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-COLtDXCi.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 LSe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function BSe(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 Sw={exports:{}},wh={};/**
 * @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 PD;function J8(){if(PD)return wh;PD=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 wh.Fragment=e,wh.jsx=r,wh.jsxs=r,wh}var AD;function Q8(){return AD||(AD=1,Sw.exports=J8()),Sw.exports}var g=Q8(),Ew={exports:{}},nr={};/**
 * @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 RD;function Z8(){if(RD)return nr;RD=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 D(){}D.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 D;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 R(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 R(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 Y(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,pe){var ce=typeof B;(ce==="undefined"||ce==="boolean")&&(B=null);var Re=!1;if(B===null)Re=!0;else switch(ce){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(B.$$typeof){case t:case e:Re=!0;break;case f:return Re=B._init,F(Re(B._payload),K,ae,te,pe)}}if(Re)return pe=pe(B),Re=te===""?"."+U(B,0):te,C(pe)?(ae="",Re!=null&&(ae=Re.replace(q,"$&/")+"/"),F(pe,K,ae,"",function(xe){return xe})):pe!=null&&(L(pe)&&(pe=N(pe,ae+(pe.key==null||B&&B.key===pe.key?"":(""+pe.key).replace(q,"$&/")+"/")+Re)),K.push(pe)),1;Re=0;var He=te===""?".":te+":";if(C(B))for(var ie=0;ie<B.length;ie++)te=B[ie],ce=He+U(te,ie),Re+=F(te,K,ae,ce,pe);else if(ie=_(B),typeof ie=="function")for(B=ie.call(B),ie=0;!(te=B.next()).done;)te=te.value,ce=He+U(te,ie++),Re+=F(te,K,ae,ce,pe);else if(ce==="object"){if(typeof B.then=="function")return F(Y(B),K,ae,te,pe);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 Re}function X(B,K,ae){if(B==null)return B;var te=[],pe=0;return F(B,te,"","",function(ce){return K.call(ae,ce,pe++)}),te}function J(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 ee=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}},H={map:X,forEach:function(B,K,ae){X(B,function(){K.apply(this,arguments)},ae)},count:function(B){var K=0;return X(B,function(){K++}),K},toArray:function(B){return X(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 nr.Activity=h,nr.Children=H,nr.Component=T,nr.Fragment=r,nr.Profiler=a,nr.PureComponent=P,nr.StrictMode=n,nr.Suspense=u,nr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,nr.__COMPILER_RUNTIME={__proto__:null,c:function(B){return I.H.useMemoCache(B)}},nr.cache=function(B){return function(){return B.apply(null,arguments)}},nr.cacheSignal=function(){return null},nr.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),pe=B.key;if(K!=null)for(ce in K.key!==void 0&&(pe=""+K.key),K)!x.call(K,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&K.ref===void 0||(te[ce]=K[ce]);var ce=arguments.length-2;if(ce===1)te.children=ae;else if(1<ce){for(var Re=Array(ce),He=0;He<ce;He++)Re[He]=arguments[He+2];te.children=Re}return R(B.type,pe,te)},nr.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},nr.createElement=function(B,K,ae){var te,pe={},ce=null;if(K!=null)for(te in K.key!==void 0&&(ce=""+K.key),K)x.call(K,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(pe[te]=K[te]);var Re=arguments.length-2;if(Re===1)pe.children=ae;else if(1<Re){for(var He=Array(Re),ie=0;ie<Re;ie++)He[ie]=arguments[ie+2];pe.children=He}if(B&&B.defaultProps)for(te in Re=B.defaultProps,Re)pe[te]===void 0&&(pe[te]=Re[te]);return R(B,ce,pe)},nr.createRef=function(){return{current:null}},nr.forwardRef=function(B){return{$$typeof:c,render:B}},nr.isValidElement=L,nr.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:J}},nr.memo=function(B,K){return{$$typeof:d,type:B,compare:K===void 0?null:K}},nr.startTransition=function(B){var K=I.T,ae={};I.T=ae;try{var te=B(),pe=I.S;pe!==null&&pe(ae,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(O,ee)}catch(ce){ee(ce)}finally{K!==null&&ae.types!==null&&(K.types=ae.types),I.T=K}},nr.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},nr.use=function(B){return I.H.use(B)},nr.useActionState=function(B,K,ae){return I.H.useActionState(B,K,ae)},nr.useCallback=function(B,K){return I.H.useCallback(B,K)},nr.useContext=function(B){return I.H.useContext(B)},nr.useDebugValue=function(){},nr.useDeferredValue=function(B,K){return I.H.useDeferredValue(B,K)},nr.useEffect=function(B,K){return I.H.useEffect(B,K)},nr.useEffectEvent=function(B){return I.H.useEffectEvent(B)},nr.useId=function(){return I.H.useId()},nr.useImperativeHandle=function(B,K,ae){return I.H.useImperativeHandle(B,K,ae)},nr.useInsertionEffect=function(B,K){return I.H.useInsertionEffect(B,K)},nr.useLayoutEffect=function(B,K){return I.H.useLayoutEffect(B,K)},nr.useMemo=function(B,K){return I.H.useMemo(B,K)},nr.useOptimistic=function(B,K){return I.H.useOptimistic(B,K)},nr.useReducer=function(B,K,ae){return I.H.useReducer(B,K,ae)},nr.useRef=function(B){return I.H.useRef(B)},nr.useState=function(B){return I.H.useState(B)},nr.useSyncExternalStore=function(B,K,ae){return I.H.useSyncExternalStore(B,K,ae)},nr.useTransition=function(){return I.H.useTransition()},nr.version="19.2.0",nr}var DD;function ox(){return DD||(DD=1,Ew.exports=Z8()),Ew.exports}var v=ox();const Ct=Sg(v);var Tw={exports:{}},Sh={},Cw={exports:{}},xw={};/**
 * @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 OD;function eV(){return OD||(OD=1,(function(t){function e(F,X){var J=F.length;F.push(X);e:for(;0<J;){var ee=J-1>>>1,H=F[ee];if(0<a(H,X))F[ee]=X,F[J]=H,J=ee;else break e}}function r(F){return F.length===0?null:F[0]}function n(F){if(F.length===0)return null;var X=F[0],J=F.pop();if(J!==X){F[0]=J;e:for(var ee=0,H=F.length,B=H>>>1;ee<B;){var K=2*(ee+1)-1,ae=F[K],te=K+1,pe=F[te];if(0>a(ae,J))te<H&&0>a(pe,ae)?(F[ee]=pe,F[te]=J,ee=te):(F[ee]=ae,F[K]=J,ee=K);else if(te<H&&0>a(pe,J))F[ee]=pe,F[te]=J,ee=te;else break e}}return X}function a(F,X){var J=F.sortIndex-X.sortIndex;return J!==0?J:F.id-X.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,D=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;function A(F){for(var X=r(d);X!==null;){if(X.callback===null)n(d);else if(X.startTime<=F)n(d),X.sortIndex=X.expirationTime,e(u,X);else break;X=r(d)}}function C(F){if(b=!1,A(F),!w)if(r(u)!==null)w=!0,O||(O=!0,j());else{var X=r(d);X!==null&&Y(C,X.startTime-F)}}var O=!1,I=-1,x=5,R=-1;function N(){return E?!0:!(t.unstable_now()-R<x)}function L(){if(E=!1,O){var F=t.unstable_now();R=F;var X=!0;try{e:{w=!1,b&&(b=!1,D(I),I=-1),_=!0;var J=m;try{t:{for(A(F),h=r(u);h!==null&&!(h.expirationTime>F&&N());){var ee=h.callback;if(typeof ee=="function"){h.callback=null,m=h.priorityLevel;var H=ee(h.expirationTime<=F);if(F=t.unstable_now(),typeof H=="function"){h.callback=H,A(F),X=!0;break t}h===r(u)&&n(u),A(F)}else n(u);h=r(u)}if(h!==null)X=!0;else{var B=r(d);B!==null&&Y(C,B.startTime-F),X=!1}}break e}finally{h=null,m=J,_=!1}X=void 0}}finally{X?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 Y(F,X){I=T(function(){F(t.unstable_now())},X)}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 X=3;break;default:X=m}var J=m;m=X;try{return F()}finally{m=J}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(F,X){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var J=m;m=F;try{return X()}finally{m=J}},t.unstable_scheduleCallback=function(F,X,J){var ee=t.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ee+J:ee):J=ee,F){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=J+H,F={id:f++,callback:X,priorityLevel:F,startTime:J,expirationTime:H,sortIndex:-1},J>ee?(F.sortIndex=J,e(d,F),r(u)===null&&F===r(d)&&(b?(D(I),I=-1):b=!0,Y(C,J-ee))):(F.sortIndex=H,e(u,F),w||_||(w=!0,O||(O=!0,j()))),F},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(F){var X=m;return function(){var J=m;m=X;try{return F.apply(this,arguments)}finally{m=J}}}})(xw)),xw}var ND;function tV(){return ND||(ND=1,Cw.exports=eV()),Cw.exports}var Pw={exports:{}},Ma={};/**
 * @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 ID;function rV(){if(ID)return Ma;ID=1;var t=ox();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 Ma.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Ma.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)},Ma.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()}},Ma.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))},Ma.prefetchDNS=function(u){typeof u=="string"&&n.d.D(u)},Ma.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})}},Ma.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)},Ma.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})}},Ma.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)},Ma.requestFormReset=function(u){n.d.r(u)},Ma.unstable_batchedUpdates=function(u,d){return u(d)},Ma.useFormState=function(u,d,f){return o.H.useFormState(u,d,f)},Ma.useFormStatus=function(){return o.H.useHostTransitionStatus()},Ma.version="19.2.0",Ma}var MD;function e3(){if(MD)return Pw.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(),Pw.exports=rV(),Pw.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 jD;function nV(){if(jD)return Sh;jD=1;var t=tV(),e=ox(),r=e3();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"),D=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"),R=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 R:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case P:return s.displayName||"Context";case D: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 Y=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},ee=[],H=-1;function B(s){return{current:s}}function K(s){0>H||(s.current=ee[H],ee[H]=null,H--)}function ae(s,l){H++,ee[H]=s.current,s.current=l}var te=B(null),pe=B(null),ce=B(null),Re=B(null);function He(s,l){switch(ae(ce,l),ae(pe,s),ae(te,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?J2(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=J2(l),s=Q2(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}K(te),ae(te,s)}function ie(){K(te),K(pe),K(ce)}function xe(s){s.memoizedState!==null&&ae(Re,s);var l=te.current,p=Q2(l,s.type);l!==p&&(ae(pe,s),ae(te,p))}function re(s){pe.current===s&&(K(te),K(pe)),Re.current===s&&(K(Re),vh._currentValue=J)}var G,ve;function Oe(s){if(G===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);G=l&&l[1]||"",ve=-1<p.stack.indexOf(`
    at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+G+s+ve}var he=!1;function Ce(s,l){if(!s||he)return"";he=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(l){var We=function(){throw Error()};if(Object.defineProperty(We.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(We,[])}catch(Ie){var Ae=Ie}Reflect.construct(s,[],We)}else{try{We.call()}catch(Ie){Ae=Ie}s.call(We.prototype)}}else{try{throw Error()}catch(Ie){Ae=Ie}(We=s())&&typeof We.catch=="function"&&We.catch(function(){})}}catch(Ie){if(Ie&&Ae&&typeof Ie.stack=="string")return[Ie.stack,Ae.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 se=M.split(`
`),Ee=V.split(`
`);for(k=y=0;y<se.length&&!se[y].includes("DetermineComponentFrameRoot");)y++;for(;k<Ee.length&&!Ee[k].includes("DetermineComponentFrameRoot");)k++;if(y===se.length||k===Ee.length)for(y=se.length-1,k=Ee.length-1;1<=y&&0<=k&&se[y]!==Ee[k];)k--;for(;1<=y&&0<=k;y--,k--)if(se[y]!==Ee[k]){if(y!==1||k!==1)do if(y--,k--,0>k||se[y]!==Ee[k]){var Fe=`
`+se[y].replace(" at new "," at ");return s.displayName&&Fe.includes("<anonymous>")&&(Fe=Fe.replace("<anonymous>",s.displayName)),Fe}while(1<=y&&0<=k);break}}}finally{he=!1,Error.prepareStackTrace=p}return(p=s?s.displayName||s.name:"")?Oe(p):""}function st(s,l){switch(s.tag){case 26:case 27:case 5:return Oe(s.type);case 16:return Oe("Lazy");case 13:return s.child!==l&&l!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return Ce(s.type,!1);case 11:return Ce(s.type.render,!1);case 1:return Ce(s.type,!0);case 31:return Oe("Activity");default:return""}}function Ne(s){try{var l="",p=null;do l+=st(s,p),p=s,s=s.return;while(s);return l}catch(y){return`
Error generating stack: `+y.message+`
`+y.stack}}var St=Object.prototype.hasOwnProperty,at=t.unstable_scheduleCallback,Ke=t.unstable_cancelCallback,it=t.unstable_shouldYield,mt=t.unstable_requestPaint,Je=t.unstable_now,ue=t.unstable_getCurrentPriorityLevel,Be=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,ot=t.unstable_NormalPriority,Pt=t.unstable_LowPriority,Ft=t.unstable_IdlePriority,Me=t.log,tt=t.unstable_setDisableYieldValue,rt=null,be=null;function lt(s){if(typeof Me=="function"&&tt(s),be&&typeof be.setStrictMode=="function")try{be.setStrictMode(rt,s)}catch{}}var yt=Math.clz32?Math.clz32:ur,tr=Math.log,Or=Math.LN2;function ur(s){return s>>>=0,s===0?32:31-(tr(s)/Or|0)|0}var dr=256,fn=262144,Z=4194304;function fe(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 ge(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=fe(y):(M&=V,M!==0?k=fe(M):p||(p=V&~s,p!==0&&(k=fe(p))))):(V=y&~S,V!==0?k=fe(V):M!==0?k=fe(M):p||(p=y&~s,p!==0&&(k=fe(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 Pe(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function De(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 W(){var s=Z;return Z<<=1,(Z&62914560)===0&&(Z=4194304),s}function $(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 ct(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,se=s.expirationTimes,Ee=s.hiddenUpdates;for(p=M&~p;0<p;){var Fe=31-yt(p),We=1<<Fe;V[Fe]=0,se[Fe]=-1;var Ae=Ee[Fe];if(Ae!==null)for(Ee[Fe]=null,Fe=0;Fe<Ae.length;Fe++){var Ie=Ae[Fe];Ie!==null&&(Ie.lane&=-536870913)}p&=~We}y!==0&&Nt(s,y,0),S!==0&&k===0&&s.tag!==0&&(s.suspendedLanes|=S&~(M&~l))}function Nt(s,l,p){s.pendingLanes|=l,s.suspendedLanes&=~l;var y=31-yt(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-yt(p),k=1<<y;k&l|s[y]&l&&(s[y]|=l),p&=~k}}function Rt(s,l){var p=l&-l;return p=(p&42)!==0?1:mr(p),(p&(s.suspendedLanes|l))!==0?0:p}function mr(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 Kr(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ge(){var s=X.p;return s!==0?s:(s=window.event,s===void 0?32:kD(s.type))}function Gt(s,l){var p=X.p;try{return X.p=s,l()}finally{X.p=p}}var xt=Math.random().toString(36).slice(2),qt="__reactFiber$"+xt,Ot="__reactProps$"+xt,An="__reactContainer$"+xt,Cn="__reactEvents$"+xt,hn="__reactListeners$"+xt,xn="__reactHandles$"+xt,Vi="__reactResources$"+xt,nn="__reactMarker$"+xt;function ua(s){delete s[qt],delete s[Ot],delete s[Cn],delete s[hn],delete s[xn]}function mn(s){var l=s[qt];if(l)return l;for(var p=s.parentNode;p;){if(l=p[An]||p[qt]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(s=iD(s);s!==null;){if(p=s[qt])return p;s=iD(s)}return l}s=p,p=s.parentNode}return null}function xs(s){if(s=s[qt]||s[An]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function ki(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function ta(s){var l=s[Vi];return l||(l=s[Vi]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function gn(s){s[nn]=!0}var Ps=new Set,As={};function Rs(s,l){Hi(s,l),Hi(s+"Capture",l)}function Hi(s,l){for(As[s]=l,s=0;s<l.length;s++)Ps.add(l[s])}var Lp=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]*$"),kd={},wd={};function Bp(s){return St.call(wd,s)?!0:St.call(kd,s)?!1:Lp.test(s)?wd[s]=!0:(kd[s]=!0,!1)}function nc(s,l,p){if(Bp(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 fo(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 va(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 _a(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Fa(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Yc(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 vu(s){if(!s._valueTracker){var l=Fa(s)?"checked":"value";s._valueTracker=Yc(s,l,""+s[l])}}function Xc(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var p=l.getValue(),y="";return s&&(y=Fa(s)?s.checked?"true":"false":s.value),s=y,s!==p?(l.setValue(s),!0):!1}function po(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 Sd=/[\n"\\]/g;function da(s){return s.replace(Sd,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ho(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=""+_a(l)):s.value!==""+_a(l)&&(s.value=""+_a(l)):M!=="submit"&&M!=="reset"||s.removeAttribute("value"),l!=null?Jc(s,M,_a(l)):p!=null?Jc(s,M,_a(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=""+_a(V):s.removeAttribute("name")}function wi(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)){vu(s);return}p=p!=null?""+_a(p):"",l=l!=null?""+_a(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),vu(s)}function Jc(s,l,p){l==="number"&&po(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=""+_a(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 et(s,l,p){if(l!=null&&(l=""+_a(l),l!==s.value&&(s.value=l),p==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=p!=null?""+_a(p):""}function ut(s,l,p,y){if(l==null){if(y!=null){if(p!=null)throw Error(n(92));if(Y(y)){if(1<y.length)throw Error(n(93));y=y[0]}p=y}p==null&&(p=""),l=p}p=_a(l),s.defaultValue=p,y=s.textContent,y===p&&y!==""&&y!==null&&(s.value=y),vu(s)}function Qe(s,l){if(l){var p=s.firstChild;if(p&&p===s.lastChild&&p.nodeType===3){p.nodeValue=l;return}}s.textContent=l}var Mt=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 Ht(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||Mt.has(l)?l==="float"?s.cssFloat=p:s[l]=(""+p).trim():s[l]=p+"px"}function Nr(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&&Ht(s,k,y)}else for(var S in l)l.hasOwnProperty(S)&&Ht(s,S,l[S])}function an(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 Rn=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"]]),fa=/^[\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 Ds(s){return fa.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function ba(){}var Qc=null;function Os(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Si=null,Ei=null;function Gi(s){var l=xs(s);if(l&&(s=l.stateNode)){var p=s[Ot]||null;e:switch(s=l.stateNode,l.type){case"input":if(ho(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="'+da(""+l)+'"][type="radio"]'),l=0;l<p.length;l++){var y=p[l];if(y!==s&&y.form===s.form){var k=y[Ot]||null;if(!k)throw Error(n(90));ho(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&&Xc(y)}break e;case"textarea":et(s,p.value,p.defaultValue);break e;case"select":l=p.value,l!=null&&_e(s,!!p.multiple,l,!1)}}}var mo=!1;function Br(s,l,p){if(mo)return s(l,p);mo=!0;try{var y=s(l);return y}finally{if(mo=!1,(Si!==null||Ei!==null)&&(Ny(),Si&&(l=Si,s=Ei,Ei=Si=null,Gi(l),s)))for(l=0;l<s.length;l++)Gi(s[l])}}function ra(s,l){var p=s.stateNode;if(p===null)return null;var y=p[Ot]||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 na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qa=!1;if(na)try{var Na={};Object.defineProperty(Na,"passive",{get:function(){qa=!0}}),window.addEventListener("test",Na,Na),window.removeEventListener("test",Na,Na)}catch{qa=!1}var aa=null,$n=null,Wi=null;function ac(){if(Wi)return Wi;var s,l=$n,p=l.length,y,k="value"in aa?aa.value:aa.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 Wi=k.slice(s,1<y?1-y:void 0)}function Ed(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 Td(){return!0}function Yg(){return!1}function Ia(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)?Td:Yg,this.isPropagationStopped=Yg,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=Td)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Td)},persist:function(){},isPersistent:Td}),l}var ic={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sc=Ia(ic),Zc=h({},ic,{view:0,detail:0}),x0=Ia(Zc),el,Q,de,me=h({},Zc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:za,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!==de&&(de&&s.type==="mousemove"?(el=s.screenX-de.screenX,Q=s.screenY-de.screenY):Q=el=0,de=s),el)},movementY:function(s){return"movementY"in s?s.movementY:Q}}),Le=Ia(me),we=h({},me,{dataTransfer:0}),Ve=Ia(we),Ze=h({},Zc,{relatedTarget:0}),bt=Ia(Ze),Er=h({},ic,{animationName:0,elapsedTime:0,pseudoElement:0}),sn=Ia(Er),fr=h({},ic,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),on=Ia(fr),Ns=h({},ic,{data:0}),oc=Ia(Ns),_u={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ki={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"},Cd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xg(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=Cd[s])?!!l[s]:!1}function za(){return Xg}var tl=h({},Zc,{key:function(s){if(s.key){var l=_u[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=Ed(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Ki[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:za,charCode:function(s){return s.type==="keypress"?Ed(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Ed(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Jg=Ia(tl),P0=h({},me,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),r1=Ia(P0),d$=h({},Zc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:za}),f$=Ia(d$),p$=h({},ic,{propertyName:0,elapsedTime:0,pseudoElement:0}),h$=Ia(p$),m$=h({},me,{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}),g$=Ia(m$),y$=h({},ic,{newState:0,oldState:0}),v$=Ia(y$),_$=[9,13,27,32],A0=na&&"CompositionEvent"in window,Up=null;na&&"documentMode"in document&&(Up=document.documentMode);var b$=na&&"TextEvent"in window&&!Up,n1=na&&(!A0||Up&&8<Up&&11>=Up),a1=" ",i1=!1;function s1(s,l){switch(s){case"keyup":return _$.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function o1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var xd=!1;function k$(s,l){switch(s){case"compositionend":return o1(l);case"keypress":return l.which!==32?null:(i1=!0,a1);case"textInput":return s=l.data,s===a1&&i1?null:s;default:return null}}function w$(s,l){if(xd)return s==="compositionend"||!A0&&s1(s,l)?(s=ac(),Wi=$n=aa=null,xd=!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 n1&&l.locale!=="ko"?null:l.data;default:return null}}var S$={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 c1(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!S$[s.type]:l==="textarea"}function l1(s,l,p,y){Si?Ei?Ei.push(y):Ei=[y]:Si=y,l=Fy(l,"onChange"),0<l.length&&(p=new sc("onChange","change",null,p,y),s.push({event:p,listeners:l}))}var Fp=null,qp=null;function E$(s){H2(s,0)}function Qg(s){var l=ki(s);if(Xc(l))return s}function u1(s,l){if(s==="change")return l}var d1=!1;if(na){var R0;if(na){var D0="oninput"in document;if(!D0){var f1=document.createElement("div");f1.setAttribute("oninput","return;"),D0=typeof f1.oninput=="function"}R0=D0}else R0=!1;d1=R0&&(!document.documentMode||9<document.documentMode)}function p1(){Fp&&(Fp.detachEvent("onpropertychange",h1),qp=Fp=null)}function h1(s){if(s.propertyName==="value"&&Qg(qp)){var l=[];l1(l,qp,s,Os(s)),Br(E$,l)}}function T$(s,l,p){s==="focusin"?(p1(),Fp=l,qp=p,Fp.attachEvent("onpropertychange",h1)):s==="focusout"&&p1()}function C$(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Qg(qp)}function x$(s,l){if(s==="click")return Qg(l)}function P$(s,l){if(s==="input"||s==="change")return Qg(l)}function A$(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var Ti=typeof Object.is=="function"?Object.is:A$;function zp(s,l){if(Ti(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(!St.call(l,k)||!Ti(s[k],l[k]))return!1}return!0}function m1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function g1(s,l){var p=m1(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=m1(p)}}function y1(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?y1(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function v1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=po(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=po(s.document)}return l}function O0(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 R$=na&&"documentMode"in document&&11>=document.documentMode,Pd=null,N0=null,$p=null,I0=!1;function _1(s,l,p){var y=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;I0||Pd==null||Pd!==po(y)||(y=Pd,"selectionStart"in y&&O0(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}),$p&&zp($p,y)||($p=y,y=Fy(N0,"onSelect"),0<y.length&&(l=new sc("onSelect","select",null,l,p),s.push({event:l,listeners:y}),l.target=Pd)))}function bu(s,l){var p={};return p[s.toLowerCase()]=l.toLowerCase(),p["Webkit"+s]="webkit"+l,p["Moz"+s]="moz"+l,p}var Ad={animationend:bu("Animation","AnimationEnd"),animationiteration:bu("Animation","AnimationIteration"),animationstart:bu("Animation","AnimationStart"),transitionrun:bu("Transition","TransitionRun"),transitionstart:bu("Transition","TransitionStart"),transitioncancel:bu("Transition","TransitionCancel"),transitionend:bu("Transition","TransitionEnd")},M0={},b1={};na&&(b1=document.createElement("div").style,"AnimationEvent"in window||(delete Ad.animationend.animation,delete Ad.animationiteration.animation,delete Ad.animationstart.animation),"TransitionEvent"in window||delete Ad.transitionend.transition);function ku(s){if(M0[s])return M0[s];if(!Ad[s])return s;var l=Ad[s],p;for(p in l)if(l.hasOwnProperty(p)&&p in b1)return M0[s]=l[p];return s}var k1=ku("animationend"),w1=ku("animationiteration"),S1=ku("animationstart"),D$=ku("transitionrun"),O$=ku("transitionstart"),N$=ku("transitioncancel"),E1=ku("transitionend"),T1=new Map,j0="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(" ");j0.push("scrollEnd");function Is(s,l){T1.set(s,l),Rs(l,[s])}var Zg=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}},Yi=[],Rd=0,L0=0;function ey(){for(var s=Rd,l=L0=Rd=0;l<s;){var p=Yi[l];Yi[l++]=null;var y=Yi[l];Yi[l++]=null;var k=Yi[l];Yi[l++]=null;var S=Yi[l];if(Yi[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&&C1(p,k,S)}}function ty(s,l,p,y){Yi[Rd++]=s,Yi[Rd++]=l,Yi[Rd++]=p,Yi[Rd++]=y,L0|=y,s.lanes|=y,s=s.alternate,s!==null&&(s.lanes|=y)}function B0(s,l,p,y){return ty(s,l,p,y),ry(s)}function wu(s,l){return ty(s,null,null,l),ry(s)}function C1(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-yt(p),s=S.hiddenUpdates,y=s[k],y===null?s[k]=[l]:y.push(l),l.lane=p|536870912),S):null}function ry(s){if(50<dh)throw dh=0,Wk=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Dd={};function I$(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 Ci(s,l,p,y){return new I$(s,l,p,y)}function U0(s){return s=s.prototype,!(!s||!s.isReactComponent)}function cc(s,l){var p=s.alternate;return p===null?(p=Ci(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 x1(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 ny(s,l,p,y,k,S){var M=0;if(y=s,typeof s=="function")U0(s)&&(M=1);else if(typeof s=="string")M=U8(s,p,te.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case R:return s=Ci(31,p,l,k),s.elementType=R,s.lanes=S,s;case b:return Su(p.children,k,S,l);case E:M=8,k|=24;break;case T:return s=Ci(12,p,l,k|2),s.elementType=T,s.lanes=S,s;case C:return s=Ci(13,p,l,k),s.elementType=C,s.lanes=S,s;case O:return s=Ci(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 D: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=Ci(M,p,l,k),l.elementType=s,l.type=y,l.lanes=S,l}function Su(s,l,p,y){return s=Ci(7,s,y,l),s.lanes=p,s}function F0(s,l,p){return s=Ci(6,s,null,l),s.lanes=p,s}function P1(s){var l=Ci(18,null,null,0);return l.stateNode=s,l}function q0(s,l,p){return l=Ci(4,s.children!==null?s.children:[],s.key,l),l.lanes=p,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var A1=new WeakMap;function Xi(s,l){if(typeof s=="object"&&s!==null){var p=A1.get(s);return p!==void 0?p:(l={value:s,source:l,stack:Ne(l)},A1.set(s,l),l)}return{value:s,source:l,stack:Ne(l)}}var Od=[],Nd=0,ay=null,Vp=0,Ji=[],Qi=0,rl=null,go=1,yo="";function lc(s,l){Od[Nd++]=Vp,Od[Nd++]=ay,ay=s,Vp=l}function R1(s,l,p){Ji[Qi++]=go,Ji[Qi++]=yo,Ji[Qi++]=rl,rl=s;var y=go;s=yo;var k=32-yt(y)-1;y&=~(1<<k),p+=1;var S=32-yt(l)+k;if(30<S){var M=k-k%5;S=(y&(1<<M)-1).toString(32),y>>=M,k-=M,go=1<<32-yt(l)+k|p<<k|y,yo=S+s}else go=1<<S|p<<k|y,yo=s}function z0(s){s.return!==null&&(lc(s,1),R1(s,1,0))}function $0(s){for(;s===ay;)ay=Od[--Nd],Od[Nd]=null,Vp=Od[--Nd],Od[Nd]=null;for(;s===rl;)rl=Ji[--Qi],Ji[Qi]=null,yo=Ji[--Qi],Ji[Qi]=null,go=Ji[--Qi],Ji[Qi]=null}function D1(s,l){Ji[Qi++]=go,Ji[Qi++]=yo,Ji[Qi++]=rl,go=l.id,yo=l.overflow,rl=s}var ka=null,yn=null,Tr=!1,nl=null,Zi=!1,V0=Error(n(519));function al(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Hp(Xi(l,s)),V0}function O1(s){var l=s.stateNode,p=s.type,y=s.memoizedProps;switch(l[qt]=s,l[Ot]=y,p){case"dialog":vr("cancel",l),vr("close",l);break;case"iframe":case"object":case"embed":vr("load",l);break;case"video":case"audio":for(p=0;p<ph.length;p++)vr(ph[p],l);break;case"source":vr("error",l);break;case"img":case"image":case"link":vr("error",l),vr("load",l);break;case"details":vr("toggle",l);break;case"input":vr("invalid",l),wi(l,y.value,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name,!0);break;case"select":vr("invalid",l);break;case"textarea":vr("invalid",l),ut(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||Y2(l.textContent,p)?(y.popover!=null&&(vr("beforetoggle",l),vr("toggle",l)),y.onScroll!=null&&vr("scroll",l),y.onScrollEnd!=null&&vr("scrollend",l),y.onClick!=null&&(l.onclick=ba),l=!0):l=!1,l||al(s,!0)}function N1(s){for(ka=s.return;ka;)switch(ka.tag){case 5:case 31:case 13:Zi=!1;return;case 27:case 3:Zi=!0;return;default:ka=ka.return}}function Id(s){if(s!==ka)return!1;if(!Tr)return N1(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")||cw(s.type,s.memoizedProps)),p=!p),p&&yn&&al(s),N1(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));yn=aD(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));yn=aD(s)}else l===27?(l=yn,vl(s.type)?(s=pw,pw=null,yn=s):yn=l):yn=ka?ts(s.stateNode.nextSibling):null;return!0}function Eu(){yn=ka=null,Tr=!1}function H0(){var s=nl;return s!==null&&(ri===null?ri=s:ri.push.apply(ri,s),nl=null),s}function Hp(s){nl===null?nl=[s]:nl.push(s)}var G0=B(null),Tu=null,uc=null;function il(s,l,p){ae(G0,l._currentValue),l._currentValue=p}function dc(s){s._currentValue=G0.current,K(G0)}function W0(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 K0(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 se=0;se<l.length;se++)if(V.context===l[se]){S.lanes|=p,V=S.alternate,V!==null&&(V.lanes|=p),W0(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),W0(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 Md(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;Ti(k.pendingProps.value,M.value)||(s!==null?s.push(V):s=[V])}}else if(k===Re.current){if(M=k.alternate,M===null)throw Error(n(387));M.memoizedState.memoizedState!==k.memoizedState.memoizedState&&(s!==null?s.push(vh):s=[vh])}k=k.return}s!==null&&K0(l,s,p,y),l.flags|=262144}function iy(s){for(s=s.firstContext;s!==null;){if(!Ti(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Cu(s){Tu=s,uc=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function wa(s){return I1(Tu,s)}function sy(s,l){return Tu===null&&Cu(s),I1(s,l)}function I1(s,l){var p=l._currentValue;if(l={context:l,memoizedValue:p,next:null},uc===null){if(s===null)throw Error(n(308));uc=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else uc=uc.next=l;return p}var M$=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()})}},j$=t.unstable_scheduleCallback,L$=t.unstable_NormalPriority,Vn={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Y0(){return{controller:new M$,data:new Map,refCount:0}}function Gp(s){s.refCount--,s.refCount===0&&j$(L$,function(){s.controller.abort()})}var Wp=null,X0=0,jd=0,Ld=null;function B$(s,l){if(Wp===null){var p=Wp=[];X0=0,jd=Zk(),Ld={status:"pending",value:void 0,then:function(y){p.push(y)}}}return X0++,l.then(M1,M1),l}function M1(){if(--X0===0&&Wp!==null){Ld!==null&&(Ld.status="fulfilled");var s=Wp;Wp=null,jd=0,Ld=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function U$(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 j1=F.S;F.S=function(s,l){_2=Je(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&B$(s,l),j1!==null&&j1(s,l)};var xu=B(null);function J0(){var s=xu.current;return s!==null?s:cn.pooledCache}function oy(s,l){l===null?ae(xu,xu.current):ae(xu,l.pool)}function L1(){var s=J0();return s===null?null:{parent:Vn._currentValue,pool:s}}var Bd=Error(n(460)),Q0=Error(n(474)),cy=Error(n(542)),ly={then:function(){}};function B1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function U1(s,l,p){switch(p=s[p],p===void 0?s.push(l):p!==l&&(l.then(ba,ba),l=p),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,q1(s),s;default:if(typeof l.status=="string")l.then(ba,ba);else{if(s=cn,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,q1(s),s}throw Au=l,Bd}}function Pu(s){try{var l=s._init;return l(s._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Au=p,Bd):p}}var Au=null;function F1(){if(Au===null)throw Error(n(459));var s=Au;return Au=null,s}function q1(s){if(s===Bd||s===cy)throw Error(n(483))}var Ud=null,Kp=0;function uy(s){var l=Kp;return Kp+=1,Ud===null&&(Ud=[]),U1(Ud,s,l)}function Yp(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function dy(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 z1(s){function l(ye,le){if(s){var Se=ye.deletions;Se===null?(ye.deletions=[le],ye.flags|=16):Se.push(le)}}function p(ye,le){if(!s)return null;for(;le!==null;)l(ye,le),le=le.sibling;return null}function y(ye){for(var le=new Map;ye!==null;)ye.key!==null?le.set(ye.key,ye):le.set(ye.index,ye),ye=ye.sibling;return le}function k(ye,le){return ye=cc(ye,le),ye.index=0,ye.sibling=null,ye}function S(ye,le,Se){return ye.index=Se,s?(Se=ye.alternate,Se!==null?(Se=Se.index,Se<le?(ye.flags|=67108866,le):Se):(ye.flags|=67108866,le)):(ye.flags|=1048576,le)}function M(ye){return s&&ye.alternate===null&&(ye.flags|=67108866),ye}function V(ye,le,Se,ze){return le===null||le.tag!==6?(le=F0(Se,ye.mode,ze),le.return=ye,le):(le=k(le,Se),le.return=ye,le)}function se(ye,le,Se,ze){var zt=Se.type;return zt===b?Fe(ye,le,Se.props.children,ze,Se.key):le!==null&&(le.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===x&&Pu(zt)===le.type)?(le=k(le,Se.props),Yp(le,Se),le.return=ye,le):(le=ny(Se.type,Se.key,Se.props,null,ye.mode,ze),Yp(le,Se),le.return=ye,le)}function Ee(ye,le,Se,ze){return le===null||le.tag!==4||le.stateNode.containerInfo!==Se.containerInfo||le.stateNode.implementation!==Se.implementation?(le=q0(Se,ye.mode,ze),le.return=ye,le):(le=k(le,Se.children||[]),le.return=ye,le)}function Fe(ye,le,Se,ze,zt){return le===null||le.tag!==7?(le=Su(Se,ye.mode,ze,zt),le.return=ye,le):(le=k(le,Se),le.return=ye,le)}function We(ye,le,Se){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return le=F0(""+le,ye.mode,Se),le.return=ye,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case _:return Se=ny(le.type,le.key,le.props,null,ye.mode,Se),Yp(Se,le),Se.return=ye,Se;case w:return le=q0(le,ye.mode,Se),le.return=ye,le;case x:return le=Pu(le),We(ye,le,Se)}if(Y(le)||j(le))return le=Su(le,ye.mode,Se,null),le.return=ye,le;if(typeof le.then=="function")return We(ye,uy(le),Se);if(le.$$typeof===P)return We(ye,sy(ye,le),Se);dy(ye,le)}return null}function Ae(ye,le,Se,ze){var zt=le!==null?le.key:null;if(typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint")return zt!==null?null:V(ye,le,""+Se,ze);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case _:return Se.key===zt?se(ye,le,Se,ze):null;case w:return Se.key===zt?Ee(ye,le,Se,ze):null;case x:return Se=Pu(Se),Ae(ye,le,Se,ze)}if(Y(Se)||j(Se))return zt!==null?null:Fe(ye,le,Se,ze,null);if(typeof Se.then=="function")return Ae(ye,le,uy(Se),ze);if(Se.$$typeof===P)return Ae(ye,le,sy(ye,Se),ze);dy(ye,Se)}return null}function Ie(ye,le,Se,ze,zt){if(typeof ze=="string"&&ze!==""||typeof ze=="number"||typeof ze=="bigint")return ye=ye.get(Se)||null,V(le,ye,""+ze,zt);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case _:return ye=ye.get(ze.key===null?Se:ze.key)||null,se(le,ye,ze,zt);case w:return ye=ye.get(ze.key===null?Se:ze.key)||null,Ee(le,ye,ze,zt);case x:return ze=Pu(ze),Ie(ye,le,Se,ze,zt)}if(Y(ze)||j(ze))return ye=ye.get(Se)||null,Fe(le,ye,ze,zt,null);if(typeof ze.then=="function")return Ie(ye,le,Se,uy(ze),zt);if(ze.$$typeof===P)return Ie(ye,le,Se,sy(le,ze),zt);dy(le,ze)}return null}function Dt(ye,le,Se,ze){for(var zt=null,Ir=null,Lt=le,sr=le=0,wr=null;Lt!==null&&sr<Se.length;sr++){Lt.index>sr?(wr=Lt,Lt=null):wr=Lt.sibling;var Mr=Ae(ye,Lt,Se[sr],ze);if(Mr===null){Lt===null&&(Lt=wr);break}s&&Lt&&Mr.alternate===null&&l(ye,Lt),le=S(Mr,le,sr),Ir===null?zt=Mr:Ir.sibling=Mr,Ir=Mr,Lt=wr}if(sr===Se.length)return p(ye,Lt),Tr&&lc(ye,sr),zt;if(Lt===null){for(;sr<Se.length;sr++)Lt=We(ye,Se[sr],ze),Lt!==null&&(le=S(Lt,le,sr),Ir===null?zt=Lt:Ir.sibling=Lt,Ir=Lt);return Tr&&lc(ye,sr),zt}for(Lt=y(Lt);sr<Se.length;sr++)wr=Ie(Lt,ye,sr,Se[sr],ze),wr!==null&&(s&&wr.alternate!==null&&Lt.delete(wr.key===null?sr:wr.key),le=S(wr,le,sr),Ir===null?zt=wr:Ir.sibling=wr,Ir=wr);return s&&Lt.forEach(function(Sl){return l(ye,Sl)}),Tr&&lc(ye,sr),zt}function Kt(ye,le,Se,ze){if(Se==null)throw Error(n(151));for(var zt=null,Ir=null,Lt=le,sr=le=0,wr=null,Mr=Se.next();Lt!==null&&!Mr.done;sr++,Mr=Se.next()){Lt.index>sr?(wr=Lt,Lt=null):wr=Lt.sibling;var Sl=Ae(ye,Lt,Mr.value,ze);if(Sl===null){Lt===null&&(Lt=wr);break}s&&Lt&&Sl.alternate===null&&l(ye,Lt),le=S(Sl,le,sr),Ir===null?zt=Sl:Ir.sibling=Sl,Ir=Sl,Lt=wr}if(Mr.done)return p(ye,Lt),Tr&&lc(ye,sr),zt;if(Lt===null){for(;!Mr.done;sr++,Mr=Se.next())Mr=We(ye,Mr.value,ze),Mr!==null&&(le=S(Mr,le,sr),Ir===null?zt=Mr:Ir.sibling=Mr,Ir=Mr);return Tr&&lc(ye,sr),zt}for(Lt=y(Lt);!Mr.done;sr++,Mr=Se.next())Mr=Ie(Lt,ye,sr,Mr.value,ze),Mr!==null&&(s&&Mr.alternate!==null&&Lt.delete(Mr.key===null?sr:Mr.key),le=S(Mr,le,sr),Ir===null?zt=Mr:Ir.sibling=Mr,Ir=Mr);return s&&Lt.forEach(function(X8){return l(ye,X8)}),Tr&&lc(ye,sr),zt}function en(ye,le,Se,ze){if(typeof Se=="object"&&Se!==null&&Se.type===b&&Se.key===null&&(Se=Se.props.children),typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case _:e:{for(var zt=Se.key;le!==null;){if(le.key===zt){if(zt=Se.type,zt===b){if(le.tag===7){p(ye,le.sibling),ze=k(le,Se.props.children),ze.return=ye,ye=ze;break e}}else if(le.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===x&&Pu(zt)===le.type){p(ye,le.sibling),ze=k(le,Se.props),Yp(ze,Se),ze.return=ye,ye=ze;break e}p(ye,le);break}else l(ye,le);le=le.sibling}Se.type===b?(ze=Su(Se.props.children,ye.mode,ze,Se.key),ze.return=ye,ye=ze):(ze=ny(Se.type,Se.key,Se.props,null,ye.mode,ze),Yp(ze,Se),ze.return=ye,ye=ze)}return M(ye);case w:e:{for(zt=Se.key;le!==null;){if(le.key===zt)if(le.tag===4&&le.stateNode.containerInfo===Se.containerInfo&&le.stateNode.implementation===Se.implementation){p(ye,le.sibling),ze=k(le,Se.children||[]),ze.return=ye,ye=ze;break e}else{p(ye,le);break}else l(ye,le);le=le.sibling}ze=q0(Se,ye.mode,ze),ze.return=ye,ye=ze}return M(ye);case x:return Se=Pu(Se),en(ye,le,Se,ze)}if(Y(Se))return Dt(ye,le,Se,ze);if(j(Se)){if(zt=j(Se),typeof zt!="function")throw Error(n(150));return Se=zt.call(Se),Kt(ye,le,Se,ze)}if(typeof Se.then=="function")return en(ye,le,uy(Se),ze);if(Se.$$typeof===P)return en(ye,le,sy(ye,Se),ze);dy(ye,Se)}return typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint"?(Se=""+Se,le!==null&&le.tag===6?(p(ye,le.sibling),ze=k(le,Se),ze.return=ye,ye=ze):(p(ye,le),ze=F0(Se,ye.mode,ze),ze.return=ye,ye=ze),M(ye)):p(ye,le)}return function(ye,le,Se,ze){try{Kp=0;var zt=en(ye,le,Se,ze);return Ud=null,zt}catch(Lt){if(Lt===Bd||Lt===cy)throw Lt;var Ir=Ci(29,Lt,null,ye.mode);return Ir.lanes=ze,Ir.return=ye,Ir}finally{}}}var Ru=z1(!0),$1=z1(!1),sl=!1;function Z0(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ek(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 ol(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function cl(s,l,p){var y=s.updateQueue;if(y===null)return null;if(y=y.shared,(Ur&2)!==0){var k=y.pending;return k===null?l.next=l:(l.next=k.next,k.next=l),y.pending=l,l=ry(s),C1(s,null,p),l}return ty(s,y,l,p),ry(s)}function Xp(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 tk(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 rk=!1;function Jp(){if(rk){var s=Ld;if(s!==null)throw s}}function Qp(s,l,p,y){rk=!1;var k=s.updateQueue;sl=!1;var S=k.firstBaseUpdate,M=k.lastBaseUpdate,V=k.shared.pending;if(V!==null){k.shared.pending=null;var se=V,Ee=se.next;se.next=null,M===null?S=Ee:M.next=Ee,M=se;var Fe=s.alternate;Fe!==null&&(Fe=Fe.updateQueue,V=Fe.lastBaseUpdate,V!==M&&(V===null?Fe.firstBaseUpdate=Ee:V.next=Ee,Fe.lastBaseUpdate=se))}if(S!==null){var We=k.baseState;M=0,Fe=Ee=se=null,V=S;do{var Ae=V.lane&-536870913,Ie=Ae!==V.lane;if(Ie?(kr&Ae)===Ae:(y&Ae)===Ae){Ae!==0&&Ae===jd&&(rk=!0),Fe!==null&&(Fe=Fe.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var Dt=s,Kt=V;Ae=l;var en=p;switch(Kt.tag){case 1:if(Dt=Kt.payload,typeof Dt=="function"){We=Dt.call(en,We,Ae);break e}We=Dt;break e;case 3:Dt.flags=Dt.flags&-65537|128;case 0:if(Dt=Kt.payload,Ae=typeof Dt=="function"?Dt.call(en,We,Ae):Dt,Ae==null)break e;We=h({},We,Ae);break e;case 2:sl=!0}}Ae=V.callback,Ae!==null&&(s.flags|=64,Ie&&(s.flags|=8192),Ie=k.callbacks,Ie===null?k.callbacks=[Ae]:Ie.push(Ae))}else Ie={lane:Ae,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Fe===null?(Ee=Fe=Ie,se=We):Fe=Fe.next=Ie,M|=Ae;if(V=V.next,V===null){if(V=k.shared.pending,V===null)break;Ie=V,V=Ie.next,Ie.next=null,k.lastBaseUpdate=Ie,k.shared.pending=null}}while(!0);Fe===null&&(se=We),k.baseState=se,k.firstBaseUpdate=Ee,k.lastBaseUpdate=Fe,S===null&&(k.shared.lanes=0),pl|=M,s.lanes=M,s.memoizedState=We}}function V1(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function H1(s,l){var p=s.callbacks;if(p!==null)for(s.callbacks=null,s=0;s<p.length;s++)V1(p[s],l)}var Fd=B(null),fy=B(0);function G1(s,l){s=bc,ae(fy,s),ae(Fd,l),bc=s|l.baseLanes}function nk(){ae(fy,bc),ae(Fd,Fd.current)}function ak(){bc=fy.current,K(Fd),K(fy)}var xi=B(null),es=null;function ll(s){var l=s.alternate;ae(Ln,Ln.current&1),ae(xi,s),es===null&&(l===null||Fd.current!==null||l.memoizedState!==null)&&(es=s)}function ik(s){ae(Ln,Ln.current),ae(xi,s),es===null&&(es=s)}function W1(s){s.tag===22?(ae(Ln,Ln.current),ae(xi,s),es===null&&(es=s)):ul()}function ul(){ae(Ln,Ln.current),ae(xi,xi.current)}function Pi(s){K(xi),es===s&&(es=null),K(Ln)}var Ln=B(0);function py(s){for(var l=s;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||dw(p)||fw(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 fc=0,ir=null,Qr=null,Hn=null,hy=!1,qd=!1,Du=!1,my=0,Zp=0,zd=null,F$=0;function Dn(){throw Error(n(321))}function sk(s,l){if(l===null)return!1;for(var p=0;p<l.length&&p<s.length;p++)if(!Ti(s[p],l[p]))return!1;return!0}function ok(s,l,p,y,k,S){return fc=S,ir=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,F.H=s===null||s.memoizedState===null?RR:wk,Du=!1,S=p(y,k),Du=!1,qd&&(S=Y1(l,p,y,k)),K1(s),S}function K1(s){F.H=rh;var l=Qr!==null&&Qr.next!==null;if(fc=0,Hn=Qr=ir=null,hy=!1,Zp=0,zd=null,l)throw Error(n(300));s===null||Gn||(s=s.dependencies,s!==null&&iy(s)&&(Gn=!0))}function Y1(s,l,p,y){ir=s;var k=0;do{if(qd&&(zd=null),Zp=0,qd=!1,25<=k)throw Error(n(301));if(k+=1,Hn=Qr=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=DR,S=l(p,y)}while(qd);return S}function q$(){var s=F.H,l=s.useState()[0];return l=typeof l.then=="function"?eh(l):l,s=s.useState()[0],(Qr!==null?Qr.memoizedState:null)!==s&&(ir.flags|=1024),l}function ck(){var s=my!==0;return my=0,s}function lk(s,l,p){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~p}function uk(s){if(hy){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}hy=!1}fc=0,Hn=Qr=ir=null,qd=!1,Zp=my=0,zd=null}function $a(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Hn===null?ir.memoizedState=Hn=s:Hn=Hn.next=s,Hn}function Bn(){if(Qr===null){var s=ir.alternate;s=s!==null?s.memoizedState:null}else s=Qr.next;var l=Hn===null?ir.memoizedState:Hn.next;if(l!==null)Hn=l,Qr=s;else{if(s===null)throw ir.alternate===null?Error(n(467)):Error(n(310));Qr=s,s={memoizedState:Qr.memoizedState,baseState:Qr.baseState,baseQueue:Qr.baseQueue,queue:Qr.queue,next:null},Hn===null?ir.memoizedState=Hn=s:Hn=Hn.next=s}return Hn}function gy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function eh(s){var l=Zp;return Zp+=1,zd===null&&(zd=[]),s=U1(zd,s,l),l=ir,(Hn===null?l.memoizedState:Hn.next)===null&&(l=l.alternate,F.H=l===null||l.memoizedState===null?RR:wk),s}function yy(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return eh(s);if(s.$$typeof===P)return wa(s)}throw Error(n(438,String(s)))}function dk(s){var l=null,p=ir.updateQueue;if(p!==null&&(l=p.memoCache),l==null){var y=ir.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=gy(),ir.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 pc(s,l){return typeof l=="function"?l(s):l}function vy(s){var l=Bn();return fk(l,Qr,s)}function fk(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,se=null,Ee=l,Fe=!1;do{var We=Ee.lane&-536870913;if(We!==Ee.lane?(kr&We)===We:(fc&We)===We){var Ae=Ee.revertLane;if(Ae===0)se!==null&&(se=se.next={lane:0,revertLane:0,gesture:null,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null}),We===jd&&(Fe=!0);else if((fc&Ae)===Ae){Ee=Ee.next,Ae===jd&&(Fe=!0);continue}else We={lane:0,revertLane:Ee.revertLane,gesture:null,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null},se===null?(V=se=We,M=S):se=se.next=We,ir.lanes|=Ae,pl|=Ae;We=Ee.action,Du&&p(S,We),S=Ee.hasEagerState?Ee.eagerState:p(S,We)}else Ae={lane:We,revertLane:Ee.revertLane,gesture:Ee.gesture,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null},se===null?(V=se=Ae,M=S):se=se.next=Ae,ir.lanes|=We,pl|=We;Ee=Ee.next}while(Ee!==null&&Ee!==l);if(se===null?M=S:se.next=V,!Ti(S,s.memoizedState)&&(Gn=!0,Fe&&(p=Ld,p!==null)))throw p;s.memoizedState=S,s.baseState=M,s.baseQueue=se,y.lastRenderedState=S}return k===null&&(y.lanes=0),[s.memoizedState,y.dispatch]}function pk(s){var l=Bn(),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);Ti(S,l.memoizedState)||(Gn=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),p.lastRenderedState=S}return[S,y]}function X1(s,l,p){var y=ir,k=Bn(),S=Tr;if(S){if(p===void 0)throw Error(n(407));p=p()}else p=l();var M=!Ti((Qr||k).memoizedState,p);if(M&&(k.memoizedState=p,Gn=!0),k=k.queue,gk(Z1.bind(null,y,k,s),[s]),k.getSnapshot!==l||M||Hn!==null&&Hn.memoizedState.tag&1){if(y.flags|=2048,$d(9,{destroy:void 0},Q1.bind(null,y,k,p,l),null),cn===null)throw Error(n(349));S||(fc&127)!==0||J1(y,l,p)}return p}function J1(s,l,p){s.flags|=16384,s={getSnapshot:l,value:p},l=ir.updateQueue,l===null?(l=gy(),ir.updateQueue=l,l.stores=[s]):(p=l.stores,p===null?l.stores=[s]:p.push(s))}function Q1(s,l,p,y){l.value=p,l.getSnapshot=y,eR(l)&&tR(s)}function Z1(s,l,p){return p(function(){eR(l)&&tR(s)})}function eR(s){var l=s.getSnapshot;s=s.value;try{var p=l();return!Ti(s,p)}catch{return!0}}function tR(s){var l=wu(s,2);l!==null&&ni(l,s,2)}function hk(s){var l=$a();if(typeof s=="function"){var p=s;if(s=p(),Du){lt(!0);try{p()}finally{lt(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pc,lastRenderedState:s},l}function rR(s,l,p,y){return s.baseState=p,fk(s,Qr,typeof y=="function"?y:pc)}function z$(s,l,p,y,k){if(ky(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,nR(l,S)):(S.next=p.next,l.pending=p.next=S)}}function nR(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),se=F.S;se!==null&&se(M,V),aR(s,l,V)}catch(Ee){mk(s,l,Ee)}finally{S!==null&&M.types!==null&&(S.types=M.types),F.T=S}}else try{S=p(k,y),aR(s,l,S)}catch(Ee){mk(s,l,Ee)}}function aR(s,l,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(y){iR(s,l,y)},function(y){return mk(s,l,y)}):iR(s,l,p)}function iR(s,l,p){l.status="fulfilled",l.value=p,sR(l),s.state=p,l=s.pending,l!==null&&(p=l.next,p===l?s.pending=null:(p=p.next,l.next=p,nR(s,p)))}function mk(s,l,p){var y=s.pending;if(s.pending=null,y!==null){y=y.next;do l.status="rejected",l.reason=p,sR(l),l=l.next;while(l!==y)}s.action=null}function sR(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function oR(s,l){return l}function cR(s,l){if(Tr){var p=cn.formState;if(p!==null){e:{var y=ir;if(Tr){if(yn){t:{for(var k=yn,S=Zi;k.nodeType!==8;){if(!S){k=null;break t}if(k=ts(k.nextSibling),k===null){k=null;break t}}S=k.data,k=S==="F!"||S==="F"?k:null}if(k){yn=ts(k.nextSibling),y=k.data==="F!";break e}}al(y)}y=!1}y&&(l=p[0])}}return p=$a(),p.memoizedState=p.baseState=l,y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oR,lastRenderedState:l},p.queue=y,p=xR.bind(null,ir,y),y.dispatch=p,y=hk(!1),S=kk.bind(null,ir,!1,y.queue),y=$a(),k={state:l,dispatch:null,action:s,pending:null},y.queue=k,p=z$.bind(null,ir,k,S,p),k.dispatch=p,y.memoizedState=s,[l,p,!1]}function lR(s){var l=Bn();return uR(l,Qr,s)}function uR(s,l,p){if(l=fk(s,l,oR)[0],s=vy(pc)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var y=eh(l)}catch(M){throw M===Bd?cy:M}else y=l;l=Bn();var k=l.queue,S=k.dispatch;return p!==l.memoizedState&&(ir.flags|=2048,$d(9,{destroy:void 0},$$.bind(null,k,p),null)),[y,S,s]}function $$(s,l){s.action=l}function dR(s){var l=Bn(),p=Qr;if(p!==null)return uR(l,p,s);Bn(),l=l.memoizedState,p=Bn();var y=p.queue.dispatch;return p.memoizedState=s,[l,y,!1]}function $d(s,l,p,y){return s={tag:s,create:p,deps:y,inst:l,next:null},l=ir.updateQueue,l===null&&(l=gy(),ir.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 fR(){return Bn().memoizedState}function _y(s,l,p,y){var k=$a();ir.flags|=s,k.memoizedState=$d(1|l,{destroy:void 0},p,y===void 0?null:y)}function by(s,l,p,y){var k=Bn();y=y===void 0?null:y;var S=k.memoizedState.inst;Qr!==null&&y!==null&&sk(y,Qr.memoizedState.deps)?k.memoizedState=$d(l,S,p,y):(ir.flags|=s,k.memoizedState=$d(1|l,S,p,y))}function pR(s,l){_y(8390656,8,s,l)}function gk(s,l){by(2048,8,s,l)}function V$(s){ir.flags|=4;var l=ir.updateQueue;if(l===null)l=gy(),ir.updateQueue=l,l.events=[s];else{var p=l.events;p===null?l.events=[s]:p.push(s)}}function hR(s){var l=Bn().memoizedState;return V$({ref:l,nextImpl:s}),function(){if((Ur&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function mR(s,l){return by(4,2,s,l)}function gR(s,l){return by(4,4,s,l)}function yR(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 vR(s,l,p){p=p!=null?p.concat([s]):null,by(4,4,yR.bind(null,l,s),p)}function yk(){}function _R(s,l){var p=Bn();l=l===void 0?null:l;var y=p.memoizedState;return l!==null&&sk(l,y[1])?y[0]:(p.memoizedState=[s,l],s)}function bR(s,l){var p=Bn();l=l===void 0?null:l;var y=p.memoizedState;if(l!==null&&sk(l,y[1]))return y[0];if(y=s(),Du){lt(!0);try{s()}finally{lt(!1)}}return p.memoizedState=[y,l],y}function vk(s,l,p){return p===void 0||(fc&1073741824)!==0&&(kr&261930)===0?s.memoizedState=l:(s.memoizedState=p,s=k2(),ir.lanes|=s,pl|=s,p)}function kR(s,l,p,y){return Ti(p,l)?p:Fd.current!==null?(s=vk(s,p,y),Ti(s,l)||(Gn=!0),s):(fc&42)===0||(fc&1073741824)!==0&&(kr&261930)===0?(Gn=!0,s.memoizedState=p):(s=k2(),ir.lanes|=s,pl|=s,l)}function wR(s,l,p,y,k){var S=X.p;X.p=S!==0&&8>S?S:8;var M=F.T,V={};F.T=V,kk(s,!1,l,p);try{var se=k(),Ee=F.S;if(Ee!==null&&Ee(V,se),se!==null&&typeof se=="object"&&typeof se.then=="function"){var Fe=U$(se,y);th(s,l,Fe,Di(s))}else th(s,l,y,Di(s))}catch(We){th(s,l,{then:function(){},status:"rejected",reason:We},Di())}finally{X.p=S,M!==null&&V.types!==null&&(M.types=V.types),F.T=M}}function H$(){}function _k(s,l,p,y){if(s.tag!==5)throw Error(n(476));var k=SR(s).queue;wR(s,k,l,J,p===null?H$:function(){return ER(s),p(y)})}function SR(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pc,lastRenderedState:J},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pc,lastRenderedState:p},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function ER(s){var l=SR(s);l.next===null&&(l=s.alternate.memoizedState),th(s,l.next.queue,{},Di())}function bk(){return wa(vh)}function TR(){return Bn().memoizedState}function CR(){return Bn().memoizedState}function G$(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var p=Di();s=ol(p);var y=cl(l,s,p);y!==null&&(ni(y,l,p),Xp(y,l,p)),l={cache:Y0()},s.payload=l;return}l=l.return}}function W$(s,l,p){var y=Di();p={lane:y,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},ky(s)?PR(l,p):(p=B0(s,l,p,y),p!==null&&(ni(p,s,y),AR(p,l,y)))}function xR(s,l,p){var y=Di();th(s,l,p,y)}function th(s,l,p,y){var k={lane:y,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(ky(s))PR(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,Ti(V,M))return ty(s,l,k,0),cn===null&&ey(),!1}catch{}finally{}if(p=B0(s,l,k,y),p!==null)return ni(p,s,y),AR(p,l,y),!0}return!1}function kk(s,l,p,y){if(y={lane:2,revertLane:Zk(),gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},ky(s)){if(l)throw Error(n(479))}else l=B0(s,p,y,2),l!==null&&ni(l,s,2)}function ky(s){var l=s.alternate;return s===ir||l!==null&&l===ir}function PR(s,l){qd=hy=!0;var p=s.pending;p===null?l.next=l:(l.next=p.next,p.next=l),s.pending=l}function AR(s,l,p){if((p&4194048)!==0){var y=l.lanes;y&=s.pendingLanes,p|=y,l.lanes=p,Qt(s,p)}}var rh={readContext:wa,use:yy,useCallback:Dn,useContext:Dn,useEffect:Dn,useImperativeHandle:Dn,useLayoutEffect:Dn,useInsertionEffect:Dn,useMemo:Dn,useReducer:Dn,useRef:Dn,useState:Dn,useDebugValue:Dn,useDeferredValue:Dn,useTransition:Dn,useSyncExternalStore:Dn,useId:Dn,useHostTransitionStatus:Dn,useFormState:Dn,useActionState:Dn,useOptimistic:Dn,useMemoCache:Dn,useCacheRefresh:Dn};rh.useEffectEvent=Dn;var RR={readContext:wa,use:yy,useCallback:function(s,l){return $a().memoizedState=[s,l===void 0?null:l],s},useContext:wa,useEffect:pR,useImperativeHandle:function(s,l,p){p=p!=null?p.concat([s]):null,_y(4194308,4,yR.bind(null,l,s),p)},useLayoutEffect:function(s,l){return _y(4194308,4,s,l)},useInsertionEffect:function(s,l){_y(4,2,s,l)},useMemo:function(s,l){var p=$a();l=l===void 0?null:l;var y=s();if(Du){lt(!0);try{s()}finally{lt(!1)}}return p.memoizedState=[y,l],y},useReducer:function(s,l,p){var y=$a();if(p!==void 0){var k=p(l);if(Du){lt(!0);try{p(l)}finally{lt(!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=W$.bind(null,ir,s),[y.memoizedState,s]},useRef:function(s){var l=$a();return s={current:s},l.memoizedState=s},useState:function(s){s=hk(s);var l=s.queue,p=xR.bind(null,ir,l);return l.dispatch=p,[s.memoizedState,p]},useDebugValue:yk,useDeferredValue:function(s,l){var p=$a();return vk(p,s,l)},useTransition:function(){var s=hk(!1);return s=wR.bind(null,ir,s.queue,!0,!1),$a().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,p){var y=ir,k=$a();if(Tr){if(p===void 0)throw Error(n(407));p=p()}else{if(p=l(),cn===null)throw Error(n(349));(kr&127)!==0||J1(y,l,p)}k.memoizedState=p;var S={value:p,getSnapshot:l};return k.queue=S,pR(Z1.bind(null,y,S,s),[s]),y.flags|=2048,$d(9,{destroy:void 0},Q1.bind(null,y,S,p,l),null),p},useId:function(){var s=$a(),l=cn.identifierPrefix;if(Tr){var p=yo,y=go;p=(y&~(1<<32-yt(y)-1)).toString(32)+p,l="_"+l+"R_"+p,p=my++,0<p&&(l+="H"+p.toString(32)),l+="_"}else p=F$++,l="_"+l+"r_"+p.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:bk,useFormState:cR,useActionState:cR,useOptimistic:function(s){var l=$a();l.memoizedState=l.baseState=s;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=p,l=kk.bind(null,ir,!0,p),p.dispatch=l,[s,l]},useMemoCache:dk,useCacheRefresh:function(){return $a().memoizedState=G$.bind(null,ir)},useEffectEvent:function(s){var l=$a(),p={impl:s};return l.memoizedState=p,function(){if((Ur&2)!==0)throw Error(n(440));return p.impl.apply(void 0,arguments)}}},wk={readContext:wa,use:yy,useCallback:_R,useContext:wa,useEffect:gk,useImperativeHandle:vR,useInsertionEffect:mR,useLayoutEffect:gR,useMemo:bR,useReducer:vy,useRef:fR,useState:function(){return vy(pc)},useDebugValue:yk,useDeferredValue:function(s,l){var p=Bn();return kR(p,Qr.memoizedState,s,l)},useTransition:function(){var s=vy(pc)[0],l=Bn().memoizedState;return[typeof s=="boolean"?s:eh(s),l]},useSyncExternalStore:X1,useId:TR,useHostTransitionStatus:bk,useFormState:lR,useActionState:lR,useOptimistic:function(s,l){var p=Bn();return rR(p,Qr,s,l)},useMemoCache:dk,useCacheRefresh:CR};wk.useEffectEvent=hR;var DR={readContext:wa,use:yy,useCallback:_R,useContext:wa,useEffect:gk,useImperativeHandle:vR,useInsertionEffect:mR,useLayoutEffect:gR,useMemo:bR,useReducer:pk,useRef:fR,useState:function(){return pk(pc)},useDebugValue:yk,useDeferredValue:function(s,l){var p=Bn();return Qr===null?vk(p,s,l):kR(p,Qr.memoizedState,s,l)},useTransition:function(){var s=pk(pc)[0],l=Bn().memoizedState;return[typeof s=="boolean"?s:eh(s),l]},useSyncExternalStore:X1,useId:TR,useHostTransitionStatus:bk,useFormState:dR,useActionState:dR,useOptimistic:function(s,l){var p=Bn();return Qr!==null?rR(p,Qr,s,l):(p.baseState=s,[s,p.queue.dispatch])},useMemoCache:dk,useCacheRefresh:CR};DR.useEffectEvent=hR;function Sk(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 Ek={enqueueSetState:function(s,l,p){s=s._reactInternals;var y=Di(),k=ol(y);k.payload=l,p!=null&&(k.callback=p),l=cl(s,k,y),l!==null&&(ni(l,s,y),Xp(l,s,y))},enqueueReplaceState:function(s,l,p){s=s._reactInternals;var y=Di(),k=ol(y);k.tag=1,k.payload=l,p!=null&&(k.callback=p),l=cl(s,k,y),l!==null&&(ni(l,s,y),Xp(l,s,y))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var p=Di(),y=ol(p);y.tag=2,l!=null&&(y.callback=l),l=cl(s,y,p),l!==null&&(ni(l,s,p),Xp(l,s,p))}};function OR(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?!zp(p,y)||!zp(k,S):!0}function NR(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&&Ek.enqueueReplaceState(l,l.state,null)}function Ou(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 IR(s){Zg(s)}function MR(s){}function jR(s){Zg(s)}function wy(s,l){try{var p=s.onUncaughtError;p(l.value,{componentStack:l.stack})}catch(y){setTimeout(function(){throw y})}}function LR(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 Tk(s,l,p){return p=ol(p),p.tag=3,p.payload={element:null},p.callback=function(){wy(s,l)},p}function BR(s){return s=ol(s),s.tag=3,s}function UR(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(){LR(l,p,y)}}var M=p.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(s.callback=function(){LR(l,p,y),typeof k!="function"&&(hl===null?hl=new Set([this]):hl.add(this));var V=y.stack;this.componentDidCatch(y.value,{componentStack:V!==null?V:""})})}function K$(s,l,p,y,k){if(p.flags|=32768,y!==null&&typeof y=="object"&&typeof y.then=="function"){if(l=p.alternate,l!==null&&Md(l,p,k,!0),p=xi.current,p!==null){switch(p.tag){case 31:case 13:return es===null?Iy():p.alternate===null&&On===0&&(On=3),p.flags&=-257,p.flags|=65536,p.lanes=k,y===ly?p.flags|=16384:(l=p.updateQueue,l===null?p.updateQueue=new Set([y]):l.add(y),Xk(s,y,k)),!1;case 22:return p.flags|=65536,y===ly?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)),Xk(s,y,k)),!1}throw Error(n(435,p.tag))}return Xk(s,y,k),Iy(),!1}if(Tr)return l=xi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=k,y!==V0&&(s=Error(n(422),{cause:y}),Hp(Xi(s,p)))):(y!==V0&&(l=Error(n(423),{cause:y}),Hp(Xi(l,p))),s=s.current.alternate,s.flags|=65536,k&=-k,s.lanes|=k,y=Xi(y,p),k=Tk(s.stateNode,y,k),tk(s,k),On!==4&&(On=2)),!1;var S=Error(n(520),{cause:y});if(S=Xi(S,p),uh===null?uh=[S]:uh.push(S),On!==4&&(On=2),l===null)return!0;y=Xi(y,p),p=l;do{switch(p.tag){case 3:return p.flags|=65536,s=k&-k,p.lanes|=s,s=Tk(p.stateNode,y,s),tk(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"&&(hl===null||!hl.has(S))))return p.flags|=65536,k&=-k,p.lanes|=k,k=BR(k),UR(k,s,p,y),tk(p,k),!1}p=p.return}while(p!==null);return!1}var Ck=Error(n(461)),Gn=!1;function Sa(s,l,p,y){l.child=s===null?$1(l,null,p,y):Ru(l,s.child,p,y)}function FR(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 Cu(l),y=ok(s,l,p,M,S,k),V=ck(),s!==null&&!Gn?(lk(s,l,k),hc(s,l,k)):(Tr&&V&&z0(l),l.flags|=1,Sa(s,l,y,k),l.child)}function qR(s,l,p,y,k){if(s===null){var S=p.type;return typeof S=="function"&&!U0(S)&&S.defaultProps===void 0&&p.compare===null?(l.tag=15,l.type=S,zR(s,l,S,y,k)):(s=ny(p.type,null,y,l,l.mode,k),s.ref=l.ref,s.return=l,l.child=s)}if(S=s.child,!Ik(s,k)){var M=S.memoizedProps;if(p=p.compare,p=p!==null?p:zp,p(M,y)&&s.ref===l.ref)return hc(s,l,k)}return l.flags|=1,s=cc(S,y),s.ref=l.ref,s.return=l,l.child=s}function zR(s,l,p,y,k){if(s!==null){var S=s.memoizedProps;if(zp(S,y)&&s.ref===l.ref)if(Gn=!1,l.pendingProps=y=S,Ik(s,k))(s.flags&131072)!==0&&(Gn=!0);else return l.lanes=s.lanes,hc(s,l,k)}return xk(s,l,p,y,k)}function $R(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 VR(s,l,S,p,y)}if((p&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&oy(l,S!==null?S.cachePool:null),S!==null?G1(l,S):nk(),W1(l);else return y=l.lanes=536870912,VR(s,l,S!==null?S.baseLanes|p:p,p,y)}else S!==null?(oy(l,S.cachePool),G1(l,S),ul(),l.memoizedState=null):(s!==null&&oy(l,null),nk(),ul());return Sa(s,l,k,p),l.child}function nh(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function VR(s,l,p,y,k){var S=J0();return S=S===null?null:{parent:Vn._currentValue,pool:S},l.memoizedState={baseLanes:p,cachePool:S},s!==null&&oy(l,null),nk(),W1(l),s!==null&&Md(s,l,y,!0),l.childLanes=k,null}function Sy(s,l){return l=Ty({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function HR(s,l,p){return Ru(l,s.child,null,p),s=Sy(l,l.pendingProps),s.flags|=2,Pi(l),l.memoizedState=null,s}function Y$(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=Sy(l,y),l.lanes=536870912,nh(null,s);if(ik(l),(s=yn)?(s=nD(s,Zi),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:rl!==null?{id:go,overflow:yo}:null,retryLane:536870912,hydrationErrors:null},p=P1(s),p.return=l,l.child=p,ka=l,yn=null)):s=null,s===null)throw al(l);return l.lanes=536870912,null}return Sy(l,y)}var S=s.memoizedState;if(S!==null){var M=S.dehydrated;if(ik(l),k)if(l.flags&256)l.flags&=-257,l=HR(s,l,p);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(n(558));else if(Gn||Md(s,l,p,!1),k=(p&s.childLanes)!==0,Gn||k){if(y=cn,y!==null&&(M=Rt(y,p),M!==0&&M!==S.retryLane))throw S.retryLane=M,wu(s,M),ni(y,s,M),Ck;Iy(),l=HR(s,l,p)}else s=S.treeContext,yn=ts(M.nextSibling),ka=l,Tr=!0,nl=null,Zi=!1,s!==null&&D1(l,s),l=Sy(l,y),l.flags|=4096;return l}return s=cc(s.child,{mode:y.mode,children:y.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Ey(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 xk(s,l,p,y,k){return Cu(l),p=ok(s,l,p,y,void 0,k),y=ck(),s!==null&&!Gn?(lk(s,l,k),hc(s,l,k)):(Tr&&y&&z0(l),l.flags|=1,Sa(s,l,p,k),l.child)}function GR(s,l,p,y,k,S){return Cu(l),l.updateQueue=null,p=Y1(l,y,p,k),K1(s),y=ck(),s!==null&&!Gn?(lk(s,l,S),hc(s,l,S)):(Tr&&y&&z0(l),l.flags|=1,Sa(s,l,p,S),l.child)}function WR(s,l,p,y,k){if(Cu(l),l.stateNode===null){var S=Dd,M=p.contextType;typeof M=="object"&&M!==null&&(S=wa(M)),S=new p(y,S),l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Ek,l.stateNode=S,S._reactInternals=l,S=l.stateNode,S.props=y,S.state=l.memoizedState,S.refs={},Z0(l),M=p.contextType,S.context=typeof M=="object"&&M!==null?wa(M):Dd,S.state=l.memoizedState,M=p.getDerivedStateFromProps,typeof M=="function"&&(Sk(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&&Ek.enqueueReplaceState(S,S.state,null),Qp(l,y,S,k),Jp(),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308),y=!0}else if(s===null){S=l.stateNode;var V=l.memoizedProps,se=Ou(p,V);S.props=se;var Ee=S.context,Fe=p.contextType;M=Dd,typeof Fe=="object"&&Fe!==null&&(M=wa(Fe));var We=p.getDerivedStateFromProps;Fe=typeof We=="function"||typeof S.getSnapshotBeforeUpdate=="function",V=l.pendingProps!==V,Fe||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(V||Ee!==M)&&NR(l,S,y,M),sl=!1;var Ae=l.memoizedState;S.state=Ae,Qp(l,y,S,k),Jp(),Ee=l.memoizedState,V||Ae!==Ee||sl?(typeof We=="function"&&(Sk(l,p,We,y),Ee=l.memoizedState),(se=sl||OR(l,p,se,y,Ae,Ee,M))?(Fe||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=Ee),S.props=y,S.state=Ee,S.context=M,y=se):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),y=!1)}else{S=l.stateNode,ek(s,l),M=l.memoizedProps,Fe=Ou(p,M),S.props=Fe,We=l.pendingProps,Ae=S.context,Ee=p.contextType,se=Dd,typeof Ee=="object"&&Ee!==null&&(se=wa(Ee)),V=p.getDerivedStateFromProps,(Ee=typeof V=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(M!==We||Ae!==se)&&NR(l,S,y,se),sl=!1,Ae=l.memoizedState,S.state=Ae,Qp(l,y,S,k),Jp();var Ie=l.memoizedState;M!==We||Ae!==Ie||sl||s!==null&&s.dependencies!==null&&iy(s.dependencies)?(typeof V=="function"&&(Sk(l,p,V,y),Ie=l.memoizedState),(Fe=sl||OR(l,p,Fe,y,Ae,Ie,se)||s!==null&&s.dependencies!==null&&iy(s.dependencies))?(Ee||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(y,Ie,se),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(y,Ie,se)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&Ae===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&Ae===s.memoizedState||(l.flags|=1024),l.memoizedProps=y,l.memoizedState=Ie),S.props=y,S.state=Ie,S.context=se,y=Fe):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&Ae===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&Ae===s.memoizedState||(l.flags|=1024),y=!1)}return S=y,Ey(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=Ru(l,s.child,null,k),l.child=Ru(l,null,p,k)):Sa(s,l,p,k),l.memoizedState=S.state,s=l.child):s=hc(s,l,k),s}function KR(s,l,p,y){return Eu(),l.flags|=256,Sa(s,l,p,y),l.child}var Pk={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ak(s){return{baseLanes:s,cachePool:L1()}}function Rk(s,l,p){return s=s!==null?s.childLanes&~p:0,l&&(s|=Ri),s}function YR(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:(Ln.current&2)!==0),M&&(k=!0,l.flags&=-129),M=(l.flags&32)!==0,l.flags&=-33,s===null){if(Tr){if(k?ll(l):ul(),(s=yn)?(s=nD(s,Zi),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:rl!==null?{id:go,overflow:yo}:null,retryLane:536870912,hydrationErrors:null},p=P1(s),p.return=l,l.child=p,ka=l,yn=null)):s=null,s===null)throw al(l);return fw(s)?l.lanes=32:l.lanes=536870912,null}var V=y.children;return y=y.fallback,k?(ul(),k=l.mode,V=Ty({mode:"hidden",children:V},k),y=Su(y,k,p,null),V.return=l,y.return=l,V.sibling=y,l.child=V,y=l.child,y.memoizedState=Ak(p),y.childLanes=Rk(s,M,p),l.memoizedState=Pk,nh(null,y)):(ll(l),Dk(l,V))}var se=s.memoizedState;if(se!==null&&(V=se.dehydrated,V!==null)){if(S)l.flags&256?(ll(l),l.flags&=-257,l=Ok(s,l,p)):l.memoizedState!==null?(ul(),l.child=s.child,l.flags|=128,l=null):(ul(),V=y.fallback,k=l.mode,y=Ty({mode:"visible",children:y.children},k),V=Su(V,k,p,null),V.flags|=2,y.return=l,V.return=l,y.sibling=V,l.child=y,Ru(l,s.child,null,p),y=l.child,y.memoizedState=Ak(p),y.childLanes=Rk(s,M,p),l.memoizedState=Pk,l=nh(null,y));else if(ll(l),fw(V)){if(M=V.nextSibling&&V.nextSibling.dataset,M)var Ee=M.dgst;M=Ee,y=Error(n(419)),y.stack="",y.digest=M,Hp({value:y,source:null,stack:null}),l=Ok(s,l,p)}else if(Gn||Md(s,l,p,!1),M=(p&s.childLanes)!==0,Gn||M){if(M=cn,M!==null&&(y=Rt(M,p),y!==0&&y!==se.retryLane))throw se.retryLane=y,wu(s,y),ni(M,s,y),Ck;dw(V)||Iy(),l=Ok(s,l,p)}else dw(V)?(l.flags|=192,l.child=s.child,l=null):(s=se.treeContext,yn=ts(V.nextSibling),ka=l,Tr=!0,nl=null,Zi=!1,s!==null&&D1(l,s),l=Dk(l,y.children),l.flags|=4096);return l}return k?(ul(),V=y.fallback,k=l.mode,se=s.child,Ee=se.sibling,y=cc(se,{mode:"hidden",children:y.children}),y.subtreeFlags=se.subtreeFlags&65011712,Ee!==null?V=cc(Ee,V):(V=Su(V,k,p,null),V.flags|=2),V.return=l,y.return=l,y.sibling=V,l.child=y,nh(null,y),y=l.child,V=s.child.memoizedState,V===null?V=Ak(p):(k=V.cachePool,k!==null?(se=Vn._currentValue,k=k.parent!==se?{parent:se,pool:se}:k):k=L1(),V={baseLanes:V.baseLanes|p,cachePool:k}),y.memoizedState=V,y.childLanes=Rk(s,M,p),l.memoizedState=Pk,nh(s.child,y)):(ll(l),p=s.child,s=p.sibling,p=cc(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 Dk(s,l){return l=Ty({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Ty(s,l){return s=Ci(22,s,null,l),s.lanes=0,s}function Ok(s,l,p){return Ru(l,s.child,null,p),s=Dk(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function XR(s,l,p){s.lanes|=l;var y=s.alternate;y!==null&&(y.lanes|=l),W0(s.return,l,p)}function Nk(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 JR(s,l,p){var y=l.pendingProps,k=y.revealOrder,S=y.tail;y=y.children;var M=Ln.current,V=(M&2)!==0;if(V?(M=M&1|2,l.flags|=128):M&=1,ae(Ln,M),Sa(s,l,y,p),y=Tr?Vp:0,!V&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&XR(s,p,l);else if(s.tag===19)XR(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&&py(s)===null&&(k=p),p=p.sibling;p=k,p===null?(k=l.child,l.child=null):(k=p.sibling,p.sibling=null),Nk(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&&py(s)===null){l.child=k;break}s=k.sibling,k.sibling=p,p=k,k=s}Nk(l,!0,p,null,S,y);break;case"together":Nk(l,!1,null,null,void 0,y);break;default:l.memoizedState=null}return l.child}function hc(s,l,p){if(s!==null&&(l.dependencies=s.dependencies),pl|=l.lanes,(p&l.childLanes)===0)if(s!==null){if(Md(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=cc(s,s.pendingProps),l.child=p,p.return=l;s.sibling!==null;)s=s.sibling,p=p.sibling=cc(s,s.pendingProps),p.return=l;p.sibling=null}return l.child}function Ik(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&iy(s)))}function X$(s,l,p){switch(l.tag){case 3:He(l,l.stateNode.containerInfo),il(l,Vn,s.memoizedState.cache),Eu();break;case 27:case 5:xe(l);break;case 4:He(l,l.stateNode.containerInfo);break;case 10:il(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,ik(l),null;break;case 13:var y=l.memoizedState;if(y!==null)return y.dehydrated!==null?(ll(l),l.flags|=128,null):(p&l.child.childLanes)!==0?YR(s,l,p):(ll(l),s=hc(s,l,p),s!==null?s.sibling:null);ll(l);break;case 19:var k=(s.flags&128)!==0;if(y=(p&l.childLanes)!==0,y||(Md(s,l,p,!1),y=(p&l.childLanes)!==0),k){if(y)return JR(s,l,p);l.flags|=128}if(k=l.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),ae(Ln,Ln.current),y)break;return null;case 22:return l.lanes=0,$R(s,l,p,l.pendingProps);case 24:il(l,Vn,s.memoizedState.cache)}return hc(s,l,p)}function QR(s,l,p){if(s!==null)if(s.memoizedProps!==l.pendingProps)Gn=!0;else{if(!Ik(s,p)&&(l.flags&128)===0)return Gn=!1,X$(s,l,p);Gn=(s.flags&131072)!==0}else Gn=!1,Tr&&(l.flags&1048576)!==0&&R1(l,Vp,l.index);switch(l.lanes=0,l.tag){case 16:e:{var y=l.pendingProps;if(s=Pu(l.elementType),l.type=s,typeof s=="function")U0(s)?(y=Ou(s,y),l.tag=1,l=WR(null,l,s,y,p)):(l.tag=0,l=xk(null,l,s,y,p));else{if(s!=null){var k=s.$$typeof;if(k===A){l.tag=11,l=FR(null,l,s,y,p);break e}else if(k===I){l.tag=14,l=qR(null,l,s,y,p);break e}}throw l=U(s)||s,Error(n(306,l,""))}}return l;case 0:return xk(s,l,l.type,l.pendingProps,p);case 1:return y=l.type,k=Ou(y,l.pendingProps),WR(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,ek(s,l),Qp(l,y,null,p);var M=l.memoizedState;if(y=M.cache,il(l,Vn,y),y!==S.cache&&K0(l,[Vn],p,!0),Jp(),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=KR(s,l,y,p);break e}else if(y!==k){k=Xi(Error(n(424)),l),Hp(k),l=KR(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(yn=ts(s.firstChild),ka=l,Tr=!0,nl=null,Zi=!0,p=$1(l,null,y,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Eu(),y===k){l=hc(s,l,p);break e}Sa(s,l,y,p)}l=l.child}return l;case 26:return Ey(s,l),s===null?(p=lD(l.type,null,l.pendingProps,null))?l.memoizedState=p:Tr||(p=l.type,s=l.pendingProps,y=qy(ce.current).createElement(p),y[qt]=l,y[Ot]=s,Ea(y,p,s),gn(y),l.stateNode=y):l.memoizedState=lD(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return xe(l),s===null&&Tr&&(y=l.stateNode=sD(l.type,l.pendingProps,ce.current),ka=l,Zi=!0,k=yn,vl(l.type)?(pw=k,yn=ts(y.firstChild)):yn=k),Sa(s,l,l.pendingProps.children,p),Ey(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Tr&&((k=y=yn)&&(y=C8(y,l.type,l.pendingProps,Zi),y!==null?(l.stateNode=y,ka=l,yn=ts(y.firstChild),Zi=!1,k=!0):k=!1),k||al(l)),xe(l),k=l.type,S=l.pendingProps,M=s!==null?s.memoizedProps:null,y=S.children,cw(k,S)?y=null:M!==null&&cw(k,M)&&(l.flags|=32),l.memoizedState!==null&&(k=ok(s,l,q$,null,null,p),vh._currentValue=k),Ey(s,l),Sa(s,l,y,p),l.child;case 6:return s===null&&Tr&&((s=p=yn)&&(p=x8(p,l.pendingProps,Zi),p!==null?(l.stateNode=p,ka=l,yn=null,s=!0):s=!1),s||al(l)),null;case 13:return YR(s,l,p);case 4:return He(l,l.stateNode.containerInfo),y=l.pendingProps,s===null?l.child=Ru(l,null,y,p):Sa(s,l,y,p),l.child;case 11:return FR(s,l,l.type,l.pendingProps,p);case 7:return Sa(s,l,l.pendingProps,p),l.child;case 8:return Sa(s,l,l.pendingProps.children,p),l.child;case 12:return Sa(s,l,l.pendingProps.children,p),l.child;case 10:return y=l.pendingProps,il(l,l.type,y.value),Sa(s,l,y.children,p),l.child;case 9:return k=l.type._context,y=l.pendingProps.children,Cu(l),k=wa(k),y=y(k),l.flags|=1,Sa(s,l,y,p),l.child;case 14:return qR(s,l,l.type,l.pendingProps,p);case 15:return zR(s,l,l.type,l.pendingProps,p);case 19:return JR(s,l,p);case 31:return Y$(s,l,p);case 22:return $R(s,l,p,l.pendingProps);case 24:return Cu(l),y=wa(Vn),s===null?(k=J0(),k===null&&(k=cn,S=Y0(),k.pooledCache=S,S.refCount++,S!==null&&(k.pooledCacheLanes|=p),k=S),l.memoizedState={parent:y,cache:k},Z0(l),il(l,Vn,k)):((s.lanes&p)!==0&&(ek(s,l),Qp(l,null,null,p),Jp()),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),il(l,Vn,y)):(y=S.cache,il(l,Vn,y),y!==k.cache&&K0(l,[Vn],p,!0))),Sa(s,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function mc(s){s.flags|=4}function Mk(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(T2())s.flags|=8192;else throw Au=ly,Q0}else s.flags&=-16777217}function ZR(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!hD(l))if(T2())s.flags|=8192;else throw Au=ly,Q0}function Cy(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?W():536870912,s.lanes|=l,Wd|=l)}function ah(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 vn(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 J$(s,l,p){var y=l.pendingProps;switch($0(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vn(l),null;case 1:return vn(l),null;case 3:return p=l.stateNode,y=null,s!==null&&(y=s.memoizedState.cache),l.memoizedState.cache!==y&&(l.flags|=2048),dc(Vn),ie(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(s===null||s.child===null)&&(Id(l)?mc(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,H0())),vn(l),null;case 26:var k=l.type,S=l.memoizedState;return s===null?(mc(l),S!==null?(vn(l),ZR(l,S)):(vn(l),Mk(l,k,null,y,p))):S?S!==s.memoizedState?(mc(l),vn(l),ZR(l,S)):(vn(l),l.flags&=-16777217):(s=s.memoizedProps,s!==y&&mc(l),vn(l),Mk(l,k,s,y,p)),null;case 27:if(re(l),p=ce.current,k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&mc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return vn(l),null}s=te.current,Id(l)?O1(l):(s=sD(k,y,p),l.stateNode=s,mc(l))}return vn(l),null;case 5:if(re(l),k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&mc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return vn(l),null}if(S=te.current,Id(l))O1(l);else{var M=qy(ce.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[qt]=l,S[Ot]=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(Ea(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&&mc(l)}}return vn(l),Mk(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,p),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==y&&mc(l);else{if(typeof y!="string"&&l.stateNode===null)throw Error(n(166));if(s=ce.current,Id(l)){if(s=l.stateNode,p=l.memoizedProps,y=null,k=ka,k!==null)switch(k.tag){case 27:case 5:y=k.memoizedProps}s[qt]=l,s=!!(s.nodeValue===p||y!==null&&y.suppressHydrationWarning===!0||Y2(s.nodeValue,p)),s||al(l,!0)}else s=qy(s).createTextNode(y),s[qt]=l,l.stateNode=s}return vn(l),null;case 31:if(p=l.memoizedState,s===null||s.memoizedState!==null){if(y=Id(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[qt]=l}else Eu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;vn(l),s=!1}else p=H0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),s=!0;if(!s)return l.flags&256?(Pi(l),l):(Pi(l),null);if((l.flags&128)!==0)throw Error(n(558))}return vn(l),null;case 13:if(y=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(k=Id(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[qt]=l}else Eu(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;vn(l),k=!1}else k=H0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=k),k=!0;if(!k)return l.flags&256?(Pi(l),l):(Pi(l),null)}return Pi(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),Cy(l,l.updateQueue),vn(l),null);case 4:return ie(),s===null&&nw(l.stateNode.containerInfo),vn(l),null;case 10:return dc(l.type),vn(l),null;case 19:if(K(Ln),y=l.memoizedState,y===null)return vn(l),null;if(k=(l.flags&128)!==0,S=y.rendering,S===null)if(k)ah(y,!1);else{if(On!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(S=py(s),S!==null){for(l.flags|=128,ah(y,!1),s=S.updateQueue,l.updateQueue=s,Cy(l,s),l.subtreeFlags=0,s=p,p=l.child;p!==null;)x1(p,s),p=p.sibling;return ae(Ln,Ln.current&1|2),Tr&&lc(l,y.treeForkCount),l.child}s=s.sibling}y.tail!==null&&Je()>Dy&&(l.flags|=128,k=!0,ah(y,!1),l.lanes=4194304)}else{if(!k)if(s=py(S),s!==null){if(l.flags|=128,k=!0,s=s.updateQueue,l.updateQueue=s,Cy(l,s),ah(y,!0),y.tail===null&&y.tailMode==="hidden"&&!S.alternate&&!Tr)return vn(l),null}else 2*Je()-y.renderingStartTime>Dy&&p!==536870912&&(l.flags|=128,k=!0,ah(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=Je(),s.sibling=null,p=Ln.current,ae(Ln,k?p&1|2:p&1),Tr&&lc(l,y.treeForkCount),s):(vn(l),null);case 22:case 23:return Pi(l),ak(),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&&(vn(l),l.subtreeFlags&6&&(l.flags|=8192)):vn(l),p=l.updateQueue,p!==null&&Cy(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(xu),null;case 24:return p=null,s!==null&&(p=s.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),dc(Vn),vn(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function Q$(s,l){switch($0(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return dc(Vn),ie(),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(Pi(l),l.alternate===null)throw Error(n(340));Eu()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(Pi(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Eu()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return K(Ln),null;case 4:return ie(),null;case 10:return dc(l.type),null;case 22:case 23:return Pi(l),ak(),s!==null&&K(xu),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return dc(Vn),null;case 25:return null;default:return null}}function e2(s,l){switch($0(l),l.tag){case 3:dc(Vn),ie();break;case 26:case 27:case 5:re(l);break;case 4:ie();break;case 31:l.memoizedState!==null&&Pi(l);break;case 13:Pi(l);break;case 19:K(Ln);break;case 10:dc(l.type);break;case 22:case 23:Pi(l),ak(),s!==null&&K(xu);break;case 24:dc(Vn)}}function ih(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){Xr(l,l.return,V)}}function dl(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 se=p,Ee=V;try{Ee()}catch(Fe){Xr(k,se,Fe)}}}y=y.next}while(y!==S)}}catch(Fe){Xr(l,l.return,Fe)}}function t2(s){var l=s.updateQueue;if(l!==null){var p=s.stateNode;try{H1(l,p)}catch(y){Xr(s,s.return,y)}}}function r2(s,l,p){p.props=Ou(s.type,s.memoizedProps),p.state=s.memoizedState;try{p.componentWillUnmount()}catch(y){Xr(s,l,y)}}function sh(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){Xr(s,l,k)}}function vo(s,l){var p=s.ref,y=s.refCleanup;if(p!==null)if(typeof y=="function")try{y()}catch(k){Xr(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){Xr(s,l,k)}else p.current=null}function n2(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){Xr(s,s.return,k)}}function jk(s,l,p){try{var y=s.stateNode;b8(y,s.type,p,l),y[Ot]=l}catch(k){Xr(s,s.return,k)}}function a2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&vl(s.type)||s.tag===4}function Lk(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||a2(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&&vl(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 Bk(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=ba));else if(y!==4&&(y===27&&vl(s.type)&&(p=s.stateNode,l=null),s=s.child,s!==null))for(Bk(s,l,p),s=s.sibling;s!==null;)Bk(s,l,p),s=s.sibling}function xy(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&&vl(s.type)&&(p=s.stateNode),s=s.child,s!==null))for(xy(s,l,p),s=s.sibling;s!==null;)xy(s,l,p),s=s.sibling}function i2(s){var l=s.stateNode,p=s.memoizedProps;try{for(var y=s.type,k=l.attributes;k.length;)l.removeAttributeNode(k[0]);Ea(l,y,p),l[qt]=s,l[Ot]=p}catch(S){Xr(s,s.return,S)}}var gc=!1,Wn=!1,Uk=!1,s2=typeof WeakSet=="function"?WeakSet:Set,pa=null;function Z$(s,l){if(s=s.containerInfo,sw=Ky,s=v1(s),O0(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,se=-1,Ee=0,Fe=0,We=s,Ae=null;t:for(;;){for(var Ie;We!==p||k!==0&&We.nodeType!==3||(V=M+k),We!==S||y!==0&&We.nodeType!==3||(se=M+y),We.nodeType===3&&(M+=We.nodeValue.length),(Ie=We.firstChild)!==null;)Ae=We,We=Ie;for(;;){if(We===s)break t;if(Ae===p&&++Ee===k&&(V=M),Ae===S&&++Fe===y&&(se=M),(Ie=We.nextSibling)!==null)break;We=Ae,Ae=We.parentNode}We=Ie}p=V===-1||se===-1?null:{start:V,end:se}}else p=null}p=p||{start:0,end:0}}else p=null;for(ow={focusedElem:s,selectionRange:p},Ky=!1,pa=l;pa!==null;)if(l=pa,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,pa=s;else for(;pa!==null;){switch(l=pa,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 Dt=Ou(p.type,k);s=y.getSnapshotBeforeUpdate(Dt,S),y.__reactInternalSnapshotBeforeUpdate=s}catch(Kt){Xr(p,p.return,Kt)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,p=s.nodeType,p===9)uw(s);else if(p===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":uw(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,pa=s;break}pa=l.return}}function o2(s,l,p){var y=p.flags;switch(p.tag){case 0:case 11:case 15:vc(s,p),y&4&&ih(5,p);break;case 1:if(vc(s,p),y&4)if(s=p.stateNode,l===null)try{s.componentDidMount()}catch(M){Xr(p,p.return,M)}else{var k=Ou(p.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(k,l,s.__reactInternalSnapshotBeforeUpdate)}catch(M){Xr(p,p.return,M)}}y&64&&t2(p),y&512&&sh(p,p.return);break;case 3:if(vc(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{H1(s,l)}catch(M){Xr(p,p.return,M)}}break;case 27:l===null&&y&4&&i2(p);case 26:case 5:vc(s,p),l===null&&y&4&&n2(p),y&512&&sh(p,p.return);break;case 12:vc(s,p);break;case 31:vc(s,p),y&4&&u2(s,p);break;case 13:vc(s,p),y&4&&d2(s,p),y&64&&(s=p.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(p=c8.bind(null,p),P8(s,p))));break;case 22:if(y=p.memoizedState!==null||gc,!y){l=l!==null&&l.memoizedState!==null||Wn,k=gc;var S=Wn;gc=y,(Wn=l)&&!S?_c(s,p,(p.subtreeFlags&8772)!==0):vc(s,p),gc=k,Wn=S}break;case 30:break;default:vc(s,p)}}function c2(s){var l=s.alternate;l!==null&&(s.alternate=null,c2(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&ua(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 kn=null,Za=!1;function yc(s,l,p){for(p=p.child;p!==null;)l2(s,l,p),p=p.sibling}function l2(s,l,p){if(be&&typeof be.onCommitFiberUnmount=="function")try{be.onCommitFiberUnmount(rt,p)}catch{}switch(p.tag){case 26:Wn||vo(p,l),yc(s,l,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Wn||vo(p,l);var y=kn,k=Za;vl(p.type)&&(kn=p.stateNode,Za=!1),yc(s,l,p),mh(p.stateNode),kn=y,Za=k;break;case 5:Wn||vo(p,l);case 6:if(y=kn,k=Za,kn=null,yc(s,l,p),kn=y,Za=k,kn!==null)if(Za)try{(kn.nodeType===9?kn.body:kn.nodeName==="HTML"?kn.ownerDocument.body:kn).removeChild(p.stateNode)}catch(S){Xr(p,l,S)}else try{kn.removeChild(p.stateNode)}catch(S){Xr(p,l,S)}break;case 18:kn!==null&&(Za?(s=kn,tD(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,p.stateNode),tf(s)):tD(kn,p.stateNode));break;case 4:y=kn,k=Za,kn=p.stateNode.containerInfo,Za=!0,yc(s,l,p),kn=y,Za=k;break;case 0:case 11:case 14:case 15:dl(2,p,l),Wn||dl(4,p,l),yc(s,l,p);break;case 1:Wn||(vo(p,l),y=p.stateNode,typeof y.componentWillUnmount=="function"&&r2(p,l,y)),yc(s,l,p);break;case 21:yc(s,l,p);break;case 22:Wn=(y=Wn)||p.memoizedState!==null,yc(s,l,p),Wn=y;break;default:yc(s,l,p)}}function u2(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{tf(s)}catch(p){Xr(l,l.return,p)}}}function d2(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{tf(s)}catch(p){Xr(l,l.return,p)}}function e8(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new s2),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new s2),l;default:throw Error(n(435,s.tag))}}function Py(s,l){var p=e8(s);l.forEach(function(y){if(!p.has(y)){p.add(y);var k=l8.bind(null,s,y);y.then(k,k)}})}function ei(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(vl(V.type)){kn=V.stateNode,Za=!1;break e}break;case 5:kn=V.stateNode,Za=!1;break e;case 3:case 4:kn=V.stateNode.containerInfo,Za=!0;break e}V=V.return}if(kn===null)throw Error(n(160));l2(S,M,k),kn=null,Za=!1,S=k.alternate,S!==null&&(S.return=null),k.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)f2(l,s),l=l.sibling}var Ms=null;function f2(s,l){var p=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ei(l,s),ti(s),y&4&&(dl(3,s,s.return),ih(3,s),dl(5,s,s.return));break;case 1:ei(l,s),ti(s),y&512&&(Wn||p===null||vo(p,p.return)),y&64&&gc&&(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=Ms;if(ei(l,s),ti(s),y&512&&(Wn||p===null||vo(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[nn]||S[qt]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=k.createElement(y),k.head.insertBefore(S,k.querySelector("head > title"))),Ea(S,y,p),S[qt]=s,gn(S),y=S;break e;case"link":var M=fD("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),Ea(S,y,p),k.head.appendChild(S);break;case"meta":if(M=fD("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),Ea(S,y,p),k.head.appendChild(S);break;default:throw Error(n(468,y))}S[qt]=s,gn(S),y=S}s.stateNode=y}else pD(k,s.type,s.stateNode);else s.stateNode=dD(k,y,s.memoizedProps);else S!==y?(S===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):S.count--,y===null?pD(k,s.type,s.stateNode):dD(k,y,s.memoizedProps)):y===null&&s.stateNode!==null&&jk(s,s.memoizedProps,p.memoizedProps)}break;case 27:ei(l,s),ti(s),y&512&&(Wn||p===null||vo(p,p.return)),p!==null&&y&4&&jk(s,s.memoizedProps,p.memoizedProps);break;case 5:if(ei(l,s),ti(s),y&512&&(Wn||p===null||vo(p,p.return)),s.flags&32){k=s.stateNode;try{Qe(k,"")}catch(Dt){Xr(s,s.return,Dt)}}y&4&&s.stateNode!=null&&(k=s.memoizedProps,jk(s,k,p!==null?p.memoizedProps:k)),y&1024&&(Uk=!0);break;case 6:if(ei(l,s),ti(s),y&4){if(s.stateNode===null)throw Error(n(162));y=s.memoizedProps,p=s.stateNode;try{p.nodeValue=y}catch(Dt){Xr(s,s.return,Dt)}}break;case 3:if(Vy=null,k=Ms,Ms=zy(l.containerInfo),ei(l,s),Ms=k,ti(s),y&4&&p!==null&&p.memoizedState.isDehydrated)try{tf(l.containerInfo)}catch(Dt){Xr(s,s.return,Dt)}Uk&&(Uk=!1,p2(s));break;case 4:y=Ms,Ms=zy(s.stateNode.containerInfo),ei(l,s),ti(s),Ms=y;break;case 12:ei(l,s),ti(s);break;case 31:ei(l,s),ti(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 13:ei(l,s),ti(s),s.child.flags&8192&&s.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Ry=Je()),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 22:k=s.memoizedState!==null;var se=p!==null&&p.memoizedState!==null,Ee=gc,Fe=Wn;if(gc=Ee||k,Wn=Fe||se,ei(l,s),Wn=Fe,gc=Ee,ti(s),y&8192)e:for(l=s.stateNode,l._visibility=k?l._visibility&-2:l._visibility|1,k&&(p===null||se||gc||Wn||Nu(s)),p=null,l=s;;){if(l.tag===5||l.tag===26){if(p===null){se=p=l;try{if(S=se.stateNode,k)M=S.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{V=se.stateNode;var We=se.memoizedProps.style,Ae=We!=null&&We.hasOwnProperty("display")?We.display:null;V.style.display=Ae==null||typeof Ae=="boolean"?"":(""+Ae).trim()}}catch(Dt){Xr(se,se.return,Dt)}}}else if(l.tag===6){if(p===null){se=l;try{se.stateNode.nodeValue=k?"":se.memoizedProps}catch(Dt){Xr(se,se.return,Dt)}}}else if(l.tag===18){if(p===null){se=l;try{var Ie=se.stateNode;k?rD(Ie,!0):rD(se.stateNode,!1)}catch(Dt){Xr(se,se.return,Dt)}}}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,Py(s,p))));break;case 19:ei(l,s),ti(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,Py(s,y)));break;case 30:break;case 21:break;default:ei(l,s),ti(s)}}function ti(s){var l=s.flags;if(l&2){try{for(var p,y=s.return;y!==null;){if(a2(y)){p=y;break}y=y.return}if(p==null)throw Error(n(160));switch(p.tag){case 27:var k=p.stateNode,S=Lk(s);xy(s,S,k);break;case 5:var M=p.stateNode;p.flags&32&&(Qe(M,""),p.flags&=-33);var V=Lk(s);xy(s,V,M);break;case 3:case 4:var se=p.stateNode.containerInfo,Ee=Lk(s);Bk(s,Ee,se);break;default:throw Error(n(161))}}catch(Fe){Xr(s,s.return,Fe)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function p2(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;p2(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function vc(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)o2(s,l.alternate,l),l=l.sibling}function Nu(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:dl(4,l,l.return),Nu(l);break;case 1:vo(l,l.return);var p=l.stateNode;typeof p.componentWillUnmount=="function"&&r2(l,l.return,p),Nu(l);break;case 27:mh(l.stateNode);case 26:case 5:vo(l,l.return),Nu(l);break;case 22:l.memoizedState===null&&Nu(l);break;case 30:Nu(l);break;default:Nu(l)}s=s.sibling}}function _c(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:_c(k,S,p),ih(4,S);break;case 1:if(_c(k,S,p),y=S,k=y.stateNode,typeof k.componentDidMount=="function")try{k.componentDidMount()}catch(Ee){Xr(y,y.return,Ee)}if(y=S,k=y.updateQueue,k!==null){var V=y.stateNode;try{var se=k.shared.hiddenCallbacks;if(se!==null)for(k.shared.hiddenCallbacks=null,k=0;k<se.length;k++)V1(se[k],V)}catch(Ee){Xr(y,y.return,Ee)}}p&&M&64&&t2(S),sh(S,S.return);break;case 27:i2(S);case 26:case 5:_c(k,S,p),p&&y===null&&M&4&&n2(S),sh(S,S.return);break;case 12:_c(k,S,p);break;case 31:_c(k,S,p),p&&M&4&&u2(k,S);break;case 13:_c(k,S,p),p&&M&4&&d2(k,S);break;case 22:S.memoizedState===null&&_c(k,S,p),sh(S,S.return);break;case 30:break;default:_c(k,S,p)}l=l.sibling}}function Fk(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&&Gp(p))}function qk(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Gp(s))}function js(s,l,p,y){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)h2(s,l,p,y),l=l.sibling}function h2(s,l,p,y){var k=l.flags;switch(l.tag){case 0:case 11:case 15:js(s,l,p,y),k&2048&&ih(9,l);break;case 1:js(s,l,p,y);break;case 3:js(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&&Gp(s)));break;case 12:if(k&2048){js(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(se){Xr(l,l.return,se)}}else js(s,l,p,y);break;case 31:js(s,l,p,y);break;case 13:js(s,l,p,y);break;case 23:break;case 22:S=l.stateNode,M=l.alternate,l.memoizedState!==null?S._visibility&2?js(s,l,p,y):oh(s,l):S._visibility&2?js(s,l,p,y):(S._visibility|=2,Vd(s,l,p,y,(l.subtreeFlags&10256)!==0||!1)),k&2048&&Fk(M,l);break;case 24:js(s,l,p,y),k&2048&&qk(l.alternate,l);break;default:js(s,l,p,y)}}function Vd(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,se=y,Ee=M.flags;switch(M.tag){case 0:case 11:case 15:Vd(S,M,V,se,k),ih(8,M);break;case 23:break;case 22:var Fe=M.stateNode;M.memoizedState!==null?Fe._visibility&2?Vd(S,M,V,se,k):oh(S,M):(Fe._visibility|=2,Vd(S,M,V,se,k)),k&&Ee&2048&&Fk(M.alternate,M);break;case 24:Vd(S,M,V,se,k),k&&Ee&2048&&qk(M.alternate,M);break;default:Vd(S,M,V,se,k)}l=l.sibling}}function oh(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:oh(p,y),k&2048&&Fk(y.alternate,y);break;case 24:oh(p,y),k&2048&&qk(y.alternate,y);break;default:oh(p,y)}l=l.sibling}}var ch=8192;function Hd(s,l,p){if(s.subtreeFlags&ch)for(s=s.child;s!==null;)m2(s,l,p),s=s.sibling}function m2(s,l,p){switch(s.tag){case 26:Hd(s,l,p),s.flags&ch&&s.memoizedState!==null&&F8(p,Ms,s.memoizedState,s.memoizedProps);break;case 5:Hd(s,l,p);break;case 3:case 4:var y=Ms;Ms=zy(s.stateNode.containerInfo),Hd(s,l,p),Ms=y;break;case 22:s.memoizedState===null&&(y=s.alternate,y!==null&&y.memoizedState!==null?(y=ch,ch=16777216,Hd(s,l,p),ch=y):Hd(s,l,p));break;default:Hd(s,l,p)}}function g2(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 lh(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];pa=y,v2(y,s)}g2(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)y2(s),s=s.sibling}function y2(s){switch(s.tag){case 0:case 11:case 15:lh(s),s.flags&2048&&dl(9,s,s.return);break;case 3:lh(s);break;case 12:lh(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Ay(s)):lh(s);break;default:lh(s)}}function Ay(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];pa=y,v2(y,s)}g2(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:dl(8,l,l.return),Ay(l);break;case 22:p=l.stateNode,p._visibility&2&&(p._visibility&=-3,Ay(l));break;default:Ay(l)}s=s.sibling}}function v2(s,l){for(;pa!==null;){var p=pa;switch(p.tag){case 0:case 11:case 15:dl(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:Gp(p.memoizedState.cache)}if(y=p.child,y!==null)y.return=p,pa=y;else e:for(p=s;pa!==null;){y=pa;var k=y.sibling,S=y.return;if(c2(y),y===p){pa=null;break e}if(k!==null){k.return=S,pa=k;break e}pa=S}}}var t8={getCacheForType:function(s){var l=wa(Vn),p=l.data.get(s);return p===void 0&&(p=s(),l.data.set(s,p)),p},cacheSignal:function(){return wa(Vn).controller.signal}},r8=typeof WeakMap=="function"?WeakMap:Map,Ur=0,cn=null,yr=null,kr=0,Yr=0,Ai=null,fl=!1,Gd=!1,zk=!1,bc=0,On=0,pl=0,Iu=0,$k=0,Ri=0,Wd=0,uh=null,ri=null,Vk=!1,Ry=0,_2=0,Dy=1/0,Oy=null,hl=null,ia=0,ml=null,Kd=null,kc=0,Hk=0,Gk=null,b2=null,dh=0,Wk=null;function Di(){return(Ur&2)!==0&&kr!==0?kr&-kr:F.T!==null?Zk():Ge()}function k2(){if(Ri===0)if((kr&536870912)===0||Tr){var s=fn;fn<<=1,(fn&3932160)===0&&(fn=262144),Ri=s}else Ri=536870912;return s=xi.current,s!==null&&(s.flags|=32),Ri}function ni(s,l,p){(s===cn&&(Yr===2||Yr===9)||s.cancelPendingCommit!==null)&&(Yd(s,0),gl(s,kr,Ri,!1)),oe(s,p),((Ur&2)===0||s!==cn)&&(s===cn&&((Ur&2)===0&&(Iu|=p),On===4&&gl(s,kr,Ri,!1)),_o(s))}function w2(s,l,p){if((Ur&6)!==0)throw Error(n(327));var y=!p&&(l&127)===0&&(l&s.expiredLanes)===0||Pe(s,l),k=y?i8(s,l):Yk(s,l,!0),S=y;do{if(k===0){Gd&&!y&&gl(s,l,0,!1);break}else{if(p=s.current.alternate,S&&!n8(p)){k=Yk(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=uh;var se=V.current.memoizedState.isDehydrated;if(se&&(Yd(V,M).flags|=256),M=Yk(V,M,!1),M!==2){if(zk&&!se){V.errorRecoveryDisabledLanes|=S,Iu|=S,k=4;break e}S=ri,ri=k,S!==null&&(ri===null?ri=S:ri.push.apply(ri,S))}k=M}if(S=!1,k!==2)continue}}if(k===1){Yd(s,0),gl(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:gl(y,l,Ri,!fl);break e;case 2:ri=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(k=Ry+300-Je(),10<k)){if(gl(y,l,Ri,!fl),ge(y,0,!0)!==0)break e;kc=l,y.timeoutHandle=Z2(S2.bind(null,y,p,ri,Oy,Vk,l,Ri,Iu,Wd,fl,S,"Throttled",-0,0),k);break e}S2(y,p,ri,Oy,Vk,l,Ri,Iu,Wd,fl,S,null,-0,0)}}break}while(!0);_o(s)}function S2(s,l,p,y,k,S,M,V,se,Ee,Fe,We,Ae,Ie){if(s.timeoutHandle=-1,We=l.subtreeFlags,We&8192||(We&16785408)===16785408){We={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ba},m2(l,S,We);var Dt=(S&62914560)===S?Ry-Je():(S&4194048)===S?_2-Je():0;if(Dt=q8(We,Dt),Dt!==null){kc=S,s.cancelPendingCommit=Dt(D2.bind(null,s,l,S,p,y,k,M,V,se,Fe,We,null,Ae,Ie)),gl(s,S,M,!Ee);return}}D2(s,l,S,p,y,k,M,V,se)}function n8(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(!Ti(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 gl(s,l,p,y){l&=~$k,l&=~Iu,s.suspendedLanes|=l,s.pingedLanes&=~l,y&&(s.warmLanes|=l),y=s.expirationTimes;for(var k=l;0<k;){var S=31-yt(k),M=1<<S;y[S]=-1,k&=~M}p!==0&&Nt(s,p,l)}function Ny(){return(Ur&6)===0?(fh(0),!1):!0}function Kk(){if(yr!==null){if(Yr===0)var s=yr.return;else s=yr,uc=Tu=null,uk(s),Ud=null,Kp=0,s=yr;for(;s!==null;)e2(s.alternate,s),s=s.return;yr=null}}function Yd(s,l){var p=s.timeoutHandle;p!==-1&&(s.timeoutHandle=-1,S8(p)),p=s.cancelPendingCommit,p!==null&&(s.cancelPendingCommit=null,p()),kc=0,Kk(),cn=s,yr=p=cc(s.current,null),kr=l,Yr=0,Ai=null,fl=!1,Gd=Pe(s,l),zk=!1,Wd=Ri=$k=Iu=pl=On=0,ri=uh=null,Vk=!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-yt(y),S=1<<k;l|=s[k],y&=~S}return bc=l,ey(),p}function E2(s,l){ir=null,F.H=rh,l===Bd||l===cy?(l=F1(),Yr=3):l===Q0?(l=F1(),Yr=4):Yr=l===Ck?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Ai=l,yr===null&&(On=1,wy(s,Xi(l,s.current)))}function T2(){var s=xi.current;return s===null?!0:(kr&4194048)===kr?es===null:(kr&62914560)===kr||(kr&536870912)!==0?s===es:!1}function C2(){var s=F.H;return F.H=rh,s===null?rh:s}function x2(){var s=F.A;return F.A=t8,s}function Iy(){On=4,fl||(kr&4194048)!==kr&&xi.current!==null||(Gd=!0),(pl&134217727)===0&&(Iu&134217727)===0||cn===null||gl(cn,kr,Ri,!1)}function Yk(s,l,p){var y=Ur;Ur|=2;var k=C2(),S=x2();(cn!==s||kr!==l)&&(Oy=null,Yd(s,l)),l=!1;var M=On;e:do try{if(Yr!==0&&yr!==null){var V=yr,se=Ai;switch(Yr){case 8:Kk(),M=6;break e;case 3:case 2:case 9:case 6:xi.current===null&&(l=!0);var Ee=Yr;if(Yr=0,Ai=null,Xd(s,V,se,Ee),p&&Gd){M=0;break e}break;default:Ee=Yr,Yr=0,Ai=null,Xd(s,V,se,Ee)}}a8(),M=On;break}catch(Fe){E2(s,Fe)}while(!0);return l&&s.shellSuspendCounter++,uc=Tu=null,Ur=y,F.H=k,F.A=S,yr===null&&(cn=null,kr=0,ey()),M}function a8(){for(;yr!==null;)P2(yr)}function i8(s,l){var p=Ur;Ur|=2;var y=C2(),k=x2();cn!==s||kr!==l?(Oy=null,Dy=Je()+500,Yd(s,l)):Gd=Pe(s,l);e:do try{if(Yr!==0&&yr!==null){l=yr;var S=Ai;t:switch(Yr){case 1:Yr=0,Ai=null,Xd(s,l,S,1);break;case 2:case 9:if(B1(S)){Yr=0,Ai=null,A2(l);break}l=function(){Yr!==2&&Yr!==9||cn!==s||(Yr=7),_o(s)},S.then(l,l);break e;case 3:Yr=7;break e;case 4:Yr=5;break e;case 7:B1(S)?(Yr=0,Ai=null,A2(l)):(Yr=0,Ai=null,Xd(s,l,S,7));break;case 5:var M=null;switch(yr.tag){case 26:M=yr.memoizedState;case 5:case 27:var V=yr;if(M?hD(M):V.stateNode.complete){Yr=0,Ai=null;var se=V.sibling;if(se!==null)yr=se;else{var Ee=V.return;Ee!==null?(yr=Ee,My(Ee)):yr=null}break t}}Yr=0,Ai=null,Xd(s,l,S,5);break;case 6:Yr=0,Ai=null,Xd(s,l,S,6);break;case 8:Kk(),On=6;break e;default:throw Error(n(462))}}s8();break}catch(Fe){E2(s,Fe)}while(!0);return uc=Tu=null,F.H=y,F.A=k,Ur=p,yr!==null?0:(cn=null,kr=0,ey(),On)}function s8(){for(;yr!==null&&!it();)P2(yr)}function P2(s){var l=QR(s.alternate,s,bc);s.memoizedProps=s.pendingProps,l===null?My(s):yr=l}function A2(s){var l=s,p=l.alternate;switch(l.tag){case 15:case 0:l=GR(p,l,l.pendingProps,l.type,void 0,kr);break;case 11:l=GR(p,l,l.pendingProps,l.type.render,l.ref,kr);break;case 5:uk(l);default:e2(p,l),l=yr=x1(l,bc),l=QR(p,l,bc)}s.memoizedProps=s.pendingProps,l===null?My(s):yr=l}function Xd(s,l,p,y){uc=Tu=null,uk(l),Ud=null,Kp=0;var k=l.return;try{if(K$(s,k,l,p,kr)){On=1,wy(s,Xi(p,s.current)),yr=null;return}}catch(S){if(k!==null)throw yr=k,S;On=1,wy(s,Xi(p,s.current)),yr=null;return}l.flags&32768?(Tr||y===1?s=!0:Gd||(kr&536870912)!==0?s=!1:(fl=s=!0,(y===2||y===9||y===3||y===6)&&(y=xi.current,y!==null&&y.tag===13&&(y.flags|=16384))),R2(l,s)):My(l)}function My(s){var l=s;do{if((l.flags&32768)!==0){R2(l,fl);return}s=l.return;var p=J$(l.alternate,l,bc);if(p!==null){yr=p;return}if(l=l.sibling,l!==null){yr=l;return}yr=l=s}while(l!==null);On===0&&(On=5)}function R2(s,l){do{var p=Q$(s.alternate,s);if(p!==null){p.flags&=32767,yr=p;return}if(p=s.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(s=s.sibling,s!==null)){yr=s;return}yr=s=p}while(s!==null);On=6,yr=null}function D2(s,l,p,y,k,S,M,V,se){s.cancelPendingCommit=null;do jy();while(ia!==0);if((Ur&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(S=l.lanes|l.childLanes,S|=L0,ct(s,p,S,M,V,se),s===cn&&(yr=cn=null,kr=0),Kd=l,ml=s,kc=p,Hk=S,Gk=k,b2=y,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,u8(ot,function(){return j2(),null})):(s.callbackNode=null,s.callbackPriority=0),y=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||y){y=F.T,F.T=null,k=X.p,X.p=2,M=Ur,Ur|=4;try{Z$(s,l,p)}finally{Ur=M,X.p=k,F.T=y}}ia=1,O2(),N2(),I2()}}function O2(){if(ia===1){ia=0;var s=ml,l=Kd,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var y=X.p;X.p=2;var k=Ur;Ur|=4;try{f2(l,s);var S=ow,M=v1(s.containerInfo),V=S.focusedElem,se=S.selectionRange;if(M!==V&&V&&V.ownerDocument&&y1(V.ownerDocument.documentElement,V)){if(se!==null&&O0(V)){var Ee=se.start,Fe=se.end;if(Fe===void 0&&(Fe=Ee),"selectionStart"in V)V.selectionStart=Ee,V.selectionEnd=Math.min(Fe,V.value.length);else{var We=V.ownerDocument||document,Ae=We&&We.defaultView||window;if(Ae.getSelection){var Ie=Ae.getSelection(),Dt=V.textContent.length,Kt=Math.min(se.start,Dt),en=se.end===void 0?Kt:Math.min(se.end,Dt);!Ie.extend&&Kt>en&&(M=en,en=Kt,Kt=M);var ye=g1(V,Kt),le=g1(V,en);if(ye&&le&&(Ie.rangeCount!==1||Ie.anchorNode!==ye.node||Ie.anchorOffset!==ye.offset||Ie.focusNode!==le.node||Ie.focusOffset!==le.offset)){var Se=We.createRange();Se.setStart(ye.node,ye.offset),Ie.removeAllRanges(),Kt>en?(Ie.addRange(Se),Ie.extend(le.node,le.offset)):(Se.setEnd(le.node,le.offset),Ie.addRange(Se))}}}}for(We=[],Ie=V;Ie=Ie.parentNode;)Ie.nodeType===1&&We.push({element:Ie,left:Ie.scrollLeft,top:Ie.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<We.length;V++){var ze=We[V];ze.element.scrollLeft=ze.left,ze.element.scrollTop=ze.top}}Ky=!!sw,ow=sw=null}finally{Ur=k,X.p=y,F.T=p}}s.current=l,ia=2}}function N2(){if(ia===2){ia=0;var s=ml,l=Kd,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var y=X.p;X.p=2;var k=Ur;Ur|=4;try{o2(s,l.alternate,l)}finally{Ur=k,X.p=y,F.T=p}}ia=3}}function I2(){if(ia===4||ia===3){ia=0,mt();var s=ml,l=Kd,p=kc,y=b2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?ia=5:(ia=0,Kd=ml=null,M2(s,s.pendingLanes));var k=s.pendingLanes;if(k===0&&(hl=null),Kr(p),l=l.stateNode,be&&typeof be.onCommitFiberRoot=="function")try{be.onCommitFiberRoot(rt,l,void 0,(l.current.flags&128)===128)}catch{}if(y!==null){l=F.T,k=X.p,X.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,X.p=k}}(kc&3)!==0&&jy(),_o(s),k=s.pendingLanes,(p&261930)!==0&&(k&42)!==0?s===Wk?dh++:(dh=0,Wk=s):dh=0,fh(0)}}function M2(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,Gp(l)))}function jy(){return O2(),N2(),I2(),j2()}function j2(){if(ia!==5)return!1;var s=ml,l=Hk;Hk=0;var p=Kr(kc),y=F.T,k=X.p;try{X.p=32>p?32:p,F.T=null,p=Gk,Gk=null;var S=ml,M=kc;if(ia=0,Kd=ml=null,kc=0,(Ur&6)!==0)throw Error(n(331));var V=Ur;if(Ur|=4,y2(S.current),h2(S,S.current,M,p),Ur=V,fh(0,!1),be&&typeof be.onPostCommitFiberRoot=="function")try{be.onPostCommitFiberRoot(rt,S)}catch{}return!0}finally{X.p=k,F.T=y,M2(s,l)}}function L2(s,l,p){l=Xi(p,l),l=Tk(s.stateNode,l,2),s=cl(s,l,2),s!==null&&(oe(s,2),_o(s))}function Xr(s,l,p){if(s.tag===3)L2(s,s,p);else for(;l!==null;){if(l.tag===3){L2(l,s,p);break}else if(l.tag===1){var y=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(hl===null||!hl.has(y))){s=Xi(p,s),p=BR(2),y=cl(l,p,2),y!==null&&(UR(p,y,l,s),oe(y,2),_o(y));break}}l=l.return}}function Xk(s,l,p){var y=s.pingCache;if(y===null){y=s.pingCache=new r8;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)||(zk=!0,k.add(p),s=o8.bind(null,s,l,p),l.then(s,s))}function o8(s,l,p){var y=s.pingCache;y!==null&&y.delete(l),s.pingedLanes|=s.suspendedLanes&p,s.warmLanes&=~p,cn===s&&(kr&p)===p&&(On===4||On===3&&(kr&62914560)===kr&&300>Je()-Ry?(Ur&2)===0&&Yd(s,0):$k|=p,Wd===kr&&(Wd=0)),_o(s)}function B2(s,l){l===0&&(l=W()),s=wu(s,l),s!==null&&(oe(s,l),_o(s))}function c8(s){var l=s.memoizedState,p=0;l!==null&&(p=l.retryLane),B2(s,p)}function l8(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),B2(s,p)}function u8(s,l){return at(s,l)}var Ly=null,Jd=null,Jk=!1,By=!1,Qk=!1,yl=0;function _o(s){s!==Jd&&s.next===null&&(Jd===null?Ly=Jd=s:Jd=Jd.next=s),By=!0,Jk||(Jk=!0,f8())}function fh(s,l){if(!Qk&&By){Qk=!0;do for(var p=!1,y=Ly;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-yt(42|s)+1)-1,S&=k&~(M&~V),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(p=!0,z2(y,S))}else S=kr,S=ge(y,y===cn?S:0,y.cancelPendingCommit!==null||y.timeoutHandle!==-1),(S&3)===0||Pe(y,S)||(p=!0,z2(y,S));y=y.next}while(p);Qk=!1}}function d8(){U2()}function U2(){By=Jk=!1;var s=0;yl!==0&&w8()&&(s=yl);for(var l=Je(),p=null,y=Ly;y!==null;){var k=y.next,S=F2(y,l);S===0?(y.next=null,p===null?Ly=k:p.next=k,k===null&&(Jd=p)):(p=y,(s!==0||(S&3)!==0)&&(By=!0)),y=k}ia!==0&&ia!==5||fh(s),yl!==0&&(yl=0)}function F2(s,l){for(var p=s.suspendedLanes,y=s.pingedLanes,k=s.expirationTimes,S=s.pendingLanes&-62914561;0<S;){var M=31-yt(S),V=1<<M,se=k[M];se===-1?((V&p)===0||(V&y)!==0)&&(k[M]=De(V,l)):se<=l&&(s.expiredLanes|=V),S&=~V}if(l=cn,p=kr,p=ge(s,s===l?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y=s.callbackNode,p===0||s===l&&(Yr===2||Yr===9)||s.cancelPendingCommit!==null)return y!==null&&y!==null&&Ke(y),s.callbackNode=null,s.callbackPriority=0;if((p&3)===0||Pe(s,p)){if(l=p&-p,l===s.callbackPriority)return l;switch(y!==null&&Ke(y),Kr(p)){case 2:case 8:p=je;break;case 32:p=ot;break;case 268435456:p=Ft;break;default:p=ot}return y=q2.bind(null,s),p=at(p,y),s.callbackPriority=l,s.callbackNode=p,l}return y!==null&&y!==null&&Ke(y),s.callbackPriority=2,s.callbackNode=null,2}function q2(s,l){if(ia!==0&&ia!==5)return s.callbackNode=null,s.callbackPriority=0,null;var p=s.callbackNode;if(jy()&&s.callbackNode!==p)return null;var y=kr;return y=ge(s,s===cn?y:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y===0?null:(w2(s,y,l),F2(s,Je()),s.callbackNode!=null&&s.callbackNode===p?q2.bind(null,s):null)}function z2(s,l){if(jy())return null;w2(s,l,!0)}function f8(){E8(function(){(Ur&6)!==0?at(Be,d8):U2()})}function Zk(){if(yl===0){var s=jd;s===0&&(s=dr,dr<<=1,(dr&261888)===0&&(dr=256)),yl=s}return yl}function $2(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ds(""+s)}function V2(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 p8(s,l,p,y,k){if(l==="submit"&&p&&p.stateNode===k){var S=$2((k[Ot]||null).action),M=y.submitter;M&&(l=(l=M[Ot]||null)?$2(l.formAction):M.getAttribute("formAction"),l!==null&&(S=l,M=null));var V=new sc("action","action",null,y,k);s.push({event:V,listeners:[{instance:null,listener:function(){if(y.defaultPrevented){if(yl!==0){var se=M?V2(k,M):new FormData(k);_k(p,{pending:!0,data:se,method:k.method,action:S},null,se)}}else typeof S=="function"&&(V.preventDefault(),se=M?V2(k,M):new FormData(k),_k(p,{pending:!0,data:se,method:k.method,action:S},S,se))},currentTarget:k}]})}}for(var ew=0;ew<j0.length;ew++){var tw=j0[ew],h8=tw.toLowerCase(),m8=tw[0].toUpperCase()+tw.slice(1);Is(h8,"on"+m8)}Is(k1,"onAnimationEnd"),Is(w1,"onAnimationIteration"),Is(S1,"onAnimationStart"),Is("dblclick","onDoubleClick"),Is("focusin","onFocus"),Is("focusout","onBlur"),Is(D$,"onTransitionRun"),Is(O$,"onTransitionStart"),Is(N$,"onTransitionCancel"),Is(E1,"onTransitionEnd"),Hi("onMouseEnter",["mouseout","mouseover"]),Hi("onMouseLeave",["mouseout","mouseover"]),Hi("onPointerEnter",["pointerout","pointerover"]),Hi("onPointerLeave",["pointerout","pointerover"]),Rs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Rs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Rs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Rs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Rs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Rs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ph="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(" "),g8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ph));function H2(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],se=V.instance,Ee=V.currentTarget;if(V=V.listener,se!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Ee;try{S(k)}catch(Fe){Zg(Fe)}k.currentTarget=null,S=se}else for(M=0;M<y.length;M++){if(V=y[M],se=V.instance,Ee=V.currentTarget,V=V.listener,se!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Ee;try{S(k)}catch(Fe){Zg(Fe)}k.currentTarget=null,S=se}}}}function vr(s,l){var p=l[Cn];p===void 0&&(p=l[Cn]=new Set);var y=s+"__bubble";p.has(y)||(G2(l,s,2,!1),p.add(y))}function rw(s,l,p){var y=0;l&&(y|=4),G2(p,s,y,l)}var Uy="_reactListening"+Math.random().toString(36).slice(2);function nw(s){if(!s[Uy]){s[Uy]=!0,Ps.forEach(function(p){p!=="selectionchange"&&(g8.has(p)||rw(p,!1,s),rw(p,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Uy]||(l[Uy]=!0,rw("selectionchange",!1,l))}}function G2(s,l,p,y){switch(kD(l)){case 2:var k=V8;break;case 8:k=H8;break;default:k=vw}p=k.bind(null,l,p,s),k=void 0,!qa||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 aw(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 se=M.tag;if((se===3||se===4)&&M.stateNode.containerInfo===k)return;M=M.return}for(;V!==null;){if(M=mn(V),M===null)return;if(se=M.tag,se===5||se===6||se===26||se===27){y=S=M;continue e}V=V.parentNode}}y=y.return}Br(function(){var Ee=S,Fe=Os(p),We=[];e:{var Ae=T1.get(s);if(Ae!==void 0){var Ie=sc,Dt=s;switch(s){case"keypress":if(Ed(p)===0)break e;case"keydown":case"keyup":Ie=Jg;break;case"focusin":Dt="focus",Ie=bt;break;case"focusout":Dt="blur",Ie=bt;break;case"beforeblur":case"afterblur":Ie=bt;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":Ie=Le;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ie=Ve;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ie=f$;break;case k1:case w1:case S1:Ie=sn;break;case E1:Ie=h$;break;case"scroll":case"scrollend":Ie=x0;break;case"wheel":Ie=g$;break;case"copy":case"cut":case"paste":Ie=on;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ie=r1;break;case"toggle":case"beforetoggle":Ie=v$}var Kt=(l&4)!==0,en=!Kt&&(s==="scroll"||s==="scrollend"),ye=Kt?Ae!==null?Ae+"Capture":null:Ae;Kt=[];for(var le=Ee,Se;le!==null;){var ze=le;if(Se=ze.stateNode,ze=ze.tag,ze!==5&&ze!==26&&ze!==27||Se===null||ye===null||(ze=ra(le,ye),ze!=null&&Kt.push(hh(le,ze,Se))),en)break;le=le.return}0<Kt.length&&(Ae=new Ie(Ae,Dt,null,p,Fe),We.push({event:Ae,listeners:Kt}))}}if((l&7)===0){e:{if(Ae=s==="mouseover"||s==="pointerover",Ie=s==="mouseout"||s==="pointerout",Ae&&p!==Qc&&(Dt=p.relatedTarget||p.fromElement)&&(mn(Dt)||Dt[An]))break e;if((Ie||Ae)&&(Ae=Fe.window===Fe?Fe:(Ae=Fe.ownerDocument)?Ae.defaultView||Ae.parentWindow:window,Ie?(Dt=p.relatedTarget||p.toElement,Ie=Ee,Dt=Dt?mn(Dt):null,Dt!==null&&(en=i(Dt),Kt=Dt.tag,Dt!==en||Kt!==5&&Kt!==27&&Kt!==6)&&(Dt=null)):(Ie=null,Dt=Ee),Ie!==Dt)){if(Kt=Le,ze="onMouseLeave",ye="onMouseEnter",le="mouse",(s==="pointerout"||s==="pointerover")&&(Kt=r1,ze="onPointerLeave",ye="onPointerEnter",le="pointer"),en=Ie==null?Ae:ki(Ie),Se=Dt==null?Ae:ki(Dt),Ae=new Kt(ze,le+"leave",Ie,p,Fe),Ae.target=en,Ae.relatedTarget=Se,ze=null,mn(Fe)===Ee&&(Kt=new Kt(ye,le+"enter",Dt,p,Fe),Kt.target=Se,Kt.relatedTarget=en,ze=Kt),en=ze,Ie&&Dt)t:{for(Kt=y8,ye=Ie,le=Dt,Se=0,ze=ye;ze;ze=Kt(ze))Se++;ze=0;for(var zt=le;zt;zt=Kt(zt))ze++;for(;0<Se-ze;)ye=Kt(ye),Se--;for(;0<ze-Se;)le=Kt(le),ze--;for(;Se--;){if(ye===le||le!==null&&ye===le.alternate){Kt=ye;break t}ye=Kt(ye),le=Kt(le)}Kt=null}else Kt=null;Ie!==null&&W2(We,Ae,Ie,Kt,!1),Dt!==null&&en!==null&&W2(We,en,Dt,Kt,!0)}}e:{if(Ae=Ee?ki(Ee):window,Ie=Ae.nodeName&&Ae.nodeName.toLowerCase(),Ie==="select"||Ie==="input"&&Ae.type==="file")var Ir=u1;else if(c1(Ae))if(d1)Ir=P$;else{Ir=C$;var Lt=T$}else Ie=Ae.nodeName,!Ie||Ie.toLowerCase()!=="input"||Ae.type!=="checkbox"&&Ae.type!=="radio"?Ee&&an(Ee.elementType)&&(Ir=u1):Ir=x$;if(Ir&&(Ir=Ir(s,Ee))){l1(We,Ir,p,Fe);break e}Lt&&Lt(s,Ae,Ee),s==="focusout"&&Ee&&Ae.type==="number"&&Ee.memoizedProps.value!=null&&Jc(Ae,"number",Ae.value)}switch(Lt=Ee?ki(Ee):window,s){case"focusin":(c1(Lt)||Lt.contentEditable==="true")&&(Pd=Lt,N0=Ee,$p=null);break;case"focusout":$p=N0=Pd=null;break;case"mousedown":I0=!0;break;case"contextmenu":case"mouseup":case"dragend":I0=!1,_1(We,p,Fe);break;case"selectionchange":if(R$)break;case"keydown":case"keyup":_1(We,p,Fe)}var sr;if(A0)e:{switch(s){case"compositionstart":var wr="onCompositionStart";break e;case"compositionend":wr="onCompositionEnd";break e;case"compositionupdate":wr="onCompositionUpdate";break e}wr=void 0}else xd?s1(s,p)&&(wr="onCompositionEnd"):s==="keydown"&&p.keyCode===229&&(wr="onCompositionStart");wr&&(n1&&p.locale!=="ko"&&(xd||wr!=="onCompositionStart"?wr==="onCompositionEnd"&&xd&&(sr=ac()):(aa=Fe,$n="value"in aa?aa.value:aa.textContent,xd=!0)),Lt=Fy(Ee,wr),0<Lt.length&&(wr=new oc(wr,s,null,p,Fe),We.push({event:wr,listeners:Lt}),sr?wr.data=sr:(sr=o1(p),sr!==null&&(wr.data=sr)))),(sr=b$?k$(s,p):w$(s,p))&&(wr=Fy(Ee,"onBeforeInput"),0<wr.length&&(Lt=new oc("onBeforeInput","beforeinput",null,p,Fe),We.push({event:Lt,listeners:wr}),Lt.data=sr)),p8(We,s,Ee,p,Fe)}H2(We,l)})}function hh(s,l,p){return{instance:s,listener:l,currentTarget:p}}function Fy(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=ra(s,p),k!=null&&y.unshift(hh(s,k,S)),k=ra(s,l),k!=null&&y.push(hh(s,k,S))),s.tag===3)return y;s=s.return}return[]}function y8(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function W2(s,l,p,y,k){for(var S=l._reactName,M=[];p!==null&&p!==y;){var V=p,se=V.alternate,Ee=V.stateNode;if(V=V.tag,se!==null&&se===y)break;V!==5&&V!==26&&V!==27||Ee===null||(se=Ee,k?(Ee=ra(p,S),Ee!=null&&M.unshift(hh(p,Ee,se))):k||(Ee=ra(p,S),Ee!=null&&M.push(hh(p,Ee,se)))),p=p.return}M.length!==0&&s.push({event:l,listeners:M})}var v8=/\r\n?/g,_8=/\u0000|\uFFFD/g;function K2(s){return(typeof s=="string"?s:""+s).replace(v8,`
`).replace(_8,"")}function Y2(s,l){return l=K2(l),K2(s)===l}function Zr(s,l,p,y,k,S){switch(p){case"children":typeof y=="string"?l==="body"||l==="textarea"&&y===""||Qe(s,y):(typeof y=="number"||typeof y=="bigint")&&l!=="body"&&Qe(s,""+y);break;case"className":fo(s,"class",y);break;case"tabIndex":fo(s,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":fo(s,p,y);break;case"style":Nr(s,y,S);break;case"data":if(l!=="object"){fo(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=Ds(""+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"&&Zr(s,l,"name",k.name,k,null),Zr(s,l,"formEncType",k.formEncType,k,null),Zr(s,l,"formMethod",k.formMethod,k,null),Zr(s,l,"formTarget",k.formTarget,k,null)):(Zr(s,l,"encType",k.encType,k,null),Zr(s,l,"method",k.method,k,null),Zr(s,l,"target",k.target,k,null)));if(y==null||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(p);break}y=Ds(""+y),s.setAttribute(p,y);break;case"onClick":y!=null&&(s.onclick=ba);break;case"onScroll":y!=null&&vr("scroll",s);break;case"onScrollEnd":y!=null&&vr("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=Ds(""+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":vr("beforetoggle",s),vr("toggle",s),nc(s,"popover",y);break;case"xlinkActuate":va(s,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":va(s,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":va(s,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":va(s,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":va(s,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":va(s,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":va(s,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":va(s,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":va(s,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":nc(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=Rn.get(p)||p,nc(s,p,y))}}function iw(s,l,p,y,k,S){switch(p){case"style":Nr(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"?Qe(s,y):(typeof y=="number"||typeof y=="bigint")&&Qe(s,""+y);break;case"onScroll":y!=null&&vr("scroll",s);break;case"onScrollEnd":y!=null&&vr("scrollend",s);break;case"onClick":y!=null&&(s.onclick=ba);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!As.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[Ot]||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,""):nc(s,p,y)}}}function Ea(s,l,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vr("error",s),vr("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:Zr(s,l,S,M,p,null)}}k&&Zr(s,l,"srcSet",p.srcSet,p,null),y&&Zr(s,l,"src",p.src,p,null);return;case"input":vr("invalid",s);var V=S=M=k=null,se=null,Ee=null;for(y in p)if(p.hasOwnProperty(y)){var Fe=p[y];if(Fe!=null)switch(y){case"name":k=Fe;break;case"type":M=Fe;break;case"checked":se=Fe;break;case"defaultChecked":Ee=Fe;break;case"value":S=Fe;break;case"defaultValue":V=Fe;break;case"children":case"dangerouslySetInnerHTML":if(Fe!=null)throw Error(n(137,l));break;default:Zr(s,l,y,Fe,p,null)}}wi(s,S,V,se,Ee,M,k,!1);return;case"select":vr("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:Zr(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":vr("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:Zr(s,l,M,V,p,null)}ut(s,y,k,S);return;case"option":for(se in p)if(p.hasOwnProperty(se)&&(y=p[se],y!=null))switch(se){case"selected":s.selected=y&&typeof y!="function"&&typeof y!="symbol";break;default:Zr(s,l,se,y,p,null)}return;case"dialog":vr("beforetoggle",s),vr("toggle",s),vr("cancel",s),vr("close",s);break;case"iframe":case"object":vr("load",s);break;case"video":case"audio":for(y=0;y<ph.length;y++)vr(ph[y],s);break;case"image":vr("error",s),vr("load",s);break;case"details":vr("toggle",s);break;case"embed":case"source":case"link":vr("error",s),vr("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(Ee in p)if(p.hasOwnProperty(Ee)&&(y=p[Ee],y!=null))switch(Ee){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Zr(s,l,Ee,y,p,null)}return;default:if(an(l)){for(Fe in p)p.hasOwnProperty(Fe)&&(y=p[Fe],y!==void 0&&iw(s,l,Fe,y,p,void 0));return}}for(V in p)p.hasOwnProperty(V)&&(y=p[V],y!=null&&Zr(s,l,V,y,p,null))}function b8(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,se=null,Ee=null,Fe=null;for(Ie in p){var We=p[Ie];if(p.hasOwnProperty(Ie)&&We!=null)switch(Ie){case"checked":break;case"value":break;case"defaultValue":se=We;default:y.hasOwnProperty(Ie)||Zr(s,l,Ie,null,y,We)}}for(var Ae in y){var Ie=y[Ae];if(We=p[Ae],y.hasOwnProperty(Ae)&&(Ie!=null||We!=null))switch(Ae){case"type":S=Ie;break;case"name":k=Ie;break;case"checked":Ee=Ie;break;case"defaultChecked":Fe=Ie;break;case"value":M=Ie;break;case"defaultValue":V=Ie;break;case"children":case"dangerouslySetInnerHTML":if(Ie!=null)throw Error(n(137,l));break;default:Ie!==We&&Zr(s,l,Ae,Ie,y,We)}}ho(s,M,V,se,Ee,Fe,S,k);return;case"select":Ie=M=V=Ae=null;for(S in p)if(se=p[S],p.hasOwnProperty(S)&&se!=null)switch(S){case"value":break;case"multiple":Ie=se;default:y.hasOwnProperty(S)||Zr(s,l,S,null,y,se)}for(k in y)if(S=y[k],se=p[k],y.hasOwnProperty(k)&&(S!=null||se!=null))switch(k){case"value":Ae=S;break;case"defaultValue":V=S;break;case"multiple":M=S;default:S!==se&&Zr(s,l,k,S,y,se)}l=V,p=M,y=Ie,Ae!=null?_e(s,!!p,Ae,!1):!!y!=!!p&&(l!=null?_e(s,!!p,l,!0):_e(s,!!p,p?[]:"",!1));return;case"textarea":Ie=Ae=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:Zr(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":Ae=k;break;case"defaultValue":Ie=k;break;case"children":break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(n(91));break;default:k!==S&&Zr(s,l,M,k,y,S)}et(s,Ae,Ie);return;case"option":for(var Dt in p)if(Ae=p[Dt],p.hasOwnProperty(Dt)&&Ae!=null&&!y.hasOwnProperty(Dt))switch(Dt){case"selected":s.selected=!1;break;default:Zr(s,l,Dt,null,y,Ae)}for(se in y)if(Ae=y[se],Ie=p[se],y.hasOwnProperty(se)&&Ae!==Ie&&(Ae!=null||Ie!=null))switch(se){case"selected":s.selected=Ae&&typeof Ae!="function"&&typeof Ae!="symbol";break;default:Zr(s,l,se,Ae,y,Ie)}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 Kt in p)Ae=p[Kt],p.hasOwnProperty(Kt)&&Ae!=null&&!y.hasOwnProperty(Kt)&&Zr(s,l,Kt,null,y,Ae);for(Ee in y)if(Ae=y[Ee],Ie=p[Ee],y.hasOwnProperty(Ee)&&Ae!==Ie&&(Ae!=null||Ie!=null))switch(Ee){case"children":case"dangerouslySetInnerHTML":if(Ae!=null)throw Error(n(137,l));break;default:Zr(s,l,Ee,Ae,y,Ie)}return;default:if(an(l)){for(var en in p)Ae=p[en],p.hasOwnProperty(en)&&Ae!==void 0&&!y.hasOwnProperty(en)&&iw(s,l,en,void 0,y,Ae);for(Fe in y)Ae=y[Fe],Ie=p[Fe],!y.hasOwnProperty(Fe)||Ae===Ie||Ae===void 0&&Ie===void 0||iw(s,l,Fe,Ae,y,Ie);return}}for(var ye in p)Ae=p[ye],p.hasOwnProperty(ye)&&Ae!=null&&!y.hasOwnProperty(ye)&&Zr(s,l,ye,null,y,Ae);for(We in y)Ae=y[We],Ie=p[We],!y.hasOwnProperty(We)||Ae===Ie||Ae==null&&Ie==null||Zr(s,l,We,Ae,y,Ie)}function X2(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function k8(){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&&X2(M)){for(M=0,V=k.responseEnd,y+=1;y<p.length;y++){var se=p[y],Ee=se.startTime;if(Ee>V)break;var Fe=se.transferSize,We=se.initiatorType;Fe&&X2(We)&&(se=se.responseEnd,M+=Fe*(se<V?1:(V-Ee)/(se-Ee)))}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 sw=null,ow=null;function qy(s){return s.nodeType===9?s:s.ownerDocument}function J2(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 Q2(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 cw(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 lw=null;function w8(){var s=window.event;return s&&s.type==="popstate"?s===lw?!1:(lw=s,!0):(lw=null,!1)}var Z2=typeof setTimeout=="function"?setTimeout:void 0,S8=typeof clearTimeout=="function"?clearTimeout:void 0,eD=typeof Promise=="function"?Promise:void 0,E8=typeof queueMicrotask=="function"?queueMicrotask:typeof eD<"u"?function(s){return eD.resolve(null).then(s).catch(T8)}:Z2;function T8(s){setTimeout(function(){throw s})}function vl(s){return s==="head"}function tD(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),tf(l);return}y--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")y++;else if(p==="html")mh(s.ownerDocument.documentElement);else if(p==="head"){p=s.ownerDocument.head,mh(p);for(var S=p.firstChild;S;){var M=S.nextSibling,V=S.nodeName;S[nn]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&S.rel.toLowerCase()==="stylesheet"||p.removeChild(S),S=M}}else p==="body"&&mh(s.ownerDocument.body);p=k}while(p);tf(l)}function rD(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 uw(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":uw(p),ua(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}s.removeChild(p)}}function C8(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[nn])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=ts(s.nextSibling),s===null)break}return null}function x8(s,l,p){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!p||(s=ts(s.nextSibling),s===null))return null;return s}function nD(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=ts(s.nextSibling),s===null))return null;return s}function dw(s){return s.data==="$?"||s.data==="$~"}function fw(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function P8(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 ts(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 pw=null;function aD(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var p=s.data;if(p==="/$"||p==="/&"){if(l===0)return ts(s.nextSibling);l--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||l++}s=s.nextSibling}return null}function iD(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 sD(s,l,p){switch(l=qy(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 mh(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);ua(s)}var rs=new Map,oD=new Set;function zy(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var wc=X.d;X.d={f:A8,r:R8,D:D8,C:O8,L:N8,m:I8,X:j8,S:M8,M:L8};function A8(){var s=wc.f(),l=Ny();return s||l}function R8(s){var l=xs(s);l!==null&&l.tag===5&&l.type==="form"?ER(l):wc.r(s)}var Qd=typeof document>"u"?null:document;function cD(s,l,p){var y=Qd;if(y&&typeof l=="string"&&l){var k=da(l);k='link[rel="'+s+'"][href="'+k+'"]',typeof p=="string"&&(k+='[crossorigin="'+p+'"]'),oD.has(k)||(oD.add(k),s={rel:s,crossOrigin:p,href:l},y.querySelector(k)===null&&(l=y.createElement("link"),Ea(l,"link",s),gn(l),y.head.appendChild(l)))}}function D8(s){wc.D(s),cD("dns-prefetch",s,null)}function O8(s,l){wc.C(s,l),cD("preconnect",s,l)}function N8(s,l,p){wc.L(s,l,p);var y=Qd;if(y&&s&&l){var k='link[rel="preload"][as="'+da(l)+'"]';l==="image"&&p&&p.imageSrcSet?(k+='[imagesrcset="'+da(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(k+='[imagesizes="'+da(p.imageSizes)+'"]')):k+='[href="'+da(s)+'"]';var S=k;switch(l){case"style":S=Zd(s);break;case"script":S=ef(s)}rs.has(S)||(s=h({rel:"preload",href:l==="image"&&p&&p.imageSrcSet?void 0:s,as:l},p),rs.set(S,s),y.querySelector(k)!==null||l==="style"&&y.querySelector(gh(S))||l==="script"&&y.querySelector(yh(S))||(l=y.createElement("link"),Ea(l,"link",s),gn(l),y.head.appendChild(l)))}}function I8(s,l){wc.m(s,l);var p=Qd;if(p&&s){var y=l&&typeof l.as=="string"?l.as:"script",k='link[rel="modulepreload"][as="'+da(y)+'"][href="'+da(s)+'"]',S=k;switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=ef(s)}if(!rs.has(S)&&(s=h({rel:"modulepreload",href:s},l),rs.set(S,s),p.querySelector(k)===null)){switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(yh(S)))return}y=p.createElement("link"),Ea(y,"link",s),gn(y),p.head.appendChild(y)}}}function M8(s,l,p){wc.S(s,l,p);var y=Qd;if(y&&s){var k=ta(y).hoistableStyles,S=Zd(s);l=l||"default";var M=k.get(S);if(!M){var V={loading:0,preload:null};if(M=y.querySelector(gh(S)))V.loading=5;else{s=h({rel:"stylesheet",href:s,"data-precedence":l},p),(p=rs.get(S))&&hw(s,p);var se=M=y.createElement("link");gn(se),Ea(se,"link",s),se._p=new Promise(function(Ee,Fe){se.onload=Ee,se.onerror=Fe}),se.addEventListener("load",function(){V.loading|=1}),se.addEventListener("error",function(){V.loading|=2}),V.loading|=4,$y(M,l,y)}M={type:"stylesheet",instance:M,count:1,state:V},k.set(S,M)}}}function j8(s,l){wc.X(s,l);var p=Qd;if(p&&s){var y=ta(p).hoistableScripts,k=ef(s),S=y.get(k);S||(S=p.querySelector(yh(k)),S||(s=h({src:s,async:!0},l),(l=rs.get(k))&&mw(s,l),S=p.createElement("script"),gn(S),Ea(S,"link",s),p.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},y.set(k,S))}}function L8(s,l){wc.M(s,l);var p=Qd;if(p&&s){var y=ta(p).hoistableScripts,k=ef(s),S=y.get(k);S||(S=p.querySelector(yh(k)),S||(s=h({src:s,async:!0,type:"module"},l),(l=rs.get(k))&&mw(s,l),S=p.createElement("script"),gn(S),Ea(S,"link",s),p.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},y.set(k,S))}}function lD(s,l,p,y){var k=(k=ce.current)?zy(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=Zd(p.href),p=ta(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=Zd(p.href);var S=ta(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(gh(s)))&&!S._p&&(M.instance=S,M.state.loading=5),rs.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},rs.set(s,p),S||B8(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=ef(p),p=ta(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 Zd(s){return'href="'+da(s)+'"'}function gh(s){return'link[rel="stylesheet"]['+s+"]"}function uD(s){return h({},s,{"data-precedence":s.precedence,precedence:null})}function B8(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}),Ea(l,"link",p),gn(l),s.head.appendChild(l))}function ef(s){return'[src="'+da(s)+'"]'}function yh(s){return"script[async]"+s}function dD(s,l,p){if(l.count++,l.instance===null)switch(l.type){case"style":var y=s.querySelector('style[data-href~="'+da(p.href)+'"]');if(y)return l.instance=y,gn(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"),gn(y),Ea(y,"style",k),$y(y,p.precedence,s),l.instance=y;case"stylesheet":k=Zd(p.href);var S=s.querySelector(gh(k));if(S)return l.state.loading|=4,l.instance=S,gn(S),S;y=uD(p),(k=rs.get(k))&&hw(y,k),S=(s.ownerDocument||s).createElement("link"),gn(S);var M=S;return M._p=new Promise(function(V,se){M.onload=V,M.onerror=se}),Ea(S,"link",y),l.state.loading|=4,$y(S,p.precedence,s),l.instance=S;case"script":return S=ef(p.src),(k=s.querySelector(yh(S)))?(l.instance=k,gn(k),k):(y=p,(k=rs.get(S))&&(y=h({},p),mw(y,k)),s=s.ownerDocument||s,k=s.createElement("script"),gn(k),Ea(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,$y(y,p.precedence,s));return l.instance}function $y(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 hw(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function mw(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Vy=null;function fD(s,l,p){if(Vy===null){var y=new Map,k=Vy=new Map;k.set(p,y)}else k=Vy,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[nn]||S[qt]||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 pD(s,l,p){s=s.ownerDocument||s,s.head.insertBefore(p,l==="title"?s.querySelector("head > title"):null)}function U8(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 hD(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function F8(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=Zd(y.href),S=l.querySelector(gh(k));if(S){l=S._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Hy.bind(s),l.then(s,s)),p.state.loading|=4,p.instance=S,gn(S);return}S=l.ownerDocument||l,y=uD(y),(k=rs.get(k))&&hw(y,k),S=S.createElement("link"),gn(S);var M=S;M._p=new Promise(function(V,se){M.onload=V,M.onerror=se}),Ea(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=Hy.bind(s),l.addEventListener("load",p),l.addEventListener("error",p))}}var gw=0;function q8(s,l){return s.stylesheets&&s.count===0&&Wy(s,s.stylesheets),0<s.count||0<s.imgCount?function(p){var y=setTimeout(function(){if(s.stylesheets&&Wy(s,s.stylesheets),s.unsuspend){var S=s.unsuspend;s.unsuspend=null,S()}},6e4+l);0<s.imgBytes&&gw===0&&(gw=62500*k8());var k=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Wy(s,s.stylesheets),s.unsuspend)){var S=s.unsuspend;s.unsuspend=null,S()}},(s.imgBytes>gw?50:800)+l);return s.unsuspend=p,function(){s.unsuspend=null,clearTimeout(y),clearTimeout(k)}}:null}function Hy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wy(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Gy=null;function Wy(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Gy=new Map,l.forEach(z8,s),Gy=null,Hy.call(s))}function z8(s,l){if(!(l.state.loading&4)){var p=Gy.get(s);if(p)var y=p.get(null);else{p=new Map,Gy.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=Hy.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 vh={$$typeof:P,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function $8(s,l,p,y,k,S,M,V,se){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=$(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$(0),this.hiddenUpdates=$(null),this.identifierPrefix=y,this.onUncaughtError=k,this.onCaughtError=S,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=se,this.incompleteTransitions=new Map}function mD(s,l,p,y,k,S,M,V,se,Ee,Fe,We){return s=new $8(s,l,p,M,se,Ee,Fe,We,V),l=1,S===!0&&(l|=24),S=Ci(3,null,null,l),s.current=S,S.stateNode=s,l=Y0(),l.refCount++,s.pooledCache=l,l.refCount++,S.memoizedState={element:y,isDehydrated:p,cache:l},Z0(S),s}function gD(s){return s?(s=Dd,s):Dd}function yD(s,l,p,y,k,S){k=gD(k),y.context===null?y.context=k:y.pendingContext=k,y=ol(l),y.payload={element:p},S=S===void 0?null:S,S!==null&&(y.callback=S),p=cl(s,y,l),p!==null&&(ni(p,s,l),Xp(p,s,l))}function vD(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var p=s.retryLane;s.retryLane=p!==0&&p<l?p:l}}function yw(s,l){vD(s,l),(s=s.alternate)&&vD(s,l)}function _D(s){if(s.tag===13||s.tag===31){var l=wu(s,67108864);l!==null&&ni(l,s,67108864),yw(s,67108864)}}function bD(s){if(s.tag===13||s.tag===31){var l=Di();l=mr(l);var p=wu(s,l);p!==null&&ni(p,s,l),yw(s,l)}}var Ky=!0;function V8(s,l,p,y){var k=F.T;F.T=null;var S=X.p;try{X.p=2,vw(s,l,p,y)}finally{X.p=S,F.T=k}}function H8(s,l,p,y){var k=F.T;F.T=null;var S=X.p;try{X.p=8,vw(s,l,p,y)}finally{X.p=S,F.T=k}}function vw(s,l,p,y){if(Ky){var k=_w(y);if(k===null)aw(s,l,y,Yy,p),wD(s,y);else if(W8(k,s,l,p,y))y.stopPropagation();else if(wD(s,y),l&4&&-1<G8.indexOf(s)){for(;k!==null;){var S=xs(k);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var M=fe(S.pendingLanes);if(M!==0){var V=S;for(V.pendingLanes|=2,V.entangledLanes|=2;M;){var se=1<<31-yt(M);V.entanglements[1]|=se,M&=~se}_o(S),(Ur&6)===0&&(Dy=Je()+500,fh(0))}}break;case 31:case 13:V=wu(S,2),V!==null&&ni(V,S,2),Ny(),yw(S,2)}if(S=_w(y),S===null&&aw(s,l,y,Yy,p),S===k)break;k=S}k!==null&&y.stopPropagation()}else aw(s,l,y,null,p)}}function _w(s){return s=Os(s),bw(s)}var Yy=null;function bw(s){if(Yy=null,s=mn(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 Yy=s,null}function kD(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(ue()){case Be:return 2;case je:return 8;case ot:case Pt:return 32;case Ft:return 268435456;default:return 32}default:return 32}}var kw=!1,_l=null,bl=null,kl=null,_h=new Map,bh=new Map,wl=[],G8="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 wD(s,l){switch(s){case"focusin":case"focusout":_l=null;break;case"dragenter":case"dragleave":bl=null;break;case"mouseover":case"mouseout":kl=null;break;case"pointerover":case"pointerout":_h.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":bh.delete(l.pointerId)}}function kh(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=xs(l),l!==null&&_D(l)),s):(s.eventSystemFlags|=y,l=s.targetContainers,k!==null&&l.indexOf(k)===-1&&l.push(k),s)}function W8(s,l,p,y,k){switch(l){case"focusin":return _l=kh(_l,s,l,p,y,k),!0;case"dragenter":return bl=kh(bl,s,l,p,y,k),!0;case"mouseover":return kl=kh(kl,s,l,p,y,k),!0;case"pointerover":var S=k.pointerId;return _h.set(S,kh(_h.get(S)||null,s,l,p,y,k)),!0;case"gotpointercapture":return S=k.pointerId,bh.set(S,kh(bh.get(S)||null,s,l,p,y,k)),!0}return!1}function SD(s){var l=mn(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,Gt(s.priority,function(){bD(p)});return}}else if(l===31){if(l=c(p),l!==null){s.blockedOn=l,Gt(s.priority,function(){bD(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 Xy(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var p=_w(s.nativeEvent);if(p===null){p=s.nativeEvent;var y=new p.constructor(p.type,p);Qc=y,p.target.dispatchEvent(y),Qc=null}else return l=xs(p),l!==null&&_D(l),s.blockedOn=p,!1;l.shift()}return!0}function ED(s,l,p){Xy(s)&&p.delete(l)}function K8(){kw=!1,_l!==null&&Xy(_l)&&(_l=null),bl!==null&&Xy(bl)&&(bl=null),kl!==null&&Xy(kl)&&(kl=null),_h.forEach(ED),bh.forEach(ED)}function Jy(s,l){s.blockedOn===l&&(s.blockedOn=null,kw||(kw=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,K8)))}var Qy=null;function TD(s){Qy!==s&&(Qy=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Qy===s&&(Qy=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(bw(y||p)===null)continue;break}var S=xs(p);S!==null&&(s.splice(l,3),l-=3,_k(S,{pending:!0,data:k,method:p.method,action:y},y,k))}}))}function tf(s){function l(se){return Jy(se,s)}_l!==null&&Jy(_l,s),bl!==null&&Jy(bl,s),kl!==null&&Jy(kl,s),_h.forEach(l),bh.forEach(l);for(var p=0;p<wl.length;p++){var y=wl[p];y.blockedOn===s&&(y.blockedOn=null)}for(;0<wl.length&&(p=wl[0],p.blockedOn===null);)SD(p),p.blockedOn===null&&wl.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[Ot]||null;if(typeof S=="function")M||TD(p);else if(M){var V=null;if(S&&S.hasAttribute("formAction")){if(k=S,M=S[Ot]||null)V=M.formAction;else if(bw(k)!==null)continue}else V=M.action;typeof V=="function"?p[y+1]=V:(p.splice(y,3),y-=3),TD(p)}}}function CD(){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 ww(s){this._internalRoot=s}Zy.prototype.render=ww.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var p=l.current,y=Di();yD(p,y,s,l,null,null)},Zy.prototype.unmount=ww.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;yD(s.current,2,null,s,null,null),Ny(),l[An]=null}};function Zy(s){this._internalRoot=s}Zy.prototype.unstable_scheduleHydration=function(s){if(s){var l=Ge();s={blockedOn:null,target:s,priority:l};for(var p=0;p<wl.length&&l!==0&&l<wl[p].priority;p++);wl.splice(p,0,s),p===0&&SD(s)}};var xD=e.version;if(xD!=="19.2.0")throw Error(n(527,xD,"19.2.0"));X.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 Y8={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ev=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ev.isDisabled&&ev.supportsFiber)try{rt=ev.inject(Y8),be=ev}catch{}}return Sh.createRoot=function(s,l){if(!a(s))throw Error(n(299));var p=!1,y="",k=IR,S=MR,M=jR;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=mD(s,1,!1,null,null,p,y,null,k,S,M,CD),s[An]=l.current,nw(s),new ww(l)},Sh.hydrateRoot=function(s,l,p){if(!a(s))throw Error(n(299));var y=!1,k="",S=IR,M=MR,V=jR,se=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&&(se=p.formState)),l=mD(s,1,!0,l,p??null,y,k,se,S,M,V,CD),l.context=gD(null),p=l.current,y=Di(),y=mr(y),k=ol(y),k.callback=null,cl(p,k,y),p=y,l.current.lanes=p,oe(l,p),_o(l),s[An]=l.current,nw(s),new Zy(l)},Sh.version="19.2.0",Sh}var LD;function aV(){if(LD)return Tw.exports;LD=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(),Tw.exports=nV(),Tw.exports}var Aw=aV();/**
 * 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 BD="popstate";function iV(t={}){function e(n,a){let{pathname:i,search:o,hash:c}=n.location;return sT("",{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:Cm(a)}return oV(e,r,null,t)}function Tn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Zs(t,e){if(!t)try{throw new Error(e)}catch{}}function sV(){return Math.random().toString(36).substring(2,10)}function UD(t,e){return{usr:t.state,key:t.key,idx:e}}function sT(t,e,r=null,n){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?_p(e):e,state:r,key:e&&e.key||n||sV()}}function Cm({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 _p(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 oV(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 D=sT(b.location,E,T);d=f()+1;let P=UD(D,d),A=b.createHref(D);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 D=sT(b.location,E,T);d=f();let P=UD(D,d),A=b.createHref(D);o.replaceState(P,"",A),i&&u&&u({action:c,location:b.location,delta:0})}function w(E){return cV(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(BD,h),u=E,()=>{a.removeEventListener(BD,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 cV(t,e=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Tn(r,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:Cm(t);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function t3(t,e,r="/"){return lV(t,e,r,!1)}function lV(t,e,r,n){let a=typeof e=="string"?_p(e):e,i=Uc(a.pathname||"/",r);if(i==null)return null;let o=r3(t);uV(o);let c=null;for(let u=0;c==null&&u<o.length;++u){let d=kV(i);c=_V(o[u],d,n)}return c}function r3(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;Tn(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=Nc([n,f.relativePath]),m=r.concat(f);o.children&&o.children.length>0&&(Tn(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),r3(o.children,e,m,h,u)),!(o.path==null&&!o.index)&&e.push({path:h,score:yV(h,o.index),routesMeta:m})};return t.forEach((o,c)=>{if(o.path===""||!o.path?.includes("?"))i(o,c);else for(let u of n3(o.path))i(o,c,!0,u)}),e}function n3(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=n3(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 uV(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:vV(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var dV=/^:[\w-]+$/,fV=3,pV=2,hV=1,mV=10,gV=-2,FD=t=>t==="*";function yV(t,e){let r=t.split("/"),n=r.length;return r.some(FD)&&(n+=gV),e&&(n+=pV),r.filter(a=>!FD(a)).reduce((a,i)=>a+(dV.test(i)?fV:i===""?hV:mV),n)}function vV(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 _V(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=x_({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},f),m=u.route;if(!h&&d&&r&&!n[n.length-1].route.index&&(h=x_({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!h)return null;Object.assign(a,h.params),o.push({params:a,pathname:Nc([i,h.pathname]),pathnameBase:TV(Nc([i,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(i=Nc([i,h.pathnameBase]))}return o}function x_(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=bV(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 bV(t,e=!1,r=!0){Zs(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 kV(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Zs(!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 Uc(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 wV(t,e="/"){let{pathname:r,search:n="",hash:a=""}=typeof t=="string"?_p(t):t;return{pathname:r?r.startsWith("/")?r:SV(r,e):e,search:CV(n),hash:xV(a)}}function SV(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 Rw(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 EV(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function cx(t){let e=EV(t);return e.map((r,n)=>n===e.length-1?r.pathname:r.pathnameBase)}function lx(t,e,r,n=!1){let a;typeof t=="string"?a=_p(t):(a={...t},Tn(!a.pathname||!a.pathname.includes("?"),Rw("?","pathname","search",a)),Tn(!a.pathname||!a.pathname.includes("#"),Rw("#","pathname","hash",a)),Tn(!a.search||!a.search.includes("#"),Rw("#","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=wV(a,c),d=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(d||f)&&(u.pathname+="/"),u}var Nc=t=>t.join("/").replace(/\/\/+/g,"/"),TV=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),CV=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,xV=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function PV(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var a3=["POST","PUT","PATCH","DELETE"];new Set(a3);var AV=["GET",...a3];new Set(AV);var bp=v.createContext(null);bp.displayName="DataRouter";var xb=v.createContext(null);xb.displayName="DataRouterState";v.createContext(!1);var i3=v.createContext({isTransitioning:!1});i3.displayName="ViewTransition";var RV=v.createContext(new Map);RV.displayName="Fetchers";var DV=v.createContext(null);DV.displayName="Await";var ao=v.createContext(null);ao.displayName="Navigation";var Eg=v.createContext(null);Eg.displayName="Location";var ws=v.createContext({outlet:null,matches:[],isDataRoute:!1});ws.displayName="Route";var ux=v.createContext(null);ux.displayName="RouteError";function OV(t,{relative:e}={}){Tn(kp(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=v.useContext(ao),{hash:a,pathname:i,search:o}=Tg(t,{relative:e}),c=i;return r!=="/"&&(c=i==="/"?r:Nc([r,i])),n.createHref({pathname:c,search:o,hash:a})}function kp(){return v.useContext(Eg)!=null}function _i(){return Tn(kp(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Eg).location}var s3="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function o3(t){v.useContext(ao).static||v.useLayoutEffect(t)}function rn(){let{isDataRoute:t}=v.useContext(ws);return t?WV():NV()}function NV(){Tn(kp(),"useNavigate() may be used only in the context of a <Router> component.");let t=v.useContext(bp),{basename:e,navigator:r}=v.useContext(ao),{matches:n}=v.useContext(ws),{pathname:a}=_i(),i=JSON.stringify(cx(n)),o=v.useRef(!1);return o3(()=>{o.current=!0}),v.useCallback((u,d={})=>{if(Zs(o.current,s3),!o.current)return;if(typeof u=="number"){r.go(u);return}let f=lx(u,JSON.parse(i),a,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Nc([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,i,a,t])}var IV=v.createContext(null);function MV(t){let e=v.useContext(ws).outlet;return v.useMemo(()=>e&&v.createElement(IV.Provider,{value:t},e),[e,t])}function c3(){let{matches:t}=v.useContext(ws),e=t[t.length-1];return e?e.params:{}}function Tg(t,{relative:e}={}){let{matches:r}=v.useContext(ws),{pathname:n}=_i(),a=JSON.stringify(cx(r));return v.useMemo(()=>lx(t,JSON.parse(a),n,e==="path"),[t,a,n,e])}function jV(t,e){return l3(t,e)}function l3(t,e,r,n,a){Tn(kp(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(ao),{matches:o}=v.useContext(ws),c=o[o.length-1],u=c?c.params:{},d=c?c.pathname:"/",f=c?c.pathnameBase:"/",h=c&&c.route;{let D=h&&h.path||"";u3(d,!h||D.endsWith("*")||D.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${D}">) 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="${D}"> to <Route path="${D==="/"?"*":`${D}/*`}">.`)}let m=_i(),_;if(e){let D=typeof e=="string"?_p(e):e;Tn(f==="/"||D.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 "${D.pathname}" was given in the \`location\` prop.`),_=D}else _=m;let w=_.pathname||"/",b=w;if(f!=="/"){let D=f.replace(/^\//,"").split("/");b="/"+w.replace(/^\//,"").split("/").slice(D.length).join("/")}let E=t3(t,{pathname:b});Zs(h||E!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Zs(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=qV(E&&E.map(D=>Object.assign({},D,{params:Object.assign({},u,D.params),pathname:Nc([f,i.encodeLocation?i.encodeLocation(D.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathname]),pathnameBase:D.pathnameBase==="/"?f:Nc([f,i.encodeLocation?i.encodeLocation(D.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:D.pathnameBase])})),o,r,n,a);return e&&T?v.createElement(Eg.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",..._},navigationType:"POP"}},T):T}function LV(){let t=GV(),e=PV(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 BV=v.createElement(LV,null),UV=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(ws.Provider,{value:this.props.routeContext},v.createElement(ux.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function FV({routeContext:t,match:e,children:r}){let n=v.useContext(bp);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),v.createElement(ws.Provider,{value:t},r)}function qV(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);Tn(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||BV,c&&(u<0&&h===0?(u3("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 D;return m?D=w:_?D=b:f.route.Component?D=v.createElement(f.route.Component,null):f.route.element?D=f.route.element:D=d,v.createElement(FV,{match:f,routeContext:{outlet:d,matches:E,isDataRoute:r!=null},children:D})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(UV,{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 dx(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function zV(t){let e=v.useContext(bp);return Tn(e,dx(t)),e}function $V(t){let e=v.useContext(xb);return Tn(e,dx(t)),e}function VV(t){let e=v.useContext(ws);return Tn(e,dx(t)),e}function fx(t){let e=VV(t),r=e.matches[e.matches.length-1];return Tn(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function HV(){return fx("useRouteId")}function GV(){let t=v.useContext(ux),e=$V("useRouteError"),r=fx("useRouteError");return t!==void 0?t:e.errors?.[r]}function WV(){let{router:t}=zV("useNavigate"),e=fx("useNavigate"),r=v.useRef(!1);return o3(()=>{r.current=!0}),v.useCallback(async(a,i={})=>{Zs(r.current,s3),r.current&&(typeof a=="number"?t.navigate(a):await t.navigate(a,{fromRouteId:e,...i}))},[t,e])}var qD={};function u3(t,e,r){!e&&!qD[t]&&(qD[t]=!0,Zs(!1,r))}v.memo(KV);function KV({routes:t,future:e,state:r,unstable_onError:n}){return l3(t,void 0,r,n,e)}function tm({to:t,replace:e,state:r,relative:n}){Tn(kp(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=v.useContext(ao);Zs(!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(ws),{pathname:o}=_i(),c=rn(),u=lx(t,cx(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 d3(t){return MV(t.context)}function _n(t){Tn(!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 YV({basename:t="/",children:e=null,location:r,navigationType:n="POP",navigator:a,static:i=!1}){Tn(!kp(),"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=_p(r));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:m="default"}=r,_=v.useMemo(()=>{let w=Uc(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 Zs(_!=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(ao.Provider,{value:c},v.createElement(Eg.Provider,{children:e,value:_}))}function XV({children:t,location:e}){return jV(oT(t),e)}function oT(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,oT(n.props.children,i));return}Tn(n.type===_n,`[${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>`),Tn(!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=oT(n.props.children,i)),r.push(o)}),r}var jv="get",Lv="application/x-www-form-urlencoded";function Pb(t){return t!=null&&typeof t.tagName=="string"}function JV(t){return Pb(t)&&t.tagName.toLowerCase()==="button"}function QV(t){return Pb(t)&&t.tagName.toLowerCase()==="form"}function ZV(t){return Pb(t)&&t.tagName.toLowerCase()==="input"}function e7(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function t7(t,e){return t.button===0&&(!e||e==="_self")&&!e7(t)}var tv=null;function r7(){if(tv===null)try{new FormData(document.createElement("form"),0),tv=!1}catch{tv=!0}return tv}var n7=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Dw(t){return t!=null&&!n7.has(t)?(Zs(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Lv}"`),null):t}function a7(t,e){let r,n,a,i,o;if(QV(t)){let c=t.getAttribute("action");n=c?Uc(c,e):null,r=t.getAttribute("method")||jv,a=Dw(t.getAttribute("enctype"))||Lv,i=new FormData(t)}else if(JV(t)||ZV(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?Uc(u,e):null,r=t.getAttribute("formmethod")||c.getAttribute("method")||jv,a=Dw(t.getAttribute("formenctype"))||Dw(c.getAttribute("enctype"))||Lv,i=new FormData(c,t),!r7()){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(Pb(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=jv,n=null,a=Lv,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 px(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function i7(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&&Uc(n.pathname,e)==="/"?n.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${r}`,n}async function s7(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 o7(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 c7(t,e,r){let n=await Promise.all(t.map(async a=>{let i=e.routes[a.route.id];if(i){let o=await s7(i,r);return o.links?o.links():[]}return[]}));return f7(n.flat(1).filter(o7).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function zD(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 l7(t,e,{includeHydrateFallback:r}={}){return u7(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 u7(t){return[...new Set(t)]}function d7(t){let e={},r=Object.keys(t).sort();for(let n of r)e[n]=t[n];return e}function f7(t,e){let r=new Set;return new Set(e),t.reduce((n,a)=>{let i=JSON.stringify(d7(a));return r.has(i)||(r.add(i),n.push({key:i,link:a})),n},[])}function f3(){let t=v.useContext(bp);return px(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function p7(){let t=v.useContext(xb);return px(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var hx=v.createContext(void 0);hx.displayName="FrameworkContext";function p3(){let t=v.useContext(hx);return px(t,"You must render this element inside a <HydratedRouter> element"),t}function h7(t,e){let r=v.useContext(hx),[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(D=>{o(D.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:Eh(c,_),onBlur:Eh(u,w),onMouseEnter:Eh(d,_),onMouseLeave:Eh(f,w),onTouchStart:Eh(h,_)}]:[!1,m,{}]}function Eh(t,e){return r=>{t&&t(r),r.defaultPrevented||e(r)}}function m7({page:t,...e}){let{router:r}=f3(),n=v.useMemo(()=>t3(r.routes,t,r.basename),[r.routes,t,r.basename]);return n?v.createElement(y7,{page:t,matches:n,...e}):null}function g7(t){let{manifest:e,routeModules:r}=p3(),[n,a]=v.useState([]);return v.useEffect(()=>{let i=!1;return c7(t,e,r).then(o=>{i||a(o)}),()=>{i=!0}},[t,e,r]),n}function y7({page:t,matches:e,...r}){let n=_i(),{manifest:a,routeModules:i}=p3(),{basename:o}=f3(),{loaderData:c,matches:u}=p7(),d=v.useMemo(()=>zD(t,e,u,a,n,"data"),[t,e,u,a,n]),f=v.useMemo(()=>zD(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 D=a.routes[T.route.id];!D||!D.hasLoader||(!d.some(P=>P.route.id===T.route.id)&&T.route.id in c&&i[T.route.id]?.shouldRevalidate||D.hasClientLoader?b=!0:w.add(T.route.id))}),w.size===0)return[];let E=i7(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(()=>l7(f,a),[f,a]),_=g7(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 v7(...t){return e=>{t.forEach(r=>{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}var h3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{h3&&(window.__reactRouterVersion="7.9.2")}catch{}function _7({basename:t,children:e,window:r}){let n=v.useRef();n.current==null&&(n.current=iV({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(YV,{basename:t,children:e,location:i.location,navigationType:i.action,navigator:a})}var m3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,g3=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(ao),b=typeof d=="string"&&m3.test(d),E,T=!1;if(typeof d=="string"&&b&&(E=d,h3))try{let R=new URL(window.location.href),N=d.startsWith("//")?new URL(R.protocol+d):new URL(d),L=Uc(N.pathname,w);N.origin===R.origin&&L!=null?d=L+N.search+N.hash:T=!0}catch{Zs(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let D=OV(d,{relative:a}),[P,A,C]=h7(n,m),O=S7(d,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:h});function I(R){e&&e(R),R.defaultPrevented||O(R)}let x=v.createElement("a",{...m,...C,href:E||D,onClick:T||i?e:I,ref:v7(_,A),target:u,"data-discover":!b&&r==="render"?"true":void 0});return P&&!b?v.createElement(v.Fragment,null,x,v.createElement(m7,{page:D})):x});g3.displayName="Link";var b7=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=Tg(o,{relative:d.relative}),m=_i(),_=v.useContext(xb),{navigator:w,basename:b}=v.useContext(ao),E=_!=null&&P7(h)&&c===!0,T=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,D=m.pathname,P=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(D=D.toLowerCase(),P=P?P.toLowerCase():null,T=T.toLowerCase()),P&&b&&(P=Uc(P,b)||P);const A=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let C=D===T||!a&&D.startsWith(T)&&D.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,R;typeof n=="function"?R=n(I):R=[n,C?"active":null,O?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let N=typeof i=="function"?i(I):i;return v.createElement(g3,{...d,"aria-current":x,className:R,ref:f,style:N,to:o,viewTransition:c},typeof u=="function"?u(I):u)});b7.displayName="NavLink";var k7=v.forwardRef(({discover:t="render",fetcherKey:e,navigate:r,reloadDocument:n,replace:a,state:i,method:o=jv,action:c,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:h,...m},_)=>{let w=C7(),b=x7(c,{relative:d}),E=o.toLowerCase()==="get"?"get":"post",T=typeof c=="string"&&m3.test(c),D=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:D,...m,"data-discover":!T&&t==="render"?"true":void 0})});k7.displayName="Form";function w7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function y3(t){let e=v.useContext(bp);return Tn(e,w7(t)),e}function S7(t,{target:e,replace:r,state:n,preventScrollReset:a,relative:i,viewTransition:o}={}){let c=rn(),u=_i(),d=Tg(t,{relative:i});return v.useCallback(f=>{if(t7(f,e)){f.preventDefault();let h=r!==void 0?r:Cm(u)===Cm(d);c(t,{replace:h,state:n,preventScrollReset:a,relative:i,viewTransition:o})}},[u,c,d,r,n,e,t,a,i,o])}var E7=0,T7=()=>`__${String(++E7)}__`;function C7(){let{router:t}=y3("useSubmit"),{basename:e}=v.useContext(ao),r=HV();return v.useCallback(async(n,a={})=>{let{action:i,method:o,encType:c,formData:u,body:d}=a7(n,e);if(a.navigate===!1){let f=a.fetcherKey||T7();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 x7(t,{relative:e}={}){let{basename:r}=v.useContext(ao),n=v.useContext(ws);Tn(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),i={...Tg(t||".",{relative:e})},o=_i();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:Nc([r,i.pathname])),Cm(i)}function P7(t,{relative:e}={}){let r=v.useContext(i3);Tn(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=y3("useViewTransitionState"),a=Tg(t,{relative:e});if(!r.isTransitioning)return!1;let i=Uc(r.currentLocation.pathname,n)||r.currentLocation.pathname,o=Uc(r.nextLocation.pathname,n)||r.nextLocation.pathname;return x_(a.pathname,o)!=null||x_(a.pathname,i)!=null}var Wc=e3();/*! Capacitor: https://capacitorjs.com/ - MIT License */var Yf;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(Yf||(Yf={}));class Ow extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const A7=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"},R7=t=>{const e=t.CapacitorCustomPlatform||null,r=t.Capacitor||{},n=r.Plugins=r.Plugins||{},a=()=>e!==null?e.name:A7(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),D=(x,R)=>{var N,L;if(b){const j=b?.methods.find(q=>R===q.name);if(j)return j.rtype==="promise"?q=>r.nativePromise(h,R.toString(),q):(q,U)=>r.nativeCallback(h,R.toString(),q,U);if(x)return(N=x[R])===null||N===void 0?void 0:N.bind(x)}else{if(x)return(L=x[R])===null||L===void 0?void 0:L.bind(x);throw new Ow(`"${h}" plugin is not implemented on ${w}`,Yf.Unimplemented)}},P=x=>{let R;const N=(...L)=>{const j=T().then(q=>{const U=D(q,x);if(U){const Y=U(...L);return R=Y?.remove,Y}else throw new Ow(`"${h}.${x}()" is not implemented on ${w}`,Yf.Unimplemented)});return x==="addListener"&&(j.remove=async()=>R()),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,R)=>{const N=A({eventName:x},R),L=async()=>{const q=await N;C({eventName:x,callbackId:q},R)},j=new Promise(q=>N.then(()=>q({remove:L})));return j.remove=async()=>{await L()},j},I=new Proxy({},{get(x,R){switch(R){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return b?O:A;case"removeListener":return C;default:return P(R)}}});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=Ow,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},D7=t=>t.Capacitor=R7(t),Wr=D7(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),io=Wr.registerPlugin;class v3{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 Wr.Exception(e,Yf.Unimplemented)}unavailable(e="not available"){return new Wr.Exception(e,Yf.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 $D=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),VD=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class O7 extends v3{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=VD(a).trim(),i=VD(i).trim(),r[a]=i}),r}async setCookie(e){try{const r=$D(e.key),n=$D(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)}}}io("CapacitorCookies",{web:()=>new O7});const N7=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)}),I7=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(a=>a.toLocaleLowerCase()).reduce((a,i,o)=>(a[i]=t[e[o]],a),{})},M7=(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,j7=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),a=I7(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 L7 extends v3{async request(e){const r=j7(e,e.webFetchExtra),n=M7(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 N7(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"}))}}io("CapacitorHttp",{web:()=>new L7});const B7="modulepreload",U7=function(t,e){return new URL(t,e).href},HD={},zr=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=U7(f,n),f in HD)return;HD[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":B7,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)})},xm=io("SocialLogin",{web:()=>zr(()=>import("./web-CInhK2aG.js"),[],import.meta.url).then(t=>new t.SocialLoginWeb)});var F7={};const q7={SOCKET:{NEEDS_PREMIUM:"premium_membership_required"}},z7=(()=>{try{if(typeof window>"u")return!1;const t=(window.location?.protocol||"").toLowerCase();return t==="capacitor:"||t==="ionic:"}catch{return!1}})(),$7=(()=>{try{if(typeof window>"u")return!1;const t=window.location?.hostname||"";return t==="localhost"||t==="127.0.0.1"}catch{return!1}})();function V7(){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 GD=(()=>{const t=V7();return t||(z7?"https://dicelounge.app":$7?"http://localhost:4000":"https://dicelounge.app")})(),H7=globalThis?.APP_TARGET,G7=typeof process<"u"?F7?.APP_TARGET:void 0;let cT;try{cT="poker"}catch{cT=void 0}const W7=H7??G7??cT,wp=W7??"unified",WD=wp==="ceelo",Go=wp==="craps",Wo=wp==="poker",rf=wp==="unified",K7="rcb_eaWheJLZtWHJDCzyjruqCITeZlrK",KD={ceelo:"goog_TshzudibKBufFkwSWOodGwQAzMI",craps:"goog_FJlwnXjmdmVYKAbOkaiNyICWjkd",poker:"goog_AwODgwTGrKmYPFStHgslgZENzyG",unified:"goog_TshzudibKBufFkwSWOodGwQAzMI"},Y7=KD[wp]??KD.ceelo,YD={ceelo:"appl_YhZbXhNlphlrxochELLsdNJajdp",craps:"appl_uCBrYNXSOUzHdUNnkbfMaNxBxXI",poker:"appl_SKqhTdSJqfYQQGUjeFYzVZoSBqA",unified:"appl_YhZbXhNlphlrxochELLsdNJajdp"},X7=YD[wp]??YD.ceelo,J7="true",_3="default",Q7="com.zentaraone.ceeloLounge.chips",b3=Q7,Z7="com.zentaraone.ceeloLounge.chips1000",e9="com.zentaraone.crapsLounge.chips_1000",t9="com.zentaraone.pokerLounge.chips_1000",k3=Go?e9:Wo?t9:Z7,r9="",w3="Premium",n9="AIzaSyCmll0lLOqadkCyjlrM-bb5H4n1L8eMxkE",a9="dice-lounge.firebaseapp.com",i9="dice-lounge",s9="1:423374558927:web:283377221554368e57c9ba",o9="G-MYPNJQR9RN",c9="dicelounge.app",l9="PEcc15f3HTqKKafnvHp1yRrbxrS8ji1kzZ4dyS4R+fI=",u9="193765381581-rucls0d90bmpkqaj0ginhp87chgjq70j.apps.googleusercontent.com",mx="193765381581-s0a3p66cb39cdfum20jrm0d2e87jmlu8.apps.googleusercontent.com",d9=mx,f9=mx,p9=Go?d9:Wo?f9:mx,h9="com.zentaraone.ceeloLounge.service",m9="com.zentaraone.crapsLounge.service",g9="com.zentaraone.pokerLounge.service",y9=Go?m9:Wo?g9:h9,v9="https://dicelounge.app/api/auth/apple/callback",_9="com.zentaraone.ceeloLounge",b9="com.zentaraone.crapsLounge",k9="com.zentaraone.pokerLounge",w9=Go?b9:Wo?k9:_9,S9="ca-app-pub-4219446894372985/2712849620",E9="ca-app-pub-4219446894372985/4123145978",T9="ca-app-pub-4219446894372985/6524920361",C9="ca-app-pub-4219446894372985/9898216833",x9="ca-app-pub-4219446894372985/2585675356",P9="ca-app-pub-4219446894372985/5810604494",A9=Go?E9:Wo?T9:S9,XD=Go?x9:Wo?P9:C9,R9="ca-app-pub-4219446894372985/3451216225",D9="ca-app-pub-4219446894372985/9366706127",O9="ca-app-pub-4219446894372985/4109691778",N9="ca-app-pub-4219446894372985/2394103660",I9="ca-app-pub-4219446894372985/5020267007",M9="ca-app-pub-4219446894372985/8389694041",j9=Go?D9:Wo?O9:R9,JD=Go?I9:Wo?M9:N9,hf=100,QD=30,S3=3,E3=3,zh=6e4,$h=1500,gx=io("SecureStoragePlugin",{web:()=>zr(()=>import("./web-peY9F48v.js"),[],import.meta.url).then(t=>new t.SecureStoragePluginWeb)}),ys=io("Preferences",{web:()=>zr(()=>import("./web-BoVA0293.js"),[],import.meta.url).then(t=>new t.PreferencesWeb)}),Ic=Object.freeze(Object.defineProperty({__proto__:null,Preferences:ys},Symbol.toStringTag,{value:"Module"})),rv="sess:";async function ZD(t){const{value:e}=await ys.get({key:t});return e??null}async function eO(t,e){await ys.set({key:t,value:e})}async function Nw(t){await ys.remove({key:t})}const Xs={async get(t){return ZD(t)},async set(t,e){await eO(t,e)},async remove(t){await Nw(t)},async setSession(t,e){await eO(rv+t,e)},async getSession(t){return ZD(rv+t)},async removeSession(t){return Nw(rv+t)},async clearSessionKeys(){try{const e=(await ys.keys()).keys?.filter(r=>r.startsWith(rv))||[];await Promise.all(e.map(r=>Nw(r)))}catch{}}};async function Xf(t){try{const e=await Xs.getSession(t);return e?JSON.parse(e):null}catch{return null}}async function Ab(t,e){try{await Xs.setSession(t,JSON.stringify(e))}catch{}}async function Jf(t){try{await Xs.removeSession(t)}catch{}}const Qf="session_token",yx=Wr.isNativePlatform();async function Zf(t){yx?await gx.set({key:Qf,value:t}):await Xs.setSession(Qf,t)}async function li(){if(yx)try{const{value:e}=await gx.get({key:Qf});return e||void 0}catch{return}return await Xs.getSession(Qf)||void 0}async function Cg(){if(yx)try{await gx.remove({key:Qf})}catch{}else await Xs.removeSession(Qf)}const nf={done:!1};function tO(t){if(!t)return"";const e=String(t);return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-6)}`}async function L9(){const t=Wr.getPlatform(),e={mode:"online"},r=u9,n=p9;e.clientId=r,e.webClientId=r,e.mode="online",e.iOSClientId=n;const a={mode:"online"},i=t==="ios"?w9:y9,o=v9;a.clientId=i,t!=="ios"&&o&&(a.redirectUrl=o),tO(r),tO(n),await xm.initialize({...Object.keys(e).length?{google:e}:{},...Object.keys(a).length?{apple:a}:{}})}async function ep(t=!1){if(!(!t&&nf.done)){if(!t&&nf.promise)return nf.promise;nf.promise=L9().then(()=>{nf.done=!0}).catch(e=>{throw nf.promise=void 0,e})}}async function T3(){try{await ep()}catch{}}function B9(){try{const t=Wr.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 U9(){await ep(!0);const e=Wr.getPlatform()==="android"?{}:{scopes:["email","name"]},r=await xm.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 F9(){await ep(!0);try{const e=Wr.getPlatform()==="android"?{}:{scopes:["email","profile"]},r=await xm.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 ep(!0);const n=Wr.getPlatform(),a=await xm.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 q9(t,e){try{await ep()}catch{}try{await xm.logout({provider:t})}catch{}try{await new Promise(r=>setTimeout(r,120)),await ep(!0)}catch{}if(e?.clearLocal!==!1)try{await Cg()}catch{}}const P_={isNativePlatform:B9,signInWithAppleNative:U9,signInWithGoogleNative:F9,signOut:q9,prewarmNativeAuth:T3};let bo;function z9(){try{const t=Wr?.getPlatform?.();if(t)return t==="android"}catch{}try{return typeof navigator<"u"&&/Android/i.test(navigator.userAgent)}catch{return!1}}function $9(){try{const t=Wr?.getPlatform?.();if(t)return t==="ios"}catch{}try{return typeof navigator<"u"&&/iPhone|iPad|iPod/i.test(navigator.userAgent)}catch{return!1}}function V9(){try{const t=Wr?.getPlatform?.();return t&&["ios","android"].includes(t)?!0:!!window.Capacitor?.isNativePlatform?.()}catch{return!1}}function H9(){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 ui(){if(bo)return bo;const t=z9(),e=$9(),r=V9();if(t||e&&r)return bo="https://dicelounge.app",bo;let n=null;if(!t&&!(e&&r)&&(n=H9()),n)return bo=n,bo;let a=!1;try{const i=window.location?.hostname;a=i==="localhost"||i==="127.0.0.1"}catch{}return a&&!(e&&r)?(bo="http://localhost:4000",bo):(bo="https://dicelounge.app",bo)}const Ll=ui();let Fu=null,mf=0,gf=null;const G9=1e4;async function Rb(t){const e=t?.force===!0,r=t?.signal;return!e&&Fu&&Date.now()-mf<G9?Fu:!e&&gf?gf:(gf=(async()=>{try{let i=!1;try{i=!!P_.isNativePlatform?.()}catch{i=!1}let o=null;try{o=await li()??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(`${Ll}/api/auth/me`,{credentials:"include",headers:u,signal:r});if(d.ok){const f=await d.json();return Fu=f,mf=Date.now(),f}if(d.status===204)return Fu=null,mf=Date.now(),null;if(d.status===401){if(!c&&o){const f=await fetch(`${Ll}/api/auth/me`,{credentials:"include",headers:{Accept:"application/json",Authorization:`Bearer ${o}`},signal:r});if(f.ok){const h=await f.json();return Fu=h,mf=Date.now(),h}if(f.status===401)try{await Cg()}catch{}}return Fu=null,mf=Date.now(),null}return null}catch(i){return i?.name==="AbortError",null}})().finally(()=>{gf=null}),await gf)}async function Bv(t){let e=null;try{e=await li()??null}catch{e=null}try{await fetch(`${Ll}/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 Cg()}catch{}try{Fu=null,mf=0,gf=null}catch{}}async function W9(t){return(await fetch(`${Ll}/api/auth/verify-app?token=${encodeURIComponent(t)}`,{method:"GET",credentials:"include"})).json()}async function K9(t){try{if(P_.isNativePlatform())throw new Error("startOAuth is not allowed on native")}catch{}try{const e=await fetch(`${Ll}/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(`${Ll}/api/auth/${t}`),{ok:!1}}catch{try{window.location.assign(`${Ll}/api/auth/${t}`)}catch{}return{ok:!1}}}async function Y9(){try{const t=await fetch(`${Ll}/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 X9={};let Iw=!1,tp=null,af=null;function J9(){return{apiKey:n9,authDomain:a9,projectId:i9,appId:s9,measurementId:o9}}function rm(){return typeof window<"u"&&typeof document<"u"}function C3(){if(!rm())return!1;if(af!==null)return af;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 af=!0}catch{}return af=!1}function nm(...t){C3()}async function Q9(){if(Iw||!rm())return;try{if(typeof navigator<"u"&&/jsdom|playwright/i.test(navigator.userAgent||"")||typeof window<"u"&&window.__E2E===!0||typeof process<"u"&&(X9.VITEST||!1)){Iw=!0,nm("skip:init (test env heuristic)");return}}catch{}const t=J9();try{const[{initializeApp:e},{getAnalytics:r}]=await Promise.all([zr(()=>import("./index.esm-OyK67d2L.js"),__vite__mapDeps([0,1]),import.meta.url),zr(()=>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});tp=r(n),nm("init:ok",{measurementId:t.measurementId})}catch(e){tp=null,nm("init:fail",{error:e?.message||String(e)})}finally{Iw=!0}}function rp(t,e){if(tp)try{zr(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||{};C3()&&(n.debug_mode=!0);try{r(tp,t,n),nm("event",{eventName:t,params:n})}catch{}})}catch{}}function rO(t,e){const r=rm()?window.location.href:void 0,n=t??(rm()?window.location.pathname:void 0),a=rm()?document.title:void 0;rp("page_view",{page_location:r,page_path:n,page_title:a})}function Mw(t){!tp||!t||zr(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(tp,t)}catch{}nm("userId:set",{userId:t})})}async function Z9(t){const e=new Set([]);try{await ys.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 Ko=Object.create(null);Ko.open="0";Ko.close="1";Ko.ping="2";Ko.pong="3";Ko.message="4";Ko.upgrade="5";Ko.noop="6";const Uv=Object.create(null);Object.keys(Ko).forEach(t=>{Uv[Ko[t]]=t});const lT={type:"error",data:"parser error"},x3=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",P3=typeof ArrayBuffer=="function",A3=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,vx=({type:t,data:e},r,n)=>x3&&e instanceof Blob?r?n(e):nO(e,n):P3&&(e instanceof ArrayBuffer||A3(e))?r?n(e):nO(new Blob([e]),n):n(Ko[t]+(e||"")),nO=(t,e)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];e("b"+(n||""))},r.readAsDataURL(t)};function aO(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let jw;function eH(t,e){if(x3&&t.data instanceof Blob)return t.data.arrayBuffer().then(aO).then(e);if(P3&&(t.data instanceof ArrayBuffer||A3(t.data)))return e(aO(t.data));vx(t,!1,r=>{jw||(jw=new TextEncoder),e(jw.encode(r))})}const iO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<iO.length;t++)Vh[iO.charCodeAt(t)]=t;const tH=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=Vh[t.charCodeAt(n)],o=Vh[t.charCodeAt(n+1)],c=Vh[t.charCodeAt(n+2)],u=Vh[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},rH=typeof ArrayBuffer=="function",_x=(t,e)=>{if(typeof t!="string")return{type:"message",data:R3(t,e)};const r=t.charAt(0);return r==="b"?{type:"message",data:nH(t.substring(1),e)}:Uv[r]?t.length>1?{type:Uv[r],data:t.substring(1)}:{type:Uv[r]}:lT},nH=(t,e)=>{if(rH){const r=tH(t);return R3(r,e)}else return{base64:!0,data:t}},R3=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},D3="",aH=(t,e)=>{const r=t.length,n=new Array(r);let a=0;t.forEach((i,o)=>{vx(i,!1,c=>{n[o]=c,++a===r&&e(n.join(D3))})})},iH=(t,e)=>{const r=t.split(D3),n=[];for(let a=0;a<r.length;a++){const i=_x(r[a],e);if(n.push(i),i.type==="error")break}return n};function sH(){return new TransformStream({transform(t,e){eH(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 Lw;function nv(t){return t.reduce((e,r)=>e+r.length,0)}function av(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 oH(t,e){Lw||(Lw=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(nv(r)<1)break;const u=av(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(nv(r)<2)break;const u=av(r,2);a=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),n=3}else if(n===2){if(nv(r)<8)break;const u=av(r,8),d=new DataView(u.buffer,u.byteOffset,u.length),f=d.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(lT);break}a=f*Math.pow(2,32)+d.getUint32(4),n=3}else{if(nv(r)<a)break;const u=av(r,a);c.enqueue(_x(i?u:Lw.decode(u),e)),n=0}if(a===0||a>t){c.enqueue(lT);break}}}})}const O3=4;function Zn(t){if(t)return cH(t)}function cH(t){for(var e in Zn.prototype)t[e]=Zn.prototype[e];return t}Zn.prototype.on=Zn.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Zn.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this};Zn.prototype.off=Zn.prototype.removeListener=Zn.prototype.removeAllListeners=Zn.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};Zn.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};Zn.prototype.emitReserved=Zn.prototype.emit;Zn.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Zn.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Db=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,r)=>r(e,0),ds=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),lH="arraybuffer";function N3(t,...e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&(r[n]=t[n]),r),{})}const uH=ds.setTimeout,dH=ds.clearTimeout;function Ob(t,e){e.useNativeTimers?(t.setTimeoutFn=uH.bind(ds),t.clearTimeoutFn=dH.bind(ds)):(t.setTimeoutFn=ds.setTimeout.bind(ds),t.clearTimeoutFn=ds.clearTimeout.bind(ds))}const fH=1.33;function pH(t){return typeof t=="string"?hH(t):Math.ceil((t.byteLength||t.size)*fH)}function hH(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 I3(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function mH(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}function gH(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 yH extends Error{constructor(e,r,n){super(e),this.description=r,this.context=n,this.type="TransportError"}}class bx extends Zn{constructor(e){super(),this.writable=!1,Ob(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 yH(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=_x(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=mH(e);return r.length?"?"+r:""}}class vH extends bx{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)};iH(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,aH(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]=I3()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(e,r)}}let M3=!1;try{M3=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _H=M3;function bH(){}class kH extends vH{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 If=class Fv extends Zn{constructor(e,r,n){super(),this.createRequest=e,Ob(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=N3(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=Fv.requestsCount++,Fv.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=bH,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Fv.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};If.requestsCount=0;If.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",sO);else if(typeof addEventListener=="function"){const t="onpagehide"in ds?"pagehide":"unload";addEventListener(t,sO,!1)}}function sO(){for(let t in If.requests)If.requests.hasOwnProperty(t)&&If.requests[t].abort()}const wH=(function(){const t=j3({xdomain:!1});return t&&t.responseType!==null})();class SH extends kH{constructor(e){super(e);const r=e&&e.forceBase64;this.supportsBinary=wH&&!r}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new If(j3,this.uri(),e)}}function j3(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||_H))return new XMLHttpRequest}catch{}if(!e)try{return new ds[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const L3=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class EH extends bx{get name(){return"websocket"}doOpen(){const e=this.uri(),r=this.opts.protocols,n=L3?{}:N3(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;vx(n,this.supportsBinary,i=>{try{this.doWrite(n,i)}catch{}a&&Db(()=>{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]=I3()),this.supportsBinary||(r.b64=1),this.createUri(e,r)}}const Bw=ds.WebSocket||ds.MozWebSocket;class TH extends EH{createSocket(e,r,n){return L3?new Bw(e,r,n):r?new Bw(e,r):new Bw(e)}doWrite(e,r){this.ws.send(r)}}class CH extends bx{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=oH(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(r).getReader(),a=sH();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&&Db(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const xH={websocket:TH,webtransport:CH,polling:SH},PH=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,AH=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uT(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=PH.exec(t||""),i={},o=14;for(;o--;)i[AH[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=RH(i,i.path),i.queryKey=DH(i,i.query),i}function RH(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 DH(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,a,i){a&&(r[a]=i)}),r}const dT=typeof addEventListener=="function"&&typeof removeEventListener=="function",qv=[];dT&&addEventListener("offline",()=>{qv.forEach(t=>t())},!1);class Bl extends Zn{constructor(e,r){if(super(),this.binaryType=lH,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=uT(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=uT(r.host).host);Ob(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=gH(this.opts.query)),dT&&(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"})},qv.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const r=Object.assign({},this.opts.query);r.EIO=O3,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&&Bl.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",Bl.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+=pH(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,Db(()=>{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(Bl.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(),dT&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=qv.indexOf(this._offlineEventListener);n!==-1&&qv.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,r),this.writeBuffer=[],this._prevBufferLen=0}}}Bl.protocol=O3;class OH extends Bl{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;Bl.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;Bl.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 NH=class extends OH{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=>xH[a]).filter(a=>!!a)),super(e,n)}};function IH(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=uT(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 MH=typeof ArrayBuffer=="function",jH=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,B3=Object.prototype.toString,LH=typeof Blob=="function"||typeof Blob<"u"&&B3.call(Blob)==="[object BlobConstructor]",BH=typeof File=="function"||typeof File<"u"&&B3.call(File)==="[object FileConstructor]";function kx(t){return MH&&(t instanceof ArrayBuffer||jH(t))||LH&&t instanceof Blob||BH&&t instanceof File}function zv(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(zv(t[r]))return!0;return!1}if(kx(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return zv(t.toJSON(),!0);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&zv(t[r]))return!0;return!1}function UH(t){const e=[],r=t.data,n=t;return n.data=fT(r,e),n.attachments=e.length,{packet:n,buffers:e}}function fT(t,e){if(!t)return t;if(kx(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]=fT(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]=fT(t[n],e));return r}return t}function FH(t,e){return t.data=pT(t.data,e),delete t.attachments,t}function pT(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]=pT(t[r],e);else if(typeof t=="object")for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=pT(t[r],e));return t}const qH=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],zH=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 $H{constructor(e){this.replacer=e}encode(e){return(e.type===xr.EVENT||e.type===xr.ACK)&&zv(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=UH(e),n=this.encodeAsString(r.packet),a=r.buffers;return a.unshift(n),a}}function oO(t){return Object.prototype.toString.call(t)==="[object Object]"}class wx extends Zn{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 VH(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(kx(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(wx.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 oO(r);case xr.DISCONNECT:return r===void 0;case xr.CONNECT_ERROR:return typeof r=="string"||oO(r);case xr.EVENT:case xr.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&qH.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 VH{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=FH(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const HH=Object.freeze(Object.defineProperty({__proto__:null,Decoder:wx,Encoder:$H,get PacketType(){return xr},protocol:zH},Symbol.toStringTag,{value:"Module"}));function zs(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const GH=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class U3 extends Zn{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=[zs(e,"open",this.onopen.bind(this)),zs(e,"packet",this.onpacket.bind(this)),zs(e,"error",this.onerror.bind(this)),zs(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(GH.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 Sp(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}Sp.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};Sp.prototype.reset=function(){this.attempts=0};Sp.prototype.setMin=function(t){this.ms=t};Sp.prototype.setMax=function(t){this.max=t};Sp.prototype.setJitter=function(t){this.jitter=t};class hT extends Zn{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,Ob(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 Sp({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||HH;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 NH(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const a=zs(r,"open",function(){n.onopen(),e&&e()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=zs(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(zs(e,"ping",this.onping.bind(this)),zs(e,"data",this.ondata.bind(this)),zs(e,"error",this.onerror.bind(this)),zs(e,"close",this.onclose.bind(this)),zs(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){Db(()=>{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 U3(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 Th={};function $v(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const r=IH(t,e.path||"/socket.io"),n=r.source,a=r.id,i=r.path,o=Th[a]&&i in Th[a].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let u;return c?u=new hT(n,e):(Th[a]||(Th[a]=new hT(n,e)),u=Th[a]),r.query&&!e.query&&(e.query=r.queryKey),u.socket(r.path,e)}Object.assign($v,{Manager:hT,Socket:U3,io:$v,connect:$v});function Zu(t,e){try{if(!t)return;const r={tag:e,id:t.id,connected:t.connected,active:t.active};t.disconnect()}catch{}}function F3(t,e){try{if(!t)return;t.close?.()}catch{}}const q3=v.createContext(void 0),WH=({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(q3.Provider,{value:{reveal:e,triggerReveal:i,scheduleReveal:u,resetReveal:d,triggerSpin:o,rollTrigger:n,resetSpin:c},children:t})},Zo=()=>{const t=v.useContext(q3);if(!t)throw new Error("useDiceReveal must be used within a DiceRevealProvider");return t},z3=v.createContext(null);let ja=null,cO="",Vv=0,$3=0,lO=0;const KH=1200;let Sx=!1,uO=0;const YH=2e3;function Ws(t,e){if(!t||t.connected||t.active||Sx)return!1;const r=Date.now();if(r<uO)return!1;uO=r+YH;try{t.connect()}catch{}return!0}function XH(){Sx=!1}function V3(){Sx=!0}function Ex(t=2e3){try{Vv=Date.now()+Math.max(0,t|0)}catch{}}function JH(t=2e3){try{Ex(t)}catch{}try{ja?.removeAllListeners()}catch{}try{Zu(ja,"SocketContext: hardDisconnectSocket")}catch{}}function QH(){const t=ja;if(t){try{t.auth={platform:"web",guest:!0}}catch{}try{$3=Date.now()+3e3}catch{}try{Zu(t,"SocketContext: logout refresh")}catch{}setTimeout(()=>{try{t.connect()}catch{}},100)}}function ZH(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=$v(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 eG(t){if(ja&&cO===t)return ja;if(ja){try{ja.removeAllListeners()}catch{}try{F3(ja,"SocketContext: getSharedSocket replace")}catch{}ja=null}ja=ZH(t),cO=t;try{if(typeof window<"u"){(window.location?.search||"").includes("e2e=1")&&(window.__SOCKET=ja,window.__sharedSocket=ja,window.hardDisconnectSocket=JH,window.suspendSocketAutoConnect=Ex);try{if(!window.__clientErrMon){window.__clientErrMon=!0;const r=a=>{try{const i=window.__sharedSocket||ja;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{}}),ja.on("connect",()=>{try{const a=ja,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 ja}function tG({children:t}){const{user:e,initialized:r}=Vr(),n=ui(),a=v.useMemo(()=>eG(n),[n]),{resetSpin:i}=Zo();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,Vv-Date.now());if(h<=0)return f();setTimeout(()=>{o||f()},h).unref?.()};if(e){const f=await li();if(o)return;if(f){const h=u(),m=`t:${f}`;if(a.auth={token:f},c(m),a.disconnected)d(()=>{o||(Ws(a),i())});else if(h!==m){const _=Date.now();_-lO>=KH&&(lO=_,d(()=>{if(!o){try{Zu(a,"SocketContext: auth change soft reconnect")}catch{}setTimeout(()=>{o||(Ws(a),i())},100)}}))}}}})(),()=>{o=!0}},[r,e,a]),v.useEffect(()=>{const o=async()=>{if(Date.now()<Vv)return;const c=await li();if(!c){if(Date.now()<$3){try{a.auth={platform:"web",guest:!0},a.__authSig="g:*"}catch{}i();return}try{a.auth={},a.__authSig=""}catch{}try{a.disconnected||Zu(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 Zf(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 li();a.auth=d?{token:d}:{platform:"web",guest:!0}}catch{}try{if(a.connected)try{Zu(a,"SocketContext: OTA forceReconnect")}catch{}setTimeout(()=>{o||(Ws(a,"SocketContext:OTA-forceReconnect"),i())},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()<Vv)&&a.disconnected){try{const m=await li();if(o||!m)return;a.auth={token:m}}catch{}a.disconnected&&(Ws(a),i())}},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{F3(a,"SocketContext: beforeunload")}catch{}};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}},[a]),g.jsx(z3.Provider,{value:a,children:t})}function Ss(){const t=v.useContext(z3);if(!t)throw new Error("useSocket must be used within a SocketProvider");return t}const H3=v.createContext({user:null,loading:!0,initialized:!1,refreshUser:async()=>{},logout:async()=>{},meId:""}),Vr=()=>v.useContext(H3);function rG(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 nG=({children:t})=>{const[e,r]=v.useState(null),[n,a]=v.useState(""),[i,o]=v.useState(!0),[c,u]=v.useState(!1),d=_i(),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 D=async()=>{r(null),a("");try{Mw(null)}catch{}};if(d.pathname==="/login"&&!b?.force){await D(),o(!1),u(!0);return}o(!0);const P=(async()=>{try{const A=await Rb(),C=rG(A);if(C){XH(),r(C),a(C?.id||"");try{Mw(C.id||null)}catch{}}else await D()}catch{if(!h.current)return;await D()}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{Ex(2500)}catch{}b&&await Bv(b);try{await fetch("/api/auth/clear",{method:"POST",credentials:"include"})}catch{}}finally{if(!h.current)return;try{await Cg()}catch{}try{await Z9()}catch{}r(null),a("");try{Mw(null)}catch{}try{QH()}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(H3.Provider,{value:w,children:t})};function Bi({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 aG(){const{user:t,loading:e,initialized:r}=Vr(),n=_i(),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(Bi,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]}):!t&&!i&&!(c||u)?g.jsx(tm,{to:"/login",replace:!0,state:{from:n}}):g.jsx(d3,{})}function iG(){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 G3=v.createContext(null);function sG({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(G3.Provider,{value:d,children:[t,Wc.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 cu(){const t=v.useContext(G3);if(!t){const e=()=>"noop";return{show:()=>"noop",success:e,error:e,info:e,dismiss:()=>{}}}return t}const W3={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(W3);const Tt=new Proxy(W3,{set(){throw new TypeError("SocketEvents is read-only")},defineProperty(){throw new TypeError("SocketEvents is read-only")},deleteProperty(){throw new TypeError("SocketEvents is read-only")}}),oG="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=",dO=""+new URL("flash-1UjQ_pjl.m4a",import.meta.url).href,fO=""+new URL("swoosh-DWLYYP2o.m4a",import.meta.url).href,K3=""+new URL("dice_whirr-D6_Xjgte.m4a",import.meta.url).href,cG=""+new URL("loss-MbFJ6Xyb.m4a",import.meta.url).href,lG=""+new URL("winner-C_feQyA8.m4a",import.meta.url).href,uG=""+new URL("win-BofsSXdy.m4a",import.meta.url).href,dG=""+new URL("ante_up-BNJNkzdg.m4a",import.meta.url).href,fG=""+new URL("push-D8ciTeGD.m4a",import.meta.url).href,pG=""+new URL("your_turn-r-y-lDUH.m4a",import.meta.url).href,hG=""+new URL("point_set-BYYb2H7O.m4a",import.meta.url).href,mG=""+new URL("place_hit-B397CGff.m4a",import.meta.url).href,gG=""+new URL("yes-D6HNwLBK.m4a",import.meta.url).href,yG=""+new URL("smashing-CDhgl1WN.m4a",import.meta.url).href,vG=""+new URL("love_you-ClILzZiq.m4a",import.meta.url).href,_G=""+new URL("gangster-BuThOTHu.m4a",import.meta.url).href,gd=typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),Mc=typeof window<"u"?window.Capacitor:void 0,Nb=!!Mc&&typeof Mc.isNativePlatform=="function"&&Mc.isNativePlatform(),qr=Mc&&(Mc.Plugins?.NativeAudio||Mc.NativeAudio)||void 0,Ep=Nb&&!!qr,Tx=Nb&&gd,bG=Nb&&!gd;let Yo=!1,Kl=!0,Pm=null;const Cx=500;function kG(){return!!Kl}function pO(t){if(Kl=!!t,!Kl)try{D_()}catch{}}const wG=["vYes","vSmashing","vLove","vGangster"],Ui={click:oG,flash:dO,chip:fO,win:lG,winDing:uG,lose:cG,push:fG,cardSwoosh:fO,placeBets:dG,yourTurn:pG,vYes:gG,vSmashing:yG,vLove:vG,vGangster:_G,pointSet:hG,placeHit:mG,betPlaced:dO},SG=["flash","win","winDing","lose","push","chip","cardSwoosh","placeBets","yourTurn","pointSet","vYes","vSmashing","vLove","vGangster","placeHit"],Y3=3,X3=4,J3=Tx?1:gd?2:8;let Uw=0,xx=!1;function Q3(){const t=performance.now();xx=Uw>0&&t-Uw>50,Uw=t,requestAnimationFrame(Q3)}typeof requestAnimationFrame<"u"&&requestAnimationFrame(Q3);const Z3={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},A_={},Fc={};let Yl=0,eB=0;const Fw=new WeakMap;let qw=!1;const hO=[];function Am(t){hO.push(t),!qw&&(qw=!0,requestAnimationFrame(()=>{qw=!1;const e=hO.splice(0);for(const r of e)r()}))}const fs=new Set,zw=new Map,Rm=new Map;function Xl(t){const e=Date.now(),r=Rm.get(t)||{count:0,last:0};r.count=Math.min(5,r.count+1),r.last=e,Rm.set(t,r)}function Ib(t){t?Rm.delete(t):Rm.clear()}function Mb(t){const e=Rm.get(t);if(!e)return!0;const r=Date.now(),n=2e3*Math.min(3,e.count);return r-e.last>n}function EG(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 jb(t,e){if(!Ep||!qr)throw new Error("Native audio not available");if(fs.has(t))return;const r=zw.get(t);if(r){if(await r,!fs.has(t))throw new Error("Asset preload failed");return}try{const n=EG(e);if(!n)throw Xl(t),new Error("Failed to resolve asset path");const a=(async()=>{await qr.preload({assetId:t,assetPath:n.path}),fs.add(t)})();zw.set(t,a),await a.finally(()=>{zw.delete(t)})}catch(n){throw Xl(t),n}}async function TG(t,e,r){if(!Ep||!qr)throw new Error("Native audio not available");if(!Mb(t))throw new Error("Native audio cooldown active");try{if(await jb(t,e),!fs.has(t))throw new Error("Asset not loaded");if(r?.volume!=null&&qr.setVolume)try{await qr.setVolume({assetId:t,volume:Xa(r.volume,0,1)})}catch{}await qr.play({assetId:t}),r?.durationMs&&r.durationMs>0&&window.setTimeout(()=>{try{qr.stop({assetId:t})}catch{}},Math.max(10,Math.floor(r.durationMs)))}catch(n){throw Xl(t),n}}function Px(t){const e=new Audio(Ui[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",()=>Lo(t,e)),e}function lu(t){let e=Fc[t];if(!e){const r=t==="flash"?X3:Y3;e={free:[],busy:new Set,size:0};for(let n=0;n<r;n++)e.free.push(Px(t)),e.size++;Fc[t]=e}return e}function Ax(t){const e=t==="flash"?X3:Y3,r=lu(t);if(r.free.length>0)return r.free.pop();if(r.size<e){const n=Px(t);return r.size++,n}return null}function Lo(t,e){const r=Fc[t];r&&r.busy.has(e)&&(r.busy.delete(e),r.free.push(e),Yl=Math.max(0,Yl-1))}function Rx(){Object.keys(Z3).forEach(t=>delete A_[t])}function CG(){try{fs.clear(),Ib()}catch{}}function Lb(t,e=800){const r=Fw.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 Fw.set(t,n),n.finally(()=>{Fw.delete(t)}),n}let iv=null,Kn=null,jc=null,R_=!1;function D_(){Object.keys(Fc).forEach(t=>{const e=Fc[t];e&&[...e.busy].forEach(r=>{try{r.pause(),r.currentTime=0}catch{}Lo(t,r)})});try{iv&&(iv.pause(),iv.currentTime=0)}catch{}try{Kn&&(Kn.pause(),Kn.currentTime=0)}catch{}iv=null,Kn=null;try{const t=Object.keys(Ui);for(const e of t){const r=ap?.[e];if(r){try{r.pause(),r.currentTime=0}catch{}ap[e]=null}Lc[e]&&(window.clearTimeout(Lc[e]),delete Lc[e])}if(Ep&&qr){for(const e of Object.keys(Ui))if(fs.has(e)){try{wf(qr.stop({assetId:e}))}catch{}try{qr.unload&&wf(qr.unload({assetId:e}))}catch{}try{fs.delete(e)}catch{}}if(fs.has("loop_dice_whirr")){try{wf(qr.stop({assetId:"loop_dice_whirr"}))}catch{}try{qr.unload&&wf(qr.unload({assetId:"loop_dice_whirr"}))}catch{}try{fs.delete("loop_dice_whirr"),Ib("loop_dice_whirr")}catch{}}R_=!1}}catch{}Yl=0,Rx()}let tB=!1;function am(t){tB=!!t}let mO=0;const xG=1500;async function PG(t,e){if(!Kl||tB)return!1;const r=Date.now();if(r-mO<xG)return!1;if(mO=r,Tx&&qr&&Mb(t))try{return(async()=>{try{if(await jb(t,Ui[t]),fs.has(t)){if(qr.setVolume)try{await qr.setVolume({assetId:t,volume:Xa(e,0,1)})}catch{}await qr.play({assetId:t})}}catch{Xl(t)}})(),!0}catch{Xl(t)}if(!Yo||gd&&xx)return!1;try{const n=Ax(t);if(!n){const i=new Audio(Ui[t]);return i.volume=mi(t,e),i.play().catch(()=>{}),!0}return lu(t).busy.add(n),Yl++,n.currentTime=0,n.volume=mi(t,e),n.play().catch(()=>Lo(t,n)),!0}catch{return!1}}const AG={3:"vGangster",4:"vLove",5:"vSmashing",6:"vYes",7:"vSmashing"};async function gO(t,e=.5){const r=AG[t>=7?7:t];return r?PG(r,e):!1}function RG(t,e){if(!Kl||!Yo||Yl>=J3)return;const r=Ax(t);if(!r)return;lu(t).busy.add(r),Yl++;try{r.currentTime=0,e?.volume!=null&&(r.volume=mi(t,e.volume)),e?.rate!=null&&(r.playbackRate=Xa(e.rate,.25,4));const a=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{r.pause(),r.currentTime=0}catch{}Lo(t,r)},Math.max(10,Math.floor(e.durationMs))):null;Am(()=>{r.play().catch(()=>{a&&window.clearTimeout(a),Lo(t,r)})})}catch{Lo(t,r)}}async function vs(t,e){if(!Kl)return;const r=Date.now();if(r<eB||gd&&xx&&t!=="win"&&t!=="lose")return;const n=Z3[t]??0;if(n>0){const o=A_[t]??0;if(r-o<n)return}if(A_[t]=r,Tx&&qr&&Mb(t)){(async()=>{try{await TG(t,Ui[t],{volume:e?.volume,durationMs:e?.durationMs})}catch{Xl(t)}})();return}if(!Yo||Pm&&r-Pm<Cx)return;if(bG){RG(t,e);return}if(Yl>=J3)return;const a=Ax(t);if(!a)return;lu(t).busy.add(a),Yl++;try{a.currentTime=0,e?.volume!=null&&(a.volume=mi(t,e.volume)),e?.rate!=null&&(a.playbackRate=Xa(e.rate,.25,4));const o=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{a.pause(),a.currentTime=0}catch{}Lo(t,a)},Math.max(10,Math.floor(e.durationMs))):null;if(!await Lb(a,1e3)){Am(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),Lo(t,a)})});return}Am(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),Lo(t,a)})})}catch{Lo(t,a)}}const Xa=(t,e,r)=>Math.min(r,Math.max(e,t)),DG={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 mi(t,e){const r=Xa(e,0,1);if(gd){const n=DG[t];if(typeof n=="number")return Xa(Math.max(r,n),0,1)}return r}function mT(){gd&&(Object.keys(Fc).forEach(t=>{const e=t,r=Fc[e];r&&r.free.forEach(n=>{try{n.pause(),n.src=Ui[e],n.load()}catch{}})}),Rx())}function OG(){try{D_()}catch{}}function NG(){CG();try{mT()}catch{}Rx()}try{const t=Mc&&(Mc.Plugins?.App||Mc.App)||void 0;Nb&&t?.addListener&&t.addListener("appStateChange",e=>{!!(e&&e.isActive)?NG():OG()})}catch{}async function Lr(){if(!Yo){Yo=!0,Pm=Date.now(),eB=Date.now()+Cx,Object.keys(Ui).forEach(t=>{try{lu(t)}catch{}});try{np()}catch{}try{if(Ep&&qr){const t=SG;Promise.resolve().then(async()=>{for(const e of t)try{await jb(e,Ui[e])}catch{}})}}catch{}}}function Dx(){return!!Yo}function np(t){const e=t&&t.length?t:Object.keys(Ui);for(const r of e)lu(r).free.forEach(a=>{try{a.load()}catch{}})}async function O_(t,e=800){const r=t&&t.length?t:Object.keys(Ui),n=i=>new Promise(o=>{try{const u=lu(i).free[0]||Px(i);Lb(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"?D_():mT()};document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>D_()),window.addEventListener("pageshow",()=>mT())}function IG(t){const r=Xa(t?.volume,0,1)*.5;vs("flash",{volume:mi("flash",r)})}function MG(t){vs("chip",{volume:mi("chip",t?.volume??.25),durationMs:t?.durationMs??500,rate:t?.playbackRate})}function jG(t){vs("cardSwoosh",{volume:mi("cardSwoosh",t?.volume),rate:t?.playbackRate??1})}function LG(t){vs("lose",{volume:mi("lose",t?.volume)})}function BG(t){vs("push",{volume:mi("push",t?.volume)})}function UG(t){const e=Xa(t?.volume,0,1),r=mi("win",e);vs("winDing",{volume:.025}),vs("win",{volume:mi("win",Xa(r*.35,0,1))})}function gT(t){vs("placeBets",{volume:mi("placeBets",t?.volume??.65)})}function yO(t){vs("pointSet",{volume:mi("pointSet",t?.volume??.15)})}function FG(t){vs("betPlaced",{volume:mi("betPlaced",t?.volume)})}function vO(t){const e=Xa(t?.sfxVolume??.15,0,1);vs("winDing",{volume:Xa(e*.25,0,1)})}async function rB(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 FSe(t){if(!Kl)return;const e=Xa(t?.volume,0,1),r=Xa(t?.playbackRate,.25,4);let n=!1;if(Ep&&qr&&Mb("loop_dice_whirr")){try{jb("loop_dice_whirr",K3).then(async()=>{try{if(R_||(qr.loop?await qr.loop({assetId:"loop_dice_whirr"}):await qr.play({assetId:"loop_dice_whirr"}),R_=!0),qr.setVolume)try{await qr.setVolume({assetId:"loop_dice_whirr",volume:e})}catch{}}catch{Xl("loop_dice_whirr"),$w(e,r)}}).catch(()=>{Xl("loop_dice_whirr"),$w(e,r)}),n=!0}catch{}if(n){try{jc&&window.clearTimeout(jc),jc=window.setTimeout(()=>{try{Ox()}catch{}},8e3)}catch{}return}}Yo&&$w(e,r)}function $w(t,e){if(Yo)try{if(!Kn){Kn=new Audio(K3),Kn.loop=!0,Kn.preload="auto";try{Kn.playsInline=!0}catch{}Lb(Kn,800)}if(!Kn.paused){Kn.volume=t,Kn.playbackRate=e;return}Kn.volume=t,Kn.playbackRate=e,Kn.currentTime=0,Am(()=>{Kn&&Kn.play().catch(()=>{})}),jc&&window.clearTimeout(jc),jc=window.setTimeout(()=>{try{Ox()}catch{}},8e3)}catch{}}function Ox(){if(jc&&(window.clearTimeout(jc),jc=null),Ep&&qr)try{try{wf(qr.stop({assetId:"loop_dice_whirr"}))}catch{}try{qr.unload&&wf(qr.unload({assetId:"loop_dice_whirr"}))}catch{}try{fs.delete("loop_dice_whirr"),Ib("loop_dice_whirr")}catch{}R_=!1}catch{}try{Kn&&rB(Kn,120)}catch{}}function wf(t){try{return t&&typeof t.then=="function"?t.catch(()=>{}):Promise.resolve()}catch{return Promise.resolve()}}const ap={},Lc={};function qG(t,e){wG.includes(t)||vs(t,{volume:e?.volume,rate:e?.rate,durationMs:e?.durationMs})}function zG(t,e){if(!(!Kl||!Yo)&&!(Pm&&Date.now()-Pm<Cx))try{let r=ap[t];if(!r){r=new Audio(Ui[t]),r.loop=!0,r.preload="auto";try{r.playsInline=!0}catch{}ap[t]=r,Lb(r,800)}const n=Xa(e?.volume??.1,0,1),a=Xa(e?.rate??1,.25,4);if(!r.paused){r.volume=n,r.playbackRate=a;return}r.volume=n,r.playbackRate=a,r.currentTime=0,Am(()=>{r.play().catch(()=>{})}),Lc[t]&&window.clearTimeout(Lc[t]);const i=Math.max(5e3,Math.min(6e4,e?.maxMs??15e3));Lc[t]=window.setTimeout(()=>{try{nB(t)}catch{}},i)}catch{}}async function nB(t){try{Lc[t]&&(window.clearTimeout(Lc[t]),delete Lc[t]);const e=ap[t];if(!e)return;await rB(e,120),ap[t]=null}catch{}}function $G(){try{Lr()}catch{}}async function VG(t,e){try{if(t==="__probe__")return Promise.resolve(!!Yo);const r=t;return r in Ui?e?.loop?(zG(r,{volume:e.volume,rate:e.rate}),!0):(qG(r,{volume:e?.volume,rate:e?.rate}),!0):!1}catch{return!1}}function HG(t){try{np(t)}catch{}}function _O(t){try{const e=t;try{nB(e)}catch{}const r=Fc[e];if(r){try{[...r.busy].forEach(n=>{try{n.pause(),n.currentTime=0}catch{}})}catch{}delete Fc[e]}try{delete A_[e]}catch{}try{fs.delete(e),Ib(e)}catch{}try{lu(e)}catch{}}catch{}}const Nl=[];function yT(t,e){try{Nl.push({event:t,ts:Date.now(),mode:e}),Nl.length>12&&Nl.shift()}catch{}}function Hv(){return[...Nl]}function im(t,e=2e3){return t.connected?Promise.resolve():(Ws(t),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 vT(t,e,r,n){try{iB(e)}catch{}const a=n?.timeoutMs??15e3;try{await im(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{Ws(t,"emit.ts:emitAck-ensureConnected-fallback")}catch{}await new Promise(u=>{const d=setTimeout(()=>u(),800);t.once("connect",()=>{clearTimeout(d),u()})})}else throw o}yT(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=Nl[Nl.length-1]?.event||"unknown";rp("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{Ws(t,"emit.ts:emitAck-disconnect-retry")}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=Nl[Nl.length-1]?.event||"unknown";rp("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 aB(t,e,r){try{iB(e)}catch{}try{await im(t),yT(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{Ws(t,"emit.ts:emitFF-fallback")}catch{}await new Promise(i=>{const o=setTimeout(()=>i(),800);t.once("connect",()=>{clearTimeout(o),i()})}),yT(e,"ff"),t.emit(e,r);return}throw n}}function iB(t){new Set([Tt.ROLL_DICE,Tt.PLACE_MAIN_BET,Tt.CREATE_SIDE_BET,Tt.ACCEPT_SIDE_BET,Tt.CANCEL_SIDE_BET,Tt.POKER_ACT,"poker:start_hand","craps:roll"]).has(t)&&Lr()}const sB=ui();async function GG(t,e,r="usd"){return await(await fetch(`${sB}/api/payment/chips`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({amount:t,userId:e,currency:r})})).json()}async function WG(t,e){return await(await fetch(`${sB}/api/payment/membership`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({planId:t,userId:e})})).json()}const bO={createChipsCheckout:GG,createMembershipCheckout:WG},oB=v.createContext(void 0),KG=({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 bO.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 bO.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(oB.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 Bb(){const t=v.useContext(oB);return t||{status:"idle",error:null,startChipsCheckout:async()=>null,startMembershipCheckout:async()=>null,setStatus:()=>{},setError:()=>{},membershipModalOpen:!1,setMembershipModalOpen:()=>{},chipsModalOpen:!1,setChipsModalOpen:()=>{}}}function Oi(){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 YG(t,e){const r=v.useCallback(async()=>{if(!t)throw new Error("Socket unavailable");if(t.connected)return t;try{!t.active&&t.disconnected&&Ws(t,"useEmitter.ensureConnected"),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:Oi()}}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()=>vT(u,i,d,_);let b,E=0;const T=2,D=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{t&&t.disconnected&&Ws(t,"useSocketEmitters:backoff-retry"),await new Promise(L=>{const j=setTimeout(()=>L(),N);t?.once("connect",()=>{clearTimeout(j),L()})})}catch{}return D()}else throw P}};b=await D();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 aB(c,i,o)},[r]);return{ack:n,send:a}}function ga(){const t=Ss(),{info:e}=cu(),r=v.useRef(0),n=v.useCallback(W=>{const $=Date.now();if(!($-r.current<1200)){r.current=$;try{e("Please wait a moment - you're doing that too quickly.",{duration:2500})}catch{}}},[e]),{ack:a,send:i}=YG(t,n),{setMembershipModalOpen:o}=Bb(),{user:c}=Vr(),u=v.useCallback(W=>{const $=(()=>{const oe={};try{oe.name=String(W.name||"").trim().slice(0,60),(W.isPrivate===!0||W.isPrivate===!1)&&(oe.isPrivate=!!W.isPrivate),(W.singlePlayer===!0||W.singlePlayer===!1)&&(oe.singlePlayer=!!W.singlePlayer),typeof W.botsPerRoom=="number"&&Number.isInteger(W.botsPerRoom)&&(oe.botsPerRoom=W.botsPerRoom),(W.gameMode==="cee-lo"||W.gameMode==="craps")&&(oe.gameMode=W.gameMode)}catch{}return oe})();return a(Tt.CREATE_ROOM,$).then(oe=>{try{oe&&oe.ok}catch{}return oe})},[a,o,c]),d=v.useCallback(async W=>{const $=async()=>a(Tt.JOIN_ROOM,{roomId:W});let oe=await $();if(oe&&oe.ok===!1&&/Room not found/i.test(String(oe.error||""))){try{await new Promise(ct=>setTimeout(ct,120))}catch{}oe=await $(),oe&&oe.ok}if(oe&&oe.ok===!1&&oe.error===q7.SOCKET.NEEDS_PREMIUM)try{o(!0)}catch{}return oe},[a,o]),f=v.useCallback(W=>a(Tt.LEAVE_ROOM,{roomId:W}),[a]),h=v.useCallback(W=>i(Tt.LEAVE_ROOM,{roomId:W}),[i]),m=v.useCallback(W=>a(Tt.ROLL_DICE,{roomId:W}),[a]),_=v.useCallback(W=>a(Tt.CONFIRM_BETS,{roomId:W}),[a]),w=v.useCallback((W,$)=>a(Tt.CRAPS_PLACE_PASS,{roomId:W,amount:$}),[a]);v.useCallback((W,$)=>a(Tt.CRAPS_PLACE_DONT_PASS,{roomId:W,amount:$}),[a]);const b=v.useCallback((W,$,oe)=>a(Tt.CRAPS_PLACE_ODDS,{roomId:W,amount:$,passType:oe}),[a]),E=v.useCallback((W,$,oe)=>a(Tt.CRAPS_PLACE_PLACE,{roomId:W,amount:$,point:oe}),[a]),T=v.useCallback((W,$)=>a(Tt.CRAPS_PLACE_FIELD,{roomId:W,amount:$}),[a]),D=v.useCallback((W,$,oe)=>a(Tt.CRAPS_PLACE_BIG,{roomId:W,amount:$,kind:oe}),[a]),P=v.useCallback((W,$)=>a(Tt.CRAPS_PLACE_COME,{roomId:W,amount:$}),[a]),A=v.useCallback((W,$)=>a(Tt.CRAPS_PLACE_DONT_COME,{roomId:W,amount:$}),[a]),C=v.useCallback((W,$,oe)=>a(Tt.CRAPS_PLACE_COME_ODDS,{roomId:W,point:$,amount:oe}),[a]),O=v.useCallback((W,$,oe)=>a(Tt.CRAPS_PLACE_DONT_COME_ODDS,{roomId:W,point:$,amount:oe}),[a]),I=v.useCallback((W,$)=>a(Tt.CRAPS_TOGGLE_PLACE_WORKING,{roomId:W,working:$}),[a]),x=v.useCallback(async W=>{try{const $=J.current.get(W)||[],oe=ee.current.get(W);if(oe&&(clearTimeout(oe),ee.current.delete(W)),$.length>0)if(J.current.delete(W),$.length>1)await a("craps:add_bets_batch",{roomId:W,bets:$,eventId:Oi()});else{const{type:ct,amount:Nt}=$[0];await a("craps:add_bet",{roomId:W,type:ct,amount:Nt,eventId:Oi()})}}catch{}try{const $=B.current.get(W)||[],oe=K.current.get(W);if(oe&&(clearTimeout(oe),K.current.delete(W)),$.length>0)if(B.current.delete(W),$.length>1)await a("craps:remove_bets_batch",{roomId:W,bets:$,eventId:Oi()});else{const{type:ct,amount:Nt}=$[0];await a("craps:remove_bet",{roomId:W,type:ct,amount:Nt,eventId:Oi()})}}catch{}},[a]),R=v.useCallback(async W=>{try{if(!W)return{ok:!1,error:"no_room"}}catch{}try{await x(W)}catch{}return a(Tt.CRAPS_ROLL,{roomId:W})},[a,x]),N=v.useCallback(W=>a(Tt.CRAPS_READY,{roomId:W}),[a]),L=v.useCallback((W,$)=>a(Tt.CRAPS_FETCH_HISTORY,{roomId:W,...$||{}}),[a]),j=v.useCallback(W=>a("craps:get_state",{roomId:W}),[a]),q=v.useCallback(W=>a("craps:join_order",{roomId:W}),[a]),U=v.useCallback(W=>a("craps:leave_order",{roomId:W}),[a]),Y=v.useCallback(W=>a("craps:pass_turn",{roomId:W}),[a]),F=v.useCallback((W,$)=>a("craps:set_order",{roomId:W,order:$}),[a]),X=v.useCallback(W=>a("craps:reset_shooter",{roomId:W}),[a]),J=v.useRef(new Map),ee=v.useRef(new Map),H=1e3,B=v.useRef(new Map),K=v.useRef(new Map),ae=1e3,te=v.useCallback(W=>a("craps:list_bets",{roomId:W,eventId:Oi()}),[a]),pe=v.useCallback((W,$,oe)=>{const ct=J.current.get(W)||[];ct.push({type:$,amount:oe}),J.current.set(W,ct);const Nt=ee.current.get(W);Nt&&clearTimeout(Nt);const Qt=setTimeout(()=>{const Rt=J.current.get(W)||[];if(Rt.length!==0)if(J.current.delete(W),ee.current.delete(W),Rt.length>1)a("craps:add_bets_batch",{roomId:W,bets:Rt,eventId:Oi()});else{const{type:mr,amount:Kr}=Rt[0];a("craps:add_bet",{roomId:W,type:mr,amount:Kr,eventId:Oi()})}},H);return ee.current.set(W,Qt),Promise.resolve({ok:!0})},[a]),ce=v.useCallback((W,$)=>a("craps:add_bets_batch",{roomId:W,bets:$,eventId:Oi()}),[a]),Re=v.useCallback((W,$)=>a("craps:remove_bets_batch",{roomId:W,bets:$,eventId:Oi()}),[a]),He=v.useCallback((W,$,oe)=>{const ct=B.current.get(W)||[];ct.push({type:$,amount:oe}),B.current.set(W,ct);const Nt=K.current.get(W);Nt&&clearTimeout(Nt);const Qt=setTimeout(()=>{const Rt=B.current.get(W)||[];if(Rt.length!==0)if(B.current.delete(W),K.current.delete(W),Rt.length>1)a("craps:remove_bets_batch",{roomId:W,bets:Rt,eventId:Oi()});else{const{type:mr,amount:Kr}=Rt[0];a("craps:remove_bet",{roomId:W,type:mr,amount:Kr,eventId:Oi()})}},ae);return K.current.set(W,Qt),Promise.resolve({ok:!0})},[a]),ie=v.useCallback(W=>a("craps:clear_bets",{roomId:W,eventId:Oi()}),[a]),xe=v.useCallback(W=>a("craps:summarize",{roomId:W}),[a]),re=v.useCallback(W=>a(Tt.BANKER_GIVE_UP,{roomId:W}),[a]),G=v.useCallback(async()=>{const W=async()=>a(Tt.GET_ROOMS_LIST,{});let $=await W();return $&&$.ok===!1&&$.error==="invalid_payload"&&(await new Promise(oe=>setTimeout(oe,80)),$=await W()),$},[a]),ve=v.useCallback((W,$)=>a(Tt.SPECTATE_SET,{roomId:W,spectate:$}),[a]),Oe=v.useCallback(async(W,$)=>{const oe=await a(Tt.PLACE_MAIN_BET,{roomId:W,amount:$});try{rp("bet_place",{game:"cee-lo",type:"MAIN",amount:$})}catch{}return oe},[a]),he=v.useCallback((W,$)=>a(Tt.CANCEL_MAIN_BET,{roomId:W,wagerId:$}),[a]),Ce=v.useCallback((W,$)=>a(Tt.CREATE_SIDE_BET,{roomId:W,...$}),[a]),st=v.useCallback((W,$)=>a(Tt.ACCEPT_SIDE_BET,{roomId:W,wagerId:$}),[a]),Ne=v.useCallback((W,$)=>a(Tt.CANCEL_SIDE_BET,{roomId:W,wagerId:$}),[a]),St=v.useCallback(async W=>{if(!W)return{ok:!1,error:"no_room"};const $={roomId:W},oe=await a(Tt.GET_WAGERS,$);return oe&&oe.ok,oe},[a]),at=v.useCallback(W=>a(Tt.RTC_JOIN,{roomId:W}),[a]),Ke=v.useCallback(W=>{try{t?.volatile?.emit?.(Tt.RTC_LEAVE,{roomId:W})}catch{}},[t]),it=v.useCallback(async(W,$,oe)=>{try{await i(Tt.RTC_SIGNAL,{roomId:W,toPeerId:$,payload:oe})}catch(ct){const Nt=String(ct?.message||ct||"");if(/disconnect|timeout|transport/i.test(Nt)){await new Promise(Qt=>setTimeout(Qt,200));try{await i(Tt.RTC_SIGNAL,{roomId:W,toPeerId:$,payload:oe})}catch{}}}},[i]),mt=v.useCallback((W,$)=>a(Tt.RTC_SET_CAMERA_OWNER,{roomId:W,ownerId:$}),[a]),Je=v.useCallback(async(W,$)=>{try{if(!W)return{ok:!1,error:"no_room"};const oe=await a(Tt.RTC_SET_VIDEO_ENABLED,{roomId:W,enabled:$});return oe.ok,oe}catch{}},[a,o]),ue=v.useCallback((W,$)=>a(Tt.ROOM_SEND_MESSAGE,{roomId:W,text:$}),[a]),Be=v.useCallback((W,$)=>a(Tt.ROOM_FETCH_HISTORY,{roomId:W,sinceTs:$}),[a]),je=v.useCallback((W,$)=>a(Tt.DM_SEND_MESSAGE,{toUserId:W,text:$}),[a]),ot=v.useCallback((W,$)=>a(Tt.DM_FETCH_HISTORY,{peerUserId:W,sinceTs:$}),[a]),Pt=v.useCallback(()=>a(Tt.LOBBY_JOIN,{}),[a]),Ft=v.useCallback(()=>i(Tt.LOBBY_LEAVE,{}),[i]),Me=v.useCallback(()=>a(Tt.LOBBY_LIST,{}),[a]),tt=v.useCallback(W=>a(Tt.DELETE_ROOM,{roomId:W}),[a]),rt=v.useCallback(()=>a(Tt.USER_GET_BALANCE,void 0),[a]),be=v.useCallback((W,$)=>a(Tt.SEND_FRIEND_REQUEST,{toUserId:W,message:$}),[a]),lt=v.useCallback(W=>a(Tt.CANCEL_FRIEND_REQUEST,{requestId:W}),[a]),yt=v.useCallback((W,$)=>a(Tt.RESPOND_FRIEND_REQUEST,{requestId:W,action:$}),[a]),tr=v.useCallback(W=>a(Tt.UNFRIEND,{otherId:W}),[a]),Or=v.useCallback(W=>a(Tt.BLOCK_USER,{blockedId:W}),[a]),ur=v.useCallback(W=>a(Tt.UNBLOCK_USER,{blockedId:W}),[a]),dr=v.useCallback(()=>a(Tt.SOCIAL_GET_LIST,void 0),[a]),fn=v.useCallback((W,$,oe)=>a(Tt.GAME_INVITE_SEND,{roomId:W,toUserId:$,gameMode:oe}),[a]),Z=v.useCallback((W,$)=>a(Tt.GAME_INVITE_RESPOND,{inviteId:W,action:$}),[a]),fe=v.useCallback(W=>a(Tt.USER_UPDATE_PROFILE,W),[a]),ge=v.useCallback(W=>a(Tt.BOTS_NUDGE,{roomId:W??null}),[a]),Pe=v.useCallback(W=>a(Tt.ROOM_REFRESH_STATE,{roomId:W??null}),[a]),De=v.useCallback((W,$)=>i("player:visibility",{roomId:W,visible:$}),[i]);return{createRoom:u,joinRoom:d,leaveRoom:f,leaveRoomTearDown:h,getRoomsList:G,setSpectate:ve,bankerGiveUp:re,pokerCreateRoom:v.useCallback(W=>{const $={...W};let oe=$.maxPlayers;if((typeof oe!="number"||!Number.isInteger(oe)||oe<1||oe>4)&&(oe=$.singlePlayer?1:4),$.maxPlayers=oe,typeof $.startingStack=="number"){const ct=Math.max(1,Math.min(1e6,Math.floor($.startingStack)));$.startingStack=ct}return a(Tt.POKER_ROOM_CREATE,$)},[a,c,o]),pokerDeleteRoom:v.useCallback(W=>a(Tt.POKER_ROOM_DELETE,{roomId:W}),[a]),pokerJoinRoom:v.useCallback(async W=>a(Tt.POKER_JOIN_ROOM,{roomId:W}),[a]),pokerStartHand:v.useCallback(W=>a(Tt.POKER_START_HAND,{roomId:W}),[a]),pokerFold:v.useCallback(W=>a(Tt.POKER_ACT,{roomId:W,action:"fold"}),[a]),pokerCheck:v.useCallback(W=>a(Tt.POKER_ACT,{roomId:W,action:"check"}),[a]),pokerCall:v.useCallback(W=>a(Tt.POKER_ACT,{roomId:W,action:"call"}),[a]),pokerBet:v.useCallback((W,$)=>a(Tt.POKER_ACT,{roomId:W,action:"bet",amount:$}),[a]),pokerRaise:v.useCallback((W,$)=>a(Tt.POKER_ACT,{roomId:W,action:"raise",amount:$}),[a]),pokerFetchHistory:v.useCallback((W,$,oe)=>a(Tt.POKER_FETCH_HISTORY,{roomId:W,limit:$,beforeSeq:oe}),[a]),rollDice:m,confirmBets:_,crapsPlacePass:w,crapsRoll:R,crapsPlaceOdds:b,crapsPlacePlace:E,crapsPlaceField:T,crapsPlaceBig:D,crapsPlaceCome:P,crapsPlaceDontCome:A,crapsPlaceComeOdds:C,crapsPlaceDontComeOdds:O,crapsTogglePlaceWorking:I,crapsReady:N,crapsFetchHistory:L,crapsGetState:j,crapsJoinOrder:q,crapsLeaveOrder:U,crapsPassTurn:Y,crapsSetOrder:F,crapsResetShooter:X,crapsListBets:te,crapsAddBet:pe,crapsBatchAddBets:ce,crapsRemoveBet:He,crapsBatchRemoveBets:Re,crapsClearBets:ie,crapsSummarizeBets:xe,placeMainBet:Oe,cancelMainBet:he,createSideBet:Ce,acceptSideBet:st,cancelSideBet:Ne,getWagers:St,rtcJoin:at,rtcLeave:Ke,rtcSignal:it,rtcSetCameraOwner:mt,rtcSetVideoEnabled:Je,roomSendMessage:ue,roomFetchHistory:Be,dmSendMessage:je,dmFetchHistory:ot,lobbyJoin:Pt,lobbyLeave:Ft,lobbyList:Me,deleteRoom:tt,getUserBalance:rt,sendFriendRequest:be,cancelFriendRequest:lt,respondFriendRequest:yt,unfriend:tr,blockUser:Or,unblockUser:ur,getFriendsList:dr,sendGameInvite:fn,respondGameInvite:Z,updateProfile:fe,botsNudge:ge,refreshRoomState:Pe,sendVisibilityChange:De}}const qe={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 Da(t){const e=Ss(),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=ue=>r.current.onLobbyRooms?.(ue),a=ue=>r.current.onRoomCreated?.(ue),i=ue=>r.current.onRoomUpdated?.(ue),o=ue=>r.current.onRoomDeleted?.(ue),c=ue=>r.current.onJoinedRoom?.(ue),u=ue=>r.current.onRejoinedRoom?.(ue),d=ue=>{r.current.onOtherPlayerJoined?.(ue)},f=ue=>{r.current.onOtherLeft?.(ue)},h=ue=>r.current.onBankerChanged?.(ue),m=ue=>r.current.onDiceRolled?.(ue),_=()=>r.current.onNotYourTurn?.(),w=ue=>r.current.onOtaUpdateAvailable?.(ue),b=ue=>r.current.onBetsUpdated?.(ue),E=ue=>r.current.onGetWagers?.(ue),T=ue=>r.current.onPlayerBalanceUpdated?.(ue),D=ue=>r.current.onSideBetCreated?.(ue),P=ue=>r.current.onSideBetAccepted?.(ue),A=ue=>r.current.onSideBetCanceled?.(ue),C=ue=>r.current.onForceLogout?.(ue),O=ue=>r.current.onError?.(ue),I=ue=>r.current.onRtcSignal?.(ue),x=ue=>r.current.onRtcPeerJoined?.(ue),R=ue=>r.current.onRtcPeerLeft?.(ue),N=ue=>r.current.onRtcCameraOwnerChanged?.(ue),L=ue=>r.current.onRtcVideoEnabled?.(ue),j=ue=>r.current.onRoomMessage?.(ue),q=ue=>r.current.onRoomHistory?.(ue),U=ue=>r.current.onDmMessage?.(ue),Y=ue=>r.current.onDmHistory?.(ue),F=ue=>r.current.onFairnessReveal?.(ue),X=ue=>r.current.onFriendRequestReceived?.(ue),J=ue=>r.current.onFriendRequestCancelled?.(ue),ee=ue=>r.current.onFriendRequestResponded?.(ue),H=ue=>r.current.onUnfriended?.(ue),B=ue=>r.current.onUserBlocked?.(ue),K=ue=>r.current.onUserUnblocked?.(ue),ae=ue=>r.current.onGameInviteReceived?.(ue),te=ue=>r.current.onTurnOrderUpdated?.(ue),pe=ue=>r.current.onSpectatorsUpdated?.(ue),ce=ue=>r.current.onPlayerProfileUpdated?.(ue),Re=ue=>r.current.onPlayerPresenceUpdate?.(ue),He=ue=>r.current.onPokerMyHole?.(ue),ie=ue=>r.current.onPokerWinners?.(ue),xe=ue=>r.current.onPokerRevealAll?.(ue),re=ue=>r.current.onPokerTimedOut?.(ue),G=ue=>r.current.onRoomUpdateState?.(ue),ve=ue=>ue&&(!ue.dice&&typeof ue.d1=="number"&&typeof ue.d2=="number"&&(ue.dice=[ue.d1,ue.d2]),ue.dice&&(typeof ue.d1!="number"||typeof ue.d2!="number")&&(ue.d1=ue.dice[0],ue.d2=ue.dice[1]),ue.shooterId!==void 0&&ue.currentRollerId===void 0&&(ue.currentRollerId=ue.shooterId),ue.nextShooterId!==void 0&&ue.nextRollerId===void 0&&(ue.nextRollerId=ue.nextShooterId),ue),Oe=ue=>{r.current.onCrapsRollResult?.(ve(ue))},he=ue=>{r.current.onCrapsReadyUpdate?.(ue)},Ce=ue=>{r.current.onCrapsBetsUpdate?.(ue)},st=ue=>{r.current.onCrapsBetDelta?.(ue)},Ne=ue=>{r.current.onCrapsBetResults?.(ue)},St=ue=>{r.current.onCrapsBetError?.(ue)},at=ue=>{r.current.onCrapsPointSet?.(ue)},Ke=ue=>{r.current.onCrapsPointMade?.(ue)},it=()=>{e.on(qe.LOBBY_ROOMS,n),e.on(qe.ROOM_CREATED,a);try{e.on(qe.POKER_ROOM_CREATED,a)}catch{}e.on(qe.ROOM_UPDATED,i);try{e.on(qe.POKER_ROOM_UPDATED,i)}catch{}e.on(qe.ROOM_DELETED,o);try{e.on(qe.POKER_ROOM_DELETED,o)}catch{}e.on(qe.JOINED_ROOM,c);try{e.on(qe.POKER_JOINED_ROOM,c)}catch{}e.on(qe.REJOINED_ROOM,u),e.on(qe.OTHER_JOINED,d),e.on(qe.POKER_OTHER_JOINED,d),e.on(qe.OTHER_LEFT,f),e.on(qe.BANKER_CHANGED,h),e.on(qe.DICE_ROLLED,m),e.on(qe.NOT_YOUR_TURN,_),e.on(qe.OTA_UPDATE_AVAILABLE,w),e.on(qe.BETS_UPDATED,b),e.on(qe.GET_WAGERS,E),e.on(qe.PLAYER_BALANCE_UPDATED,T),e.on(qe.SIDE_BET_CREATED,D),e.on(qe.SIDE_BET_ACCEPTED,P),e.on(qe.SIDE_BET_CANCELED,A),e.on(qe.FORCE_LOGOUT,C),e.on(qe.ERROR,O),e.on(qe.RTC_SIGNAL,I),e.on(qe.RTC_PEER_JOINED,x),e.on(qe.RTC_PEER_LEFT,R),e.on(qe.RTC_CAMERA_OWNER_CHANGED,N),e.on(qe.RTC_VIDEO_ENABLED,L),e.on(qe.ROOM_MESSAGE,j),e.on(qe.ROOM_HISTORY,q),e.on(qe.DM_MESSAGE,U),e.on(qe.DM_HISTORY,Y),e.on(qe.FAIRNESS_REVEAL,F),e.on(qe.FRIEND_REQUEST_RECEIVED,X),e.on(qe.FRIEND_REQUEST_CANCELLED,J),e.on(qe.FRIEND_REQUEST_RESPONDED,ee),e.on(qe.UNFRIENDED,H),e.on(qe.USER_BLOCKED,B),e.on(qe.USER_UNBLOCKED,K),e.on(qe.GAME_INVITE_RECEIVED,ae),e.on(qe.TURN_ORDER_UPDATED,te),e.on(qe.SPECTATORS_UPDATED,pe),e.on(qe.PLAYER_PROFILE_UPDATED,ce),e.on(qe.PLAYER_PRESENCE_UPDATE,Re),e.on(qe.CRAPS_ROLL,Oe),e.on(qe.CRAPS_READY_UPDATE,he),e.on(qe.CRAPS_BETS_UPDATE,Ce),e.on(qe.CRAPS_BET_DELTA,st),e.on(qe.CRAPS_BET_RESULTS,Ne),e.on(qe.CRAPS_BET_ERROR,St),e.on(qe.CRAPS_POINT_SET,at),e.on(qe.CRAPS_POINT_MADE,Ke),e.on(qe.POKER_MY_HOLE,He),e.on(qe.POKER_WINNERS,ie),e.on(qe.POKER_REVEAL_ALL,xe),e.on(qe.POKER_TIMED_OUT,re),e.on(qe.ROOM_UPDATE_STATE,G);const ue=Be=>r.current.onCrapsState?.(Be);return e.on(qe.CRAPS_STATE,ue),()=>{e.off(qe.LOBBY_ROOMS,n),e.off(qe.ROOM_CREATED,a);try{e.off(qe.POKER_ROOM_CREATED,a)}catch{}e.off(qe.ROOM_UPDATED,i);try{e.off(qe.POKER_ROOM_UPDATED,i)}catch{}e.off(qe.ROOM_DELETED,o);try{e.off(qe.POKER_ROOM_DELETED,o)}catch{}e.off(qe.JOINED_ROOM,c);try{e.off(qe.POKER_JOINED_ROOM,c)}catch{}e.off(qe.REJOINED_ROOM,u),e.off(qe.OTHER_JOINED,d);try{e.off(qe.POKER_OTHER_JOINED,d)}catch{}e.off(qe.OTHER_LEFT,f),e.off(qe.BANKER_CHANGED,h),e.off(qe.DICE_ROLLED,m),e.off(qe.NOT_YOUR_TURN,_),e.off(qe.OTA_UPDATE_AVAILABLE,w),e.off(qe.BETS_UPDATED,b),e.off(qe.GET_WAGERS,E),e.off(qe.PLAYER_BALANCE_UPDATED,T),e.off(qe.SIDE_BET_CREATED,D),e.off(qe.SIDE_BET_ACCEPTED,P),e.off(qe.SIDE_BET_CANCELED,A),e.off(qe.FORCE_LOGOUT,C),e.off(qe.ERROR,O),e.off(qe.RTC_SIGNAL,I),e.off(qe.RTC_PEER_JOINED,x),e.off(qe.RTC_PEER_LEFT,R),e.off(qe.RTC_CAMERA_OWNER_CHANGED,N),e.off(qe.RTC_VIDEO_ENABLED,L),e.off(qe.ROOM_MESSAGE,j),e.off(qe.ROOM_HISTORY,q),e.off(qe.DM_MESSAGE,U),e.off(qe.DM_HISTORY,Y),e.off(qe.FAIRNESS_REVEAL,F),e.off(qe.FRIEND_REQUEST_RECEIVED,X),e.off(qe.FRIEND_REQUEST_CANCELLED,J),e.off(qe.FRIEND_REQUEST_RESPONDED,ee),e.off(qe.UNFRIENDED,H),e.off(qe.USER_BLOCKED,B),e.off(qe.USER_UNBLOCKED,K),e.off(qe.GAME_INVITE_RECEIVED,ae),e.off(qe.TURN_ORDER_UPDATED,te),e.off(qe.SPECTATORS_UPDATED,pe),e.off(qe.PLAYER_PROFILE_UPDATED,ce),e.off(qe.PLAYER_PRESENCE_UPDATE,Re),e.off(qe.CRAPS_ROLL,Oe),e.off(qe.CRAPS_READY_UPDATE,he),e.off(qe.CRAPS_BETS_UPDATE,Ce),e.off(qe.CRAPS_BET_DELTA,st),e.off(qe.CRAPS_BET_RESULTS,Ne),e.off(qe.CRAPS_BET_ERROR,St),e.off(qe.CRAPS_POINT_SET,at),e.off(qe.CRAPS_POINT_MADE,Ke),e.off(qe.POKER_MY_HOLE,He),e.off(qe.POKER_WINNERS,ie),e.off(qe.POKER_REVEAL_ALL,xe),e.off(qe.POKER_TIMED_OUT,re),e.off(qe.ROOM_UPDATE_STATE,G),e.off(qe.CRAPS_STATE)}};let mt=it();const Je=()=>{try{mt&&mt()}catch{}mt=it()};return e.on("connect",Je),e.on("reconnect",Je),()=>{e.off("connect",Je),e.off("reconnect",Je);try{mt&&mt()}catch{}}},[e])}function cB(){const{getRoomsList:t,createRoom:e,lobbyJoin:r,lobbyLeave:n}=ga(),[a,i]=v.useState({public:[],private:[]}),[o,c]=v.useState(!0),[u,d]=v.useState(null),{setMembershipModalOpen:f}=Bb(),{resetSpin:h}=Zo(),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,R=I.data||I.roomsList||{},N=R.public&&R.private?{public:R.public,private:R.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]),D=globalThis.__createRoomGuard||(globalThis.__createRoomGuard={}),P=800,A=v.useCallback(async C=>{const O=Date.now(),I=D.lastAt||0;if(O-I<P&&D.inFlight)try{return await D.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(Y=>setTimeout(Y,q+U))}return e({name:C.name,isPrivate:C.isPrivate,singlePlayer:C.singlePlayer,gameMode:C.gameMode})};c(!0),d(null),D.lastAt=Date.now();const R=x();D.inFlight=R;try{const N=await R;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),D.inFlight=null}},[e,w,f,h]);return v.useEffect(()=>(E(),()=>{T()}),[]),v.useEffect(()=>{w()},[w]),Da({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 XG({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=rn(),{createRoom:E}=cB(),{pokerCreateRoom:T}=ga(),D=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:D,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 lB(t){v.useEffect(()=>{if(!(typeof document>"u")){if(t){try{am(!0)}catch{}try{Ox()}catch{}try{document.body.classList.add("modal-open")}catch{}}else{try{am(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}return()=>{try{am(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}}},[t])}function JG({open:t,onClose:e,gameMode:r}){const[n,a]=v.useState(r||"cee-lo");lB(!!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(XG,{gameMode:n})]})}):null}function kO({rooms:t,title:e}){const r=rn();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 QG({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(kO,{title:"Private Rooms",rooms:a.private}):g.jsx("p",{children:"No private rooms available."}):a.public.length?g.jsx(kO,{title:"Public Rooms",rooms:a.public}):g.jsx("p",{children:"No public rooms available."})]})}):null}function ZG({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 Fo=io("App",{web:()=>zr(()=>import("./web-B5HGKQ36.js"),[],import.meta.url).then(t=>new t.AppWeb)}),eW=Object.freeze(Object.defineProperty({__proto__:null,App:Fo},Symbol.toStringTag,{value:"Module"}));var tW=Object.create,uB=Object.defineProperty,rW=Object.getOwnPropertyDescriptor,nW=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ub=t=>{throw TypeError(t)},dB=(t,e,r)=>e in t?uB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aW=t=>[,,,tW(null)],fB=["class","method","getter","setter","accessor","field","value","get","set"],pB=t=>t!==void 0&&typeof t!="function"?Ub("Function expected"):t,iW=(t,e,r,n,a)=>({kind:fB[t],name:e,metadata:n,addInitializer:i=>r._?Ub("Already initialized"):a.push(pB(i||null))}),sW=(t,e)=>dB(e,nW("metadata"),t[3]),oW=(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},cW=(t,e,r,n,a,i)=>{for(var o,c,u,d,f=e&7,h=!1,m=!1,_=2,w=fB[f+5],b=t[_]||(t[_]=[]),E=(a=a.prototype,rW(a,r)),T=n.length-1;T>=0;T--)u=iW(f,r,c={},t[3],b),u.static=h,u.private=m,d=u.access={has:D=>r in D},d.get=D=>D[r],f>2,o=(0,n[T])(E[w],u),c._=1,pB(o)&&(E[w]=o);return E&&uB(a,r,E),a},wt=(t,e,r)=>dB(t,typeof e!="symbol"?e+"":e,r),hB=(t,e,r)=>e.has(t)||Ub("Cannot "+r),wO=(t,e,r)=>(hB(t,e,"read from private field"),r?r.call(t):e.get(t)),SO=(t,e,r)=>e.has(t)?Ub("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),EO=(t,e,r,n)=>(hB(t,e,"write to private field"),e.set(t,r),r);const lW="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(lW);const Nx=1,Ix=2,mB=4,uW=8,dW=16,fW=1,pW=2,hW=4,mW=8,gW=16,yW=1,vW=2,_W=4,bW=1,kW=2,ai=Symbol(),Dm="http://www.w3.org/2000/svg";function wW(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const SW=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function EW(t){return SW.includes(t)}const TW={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject"};function CW(t){return t=t.toLowerCase(),TW[t]??t}const xW=["touchstart","touchmove"];function PW(t){return xW.includes(t)}const AW=!1;var Fb=Array.isArray,RW=Array.prototype.indexOf,Mx=Array.from,DW=Object.defineProperty,Ul=Object.getOwnPropertyDescriptor,gB=Object.getOwnPropertyDescriptors,OW=Object.prototype,NW=Array.prototype,jx=Object.getPrototypeOf;function yf(t){return typeof t=="function"}const Ar=()=>{};function IW(t){return t()}function N_(t){for(var e=0;e<t.length;e++)t[e]()}const eo=2,yB=4,xg=8,qb=16,so=32,Pg=64,I_=128,yd=256,M_=512,gi=1024,Jl=2048,Ag=4096,qo=8192,Tp=16384,vB=32768,uu=65536,MW=1<<17,jW=1<<19,_B=1<<20,Fl=Symbol("$state"),bB=Symbol("legacy props"),LW=Symbol("");function kB(t){return t===this.v}function wB(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Lx(t){return!wB(t,this.v)}function BW(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function UW(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function FW(t){throw new Error("https://svelte.dev/e/effect_orphan")}function qW(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function zW(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function $W(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function VW(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function HW(){throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function GW(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Cp=!1,WW=!1;function KW(){Cp=!0}function si(t,e){var r={f:0,v:t,reactions:null,equals:kB,rv:0,wv:0};return r}function or(t){return SB(si(t))}function zb(t,e=!1){var r;const n=si(t);return e||(n.equals=Lx),Cp&&Dr!==null&&Dr.l!==null&&((r=Dr.l).s??(r.s=[])).push(n),n}function Us(t,e=!1){return SB(zb(t,e))}function SB(t){return $r!==null&&($r.f&eo)!==0&&(zo===null?sK([t]):zo.push(t)),t}function gt(t,e){return $r!==null&&$x()&&($r.f&(eo|qb))!==0&&(zo===null||!zo.includes(t))&&GW(),_T(t,e)}function _T(t,e){return t.equals(e)||(t.v,t.v=e,t.wv=qB(),EB(t,Jl),$x()&&lr!==null&&(lr.f&gi)!==0&&(lr.f&so)===0&&(La!==null&&La.includes(t)?(oo(lr,Jl),Hb(lr)):ql===null?oK([t]):ql.push(t))),e}function EB(t,e){var r=t.reactions;if(r!==null)for(var n=$x(),a=r.length,i=0;i<a;i++){var o=r[i],c=o.f;(c&Jl)===0&&(!n&&o===lr||(oo(o,e),(c&(gi|yd))!==0&&((c&eo)!==0?EB(o,Ag):Hb(o))))}}let Bx=!1;function Wt(t,e=null,r){if(typeof t!="object"||t===null||Fl in t)return t;const n=jx(t);if(n!==OW&&n!==NW)return t;var a=new Map,i=Fb(t),o=si(0);i&&a.set("length",si(t.length));var c;return new Proxy(t,{defineProperty(u,d,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&$W();var h=a.get(d);return h===void 0?(h=si(f.value),a.set(d,h)):gt(h,Wt(f.value,c)),!0},deleteProperty(u,d){var f=a.get(d);if(f===void 0)d in u&&a.set(d,si(ai));else{if(i&&typeof d=="string"){var h=a.get("length"),m=Number(d);Number.isInteger(m)&&m<h.v&&gt(h,m)}gt(f,ai),TO(o)}return!0},get(u,d,f){var h;if(d===Fl)return t;var m=a.get(d),_=d in u;if(m===void 0&&(!_||(h=Ul(u,d))!=null&&h.writable)&&(m=si(Wt(_?u[d]:ai,c)),a.set(d,m)),m!==void 0){var w=z(m);return w===ai?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=z(h))}else if(f===void 0){var m=a.get(d),_=m?.v;if(m!==void 0&&_!==ai)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return f},has(u,d){var f;if(d===Fl)return!0;var h=a.get(d),m=h!==void 0&&h.v!==ai||Reflect.has(u,d);if(h!==void 0||lr!==null&&(!m||(f=Ul(u,d))!=null&&f.writable)){h===void 0&&(h=si(m?Wt(u[d],c):ai),a.set(d,h));var _=z(h);if(_===ai)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?gt(E,ai):b in u&&(E=si(ai),a.set(b+"",E))}_===void 0?(!w||(m=Ul(u,d))!=null&&m.writable)&&(_=si(void 0),gt(_,Wt(f,c)),a.set(d,_)):(w=_.v!==ai,gt(_,Wt(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 D=a.get("length"),P=Number(d);Number.isInteger(P)&&P>=D.v&&gt(D,P+1)}TO(o)}return!0},ownKeys(u){z(o);var d=Reflect.ownKeys(u).filter(m=>{var _=a.get(m);return _===void 0||_.v!==ai});for(var[f,h]of a)h.v!==ai&&!(f in u)&&d.push(f);return d},setPrototypeOf(){VW()}})}function TO(t,e=1){gt(t,t.v+e)}var CO,TB,CB;function YW(){if(CO===void 0){CO=window;var t=Element.prototype,e=Node.prototype;TB=Ul(e,"firstChild").get,CB=Ul(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 Rg(t=""){return document.createTextNode(t)}function sd(t){return TB.call(t)}function $b(t){return CB.call(t)}function Ue(t,e){return sd(t)}function Zt(t,e){{var r=sd(t);return r instanceof Comment&&r.data===""?$b(r):r}}function Et(t,e=1,r=!1){let n=t;for(;e--;)n=$b(n);return n}function XW(t){t.textContent=""}function $e(t){var e=eo|Jl;lr===null?e|=yd:lr.f|=_B;var r=$r!==null&&($r.f&eo)!==0?$r:null;const n={children:null,ctx:Dr,deps:null,equals:kB,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 Mf(t){const e=$e(t);return e.equals=Lx,e}function xB(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&eo)!==0?Ux(n):_s(n)}}}function JW(t){for(var e=t.parent;e!==null;){if((e.f&eo)===0)return e;e=e.parent}return null}function PB(t){var e,r=lr;yi(JW(t));try{xB(t),e=zB(t)}finally{yi(r)}return e}function AB(t){var e=PB(t),r=(Il||(t.f&yd)!==0)&&t.deps!==null?Ag:gi;oo(t,r),t.equals(e)||(t.v=e,t.wv=qB())}function Ux(t){xB(t),Mm(t,0),oo(t,Tp),t.v=t.children=t.deps=t.ctx=t.reactions=null}function RB(t){lr===null&&$r===null&&FW(),$r!==null&&($r.f&yd)!==0&&UW(),zx&&BW()}function QW(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function xp(t,e,r,n=!0){var a=(t&Pg)!==0,i=lr,o={ctx:Dr,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:t|Jl,first:null,fn:e,last:null,next:null,parent:a?null:i,prev:null,teardown:null,transitions:null,wv:0};if(r){var c=jf;try{xO(!0),Ng(o),o.f|=vB}catch(f){throw _s(o),f}finally{xO(c)}}else e!==null&&Hb(o);var u=r&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&_B)===0;if(!u&&!a&&n&&(i!==null&&QW(o,i),$r!==null&&($r.f&eo)!==0)){var d=$r;(d.children??(d.children=[])).push(o)}return o}function ZW(){return $r===null?!1:!Il}function DB(t){const e=xp(xg,null,!1);return oo(e,gi),e.teardown=t,e}function ip(t){RB();var e=lr!==null&&(lr.f&so)!==0&&Dr!==null&&!Dr.m;if(e){var r=Dr;(r.e??(r.e=[])).push({fn:t,effect:lr,reaction:$r})}else{var n=Vb(t);return n}}function eK(t){return RB(),Dg(t)}function tK(t){const e=xp(Pg,t,!0);return(r={})=>new Promise(n=>{r.outro?od(e,()=>{_s(e),n(void 0)}):(_s(e),n(void 0))})}function Vb(t){return xp(yB,t,!1)}function ko(t,e){var r=Dr,n={effect:null,ran:!1};r.l.r1.push(n),n.effect=Dg(()=>{t(),!n.ran&&(n.ran=!0,gt(r.l.r2,!0),Xo(e))})}function rK(){var t=Dr;Dg(()=>{if(z(t.l.r2)){for(var e of t.l.r1){var r=e.effect;(r.f&gi)!==0&&oo(r,Ag),Pp(r)&&Ng(r),e.ran=!1}t.l.r2.v=!1}})}function Dg(t){return xp(xg,t,!0)}function _t(t){return du(t)}function du(t,e=0){return xp(xg|qb|e,t,!0)}function ms(t,e=!0){return xp(xg|so,t,!0,e)}function OB(t){var e=t.teardown;if(e!==null){const r=zx,n=$r;PO(!0),bs(null);try{e.call(null)}finally{PO(r),bs(n)}}}function NB(t){var e=t.deriveds;if(e!==null){t.deriveds=null;for(var r=0;r<e.length;r+=1)Ux(e[r])}}function IB(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var n=r.next;_s(r,e),r=n}}function nK(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&so)===0&&_s(e),e=r}}function _s(t,e=!0){var r=!1;if((e||(t.f&jW)!==0)&&t.nodes_start!==null){for(var n=t.nodes_start,a=t.nodes_end;n!==null;){var i=n===a?null:$b(n);n.remove(),n=i}r=!0}IB(t,e&&!r),NB(t),Mm(t,0),oo(t,Tp);var o=t.transitions;if(o!==null)for(const u of o)u.stop();OB(t);var c=t.parent;c!==null&&c.first!==null&&MB(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function MB(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 od(t,e){var r=[];Fx(t,r,!0),jB(r,()=>{_s(t),e&&e()})}function jB(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var a of t)a.out(n)}else e()}function Fx(t,e,r){if((t.f&qo)===0){if(t.f^=qo,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&uu)!==0||(n.f&so)!==0;Fx(n,e,i?r:!1),n=a}}}function Om(t){LB(t,!0)}function LB(t,e){if((t.f&qo)!==0){Pp(t)&&Ng(t),t.f^=qo;for(var r=t.first;r!==null;){var n=r.next,a=(r.f&uu)!==0||(r.f&so)!==0;LB(r,a?e:!1),r=n}if(t.transitions!==null)for(const i of t.transitions)(i.is_global||e)&&i.in()}}let j_=!1,bT=[];function BB(){j_=!1;const t=bT.slice();bT=[],N_(t)}function vd(t){j_||(j_=!0,queueMicrotask(BB)),bT.push(t)}function aK(){j_&&BB()}function qx(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}const UB=0,iK=1;let sm=!1,Gv=UB,Nm=!1,Im=null,jf=!1,zx=!1;function xO(t){jf=t}function PO(t){zx=t}let Wu=[],Lf=0,$r=null;function bs(t){$r=t}let lr=null;function yi(t){lr=t}let zo=null;function sK(t){zo=t}let La=null,Ni=0,ql=null;function oK(t){ql=t}let FB=1,kT=0,Il=!1,Dr=null;function AO(t){Dr=t}function qB(){return++FB}function $x(){return!Cp||Dr!==null&&Dr.l===null}function Pp(t){var e,r=t.f;if((r&Jl)!==0)return!0;if((r&Ag)!==0){var n=t.deps,a=(r&yd)!==0;if(n!==null){var i,o,c=(r&M_)!==0,u=a&&lr!==null&&!Il,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^=M_)}for(i=0;i<d;i++)if(o=n[i],Pp(o)&&AB(o),o.wv>t.wv)return!0}(!a||lr!==null&&!Il)&&oo(t,gi)}return!1}function cK(t,e){for(var r=e;r!==null;){if((r.f&I_)!==0)try{r.fn(t);return}catch{r.f^=I_}r=r.parent}throw sm=!1,t}function lK(t){return(t.f&Tp)===0&&(t.parent===null||(t.parent.f&I_)===0)}function Vw(){sm=!1}function Og(t,e,r,n){if(sm){if(r===null&&(sm=!1),lK(e))throw t;return}r!==null&&(sm=!0);{cK(t,e);return}}function zB(t){var e,r=La,n=Ni,a=ql,i=$r,o=Il,c=zo,u=Dr,d=t.f;La=null,Ni=0,ql=null,$r=(d&(so|Pg))===0?t:null,Il=!jf&&(d&yd)!==0,zo=null,Dr=t.ctx,kT++;try{var f=(0,t.fn)(),h=t.deps;if(La!==null){var m;if(Mm(t,Ni),h!==null&&Ni>0)for(h.length=Ni+La.length,m=0;m<La.length;m++)h[Ni+m]=La[m];else t.deps=h=La;if(!Il)for(m=Ni;m<h.length;m++)((e=h[m]).reactions??(e.reactions=[])).push(t)}else h!==null&&Ni<h.length&&(Mm(t,Ni),h.length=Ni);return f}finally{La=r,Ni=n,ql=a,$r=i,Il=o,zo=c,Dr=u}}function uK(t,e){let r=e.reactions;if(r!==null){var n=RW.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&eo)!==0&&(La===null||!La.includes(e))&&(oo(e,Ag),(e.f&(yd|M_))===0&&(e.f^=M_),Mm(e,0))}function Mm(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)uK(t,r[n])}function Ng(t){var e=t.f;if((e&Tp)===0){oo(t,gi);var r=lr,n=Dr;lr=t;try{(e&qb)!==0?nK(t):IB(t),NB(t),OB(t);var a=zB(t);t.teardown=typeof a=="function"?a:null,t.wv=FB;var i=t.deps,o;AW&&WW&&t.f&Jl}catch(c){Og(c,t,r,n||t.ctx)}finally{lr=r}}}function $B(){if(Lf>1e3){Lf=0;try{qW()}catch(t){if(Im!==null)Og(t,Im,null);else throw t}}Lf++}function VB(t){var e=t.length;if(e!==0){$B();var r=jf;jf=!0;try{for(var n=0;n<e;n++){var a=t[n];(a.f&gi)===0&&(a.f^=gi);var i=[];HB(a,i),dK(i)}}finally{jf=r}}}function dK(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];if((n.f&(Tp|qo))===0)try{Pp(n)&&(Ng(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?MB(n):n.fn=null))}catch(a){Og(a,n,null,n.ctx)}}}function fK(){if(Nm=!1,Lf>1001)return;const t=Wu;Wu=[],VB(t),Nm||(Lf=0,Im=null)}function Hb(t){Gv===UB&&(Nm||(Nm=!0,queueMicrotask(fK))),Im=t;for(var e=t;e.parent!==null;){e=e.parent;var r=e.f;if((r&(Pg|so))!==0){if((r&gi)===0)return;e.f^=gi}}Wu.push(e)}function HB(t,e){var r=t.first,n=[];e:for(;r!==null;){var a=r.f,i=(a&so)!==0,o=i&&(a&gi)!==0,c=r.next;if(!o&&(a&qo)===0)if((a&xg)!==0){if(i)r.f^=gi;else try{Pp(r)&&Ng(r)}catch(h){Og(h,r,null,r.ctx)}var u=r.first;if(u!==null){r=u;continue}}else(a&yB)!==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),HB(u,e)}function GB(t){var e=Gv,r=Wu;try{$B();const a=[];Gv=iK,Wu=a,Nm=!1,VB(r);var n=t?.();return aK(),(Wu.length>0||a.length>0)&&GB(),Lf=0,Im=null,n}finally{Gv=e,Wu=r}}async function pK(){await Promise.resolve(),GB()}function z(t){var e,r=t.f,n=(r&eo)!==0;if(n&&(r&Tp)!==0){var a=PB(t);return Ux(t),a}if($r!==null){zo!==null&&zo.includes(t)&&HW();var i=$r.deps;t.rv<kT&&(t.rv=kT,La===null&&i!==null&&i[Ni]===t?Ni++:La===null?La=[t]:La.push(t),ql!==null&&lr!==null&&(lr.f&gi)!==0&&(lr.f&so)===0&&ql.includes(t)&&(oo(lr,Jl),Hb(lr)))}else if(n&&t.deps===null)for(var o=t,c=o.parent,u=o;c!==null;)if((c.f&eo)!==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,Pp(o)&&AB(o)),t.v}function Xo(t){const e=$r;try{return $r=null,t()}finally{$r=e}}const hK=-7169;function oo(t,e){t.f=t.f&hK|e}function ea(t){return WB().get(t)}function ed(t,e){return WB().set(t,e),e}function WB(t){return Dr===null&&qx(),Dr.c??(Dr.c=new Map(mK(Dr)||void 0))}function mK(t){let e=t.p;for(;e!==null;){const r=e.c;if(r!==null)return r;e=e.p}return null}function Xt(t,e=!1,r){Dr={p:Dr,c:null,e:null,m:!1,s:t,x:null,l:null},Cp&&!e&&(Dr.l={s:null,u:null,r1:[],r2:si(!1)})}function Jt(t){const e=Dr;if(e!==null){t!==void 0&&(e.x=t);const o=e.e;if(o!==null){var r=lr,n=$r;e.e=null;try{for(var a=0;a<o.length;a++){var i=o[a];yi(i.effect),bs(i.reaction),Vb(i.fn)}}finally{yi(r),bs(n)}}Dr=e.p,e.m=!0}return t||{}}function Wv(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Fl in t)wT(t);else if(!Array.isArray(t))for(let e in t){const r=t[e];typeof r=="object"&&r&&Fl in r&&wT(r)}}}function wT(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{wT(t[n],e)}catch{}const r=jx(t);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const n=gB(r);for(let a in n){const i=n[a].get;if(i)try{i.call(t)}catch{}}}}}function gK(t,e){if(e){const r=document.body;t.autofocus=!0,vd(()=>{document.activeElement===r&&t.focus()})}}function yK(t){var e=$r,r=lr;bs(null),yi(null);try{return t()}finally{bs(e),yi(r)}}const KB=new Set,ST=new Set;function Vx(t,e,r,n){function a(i){if(n.capture||Hh.call(e,i),!i.cancelBubble)return yK(()=>r.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?vd(()=>{e.addEventListener(t,a,n)}):e.addEventListener(t,a,n),a}function vK(t,e,r,n={}){var a=Vx(e,t,r,n);return()=>{t.removeEventListener(e,a,n)}}function Bo(t,e,r,n,a){var i={capture:n,passive:a},o=Vx(t,e,r,i);(e===document.body||e===window||e===document)&&DB(()=>{e.removeEventListener(t,o,i)})}function Gb(t){for(var e=0;e<t.length;e++)KB.add(t[e]);for(var r of ST)r(t)}function Hh(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){DW(t,"currentTarget",{configurable:!0,get(){return o||n}});var h=$r,m=lr;bs(null),yi(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(Fb(E)){var[T,...D]=E;T.apply(o,[t,...D])}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,bs(h),yi(m)}}}function Hx(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function cd(t,e){var r=lr;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function dt(t,e){var r=(e&bW)!==0,n=(e&kW)!==0,a,i=!t.startsWith("<!>");return()=>{a===void 0&&(a=Hx(i?t:"<!>"+t),r||(a=sd(a)));var o=n?document.importNode(a,!0):a.cloneNode(!0);if(r){var c=sd(o),u=o.lastChild;cd(c,u)}else cd(o,o);return o}}function ec(t,e,r="svg"){var n=!t.startsWith("<!>"),a=`<${r}>${n?t:"<!>"+t}</${r}>`,i;return()=>{if(!i){var o=Hx(a),c=sd(o);i=sd(c)}var u=i.cloneNode(!0);return cd(u,u),u}}function Fr(t=""){{var e=Rg(t+"");return cd(e,e),e}}function Sr(){var t=document.createDocumentFragment(),e=document.createComment(""),r=Rg();return t.append(e,r),cd(e,r),t}function ke(t,e){t!==null&&t.before(e)}let L_=!0;function RO(t){L_=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 ET(t,e){return _K(t,e)}const sf=new Map;function _K(t,{target:e,anchor:r,props:n={},events:a,context:i,intro:o=!0}){YW();var c=new Set,u=h=>{for(var m=0;m<h.length;m++){var _=h[m];if(!c.has(_)){c.add(_);var w=PW(_);e.addEventListener(_,Hh,{passive:w});var b=sf.get(_);b===void 0?(document.addEventListener(_,Hh,{passive:w}),sf.set(_,1)):sf.set(_,b+1)}}};u(Mx(KB)),ST.add(u);var d=void 0,f=tK(()=>{var h=r??e.appendChild(Rg());return ms(()=>{if(i){Xt({});var m=Dr;m.c=i}a&&(n.$$events=a),L_=o,d=t(h,n)||{},L_=!0,i&&Jt()}),()=>{var m;for(var _ of c){e.removeEventListener(_,Hh);var w=sf.get(_);--w===0?(document.removeEventListener(_,Hh),sf.delete(_)):sf.set(_,w)}ST.delete(u),h!==r&&((m=h.parentNode)==null||m.removeChild(h))}});return TT.set(d,f),d}let TT=new WeakMap;function Kv(t,e){const r=TT.get(t);return r?(TT.delete(t),r(e)):Promise.resolve()}function At(t,e,r=!1){var n=t,a=null,i=null,o=ai,c=r?uu:0,u=!1;const d=(h,m=!0)=>{u=!0,f(m,h)},f=(h,m)=>{o!==(o=h)&&(o?(a?Om(a):m&&(a=ms(()=>m(n))),i&&od(i,()=>{i=null})):(i?Om(i):m&&(i=ms(()=>m(n))),a&&od(a,()=>{a=null})))};du(()=>{u=!1,e(d),u||f(null,null)},c)}function sp(t,e){return e}function bK(t,e,r,n){for(var a=[],i=e.length,o=0;o<i;o++)Fx(e[o].e,a,!0);var c=i>0&&a.length===0&&r!==null;if(c){var u=r.parentNode;XW(u),u.append(r),n.clear(),Pl(t,e[0].prev,e[i-1].next)}jB(a,()=>{for(var d=0;d<i;d++){var f=e[d];c||(n.delete(f.k),Pl(t,f.prev,f.next)),_s(f.e,!c)}})}function op(t,e,r,n,a,i=null){var o=t,c={flags:e,items:new Map,first:null},u=(e&mB)!==0;if(u){var d=t;o=d.appendChild(Rg())}var f=null,h=!1;du(()=>{var m=r(),_=Fb(m)?m:m==null?[]:Mx(m),w=_.length;if(!(h&&w===0)){h=w===0;{var b=$r;kK(_,c,o,a,e,(b.f&qo)!==0,n)}i!==null&&(w===0?f?Om(f):f=ms(()=>i(o)):f!==null&&od(f,()=>{f=null})),r()}})}function kK(t,e,r,n,a,i,o,c){var u,d,f,h,m=(a&uW)!==0,_=(a&(Nx|Ix))!==0,w=t.length,b=e.items,E=e.first,T=E,D,P=null,A,C=[],O=[],I,x,R,N;if(m)for(N=0;N<w;N+=1)I=t[N],x=o(I,N),R=b.get(x),R!==void 0&&((u=R.a)==null||u.measure(),(A??(A=new Set)).add(R));for(N=0;N<w;N+=1){if(I=t[N],x=o(I,N),R=b.get(x),R===void 0){var L=T?T.e.nodes_start:r;P=SK(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(_&&wK(R,I,N,a),(R.e.f&qo)!==0&&(Om(R.e),m&&((d=R.a)==null||d.unfix(),(A??(A=new Set)).delete(R))),R!==T){if(D!==void 0&&D.has(R)){if(C.length<O.length){var j=O[0],q;P=j.prev;var U=C[0],Y=C[C.length-1];for(q=0;q<C.length;q+=1)DO(C[q],j,r);for(q=0;q<O.length;q+=1)D.delete(O[q]);Pl(e,U.prev,Y.next),Pl(e,P,U),Pl(e,Y,j),T=j,P=Y,N-=1,C=[],O=[]}else D.delete(R),DO(R,T,r),Pl(e,R.prev,R.next),Pl(e,R,P===null?e.first:P.next),Pl(e,P,R),P=R;continue}for(C=[],O=[];T!==null&&T.k!==x;)(i||(T.e.f&qo)===0)&&(D??(D=new Set)).add(T),O.push(T),T=T.next;if(T===null)continue;R=T}C.push(R),P=R,T=R.next}if(T!==null||D!==void 0){for(var F=D===void 0?[]:Mx(D);T!==null;)(i||(T.e.f&qo)===0)&&F.push(T),T=T.next;var X=F.length;if(X>0){var J=(a&mB)!==0&&w===0?r:null;if(m){for(N=0;N<X;N+=1)(f=F[N].a)==null||f.measure();for(N=0;N<X;N+=1)(h=F[N].a)==null||h.fix()}bK(e,F,J,b)}}m&&vd(()=>{var ee;if(A!==void 0)for(R of A)(ee=R.a)==null||ee.apply()}),lr.first=e.first&&e.first.e,lr.last=P&&P.e}function wK(t,e,r,n){(n&Nx)!==0&&_T(t.v,e),(n&Ix)!==0?_T(t.i,r):t.i=r}function SK(t,e,r,n,a,i,o,c,u,d){var f=(u&Nx)!==0,h=(u&dW)===0,m=f?h?zb(a):si(a):a,_=(u&Ix)===0?o:si(o),w={i:_,v:m,k:i,a:null,e:null,prev:r,next:n};try{return w.e=ms(()=>c(t,m,_),Bx),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 DO(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=$b(i);a.before(i),i=o}}function Pl(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 fu(t,e,r,n,a){var i=t,o="",c;du(()=>{o!==(o=e()??"")&&(c!==void 0&&(_s(c),c=void 0),o!==""&&(c=ms(()=>{var u=o+"",d=Hx(u);cd(sd(d),d.lastChild),i.before(d)})))})}function jn(t,e,...r){var n=t,a=Ar,i;du(()=>{a!==(a=e())&&(i&&(_s(i),i=null),i=ms(()=>a(n,...r)))},uu)}function EK(t,e,r){var n=t,a,i;du(()=>{a!==(a=e())&&(i&&(od(i),i=null),a&&(i=ms(()=>r(n,a))))},uu)}function B_(t,e,r,n,a,i){var o,c,u=null,d=t,f;du(()=>{const h=e()||null;var m=h==="svg"?Dm:null;h!==o&&(f&&(h===null?od(f,()=>{f=null,c=null}):h===c?Om(f):(_s(f),RO(!1))),h&&h!==c&&(f=ms(()=>{if(u=m?document.createElementNS(m,h):document.createElement(h),cd(u,u),n){var _=u.appendChild(Rg());n(u,_)}lr.nodes_end=u,d.before(u)})),o=h,o&&(c=o),RO(!0))},uu)}function Vt(t,e){vd(()=>{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 YB(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=YB(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function TK(){for(var t,e,r=0,n="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=YB(t))&&(n&&(n+=" "),n+=e);return n}function XB(t){return typeof t=="object"?TK(t):t??""}function CK(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[LW]=r),r==null?t.removeAttribute(e):typeof r!="string"&&JB(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function U_(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=XB(r.class)),n!==void 0&&(r.class=r.class?r.class+" "+n:n);var f=JB(t),h=t.__attributes??(t.__attributes={});for(const T in r){let D=r[T];if(u&&T==="value"&&D==null){t.value=t.__value="",c[T]=D;continue}var m=c[T];if(D!==m){c[T]=D;var _=T[0]+T[1];if(_!=="$$"){if(_==="on"){const P={},A="$$"+T;let C=T.slice(2);var w=EW(C);if(wW(C)&&(C=C.slice(0,-7),P.capture=!0),!w&&m){if(D!=null)continue;t.removeEventListener(C,c[A],P),c[A]=null}if(D!=null)if(w)t[`__${C}`]=D,Gb([C]);else{let O=function(I){c[T].call(this,I)};c[A]=Vx(C,t,O,P)}else w&&(t[`__${C}`]=void 0)}else if(T==="style"&&D!=null)t.style.cssText=D+"";else if(T==="autofocus")gK(t,!!D);else if(T==="__value"||T==="value"&&D!=null)t.value=t[T]=t.__value=D;else if(T==="selected"&&u)CK(t,D);else{var b=T;a||(b=CW(b));var E=b==="defaultValue"||b==="defaultChecked";if(D==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 D!="string")?t[b]=D:typeof D!="function"&&Ut(t,b,D)}T==="style"&&"__styles"in t&&(t.__styles={})}}}return c}var OO=new Map;function JB(t){var e=OO.get(t.nodeName);if(e)return e;OO.set(t.nodeName,e=[]);for(var r,n=t,a=Element.prototype;a!==n;){r=gB(n);for(var i in r)r[i].set&&e.push(i);n=jx(n)}return e}function xK(t,e,r){var n=t.__className,a=QB(e,r);(n!==a||Bx)&&(a===""?t.removeAttribute("class"):t.setAttribute("class",a),t.__className=a)}function Ql(t,e,r){var n=t.__className,a=QB(e,r);(n!==a||Bx)&&(e==null&&!r?t.removeAttribute("class"):t.className=a,t.__className=a)}function QB(t,e){return(t??"")+(e?" "+e:"")}function Bc(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 PK=()=>performance.now(),xc={tick:(t=>requestAnimationFrame(t)),now:()=>PK(),tasks:new Set};function ZB(){const t=xc.now();xc.tasks.forEach(e=>{e.c(t)||(xc.tasks.delete(e),e.f())}),xc.tasks.size!==0&&xc.tick(ZB)}function AK(t){let e;return xc.tasks.size===0&&xc.tick(ZB),{promise:new Promise(r=>{xc.tasks.add(e={c:t,f:r})}),abort(){xc.tasks.delete(e)}}}function sv(t,e){t.dispatchEvent(new CustomEvent(e))}function RK(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 NO(t){const e={},r=t.split(";");for(const n of r){const[a,i]=n.split(":");if(!a||i===void 0)break;const o=RK(a.trim());e[o]=i.trim()}return e}const DK=t=>t;function eU(t,e,r,n){var a=(t&yW)!==0,i=(t&vW)!==0,o=a&&i,c=(t&_W)!==0,u=o?"both":a?"in":"out",d,f=e.inert,h,m;function _(){var D=$r,P=lr;bs(null),yi(null);try{return d??(d=r()(e,n?.()??{},{direction:u}))}finally{bs(D),yi(P)}}var w={is_global:c,in(){var D;if(e.inert=f,!a){m?.abort(),(D=m?.reset)==null||D.call(m);return}i||h==null||h.abort(),sv(e,"introstart"),h=CT(e,_(),m,1,()=>{sv(e,"introend"),h?.abort(),h=d=void 0})},out(D){if(!i){D?.(),d=void 0;return}e.inert=!0,sv(e,"outrostart"),m=CT(e,_(),h,0,()=>{sv(e,"outroend"),D?.()})},stop:()=>{h?.abort(),m?.abort()}},b=lr;if((b.transitions??(b.transitions=[])).push(w),a&&L_){var E=c;if(!E){for(var T=b.parent;T&&(T.f&uu)!==0;)for(;(T=T.parent)&&(T.f&qb)===0;);E=!T||(T.f&vB)!==0}E&&Vb(()=>{Xo(()=>w.in())})}}function CT(t,e,r,n,a){var i=n===1;if(yf(e)){var o,c=!1;return vd(()=>{if(!c){var E=e({direction:i?"in":"out"});o=CT(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=DK}=e;var m=[];if(i&&r===void 0&&(f&&f(0,1),d)){var _=NO(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,D=e.duration*Math.abs(T),P=[];if(D>0){if(d)for(var A=Math.ceil(D/16.666666666666668),C=0;C<=A;C+=1){var O=E+T*h(C/A),I=d(O,1-O);P.push(NO(I))}w=()=>{var x=b.currentTime;return E+T*h(x/D)},f&&AK(()=>{if(b.playState!=="running")return!1;var x=w();return f(x,1-x),!0})}b=t.animate(P,{duration:D,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 IO(t,e){return t===e||t?.[Fl]===e}function tU(t={},e,r,n){return Vb(()=>{var a,i;return Dg(()=>{a=i,i=[],Xo(()=>{t!==r(...i)&&(e(t,...i),a&&IO(r(...a),t)&&e(null,...a))})}),()=>{vd(()=>{i&&IO(r(...i),t)&&e(null,...i)})}}),t}function Es(t=!1){const e=Dr,r=e.l.u;if(!r)return;let n=()=>Wv(e.s);if(t){let a=0,i={};const o=$e(()=>{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=()=>z(o)}r.b.length&&eK(()=>{MO(e,n),N_(r.b)}),ip(()=>{const a=Xo(()=>r.m.map(IW));return()=>{for(const i of a)typeof i=="function"&&i()}}),r.a.length&&ip(()=>{MO(e,n),N_(r.a)})}function MO(t,e){if(t.l.s)for(const r of t.l.s)z(r);e()}function rU(t,e){var r,n=(r=t.$$events)==null?void 0:r[e.type],a=Fb(n)?n.slice():n==null?[]:[n];for(var i of a)i.call(this,e)}function ks(t){Dr===null&&qx(),Cp&&Dr.l!==null?OK(Dr).m.push(t):ip(()=>{const e=Xo(t);if(typeof e=="function")return e})}function Ig(t){Dr===null&&qx(),ks(()=>()=>Xo(t))}function OK(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}function nU(t,e,r){if(t==null)return e(void 0),r&&r(void 0),Ar;const n=Xo(()=>t.subscribe(e,r));return n.unsubscribe?()=>n.unsubscribe():n}let ov=!1;function ya(t,e,r){const n=r[e]??(r[e]={store:null,source:zb(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=nU(t,i=>{a?n.source.v=i:gt(n.source,i)}),a=!1}return z(n.source)}function NK(t,e){return t.set(e),e}function Oa(){const t={};return DB(()=>{for(var e in t)t[e].unsubscribe()}),t}function IK(t){var e=ov;try{return ov=!1,[t(),ov]}finally{ov=e}}const MK={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 pu(t,e,r){return new Proxy({props:t,exclude:e},MK)}const jK={get(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(yf(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];yf(a)&&(a=a());const i=Ul(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(yf(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n){const a=Ul(n,e);return a&&!a.configurable&&(a.configurable=!0),a}}},has(t,e){if(e===Fl||e===bB)return!1;for(let r of t.props)if(yf(r)&&(r=r()),r!=null&&e in r)return!0;return!1},ownKeys(t){const e=[];for(let r of t.props){yf(r)&&(r=r());for(const n in r)e.includes(n)||e.push(n)}return e}};function qc(...t){return new Proxy({props:t},jK)}function jO(t){for(var e=lr,r=lr;e!==null&&(e.f&(so|Pg))===0;)e=e.parent;try{return yi(e),t()}finally{yi(r)}}function jt(t,e,r,n){var a,i=(r&fW)!==0,o=!Cp||(r&pW)!==0,c=(r&mW)!==0,u=(r&gW)!==0,d=!1,f;c?[f,d]=IK(()=>t[e]):f=t[e];var h=Fl in t||bB in t,m=((a=Ul(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?_=Xo(n):_=n),_);f===void 0&&n!==void 0&&(m&&o&&zW(),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 D=jO(()=>(i?$e:Mf)(()=>t[e]));D.f|=MW,T=()=>{var x=z(D);return x!==void 0&&(_=void 0),x===void 0?_:x}}if((r&hW)===0)return T;if(m){var P=t.$$legacy;return function(x,R){return arguments.length>0?((!o||!R||P||d)&&m(R?T():x),x):T()}}var A=!1,C=!1,O=zb(f),I=jO(()=>$e(()=>{var x=T(),R=z(O);return A?(A=!1,C=!0,R):(C=!1,O.v=x)}));return i||(I.equals=Lx),function(x,R){if(arguments.length>0){const N=R?z(I):o&&c?Wt(x):x;return I.equals(N)||(A=!0,gt(O,N),b&&_!==void 0&&(_=N),Xo(()=>z(I))),x}return z(I)}}function LO(t,e){var r=lr,n=$r,a=Dr;yi(t),bs(t),AO(t.ctx);try{e()}finally{yi(r),bs(n),AO(a)}}function LK(t,e,r){var n=t,a;du(()=>{var i=lr,o=!1;i.fn=c=>{var u=e.onerror;let d=e.failed;if(!u&&!d||o)throw c;var f=()=>{od(a),LO(i,()=>{o=!1,a=ms(()=>r(n)),Vw()})};u?.(c,f),a&&_s(a),d&&vd(()=>{LO(i,()=>{o=!0;try{a=ms(()=>{d(n,()=>c,()=>f)})}catch(h){Og(h,i,null,i.ctx)}Vw(),o=!1})})},a=ms(()=>r(n)),Vw()},uu|I_)}var zn=(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))(zn||{});class om{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 cm?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case Gr.ErrorSettingUpPurchase:return 2;case Gr.ErrorChargingPayment:return 20;case Gr.NetworkError:return 10;case Gr.MissingEmailError:return 4;case Gr.AlreadyPurchasedError:return 6;default:return 0}}}var cm=(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))(cm||{});class wn extends Error{constructor(e,r,n,a){super(r),wt(this,"toString",()=>`PurchasesError(code: ${zn[this.errorCode]}, message: ${this.message})`),this.errorCode=e,this.underlyingErrorMessage=n,this.extra=a}static getForBackendError(e,r){const n=om.getErrorCodeForBackendErrorCode(e);return new wn(n,om.getPublicMessage(n),r,{backendErrorCode:e})}static getForPurchasesFlowError(e){return new wn(om.convertPurchaseFlowErrorCodeToErrorCode(e.errorCode),e.message,e.underlyingErrorMessage)}}class BK extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Gh=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Gh||{}),vf=(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))(vf||{}),Ii=(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))(Ii||{});class rr{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===Ii.Silent)){if(this.logHandler!==null){this.logHandler(r,n);return}switch(r){case Ii.Error:break;case Ii.Warn:break;case Ii.Info:break;case Ii.Debug:break;case Ii.Verbose:break}}}static errorLog(e){this.log(e,Ii.Error)}static warnLog(e){this.log(e,Ii.Warn)}static infoLog(e){this.log(e,Ii.Info)}static debugLog(e){this.log(e,Ii.Debug)}static verboseLog(e){this.log(e,Ii.Verbose)}}wt(rr,"logLevel",Ii.Silent),wt(rr,"logHandler",null);function UK(t){var e;return t.operation.redemption_info?{redeemUrl:((e=t.operation.redemption_info)==null?void 0:e.redeem_url)??null}:null}var Gr=(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))(Gr||{});class ln 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===zn.ProductAlreadyPurchasedError?a=5:e.errorCode===zn.InvalidEmailError?a=4:e.errorCode===zn.NetworkError?a=3:a=ln.fromBackendErrorCode((n=e.extra)==null?void 0:n.backendErrorCode)??r,new ln(a,e.message,e.underlyingErrorMessage,e.errorCode,e.extra)}static fromBackendErrorCode(e){switch(e){case cm.BackendGatewaySetupErrorStripeTaxNotActive:return 6;case cm.BackendGatewaySetupErrorInvalidTaxOriginAddress:return 7;case cm.BackendGatewaySetupErrorMissingRequiredPermission:return 8;default:return null}}}class FK{constructor(e,r,n=10){wt(this,"operationSessionId",null),wt(this,"backend"),wt(this,"eventsTracker"),wt(this,"maxNumberAttempts"),wt(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 wn)throw ln.fromPurchasesError(c,0);{const u="Unknown error starting purchase: "+String(c);throw rr.errorLog(u),new ln(2,u)}}}async checkoutCalculateTax(e,r,n){const a=this.operationSessionId;if(!a)throw new ln(0,"No purchase started");try{return await this.backend.postCheckoutCalculateTax(a,e,r,n)}catch(i){if(i instanceof wn)throw ln.fromPurchasesError(i,0);{const o="Unknown error calculating tax: "+String(i);throw rr.errorLog(o),new ln(2,o)}}}async checkoutComplete(e){const r=this.operationSessionId;if(!r)throw new ln(0,"No purchase started");try{return await this.backend.postCheckoutComplete(r,e)}catch(n){if(n instanceof wn)throw ln.fromPurchasesError(n,0);{const a="Unknown error starting purchase: "+String(n);throw rr.errorLog(a),new ln(2,a)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new ln(0,"No purchase in progress");return new Promise((r,n)=>{const a=(i=1)=>{if(i>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new ln(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 Gh.Started:case Gh.InProgress:setTimeout(()=>a(i+1),this.waitMSBetweenAttempts);break;case Gh.Succeeded:if(this.clearPurchaseInProgress(),!c||!u||!d){n(new ln(2,"Missing required fields in operation response."));return}r({redemptionInfo:UK(o),operationSessionId:e,storeTransactionIdentifier:c,productIdentifier:u,purchaseDate:d});return;case Gh.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(o.operation.error,n)}}).catch(o=>{const c=ln.fromPurchasesError(o,3);n(c)})};a()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new ln(2,"Got an error status but error field is empty."));return}switch(e.code){case vf.SetupIntentCreationFailed:r(new ln(0,"Setup intent creation failed"));return;case vf.PaymentMethodCreationFailed:r(new ln(0,"Payment method creation failed"));return;case vf.PaymentChargeFailed:r(new ln(1,"Payment charge failed"));return;case vf.SetupIntentCompletionFailed:r(new ln(0,"Setup intent completion failed"));return;case vf.AlreadyPurchased:r(new ln(5,"Purchased was already completed"));return;default:r(new ln(2,"Unknown error code received"));return}}}const Fi="rcb-ui-translator",Bf="en",qK={"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"},zK={"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."},$K={"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."},VK={"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}} بتحصيل رسوم منك وفقًا لشروطها حتى تقوم بالإلغاء."},HK={"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."},GK={"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}} 按照其条款向您收费，直到您取消订阅。"},WK={"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}} 根據其條款向您收費，直到您取消為止。"},KK={"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."},YK={"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."},XK={"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."},JK={"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."},QK={"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."},ZK={"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."},eY={"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."},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.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}} να σας χρεώνει σύμφωνα με τους όρους της έως ότου ακυρώσετε."},rY={"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}} לחייב אותך בהתאם לתנאים שלהם עד שתבטל."},nY={"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}} को रद्द करने तक उनकी शर्तों के अनुसार आपसे शुल्क लेने की अनुमति देने के लिए सहमत हैं."},aY={"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."},iY={"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."},sY={"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}}が利用規約に従って課金することを許可することに同意したことになります。"},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":"{{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}}이 약관에 따라 요금을 청구하는 데 동의하는 것입니다."},cY={"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."},lY={"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."},uY={"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."},dY={"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."},fY={"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."},pY={"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}} будет взимать с вас плату в соответствии с их условиями до тех пор, пока вы не отмените подписку."},hY={"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."},mY={"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."},gY={"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}} เรียกเก็บเงินจากคุณตามข้อกำหนดจนกว่าคุณจะยกเลิก"},yY={"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."},vY={"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}} стягувати з вас плату відповідно до їхніх умов, поки ви не скасуєте підписку."},_Y={"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 It=(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))(It||{});const bY={en:qK,es:zK,it:$K,ar:VK,ca:HK,zh_Hans:GK,zh_Hant:WK,hr:KK,cs:YK,da:XK,nl:JK,fi:QK,fr:ZK,de:eY,el:tY,he:rY,hi:nY,hu:aY,id:iY,ja:sY,ko:oY,ms:cY,no:lY,pl:uY,pt:dY,ro:fY,ru:pY,sk:hY,sv:mY,th:gY,tr:yY,uk:vY,vi:_Y};var xa=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(xa||{});function aU(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return rr.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 rr.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}function xT(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 kY=t=>t/1e6,zl=(t,e,r,n={})=>{const a=kY(t),i={style:"currency",currency:e,currencyDisplay:"symbol",...n,minimumFractionDigits:n.maximumFractionDigits};return new Intl.NumberFormat(r,i).format(a).replace("US$","$")},wY=(t,e)=>{const r=aU(t);return r?e.translatePeriod(r.number,r.unit)||`${r.number} ${r.unit}s`:t},SY=t=>{try{return t.charAt(0).toUpperCase()+t.slice(1)}catch{return t}},Sf={noWhitespace:!1,short:!1},iU={useMultipleWords:!1};class Wb{constructor(e={},r=Bf,n=Bf){wt(this,"locales",{}),this.selectedLocale=r,this.defaultLocale=n;const a={};Object.entries(bY).forEach(([i,o])=>{a[i]=new BO(o,i)}),this.locales=a,e&&this.override(e)}static fallback(){return new Wb}override(e){Object.entries(e).forEach(([r,n])=>{this.locales[r]=new BO({...this.locales[r].labels||{},...n},this.getLanguageCodeString(r))})}formatPrice(e,r){const n={currencyDisplay:"narrowSymbol"};e===0&&(n.maximumFractionDigits=0);try{return zl(e,r,this.locale,n)}catch{rr.errorLog(`Failed to create a price formatter for locale: ${this.locale}`)}try{return zl(e,r,this.fallbackLocale,n)}catch{rr.errorLog(`Failed to create a price formatter for locale: ${this.fallbackLocale}`)}return zl(e,r,Bf,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=Sf){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=Sf){const n=this.getLocaleInstance(this.selectedLocale),a=this.getLocaleInstance(this.defaultLocale);return n?.translatePeriodUnit(e,r)||a?.translatePeriodUnit(e,r)}translatePeriodFrequency(e,r,n=iU){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 BO{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=Sf){var a;const{noWhitespace:i,short:o}={...Sf,...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=Sf){var n;const{noWhitespace:a,short:i}={...Sf,...r},o=`periods.${e}${i?"Short":""}`;return(n=this.translate(o,{amount:""}))==null?void 0:n.replace(" ",a?"":" ")}translatePeriodFrequency(e,r,n=iU){const a=n?.useMultipleWords,i=Math.abs(e)===1?`periods.${a===!0?"per":""}${a?SY(r.toString()):r}Frequency`:`periods.${r}FrequencyPlural`;return this.translate(i,{amount:e.toString()})}translateDate(e,r={}){return e.toLocaleDateString(this.localeKey,r)}}KW();const EY=`<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 TY=dt('<div style="color:var(--rc-color-primary);"><!></div>');function sU(t){var e=TY(),r=Ue(e);fu(r,()=>EY),ke(t,e)}var CY=dt("<button><!></button>");const xY={hash:"svelte-1wpam0z",code:"button.svelte-1wpam0z {border:none;cursor:pointer;background:transparent;width:fit-content;}"};function oU(t,e){Xt(e,!0),Vt(t,xY);var r=CY();r.__click=function(...a){var i;(i=e.onclick)==null||i.apply(this,a)};var n=Ue(r);jn(n,()=>e.children??Ar),_t(()=>{Ql(r,XB(e.class),"svelte-1wpam0z"),r.disabled=!e.onclick,Ut(r,"style",e.style)}),ke(t,r),Jt()}Gb(["click"]);const to="light",PT="#000000",PY="#FFFFFF";var AT;(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"})(AT||(AT={}));var F_;(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"})(F_||(F_={}));var q_;(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"})(q_||(q_={}));var z_;(function(t){t.leading="start",t.center="center",t.trailing="end"})(z_||(z_={}));var RT;(function(t){t.vertical="column",t.horizontal="row",t.zlayer="zstack"})(RT||(RT={}));var DT;(function(t){t.top="flex-start",t.leading="flex-start",t.center="center",t.bottom="flex-end",t.trailing="flex-end"})(DT||(DT={}));var OT;(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"})(OT||(OT={}));function UO(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 AY(t){return AT[t]}function $l({colorMap:t,colorMode:e=to,fallback:r="FFFFFF"}){if(!t)return r;const n=t[e]||t[to];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 cU(t,e=to){if(!t)return"";const r=$l({colorMap:t.color,colorMode:e});return`${t.width}px solid ${r}`}function $_(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 Kb({background_color:t,border:e,margin:r,padding:n,color:a,colorMode:i=to,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,UO(n,"padding")),r&&Object.assign(u,UO(r,"margin")),t&&(u["--background"]=$l({colorMap:t,colorMode:i,fallback:"transparent"})),a&&(u["--text-color"]=$l({colorMap:a,colorMode:i,fallback:PT})),e&&(u["--border"]=cU(e,i)),o?.type==="rectangle"&&o.corners&&Object.assign(u,$_(o.corners)),o?.type==="pill"&&Object.assign(u,$_({bottom_leading:9999,bottom_trailing:9999,top_leading:9999,top_trailing:9999})),c&&(u["--shadow"]=`${c.x}px ${c.y}px ${c.radius}px 
      ${$l({colorMap:c.color,colorMode:i,fallback:PT})}`),u}function FO(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 Mg(t){const e={"--width":"initial","--height":"initial","--flex":"initial"},r=FO(t.width),n=FO(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 lU(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 RY(t){const e={"--direction":"initial","--alignment":"initial","--distribution":"initial","--position":"relative","--inset":"initial","--transform":"initial"};return t.type!=="zlayer"&&(Object.assign(e,{"--direction":RT[t.type],"--alignment":DT[t.alignment]}),t.distribution&&Object.assign(e,{"--distribution":OT[t.distribution]})),e}function DY(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":z_[r]||z_.leading,"--font-weight":F_[n]||F_.regular,"--font-size":q_[e]||q_.body_m,"--font-family":a||"sans-serif"}),i}function qi(t){return Object.entries(t).map(([e,r])=>`${e}: ${r}`).join("; ")}function OY(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 Gx=(t,e)=>e?NY(e).reduce((r,n)=>{var a;if(t){const i=((a=t?.states)==null?void 0:a[n])||{};return{...r,...i}}return r},{}):{},NY=t=>t?Object.entries(t).reduce((e,[r,n])=>(n&&e.push(r),e),[]):[];function Ts(t,e){return t?e?Object.entries(t).reduce((r,[n,a])=>{const i=n.replace(/^--/,`${e}-`);return r[`--${i}`]=a,r},{}):t:{}}function IY(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 MY=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,$_(t.corners)),e};function jY(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?.[to],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 LY({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=Ts(e||{},"button");return qi({...i,position:"var(--button-position, relative)",inset:"var(--button-inset, 0)",transform:"var(--button-transform, initial)",width:a})}const of=[];function uU(t,e){return{subscribe:Wx(t,e).subscribe}}function Wx(t,e=Ar){let r=null;const n=new Set;function a(c){if(wB(t,c)&&(t=c,r)){const u=!of.length;for(const d of n)d[1](),of.push(d,t);if(u){for(let d=0;d<of.length;d+=2)of[d][0](of[d+1]);of.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 dU(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 uU(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)=>nU(w,E=>{d[b]=E,f&=~(1<<b),u&&m()},()=>{f|=1<<b}));return u=!0,m(),function(){N_(_),h(),u=!1}})}function BY(t){gt(t,t.v+1)}function UY(t){let e=0,r=si(0),n;return()=>{ZW()&&(z(r),Dg(()=>(e===0&&(n=Xo(()=>t(()=>BY(r)))),e+=1,()=>{pK().then(()=>{e-=1,e===0&&(n?.(),n=void 0)})})))}}const fU=Symbol("paywall");function FY(t){ed(fU,t)}function Kx(){const t=ea(fU);if(t===void 0)throw new Error("Paywall context not found");return t}const qY={hash:"svelte-mx8s0a",code:""};function zY(t,e){Xt(e,!0),Vt(t,qY);const r=pu(e,["$$slots","$$events","$$legacy","stack","action"]),{onButtonAction:n}=Kx(),a=()=>n(e.action),i=$e(()=>LY({stack:e.stack,action:e.action,...r}));oU(t,{onclick:a,get style(){return z(i)},class:"rc-pw-button",children:(o,c)=>{jg(o,qc(()=>e.stack))},$$slots:{default:!0}}),Jt()}const pU={light:{type:"hex",value:PT}},$Y={light:{type:"hex",value:PY}},Yx=(t,e)=>{const{font_size:r="body_m",color:n=pU,background_color:a=$Y,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=Gx(e.overrides,e.componentState),f=AY(r),h=DY({...e,...d}),m=Kb({background_color:a,color:n,margin:o,padding:i,colorMode:t,...d}),_=Mg({...c,...d}),w={...u,...m,...h,..._};return{textStyles:Ts(w,"text"),tagToRender:f}};function VY(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,Kb({background_color:r,...t}),Mg(e)),Object.assign(n,t.zStackChildStyles);const a=Ts(n,"text");return qi(a)}function HY(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}=Yx(t,e);return Object.assign(r,a),{tagToRender:n,textStyles:qi(r)}}function GY(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 WY={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 hU(t,e){Xt(e,!0),Vt(t,WY);const r=jt(e,"styleVariables",3,""),n=jt(e,"component",3,"p");var a=Sr(),i=Zt(a);B_(i,n,!1,(o,c)=>{let u;_t(()=>u=U_(o,u,{id:e.id,style:r(),class:"rc-pw-text-block"},"svelte-1wz4si8",o.namespaceURI===Dm,o.nodeName.includes("-")));var d=Sr(),f=Zt(d);jn(f,()=>e.children??Ar),ke(c,d)}),ke(t,a),Jt()}var Yv,Xv;class KY{constructor(e,r){SO(this,Yv),SO(this,Xv),EO(this,Yv,e),EO(this,Xv,UY(r))}get current(){return wO(this,Xv).call(this),wO(this,Yv).call(this)}}Yv=new WeakMap,Xv=new WeakMap;const YY=/\(.+\)/;class XY extends KY{constructor(e,r){let n=YY.test(e)?e:`(${e})`;const a=window.matchMedia(n);super(()=>a.matches,i=>vK(a,"change",i))}}const mU=Symbol("color-mode");function JY(t){const e=new XY("prefers-color-scheme: dark",(t?.()??to)==="dark"),r=()=>t?.()??(e.current?"dark":to);return ed(mU,r),r}function Yb(){return ea(mU)??(()=>to)}const gU=Symbol("localization");function QY(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 ed(gU,e),e}function Xx(){const t=ea(gU);if(t===void 0)throw new Error("Localization context not found");return t}const ZY=["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 V_(t="",e){return e===void 0?t:ZY.reduce((r,n)=>{var a;return r.replaceAll(`{{ ${n} }}`,((a=e[n])==null?void 0:a.toString())||"N/A")},t)}const yU=Symbol("variables");function vU(t){ed(yU,t)}function Xb(){const t=ea(yU);if(t===void 0)throw new Error("Variables context not found");return t}var eX=dt('<span class="rc-pw-text-wrapper svelte-11gzifq"><!></span>');const tX={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 rX(t,e){Xt(e,!0),Vt(t,tX);const r=Oa(),n=()=>ya(h,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy","id","text_lid","background_color","size"]),i=Yb(),o=$e(i),c=$e(()=>HY(z(o),{id:e.id,text_lid:e.text_lid,background_color:e.background_color,size:e.size,...a})),u=$e(()=>z(c).tagToRender),d=$e(()=>z(c).textStyles),f=$e(()=>VY(a,e.size,e.background_color)),h=Xb(),{getLocalizedString:m}=Xx(),_=$e(()=>V_(m(e.text_lid),n())),w=$e(()=>GY(z(_)));var b=eX(),E=Ue(b);hU(E,{get styleVariables(){return z(d)},get component(){return z(u)},get id(){return e.id},children:(T,D)=>{var P=Sr(),A=Zt(P);fu(A,()=>z(w)),ke(T,P)},$$slots:{default:!0}}),_t(()=>Ut(b,"style",z(f))),ke(t,b),Jt()}function H_(t,e){Xt(e,!0);const r={stack:jg,text:rX,image:SX,button:zY,purchase_button:LX,package:xX,footer:_U,timeline:HX},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=pu(e,["$$slots","$$events","$$legacy","nodeData","zStackChildStyles"]),i=$e(()=>n(e.nodeData)),o=$e(()=>z(i)[0]),c=$e(()=>z(i)[1]),u=$e(()=>("components"in e.nodeData?e.nodeData.components:void 0)??[]);var d=Sr(),f=Zt(d);return EK(f,()=>z(o),(h,m)=>{m(h,qc(()=>z(c)||{},{get zStackChildStyles(){return e.zStackChildStyles}},()=>a,{children:(_,w)=>{var b=Sr(),E=Zt(b);op(E,17,()=>z(u),sp,(T,D)=>{H_(T,qc({get nodeData(){return z(D)}},()=>a))}),ke(_,b)},$$slots:{default:!0}}))}),ke(t,d),Jt({getComponentClass:n})}const nX=(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=Gx(m,h);Object.assign(w,Kb({background_color:r,margin:n,padding:a,border:c,colorMode:t,shape:u,shadow:d,...b}),RY({...f,...b}),Mg({...o,...b})),Object.assign(w,_);const E=Ts(w,"stack");return qi(E)};function aX(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,lU({alignment:u.alignment}),Kb({...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"]=cv(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"]=cv(u,h)),u.alignment==="bottom"&&(d["--padding-block-start"]=`${h+u.padding.top}px`,d["--transform"]=cv(u,-h))}else d["--transform"]=cv(u),Object.assign(d,iX(e));const f=Ts(d,"stack-badge");return qi(f)}const qO={top_leading:"bottom_trailing",top_trailing:"bottom_leading",bottom_leading:"top_trailing",bottom_trailing:"top_leading"},zO={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 iX(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[zO[qO[c]]]=`${(r=i.shape)==null?void 0:r.corners[qO[c]]}px`,a[zO[c]]=`${((n=t.shape)==null?void 0:n.corners[c])-o}px`,a}function cv(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 sX(t,e){const{badge:r}=e;if(!r)return{tagToRender:"",textStyles:""};const{tagToRender:n,textStyles:a}=Yx(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=qi(i);return{tagToRender:n,textStyles:o}}function oX(t){const{dimension:e}=t,r={"--inset":"initial","--transform":"initial","--position":"relative"};if(e.type!=="zlayer")return;const n=lU({...e});return Object.assign(r,{...n,"--position":"absolute"}),r}var cX=dt('<span class="rc-pw-badge svelte-1b5bst5"><!></span>'),lX=dt('<div class="rc-pw-stack-wrapper svelte-1b5bst5"><!> <div class="rc-pw-stack svelte-1b5bst5"></div></div>');const uX={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 jg(t,e){Xt(e,!0),Vt(t,uX);const r=Oa(),n=()=>ya(f,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy","id","components","badge","zStackChildStyles"]),i=Yb(),o=$e(i),c=$e(()=>nX(z(o),{id:e.id,components:e.components,zStackChildStyles:e.zStackChildStyles,...a})),u=$e(()=>aX(z(o),{id:e.id,components:e.components,badge:e.badge,...a})),d=$e(()=>oX({id:e.id,components:e.components,...a})),f=Xb(),{getLocalizedString:h}=Xx(),m=$e(()=>{var A;return V_(h((A=e.badge)==null?void 0:A.text_lid),n())}),_=$e(()=>sX(z(o),{id:e.id,components:e.components,badge:e.badge,...a})),w=$e(()=>z(_).tagToRender),b=$e(()=>z(_).textStyles);var E=lX(),T=Ue(E);{var D=A=>{var C=cX(),O=Ue(C);hU(O,{get styleVariables(){return z(b)},get component(){return z(w)},children:(I,x)=>{var R=Fr();_t(()=>hr(R,z(m))),ke(I,R)},$$slots:{default:!0}}),_t(()=>Ut(C,"style",z(u))),ke(A,C)};At(T,A=>{e.badge&&A(D)})}var P=Et(T,2);op(P,21,()=>e.components,sp,(A,C,O)=>{var I=Sr(),x=Zt(I);{var R=L=>{var j=$e(()=>O>0?z(d):void 0);H_(L,{get nodeData(){return z(C)},get componentState(){return e.componentState},get zStackChildStyles(){return z(j)}})},N=L=>{H_(L,{get nodeData(){return z(C)},get componentState(){return e.componentState}})};At(x,L=>{z(d)?L(R):L(N,!1)})}ke(A,I)}),_t(()=>{Ut(E,"id",e.id),Ut(E,"style",z(c))}),ke(t,E),Jt()}var dX=dt('<div class="rc-pw-footer svelte-pg5jlz"><!></div>');const fX={hash:"svelte-pg5jlz",code:".rc-pw-footer.svelte-pg5jlz {position:sticky;bottom:0;transform:translateY(50%);width:100%;}"};function _U(t,e){Vt(t,fX);var r=dX(),n=Ue(r);jg(n,qc(()=>e.stack)),_t(()=>Ut(r,"id",e.id)),ke(t,r)}const pX=(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=Gx(n,a);Object.assign(o,i),Object.assign(o,Mg({...r,...c})),Object.assign(o,MY(e.mask_shape));const u=Ts(o,"image"),d=IY(e),f=jY(t,e);return{imageStyles:qi(u),maskPath:d,linearGradientAngle:f}};var hX=ec('<ellipse cx="50" rx="50"></ellipse>'),mX=ec("<path></path>"),gX=ec("<stop></stop>"),yX=ec("<linearGradient></linearGradient>"),vX=ec("<stop></stop>"),_X=ec('<radialGradient cx="50%" cy="50%" r="50%" fx="50%" fy="50%"></radialGradient>'),bX=ec('<linearGradient><stop offset="0%"></stop></linearGradient>'),kX=dt('<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 wX={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 SX(t,e){Xt(e,!0),Vt(t,wX);const r=pu(e,["$$slots","$$events","$$legacy","id","source"]),n=Yb(),a=$e(n);let i=or(0),o;function c(){o&&gt(i,o.naturalHeight/o.naturalWidth)}const u=$e(()=>pX(z(a),{id:e.id,source:e.source,...r,imageAspectRatio:z(i)})),d=$e(()=>z(u).imageStyles),f=$e(()=>z(u).maskPath),h=$e(()=>z(u).linearGradientAngle),m=$e(()=>{var j,q;return(j=e.source[z(a)])!=null&&j.original?e.source[z(a)].original:(q=e.source[to])==null?void 0:q.original}),_=$e(()=>e.color_overlay),w=$e(()=>{var j,q;return((j=z(_))==null?void 0:j[z(a)])??((q=z(_))==null?void 0:q[to])});var b=kX(),E=Zt(b);tU(E,j=>o=j,()=>o);var T=Et(E,2),D=Ue(T),P=Ue(D),A=Ue(P);{var C=j=>{var q=hX();_t(()=>{Ut(q,"cy",z(i)*50),Ut(q,"ry",z(i)*50)}),ke(j,q)},O=j=>{var q=mX();_t(()=>Ut(q,"d",z(f))),ke(j,q)};At(A,j=>{var q;((q=e.mask_shape)==null?void 0:q.type)==="circle"?j(C):j(O,!1)})}var I=Et(P);{var x=j=>{var q=yX();op(q,21,()=>{var U;return((U=z(w))==null?void 0:U.points)||[]},sp,(U,Y)=>{var F=gX();_t(()=>{Ut(F,"offset",`${z(Y).percent}%`),Ut(F,"style",`stop-color: ${z(Y).color}`)}),ke(U,F)}),_t(()=>{Ut(q,"id",`gradient-${e.id}`),Ut(q,"x1",z(h).x1),Ut(q,"y1",z(h).y1),Ut(q,"x2",z(h).x2),Ut(q,"y2",z(h).y2)}),ke(j,q)},R=j=>{var q=Sr(),U=Zt(q);{var Y=X=>{var J=_X();op(J,21,()=>{var ee;return((ee=z(w))==null?void 0:ee.points)||[]},sp,(ee,H)=>{var B=vX();_t(()=>{Ut(B,"offset",`${z(H).percent}%`),Ut(B,"style",`stop-color: ${z(H).color}`)}),ke(ee,B)}),_t(()=>Ut(J,"id",`gradient-${e.id}`)),ke(X,J)},F=X=>{var J=Sr(),ee=Zt(J);{var H=B=>{var K=bX(),ae=Ue(K);_t(()=>{var te;Ut(K,"id",`gradient-${e.id}`),Ut(ae,"style",`stop-color: ${(te=z(w))==null?void 0:te.value}`)}),ke(B,K)};At(ee,B=>{var K;((K=z(w))==null?void 0:K.type)==="hex"&&B(H)},!0)}ke(X,J)};At(U,X=>{var J;((J=z(w))==null?void 0:J.type)==="radial"?X(Y):X(F,!1)},!0)}ke(j,q)};At(I,j=>{var q;((q=z(w))==null?void 0:q.type)==="linear"?j(x):j(R,!1)})}var N=Et(D),L=Et(N);_t(()=>{Ut(E,"src",z(m)),Ut(T,"id",`rc-pw-image-container-${e.id}`),Ut(T,"style",z(d)),Ut(T,"viewBox",`0 0 100 ${z(i)*100}`),Ut(P,"id",`clip-path-${e.id}`),Ut(N,"href",z(m)),Ut(N,"height",z(i)*100),Ut(N,"clip-path",`url(#clip-path-${e.id})`),Ut(N,"id",e.id),Ut(L,"height",z(i)*100),Ut(L,"clip-path",`url(#clip-path-${e.id})`),Ut(L,"fill",`url(#gradient-${e.id})`)}),Bo("load",E,c),ke(t,b),Jt()}const EX=(t,e,r,n)=>NK(r,Wt(n.package_id));var TX=dt('<button class="rc-pw-package svelte-123kamd"><!></button>');const CX={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 xX(t,e){Xt(e,!0),Vt(t,CX);const r=Oa(),n=()=>ya(i,"$selectedPackageId",r),a=()=>ya(o,"$variablesPerPackage",r),{selectedPackageId:i,variablesPerPackage:o}=Kx(),c=Xb(),u=dU(c,_=>{var w;return((w=a())==null?void 0:w[e.package_id])??_});vU(u);const d=$e(()=>({selected:n()===e.package_id})),f=$e(()=>qi(Ts(e.zStackChildStyles,"package")));var h=TX();h.__click=[EX,n,i,e];var m=Ue(h);jg(m,qc(()=>e.stack,{get componentState(){return z(d)}})),_t(()=>{Ut(h,"id",e.id),Ut(h,"style",z(f)),Bc(h,"selected",z(d).selected)}),ke(t,h),Jt()}Gb(["click"]);function PX({background:t,colorMode:e}){const r={"--background":"initial"};t?.type==="color"&&Object.assign(r,{"--background":$l({colorMap:t.value,colorMode:e,fallback:"transparent"})});const n=Ts(r,"paywall");return qi(n)}function AX(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[to])==null?void 0:n.original)}var RX=dt('<div class="rc-pw-paywall-background svelte-14bszwq"></div>'),DX=dt('<div class="rc-pw-paywall-background rc-pw-image-container svelte-14bszwq"><img class="rc-pw-image svelte-14bszwq" alt=""></div>'),OX=dt('<div class="rc-pw-paywall svelte-14bszwq"><!> <!> <!></div>');const NX={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 IX(t,e){Xt(e,!0),Vt(t,NX);const r=Oa(),n=()=>ya(u,"$selectedPackageId",r),a=jt(e,"variablesPerPackage",19,()=>({})),i=JY(()=>e.preferredColorMode),o=$e(i),{getLocalizedString:c}=QY(()=>({defaultLocale:e.paywallData.default_locale,selectedLocale:e.selectedLocale,localizations:e.paywallData.components_localizations})),u=Wx(OY(e.paywallData)),d=()=>{var E;const T=n();T!==void 0&&((E=e.onPurchaseClicked)==null||E.call(e,T))},f=E=>{var T,D,P,A;switch(E.type){case"navigate_back":(T=e.onBackClicked)==null||T.call(e);return;case"restore_purchases":(D=e.onRestorePurchasesClicked)==null||D.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}};FY({selectedPackageId:u,variablesPerPackage:uU(a()),onPurchase:d,onButtonAction:f});const h=dU(u,E=>a()[E||""]);vU(h);const m=$e(()=>{var E;return PX({background:(E=e.paywallData.components_config.base)==null?void 0:E.background,colorMode:z(o)})}),_=$e(()=>AX(e.paywallData,z(o)));var w=Sr(),b=Zt(w);LK(b,{get onerror(){return e.onError}},E=>{var T=OX(),D=Ue(T);H_(D,{get nodeData(){return e.paywallData.components_config.base.stack}});var P=Et(D,2);{var A=x=>{_U(x,qc(()=>e.paywallData.components_config.base.sticky_footer,{get stack(){return e.paywallData.components_config.base.sticky_footer.stack}}))};At(P,x=>{e.paywallData.components_config.base.sticky_footer&&x(A)})}var C=Et(P,2);{var O=x=>{var R=RX();_t(()=>Ut(R,"style",z(m))),ke(x,R)},I=x=>{var R=Sr(),N=Zt(R);{var L=j=>{var q=DX(),U=Ue(q);_t(()=>Ut(U,"src",z(_))),ke(j,q)};At(N,j=>{var q;((q=e.paywallData.components_config.base.background)==null?void 0:q.type)==="image"&&j(L)},!0)}ke(x,R)};At(C,x=>{var R;((R=e.paywallData.components_config.base.background)==null?void 0:R.type)==="color"?x(O):x(I,!1)})}ke(E,T)}),ke(t,w),Jt()}function MX({stack:t,zStackChildStyles:e}){const r=t.size.width.type==="fill"?"100%":"fit-content",n=Ts(e||{},"purchase-button");return qi({...n,position:"var(--purchase-button-position, relative)",inset:"var(--purchase-button-inset, 0)",transform:"var(--purchase-button-transform, initial)",width:r})}const jX={hash:"svelte-1x8zwdp",code:""};function LX(t,e){Xt(e,!0),Vt(t,jX);const r=pu(e,["$$slots","$$events","$$legacy","stack","zStackChildStyles"]),{onPurchase:n}=Kx(),a=$e(()=>MX({stack:e.stack,zStackChildStyles:e.zStackChildStyles,...r}));oU(t,{onclick:n,class:"rc-pw-purchase-button",get style(){return z(a)},children:(i,o)=>{jg(i,qc(()=>e.stack))},$$slots:{default:!0}}),Jt()}function BX(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,Mg(t.size)),Object.assign(e,t.zStackChildStyles);const r=Ts(e,"timeline");return qi(r)}function UX(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":$l({colorMap:e.icon.color,colorMode:t}),"--icon-background-color":$l({colorMap:(r=e.icon_background)==null?void 0:r.color,colorMode:t}),"--icon-border":cU((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":$l({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"?$_((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=Ts(f,"timeline-item");return qi(h)}function $O(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)||pU,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}=Yx(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:qi(Ts(c,"timeline-item")),tagToRender:d}}var FX=dt('<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 qX={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 zX(t,e){Xt(e,!0),Vt(t,qX);const r=Oa(),n=()=>ya(d,"$variables",r),a=pu(e,["$$slots","$$events","$$legacy"]),i=Yb(),o=$e(i),c=$e(()=>UX(z(o),a)),{getLocalizedString:u}=Xx(),d=Xb(),f=$e(()=>V_(u(e.title.text_lid),n())),h=$e(()=>{var I;return V_(u((I=e.description)==null?void 0:I.text_lid),n())}),m=$e(()=>$O(z(o),a,"title")),_=$e(()=>z(m).tagToRender),w=$e(()=>z(m).textStyles),b=$e(()=>$O(z(o),a,"description")),E=$e(()=>z(b).tagToRender),T=$e(()=>z(b).textStyles);var D=FX(),P=Et(Ue(D),2),A=Ue(P);B_(A,()=>z(_),!1,(I,x)=>{let R;_t(()=>R=U_(I,R,{class:"rc-pw-timeline-item-content-title",style:z(w)},"svelte-gjmo4g",I.namespaceURI===Dm,I.nodeName.includes("-")));var N=Fr();_t(()=>hr(N,z(f))),ke(x,N)});var C=Et(A,2);{var O=I=>{var x=Sr(),R=Zt(x);B_(R,()=>z(E),!1,(N,L)=>{let j;_t(()=>j=U_(N,j,{class:"rc-pw-timeline-item-content-description",style:z(T)},"svelte-gjmo4g",N.namespaceURI===Dm,N.nodeName.includes("-")));var q=Fr();_t(()=>hr(q,z(h))),ke(L,q)}),ke(I,x)};At(C,I=>{z(h)&&I(O)})}_t(()=>Ut(D,"style",z(c))),ke(t,D),Jt()}var $X=dt('<div class="rc-pw-timeline-container svelte-12g27vu"></div>');const VX={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 HX(t,e){Xt(e,!0),Vt(t,VX);const r=pu(e,["$$slots","$$events","$$legacy","items"]),n=$e(()=>BX({items:e.items,...r}));var a=Sr(),i=Zt(a);{var o=c=>{var u=$X();op(u,21,()=>e.items,sp,(d,f,h)=>{var m=$e(()=>`${e.id}-${h}`),_=$e(()=>`${e.name}-${h}`);zX(d,qc(()=>z(f),{get id(){return z(m)},get name(){return z(_)},type:"timeline",get text_spacing(){return e.text_spacing},get item_spacing(){return e.item_spacing}}))}),_t(()=>Ut(u,"style",z(n))),ke(c,u)};At(i,c=>{e.items.length&&c(o)})}ke(t,a),Jt()}var GX=dt("<span><!></span>");const WX={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 KX(t,e){Xt(e,!0),Vt(t,WX);const r=jt(e,"size",3,"body-base");var n=GX(),a=Ue(n);jn(a,()=>e.children??Ar),_t(()=>Ql(n,`rcb-typography rcb-typography-${r()??""} svelte-byrjto`)),ke(t,n),Jt()}const YX={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"}},VO="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",wo={regular:"400",medium:"500",semibold:"600"},os={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},So={120:"120%",130:"130%",140:"140%"},Eo={tight:"0.20%",regular:"0"},Yn={heading2xl:{fontSize:os[28],lineHeight:So[120],fontWeight:wo.semibold,letterSpacing:Eo.tight},headingXl:{fontSize:os[24],lineHeight:So[130],fontWeight:wo.semibold,letterSpacing:Eo.regular},headingLg:{fontSize:"20px",lineHeight:So[130],fontWeight:wo.semibold,letterSpacing:Eo.regular},headingMd:{fontSize:"16px",lineHeight:So[140],fontWeight:wo.medium,letterSpacing:Eo.regular},bodyBase:{fontSize:os[16],lineHeight:So[140],fontWeight:wo.regular,letterSpacing:Eo.regular},bodySmall:{fontSize:os[14],lineHeight:So[140],fontWeight:wo.regular,letterSpacing:Eo.regular},labelButton:{fontSize:os[16],lineHeight:So[140],fontWeight:wo.regular,letterSpacing:Eo.tight},labelDefault:{fontSize:os[14],lineHeight:So[140],fontWeight:wo.regular,letterSpacing:Eo.tight},captionDefault:{fontSize:os[12],lineHeight:So[140],fontWeight:wo.regular,letterSpacing:Eo.regular},captionLink:{fontSize:os[12],lineHeight:So[140],fontWeight:wo.regular,letterSpacing:Eo.regular}},To={heading2xl:{...Yn.heading2xl,fontSize:os[36]},headingXl:{...Yn.headingXl,fontSize:os[32]},headingLg:{...Yn.headingLg,fontSize:os[24]},headingMd:{...Yn.headingMd,fontSize:os[18]},bodyBase:{...Yn.bodyBase},bodySmall:{...Yn.bodySmall},labelButton:{...Yn.labelButton},labelDefault:{...Yn.labelDefault},captionDefault:{...Yn.captionDefault},captionLink:{...Yn.captionLink}},XX={heading2xl:{mobile:Yn.heading2xl,desktop:To.heading2xl},headingXl:{desktop:To.headingXl,mobile:Yn.headingXl},headingLg:{desktop:To.headingLg,mobile:Yn.headingLg},headingMd:{desktop:To.headingMd,mobile:Yn.headingMd},bodyBase:{desktop:To.bodyBase,mobile:Yn.bodyBase},bodySmall:{desktop:To.bodySmall,mobile:Yn.bodySmall},labelButton:{desktop:To.labelButton,mobile:Yn.labelButton},labelDefault:{desktop:To.labelDefault,mobile:Yn.labelDefault},captionDefault:{desktop:To.captionDefault,mobile:Yn.captionDefault},captionLink:{desktop:To.captionLink,mobile:Yn.captionLink}},JX={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"},QX={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"},bU={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},ZX={...bU,"input-background":"color_form_bg",background:"color_form_bg"},eJ={...bU,"input-background":"color_product_info_bg",background:"color_product_info_bg"},kU={"input-border-radius":"4px","input-button-border-radius":"8px"},tJ={"input-border-radius":"0px","input-button-border-radius":"0px"},rJ={"input-border-radius":"12px","input-button-border-radius":"9999px"},HO=kU,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,Jx=({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},Qx=.37,nJ=(t,e=Qx)=>{const r=Jx({...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 aJ(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=Jx({...i,luminanceThreshold:Qx})?"#000000":"#FFFFFF";return aJ(a,o,n)}function Hw(t){return t.toString(16).padStart(2,"0").toUpperCase()}const iJ=(t,e,r,n=Qx)=>{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,nJ(i))}if(e!=null&&e.startsWith("#")){const i=jm(e);i!==null&&(a["primary-text"]=Jx({...i,luminanceThreshold:n})?"black":"white")}return a},sJ=t=>({"primary-hover":GO(t,.1),"primary-pressed":GO(t,.15)}),oJ=(t,e)=>t||e,cJ=(t,e,r)=>{const n=Object.entries(t).map(([a,i])=>[a,oJ(r?r[i]:null,e[a])]);return Object.fromEntries(n)},wU=(t,e,r)=>{const n=cJ(t,e,r);return r?{...e,...n,...iJ(n.background,n.primary,e),...sJ(n.primary)}:{...e}},lJ=t=>wU(eJ,QX,t),SU=t=>wU(ZX,JX,t),Zx=t=>{if(!t)return HO;switch(t.shapes){case"rounded":return kU;case"rectangle":return tJ;case"pill":return rJ;default:return HO}},G_=(t="",e)=>e.map(([r,n])=>`--rc-${t}-${r}: ${n}`).join("; "),uJ=t=>{const e=G_("color",Object.entries(lJ(t))),r=G_("shape",Object.entries(Zx(t)));return[e,r].join("; ")},dJ=t=>{const e=G_("color",Object.entries(SU(t))),r=G_("shape",Object.entries(Zx(t)));return[e,r].join("; ")},fJ=(t="",e)=>Object.entries(e).flatMap(([r,{desktop:n,mobile:a}])=>[`--rc-${t}-${r}-desktop: normal normal ${n.fontWeight} ${n.fontSize}/${n.lineHeight} ${VO}`,`--rc-${t}-${r}-mobile: normal normal ${a.fontWeight} ${a.fontSize}/${a.lineHeight} ${VO}`,`--rc-${t}-${r}-desktop-font-size: ${n.fontSize}`,`--rc-${t}-${r}-mobile-font-size: ${a.fontSize}`]).join("; "),pJ=(t="",e)=>Object.entries(e).map(([r,{mobile:n,desktop:a}])=>`--rc-${t}-${r}-mobile: ${n};  --rc-${t}-${r}-desktop: ${a};`).join(" ");let hJ=class{constructor(t){wt(this,"brandingAppearance"),t?this.brandingAppearance=t:this.brandingAppearance=void 0}get shape(){return Zx(this.brandingAppearance)}get formColors(){return SU(this.brandingAppearance)}get formStyleVars(){return dJ(this.brandingAppearance)}get productInfoStyleVars(){return uJ(this.brandingAppearance)}get spacing(){return YX}get textStyles(){return XX}get textStyleVars(){return fJ("text",this.textStyles)}get spacingStyleVars(){return pJ("spacing",this.spacing)}};var mJ=dt('<div class="rcb-processing svelte-2j2b59"></div>');const gJ={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 yJ(t,e){Vt(t,gJ);let r=jt(e,"size",8,"medium");const n={small:{width:"8px",offset:"10px"},medium:{width:"12px",offset:"20px"},large:{width:"16px",offset:"30px"}};var a=mJ();_t(()=>Ut(a,"style",`--shadow-offset: ${n[r()].offset??""}; --width: ${n[r()].width??""};`)),ke(t,a)}var vJ=dt("<button><!></button>");const _J={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 EU(t,e){Xt(e,!0),Vt(t,_J);const r=jt(e,"intent",3,"primary"),n=jt(e,"disabled",3,!1),a=jt(e,"loading",3,!1),i=$e(()=>new hJ(e.brandingAppearance)),o=$e(()=>z(i).textStyleVars),c=$e(()=>z(i).spacingStyleVars),u=$e(()=>z(i).productInfoStyleVars),d=$e(()=>z(i).formStyleVars),f=$e(()=>[e.styleOverrides,z(o),z(c),z(u),z(d)].join("; "));var h=vJ();h.__click=function(...b){var E;(E=e.onclick)==null||E.apply(this,b)};var m=Ue(h);{var _=b=>{yJ(b,{size:"small"})},w=b=>{KX(b,{size:"body-base",children:(E,T)=>{var D=Sr(),P=Zt(D);jn(P,()=>e.children??Ar),ke(E,D)},$$slots:{default:!0}})};At(m,b=>{a()?b(_):b(w,!1)})}_t(()=>{Ql(h,`${`intent-${r()}`??""} svelte-td7xvm`),h.disabled=n(),Ut(h,"data-testid",e.testId),Ut(h,"type",e.type),Ut(h,"style",z(f))}),ke(t,h),Jt()}Gb(["click"]);var bJ=dt('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const kJ={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function wJ(t,e){Xt(e,!1),Vt(t,kJ);let r=jt(e,"children",8);Es();var n=bJ(),a=Ue(n);jn(a,()=>r()??Ar),ke(t,n),Jt()}const SJ={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 EJ(t,e){Xt(e,!1),Vt(t,SJ);let r=jt(e,"as",8,"section"),n=jt(e,"children",8);Es();var a=Sr(),i=Zt(a);B_(i,r,!1,(o,c)=>{U_(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Dm,o.nodeName.includes("-"));var u=Sr(),d=Zt(u);jn(d,()=>n()??Ar),ke(c,u)}),ke(t,a),Jt()}var TJ=dt("<div><!></div>");const CJ={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 TU(t,e){Xt(e,!1),Vt(t,CJ);let r=jt(e,"gap",8,"small"),n=jt(e,"align",8,"start"),a=jt(e,"children",8);Es();var i=TJ(),o=Ue(i);jn(o,()=>a()??Ar),_t(()=>Ql(i,`rcb-column gap-${r()??""} align-${n()??""} svelte-b5dygi`)),ke(t,i),Jt()}var xJ=dt('<div class="rcb-row svelte-1seeuxq"><!></div>');const PJ={hash:"svelte-1seeuxq",code:".rcb-row.svelte-1seeuxq {display:flex;flex-direction:row;justify-content:flex-start;}"};function AJ(t,e){Xt(e,!1),Vt(t,PJ);let r=jt(e,"children",8);Es();var n=xJ(),a=Ue(n);jn(a,()=>r()??Ar),ke(t,n),Jt()}var RJ=dt("<span><!></span>");const DJ={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){Xt(e,!0),Vt(t,DJ);const r=jt(e,"size",3,"body-base"),n=jt(e,"branded",3,!1);var a=RJ(),i=Ue(a);jn(i,()=>e.children??Ar),_t(()=>Ql(a,`rcb-typography rcb-typography-${r()??""} ${(n()?"rcb-typography-branded":"")??""} svelte-orw2sj`)),ke(t,a),Jt()}var OJ=dt("<div><!></div>"),NJ=dt('<span style="display: block;"><!></span>'),IJ=dt("<!> <!>",1),MJ=dt("<!> <!>",1),jJ=dt('<div class="rcb-modal-message svelte-w46z5s" data-type="error"><!></div>');const LJ={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 BJ(t,e){Xt(e,!0),Vt(t,LJ);const r=jt(e,"title",3,null),n=jt(e,"icon",3,null),a=32;let i=or(null),o=or(!1),c;ks(()=>(z(i)&&(c=new ResizeObserver(()=>{var f;gt(o,(((f=z(i))==null?void 0:f.offsetHeight)??0)>a)}),c.observe(z(i))),()=>{c?.disconnect()}));var u=jJ(),d=Ue(u);TU(d,{gap:"medium",align:"start",children:(f,h)=>{var m=MJ(),_=Zt(m);AJ(_,{children:(E,T)=>{var D=IJ(),P=Zt(D);{var A=I=>{var x=OJ(),R=Ue(x);jn(R,n),_t(()=>Ql(x,`rcb-modal-message-icon ${z(o)?"large":"small"} svelte-w46z5s`)),ke(I,x)};At(P,I=>{n()&&I(A)})}var C=Et(P,2);{var O=I=>{var x=NJ(),R=Ue(x);Pr(R,{size:"heading-md",children:(N,L)=>{var j=Fr();_t(()=>hr(j,r())),ke(N,j)},$$slots:{default:!0}}),tU(x,N=>gt(i,N),()=>z(i)),ke(I,x)};At(C,I=>{r()&&I(O)})}ke(E,D)},$$slots:{default:!0}});var w=Et(_,2);{var b=E=>{Pr(E,{size:"body-small",children:(T,D)=>{var P=Sr(),A=Zt(P);jn(A,()=>e.message??Ar),ke(T,P)},$$slots:{default:!0}})};At(w,E=>{e.message&&E(b)})}ke(f,m)},$$slots:{default:!0}}),_t(()=>Ut(u,"data-has-title",!!r())),ke(t,u),Jt()}var UJ=dt('<div class="rcb-modal-message-icon svelte-c8cuu5"><!></div>'),FJ=dt("<!> <!>",1),qJ=dt('<div class="rcb-modal-message svelte-c8cuu5" data-type="success"><!></div>');const zJ={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 $J(t,e){Xt(e,!0),Vt(t,zJ);const r=jt(e,"title",3,null),n=jt(e,"icon",3,null);var a=qJ(),i=Ue(a);TU(i,{gap:"large",align:"center",children:(o,c)=>{var u=FJ(),d=Zt(u);{var f=_=>{var w=UJ(),b=Ue(w);jn(b,n),ke(_,w)};At(d,_=>{n()&&_(f)})}var h=Et(d,2);{var m=_=>{Pr(_,{size:"heading-md",children:(w,b)=>{var E=Fr();_t(()=>hr(E,r())),ke(w,E)},$$slots:{default:!0}})};At(h,_=>{r()&&_(m)})}ke(o,u)},$$slots:{default:!0}}),_t(()=>Ut(a,"data-has-title",!!r())),ke(t,a),Jt()}const eP="rcb-ui-events-tracker",tP="branding";var VJ=dt('<div class="message-layout svelte-qavr33"><div class="message-layout-content svelte-qavr33"><!></div> <div class="message-layout-footer"><!></div></div>');const HJ={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 rP(t,e){Xt(e,!0),Vt(t,HJ);let r=jt(e,"title",3,null),n=jt(e,"closeButtonTitle",3,"Go back to app"),a=jt(e,"icon",3,null),i=jt(e,"message",3,null);const o=ea(tP);function c(){e.onDismiss()}var u=VJ(),d=Ue(u),f=Ue(d);EJ(f,{children:(_,w)=>{var b=Sr(),E=Zt(b);{var T=P=>{$J(P,{get title(){return r()},get icon(){return a()}})},D=P=>{BJ(P,{get title(){return r()},get icon(){return a()},get message(){return i()}})};At(E,P=>{e.type==="success"?P(T):P(D,!1)})}ke(_,b)},$$slots:{default:!0}});var h=Et(d,2),m=Ue(h);wJ(m,{children:(_,w)=>{EU(_,{onclick:c,type:"submit",brandingAppearance:o,children:(b,E)=>{var T=Fr();_t(()=>hr(T,n())),ke(b,T)},$$slots:{default:!0}})},$$slots:{default:!0}}),ke(t,u),Jt()}function ci(t,e){Xt(e,!0);const r=Oa(),n=()=>ya(i,"$translator",r),a=jt(e,"key",3,""),i=ea(Fi),o=$e(()=>a()?n().translate(a()||"",e.variables):void 0);var c=Sr(),u=Zt(c);{var d=h=>{var m=Fr();_t(()=>hr(m,z(o))),ke(h,m)},f=h=>{var m=Sr(),_=Zt(m);jn(_,()=>e.children??Ar),ke(h,m)};At(u,h=>{z(o)?h(d):h(f,!1)})}ke(t,c),Jt()}var GJ=dt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),WJ=dt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),KJ=dt('<div class="footer-caption-container svelte-1hbk6xu"><!> <!> <p class="footer-caption svelte-1hbk6xu"><!></p></div>');const YJ={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 XJ(t,e){Xt(e,!1),Vt(t,YJ);const r=Oa(),n=()=>ya(E,"$translator",r),a=Us(),i=Us(),o=Us(),c=Us(),u=Us(),d=Us(),f=Us(),h=Us(),m=Us(),_=Us();let w=jt(e,"brandingInfo",8,null),b=jt(e,"purchaseOption",8,null);const E=ea(Fi);function T(L){return L!=null&&"base"in L}function D(L){return L!=null&&"basePrice"in L}function P(L){return L?L.trial?It.PaymentEntryPageTrialSubscriptionTermsInfo:It.PaymentEntryPageSubscriptionTermsInfo:It.PaymentEntryPageOtpTermsInfo}ko(()=>Wv(b()),()=>{gt(a,T(b())?b():null)}),ko(()=>Wv(b()),()=>{gt(i,D(b())?b():null)}),ko(()=>z(a),()=>{gt(o,P(z(a)))}),ko(()=>z(a),()=>{var L,j;gt(c,((L=z(a))==null?void 0:L.introPrice)||((j=z(a))==null?void 0:j.base))}),ko(()=>(z(i),z(c)),()=>{var L,j;gt(u,((L=z(i))==null?void 0:L.basePrice)||((j=z(c))==null?void 0:j.price))}),ko(()=>(z(u),n()),()=>{gt(d,z(u)?zl(z(u).amountMicros,z(u).currency,n().locale||n().fallbackLocale):null)}),ko(()=>(z(c),n()),()=>{var L,j,q,U,Y;gt(f,(L=z(c))!=null&&L.period?n().translatePeriodFrequency(((q=(j=z(c))==null?void 0:j.period)==null?void 0:q.number)||1,(Y=(U=z(c))==null?void 0:U.period)==null?void 0:Y.unit,{useMultipleWords:!0}):null)}),ko(()=>(z(a),n(),xT),()=>{var L,j;gt(h,(j=(L=z(a))==null?void 0:L.trial)!=null&&j.period?n().translateDate(xT(new Date,z(a).trial.period,!0),{year:"numeric",month:"long",day:"numeric"}):null)}),ko(()=>(Wv(w()),z(u),n(),z(o),z(d),z(f),z(h)),()=>{var L;gt(m,w()&&z(u)?n().translate(z(o),{appName:(L=w())==null?void 0:L.app_name,price:z(d),perFrequency:z(f),renewalDate:z(h)}):null)}),ko(()=>(z(a),n(),It),()=>{gt(_,z(a)?n().translate(It.PaymentEntryPageSubscriptionInfo):null)}),rK(),Es();var A=KJ(),C=Ue(A);{var O=L=>{var j=GJ(),q=Ue(j);Pr(q,{size:"caption-default",children:(U,Y)=>{var F=Fr();_t(()=>hr(F,z(m))),ke(U,F)},$$slots:{default:!0}}),ke(L,j)};At(C,L=>{z(m)&&L(O)})}var I=Et(C,2);{var x=L=>{var j=WJ(),q=Ue(j);Pr(q,{size:"caption-default",children:(U,Y)=>{var F=Fr();_t(()=>hr(F,z(_))),ke(U,F)},$$slots:{default:!0}}),ke(L,j)};At(I,L=>{z(_)&&L(x)})}var R=Et(I,2),N=Ue(R);Pr(N,{size:"caption-default",children:(L,j)=>{ci(L,{get key(){return It.PaymentEntryPagePaymentStepTitle}})},$$slots:{default:!0}}),ke(t,A),Jt()}var vi=(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))(vi||{}),nP=(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))(nP||{});function JJ({errorCode:t,errorMessage:e}){return{eventName:vi.CheckoutFlowError,properties:{errorCode:t,errorMessage:e}}}function QJ({errorCode:t,errorMessage:e}){return{eventName:vi.CheckoutPaymentFormError,properties:{errorCode:t,errorMessage:e}}}function ZJ({appearance:t,rcPackage:e,purchaseOptionToUse:r,customerEmail:n}){return{eventName:vi.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 eQ({redemptionInfo:t}){return{eventName:vi.CheckoutSessionEnd,properties:{outcome:"finished",withRedemptionInfo:!!t}}}function tQ(){return{eventName:vi.CheckoutSessionEnd,properties:{outcome:"closed"}}}function rQ({errorCode:t,errorMessage:e}){return{eventName:vi.CheckoutSessionEnd,properties:{outcome:"errored",errorCode:t,errorMessage:e}}}function nQ({taxCalculation:t,taxCustomerDetails:e}){const r=t.failed_reason===nP.tax_collection_disabled?"disabled":t.failed_reason?"failed":t.tax_amount_in_micros===0?"not-taxed":"taxed",n=e===null?"auto":"form";return{eventName:vi.CheckoutPaymentTaxCalculation,properties:{outcome:r,ui_element:n,tax_inclusive:t.tax_inclusive,error_code:t.failed_reason??null}}}function aQ({selectedPaymentMethod:t}){return{eventName:vi.CheckoutPaymentFormSubmit,properties:{selectedPaymentMethod:t??null}}}function iQ({errorCode:t,errorMessage:e}){return{eventName:vi.CheckoutPaymentFormGatewayError,properties:{errorCode:t,errorMessage:e}}}const sQ=`<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 oQ=dt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1sxpw7o"><!></div>');const cQ={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 lQ(t){Vt(t,cQ);var e=oQ(),r=Ue(e);fu(r,()=>sQ),ke(t,e)}var uQ=dt('<div class="rcb-modal-loader svelte-102edf4"><!></div>');const dQ={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 CU(t){Vt(t,dQ);var e=uQ(),r=Ue(e);lQ(r),ke(t,e)}function fQ(t,e){var r,n;Xt(e,!0);const a=Oa(),i=()=>ya(o,"$translator",a),o=ea(Fi),c=ea(tP),u=$e(()=>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=$e(()=>d?i().translatePeriod(d.number,d.unit):null);EU(t,{get disabled(){return e.disabled},testId:"PayButton",brandingAppearance:c,children:(h,m)=>{var _=Sr(),w=Zt(_);{var b=T=>{var D=$e(()=>({trialPeriodLabel:z(f)}));ci(T,{get key(){return It.PaymentEntryPageButtonStartTrial},get variables(){return z(D)}})},E=T=>{var D=Sr(),P=Zt(D);{var A=O=>{var I=$e(()=>({formattedPrice:z(u)}));ci(O,{get key(){return It.PaymentEntryPageButtonWithPrice},get variables(){return z(I)}})},C=O=>{ci(O,{get key(){return It.PaymentEntryPageButtonPay}})};At(P,O=>{z(u)?O(A):O(C,!1)},!0)}ke(T,D)};At(w,T=>{var D;(D=e.subscriptionOption)!=null&&D.trial?T(b):T(E,!1)})}ke(h,_)},$$slots:{default:!0}}),Jt()}const pQ={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"},hQ={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"},xU={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},mQ={...xU,"input-background":"color_form_bg",background:"color_form_bg"},gQ={...xU,"input-background":"color_product_info_bg",background:"color_product_info_bg"},PU={"input-border-radius":"4px","input-button-border-radius":"8px"},yQ={"input-border-radius":"0px","input-button-border-radius":"0px"},vQ={"input-border-radius":"12px","input-button-border-radius":"9999px"},WO=PU,W_="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",AU="BrandCustomFont",KO=`${AU}, ${W_}`,Co={regular:"400",medium:"500",semibold:"600"},cs={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},xo={130:"130%",140:"140%"},Po={tight:"0.20%",regular:"0",loose:"0.20%"},Xn={heading2xl:{fontSize:cs[28],lineHeight:xo[130],fontWeight:Co.semibold,letterSpacing:Po.loose},headingXl:{fontSize:cs[24],lineHeight:xo[130],fontWeight:Co.semibold,letterSpacing:Po.loose},headingLg:{fontSize:"20px",lineHeight:xo[130],fontWeight:Co.semibold,letterSpacing:Po.loose},headingMd:{fontSize:"16px",lineHeight:xo[140],fontWeight:Co.medium,letterSpacing:Po.regular},bodyBase:{fontSize:cs[16],lineHeight:xo[140],fontWeight:Co.regular,letterSpacing:Po.regular},bodySmall:{fontSize:cs[14],lineHeight:xo[140],fontWeight:Co.regular,letterSpacing:Po.regular},labelButton:{fontSize:cs[16],lineHeight:xo[140],fontWeight:Co.semibold,letterSpacing:Po.tight},labelDefault:{fontSize:cs[14],lineHeight:xo[140],fontWeight:Co.regular,letterSpacing:Po.tight},captionDefault:{fontSize:cs[12],lineHeight:xo[140],fontWeight:Co.regular,letterSpacing:Po.regular},captionLink:{fontSize:cs[12],lineHeight:xo[140],fontWeight:Co.regular,letterSpacing:Po.regular}},Ao={heading2xl:{...Xn.heading2xl,fontSize:cs[36]},headingXl:{...Xn.headingXl,fontSize:cs[32]},headingLg:{...Xn.headingLg,fontSize:cs[24]},headingMd:{...Xn.headingMd,fontSize:cs[18]},bodyBase:{...Xn.bodyBase},bodySmall:{...Xn.bodySmall},labelButton:{...Xn.labelButton},labelDefault:{...Xn.labelDefault},captionDefault:{...Xn.captionDefault},captionLink:{...Xn.captionLink}},NT={heading2xl:{mobile:Xn.heading2xl,desktop:Ao.heading2xl},headingXl:{desktop:Ao.headingXl,mobile:Xn.headingXl},headingLg:{desktop:Ao.headingLg,mobile:Xn.headingLg},headingMd:{desktop:Ao.headingMd,mobile:Xn.headingMd},bodyBase:{desktop:Ao.bodyBase,mobile:Xn.bodyBase},bodySmall:{desktop:Ao.bodySmall,mobile:Xn.bodySmall},labelButton:{desktop:Ao.labelButton,mobile:Xn.labelButton},labelDefault:{desktop:Ao.labelDefault,mobile:Xn.labelDefault},captionDefault:{desktop:Ao.captionDefault,mobile:Xn.captionDefault},captionLink:{desktop:Ao.captionLink,mobile:Xn.captionLink}},Lm=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,aP=({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},iP=.37,_Q=(t,e=iP)=>{const r=aP({...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 bQ(t,e,r){const n=Lm(t)||{r:0,g:0,b:0},a=Lm(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`#${Gw(i)}${Gw(o)}${Gw(c)}`}function YO(t,e){const r={r:255,g:255,b:255},n=Math.max(0,Math.min(1,e));let a=t,i=Lm(t)||r;(isNaN(i.r)||isNaN(i.g)||isNaN(i.b))&&(i=r,a="#FFFFFF");const o=aP({...i,luminanceThreshold:iP})?"#000000":"#FFFFFF";return bQ(a,o,n)}function Gw(t){return t.toString(16).padStart(2,"0").toUpperCase()}const kQ=(t,e,r,n=iP)=>{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=Lm(t);i!==null&&Object.assign(a,_Q(i))}if(e!=null&&e.startsWith("#")){const i=Lm(e);i!==null&&(a["primary-text"]=aP({...i,luminanceThreshold:n})?"black":"white")}return a},wQ=t=>({"primary-hover":YO(t,.1),"primary-pressed":YO(t,.15)}),SQ=(t,e)=>t||e,EQ=(t,e,r)=>{const n=Object.entries(t).map(([a,i])=>[a,SQ(r?r[i]:null,e[a])]);return Object.fromEntries(n)},RU=(t,e,r)=>{const n=EQ(t,e,r);return r?{...e,...n,...kQ(n.background,n.primary,e),...wQ(n.primary)}:{...e}},TQ=t=>RU(gQ,hQ,t),DU=t=>RU(mQ,pQ,t),sP=t=>{if(!t)return WO;switch(t.shapes){case"rounded":return PU;case"rectangle":return yQ;case"pill":return vQ;default:return WO}},K_=(t="",e)=>e.map(([r,n])=>`--rc-${t}-${r}: ${n}`).join("; "),OU=t=>{const e=K_("color",Object.entries(TQ(t))),r=K_("shape",Object.entries(sP(t)));return[e,r].join("; ")},CQ=t=>{const e=K_("color",Object.entries(DU(t))),r=K_("shape",Object.entries(sP(t)));return[e,r].join("; ")},xQ=(t="",e,r)=>Object.entries(e).flatMap(([n,{desktop:a,mobile:i}])=>{const o=`normal normal ${a.fontWeight} ${a.fontSize}/${a.lineHeight} ${W_}`,c=`normal normal ${i.fontWeight} ${i.fontSize}/${i.lineHeight} ${W_}`,u=`normal normal ${r?.desktop.font_weight} ${r?.desktop.font_size} ${KO}`,d=`normal normal ${r?.mobile.font_weight} ${r?.mobile.font_size} ${KO}`;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("; "),PQ=(t="",e)=>Object.entries(e).map(([r,{mobile:n,desktop:a}])=>`--rc-${t}-${r}-mobile: ${n};  --rc-${t}-${r}-desktop: ${a};`).join(" "),AQ={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 Bm{constructor(e){wt(this,"brandingAppearance"),e?this.brandingAppearance=e:this.brandingAppearance=void 0}get shape(){return sP(this.brandingAppearance)}get formColors(){return DU(this.brandingAppearance)}get formStyleVars(){return CQ(this.brandingAppearance)}get productInfoStyleVars(){return OU(this.brandingAppearance)}get spacing(){return AQ}get textStyles(){return NT}getTextStyleVars(e){return xQ("text",this.textStyles,e)}get spacingStyleVars(){return PQ("spacing",this.spacing)}}var NU="basil",RQ=function(t){return t===3?"v3":t},IU="https://js.stripe.com",DQ="".concat(IU,"/").concat(NU,"/stripe.js"),OQ=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,NQ=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,IQ=function(t){return OQ.test(t)||NQ.test(t)},MQ=function(){for(var t=document.querySelectorAll('script[src^="'.concat(IU,'"]')),e=0;e<t.length;e++){var r=t[e];if(IQ(r.src))return r}return null},XO=function(t){var e="",r=document.createElement("script");r.src="".concat(DQ).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},jQ=function(t,e){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"7.3.1",startTime:e})},Ch=null,lv=null,uv=null,LQ=function(t){return function(e){t(new Error("Failed to load Stripe.js",{cause:e}))}},BQ=function(t,e){return function(){window.Stripe?t(window.Stripe):e(new Error("Stripe.js not available"))}},UQ=function(t){return Ch!==null?Ch:(Ch=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=MQ();if(!(n&&t)){if(!n)n=XO(t);else if(n&&uv!==null&&lv!==null){var a;n.removeEventListener("load",uv),n.removeEventListener("error",lv),(a=n.parentNode)===null||a===void 0||a.removeChild(n),n=XO(t)}}uv=BQ(e,r),lv=LQ(r),n.addEventListener("load",uv),n.addEventListener("error",lv)}catch(i){r(i);return}}),Ch.catch(function(e){return Ch=null,Promise.reject(e)}))},FQ=function(t,e,r){if(t===null)return null;var n=e[0],a=n.match(/^pk_test/),i=RQ(t.version),o=NU,c=t.apply(void 0,e);return jQ(c,r),c},dv,MU=!1,jU=function(){return dv||(dv=UQ(null).catch(function(t){return dv=null,Promise.reject(t)}),dv)};Promise.resolve().then(function(){return jU()}).catch(function(t){});var qQ=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];MU=!0;var n=Date.now();return jU().then(function(a){return FQ(a,e,n)})},IT=(t=>(t[t.ErrorLoadingStripe=0]="ErrorLoadingStripe",t[t.HandledFormError=1]="HandledFormError",t[t.UnhandledFormError=2]="UnhandledFormError",t))(IT||{});class Jv{constructor(e,r,n){this.code=e,this.gatewayErrorCode=r,this.message=n}}const LU=class Qv{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 qQ(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 Bm(a?.appearance),f=d.shape,h=d.formColors,m=d.textStyles,_=NT.bodyBase[c].fontSize||NT.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 Jv(0,e.code,e.message)}static mapError(e){return this.isStripeHandledFormError(e)?new Jv(1,e.code,e.message):new Jv(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===xa.Year?(r.setFullYear(r.getFullYear()+e.number),r):e.unit===xa.Month?(r.setMonth(r.getMonth()+e.number),r):e.unit===xa.Week?(r.setDate(r.getDate()+e.number*7),r):(e.unit===xa.Day&&r.setDate(r.getDate()+e.number),r)}static applePayPeriod(e){return e.unit===xa.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=Qv.microsToMinimumAmountPrice(r.totalAmountInMicros,r.currency),u=n.trial,d=(o=n.trial)==null?void 0:o.period,f=n.base.period,h=u&&d?Qv.nextDateForPeriod(d,new Date):void 0,m=f?Qv.applePayPeriod(f):{};return{applePay:{recurringPaymentRequest:{paymentDescription:e.title,managementURL:i,trialBilling:u?{label:a.translate(It.ApplePayFreeTrial),amount:0}:void 0,regularBilling:{label:e.title,amount:c,recurringPaymentStartDate:h,...m}}}}}};wt(LU,"FORM_VALIDATED_CARD_ERROR_CODES",["card_declined","expired_card","incorrect_cvc","incorrect_number"]);let Ba=LU;var zQ=dt("<div></div>");function $Q(t,e){Xt(e,!0);let r=null;const n="payment-element",a=async o=>{await e.onError(Ba.mapInitializationError(o.error))};ks(()=>{var o;try{r=Ba.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(Ba.mapInitializationError(c))}}),Ig(()=>{r?.destroy(),r=null});var i=zQ();Ut(i,"id",n),ke(t,i),Jt()}var VQ=dt("<div></div>");function HQ(t,e){Xt(e,!0);let r=null;const n="link-authentication-element",a=async o=>{await e.onError(Ba.mapInitializationError(o.error))};ks(()=>{try{r=Ba.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(Ba.mapInitializationError(o))}}),Ig(()=>{r?.destroy(),r=null});var i=VQ();Ut(i,"id",n),ke(t,i),Jt()}var GQ=dt('<div class="text-separator svelte-ch0h61"><hr class="line svelte-ch0h61"> <span class="text svelte-ch0h61"><!></span> <hr class="line svelte-ch0h61"></div>');const WQ={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 KQ(t,e){Vt(t,WQ);let r=jt(e,"text",8);var n=GQ(),a=Et(Ue(n),2),i=Ue(a);Pr(i,{size:"caption-default",children:(o,c)=>{var u=Fr();_t(()=>hr(u,r())),ke(o,u)},$$slots:{default:!0}}),ke(t,n)}var YQ=dt("<div></div> <!>",1);function XQ(t,e){Xt(e,!0);const r=Oa(),n=()=>ya(a,"$translator",r),a=ea(Fi);let i=null,o=or(!1);const c="express-checkout-element",u=async b=>{const E={...e.expressCheckoutOptions?e.expressCheckoutOptions:{}};b.resolve(E)},d=async b=>{await e.onError(Ba.mapInitializationError(b.error))},f=async b=>{var E;e.onSubmit(b.expressPaymentType,((E=b.billingDetails)==null?void 0:E.email)??"")},h=async b=>{gt(o,!b.availablePaymentMethods),e.onReady()};ks(()=>{try{i=Ba.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(Ba.mapInitializationError(b))}}),Ig(()=>{i?.destroy(),i=null});var m=Sr(),_=Zt(m);{var w=b=>{var E=YQ(),T=Zt(E);Ut(T,"id",c);var D=Et(T,2),P=$e(()=>n().translate(It.PaymentEntryPageExpressCheckoutDivider));KQ(D,{get text(){return z(P)}}),ke(b,E)};At(_,b=>{z(o)||b(w)})}ke(t,m),Jt()}var JQ=dt('<div class="rc-elements svelte-6qa1vy"><!> <!> <!></div>');const QQ={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 ZQ(t,e){Xt(e,!0),Vt(t,QQ);const r=Oa(),n=()=>ya(o,"$translator",r);let a=jt(e,"stripe",15,null),i=jt(e,"elements",15,null);const o=ea(Fi),c=Ba.getStripeLocale(n().locale||n().fallbackLocale);let u=or(!1),d=or(Wt(e.skipEmail)),f=or(!1),h=or(void 0),m=or("mobile"),_=or(void 0);function w(){window.matchMedia&&window.matchMedia("(max-width: 767px)").matches?gt(m,"mobile"):gt(m,"desktop"),gt(h,Wt({fontSizeBase:"14px",fontFamily:W_,spacingGridRow:"16px"}))}function b(){clearTimeout(z(_)),gt(_,Wt(setTimeout(()=>{w()},150)))}const E=R=>{e.onError(R),e.onLoadingComplete()},T=async()=>{z(d)||(gt(d,!0),z(d)&&z(u)&&z(f)&&e.onLoadingComplete())},D=async()=>{z(f)||(gt(f,!0),z(d)&&z(u)&&z(f)&&e.onLoadingComplete())},P=async()=>{z(u)||(gt(u,!0),z(d)&&z(u)&&z(f)&&e.onLoadingComplete())},A=async R=>{e.onPaymentInfoChange({complete:R.complete,paymentMethod:R.complete?R.value.type:void 0})},C=async R=>{e.onEmailChange(R.complete,R.value.email)};ks(()=>(window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)})),ks(async()=>{w(),!a()&&(i()||!e.stripeAccountId||!e.publishableApiKey||!e.elementsConfiguration||await Ba.initializeStripe(e.stripeAccountId,e.publishableApiKey,e.elementsConfiguration,e.brandingInfo,c,z(h),z(m)).then(({stripe:R,elements:N})=>{a(R),i(N)}).catch(R=>{e.onError(R)}))}),ip(()=>{e.elementsConfiguration&&i()&&Ba.updateElementsConfiguration(i(),e.elementsConfiguration)});var O=Sr(),I=Zt(O);{var x=R=>{var N=JQ(),L=Ue(N);XQ(L,{get elements(){return i()},onError:E,onReady:D,get onSubmit(){return e.onExpressCheckoutElementSubmit},get expressCheckoutOptions(){return e.expressCheckoutOptions},get billingAddressRequired(){return e.billingAddressRequired}});var j=Et(L,2);{var q=Y=>{HQ(Y,{get elements(){return i()},onReady:T,onChange:C,onError:E})};At(j,Y=>{e.skipEmail||Y(q)})}var U=Et(j,2);$Q(U,{get elements(){return i()},get brandingInfo(){return e.brandingInfo},onReady:P,onChange:A,onError:E}),ke(R,N)};At(I,R=>{i()&&R(x)})}ke(t,O),Jt()}const eZ=`<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 tZ=dt('<div class="rcb-ui-asset-icon svelte-1rk57mx"><!></div>');const rZ={hash:"svelte-1rk57mx",code:".rcb-ui-asset-icon.svelte-1rk57mx {display:inline-block;width:1em;height:1em;}"};function BU(t){Vt(t,rZ);var e=tZ(),r=Ue(e);fu(r,()=>eZ),ke(t,e)}var nZ=dt('<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 aZ={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 iZ(t,e){Vt(t,aZ);var r=nZ(),n=Ue(r),a=Ue(n);BU(a);var i=Et(n,2),o=Ue(i),c=Ue(o);Pr(c,{size:"body-small",children:(f,h)=>{var m=Fr();_t(()=>hr(m,e.title)),ke(f,m)},$$slots:{default:!0}});var u=Et(o,2),d=Ue(u);Pr(d,{size:"body-small",children:(f,h)=>{var m=Fr();_t(()=>hr(m,e.message)),ke(f,m)},$$slots:{default:!0}}),ke(t,r)}function sZ(t,e){Xt(e,!0);const r=Oa(),n=()=>ya(a,"$translator",r),a=ea(Fi);var i=$e(()=>n().translate(It.PriceUpdateTitle)),o=$e(()=>{var c;return n().translate((c=e.subscriptionOption)!=null&&c.trial?It.PriceUpdateTrialMessage:It.PriceUpdateBaseMessage)});iZ(t,{get title(){return z(i)},get message(){return z(o)}}),Jt()}function UU(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 JO extends Error{}var oZ=dt('<div class="rc-loading svelte-dg9m6p"><!></div>'),cZ=dt('<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 lZ={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 uZ(t,e){var r,n,a;Xt(e,!0),Vt(t,lZ);const i=Oa(),o=()=>ya(u,"$translator",i),c=ea(eP),u=ea(Fi),d=(r=e.productDetails.subscriptionOptions)==null?void 0:r[e.purchaseOption.id],f=UU(e.productDetails,e.purchaseOption);let h=or(Wt(((n=e.defaultPriceBreakdown)==null?void 0:n.taxCalculationStatus)??((a=e.brandingInfo)!=null&&a.gateway_tax_collection_enabled?"unavailable":"disabled"))),m=or(null),_=or(null),w=or(Wt(f.amountMicros)),b=or(Wt(f.amountMicros)),E=$e(()=>e.defaultPriceBreakdown??{currency:f.currency,totalAmountInMicros:z(b),totalExcludingTaxInMicros:z(w),taxCalculationStatus:z(h),taxAmountInMicros:z(m),taxBreakdown:z(_)}),T=or(Wt(e.gatewayParams.elements_configuration)),D=or(null),P=or(null),A=or(null),C=or(Wt(e.customerEmail??void 0)),O=or(Wt(!!e.customerEmail)),I=or(!0),x=or(!1),R=or(void 0),N=or(void 0),L=or(void 0),j=or(!1),q=or(null),U=$e(()=>z(I)||z(j)?"loading":z(N)?"error":"form"),Y=or("unavailable"),F=$e(()=>!z(j)&&z(x)&&z(O)&&(z(h)==="disabled"||z(h)==="calculated"||z(h)==="miss-match")),X=$e(()=>d&&e.managementUrl&&z(E)?Ba.buildStripeExpressCheckoutOptionsForSubscription(e.productDetails,z(E),d,o(),e.managementUrl):void 0);ip(()=>{e.onPriceBreakdownUpdated(z(E))}),ks(async()=>{z(h)==="unavailable"&&await J(null).catch(G)}),Ig(()=>{z(q)&&(z(q).abort(),gt(q,null))});async function J(be,lt){await e.purchaseOperationHelper.checkoutCalculateTax(be?.countryCode,be?.postalCode,lt).then(yt=>{const tr=nQ({taxCalculation:yt,taxCustomerDetails:be});c.trackSDKEvent(tr),lt?.throwIfAborted(),yt.failed_reason?!be&&yt.failed_reason===nP.invalid_tax_location?gt(h,"pending"):gt(h,"disabled"):gt(h,"calculated"),gt(m,Wt(yt.tax_amount_in_micros)),gt(w,Wt(yt.total_excluding_tax_in_micros)),gt(b,Wt(yt.total_amount_in_micros)),gt(_,Wt(yt.tax_breakdown)),gt(T,Wt(yt.gateway_params.elements_configuration)),gt(D,Wt(be))})}function ee(){c.trackSDKEvent({eventName:vi.CheckoutPaymentFormImpression}),gt(I,!1)}async function H(be,lt){gt(C,Wt(lt)),gt(O,Wt(be)),await te()}async function B({complete:be,paymentMethod:lt}){gt(R,Wt(lt)),gt(x,Wt(be)),await te()}async function K(be){if(be?.preventDefault(),z(j))return;const lt=aQ({selectedPaymentMethod:z(R)??null});c.trackSDKEvent(lt),gt(j,!0),await pe()?e.onContinue():gt(j,!1)}async function ae(be,lt){gt(R,Wt(be)),gt(C,Wt(e.customerEmail??lt)),await K()}async function te(){z(R)!=="card"||!z(O)||!z(x)||z(j)||z(h)==="disabled"||(z(h)!=="loading"&&(gt(Y,Wt(z(h))),gt(h,"loading")),await ce(async be=>{await Re().then(()=>be.throwIfAborted()).then(()=>He(be)).then(()=>be.throwIfAborted()).catch(lt=>{be.aborted||G(lt)}).finally(()=>{z(h)==="loading"&&!be.aborted&&gt(h,Wt(z(Y)))})}))}async function pe(){return await ce(async be=>{const lt=z(b);let yt;return await Re().then(()=>be.throwIfAborted()).then(()=>He(be)).then(tr=>{yt=tr}).then(()=>be.throwIfAborted()).then(ie(lt)).then(()=>be.throwIfAborted()).then(xe).then(()=>be.throwIfAborted()).then(()=>re(yt)).then(()=>be.throwIfAborted()).then(()=>!0).catch(tr=>(be.aborted||G(tr),!1))})}async function ce(be){z(q)&&z(q).abort(),gt(q,Wt(new AbortController));const lt=z(q).signal;try{return await be(lt)}catch(yt){if(yt instanceof DOMException&&yt.name==="AbortError")return Promise.resolve(void 0);throw yt}}async function Re(){z(A)&&await Ba.submitElements(z(A))}async function He(be){var lt,yt;if(z(h)==="unavailable"||z(h)==="disabled"||!z(A)||!z(P))return;const{customerDetails:tr,confirmationTokenId:Or}=await Ba.extractTaxCustomerDetails(z(A),z(P));return be?.throwIfAborted(),tr.postalCode===((lt=z(D))==null?void 0:lt.postalCode)&&tr.countryCode===((yt=z(D))==null?void 0:yt.countryCode)||await J(tr,be),Or&&z(R)!=="card"?Or:void 0}function ie(be){return()=>{if(z(b)!==be)throw new JO}}async function xe(){var be;const lt=await e.purchaseOperationHelper.checkoutComplete(z(C)),yt=(be=lt?.gateway_params)==null?void 0:be.client_secret;yt&&gt(L,Wt(yt))}async function re(be){!z(P)||!z(A)||!z(L)||await Ba.confirmElements(z(P),z(A),z(L),be)}async function G(be){if(be instanceof JO)gt(h,"miss-match");else if(be instanceof ln){const lt=QJ({errorCode:be.errorCode.toString(),errorMessage:be.message});c.trackSDKEvent(lt),be.errorCode===Gr.MissingEmailError?gt(N,Wt(o().translate(It.ErrorPageErrorMessageInvalidEmailError,{email:z(C)}))):e.onError(be)}else if(be instanceof Jv)await ve(be);else throw be}async function ve(be){const lt=iQ({errorCode:be.gatewayErrorCode??"",errorMessage:be.message??""});c.trackSDKEvent(lt),be.code===IT.HandledFormError||(be.code===IT.UnhandledFormError?gt(N,Wt(be.message)):e.onError(new ln(Gr.ErrorSettingUpPurchase,"Failed to initialize payment form",be.message)))}const Oe=()=>{gt(N,void 0)};var he=cZ(),Ce=Ue(he);{var st=be=>{var lt=oZ(),yt=Ue(lt);CU(yt),ke(be,lt)};At(Ce,be=>{z(U)==="loading"&&be(st)})}var Ne=Et(Ce,2);{var St=be=>{var lt=$e(()=>o().translate(It.ErrorButtonTryAgain));rP(be,{title:null,type:"error",get closeButtonTitle(){return z(lt)},onDismiss:Oe,icon:yt=>{sU(yt)},message:yt=>{var tr=Fr();_t(()=>hr(tr,z(N))),ke(yt,tr)},$$slots:{icon:!0,message:!0}})};At(Ne,be=>{z(U)==="error"&&be(St)})}var at=Et(Ne,2),Ke=Ue(at),it=Ue(Ke),mt=Ue(it),Je=$e(()=>!!e.customerEmail),ue=$e(()=>z(h)!=="disabled");ZQ(mt,{get stripeAccountId(){return e.gatewayParams.stripe_account_id},get publishableApiKey(){return e.gatewayParams.publishable_api_key},get elementsConfiguration(){return z(T)},get brandingInfo(){return e.brandingInfo},get skipEmail(){return z(Je)},get billingAddressRequired(){return z(ue)},onLoadingComplete:ee,onError:ve,onEmailChange:H,onPaymentInfoChange:B,onExpressCheckoutElementSubmit:ae,get expressCheckoutOptions(){return z(X)},get stripe(){return z(P)},set stripe(be){gt(P,Wt(be))},get elements(){return z(A)},set elements(be){gt(A,Wt(be))}});var Be=Et(it,2),je=Ue(Be);sZ(je,{subscriptionOption:d});var ot=Et(Be,2),Pt=Ue(ot),Ft=$e(()=>!z(F)),Me=$e(()=>{var be;return(be=e.brandingInfo)!=null&&be.gateway_tax_collection_enabled?z(E):void 0});fQ(Pt,{get disabled(){return z(Ft)},subscriptionOption:d,get priceBreakdown(){return z(Me)}});var tt=Et(Pt,2),rt=Ue(tt);XJ(rt,{get brandingInfo(){return e.brandingInfo},get purchaseOption(){return e.purchaseOption}}),_t(()=>{Bc(Ke,"invisible",z(U)!=="form"),Bc(Be,"fully-hidden",z(h)!=="miss-match"||z(U)!=="form"),Bc(ot,"fully-hidden",z(U)!=="form")}),Bo("submit",at,K),ke(t,he),Jt()}function dZ(t){return t!=null}var td=(t=>(t.Subscription="subscription",t.Consumable="consumable",t.NonConsumable="non_consumable",t))(td||{});const FU=t=>({amount:t.amount_micros/1e4,amountMicros:t.amount_micros,currency:t.currency,formattedPrice:zl(t.amount_micros,t.currency)}),Ww=t=>{const e=t.period_duration,r=t.price?FU(t.price):null,n=e?aU(e):null;let a=null,i=null,o=null;if(r!==null&&n!==null){const c=fZ(n),u=1e4,d=Math.round(r.amountMicros*c.toWeek);a={amount:d/u,amountMicros:d,currency:r.currency,formattedPrice:zl(d,r.currency)};const f=Math.round(r.amountMicros*c.toMonth);i={amount:f/u,amountMicros:f,currency:r.currency,formattedPrice:zl(f,r.currency)};const h=Math.round(r.amountMicros*c.toYear);o={amount:h/u,amountMicros:h,currency:r.currency,formattedPrice:zl(h,r.currency)}}return{periodDuration:e,period:n,cycleCount:t.cycle_count,price:r,pricePerWeek:a,pricePerMonth:i,pricePerYear:o}};function fZ(t){const{number:e,unit:r}=t,n=7,a=30,i=365;let o;switch(r){case xa.Day:o=e;break;case xa.Week:o=e*n;break;case xa.Month:o=e*a;break;case xa.Year:o=e*i;break;default:o=0,rr.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 pZ=t=>t.base==null?(rr.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,base:Ww(t.base),trial:t.trial?Ww(t.trial):null,introPrice:t.intro_price?Ww(t.intro_price):null},hZ=t=>t.base_price==null?(rr.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,basePrice:FU(t.base_price)},mZ=(t,e)=>{const r=t.product_type;return r==="subscription"?yZ(t,e,r):gZ(t,e,r)},gZ=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([o,c])=>{const u=hZ(c);u!=null&&(n[o]=u)}),Object.keys(n).length===0)return rr.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?(rr.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}},yZ=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([c,u])=>{const d=pZ(u);d!=null&&(n[c]=d)}),Object.keys(n).length===0)return rr.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 rr.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const o=i.base.price;return o==null?(rr.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}},vZ=(t,e,r)=>{const n=r[e.platform_product_identifier];if(n===void 0)return null;const a=mZ(n,t);return a===null?null:{identifier:e.identifier,rcBillingProduct:a,webBillingProduct:a,packageType:bZ(e.identifier)}},_Z=(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=>vZ(a,c,r)).filter(dZ),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 bZ(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 kZ=ec('<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 wZ={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 fv(t,e){Vt(t,wZ);let r=jt(e,"direction",8);var n=kZ();_t(()=>xK(n,`arrow ${r()??""} svelte-1qexsu3`)),ke(t,n)}var SZ=ec('<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 EZ={hash:"svelte-r0zny8",code:".arrow-fill.svelte-r0zny8 {fill:var(--rc-color-grey-text-dark);}"};function TZ(t){Vt(t,EZ);var e=SZ();ke(t,e)}const CZ=`<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 xZ=dt('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function PZ(t){var e=xZ(),r=Ue(e);fu(r,()=>CZ),ke(t,e)}const AZ=`<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 RZ=dt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-wgufvv"><!></div>');const DZ={hash:"svelte-wgufvv",code:"div.svelte-wgufvv {height:24px;width:24px;}"};function OZ(t){Vt(t,DZ);var e=RZ(),r=Ue(e);fu(r,()=>AZ),ke(t,e)}const NZ=`<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 IZ=dt('<div style="color:var(--rc-color-primary)"><!></div>');function qU(t){var e=IZ(),r=Ue(e);fu(r,()=>NZ),ke(t,e)}var MZ=ec('<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 jZ={hash:"svelte-1jpfelf",code:".arrow-fill.svelte-1jpfelf {fill:var(--arrow-fill-color, var(--rc-color-grey-text-dark));}"};function LZ(t){Vt(t,jZ);var e=MZ();ke(t,e)}const BZ={cart:PZ,error:sU,lock:OZ,success:qU,back:TZ,info:BU,close:LZ,"chevron-left":fv,"chevron-right":fv,"chevron-up":fv,"chevron-down":fv};function Um(t,e){Xt(e,!0);const r=BZ[e.name];let n=or(Wt({}));if(e.name.startsWith("chevron")){const a=e.name.split("-")[1];gt(n,Wt({direction:a}))}r(t,qc(()=>z(n))),Jt()}var UZ=dt('<span class="rc-sandbox-only-error svelte-1d8gf9n"><!></span> <br> <br>',1),FZ=dt('<!> <a class="svelte-1d8gf9n"> </a>.',1),qZ=dt("<!> <!>",1);const zZ={hash:"svelte-1d8gf9n",code:"a.svelte-1d8gf9n {color:var(--rc-color-grey-text-dark);}.rc-sandbox-only-error.svelte-1d8gf9n {font-weight:bold;}"};function $Z(t,e){Xt(e,!0),Vt(t,zZ);const r=Oa(),n=()=>ya(i,"$translator",r),a=$e(()=>e.lastError??new ln(Gr.UnknownError,"Unknown error without state set.")),i=ea(Fi),o=$e(()=>z(a).errorCode===Gr.StripeTaxNotActive||z(a).errorCode===Gr.StripeInvalidTaxOriginAddress||z(a).errorCode===Gr.StripeMissingRequiredPermission);ks(()=>{rr.errorLog(`Displayed error: ${Gr[z(a).errorCode]}. Message: ${z(a).message??"None"}. Underlying error: ${z(a).underlyingErrorMessage??"None"}`)});function c(){return z(a).errorCode===Gr.AlreadyPurchasedError?n().translate(It.ErrorPageCloseButtonTitle,{appName:e.appName??"App"}):z(o)?n().translate(It.ErrorButtonClose):n().translate(It.ErrorButtonTryAgain)}function u(){switch(z(a).errorCode){case Gr.AlreadyPurchasedError:return e.productDetails.productType===td.Subscription?n().translate(It.ErrorPageErrorTitleAlreadySubscribed,{productTitle:e.productDetails.title}):n().translate(It.ErrorPageErrorTitleAlreadyPurchased,{productTitle:e.productDetails.title});case Gr.StripeTaxNotActive:return n().translate(It.ErrorPageErrorTitleStripeTaxNotActive);case Gr.StripeInvalidTaxOriginAddress:return n().translate(It.ErrorPageErrorTitleStripeInvalidTaxOriginAddress);case Gr.StripeMissingRequiredPermission:return n().translate(It.ErrorPageErrorTitleStripeMissingRequiredPermission);default:return n().translate(It.ErrorPageErrorTitleOtherErrors)}}function d(){const w=z(a).getErrorCode();switch(z(a).errorCode){case Gr.ErrorSettingUpPurchase:return n().translate(It.ErrorPageErrorMessageErrorSettingUpPurchase,{errorCode:w});case Gr.ErrorChargingPayment:return n().translate(It.ErrorPageErrorMessageErrorChargingPayment,{errorCode:w});case Gr.AlreadyPurchasedError:return e.productDetails.productType===td.Subscription?n().translate(It.ErrorPageErrorMessageAlreadySubscribed,{errorCode:w}):n().translate(It.ErrorPageErrorMessageAlreadyPurchased,{errorCode:w});case Gr.StripeTaxNotActive:return n().translate(It.ErrorPageErrorMessageStripeTaxNotActive,{errorCode:w});case Gr.StripeInvalidTaxOriginAddress:return n().translate(It.ErrorPageErrorMessageStripeInvalidTaxOriginAddress,{errorCode:w});case Gr.StripeMissingRequiredPermission:return n().translate(It.ErrorPageErrorMessageStripeMissingRequiredPermission,{errorCode:w});case Gr.NetworkError:return n().translate(It.ErrorPageErrorMessageNetworkError,{errorCode:w});default:return n().translate(It.ErrorPageErrorMessageUnknownError,{errorCode:w})}}function f(){return z(a).errorCode===Gr.AlreadyPurchasedError?It.ErrorPageTroubleAccessing:It.ErrorPageIfErrorPersists}function h(){return z(a).errorCode===Gr.AlreadyPurchasedError?"success":"error"}var m=$e(u),_=$e(c);rP(t,{get title(){return z(m)},get onDismiss(){return e.onDismiss},type:"error",get closeButtonTitle(){return z(_)},icon:w=>{var b=$e(h);Um(w,{get name(){return z(b)}})},message:w=>{var b=qZ(),E=Zt(b);{var T=C=>{var O=UZ(),I=Zt(O),x=Ue(I);ci(x,{get key(){return It.ErrorPageErrorMessageOnlyInSandbox}}),ke(C,O)};At(E,C=>{z(o)&&C(T)})}var D=Et(E);_t(()=>hr(D,` ${d()??""} `));var P=Et(D);{var A=C=>{var O=FZ(),I=Zt(O),x=$e(f);ci(I,{get key(){return z(x)}});var R=Et(I,2),N=Ue(R);_t(()=>{Ut(R,"href",`mailto:${e.supportEmail??""}`),hr(N,e.supportEmail)}),ke(C,O)};At(P,C=>{!z(o)&&e.supportEmail&&C(A)})}ke(w,b)},$$slots:{icon:!0,message:!0}}),Jt()}function VZ(t,e){Xt(e,!1);const r=Oa(),n=()=>ya(i,"$translator",r);let a=jt(e,"onContinue",8);const i=ea(Fi),o=ea(eP);function c(){o.trackSDKEvent({eventName:vi.CheckoutPurchaseSuccessfulDismiss,properties:{ui_element:"go_back_to_app"}}),a()()}ks(()=>{o.trackSDKEvent({eventName:vi.CheckoutPurchaseSuccessfulImpression})}),Es();var u=Mf(()=>n().translate(It.SuccessPagePurchaseSuccessful)),d=Mf(()=>n().translate(It.SuccessPageButtonClose));rP(t,{type:"success",get title(){return z(u)},onDismiss:c,get closeButtonTitle(){return z(d)},icon:f=>{qU(f)},$$slots:{icon:!0}}),Jt()}function HZ(t){CU(t)}var GZ=dt('<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 WZ={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 KZ(t,e){Xt(e,!1),Vt(t,WZ);const r=Oa(),n=()=>ya(o,"$translator",r);let a=jt(e,"isExpanded",12,!0),i=jt(e,"children",8);const o=ea(Fi);function c(){a(!a())}Es();var u=GZ(),d=Ue(u),f=Ue(d);Pr(f,{size:"label-default",children:(D,P)=>{var A=Sr(),C=Zt(A);{var O=x=>{var R=Fr();_t(()=>hr(R,n().translate(It.PricingDropdownHideDetails))),ke(x,R)},I=x=>{var R=Fr();_t(()=>hr(R,n().translate(It.PricingDropdownShowDetails))),ke(x,R)};At(C,x=>{a()?x(O):x(I,!1)})}ke(D,A)},$$slots:{default:!0}});var h=Et(f,2),m=Ue(h);{var _=D=>{Um(D,{name:"chevron-up"})},w=D=>{Um(D,{name:"chevron-down"})};At(m,D=>{a()?D(_):D(w,!1)})}var b=Et(d,2),E=Ue(b),T=Ue(E);jn(T,()=>i()??Ar),_t(()=>{Ut(d,"aria-expanded",a()),Bc(b,"collapsed",!a())}),Bo("click",d,c),Bo("keydown",d,D=>D.key==="Enter"||D.key===" "?c():null),ke(t,u),Jt()}var YZ=dt('<div class="rcb-pricing-table-value-loading svelte-erv89n"><!></div>');const XZ={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 JZ(t,e){Xt(e,!1),Vt(t,XZ);let r=jt(e,"children",8);Es();var n=YZ(),a=Ue(n);jn(a,()=>r()??Ar),ke(t,n),Jt()}var QZ=dt('<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>'),ZZ=dt('<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>'),eee=dt('<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>'),tee=dt('<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),ree=dt('<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>'),nee=dt('<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 aee={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 iee(t,e){var r;Xt(e,!0),Vt(t,aee);const n=Oa(),a=()=>ya(c,"$translator",n),i=_=>{var w=nee(),b=Ue(w);{var E=x=>{var R=tee(),N=Zt(R),L=Ue(N),j=Ue(L);Pr(j,{size:"body-small",children:(J,ee)=>{var H=Fr();_t(()=>hr(H,a().translate(It.PricingTotalExcludingTax))),ke(J,H)},$$slots:{default:!0}});var q=Et(L,2),U=Ue(q);Pr(U,{size:"body-small",children:(J,ee)=>{var H=Fr();_t(()=>hr(H,a().formatPrice(e.priceBreakdown.totalExcludingTaxInMicros,e.priceBreakdown.currency))),ke(J,H)},$$slots:{default:!0}});var Y=Et(N,2);{var F=J=>{var ee=QZ(),H=Ue(ee),B=Ue(H);Pr(B,{size:"body-small",children:(te,pe)=>{var ce=Fr();_t(()=>hr(ce,a().translate(It.PricingTableTax))),ke(te,ce)},$$slots:{default:!0}});var K=Et(H,2),ae=Ue(K);Pr(ae,{size:"body-small",children:(te,pe)=>{JZ(te,{children:(ce,Re)=>{var He=Fr();_t(()=>hr(He,a().formatPrice(1234e4,e.priceBreakdown.currency))),ke(ce,He)},$$slots:{default:!0}})},$$slots:{default:!0}}),ke(J,ee)},X=J=>{var ee=Sr(),H=Zt(ee);{var B=ae=>{var te=ZZ(),pe=Ue(te),ce=Ue(pe);_t(()=>hr(ce,a().translate(It.PricingTableTax)));var Re=Et(pe,2),He=Ue(Re);Pr(He,{size:"body-small",children:(ie,xe)=>{var re=Fr();_t(()=>hr(re,a().translate(It.PricingTableEnterBillingAddressToCalculate))),ke(ie,re)},$$slots:{default:!0}}),ke(ae,te)},K=ae=>{var te=Sr(),pe=Zt(te);{var ce=Re=>{var He=Sr(),ie=Zt(He);op(ie,17,()=>e.priceBreakdown.taxBreakdown,sp,(xe,re)=>{var G=eee(),ve=Ue(G),Oe=Ue(ve);Pr(Oe,{size:"body-small",children:(st,Ne)=>{var St=Fr();_t(()=>hr(St,z(re).display_name)),ke(st,St)},$$slots:{default:!0}});var he=Et(ve,2),Ce=Ue(he);Pr(Ce,{size:"body-small",children:(st,Ne)=>{var St=Fr();_t(()=>hr(St,a().formatPrice(z(re).tax_amount_in_micros,e.priceBreakdown.currency))),ke(st,St)},$$slots:{default:!0}}),ke(xe,G)}),ke(Re,He)};At(pe,Re=>{e.priceBreakdown.taxBreakdown!==null&&Re(ce)},!0)}ke(ae,te)};At(H,ae=>{e.priceBreakdown.taxCalculationStatus==="pending"?ae(B):ae(K,!1)},!0)}ke(J,ee)};At(Y,J=>{e.priceBreakdown.taxCalculationStatus==="loading"?J(F):J(X,!1)})}ke(x,R)};At(b,x=>{z(u)&&x(E)})}var T=Et(b,2);{var D=x=>{var R=ree(),N=Ue(R),L=Ue(N);Pr(L,{size:"body-small",children:(U,Y)=>{var F=Fr();_t(()=>hr(F,a().translate(It.PricingTableTrialEnds,{formattedTrialEndDate:a().translateDate(z(o),{dateStyle:"medium"})}))),ke(U,F)},$$slots:{default:!0}});var j=Et(N,2),q=Ue(j);Pr(q,{size:"body-small",children:(U,Y)=>{var F=Fr();_t(()=>hr(F,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),ke(U,F)},$$slots:{default:!0}}),ke(x,R)};At(T,x=>{z(o)&&x(D)})}var P=Et(T,2),A=Ue(P),C=Ue(A);Pr(C,{size:"body-small",children:(x,R)=>{var N=Fr();_t(()=>hr(N,a().translate(It.PricingTableTotalDueToday))),ke(x,N)},$$slots:{default:!0}});var O=Et(A,2),I=Ue(O);Pr(I,{size:"body-small",children:(x,R)=>{var N=Sr(),L=Zt(N);{var j=U=>{var Y=Fr();_t(()=>hr(Y,a().formatPrice(0,e.priceBreakdown.currency))),ke(U,Y)},q=U=>{var Y=Fr();_t(()=>hr(Y,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),ke(U,Y)};At(L,U=>{z(o)?U(j):U(q,!1)})}ke(x,N)},$$slots:{default:!0}}),ke(_,w)};let o=or(null);(r=e.trialPhase)!=null&&r.period&&gt(o,Wt(xT(new Date,e.trialPhase.period,!0)));const c=ea(Fi),u=$e(()=>e.priceBreakdown.taxCalculationStatus!=="unavailable"&&e.priceBreakdown.taxCalculationStatus!=="disabled"&&e.priceBreakdown.taxBreakdown&&e.priceBreakdown.taxBreakdown.length>0);var d=Sr(),f=Zt(d);{var h=_=>{KZ(_,{children:(w,b)=>{i(w)},$$slots:{default:!0}})},m=_=>{i(_)};At(f,_=>{z(u)?_(h):_(m,!1)})}ke(t,d),Jt()}var see=dt('<div class="rcb-subscribe-to svelte-4fnm8t"><!></div>'),oee=dt('<span class="rcb-product-description svelte-4fnm8t"><!></span>'),cee=dt('<div class="rcb-pricing-info-header svelte-4fnm8t"><!> <div class="rcb-product-title svelte-4fnm8t"><!></div> <!></div>');const lee={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 uee(t,e){Xt(e,!1),Vt(t,lee);let r=jt(e,"productDetails",8),n=jt(e,"showProductDescription",8);const a=r().productType===td.Subscription;Es();var i=cee(),o=Ue(i);{var c=m=>{var _=see(),w=Ue(_);Pr(w,{size:"body-base",children:(b,E)=>{var T=Mf(()=>({productTitle:r().title}));ci(b,{get key(){return It.ProductInfoSubscribeTo},get variables(){return z(T)}})},$$slots:{default:!0}}),ke(m,_)};At(o,m=>{a&&m(c)})}var u=Et(o,2),d=Ue(u);Pr(d,{size:"heading-lg",branded:!0,children:(m,_)=>{var w=Mf(()=>({productTitle:r().title}));ci(m,{get key(){return It.ProductInfoProductTitle},get variables(){return z(w)}})},$$slots:{default:!0}});var f=Et(u,2);{var h=m=>{var _=oee(),w=Ue(_);Pr(w,{size:"body-small",children:(b,E)=>{var T=Mf(()=>({productDescription:r().description}));ci(b,{get key(){return It.ProductInfoProductDescription},get variables(){return z(T)}})},$$slots:{default:!0}}),ke(m,_)};At(f,m=>{n()&&r().description&&m(h)})}ke(t,i),Jt()}var dee=dt("<div><!></div>"),fee=dt("<div><!> <!></div>"),pee=dt('<div class="rcb-product-price-container svelte-509gz3"><!> <!> <div><!> <!> <!></div></div>');const hee={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 mee(t,e){Xt(e,!0),Vt(t,hee);const r=Oa(),n=()=>ya(a,"$translator",r),a=ea(Fi),i=$e(()=>{var N;return(N=e.introPricePhase)!=null&&N.period&&n().translatePeriod(e.introPricePhase.period.number*e.introPricePhase.cycleCount,e.introPricePhase.period.unit)||""}),o=$e(()=>"heading-lg"),c=$e(()=>{var N;return(N=e.trialPhase)!=null&&N.periodDuration?"heading-md":"heading-lg"}),u=$e(()=>{var N,L;return(N=e.trialPhase)!=null&&N.periodDuration||(L=e.introPricePhase)!=null&&L.periodDuration?"heading-md":"heading-lg"}),d=$e(()=>{var N;return(N=e.trialPhase)==null?void 0:N.periodDuration}),f=$e(()=>{var N;return(N=e.introPricePhase)==null?void 0:N.periodDuration}),h=$e(()=>{var N;return((N=e.introPricePhase)==null?void 0:N.cycleCount)==1}),m=$e(()=>{var N,L;return n().formatPrice(z(f)?((L=(N=e.basePhase)==null?void 0:N.price)==null?void 0:L.amountMicros)??0:e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency)}),_=$e(()=>n().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency));var w=pee(),b=Ue(w);{var E=N=>{var L=dee(),j=Ue(L);Pr(j,{get size(){return z(o)},children:(q,U)=>{var Y=$e(()=>({trialDuration:wY(e.trialPhase.periodDuration,n())}));ci(q,{get key(){return It.ProductInfoFreeTrialDuration},get variables(){return z(Y)}})},$$slots:{default:!0}}),ke(N,L)};At(b,N=>{var L;(L=e.trialPhase)!=null&&L.periodDuration&&N(E)})}var T=Et(b,2);{var D=N=>{var L=fee(),j=Ue(L);Pr(j,{get size(){return z(c)},children:(F,X)=>{var J=$e(()=>z(d)?It.ProductInfoIntroPricePhaseAfterTrial:It.ProductInfoIntroPricePhase),ee=$e(()=>({introPriceDuration:z(i),introPrice:z(_)}));ci(F,{get key(){return z(J)},get variables(){return z(ee)}})},$$slots:{default:!0}});var q=Et(j,2);{var U=F=>{Pr(F,{size:"body-small",children:(X,J)=>{ci(X,{get key(){return It.ProductInfoIntroPricePhasePaidOnce}})},$$slots:{default:!0}})},Y=F=>{var X=Sr(),J=Zt(X);{var ee=H=>{Pr(H,{size:"body-small",children:(B,K)=>{var ae=Fr();_t(()=>hr(ae,n().translatePeriodFrequency(e.introPricePhase.period.number,e.introPricePhase.period.unit,{useMultipleWords:!0}))),ke(B,ae)},$$slots:{default:!0}})};At(J,H=>{e.introPricePhase.period&&H(ee)},!0)}ke(F,X)};At(q,F=>{z(h)?F(U):F(Y,!1)})}ke(N,L)};At(T,N=>{var L;(L=e.introPricePhase)!=null&&L.periodDuration&&N(D)})}var P=Et(T,2),A=Ue(P);Pr(A,{get size(){return z(u)},children:(N,L)=>{var j=Fr();_t(()=>hr(j,z(m))),ke(N,j)},$$slots:{default:!0}});var C=Et(A,2);{var O=N=>{Pr(N,{size:"body-small",children:(L,j)=>{var q=Fr();_t(()=>hr(q,n().translatePeriodFrequency(e.basePhase.period.number,e.basePhase.period.unit,{useMultipleWords:!0}))),ke(L,q)},$$slots:{default:!0}})};At(C,N=>{var L;(L=e.basePhase)!=null&&L.period&&N(O)})}var I=Et(C,2);{var x=N=>{Pr(N,{size:"body-small",children:(L,j)=>{ci(L,{get key(){return It.ProductInfoAfter}})},$$slots:{default:!0}})},R=N=>{var L=Sr(),j=Zt(L);{var q=U=>{Pr(U,{size:"body-small",children:(Y,F)=>{ci(Y,{get key(){return It.ProductInfoAfterTrial}})},$$slots:{default:!0}})};At(j,U=>{z(d)&&U(q)},!0)}ke(N,L)};At(I,N=>{z(f)?N(x):N(R,!1)})}ke(t,w),Jt()}var gee=dt('<div class="rcb-pricing-info svelte-18guro7"><div class="rcb-pricing-info-header svelte-18guro7"><!> <!></div> <!></div>');const yee={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 vee(t,e){Vt(t,yee);let r=jt(e,"productDetails",8),n=jt(e,"purchaseOption",8),a=jt(e,"showProductDescription",8),i=jt(e,"priceBreakdown",8);const o=n(),c=o?.base,u=o?.trial,d=o?.introPrice;var f=gee(),h=Ue(f),m=Ue(h);uee(m,{get productDetails(){return r()},get showProductDescription(){return a()}});var _=Et(m,2);mee(_,{get priceBreakdown(){return i()},basePhase:c,trialPhase:u,introPricePhase:d});var w=Et(h,2);iee(w,{get priceBreakdown(){return i()},trialPhase:u}),ke(t,f)}const Wh=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;var _ee=dt('<div class="rcb-ui-container svelte-1h6xr8z"><!></div>');const bee={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 kee(t,e){Xt(e,!0),Vt(t,bee);const r=jt(e,"brandingAppearance",3,void 0),n=jt(e,"brandFontConfig",3,void 0),a=jt(e,"isInElement",3,!1),i=$e(()=>new Bm(r()).getTextStyleVars(n())),o=$e(()=>new Bm(r()).spacingStyleVars),c=$e(()=>[z(i),z(o)].join("; ")),u=$e(()=>{var m;return(m=n())!=null&&m.font_url?Wh(n().font_url):null}),d=async m=>{try{const _=new FontFace(AU,`url(${m})`);await _.load(),document.fonts.add(_)}catch{}};ip(()=>{z(u)&&d(z(u))});var f=_ee(),h=Ue(f);jn(h,()=>e.children??Ar),_t(()=>{Ut(f,"style",z(c)),Bc(f,"fullscreen",!a()),Bc(f,"inside",a())}),ke(t,f),Jt()}var wee=dt('<div id="layout-query-container" class="svelte-1x4ow5d"><div class="rcb-ui-layout svelte-1x4ow5d"><!></div></div>');const See={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 Eee(t,e){Xt(e,!1),Vt(t,See);let r=jt(e,"style",8,""),n=jt(e,"children",8);Es();var a=wee(),i=Ue(a),o=Ue(i);jn(o,()=>n()??Ar),_t(()=>Ut(i,"style",r())),ke(t,a),Jt()}const Tee=t=>t;function Cee(t){const e=t-1;return e*e*e+1}function QO(t){const e=typeof t=="string"&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function xee(t,{delay:e=0,duration:r=400,easing:n=Tee}={}){const a=+getComputedStyle(t).opacity;return{delay:e,duration:r,easing:n,css:i=>`opacity: ${i*a}`}}function Pee(t,{delay:e=0,duration:r=400,easing:n=Cee,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]=QO(a),[_,w]=QO(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 Aee=dt('<div><div class="layout-wrapper svelte-1w6qvx7"><div><!></div></div></div>');const Ree={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 zU(t,e){Xt(e,!0),Vt(t,Ree);const r=`rcb-${e.location}`;var n=Aee();Ql(n,`layout-wrapper-outer ${r??""} svelte-1w6qvx7`);var a=Ue(n),i=Ue(a);Ql(i,`layout-content ${r??""} svelte-1w6qvx7`);var o=Ue(i);jn(o,()=>e.children??Ar),eU(3,i,()=>xee,()=>({duration:500,delay:50})),ke(t,n),Jt()}var Dee=dt('<div class="navbar-body svelte-jz90ay"><!></div>'),Oee=dt('<div class="navbar-header svelte-jz90ay"><!></div> <!>',1),Nee=dt('<div class="rcb-ui-navbar svelte-jz90ay"><!></div>');const Iee={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 Mee(t,e){Xt(e,!0),Vt(t,Iee);const r=jt(e,"brandingAppearance",3,void 0),n=$e(()=>new Bm(r()).productInfoStyleVars);var a=Nee(),i=Ue(a);zU(i,{location:"navbar",children:(o,c)=>{var u=Oee(),d=Zt(u),f=Ue(d);jn(f,()=>e.headerContent??Ar);var h=Et(d,2);{var m=_=>{var w=Dee(),b=Ue(w);jn(b,()=>e.bodyContent??Ar),ke(_,w)};At(h,_=>{e.bodyContent&&_(m)})}ke(o,u)},$$slots:{default:!0}}),_t(()=>Ut(a,"style",z(n))),ke(t,a),Jt()}var jee=dt('<button class="rcb-close-button svelte-nssttr" data-testid="close-button"><!></button>');const Lee={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 $U(t,e){Vt(t,Lee);var r=jee(),n=Ue(r);Um(n,{name:"close"}),Bo("click",r,function(a){rU.call(this,e,a)}),ke(t,r)}const Bee=`<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 Uee=dt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-5vi85d"><!></div>');const Fee={hash:"svelte-5vi85d",code:"div.svelte-5vi85d {height:12px;width:12px;}"};function qee(t){Vt(t,Fee);var e=Uee(),r=Ue(e);fu(r,()=>Bee),ke(t,e)}var zee=dt('<span class="rcb-sandbox-text svelte-18xxdea">SANDBOX</span>'),$ee=dt('<span class="rcb-sandbox-text svelte-18xxdea">Share feedback</span>'),Vee=dt('<a class="rcb-ui-sandbox-banner-link svelte-18xxdea" target="_blank"><!> <!></a>'),Hee=dt('<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 Gee={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 Wee(t,e){Xt(e,!1),Vt(t,Gee);let r=jt(e,"style",8,""),n=jt(e,"isInElement",8,!1),a=jt(e,"brandingInfo",8,null),i=Us(!0);function o(){rr.debugLog("closeBanner"),gt(i,!1)}Es();var c=Sr(),u=Zt(c);{var d=f=>{var h=Hee(),m=Et(Ue(h),2),_=Ue(m);Pr(_,{size:"caption-default",children:(D,P)=>{var A=zee();ke(D,A)},$$slots:{default:!0}});var w=Et(m,2),b=Ue(w);{var E=D=>{var P=Vee(),A=Ue(P);qee(A);var C=Et(A,2);Pr(C,{size:"caption-link",children:(O,I)=>{var x=$ee();ke(O,x)},$$slots:{default:!0}}),_t(()=>Ut(P,"href",a().sandbox_configuration.checkout_feedback_form_url)),ke(D,P)};At(b,D=>{var P;(P=a())!=null&&P.sandbox_configuration&&D(E)})}var T=Et(b,2);$U(T,{$$events:{click:o}}),_t(()=>{Ut(h,"style",r()),Bc(h,"isInElement",n())}),eU(2,h,()=>Pee,()=>({y:-100,duration:300})),ke(f,h)};At(u,f=>{z(i)&&f(d)})}ke(t,c),Jt()}var Kee=dt('<div class="rcb-ui-main svelte-nr408n"><!></div>');const Yee={hash:"svelte-nr408n",code:".rcb-ui-main.svelte-nr408n {flex:1;display:flex;background-color:var(--rc-color-background);}"};function Xee(t,e){Xt(e,!0),Vt(t,Yee);const r=$e(()=>new Bm(e.brandingAppearance).formStyleVars);var n=Kee(),a=Ue(n);zU(a,{location:"main-block",children:(i,o)=>{var c=Sr(),u=Zt(c);jn(u,()=>e.children??Ar),ke(i,c)},$$slots:{default:!0}}),_t(()=>Ut(n,"style",z(r))),ke(t,n),Jt()}var Jee=dt("<!> <!>",1),Qee=dt("<!> <!>",1);function Zee(t,e){Xt(e,!0);const r=$e(()=>{var i;return OU((i=e.brandingInfo)==null?void 0:i.appearance)??""});var n=$e(()=>{var i;return(i=e.brandingInfo)==null?void 0:i.appearance}),a=$e(()=>{var i;return(i=e.brandingInfo)==null?void 0:i.brand_font_config});kee(t,{get brandingAppearance(){return z(n)},get brandFontConfig(){return z(a)},get isInElement(){return e.isInElement},children:(i,o)=>{var c=Qee(),u=Zt(c);{var d=h=>{Wee(h,{get style(){return z(r)},get isInElement(){return e.isInElement},get brandingInfo(){return e.brandingInfo}})};At(u,h=>{e.isSandbox&&h(d)})}var f=Et(u,2);Eee(f,{get style(){return z(r)},children:(h,m)=>{var _=Jee(),w=Zt(_);{var b=D=>{var P=$e(()=>{var A;return(A=e.brandingInfo)==null?void 0:A.appearance});Mee(D,{get brandingAppearance(){return z(P)},get headerContent(){return e.navbarHeaderContent},get bodyContent(){return e.navbarBodyContent}})};At(w,D=>{(e.navbarHeaderContent||e.navbarBodyContent)&&D(b)})}var E=Et(w,2),T=$e(()=>{var D;return(D=e.brandingInfo)==null?void 0:D.appearance});Xee(E,{get brandingAppearance(){return z(T)},children:(D,P)=>{var A=Sr(),C=Zt(A);jn(C,()=>e.mainContent??Ar),ke(D,A)},$$slots:{default:!0}}),ke(h,_)},$$slots:{default:!0}}),ke(i,c)},$$slots:{default:!0}}),Jt()}var ete=dt('<source type="image/webp">'),tte=dt('<picture class="rcb-app-icon-picture-container svelte-el1u77"><!> <img class="rcb-app-icon svelte-el1u77" alt="App icon"></picture>'),rte=dt('<div class="rcb-app-icon loading svelte-el1u77"></div>');const nte={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 ate(t,e){Vt(t,nte);var r=Sr(),n=Zt(r);{var a=o=>{var c=tte(),u=Ue(c);{var d=h=>{var m=ete();_t(()=>Ut(m,"srcset",e.srcWebp)),ke(h,m)};At(u,h=>{e.srcWebp&&h(d)})}var f=Et(u,2);_t(()=>Ut(f,"src",e.src)),ke(o,c)},i=o=>{var c=rte();ke(o,c)};At(n,o=>{e.src?o(a):o(i,!1)})}ke(t,r)}var ite=dt('<button class="rcb-back-button svelte-9xjbko" data-testid="close-button"><!></button>');const ste={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 ote(t,e){Vt(t,ste);var r=ite(),n=Ue(r);Um(n,{name:"back"}),Bo("click",r,function(a){rU.call(this,e,a)}),ke(t,r)}var cte=dt('<source type="image/webp" class="rcb-app-icon svelte-19gv4gf">'),lte=dt('<picture class="rcb-app-icon svelte-19gv4gf"><!> <img class="rcb-app-icon svelte-19gv4gf" alt="App icon"></picture>');const ute={hash:"svelte-19gv4gf",code:".rcb-app-icon.svelte-19gv4gf {height:32px;}"};function dte(t,e){Vt(t,ute);var r=lte(),n=Ue(r);{var a=o=>{var c=cte();_t(()=>Ut(c,"srcset",e.srcWebp)),ke(o,c)};At(n,o=>{e.srcWebp&&o(a)})}var i=Et(n,2);_t(()=>Ut(i,"src",e.src)),ke(t,r)}var fte=dt('<div class="rcb-back-wrapper svelte-11zapuq"><!></div>'),pte=dt('<div class="rcb-close-wrapper svelte-11zapuq"><!></div>'),hte=dt('<div class="rcb-header-wrapper svelte-11zapuq"><!> <div class="rcb-header svelte-11zapuq"><div class="rcb-title svelte-11zapuq"><!> <!></div></div> <!></div>');const mte={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 gte(t,e){Xt(e,!0),Vt(t,mte);const r=x=>x==null||x==null||x==""?null:x,n=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon)}),a=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon_webp)}),i=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark)}),o=$e(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark_webp)}),c=$e(()=>z(n)?Wh(z(n)):null),u=$e(()=>z(a)?Wh(z(a)):null),d=$e(()=>z(i)?Wh(z(i)):null),f=$e(()=>z(o)?Wh(z(o)):null),h=()=>{e.onClose&&e.onClose()};var m=hte(),_=Ue(m);{var w=x=>{var R=fte(),N=Ue(R);ote(N,{$$events:{click:h}}),ke(x,R)};At(_,x=>{e.showCloseButton&&x(w)})}var b=Et(_,2),E=Ue(b),T=Ue(E);{var D=x=>{dte(x,{get src(){return z(d)},get srcWebp(){return z(f)}})},P=x=>{var R=Sr(),N=Zt(R);{var L=j=>{ate(j,{get src(){return z(c)},get srcWebp(){return z(u)}})};At(N,j=>{z(c)!==null&&z(u)!==null&&j(L)},!0)}ke(x,R)};At(T,x=>{z(d)!==null?x(D):x(P,!1)})}var A=Et(T,2);{var C=x=>{Pr(x,{size:"body-base",children:(R,N)=>{var L=Fr();_t(()=>{var j;return hr(L,(j=e.brandingInfo)==null?void 0:j.app_name)}),ke(R,L)},$$slots:{default:!0}})};At(A,x=>{z(d)===null&&x(C)})}var O=Et(b,2);{var I=x=>{var R=pte(),N=Ue(R);$U(N,{$$events:{click:h}}),ke(x,R)};At(O,x=>{e.showCloseButton&&x(I)})}_t(()=>Bc(m,"rcb-with-close-button",e.showCloseButton)),ke(t,m),Jt()}var yte=dt("<!> <!> <!> <!>",1);function vte(t,e){Xt(e,!0);const r=jt(e,"onClose",3,void 0),n=UU(e.productDetails,e.purchaseOptionToUse);let a=or(Wt(e.defaultPriceBreakdown??{currency:n.currency,totalAmountInMicros:n.amountMicros,totalExcludingTaxInMicros:n.amountMicros,taxCalculationStatus:"unavailable",taxAmountInMicros:null,taxBreakdown:null}));const i=o=>{gt(a,Wt(o))};Zee(t,{get brandingInfo(){return e.brandingInfo},get isInElement(){return e.isInElement},get isSandbox(){return e.isSandbox},get onClose(){return r()},navbarHeaderContent:o=>{var c=$e(()=>!e.isInElement&&!!r());gte(o,{get brandingInfo(){return e.brandingInfo},get onClose(){return r()},get showCloseButton(){return z(c)}})},navbarBodyContent:o=>{var c=$e(()=>{var u,d;return((d=(u=e.brandingInfo)==null?void 0:u.appearance)==null?void 0:d.show_product_description)??!1});vee(o,{get productDetails(){return e.productDetails},get purchaseOption(){return e.purchaseOptionToUse},get showProductDescription(){return z(c)},get priceBreakdown(){return z(a)}})},mainContent:o=>{var c=yte(),u=Zt(c);{var d=E=>{HZ(E)};At(u,E=>{e.currentPage==="payment-entry-loading"&&E(d)})}var f=Et(u,2);{var h=E=>{uZ(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})};At(f,E=>{e.currentPage==="payment-entry"&&E(h)})}var m=Et(f,2);{var _=E=>{var T=$e(()=>{var P;return((P=e.brandingInfo)==null?void 0:P.support_email)??null}),D=$e(()=>{var P;return((P=e.brandingInfo)==null?void 0:P.app_name)??null});$Z(E,{get lastError(){return e.lastError},get productDetails(){return e.productDetails},get supportEmail(){return z(T)},get onDismiss(){return e.closeWithError},get appName(){return z(D)}})};At(m,E=>{e.currentPage==="error"&&E(_)})}var w=Et(m,2);{var b=E=>{VZ(E,{get onContinue(){return e.onContinue}})};At(w,E=>{e.currentPage==="success"&&E(b)})}ke(o,c)},$$slots:{navbarHeaderContent:!0,navbarBodyContent:!0,mainContent:!0}}),Jt()}function _te(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 bte(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 rr.errorLog(e),new wn(zn.ConfigurationError,e)}}function kte(t,e){var r;Xt(e,!0);const n=jt(e,"customTranslations",19,()=>({})),a=jt(e,"skipSuccessPage",3,!1),i=e.customerEmail?_te(e.customerEmail):null;let o=or(Wt(i?void 0:e.customerEmail)),c=e.rcPackage.webBillingProduct,u=or(null);const d=e.rcPackage.webBillingProduct.identifier??null;let f=or("payment-entry-loading"),h=or(null),m=or(Wt({})),_=or(null),w=or(null),b=or(null),E=or(null),T=new Wb(n(),e.selectedLocale,e.defaultLocale),D=Wx(T);ed(Fi,D),ed(tP,(r=e.brandingInfo)==null?void 0:r.appearance),ks(()=>{e.isInElement||(gt(w,Wt(document.documentElement.style.height)),gt(b,Wt(document.documentElement.style.overflow)),gt(E,Wt(document.body.style.height)),document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.overflow="hidden")}),Ig(()=>{if(!e.isInElement){const x=(R,N,L)=>{L===""?R.style.removeProperty(N):R.style.setProperty(N,L)};x(document.documentElement,"height",z(w)),x(document.body,"height",z(E)),x(document.documentElement,"overflow",z(b))}}),ed(eP,e.eventsTracker),ks(async()=>{if(d===null){A(new ln(Gr.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}e.purchaseOperationHelper.checkoutStart(e.appUserId,d,e.purchaseOption,e.rcPackage.webBillingProduct.presentedOfferingContext,z(o),e.metadata).then(x=>{gt(u,null),gt(f,"payment-entry"),gt(m,Wt(x.gateway_params)),gt(_,Wt(x.management_url))}).catch(x=>{if(x.errorCode===Gr.MissingEmailError)return gt(o,void 0),e.purchaseOperationHelper.checkoutStart(e.appUserId,d,e.purchaseOption,e.rcPackage.webBillingProduct.presentedOfferingContext,z(o),e.metadata).then(R=>{gt(u,null),gt(f,"payment-entry"),gt(m,Wt(R.gateway_params)),gt(_,Wt(R.management_url))}).catch(R=>{A(R)});A(x)})});const P=()=>{if(z(f)==="payment-entry"){e.purchaseOperationHelper.pollCurrentPurchaseForCompletion().then(x=>{gt(h,Wt(x)),a()?e.onFinished(x):gt(f,"success")}).catch(x=>{A(x)});return}if(z(f)==="success"||z(f)==="error"){e.onFinished(z(h));return}gt(f,"success")},A=x=>{const R=JJ({errorCode:x.getErrorCode().toString(),errorMessage:x.message});e.eventsTracker.trackSDKEvent(R),gt(u,Wt(x)),gt(f,"error")},C=()=>{e.onError(z(u)??new ln(Gr.UnknownError,"Unknown error without state set."))};var O=$e(()=>e.purchases.isSandbox()),I=$e(()=>z(o)??null);vte(t,{get isSandbox(){return z(O)},get currentPage(){return z(f)},get brandingInfo(){return e.brandingInfo},productDetails:c,get purchaseOptionToUse(){return e.purchaseOption},get lastError(){return z(u)},get gatewayParams(){return z(m)},get managementUrl(){return z(_)},get purchaseOperationHelper(){return e.purchaseOperationHelper},get isInElement(){return e.isInElement},get customerEmail(){return z(I)},closeWithError:C,onContinue:P,onError:A,get onClose(){return e.onClose}}),Jt()}function VU(t){return t==null?!0:new Date(t)>new Date}function wte(t,e,r,n){const a=e.product_identifier;if(a in r)return Ste(t,e,r[a]);if(a in n)return Ete(t,e,n[a]);throw new wn(zn.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Ste(t,e,r){return{identifier:t,isActive:VU(e.expires_date),willRenew:GU(e.expires_date,r),store:r?.store??"unknown",latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(e.purchase_date),expirationDate:No(e.expires_date),productIdentifier:e.product_identifier,productPlanIdentifier:e.product_plan_identifier??null,unsubscribeDetectedAt:No(r?.unsubscribe_detected_at),billingIssueDetectedAt:No(r?.billing_issues_detected_at),isSandbox:r?.is_sandbox??!1,periodType:r?.period_type??"normal",ownershipType:r?.ownership_type??"UNKNOWN"}}function Ete(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 Tte(t,e,r){const n={},a={};for(const i in t){const o=wte(i,t[i],e,r);n[i]=o,o.isActive&&(a[i]=o)}return{all:n,active:a}}function No(t){return t==null?null:new Date(t)}function HU(t){const e=xte(t),r=t.subscriber,n=Ate(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:No(u.original_purchase_date),expiresDate:No(u.expires_date),store:u.store,unsubscribeDetectedAt:No(u.unsubscribe_detected_at),isSandbox:u.is_sandbox,billingIssuesDetectedAt:No(u.billing_issues_detected_at),gracePeriodExpiresDate:No(u.grace_period_expires_date),ownershipType:u.ownership_type??"UNKNOWN",periodType:u.period_type,refundedAt:No(u.refunded_at),storeTransactionId:u.store_transaction_id||null,isActive:VU(u.expires_date),willRenew:GU(u.expires_date,u)}]));return{entitlements:Tte(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:Cte(t,n),activeSubscriptions:Pte(e),managementURL:r.management_url,requestDate:i,firstSeenDate:new Date(r.first_seen),originalPurchaseDate:No(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id,nonSubscriptionTransactions:a,subscriptionsByProductIdentifier:o}}function GU(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 Cte(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 xte(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 Pte(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 Ate(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 WU="1.14.0",Rte="https://api.revenuecat.com",Dte="https://e.revenue.cat";var Y_;(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"})(Y_||(Y_={}));const Ote=/^rcb_[a-zA-Z0-9_.-]+$/,Nte=/^pdl_[a-zA-Z0-9_.-]+$/,Ite=/^test_[a-zA-Z0-9_.-]+$/;function X_(t){return t?t.startsWith("rcb_sb_"):!1}function Mte(t){return t?Ote.test(t):!1}function jte(t){return t?Nte.test(t):!1}function qu(t){return t?Ite.test(t):!1}async function Ls(t,e,r){const{apiKey:n,body:a,headers:i,httpConfig:o}=e,c=`${o?.proxyURL??Rte}${t.urlPath()}`;try{const u=await fetch(c,{method:t.method,headers:rF(n,i,o?.additionalHeaders),body:Bte(a),signal:r});return await Lte(u,t),await u.json()}catch(u){throw u instanceof TypeError?new wn(zn.NetworkError,om.getPublicMessage(zn.NetworkError),u.message):u}}async function Lte(t,e){const r=t.status;if(r>=Y_.INTERNAL_SERVER_ERROR)Kw(e,r,await t.text());else if(r>=Y_.BAD_REQUEST){const n=await t.json(),a=n?JSON.stringify(n):null,i=n?.code,o=n?.message;if(i!=null){const c=om.convertCodeToBackendErrorCode(i);if(c==null)Kw(e,r,a,i);else throw wn.getForBackendError(c,o)}else Kw(e,r,a)}}function Kw(t,e,r,n){throw new wn(zn.UnknownBackendError,"Unknown backend error.",`Request: ${t.name}. Status code: ${e}. Body: ${r}.`,{backendErrorCode:n})}function Bte(t){return t==null?null:JSON.stringify(t)}const KU="Authorization",YU="Content-Type",XU="Accept",JU="X-Platform",QU="X-Version",ZU="X-Platform-Flavor",eF="X-Platform-Flavor-Version",tF="X-Is-Sandbox",Ute=new Set([KU,YU,XU,JU,QU,tF,ZU,eF]);function rF(t,e,r){let n={[KU]:`Bearer ${t}`,[YU]:"application/json",[XU]:"application/json",[JU]:"web",[QU]:WU,[tF]:`${X_(t)}`};const a=lm.getPlatformInfo();if(a){const i={[ZU]:a.flavor,[eF]:a.version};n={...n,...i}}return e&&(n={...n,...e}),r&&(n={...r,...n}),n}const Jb="/v1/subscribers",Ap="/rcbilling/v1";class Fte{constructor(e){wt(this,"appUserId"),wt(this,"method","GET"),wt(this,"name","getOfferings"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/offerings`}}class qte{constructor(e,r,n){wt(this,"method","GET"),wt(this,"name","getProducts"),wt(this,"appUserId"),wt(this,"productIds"),wt(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`${Ap}/subscribers/${e}/products?id=${r}${n}`}}class zte{constructor(e){wt(this,"method","GET"),wt(this,"name","getCustomerInfo"),wt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}`}}class $te{constructor(){wt(this,"method","GET"),wt(this,"name","getBrandingInfo")}urlPath(){return`${Ap}/branding`}}class Vte{constructor(){wt(this,"method","POST"),wt(this,"name","postCheckoutStart")}urlPath(){return`${Ap}/checkout/start`}}class Hte{constructor(e){wt(this,"method","POST"),wt(this,"name","postCheckoutCalculateTax"),wt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/calculate_taxes`}}class Gte{constructor(e){wt(this,"method","POST"),wt(this,"name","postCheckoutComplete"),wt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/complete`}}class Wte{constructor(e){wt(this,"method","GET"),wt(this,"name","getCheckoutStatus"),wt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Ap}/checkout/${this.operationSessionId}`}}class Kte{constructor(e){wt(this,"method","POST"),wt(this,"name","setAttributes"),wt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/attributes`}}class Yte{constructor(){wt(this,"method","POST"),wt(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class Xte{constructor(e){wt(this,"method","GET"),wt(this,"name","getVirtualCurrencies"),wt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Jb}/${e}/virtual_currencies`}}const MT={};class Jte{constructor(e,r=MT){wt(this,"API_KEY"),wt(this,"httpConfig"),wt(this,"isSandbox"),this.API_KEY=e,this.httpConfig=r,this.isSandbox=X_(e)}getIsSandbox(){return this.isSandbox}async getOfferings(e){return await Ls(new Fte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await Ls(new zte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,r,n){return await Ls(new qte(e,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Ls(new $te,{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 Ls(new Vte,{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 Ls(new Hte(e),{apiKey:this.API_KEY,body:i,httpConfig:this.httpConfig},a)}async postCheckoutComplete(e,r){const n={email:r};return await Ls(new Gte(e),{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await Ls(new Wte(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 Ls(new Kte(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 Ls(new Yte,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async getVirtualCurrencies(e){return await Ls(new Xte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Qte(t,e){if(!(Mte(t)||qu(t)||jte(t)&&e?.allowPaddleAPIKey))throw new wn(zn.InvalidCredentialsError,"Invalid API key. Use your Web Billing API key.")}function ZO(t){if(!t||new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new wn(zn.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 Zte(t){if(t!=null&&t.endsWith("/"))throw new wn(zn.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function ere(t){if(t){for(const e in t)if(Ute.has(e))throw new wn(zn.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var nF=(t=>(t.Current="current",t))(nF||{});function tre(t,e){async function r(...n){return await this.preload(),await t.call(this,...n)}return r}const aF=(t,e)=>{const r={...t.webBillingProduct,presentedOfferingContext:{...t.webBillingProduct.presentedOfferingContext,placementIdentifier:e}};return{...t,webBillingProduct:r,rcBillingProduct:r}},Mu=(t,e)=>t==null?null:aF(t,e),rre=(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,aF(u,r)]));return{...i,packagesById:o,availablePackages:Object.values(o),weekly:Mu(i.weekly,r),monthly:Mu(i.monthly,r),twoMonth:Mu(i.twoMonth,r),threeMonth:Mu(i.threeMonth,r),sixMonth:Mu(i.sixMonth,r),annual:Mu(i.annual,r),lifetime:Mu(i.lifetime,r)}};function nre(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=_Z(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&&rr.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 are=1000001;function ire(t){return t.webBillingProduct.defaultPurchaseOption}function eN(t,e,r,n=!1){return r.translate(It.PaywallVariablesPricePerPeriod,{formattedPrice:t,period:e.base.period?r.translatePeriod(e.base.period.number,e.base.period.unit,{noWhitespace:!0,short:!n}):""})}function sre(t,e){return t.unit==="year"?e.translatePeriod(t.number*12,xa.Month):e.translatePeriod(t.number,t.unit)}function ore({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 cre({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 tN({price:t,period:e,full:r=!1,translator:n}){if(!e||!e.number||e.unit===xa.Month&&e.number==1)return n.formatPrice(t.amountMicros,t.currency);let a="";switch(e.unit){case xa.Year:a=n.formatPrice(t.amountMicros/12,t.currency);break;case xa.Month:a=n.formatPrice(t.amountMicros/e.number,t.currency);break;case xa.Week:a=n.formatPrice(t.amountMicros*4/e.number,t.currency);break;case xa.Day:a=n.formatPrice(t.amountMicros*30/e.number,t.currency);break}return n.translate(It.PaywallVariablesTotalPriceAndPerMonth,{formattedPrice:n.formatPrice(t.amountMicros,t.currency),period:n.translatePeriod(e.number,e.unit,{noWhitespace:!0,short:!r}),formattedPricePerMonth:a,monthPeriod:n.translatePeriodUnit(xa.Month,{noWhitespace:!0,short:!r})})}function lre(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]=ure(i,n,e),a),{})}function ure(t,e,r){const n=t.webBillingProduct,a=n.price||n.price,i=r.formatPrice(a.amountMicros,a.currency),o=ire(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===td.Subscription&&o){u.price_per_period=eN(i,o,r),u.price_per_period_full=eN(i,o,r,!0);const d=n.period||o.base.period;u.total_price_and_per_month=tN({price:a,period:d,translator:r}),u.total_price_and_per_month_full=tN({price:a,period:d,full:!0,translator:r}),u.sub_price_per_month=cre({price:a,period:d,translator:r}),u.sub_price_per_week=ore({price:a,period:d,translator:r}),u.sub_duration=r.translatePeriod(d?.number,d?.unit),u.sub_duration_in_months=sre(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(It.PaywallVariablesSubRelativeDiscount,{discount:m})}return(c===td.NonConsumable||c===td.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(It.PeriodsLifetime),u.sub_duration_in_months=r.translate(It.PeriodsLifetime),u.sub_period=r.translate(It.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 rN(t){for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256)}function Fm(){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):rN(e)}catch{rN(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 dre=/(%?)(%([sdijo]))/g;function fre(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 oP(t,...e){if(e.length===0)return t;let r=0,n=t.replace(dre,(a,i,o,c)=>{const u=e[r],d=fre(u,c);return i?a:(r++,d)});return r<e.length&&(n+=` ${e.slice(r).join(" ")}`),n=n.replace(/%{2,2}/g,"%"),n}var pre=2;function hre(t){if(!t.stack)return;const e=t.stack.split(`
`);e.splice(1,pre),t.stack=e.join(`
`)}var mre=class extends Error{constructor(t,...e){super(t),this.message=t,this.name="Invariant Violation",this.message=oP(t,...e),hre(this)}},iF=(t,e,...r)=>{if(!t)throw new mre(e,...r)};iF.as=(t,e,r,...n)=>{if(!e){const a=n.length===0?r:oP(r,...n);let i;try{i=Reflect.construct(t,[a])}catch{i=t(a)}throw i}};const gre="[MSW]";function yre(t,...e){const r=oP(t,...e);return`${gre} ${r}`}function vre(t,...e){}function _re(t,...e){}const bre={formatMessage:yre,warn:vre,error:_re};function kre(){iF(typeof URL<"u",bre.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 sF=(t=>(t.HEAD="HEAD",t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH",t.OPTIONS="OPTIONS",t.DELETE="DELETE",t))(sF||{});kre();class wre{constructor(e,r,n,a){wt(this,"initialDelay"),wt(this,"maxDelay"),wt(this,"jitterPercent"),wt(this,"callback"),wt(this,"currentDelay"),wt(this,"timeoutId"),wt(this,"executingCallback",!1),this.initialDelay=e,this.currentDelay=e,this.maxDelay=r,this.jitterPercent=n,this.callback=a}tryFlush(){if(this.backingOff()){rr.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);rr.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){rr.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 oF(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]=oF(a):e[n]=a}return e}class Sre{constructor(e){wt(this,"EVENT_TYPE","web_billing"),wt(this,"id"),wt(this,"timestampMs"),wt(this,"data"),this.id=Fm(),this.timestampMs=Date.now(),this.data=e}toJSON(){return oF({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 Ere(t,e){const r=new URLSearchParams(window.location.search);return{libraryName:"purchases-js",libraryVersion:WU,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 Tre=2e3,Cre=5*6e4,xre=.1;class Pre{constructor(e){wt(this,"apiKey"),wt(this,"eventsQueue",[]),wt(this,"eventsUrl"),wt(this,"flushManager"),wt(this,"traceId",Fm()),wt(this,"appUserId"),wt(this,"isSilent"),wt(this,"rcSource"),this.apiKey=e.apiKey,this.eventsUrl=`${Dte}/v1/events`,this.appUserId=e.appUserId,this.isSilent=e.silent||!1,this.rcSource=e.rcSource,this.flushManager=new wre(Tre,Cre,xre,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){rr.verboseLog("Skipping event tracking, the EventsTracker is silent");return}try{const r=new Sre({eventName:e.eventName,traceId:this.traceId,appUserId:this.appUserId,context:Ere(e.source,this.rcSource),properties:e.properties||{}});this.eventsQueue.push(r),this.flushManager.tryFlush()}catch{rr.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:sF.POST,headers:rF(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 rr.debugLog("Events failed to flush due to server error"),new Error("Events failed to flush due to server error")}).catch(r=>{throw rr.debugLog("Error while flushing events"),r})}}const Are=()=>{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},Rre=["app","embedded"],Yw={autoCollectUTMAsMetadata:!0,collectAnalyticsEvents:!0};var Dre=dt('<p class="svelte-11vxb6p"><strong>Free Trial:</strong> </p>'),Ore=dt('<p class="svelte-11vxb6p"><strong>Intro Price:</strong> </p>'),Nre=dt('<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 Ire={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 Mre(t,e){Xt(e,!1),Vt(t,Ire);let r=jt(e,"productIdentifier",8),n=jt(e,"productType",8),a=jt(e,"basePrice",8),i=jt(e,"freeTrialPeriod",8,void 0),o=jt(e,"introPriceFormatted",8,void 0),c=jt(e,"onValidPurchase",8),u=jt(e,"onFailedPurchase",8),d=jt(e,"onCancel",8);function f(U){U.target===U.currentTarget&&d()()}Es();var h=Nre(),m=Ue(h),_=Ue(m),w=Et(Ue(_),2),b=Ue(w),E=Ue(b),T=Et(Ue(E)),D=Et(E,2),P=Et(Ue(D)),A=Et(D,2),C=Et(Ue(A)),O=Et(A,2);{var I=U=>{var Y=Dre(),F=Et(Ue(Y));_t(()=>hr(F,` ${i()??""}`)),ke(U,Y)};At(O,U=>{i()&&U(I)})}var x=Et(O,2);{var R=U=>{var Y=Ore(),F=Et(Ue(Y));_t(()=>hr(F,` ${o()??""}`)),ke(U,Y)};At(x,U=>{o()&&U(R)})}var N=Et(w,2),L=Ue(N),j=Et(L,2),q=Et(j,2);_t(()=>{hr(T,` ${r()??""}`),hr(P,` ${n()??""}`),hr(C,` ${a()??""}`)}),Bo("click",L,function(...U){var Y;(Y=c())==null||Y.apply(this,U)}),Bo("click",j,function(...U){var Y;(Y=u())==null||Y.apply(this,U)}),Bo("click",q,function(...U){var Y;(Y=d())==null||Y.apply(this,U)}),Bo("click",h,f),ke(t,h),Jt()}async function cF(t,e,r){const n=new Date,a=`test_${n.getTime()}_${Fm()}`,i=`test_store_operation_session_${Fm()}`,o={storeTransactionId:a,productIdentifier:t.identifier,purchaseDate:n},c=await e.postReceipt(r,t.identifier,t.price.currency,a,t.presentedOfferingContext,"purchase");return{customerInfo:HU(c),redemptionInfo:null,operationSessionId:i,storeTransaction:o}}function jre(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&&Kv(w),document.body.removeChild(m)};let w=null;w=ET(Mre,{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 cF(n,e,r))}catch(b){f(b)}},onFailedPurchase:()=>{_(),f(new wn(zn.ProductNotAvailableForPurchaseError,"Simulated test purchase failure: no real transaction occurred"))},onCancel:()=>{_(),f(new wn(zn.UserCancelledError))}}})})}class Lre{constructor(){wt(this,"virtualCurrenciesCache",new Map),wt(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 Bre(t){return{balance:t.balance,name:t.name,code:t.code,serverDescription:t.description??null}}function Ure(t){const e={};for(const[r,n]of Object.entries(t.virtual_currencies))e[r]=Bre(n);return{all:e}}const nN="$RCAnonymousID:";var lF,Zv;lF=[tre];const Kh=class ii{constructor(e,r,n=MT,a=Yw){oW(Zv,5,this),wt(this,"_API_KEY"),wt(this,"_appUserId"),wt(this,"_brandingInfo",null),wt(this,"_loadingResourcesPromise",null),wt(this,"_flags"),wt(this,"backend"),wt(this,"purchaseOperationHelper"),wt(this,"eventsTracker"),wt(this,"inMemoryCache"),this._API_KEY=e,this._appUserId=r,this._flags={...Yw,...a},X_(e)?rr.debugLog("Initializing Purchases SDK with Web billing sandbox API Key"):qu(e)&&rr.debugLog("Initializing Purchases SDK with RC Test store API Key."),this.eventsTracker=new Pre({apiKey:this._API_KEY,appUserId:this._appUserId,silent:!this._flags.collectAnalyticsEvents,rcSource:this._flags.rcSource??null}),this.backend=new Jte(this._API_KEY,n),this.inMemoryCache=new Lre,this.purchaseOperationHelper=new FK(this.backend,this.eventsTracker),this.eventsTracker.trackSDKEvent({eventName:vi.SDKInitialized})}static setLogLevel(e){rr.setLogLevel(e)}static setLogHandler(e){rr.setLogHandler(e)}static setPlatformInfo(e){ii._platformInfo=e}static getPlatformInfo(){return ii._platformInfo}static getSharedInstance(){if(ii.isConfigured())return ii.instance;throw new BK}static isConfigured(){return ii.instance!==void 0}static configure(e,r,n,a){ii.instance!==void 0&&rr.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 wn(zn.ConfigurationError,"API key must be provided as a string");if(typeof r!="string")throw new wn(zn.ConfigurationError,"App user ID must be provided as a string");i={apiKey:e,appUserId:r,httpConfig:n,flags:a}}return ii.configureInternal(i),ii.getSharedInstance()}static configureInternal(e){const{apiKey:r,appUserId:n,httpConfig:a,flags:i}=e,o=a??MT,c=i??Yw;ii.validateConfig(e),ii.instance=new ii(r,n,o,c)}static validateConfig(e){var r,n;Qte(e.apiKey,e.flags),ZO(e.appUserId),Zte((r=e.httpConfig)==null?void 0:r.proxyURL),ere((n=e.httpConfig)==null?void 0:n.additionalHeaders)}async preload(){if(this.hasLoadedResources()){rr.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){rr.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.fetchAndCacheBrandingInfo().catch(e=>{let r=`${e}`;e instanceof wn&&(r=`${e.message}. ${e.underlyingErrorMessage?`Underlying error: ${e.underlyingErrorMessage}`:""}`),rr.errorLog(`Error fetching branding info: ${r}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}async fetchAndCacheBrandingInfo(){if(qu(this._API_KEY)){rr.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=`${are}`,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 Wb({},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)||Bf})},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=lre(a,o);return new Promise((m,_)=>{ET(IX,{target:n,props:{paywallData:a.paywall_components,selectedLocale:i,onNavigateToUrlClicked:u,onVisitCustomerCenterClicked:f,onBackClicked:()=>{if(e.onBack){e.onBack();return}n.innerHTML="",rr.debugLog("Purchase cancelled by user"),_(new wn(zn.UserCancelledError))},onRestorePurchasesClicked:d,onPurchaseClicked:w=>{c(w).then(b=>{m(b)}).catch(b=>_(b))},onError:w=>_(w),variablesPerPackage:h}})})}async getOfferings(e){bte(e?.currency);const r=this._appUserId,n=await this.backend.getOfferings(r),a=e?.offeringIdentifier===nF.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:rre(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),nre(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=Bf,defaultLocale:u=Bf,skipSuccessPage:d=!1}=e;if(qu(this._API_KEY)){const A=await jre(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;rr.debugLog(`Presenting purchase form for package ${n.identifier}`);const _=c||u,w=a??n.webBillingProduct.defaultPurchaseOption,b=ZJ({appearance:(r=this._brandingInfo)==null?void 0:r.appearance,rcPackage:n,purchaseOptionToUse:w,customerEmail:o});this.eventsTracker.trackSDKEvent(b);const E={...this._flags.autoCollectUTMAsMetadata?Are():{},...e.metadata||{}};let T=null;const D=this._brandingInfo;D&&e.brandingAppearanceOverride&&(D.appearance=e.brandingAppearanceOverride);const P=i!==void 0;return new Promise((A,C)=>{P||window.history.pushState({checkoutOpen:!0},"");const O=this._flags.rcSource&&Rre.includes(this._flags.rcSource)?void 0:()=>{const I=tQ();this.eventsTracker.trackSDKEvent(I),window.removeEventListener("popstate",O),T&&Kv(T),h.innerHTML="",rr.debugLog("Purchase cancelled by user"),C(new wn(zn.UserCancelledError))};!P&&O&&window.addEventListener("popstate",O),T=ET(kte,{target:h,props:{isInElement:P,appUserId:m,rcPackage:n,purchaseOption:w,customerEmail:o,onFinished:async I=>{const x=eQ({redemptionInfo:I.redemptionInfo});this.eventsTracker.trackSDKEvent(x),this.inMemoryCache.invalidateAllCaches(),rr.debugLog("Purchase finished"),T&&Kv(T),h.innerHTML="";const R={customerInfo:await this._getCustomerInfoForUserId(m),redemptionInfo:I.redemptionInfo,operationSessionId:I.operationSessionId,storeTransaction:{storeTransactionId:I.storeTransactionIdentifier,productIdentifier:n.webBillingProduct.identifier,purchaseDate:I.purchaseDate}};A(R)},onClose:O,onError:I=>{var x;const R=rQ({errorCode:(x=I.errorCode)==null?void 0:x.toString(),errorMessage:I.message});this.eventsTracker.trackSDKEvent(R),T&&Kv(T),h.innerHTML="",C(wn.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 qu(this._API_KEY)}async _postSimulatedStoreReceipt(e){if(!qu(this._API_KEY))throw new wn(zn.ConfigurationError,"Posting a test store receipt is only available for RC Test Store API keys.");return await cF(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 ZO(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&&rr.debugLog(`Could not find product data for product ids:
        ${a.join()}.
        Please check that your product configuration is correct.`)}isSandbox(){return X_(this._API_KEY)||qu(this._API_KEY)}isAnonymous(){return this._appUserId.startsWith(nN)}async getVirtualCurrencies(){return await this._getVirtualCurrenciesForUserId(this._appUserId)}getCachedVirtualCurrencies(){return this.inMemoryCache.getCachedVirtualCurrencies(this._appUserId,!0)}invalidateVirtualCurrenciesCache(){this.inMemoryCache.invalidateVirtualCurrenciesCache(this._appUserId)}close(){ii.instance===this?(this.eventsTracker&&this.eventsTracker.dispose(),ii.instance=void 0):rr.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 HU(r)}async _getVirtualCurrenciesForUserId(e){const r=this.inMemoryCache.getCachedVirtualCurrencies(e);if(r)return rr.debugLog("Vending VirtualCurrencies from cache."),r;const n=await this.backend.getVirtualCurrencies(e),a=Ure(n);return rr.debugLog("VirtualCurrencies updated from the network."),this.inMemoryCache.cacheVirtualCurrencies(e,a),a}static generateRevenueCatAnonymousAppUserId(){return`${nN}${Fm().replace(/-/g,"")}`}_trackEvent(e){this.eventsTracker.trackExternalEvent(e)}};Zv=aW(),cW(Zv,1,"purchase",lF,Kh),sW(Zv,Kh),wt(Kh,"_platformInfo"),wt(Kh,"instance");let lm=Kh;function Fre(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 jT(t){const e=t==="web"?K7:t==="ios"?X7:Y7;if(!e)throw new Error(`RevenueCat SDK key missing for ${t}. Add VITE_RC_API_KEY_* and restart.`);return Fre(t,String(e)),String(e)}function qre(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 Al=null,_f=null,qm=null;function zre(t){const e=(t??"").toString();return{length:e.length,empty:e.length===0}}function $re(t){return t?String(t).slice(0,4):null}async function Vre(t){return Al||_f||(_f=(async()=>{const e=Wr.getPlatform();if(e==="web"){const n=jT("web");if(typeof lm?.configure!="function")throw new Error("[RC] Web SDK load failed");try{await lm.configure({apiKey:n,appUserId:t,observerMode:!1});try{J_()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Al={platform:"web",Purchases:lm},Al}const r=jT(e==="ios"?"ios":"android");try{const a=(await zr(()=>import("./index-BL33b6vT.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{J_()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Al={platform:"native",Purchases:a},Al}catch(n){throw n}})().catch(e=>{throw _f=null,e}),_f)}async function cP(t){const e=qre(t),r=await Vre(e);if(qm!==e){try{const n=r.Purchases;typeof n?.logIn=="function"&&(r.platform==="native"?await n.logIn({appUserID:e}):await n.logIn(e));try{J_()}catch{}}catch{}qm=e}return r}function Mi(){const t=Al;if(!t?.Purchases){if(Wr.getPlatform()==="web")try{const o=lm;if(typeof o?.getSharedInstance=="function"){const c=o.getSharedInstance();if(c)return c}return null}catch{}return null}const e=Wr.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=$re(jT(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 J_(){Wr.getPlatform(),zre(qm);try{Fo.getInfo().then(t=>{}).catch(()=>{})}catch{}}async function bf(){if(!qm)throw new Error("Cannot reconfigure RevenueCat before user identification.");return Al=null,_f=null,cP(qm)}const Hre=Object.freeze(Object.defineProperty({__proto__:null,getPurchases:Mi,initRevenueCat:cP,logRevenueCatConfig:J_,reconfigureRevenueCat:bf},Symbol.toStringTag,{value:"Module"})),aN=_3,Gre=b3,Wre=k3,Kre=String(J7).toLowerCase()==="true",e_={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 Xw(t,e){try{const r=e?.getErrorCode?.()??e?.errorCode??e?.code,n=typeof r=="number"?e_[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(Kre){const c=e?.extra?{...e.extra}:void 0}}catch{}}const uF=v.createContext({rc:null,ready:!1,error:null,buyChips:async()=>{},buySubscription:async()=>{},restorePurchases:async()=>{}});function Yre({children:t}){const{user:e,refreshUser:r}=Vr(),[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 cP(e.id);let O=!1;const I=1e3,x=Date.now();for(;!A;){const N=Mi()||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?.[aN]?A.all[aN]:A?.current||A?.all?.default||null,[]),h=v.useCallback(A=>{const C=[],O=x=>{if(Array.isArray(x))for(const R of x){const N=R?.identifier||R?.product?.identifier;N&&(C.find(L=>(L?.identifier||L?.product?.identifier)===N)||C.push(R))}};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 R=O.find(N=>N?.identifier===Gre);if(R)return R}{const R=O.find(N=>N?.product?.identifier===Wre);if(R)return R}const I=O.find(R=>_(R));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 R=O.find(L=>m(L));if(R)return R;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=Mi();if(!A?.getOfferings||!A?.purchasePackage)try{await bf(),A=Mi()}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 bf();const R=Mi();if(!R?.purchasePackage)throw I;await R.purchasePackage(O),d();return}catch{}throw I}}catch(I){Xw("[RC] purchasePackage(chips)",I);const x=I?.getErrorCode?.()??I?.errorCode??I?.code,R=typeof x=="number"?e_[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 (${R}${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=Mi();if(!A?.getOfferings||!A?.purchasePackage)try{await bf(),A=Mi()}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 bf();const R=Mi();if(!R?.purchasePackage)throw I;await R.purchasePackage(O),d();return}catch{}throw I}}catch(I){Xw("[RC] purchasePackage(subscription)",I);const x=I?.getErrorCode?.()??I?.errorCode??I?.code,R=typeof x=="number"?e_[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 (${R}${typeof x=="number"?` ${x}`:""}${N?` | backend ${N}`:""}).${L}`)}},[i,b,d]),D=v.useCallback(async()=>{if(!i)throw new Error("RevenueCat not ready");let A=Mi();if(!A?.getCustomerInfo||!A?.syncPurchases)try{await bf(),A=Mi()}catch{}try{const C=await A?.getCustomerInfo?.();if(!A?.syncPurchases)throw new Error("Restore Purchases not initialized");await A?.syncPurchases(),d()}catch(C){Xw("[RC] restorePurchases",C);const O=C?.getErrorCode?.()??C?.errorCode??C?.code,I=typeof O=="number"?e_[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:D}),[n,i,c,E,T,D]);return g.jsx(uF.Provider,{value:P,children:t})}function Xre(){return v.useContext(uF)}function Jre({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 Qre=0,Zre=1800,la={diceRevealDelayMs:Qre,diceSettleClientMs:Zre,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 pv=null;async function dF(){if(pv)return pv;const t=await zr(()=>import("./lottie-CGgLB2qZ.js").then(e=>e.l),[],import.meta.url);return pv=t?.default&&t.default.loadAnimation?t.default:t,pv}let hv=null,mv=null;async function LT(t){if(t==="win"&&hv)return hv;if(t==="lose"&&mv)return mv;if(t==="win"){const e=await zr(()=>import("./winning-lottie-NODzSKgp.js"),[],import.meta.url);return hv=e.default||e,hv}else{const e=await zr(()=>import("./lose-lottie-DRt9PYrq.js"),[],import.meta.url);return mv=e.default||e,mv}}const lP=v.createContext(null),ene={win:void 0,lose:void 0,push:void 0,roll:void 0,info:void 0},tne=typeof window<"u"&&window.requestIdleCallback||(t=>setTimeout(t,50));function rne(){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 iN(){tne(async()=>{try{await dF(),await Promise.allSettled([LT("win"),LT("lose")])}catch{}})}function sN(){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 nne(t,e,r,n){return typeof e=="boolean"?e:n?!1:t==="lose"&&typeof r!="number"}function ane(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 ine(){try{return document.querySelector(".card-header.card-header--two-rows")}catch{return null}}function Jw(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 sne(){v.useEffect(()=>{if(iN(),typeof window>"u")return;const t=()=>{iN(),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 one(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 cne(t){v.useEffect(()=>{let e=!1;const r=async()=>{try{if(!Dx())try{await Lr()}catch{}const a=t==="win"?["winDing","win"]:t==="lose"?["lose"]:t==="push"?["push"]:[];if(a.length){try{np(a)}catch{}try{await O_(a,600)}catch{}}if(e)return;t==="lose"?LG({volume:.06}):t==="win"?UG({volume:.25}):t==="push"&&BG({volume:.04})}catch{}},n=window.setTimeout(()=>{r()},10);return()=>{e=!0,window.clearTimeout(n)}},[t])}function lne(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 dF(),h=a||(r?i[r]:void 0)||await LT(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 une({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]);cne(t.kind),one(t.id,t.duration,f);const h=v.useMemo(rne,[]),m=t.kind==="win"||t.kind==="lose";lne({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:Jw(T)})]})})():Jw(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:Jw(t.subtitle)}),t.viral&&g.jsx(Jre,{viral:t.viral,onClose:()=>{}})]})]})}function dne({children:t,baseDurationMs:e=la.flash.baseMs}){const[r,n]=v.useState([]),a=v.useRef(new Set),i=v.useRef({...ene});sne();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"?sN():{isCeeLo:!1}).isCeeLo,E=typeof m.duration=="number"?m.duration:b&&(m.kind==="win"||m.kind==="lose")?la.flash.ceeLoShortMs:m.kind==="win"?la.flash.winMs:e,T={id:_,dismissible:!0,autoDismissOnComplete:nne(m.kind,m.autoDismissOnComplete,m.duration,b),...m,duration:E};try{const D=typeof location<"u"?new URLSearchParams(location.search):null;if(D&&D.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{IG({volume:.15})}catch{}return n(D=>[...D,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=sN(),_=ine();return r.map((w,b)=>{const T=ane(w,m)&&_?_:document.body,D=T!==document.body,P=2e3+b;return Wc.createPortal(g.jsxs("div",{className:"flash-root"+(D?" flash-root--header":""),"aria-live":"polite","data-testid":"flash-overlay-root",children:[g.jsx(une,{item:w,onDone:o,animations:i.current,zIndex:P}),g.jsx("div",{className:"flash-backdrop"})]},w.id),T)})},[r,o]);return g.jsxs(lP.Provider,{value:f,children:[t,h]})}function Cs(){const t=v.useContext(lP);if(!t)throw new Error("useFlashOverlay must be used within <FlashOverlayProvider>");return t}function uP(){const t=v.useContext(lP);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 oN=_3,fne=b3,pne=k3,hne=r9,cN=w3;function Lg(){const{user:t,refreshUser:e}=Vr(),{rc:r,ready:n,error:a,buyChips:i,buySubscription:o,restorePurchases:c}=Xre(),{infoNow:u}=Cs(),[d,f]=v.useState(!1),[h,m]=v.useState(!1),[_,w]=v.useState(!1),[b,E]=v.useState(!1),[T,D]=v.useState(!1),[P,A]=v.useState(void 0),[C,O]=v.useState(void 0),[I,x]=v.useState(void 0),[R,N]=v.useState(void 0),[L,j]=v.useState(void 0),[q,U]=v.useState(void 0),[Y,F]=v.useState(!1),X=Wr.getPlatform()==="web",J=ui(),ee=!0,H=v.useMemo(()=>r?.Purchases,[r]);v.useCallback(ce=>ce?.all?.[oN]?ce.all[oN]:ce?.current||ce?.all?.default||null,[]);const B=v.useCallback(async()=>{try{const Re=await Mi()?.getCustomerInfo?.();let He=!1;const ie=Re?.entitlements?.active||{},xe=Object.keys(ie).length>0;cN&&(He=!!ie?.[cN]||xe),D(He)}catch{}},[H,ee]);v.useEffect(()=>{n&&ee&&B()},[n,ee,B]),v.useEffect(()=>{if(!n||!ee)return;let ce=0;const Re=6,He=setInterval(()=>{ce+=1,B(),ce>=Re&&clearInterval(He)},500);return()=>clearInterval(He)},[n,ee,B]),v.useEffect(()=>{let ce=!1;return(async()=>{try{if(!n||!ee)return;const He=await Mi()?.getOfferings?.();if(!He)return;const ie=[],xe=at=>{Array.isArray(at)&&at.forEach(Ke=>{Ke&&ie.push(Ke)})};xe(He?.current?.availablePackages||He?.current?.packages),He?.all&&Object.values(He.all).forEach(at=>xe(at?.availablePackages||at?.packages));const re=at=>at?.identifier||at?.product?.identifier||at?.rcBillingProduct?.identifier||at?.webBillingProduct?.identifier,G=at=>at?.product||at?.rcBillingProduct||at?.webBillingProduct||at,ve=at=>{const Ke=G(at);return!!(at?.packageType==="MONTHLY"||at?.packageType==="ANNUAL"||Ke?.subscriptionPeriod||Ke?.period||Ke?.defaultSubscriptionOption||Ke?.productType&&/subscription/i.test(String(Ke.productType)))},Oe=at=>at?.priceString||at?.price?.formattedPrice||at?.currentPrice?.formattedPrice||at?.price||at?.defaultPurchaseOption?.basePrice?.formattedPrice,he=at=>String(at?.title||at?.displayName||""),Ce=at=>String(at?.description||""),st=at=>at?ie.find(Ke=>re(Ke)===at):void 0;let Ne=st(fne)||st(pne);if(Ne||(Ne=ie.find(at=>!ve(at))),Ne){const at=G(Ne),Ke=Oe(at),it=he(at),mt=Ce(at),Je=String(re(Ne)||""),ue=Me=>{const tt=Me.match(/\b(\d{1,3}(?:[\,\._\s]\d{3})*|\d{2,})\b/);if(!tt)return null;const rt=tt[1].replace(/[\._\s,]/g,""),be=parseInt(rt,10);return Number.isFinite(be)?be:null},Be=ue(it)??ue(mt)??ue(Je),je=Be&&Be>0?Be:void 0,ot=je?new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(je):void 0,Pt=ot?`z${ot}`:"Z Credits",Ft=Ke?`${Pt} for ${Ke}`:void 0;ce||A(Ft),ce||x("Top up your Z Credits to keep playing.")}let St=st(hne);if(St||(St=ie.find(it=>it?.packageType==="MONTHLY"||/month/i.test(String(re(it)||""))||/month/i.test(he(G(it))))||ie.find(it=>ve(it)||/year|annual|week|month/i.test(String(re(it)||"")))),ce||F(!!St),St){const at=G(St),Ke=Oe(at),it=Ke?`${Ke} Mo`:void 0;if(ce||O(it),ce||N("Remove ads and unlock premium features."),ce||j(Ke),!ce){let mt="Auto-renewing";const Je=St?.packageType||at?.subscriptionPeriod||at?.period||at?.defaultSubscriptionOption?.period,ue=String(Je||"").toUpperCase();ue.includes("MONTH")||ue==="MONTHLY"||ue==="P1M"?mt="Monthly":ue.includes("YEAR")||ue==="ANNUAL"||ue==="P1Y"?mt="Annual":ue.includes("WEEK")||ue==="WEEKLY"||ue==="P1W"?mt="Weekly":(ue.includes("DAY")||ue==="P1D")&&(mt="Daily"),U(mt)}}}catch{}})(),()=>{ce=!0}},[n,ee,H]);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(ce){let Re=ce?.message||"Purchase unavailable right now. Please try again shortly.";try{const He=ce?.getErrorCode?.()??ce?.errorCode??ce?.code,ie=typeof He=="number"?He===3?"PurchaseNotAllowedError":He===2?"StoreProblemError":He===5?"ProductNotAvailableForPurchaseError":void 0:void 0;ie==="PurchaseNotAllowedError"?Re="Purchases not allowed for this Apple ID/device. Use an App Store sandbox account and ensure the Paid Apps Agreement is accepted.":ie==="StoreProblemError"?Re="App Store is currently unavailable. Please try again later or verify sandbox account is signed in to the device.":ie==="ProductNotAvailableForPurchaseError"&&(Re="Product not available. Verify the product identifier matches App Store Connect and RevenueCat configuration for this app target.")}catch{}u("Purchase failed",Re)}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 zr(async()=>{const{reconfigureRevenueCat:ce}=await Promise.resolve().then(()=>Hre);return{reconfigureRevenueCat:ce}},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 ce=await li();ce&&await fetch(`${J}/api/payment/revenuecat/restore`,{method:"POST",headers:{Authorization:`Bearer ${ce}`}})}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)}},pe=v.useMemo(()=>!n||!ee?"Initializing…":T?"Premium Active":"Go Premium",[T,n,ee]);return{ready:n,error:a||null,busy:d,busyChips:h,busySubscription:_,premiumActive:T,hasPremiumPackage:Y,premiumLabel:pe,purchasesReady:ee,isWeb:X,onBuyChips:K,onGoPremium:ae,onRestore:te,chipsSubtitle:P,premiumSubtitle:C,chipsDescription:I,premiumDescription:R,premiumPrice:L,premiumInterval:q}}var um;(function(t){t.Heavy="HEAVY",t.Medium="MEDIUM",t.Light="LIGHT"})(um||(um={}));var lN;(function(t){t.Success="SUCCESS",t.Warning="WARNING",t.Error="ERROR"})(lN||(lN={}));const Yh=io("Haptics",{web:()=>zr(()=>import("./web-B6xrwWdW.js"),[],import.meta.url).then(t=>new t.HapticsWeb)}),mne={Light:um.Light,Medium:um.Medium,Heavy:um.Heavy},gne={Light:10,Medium:20,Heavy:35};async function ld(t="Light"){try{await Yh.impact({style:mne[t]});return}catch{}try{navigator.vibrate?.(gne[t])}catch{}}function ar(t="Light"){ld(t)}async function fF(){try{if(Yh?.selectionStart){await Yh.selectionStart(),await Yh.selectionChanged(),await Yh.selectionEnd();return}}catch{}await ld("Light")}const yne=Object.freeze(Object.defineProperty({__proto__:null,hapticClick:ar,hapticImpact:ld,hapticSelection:fF},Symbol.toStringTag,{value:"Module"}));function dP({isPremium:t,className:e}){const[r,n]=v.useState(!1),{onGoPremium:a,busy:i,ready:o,purchasesReady:c}=Lg();if(!t)return null;const u=async()=>{try{n(!0);try{ar("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 pF({open:t,onClose:e,featureDescription:r}){const{user:n}=Vr(),{onGoPremium:a,onRestore:i,busy:o,premiumActive:c,hasPremiumPackage:u,premiumLabel:d,error:f,ready:h,purchasesReady:m,premiumPrice:_,premiumInterval:w}=Lg(),b=rn(),{infoNow:E}=Cs(),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 D=!!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:D?o?"Processing…":d:"Sign in to Upgrade"}),c&&g.jsx("div",{style:{marginTop:12},children:g.jsx(dP,{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:!D||o||!h||!m,"aria-label":"Restore Purchases",title:"Restore Purchases",children:"Restore Purchases"})}),!D&&!c&&g.jsx("p",{className:"meta",children:"Please sign in to upgrade."}),!D&&f&&g.jsx("p",{className:"meta",children:"Purchases unavailable while signed out."})]})})}function fP({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=rn(),{user:m,loading:_}=Vr(),w=v.useMemo(()=>{if(_)return!1;const A=m?.email||"";return!A||/@guest\.local$/i.test(A)},[m?.email,_]),b=v.useCallback(()=>{try{o&&ys.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),D=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(()=>{D()},[D]),v.useEffect(()=>{if(!t)return;const A=()=>D(),C=()=>D();window.addEventListener("resize",A),window.addEventListener("scroll",C,!0);const O=setInterval(D,400);return()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",C,!0),clearInterval(O)}},[t,D]),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&&ys.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 uN=""+new URL("logo-XCMDZE3A.png",import.meta.url).href,vne=""+new URL("logo-256-CalulGNO.webp",import.meta.url).href,_ne=""+new URL("logo-420-D7JbtaQr.webp",import.meta.url).href,bne=""+new URL("logo-256-BQd-RHpb.avif",import.meta.url).href,kne=""+new URL("logo-420-CxzlrsyU.avif",import.meta.url).href;function hF({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=uN}catch{}}})]}):g.jsxs("picture",{children:[g.jsx("source",{type:"image/avif",srcSet:`${bne} 256w, ${kne} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("source",{type:"image/webp",srcSet:`${vne} 256w, ${_ne} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("img",{width:t,height:e,src:uN,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 mF({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 gF({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(mF,{})]})}):null}function wne(){const{user:t}=Vr(),[e,r]=v.useState(null),[n,a]=v.useState(!1),[i,o]=v.useState(null),c=ui(),u=v.useCallback(async()=>{if(t){a(!0),o(null);try{const d=await li(),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 Sne({open:t,onClose:e}){const{data:r,loading:n,error:a,refresh:i}=wne();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 Ene({open:t,onClose:e,onGoLogin:r,title:n,message:a}){const i=v.useRef(null),o=rn();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 kf=io("CapacitorUpdater",{web:()=>zr(()=>import("./web-DvXMtbXR.js"),[],import.meta.url).then(t=>new t.CapacitorUpdaterWeb)});var gv={exports:{}},Qw,dN;function Qb(){if(dN)return Qw;dN=1;const t="2.0.0",e=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,a=e-6;return Qw={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},Qw}var Zw,fN;function Zb(){if(fN)return Zw;fN=1;var t={};return Zw=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...r)=>{}:()=>{},Zw}var pN;function Bg(){return pN||(pN=1,(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=Qb(),i=Zb();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,D]of _)E=E.split(`${T}*`).join(`${T}{0,${D}}`).split(`${T}+`).join(`${T}{1,${D}}`);return E},b=(E,T,D)=>{const P=w(T),A=h++;i(E,A,T),f[E]=A,u[A]=T,d[A]=P,o[A]=new RegExp(T,D?"g":void 0),c[A]=new RegExp(P,D?"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*$")})(gv,gv.exports)),gv.exports}var eS,hN;function pP(){if(hN)return eS;hN=1;const t=Object.freeze({loose:!0}),e=Object.freeze({});return eS=n=>n?typeof n!="object"?t:n:e,eS}var tS,mN;function yF(){if(mN)return tS;mN=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 tS={compareIdentifiers:e,rcompareIdentifiers:(n,a)=>e(a,n)},tS}var rS,gN;function Ja(){if(gN)return rS;gN=1;const t=Zb(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:r}=Qb(),{safeRe:n,t:a}=Bg(),i=pP(),{compareIdentifiers:o}=yF();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 rS=c,rS}var nS,yN;function Rp(){if(yN)return nS;yN=1;const t=Ja();return nS=(r,n,a=!1)=>{if(r instanceof t)return r;try{return new t(r,n)}catch(i){if(!a)return null;throw i}},nS}var aS,vN;function Tne(){if(vN)return aS;vN=1;const t=Rp();return aS=(r,n)=>{const a=t(r,n);return a?a.version:null},aS}var iS,_N;function Cne(){if(_N)return iS;_N=1;const t=Rp();return iS=(r,n)=>{const a=t(r.trim().replace(/^[=v]+/,""),n);return a?a.version:null},iS}var sS,bN;function xne(){if(bN)return sS;bN=1;const t=Ja();return sS=(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}},sS}var oS,kN;function Pne(){if(kN)return oS;kN=1;const t=Rp();return oS=(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"},oS}var cS,wN;function Ane(){if(wN)return cS;wN=1;const t=Ja();return cS=(r,n)=>new t(r,n).major,cS}var lS,SN;function Rne(){if(SN)return lS;SN=1;const t=Ja();return lS=(r,n)=>new t(r,n).minor,lS}var uS,EN;function Dne(){if(EN)return uS;EN=1;const t=Ja();return uS=(r,n)=>new t(r,n).patch,uS}var dS,TN;function One(){if(TN)return dS;TN=1;const t=Rp();return dS=(r,n)=>{const a=t(r,n);return a&&a.prerelease.length?a.prerelease:null},dS}var fS,CN;function co(){if(CN)return fS;CN=1;const t=Ja();return fS=(r,n,a)=>new t(r,a).compare(new t(n,a)),fS}var pS,xN;function Nne(){if(xN)return pS;xN=1;const t=co();return pS=(r,n,a)=>t(n,r,a),pS}var hS,PN;function Ine(){if(PN)return hS;PN=1;const t=co();return hS=(r,n)=>t(r,n,!0),hS}var mS,AN;function hP(){if(AN)return mS;AN=1;const t=Ja();return mS=(r,n,a)=>{const i=new t(r,a),o=new t(n,a);return i.compare(o)||i.compareBuild(o)},mS}var gS,RN;function Mne(){if(RN)return gS;RN=1;const t=hP();return gS=(r,n)=>r.sort((a,i)=>t(a,i,n)),gS}var yS,DN;function jne(){if(DN)return yS;DN=1;const t=hP();return yS=(r,n)=>r.sort((a,i)=>t(i,a,n)),yS}var vS,ON;function e0(){if(ON)return vS;ON=1;const t=co();return vS=(r,n,a)=>t(r,n,a)>0,vS}var _S,NN;function mP(){if(NN)return _S;NN=1;const t=co();return _S=(r,n,a)=>t(r,n,a)<0,_S}var bS,IN;function vF(){if(IN)return bS;IN=1;const t=co();return bS=(r,n,a)=>t(r,n,a)===0,bS}var kS,MN;function _F(){if(MN)return kS;MN=1;const t=co();return kS=(r,n,a)=>t(r,n,a)!==0,kS}var wS,jN;function gP(){if(jN)return wS;jN=1;const t=co();return wS=(r,n,a)=>t(r,n,a)>=0,wS}var SS,LN;function yP(){if(LN)return SS;LN=1;const t=co();return SS=(r,n,a)=>t(r,n,a)<=0,SS}var ES,BN;function bF(){if(BN)return ES;BN=1;const t=vF(),e=_F(),r=e0(),n=gP(),a=mP(),i=yP();return ES=(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}`)}},ES}var TS,UN;function Lne(){if(UN)return TS;UN=1;const t=Ja(),e=Rp(),{safeRe:r,t:n}=Bg();return TS=(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)},TS}var CS,FN;function Bne(){if(FN)return CS;FN=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 CS=t,CS}var xS,qN;function lo(){if(qN)return xS;qN=1;const t=/\s+/g;class e{constructor(Y,F){if(F=a(F),Y instanceof e)return Y.loose===!!F.loose&&Y.includePrerelease===!!F.includePrerelease?Y:new e(Y.raw,F);if(Y instanceof i)return this.raw=Y.value,this.set=[[Y]],this.formatted=void 0,this;if(this.options=F,this.loose=!!F.loose,this.includePrerelease=!!F.includePrerelease,this.raw=Y.trim().replace(t," "),this.set=this.raw.split("||").map(X=>this.parseRange(X.trim())).filter(X=>X.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const X=this.set[0];if(this.set=this.set.filter(J=>!b(J[0])),this.set.length===0)this.set=[X];else if(this.set.length>1){for(const J of this.set)if(J.length===1&&E(J[0])){this.set=[J];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let Y=0;Y<this.set.length;Y++){Y>0&&(this.formatted+="||");const F=this.set[Y];for(let X=0;X<F.length;X++)X>0&&(this.formatted+=" "),this.formatted+=F[X].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(Y){const X=((this.options.includePrerelease&&_)|(this.options.loose&&w))+":"+Y,J=n.get(X);if(J)return J;const ee=this.options.loose,H=ee?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];Y=Y.replace(H,j(this.options.includePrerelease)),o("hyphen replace",Y),Y=Y.replace(u[d.COMPARATORTRIM],f),o("comparator trim",Y),Y=Y.replace(u[d.TILDETRIM],h),o("tilde trim",Y),Y=Y.replace(u[d.CARETTRIM],m),o("caret trim",Y);let B=Y.split(" ").map(pe=>D(pe,this.options)).join(" ").split(/\s+/).map(pe=>L(pe,this.options));ee&&(B=B.filter(pe=>(o("loose invalid filter",pe,this.options),!!pe.match(u[d.COMPARATORLOOSE])))),o("range list",B);const K=new Map,ae=B.map(pe=>new i(pe,this.options));for(const pe of ae){if(b(pe))return[pe];K.set(pe.value,pe)}K.size>1&&K.has("")&&K.delete("");const te=[...K.values()];return n.set(X,te),te}intersects(Y,F){if(!(Y instanceof e))throw new TypeError("a Range is required");return this.set.some(X=>T(X,F)&&Y.set.some(J=>T(J,F)&&X.every(ee=>J.every(H=>ee.intersects(H,F)))))}test(Y){if(!Y)return!1;if(typeof Y=="string")try{Y=new c(Y,this.options)}catch{return!1}for(let F=0;F<this.set.length;F++)if(q(this.set[F],Y,this.options))return!0;return!1}}xS=e;const r=Bne(),n=new r,a=pP(),i=t0(),o=Zb(),c=Ja(),{safeRe:u,t:d,comparatorTrimReplace:f,tildeTrimReplace:h,caretTrimReplace:m}=Bg(),{FLAG_INCLUDE_PRERELEASE:_,FLAG_LOOSE:w}=Qb(),b=U=>U.value==="<0.0.0-0",E=U=>U.value==="",T=(U,Y)=>{let F=!0;const X=U.slice();let J=X.pop();for(;F&&X.length;)F=X.every(ee=>J.intersects(ee,Y)),J=X.pop();return F},D=(U,Y)=>(o("comp",U,Y),U=O(U,Y),o("caret",U),U=A(U,Y),o("tildes",U),U=x(U,Y),o("xrange",U),U=N(U,Y),o("stars",U),U),P=U=>!U||U.toLowerCase()==="x"||U==="*",A=(U,Y)=>U.trim().split(/\s+/).map(F=>C(F,Y)).join(" "),C=(U,Y)=>{const F=Y.loose?u[d.TILDELOOSE]:u[d.TILDE];return U.replace(F,(X,J,ee,H,B)=>{o("tilde",U,X,J,ee,H,B);let K;return P(J)?K="":P(ee)?K=`>=${J}.0.0 <${+J+1}.0.0-0`:P(H)?K=`>=${J}.${ee}.0 <${J}.${+ee+1}.0-0`:B?(o("replaceTilde pr",B),K=`>=${J}.${ee}.${H}-${B} <${J}.${+ee+1}.0-0`):K=`>=${J}.${ee}.${H} <${J}.${+ee+1}.0-0`,o("tilde return",K),K})},O=(U,Y)=>U.trim().split(/\s+/).map(F=>I(F,Y)).join(" "),I=(U,Y)=>{o("caret",U,Y);const F=Y.loose?u[d.CARETLOOSE]:u[d.CARET],X=Y.includePrerelease?"-0":"";return U.replace(F,(J,ee,H,B,K)=>{o("caret",U,J,ee,H,B,K);let ae;return P(ee)?ae="":P(H)?ae=`>=${ee}.0.0${X} <${+ee+1}.0.0-0`:P(B)?ee==="0"?ae=`>=${ee}.${H}.0${X} <${ee}.${+H+1}.0-0`:ae=`>=${ee}.${H}.0${X} <${+ee+1}.0.0-0`:K?(o("replaceCaret pr",K),ee==="0"?H==="0"?ae=`>=${ee}.${H}.${B}-${K} <${ee}.${H}.${+B+1}-0`:ae=`>=${ee}.${H}.${B}-${K} <${ee}.${+H+1}.0-0`:ae=`>=${ee}.${H}.${B}-${K} <${+ee+1}.0.0-0`):(o("no pr"),ee==="0"?H==="0"?ae=`>=${ee}.${H}.${B}${X} <${ee}.${H}.${+B+1}-0`:ae=`>=${ee}.${H}.${B}${X} <${ee}.${+H+1}.0-0`:ae=`>=${ee}.${H}.${B} <${+ee+1}.0.0-0`),o("caret return",ae),ae})},x=(U,Y)=>(o("replaceXRanges",U,Y),U.split(/\s+/).map(F=>R(F,Y)).join(" ")),R=(U,Y)=>{U=U.trim();const F=Y.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return U.replace(F,(X,J,ee,H,B,K)=>{o("xRange",U,X,J,ee,H,B,K);const ae=P(ee),te=ae||P(H),pe=te||P(B),ce=pe;return J==="="&&ce&&(J=""),K=Y.includePrerelease?"-0":"",ae?J===">"||J==="<"?X="<0.0.0-0":X="*":J&&ce?(te&&(H=0),B=0,J===">"?(J=">=",te?(ee=+ee+1,H=0,B=0):(H=+H+1,B=0)):J==="<="&&(J="<",te?ee=+ee+1:H=+H+1),J==="<"&&(K="-0"),X=`${J+ee}.${H}.${B}${K}`):te?X=`>=${ee}.0.0${K} <${+ee+1}.0.0-0`:pe&&(X=`>=${ee}.${H}.0${K} <${ee}.${+H+1}.0-0`),o("xRange return",X),X})},N=(U,Y)=>(o("replaceStars",U,Y),U.trim().replace(u[d.STAR],"")),L=(U,Y)=>(o("replaceGTE0",U,Y),U.trim().replace(u[Y.includePrerelease?d.GTE0PRE:d.GTE0],"")),j=U=>(Y,F,X,J,ee,H,B,K,ae,te,pe,ce)=>(P(X)?F="":P(J)?F=`>=${X}.0.0${U?"-0":""}`:P(ee)?F=`>=${X}.${J}.0${U?"-0":""}`:H?F=`>=${F}`:F=`>=${F}${U?"-0":""}`,P(ae)?K="":P(te)?K=`<${+ae+1}.0.0-0`:P(pe)?K=`<${ae}.${+te+1}.0-0`:ce?K=`<=${ae}.${te}.${pe}-${ce}`:U?K=`<${ae}.${te}.${+pe+1}-0`:K=`<=${K}`,`${F} ${K}`.trim()),q=(U,Y,F)=>{for(let X=0;X<U.length;X++)if(!U[X].test(Y))return!1;if(Y.prerelease.length&&!F.includePrerelease){for(let X=0;X<U.length;X++)if(o(U[X].semver),U[X].semver!==i.ANY&&U[X].semver.prerelease.length>0){const J=U[X].semver;if(J.major===Y.major&&J.minor===Y.minor&&J.patch===Y.patch)return!0}return!1}return!0};return xS}var PS,zN;function t0(){if(zN)return PS;zN=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(">")))}}PS=e;const r=pP(),{safeRe:n,t:a}=Bg(),i=bF(),o=Zb(),c=Ja(),u=lo();return PS}var AS,$N;function r0(){if($N)return AS;$N=1;const t=lo();return AS=(r,n,a)=>{try{n=new t(n,a)}catch{return!1}return n.test(r)},AS}var RS,VN;function Une(){if(VN)return RS;VN=1;const t=lo();return RS=(r,n)=>new t(r,n).set.map(a=>a.map(i=>i.value).join(" ").trim().split(" ")),RS}var DS,HN;function Fne(){if(HN)return DS;HN=1;const t=Ja(),e=lo();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,GN;function qne(){if(GN)return OS;GN=1;const t=Ja(),e=lo();return OS=(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},OS}var NS,WN;function zne(){if(WN)return NS;WN=1;const t=Ja(),e=lo(),r=e0();return NS=(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},NS}var IS,KN;function $ne(){if(KN)return IS;KN=1;const t=lo();return IS=(r,n)=>{try{return new t(r,n).range||"*"}catch{return null}},IS}var MS,YN;function vP(){if(YN)return MS;YN=1;const t=Ja(),e=t0(),{ANY:r}=e,n=lo(),a=r0(),i=e0(),o=mP(),c=yP(),u=gP();return MS=(f,h,m,_)=>{f=new t(f,_),h=new n(h,_);let w,b,E,T,D;switch(m){case">":w=i,b=c,E=o,T=">",D=">=";break;case"<":w=o,b=u,E=i,T="<",D="<=";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===D||(!O.operator||O.operator===T)&&b(f,O.semver))return!1;if(O.operator===D&&E(f,O.semver))return!1}return!0},MS}var jS,XN;function Vne(){if(XN)return jS;XN=1;const t=vP();return jS=(r,n,a)=>t(r,n,">",a),jS}var LS,JN;function Hne(){if(JN)return LS;JN=1;const t=vP();return LS=(r,n,a)=>t(r,n,"<",a),LS}var BS,QN;function Gne(){if(QN)return BS;QN=1;const t=lo();return BS=(r,n,a)=>(r=new t(r,a),n=new t(n,a),r.intersects(n,a)),BS}var US,ZN;function Wne(){if(ZN)return US;ZN=1;const t=r0(),e=co();return US=(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},US}var FS,eI;function Kne(){if(eI)return FS;eI=1;const t=lo(),e=t0(),{ANY:r}=e,n=r0(),a=co(),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 R of m)if(!n(x,String(R),_))return!1;return!0}let D,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(D=d(b,x,_),D===x&&D!==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 FS=i,FS}var qS,tI;function Yne(){if(tI)return qS;tI=1;const t=Bg(),e=Qb(),r=Ja(),n=yF(),a=Rp(),i=Tne(),o=Cne(),c=xne(),u=Pne(),d=Ane(),f=Rne(),h=Dne(),m=One(),_=co(),w=Nne(),b=Ine(),E=hP(),T=Mne(),D=jne(),P=e0(),A=mP(),C=vF(),O=_F(),I=gP(),x=yP(),R=bF(),N=Lne(),L=t0(),j=lo(),q=r0(),U=Une(),Y=Fne(),F=qne(),X=zne(),J=$ne(),ee=vP(),H=Vne(),B=Hne(),K=Gne(),ae=Wne(),te=Kne();return qS={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:D,gt:P,lt:A,eq:C,neq:O,gte:I,lte:x,cmp:R,coerce:N,Comparator:L,Range:j,satisfies:q,toComparators:U,maxSatisfying:Y,minSatisfying:F,minVersion:X,validRange:J,outside:ee,gtr:H,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},qS}var Xne=Yne();const cf=Sg(Xne),Jne={},Q_="https://updates.dicelounge.app";function Qne(){const e=String("poker").trim().toLowerCase();let r=e==="craps"||e==="ceelo"||e==="poker"?`${Q_}/${e}/manifest.json`:`${Q_}/manifest.json`;r=r.replace(/manifest\.jjson$/i,"manifest.json");try{}catch{}return r}function rI(){return Date.now()}function xh(){try{const e=globalThis.Capacitor?.getPlatform?.();return e==="ios"||e==="android"}catch{return!1}}function nI(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 Zne(t){try{const e=new URL(t);return`${e.protocol}//${e.host}`===Q_}catch{return!1}}async function eae(t){if(!Zne(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 tae(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 aI=globalThis.OTA_PUBLIC_KEY_B64||Jne?.VITE_OTA_PUBKEY||l9,iI=!0,rae=25*1024*1024,nae=/^(\d{12,14}|v?\d+\.\d+\.\d+(?:[-+].+)?)$/;async function aae(){try{let t=Uint8Array.from(atob(aI),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 iae=aae();async function sae(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 iae;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 oae{nativeVersion=null;activeWebVersion=null;pendingUpdateVersion=null;previousWebVersion=null;lastAppliedSha256=null;async init(){if(!xh())return;const e=await Fo.getInfo();this.nativeVersion=e.version;const r=await ys.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 kf.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&&xh())try{e=(await Fo.getInfo()).version||null,this.nativeVersion=e}catch(r){r?.message}e=e||"0.0.0";try{const r=Qne(),a=(await eae(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(iI&&!a.sig)return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(!nae.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=nI(e),o=nI(a.minNativeVersion),c=cf.coerce(o)||"0.0.0",u=cf.coerce(i)||"0.0.0",d=cf.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?cf.valid(f):null,m=cf.valid(a.webVersion);let _=!0;if(f)if(h&&m)_=cf.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(!xh())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>rae)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 tae(f)).toLowerCase()!==e.sha256.toLowerCase())throw e.sha256,new Error("SHA256_MISMATCH");try{const w=new URL(e.url);if(`${w.protocol}//${w.host}`!==Q_)throw new Error("ORIGIN_MISMATCH")}catch{throw new Error("ORIGIN_MISMATCH")}const m=!!e.sig;if(!await sae(e.sig,e)){const w=m?"SIG_INVALID":"SIG_MISSING";if(w==="SIG_MISSING"&&iI)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(!xh())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 kf.download({url:e.url,version:e.webVersion});await kf.set({id:n.id}),this.previousWebVersion,e.webVersion}async healthCheck(){if(!xh())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 kf.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=rI(),n=window;for(;rI()-r<e;){if(n.__APP_MOUNTED__)return!0;await new Promise(a=>setTimeout(a,100))}return!1}async rollbackIfBootFails(){try{await kf.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 ys.set({key:"ota_state",value:JSON.stringify(e)})}}const us=new oae,sI="ota:lastCheckAt",cae=18e4;function lae(){try{const t=globalThis.__E2E_OTA_COOLDOWN_MS;if(typeof t=="number"&&t>=0)return t}catch{}return cae}function uae(){const[t,e]=v.useState(us.getVersions()),[r,n]=v.useState(!1),[a,i]=v.useState(null),[o,c]=v.useState({stage:"idle"}),u=v.useRef(null);v.useEffect(()=>{e(us.getVersions())},[]);const d=v.useCallback(async()=>{n(!0);try{try{const _=Date.now(),w=await Xs.get(sI),b=w?Number(w):0;if(b&&_-b<lae()){n(!1);return}}catch{}const m=await us.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 us.downloadUpdate(m.release,b=>c(b));c({stage:"applying"}),await us.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 Xs.set(sI,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 us.downloadUpdate(m,w=>c(w));c({stage:"applying"}),await us.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 dae({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 fae({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 us.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 us.downloadUpdate(c.release,d=>{});await us.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 Fo.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 pae="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",hae="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 _P(){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 mae({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 zr(async()=>{const{Preferences:_}=await Promise.resolve().then(()=>Ic);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 zr(async()=>{const{Preferences:m}=await Promise.resolve().then(()=>Ic);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 gae(){const{available:t,progress:e,applyNow:r,later:n}=uae(),{membershipModalOpen:a,setMembershipModalOpen:i}=Bb(),o=rn(),{roomsList:c,createRoom:u}=cB(),{pokerCreateRoom:d,getUserBalance:f}=ga(),{logout:h,user:m,refreshUser:_}=Vr(),[w,b]=v.useState(!1),[E,T]=v.useState(!1),[D,P]=v.useState(!1),[A,C]=v.useState(!1),[O,I]=v.useState(!1),[x,R]=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,Y]=v.useState(q??null),[F,X]=v.useState(!1),[J,ee]=v.useState(!1),H=v.useRef(null),{info:B}=cu();v.useEffect(()=>{q||(async()=>{try{const{Preferences:$}=await zr(async()=>{const{Preferences:ct}=await Promise.resolve().then(()=>Ic);return{Preferences:ct}},void 0,import.meta.url),{value:oe}=await $.get({key:"selectedGameMode"});Y(oe==="cee-lo"||oe==="craps"||oe==="poker"?oe:"cee-lo")}catch{Y("cee-lo")}})()},[q]),v.useEffect(()=>{q||U&&(async()=>{try{const{Preferences:$}=await zr(async()=>{const{Preferences:oe}=await Promise.resolve().then(()=>Ic);return{Preferences:oe}},void 0,import.meta.url);await $.set({key:"selectedGameMode",value:U})}catch{}})()},[U,q]);const K=v.useMemo(()=>{const $=q??U;if(!$)return c;const oe=ct=>ct.filter(Nt=>(Nt.gameMode||"cee-lo")===$);return{public:oe(c.public),private:oe(c.private)}},[c,q,U]),ae=v.useRef(null),te=v.useCallback(()=>{ar("Light")},[]),pe=v.useCallback(()=>{try{}catch{}},[]),ce=v.useCallback(()=>{try{Lr()}catch{}},[]),Re=v.useCallback($=>{ce(),$!==U?(te(),pe(),Y($)):(te(),pe())},[U,te,pe,ce]),He=v.useRef(null),ie=v.useRef(null),[xe,re]=v.useState(1),[G,ve]=v.useState(null),Oe=v.useCallback(()=>{const $=ie.current,oe=He.current;if(!$||!oe)return;const ct=$.style.transform;$.style.transform="none";const Nt=$.scrollHeight,Qt=window.innerHeight;let Rt=Math.min(1,Qt/Nt);re(Rt),ve(Nt*Rt),$.style.transform=ct},[]);v.useLayoutEffect(()=>{Oe()},[Oe,U]),v.useEffect(()=>{const $=new ResizeObserver(()=>requestAnimationFrame(Oe)),oe=ie.current;oe&&$.observe(oe),window.addEventListener("resize",Oe);const ct=setTimeout(Oe,250),Nt=setTimeout(Oe,800);return()=>{$.disconnect(),window.removeEventListener("resize",Oe),clearTimeout(ct),clearTimeout(Nt)}},[Oe]);const he=v.useCallback(()=>{o("/profile")},[o]),Ce=v.useCallback(()=>{o("/settings")},[o]),st=v.useCallback(()=>{o("/add-chips")},[o]),Ne=v.useCallback(()=>{o("/login")},[o]),St=v.useCallback(()=>{ce(),te(),pe(),h()},[h,te,pe,ce]),at=async()=>{try{const $=m&&typeof m.balance=="number"?Number(m.balance):null;if($!=null)return $;try{await Promise.resolve(_())}catch{}const oe=m&&typeof m.balance=="number"?Number(m.balance):null;if(oe!=null)return oe}catch{}try{const $=await f?.();if($?.ok&&typeof $.data?.balance=="number")return Number($.data.balance)}catch{}return null},Ke=v.useCallback(async()=>{ce(),te(),pe();try{if(m?.isGuest===!0){R(!0);return}}catch{}if(U==="poker")try{const $=await at();if($!=null&&$<1e3){X(!0);return}}catch{}T(!0)},[ce,te,pe,U,m,_,i,Ne]),it=v.useCallback(async()=>{ce(),te(),pe();try{if(m?.isGuest===!0){R(!0);return}}catch{}if(U==="poker")try{const $=await at();if($!=null&&$<1e3){X(!0);return}}catch{}P(!0)},[ce,te,pe,U,m,_,i,Ne]),mt=v.useCallback(()=>{document.activeElement?.blur?.()},[]),Je=v.useCallback(()=>{mt(),it()},[mt,it]),ue=v.useCallback(()=>{mt(),Ke()},[mt,Ke]),{meId:Be}=Vr(),je=v.useCallback(async()=>{if(ce(),!!U&&!O){I(!0),ee(!0),te(),pe(),H.current&&clearTimeout(H.current),H.current=window.setTimeout(()=>{ee(!1),B("Try again.",{duration:3e3})},15e3);try{let $;U==="poker"?$=await d({name:"Single Player Room",singlePlayer:!0}):$=await u({singlePlayer:!0,name:"Single Player Room",gameMode:U});try{window.location.search.includes("e2e=1")&&(window.__handleCreateSingleRes=$)}catch{}const oe=$?.room??$?.roomsList?.room??$?.data?.room??null,ct=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),Nt=oe?.roomId??oe?.id??$?.roomId??$?.data?.roomId;if(Nt&&oe){H.current&&(clearTimeout(H.current),H.current=null);try{window.__PRESEEDED_ROOM=oe}catch{}const Qt=ct?"?e2e=1":"";o(U==="poker"?`/poker/room/${Nt}${Qt}`:`/room/${Nt}${Qt}`)}else if($?.error){const Qt=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),Rt=String($.error||"");if(!Qt&&/insufficient|minimum buy-in/i.test(Rt)){X(!0);return}}}catch($){const oe=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})();if(oe){const ct=`e2e-${Math.random().toString(36).slice(2,8)}`;try{window.__handleCreateSingleRes={ok:!0,roomId:ct}}catch{}const Nt=oe?"&e2e=1":"";o(U==="poker"?`/poker/room/${ct}?m=${U}${Nt}`:`/room/${ct}?m=${U}${Nt}`)}else{const ct=String($?.message??$??"");/insufficient|minimum buy-in/i.test(ct)&&X(!0)}}finally{I(!1),ee(!1),H.current&&(clearTimeout(H.current),H.current=null)}}},[ce,u,te,pe,o,O,U,Be,B]),ot=v.useCallback($=>()=>{ce(),te(),pe(),$()},[ce,te,pe]);m?.membershipTier;const Pt=!!m,Ft=(()=>{try{return m?.isGuest===!0}catch{return!1}})(),Me=v.useMemo(()=>[{key:"profile",label:"Profile",onClick:ot(he)},{key:"chips",label:"Shop",onClick:ot(st)},{key:"logout",label:"Log Out",onClick:ot(St)}],[ot,he,Ce,st]),tt=v.useCallback($=>{$.stopPropagation(),ce(),te(),pe();try{if(m?.isGuest===!0){R(!0);return}}catch{}C(oe=>!oe)},[ce,te,pe,m,Ne]),rt=v.useCallback(()=>C(!1),[]),be=v.useCallback(()=>T(!1),[]),lt=v.useCallback(()=>P(!1),[]),yt=v.useCallback(()=>i(!1),[i]),[tr,Or]=v.useState(!1),ur=v.useCallback(()=>{ce(),te(),pe(),Or(!0)},[ce,te,pe]),dr=v.useCallback(()=>Or(!1),[]),[fn,Z]=v.useState(!1),[fe,ge]=v.useState(!1);v.useEffect(()=>{let $=!0;return(async()=>{try{const{Preferences:oe}=await zr(async()=>{const{Preferences:Nt}=await Promise.resolve().then(()=>Ic);return{Preferences:Nt}},void 0,import.meta.url),{value:ct}=await oe.get({key:"seenOnboardingV1"});if(!$)return;ge(ct!=="1")}catch{if(!$)return;ge(!0)}})(),()=>{$=!1}},[]);const Pe=v.useCallback(()=>ge(!1),[]),De=v.useCallback(()=>{ce(),te(),pe(),Z(!0)},[ce,te,pe]),W=v.useCallback(()=>Z(!1),[]);return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(Bi,{className:"page-home-screen"}),g.jsx(fae,{}),g.jsx(fP,{open:fe,onClose:Pe}),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:ur,role:"button",children:g.jsx("img",{src:hae,alt:"How to Play",className:"home-header-icon"})}),g.jsx("a",{className:"gold-link home-header-link",title:"Leaderboards","aria-label":"Leaderboards",onClick:De,children:"Leaderboards"}),!m&&g.jsx("a",{className:"gold-link",onClick:ot(Ne),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:tt,children:g.jsx("img",{src:pae,alt:"Settings",className:"home-header-icon"})}),g.jsx(ZG,{anchorRef:ae,open:A,onClose:rt,items:Me})]})]}),g.jsx("div",{ref:He,className:"home-fit-shell",style:G?{height:G}:void 0,children:g.jsxs("div",{ref:ie,className:"home-fit-content",style:xe<1?{transform:`scale(${xe})`,transformOrigin:"top center"}:void 0,children:[(!Pt||Ft)&&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:ot(Ne),"aria-label":"Login",children:"Login"})})]}),g.jsx(hF,{}),!q&&g.jsx(mae,{selected:U,onChange:Re,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:Je,disabled:!U,"aria-label":"Join Room",children:"Join Room"}),g.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:ue,disabled:!U,"aria-label":"Create Room",children:"Create Room"})]})]})}),g.jsx(JG,{open:E,onClose:be,gameMode:U??"cee-lo"}),g.jsx(QG,{open:D,onClose:lt,isPrivate:w,setIsPrivate:b,roomsList:K}),g.jsx(pF,{open:a,onClose:yt,planId:m?.membershipTier}),g.jsx(gF,{open:tr,onClose:dr}),g.jsx(Sne,{open:fn,onClose:W}),g.jsx(Ene,{open:x,onClose:()=>R(!1),onGoLogin:()=>Ne(),title:"Login Required",message:g.jsx(g.Fragment,{children:"Please log in to access Settings and Multiplayer."})}),g.jsx(dae,{available:t,progress:e,applyNow:r,later:n}),g.jsx(_P,{})]})}const yae=""+new URL("fairness-BAFxLGWm.png",import.meta.url).href;function bP({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:yae,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 BT(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 vae(t){if(Array.isArray(t))return t}function _ae(t){if(Array.isArray(t))return BT(t)}function bae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kae(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,kF(n.key),n)}}function wae(t,e,r){return e&&kae(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function t_(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=kP(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=kF(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sae(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Eae(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 Tae(){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 Cae(){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 oI(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 pt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?oI(Object(r),!0).forEach(function(n){Cr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oI(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function n0(t,e){return vae(t)||Eae(t,e)||kP(t,e)||Tae()}function ro(t){return _ae(t)||Sae(t)||kP(t)||Cae()}function xae(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 kF(t){var e=xae(t,"string");return typeof e=="symbol"?e:e+""}function Z_(t){"@babel/helpers - typeof";return Z_=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},Z_(t)}function kP(t,e){if(t){if(typeof t=="string")return BT(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)?BT(t,e):void 0}}var cI=function(){},wP={},wF={},SF=null,EF={mark:cI,measure:cI};try{typeof window<"u"&&(wP=window),typeof document<"u"&&(wF=document),typeof MutationObserver<"u"&&(SF=MutationObserver),typeof performance<"u"&&(EF=performance)}catch{}var Pae=wP.navigator||{},lI=Pae.userAgent,uI=lI===void 0?"":lI,Zl=wP,bn=wF,dI=SF,yv=EF;Zl.document;var Kc=!!bn.documentElement&&!!bn.head&&typeof bn.addEventListener=="function"&&typeof bn.createElement=="function",TF=~uI.indexOf("MSIE")||~uI.indexOf("Trident/"),zS,Aae=/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)?[\-\ ]/,Rae=/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,CF={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"}},Dae={GROUP:"duotone-group",PRIMARY:"primary",SECONDARY:"secondary"},xF=["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"],Ra="classic",Ug="duotone",PF="sharp",AF="sharp-duotone",RF="chisel",DF="etch",OF="jelly",NF="jelly-duo",IF="jelly-fill",MF="notdog",jF="notdog-duo",LF="slab",BF="slab-press",UF="thumbprint",FF="whiteboard",Oae="Classic",Nae="Duotone",Iae="Sharp",Mae="Sharp Duotone",jae="Chisel",Lae="Etch",Bae="Jelly",Uae="Jelly Duo",Fae="Jelly Fill",qae="Notdog",zae="Notdog Duo",$ae="Slab",Vae="Slab Press",Hae="Thumbprint",Gae="Whiteboard",qF=[Ra,Ug,PF,AF,RF,DF,OF,NF,IF,MF,jF,LF,BF,UF,FF];zS={},Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(zS,Ra,Oae),Ug,Nae),PF,Iae),AF,Mae),RF,jae),DF,Lae),OF,Bae),NF,Uae),IF,Fae),MF,qae),Cr(Cr(Cr(Cr(Cr(zS,jF,zae),LF,$ae),BF,Vae),UF,Hae),FF,Gae);var Wae={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"}},Kae={"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"}},Yae=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}]]),Xae={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"}},zF=["fak","fa-kit","fakd","fa-kit-duotone"],fI={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},Jae=["kit"],Qae="kit",Zae="kit-duotone",eie="Kit",tie="Kit Duotone";Cr(Cr({},Qae,eie),Zae,tie);var rie={kit:{"fa-kit":"fak"}},nie={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},aie={kit:{fak:"fa-kit"}},pI={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}},$S,vv={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},iie=["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"],sie="classic",oie="duotone",cie="sharp",lie="sharp-duotone",uie="chisel",die="etch",fie="jelly",pie="jelly-duo",hie="jelly-fill",mie="notdog",gie="notdog-duo",yie="slab",vie="slab-press",_ie="thumbprint",bie="whiteboard",kie="Classic",wie="Duotone",Sie="Sharp",Eie="Sharp Duotone",Tie="Chisel",Cie="Etch",xie="Jelly",Pie="Jelly Duo",Aie="Jelly Fill",Rie="Notdog",Die="Notdog Duo",Oie="Slab",Nie="Slab Press",Iie="Thumbprint",Mie="Whiteboard";$S={},Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr($S,sie,kie),oie,wie),cie,Sie),lie,Eie),uie,Tie),die,Cie),fie,xie),pie,Pie),hie,Aie),mie,Rie),Cr(Cr(Cr(Cr(Cr($S,gie,Die),yie,Oie),vie,Nie),_ie,Iie),bie,Mie);var jie="kit",Lie="kit-duotone",Bie="Kit",Uie="Kit Duotone";Cr(Cr({},jie,Bie),Lie,Uie);var Fie={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"}},qie={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"]},UT={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"}},zie=["fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands","fa-semibold"],$F=["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(iie,zie),$ie=["solid","regular","light","thin","duotone","brands","semibold"],VF=[1,2,3,4,5,6,7,8,9,10],Vie=VF.concat([11,12,13,14,15,16,17,18,19,20]),Hie=["aw","fw","pull-left","pull-right"],Gie=[].concat(ro(Object.keys(qie)),$ie,Hie,["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",vv.GROUP,vv.SWAP_OPACITY,vv.PRIMARY,vv.SECONDARY]).concat(VF.map(function(t){return"".concat(t,"x")})).concat(Vie.map(function(t){return"w-".concat(t)})),Wie={"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"}},zc="___FONT_AWESOME___",FT=16,HF="fa",GF="svg-inline--fa",ud="data-fa-i2svg",qT="data-fa-pseudo-element",Kie="data-fa-pseudo-element-pending",SP="data-prefix",EP="data-icon",hI="fontawesome-i2svg",Yie="async",Xie=["HTML","HEAD","STYLE","SCRIPT"],WF=["::before","::after",":before",":after"],KF=(function(){try{return!0}catch{return!1}})();function Fg(t){return new Proxy(t,{get:function(r,n){return n in r?r[n]:r[Ra]}})}var YF=pt({},CF);YF[Ra]=pt(pt(pt(pt({},{"fa-duotone":"duotone"}),CF[Ra]),fI.kit),fI["kit-duotone"]);var Jie=Fg(YF),zT=pt({},Xae);zT[Ra]=pt(pt(pt(pt({},{duotone:"fad"}),zT[Ra]),pI.kit),pI["kit-duotone"]);var mI=Fg(zT),$T=pt({},UT);$T[Ra]=pt(pt({},$T[Ra]),aie.kit);var TP=Fg($T),VT=pt({},Fie);VT[Ra]=pt(pt({},VT[Ra]),rie.kit);Fg(VT);var Qie=Aae,XF="fa-layers-text",Zie=Rae,ese=pt({},Wae);Fg(ese);var tse=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],VS=Dae,rse=[].concat(ro(Jae),ro(Gie)),dm=Zl.FontAwesomeConfig||{};function nse(t){var e=bn.querySelector("script["+t+"]");if(e)return e.getAttribute(t)}function ase(t){return t===""?!0:t==="false"?!1:t==="true"?!0:t}if(bn&&typeof bn.querySelector=="function"){var ise=[["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"]];ise.forEach(function(t){var e=n0(t,2),r=e[0],n=e[1],a=ase(nse(r));a!=null&&(dm[n]=a)})}var JF={styleDefault:"solid",familyDefault:Ra,cssPrefix:HF,replacementClass:GF,autoReplaceSvg:!0,autoAddCss:!0,searchPseudoElements:!1,searchPseudoElementsWarnings:!0,searchPseudoElementsFullScan:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};dm.familyPrefix&&(dm.cssPrefix=dm.familyPrefix);var cp=pt(pt({},JF),dm);cp.autoReplaceSvg||(cp.observeMutations=!1);var $t={};Object.keys(JF).forEach(function(t){Object.defineProperty($t,t,{enumerable:!0,set:function(r){cp[t]=r,fm.forEach(function(n){return n($t)})},get:function(){return cp[t]}})});Object.defineProperty($t,"familyPrefix",{enumerable:!0,set:function(e){cp.cssPrefix=e,fm.forEach(function(r){return r($t)})},get:function(){return cp.cssPrefix}});Zl.FontAwesomeConfig=$t;var fm=[];function sse(t){return fm.push(t),function(){fm.splice(fm.indexOf(t),1)}}var lf=FT,Uo={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function ose(t){if(!(!t||!Kc)){var e=bn.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=t;for(var r=bn.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 bn.head.insertBefore(e,n),t}}var cse="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function gI(){for(var t=12,e="";t-- >0;)e+=cse[Math.random()*62|0];return e}function Dp(t){for(var e=[],r=(t||[]).length>>>0;r--;)e[r]=t[r];return e}function CP(t){return t.classList?Dp(t.classList):(t.getAttribute("class")||"").split(" ").filter(function(e){return e})}function QF(t){return"".concat(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lse(t){return Object.keys(t||{}).reduce(function(e,r){return e+"".concat(r,'="').concat(QF(t[r]),'" ')},"").trim()}function a0(t){return Object.keys(t||{}).reduce(function(e,r){return e+"".concat(r,": ").concat(t[r].trim(),";")},"")}function xP(t){return t.size!==Uo.size||t.x!==Uo.x||t.y!==Uo.y||t.rotate!==Uo.rotate||t.flipX||t.flipY}function use(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 dse(t){var e=t.transform,r=t.width,n=r===void 0?FT:r,a=t.height,i=a===void 0?FT:a,o="";return TF?o+="translate(".concat(e.x/lf-n/2,"em, ").concat(e.y/lf-i/2,"em) "):o+="translate(calc(-50% + ".concat(e.x/lf,"em), calc(-50% + ").concat(e.y/lf,"em)) "),o+="scale(".concat(e.size/lf*(e.flipX?-1:1),", ").concat(e.size/lf*(e.flipY?-1:1),") "),o+="rotate(".concat(e.rotate,"deg) "),o}var fse=`: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 ZF(){var t=HF,e=GF,r=$t.cssPrefix,n=$t.replacementClass,a=fse;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 yI=!1;function HS(){$t.autoAddCss&&!yI&&(ose(ZF()),yI=!0)}var pse={mixout:function(){return{dom:{css:ZF,insertCss:HS}}},hooks:function(){return{beforeDOMElementCreation:function(){HS()},beforeI2svg:function(){HS()}}}},$c=Zl||{};$c[zc]||($c[zc]={});$c[zc].styles||($c[zc].styles={});$c[zc].hooks||($c[zc].hooks={});$c[zc].shims||($c[zc].shims=[]);var Ks=$c[zc],e5=[],t5=function(){bn.removeEventListener("DOMContentLoaded",t5),eb=1,e5.map(function(e){return e()})},eb=!1;Kc&&(eb=(bn.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(bn.readyState),eb||bn.addEventListener("DOMContentLoaded",t5));function hse(t){Kc&&(eb?setTimeout(t,0):e5.push(t))}function qg(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"?QF(t):"<".concat(e," ").concat(lse(n),">").concat(i.map(qg).join(""),"</").concat(e,">")}function vI(t,e,r){if(t&&t[e]&&t[e][r])return{prefix:e,iconName:r,icon:t[e][r]}}var GS=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 r5(t){return ro(t).length!==1?null:t.codePointAt(0).toString(16)}function _I(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 HT(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.skipHooks,a=n===void 0?!1:n,i=_I(e);typeof Ks.hooks.addPack=="function"&&!a?Ks.hooks.addPack(t,_I(e)):Ks.styles[t]=pt(pt({},Ks.styles[t]||{}),i),t==="fas"&&HT("fa",e)}var zm=Ks.styles,mse=Ks.shims,n5=Object.keys(TP),gse=n5.reduce(function(t,e){return t[e]=Object.keys(TP[e]),t},{}),PP=null,a5={},i5={},s5={},o5={},c5={};function yse(t){return~rse.indexOf(t)}function vse(t,e){var r=e.split("-"),n=r[0],a=r.slice(1).join("-");return n===t&&a!==""&&!yse(a)?a:null}var l5=function(){var e=function(i){return GS(zm,function(o,c,u){return o[u]=GS(c,i,{}),o},{})};a5=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}),i5=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}),c5=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 zm||$t.autoFetchSvg,n=GS(mse,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:{}});s5=n.names,o5=n.unicodes,PP=i0($t.styleDefault,{family:$t.familyDefault})};sse(function(t){PP=i0(t.styleDefault,{family:$t.familyDefault})});l5();function AP(t,e){return(a5[t]||{})[e]}function _se(t,e){return(i5[t]||{})[e]}function Ku(t,e){return(c5[t]||{})[e]}function u5(t){return s5[t]||{prefix:null,iconName:null}}function bse(t){var e=o5[t],r=AP("fas",t);return e||(r?{prefix:"fas",iconName:r}:null)||{prefix:null,iconName:null}}function eu(){return PP}var d5=function(){return{prefix:null,iconName:null,rest:[]}};function kse(t){var e=Ra,r=n5.reduce(function(n,a){return n[a]="".concat($t.cssPrefix,"-").concat(a),n},{});return qF.forEach(function(n){(t.includes(r[n])||t.some(function(a){return gse[n].includes(a)}))&&(e=n)}),e}function i0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.family,n=r===void 0?Ra:r,a=Jie[n][t];if(n===Ug&&!t)return"fad";var i=mI[n][t]||mI[n][a],o=t in Ks.styles?t:null,c=i||o||null;return c}function wse(t){var e=[],r=null;return t.forEach(function(n){var a=vse($t.cssPrefix,n);a?r=a:n&&e.push(n)}),{iconName:r,rest:e}}function bI(t){return t.sort().filter(function(e,r,n){return n.indexOf(e)===r})}var kI=$F.concat(zF);function s0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.skipLookups,n=r===void 0?!1:r,a=null,i=bI(t.filter(function(_){return kI.includes(_)})),o=bI(t.filter(function(_){return!kI.includes(_)})),c=i.filter(function(_){return a=_,!xF.includes(_)}),u=n0(c,1),d=u[0],f=d===void 0?null:d,h=kse(i),m=pt(pt({},wse(o)),{},{prefix:i0(f,{family:h})});return pt(pt(pt({},m),Cse({values:t,family:h,styles:zm,config:$t,canonical:m,givenPrefix:a})),Sse(n,a,m))}function Sse(t,e,r){var n=r.prefix,a=r.iconName;if(t||!n||!a)return{prefix:n,iconName:a};var i=e==="fa"?u5(a):{},o=Ku(n,a);return a=i.iconName||o||a,n=i.prefix||n,n==="far"&&!zm.far&&zm.fas&&!$t.autoFetchSvg&&(n="fas"),{prefix:n,iconName:a}}var Ese=qF.filter(function(t){return t!==Ra||t!==Ug}),Tse=Object.keys(UT).filter(function(t){return t!==Ra}).map(function(t){return Object.keys(UT[t])}).flat();function Cse(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===Ug,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&&Ese.includes(r)){var w=Object.keys(c).find(function(E){return Tse.includes(E)});if(w||d.autoFetchSvg){var b=Yae.get(r).defaultShortPrefixId;n.prefix=b,n.iconName=Ku(n.prefix,n.iconName)||n.iconName}}return(n.prefix==="fa"||i==="fa")&&(n.prefix=eu()||"fas"),n}var xse=(function(){function t(){bae(this,t),this.definitions={}}return wae(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]=pt(pt({},r.definitions[c]||{}),o[c]),HT(c,o[c]);var u=TP[Ra][c];u&&HT(u,o[c]),l5()})}},{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}}])})(),wI=[],Ef={},Uf={},Pse=Object.keys(Uf);function Ase(t,e){var r=e.mixoutsTo;return wI=t,Ef={},Object.keys(Uf).forEach(function(n){Pse.indexOf(n)===-1&&delete Uf[n]}),wI.forEach(function(n){var a=n.mixout?n.mixout():{};if(Object.keys(a).forEach(function(o){typeof a[o]=="function"&&(r[o]=a[o]),Z_(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){Ef[o]||(Ef[o]=[]),Ef[o].push(i[o])})}n.provides&&n.provides(Uf)}),r}function GT(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=Ef[t]||[];return i.forEach(function(o){e=o.apply(null,[e].concat(n))}),e}function dd(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=Ef[t]||[];a.forEach(function(i){i.apply(null,r)})}function tu(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);return Uf[t]?Uf[t].apply(null,e):void 0}function WT(t){t.prefix==="fa"&&(t.prefix="fas");var e=t.iconName,r=t.prefix||eu();if(e)return e=Ku(r,e)||e,vI(f5.definitions,r,e)||vI(Ks.styles,r,e)}var f5=new xse,Rse=function(){$t.autoReplaceSvg=!1,$t.observeMutations=!1,dd("noAuto")},Dse={i2svg:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Kc?(dd("beforeI2svg",e),tu("pseudoElements2svg",e),tu("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;$t.autoReplaceSvg===!1&&($t.autoReplaceSvg=!0),$t.observeMutations=!0,hse(function(){Nse({autoReplaceSvgRoot:r}),dd("watch",e)})}},Ose={icon:function(e){if(e===null)return null;if(Z_(e)==="object"&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:Ku(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=i0(e[0]);return{prefix:n,iconName:Ku(n,r)||r}}if(typeof e=="string"&&(e.indexOf("".concat($t.cssPrefix,"-"))>-1||e.match(Qie))){var a=s0(e.split(" "),{skipLookups:!0});return{prefix:a.prefix||eu(),iconName:Ku(a.prefix,a.iconName)||a.iconName}}if(typeof e=="string"){var i=eu();return{prefix:i,iconName:Ku(i,e)||e}}}},zi={noAuto:Rse,config:$t,dom:Dse,parse:Ose,library:f5,findIconDefinition:WT,toHtml:qg},Nse=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.autoReplaceSvgRoot,n=r===void 0?bn:r;(Object.keys(Ks.styles).length>0||$t.autoFetchSvg)&&Kc&&$t.autoReplaceSvg&&zi.dom.i2svg({node:n})};function o0(t,e){return Object.defineProperty(t,"abstract",{get:e}),Object.defineProperty(t,"html",{get:function(){return t.abstract.map(function(n){return qg(n)})}}),Object.defineProperty(t,"node",{get:function(){if(Kc){var n=bn.createElement("div");return n.innerHTML=t.html,n.children}}}),t}function Ise(t){var e=t.children,r=t.main,n=t.mask,a=t.attributes,i=t.styles,o=t.transform;if(xP(o)&&r.found&&!n.found){var c=r.width,u=r.height,d={x:c/u/2,y:.5};a.style=a0(pt(pt({},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 Mse(t){var e=t.prefix,r=t.iconName,n=t.children,a=t.attributes,i=t.symbol,o=i===!0?"".concat(e,"-").concat($t.cssPrefix,"-").concat(r):i;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:pt(pt({},a),{},{id:o}),children:n}]}]}function jse(t){var e=["aria-label","aria-labelledby","title","role"];return e.some(function(r){return r in t})}function RP(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=[$t.replacementClass,i?"".concat($t.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:pt(pt({},d.attributes),{},{"data-prefix":a,"data-icon":i,class:b,role:d.attributes.role||"img",viewBox:"0 0 ".concat(_," ").concat(w)})};!jse(d.attributes)&&!d.attributes["aria-hidden"]&&(E.attributes["aria-hidden"]="true"),h&&(E.attributes[ud]="");var T=pt(pt({},E),{},{prefix:a,iconName:i,main:r,mask:n,maskId:u,transform:o,symbol:c,styles:pt({},d.styles)}),D=n.found&&r.found?tu("generateAbstractMask",T)||{children:[],attributes:{}}:tu("generateAbstractIcon",T)||{children:[],attributes:{}},P=D.children,A=D.attributes;return T.children=P,T.attributes=A,c?Mse(T):Ise(T)}function SI(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=pt(pt({},i.attributes),{},{class:i.classes.join(" ")});c&&(u[ud]="");var d=pt({},i.styles);xP(a)&&(d.transform=dse({transform:a,width:r,height:n}),d["-webkit-transform"]=d.transform);var f=a0(d);f.length>0&&(u.style=f);var h=[];return h.push({tag:"span",attributes:u,children:[e]}),h}function Lse(t){var e=t.content,r=t.extra,n=pt(pt({},r.attributes),{},{class:r.classes.join(" ")}),a=a0(r.styles);a.length>0&&(n.style=a);var i=[];return i.push({tag:"span",attributes:n,children:[e]}),i}var WS=Ks.styles;function KT(t){var e=t[0],r=t[1],n=t.slice(4),a=n0(n,1),i=a[0],o=null;return Array.isArray(i)?o={tag:"g",attributes:{class:"".concat($t.cssPrefix,"-").concat(VS.GROUP)},children:[{tag:"path",attributes:{class:"".concat($t.cssPrefix,"-").concat(VS.SECONDARY),fill:"currentColor",d:i[0]}},{tag:"path",attributes:{class:"".concat($t.cssPrefix,"-").concat(VS.PRIMARY),fill:"currentColor",d:i[1]}}]}:o={tag:"path",attributes:{fill:"currentColor",d:i}},{found:!0,width:e,height:r,icon:o}}var Bse={found:!1,width:512,height:512};function Use(t,e){!KF&&$t.showMissingIcons}function YT(t,e){var r=e;return e==="fa"&&$t.styleDefault!==null&&(e=eu()),new Promise(function(n,a){if(r==="fa"){var i=u5(t)||{};t=i.iconName||t,e=i.prefix||e}if(t&&e&&WS[e]&&WS[e][t]){var o=WS[e][t];return n(KT(o))}Use(t,e),n(pt(pt({},Bse),{},{icon:$t.showMissingIcons&&t?tu("missingIconAbstract")||{}:{}}))})}var EI=function(){},XT=$t.measurePerformance&&yv&&yv.mark&&yv.measure?yv:{mark:EI,measure:EI},Xh='FA "7.0.1"',Fse=function(e){return XT.mark("".concat(Xh," ").concat(e," begins")),function(){return p5(e)}},p5=function(e){XT.mark("".concat(Xh," ").concat(e," ends")),XT.measure("".concat(Xh," ").concat(e),"".concat(Xh," ").concat(e," begins"),"".concat(Xh," ").concat(e," ends"))},DP={begin:Fse,end:p5},r_=function(){};function TI(t){var e=t.getAttribute?t.getAttribute(ud):null;return typeof e=="string"}function qse(t){var e=t.getAttribute?t.getAttribute(SP):null,r=t.getAttribute?t.getAttribute(EP):null;return e&&r}function zse(t){return t&&t.classList&&t.classList.contains&&t.classList.contains($t.replacementClass)}function $se(){if($t.autoReplaceSvg===!0)return n_.replace;var t=n_[$t.autoReplaceSvg];return t||n_.replace}function Vse(t){return bn.createElementNS("http://www.w3.org/2000/svg",t)}function Hse(t){return bn.createElement(t)}function h5(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.ceFn,n=r===void 0?t.tag==="svg"?Vse:Hse:r;if(typeof t=="string")return bn.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(h5(o,{ceFn:n}))}),a}function Gse(t){var e=" ".concat(t.outerHTML," ");return e="".concat(e,"Font Awesome fontawesome.com "),e}var n_={replace:function(e){var r=e[0];if(r.parentNode)if(e[1].forEach(function(a){r.parentNode.insertBefore(h5(a),r)}),r.getAttribute(ud)===null&&$t.keepOriginalSource){var n=bn.createComment(Gse(r));r.parentNode.replaceChild(n,r)}else r.remove()},nest:function(e){var r=e[0],n=e[1];if(~CP(r).indexOf($t.replacementClass))return n_.replace(e);var a=new RegExp("".concat($t.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){var i=n[0].attributes.class.split(" ").reduce(function(c,u){return u===$t.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 qg(c)}).join(`
`);r.setAttribute(ud,""),r.innerHTML=o}};function CI(t){t()}function m5(t,e){var r=typeof e=="function"?e:r_;if(t.length===0)r();else{var n=CI;$t.mutateApproach===Yie&&(n=Zl.requestAnimationFrame||CI),n(function(){var a=$se(),i=DP.begin("mutate");t.map(a),i(),r()})}}var OP=!1;function g5(){OP=!0}function JT(){OP=!1}var tb=null;function xI(t){if(dI&&$t.observeMutations){var e=t.treeCallback,r=e===void 0?r_:e,n=t.nodeCallback,a=n===void 0?r_:n,i=t.pseudoElementsCallback,o=i===void 0?r_:i,c=t.observeMutationsRoot,u=c===void 0?bn:c;tb=new dI(function(d){if(!OP){var f=eu();Dp(d).forEach(function(h){if(h.type==="childList"&&h.addedNodes.length>0&&!TI(h.addedNodes[0])&&($t.searchPseudoElements&&o(h.target),r(h.target)),h.type==="attributes"&&h.target.parentNode&&$t.searchPseudoElements&&o([h.target],!0),h.type==="attributes"&&TI(h.target)&&~tse.indexOf(h.attributeName))if(h.attributeName==="class"&&qse(h.target)){var m=s0(CP(h.target)),_=m.prefix,w=m.iconName;h.target.setAttribute(SP,_||f),w&&h.target.setAttribute(EP,w)}else zse(h.target)&&a(h.target)})}}),Kc&&tb.observe(u,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function Wse(){tb&&tb.disconnect()}function Kse(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 Yse(t){var e=t.getAttribute("data-prefix"),r=t.getAttribute("data-icon"),n=t.innerText!==void 0?t.innerText.trim():"",a=s0(CP(t));return a.prefix||(a.prefix=eu()),e&&r&&(a.prefix=e,a.iconName=r),a.iconName&&a.prefix||(a.prefix&&n.length>0&&(a.iconName=_se(a.prefix,t.innerText)||AP(a.prefix,r5(t.innerText))),!a.iconName&&$t.autoFetchSvg&&t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&(a.iconName=t.firstChild.data)),a}function Xse(t){var e=Dp(t.attributes).reduce(function(r,n){return r.name!=="class"&&r.name!=="style"&&(r[n.name]=n.value),r},{});return e}function Jse(){return{iconName:null,prefix:null,transform:Uo,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function PI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0},r=Yse(t),n=r.iconName,a=r.prefix,i=r.rest,o=Xse(t),c=GT("parseNodeAttributes",{},t),u=e.styleParser?Kse(t):[];return pt({iconName:n,prefix:a,transform:Uo,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:i,styles:u,attributes:o}},c)}var Qse=Ks.styles;function y5(t){var e=$t.autoReplaceSvg==="nest"?PI(t,{styleParser:!1}):PI(t);return~e.extra.classes.indexOf(XF)?tu("generateLayersText",t,e):tu("generateSvgReplacementMutation",t,e)}function Zse(){return[].concat(ro(zF),ro($F))}function AI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!Kc)return Promise.resolve();var r=bn.documentElement.classList,n=function(h){return r.add("".concat(hI,"-").concat(h))},a=function(h){return r.remove("".concat(hI,"-").concat(h))},i=$t.autoFetchSvg?Zse():xF.concat(Object.keys(Qse));i.includes("fa")||i.push("fa");var o=[".".concat(XF,":not([").concat(ud,"])")].concat(i.map(function(f){return".".concat(f,":not([").concat(ud,"])")})).join(", ");if(o.length===0)return Promise.resolve();var c=[];try{c=Dp(t.querySelectorAll(o))}catch{}if(c.length>0)n("pending"),a("complete");else return Promise.resolve();var u=DP.begin("onTree"),d=c.reduce(function(f,h){try{var m=y5(h);m&&f.push(m)}catch(_){KF||_.name}return f},[]);return new Promise(function(f,h){Promise.all(d).then(function(m){m5(m,function(){n("active"),n("complete"),a("pending"),typeof e=="function"&&e(),u(),f()})}).catch(function(m){u(),h(m)})})}function eoe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;y5(t).then(function(r){r&&m5([r],e)})}function toe(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(e||{}).icon?e:WT(e||{}),a=r.mask;return a&&(a=(a||{}).icon?a:WT(a||{})),t(n,pt(pt({},r),{},{mask:a}))}}var roe=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.transform,a=n===void 0?Uo: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,D=e.iconName,P=e.icon;return o0(pt({type:"icon"},e),function(){return dd("beforeDOMElementCreation",{iconDefinition:e,params:r}),RP({icons:{main:KT(P),mask:u?KT(u.icon):{found:!1,width:null,height:null,icon:{}}},prefix:T,iconName:D,transform:pt(pt({},Uo),a),symbol:o,maskId:f,extra:{attributes:w,styles:E,classes:m}})})}},noe={mixout:function(){return{icon:toe(roe)}},hooks:function(){return{mutationObserverCallbacks:function(r){return r.treeCallback=AI,r.nodeCallback=eoe,r}}},provides:function(e){e.i2svg=function(r){var n=r.node,a=n===void 0?bn:n,i=r.callback,o=i===void 0?function(){}:i;return AI(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([YT(a,i),u.iconName?YT(u.iconName,u.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(function(_){var w=n0(_,2),b=w[0],E=w[1];h([r,RP({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=a0(c);u.length>0&&(a.style=u);var d;return xP(o)&&(d=tu("generateAbstractTransformGrouping",{main:i,transform:o,containerWidth:i.width,iconWidth:i.width})),n.push(d||i.icon),{children:n,attributes:a}}}},aoe={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 o0({type:"layer"},function(){dd("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($t.cssPrefix,"-layers")].concat(ro(i)).join(" ")},children:o}]})}}}},ioe={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 o0({type:"counter",content:r},function(){return dd("beforeDOMElementCreation",{content:r,params:n}),Lse({content:r.toString(),extra:{attributes:c,styles:d,classes:["".concat($t.cssPrefix,"-layers-counter")].concat(ro(i))}})})}}}},soe={mixout:function(){return{text:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.transform,i=a===void 0?Uo: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 o0({type:"text",content:r},function(){return dd("beforeDOMElementCreation",{content:r,params:n}),SI({content:r,transform:pt(pt({},Uo),i),extra:{attributes:d,styles:h,classes:["".concat($t.cssPrefix,"-layers-text")].concat(ro(c))}})})}}},provides:function(e){e.generateLayersText=function(r,n){var a=n.transform,i=n.extra,o=null,c=null;if(TF){var u=parseInt(getComputedStyle(r).fontSize,10),d=r.getBoundingClientRect();o=d.width/u,c=d.height/u}return Promise.resolve([r,SI({content:r.innerHTML,width:o,height:c,transform:a,extra:i,watchable:!0})])}}},v5=new RegExp('"',"ug"),RI=[1105920,1112319],DI=pt(pt(pt(pt({},{FontAwesome:{normal:"fas",400:"fas"}}),Kae),Wie),nie),QT=Object.keys(DI).reduce(function(t,e){return t[e.toLowerCase()]=DI[e],t},{}),ooe=Object.keys(QT).reduce(function(t,e){var r=QT[e];return t[e]=r[900]||ro(Object.entries(r))[0][1],t},{});function coe(t){var e=t.replace(v5,"");return r5(ro(e)[0]||"")}function loe(t){var e=t.getPropertyValue("font-feature-settings").includes("ss01"),r=t.getPropertyValue("content"),n=r.replace(v5,""),a=n.codePointAt(0),i=a>=RI[0]&&a<=RI[1],o=n.length===2?n[0]===n[1]:!1;return i||o||e}function uoe(t,e){var r=t.replace(/^['"]|['"]$/g,"").toLowerCase(),n=parseInt(e),a=isNaN(n)?"normal":n;return(QT[r]||{})[a]||ooe[r]}function OI(t,e){var r="".concat(Kie).concat(e.replace(":","-"));return new Promise(function(n,a){if(t.getAttribute(r)!==null)return n();var i=Dp(t.children),o=i.filter(function(O){return O.getAttribute(qT)===e})[0],c=Zl.getComputedStyle(t,e),u=c.getPropertyValue("font-family"),d=u.match(Zie),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"),_=uoe(u,f),w=coe(m),b=d[0].startsWith("FontAwesome"),E=loe(c),T=AP(_,w),D=T;if(b){var P=bse(w);P.iconName&&P.prefix&&(T=P.iconName,_=P.prefix)}if(T&&!E&&(!o||o.getAttribute(SP)!==_||o.getAttribute(EP)!==D)){t.setAttribute(r,D),o&&t.removeChild(o);var A=Jse(),C=A.extra;C.attributes[qT]=e,YT(T,_).then(function(O){var I=RP(pt(pt({},A),{},{icons:{main:O,mask:d5()},prefix:_,iconName:D,extra:C,watchable:!0})),x=bn.createElementNS("http://www.w3.org/2000/svg","svg");e==="::before"?t.insertBefore(x,t.firstChild):t.appendChild(x),x.outerHTML=I.map(function(R){return qg(R)}).join(`
`),t.removeAttribute(r),n()}).catch(a)}else n()}else n()})}function doe(t){return Promise.all([OI(t,"::before"),OI(t,"::after")])}function foe(t){return t.parentNode!==document.head&&!~Xie.indexOf(t.tagName.toUpperCase())&&!t.getAttribute(qT)&&(!t.parentNode||t.parentNode.tagName!=="svg")}var poe=function(e){return!!e&&WF.some(function(r){return e.includes(r)})},hoe=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=t_(n),i;try{for(a.s();!(i=a.n()).done;){var o=i.value;if(poe(o)){var c=WF.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 NI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Kc){var r;if(e)r=t;else if($t.searchPseudoElementsFullScan)r=t.querySelectorAll("*");else{var n=new Set,a=t_(document.styleSheets),i;try{for(a.s();!(i=a.n()).done;){var o=i.value;try{var c=t_(o.cssRules),u;try{for(c.s();!(u=c.n()).done;){var d=u.value,f=hoe(d.selectorText),h=t_(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{$t.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=Dp(r).filter(foe).map(doe),D=DP.begin("searchPseudoElements");g5(),Promise.all(T).then(function(){D(),JT(),b()}).catch(function(){D(),JT(),E()})})}}var moe={hooks:function(){return{mutationObserverCallbacks:function(r){return r.pseudoElementsCallback=NI,r}}},provides:function(e){e.pseudoElements2svg=function(r){var n=r.node,a=n===void 0?bn:n;$t.searchPseudoElements&&NI(a)}}},II=!1,goe={mixout:function(){return{dom:{unwatch:function(){g5(),II=!0}}}},hooks:function(){return{bootstrap:function(){xI(GT("mutationObserverCallbacks",{}))},noAuto:function(){Wse()},watch:function(r){var n=r.observeMutationsRoot;II?JT():xI(GT("mutationObserverCallbacks",{observeMutationsRoot:n}))}}}},MI=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)},yoe={mixout:function(){return{parse:{transform:function(r){return MI(r)}}}},hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-transform");return a&&(r.transform=MI(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:pt({},_.outer),children:[{tag:"g",attributes:pt({},_.inner),children:[{tag:n.icon.tag,children:n.icon.children,attributes:pt(pt({},n.icon.attributes),_.path)}]}]}}}},KS={x:0,y:0,width:"100%",height:"100%"};function jI(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 voe(t){return t.tag==="g"?t.children:[t]}var _oe={hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-mask"),i=a?s0(a.split(" ").map(function(o){return o.trim()})):d5();return i.prefix||(i.prefix=eu()),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,_=use({transform:u,containerWidth:h,iconWidth:d}),w={tag:"rect",attributes:pt(pt({},KS),{},{fill:"white"})},b=f.children?{children:f.children.map(jI)}:{},E={tag:"g",attributes:pt({},_.inner),children:[jI(pt({tag:f.tag,attributes:pt(pt({},f.attributes),_.path)},b))]},T={tag:"g",attributes:pt({},_.outer),children:[E]},D="mask-".concat(c||gI()),P="clip-".concat(c||gI()),A={tag:"mask",attributes:pt(pt({},KS),{},{id:D,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[w,T]},C={tag:"defs",children:[{tag:"clipPath",attributes:{id:P},children:voe(m)},A]};return n.push(C,{tag:"rect",attributes:pt({fill:"currentColor","clip-path":"url(#".concat(P,")"),mask:"url(#".concat(D,")")},KS)}),{children:n,attributes:a}}}},boe={provides:function(e){var r=!1;Zl.matchMedia&&(r=Zl.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:pt(pt({},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=pt(pt({},i),{},{attributeName:"opacity"}),c={tag:"circle",attributes:pt(pt({},a),{},{cx:"256",cy:"364",r:"28"}),children:[]};return r||c.children.push({tag:"animate",attributes:pt(pt({},i),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:pt(pt({},o),{},{values:"1;0;1;1;0;1;"})}),n.push(c),n.push({tag:"path",attributes:pt(pt({},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:pt(pt({},o),{},{values:"1;0;0;0;0;1;"})}]}),r||n.push({tag:"path",attributes:pt(pt({},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:pt(pt({},o),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:n}}}},koe={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}}}},woe=[pse,noe,aoe,ioe,soe,moe,goe,yoe,_oe,boe,koe];Ase(woe,{mixoutsTo:zi});zi.noAuto;zi.config;zi.library;zi.dom;var ZT=zi.parse;zi.findIconDefinition;zi.toHtml;var Soe=zi.icon;zi.layer;zi.text;zi.counter;var YS={exports:{}},XS,LI;function Eoe(){if(LI)return XS;LI=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return XS=t,XS}var JS,BI;function Toe(){if(BI)return JS;BI=1;var t=Eoe();function e(){}function r(){}return r.resetWarningCache=e,JS=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},JS}var UI;function Coe(){return UI||(UI=1,YS.exports=Toe()()),YS.exports}var xoe=Coe();const pr=Sg(xoe);var Poe={};function eC(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 Aoe(t){if(Array.isArray(t))return t}function Roe(t){if(Array.isArray(t))return eC(t)}function Rl(t,e,r){return(e=Boe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Doe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ooe(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 Noe(){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 Ioe(){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 FI(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 Mo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?FI(Object(r),!0).forEach(function(n){Rl(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FI(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Moe(t,e){if(t==null)return{};var r,n,a=joe(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 joe(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 qI(t,e){return Aoe(t)||Ooe(t,e)||_5(t,e)||Noe()}function tC(t){return Roe(t)||Doe(t)||_5(t)||Ioe()}function Loe(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 Boe(t){var e=Loe(t,"string");return typeof e=="symbol"?e:e+""}function rb(t){"@babel/helpers - typeof";return rb=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},rb(t)}function _5(t,e){if(t){if(typeof t=="string")return eC(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)?eC(t,e):void 0}}var Uoe="7.0.0",rC;try{var Foe=require("@fortawesome/fontawesome-svg-core/package.json");rC=Foe.version}catch{rC=typeof process<"u"&&Poe.FA_VERSION||"7.0.0"}function qoe(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,D=t.pull,P=t.swapOpacity,A=t.rotateBy,C=t.widthAuto,O=zoe(rC,Uoe),I=Rl(Rl(Rl(Rl(Rl(Rl({"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(D),typeof D<"u"&&D!==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 zoe(t,e){for(var r=t.split("-"),n=qI(r,2),a=n[0],i=n[1],o=e.split("-"),c=qI(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 D=f[T]||"0",P=h[T]||"0";if(D!==P&&D.length!==P.length)return D.length<P.length}return!(i&&!d)}function $oe(t){return t=t-0,t===t}function b5(t){return $oe(t)?t:(t=t.replace(/[\-_\s]+(.)?/g,function(e,r){return r?r.toUpperCase():""}),t.substr(0,1).toLowerCase()+t.substr(1))}var Voe=["style"];function Hoe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Goe(t){return t.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,r){var n=r.indexOf(":"),a=b5(r.slice(0,n)),i=r.slice(n+1).trim();return a.startsWith("webkit")?e[Hoe(a)]=i:e[a]=i,e},{})}function k5(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 k5(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=Goe(f);break;default:d.indexOf("aria-")===0||d.indexOf("data-")===0?u.attrs[d.toLowerCase()]=f:u.attrs[b5(d)]=f}return u},{attrs:{}}),i=r.style,o=i===void 0?{}:i,c=Moe(r,Voe);return a.attrs.style=Mo(Mo({},a.attrs.style),o),t.apply(void 0,[e.tag,Mo(Mo({},a.attrs),c)].concat(tC(n)))}var w5=!1;try{w5=!0}catch{}function Woe(){if(!w5&&console&&typeof console.error=="function"){var t;(t=console).error.apply(t,arguments)}}function zI(t){if(t&&rb(t)==="object"&&t.prefix&&t.iconName&&t.icon)return t;if(ZT.icon)return ZT.icon(t);if(t===null)return null;if(t&&rb(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 QS(t,e){return Array.isArray(e)&&e.length>0||!Array.isArray(e)&&e?Rl({},t,e):{}}var $I={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},Ml=Ct.forwardRef(function(t,e){var r=Mo(Mo({},$I),t),n=r.icon,a=r.mask,i=r.symbol,o=r.className,c=r.title,u=r.titleId,d=r.maskId,f=zI(n),h=QS("classes",[].concat(tC(qoe(r)),tC((o||"").split(" ")))),m=QS("transform",typeof r.transform=="string"?ZT.transform(r.transform):r.transform),_=QS("mask",zI(a)),w=Soe(f,Mo(Mo(Mo(Mo({},h),m),_),{},{symbol:i,title:c,titleId:u,maskId:d}));if(!w)return Woe("Could not find icon",f),null;var b=w.abstract,E={ref:e};return Object.keys(r).forEach(function(T){$I.hasOwnProperty(T)||(E[T]=r[T])}),Koe(b[0],E)});Ml.displayName="FontAwesomeIcon";Ml.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 Koe=k5.bind(null,Ct.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 Yoe={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"]},Xoe={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 VI=(()=>{try{return Wr.getPlatform()}catch{return"web"}})(),ZS=VI==="ios"||VI==="android",HI=Yoe,GI=Xoe;function Joe({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 D=v.useRef(null),P=rn(),{refreshUser:A}=Vr(),C=()=>setTimeout(()=>D.current?.focus(),60);v.useCallback(()=>{w(!0),C()},[]),v.useCallback(()=>{P("/how-to-play")},[P]);const O=v.useCallback(async()=>{try{await Bv("");const R=ui();await fetch(`${R}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}try{const R=await Y9();if(R.ok){try{R.token&&await Zf(R.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 R=>{try{if(ZS){u("Use the Native Sign-in buttons inside the mobile app.");return}R==="google"?f(!0):m(!0),u(null);try{await Bv("");const N=ui();await fetch(`${N}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}await K9(R)}catch(N){R==="google"?f(!1):m(!1),u(N?.message||"Web sign-in failed")}},x=async R=>{try{if(!ZS){u("Open the Android/iOS app to use Native Sign-in.");return}R==="google"?f(!0):m(!0),u(null);try{await Bv("");const U=ui();await fetch(`${U}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}const N=R==="apple"?await P_.signInWithAppleNative():await P_.signInWithGoogleNative(),L=ui(),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 Zf(q.token)}catch{}await A({force:!0}),P("/lobby",{replace:!0})}else throw new Error("No token")}catch(N){R==="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(Bi,{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(bP,{state:"verified"})]}),g.jsx(hF,{}),g.jsxs("div",{id:"signup-form",className:["lp-signup",_||i==="sent"?"is-open":""].join(" "),children:[ZS?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(Ml,{className:"lp-oauth__fa",icon:HI,"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(Ml,{className:"lp-oauth__fa",icon:GI,"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(Ml,{className:"lp-oauth__fa",icon:HI,"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(Ml,{className:"lp-oauth__fa",icon:GI,"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(gF,{open:b,onClose:T})]})}function Qoe(){const{user:t,loading:e,initialized:r,refreshUser:n}=Vr(),a=_i(),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"&&Cg()},[a.pathname]),a.pathname!=="/login"&&(!r||e)?g.jsx("div",{className:"app-loading",children:"Loading…"}):t&&!i?g.jsx(tm,{to:"/lobby",replace:!0}):g.jsx(d3,{})}var WI={};function Zoe(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 ece=Object.defineProperty,tce=(t,e,r)=>e in t?ece(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KI=(t,e,r)=>tce(t,typeof e!="symbol"?e+"":e,r);class Ya{constructor(){KI(this,"_locking"),KI(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 Mn(t,e){if(!t)throw new Error(e)}const rce=34028234663852886e22,nce=-34028234663852886e22,ace=4294967295,ice=2147483647,sce=-2147483648;function a_(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>ice||t<sce)throw new Error("invalid int 32: "+t)}function nC(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>ace||t<0)throw new Error("invalid uint 32: "+t)}function S5(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>rce||t<nce))throw new Error("invalid float 32: "+t)}const E5=Symbol("@bufbuild/protobuf/enum-type");function oce(t){const e=t[E5];return Mn(e,"missing enum type on enum object"),e}function T5(t,e,r,n){t[E5]=C5(e,r.map(a=>({no:a.no,name:a.name,localName:t[a.no]})))}function C5(t,e,r){const n=Object.create(null),a=Object.create(null),i=[];for(const o of e){const c=x5(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 cce(t,e,r){const n={};for(const a of e){const i=x5(a);n[i.localName]=i.no,n[i.no]=i.localName}return T5(n,t,e),n}function x5(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class NP{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 lce(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 NP),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 uce(){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 eE(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 i_=4294967296;function YI(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>=i_&&(a=a+(n/i_|0),n=n%i_)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),e?A5(n,a):IP(n,a)}function dce(t,e){let r=IP(t,e);const n=r.hi&2147483648;n&&(r=A5(r.lo,r.hi));const a=P5(r.lo,r.hi);return n?"-"+a:a}function P5(t,e){if({lo:t,hi:e}=fce(t,e),e<=2097151)return String(i_*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()+XI(o)+XI(i)}function fce(t,e){return{lo:t>>>0,hi:e>>>0}}function IP(t,e){return{lo:t|0,hi:e|0}}function A5(t,e){return e=~e,t?t=~t+1:e+=1,IP(t,e)}const XI=t=>{const e=String(t);return"0000000".slice(e.length)+e};function JI(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 pce(){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 hce(){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 WI!="object"||WI.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=>Mn(/^-?[0-9]+$/.test(a),"int64 invalid: ".concat(a)),n=a=>Mn(/^[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),YI(a)},uEnc(a){return typeof a!="string"&&(a=a.toString()),n(a),YI(a)},dec(a,i){return dce(a,i)},uDec(a,i){return P5(a,i)}}}const Sn=hce();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 ru;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(ru||(ru={}));function El(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 lp(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?Sn.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 R5(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 qn;(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"})(qn||(qn={}));class mce{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(nC(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return a_(e),JI(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){S5(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){nC(e);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!0),this.raw(r)}sfixed32(e){a_(e);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,e,!0),this.raw(r)}sint32(e){return a_(e),e=(e<<1^e>>31)>>>0,JI(e,this.buf),this}sfixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),a=Sn.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=Sn.uEnc(e);return n.setInt32(0,a.lo,!0),n.setInt32(4,a.hi,!0),this.raw(r)}int64(e){let r=Sn.enc(e);return eE(r.lo,r.hi,this.buf),this}sint64(e){let r=Sn.enc(e),n=r.hi>>31,a=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return eE(a,i,this.buf),this}uint64(e){let r=Sn.uEnc(e);return eE(r.lo,r.hi,this.buf),this}}class gce{constructor(e,r){this.varint64=uce,this.uint32=pce,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 qn.Varint:for(;this.buf[this.pos++]&128;);break;case qn.Bit64:this.pos+=4;case qn.Bit32:this.pos+=4;break;case qn.LengthDelimited:let a=this.uint32();this.pos+=a;break;case qn.StartGroup:for(;;){const[i,o]=this.tag();if(o===qn.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 Sn.dec(...this.varint64())}uint64(){return Sn.uDec(...this.varint64())}sint64(){let[e,r]=this.varint64(),n=-(e&1);return e=(e>>>1|(r&1)<<31)^n,r=r>>>1^n,Sn.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 Sn.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Sn.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 yce(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 D5(t){const e=t.field.localName,r=Object.create(null);return r[e]=vce(t),[r,()=>r[e]]}function vce(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 lp(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 _ce(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 Pc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),c0=[];for(let t=0;t<Pc.length;t++)c0[Pc[t].charCodeAt(0)]=t;c0[45]=Pc.indexOf("+");c0[95]=Pc.indexOf("/");const O5={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=c0[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+=Pc[n>>2],a=(n&3)<<4,r=1;break;case 1:e+=Pc[a|n>>4],a=(n&15)<<2,r=2;break;case 2:e+=Pc[a|n>>6],e+=Pc[n&63],r=0;break}return r&&(e+=Pc[a],e+="=",r==1&&(e+="=")),e}};function bce(t,e,r){I5(e,t);const n=e.runtime.bin.makeReadOptions(r),a=_ce(t.getType().runtime.bin.listUnknownFields(t),e.field),[i,o]=D5(e);for(const c of a)e.runtime.bin.readField(i,n.readerFactory(c.data),e.field,c.wireType,n);return o()}function kce(t,e,r,n){I5(e,t);const a=e.runtime.bin.makeReadOptions(n),i=e.runtime.bin.makeWriteOptions(n);if(N5(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 N5(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 I5(t,e){Mn(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function M5(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:!R5(t.T,e[r]);case"message":return e[r]!==void 0;case"map":return Object.keys(e[r]).length>0}}function QI(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?lp(t.T,t.L):void 0;break;case"message":e[r]=void 0;break}}function Ac(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(NP.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 j5(t,e){return Ac(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 ZI={ignoreUnknownFields:!1},eM={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function wce(t){return t?Object.assign(Object.assign({},ZI),t):ZI}function Sce(t){return t?Object.assign(Object.assign({},eM),t):eM}const nb=Symbol(),s_=Symbol();function Ece(){return{makeReadOptions:wce,makeWriteOptions:Sce,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(Io(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)}tM(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]=D5(f);tM(h,c,f.field,r,f),kce(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(!M5(a,t)){if(a.req)throw"required field not set";if(!e.emitDefaultValues||!Cce(a))continue}const o=a.oneof?t[a.oneof.localName].value:t[a.localName],c=rM(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&&N5(t,c)){const u=bce(t,c,e),d=rM(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 pm(t,e,r??ru.BIGINT,!0)},writeScalar(t,e,r){if(e!==void 0&&(r||R5(t,e)))return o_(t,e)},debug:Io}}function Io(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 tM(t,e,r,n,a){let i=r.localName;if(r.repeated){if(Mn(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(Io(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(Io(c)));switch(r.kind){case"message":o.push(r.T.fromJson(c,n));break;case"enum":const u=tE(r.T,c,n.ignoreUnknownFields,!0);u!==s_&&o.push(u);break;case"scalar":try{o.push(pm(r.T,c,r.L,!0))}catch(d){let f="cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Io(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(Io(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=Tce(r.K,c)}catch(f){let h="cannot decode map key for field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Io(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=tE(r.V.T,u,n.ignoreUnknownFields,!0);f!==s_&&(o[d]=f);break;case"scalar":try{o[d]=pm(r.V.T,u,ru.BIGINT,!0)}catch(h){let m="cannot decode map value for field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Io(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];Ac(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=tE(r.T,e,n.ignoreUnknownFields,!1);switch(u){case nb:QI(r,t);break;case s_:break;default:t[i]=u;break}break;case"scalar":try{const d=pm(r.T,e,r.L,!1);switch(d){case nb:QI(r,t);break;default:t[i]=d;break}}catch(d){let f="cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Io(e));throw d instanceof Error&&d.message.length>0&&(f+=": ".concat(d.message)),new Error(f)}break}}function Tce(t,e){if(t===Xe.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return pm(t,e,ru.BIGINT,!0).toString()}function pm(t,e,r,n){if(e===null)return n?lp(t,r):nb;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&&S5(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?nC(i):a_(i),i;case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:if(typeof e!="number"&&typeof e!="string")break;const o=Sn.parse(e);return r?o.toString():o;case Xe.FIXED64:case Xe.UINT64:if(typeof e!="number"&&typeof e!="string")break;const c=Sn.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 O5.dec(e)}throw new Error}function tE(t,e,r,n){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:n?t.values[0].no:nb;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 s_;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(Io(e)))}function Cce(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function rM(t,e,r){if(t.kind=="map"){Mn(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()]=o_(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()]=rE(i,c,r.enumAsInteger);break}return r.emitDefaultValues||a.length>0?n:void 0}if(t.repeated){Mn(Array.isArray(e));const n=[];switch(t.kind){case"scalar":for(let a=0;a<e.length;a++)n.push(o_(t.T,e[a]));break;case"enum":for(let a=0;a<e.length;a++)n.push(rE(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 o_(t.T,e);case"enum":return rE(t.T,e,r.enumAsInteger);case"message":return j5(t.T,e).toJson(r)}}function rE(t,e,r){var n;if(Mn(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 o_(t,e){switch(t){case Xe.INT32:case Xe.SFIXED32:case Xe.SINT32:case Xe.FIXED32:case Xe.UINT32:return Mn(typeof e=="number"),e;case Xe.FLOAT:case Xe.DOUBLE:return Mn(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case Xe.STRING:return Mn(typeof e=="string"),e;case Xe.BOOL:return Mn(typeof e=="boolean"),e;case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return Mn(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case Xe.BYTES:return Mn(e instanceof Uint8Array),O5.enc(e)}}const uf=Symbol("@bufbuild/protobuf/unknown-fields"),nM={readUnknownFields:!0,readerFactory:t=>new gce(t)},aM={writeUnknownFields:!0,writerFactory:()=>new mce};function xce(t){return t?Object.assign(Object.assign({},nM),t):nM}function Pce(t){return t?Object.assign(Object.assign({},aM),t):aM}function Ace(){return{makeReadOptions:xce,makeWriteOptions:Pce,listUnknownFields(t){var e;return(e=t[uf])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[uf]},writeUnknownFields(t,e){const n=t[uf];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[uf])||(a[uf]=[]),a[uf].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==qn.EndGroup));){const d=i.fields.find(c);if(!d){const f=e.skip(u,c);n.readUnknownFields&&this.onUnknownField(t,c,u,f);continue}iM(t,e,d,u,n)}if(a&&(u!=qn.EndGroup||c!==r))throw new Error("invalid end group tag")},readField:iM,writeMessage(t,e,r){const n=t.getType();for(const a of n.fields.byNumber()){if(!M5(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];sM(a,i,e,r)}return r.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,r,n){e!==void 0&&sM(t,e,r,n)}}}function iM(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=ab;if(r.kind=="scalar"&&r.L>0&&(u=Dce),i){let m=t[o];if(n==qn.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(c_(e,new d,a,r)):Ac(t[o])?c_(e,t[o],a,r):(t[o]=c_(e,new d,a,r),d.fieldWrapper&&!r.oneof&&!r.repeated&&(t[o]=d.fieldWrapper.unwrapField(t[o])));break;case"map":let[f,h]=Rce(r,e,a);t[o][f]=h;break}}function c_(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 Rce(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=ab(e,t.K);break;case 2:switch(t.V.kind){case"scalar":o=ab(e,t.V.T);break;case"enum":o=e.int32();break;case"message":o=c_(e,new t.V.T,r,void 0);break}break}}if(i===void 0&&(i=lp(t.K,ru.BIGINT)),typeof i!="string"&&typeof i!="number"&&(i=i.toString()),o===void 0)switch(t.V.kind){case"scalar":o=lp(t.V.T,ru.BIGINT);break;case"enum":o=t.V.T.values[0].no;break;case"message":o=new t.V.T;break}return[i,o]}function Dce(t,e){const r=ab(t,e);return typeof r=="bigint"?r.toString():r}function ab(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 sM(t,e,r,n){Mn(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(Mn(Array.isArray(e)),t.packed)Nce(r,i,t.no,e);else for(const o of e)hm(r,i,t.no,o);else hm(r,i,t.no,e);break;case"message":if(a){Mn(Array.isArray(e));for(const o of e)oM(r,n,t,o)}else oM(r,n,t,e);break;case"map":Mn(typeof e=="object"&&e!=null);for(const[o,c]of Object.entries(e))Oce(r,n,t,o,c);break}}function Oce(t,e,r,n,a){t.tag(r.no,qn.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:Mn(n=="true"||n=="false"),i=n=="true";break}switch(hm(t,r.K,1,i),r.V.kind){case"scalar":hm(t,r.V.T,2,a);break;case"enum":hm(t,Xe.INT32,2,a);break;case"message":Mn(a!==void 0),t.tag(2,qn.LengthDelimited).bytes(a.toBinary(e));break}t.join()}function oM(t,e,r,n){const a=j5(r.T,n);r.delimited?t.tag(r.no,qn.StartGroup).raw(a.toBinary(e)).tag(r.no,qn.EndGroup):t.tag(r.no,qn.LengthDelimited).bytes(a.toBinary(e))}function hm(t,e,r,n){Mn(n!==void 0);let[a,i]=L5(e);t.tag(r,a)[i](n)}function Nce(t,e,r,n){if(!n.length)return;t.tag(r,qn.LengthDelimited).fork();let[,a]=L5(e);for(let i=0;i<n.length;i++)t[a](n[i]);t.join()}function L5(t){let e=qn.Varint;switch(t){case Xe.BYTES:case Xe.STRING:e=qn.LengthDelimited;break;case Xe.DOUBLE:case Xe.FIXED64:case Xe.SFIXED64:e=qn.Bit64;break;case Xe.FIXED32:case Xe.SFIXED32:case Xe.FLOAT:e=qn.Bit32;break}const r=Xe[t].toLowerCase();return[e,r]}function Ice(){return{setEnumType:T5,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"&&!Ac(d,u.T)?d=new u.T(d):u&&u.kind==="scalar"&&u.T===Xe.BYTES&&(d=Ph(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(Ph):Ph(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][_]=Ph(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=>Ac(m,h)?m:new h(m));else{const m=o[a];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?i[a]=Ph(m):i[a]=m:i[a]=Ac(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)=>El(n.T,o,i[c]));case"enum":return a.every((o,c)=>El(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&&!Ac(o)&&(o=n.T.fieldWrapper.wrapField(o)),c!==void 0&&!Ac(c)&&(c=n.T.fieldWrapper.wrapField(c))),n.T.equals(o,c);case"enum":return El(Xe.INT32,a,i);case"scalar":return El(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 El(Xe.INT32,a.value,i.value);case"scalar":return El(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=>El(Xe.INT32,a[m],i[m]));case"scalar":const h=n.V.T;return d.every(m=>El(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(_v);else if(a.kind=="map"){o=n[a.localName];for(const[c,u]of Object.entries(i))o[c]=_v(u)}else a.kind=="oneof"?o=a.findField(i.case)?{case:i.case,value:_v(i.value)}:{case:void 0}:o=_v(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 _v(t){if(t===void 0)return t;if(Ac(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function Ph(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Mce(t,e,r){return{syntax:t,json:Ece(),bin:Ace(),util:Object.assign(Object.assign({},Ice()),{newFieldList:e,initFields:r}),makeMessageType(n,a,i){return lce(this,n,a,i)},makeEnum:cce,makeEnumType:C5,getEnumType:oce,makeExtension(n,a,i){return yce(this,n,a,i)}}}class jce{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 B5(t,e){const r=U5(t);return e?r:zce(qce(r))}function Lce(t){return B5(t,!1)}const Bce=U5;function U5(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 Uce=new Set(["constructor","toString","toJSON","valueOf"]),Fce=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),F5=t=>"".concat(t,"$"),qce=t=>Fce.has(t)?F5(t):t,zce=t=>Uce.has(t)?F5(t):t;class $ce{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=Lce(e)}addField(e){Mn(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 Vce(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=B5(f.name,f.oneof!==void 0),h.jsonName=(r=f.jsonName)!==null&&r!==void 0?r:Bce(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:ru.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 $ce(m)),h.oneof=d,d.addField(h)}u.push(h)}return u}const Te=Mce("proto3",t=>new jce(t,e=>Vce(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]=lp(e.T,e.L);break}}});class oi extends NP{constructor(e){super(),this.seconds=Sn.zero,this.nanos=0,Te.util.initPartial(e,this)}fromJson(e,r){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Te.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=Sn.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 oi.fromDate(new Date)}static fromDate(e){const r=e.getTime();return new oi({seconds:Sn.parse(Math.floor(r/1e3)),nanos:r%1e3*1e6})}static fromBinary(e,r){return new oi().fromBinary(e,r)}static fromJson(e,r){return new oi().fromJson(e,r)}static fromJsonString(e,r){return new oi().fromJsonString(e,r)}static equals(e,r){return Te.util.equals(oi,e,r)}}oi.runtime=Te;oi.typeName="google.protobuf.Timestamp";oi.fields=Te.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Hce=Te.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:oi},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:Gce,repeated:!0},{no:5,name:"events",kind:"message",T:Kce,repeated:!0}]),Gce=Te.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:Wce,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Wce=Te.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:oi},{no:3,name:"value",kind:"scalar",T:2}]),Kce=Te.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:oi},{no:7,name:"normalized_end_timestamp",kind:"message",T:oi,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),q5=Te.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Vs=Te.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Qn=Te.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"}]),MP=Te.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Jh=Te.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),$m=Te.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Ys=Te.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"}]),zu=Te.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"}]),Yce=Te.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),ha=Te.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"}]),l0=Te.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:ib,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:eq}]),ib=Te.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),Xce=Te.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:Te.getEnumType(Qn),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}]),fd=Te.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:Te.getEnumType(Ff)},{no:4,name:"tracks",kind:"message",T:Tf,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:Xce},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Te.getEnumType(Vm)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Te.getEnumType(Ys)},{no:18,name:"kind_details",kind:"enum",T:Te.getEnumType(Jce),repeated:!0}]),Ff=Te.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Vm=Te.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"}]),Jce=Te.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),oa=Te.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),Qce=Te.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:Vl,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Te.getEnumType(z5)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Tf=Te.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Te.getEnumType(Vs)},{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:Te.getEnumType(Qn)},{no:10,name:"layers",kind:"message",T:Vl,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:Qce,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:Te.getEnumType(oa)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:eq},{no:19,name:"audio_features",kind:"enum",T:Te.getEnumType(ha),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Te.getEnumType(q5)}]),Vl=Te.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Te.getEnumType(MP)},{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}]),z5=Te.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"}]),Ha=Te.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Te.getEnumType(gr)},{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:jP,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Zce,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:G5,oneof:"value"},{no:7,name:"transcription",kind:"message",T:ele,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Hce,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:sb,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:LP,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:BP,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:UP,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:ob,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:cb,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:lb,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:$5,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),gr=Te.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),$5=Te.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:Te.getEnumType(oa)},{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}]),V5=Te.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:jP,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:sb,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:LP,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:BP,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:UP,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:ob,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:cb,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:lb,oneof:"value"}]),Zce=Te.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:H5,repeated:!0}]),H5=Te.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}]),jP=Te.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}]),G5=Te.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),ele=Te.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:tle,repeated:!0}]),tle=Te.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}]),sb=Te.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}]),LP=Te.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}]),BP=Te.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),UP=Te.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:W5,oneof:"value"}]),W5=Te.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}]),K5=Te.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),Y5=Te.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Te.getEnumType(X5)},{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}]),X5=Te.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),J5=Te.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Te.getEnumType(Q5)},{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}]),Q5=Te.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"}]),Z5=Te.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:cM},{no:2,name:"screen",kind:"message",T:cM},{no:3,name:"resume_connection",kind:"enum",T:Te.getEnumType($m)},{no:4,name:"disabled_codecs",kind:"message",T:rle},{no:5,name:"force_relay",kind:"enum",T:Te.getEnumType($m)}]),cM=Te.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Te.getEnumType($m)}]),rle=Te.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:ib,repeated:!0},{no:2,name:"publish",kind:"message",T:ib,repeated:!0}]),eq=Te.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),aC=Te.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),tq=Te.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Te.getEnumType(aC)},{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"}),rq=Te.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),ob=Te.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:Te.getEnumType(oa)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:tq,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:rq,oneof:"content_header"}],{localName:"DataStream_Header"}),cb=Te.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"}),lb=Te.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"}),nle=Te.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),Hs=Te.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),iC=Te.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),ale=Te.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),ile=Te.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:nu,oneof:"message"},{no:2,name:"answer",kind:"message",T:nu,oneof:"message"},{no:3,name:"trickle",kind:"message",T:u0,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Hm,oneof:"message"},{no:5,name:"mute",kind:"message",T:d0,oneof:"message"},{no:6,name:"subscription",kind:"message",T:f0,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:nq,oneof:"message"},{no:8,name:"leave",kind:"message",T:p0,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:iq,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:cq,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:VP,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Do,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:zP,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:dq,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:qP,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:aq,oneof:"message"}]),lM=Te.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:sle,oneof:"message"},{no:2,name:"answer",kind:"message",T:nu,oneof:"message"},{no:3,name:"offer",kind:"message",T:nu,oneof:"message"},{no:4,name:"trickle",kind:"message",T:u0,oneof:"message"},{no:5,name:"update",kind:"message",T:lle,oneof:"message"},{no:6,name:"track_published",kind:"message",T:FP,oneof:"message"},{no:8,name:"leave",kind:"message",T:p0,oneof:"message"},{no:9,name:"mute",kind:"message",T:d0,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:ule,oneof:"message"},{no:11,name:"room_update",kind:"message",T:dle,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:ple,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:mle,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:yle,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:_le,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:cle,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:ole,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:kle,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:Ele,oneof:"message"},{no:22,name:"request_response",kind:"message",T:Tle,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:Cle,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:ble,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:Rle,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:vle,oneof:"message"}]),sC=Te.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:Vl,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Te.getEnumType(z5)}]),Hm=Te.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:Te.getEnumType(Vs)},{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:Te.getEnumType(Qn)},{no:9,name:"layers",kind:"message",T:Vl,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:sC,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:Te.getEnumType(oa)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Te.getEnumType(q5)},{no:17,name:"audio_features",kind:"enum",T:Te.getEnumType(ha),repeated:!0}]),u0=Te.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Te.getEnumType(Hs)},{no:3,name:"final",kind:"scalar",T:8}]),d0=Te.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),sle=Te.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:l0},{no:2,name:"participant",kind:"message",T:fd},{no:3,name:"other_participants",kind:"message",T:fd,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:sq,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:Z5},{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:Y5},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:ib,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),ole=Te.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:sq,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Z5},{no:3,name:"server_info",kind:"message",T:Y5},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),FP=Te.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Tf}]),cle=Te.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),nu=Te.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}}]),lle=Te.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:fd,repeated:!0}]),f0=Te.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:K5,repeated:!0}]),nq=Te.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:Te.getEnumType(MP)},{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}]),qP=Te.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Te.getEnumType(ha),repeated:!0}]),aq=Te.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}]),p0=Te.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Te.getEnumType(Ys)},{no:3,name:"action",kind:"enum",T:Te.getEnumType(qf)},{no:4,name:"regions",kind:"message",T:wle}]),qf=Te.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),iq=Te.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Vl,repeated:!0}]),zP=Te.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}]),sq=Te.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}]),ule=Te.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:H5,repeated:!0}]),dle=Te.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:l0}]),fle=Te.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Te.getEnumType(Jh)},{no:3,name:"score",kind:"scalar",T:2}]),ple=Te.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:fle,repeated:!0}]),hle=Te.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:Te.getEnumType(iC)}]),mle=Te.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:hle,repeated:!0}]),$P=Te.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Te.getEnumType(MP)},{no:2,name:"enabled",kind:"scalar",T:8}]),gle=Te.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:$P,repeated:!0}]),yle=Te.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:$P,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:gle,repeated:!0}]),vle=Te.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:nle,repeated:!0}]),oq=Te.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}]),cq=Te.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:oq,repeated:!0}]),_le=Te.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}]),ble=Te.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:l0},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:fd},{no:4,name:"other_participants",kind:"message",T:fd,repeated:!0}]),VP=Te.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:nu},{no:2,name:"subscription",kind:"message",T:f0},{no:3,name:"publish_tracks",kind:"message",T:FP,repeated:!0},{no:4,name:"data_channels",kind:"message",T:uq,repeated:!0},{no:5,name:"offer",kind:"message",T:nu},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:lq,repeated:!0}]),lq=Te.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),uq=Te.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:Te.getEnumType(Hs)}]),Do=Te.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:Te.getEnumType(ale),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"}]),dq=Te.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),kle=Te.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),wle=Te.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:Sle,repeated:!0}]),Sle=Te.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}]),Ele=Te.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Te.getEnumType(Yce)}]),Tle=Te.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Te.getEnumType(HP)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:u0,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Hm,oneof:"request"},{no:6,name:"mute",kind:"message",T:d0,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:zP,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:qP,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:aq,oneof:"request"}]),HP=Te.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"}]),Cle=Te.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),fq=Te.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}]),xle=Te.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:J5},{no:2,name:"connection_settings",kind:"message",T:fq},{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:Hm,repeated:!0},{no:6,name:"publisher_offer",kind:"message",T:nu},{no:7,name:"reconnect",kind:"scalar",T:8},{no:8,name:"reconnect_reason",kind:"enum",T:Te.getEnumType(zu)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:VP}]),Ple=Te.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:Te.getEnumType(Ale)},{no:2,name:"join_request",kind:"scalar",T:12}]),Ale=Te.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),Rle=Te.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function Dle(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l_={exports:{}},Ole=l_.exports,uM;function Nle(){return uM||(uM=1,(function(t){(function(e,r){t.exports?t.exports=r():e.log=r()})(Ole,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,D,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 R(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??D},T.setLevel=function(L,j){return A=R(L),j!==!1&&O(A),f.call(T)},T.setDefaultLevel=function(L){P=R(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&&(D=R(o.getLevel())),f.call(T),o===T)for(var L in i)i[L].rebuild()},D=R(o?o.getLevel():"WARN");var N=I();N!=null&&(A=R(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})})(l_)),l_.exports}var h0=Nle(),oC;(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"})(oC||(oC={}));var no;(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"})(no||(no={}));let cr=h0.getLogger("livekit");Object.values(no).map(t=>h0.getLogger(t));cr.setDefaultLevel(oC.info);function Vc(t){const e=h0.getLogger(t);return e.setDefaultLevel(cr.getLevel()),e}const Ile=h0.getLogger("lk-e2ee"),Ah=7e3,Mle=[0,300,4*300,9*300,16*300,Ah,Ah,Ah,Ah,Ah];class jle{constructor(e){this._retryDelays=e!==void 0?[...e]:Mle}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 Lle(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 dM(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 Rc(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 dM=="function"?dM(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 bv={exports:{}},fM;function Ble(){if(fM)return bv.exports;fM=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)}bv.exports=i,bv.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",R=this._events;if(R!==void 0)x=x&&R.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=R[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,R,N;if(c(O),R=A._events,R===void 0?(R=A._events=Object.create(null),A._eventsCount=0):(R.newListener!==void 0&&(A.emit("newListener",C,O.listener?O.listener:O),R=A._events),N=R[C]),N===void 0)N=R[C]=O,++A._eventsCount;else if(typeof N=="function"?N=R[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,R,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(R=-1,N=I.length-1;N>=0;N--)if(I[N]===O||I[N].listener===O){L=I[N].listener,R=N;break}if(R<0)return this;R===0?I.shift():b(I,R),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 R=Object.keys(I),N;for(x=0;x<R.length;++x)N=R[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,R),I(N)}function R(){typeof A.removeListener=="function"&&A.removeListener("error",x),O([].slice.call(arguments))}P(A,C,R,{once:!0}),C!=="error"&&D(A,x,{once:!0})})}function D(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(R){I.once&&A.removeEventListener(C,x),O(R)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof A)}return bv.exports}var tc=Ble();let pq=!0,Ule=!0;function Qh(t,e,r){const n=t.match(e);return n&&n.length>=r&&parseFloat(n[r],10)}function _d(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 Fle(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(pq=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function qle(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(Ule=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function hq(){}function zle(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(Qh(r.userAgent,/Firefox\/(\d+)\./,1));else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(Qh(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(Qh(r.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=Qh(r.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function pM(t){return Object.prototype.toString.call(t)==="[object Object]"}function mq(t){return pM(t)?Object.keys(t).reduce(function(e,r){const n=pM(t[r]),a=n?mq(t[r]):t[r],i=n&&!Object.keys(a).length;return a===void 0||i?e:Object.assign(e,{[r]:a})},{}):t}function cC(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?cC(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(a=>{cC(t,t.get(a),r)})}))}function hM(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&&cC(t,c,a)})}),a}const mM=hq;function gq(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),mM("chrome: "+JSON.stringify(c)),u(c)})}c.video=n(c.video)}return mM("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 yq(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function vq(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 _d(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function _q(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 bq(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=>hM(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}),_d(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){const a=this;return this._pc.getStats().then(i=>hM(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 kq(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 wq(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return kq(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 lC(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 Sq(t,e){_d(t,"negotiationneeded",r=>{const n=r.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return r})}var gM=Object.freeze({__proto__:null,fixNegotiationNeeded:Sq,shimAddTrackRemoveTrack:wq,shimAddTrackRemoveTrackWithNative:kq,shimGetSendersWithDtmf:_q,shimGetUserMedia:gq,shimMediaStream:yq,shimOnTrack:vq,shimPeerConnection:lC,shimSenderReceiverGetStats:bq});function Eq(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 $le(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 Tq(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 uC(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 Cq(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 xq(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}),_d(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Pq(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 Aq(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function Rq(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 Dq(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 Oq(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 Nq(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 yM=Object.freeze({__proto__:null,shimAddTransceiver:Rq,shimCreateAnswer:Nq,shimCreateOffer:Oq,shimGetDisplayMedia:$le,shimGetParameters:Dq,shimGetUserMedia:Eq,shimOnTrack:Tq,shimPeerConnection:uC,shimRTCDataChannel:Aq,shimReceiverGetStats:xq,shimRemoveStream:Pq,shimSenderGetStats:Cq});function Iq(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 Mq(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 jq(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 Lq(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(Bq(a))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,a,i){e.mediaDevices.getUserMedia(n).then(a,i)}).bind(e))}function Bq(t){return t&&t.video!==void 0?Object.assign({},t,{video:mq(t.video)}):t}function Uq(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 Fq(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 qq(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 zq(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var vM=Object.freeze({__proto__:null,shimAudioContext:zq,shimCallbacksAPI:jq,shimConstraints:Bq,shimCreateOfferLegacy:qq,shimGetUserMedia:Lq,shimLocalStreamsAPI:Iq,shimRTCIceServerUrls:Uq,shimRemoteStreamsAPI:Mq,shimTrackEventTransceiver:Fq}),nE={exports:{}},_M;function Vle(){return _M||(_M=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})(nE)),nE.exports}var $q=Vle(),zf=Dle($q),Hle=Zoe({__proto__:null,default:zf},[$q]);function u_(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=zf.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,_d(t,"icecandidate",r=>(r.candidate&&Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}function dC(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||_d(t,"icecandidate",e=>{if(e.candidate){const r=zf.parseCandidate(e.candidate.candidate);r.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[r.priority>>24])}return e})}function d_(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=zf.splitSections(c.sdp);return u.shift(),u.some(d=>{const f=zf.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=zf.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 f_(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},_d(t,"datachannel",n=>(e(n.channel,n.target),n))}function fC(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 pC(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 p_(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 h_(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 Gle=Object.freeze({__proto__:null,removeExtmapAllowMixed:pC,shimAddIceCandidateNullOrEmpty:p_,shimConnectionState:fC,shimMaxMessageSize:d_,shimParameterlessSetLocalDescription:h_,shimRTCIceCandidate:u_,shimRTCIceCandidateRelayProtocol:dC,shimSendThrowTypeError:f_});function Wle(){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=hq,n=zle(t),a={browserDetails:n,commonShim:Gle,extractVersion:Qh,disableLog:Fle,disableWarnings:qle,sdp:Hle};switch(n.browser){case"chrome":if(!gM||!lC||!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=gM,p_(t,n),h_(t),gq(t,n),yq(t),lC(t,n),vq(t),wq(t,n),_q(t),bq(t),Sq(t,n),u_(t),dC(t),fC(t),d_(t,n),f_(t),pC(t,n);break;case"firefox":if(!yM||!uC||!e.shimFirefox)return r("Firefox shim is not included in this adapter release."),a;r("adapter.js shimming firefox."),a.browserShim=yM,p_(t,n),h_(t),Eq(t,n),uC(t,n),Tq(t),Pq(t),Cq(t),xq(t),Aq(t),Rq(t),Dq(t),Oq(t),Nq(t),u_(t),fC(t),d_(t,n),f_(t);break;case"safari":if(!vM||!e.shimSafari)return r("Safari shim is not included in this adapter release."),a;r("adapter.js shimming safari."),a.browserShim=vM,p_(t,n),h_(t),Uq(t),qq(t),jq(t),Iq(t),Mq(t),Fq(t),Lq(t),zq(t),u_(t),dC(t),d_(t,n),f_(t),pC(t,n);break;default:r("Unsupported browser!");break}return a}Wle({window:typeof window>"u"?void 0:window});class di 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 Kle=/version\/(\d+(\.?_?\d+)+)/i;let aE;function hi(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const r=navigator.userAgent.toLowerCase();if(aE===void 0||e){const n=Yle.find(a=>{let{test:i}=a;return i.test(r)});aE=n?.describe(r)}return aE}const Yle=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:m_(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:iE(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:m_(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:iE(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:m_(Kle,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:iE(t)}}}];function m_(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 iE(t){return t.includes("mac os")?m_(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var Xle="2.17.0";const Jle=Xle,Qle=16;class rc extends Error{constructor(e,r){super(r||"an error has occured"),this.name="LiveKitError",this.code=e}}var dn;(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"})(dn||(dn={}));class Yt extends rc{constructor(e,r,n,a){super(1,e),this.name="ConnectionError",this.status=n,this.reason=r,this.context=a,this.reasonName=dn[r]}static notAllowed(e,r,n){return new Yt(e,dn.NotAllowed,r,n)}static timeout(e){return new Yt(e,dn.Timeout)}static leaveRequest(e,r){return new Yt(e,dn.LeaveRequest,void 0,r)}static internal(e,r){return new Yt(e,dn.InternalError,void 0,r)}static cancelled(e){return new Yt(e,dn.Cancelled)}static serverUnreachable(e,r){return new Yt(e,dn.ServerUnreachable,r)}static websocket(e,r,n){return new Yt(e,dn.WebSocket,r,n)}static serviceNotFound(e,r){return new Yt(e,dn.ServiceNotFound,void 0,r)}}class GP extends rc{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Dc extends rc{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class Zle extends rc{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class Fn extends rc{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class $f extends rc{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class bM extends rc{constructor(e,r){super(15,e),this.name="PublishTrackError",this.status=r}}class kM extends rc{constructor(e,r){super(15,e),this.name="SignalRequestError",this.reason=r,this.reasonName=typeof r=="string"?r:HP[r]}}var Va;(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"})(Va||(Va={}));class ss extends rc{constructor(e,r){super(16,e),this.name="DataStreamError",this.reason=r,this.reasonName=Va[r]}}class df extends rc{constructor(e){super(18,e),this.name="SignalReconnectError"}}var ub;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(ub||(ub={}));(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})(ub||(ub={}));class Pa{}Pa.setTimeout=function(){return setTimeout(...arguments)};Pa.setInterval=function(){return setInterval(...arguments)};Pa.clearTimeout=function(){return clearTimeout(...arguments)};Pa.clearInterval=function(){return clearInterval(...arguments)};var nt;(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"})(nt||(nt={}));var kt;(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"})(kt||(kt={}));var vt;(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"})(vt||(vt={}));var ht;(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"})(ht||(ht={}));function eue(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 tn{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 tue=["vp8","h264"],rue=["vp8","h264","vp9","av1","h265"];function nue(t){return!!tue.find(e=>e===t)}const aue=nue;var wM;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(wM||(wM={}));var hC;(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}})(hC||(hC={}));const up={h90:new tn(160,90,9e4,20),h180:new tn(320,180,16e4,20),h216:new tn(384,216,18e4,20),h360:new tn(640,360,45e4,20),h540:new tn(960,540,8e5,25),h720:new tn(1280,720,17e5,30),h1080:new tn(1920,1080,3e6,30),h1440:new tn(2560,1440,5e6,30),h2160:new tn(3840,2160,8e6,30)},mC={h120:new tn(160,120,7e4,20),h180:new tn(240,180,125e3,20),h240:new tn(320,240,14e4,20),h360:new tn(480,360,33e4,20),h480:new tn(640,480,5e5,20),h540:new tn(720,540,6e5,25),h720:new tn(960,720,13e5,30),h1080:new tn(1440,1080,23e5,30),h1440:new tn(1920,1440,38e5,30)},WP={h360fps3:new tn(640,360,2e5,3,"medium"),h360fps15:new tn(640,360,4e5,15,"medium"),h720fps5:new tn(1280,720,8e5,5,"medium"),h720fps15:new tn(1280,720,15e5,15,"medium"),h720fps30:new tn(1280,720,2e6,30,"medium"),h1080fps15:new tn(1920,1080,25e5,15,"medium"),h1080fps30:new tn(1920,1080,5e6,30,"medium"),original:new tn(0,0,7e6,30,"medium")};function Vq(t,e,r){var n,a,i,o;const{optionsWithoutProcessor:c,audioProcessor:u,videoProcessor:d}=Wq(t??{}),f=e?.processor,h=r?.processor,m=c??{};return m.audio===!0&&(m.audio={}),m.video===!0&&(m.video={}),m.audio&&(gC(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&&(gC(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 gC(t,e){return Object.keys(e).forEach(r=>{t[r]===void 0&&(t[r]=e[r])}),t}function KP(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":gC(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 Hq(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=Gq();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 Aa(r),a.getByteTimeDomainData(o);const u=o.some(d=>d!==128&&d!==0);return n.close(),!u}return!1})()})}function Gq(){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 iue(t){return t==="audioinput"?Ye.Source.Microphone:t==="videoinput"?Ye.Source.Camera:Ye.Source.Unknown}function yC(t){return t===Ye.Source.Microphone?"audioinput":t===Ye.Source.Camera?"videoinput":void 0}function sue(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,hd()?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 mm(t){return t.split("/")[1].toLowerCase()}function oue(t){const e=[];return t.forEach(r=>{r.track!==void 0&&e.push(new FP({cid:r.track.mediaStreamID,track:r.trackInfo}))}),e}function _r(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?_r(t.track):{})}}function cue(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function lue(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 Wq(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:eue(e)}}function uue(t){switch(t){case Qn.CAMERA:return Ye.Source.Camera;case Qn.MICROPHONE:return Ye.Source.Microphone;case Qn.SCREEN_SHARE:return Ye.Source.ScreenShare;case Qn.SCREEN_SHARE_AUDIO:return Ye.Source.ScreenShareAudio;default:return Ye.Source.Unknown}}function SM(t,e){return t.width*t.height<e.width*e.height}function due(t,e){var r;return(r=t.layers)===null||r===void 0?void 0:r.find(n=>n.quality===e)}const fue=5e3,Rh=[];var ji;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(ji||(ji={}));class Ye extends tc.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=Ye.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=cr,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),fue):this.handleAppVisibilityChanged()},this.log=Vc((a=n.loggerName)!==null&&a!==void 0?a:no.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=r,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=Ye.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),_r(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let r="audio";this.kind===Ye.Kind.Video&&(r="video"),this.attachedElements.length===0&&this.kind===Ye.Kind.Video&&this.addAppVisibilityListener(),e||(r==="audio"&&(Rh.forEach(i=>{i.parentElement===null&&!e&&(e=i)}),e&&Rh.splice(Rh.indexOf(e),1)),e||(e=document.createElement(r))),this.attachedElements.includes(e)||this.attachedElements.push(e),Cf(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),a=n.some(i=>i.kind==="audio");return e.play().then(()=>{this.emit(a?ht.AudioPlaybackStarted:ht.VideoPlaybackStarted)}).catch(i=>{i.name==="NotAllowedError"?this.emit(a?ht.AudioPlaybackFailed:ht.VideoPlaybackFailed,i):i.name==="AbortError"?cr.debug("".concat(a?"audio":"video"," playback aborted, likely due to new play request")):cr.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(ht.ElementAttached,e),e}detach(e){try{if(e){Vf(this.mediaStreamTrack,e);const n=this.attachedElements.indexOf(e);return n>=0&&(this.attachedElements.splice(n,1),this.recycleElement(e),this.emit(ht.ElementDetached,e)),e}const r=[];return this.attachedElements.forEach(n=>{Vf(this.mediaStreamTrack,n),r.push(n),this.recycleElement(n),this.emit(ht.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=Vc(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let r=!0;e.pause(),Rh.forEach(n=>{n.parentElement||(r=!1)}),r&&Rh.push(e)}}handleAppVisibilityChanged(){return ne(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===Ye.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){fi()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){fi()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Cf(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)),(!hd()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=r.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==r&&(e.srcObject=r,(hd()||pd())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=r,e.play().catch(()=>{})},0))}function Vf(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 Vs.AUDIO;case e.Video:return Vs.VIDEO;default:return Vs.DATA}}t.kindToProto=a;function i(d){switch(d){case Vs.AUDIO:return e.Audio;case Vs.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=i;function o(d){switch(d){case r.Camera:return Qn.CAMERA;case r.Microphone:return Qn.MICROPHONE;case r.ScreenShare:return Qn.SCREEN_SHARE;case r.ScreenShareAudio:return Qn.SCREEN_SHARE_AUDIO;default:return Qn.UNKNOWN}}t.sourceToProto=o;function c(d){switch(d){case Qn.CAMERA:return r.Camera;case Qn.MICROPHONE:return r.Microphone;case Qn.SCREEN_SHARE:return r.ScreenShare;case Qn.SCREEN_SHARE_AUDIO:return r.ScreenShareAudio;default:return r.Unknown}}t.sourceFromProto=c;function u(d){switch(d){case iC.ACTIVE:return n.Active;case iC.PAUSED:return n.Paused;default:return n.Unknown}}t.streamStateFromProto=u})(Ye||(Ye={}));const pue="|",EM="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function hue(t){const e=t.split(pue);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function Aa(t){return new di(e=>Pa.setTimeout(e,t))}function vC(){return"addTransceiver"in RTCPeerConnection.prototype}function _C(){return"addTrack"in RTCPeerConnection.prototype}function mue(){if(!("getCapabilities"in RTCRtpSender)||hd()||pd())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 gue(){if(!("getCapabilities"in RTCRtpSender)||pd())return!1;if(hd()){const r=hi();if(r?.version&&Qo(r.version,"16")<0||r?.os==="iOS"&&r?.osVersion&&Qo(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 Gs(t){return t==="av1"||t==="vp9"}function bC(t){return!document||Gm()?!1:(t||(t=document.createElement("audio")),"setSinkId"in t)}function yue(){return typeof RTCPeerConnection>"u"?!1:vC()||_C()}function pd(){var t;return((t=hi())===null||t===void 0?void 0:t.name)==="Firefox"}function TM(){const t=hi();return!!t&&t.name==="Chrome"&&t.os!=="iOS"}function hd(){var t;return((t=hi())===null||t===void 0?void 0:t.name)==="Safari"}function Gm(){const t=hi();return t?.name==="Safari"||t?.os==="iOS"}function vue(){const t=hi();return t?.name==="Safari"&&t.version.startsWith("17.")||t?.os==="iOS"&&!!t?.osVersion&&Qo(t.osVersion,"17")>=0}function _ue(t){return t||(t=hi()),t?.name==="Safari"&&Qo(t.version,"18.3")>0||t?.os==="iOS"&&!!t?.osVersion&&Qo(t.osVersion,"18.3")>0}function Kq(){var t,e;return fi()?(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 bue(){const t=hi(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&Qo(t.osVersion,e)>=0?!0:t.name==="Safari"&&Qo(t.version,e)>=0}function fi(){return typeof document<"u"}function Jo(){return navigator.product=="ReactNative"}function dp(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function sE(t){return dp(t)?t.hostname.split(".")[0]:null}function Yq(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Xq(){if(!Jo())return;let t=Yq();if(t)return t.platform}function CM(){if(fi())return window.devicePixelRatio;if(Jo()){let t=Yq();if(t)return t.devicePixelRatio}return 1}function Qo(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 kue(t){for(const e of t)e.target.handleResize(e)}function wue(t){for(const e of t)e.target.handleVisibilityChanged(e)}let oE=null;const xM=()=>(oE||(oE=new ResizeObserver(kue)),oE);let cE=null;const PM=()=>(cE||(cE=new IntersectionObserver(wue,{root:null,rootMargin:"0px"})),cE);function Sue(){var t;const e=new J5({sdk:Q5.JS,protocol:Qle,version:Jle});return Jo()&&(e.os=(t=Xq())!==null&&t!==void 0?t:""),e}function AM(){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 Dh;function lE(){if(!Dh){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(),[Dh]=n.stream.getAudioTracks(),!Dh)throw Error("Could not get empty media stream audio track");Dh.enabled=!1}return Dh.clone()}class ps{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 Eue(t){return rue.includes(t)}function Hl(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 Tue(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function Wm(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function Cue(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 xue(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 RM(t){switch(t.reason){case dn.LeaveRequest:return t.context;case dn.Cancelled:return Ys.CLIENT_INITIATED;case dn.NotAllowed:return Ys.USER_REJECTED;case dn.ServerUnreachable:return Ys.JOIN_FAILURE;default:return Ys.UNKNOWN_REASON}}function g_(t){return t!==void 0?Number(t):void 0}function $u(t){return t!==void 0?BigInt(t):void 0}function Hf(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function $o(t){return!!t&&t.kind==Ye.Kind.Audio}function hu(t){return!!t&&t.kind==Ye.Kind.Video}function Tl(t){return Hf(t)&&hu(t)}function Tc(t){return Hf(t)&&$o(t)}function kC(t){return!!t&&!t.isLocal}function Pue(t){return!!t&&!t.isLocal}function uE(t){return kC(t)&&hu(t)}function Aue(t){return t.isLocal}function Rue(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 Due(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 Oue(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const n=Nue(t,e);return r?n:YP(n,"v1")}function Nue(t,e){const r=new URL(Tue(t));return e.forEach((n,a)=>{r.searchParams.set(a,n)}),YP(r,"rtc")}function Iue(t){const e=new URL(Wm(t));return YP(e,"validate")}function Jq(t){return t.endsWith("/")?t:"".concat(t,"/")}function YP(t,e){return t.pathname="".concat(Jq(t.pathname)).concat(e),t}function DM(t){if(typeof t=="string")return lM.fromJson(JSON.parse(t),{ignoreUnknownFields:!0});if(t instanceof ArrayBuffer)return lM.fromBinary(new Uint8Array(t));throw new Error("could not decode websocket message: ".concat(typeof t))}function Mue(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 jue=10,Oh="lk_e2ee",Lue="LKFrameEncryptionKey",Bue={sharedKey:!1,ratchetSalt:Lue,ratchetWindowSize:8,failureTolerance:jue,keyringSize:16};var Gl;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(Gl||(Gl={}));var OM;(function(t){t.KeyRatcheted="keyRatcheted"})(OM||(OM={}));var jl;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(jl||(jl={}));var NM;(function(t){t.Error="cryptorError"})(NM||(NM={}));function Uue(){return Fue()||wC()}function wC(){return typeof window.RTCRtpScriptTransform<"u"}function Fue(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}function que(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 V5({value:t.value})}class qSe extends tc.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(r,n,a)=>{cr.debug("key ratcheted event received",{ratchetResult:r,participantId:n,keyIndex:a})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Bue),e),this.on(Gl.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(Gl.SetKey,a)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,r){this.emit(Gl.RatchetRequest,e,r)}}var IM;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(IM||(IM={}));class zue extends tc.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(cr.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(jl.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(jl.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(jl.ParticipantEncryptionStatusChanged,c.enabled,f)}break;case"ratchetKey":this.keyProvider.emit(Gl.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=>{cr.error("e2ee worker encountered an error:",{error:n.error}),this.emit(jl.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(!Uue())throw new GP("tried to setup end-to-end encryption on an unsupported browser");if(cr.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:Ile.getLevel()}};this.worker&&(cr.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(r))}}setParticipantCryptorEnabled(e,r){cr.debug("set e2ee to ".concat(e," for participant ").concat(r)),this.postEnable(e,r)}setSifTrailer(e){!e||e.length===0?cr.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(vt.RTPVideoMapUpdate,r=>{this.postRTPMap(r)})}setupEventListeners(e,r){e.on(nt.TrackPublished,(n,a)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==oa.NONE,a.identity)),e.on(nt.ConnectionStateChanged,n=>{n===jr.Connected&&e.remoteParticipants.forEach(a=>{a.trackPublications.forEach(i=>{this.setParticipantCryptorEnabled(i.trackInfo.encryption!==oa.NONE,a.identity)})})}).on(nt.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(nt.TrackSubscribed,(n,a,i)=>{this.setupE2EEReceiver(n,i.identity,a.trackInfo)}).on(nt.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(kt.LocalSenderCreated,(n,a)=>ne(this,void 0,void 0,function*(){this.setupE2EESender(a,n)})),e.localParticipant.on(kt.LocalTrackPublished,n=>{if(!hu(n.track)||!Gm())return;const a={kind:"updateCodec",data:{trackId:n.track.mediaStreamID,codec:mm(n.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(a)}),r.on(Gl.SetKey,n=>this.postKey(n)).on(Gl.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 ps;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 ps;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"?mm(n.mimeType):void 0)}}setupE2EESender(e,r){if(!Hf(e)||!r){r||cr.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(wC()&&!TM()){const i={kind:"decode",participantIdentity:n,trackId:r,codec:a};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{if(Oh 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:Oh in e}};this.worker.postMessage(c,[o,i])}e[Oh]=!0}})}handleSender(e,r,n){var a;if(!(Oh 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(wC()&&!TM()){cr.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{cr.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[Oh]=!0}}}const $ue=500,Vue=15e3;class Gf{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||(this._instance=new Gf),this._instance}addFailedConnectionAttempt(e){var r;const n=new URL(e),a=sE(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,Aa(Math.min($ue*Math.pow(2,i),Vue)))}getBackOffPromise(e){const r=new URL(e),n=r&&sE(r);return n&&this.backOffPromises.get(n)||Promise.resolve()}resetFailedConnectionAttempts(e){const r=new URL(e),n=r&&sE(r);n&&(this.failedConnectionAttempts.set(n,0),this.backOffPromises.set(n,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}}Gf._instance=null;const dE="default";class ma{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new ma),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=ma.userMediaPromiseMap)===null||i===void 0?void 0:i.size)>0){cr.debug("awaiting getUserMedia promise");try{r?yield ma.userMediaPromiseMap.get(r):yield Promise.all(ma.userMediaPromiseMap.values())}catch{cr.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(a&&!(hd()&&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!==dE)return r;const a=yield this.getDevices(e),i=a.find(c=>c.deviceId===dE);if(!i){cr.warn("could not reliably determine default device");return}const o=a.find(c=>c.deviceId!==dE&&c.groupId===(n??i.groupId));if(!o){cr.warn("could not reliably determine default device");return}return o?.deviceId})}hasDeviceInUse(e){return e?ma.userMediaPromiseMap.has(e):ma.userMediaPromiseMap.size>0}}ma.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];ma.userMediaPromiseMap=new Map;var gm;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(gm||(gm={}));class Hue{constructor(){this.pendingTasks=new Map,this.taskMutex=new Ya,this.nextTaskIndex=0}run(e){return ne(this,void 0,void 0,function*(){const r={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:gm.WAITING};this.pendingTasks.set(r.id,r);const n=yield this.taskMutex.lock();try{return r.executedAt=Date.now(),r.status=gm.RUNNING,yield e()}finally{r.status=gm.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 Gue{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 di((c,u)=>{const d=()=>{u(Yt.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 di((c,u)=>{const d=()=>ne(this,void 0,void 0,function*(){const f=new di(m=>{i.readyState!==WebSocket.CLOSED&&i.addEventListener("close",_=>{m(_)},{once:!0})}),h=yield di.race([Aa(250),f]);h?c(h):u(Yt.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 Wue=["syncState","trickle","offer","answer","simulate","leave"];function Kue(t){const e=Wue.indexOf(t.case)>=0;return cr.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var un;(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"})(un||(un={}));const Yue=250;class XP{get currentState(){return this.state}get isDisconnected(){return this.state===un.DISCONNECTING||this.state===un.DISCONNECTED}get isEstablishingConnection(){return this.state===un.CONNECTING||this.state===un.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=un.DISCONNECTED,this.log=cr,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=Vc((n=r.loggerName)!==null&&n!==void 0?n:no.Signal),this.loggerContextCb=r.loggerContextCb,this.useJSON=e,this.requestQueue=new Hue,this.queuedRequests=[],this.closingLock=new Ya,this.connectionLock=new Ya,this.state=un.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=un.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=un.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=Sue(),_=f?Xue(o,m,c):Jue(o,m,c),w=Oue(i,_,f).toString(),b=Iue(w).toString();return new Promise((E,T)=>ne(d,void 0,void 0,function*(){var D,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=Mue(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(Yt.cancelled(j))});u?.addEventListener("abort",C);const O=()=>{clearTimeout(I),u?.removeEventListener("abort",C)},I=setTimeout(()=>{C(Yt.timeout("room connection has timed out (signal)"))},c.websocketTimeout),x=(N,L)=>{this.handleSignalConnected(N,I,L)},R=new URL(w);R.searchParams.has("access_token")&&R.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(R),Object.assign({reconnect:c.reconnect,reconnectReason:c.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new Gue(w);try{this.ws.closed.then(F=>{var X;this.isEstablishingConnection&&T(Yt.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===un.CONNECTED&&this.handleOnClose((X=F.reason)!==null&&X!==void 0?X:"Unexpected WS error"))}).catch(F=>{this.isEstablishingConnection&&T(Yt.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!==un.CONNECTED){this.state=un.DISCONNECTED,clearTimeout(I);const X=yield this.handleConnectionError(F,b);T(X);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 Yt.internal("no message received as first message");const q=DM(j.value),U=this.validateFirstMessage(q,(D=c.reconnect)!==null&&D!==void 0?D:!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 Y=U.shouldProcessFirstMessage?q:void 0;x(N,Y),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 Aa(this.signalLatency));const{done:n,value:a}=yield e.read();if(n)break;const i=DM(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([un.DISCONNECTING||un.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=un.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,Aa(Yue)])}}catch(i){e.log.debug("websocket error while closing",Object.assign(Object.assign({},e.logContext),{error:i}))}finally{r&&(e.state=un.DISCONNECTED),a()}})()})}sendOffer(e,r){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:xf(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:xf(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 u0({candidateInit:JSON.stringify(e),target:r})})}sendMuteTrack(e,r){return this.sendRequest({case:"mute",value:new d0({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 zP({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 iq({trackSid:e,layers:r})})}sendUpdateSubscriptionPermissions(e,r){return this.sendRequest({case:"subscriptionPermission",value:new cq({allParticipants:e,trackPermissions:r})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:Sn.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new dq({timestamp:Sn.parse(Date.now()),rtt:Sn.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,r){return this.sendRequest({case:"updateAudioTrack",value:new qP({trackSid:e,features:r})})}sendLeave(){return this.sendRequest({case:"leave",value:new p0({reason:Ys.CLIENT_INITIATED,action:qf.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&&!Kue(r)&&n.state===un.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 Aa(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 ile({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=MM(a.value);this.onAnswer&&this.onAnswer(o,a.value.id,a.value.midToTrackId)}else if(a.case==="offer"){const o=MM(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===un.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=Pa.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&&Pa.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=Pa.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Pa.clearInterval(this.pingInterval)}handleSignalConnected(e,r,n){this.state=un.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===un.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:Yt.leaveRequest("Received leave request while trying to (re)connect",e.message.value.reason)}:r?{isValid:!1,error:Yt.internal("Unexpected first message")}:{isValid:!1,error:Yt.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 Yt.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const a=yield n.text();return Yt.notAllowed(a,n.status);default:break}return e instanceof Yt?e:Yt.internal("Encountered unknown websocket error during connection: ".concat(e),{status:n.status,statusText:n.statusText})}catch(n){return n instanceof Yt?n:Yt.serverUnreachable(n instanceof Error?n.message:"server was not reachable")}})}}function MM(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 xf(t,e){return new nu({sdp:t.sdp,type:t.type,id:e})}function Xue(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",Jo()?"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 Jue(t,e,r){const n=new URLSearchParams;n.set("access_token",t);const a=new xle({clientInfo:e,connectionSettings:new fq({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 Ple({joinRequest:a.toBinary()});return n.set("join_request",btoa(new TextDecoder("utf-8").decode(i.toBinary()))),n}class jM{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 Que{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 Bs={},fE={},pE={exports:{}},LM;function JP(){if(LM)return pE.exports;LM=1;var t=pE.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")})}),pE.exports}var BM;function Zue(){return BM||(BM=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=JP(),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}})})}})(fE)),fE}var hE,UM;function ede(){if(UM)return hE;UM=1;var t=JP(),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 hE=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
`},hE}var FM;function tde(){if(FM)return Bs;FM=1;var t=Zue(),e=ede(),r=JP();return Bs.grammar=r,Bs.write=e,Bs.parse=t.parse,Bs.parseParams=t.parseParams,Bs.parseFmtpConfig=t.parseFmtpConfig,Bs.parsePayloads=t.parsePayloads,Bs.parseRemoteCandidates=t.parseRemoteCandidates,Bs.parseImageAttributes=t.parseImageAttributes,Bs.parseSimulcastStreamList=t.parseSimulcastStreamList,Bs}var Cl=tde();function QP(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 D=t.apply(w,_);return c&&c(D),b(D)}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 rde=.7,nde=20,Wf={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class qM extends tc.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=cr,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=QP(a=>ne(this,void 0,void 0,function*(){this.emit(Wf.NegotiationStarted);try{yield this.createAndSendOffer()}catch(i){if(a)a(i);else throw i}}),nde),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=Vc((n=r.loggerName)!==null&&n!==void 0?n:no.PCTransport),this.loggerOptions=r,this.config=e,this._pc=this.createPC(),this.offerLock=new Ya}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}=ade(e);this.remoteStereoMids=i,this.remoteNackMids=o}else if(e.type==="answer"){const i=Cl.parse((n=e.sdp)!==null&&n!==void 0?n:"");i.media.forEach(o=>{const c=ZP(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=Cl.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(Wf.NegotiationComplete),e.sdp&&Cl.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(Wf.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=Cl.parse((r=i.sdp)!==null&&r!==void 0?r:"");if(o.media.forEach(c=>{$M(c),c.type==="audio"?zM(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||(Gs(u.codec)&&!hd()&&this.ensureVideoDDExtensionForSVC(c,o),!Gs(u.codec)))return!0;const f=Math.round(u.maxbr*rde);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,Cl.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=Cl.parse((e=r.sdp)!==null&&e!==void 0?e:"");return n.media.forEach(a=>{$M(a),a.type==="audio"&&zM(a,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(r,Cl.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 Fn("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 Fn("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 $f(i)}})}ensureVideoDDExtensionForSVC(e,r){var n,a;if(!((n=e.ext)===null||n===void 0?void 0:n.some(o=>o.uri===EM))){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:EM})}}}function zM(t,e,r){const n=ZP(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 ade(t){var e;const r=[],n=[],a=Cl.parse((e=t.sdp)!==null&&e!==void 0?e:"");let i=0;return a.media.forEach(o=>{var c;const u=ZP(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 $M(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 ZP(t){return typeof t=="number"?t.toFixed(0):t}const SC="vp8",ide={audioPreset:hC.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:WP.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:SC,backupCodec:!0,preConnectBuffer:!1},Qq={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Zq={deviceId:{ideal:"default"},resolution:up.h720.resolution},sde={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new jle,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},eA={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Nn;(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"})(Nn||(Nn={}));class ode{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=eA.peerConnectionTimeout,this.log=cr,this.updateState=()=>{var i,o;const c=this.state,u=this.requiredTransports.map(d=>d.getConnectionState());u.every(d=>d==="connected")?this.state=Nn.CONNECTED:u.some(d=>d==="failed")?this.state=Nn.FAILED:u.some(d=>d==="connecting")?this.state=Nn.CONNECTING:u.every(d=>d==="closed")?this.state=Nn.CLOSED:u.some(d=>d==="closed")?this.state=Nn.CLOSING:u.every(d=>d==="new")&&(this.state=Nn.NEW),c!==this.state&&(this.log.debug("pc state change: from ".concat(Nn[c]," to ").concat(Nn[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=Vc((a=n.loggerName)!==null&&a!==void 0?a:no.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=r!=="subscriber-primary",this.isSubscriberConnectionRequired=r==="subscriber-primary",this.publisher=new qM(e,n),this._mode=r,r!=="publisher-only"&&(this.subscriber=new qM(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,Hs.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,Hs.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=Nn.NEW,this.connectionLock=new Ya,this.remoteOfferLock=new Ya}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===Hs.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 di((r,n)=>ne(this,void 0,void 0,function*(){const a=setTimeout(()=>{n(new $f("negotiation timed out"))},this.peerConnectionTimeout),i=()=>{clearTimeout(a),n(new $f("negotiation aborted"))};e.signal.addEventListener("abort",i),this.publisher.once(Wf.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Wf.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===Hs.PUBLISHER?this.publisher.getConnectedAddress():e===Hs.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),Pa.clearTimeout(h),d(Yt.cancelled("room connection has been cancelled"))};a?.signal.aborted&&f(),a?.signal.addEventListener("abort",f);const h=Pa.setTimeout(()=>{a?.signal.removeEventListener("abort",f),d(Yt.internal("could not establish pc connection"))},o);for(;this.state!==Nn.CONNECTED;)if(yield Aa(50),a?.signal.aborted){d(Yt.cancelled("room connection has been cancelled"));return}Pa.clearTimeout(h),a?.signal.removeEventListener("abort",f),u()}))})()})}}const e4=5e3,cde=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(lde(e),"/regions"),{headers:{authorization:"Bearer ".concat(r)},signal:n});if(i.ok){const o=Due(i.headers),c=o?o*1e3:e4;return{regionSettings:yield i.json(),updatedAtInMs:Date.now(),maxAgeInMs:c}}else throw i.status===401?Yt.notAllowed("Could not fetch region settings: ".concat(i.statusText),i.status):Yt.internal("Could not fetch region settings: ".concat(i.statusText))}catch(i){throw i instanceof Yt?i:n?.aborted?Yt.cancelled("Region fetching was aborted"):Yt.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 Yt&&i.reason===dn.NotAllowed){cr.debug("token is not valid, cancelling auto region refresh");return}cr.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&&(cr.debug("stopping region refetch after disconnect delay",{hostname:e}),Rr.stopRefetch(e)),n&&(n.cleanupTimeout=void 0)},cde))}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 dp(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),cr.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 Ya;function lde(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}let Ga=class Vu extends Error{constructor(e,r,n){super(r),this.code=e,this.message=VM(r,Vu.MAX_MESSAGE_BYTES),this.data=n?VM(n,Vu.MAX_DATA_BYTES):void 0}static fromProto(e){return new Vu(e.code,e.message,e.data)}toProto(){return new W5({code:this.code,message:this.message,data:this.data})}static builtIn(e,r){return new Vu(Vu.ErrorCode[e],Vu.ErrorMessage[e],r)}};Ga.MAX_MESSAGE_BYTES=256;Ga.MAX_DATA_BYTES=15360;Ga.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};Ga.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 t4=15360;function tA(t){return new TextEncoder().encode(t).length}function VM(t,e){if(tA(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 rA=2e3;function m0(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 nA=typeof MediaRecorder<"u";class ude{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const dde=nA?MediaRecorder:ude;class fde extends dde{constructor(e,r){if(!nA)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 pde(){return nA}const hde=1e3,mde=1e4;class r4 extends Ye{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=QP(()=>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(ht.Ended,this)},this.reacquireTrack=!1,this.providedByUser=a,this.muteLock=new Ya,this.pauseUpstreamLock=new Ya,this.trackChangeLock=new Ya,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!==Ye.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=>{Vf(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&&(Cf(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=>{Cf(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]:hde;return(function*(){var n;if(e.kind===Ye.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=hi())===null||n===void 0?void 0:n.os)==="iOS"&&(yield Aa(10));const a=Date.now();for(;Date.now()-a<r;){const i=e.dimensions;if(i)return i;yield Aa(50)}throw new Dc("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===Hl(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Hl(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===Ye.Source.ScreenShare)return;const{deviceId:n,groupId:a}=e._mediaStreamTrack.getSettings(),i=e.kind===Ye.Kind.Audio?"audioinput":"videoinput";return r?ma.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 Dc("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=Lle(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===Ye.Kind.Video?o.video=n||a?{deviceId:n,facingMode:a}:!0:o.audio=n?Object.assign({deviceId:n},i):!0,this.attachedElements.forEach(d=>{Vf(this.mediaStreamTrack,d)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const u=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return this.kind===Ye.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(ht.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?ht.Muted:ht.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),Kq()&&(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(ht.UpstreamPaused,this);const n=hi();if(n?.name==="Safari"&&Qo(n.version,"12.0")<0)throw new GP("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(ht.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(Cf(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&&(Vf(n._mediaStreamTrack,d),Cf(n.processor.processedTrack,d));yield(i=n.sender)===null||i===void 0?void 0:i.replaceTrack(n.processor.processedTrack)}n.emit(ht.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(ht.TrackProcessorUpdate))})()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!pde()){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 fde(this,{mimeType:r})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},mde)}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 db extends r4{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,Ye.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=m0(o,this.prevStats)),this.prevStats=o}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(ht.AudioTrackFeatureUpdate,this,ha.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(ht.AudioTrackFeatureUpdate,this,ha.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===Ye.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!==Hl(this._constraints.deviceId);return this.source===Ye.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=KP({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(){fi()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},rA)))}setProcessor(e){return ne(this,void 0,void 0,function*(){var r;const n=yield this.trackChangeLock.lock();try{if(!Jo()&&!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(ht.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 Hq(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(ht.AudioSilenceDetected)),e})}}function gde(t,e,r){switch(t.kind){case"audio":return new db(t,e,!1,void 0,r);case"video":return new fb(t,e,!1,r);default:throw new Dc("unsupported track type: ".concat(t.kind))}}const yde=Object.values(up),vde=Object.values(mC),_de=Object.values(WP),bde=[up.h180,up.h360],kde=[mC.h180,mC.h360],wde=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(r=>{var n,a;return new tn(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)}),EC=["q","h","f"];function TC(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=Ede(t,e,r,d),cr.debug("using video encoding",o));const f=o.maxFramerate,h=new tn(e,r,o.maxBitrate,o.maxFramerate,o.priority);if(u&&Gs(d)){const w=new n4(u),b=[];if(w.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(u));const E=hi();if(Gm()||Jo()||E?.name==="Chrome"&&Qo(E?.version,"113")<0){const T=w.suffix=="h"?2:3,D=_ue(E);for(let P=0;P<w.spatial;P+=1)b.push({rid:EC[2-P],maxBitrate:o.maxBitrate/Math.pow(T,P),maxFramerate:h.encoding.maxFramerate,scaleResolutionDownBy:D?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),cr.debug("using svc encoding",{encodings:b}),b}if(!c)return[o];let m=[];t?m=(a=GM(n?.screenShareSimulcastLayers))!==null&&a!==void 0?a:HM(t,h):m=(i=GM(n?.videoSimulcastLayers))!==null&&i!==void 0?i:HM(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 mE(e,r,[w,_,h],f);if(b>=480)return mE(e,r,[w,h],f)}return mE(e,r,[h])}function Sde(t,e,r){var n,a,i,o;if(!r.backupCodec||r.backupCodec===!0||r.backupCodec.codec===r.videoCodec)return;e!==r.backupCodec.codec&&cr.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===Ye.Source.ScreenShare&&r.simulcast&&(r.simulcast=!1),TC(t.source===Ye.Source.ScreenShare,u,d,r)}function Ede(t,e,r,n){const a=Tde(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 Tde(t,e,r){if(t)return _de;const n=e>r?e/r:r/e;return Math.abs(n-16/9)<Math.abs(n-4/3)?yde:vde}function HM(t,e){if(t)return wde(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)?bde:kde}function mE(t,e,r,n){const a=[];if(r.forEach((i,o)=>{if(o>=EC.length)return;const c=Math.min(t,e),d={rid:EC[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=pd()||o===0;i.encoding.priority&&h&&(d.priority=i.encoding.priority,d.networkPriority=i.encoding.priority),a.push(d)}),Jo()&&Xq()==="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,cr.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),cr.info('Setting framerate of encoding "'.concat((u=c.rid)!==null&&u!==void 0?u:"",'" to ').concat(i)),c.maxFramerate=i)})}return a}function GM(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 n4{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 Cde(t){return t.source===Ye.Source.ScreenShare||t.constraints.height&&Hl(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const xde=5e3;class fb extends r4{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,Ye.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(ht.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+=m0(d,m)}),this._currentBitrate=u}this.prevStats=o}),this.senderLock=new Ya}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var r;if(this.signalClient=e,!fi())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()},rA))}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=Rc(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=Rc(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===Ye.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===Ye.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=ji.LOW;n<=ji.HIGH;n+=1)r.push(new $P({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(Gs(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=KP({video:e});typeof h.video!="boolean"&&(c=h.video)}yield this.restart(c),this.isCpuConstrained=!1;try{for(var u=!0,d=Rc(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,_=Rc(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)},xde))}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(Gs(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const d=[];try{for(r=!0,n=Rc(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(Gs(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 WM(h.sender,h.encodings,f.qualities,this.senderLock,Gs(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 WM(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&&Gs(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),Kq()&&this.isInBackground&&this.source===Ye.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function WM(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=a4(b),T=r.find(D=>D.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),pd()&&(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 a4(t){switch(t){case"f":return ji.HIGH;case"h":return ji.MEDIUM;case"q":return ji.LOW;default:return ji.HIGH}}function KM(t,e,r,n){if(!r)return[new Vl({quality:ji.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(n){const a=r[0].scalabilityMode,i=new n4(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 Vl({quality:Math.min(ji.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=a4((o=a.rid)!==null&&o!==void 0?o:"");return new Vl({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 YM="_lossy",XM="_reliable",Pde=2*1e3,gE="leave-reconnect",Ade=3e4,Rde=8*1024,Dde=256*1024;var as;(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"})(as||(as={}));class Ode extends tc.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var r;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=eA.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=as.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=cr,this.reliableDataSequence=1,this.reliableMessageBuffer=new jM,this.reliableReceivedState=new Que(Ade),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===XM)i.reliableDCSub=o;else if(o.label===YM)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=Ha.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(vt.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),_=V5.fromBinary(m.payload),w=new Ha({value:_.value,participantIdentity:h.participantIdentity,participantSid:h.participantSid});((c=w.value)===null||c===void 0?void 0:c.case)==="user"&&JM(w,w.value.value),this.emit(vt.DataPacketReceived,w,h.value.value.encryptionType)}else((u=h.value)===null||u===void 0?void 0:u.case)==="user"&&JM(h,h.value.value),this.emit(vt.DataPacketReceived,h,oa.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?gr.LOSSY:gr.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(vt.Disconnected),this.close()},o=Date.now()-this.reconnectStart;let c=this.getNextRetryDelay({elapsedMs:o,retryCount:this.reconnectAttempts});if(c===null){i(o);return}n===gE&&(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=Pa.setTimeout(()=>this.attemptReconnect(a).finally(()=>this.reconnectTimeout=void 0),c)},this.waitForRestarted=()=>new Promise((n,a)=>{this.pcState===as.Connected&&n();const i=()=>{this.off(vt.Disconnected,o),n()},o=()=>{this.off(vt.Restarted,i),a()};this.once(vt.Restarted,i),this.once(vt.Disconnected,o)}),this.updateAndEmitDCBufferStatus=n=>{if(n===gr.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(vt.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(Wm(this.url),{method:"HEAD"}).then(a=>a.ok).catch(()=>!1))||(this.log.info("detected network reconnected"),(this.client.currentState===un.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===un.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(zu.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>ne(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(Wm(this.url),{method:"HEAD"}),Aa(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info("detected network interruption"),this.isWaitingForNetworkReconnect=!0)}}),this.log=Vc((r=e.loggerName)!==null&&r!==void 0?r:no.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new XP(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new Ya,this.dataProcessLock=new Ya,this.dcBufferStatus=new Map([[gr.LOSSY,!0],[gr.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(vt.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(vt.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(vt.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(vt.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(vt.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(vt.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(vt.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(vt.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=>{cr.error(m,d.logContext)}),d.registerOnLineListener(),d.clientConfiguration=h.clientConfiguration,d.emit(vt.SignalConnected,h),h}catch(h){if(h instanceof Yt){if(h.reason===dn.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===dn.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(vt.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 jM,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 Dc("a track with the same ID has already been published");return new Promise((r,n)=>{const a=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(Yt.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!==Nn.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new ode(i,r?"publisher-only":e.subscriberPrimary?"subscriber-primary":"publisher-primary",this.loggerOptions),this.emit(vt.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===Nn.CONNECTED){const h=this.pcState===as.New;this.pcState=as.Connected,h&&this.emit(vt.Connected,e)}else o===Nn.FAILED&&(this.pcState===as.Connected||this.pcState===as.Reconnecting)&&(this.pcState=as.Disconnected,this.handleDisconnect("peerconnection failed",u==="failed"?zu.RR_SUBSCRIBER_FAILED:zu.RR_PUBLISHER_FAILED));const d=this.client.isDisconnected||this.client.currentState===un.RECONNECTING,f=[Nn.FAILED,Nn.CLOSING,Nn.CLOSED].includes(o);d&&f&&!this._isClosed&&this.emit(vt.Offline)}),this.pcManager.onTrack=o=>{o.streams.length!==0&&this.emit(vt.MediaTrackAdded,o.track,o.streams[0],o.receiver)},Nde((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(vt.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(vt.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(vt.RemoteMute,e,r)},this.client.onSubscribedQualityUpdate=e=>{this.emit(vt.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(vt.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",zu.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:e4,regionSettings:e.regions})),e.action){case qf.DISCONNECT:this.emit(vt.Disconnected,e?.reason),this.close();break;case qf.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(gE);break;case qf.RESUME:this.handleDisconnect(gE)}}}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===$m.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(YM,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(XM,{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(gr.LOSSY);if(e){const r=this.lossyDataStatByterate/10;e.bufferedAmountLowThreshold=Math.min(Math.max(r,Rde),Dde)}},1e3))}createSender(e,r,n){return ne(this,void 0,void 0,function*(){if(vC())return yield this.createTransceiverRTCRtpSender(e,r,n);if(_C())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new Fn("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,r,n,a){return ne(this,void 0,void 0,function*(){if(vC())return this.createSimulcastTransceiverSender(e,r,n,a);if(_C())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new Fn("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,r,n){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Fn("publisher is closed");const a=[];e.mediaStream&&a.push(e.mediaStream),hu(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 Fn("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 Fn("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){cr.warn("already attempting reconnect, returning early",this.logContext);return}(((r=this.clientConfiguration)===null||r===void 0?void 0:r.resumeConnection)===$m.DISABLED||((a=(n=this.pcManager)===null||n===void 0?void 0:n.currentState)!==null&&a!==void 0?a:Nn.NEW)===Nn.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 Fn?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:i})),o=!1):i instanceof df||(this.fullReconnectOnNext=!0),o?this.handleDisconnect("reconnect",zu.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(vt.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 Fn("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(vt.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 df;i=yield this.join(e??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)}catch(o){throw o instanceof Yt&&o.reason===dn.NotAllowed?new Fn("could not reconnect, token might be expired"):new df}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(vt.SignalRestarted,i),yield this.waitForPCReconnected(),this.client.currentState!==un.CONNECTED)throw new df("Signal connection got severed during reconnect");(r=this.regionUrlProvider)===null||r===void 0||r.resetAttempts(),this.emit(vt.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 Fn("could not reconnect, url or token not saved");if(!this.pcManager)throw new Fn("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(vt.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 Yt&&a.reason===dn.NotAllowed?new Fn("could not reconnect, token might be expired"):a instanceof Yt&&a.reason===dn.LeaveRequest?a:new df(i)}if(this.emit(vt.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!==un.CONNECTED)throw new df("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(vt.Resumed)})}waitForPCInitialConnection(e,r){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Fn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(r,e)})}waitForPCReconnected(){return ne(this,void 0,void 0,function*(){this.pcState=as.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield Aa(Pde),!this.pcManager)throw new Fn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=as.Connected}catch(e){throw this.pcState=as.Disconnected,Yt.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 Ha({destinationIdentities:[e],kind:gr.RELIABLE,value:{case:"rpcResponse",value:new UP({requestId:r,value:a?{case:"error",value:a.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(i,gr.RELIABLE)})}publishRpcAck(e,r){return ne(this,void 0,void 0,function*(){const n=new Ha({destinationIdentities:[e],kind:gr.RELIABLE,value:{case:"rpcAck",value:new BP({requestId:r})}});yield this.sendDataPacket(n,gr.RELIABLE)})}sendDataPacket(e,r){return ne(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(r),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const i=que(e);if(i){const o=yield this.e2eeManager.encryptData(i.toBinary());e.value={case:"encryptedPacket",value:new $5({encryptedValue:o.payload,iv:o.iv,keyIndex:o.keyIndex})}}}r===gr.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const n=e.toBinary(),a=this.dataChannelForKind(r);if(a){if(r===gr.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(gr.RELIABLE);const r=this.dataChannelForKind(gr.RELIABLE);r&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(n=>{r.send(n.data)})),this.updateAndEmitDCBufferStatus(gr.RELIABLE)})}waitForBufferStatusLow(e){return new di((r,n)=>ne(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))r();else{const a=()=>n(new Fn("engine closed"));for(this.once(vt.Closing,a);!this.dcBufferStatus.get(e);)yield Aa(10);this.off(vt.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 Fn("PC manager is closed");const o=a?n.pcManager.subscriber:n.pcManager.publisher,c=a?"Subscriber":"Publisher";if(!o)throw Yt.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=>{cr.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 Aa(50)}throw Yt.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!==Nn.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return ne(this,void 0,void 0,function*(){return new di((e,r)=>ne(this,void 0,void 0,function*(){if(!this.pcManager){r(new $f("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 $f("cannot negotiate on closed engine")),this.on(vt.Closing,a),this.pcManager.publisher.once(Wf.RTPVideoPayloadTypes,i=>{const o=new Map;i.forEach(c=>{const u=c.codec.toLowerCase();Eue(u)&&o.set(c.payload,u)}),this.emit(vt.RTPVideoMapUpdate,o)});try{yield this.pcManager.negotiate(n),e()}catch(i){i instanceof $f&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",zu.RR_UNKNOWN),i instanceof Error?r(i):r(new Error(String(i)))}finally{this.off(vt.Closing,a)}}))})}dataChannelForKind(e,r){if(r){if(e===gr.LOSSY)return this.lossyDCSub;if(e===gr.RELIABLE)return this.reliableDCSub}else{if(e===gr.LOSSY)return this.lossyDC;if(e===gr.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 VP({answer:this.pcManager.mode==="publisher-only"?u?xf({sdp:u.sdp,type:u.type}):void 0:f?xf({sdp:f.sdp,type:f.type}):void 0,offer:this.pcManager.mode==="publisher-only"?c?xf({sdp:c.sdp,type:c.type}):void 0:d?xf({sdp:d.sdp,type:d.type}):void 0,subscription:new f0({trackSids:m,subscribe:!h,participantTracks:[]}),publishTracks:oue(r),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:_,datachannelReceiveStates:this.reliableReceivedState.map((w,b)=>new lq({publisherSid:b,lastSeq:w}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],r=(n,a)=>{n?.id!==void 0&&n.id!==null&&e.push(new uq({label:n.label,id:n.id,target:a}))};return r(this.dataChannelForKind(gr.LOSSY),Hs.PUBLISHER),r(this.dataChannelForKind(gr.RELIABLE),Hs.PUBLISHER),r(this.dataChannelForKind(gr.LOSSY,!0),Hs.SUBSCRIBER),r(this.dataChannelForKind(gr.RELIABLE,!0),Hs.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Pa.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){fi()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){fi()&&(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 Nde(t){return t!==void 0&&t>13}function JM(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 i4{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 ss("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),Va.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new ss("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),Va.LengthExceeded)}}constructor(e,r,n,a){this.reader=r,this.totalByteSize=n,this._info=e,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=a}}class Ide extends i4{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 ps,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=Rc(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 Mde extends i4{constructor(e,r,n,a){super(e,r,n,a),this.receivedChunks=new Map}handleChunkReceived(e){var r;const n=g_(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 ps,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 ss("Cannot decode datastream chunk ".concat(f.chunkIndex," as text: ").concat(m),Va.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=Rc(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 jde{constructor(){this.log=cr,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 ss('A text stream handler for topic "'.concat(e,'" has already been set.'),Va.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,r)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,r){if(this.byteStreamHandlers.has(e))throw new ss('A byte stream handler for topic "'.concat(e,'" has already been set.'),Va.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 ss("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),Va.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 ps;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:g_(e.timestamp),attributes:e.attributes,encryptionType:n},d=new ReadableStream({start:f=>{if(o=f,this.textStreamControllers.has(e.streamId))throw new ss("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),Va.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:u,controller:o,startTime:Date.now(),sendingParticipantIdentity:r,outOfBandFailureRejectingFuture:c})}});i(new Ide(u,d,g_(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 ps;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 ss("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),Va.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:u,controller:o,startTime:Date.now(),sendingParticipantIdentity:r,outOfBandFailureRejectingFuture:c})}});i(new Mde(u,d,g_(e.totalLength),c),{identity:r})}})}handleStreamChunk(e,r){const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.encryptionType!==r?(n.controller.error(new ss("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),Va.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 ss("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),Va.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 ss("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),Va.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 ss("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),Va.EncryptionTypeMismatch)):(a.info.attributes=Object.assign(Object.assign({},a.info.attributes),e.attributes),a.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class s4{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 Lde extends s4{}class Bde extends s4{}const QM=15e3;class Ude{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?oa.GCM:oa.NONE},c=new ob({streamId:i,mimeType:o.mimeType,topic:o.topic,timestamp:$u(o.timestamp),totalLength:$u(e?.totalSize),attributes:o.attributes,contentHeader:{case:"textHeader",value:new tq({version:e?.version,attachedStreamIds:e?.attachedStreamIds,replyToStreamId:e?.replyToStreamId,operationType:e?.type==="update"?aC.UPDATE:aC.CREATE})}}),u=e?.destinationIdentities,d=new Ha({destinationIdentities:u,value:{case:"streamHeader",value:c}});yield this.engine.sendDataPacket(d,gr.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 Rue(b,QM)){const T=new cb({content:E,streamId:i,chunkIndex:$u(f)}),D=new Ha({destinationIdentities:u,value:{case:"streamChunk",value:T}});yield h.sendDataPacket(D,gr.RELIABLE),f+=1}})},close(){return ne(this,void 0,void 0,function*(){const b=new lb({streamId:i}),E=new Ha({destinationIdentities:u,value:{case:"streamTrailer",value:b}});yield h.sendDataPacket(E,gr.RELIABLE)})},abort(b){}});let _=()=>ne(this,void 0,void 0,function*(){yield w.close()});h.once(vt.Closing,_);const w=new Lde(m,o,()=>this.engine.off(vt.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?oa.GCM:oa.NONE},h=new ob({totalLength:$u((c=f.size)!==null&&c!==void 0?c:0),mimeType:f.mimeType,streamId:u,topic:f.topic,timestamp:$u(Date.now()),attributes:f.attributes,contentHeader:{case:"byteHeader",value:new rq({name:f.name})}}),m=new Ha({destinationIdentities:d,value:{case:"streamHeader",value:h}});yield this.engine.sendDataPacket(m,gr.RELIABLE);let _=0;const w=new Ya,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+QM),I=new Ha({destinationIdentities:d,value:{case:"streamChunk",value:new cb({content:O,streamId:u,chunkIndex:$u(_)})}});yield b.sendDataPacket(I,gr.RELIABLE),_+=1,C+=O.byteLength}}finally{A()}})},close(){return ne(this,void 0,void 0,function*(){const P=new lb({streamId:u}),A=new Ha({destinationIdentities:d,value:{case:"streamTrailer",value:P}});yield b.sendDataPacket(A,gr.RELIABLE)})},abort(P){E.error("Sink error:",P)}});return new Bde(T,f)})}}class o4 extends Ye{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?ht.Muted:ht.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(ht.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(),rA)),cue()&&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(ht.TimeSyncUpdate,{timestamp:a,rtpTimestamp:i}),this.rtpTimestamp=i)}};e()}}class Fde extends o4{constructor(e,r,n,a,i,o){super(e,r,Ye.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=m0(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;Jo()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(Jo())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(bC(r))return r.setSinkId(e)}))})}attach(e){const r=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&bC(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(ht.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(a=>{this.emit(ht.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 yE=100;class qde extends o4{constructor(e,r,n,a,i){super(e,r,Ye.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=m0(o,this.prevStats)),this.prevStats=o}),this.debouncedHandleResize=QP(()=>{this.updateDimensions()},yE),this.adaptiveStreamSettings=a}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}setStreamState(e){super.setStreamState(e),this.log.debug("setStreamState",e),this.isAdaptiveStream&&e===Ye.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(r=>{e?Vf(this._mediaStreamTrack,r):Cf(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 zde(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<yE){Pa.setTimeout(()=>{this.updateVisibility()},yE);return}this.lastVisible=c,this.emit(ht.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(ht.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const r=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return r==="screen"?CM():r||(CM()>2?2:1)}}class zde{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=Nh(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=Nh(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.onLeavePiP=()=>{var n;this.isPiP=Nh(this.element),(n=this.handleVisibilityChanged)===null||n===void 0||n.call(this)},this.element=e,this.isIntersecting=r??CC(e),this.isPiP=fi()&&Nh(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,r,n;this.isIntersecting=CC(this.element),this.isPiP=Nh(this.element),this.element.handleResize=()=>{var a;(a=this.handleResize)===null||a===void 0||a.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,PM().observe(this.element),xM().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=PM())===null||e===void 0||e.unobserve(this.element),(r=xM())===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 Nh(t){var e,r;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?CC(t,(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window):!1}function CC(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 Cc extends tc.EventEmitter{constructor(e,r,n,a){var i;super(),this.metadataMuted=!1,this.encryption=oa.NONE,this.log=cr,this.handleMuted=()=>{this.emit(ht.Muted)},this.handleUnmuted=()=>{this.emit(ht.Unmuted)},this.log=Vc((i=a?.loggerName)!==null&&i!==void 0?i:no.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=r,this.trackName=n,this.source=Ye.Source.Unknown}setTrack(e){this.track&&(this.track.off(ht.Muted,this.handleMuted),this.track.off(ht.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(ht.Muted,this.handleMuted),e.on(ht.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),_r(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==oa.NONE}get audioTrack(){if($o(this.track))return this.track}get videoTrack(){if(hu(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=Ye.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===Ye.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={}))})(Cc||(Cc={}));class xC extends Cc{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(ht.Ended)},this.handleCpuConstrained=()=>{this.track&&hu(this.track)&&this.emit(ht.CpuConstrained,this.track)},this.updateInfo(r),this.setTrack(n)}setTrack(e){this.track&&(this.track.off(ht.Ended,this.handleTrackEnded),this.track.off(ht.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(ht.Ended,this.handleTrackEnded),e.on(ht.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($o(this.track)){const r=this.track.getSourceTrackSettings(),n=new Set;return r.autoGainControl&&n.add(ha.TF_AUTO_GAIN_CONTROL),r.echoCancellation&&n.add(ha.TF_ECHO_CANCELLATION),r.noiseSuppression&&n.add(ha.TF_NOISE_SUPPRESSION),r.channelCount&&r.channelCount>1&&n.add(ha.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(ha.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(ha.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function g0(t,e){return ne(this,void 0,void 0,function*(){t??(t={});let r=!1;const{audioProcessor:n,videoProcessor:a,optionsWithoutProcessor:i}=Wq(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=Vq(i,Qq,Zq),d=KP(u),f=navigator.mediaDevices.getUserMedia(d);i.audio&&(ma.userMediaPromiseMap.set("audioinput",f),f.catch(()=>ma.userMediaPromiseMap.delete("audioinput"))),i.video&&(ma.userMediaPromiseMap.set("videoinput",f),f.catch(()=>ma.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&&Hl(b.deviceId)!==T?b.deviceId=T:b||(b={deviceId:T});const D=gde(m,b,e);return D.kind===Ye.Kind.Video?D.source=Ye.Source.Camera:D.kind===Ye.Kind.Audio&&(D.source=Ye.Source.Microphone),D.mediaStream=h,$o(D)&&n?yield D.setProcessor(n):hu(D)&&a&&(yield D.setProcessor(a)),D})))}catch(h){if(!r)throw h;return g0(Object.assign(Object.assign({},t),{audio:o,video:c}),e)}})}function $de(t){return ne(this,void 0,void 0,function*(){return(yield g0({audio:!1,video:!0}))[0]})}function Vde(t){return ne(this,void 0,void 0,function*(){return(yield g0({audio:!0,video:!1}))[0]})}var Ol;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(Ol||(Ol={}));function Hde(t){switch(t){case Jh.EXCELLENT:return Ol.Excellent;case Jh.GOOD:return Ol.Good;case Jh.POOR:return Ol.Poor;case Jh.LOST:return Ol.Lost;default:return Ol.Unknown}}class c4 extends tc.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===Vm.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===Ff.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]:Vm.STANDARD;var u;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Ol.Unknown,this.log=cr,this.log=Vc((u=o?.loggerName)!==null&&u!==void 0?u:no.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 ps,this.once(kt.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(Ye.Source.Camera);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const r=this.getTrackPublication(Ye.Source.Microphone);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(Ye.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===Ff.ACTIVE&&((r=this.participantInfo)===null||r===void 0?void 0:r.state)!==Ff.ACTIVE&&this.emit(kt.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(kt.ParticipantMetadataChanged,n)}_setName(e){const r=this.name!==e;this.name=e,r&&this.emit(kt.ParticipantNameChanged,e)}_setAttributes(e){const r=lue(this.attributes,e);this._attributes=e,Object.keys(r).length>0&&this.emit(kt.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(kt.ParticipantPermissionsChanged,u),d}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(kt.IsSpeakingChanged,e))}setConnectionQuality(e){const r=this._connectionQuality;this._connectionQuality=Hde(e),r!==this._connectionQuality&&this.emit(kt.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=>$o(r.track)&&r.track.setAudioContext(e))}addTrackPublication(e){e.on(ht.Muted,()=>{this.emit(kt.TrackMuted,e)}),e.on(ht.Unmuted,()=>{this.emit(kt.TrackUnmuted,e)});const r=e;switch(r.track&&(r.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case Ye.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case Ye.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function Gde(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 oq({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 Wde extends c4{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=oa.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new ps)},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 ps),(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!==HP.OK&&h.reject(new kM(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=Ga.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=>Gde(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),_r(c)));return}this.engine.updateMuteStatus(c.sid,u)},this.onTrackUpstreamPaused=c=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),_r(c))),this.onTrackMuted(c,!0)},this.onTrackUpstreamResumed=c=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),_r(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),_r(u))),this.emit(kt.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=Rc(w),T;T=yield E.next(),u=T.done,!u;b=!0){h=T.value,b=!1;const D=h;aue(D)&&(this.log.debug("publish ".concat(D," for ").concat(_.videoTrack.sid),Object.assign(Object.assign({},this.logContext),_r(_))),yield this.publishAdditionalCodecForTrack(_.videoTrack,D,_.options))}}catch(D){d={error:D}}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===Ye.Source.ScreenShare||c.source===Ye.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),_r(c))),this.unpublishTrack(c);else if(c.isUserProvided)yield c.mute();else if(Tc(c)||Tl(c))try{if(fi())try{const u=yield navigator?.permissions.query({name:c.source===Ye.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),_r(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),_r(c))),Tc(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),_r(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!==oa.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(vt.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(vt.Connected,this.handleReconnected).on(vt.SignalConnected,this.handleSignalConnected).on(vt.SignalRestarted,this.handleReconnected).on(vt.SignalResumed,this.handleReconnected).on(vt.Restarting,this.handleReconnecting).on(vt.Resuming,this.handleReconnecting).on(vt.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(vt.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(vt.Closing,this.handleClosing).on(vt.SignalRequestResponse,this.handleSignalRequestResponse).on(vt.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 di((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 Aa(50)}u(new kM("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(Ye.Source.Camera,e,r,n)}setMicrophoneEnabled(e,r,n){return this.setTrackEnabled(Ye.Source.Microphone,e,r,n)}setScreenShareEnabled(e,r,n){return this.setTrackEnabled(Ye.Source.ScreenShare,e,r,n)}setE2EEEnabled(e){return ne(this,void 0,void 0,function*(){this.encryptionType=e?oa.GCM:oa.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 Ye.Source.Camera:u=yield this.createTracks({video:(i=n)!==null&&i!==void 0?i:!0});break;case Ye.Source.Microphone:u=yield this.createTracks({audio:(o=n)!==null&&o!==void 0?o:!0});break;case Ye.Source.ScreenShare:u=yield this.createScreenTracks(Object.assign({},n));break;default:throw new Dc(e)}}catch(d){throw u?.forEach(f=>{f.stop()}),d instanceof Error&&this.emit(kt.MediaDevicesError,d,yC(e)),this.pendingPublishing.delete(e),d}for(const d of u){const f=Object.assign(Object.assign({},this.roomOptions.publishDefaults),n);e===Ye.Source.Microphone&&$o(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),_r(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===Ye.Source.ScreenShare){c=yield this.unpublishTrack(c.track);const u=this.getTrackPublication(Ye.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(Ye.Source.Camera)||this.pendingPublishing.has(Ye.Source.Microphone))){this.pendingPublishing.add(Ye.Source.Camera),this.pendingPublishing.add(Ye.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(Ye.Source.Camera),this.pendingPublishing.delete(Ye.Source.Microphone)}}})}createTracks(e){return ne(this,void 0,void 0,function*(){var r,n;e??(e={});const a=Vq(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 g0(a,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(c=>($o(c)&&(this.microphoneError=void 0,c.setAudioContext(this.audioContext),c.source=Ye.Source.Microphone,this.emit(kt.AudioStreamAcquired)),hu(c)&&(this.cameraError=void 0,c.source=Ye.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 GP("getDisplayMedia not supported");e.resolution===void 0&&!vue()&&(e.resolution=WP.h1080fps30.resolution);const r=sue(e),n=yield navigator.mediaDevices.getDisplayMedia(r),a=n.getVideoTracks();if(a.length===0)throw new Dc("no video track found");const i=new fb(a[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});i.source=Ye.Source.ScreenShare,e.contentHint&&(i.mediaStreamTrack.contentHint=e.contentHint);const o=[i];if(n.getAudioTracks().length>0){this.emit(kt.AudioStreamAcquired);const c=new db(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});c.source=Ye.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;Tc(n)&&n.setAudioContext(i.audioContext),yield(c=i.reconnectFuture)===null||c===void 0?void 0:c.promise,i.republishPromise&&!o&&(yield i.republishPromise),Hf(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 Ye.Source.Microphone:T="audioinput";break;case Ye.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 db(n,h,!0,i.audioContext,{loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});break;case"video":n=new fb(n,h,!0,{loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});break;default:throw new Dc("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),_r(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),_r(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)),!bue()&&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,D)=>ne(i,void 0,void 0,function*(){try{if(this.engine.client.currentState!==un.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:_r(n)}));let P=!1;const A=setTimeout(()=>{P=!0,n.stop(),D(new bM("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){D(P)}}catch(P){D(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 ps),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),_r(e))),!1;const{canPublish:r,canPublishSources:n}=this.permissions;return r&&(n.length===0||n.map(a=>uue(a)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),_r(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 bM("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(R=>Hf(e)&&R.source===e.source)&&e.source!==Ye.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),_r(e))),r.stopMicTrackOnMute&&$o(e)&&(e.stopOnMute=!0),e.source===Ye.Source.ScreenShare&&pd()&&(r.simulcast=!1),r.videoCodec==="av1"&&!mue()&&(r.videoCodec=void 0),r.videoCodec==="vp9"&&!gue()&&(r.videoCodec=void 0),r.videoCodec===void 0&&(r.videoCodec=SC),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(R=>r.videoCodec===mm(R.mime))||(r.videoCodec=mm(this.enabledPublishVideoCodecs[0].mime)));const b=r.videoCodec;e.on(ht.Muted,this.onTrackMuted),e.on(ht.Unmuted,this.onTrackUnmuted),e.on(ht.Ended,this.handleTrackEnded),e.on(ht.UpstreamPaused,this.onTrackUpstreamPaused),e.on(ht.UpstreamResumed,this.onTrackUpstreamResumed),e.on(ht.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const E=[],T=!(!((a=r.dtx)!==null&&a!==void 0)||a),D=e.getSourceTrackSettings();D.autoGainControl&&E.push(ha.TF_AUTO_GAIN_CONTROL),D.echoCancellation&&E.push(ha.TF_ECHO_CANCELLATION),D.noiseSuppression&&E.push(ha.TF_NOISE_SUPPRESSION),D.channelCount&&D.channelCount>1&&E.push(ha.TF_STEREO),T&&E.push(ha.TF_NO_DTX),Tc(e)&&e.hasPreConnectBuffer&&E.push(ha.TF_PRECONNECT_BUFFER);const P=new Hm({cid:e.mediaStreamTrack.id,name:r.name,type:Ye.kindToProto(e.kind),muted:e.isMuted,source:Ye.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===Ye.Kind.Video){let R={width:0,height:0};try{R=yield e.waitForDimensions()}catch{const L=(c=(o=this.roomOptions.videoCaptureDefaults)===null||o===void 0?void 0:o.resolution)!==null&&c!==void 0?c:up.h720.resolution;R={width:L.width,height:L.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),_r(e)),{dims:R}))}P.width=R.width,P.height=R.height,Tl(e)&&(Gs(b)&&(e.source===Ye.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),_r(e))))),r.scalabilityMode=(u=r.scalabilityMode)!==null&&u!==void 0?u:"L3T3_KEY"),P.simulcastCodecs=[new sC({codec:b,cid:e.mediaStreamTrack.id})],r.backupCodec===!0&&(r.backupCodec={codec:SC}),r.backupCodec&&b!==r.backupCodec.codec&&P.encryption===oa.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),P.simulcastCodecs.push(new sC({codec:r.backupCodec.codec,cid:""})))),A=TC(e.source===Ye.Source.ScreenShare,P.width,P.height,r),P.layers=KM(P.width,P.height,A,Gs(r.videoCodec))}else e.kind===Ye.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 Fn("cannot publish track when not connected");const C=()=>ne(this,void 0,void 0,function*(){var R,N,L;if(!this.engine.pcManager)throw new Fn("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,r,A),this.emit(kt.LocalSenderCreated,e.sender,e),Tl(e)&&((R=r.degradationPreference)!==null&&R!==void 0||(r.degradationPreference=Cde(e)),e.setDegradationPreference(r.degradationPreference)),A)if(pd()&&e.kind===Ye.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&&Gs(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((R,N)=>ne(this,void 0,void 0,function*(){var L;try{O=yield this.engine.addTrack(P),R(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),_r(e)),{error:q}))})),N(j)}}));if(this.enabledPublishVideoCodecs.length>0)O=(yield Promise.all([I,C()]))[0];else{O=yield I;let R;if(O.codecs.forEach(N=>{R===void 0&&(R=N.mimeType)}),R&&e.kind===Ye.Kind.Video){const N=mm(R);N!==b&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),_r(e)),{codec:N})),r.videoCodec=N,A=TC(e.source===Ye.Source.ScreenShare,P.width,P.height,r))}yield C()}const x=new xC(e.kind,O,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(x.on(ht.CpuConstrained,R=>this.onTrackCpuConstrained(R,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})),Tl(e)?e.startMonitor(this.engine.client):Tc(e)&&e.startMonitor(),this.addTrackPublication(x),this.emit(kt.LocalTrackPublished,x),Tc(e)&&O.audioFeatures.includes(ha.TF_PRECONNECT_BUFFER)){const R=e.getPreConnectBuffer(),N=e.getPreConnectBufferMimeType();this.on(kt.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),_r(e))),e.stopPreConnectBuffer()}}),R&&new Promise((j,q)=>ne(this,void 0,void 0,function*(){var U,Y,F,X,J,ee;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),_r(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),_r(e)));const pe=yield this.streamBytes({name:"preconnect-buffer",mimeType:N,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[te.identity],attributes:{trackId:x.trackSid,sampleRate:String((J=D.sampleRate)!==null&&J!==void 0?J:"48000"),channels:String((ee=D.channelCount)!==null&&ee!==void 0?ee:"1")}});try{for(var H=!0,B=Rc(R),K;K=yield B.next(),U=K.done,!U;H=!0){X=K.value,H=!1;const ce=X;yield pe.write(ce)}}catch(ce){Y={error:ce}}finally{try{!H&&!U&&(F=B.return)&&(yield F.call(B))}finally{if(Y)throw Y.error}}yield pe.close(),j()}catch(ae){q(ae)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),_r(e)))}).catch(j=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),_r(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!==oa.NONE)return;let i;if(this.trackPublications.forEach(_=>{_.track&&_.track===e&&(i=_)}),!i)throw new Dc("track is not published");if(!Tl(e))throw new Dc("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=Sde(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),_r(e)));return}const u=e.addSimulcastTrack(r,c);if(!u)return;const d=new Hm({cid:u.mediaStreamTrack.id,type:Ye.kindToProto(e.kind),muted:e.isMuted,source:Ye.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:u.mediaStreamTrack.id}]});if(d.layers=KM(d.width,d.height,c),!this.engine||this.engine.isClosed)throw new Fn("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(Hf(e)){const d=this.pendingPublishPromises.get(e);d&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),_r(e))),yield d)}const i=this.getPublicationForTrack(e),o=i?_r(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(ht.Muted,this.onTrackMuted),e.off(ht.Unmuted,this.onTrackUnmuted),e.off(ht.Ended,this.handleTrackEnded),e.off(ht.UpstreamPaused,this.onTrackUpstreamPaused),e.off(ht.UpstreamResumed,this.onTrackUpstreamResumed),e.off(ht.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<Nn.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),Tl(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 Ye.Kind.Audio:this.audioTrackPublications.delete(i.trackSid);break;case Ye.Kind.Video:this.videoTrackPublications.delete(i.trackSid);break}return this.emit(kt.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 di((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!==Ye.Source.ScreenShare&&d.source!==Ye.Source.ScreenShareAudio&&(Tc(d)||Tl(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?gr.RELIABLE:gr.LOSSY,o=a.destinationIdentities,c=a.topic;let u=new jP({participantIdentity:n.identity,payload:r,destinationIdentities:o,topic:c});const d=new Ha({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 Ha({kind:gr.RELIABLE,value:{case:"sipDtmf",value:new G5({code:e,digit:r})}});yield this.engine.sendDataPacket(n,gr.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 Ha({value:{case:"chatMessage",value:new sb(Object.assign(Object.assign({},n),{timestamp:Sn.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(a,gr.RELIABLE),this.emit(kt.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 Ha({value:{case:"chatMessage",value:new sb(Object.assign(Object.assign({},n),{timestamp:Sn.parse(n.timestamp),editTimestamp:Sn.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(a,gr.RELIABLE),this.emit(kt.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 di((u,d)=>ne(this,void 0,void 0,function*(){var f,h,m,_;if(tA(a)>t4){d(Ga.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&&Qo((_=(m=this.engine.latestJoinResponse)===null||m===void 0?void 0:m.serverInfo)===null||_===void 0?void 0:_.version,"1.8.0")<0){d(Ga.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(Ga.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(Ga.builtIn("RESPONSE_TIMEOUT"))},i);this.pendingResponses.set(b,{resolve:(D,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(D??"")},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 Ha({destinationIdentities:[e],kind:gr.RELIABLE,value:{case:"rpcRequest",value:new LP({id:r,method:n,payload:a,responseTimeoutMs:i,version:1})}});yield this.engine.sendDataPacket(o,gr.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,Ga.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),_r(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 ps),this.activeAgentFuture.promise)}getPublicationForTrack(e){let r;return this.trackPublications.forEach(n=>{const a=n.track;a&&(e instanceof MediaStreamTrack?(Tc(a)||Tl(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 Aa(20)}})}}class Kde extends Cc{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(ht.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 f0({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new K5({participantSid:"",trackSids:[this.trackSid]})]});this.emit(ht.UpdateSubscription,a),this.emitSubscriptionUpdateIfChanged(r),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?Cc.SubscriptionStatus.Unsubscribed:super.isSubscribed?Cc.SubscriptionStatus.Subscribed:Cc.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Cc.PermissionStatus.Allowed:Cc.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||(uE(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&uE(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){var e;return(e=this.requestedMaxQuality)!==null&&e!==void 0?e:ji.HIGH}setTrack(e){const r=this.subscriptionStatus,n=this.permissionStatus,a=this.track;a!==e&&(a&&(a.off(ht.VideoDimensionsChanged,this.handleVideoDimensionsChange),a.off(ht.VisibilityChanged,this.handleVisibilityChange),a.off(ht.Ended,this.handleEnded),a.detach(),a.stopMonitor(),this.emit(ht.Unsubscribed,a)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(ht.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(ht.VisibilityChanged,this.handleVisibilityChange),e.on(ht.Ended,this.handleEnded),this.emit(ht.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(ht.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?ht.Muted:ht.Unmuted)}emitSubscriptionUpdateIfChanged(e){const r=this.subscriptionStatus;e!==r&&this.emit(ht.SubscriptionStatusChanged,r,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(ht.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 uE(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new nq({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===Ye.Kind.Video){let r=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(r)SM(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=due(this.trackInfo,this.requestedMaxQuality);n&&SM(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:ji.HIGH})),e.quality=ji.HIGH)}this.emit(ht.UpdateSettings,e)}}class pb extends c4{static fromParticipantInfo(e,r,n){return new pb(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]:Vm.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(ht.UpdateSettings,r=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),_r(e)),{settings:r})),this.signalClient.sendUpdateTrackSettings(r)}),e.on(ht.UpdateSubscription,r=>{r.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(r)}),e.on(ht.SubscriptionPermissionChanged,r=>{this.emit(kt.TrackSubscriptionPermissionChanged,e,r)}),e.on(ht.SubscriptionStatusChanged,r=>{this.emit(kt.TrackSubscriptionStatusChanged,e,r)}),e.on(ht.Subscribed,r=>{this.emit(kt.TrackSubscribed,r,e)}),e.on(ht.Unsubscribed,r=>{this.emit(kt.TrackUnsubscribed,r,e)}),e.on(ht.SubscriptionFailed,r=>{this.emit(kt.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]:Ye.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]:Ye.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(kt.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),_r(c))),this.emit(kt.TrackSubscriptionFailed,r);return}const u=e.kind==="video";let d;return u?d=new qde(e,r,a,i):d=new Fde(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)&&kC(d)&&$o(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=Ye.kindFromProto(a.type);if(!u)return;c=new Kde(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!==Ye.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:_r(d),newTrack:_r(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),_r(a))),this.unpublishTrack(a.trackSid,!0))}),n.forEach(a=>{this.emit(kt.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 Ye.Kind.Audio:this.audioTrackPublications.delete(e);break;case Ye.Kind.Video:this.videoTrackPublications.delete(e);break}r&&this.emit(kt.TrackUnpublished,n)}setAudioOutput(e){return ne(this,void 0,void 0,function*(){this.audioOutput=e;const r=[];this.audioTrackPublications.forEach(n=>{var a;$o(n.track)&&kC(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 jr;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(jr||(jr={}));const Yde=4*1e3;class fp extends tc.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(e){var r,n,a,i,o;if(super(),r=this,this.state=jr.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=cr,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(c,u,d)=>ne(this,void 0,void 0,function*(){var f;if(!yue())throw Jo()?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===jr.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(jr.Connecting),((f=this.regionUrlProvider)===null||f===void 0?void 0:f.getServerUrl().toString())!==Jq(c)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),dp(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,D;this.abortController&&this.abortController.abort();const P=new AbortController;this.abortController=P,h?.();try{if(yield Gf.getInstance().getBackOffPromise(c),P.signal.aborted)throw Yt.cancelled("Connection attempt aborted");yield this.attemptConnection(E??c,u,d,P),this.abortController=void 0,w()}catch(A){if(this.regionUrlProvider&&A instanceof Yt&&A.reason!==dn.Cancelled&&A.reason!==dn.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 Yt&&(O.status===401||O.reason===dn.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),b(O);return}}[dn.InternalError,dn.ServerUnreachable,dn.Timeout].includes(A.reason)&&(this.log.debug("Adding failed connection attempt to back off"),Gf.getInstance().addFailedConnectionAttempt(c)),C&&!(!((D=this.abortController)===null||D===void 0)&&D.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,RM(A)),b(A))}else{let C=Ys.UNKNOWN_REASON;A instanceof Yt&&(C=RM(A)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,C),b(A)}}}),_=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new ps((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(D=>{let[P,A]=D;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 Zle("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===jr.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({},eA),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(nt.SignalConnected)}catch(_){yield this.engine.close(),this.recreateEngine();const w=f.signal.aborted?Yt.cancelled("Signal connection aborted"):Yt.serverUnreachable("could not establish signal connection");throw _ instanceof Error&&(w.message="".concat(w.message,": ").concat(_.message)),_ instanceof Yt&&(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(),Yt.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,f)}catch(_){throw yield this.engine.close(),this.recreateEngine(),_}fi()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),fi()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(jr.Connected),this.emit(nt.Connected),Gf.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===jr.Disconnected){f.log.debug("already disconnected",f.logContext);return}if(f.log.info("disconnect from room",Object.assign({},f.logContext)),f.state===jr.Connecting||f.state===jr.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(_,Yt.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,Ys.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=hi();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=lE();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(nt.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(jr.Reconnecting)&&this.emit(nt.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(jr.Connected),this.emit(nt.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===Ff.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(nt.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(nt.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=Ye.streamStateFromProto(u.state);f.track.setStreamState(h),h!==f.track.streamState&&(d.emit(kt.TrackStreamStateChanged,f,f.track.streamState),this.emitWhenConnected(nt.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(nt.DataReceived,u.payload,c,d,u.topic,f),c?.emit(kt.DataReceived,u.payload,d,f)},this.handleSipDtmf=(c,u)=>{this.emit(nt.SipDTMFReceived,u,c),c?.emit(kt.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=Cue(u,this.transcriptionReceivedTimes);f?.emit(ht.TranscriptionReceived,h),d?.emit(kt.TranscriptionReceived,h,f),this.emit(nt.TranscriptionReceived,h,d,f)},this.handleChatMessage=(c,u)=>{const d=xue(u);this.emit(nt.ChatMessage,d,c)},this.handleMetrics=(c,u)=>{this.emit(nt.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(nt.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(nt.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(nt.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(nt.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>ne(this,void 0,void 0,function*(){var c;((c=hi())===null||c===void 0?void 0:c.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(nt.MediaDevicesChanged)}),this.handleRoomUpdate=c=>{const u=this.roomInfo;this.roomInfo=c,u&&u.metadata!==c.metadata&&this.emitWhenConnected(nt.RoomMetadataChanged,c.metadata),u?.activeRecording!==c.activeRecording&&this.emitWhenConnected(nt.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(nt.ParticipantMetadataChanged,c,this.localParticipant)},this.onLocalParticipantNameChanged=c=>{this.emit(nt.ParticipantNameChanged,c,this.localParticipant)},this.onLocalAttributesChanged=c=>{this.emit(nt.ParticipantAttributesChanged,c,this.localParticipant)},this.onLocalTrackMuted=c=>{this.emit(nt.TrackMuted,c,this.localParticipant)},this.onLocalTrackUnmuted=c=>{this.emit(nt.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(ht.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.on(ht.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(nt.LocalTrackPublished,c,this.localParticipant),Tc(c.track)&&(yield c.track.checkForSilence())&&this.emit(nt.LocalAudioSilenceDetected,c);const w=yield(_=c.track)===null||_===void 0?void 0:_.getDeviceId(!1),b=yC(c.source);b&&w&&w!==this.localParticipant.activeDeviceMap.get(b)&&(this.localParticipant.activeDeviceMap.set(b,w),this.emit(nt.ActiveDeviceChanged,b,w))}),this.onLocalTrackUnpublished=c=>{var u,d;(u=c.track)===null||u===void 0||u.off(ht.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.off(ht.Restarted,this.onLocalTrackRestarted),this.emit(nt.LocalTrackUnpublished,c,this.localParticipant)},this.onLocalTrackRestarted=c=>ne(this,void 0,void 0,function*(){const u=yield c.getDeviceId(!1),d=yC(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(nt.ActiveDeviceChanged,d,u))}),this.onLocalConnectionQualityChanged=c=>{this.emit(nt.ConnectionQualityChanged,c,this.localParticipant)},this.onMediaDevicesError=(c,u)=>{this.emit(nt.MediaDevicesError,c,u)},this.onLocalParticipantPermissionsChanged=c=>{this.emit(nt.ParticipantPermissionsChanged,c,this.localParticipant)},this.onLocalChatMessageSent=c=>{this.emit(nt.ChatMessage,c,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},sde),e),this.log=Vc((n=this.options.loggerName)!==null&&n!==void 0?n:no.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Qq),e?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Zq),e?.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},ide),e?.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new jde,this.outgoingDataStreamManager=new Ude(this.engine,this.log),this.disconnectLock=new Ya,this.localParticipant=new Wde("","",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",Hl(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Hl(this.options.audioCaptureDefaults.deviceId)),!((a=this.options.audioOutput)===null||a===void 0)&&a.deviceId&&this.switchActiveDevice("audiooutput",Hl(this.options.audioOutput.deviceId)).catch(c=>this.log.warn("Could not set audio output: ".concat(c.message),this.logContext)),fi()){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}),fp.cleanupRegistry&&fp.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 zue(n,r),this.e2eeManager.on(jl.ParticipantEncryptionStatusChanged,(a,i)=>{Aue(i)&&(this.isE2EEEnabled=a),this.emit(nt.ParticipantEncryptionStatusChanged,a,i)}),this.e2eeManager.on(jl.EncryptionError,(a,i)=>{const o=i?this.getParticipantByIdentity(i):void 0;this.emit(nt.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===jr.Disconnected?di.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?di.resolve(this.roomInfo.sid):new di((e,r)=>{const n=a=>{a.sid!==""&&(this.engine.off(vt.RoomUpdate,n),e(a.sid))};this.engine.on(vt.RoomUpdate,n),this.once(nt.Disconnected,()=>{this.engine.off(vt.RoomUpdate,n),r(new Fn("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 Ode(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(vt.ParticipantUpdate,this.handleParticipantUpdates).on(vt.RoomUpdate,this.handleRoomUpdate).on(vt.SpeakersChanged,this.handleSpeakersChanged).on(vt.StreamStateChanged,this.handleStreamStateUpdate).on(vt.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(vt.SubscriptionError,this.handleSubscriptionError).on(vt.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(vt.MediaTrackAdded,(e,r,n)=>{this.onTrackAdded(e,r,n)}).on(vt.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(vt.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(vt.DataPacketReceived,this.handleDataPacket).on(vt.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(jr.SignalReconnecting)&&this.emit(nt.SignalReconnecting)}).on(vt.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(jr.Connected)&&this.emit(nt.Reconnected)}).on(vt.SignalResumed,()=>{this.bufferedEvents=[],(this.state===jr.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(vt.Restarting,this.handleRestarting).on(vt.SignalRestarted,this.handleSignalRestarted).on(vt.Offline,()=>{this.setAndEmitConnectionState(jr.Reconnecting)&&this.emit(nt.Reconnecting)}).on(vt.DCBufferStatusChanged,(e,r)=>{this.emit(nt.DCBufferStatusChanged,e,r)}).on(vt.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(kt.LocalTrackSubscribed,r),this.emitWhenConnected(nt.LocalTrackSubscribed,r,this.localParticipant)}).on(vt.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(nt.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 ma.getInstance().getDevices(e,r)}prepareConnection(e,r){return ne(this,void 0,void 0,function*(){if(this.state===jr.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(dp(new URL(e))&&r){this.regionUrlProvider=new Rr(e,r);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===jr.Disconnected&&(this.regionUrl=n,yield fetch(Wm(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(Wm(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 Do({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":a=new Do({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":a=new Do({scenario:{case:"serverLeave",value:!0}});break;case"migration":a=new Do({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 Do({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 Do({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 Do({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 p0({reason:Ys.CLIENT_INITIATED,action:qf.RECONNECT}))});break;case"subscriber-bandwidth":if(r===void 0||typeof r!="number")throw new Error("subscriber-bandwidth requires a number as argument");a=new Do({scenario:{case:"subscriberBandwidth",value:$u(r)}});break;case"leave-full-reconnect":a=new Do({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 D=Array.from(i.localParticipant.audioTrackPublications.values()).filter(A=>A.source===Ye.Source.Microphone);try{w=(yield Promise.all(D.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=D.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 D=Array.from(i.localParticipant.videoTrackPublications.values()).filter(A=>A.source===Ye.Source.Camera);try{w=(yield Promise.all(D.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=D.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,!bC()&&!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 ma.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(D=>D.setAudioOutput({deviceId:a})))}catch(D){throw i.options.audioOutput.deviceId=T,D}}return b&&(i.localParticipant.activeDeviceMap.set(n,a),i.emit(nt.ActiveDeviceChanged,n,a)),w})()})}setupLocalParticipantEvents(){this.localParticipant.on(kt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(kt.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(kt.AttributesChanged,this.onLocalAttributesChanged).on(kt.TrackMuted,this.onLocalTrackMuted).on(kt.TrackUnmuted,this.onLocalTrackUnmuted).on(kt.LocalTrackPublished,this.onLocalTrackPublished).on(kt.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(kt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(kt.MediaDevicesError,this.onMediaDevicesError).on(kt.AudioStreamAcquired,this.startAudio).on(kt.ChatMessage,this.onLocalChatMessageSent).on(kt.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===jr.Connecting||this.state===jr.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(nt.Reconnected,h),this.off(nt.Connected,h),this.off(nt.Disconnected,m)};this.once(nt.Reconnected,h),this.once(nt.Connected,h),this.once(nt.Disconnected,m);return}if(this.state===jr.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=hue(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(nt.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!==jr.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(kt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(kt.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(kt.AttributesChanged,this.onLocalAttributesChanged).off(kt.TrackMuted,this.onLocalTrackMuted).off(kt.TrackUnmuted,this.onLocalTrackUnmuted).off(kt.LocalTrackPublished,this.onLocalTrackPublished).off(kt.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(kt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(kt.MediaDevicesError,this.onMediaDevicesError).off(kt.AudioStreamAcquired,this.startAudio).off(kt.ChatMessage,this.onLocalChatMessageSent).off(kt.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),fi()&&(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(jr.Disconnected),this.emit(nt.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(nt.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,Ga.builtIn("UNSUPPORTED_VERSION"));return}const c=this.rpcHandlers.get(n);if(!c){yield this.engine.publishRpcResponse(e,r,null,Ga.builtIn("UNSUPPORTED_METHOD"));return}let u=null,d=null;try{const f=yield c({requestId:r,callerIdentity:e,payload:a,responseTimeout:i});tA(f)>t4?(u=Ga.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),this.log.warn("RPC Response payload too large for ".concat(n))):d=f}catch(f){f instanceof Ga?u=f:(this.log.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),f),u=Ga.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=ma.getInstance().previousDevices,i=yield ma.getInstance().getDevices(void 0,!1),o=hi();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(nt.ActiveDeviceChanged,u.kind,u.deviceId)}const c=["audiooutput","audioinput","videoinput"];for(let u of c){const d=iue(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"&&!Gm()||u==="videoinput"||h.length>0&&!h.find(_=>_.deviceId===this.getActiveDevice(u))&&(u!=="audiooutput"||!Gm())&&(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=Gq())!==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(),Aa(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(nt.AudioPlaybackStatusChanged,n))})}createParticipant(e,r){var n;let a;return r?a=pb.fromParticipantInfo(this.engine.client,r,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):a=new pb(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(nt.ParticipantConnected,n),n.on(kt.TrackPublished,a=>{this.emitWhenConnected(nt.TrackPublished,a,n)}).on(kt.TrackSubscribed,(a,i)=>{a.kind===Ye.Kind.Audio?(a.on(ht.AudioPlaybackStarted,this.handleAudioPlaybackStarted),a.on(ht.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):a.kind===Ye.Kind.Video&&(a.on(ht.VideoPlaybackFailed,this.handleVideoPlaybackFailed),a.on(ht.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(nt.TrackSubscribed,a,i,n)}).on(kt.TrackUnpublished,a=>{this.emit(nt.TrackUnpublished,a,n)}).on(kt.TrackUnsubscribed,(a,i)=>{this.emit(nt.TrackUnsubscribed,a,i,n)}).on(kt.TrackMuted,a=>{this.emitWhenConnected(nt.TrackMuted,a,n)}).on(kt.TrackUnmuted,a=>{this.emitWhenConnected(nt.TrackUnmuted,a,n)}).on(kt.ParticipantMetadataChanged,a=>{this.emitWhenConnected(nt.ParticipantMetadataChanged,a,n)}).on(kt.ParticipantNameChanged,a=>{this.emitWhenConnected(nt.ParticipantNameChanged,a,n)}).on(kt.AttributesChanged,a=>{this.emitWhenConnected(nt.ParticipantAttributesChanged,a,n)}).on(kt.ConnectionQualityChanged,a=>{this.emitWhenConnected(nt.ConnectionQualityChanged,a,n)}).on(kt.ParticipantPermissionsChanged,a=>{this.emitWhenConnected(nt.ParticipantPermissionsChanged,a,n)}).on(kt.TrackSubscriptionStatusChanged,(a,i)=>{this.emitWhenConnected(nt.TrackSubscriptionStatusChanged,a,i,n)}).on(kt.TrackSubscriptionFailed,(a,i)=>{this.emit(nt.TrackSubscriptionFailed,a,n,i)}).on(kt.TrackSubscriptionPermissionChanged,(a,i)=>{this.emitWhenConnected(nt.TrackSubscriptionPermissionChanged,a,i,n)}).on(kt.Active,()=>{this.emitWhenConnected(nt.ParticipantActive,n),n.kind===Vm.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&&Pue(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=Pa.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,Ys.STATE_MISMATCH))):e=0},Yde)}clearConnectionReconcile(){this.connectionReconcileInterval&&Pa.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(nt.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===jr.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===jr.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 l0({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:Sn.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new fd({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(nt.SignalConnected),this.emit(nt.Connected),this.setAndEmitConnectionState(jr.Connected),o.video){const u=new xC(Ye.Kind.Video,new Tf({source:Qn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Vs.AUDIO,name:"video-dummy"}),new fb(o.useRealTracks&&(!((r=window.navigator.mediaDevices)===null||r===void 0)&&r.getUserMedia)?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:AM(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(kt.LocalTrackPublished,u)}if(o.audio){const u=new xC(Ye.Kind.Audio,new Tf({source:Qn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Vs.AUDIO}),new db(o.useRealTracks&&(!((a=navigator.mediaDevices)===null||a===void 0)&&a.getUserMedia)?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:lE(),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(kt.LocalTrackPublished,u)}for(let u=0;u<c.count-1;u+=1){let d=new fd({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(u),state:Ff.ACTIVE,tracks:[],joinedAt:Sn.parse(Date.now())});const f=this.getOrCreateParticipant(d.identity,d);if(c.video){const h=AM(160*((i=c.aspectRatios[u%c.aspectRatios.length])!==null&&i!==void 0?i:1),160,!1,!0),m=new Tf({source:Qn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:Vs.AUDIO});f.addSubscribedMediaTrack(h,m.sid,new MediaStream([h]),new RTCRtpReceiver),d.tracks=[...d.tracks,m]}if(c.audio){const h=lE(),m=new Tf({source:Qn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:Vs.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!==nt.ActiveSpeakersChanged&&e!==nt.TranscriptionReceived){const i=l4(n).filter(o=>o!==void 0);(e===nt.TrackSubscribed||e===nt.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)}}fp.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function l4(t){return t.map(e=>{if(e)return Array.isArray(e)?l4(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var $s;(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"})($s||($s={}));class mu extends tc.EventEmitter{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=$s.IDLE,this.logs=[],this.options={},this.url=e,this.token=r,this.name=this.constructor.name,this.room=new fp(n.roomOptions),this.connectOptions=n.connectOptions,this.options=n}run(e){return ne(this,void 0,void 0,function*(){if(this.status!==$s.IDLE)throw Error("check is running already");this.setStatus($s.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!==$s.SKIPPED&&this.setStatus(this.isSuccess()?$s.SUCCESS:$s.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===jr.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!==jr.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus($s.SKIPPED)}switchProtocol(e){return ne(this,void 0,void 0,function*(){let r=!1,n=!1;if(this.room.on(nt.Reconnecting,()=>{r=!0}),this.room.once(nt.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 Aa(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 Xde extends mu{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 vE=1e4;class Jde extends mu{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/(vE/1e3)*100).toFixed(2),"%")),n.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((n.qualityLimitationDurations.cpu/(vE/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,vE)),clearInterval(h),c.stop(),r.remove(),yield this.disconnect(),f})}}class Qde extends mu{get description(){return"Can publish audio"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect(),n=yield Vde();if(yield Hq(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 Zde extends mu{get description(){return"Can publish video"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect(),n=yield $de();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 efe extends mu{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(nt.SignalReconnecting,c).on(nt.Reconnecting,c).on(nt.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!==jr.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 tfe extends mu{get description(){return"Can connect via TURN"}perform(){return ne(this,void 0,void 0,function*(){var e,r,n;dp(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 XP,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 rfe extends mu{get description(){return"Establishing WebRTC connection"}perform(){return ne(this,void 0,void 0,function*(){let e=!1,r=!1;this.room.on(nt.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&&(nfe(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(),cr.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 nfe(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 afe extends mu{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 XP,i;try{i=yield a.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0)}catch(o){if(dp(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)===X5.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 zSe extends tc.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:$s.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!==$s.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(afe)})}checkWebRTC(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(rfe)})}checkTURN(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(tfe)})}checkReconnect(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(efe)})}checkPublishAudio(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Qde)})}checkPublishVideo(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Zde)})}checkConnectionProtocol(){return ne(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(Jde);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(Xde)})}}function br(t,e,r){return(e=sfe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ife(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 sfe(t){var e=ife(t,"string");return typeof e=="symbol"?e:e+""}new TextEncoder;new TextDecoder;class Qa extends Error{constructor(e,r){var n;super(e,r),br(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,this.constructor)}}br(Qa,"code","ERR_JOSE_GENERIC");class ofe extends Qa{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}}),br(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),br(this,"claim",void 0),br(this,"reason",void 0),br(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}br(ofe,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class cfe extends Qa{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}}),br(this,"code","ERR_JWT_EXPIRED"),br(this,"claim",void 0),br(this,"reason",void 0),br(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}br(cfe,"code","ERR_JWT_EXPIRED");class lfe extends Qa{constructor(){super(...arguments),br(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}br(lfe,"code","ERR_JOSE_ALG_NOT_ALLOWED");class ufe extends Qa{constructor(){super(...arguments),br(this,"code","ERR_JOSE_NOT_SUPPORTED")}}br(ufe,"code","ERR_JOSE_NOT_SUPPORTED");class dfe extends Qa{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),br(this,"code","ERR_JWE_DECRYPTION_FAILED")}}br(dfe,"code","ERR_JWE_DECRYPTION_FAILED");class ffe extends Qa{constructor(){super(...arguments),br(this,"code","ERR_JWE_INVALID")}}br(ffe,"code","ERR_JWE_INVALID");class pfe extends Qa{constructor(){super(...arguments),br(this,"code","ERR_JWS_INVALID")}}br(pfe,"code","ERR_JWS_INVALID");class hfe extends Qa{constructor(){super(...arguments),br(this,"code","ERR_JWT_INVALID")}}br(hfe,"code","ERR_JWT_INVALID");class mfe extends Qa{constructor(){super(...arguments),br(this,"code","ERR_JWK_INVALID")}}br(mfe,"code","ERR_JWK_INVALID");class gfe extends Qa{constructor(){super(...arguments),br(this,"code","ERR_JWKS_INVALID")}}br(gfe,"code","ERR_JWKS_INVALID");class yfe extends Qa{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),br(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}br(yfe,"code","ERR_JWKS_NO_MATCHING_KEY");class vfe extends Qa{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),br(this,Symbol.asyncIterator,void 0),br(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}br(vfe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class _fe extends Qa{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),br(this,"code","ERR_JWKS_TIMEOUT")}}br(_fe,"code","ERR_JWKS_TIMEOUT");class bfe extends Qa{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),br(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}br(bfe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const u4=v.createContext(null),kfe=()=>v.useContext(u4);function wfe({children:t}){const{user:e}=Vr(),r=Ss(),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,D]=v.useState(null),[P,A]=v.useState(!1),[C,O]=v.useState(!1),[I,x]=v.useState(null),R=v.useCallback(()=>{const ee=o.current;if(!ee){E([]),D(null);return}const H=[];ee.remoteParticipants.forEach(K=>{const ae=K.getTrackPublication(Ye.Source.Camera)?.track,te=K.getTrackPublication(Ye.Source.Microphone)?.track;H.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(H);const B=ee.localParticipant;if(B){const ae=B.getTrackPublication(Ye.Source.Camera)?.track,te=B.getTrackPublication(Ye.Source.Microphone)?.track;D({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 ee=>{if(!i||!r){w("Not authenticated");return}if(N.current!==ee){if(A(!1),O(!1),o.current){try{const H=o.current.localParticipant;if(H){try{await H.setCameraEnabled(!1)}catch{}try{await H.setMicrophoneEnabled(!1)}catch{}}o.current.disconnect()}catch{}o.current=null}N.current=ee,L.current=!1,m(!0),w(null);try{const H=await new Promise(Re=>{r.emit("livekit_join",{roomId:ee},Re)});if(L.current){N.current=null;return}if(!H?.ok)throw new Error(H?.error||"Failed to get LiveKit token");const{token:B,url:K,iceServers:ae}=H,te={};ae&&Array.isArray(ae)&&ae.length>0&&(te.iceServers=ae,te.iceTransportPolicy="all");const pe=new fp({adaptiveStream:!0,dynacast:!0,videoCaptureDefaults:{resolution:up.h540.resolution}});await pe.prepareConnection(K,B),pe.on(nt.Connected,()=>{f(!0),m(!1),R()}),pe.on(nt.Disconnected,()=>{f(!1),u(null),R()}),pe.on(nt.ParticipantConnected,Re=>{R()}),pe.on(nt.ParticipantDisconnected,Re=>{R()}),pe.on(nt.TrackSubscribed,(Re,He,ie)=>{R()}),pe.on(nt.TrackUnsubscribed,(Re,He,ie)=>{R()}),pe.on(nt.LocalTrackPublished,(Re,He)=>{R()}),pe.on(nt.LocalTrackUnpublished,(Re,He)=>{R()}),pe.on(nt.ActiveSpeakersChanged,()=>{R()}),pe.on(nt.ConnectionStateChanged,Re=>{Re===jr.Disconnected&&f(!1)});const ce=Object.keys(te).length>0?{rtcConfig:te}:void 0;if(await pe.connect(K,B,ce),L.current){pe.disconnect(),N.current=null;return}o.current=pe,u(ee),N.current=null}catch(H){w(H?.message||"Failed to join room"),m(!1),N.current=null}}},[i,r,R]),q=v.useCallback(async()=>{L.current=!0,N.current=null;const ee=o.current;if(ee){try{const H=ee.localParticipant;if(H){try{H.isCameraEnabled&&await H.setCameraEnabled(!1)}catch{}try{H.isMicrophoneEnabled&&await H.setMicrophoneEnabled(!1)}catch{}}ee.disconnect()}catch{}o.current=null}f(!1),m(!1),u(null),E([]),D(null),x(null),A(!1),O(!1)},[]),U=v.useCallback(async()=>{const ee=o.current;if(ee)try{await ee.localParticipant.setMicrophoneEnabled(!P),A(!P)}catch{}},[P]),Y=v.useCallback(async()=>{const ee=o.current;if(ee)try{await ee.localParticipant.setCameraEnabled(!C),O(!C),R()}catch{}},[C,R]),F=v.useCallback(async ee=>{const H=o.current;if(H)try{await H.localParticipant.setMicrophoneEnabled(ee),A(ee)}catch{}},[]),X=v.useCallback(async ee=>{const H=o.current;if(H)try{await H.localParticipant.setCameraEnabled(ee),O(ee),R()}catch{}},[R]);v.useEffect(()=>()=>{L.current=!0,N.current=null;const ee=o.current;if(ee){try{const H=ee.localParticipant;if(H){try{H.setCameraEnabled(!1)}catch{}try{H.setMicrophoneEnabled(!1)}catch{}}ee.disconnect()}catch{}o.current=null}},[]);const J={connected:d,connecting:h,error:_,joinRoom:j,leaveRoom:q,currentRoomId:c,participants:b,localParticipant:T,micEnabled:P,videoEnabled:C,toggleMic:U,toggleVideo:Y,setMicEnabled:F,setVideoEnabled:X,localVideoTrack:I};return g.jsx(u4.Provider,{value:J,children:t})}const Oc={diceAudio:!0,backgroundMusic:!0,chatAudio:!1,video:!1,showAnimations:!0,lastGameMode:"cee-lo",diceColorTheme:"dice_white_black"},d4="app:settings:v1";async function au(){try{const{value:t}=await ys.get({key:d4});if(!t)return{...Oc};const e=JSON.parse(t);return{...Oc,...e}}catch{return{...Oc}}}async function y0(t){await ys.set({key:d4,value:JSON.stringify(t)})}const Sfe={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"poker",VITE_OTA:"1"},Km=500,f4=new Array(Km);let ym=0,hb=0;function Efe(){try{if(typeof window<"u"&&window.localStorage?.getItem("logs:disable")==="1"||typeof import.meta<"u"&&Sfe?.VITE_LOGS_DISABLED==="1")return!1}catch{}return!0}function Tfe(t){f4[ym]=t,ym=(ym+1)%Km,hb=Math.min(hb+1,Km);try{window.dispatchEvent(new CustomEvent("fe:log",{detail:t}))}catch{}}function p4(){const t=[],e=hb;for(let r=0;r<e;r++){const n=(ym-e+r+Km)%Km,a=f4[n];a&&t.push(a)}return t}function Cfe(){ym=0,hb=0}function kv(t,e,r,n){const a={t:Date.now(),tag:t,level:e,msg:r,data:n};if(Efe()){`${new Date(a.t).toISOString()}${t}${e}`;try{const i=n===void 0?[]:[n]}catch{}Tfe(a)}}const Bt={debug:(t,e)=>kv("RTC","debug",t,e),info:(t,e)=>kv("RTC","info",t,e),warn:(t,e)=>kv("RTC","warn",t,e),error:(t,e)=>kv("RTC","error",t,e)};try{window.rtcLogs=p4,window.rtcLogsClear=Cfe}catch{}const h4=v.createContext(null),xfe=()=>v.useContext(h4);function pn(t){return t.connectionState==="closed"||t.signalingState==="closed"}function wv(t){if(t)try{t.getTracks().forEach(e=>e.stop())}catch{}}function Pfe(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 Afe=(()=>{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 Ih(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 Rfe(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 Mh(t){t.heartbeat&&(clearInterval(t.heartbeat),t.heartbeat=void 0);try{t.dc?.close()}catch{}t.dc=void 0}function Dfe({children:t}){const{user:e}=Vr(),r=Ss(),n=e?.id,a=!!(e?.email&&/@guest\.local$/i.test(e.email)),i=!!n&&!a;function o(Z,fe){try{const ge=window;ge.__rtcVideoDisableReasons||(ge.__rtcVideoDisableReasons=[]),ge.__rtcVideoDisableReasons.push({t:Date.now(),reason:Z,...fe?{data:fe}:{}});try{PC(`video:disable:${Z}`)}catch{}}catch{}}const{rtcJoin:c,rtcSignal:u,rtcLeave:d,rtcSetVideoEnabled:f}=ga(),h=v.useRef(new Map),[m,_]=v.useState({}),w=null,[b,E]=v.useState({}),[T,D]=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,R]=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,Y]=v.useState(0),F=v.useRef(null);v.useRef([]);const X=v.useRef({audio:!1,video:!1}),J=U>0||N||x,ee=v.useCallback(async()=>{try{const Z=navigator;Z?.wakeLock?.request&&!F.current&&(F.current=await Z.wakeLock.request("screen"),F.current.addEventListener("release",()=>{}))}catch{}},[]),H=v.useCallback(async()=>{try{await F.current?.release?.()}catch{}F.current=null},[]);v.useEffect(()=>(Bt.debug("wakeLock:effect",{need:J}),J?ee():H(),()=>{H()}),[J,ee,H]),v.useEffect(()=>{const Z=()=>{document.visibilityState==="visible"&&J&&ee()};return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},[J,ee]);const B=(()=>{try{return window.Capacitor?.getPlatform?.()==="ios"}catch{return!1}})();async function K(Z,fe){if(!i||X.current[fe])return null;X.current[fe]=!0;try{return navigator.mediaDevices?.getUserMedia?await navigator.mediaDevices.getUserMedia(Z):(Bt.error("gUM:not-available",{kind:fe,isNativeIOS:B}),null)}catch(ge){return Bt.error("gUM:failed",{kind:fe,errName:ge?.name,errMsg:ge?.message,isNativeIOS:B}),null}finally{X.current[fe]=!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 fe=Z.getAudioTracks()[0];fe&&(fe.enabled=!1),A.current=Z}return A.current}async function te(){if(!i)return;if(P.current)return P.current;const fe=await K({audio:!1,video:Afe?{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 fe&&(P.current=fe,D(fe),Bt.info("ensureVideo:acquired",Pfe(fe))),P.current}function pe(){const Z=P.current?.getVideoTracks()??[];try{Z.forEach(fe=>{fe.stop()})}catch{}P.current=void 0,D(void 0)}function ce(){try{A.current?.getAudioTracks()?.forEach(Z=>Z.stop())}catch{}A.current=void 0}const Re=v.useRef(new Map),[He,ie]=v.useState({});function xe(Z,fe){if(Re.current.get(Z))return;const ge=fe?.getAudioTracks?.()??[];if(!ge.length||ge.every(Ge=>Ge.readyState!=="live"))return;let Pe;try{Pe=new AudioContext}catch(Ge){Bt.warn("vad:audiocontext-failed",{pid:Z,err:String(Ge)});return}let De,W;try{De=Pe.createMediaStreamSource(fe),W=Pe.createAnalyser(),W.fftSize=2048,De.connect(W)}catch(Ge){Bt.warn("vad:setup-failed",{pid:Z,err:String(Ge)});try{Pe.close()}catch{}return}const $=new Uint8Array(W.fftSize);let oe=0;const ct=.04,Nt=.02;let Qt=!1,Rt=!1;const mr=()=>{if(!Rt){try{W.getByteTimeDomainData($);let Ge=0;for(let xt=0;xt<$.length;xt++){const qt=($[xt]-128)/128;Ge+=qt*qt}const Gt=Math.sqrt(Ge/$.length);!Qt&&Gt>=ct?(Qt=!0,ie(xt=>xt[Z]===!0?xt:{...xt,[Z]:!0})):Qt&&Gt<=Nt&&(Qt=!1,ie(xt=>xt[Z]===!1?xt:{...xt,[Z]:!1}))}catch{}Rt||(oe=requestAnimationFrame(mr))}};oe=requestAnimationFrame(mr);const Kr=()=>{Rt=!0,cancelAnimationFrame(oe);try{De.disconnect()}catch{}try{W.disconnect()}catch{}Pe.close().catch(()=>{})};Re.current.set(Z,Kr)}function re(Z){const fe=Re.current.get(Z);fe&&(fe(),Re.current.delete(Z)),ie(ge=>{if(!(Z in ge))return ge;const Pe={...ge};return delete Pe[Z],Pe})}function G(Z,fe){try{return pn(Z)?void 0:Z.getTransceivers().find(ge=>ge.receiver.track?.kind===fe)??Z.getTransceivers().find(ge=>ge.sender.track?.kind===fe)??Z.getTransceivers()[fe==="audio"?0:1]}catch{return}}function ve(Z,fe){try{return pn(Z)?void 0:Z.getSenders().find(ge=>ge.track?.kind===fe)??G(Z,fe)?.sender}catch{return}}async function Oe(Z,fe){try{if(pn(Z))return;const ge=fe?.getAudioTracks?.()[0]??null,Pe=ve(Z,"audio");Pe&&await Pe.replaceTrack(ge)}catch(ge){Bt.warn("upsertAudioTrack:failed",{err:String(ge)})}}async function he(Z,fe){try{if(pn(Z))return;const ge=fe?.getVideoTracks?.()[0]??null,Pe=ve(Z,"video");Pe&&await Pe.replaceTrack(ge)}catch(ge){Bt.warn("upsertVideoTrack:failed",{err:String(ge)})}}async function Ce(Z,fe){try{const ge=fe.pc,Pe=Date.now();let De=0,W=0;(await ge.getStats()).forEach(ct=>{ct.type==="outbound-rtp"&&!ct.isRemote&&(De+=ct.bytesSent??0),ct.type==="inbound-rtp"&&!ct.isRemote&&(W+=ct.bytesReceived??0)});const oe=I.current.get(Z);I.current.set(Z,{t:Pe,up:De,down:W}),oe&&ge.connectionState==="connected"&&De===oe.up&&W===oe.down&&Pe-oe.t>2e4&&await Je(Z,fe)}catch{}}function st(Z,fe){if(O.current.get(Z))return;const ge=window.setInterval(()=>Ce(Z,fe),1e4);O.current.set(Z,ge)}function Ne(Z){const fe=O.current.get(Z);fe&&(clearInterval(fe),O.current.delete(Z)),I.current.delete(Z)}function St(){const Z=typeof window<"u"?new URL(window.location.href):null,fe=typeof localStorage<"u"&&(localStorage.getItem("rtcRelayOnly")==="1"||localStorage.getItem("rtcRelayOnly")==="true")||Z?.searchParams.get("rtcRelay")==="1"||Z?.searchParams.get("rtcRelay")==="true",ge=!!Ke._compat,Pe=!!(fe||ge),De={iceServers:Ih(q.current,j),bundlePolicy:"balanced",iceTransportPolicy:Pe?"relay":"all",rtcpMuxPolicy:"require",iceCandidatePoolSize:2};De.iceServers.some($=>(Array.isArray($.urls)?$.urls:[$.urls]).some(ct=>ct.startsWith("turn:")||ct.startsWith("turns:"))),Bt.debug("pc:new",{relayOnly:Pe,iceTransportPolicy:De.iceTransportPolicy,iceServers:(De.iceServers||[]).map($=>typeof $.urls=="string"?$.urls:$.urls?.[0])});let W;try{W=new RTCPeerConnection(De)}catch($){Bt.error("pc:new-failed",{err:String($),servers:De.iceServers});const oe={...De,iceServers:j};W=new RTCPeerConnection(oe)}return W.addTransceiver("audio",{direction:"sendrecv"}),W.addTransceiver("video",{direction:"sendrecv"}),W}async function at(Z,fe){try{const ge=await fe.getStats(),Pe={};ge.forEach(W=>{W&&W.id&&(Pe[W.id]=W)});let De;if(ge.forEach(W=>{W.type==="transport"&&W.selectedCandidatePairId&&Pe[W.selectedCandidatePairId]&&(De=Pe[W.selectedCandidatePairId])}),De||ge.forEach(W=>{W.type==="candidate-pair"&&(W.selected||W.state==="succeeded")&&(De=W)}),De){const W=Pe[De.localCandidateId],$=Pe[De.remoteCandidateId];Bt.info("ice:selected",{peerId:Z,state:De.state,nominated:De.nominated,bytesSent:De.bytesSent,bytesReceived:De.bytesReceived,local:W?{type:W.candidateType,protocol:W.protocol,address:W.address,port:W.port}:void 0,remote:$?{type:$.candidateType,protocol:$.protocol,address:$.address,port:$.port}:void 0})}else Bt.debug("ice:selected:none",{peerId:Z})}catch(ge){Bt.error("ice:selected-failed",{peerId:Z,err:String(ge)})}}async function Ke(){try{if(Ke._ran)return;Ke._ran=!0;const Z={iceServers:Ih(q.current,j),bundlePolicy:"balanced",iceTransportPolicy:"all"},fe=new RTCPeerConnection(Z),ge={host:0,srflx:0,relay:0,prflx:0};fe.onicecandidate=ct=>{if(!ct.candidate)return;const Rt=(ct.candidate.candidate||"").match(/ typ ([a-z]+)/)?.[1]||"unknown";ge[Rt]===void 0&&(ge[Rt]=0),ge[Rt]+=1},fe.createDataChannel("probe");const Pe=await fe.createOffer({iceRestart:!1});await fe.setLocalDescription(Pe),await new Promise(ct=>setTimeout(ct,4e3));try{fe.close()}catch{}const De=(ge.relay||0)>0,W=(ge.srflx||0)>0,$=(ge.host||0)>0,oe=De&&!W&&$;if(oe){Bt.warn("ice:probe-forcing-relay",{counts:ge,reason:"no-srflx"}),Ke._compat=!0;try{localStorage.setItem("rtcRelayOnly","1")}catch{}}else!De&&!W&&Bt.error("ice:probe-restricted-network",{counts:ge,warning:"Voice/video may not work"});Bt.info("ice:probe",{counts:ge,relayOK:De,srflxOK:W,needsRelayOnly:oe})}catch(Z){Bt.error("ice:probe-failed",{err:String(Z)})}}function it(Z){let fe=h.current.get(Z);if(fe)return fe;const ge=St(),Pe={pc:ge,iceBuffer:[],makingOffer:!1,ignoreOffer:!1,isSettingRemoteAnswerPending:!1};return ge.onicecandidate=De=>{De.candidate&&(Bt.debug("pc:icecandidate",{peerId:Z,ctype:De.candidate.type,proto:De.candidate.protocol,addr:De.candidate.address,port:De.candidate.port}),u(C.current,Z,{ice:De.candidate.toJSON()}).catch(console.error))},ge.ontrack=De=>{if(Bt.info("pc:ontrack",{peerId:Z,kind:De.track.kind,id:De.track.id}),_(W=>{const $=W[Z]??new MediaStream;return $.getTracks().includes(De.track)||($.addTrack(De.track),De.track.addEventListener("ended",()=>{Bt.debug("pc:track-ended",{peerId:Z,kind:De.track.kind,id:De.track.id}),_(oe=>{const ct=oe[Z];if(!ct)return oe;try{ct.removeTrack(De.track)}catch{}return{...oe,[Z]:ct}}),De.track.kind==="video"&&E(oe=>({...oe,[Z]:!1}))}),De.track.kind==="video"&&(De.track.addEventListener("mute",()=>{E(oe=>({...oe,[Z]:!1}))}),De.track.addEventListener("unmute",()=>{De.track.readyState==="live"&&E(oe=>({...oe,[Z]:!0}))}))),{...W,[Z]:$}}),De.track.kind==="video"){const W=De.track.readyState==="live"&&!De.track.muted;E($=>({...$,[Z]:W}))}},ge.onnegotiationneeded=()=>{Bt.debug("pc:onnegotiationneeded",{peerId:Z})},ge.onconnectionstatechange=()=>{const{connectionState:De}=ge,W=ge.iceConnectionState;if(Bt.info("pc:state",{peerId:Z,state:De,ice:W}),De==="connected"&&(Pe.degradedAt=null,Pe.iceRestartCount=0,Pe.rebuildAttempts=0,Rfe(Z,Pe),st(Z,Pe),setTimeout(()=>at(Z,ge),500)),De==="closed"&&(Mh(Pe),Ne(Z)),(De==="disconnected"||mt(De,W))&&!Pe.degradedAt&&(Pe.degradedAt=Date.now()),De==="disconnected"&&Pe.degradedAt){const oe=Date.now()-Pe.degradedAt;oe>3e3&&oe<8e3?Je(Z,Pe):oe>=8e3&&(Bt.warn("pc:prolonged-disconnect",{peerId:Z,degradedMs:oe}),ot(Z))}mt(De,W)&&Je(Z,Pe)},ge.oniceconnectionstatechange=()=>{const De=ge.iceConnectionState;Bt.debug("pc:ice-state",{peerId:Z,ice:De}),De==="failed"&&Je(Z,Pe),De==="disconnected"&&setTimeout(()=>{!pn(ge)&&ge.iceConnectionState==="disconnected"&&(Bt.warn("ice:prolonged-disconnect",{peerId:Z}),Je(Z,Pe))},4e3)},ge.onicegatheringstatechange=()=>{},ge.ondatachannel=De=>{if(De.channel.label==="ka"){const W=De.channel;Pe.dc=W,Bt.debug("pc:datachannel",{peerId:Z,label:W.label,state:W.readyState})}},h.current.set(Z,Pe),Y(h.current.size),Bt.info("peer:new",{peerId:Z}),Pe}function mt(Z,fe){return Z==="failed"||fe==="failed"}async function Je(Z,fe){if(pn(fe.pc))return;const ge=Date.now(),Pe=fe.lastIceRestartAt,De=fe.iceRestartCount??0,W=Math.min(1e4*Math.pow(2,De),6e4);if(!(Pe&&ge-Pe<W)){if(De>=3){Bt.warn("ice:restart-exhausted",{peerId:Z,restartCount:De}),fe.iceRestartCount=0,await ot(Z);return}if(Bt.warn("ice:restart",{peerId:Z,attempt:De+1}),!(fe.makingOffer||pn(fe.pc))&&(fe.pc.signalingState!=="stable"&&await Ft(fe.pc),!pn(fe.pc)))try{const $=await fe.pc.createOffer({iceRestart:!0});if(pn(fe.pc))return;await fe.pc.setLocalDescription($),await u(C.current,Z,{sdp:fe.pc.localDescription}),fe.lastIceRestartAt=ge,fe.iceRestartCount=De+1}catch($){Bt.error("ice:restart-failed",{peerId:Z,err:String($)}),fe.iceRestartCount=0,await ot(Z)}}}const ue=v.useRef(new Map),Be=3,je=3e4;async function ot(Z){const fe=ue.current.get(Z)??{count:0,lastAt:0},ge=Date.now();if(ge-fe.lastAt>je*3&&(fe.count=0),fe.count>=Be){const $=je-(ge-fe.lastAt);if($>0){Bt.warn("rebuild:rate-limited",{peerId:Z,attempts:fe.count,waitMs:$}),setTimeout(()=>{ue.current.delete(Z),ot(Z)},$);return}fe.count=0}fe.count++,fe.lastAt=ge,ue.current.set(Z,fe),Bt.info("rebuild:peer",{peerId:Z,attempt:fe.count});const Pe=h.current.get(Z);if(Pe){Mh(Pe);try{Pe.pc.close()}catch{}h.current.delete(Z)}_($=>{if(!$[Z])return $;const oe={...$};return wv(oe[Z]),delete oe[Z],oe}),re(Z),E($=>{const{[Z]:oe,...ct}=$;return ct});const{pc:De}=it(Z);await lt(De);const W=h.current.get(Z);await Me(Z,De,W)}function Pt(Z){return Z.signalingState==="stable"}function Ft(Z){return Z.signalingState==="stable"||pn(Z)?Promise.resolve():new Promise(fe=>{const ge=()=>{const Pe=Z.signalingState;(Pe==="stable"||Pe==="closed")&&(Z.removeEventListener("signalingstatechange",ge),fe())};Z.addEventListener("signalingstatechange",ge)})}async function Me(Z,fe,ge){try{if(pn(fe)||(Pt(fe)||await Ft(fe),!Pt(fe)||ge.makingOffer||pn(fe)))return;ge.makingOffer=!0,Bt.debug("sdp:offer",{peerId:Z});const Pe=await fe.createOffer();if(pn(fe)){ge.makingOffer=!1;return}await fe.setLocalDescription(Pe),await u(C.current,Z,{sdp:fe.localDescription})}catch(Pe){Bt.warn("safeRenegotiate:failed",{peerId:Z,err:String(Pe)})}finally{ge.makingOffer=!1}}const tt=v.useCallback(async Z=>{if(Z!==N){if(!i){L(!1),o("preferences:init"),L(!1);return}if(L(Z),n&&E(fe=>({...fe,[n]:Z})),Z){try{am(!0)}catch{}if(!await te()){L(!1),n&&E(De=>({...De,[n]:!1}));return}for(const[De,W]of h.current)await he(W.pc,P.current),await Me(De,W.pc,W);const ge=()=>{try{am(!1)}catch{}};let Pe=!1;for(const[,De]of h.current){const W=De.pc,$=()=>{!Pe&&W.connectionState==="connected"&&(Pe=!0,ge(),W.removeEventListener("connectionstatechange",$))};W.addEventListener("connectionstatechange",$)}window.setTimeout(()=>{Pe||ge()},2500)}else{for(const[fe,ge]of h.current)await he(ge.pc,void 0),await Me(fe,ge.pc,ge);pe()}f(C.current,Z).catch(()=>{});try{PC(Z?"videoEnabled:on":"videoEnabled:off")}catch{}}},[N,n,i,h,te,he,Me,pe,f]),rt=async Z=>{if(!i){R(!1);return}if(R(Z),Z&&!A.current&&!await ae()){R(!1);return}const fe=A.current?.getAudioTracks?.()[0];fe&&(fe.enabled=Z);for(const[,ge]of h.current)await Oe(ge.pc,A.current)},be=Z=>Z===n?!!P.current?.getVideoTracks?.().some(ge=>ge.readyState==="live"):!!m[Z]?.getVideoTracks?.().some(ge=>ge.readyState==="live"),lt=async Z=>{if(!pn(Z)){if(!i){await Oe(Z,void 0),await he(Z,void 0);return}try{if(await ae(),N&&await te(),pn(Z))return;Bt.debug("attachLocalTracks",{audio:!!(x&&A.current),video:!!(N&&P.current)}),await Oe(Z,x?A.current:void 0),await he(Z,N?P.current:void 0)}catch(fe){Bt.warn("attachLocalTracks:failed",{err:String(fe)})}}},yt=v.useRef(0),tr=5400*1e3;v.useEffect(()=>{if(!C.current||h.current.size===0)return;const Z=async()=>{const ge=Date.now();if(!(ge-yt.current<tr)){Bt.info("ice:refresh-credentials",{roomId:C.current});try{const Pe=await c(C.current);if(Pe?.ok&&Array.isArray(Pe.iceServers)&&Pe.iceServers.length){const De=Ih([...j,...Pe.iceServers],j);q.current=De,yt.current=ge,Bt.debug("ice:credentials-refreshed",{count:De.length})}}catch(Pe){Bt.warn("ice:refresh-failed",{err:String(Pe)})}}},fe=window.setInterval(Z,6e4);return()=>clearInterval(fe)},[U,c]);const Or=async Z=>{if(!i||!n)return;C.current=Z,Bt.info("rtc:join",{roomId:Z});const fe=3,ge=150;let Pe=null,De=null;for(let W=0;W<fe&&(Pe=await c(Z),!(Pe?.ok||(De=Pe?.error||"rtc_join failed",!/not a member|room not found/i.test(De||"")||W>=fe-1)));W++)Bt.warn("rtc:join:retry",{roomId:Z,attempt:W+1,error:De}),await new Promise(oe=>setTimeout(oe,ge*(W+1)));if(!Pe?.ok)throw new Error(De||"rtc_join failed");if(Array.isArray(Pe.iceServers)&&Pe.iceServers.length){const W=Ih([...j,...Pe.iceServers],j);q.current=W,yt.current=Date.now(),W.some($=>(Array.isArray($.urls)?$.urls:[$.urls]).some(ct=>ct.startsWith("turn:")||ct.startsWith("turns:"))),Bt.debug("rtc:ice-servers",{count:W.length,servers:W.map($=>$.urls).slice(0,4)})}else q.current=[...j],yt.current=Date.now();if(Ke(),N&&!P.current){const W=await te();W&&D(W)}for(const W of Pe.peers.filter($=>$!==n)){const{pc:$}=it(W);await lt($);const oe=h.current.get(W);await Me(W,$,oe)}Y(h.current.size)},ur=Z=>{!Z||C.current&&C.current,Bt.info("rtc:leave",{roomId:Z});try{d(Z)}catch{}for(const[,fe]of h.current){Mh(fe);try{fe.pc.close()}catch{}}h.current.clear(),Y(0),C.current=void 0,H(),_(fe=>(Object.values(fe).forEach(wv),{}));for(const fe of Array.from(Re.current.keys()))re(fe);A.current?.getTracks()?.forEach(fe=>fe.stop()),P.current?.getTracks()?.forEach(fe=>fe.stop()),A.current=void 0,P.current=void 0,D(void 0),E({})},dr=async(Z,fe)=>{},fn=async()=>{i&&await tt(!0)};return v.useEffect(()=>{if(!N||!C.current||h.current.size===0)return;const Z=async()=>{if(!N||!P.current)return;const ge=P.current.getVideoTracks()[0];if(!((!ge||ge.readyState!=="live")&&(Bt.warn("health:video-track-dead"),P.current=void 0,!await te()))){for(const[Pe,De]of h.current)if(!pn(De.pc))try{const $=De.pc.getSenders().find(ct=>ct.track?.kind==="video")?.track,oe=P.current?.getVideoTracks()[0];oe&&(!$||$.id!==oe.id)&&(Bt.info("health:reattach-video",{peerId:Pe}),await he(De.pc,P.current),await Me(Pe,De.pc,De))}catch(W){Bt.warn("health:check-failed",{peerId:Pe,err:String(W)})}}},fe=window.setInterval(Z,5e3);return Z(),()=>clearInterval(fe)},[N,U]),v.useEffect(()=>{if(!r||!i)return;const Z=async()=>{const fe=C.current;if(fe){Bt.info("socket:reconnect:rtc-rejoin",{roomId:fe,peerCount:h.current.size});for(const[,ge]of h.current){Mh(ge);try{ge.pc.close()}catch{}}h.current.clear(),Y(0),_(ge=>(Object.values(ge).forEach(wv),{})),E({});try{const ge=await c(fe);if(!ge?.ok){Bt.warn("socket:reconnect:rtc-rejoin-failed",{roomId:fe,error:ge?.error});return}if(Array.isArray(ge.iceServers)&&ge.iceServers.length){const Pe=Ih([...j,...ge.iceServers],j);q.current=Pe,yt.current=Date.now()}for(const Pe of ge.peers.filter(De=>De!==n)){const{pc:De}=it(Pe);await lt(De);const W=h.current.get(Pe);await Me(Pe,De,W)}Y(h.current.size),Bt.info("socket:reconnect:rtc-rejoin-success",{roomId:fe,peerCount:h.current.size})}catch(ge){Bt.error("socket:reconnect:rtc-rejoin-error",{roomId:fe,err:String(ge)})}}};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,fe]of Object.entries(m))fe?.getAudioTracks().some(Pe=>Pe.enabled)&&xe(Z,fe);for(const Z of Re.current.keys())Z!==n&&!m[Z]&&re(Z)},[m,n]),Da({onRtcPeerJoined:async({peerId:Z})=>{if(Bt.info("sig:peer-joined",{peerId:Z}),!(!C.current||Z===n))try{const{pc:fe}=it(Z);if(pn(fe))return;await lt(fe);const ge=h.current.get(Z);ge&&!pn(fe)&&await Me(Z,fe,ge)}catch(fe){Bt.warn("sig:peer-joined:failed",{peerId:Z,err:String(fe)})}},onRtcPeerLeft:({peerId:Z})=>{Bt.info("sig:peer-left",{peerId:Z});const fe=h.current.get(Z);if(fe){Mh(fe),Ne(Z);try{fe.pc.close()}catch{}}h.current.delete(Z),Y(h.current.size),_(ge=>{const Pe={...ge};return wv(Pe[Z]),delete Pe[Z],Pe}),re(Z),E(ge=>{const{[Z]:Pe,...De}=ge;return De})},onRtcSignal:async({fromPeerId:Z,payload:fe})=>{let ge,Pe;try{ge=it(Z),Pe=ge.pc}catch(De){Bt.warn("sig:getPeer-failed",{fromPeerId:Z,err:String(De)});return}if(pn(Pe)){Bt.debug("sig:pc-closed",{fromPeerId:Z});return}try{if(fe.sdp){if(Bt.debug("sig:sdp",{fromPeerId:Z,type:fe.sdp.type}),pn(Pe))return;const De=fe.sdp;if(De.type==="answer"&&Pt(Pe)){Bt.debug("sig:stale-answer-ignored",{fromPeerId:Z,signalingState:Pe.signalingState});return}const W=Pt(Pe)||ge.isSettingRemoteAnswerPending,$=De.type==="offer"&&!W;if(ge.ignoreOffer=!(n<Z)&&$,ge.ignoreOffer||(De.type==="answer"&&(ge.isSettingRemoteAnswerPending=!0),$&&(pn(Pe)||await Pe.setLocalDescription({type:"rollback"})),pn(Pe)))return;if(await Pe.setRemoteDescription(De),ge.isSettingRemoteAnswerPending=!1,De.type==="offer"&&!pn(Pe)){const oe=await Pe.createAnswer();if(pn(Pe))return;await Pe.setLocalDescription(oe),await u(C.current,Z,{sdp:Pe.localDescription})}for(;ge.iceBuffer.length&&!pn(Pe);){const oe=ge.iceBuffer.shift();try{await Pe.addIceCandidate(oe)}catch{}}}else if(fe.ice){if(Bt.debug("sig:ice",{fromPeerId:Z,hasRemote:!!Pe.remoteDescription}),pn(Pe))return;const De=fe.ice;if(Pe.remoteDescription)try{await Pe.addIceCandidate(De)}catch{}else ge.iceBuffer.push(De)}}catch(De){const W=String(De);Bt.error("sig:error",{fromPeerId:Z,err:W}),(W.includes("order of m-lines")||W.includes("m-line")||W.includes("InvalidAccessError"))&&(Bt.warn("sig:mline-mismatch-rebuild",{fromPeerId:Z}),await ot(Z))}},onRtcVideoEnabled:({playerId:Z,enabled:fe})=>{Bt.debug("sig:video-enabled",{playerId:Z,enabled:fe}),E(ge=>({...ge,[Z]:!!fe}))}}),v.useEffect(()=>{let Z=!0;return(async()=>{try{const fe=await au();if(!Z)return;L(!1),n&&E(ge=>({...ge,[n]:!1})),R(i?!!fe.chatAudio:!1)}catch{}})(),()=>{Z=!1}},[n,i]),v.useEffect(()=>{i||(R(!1),N&&o("auth:lost"),L(!1),n&&E(Z=>({...Z,[n]:!1})),(async()=>{for(const[Z,fe]of h.current)await Oe(fe.pc,void 0),await he(fe.pc,void 0),await Me(Z,fe.pc,fe).catch(()=>{})})(),ce(),pe())},[i,n]),v.useEffect(()=>{const Z=fe=>{const ge=fe.detail;ge&&(typeof ge.video=="boolean"&&ge.video===!1&&(L(!1),E(Pe=>({...Pe,[n]:!1}))),typeof ge.chatAudio=="boolean"&&R(ge.chatAudio))};return window.addEventListener("app:settings",Z),()=>window.removeEventListener("app:settings",Z)},[n]),v.useEffect(()=>{const Z=()=>{if(document.visibilityState==="visible")for(const[Pe,De]of h.current)Je(Pe,De)},fe=()=>{for(const[Pe,De]of h.current)Je(Pe,De)},ge=()=>{for(const[Pe,De]of h.current)Je(Pe,De)};return document.addEventListener("visibilitychange",Z),window.addEventListener("online",fe),window.addEventListener("offline",ge),()=>{document.removeEventListener("visibilitychange",Z),window.removeEventListener("online",fe),window.removeEventListener("offline",ge)}},[]),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(h4.Provider,{value:{videoEnabled:N,setVideoEnabled:tt,enableCamera:fn,joinRtc:Or,leaveRtc:ur,cameraOwnerId:w,setCameraOwner:dr,remoteStreams:m,myVideo:T,micEnabled:x,setMicEnabled:rt,hasVideo:be,speaking:He,remoteVideoFlags:b},children:t})}function Ofe(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 PC(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:Ofe(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=PC})}catch{}function gu(){const t=kfe(),e=xfe(),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(async h=>{r?await 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 m4=v.createContext(null),Li=()=>v.useContext(m4),_E={};function Nfe({children:t}){const{user:e,meId:r}=Vr(),n=r||e?.id,{resetSpin:a}=Zo(),i=rn(),{joinRoom:o,leaveRoom:c,setSpectate:u,pokerJoinRoom:d,getRoomsList:f}=ga(),[h,m]=v.useState(()=>{try{const R=window.__PRESEEDED_ROOM;if(R&&typeof R=="object")return delete window.__PRESEEDED_ROOM,R}catch{}return null}),{leaveRoom:_,joinRoom:w}=gu(),b=v.useRef({}),E=v.useMemo(()=>(h?.gameState??{}).phase==="waiting"||h===null,[h]),T=v.useCallback(async R=>{try{const N=await o(R);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?.(R))}catch{}if(!N.room?.singlePlayer)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===R);q&&Array.isArray(q.players)&&m(U=>{if(!U||U.id!==R)return U;const Y=Array.isArray(U.players)?U.players:[],F=new Map(Y.map(J=>[J.id,J])),X=q.players.map(J=>{const ee=F.get(J.id);return ee&&ee.name&&ee.name!=="Bot"&&ee.name!=="Player"?{...J,name:ee.name}:J});for(const J of Y)X.some(ee=>ee.id===J.id)||X.push(J);return{...U,players:X}})}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",Y={id:R,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(Y);return}catch{throw N}}},[o,a,w,f,n,e?.name]),D=v.useCallback(async()=>{if(h){try{await _(h.id)}catch{}try{await c(h.id)}finally{m(null)}}},[c,_,h]),P=v.useCallback((R,N)=>{if(!N)return R;if(!R)return N;try{const L=Array.isArray(R.players)?R.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])),Y=new Map(j.map(F=>[String(F.id),F]));q=[];for(const[F,X]of Y.entries()){const J=U.get(F);J?q.push({...J,...X,name:X.name||J.name,avatarUrl:X.avatarUrl??J.avatarUrl}):q.push(X)}}return{...R,...N,players:q}}catch{return N||R}},[]);Da({onJoinedRoom:({room:R})=>{try{a()}catch{}m(N=>P(N,R))},onOtherPlayerJoined:({room:R})=>m(N=>P(N,R)),onOtherLeft:({room:R})=>{let N=!1,L=null;if(m(j=>{const q=P(j,R);try{const U=Array.isArray(R?.players)?R?.players:Array.isArray(q?.players)?q.players:[],Y=String(n||"");if(!(Y&&U.some(X=>String(X?.id)===Y))&&j){if(!!(R?.singlePlayer||q?.singlePlayer))return q;const J=String(j.id||""),ee=b.current[J]||0,H=Date.now();return ee?H-ee<1500?q:(N=!0,L=String(j.id),delete b.current[J],null):(b.current[J]=H,q)}}catch{}return q}),N){try{L&&_?.(L)}catch{}try{i("/lobby",{replace:!0})}catch{}}},onSpectatorsUpdated:({spectators:R})=>{m(N=>N&&{...N,gameState:{...N.gameState,spectators:R}})},onPlayerProfileUpdated:({playerId:R,name:N,avatarUrl:L})=>{m(j=>{if(!j)return j;const q=j.players.map(U=>U.id!==R?U:{...U,...N!==void 0&&{name:N},...L!==void 0&&{avatarUrl:L}});return{...j,players:q}})},onBetsUpdated:({room:R})=>{R&&m(N=>{if(!N)return R;try{const L=new Map(N.players.map(U=>[U.id,U])),j=new Map((R.players||[]).map(U=>[U.id,U])),q=N.players.map(U=>j.get(U.id)||U);for(const[U,Y]of j.entries())L.has(U)||q.push(Y);return{...N,gameState:R.gameState??N.gameState,name:R.name??N.name,maxPlayers:R.maxPlayers??N.maxPlayers,private:R.private??N.private,singlePlayer:R.singlePlayer??N.singlePlayer,players:q}}catch{return N}})},onBankerChanged:R=>{m(N=>!N||N.id!==R.roomId?N:{...N,gameState:{...N.gameState,banker:R.bankerId,currentRollerId:R.currentRollerId,roundSeq:R.roundSeq,bankRoll:null}})},onForceLogout:R=>{R?.reason==="session_superseded"&&V3();try{h?.id&&_(h.id)}catch{}m(null)},onRoomUpdateState:({roomId:R,gameState:N,room:L})=>{const j=L?.gameState??N;if(!j)return;const q=Array.isArray(L?.players)?L.players:[];let U=!1,Y=null;if(m(F=>{const X=J=>{if(!q.length)return J;const ee=new Map(J.map(H=>[H.id,H]));for(const H of q){const B=ee.get(H.id);B?ee.set(H.id,{...B,...H}):ee.set(H.id,H)}return Array.from(ee.values())};try{if(q.length&&F&&F.id===R){const J=String(n||"");if(J&&!q.some(H=>String(H?.id)===J)){if(!!(L?.singlePlayer||F?.singlePlayer))return{...F,players:X(F.players),gameState:j};const B=String(F.id||""),K=b.current[B]||0,ae=Date.now();return K?ae-K<1500?{...F,players:X(F.players),gameState:j}:(U=!0,Y=String(F.id),delete b.current[B],null):(b.current[B]=ae,{...F,players:X(F.players),gameState:j})}}}catch{}return F&&F.id===R?{...F,players:X(F.players),gameState:j}:F||{id:R,players:q,gameState:j}}),U){try{Y&&_?.(Y)}catch{}try{i("/lobby",{replace:!0})}catch{}}},onPlayerBalanceUpdated:({playerId:R,balance:N})=>{m(L=>{if(!L)return L;const j=L.players.findIndex(Y=>Y.id===R);if(j<0){const Y=[...L.players,{id:R,balance:N}];return{...L,players:Y}}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:R=>{try{const N=Hv?.()||[],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:D,setRoom:m,setSpectatingForMe:async R=>{if(h)try{return await u(h.id,R)}catch(N){return{ok:!1,error:N?.message||"Failed"}}}}),[h,E,T,D,u]),C=Ss(),O=v.useRef(0),I=v.useRef(!1),x=v.useCallback(async()=>{const R=Date.now();if(R-(O.current||0)<800)return;O.current=R;const N=h?.id;if(!N){try{const j=(Hv?.()||[]).slice(-1)[0];if(j&&String(j.event).toLowerCase().includes("create_room")&&R-(j.ts||0)<1500)return}catch{}return}try{const j=(Hv?.()||[]).slice(-1)[0];j&&String(j.event).toLowerCase().includes("create_room")&&R-(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=_E[N];if(q)j=await q;else{const U=d(N);_E[N]=U;try{j=await U}finally{delete _E[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?.(),Y=(q&&(Array.isArray(q?.rooms)?q.rooms:Array.isArray(q?.data?.rooms)?q.data.rooms:[])||[]).find(F=>F?.id===N);Y&&Array.isArray(Y.players)&&m(F=>!F||F.id!==N?F:{...F,players:Y.players})}catch{}}}catch{}},[h?.id,d,o,a,w,f]);return v.useEffect(()=>{if(!C)return;const R=q=>{q!=="io client disconnect"&&(I.current=!0)},N=()=>{I.current&&(I.current=!1,x())},L=()=>{x()},j=()=>{x()};C.on("disconnect",R),C.on("connect",N);try{C.io.on("reconnect",L)}catch{}try{C.on?.("reconnect",j)}catch{}return()=>{C.off("disconnect",R),C.off("connect",N);try{C.io.off("reconnect",L)}catch{}try{C.off?.("reconnect",j)}catch{}}},[C,x]),v.useEffect(()=>{const R=()=>{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",R),window.addEventListener("focus",N),window.addEventListener("pageshow",L),window.addEventListener("ad:complete",j),()=>{window.removeEventListener("visibilitychange",R),window.removeEventListener("focus",N),window.removeEventListener("pageshow",L),window.removeEventListener("ad:complete",j)}},[C,x]),g.jsx(m4.Provider,{value:A,children:t})}const Sv=globalThis.__lastWagersFetchAt||(globalThis.__lastWagersFetchAt={}),ZM=500;function v0(t,e){const r=Ss(),{room:n}=Li(),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 Xf(a);if(!re?.mainWagerId)return;o(G=>G.open.some(Oe=>Oe.type==="MAIN"&&Oe.playerId===e)?G:{...G,roundSeq:re.roundSeq||G.roundSeq,open:[...G.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 Xf(a);if(!re)return;re?.mainWagerId&&o(G=>G.open.some(Oe=>Oe.type==="MAIN"&&Oe.playerId===e)?G:{...G,roundSeq:re.roundSeq||G.roundSeq,open:[...G.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}=ga(),[_,w]=v.useState([]),b=v.useRef(new Set),E=v.useRef(new Set),[T,D]=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(),D(0),a&&Jf(a)},[t,a]),Da({onBetsUpdated:re=>{a&&(async()=>{try{const he=re.open.find(Ce=>Ce.type==="MAIN"&&Ce.playerId===e);he?await Ab(a,{roundSeq:re.roundSeq,mainWagerId:he.id}):await Jf(a)}catch{}})(),o(re);const G=re.settled.filter(he=>he.roundSeq===re.roundSeq);w(G.filter(he=>!b.current.has(he.id)));const Oe=(re.open||[]).filter(he=>he.type==="SIDE"&&!he.acceptedById&&he.playerId!==e&&he.subjectId!==e).filter(he=>!E.current.has(he.id));D(Oe.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(G=>{if(re.length===0)return G;const ve=new Map;for(const he of G)ve.set(he.id,he);for(const he of re)ve.set(he.id,he);return Array.from(ve.values()).sort((he,Ce)=>{const st=Number(he.roundSeq||0),Ne=Number(Ce.roundSeq||0);return Ne!==st?Ne-st:String(Ce.id).localeCompare(String(he.id))})})},[i.settledAll]),v.useEffect(()=>{if(!t)return;let re=null;const G=()=>{const Oe=Date.now(),he=Sv[t]||0;Oe-he<ZM||(Sv[t]=Oe,re=window.setTimeout(()=>{try{c(t)}catch{}},300))};if(n?.id===t)return G(),()=>{re&&clearTimeout(re)};const ve=window.setTimeout(()=>{G()},500);return()=>{re&&clearTimeout(re),clearTimeout(ve)}},[t,n?.id,c]),v.useEffect(()=>{if(!r)return;const re={current:0},G=()=>{if(!t||n?.id!==t)return;const ve=Date.now();if(!(ve-re.current<400)&&!(ve-(Sv[t]||0)<ZM)){re.current=ve,Sv[t]=ve;try{E.current.clear(),D(0),b.current.clear(),setTimeout(()=>{try{c(t)}catch{}},300)}catch{}}};return r.on("reconnect",G),()=>{r.off("reconnect",G)}},[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]),R=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,G)=>re+(G.amount||0),0),[i.open,e]),[j,q]=v.useState([]);v.useEffect(()=>{const re=setTimeout(()=>{q(A.filter(G=>G.playerId===e||G.acceptedById===e))},la.mySettledDelayMs);return()=>clearTimeout(re)},[A,e]);const[U,Y]=v.useState(null);v.useEffect(()=>{const re=setTimeout(()=>{Y(i.playerBalance)},la.balanceDelayMs);return()=>clearTimeout(re)},[i.playerBalance]);const[F,X]=v.useState([]);v.useEffect(()=>{const re=setTimeout(()=>{X(A)},la.settledAllDelayMs);return()=>clearTimeout(re)},[A]);const J=v.useMemo(()=>i.open.filter(re=>re.type==="SIDE"&&!re.acceptedById&&re.subjectId!==e&&re.playerId!==e),[i.open,e]),ee=()=>w(re=>{if(re.length===0)return re;const[G,...ve]=re;return b.current.add(G.id),ve}),H=re=>w(G=>(b.current.add(re),G.filter(ve=>ve.id!==re))),B=v.useCallback(()=>{for(const re of J)E.current.add(re.id);D(0)},[J]),K=v.useCallback(async re=>{try{const G=await u(t,{amount:Math.floor(re.amount),subjectId:re.subjectId,predicate:re.predicate,oddsBp:re.oddsBp});return G?.ok?{ok:!0,betId:G?.wager?.id||G?.id||re.clientBetId}:{ok:!1,error:G?.error||"Failed to place side bet"}}catch(G){return{ok:!1,error:G?.message||"Failed to place side bet"}}},[t,u]),ae=v.useCallback(async re=>{try{const G=await d(t,re);return G?.ok?{ok:!0}:{ok:!1,error:G?.error||"Failed to cancel side bet"}}catch(G){return{ok:!1,error:G?.message||"Failed to cancel side bet"}}},[t,d]),te=v.useCallback(async re=>{try{const G=await f(t,re);return G?.ok?{ok:!0}:{ok:!1,error:G?.error||"Failed to accept side bet"}}catch(G){return{ok:!1,error:G?.message||"Failed to accept side bet"}}},[t,f]),pe=v.useCallback(async re=>{try{const G=await h(t,Math.floor(re));return G?.ok?{ok:!0,wagerId:G?.wager?.id||G?.id}:{ok:!1,error:G?.error||"Failed to place main bet"}}catch(G){return{ok:!1,error:G?.message||"Failed to place main bet"}}},[t,h]),ce=v.useCallback(async re=>{try{const G=await m(t,re);return G?.ok?{ok:!0}:{ok:!1,error:G?.error||"Failed to cancel main bet"}}catch(G){return{ok:!1,error:G?.message||"Failed to cancel main bet"}}},[t,m]),[Re,He]=v.useState([]),ie=v.useRef(i.roundSeq),xe=v.useRef(new Set);return v.useEffect(()=>{ie.current!==i.roundSeq&&(ie.current=i.roundSeq,xe.current.clear(),He([]));const re=i.settledAll.filter(G=>G.roundSeq===i.roundSeq&&!xe.current.has(G.id));if(re.length>0){re.forEach(ve=>xe.current.add(ve.id)),He(re);const G=setTimeout(()=>He([]),1e3);return()=>clearTimeout(G)}},[i.settledAll,i.roundSeq]),{roundSeq:i.roundSeq,openAll:i.openAll,open:i.open,settled:i.settled,settledAll:F,myOpenMain:I,myOpenSides:R,openAllMain:O,openAllSides:x,mySettledThisRound:N,mySettledAll:j,myExposure:L,unseenSettledWagers:_,consumeNextUnseen:ee,markAsSeen:H,offersToMe:J,newOfferCount:T,markOffersAsSeen:B,placeSideBet:K,cancelSideBet:ae,acceptSideBet:te,placeMainBet:pe,cancelMainBet:ce,playerBalance:U,newSettlements:Re}}var Ev={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 ej;function Ife(){return ej||(ej=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),R=P<0?"-":"",N=parseInt(E(Math.abs(P||0),x),10)+"",L=N.length>3?N.length%3:0;return R+(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]:"")},D=a.formatMoney=function(P,A,C,O,I,x){if(d(P))return m(P,function(j){return D(j,A,C,O,I,x)});P=b(P);var R=h(f(A)?A:{symbol:A,precision:C,thousand:O,decimal:I,format:x},a.settings.currency),N=w(R.format),L=P>0?N.pos:P<0?N.neg:N.zero;return L.replace("%s",R.symbol).replace("%v",T(Math.abs(P),_(R.precision),R.thousand,R.decimal))};a.formatColumn=function(P,A,C,O,I,x){if(!P)return[];var R=h(f(A)?A:{symbol:A,precision:C,thousand:O,decimal:I,format:x},a.settings.currency),N=w(R.format),L=N.pos.indexOf("%s")<N.pos.indexOf("%v"),j=0,q=m(P,function(U,Y){if(d(U))return a.formatColumn(U,R);U=b(U);var F=U>0?N.pos:U<0?N.neg:N.zero,X=F.replace("%s",R.symbol).replace("%v",T(Math.abs(U),_(R.precision),R.thousand,R.decimal));return X.length>j&&(j=X.length),X});return m(q,function(U,Y){return u(U)&&U.length<j?L?U.replace(R.symbol,R.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})()})(Ev,Ev.exports)),Ev.exports}var Mfe=Ife();const rd=Sg(Mfe);function tj(t){return t==="WIN"?"LOSE":t==="LOSE"?"WIN":t}function mb(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 md(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=rj(t);return{myResult:t.result,myPayout:t.result==="WIN"?o:0,label:Hu(t.result,t.result==="WIN"?o:0,t.amount)}}else{const o=tj(t.result),c=jfe(t);return{myResult:o,myPayout:o==="WIN"?c:0,label:Hu(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=rj(t),u=t.result==="WIN"?c:0,d={myResult:t.result,myPayout:u,label:Hu(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:Hu(d.myResult,f,t.amount)}}return d}else{const c=tj(t.result),u=Lfe(t),d=c==="WIN"?u:0,f={myResult:c,myPayout:d,label:Hu(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:Hu(f.myResult,h,t.amount)}}return f}}return{myResult:"PUSH",myPayout:0,label:"Push"}}function rj(t){return typeof t.payout=="number"?t.payout:t.amount}function jfe(t){return t.amount}function Lfe(t){return typeof t.oddsBp=="number"&&t.oddsBp!==1e4&&typeof t.payout=="number"?t.payout:t.amount}function Hu(t,e,r){return t==="WIN"?`won ${mb(Math.max(0,e))}`:t==="LOSE"?`lost ${mb(Math.max(0,r))}`:t==="PUSH"?"Push":t}function Bfe(t){return!t||t.length===0?0:t.reduce((e,r)=>e+Number(r?.amount||0),0)}function g4({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 _=md(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",rd.formatMoney(_,"",0)]},h))})}),u&&g.jsxs(g.Fragment,{children:[(()=>{const h=Bfe(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",rd.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 D="";if(h.kind==="BET_PLACED")D=`Placed ${h.meta?.betType?String(h.meta.betType):"bet"}`;else if(h.kind==="REFUND")D=`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)`:"";D=`Settled: ${C} ${O}${I}${x}`}return g.jsx("li",{className:"betitem results-modal__bet-row",children:g.jsxs("span",{children:[T," — ",D," ",w?"+":"-","z",rd.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=Hu(...(()=>{const T=md(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 y4=v.createContext({});function Ufe(t){const e=v.useRef(null);return e.current===null&&(e.current=t()),e.current}const aA=typeof window<"u",Ffe=aA?v.useLayoutEffect:v.useEffect,iA=v.createContext(null);function sA(t,e){t.indexOf(e)===-1&&t.push(e)}function oA(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}const Hc=(t,e,r)=>r>e?e:r<t?t:r;let cA=()=>{};const Gc={},v4=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function _4(t){return typeof t=="object"&&t!==null}const b4=t=>/^0[^.\s]+$/u.test(t);function lA(t){let e;return()=>(e===void 0&&(e=t()),e)}const gs=t=>t,qfe=(t,e)=>r=>e(t(r)),zg=(...t)=>t.reduce(qfe),Ym=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n};class uA{constructor(){this.subscriptions=[]}add(e){return sA(this.subscriptions,e),()=>oA(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 Vo=t=>t*1e3,hs=t=>t/1e3;function k4(t,e){return e?t*(1e3/e):0}const w4=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,zfe=1e-7,$fe=12;function Vfe(t,e,r,n,a){let i,o,c=0;do o=e+(r-e)/2,i=w4(o,n,a)-t,i>0?r=o:e=o;while(Math.abs(i)>zfe&&++c<$fe);return o}function $g(t,e,r,n){if(t===e&&r===n)return gs;const a=i=>Vfe(i,0,1,t,r);return i=>i===0||i===1?i:w4(a(i),e,n)}const S4=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,E4=t=>e=>1-t(1-e),T4=$g(.33,1.53,.69,.99),dA=E4(T4),C4=S4(dA),x4=t=>(t*=2)<1?.5*dA(t):.5*(2-Math.pow(2,-10*(t-1))),fA=t=>1-Math.sin(Math.acos(t)),P4=E4(fA),A4=S4(fA),Hfe=$g(.42,0,1,1),Gfe=$g(0,0,.58,1),R4=$g(.42,0,.58,1),Wfe=t=>Array.isArray(t)&&typeof t[0]!="number",D4=t=>Array.isArray(t)&&typeof t[0]=="number",Kfe={linear:gs,easeIn:Hfe,easeInOut:R4,easeOut:Gfe,circIn:fA,circInOut:A4,circOut:P4,backIn:dA,backInOut:C4,backOut:T4,anticipate:x4},Yfe=t=>typeof t=="string",nj=t=>{if(D4(t)){cA(t.length===4);const[e,r,n,a]=t;return $g(e,r,n,a)}else if(Yfe(t))return Kfe[t];return t},Tv=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Xfe(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 Jfe=40;function O4(t,e){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,o=Tv.reduce((P,A)=>(P[A]=Xfe(i),P),{}),{setup:c,read:u,resolveKeyframes:d,preUpdate:f,update:h,preRender:m,render:_,postRender:w}=o,b=()=>{const P=Gc.useManualTiming?a.timestamp:performance.now();r=!1,Gc.useManualTiming||(a.delta=n?1e3/60:Math.max(Math.min(P-a.timestamp,Jfe),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:Tv.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<Tv.length;A++)o[Tv[A]].cancel(P)},state:a,steps:o}}const{schedule:En,cancel:iu,state:Ta,steps:bE}=O4(typeof requestAnimationFrame<"u"?requestAnimationFrame:gs,!0);let y_;function Qfe(){y_=void 0}const pi={now:()=>(y_===void 0&&pi.set(Ta.isProcessing||Gc.useManualTiming?Ta.timestamp:performance.now()),y_),set:t=>{y_=t,queueMicrotask(Qfe)}},N4=t=>e=>typeof e=="string"&&e.startsWith(t),pA=N4("--"),Zfe=N4("var(--"),hA=t=>Zfe(t)?epe.test(t.split("/*")[0].trim()):!1,epe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Op={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Xm={...Op,transform:t=>Hc(0,1,t)},Cv={...Op,default:1},vm=t=>Math.round(t*1e5)/1e5,mA=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function tpe(t){return t==null}const rpe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,gA=(t,e)=>r=>!!(typeof r=="string"&&rpe.test(r)&&r.startsWith(t)||e&&!tpe(r)&&Object.prototype.hasOwnProperty.call(r,e)),I4=(t,e,r)=>n=>{if(typeof n!="string")return n;const[a,i,o,c]=n.match(mA);return{[t]:parseFloat(a),[e]:parseFloat(i),[r]:parseFloat(o),alpha:c!==void 0?parseFloat(c):1}},npe=t=>Hc(0,255,t),kE={...Op,transform:t=>Math.round(npe(t))},Yu={test:gA("rgb","red"),parse:I4("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+kE.transform(t)+", "+kE.transform(e)+", "+kE.transform(r)+", "+vm(Xm.transform(n))+")"};function ape(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 AC={test:gA("#"),parse:ape,transform:Yu.transform},Vg=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),xl=Vg("deg"),Ho=Vg("%"),er=Vg("px"),ipe=Vg("vh"),spe=Vg("vw"),aj={...Ho,parse:t=>Ho.parse(t)/100,transform:t=>Ho.transform(t*100)},Pf={test:gA("hsl","hue"),parse:I4("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+Ho.transform(vm(e))+", "+Ho.transform(vm(r))+", "+vm(Xm.transform(n))+")"},Jn={test:t=>Yu.test(t)||AC.test(t)||Pf.test(t),parse:t=>Yu.test(t)?Yu.parse(t):Pf.test(t)?Pf.parse(t):AC.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Yu.transform(t):Pf.transform(t),getAnimatableNone:t=>{const e=Jn.parse(t);return e.alpha=0,Jn.transform(e)}},ope=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function cpe(t){return isNaN(t)&&typeof t=="string"&&(t.match(mA)?.length||0)+(t.match(ope)?.length||0)>0}const M4="number",j4="color",lpe="var",upe="var(",ij="${}",dpe=/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 Jm(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},a=[];let i=0;const c=e.replace(dpe,u=>(Jn.test(u)?(n.color.push(i),a.push(j4),r.push(Jn.parse(u))):u.startsWith(upe)?(n.var.push(i),a.push(lpe),r.push(u)):(n.number.push(i),a.push(M4),r.push(parseFloat(u))),++i,ij)).split(ij);return{values:r,split:c,indexes:n,types:a}}function L4(t){return Jm(t).values}function B4(t){const{split:e,types:r}=Jm(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===M4?i+=vm(a[o]):c===j4?i+=Jn.transform(a[o]):i+=a[o]}return i}}const fpe=t=>typeof t=="number"?0:Jn.test(t)?Jn.getAnimatableNone(t):t;function ppe(t){const e=L4(t);return B4(t)(e.map(fpe))}const su={test:cpe,parse:L4,createTransformer:B4,getAnimatableNone:ppe};function wE(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 hpe({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=wE(u,c,t+1/3),i=wE(u,c,t),o=wE(u,c,t-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:n}}function gb(t,e){return r=>r>0?e:t}const Pn=(t,e,r)=>t+(e-t)*r,SE=(t,e,r)=>{const n=t*t,a=r*(e*e-n)+n;return a<0?0:Math.sqrt(a)},mpe=[AC,Yu,Pf],gpe=t=>mpe.find(e=>e.test(t));function sj(t){const e=gpe(t);if(!e)return!1;let r=e.parse(t);return e===Pf&&(r=hpe(r)),r}const oj=(t,e)=>{const r=sj(t),n=sj(e);if(!r||!n)return gb(t,e);const a={...r};return i=>(a.red=SE(r.red,n.red,i),a.green=SE(r.green,n.green,i),a.blue=SE(r.blue,n.blue,i),a.alpha=Pn(r.alpha,n.alpha,i),Yu.transform(a))},RC=new Set(["none","hidden"]);function ype(t,e){return RC.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function vpe(t,e){return r=>Pn(t,e,r)}function yA(t){return typeof t=="number"?vpe:typeof t=="string"?hA(t)?gb:Jn.test(t)?oj:kpe:Array.isArray(t)?U4:typeof t=="object"?Jn.test(t)?oj:_pe:gb}function U4(t,e){const r=[...t],n=r.length,a=t.map((i,o)=>yA(i)(i,e[o]));return i=>{for(let o=0;o<n;o++)r[o]=a[o](i);return r}}function _pe(t,e){const r={...t,...e},n={};for(const a in r)t[a]!==void 0&&e[a]!==void 0&&(n[a]=yA(t[a])(t[a],e[a]));return a=>{for(const i in n)r[i]=n[i](a);return r}}function bpe(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 kpe=(t,e)=>{const r=su.createTransformer(e),n=Jm(t),a=Jm(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?RC.has(t)&&!a.values.length||RC.has(e)&&!n.values.length?ype(t,e):zg(U4(bpe(n,a),a.values),r):gb(t,e)};function F4(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?Pn(t,e,r):yA(t)(t,e)}const wpe=t=>{const e=({timestamp:r})=>t(r);return{start:(r=!0)=>En.update(e,r),stop:()=>iu(e),now:()=>Ta.isProcessing?Ta.timestamp:pi.now()}},q4=(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)})`},yb=2e4;function vA(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e<yb;)e+=r,n=t.next(e);return e>=yb?1/0:e}function Spe(t,e=100,r){const n=r({...t,keyframes:[0,e]}),a=Math.min(vA(n),yb);return{type:"keyframes",ease:i=>n.next(a*i).value/e,duration:hs(a)}}const Epe=5;function z4(t,e,r){const n=Math.max(e-Epe,0);return k4(r-t(n),e-n)}const In={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},EE=.001;function Tpe({duration:t=In.duration,bounce:e=In.bounce,velocity:r=In.velocity,mass:n=In.mass}){let a,i,o=1-e;o=Hc(In.minDamping,In.maxDamping,o),t=Hc(In.minDuration,In.maxDuration,hs(t)),o<1?(a=d=>{const f=d*o,h=f*t,m=f-r,_=DC(d,o),w=Math.exp(-h);return EE-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=DC(Math.pow(d,2),o);return(-a(d)+EE>0?-1:1)*((m-_)*w)/b}):(a=d=>{const f=Math.exp(-d*t),h=(d-r)*t+1;return-EE+f*h},i=d=>{const f=Math.exp(-d*t),h=(r-d)*(t*t);return f*h});const c=5/t,u=xpe(a,i,c);if(t=Vo(t),isNaN(u))return{stiffness:In.stiffness,damping:In.damping,duration:t};{const d=Math.pow(u,2)*n;return{stiffness:d,damping:o*2*Math.sqrt(n*d),duration:t}}}const Cpe=12;function xpe(t,e,r){let n=r;for(let a=1;a<Cpe;a++)n=n-t(n)/e(n);return n}function DC(t,e){return t*Math.sqrt(1-e*e)}const Ppe=["duration","bounce"],Ape=["stiffness","damping","mass"];function cj(t,e){return e.some(r=>t[r]!==void 0)}function Rpe(t){let e={velocity:In.velocity,stiffness:In.stiffness,damping:In.damping,mass:In.mass,isResolvedFromDuration:!1,...t};if(!cj(t,Ape)&&cj(t,Ppe))if(t.visualDuration){const r=t.visualDuration,n=2*Math.PI/(r*1.2),a=n*n,i=2*Hc(.05,1,1-(t.bounce||0))*Math.sqrt(a);e={...e,mass:In.mass,stiffness:a,damping:i}}else{const r=Tpe(t);e={...e,...r,mass:In.mass},e.isResolvedFromDuration=!0}return e}function vb(t=In.visualDuration,e=In.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:_}=Rpe({...r,velocity:-hs(r.velocity||0)}),w=m||0,b=d/(2*Math.sqrt(u*f)),E=o-i,T=hs(Math.sqrt(u/f)),D=Math.abs(E)<5;n||(n=D?In.restSpeed.granular:In.restSpeed.default),a||(a=D?In.restDelta.granular:In.restDelta.default);let P;if(b<1){const C=DC(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?Vo(w):z4(P,C,O));const x=Math.abs(I)<=n,R=Math.abs(o-O)<=a;c.done=x&&R}return c.value=c.done?o:O,c},toString:()=>{const C=Math.min(vA(A),yb),O=q4(I=>A.next(C*I).value,C,30);return C+"ms "+O},toTransition:()=>{}};return A}vb.applyToOptions=t=>{const e=Spe(t,100,vb);return t.ease=e.ease,t.duration=Vo(e.duration),t.type="keyframes",t};function OC({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 D=x=>-b*Math.exp(-x/n),P=x=>T+D(x),A=x=>{const R=D(x),N=P(x);m.done=Math.abs(R)<=d,m.value=m.done?T:N};let C,O;const I=x=>{_(m.value)&&(C=x,O=vb({keyframes:[m.value,w(m.value)],velocity:z4(P,x,m.value),damping:a,stiffness:i,restDelta:d,restSpeed:f}))};return I(0),{calculatedDuration:null,next:x=>{let R=!1;return!O&&C===void 0&&(R=!0,A(x),I(x)),C!==void 0&&x>=C?O.next(x-C):(!R&&A(x),m)}}}function Dpe(t,e,r){const n=[],a=r||Gc.mix||F4,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]||gs:e;c=zg(u,c)}n.push(c)}return n}function Ope(t,e,{clamp:r=!0,ease:n,mixer:a}={}){const i=t.length;if(cA(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=Dpe(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=Ym(t[h],t[h+1],f);return c[h](m)};return r?f=>d(Hc(t[0],t[i-1],f)):d}function Npe(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const a=Ym(0,e,n);t.push(Pn(r,1,a))}}function Ipe(t){const e=[0];return Npe(e,t.length-1),e}function Mpe(t,e){return t.map(r=>r*e)}function jpe(t,e){return t.map(()=>e||R4).splice(0,t.length-1)}function _m({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const a=Wfe(n)?n.map(nj):nj(n),i={done:!1,value:e[0]},o=Mpe(r&&r.length===e.length?r:Ipe(e),t),c=Ope(o,e,{ease:Array.isArray(a)?a:jpe(e,a)});return{calculatedDuration:t,next:u=>(i.value=c(u),i.done=u>=t,i)}}const Lpe=t=>t!==null;function _A(t,{repeat:e,repeatType:r="loop"},n,a=1){const i=t.filter(Lpe),c=a<0||e&&r!=="loop"&&e%2===1?0:i.length-1;return!c||n===void 0?i[c]:n}const Bpe={decay:OC,inertia:OC,tween:_m,keyframes:_m,spring:vb};function $4(t){typeof t.type=="string"&&(t.type=Bpe[t.type])}class bA{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 Upe=t=>t/100;class kA extends bA{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!==pi.now()&&this.tick(pi.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;$4(e);const{type:r=_m,repeat:n=0,repeatDelay:a=0,repeatType:i,velocity:o=0}=e;let{keyframes:c}=e;const u=r||_m;u!==_m&&typeof c[0]!="number"&&(this.mixKeyframes=zg(Upe,F4(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=vA(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),D=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 R=Math.floor(x),N=x%1;!N&&x>=1&&(N=1),N===1&&R--,R=Math.min(R,h+1),!!(R%2)&&(m==="reverse"?(N=1-N,_&&(N-=_/c)):m==="mirror"&&(A=o)),P=Hc(0,1,N)*c}const C=D?{done:!1,value:f[0]}:A.next(P);i&&(C.value=i(C.value));let{done:O}=C;!D&&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!==OC&&(C.value=_A(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 hs(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+hs(e)}get time(){return hs(this.currentTime)}set time(e){e=Vo(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(pi.now());const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=hs(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=wpe,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(pi.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 Fpe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Xu=t=>t*180/Math.PI,NC=t=>{const e=Xu(Math.atan2(t[1],t[0]));return IC(e)},qpe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:NC,rotateZ:NC,skewX:t=>Xu(Math.atan(t[1])),skewY:t=>Xu(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},IC=t=>(t=t%360,t<0&&(t+=360),t),lj=NC,uj=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),dj=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),zpe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:uj,scaleY:dj,scale:t=>(uj(t)+dj(t))/2,rotateX:t=>IC(Xu(Math.atan2(t[6],t[5]))),rotateY:t=>IC(Xu(Math.atan2(-t[2],t[0]))),rotateZ:lj,rotate:lj,skewX:t=>Xu(Math.atan(t[4])),skewY:t=>Xu(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function MC(t){return t.includes("scale")?1:0}function jC(t,e){if(!t||t==="none")return MC(e);const r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=zpe,a=r;else{const c=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=qpe,a=c}if(!a)return MC(e);const i=n[e],o=a[1].split(",").map(Vpe);return typeof i=="function"?i(o):o[i]}const $pe=(t,e)=>{const{transform:r="none"}=getComputedStyle(t);return jC(r,e)};function Vpe(t){return parseFloat(t.trim())}const Np=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ip=new Set(Np),fj=t=>t===Op||t===er,Hpe=new Set(["x","y","z"]),Gpe=Np.filter(t=>!Hpe.has(t));function Wpe(t){const e=[];return Gpe.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const nd={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})=>jC(e,"x"),y:(t,{transform:e})=>jC(e,"y")};nd.translateX=nd.x;nd.translateY=nd.y;const ad=new Set;let LC=!1,BC=!1,UC=!1;function V4(){if(BC){const t=Array.from(ad).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const a=Wpe(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)})}BC=!1,LC=!1,ad.forEach(t=>t.complete(UC)),ad.clear()}function H4(){ad.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(BC=!0)})}function Kpe(){UC=!0,H4(),V4(),UC=!1}class wA{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?(ad.add(this),LC||(LC=!0,En.read(H4),En.resolveKeyframes(V4))):(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])}Fpe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ad.delete(this)}cancel(){this.state==="scheduled"&&(ad.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Ype=t=>t.startsWith("--");function Xpe(t,e,r){Ype(e)?t.style.setProperty(e,r):t.style[e]=r}const Jpe=lA(()=>window.ScrollTimeline!==void 0),Qpe={};function Zpe(t,e){const r=lA(t);return()=>Qpe[e]??r()}const G4=Zpe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Zh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,pj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zh([0,.65,.55,1]),circOut:Zh([.55,0,1,.45]),backIn:Zh([.31,.01,.66,-.59]),backOut:Zh([.33,1.53,.69,.99])};function W4(t,e){if(t)return typeof t=="function"?G4()?q4(t,e):"ease-out":D4(t)?Zh(t):Array.isArray(t)?t.map(r=>W4(r,e)||pj.easeOut):pj[t]}function ehe(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=W4(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 K4(t){return typeof t=="function"&&"applyToOptions"in t}function the({type:t,...e}){return K4(t)&&G4()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class rhe extends bA{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,cA(typeof e.type!="string");const d=the(e);this.animation=ehe(r,n,a,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const f=_A(a,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(f):Xpe(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 hs(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+hs(e)}get time(){return hs(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Vo(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&&Jpe()?(this.animation.timeline=e,gs):r(this)}}const Y4={anticipate:x4,backInOut:C4,circInOut:A4};function nhe(t){return t in Y4}function ahe(t){typeof t.ease=="string"&&nhe(t.ease)&&(t.ease=Y4[t.ease])}const hj=10;class ihe extends rhe{constructor(e){ahe(e),$4(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 kA({...o,autoplay:!1}),u=Vo(this.finishedTime??this.time);r.setWithVelocity(c.sample(u-hj).value,c.sample(u).value,hj),c.stop()}}const mj=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(su.test(t)||t==="0")&&!t.startsWith("url("));function she(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 ohe(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=mj(a,e),c=mj(i,e);return!o||!c?!1:she(t)||(r==="spring"||K4(r))&&n}function FC(t){t.duration=0,t.type="keyframes"}const che=new Set(["opacity","clipPath","filter","transform"]),lhe=lA(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function uhe(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 lhe()&&r&&che.has(r)&&(r!=="transform"||!d)&&!u&&!n&&a!=="mirror"&&i!==0&&o!=="inertia"}const dhe=40;class fhe extends bA{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=pi.now();const m={autoplay:e,delay:r,type:n,repeat:a,repeatDelay:i,repeatType:o,name:u,motionValue:d,element:f,...h},_=f?.KeyframeResolver||wA;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=pi.now(),ohe(e,i,o,c)||((Gc.instantAnimations||!u)&&f?.(_A(e,n,r)),e[0]=e[e.length-1],FC(n),n.repeat=0);const m={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>dhe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:e},_=!d&&uhe(m)?new ihe({...m,element:m.motionValue.owner.current}):new kA(m);_.finished.then(()=>this.notifyFinished()).catch(gs),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(),Kpe()),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 phe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function hhe(t){const e=phe.exec(t);if(!e)return[,];const[,r,n,a]=e;return[`--${r??n}`,a]}function X4(t,e,r=1){const[n,a]=hhe(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const o=i.trim();return v4(o)?parseFloat(o):o}return hA(a)?X4(a,e,r+1):a}function SA(t,e){return t?.[e]??t?.default??t}const J4=new Set(["width","height","top","left","right","bottom",...Np]),mhe={test:t=>t==="auto",parse:t=>t},Q4=t=>e=>e.test(t),Z4=[Op,er,Ho,xl,spe,ipe,mhe],gj=t=>Z4.find(Q4(t));function ghe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||b4(t):!0}const yhe=new Set(["brightness","contrast","saturate","opacity"]);function vhe(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(mA)||[];if(!n)return t;const a=r.replace(n,"");let i=yhe.has(e)?1:0;return n!==r&&(i*=100),e+"("+i+a+")"}const _he=/\b([a-z-]*)\(.*?\)/gu,qC={...su,getAnimatableNone:t=>{const e=t.match(_he);return e?e.map(vhe).join(" "):t}},yj={...Op,transform:Math.round},bhe={rotate:xl,rotateX:xl,rotateY:xl,rotateZ:xl,scale:Cv,scaleX:Cv,scaleY:Cv,scaleZ:Cv,skew:xl,skewX:xl,skewY:xl,distance:er,translateX:er,translateY:er,translateZ:er,x:er,y:er,z:er,perspective:er,transformPerspective:er,opacity:Xm,originX:aj,originY:aj,originZ:er},EA={borderWidth:er,borderTopWidth:er,borderRightWidth:er,borderBottomWidth:er,borderLeftWidth:er,borderRadius:er,radius:er,borderTopLeftRadius:er,borderTopRightRadius:er,borderBottomRightRadius:er,borderBottomLeftRadius:er,width:er,maxWidth:er,height:er,maxHeight:er,top:er,right:er,bottom:er,left:er,padding:er,paddingTop:er,paddingRight:er,paddingBottom:er,paddingLeft:er,margin:er,marginTop:er,marginRight:er,marginBottom:er,marginLeft:er,backgroundPositionX:er,backgroundPositionY:er,...bhe,zIndex:yj,fillOpacity:Xm,strokeOpacity:Xm,numOctaves:yj},khe={...EA,color:Jn,backgroundColor:Jn,outlineColor:Jn,fill:Jn,stroke:Jn,borderColor:Jn,borderTopColor:Jn,borderRightColor:Jn,borderBottomColor:Jn,borderLeftColor:Jn,filter:qC,WebkitFilter:qC},ez=t=>khe[t];function tz(t,e){let r=ez(t);return r!==qC&&(r=su),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const whe=new Set(["auto","none","0"]);function She(t,e,r){let n=0,a;for(;n<t.length&&!a;){const i=t[n];typeof i=="string"&&!whe.has(i)&&Jm(i).values.length&&(a=t[n]),n++}if(a&&r)for(const i of e)t[i]=tz(r,a)}class Ehe extends wA{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(),hA(d))){const f=X4(d,r.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!J4.has(n)||e.length!==2)return;const[a,i]=e,o=gj(a),c=gj(i);if(o!==c)if(fj(o)&&fj(c))for(let u=0;u<e.length;u++){const d=e[u];typeof d=="string"&&(e[u]=parseFloat(d))}else nd[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:r}=this,n=[];for(let a=0;a<e.length;a++)(e[a]===null||ghe(e[a]))&&n.push(a);n.length&&She(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=nd[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]=nd[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 The(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 rz=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Che(t){return _4(t)&&"offsetHeight"in t}const vj=30,xhe=t=>!isNaN(parseFloat(t));class Phe{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const a=pi.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=pi.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=xhe(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 uA);const n=this.events[e].add(r);return e==="change"?()=>{n(),En.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=pi.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>vj)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,vj);return k4(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 pp(t,e){return new Phe(t,e)}const{schedule:TA}=O4(queueMicrotask,!1),Fs={x:!1,y:!1};function nz(){return Fs.x||Fs.y}function Ahe(t){return t==="x"||t==="y"?Fs[t]?null:(Fs[t]=!0,()=>{Fs[t]=!1}):Fs.x||Fs.y?null:(Fs.x=Fs.y=!0,()=>{Fs.x=Fs.y=!1})}function az(t,e){const r=The(t),n=new AbortController,a={passive:!0,...e,signal:n.signal};return[r,a,()=>n.abort()]}function _j(t){return!(t.pointerType==="touch"||nz())}function Rhe(t,e,r={}){const[n,a,i]=az(t,r),o=c=>{if(!_j(c))return;const{target:u}=c,d=e(u,c);if(typeof d!="function"||!u)return;const f=h=>{_j(h)&&(d(h),u.removeEventListener("pointerleave",f))};u.addEventListener("pointerleave",f,a)};return n.forEach(c=>{c.addEventListener("pointerenter",o,a)}),i}const iz=(t,e)=>e?t===e?!0:iz(t,e.parentElement):!1,CA=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Dhe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ohe(t){return Dhe.has(t.tagName)||t.tabIndex!==-1}const v_=new WeakSet;function bj(t){return e=>{e.key==="Enter"&&t(e)}}function TE(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Nhe=(t,e)=>{const r=t.currentTarget;if(!r)return;const n=bj(()=>{if(v_.has(r))return;TE(r,"down");const a=bj(()=>{TE(r,"up")}),i=()=>TE(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 kj(t){return CA(t)&&!nz()}function Ihe(t,e,r={}){const[n,a,i]=az(t,r),o=c=>{const u=c.currentTarget;if(!kj(c))return;v_.add(u);const d=e(u,c),f=(_,w)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),v_.has(u)&&v_.delete(u),kj(_)&&typeof d=="function"&&d(_,{success:w})},h=_=>{f(_,u===window||u===document||r.useGlobalTarget||iz(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),Che(c)&&(c.addEventListener("focus",d=>Nhe(d,a)),!Ohe(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),i}function sz(t){return _4(t)&&"ownerSVGElement"in t}function Mhe(t){return sz(t)&&t.tagName==="svg"}const Ua=t=>!!(t&&t.getVelocity),jhe=[...Z4,Jn,su],Lhe=t=>jhe.find(Q4(t)),oz=v.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Bhe(t=!0){const e=v.useContext(iA);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 cz=v.createContext({strict:!1}),wj={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"]},hp={};for(const t in wj)hp[t]={isEnabled:e=>wj[t].some(r=>!!e[r])};function Uhe(t){for(const e in t)hp[e]={...hp[e],...t[e]}}const Fhe=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 _b(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Fhe.has(t)}let lz=t=>!_b(t);function qhe(t){typeof t=="function"&&(lz=e=>e.startsWith("on")?!_b(e):t(e))}try{qhe(require("@emotion/is-prop-valid").default)}catch{}function zhe(t,e,r){const n={};for(const a in t)a==="values"&&typeof t.values=="object"||(lz(a)||r===!0&&_b(a)||!e&&!_b(a)||t.draggable&&a.startsWith("onDrag"))&&(n[a]=t[a]);return n}const _0=v.createContext({});function b0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Qm(t){return typeof t=="string"||Array.isArray(t)}const xA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],PA=["initial",...xA];function k0(t){return b0(t.animate)||PA.some(e=>Qm(t[e]))}function uz(t){return!!(k0(t)||t.variants)}function $he(t,e){if(k0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Qm(r)?r:void 0,animate:Qm(n)?n:void 0}}return t.inherit!==!1?e:{}}function Vhe(t){const{initial:e,animate:r}=$he(t,v.useContext(_0));return v.useMemo(()=>({initial:e,animate:r}),[Sj(e),Sj(r)])}function Sj(t){return Array.isArray(t)?t.join(" "):t}const Zm={};function Hhe(t){for(const e in t)Zm[e]=t[e],pA(e)&&(Zm[e].isCSSVariable=!0)}function dz(t,{layout:e,layoutId:r}){return Ip.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Zm[t]||t==="opacity")}const Ghe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Whe=Np.length;function Khe(t,e,r){let n="",a=!0;for(let i=0;i<Whe;i++){const o=Np[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=rz(c,EA[o]);if(!u){a=!1;const f=Ghe[o]||o;n+=`${f}(${d}) `}r&&(e[o]=d)}}return n=n.trim(),r?n=r(e,a?"":n):a&&(n="none"),n}function AA(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(Ip.has(u)){o=!0;continue}else if(pA(u)){a[u]=d;continue}else{const f=rz(d,EA[u]);u.startsWith("origin")?(c=!0,i[u]=f):n[u]=f}}if(e.transform||(o||r?n.transform=Khe(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 RA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function fz(t,e,r){for(const n in e)!Ua(e[n])&&!dz(n,r)&&(t[n]=e[n])}function Yhe({transformTemplate:t},e){return v.useMemo(()=>{const r=RA();return AA(r,e,t),Object.assign({},r.vars,r.style)},[e])}function Xhe(t,e){const r=t.style||{},n={};return fz(n,r,t),Object.assign(n,Yhe(t,e)),n}function Jhe(t,e){const r={},n=Xhe(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 Qhe={offset:"stroke-dashoffset",array:"stroke-dasharray"},Zhe={offset:"strokeDashoffset",array:"strokeDasharray"};function eme(t,e,r=1,n=0,a=!0){t.pathLength=1;const i=a?Qhe:Zhe;t[i.offset]=er.transform(-n);const o=er.transform(e),c=er.transform(r);t[i.array]=`${o} ${c}`}function pz(t,{attrX:e,attrY:r,attrScale:n,pathLength:a,pathSpacing:i=1,pathOffset:o=0,...c},u,d,f){if(AA(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&&eme(h,a,i,o,!1)}const hz=()=>({...RA(),attrs:{}}),mz=t=>typeof t=="string"&&t.toLowerCase()==="svg";function tme(t,e,r,n){const a=v.useMemo(()=>{const i=hz();return pz(i,e,mz(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};fz(i,t.style,t),a.style={...i,...a.style}}return a}const rme=["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 DA(t){return typeof t!="string"||t.includes("-")?!1:!!(rme.indexOf(t)>-1||/[A-Z]/u.test(t))}function nme(t,e,r,{latestValues:n},a,i=!1){const c=(DA(t)?tme:Jhe)(e,n,a,t),u=zhe(e,typeof t=="string",i),d=t!==v.Fragment?{...u,...c,ref:r}:{},{children:f}=e,h=v.useMemo(()=>Ua(f)?f.get():f,[f]);return v.createElement(t,{...d,children:h})}function Ej(t){const e=[{},{}];return t?.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function OA(t,e,r,n){if(typeof e=="function"){const[a,i]=Ej(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]=Ej(n);e=e(r!==void 0?r:t.custom,a,i)}return e}function __(t){return Ua(t)?t.get():t}function ame({scrapeMotionValuesFromProps:t,createRenderState:e},r,n,a){return{latestValues:ime(r,n,a,t),renderState:e()}}function ime(t,e,r,n){const a={},i=n(t,{});for(const m in i)a[m]=__(i[m]);let{initial:o,animate:c}=t;const u=k0(t),d=uz(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"&&!b0(h)){const m=Array.isArray(h)?h:[h];for(let _=0;_<m.length;_++){const w=OA(t,m[_]);if(w){const{transitionEnd:b,transition:E,...T}=w;for(const D in T){let P=T[D];if(Array.isArray(P)){const A=f?P.length-1:0;P=P[A]}P!==null&&(a[D]=P)}for(const D in b)a[D]=b[D]}}}return a}const gz=t=>(e,r)=>{const n=v.useContext(_0),a=v.useContext(iA),i=()=>ame(t,e,n,a);return r?i():Ufe(i)};function NA(t,e,r){const{style:n}=t,a={};for(const i in n)(Ua(n[i])||e.style&&Ua(e.style[i])||dz(i,t)||r?.getValue(i)?.liveStyle!==void 0)&&(a[i]=n[i]);return a}const sme=gz({scrapeMotionValuesFromProps:NA,createRenderState:RA});function yz(t,e,r){const n=NA(t,e,r);for(const a in t)if(Ua(t[a])||Ua(e[a])){const i=Np.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;n[i]=t[a]}return n}const ome=gz({scrapeMotionValuesFromProps:yz,createRenderState:hz}),cme=Symbol.for("motionComponentSymbol");function Af(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function lme(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):Af(r)&&(r.current=n))},[e])}const IA=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ume="framerAppearId",vz="data-"+IA(ume),_z=v.createContext({});function dme(t,e,r,n,a){const{visualElement:i}=v.useContext(_0),o=v.useContext(cz),c=v.useContext(iA),u=v.useContext(oz).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(_z);f&&!f.projection&&a&&(f.type==="html"||f.type==="svg")&&fme(d.current,r,a,h);const m=v.useRef(!1);v.useInsertionEffect(()=>{f&&m.current&&f.update(r,c)});const _=r[vz],w=v.useRef(!!_&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return Ffe(()=>{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 fme(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:bz(t.parent)),t.projection.setOptions({layoutId:a,layout:i,alwaysMeasureLayout:!!o||c&&Af(c),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:f,layoutScroll:u,layoutRoot:d})}function bz(t){if(t)return t.options.allowProjection!==!1?t.projection:bz(t.parent)}function CE(t,{forwardMotionProps:e=!1}={},r,n){r&&Uhe(r);const a=DA(t)?ome:sme;function i(c,u){let d;const f={...v.useContext(oz),...c,layoutId:pme(c)},{isStatic:h}=f,m=Vhe(c),_=a(c,h);if(!h&&aA){hme();const w=mme(f);d=w.MeasureLayout,m.visualElement=dme(t,_,f,n,w.ProjectionNode)}return g.jsxs(_0.Provider,{value:m,children:[d&&m.visualElement?g.jsx(d,{visualElement:m.visualElement,...f}):null,nme(t,c,lme(_,m.visualElement,u),_,h,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=v.forwardRef(i);return o[cme]=t,o}function pme({layoutId:t}){const e=v.useContext(y4).id;return e&&t!==void 0?e+"-"+t:t}function hme(t,e){v.useContext(cz).strict}function mme(t){const{drag:e,layout:r}=hp;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e?.isEnabled(t)||r?.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function gme(t,e){if(typeof Proxy>"u")return CE;const r=new Map,n=(i,o)=>CE(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,CE(o,void 0,t,e)),r.get(o))})}function kz({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function yme({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vme(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 xE(t){return t===void 0||t===1}function zC({scale:t,scaleX:e,scaleY:r}){return!xE(t)||!xE(e)||!xE(r)}function Gu(t){return zC(t)||wz(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function wz(t){return Tj(t.x)||Tj(t.y)}function Tj(t){return t&&t!=="0%"}function bb(t,e,r){const n=t-r,a=e*n;return r+a}function Cj(t,e,r,n,a){return a!==void 0&&(t=bb(t,a,n)),bb(t,r,n)+e}function $C(t,e=0,r=1,n,a){t.min=Cj(t.min,e,r,n,a),t.max=Cj(t.max,e,r,n,a)}function Sz(t,{x:e,y:r}){$C(t.x,e.translate,e.scale,e.originPoint),$C(t.y,r.translate,r.scale,r.originPoint)}const xj=.999999999999,Pj=1.0000000000001;function _me(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&&Df(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,Sz(t,o)),n&&Gu(i.latestValues)&&Df(t,i.latestValues))}e.x<Pj&&e.x>xj&&(e.x=1),e.y<Pj&&e.y>xj&&(e.y=1)}function Rf(t,e){t.min=t.min+e,t.max=t.max+e}function Aj(t,e,r,n,a=.5){const i=Pn(t.min,t.max,a);$C(t,e,r,i,n)}function Df(t,e){Aj(t.x,e.x,e.scaleX,e.scale,e.originX),Aj(t.y,e.y,e.scaleY,e.scale,e.originY)}function Ez(t,e){return kz(vme(t.getBoundingClientRect(),e))}function bme(t,e,r){const n=Ez(t,r),{scroll:a}=e;return a&&(Rf(n.x,a.offset.x),Rf(n.y,a.offset.y)),n}const Rj=()=>({translate:0,scale:1,origin:0,originPoint:0}),Of=()=>({x:Rj(),y:Rj()}),Dj=()=>({min:0,max:0}),Un=()=>({x:Dj(),y:Dj()}),kb={current:null},MA={current:!1};function Tz(){if(MA.current=!0,!!aA)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>kb.current=t.matches;t.addEventListener("change",e),e()}else kb.current=!1}const kme=new WeakMap;function wme(t,e,r){for(const n in e){const a=e[n],i=r[n];if(Ua(a))t.addValue(n,a);else if(Ua(i))t.addValue(n,pp(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,pp(o!==void 0?o:a,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const Oj=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Sme{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=wA,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=pi.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,En.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=k0(r),this.isVariantNode=uz(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&&Ua(_)&&_.set(u[m])}}mount(e){this.current=e,kme.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)),MA.current||Tz(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:kb.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),iu(this.notifyUpdate),iu(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=Ip.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=r.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&En.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 hp){const r=hp[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):Un()}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<Oj.length;n++){const a=Oj[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=wme(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=pp(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"&&(v4(n)||b4(n))?n=parseFloat(n):!Lhe(n)&&su.test(r)&&(n=tz(e,r)),this.setBaseTarget(e,Ua(n)?n.get():n)),Ua(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=OA(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&&!Ua(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 uA),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}scheduleRenderMicrotask(){TA.render(this.render)}}class Cz extends Sme{constructor(){super(...arguments),this.KeyframeResolver=Ehe}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;Ua(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function xz(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 Eme(t){return window.getComputedStyle(t)}class Tme extends Cz{constructor(){super(...arguments),this.type="html",this.renderInstance=xz}readValueFromInstance(e,r){if(Ip.has(r))return this.projection?.isProjecting?MC(r):$pe(e,r);{const n=Eme(e),a=(pA(r)?n.getPropertyValue(r):n[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:r}){return Ez(e,r)}build(e,r,n){AA(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return NA(e,r,n)}}const Pz=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 Cme(t,e,r,n){xz(t,e,void 0,n);for(const a in e.attrs)t.setAttribute(Pz.has(a)?a:IA(a),e.attrs[a])}class xme extends Cz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Un}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Ip.has(r)){const n=ez(r);return n&&n.default||0}return r=Pz.has(r)?r:IA(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return yz(e,r,n)}build(e,r,n){pz(e,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,r,n,a){Cme(e,r,n,a)}mount(e){this.isSVGTag=mz(e.tagName),super.mount(e)}}const Pme=(t,e)=>DA(t)?new xme(e):new Tme(e,{allowProjection:t!==v.Fragment});function Kf(t,e,r){const n=t.getProps();return OA(n,e,r!==void 0?r:n.custom,t)}const VC=t=>Array.isArray(t);function Ame(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,pp(r))}function Rme(t){return VC(t)?t[t.length-1]||0:t}function Dme(t,e){const r=Kf(t,e);let{transitionEnd:n={},transition:a={},...i}=r||{};i={...i,...n};for(const o in i){const c=Rme(i[o]);Ame(t,o,c)}}function Ome(t){return!!(Ua(t)&&t.add)}function HC(t,e){const r=t.getValue("willChange");if(Ome(r))return r.add(e);if(!r&&Gc.WillChange){const n=new Gc.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function Az(t){return t.props[vz]}const Nme=t=>t!==null;function Ime(t,{repeat:e,repeatType:r="loop"},n){const a=t.filter(Nme),i=e&&r!=="loop"&&e%2===1?0:a.length-1;return a[i]}const Mme={type:"spring",stiffness:500,damping:25,restSpeed:10},jme=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Lme={type:"keyframes",duration:.8},Bme={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ume=(t,{keyframes:e})=>e.length>2?Lme:Ip.has(t)?t.startsWith("scale")?jme(e[1]):Mme:Bme;function Fme({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 jA=(t,e,r,n={},a,i)=>o=>{const c=SA(n,t)||{},u=c.delay||n.delay||0;let{elapsed:d=0}=n;d=d-Vo(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};Fme(c)||Object.assign(f,Ume(t,f)),f.duration&&(f.duration=Vo(f.duration)),f.repeatDelay&&(f.repeatDelay=Vo(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let h=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(FC(f),f.delay===0&&(h=!0)),(Gc.instantAnimations||Gc.skipAnimations)&&(h=!0,FC(f),f.delay=0),f.allowFlatten=!c.type&&!c.ease,h&&!i&&e.get()!==void 0){const m=Ime(f.keyframes,c);if(m!==void 0){En.update(()=>{f.onUpdate(m),f.onComplete()});return}}return c.isSync?new kA(f):new fhe(f)};function qme({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function Rz(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&&qme(d,f))continue;const _={delay:r,...SA(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=Az(t);if(T){const D=window.MotionHandoffAnimation(T,f,En);D!==null&&(_.startTime=D,b=!0)}}HC(t,f),h.start(jA(f,h,m,t.shouldReduceMotion&&J4.has(f)?{type:!1}:_,t,b));const E=h.animation;E&&u.push(E)}return o&&Promise.all(u).then(()=>{En.update(()=>{o&&Dme(t,o)})}),u}function Dz(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 GC(t,e,r={}){const n=Kf(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(Rz(t,n,r)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=a;return zme(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 zme(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(GC(u,e,{...o,delay:r+(typeof n=="function"?0:n)+Dz(t.variantChildren,u,n,a,i)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(c)}function $me(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const a=e.map(i=>GC(t,i,r));n=Promise.all(a)}else if(typeof e=="string")n=GC(t,e,r);else{const a=typeof e=="function"?Kf(t,e,r.custom):e;n=Promise.all(Rz(t,a,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}function Oz(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 Vme=PA.length;function Nz(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?Nz(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;r<Vme;r++){const n=PA[r],a=t.props[n];(Qm(a)||a===!1)&&(e[n]=a)}return e}const Hme=[...xA].reverse(),Gme=xA.length;function Wme(t){return e=>Promise.all(e.map(({animation:r,options:n})=>$me(t,r,n)))}function Kme(t){let e=Wme(t),r=Nj(),n=!0;const a=u=>(d,f)=>{const h=Kf(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=Nz(t.parent)||{},h=[],m=new Set;let _={},w=1/0;for(let E=0;E<Gme;E++){const T=Hme[E],D=r[T],P=d[T]!==void 0?d[T]:f[T],A=Qm(P),C=T===u?D.isActive:null;C===!1&&(w=E);let O=P===f[T]&&P!==d[T]&&A;if(O&&n&&t.manuallyAnimateOnMount&&(O=!1),D.protectedKeys={..._},!D.isActive&&C===null||!P&&!D.prevProp||b0(P)||typeof P=="boolean")continue;const I=Yme(D.prevProp,P);let x=I||T===u&&D.isActive&&!O&&A||E>w&&A,R=!1;const N=Array.isArray(P)?P:[P];let L=N.reduce(a(T),{});C===!1&&(L={});const{prevResolvedValues:j={}}=D,q={...j,...L},U=X=>{x=!0,m.has(X)&&(R=!0,m.delete(X)),D.needsAnimating[X]=!0;const J=t.getValue(X);J&&(J.liveStyle=!1)};for(const X in q){const J=L[X],ee=j[X];if(_.hasOwnProperty(X))continue;let H=!1;VC(J)&&VC(ee)?H=!Oz(J,ee):H=J!==ee,H?J!=null?U(X):m.add(X):J!==void 0&&m.has(X)?U(X):D.protectedKeys[X]=!0}D.prevProp=P,D.prevResolvedValues=L,D.isActive&&(_={..._,...L}),n&&t.blockInitialAnimation&&(x=!1);const Y=O&&I;x&&(!Y||R)&&h.push(...N.map(X=>{const J={type:T};if(typeof X=="string"&&n&&!Y&&t.manuallyAnimateOnMount&&t.parent){const{parent:ee}=t,H=Kf(ee,X);if(ee.enteringChildren&&H){const{delayChildren:B}=H.transition||{};J.delay=Dz(ee.enteringChildren,t,B)}}return{animation:X,options:J}}))}if(m.size){const E={};if(typeof d.initial!="boolean"){const T=Kf(t,Array.isArray(d.initial)?d.initial[0]:d.initial);T&&T.transition&&(E.transition=T.transition)}m.forEach(T=>{const D=t.getBaseTarget(T),P=t.getValue(T);P&&(P.liveStyle=!0),E[T]=D??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=Nj(),n=!0}}}function Yme(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Oz(e,t):!1}function ju(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Nj(){return{animate:ju(!0),whileInView:ju(),whileHover:ju(),whileTap:ju(),whileDrag:ju(),whileFocus:ju(),exit:ju()}}class yu{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Xme extends yu{constructor(e){super(e),e.animationState||(e.animationState=Kme(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();b0(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 Jme=0;class Qme extends yu{constructor(){super(...arguments),this.id=Jme++}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 Zme={animation:{Feature:Xme},exit:{Feature:Qme}};function eg(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Hg(t){return{point:{x:t.pageX,y:t.pageY}}}const ege=t=>e=>CA(e)&&t(e,Hg(e));function bm(t,e,r,n){return eg(t,e,ege(r),n)}const Iz=1e-4,tge=1-Iz,rge=1+Iz,Mz=.01,nge=0-Mz,age=0+Mz;function Ka(t){return t.max-t.min}function ige(t,e,r){return Math.abs(t-e)<=r}function Ij(t,e,r,n=.5){t.origin=n,t.originPoint=Pn(e.min,e.max,t.origin),t.scale=Ka(r)/Ka(e),t.translate=Pn(r.min,r.max,t.origin)-t.originPoint,(t.scale>=tge&&t.scale<=rge||isNaN(t.scale))&&(t.scale=1),(t.translate>=nge&&t.translate<=age||isNaN(t.translate))&&(t.translate=0)}function km(t,e,r,n){Ij(t.x,e.x,r.x,n?n.originX:void 0),Ij(t.y,e.y,r.y,n?n.originY:void 0)}function Mj(t,e,r){t.min=r.min+e.min,t.max=t.min+Ka(e)}function sge(t,e,r){Mj(t.x,e.x,r.x),Mj(t.y,e.y,r.y)}function jj(t,e,r){t.min=e.min-r.min,t.max=t.min+Ka(e)}function wm(t,e,r){jj(t.x,e.x,r.x),jj(t.y,e.y,r.y)}function is(t){return[t("x"),t("y")]}const jz=({current:t})=>t?t.ownerDocument.defaultView:null,Lj=(t,e)=>Math.abs(t-e);function oge(t,e){const r=Lj(t.x,e.x),n=Lj(t.y,e.y);return Math.sqrt(r**2+n**2)}class Lz{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=AE(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,w=oge(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!w)return;const{point:b}=m,{timestamp:E}=Ta;this.history.push({...b,timestamp:E});const{onStart:T,onMove:D}=this.handlers;_||(T&&T(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),D&&D(this.lastMoveEvent,m)},this.handlePointerMove=(m,_)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=PE(_,this.transformPagePoint),En.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=AE(m.type==="pointercancel"?this.lastMoveEventInfo:PE(_,this.transformPagePoint),this.history);this.startEvent&&w&&w(m,T),b&&b(m,T)},!CA(e))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=a||window;const c=Hg(e),u=PE(c,this.transformPagePoint),{point:d}=u,{timestamp:f}=Ta;this.history=[{...d,timestamp:f}];const{onSessionStart:h}=r;h&&h(e,AE(u,this.history)),this.removeListeners=zg(bm(this.contextWindow,"pointermove",this.handlePointerMove),bm(this.contextWindow,"pointerup",this.handlePointerUp),bm(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),iu(this.updatePoint)}}function PE(t,e){return e?{point:e(t.point)}:t}function Bj(t,e){return{x:t.x-e.x,y:t.y-e.y}}function AE({point:t},e){return{point:t,delta:Bj(t,Bz(e)),offset:Bj(t,cge(e)),velocity:lge(e,.1)}}function cge(t){return t[0]}function Bz(t){return t[t.length-1]}function lge(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const a=Bz(t);for(;r>=0&&(n=t[r],!(a.timestamp-n.timestamp>Vo(e)));)r--;if(!n)return{x:0,y:0};const i=hs(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 uge(t,{min:e,max:r},n){return e!==void 0&&t<e?t=n?Pn(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?Pn(r,t,n.max):Math.min(t,r)),t}function Uj(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 dge(t,{top:e,left:r,bottom:n,right:a}){return{x:Uj(t.x,r,a),y:Uj(t.y,e,n)}}function Fj(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 fge(t,e){return{x:Fj(t.x,e.x),y:Fj(t.y,e.y)}}function pge(t,e){let r=.5;const n=Ka(t),a=Ka(e);return a>n?r=Ym(e.min,e.max-n,t.min):n>a&&(r=Ym(t.min,t.max-a,e.min)),Hc(0,1,r)}function hge(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 WC=.35;function mge(t=WC){return t===!1?t=0:t===!0&&(t=WC),{x:qj(t,"left","right"),y:qj(t,"top","bottom")}}function qj(t,e,r){return{min:zj(t,e),max:zj(t,r)}}function zj(t,e){return typeof t=="number"?t:t[e]||0}const gge=new WeakMap;class yge{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=Un(),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(Hg(h).point)},o=(h,m)=>{const{drag:_,dragPropagation:w,onDragStart:b}=this.getProps();if(_&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ahe(_),!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),is(T=>{let D=this.getAxisMotionValue(T).get()||0;if(Ho.test(D)){const{projection:P}=this.visualElement;if(P&&P.layout){const A=P.layout.layoutBox[T];A&&(D=Ka(A)*(parseFloat(D)/100))}}this.originPoint[T]=D}),b&&En.postRender(()=>b(h,m)),HC(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=vge(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=()=>is(h=>this.getAnimationState(h)==="paused"&&this.getAxisMotionValue(h).animation?.play()),{dragSnapToOrigin:f}=this.getProps();this.panSession=new Lz(e,{onSessionStart:i,onStart:o,onMove:c,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:n,contextWindow:jz(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&&En.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||!xv(e,a,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=uge(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&&Af(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=dge(n.layoutBox,e):this.constraints=!1,this.elastic=mge(r),a!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&is(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=hge(n.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Af(e))return!1;const n=e.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const i=bme(n,a.root,this.visualElement.getTransformPagePoint());let o=fge(a.layout.layoutBox,i);if(r){const c=r(yme(o));this.hasMutatedConstraints=!!c,c&&(o=kz(c))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:a,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=is(f=>{if(!xv(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 HC(this.visualElement,e),n.start(jA(e,n,0,r,this.visualElement,!1))}stopAnimation(){is(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){is(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){is(r=>{const{drag:n}=this.getProps();if(!xv(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]-Pn(o,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Af(r)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};is(o=>{const c=this.getAxisMotionValue(o);if(c&&this.constraints!==!1){const u=c.get();a[o]=pge({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(),is(o=>{if(!xv(o,e,null))return;const c=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];c.set(Pn(u,d,a[o]))})}addListeners(){if(!this.visualElement.current)return;gge.set(this.visualElement,this);const e=this.visualElement.current,r=bm(e,"pointerdown",u=>{const{drag:d,dragListener:f=!0}=this.getProps();d&&f&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Af(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()),En.read(n);const o=eg(window,"resize",()=>this.scalePositionWithinConstraints()),c=a.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(is(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=WC,dragMomentum:c=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:a,dragConstraints:i,dragElastic:o,dragMomentum:c}}}function xv(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function vge(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class _ge extends yu{constructor(e){super(e),this.removeGroupControls=gs,this.removeListeners=gs,this.controls=new yge(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||gs}unmount(){this.removeGroupControls(),this.removeListeners()}}const $j=t=>(e,r)=>{t&&En.postRender(()=>t(e,r))};class bge extends yu{constructor(){super(...arguments),this.removePointerDownListener=gs}onPointerDown(e){this.session=new Lz(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jz(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:$j(e),onStart:$j(r),onMove:n,onEnd:(i,o)=>{delete this.session,a&&En.postRender(()=>a(i,o))}}}mount(){this.removePointerDownListener=bm(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 b_={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Vj(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const jh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(er.test(t))t=parseFloat(t);else return t;const r=Vj(t,e.target.x),n=Vj(t,e.target.y);return`${r}% ${n}%`}},kge={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,a=su.parse(t);if(a.length>5)return n;const i=su.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=Pn(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 RE=!1;class wge extends v.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:a}=this.props,{projection:i}=e;Hhe(Sge),i&&(r.group&&r.group.add(i),n&&n.register&&a&&n.register(i),RE&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),b_.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:a,isPresent:i}=this.props,{projection:o}=n;return o&&(o.isPresent=i,RE=!0,a||e.layoutDependency!==r||r===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||En.postRender(()=>{const c=o.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),TA.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:a}=e;RE=!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 Uz(t){const[e,r]=Bhe(),n=v.useContext(y4);return g.jsx(wge,{...t,layoutGroup:n,switchLayoutGroup:v.useContext(_z),isPresent:e,safeToRemove:r})}const Sge={borderRadius:{...jh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:jh,borderTopRightRadius:jh,borderBottomLeftRadius:jh,borderBottomRightRadius:jh,boxShadow:kge};function Ege(t,e,r){const n=Ua(t)?t:pp(t);return n.start(jA("",n,e,r)),n.animation}const Tge=(t,e)=>t.depth-e.depth;class Cge{constructor(){this.children=[],this.isDirty=!1}add(e){sA(this.children,e),this.isDirty=!0}remove(e){oA(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Tge),this.isDirty=!1,this.children.forEach(e)}}function xge(t,e){const r=pi.now(),n=({timestamp:a})=>{const i=a-r;i>=e&&(iu(n),t(i-e))};return En.setup(n,!0),()=>iu(n)}const Fz=["TopLeft","TopRight","BottomLeft","BottomRight"],Pge=Fz.length,Hj=t=>typeof t=="string"?parseFloat(t):t,Gj=t=>typeof t=="number"||er.test(t);function Age(t,e,r,n,a,i){a?(t.opacity=Pn(0,r.opacity??1,Rge(n)),t.opacityExit=Pn(e.opacity??1,0,Dge(n))):i&&(t.opacity=Pn(e.opacity??1,r.opacity??1,n));for(let o=0;o<Pge;o++){const c=`border${Fz[o]}Radius`;let u=Wj(e,c),d=Wj(r,c);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||Gj(u)===Gj(d)?(t[c]=Math.max(Pn(Hj(u),Hj(d),n),0),(Ho.test(d)||Ho.test(u))&&(t[c]+="%")):t[c]=d}(e.rotate||r.rotate)&&(t.rotate=Pn(e.rotate||0,r.rotate||0,n))}function Wj(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Rge=qz(0,.5,P4),Dge=qz(.5,.95,gs);function qz(t,e,r){return n=>n<t?0:n>e?1:r(Ym(t,e,n))}function Kj(t,e){t.min=e.min,t.max=e.max}function ns(t,e){Kj(t.x,e.x),Kj(t.y,e.y)}function Yj(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Xj(t,e,r,n,a){return t-=e,t=bb(t,1/r,n),a!==void 0&&(t=bb(t,1/a,n)),t}function Oge(t,e=0,r=1,n=.5,a,i=t,o=t){if(Ho.test(e)&&(e=parseFloat(e),e=Pn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let c=Pn(i.min,i.max,n);t===i&&(c-=e),t.min=Xj(t.min,e,r,c,a),t.max=Xj(t.max,e,r,c,a)}function Jj(t,e,[r,n,a],i,o){Oge(t,e[r],e[n],e[a],e.scale,i,o)}const Nge=["x","scaleX","originX"],Ige=["y","scaleY","originY"];function Qj(t,e,r,n){Jj(t.x,e,Nge,r?r.x:void 0,n?n.x:void 0),Jj(t.y,e,Ige,r?r.y:void 0,n?n.y:void 0)}function Zj(t){return t.translate===0&&t.scale===1}function zz(t){return Zj(t.x)&&Zj(t.y)}function eL(t,e){return t.min===e.min&&t.max===e.max}function Mge(t,e){return eL(t.x,e.x)&&eL(t.y,e.y)}function tL(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function $z(t,e){return tL(t.x,e.x)&&tL(t.y,e.y)}function rL(t){return Ka(t.x)/Ka(t.y)}function nL(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class jge{constructor(){this.members=[]}add(e){sA(this.members,e),e.scheduleRender()}remove(e){if(oA(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 Lge(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 DE=["","X","Y","Z"],Bge=1e3;let Uge=0;function OE(t,e,r,n){const{latestValues:a}=e;a[t]&&(r[t]=a[t],e.setStaticValue(t,0),n&&(n[t]=0))}function Vz(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=Az(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:a,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",En,!(a||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&Vz(n)}function Hz({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(o={},c=e?.()){this.id=Uge++,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(zge),this.nodes.forEach(Gge),this.nodes.forEach(Wge),this.nodes.forEach($ge)},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 Cge)}addEventListener(o,c){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new uA),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=sz(o)&&!Mhe(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;En.read(()=>{h=window.innerWidth}),t(o,()=>{const _=window.innerWidth;_!==h&&(h=_,this.root.updateBlockedByResize=!0,f&&f(),f=xge(m,250),b_.hasAnimatedSinceResize&&(b_.hasAnimatedSinceResize=!1,this.nodes.forEach(sL)))})}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()||Qge,{onLayoutAnimationStart:b,onLayoutAnimationComplete:E}=d.getProps(),T=!this.targetLayout||!$z(this.targetLayout,_),D=!h&&m;if(this.options.layoutRoot||this.resumeFrom||D||h&&(T||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const P={...SA(w,"layout"),onPlay:b,onComplete:E};(d.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P),this.setAnimationOrigin(f,D)}else h||sL(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(),iu(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(Kge),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&&Vz(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(aL);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(iL);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Hge),this.nodes.forEach(Fge),this.nodes.forEach(qge)):this.nodes.forEach(iL),this.clearAllSnapshots();const c=pi.now();Ta.delta=Hc(0,1e3/60,c-Ta.timestamp),Ta.timestamp=c,Ta.isProcessing=!0,bE.update.process(Ta),bE.preRender.process(Ta),bE.render.process(Ta),Ta.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,TA.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Vge),this.sharedNodes.forEach(Yge)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,En.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){En.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ka(this.snapshot.measuredBox.x)&&!Ka(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=Un(),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&&!zz(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;o&&this.instance&&(c||Gu(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)),Zge(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return Un();const c=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(eye))){const{scroll:d}=this.root;d&&(Rf(c.x,d.offset.x),Rf(c.y,d.offset.y))}return c}removeElementScroll(o){const c=Un();if(ns(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&&ns(c,o),Rf(c.x,f.offset.x),Rf(c.y,f.offset.y))}return c}applyTransform(o,c=!1){const u=Un();ns(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&&Df(u,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),Gu(f.latestValues)&&Df(u,f.latestValues)}return Gu(this.latestValues)&&Df(u,this.latestValues),u}removeTransform(o){const c=Un();ns(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!d.instance||!Gu(d.latestValues))continue;zC(d.latestValues)&&d.updateSnapshot();const f=Un(),h=d.measurePageBox();ns(f,h),Qj(c,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,f)}return Gu(this.latestValues)&&Qj(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!==Ta.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=Ta.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Un(),this.relativeTargetOrigin=Un(),wm(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),ns(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Un(),this.targetWithTransforms=Un()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),sge(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ns(this.target,this.layout.layoutBox),Sz(this.target,this.targetDelta)):ns(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=Un(),this.relativeTargetOrigin=Un(),wm(this.relativeTargetOrigin,this.target,m.target),ns(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||zC(this.parent.latestValues)||wz(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===Ta.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;ns(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,m=this.treeScale.y;_me(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=Un());const{target:_}=o;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Yj(this.prevProjectionDelta.x,this.projectionDelta.x),Yj(this.prevProjectionDelta.y,this.projectionDelta.y)),km(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==m||!nL(this.projectionDelta.x,this.prevProjectionDelta.x)||!nL(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=Of(),this.projectionDelta=Of(),this.projectionDeltaWithTransform=Of()}setAnimationOrigin(o,c=!1){const u=this.snapshot,d=u?u.latestValues:{},f={...this.latestValues},h=Of();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const m=Un(),_=u?u.source:void 0,w=this.layout?this.layout.source:void 0,b=_!==w,E=this.getStack(),T=!E||E.members.length<=1,D=!!(b&&!T&&this.options.crossfade===!0&&!this.path.some(Jge));this.animationProgress=0;let P;this.mixTargetDelta=A=>{const C=A/1e3;oL(h.x,o.x,C),oL(h.y,o.y,C),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wm(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Xge(this.relativeTarget,this.relativeTargetOrigin,m,C),P&&Mge(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=Un()),ns(P,this.relativeTarget)),b&&(this.animationValues=f,Age(f,d,this.latestValues,C,D,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&&(iu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=En.update(()=>{b_.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=pp(0)),this.currentAnimation=Ege(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(Bge),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&&Gz(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||Un();const h=Ka(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+h;const m=Ka(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+m}ns(c,u),Df(c,f),km(this.projectionDeltaWithTransform,this.layoutCorrected,c,f)}}registerSharedNode(o,c){this.sharedNodes.has(o)||this.sharedNodes.set(o,new jge),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&&OE("z",o,d,this.animationValues);for(let f=0;f<DE.length;f++)OE(`rotate${DE[f]}`,o,d,this.animationValues),OE(`skew${DE[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=__(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=__(c?.pointerEvents)||""),this.hasProjected&&!Gu(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const f=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=Lge(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 Zm){if(f[w]===void 0)continue;const{correct:b,applyTo:E,isCSSVariable:T}=Zm[w],D=h==="none"?f[w]:b(f[w],d);if(E){const P=E.length;for(let A=0;A<P;A++)o[E[A]]=D}else T?this.options.visualElement.renderState.vars[w]=D:o[w]=D}this.options.layoutId&&(o.pointerEvents=d===this?__(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(aL),this.root.sharedNodes.clear()}}}function Fge(t){t.updateLayout()}function qge(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"?is(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Ka(h);h.min=r[f].min,h.max=h.min+m}):Gz(a,e.layoutBox,r)&&is(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Ka(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=Of();km(o,r,e.layoutBox);const c=Of();i?km(c,t.applyTransform(n,!0),e.measuredBox):km(c,r,e.layoutBox);const u=!zz(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 _=Un();wm(_,e.layoutBox,h.layoutBox);const w=Un();wm(w,r,m.layoutBox),$z(_,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 zge(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 $ge(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Vge(t){t.clearSnapshot()}function aL(t){t.clearMeasurements()}function iL(t){t.isLayoutDirty=!1}function Hge(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function sL(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Gge(t){t.resolveTargetDelta()}function Wge(t){t.calcProjection()}function Kge(t){t.resetSkewAndRotation()}function Yge(t){t.removeLeadSnapshot()}function oL(t,e,r){t.translate=Pn(e.translate,0,r),t.scale=Pn(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function cL(t,e,r,n){t.min=Pn(e.min,r.min,n),t.max=Pn(e.max,r.max,n)}function Xge(t,e,r,n){cL(t.x,e.x,r.x,n),cL(t.y,e.y,r.y,n)}function Jge(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Qge={duration:.45,ease:[.4,0,.1,1]},lL=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),uL=lL("applewebkit/")&&!lL("chrome/")?Math.round:gs;function dL(t){t.min=uL(t.min),t.max=uL(t.max)}function Zge(t){dL(t.x),dL(t.y)}function Gz(t,e,r){return t==="position"||t==="preserve-aspect"&&!ige(rL(e),rL(r),.2)}function eye(t){return t!==t.root&&t.scroll?.wasRoot}const tye=Hz({attachResizeListener:(t,e)=>eg(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),NE={current:void 0},Wz=Hz({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!NE.current){const t=new tye({});t.mount(window),t.setOptions({layoutScroll:!0}),NE.current=t}return NE.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),rye={pan:{Feature:bge},drag:{Feature:_ge,ProjectionNode:Wz,MeasureLayout:Uz}};function fL(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&&En.postRender(()=>i(e,Hg(e)))}class nye extends yu{mount(){const{current:e}=this.node;e&&(this.unmount=Rhe(e,(r,n)=>(fL(this.node,n,"Start"),a=>fL(this.node,a,"End"))))}unmount(){}}class aye extends yu{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=zg(eg(this.node.current,"focus",()=>this.onFocus()),eg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function pL(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&&En.postRender(()=>i(e,Hg(e)))}class iye extends yu{mount(){const{current:e}=this.node;e&&(this.unmount=Ihe(e,(r,n)=>(pL(this.node,n,"Start"),(a,{success:i})=>pL(this.node,a,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const KC=new WeakMap,IE=new WeakMap,sye=t=>{const e=KC.get(t.target);e&&e(t)},oye=t=>{t.forEach(sye)};function cye({root:t,...e}){const r=t||document;IE.has(r)||IE.set(r,{});const n=IE.get(r),a=JSON.stringify(e);return n[a]||(n[a]=new IntersectionObserver(oye,{root:t,...e})),n[a]}function lye(t,e,r){const n=cye(e);return KC.set(t,r),n.observe(t),()=>{KC.delete(t),n.unobserve(t)}}const uye={some:0,all:1};class dye extends yu{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:uye[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 lye(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(fye(e,r))&&this.startObserver()}unmount(){}}function fye({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const pye={inView:{Feature:dye},tap:{Feature:iye},focus:{Feature:aye},hover:{Feature:nye}},hye={layout:{ProjectionNode:Wz,MeasureLayout:Uz}},mye={...Zme,...pye,...rye,...hye},Js=gme(mye,Pme);function gye(){!MA.current&&Tz();const[t]=v.useState(kb.current);return t}const Kz=[1,5,10,25,100];var k_=(t=>(t.FREE="FREE",t.PREMIUM="PREMIUM",t))(k_||{});const VSe={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]},em=t=>`$${t.toLocaleString(void 0,{maximumFractionDigits:0})}`;function Qs({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 ${em(Number(t))}`,title:`Add ${em(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 ${em(Number(t))} chip`,title:`Clear ${em(Number(t))} chip`,onClick:_=>{_.stopPropagation(),r(t)},children:"×"})]})}const yye=[500,100,25,10,5,1],ME=20;function LA(t){const e=[];let r=Math.max(1,Math.floor(t));for(const n of yye){for(;r>=n&&(e.push(n),r-=n,!(e.length>=ME)););if(e.length>=ME)break}return r>0&&e.length<ME&&e.push(r),e.length===0&&e.push(1),e}function vye({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(Js.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,em(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:[" ",LA(m.amount).map(_=>g.jsx(Qs,{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 YC({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 Yz({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 _ye={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 w0({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:D,heading:P}){const A=Kz,C=gye(),O=v.useCallback(()=>{ar("Light")},[]),I=v.useRef(!1),x=!!E,R=!!b,N=!i&&!x&&!R&&!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||R||!T||(O(),a?.())},[i,R,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(Js.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 Y=(t[U]??0)>0;return g.jsx(Js.div,{role:"option","aria-selected":Y,variants:C?void 0:_ye,layout:!0,className:"chipRack__chipWrapper",children:g.jsx(Qs,{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(Yz,{onClick:L,disabled:!N,mini:u})}),N&&g.jsx("div",{className:"chipRack__halo","aria-hidden":"true"})]}),g.jsx(Js.div,{children:g.jsx(YC,{onClick:q,disabled:i||R||!T})}),g.jsx("div",{className:"chipRack__amount","aria-live":"polite","aria-atomic":"true",children:g.jsx(vye,{isBanker:d,meId:f,open:h,players:m,show:_,labelPrefix:w})})]})}function BA(t={1:0,5:0,10:0,25:0,100:0}){const[e,r]=v.useState(t),n=v.useMemo(()=>Kz.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 bye=""+new URL("roll-btn-web-wZ6ex-aH.webp",import.meta.url).href;function Xz({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,Lr(),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 ld("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 ld("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:bye,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 kye({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:_}=BA(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),D=cu(),A=(o?.banker??r)===e,{open:C,settled:O,myOpenMain:I,placeMainBet:x,cancelMainBet:R}=v0(t,e),[N,L]=v.useState(!1);v.useEffect(()=>{I&&N&&L(!1)},[I,N]),v.useEffect(()=>{if(!N||I)return;const ie=setTimeout(()=>L(!1),5e3);return()=>clearTimeout(ie)},[N,I]);const j=!A&&!I&&!N,q=c?.handleRoll??(()=>{}),U=!!c?.canRoll;c?.lastRollerId;const Y=c?.diceSettled??!0,F=o?.betsLocked??!1;o?.roundSeq;const X=!!o?.bankRoll,J=X,[ee,H]=v.useState(!1),B=v.useRef(F),K=v.useRef(null);v.useEffect(()=>(B.current&&!F&&(H(!0),K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{H(!1),K.current=null},3e3)),F&&K.current&&(window.clearTimeout(K.current),K.current=null,H(!1)),B.current=F,()=>{K.current&&window.clearTimeout(K.current)}),[F]);const ae=v.useCallback(async()=>{try{Lr()}catch{}if(w)return;const ie=Math.floor(h);if(ie<=0){D.info("Tap chips to add a bet amount.");return}if(!X){if(F||J){D.info("Bets are closed.");return}if(o?.spectators?.includes(e)){D.info("Exit spectate to place a bet.");return}try{b(!0);const xe=await x(ie);if(!xe?.ok){D.error(xe?.error||"Bet rejected");return}L(!0)}catch{}finally{b(!1)}}},[w,h,i,F,J,o,x]),te=v.useCallback(async()=>{try{Lr()}catch{}if(I)try{const ie=await R(I.id);ie.ok||D.error(ie.error||"Failed to cancel bet")}catch(ie){D.error(ie?.message??"Failed to cancel bet")}},[R,I,D]),ce=(o?.spectators??[]).includes(e),Re=w||ce||J||F||N,{triggerSpin:He}=Zo();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(Xz,{disabled:!U||ce,busy:!Y,onClick:q,onPressStart:He,"data-testid":"roll-button"})}),!A&&g.jsx("div",{className:"betpanel__row",children:g.jsx(w0,{mainAmt:h,selectedTimes:f,onAdd:m,onClear:_,onPlaceBet:ae,onCancelBet:te,disabled:Re,collapsed:!j,betTokenProps:{isBanker:A,meId:e,open:C,players:n,show:!j},hasBankRoll:X,betsLocked:F||ee,myOpenMain:I})})]}),E&&g.jsx(g4,{meId:e,items:O,onClose:()=>T(!1)})]})}function wye(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 Sye(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 Jz(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 Sm(t,e){return Jz(t)}function jE(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 wb(t){if(!t||t.length!==3)return{score:0,label:"—",kind:"invalid"};const e=Jz(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 Eye({gameMode:t="cee-lo",gameState:e,className:r}){let n=null;if(t==="craps")n=wye(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 — ${wb(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 Tye="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let LE=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Tye[r[t]&63];return e};const Cye="_panelRoot_e91cw_1",xye="_crapsPlaceTile_e91cw_80",Pye="_mobileShow_e91cw_101",Aye="_mobileHide_e91cw_105",Rye="_spotBtn_e91cw_132",Dye="_spotRow_e91cw_145",Oye="_actions_e91cw_157",Nye="_actionBtn_e91cw_161",Iye="_amountBadge_e91cw_167",Mye="_badgeMinus_e91cw_174",jye="_crapsStatusBar_e91cw_185",Lye="_crapsStatusText_e91cw_191",Bye="_crapsHighlight_e91cw_199",Uye="_crapsPlaceRow_e91cw_216",Fye="_crapsBetTile_e91cw_227",qye="_crapsActionsBar_e91cw_235",zye="_crapsActionButton_e91cw_239",$ye="_crapsActionButtonPrimary_e91cw_244",Vye="_crapsActionButtonSecondary_e91cw_245",Hye="_crapsMainBets_e91cw_251",Gye="_disabled_e91cw_321",Wye="_spotBtnTopRow_e91cw_507",Kye="_lineWin_e91cw_558",Yye="_lineLose_e91cw_563",Xye="_linePush_e91cw_568",Jye="_outcomeBadge_e91cw_573",Qye="_locked_e91cw_587",Zye="_amountBadgeDisabled_e91cw_615",eve="_lockIcon_e91cw_621",tve="_aggBadge_e91cw_661",rve="_rollBtn_e91cw_877",nve="_rollIcon_e91cw_884",ave="_clear_e91cw_910",ive="_errorLive_e91cw_927",sve="_tooltip_e91cw_935",ove="_betInfoBtn_e91cw_959",cve="_betInfoModalOverlay_e91cw_987",lve="_betInfoModal_e91cw_987",uve="_betInfoHeader_e91cw_1021",dve="_betInfoClose_e91cw_1037",fve="_betInfoContent_e91cw_1058",pve="_betInfoItem_e91cw_1066",hve="_shake_e91cw_1152",mve="_attnHalo_e91cw_1200",gve="_crapsAtsLabel_e91cw_1345",yve="_crapsIronCrossBtn_e91cw_1365",vve="_crapsMinusBadge_e91cw_1459",_ve="_crapsClearIcon_e91cw_1701",bve="_particle_e91cw_1735",kve="_particleContainer_e91cw_1741",wve="_floatingWinAmount_e91cw_1791",Sve="_rollHaloActive_e91cw_1851",Eve="_chipPickerWrapper_e91cw_2200",Tve="_chipPickerToggle_e91cw_2205",Cve="_chipPickerToggleOpen_e91cw_2248",xve="_chipPickerChip_e91cw_2258",Pve="_chipPickerDropdown_e91cw_2262",Ave="_chipPickerOption_e91cw_2284",Rve="_chipPickerOptionSelected_e91cw_2293",Dve="_chipPickerChipSelected_e91cw_2297",Ove="_crapsAtsSection_e91cw_2317",ft={panelRoot:Cye,crapsPlaceTile:xye,mobileShow:Pye,mobileHide:Aye,spotBtn:Rye,spotRow:Dye,actions:Oye,actionBtn:Nye,amountBadge:Iye,badgeMinus:Mye,crapsStatusBar:jye,crapsStatusText:Lye,crapsHighlight:Bye,crapsPlaceRow:Uye,crapsBetTile:Fye,crapsActionsBar:qye,crapsActionButton:zye,crapsActionButtonPrimary:$ye,crapsActionButtonSecondary:Vye,crapsMainBets:Hye,disabled:Gye,spotBtnTopRow:Wye,lineWin:Kye,lineLose:Yye,linePush:Xye,outcomeBadge:Jye,locked:Qye,amountBadgeDisabled:Zye,lockIcon:eve,aggBadge:tve,rollBtn:rve,rollIcon:nve,clear:ave,errorLive:ive,tooltip:sve,betInfoBtn:ove,betInfoModalOverlay:cve,betInfoModal:lve,betInfoHeader:uve,betInfoClose:dve,betInfoContent:fve,betInfoItem:pve,shake:hve,attnHalo:mve,crapsAtsLabel:gve,crapsIronCrossBtn:yve,crapsMinusBadge:vve,crapsClearIcon:_ve,particle:bve,particleContainer:kve,floatingWinAmount:wve,rollHaloActive:Sve,chipPickerWrapper:Eve,chipPickerToggle:Tve,chipPickerToggleOpen:Cve,chipPickerChip:xve,chipPickerDropdown:Pve,chipPickerOption:Ave,chipPickerOptionSelected:Rve,chipPickerChipSelected:Dve,crapsAtsSection:Ove};/*!
 * 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 Nve={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"]},Ive={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 Mve={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 jve({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(Mve).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 Wc.createPortal(n,document.body)}const Lve="_atsProgressContainer_bok0p_3",Bve="_inline_bok0p_15",Uve="_atsSection_bok0p_25",Fve="_complete_bok0p_42",qve="_justCompleted_bok0p_47",zve="_atsSectionAll_bok0p_66",$ve="_atsSectionHeader_bok0p_75",Vve="_atsSectionLabel_bok0p_84",Hve="_atsSectionCount_bok0p_97",Gve="_atsNumberRow_bok0p_107",Wve="_atsNumber_bok0p_107",Kve="_hit_bok0p_138",Yve="_atsCompleteText_bok0p_160",Xve="_atsLockedBadge_bok0p_181",Jr={atsProgressContainer:Lve,inline:Bve,atsSection:Uve,complete:Fve,justCompleted:qve,atsSectionAll:zve,atsSectionHeader:$ve,atsSectionLabel:Vve,atsSectionCount:Hve,atsNumberRow:Gve,atsNumber:Wve,hit:Kve,atsCompleteText:Yve,atsLockedBadge:Xve},Jve=[2,3,4,5,6],Qve=[8,9,10,11,12];function Zve({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:`${Jr.atsProgressContainer} ${o?Jr.inline:""}`,children:[g.jsxs("div",{className:`${Jr.atsSection} ${u?Jr.complete:""} ${i==="small"?Jr.justCompleted:""}`,children:[g.jsxs("div",{className:Jr.atsSectionHeader,children:[g.jsx("span",{className:Jr.atsSectionLabel,children:"SMALL"}),g.jsxs("span",{className:Jr.atsSectionCount,children:[e,"/5"]})]}),g.jsx("div",{className:Jr.atsNumberRow,children:Jve.map(h=>g.jsx("div",{className:`${Jr.atsNumber} ${c(h)?Jr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]}),g.jsxs("div",{className:`${Jr.atsSection} ${Jr.atsSectionAll} ${f?Jr.complete:""} ${i==="all"?Jr.justCompleted:""}`,children:[g.jsxs("div",{className:Jr.atsSectionHeader,children:[g.jsx("span",{className:Jr.atsSectionLabel,children:"ALL"}),g.jsxs("span",{className:Jr.atsSectionCount,children:[n,"/10"]})]}),f&&g.jsx("div",{className:Jr.atsCompleteText,children:"🎉"}),a&&!f&&g.jsx("div",{className:Jr.atsLockedBadge,children:"LOCKED"})]}),g.jsxs("div",{className:`${Jr.atsSection} ${d?Jr.complete:""} ${i==="tall"?Jr.justCompleted:""}`,children:[g.jsxs("div",{className:Jr.atsSectionHeader,children:[g.jsx("span",{className:Jr.atsSectionLabel,children:"TALL"}),g.jsxs("span",{className:Jr.atsSectionCount,children:[r,"/5"]})]}),g.jsx("div",{className:Jr.atsNumberRow,children:Qve.map(h=>g.jsx("div",{className:`${Jr.atsNumber} ${c(h)?Jr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]})]})}const Ro={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"},BE={hitNumbers:[],smallProgress:0,tallProgress:0,allProgress:0,betsLocked:!1};function e_e(t){const e=Ss(),[r,n]=v.useState(BE),[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(BE),i(null))};return e.on(Ro.PROGRESS,c),e.on(Ro.SMALL_COMPLETE,u),e.on(Ro.TALL_COMPLETE,d),e.on(Ro.ALL_COMPLETE,f),e.on(Ro.RESET,h),()=>{e.off(Ro.PROGRESS,c),e.off(Ro.SMALL_COMPLETE,u),e.off(Ro.TALL_COMPLETE,d),e.off(Ro.ALL_COMPLETE,f),e.off(Ro.RESET,h)}},[e,t]);const o=v.useCallback(c=>r.hitNumbers.includes(c),[r.hitNumbers]);return{atsProgress:r,lastCompletedCategory:a,isNumberHit:o,reset:()=>n(BE)}}function Ca(t){return`z${t}`}function ls(t,e){return t.filter(r=>r.type===e).reduce((r,n)=>r+n.amount,0)}function t_e(t,e){return t*e}function hL(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=ls(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",D=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 ${Ca(c)}`}}if(E){if(!a)return{ok:!1,reason:"Come bets only after point"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Ca(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ca(u)}`}}if(T){if(!a)return{ok:!1,reason:"Point required for odds"};const C=ls(o,t==="oddsPass"?"pass":"dontPass");if(!C)return{ok:!1,reason:"Need line bet first"};const O=t_e(C,t==="oddsPass"?d.pass:d.dontPass);if(m+e>O)return{ok:!1,reason:`Max odds ${Ca(O)}`}}if(D){if(!a)return{ok:!1,reason:"Place bets only in point phase"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Ca(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ca(u)}`}}if(t==="field"||t==="big6"||t==="big8"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Ca(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ca(u)}`}}if(t==="atsSmall"||t==="atsTall"||t==="atsAll"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Ca(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Ca(u)}`}}return{ok:!0}}const r_e=[{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"}],n_e=[{key:"atsSmall",label:"Small"},{key:"atsTall",label:"Tall"},{key:"atsAll",label:"All"}],a_e=[{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 i_e(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 s_e(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 o_e(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 c_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 l_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 u_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=ls(a,"pass")+ls(a,"dontPass")+ls(a,"place4")+ls(a,"place5")+ls(a,"place6")+ls(a,"place8")+ls(a,"place9")+ls(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 d_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 f_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 p_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 h_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 m_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=`+${Ca(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 g_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:D,onBetDelta:P,onBetsBatch:A,showReadyButton:C,onReadyClick:O,readyStateLabel:I,readyButtonDisabled:x,recentSettlements:R=[],myPlayerLineTotals:N,othersTotals:L,myCommittedByType:j={}}=t,q=_,{selectedChip:U,setSelectedChip:Y}=i_e(d),{atsProgress:F,lastCompletedCategory:X}=e_e(e??null),[J,ee]=v.useState(!1),[H,B]=v.useState(),[K,ae]=v.useState(),{info:te}=uP(),{triggerSpin:pe}=Zo(),ce=v.useRef(!1),Re=v.useRef(null),He=n==="comeOut"&&!a,ie=n==="point"&&!!a,xe=!1,re=v.useRef(null),G=v.useRef(null),ve=v.useRef(null),Oe=v.useRef(F.betsLocked),he=s_e({pendingBets:f,myPlayerPlaceTotal:E,myCommittedByType:j}),Ce=n==="point"&&!!a&&!he;o_e(Ce,a,G),c_e(X,G),l_e(e,re,G),v.useEffect(()=>{const $=Oe.current,oe=F.betsLocked;Oe.current=oe,$!==oe&&(oe&&ve.current?ve.current.scrollTo({left:ve.current.scrollWidth,behavior:"smooth"}):!oe&&ve.current&&ve.current.scrollTo({left:0,behavior:"smooth"}))},[F.betsLocked]);const st=v.useCallback(()=>{Re.current&&(window.clearInterval(Re.current),Re.current=null)},[]),Ne=v.useCallback(()=>{ce.current||(ce.current=!0,Lr(),pe(),st(),Re.current=window.setInterval(()=>{pe()},500))},[pe,st]),St=v.useCallback(()=>{if(st(),!!ce.current){if(ce.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,st]),at=u_e({phase:n,point:a,balance:r,pendingBets:f,minBet:o,maxBet:c,oddsMultiple:u,myPlayerLineTotals:N,myPlayerPlaceTotal:E}),Ke=d_e(f,j);f_e(f,j,h);const it=v.useMemo(()=>{const $=ls(f,"pass")>0||ls(f,"dontPass")>0,oe=(N?.pass??0)>0||(N?.dontPass??0)>0,ct=Ke("pass")>0||Ke("dontPass")>0;return $||oe||ct},[f,N?.pass,N?.dontPass,Ke]),{lineOutcomeMap:mt,placeOutcomeMap:Je,fieldOutcomeMap:ue,bigOutcomeMap:Be,comeOutcomeMap:je}=p_e({recentSettlements:R,meId:D,myPlayerLineTotals:N}),ot=v.useMemo(()=>`.${ft.spotBtn}[data-win-outcome="true"]`,[]),Pt=v.useMemo(()=>JSON.stringify({lineOutcomeMap:mt,placeOutcomeMap:Je,fieldOutcomeMap:ue,bigOutcomeMap:Be,comeOutcomeMap:je}),[mt,Je,ue,Be,je]);h_e(ot,Pt),m_e({recentSettlements:R,meId:D,winSelector:ot,floatingClass:ft.floatingWinAmount});const Ft=v.useMemo(()=>{const $=new Set;for(const oe of f){const ct=Number(j[oe.type]||0);oe.amount!==ct&&$.add(oe.type)}return $},[f,j]),Me=v.useRef(new Set);v.useEffect(()=>{const $=Me.current,oe=Ft;for(const ct of $)if(!oe.has(ct)){try{FG({volume:.03})}catch{}break}Me.current=new Set(oe)},[Ft]);const tt=Ft.size>0;v.useMemo(()=>Ft.size>0,[Ft]);const rt=v.useCallback(($,oe)=>{if(oe===0)return;const ct=f.find(Rt=>Rt.type===$);if(oe>0){const Rt=oe,{ok:mr,reason:Kr}=hL($,Rt,at);if(!mr){if(B(Kr),ae($),Kr==="Insufficient balance")try{te("Insufficient funds","Add chips to place this bet")}catch{}window.setTimeout(()=>ae(void 0),600);return}if(ct)h(f.map(Ge=>Ge===ct?{...Ge,amount:Ge.amount+Rt}:Ge));else{const Ge=Number(j[$]||0);h([...f,{id:LE(),type:$,amount:Ge+Rt}])}P?.($,Rt);return}let Nt=ct?.amount??0;if(!ct){const Rt=Number(j[$]||0);if(Rt<=0)return;Nt=Rt}const Qt=Nt+oe;h(ct?f.map(Rt=>Rt===ct?{...Rt,amount:Math.max(0,Qt)}:Rt):[...f,{id:LE(),type:$,amount:Math.max(0,Qt)}]),P?.($,oe)},[f,h,o,j,at,P,te]),be=v.useCallback(($,oe)=>{const ct=$==="oddsPass",Nt=$==="oddsDontPass",Qt=$==="atsSmall"||$==="atsTall"||$==="atsAll",Rt=$==="pass"||$==="dontPass"?ie:ct?n!=="point"||!a||Ke("pass")===0:Nt?n!=="point"||!a||Ke("dontPass")===0:$.startsWith("place")||$==="come"||$==="dontCome"?!a:Qt?n!=="comeOut"||F.betsLocked:!1,mr=$==="pass"||$==="dontPass",Kr=$==="come"||$==="dontCome",Ge=!$.startsWith("place"),Gt=mr&&ie,xt=mr?mt[$]:$==="field"?ue[$]:$==="big6"||$==="big8"?Be[$]:Kr?je[$]:void 0,qt=xt==="WIN"?ft.lineWin:xt==="LOSE"?ft.lineLose:xt==="PUSH"?ft.linePush:"",Ot=mr&&He&&!it,An=[ft.spotBtn,ft.crapsBetTile,$.startsWith("place")?ft.crapsPlaceTile:"",Rt?ft.locked:"",K===$?ft.shake:"",qt,Ot?ft.attnHalo:"",$.startsWith("place")&&Ce?ft.attnHalo:""],Cn=_||xe||tt,hn=L&&typeof L[$]=="number"?L[$]:0,xn=Ke($);if(Ge){const ua=[...An,ft.spotBtnTopRow,"gold-link",Cn?ft.disabled:""].filter(Boolean).join(" ");return g.jsxs(Js.a,{role:"button",tabIndex:0,"aria-disabled":Cn||void 0,className:ua,"data-bet-type":$,"data-attn":Ot?"need-line":void 0,"data-has-bet":xn>0?"true":"false","data-win-outcome":xt==="WIN"?"true":"false","data-no-global-haptic":!0,"aria-label":`Place bet on ${oe}, +${U}`,onClick:mn=>{mn.preventDefault(),!Rt&&!Cn&&(Lr(),ar("Light"),rt($,U))},onKeyDown:mn=>{(mn.key==="Enter"||mn.key===" ")&&!Rt&&!Cn&&(mn.preventDefault(),Lr(),ar("Light"),rt($,U))},whileTap:{scale:.94},children:[oe,hn>0&&g.jsx("div",{className:ft.aggBadge,"aria-label":`Others ${oe} total ${Ca(hn)}`,children:Ca(hn)}),xn>0&&g.jsxs("div",{className:ft.amountBadge+(Gt?" "+ft.amountBadgeDisabled:""),"aria-disabled":Gt||void 0,children:[!Gt&&g.jsx("span",{role:"button",tabIndex:0,className:[ft.badgeMinus,ft.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${oe}`,onClick:mn=>{mn.stopPropagation(),Lr(),ar("Light"),rt($,-U)},onKeyDown:mn=>{(mn.key==="Enter"||mn.key===" ")&&(mn.preventDefault(),mn.stopPropagation(),Lr(),ar("Light"),rt($,-U))},children:"−"}),Ca(xn),Gt&&g.jsx("span",{className:ft.lockIcon,"aria-hidden":"true",children:"🔒"}),xt&&g.jsx("span",{className:ft.outcomeBadge,"aria-label":`Outcome ${xt}`,children:xt==="WIN"?"✓":xt==="LOSE"?"✕":"⟳"})]}),K===$&&H&&g.jsx("div",{className:ft.tooltip,children:H})]},$)}const Vi=$.startsWith("place")?Je[$]:$==="field"?ue[$]:$==="big6"||$==="big8"?Be[$]:void 0,nn=An.filter(Boolean).join(" ");return g.jsxs(Js.button,{type:"button",className:nn,"data-bet-type":$,"data-attn":$.startsWith("place")&&Ce?"need-places":void 0,"data-has-bet":xn>0?"true":"false","data-win-outcome":xt==="WIN"||Vi==="WIN"?"true":"false","aria-label":`Place bet on ${oe}, +${U}`,onClick:()=>{!Rt&&!Cn&&(Lr(),ar("Light"),rt($,U))},disabled:_||xe||tt,whileTap:{scale:.94},children:[oe,hn>0&&g.jsx("div",{className:ft.aggBadge,"aria-label":`Others ${oe} total ${Ca(hn)}`,children:Ca(hn)}),xn>0&&g.jsxs("div",{className:ft.amountBadge+(Gt?" "+ft.amountBadgeDisabled:""),"aria-disabled":Gt||void 0,children:[!Gt&&g.jsx("span",{role:"button",tabIndex:0,className:[ft.badgeMinus,ft.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${oe}`,onClick:ua=>{ua.stopPropagation(),Lr(),ar("Light"),rt($,-U)},onKeyDown:ua=>{(ua.key==="Enter"||ua.key===" ")&&(ua.preventDefault(),ua.stopPropagation(),Lr(),ar("Light"),rt($,-U))},children:"−"}),Ca(xn),Gt&&g.jsx("span",{className:ft.lockIcon,"aria-hidden":"true",children:"🔒"}),xt&&g.jsx("span",{className:ft.outcomeBadge,"aria-label":`Outcome ${xt}`,children:xt==="WIN"?"✓":xt==="LOSE"?"✕":"⟳"})]}),K===$&&H&&g.jsx("div",{className:ft.tooltip,children:H})]},$)},[rt,_,xe,Ke,H,K,He,it,Ce,U,ie,n,a,mt,Je,ue,Be,je,L,tt,F.betsLocked]),lt=v.useMemo(()=>{const $=[...r_e],oe=(ct,Nt,Qt)=>{const Rt=$.findIndex(mr=>mr.key===ct);Rt>=0&&!$.some(mr=>mr.key===Nt)&&$.splice(Rt+1,0,{key:Nt,label:Qt})};return oe("pass","oddsPass","Odds Pass"),oe("dontPass","oddsDontPass","Odds Don't"),$},[]),yt=v.useMemo(()=>lt.map($=>be($.key,$.label)),[lt,be]),tr=v.useMemo(()=>a_e.map($=>be($.key,$.label)),[be]),Or=v.useMemo(()=>n_e.map($=>be($.key,$.label)),[be]),ur=v.useCallback(()=>{if(_||xe||tt)return;Lr(),ar("Light");const $=["place4","place5","place6","place8","place9","place10"],oe=[];for(const Nt of $){f.find(Kr=>Kr.type===Nt);const Qt=U,{ok:Rt,reason:mr}=hL(Nt,Qt,at);if(!Rt){if(B(mr),ae(Nt),mr==="Insufficient balance")try{te("Insufficient funds","Add chips to place All Places bet")}catch{}window.setTimeout(()=>ae(void 0),600);return}oe.push({type:Nt,delta:Qt})}let ct=[...f];for(const{type:Nt,delta:Qt}of oe){const Rt=ct.find(mr=>mr.type===Nt);if(Rt)ct=ct.map(mr=>mr===Rt?{...mr,amount:mr.amount+Qt}:mr);else{const mr=Number(j[Nt]||0);ct.push({id:LE(),type:Nt,amount:mr+Qt})}}h(ct),A?A(oe.map(({type:Nt,delta:Qt})=>({type:Nt,amount:Qt}))):P&&oe.forEach(({type:Nt,delta:Qt})=>P(Nt,Qt))},[_,xe,f,U,o,at,h,j,A,P,te,tt]),dr=!!C,fn=dr?I||"Ready":"Roll",Z=dr?!!x:q||b===!1,fe=!dr&&!Z&&b!==!1&&(n!=="point"||he),[ge,Pe]=v.useState(!1),De=v.useRef(null);v.useEffect(()=>{if(!ge)return;const $=oe=>{De.current&&!De.current.contains(oe.target)&&Pe(!1)};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[ge]);const W=i;return g.jsxs("div",{className:[ft.panelRoot,_?ft.disabled:""].join(" "),children:[g.jsxs("div",{className:ft.crapsStatusBar,children:[g.jsxs("div",{className:ft.chipPickerWrapper,ref:De,children:[g.jsx("div",{className:[ft.chipPickerToggle,ge?ft.chipPickerToggleOpen:""].join(" "),onClick:()=>{Lr(),ar("Light"),Pe($=>!$)},role:"button",tabIndex:0,"aria-label":`Selected chip ${U}, click to change`,"aria-expanded":ge,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),Lr(),ar("Light"),Pe(oe=>!oe))},children:g.jsx(Qs,{value:U,mini:!0,className:ft.chipPickerChip,onAdd:()=>{Lr(),ar("Light"),Pe($=>!$)}})}),ge&&g.jsx("div",{className:ft.chipPickerDropdown,children:d.map($=>g.jsx("div",{className:[ft.chipPickerOption,$===U?ft.chipPickerOptionSelected:""].join(" "),children:g.jsx(Qs,{value:$,mini:!0,className:$===U?ft.chipPickerChipSelected:"",onAdd:()=>{Lr(),fF(),Y($),Pe(!1)}})},$))})]}),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:W})," • ",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:()=>{ar("Light"),ee(!0)},"aria-label":"Show bet information",children:g.jsx(Ml,{icon:Ive})})]}),g.jsx(jve,{open:J,onClose:()=>ee(!1)}),g.jsx("div",{className:[ft.spotRow,ft.crapsMainBets].join(" "),ref:re,children:yt}),g.jsxs("div",{className:ft.crapsPlaceRow,ref:G,children:[tr,g.jsx("button",{type:"button",className:[ft.spotBtn,ft.crapsBetTile,ft.crapsIronCrossBtn].join(" "),onClick:ur,disabled:!a||_||xe||tt,"aria-label":"Place All Places (4/5/6/8/9/10)",children:"All Places"})]}),g.jsxs("div",{className:ft.crapsAtsSection,ref:ve,children:[g.jsx("span",{className:ft.crapsAtsLabel,children:"ATS"}),Or,g.jsx(Zve,{hitNumbers:F.hitNumbers,smallProgress:F.smallProgress,tallProgress:F.tallProgress,allProgress:F.allProgress,betsLocked:F.betsLocked,lastCompletedCategory:X,inline:!0})]}),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,fe?ft.rollHaloActive:""].join(" "),onClick:$=>{if(dr){if(x)return;try{Lr(),ar("Light")}catch{}O?.();return}if(ce.current){$.preventDefault();return}if(!Z){Lr(),ar("Medium"),pe();try{n==="point"&&!he&&te("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}w?.()}},onPointerDown:()=>{dr||Z||(Ne(),ar("Medium"))},onPointerUp:()=>{dr||St()},disabled:Z,"aria-label":dr?"Mark ready":"Roll dice",children:[!dr&&g.jsx(Ml,{icon:Nve,className:ft.rollIcon,"aria-hidden":"true"}),fn]}),g.jsxs("button",{type:"button",className:[ft.actionBtn,ft.clear,ft.crapsActionButton,ft.crapsActionButtonSecondary].join(" "),onClick:()=>{Lr(),ar("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:H||""})]})}function y_e(t,e){const{crapsGetState:r,crapsJoinOrder:n,crapsLeaveOrder:a,crapsSetOrder:i,crapsRoll:o,crapsResetShooter:c,crapsReady:u}=ga(),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 Lh={},v_e=1;function Qz(t){const{roomId:e,myPlayerId:r,autoJoinOrder:n=!0,onRoll:a,onState:i}=t,{crapsReady:o}=ga(),c=(()=>{try{return Li&&Li()}catch{return null}})(),u=c?.room??null,d=c?.setRoom??(()=>{}),h=u?.gameState?.gameMode==="craps",m=y_e(e,{enabled:h}),_=v.useMemo(()=>{const ie=u?.gameState;return!ie||ie.gameMode!=="craps"?null:{point:ie.crapsPoint??null,currentRollerId:ie.currentRollerId??null,turnOrder:ie.turnOrder??[]}},[u?.gameState]),[w,b]=v.useState(null),[E,T]=v.useState([]),[D,P]=v.useState(!1),A=v.useRef(!1),[C,O]=v.useState([]),[I,x]=v.useState(null),[R,N]=v.useState([]),L=v.useRef(null),j=v.useRef(null),q=v.useRef(null),U=v.useRef(null),Y=v.useRef(null),{triggerSpin:F}=Zo(),X=v.useRef(null),J=v.useRef(null),ee=2e3,H=v.useMemo(()=>!!(r&&_?.turnOrder.includes(r)),[r,_?.turnOrder]),B=v.useCallback(()=>{h&&m.getState?.()},[m,h]),K=v.useCallback(ie=>{!h||!e||A.current||(A.current=!0,m.joinOrder?.(xe=>{A.current=!1,ie?.(xe?.ok,xe?.data)}))},[m,e,h]),ae=v.useCallback(ie=>{!h||!e||A.current||(A.current=!0,m.leaveOrder?.(xe=>{A.current=!1,ie?.(xe?.ok,xe?.data)}))},[m,e,h]),te=v.useCallback((ie,xe)=>{!h||!e||A.current||(A.current=!0,m.setOrder?.(ie,re=>{A.current=!1,xe?.(re?.ok,re?.data)}))},[m,e,h]),pe=v.useCallback(ie=>{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 G=!!re?.ok,ve=String(re?.error||"");if(A.current=!1,!G)try{const Oe=/invalid_payload/i.test(ve),he=/no_room/i.test(ve),Ce=/forbidden|unauthorized/i.test(ve);if(Oe||he||Ce){J.current&&(window.clearTimeout(J.current),J.current=null),P(!1),B(),ie?.(!1,re?.data);return}}catch{}try{J.current&&(window.clearTimeout(J.current),J.current=null),J.current=window.setTimeout(()=>{P(!1),J.current=null},Math.max(ee,4e3))}catch{}ie?.(G,re?.data)}).catch(()=>{A.current=!1,P(!1);try{B()}catch{}ie?.(!1)})}catch{A.current=!1,P(!1),ie?.(!1)}}},[m,e,h]),ce=v.useCallback(ie=>{if(!(!h||!e||A.current)){A.current=!0;try{const xe=m.resetShooter?.();xe&&typeof xe.then=="function"&&xe.then(re=>{A.current=!1,ie?.(!!re?.ok,re?.data)}).catch(()=>{A.current=!1,ie?.(!1)})}catch{A.current=!1,ie?.(!1)}}},[m,e,h]),Re=v.useRef(0);Re.current===0&&(Re.current=v_e++);const He=v.useMemo(()=>e?Lh[e]?Lh[e]===Re.current:(Lh[e]=Re.current,!0):!1,[e]);return v.useEffect(()=>()=>{try{e&&Lh[e]===Re.current&&delete Lh[e]}catch{}},[e]),Da({onJoinedRoom:({room:ie})=>{if(He)try{if(!e||!ie||ie.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:ie})=>{if(He)try{if(!e||!ie||ie.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:ie=>{if(!He||!e||ie.roomId!==e)return;const xe=ie.state?.currentRollerId??ie.state?.currentShooterId??ie.state?.shooterId??null,re=ie.state?.turnOrder||ie.state?.shooterOrder||[],G=ie.state?.point??ie.state?.crapsPoint??null;try{d(ve=>{if(!ve||ve.id!==e)return ve;const Oe=ve.gameState||{},he=G?"point":"come-out";return{...ve,gameState:{...Oe,gameMode:Oe.gameMode||"craps",crapsPoint:G,currentRollerId:xe,turnOrder:re,crapsPhase:he}}})}catch{}try{i?.({point:G,currentRollerId:xe,turnOrder:re})}catch{}n&&r&&!re.includes(r)&&K()},onCrapsPointSet:ie=>{if(He)try{if(!e||ie?.roomId!==e)return;const xe=ie?.point??ie?.crapsPoint??null;d(re=>{if(!re||re.id!==e)return re;const G={...re.gameState||{}};return xe!=null&&(G.crapsPoint=xe,G.crapsPhase="point"),{...re,gameState:G}})}catch{}},onCrapsRollResult:ie=>{if(!He||!e||ie?.roomId!==e)return;try{A.current=!1,P(!0),X.current&&(window.clearTimeout(X.current),X.current=null),X.current=window.setTimeout(()=>{P(!1),X.current=null},ee),J.current&&(window.clearTimeout(J.current),J.current=null)}catch{}let xe,re;if(Array.isArray(ie?.dice)?[xe,re]=ie.dice:(xe=ie?.d1,re=ie?.d2),typeof xe!="number"||typeof re!="number")return;const G=typeof ie.total=="number"?ie.total:xe+re,ve=ie.currentRollerId??ie.currentShooterId??ie.shooterId??null,Oe=ie.nextRollerId??ie.nextShooterId??ie.nextShooter??null,he={roomId:ie.roomId,dice:[xe,re],total:G,point:ie.point??ie.crapsPoint??null,currentRollerId:ve,nextRollerId:Oe,events:Array.isArray(ie.events)?ie.events:[],resolutions:ie.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1}};b(he),T(Ce=>{const st=Date.now(),Ne=30,St=900;for(let it=0;it<Ce.length&&it<5;it++){const mt=Ce[it];if(mt.dice[0]===he.dice[0]&&mt.dice[1]===he.dice[1]&&st-mt.ts<St)return Ce}const Ke=[{...he,ts:st,phase:he.point?"point":"come-out"},...Ce];Ke.length>Ne&&(Ke.length=Ne);try{if(e){const it={v:1,roomId:e,ts:st,items:Ke};Ab(`craps-roll-history:${e}`,it)}}catch{}return Ke});try{const Ce=Oe||null;O(Ce?[Ce]:[]),x(null)}catch{}try{F()}catch{}try{(ie.gameState||ie.point!==void 0||ie.currentRollerId!==void 0||ie.nextRollerId!==void 0)&&d(Ce=>{if(!Ce||Ce.id!==e)return Ce;const Ne={...Ce.gameState||{}};(ie.point!==void 0||ie.crapsPoint!==void 0)&&(Ne.crapsPoint=ie.point??ie.crapsPoint);const St=Oe??ve;return St!==void 0&&(Ne.currentRollerId=St),(Array.isArray(ie.turnOrder)||Array.isArray(ie.shooterOrder))&&(Ne.turnOrder=ie.turnOrder||ie.shooterOrder),Ne.gameMode||(Ne.gameMode="craps"),Ne.crapsPhase=Ne.crapsPoint?"point":"come-out",{...Ce,gameState:Ne}})}catch{}a?.(he)},onCrapsReadyUpdate:ie=>{if(He)try{const xe=Array.isArray(ie?.readyPlayers)?ie.readyPlayers:void 0,re=Array.isArray(ie?.requiredReadyPlayers)?ie.requiredReadyPlayers:void 0,G=ie&&Object.prototype.hasOwnProperty.call(ie,"deadline"),ve=G?typeof ie.deadline=="number"?ie.deadline:null:void 0,Oe=(he,Ce)=>{if(!he&&!Ce)return!0;if(!he||!Ce||he.length!==Ce.length)return!1;for(let st=0;st<he.length;st++)if(he[st]!==Ce[st])return!1;return!0};xe&&(Oe(L.current,xe)||(L.current=xe.slice(),O(xe))),re&&(Oe(j.current,re)||(j.current=re.slice(),N(re))),G&&q.current!==ve&&(q.current=ve===void 0?q.current:ve,x(ve))}catch{}},onCrapsBetsUpdate:ie=>{if(He)try{const xe=ie?.snapshot||{};d(re=>{if(!re||re.id!==e)return re;const G={...re.gameState||{}};for(const ve of Object.keys(xe))G[ve]=xe[ve];return G.gameMode||(G.gameMode="craps"),{...re,gameState:G}})}catch{}}}),v.useEffect(()=>{!e||!h||He&&B()},[e,h]),v.useEffect(()=>{try{const ie=u?.gameState;if(!ie||ie.gameMode!=="craps")return;const xe=ie.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 ie=0;const xe=500,re=()=>{try{const he=Date.now();if(he-ie<xe)return;ie=he,B()}catch{}},G=()=>{document.visibilityState==="visible"&&re()},ve=()=>{re()},Oe=()=>{re()};return window.addEventListener("visibilitychange",G),window.addEventListener("focus",ve),window.addEventListener("ad:complete",Oe),()=>{window.removeEventListener("visibilitychange",G),window.removeEventListener("focus",ve),window.removeEventListener("ad:complete",Oe)}},[h,e,B,He]),v.useEffect(()=>{e&&(async()=>{try{const ie=await Xf(`craps-roll-history:${e}`);if(!ie)return;if(ie&&ie.v===1&&Array.isArray(ie.items)){if(typeof ie.ts=="number"&&Date.now()-ie.ts>72e5)return;const re=[];for(const G of ie.items)if(!(!G||!Array.isArray(G.dice)||G.dice.length!==2)&&!(typeof G.total!="number"||typeof G.ts!="number")&&(re.push({roomId:e,dice:[Number(G.dice[0]),Number(G.dice[1])],total:Number(G.total),point:typeof G.point=="number"?G.point:G.point??null,currentRollerId:G.currentRollerId??null,nextRollerId:G.nextRollerId??null,events:Array.isArray(G.events)?G.events.slice(0,8):[],resolutions:G.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1},ts:G.ts,phase:G.phase==="point"?"point":"come-out"}),re.length>=30))break;re.length&&T(re)}}catch{}})()},[e]),v.useEffect(()=>()=>{X.current&&(window.clearTimeout(X.current),X.current=null),J.current&&(window.clearTimeout(J.current),J.current=null),Y.current&&(window.clearTimeout(Y.current),Y.current=null)},[]),{shooterState:_,lastRoll:w,rollHistory:E,rolling:D,inTurnOrder:H,joinOrder:K,leaveOrder:ae,setOrder:te,roll:pe,resetShooter:ce,requestState:B,readyPlayers:C,readinessDeadline:I,requiredReadyPlayers:R,ready:ie=>{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:ie,at:Date.now()};try{Y.current&&(window.clearTimeout(Y.current),Y.current=null),Y.current=window.setTimeout(async()=>{try{if(!U.current)return;const re=await o(e),G=U.current?.cb;U.current=null,G?.(!!re?.ok,re?.data)}catch{const re=U.current?.cb;U.current=null,re?.(!1)}finally{Y.current&&(window.clearTimeout(Y.current),Y.current=null)}},600)}catch{}return}(async()=>{try{const re=await o(e);if(!re?.ok){const G=String(re?.error||""),ve=/forbidden|unauthorized/i.test(G),Oe=/ready_failed/i.test(G);if(ve||Oe){try{B()}catch{}try{const he=await o(e);ie?.(!!he?.ok,he?.data);return}catch{}}ie?.(!1);return}ie?.(!0,re?.data)}catch{try{setTimeout(async()=>{try{const re=await o(e);ie?.(!!re?.ok,re?.data)}catch{ie?.(!1)}},400)}catch{ie?.(!1)}}})()},iAmReady:!!(r&&C.includes(r)),clearRollHistory:()=>{T([]);try{e&&Jf(`craps-roll-history:${e}`)}catch{}}}}function __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 UE=new Map,FE={pass:[],dontPass:[],odds:[],place:[],field:[],big:[],come:[],dontCome:[],ats:[],lastUpdated:0};function Zz(t){const{roomId:e,myPlayerId:r,autoListOnMount:n=!0,autoClearSettlementsMs:a=8e3}=t;Ss();const{room:i,setRoom:o}=Li(),[c,u]=v.useState(FE),d=v.useRef(FE),[f,h]=v.useState([]),[m,_]=v.useState(null),[w,b]=v.useState(null),[E,T]=v.useState(null),[D,P]=v.useState([]),[A,C]=v.useState([]),[O,I]=v.useState(null),x=v.useRef(null),R=v.useRef(!1),N=v.useRef(0),L=v.useRef(new Map),{crapsListBets:j,crapsAddBet:q,crapsRemoveBet:U,crapsClearBets:Y,crapsSummarizeBets:F}=ga(),X=v.useCallback(G=>{if(!e)return;const ve=UE.get(e);if(ve)return G&&ve.then(he=>G(he)).catch(he=>G({ok:!1,error:String(he?.message||he)})),ve;const Oe=j(e);return UE.set(e,Oe),Oe.finally(()=>{UE.delete(e)}),G&&Oe.then(he=>G(he)).catch(he=>G({ok:!1,error:String(he?.message||he)})),Oe},[j,e]),J=v.useCallback((G,ve,Oe)=>{if(!e)return;const he=q(e,G,ve);return Oe&&he.then(Ce=>Oe(Ce)).catch(Ce=>Oe({ok:!1,error:String(Ce?.message||Ce)})),he},[q,e]),ee=v.useCallback((G,ve,Oe)=>{if(!e)return;const he=U(e,G,ve);return Oe&&he.then(Ce=>Oe(Ce)).catch(Ce=>Oe({ok:!1,error:String(Ce?.message||Ce)})),he},[U,e]),H=v.useCallback(G=>{if(!e)return;const ve=Y(e);return G&&ve.then(Oe=>G(Oe)).catch(Oe=>G({ok:!1,error:String(Oe?.message||Oe)})),ve},[Y,e]),B=v.useCallback(G=>{if(!e)return;const ve=F(e);return G&&ve.then(Oe=>G(Oe)).catch(Oe=>G({ok:!1,error:String(Oe?.message||Oe)})),ve},[F,e]),K=e&&r?`crapsbets:${e}:${r}`:null,ae=1800*1e3,te=v.useCallback(async()=>{if(K)try{const G=await Xf(K);if(!G)return;const ve=G.pass,Oe=G.dontPass,he=Array.isArray(G.place)?G.place:[],Ce=typeof G.ts=="number"?G.ts:void 0;if(Ce&&Date.now()-Ce>ae||!he?.length&&!ve&&!Oe)return;u(st=>{if(st.lastUpdated!==0||st.place.length+st.pass.length+st.dontPass.length>0)return st;const Ne={...st};return ve&&(Ne.pass=[{playerId:r,amount:ve}]),Oe&&(Ne.dontPass=[{playerId:r,amount:Oe}]),he?.length&&(Ne.place=he.map(St=>({playerId:r,point:St.point,amount:St.amount}))),Ne.lastUpdated=Date.now(),d.current=Ne,Ne})}catch{}},[K,r]);v.useEffect(()=>{te()},[te]);const pe=v.useCallback(async()=>{if(!(!K||!r||!e))try{const G=await Xf(K);if(!G)return;const ve=Number(G.pass||0),Oe=Number(G.dontPass||0),he=Array.isArray(G.place)?G.place:[],Ce=Date.now();try{await X()}catch{}const st=Date.now()+1200;for(;(d.current.lastUpdated||0)<=Ce&&Date.now()<st;)await new Promise(Je=>setTimeout(Je,120));if((d.current.lastUpdated||0)<=Ce)return;const Ne=d.current,St=(Ne.pass||[]).find(Je=>Je.playerId===r)?.amount||0,at=(Ne.dontPass||[]).find(Je=>Je.playerId===r)?.amount||0,Ke={};for(const Je of Ne.place||[])Je.playerId===r&&(Ke[Je.point]=(Ke[Je.point]||0)+Je.amount);const it=Math.max(0,ve-St),mt=Math.max(0,Oe-at);if(it>0)try{await q(e,"pass",it)}catch{}if(mt>0)try{await q(e,"dontPass",mt)}catch{}for(const Je of he){const ue=Number(Je.point),Be=Number(Je.amount||0),je=Number(Ke[ue]||0),ot=Math.max(0,Be-je);if(ot>0)try{const Pt=`place${ue}`;await q(e,Pt,ot)}catch{}}}catch{}},[K,r,e,X,c,q]),ce=v.useCallback(G=>{!G||typeof G!="object"||u(ve=>{const Oe={pass:Array.isArray(G.crapsPassBets)?G.crapsPassBets:ve.pass,dontPass:Array.isArray(G.crapsDontPassBets)?G.crapsDontPassBets:ve.dontPass,odds:Array.isArray(G.crapsOddsBets)?G.crapsOddsBets:ve.odds,place:Array.isArray(G.crapsPlaceBets)?G.crapsPlaceBets:ve.place,field:Array.isArray(G.crapsFieldBets)?G.crapsFieldBets:ve.field,big:Array.isArray(G.crapsBigBets)?G.crapsBigBets:ve.big,come:Array.isArray(G.crapsComeBets)?G.crapsComeBets:ve.come,dontCome:Array.isArray(G.crapsDontComeBets)?G.crapsDontComeBets:ve.dontCome,ats:Array.isArray(G.crapsAtsBets)?G.crapsAtsBets:ve.ats,lastUpdated:Date.now()};return d.current=Oe,Oe})},[]),Re=v.useCallback((G,ve,Oe)=>{if(!e||G!==e)return;h(ve),N.current+=1;const he={...Oe||{},_seq:N.current};_(he);try{o(st=>{if(!st||st.id!==e)return st;const Ne={...st.gameState||{}};return Ne.lastCrapsSettlementsTs=Date.now(),Ne.lastCrapsSettlements=ve,{...st,gameState:Ne}})}catch{}const Ce=new Map;for(const st of ve)st.outcome==="WIN"&&st.playerId&&Ce.set(st.playerId,(Ce.get(st.playerId)||0)+1);for(const[st,Ne]of Ce){const St=L.current.get(st)||0,at=St+Ne;if(L.current.set(st,at),St>=6&&at>St)gO(7,.55);else for(const Ke of[3,4,5,6])if(St<Ke&&at>=Ke){gO(Ke,.55);break}}x.current&&clearTimeout(x.current),x.current=setTimeout(()=>h([]),a)},[e,o,a]);Da({onCrapsRollResult:G=>{try{if(!e||G?.roomId!==e)return;const ve=Array.isArray(G?.events)?G.events:[],Oe=ve.includes("crapsOut")||ve.includes("CRAPS_OUT"),he=ve.includes("sevenOut")||ve.includes("SEVEN_OUT");if((Oe||he)&&L.current.clear(),he){u(Ce=>{if(!Ce.place.length)return Ce;const st={...Ce,place:[],lastUpdated:Date.now()};return d.current=st,st});try{o(Ce=>{if(!Ce||Ce.id!==e)return Ce;const st={...Ce.gameState||{}};return st.crapsPlaceBets=[],{...Ce,gameState:st}})}catch{}}}catch{}},onJoinedRoom:async({room:G})=>{try{if(G?.id&&G.id===e){try{await X()}catch{}try{await pe()}catch{}}}catch{}},onRejoinedRoom:async({room:G})=>{try{if(G?.id&&G.id===e){try{await X()}catch{}try{await pe()}catch{}}}catch{}},onCrapsReadyUpdate:G=>{try{if(Array.isArray(G?.readyPlayers)&&P(G.readyPlayers),Array.isArray(G?.requiredReadyPlayers)&&C(G.requiredReadyPlayers),G&&Object.prototype.hasOwnProperty.call(G,"deadline")){const ve=typeof G.deadline=="number"?G.deadline:null;I(ve)}}catch{}},onCrapsBetsUpdate:G=>{if(!e||G?.roomId!==e)return;const ve=G?.snapshot;if(ve){ce(ve);try{o(Oe=>{if(!Oe||Oe.id!==e)return Oe;const he={...Oe.gameState||{}};for(const Ce of Object.keys(ve))he[Ce]=ve[Ce];return he.gameMode||(he.gameMode="craps"),{...Oe,gameState:he}})}catch{}}K&&r&&(async()=>{try{const Oe=(ve?.crapsPassBets||[]).find(Ne=>Ne.playerId===r)?.amount||0,he=(ve?.crapsDontPassBets||[]).find(Ne=>Ne.playerId===r)?.amount||0,Ce=(ve?.crapsPlaceBets||[]).filter(Ne=>Ne.playerId===r).map(Ne=>({point:Ne.point,amount:Ne.amount})),st={v:1,ts:Date.now(),pass:Oe,dontPass:he,place:Ce};Oe||he||Ce.length?await Ab(K,st):await Jf(K)}catch{}})()},onCrapsBetResults:G=>{const ve=Array.isArray(G?.settlements)?G.settlements:[];Re(G?.roomId,ve,G?.roll)},onCrapsPointSet:G=>{if(!e||G?.roomId!==e)return;const ve=G.currentRollerId||G.nextRollerId||"unknown",Oe=`ptSet:${G.point}:${Array.isArray(G.dice)?G.dice.join("-"):""}:${ve}`;b({...G,_key:Oe});try{o(he=>{if(!he||he.id!==e)return he;const Ce={...he.gameState||{}};return Ce.gameMode=Ce.gameMode||"craps",Ce.crapsPoint=typeof G.point=="number"?G.point:G.point??null,Ce.crapsPhase=Ce.crapsPoint?"point":"come-out",G.currentRollerId!==void 0&&(Ce.currentRollerId=G.currentRollerId),Array.isArray(G.turnOrder)&&(Ce.turnOrder=G.turnOrder),{...he,gameState:Ce}})}catch{}},onCrapsPointMade:G=>{if(!e||G?.roomId!==e)return;const ve=G.currentRollerId||G.nextRollerId||"unknown",Oe=`ptMade:${G.point}:${Array.isArray(G.dice)?G.dice.join("-"):""}:${ve}`;T({...G,_key:Oe});try{o(he=>{if(!he||he.id!==e)return he;const Ce={...he.gameState||{}};return Ce.gameMode=Ce.gameMode||"craps",Ce.crapsPoint=null,Ce.crapsPhase="come-out",G.nextRollerId!==void 0&&(Ce.currentRollerId=G.nextRollerId),Array.isArray(G.turnOrder)&&(Ce.turnOrder=G.turnOrder),{...he,gameState:Ce}})}catch{}}}),v.useEffect(()=>{if(!e){u(FE),R.current=!1,h([]),_(null);return}const G=i?.gameState;G&&(G.crapsPassBets||G.crapsDontPassBets)&&ce(G),n&&!R.current&&(R.current=!0,X())},[e]),v.useEffect(()=>{if(!e)return;const G=async()=>{await new Promise(ve=>setTimeout(ve,300));try{await X()}catch{}try{await pe()}catch{}};return window.addEventListener("ad:complete",G),()=>{window.removeEventListener("ad:complete",G)}},[e,X,pe]),v.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]);const He=v.useMemo(()=>c.pass.reduce((G,ve)=>G+ve.amount,0),[c.pass]),ie=v.useMemo(()=>c.dontPass.reduce((G,ve)=>G+ve.amount,0),[c.dontPass]),xe=v.useMemo(()=>c.field.reduce((G,ve)=>G+ve.amount,0),[c.field]),re=v.useMemo(()=>r?{pass:c.pass.filter(G=>G.playerId===r).reduce((G,ve)=>G+ve.amount,0),dontPass:c.dontPass.filter(G=>G.playerId===r).reduce((G,ve)=>G+ve.amount,0)}:{pass:0,dontPass:0},[c.pass,c.dontPass,r]);return{betsState:c,recentSettlements:f,lastSettlementRoll:m,_persistKey:K,passTotal:He,dontPassTotal:ie,fieldTotal:xe,myLine:re,listBets:X,addBet:J,removeBet:ee,clearBets:H,summarize:B,clearRecentSettlements:()=>h([]),pointSetEvent:w,pointMadeEvent:E,readyPlayers:D,requiredReadyPlayers:A,readinessDeadline:O}}function b_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 Sc(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 Bh(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 Lu(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 mL(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 k_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 ff(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 w_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 S_e({balance:t,meId:e,readyPlayers:r}){const{user:n,meId:a}=Vr(),{room:i,setRoom:o}=Li(),c=i?.id??null,u=v.useMemo(()=>b_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}=Qz({roomId:c,myPlayerId:f}),D=Zz({roomId:c,myPlayerId:f}),P=v.useMemo(()=>Array.isArray(r)?r:Array.isArray(D.readyPlayers)&&D.readyPlayers.length>0?D.readyPlayers:E,[r,D.readyPlayers,E]),A=v.useMemo(()=>({addBet:D.addBet,removeBet:D.removeBet,clearBets:D.clearBets}),[D.addBet,D.removeBet,D.clearBets]),C=D.betsState||{},O=C.pass||[],I=C.dontPass||[],x=C.place||[],R=C.field||[],N=C.big||[],L=C.come||[],j=C.dontCome||[],q=C.odds||[],U=C.ats||[],Y=v.useMemo(()=>k_e(x,f),[x,f]),F=v.useMemo(()=>{let Be=0;for(const je of[4,5,6,8,9,10])Be+=Y[je]||0;return Be},[Y]),X=v.useMemo(()=>{const Be={};if(!f)return Be;const je=D.myLine?.pass??Sc(O,f),ot=D.myLine?.dontPass??Sc(I,f);je>0&&(Be.pass=je),ot>0&&(Be.dontPass=ot);for(const ur of[4,5,6,8,9,10]){const dr=Y[ur]||0;dr>0&&(Be[`place${ur}`]=dr)}const Pt=Sc(R,f);Pt>0&&(Be.field=Pt);const Ft=Lu(N,f,ur=>ur.kind==="big6");Ft>0&&(Be.big6=Ft);const Me=Lu(N,f,ur=>ur.kind==="big8");Me>0&&(Be.big8=Me);const tt=Sc(L,f);tt>0&&(Be.come=tt);const rt=Sc(j,f);rt>0&&(Be.dontCome=rt);const be=Lu(q,f,ur=>ur.passType==="pass");be>0&&(Be.oddsPass=be);const lt=Lu(q,f,ur=>ur.passType==="dontPass");lt>0&&(Be.oddsDontPass=lt);const yt=Lu(U,f,ur=>ur.kind==="atsSmall");yt>0&&(Be.atsSmall=yt);const tr=Lu(U,f,ur=>ur.kind==="atsTall");tr>0&&(Be.atsTall=tr);const Or=Lu(U,f,ur=>ur.kind==="atsAll");return Or>0&&(Be.atsAll=Or),Be},[f,D.myLine?.pass,D.myLine?.dontPass,O,I,Y,R,N,L,j,q,U]),J=v.useMemo(()=>{const Be=f;return Be?{pass:Bh(O,Be),dontPass:Bh(I,Be),field:Bh(R,Be),big6:mL(N,Be,je=>je.kind==="big6"),big8:mL(N,Be,je=>je.kind==="big8"),come:Bh(L,Be),dontCome:Bh(j,Be),place4:ff(x,Be,4),place5:ff(x,Be,5),place6:ff(x,Be,6),place8:ff(x,Be,8),place9:ff(x,Be,9),place10:ff(x,Be,10)}:{}},[f,O,I,R,N,L,j,x]),ee=v.useCallback(Be=>m(Be),[]),H=v.useRef(0),B=v.useCallback(()=>{if(!c||!f||!h.length)return;const Be=Date.now();if(!(Be-H.current<1e3)){H.current=Be;try{const je=Sc(O,f),ot=Sc(I,f),Pt=Y;for(const Ft of h){const Me=Ft.type;let tt=0;if(Me==="pass")tt=je;else if(Me==="dontPass")tt=ot;else if(Me.startsWith("place")){const lt=parseInt(Me.replace("place",""),10);tt=Pt[lt]||0}else continue;const rt=Math.max(0,Number(Ft.amount)||0),be=Math.max(0,rt-tt);if(be>0)try{A.addBet(Me,be)}catch{}}}catch{}}},[c,f,h,O,I,Y,A]);Da({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!(Sc(O,f)>=je.amount);if(je.type==="dontPass")return!(Sc(I,f)>=je.amount);if(je.type.startsWith("place")){const ot=parseInt(je.type.replace("place",""),10);return!((Y[ot]||0)>=je.amount)}return!0});Be.length!==h.length&&m(Be)},[f,O,I,Y,h]),v.useEffect(()=>{if(!c||!f||!o||!u)return;const Be=i?.gameState,je=Be?.currentRollerId;if(!je||je!==f)return;const ot=Be?.crapsPassBets,Pt=Be?.crapsDontPassBets;if(!(ot?.some(Me=>Me.playerId===f&&Me.amount>0)||Pt?.some(Me=>Me.playerId===f&&Me.amount>0)))try{o(Me=>{if(!Me||Me.id!==c)return Me;const tt=Me.gameState||{},rt=Array.isArray(tt.crapsPassBets)?tt.crapsPassBets.slice():[];return rt.push({playerId:f,amount:10}),{...Me,gameState:{...tt,crapsPassBets:rt,gameMode:tt.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}=Zo(),{displayPoint:pe,displayPhase:ce}=w_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 Re=i?.gameState,He=D.readinessDeadline??null,ie=D.requiredReadyPlayers??[],xe=__e({roomId:c,userId:d,shooterState:_,roomGameState:Re,pendingBets:h,myLineFromUnified:D.myLine,betsLastUpdated:D.betsState?.lastUpdated}),re=u?!0:xe;v.useEffect(()=>{try{if(!u)return;window.__debugCanRoll={canRoll:re,userId:n?.id,rolling:b,shooterState:_,roomGS:Re,readyPlayers:P,requiredReadyPlayers:ie,readinessDeadline:He}}catch{}},[re,n,b,_,Re,P,ie,He,u]);const G=!c,ve=v.useMemo(()=>{const Be=i?.gameState?.currentRollerId;return f?Be===f:!1},[i?.gameState,f]),Oe=!!(f&&P.includes(f)),[he,Ce]=v.useState(!1);v.useEffect(()=>{Oe&&Ce(!1)},[Oe]);const st=v.useRef(null),Ne=v.useCallback(()=>{if(!(!c||!f||he||Oe)){Ce(!0);try{T()}catch{}st.current&&window.clearTimeout(st.current),st.current=window.setTimeout(()=>{Ce(!1)},5e3)}},[c,f,he,Oe,T]);v.useEffect(()=>()=>{st.current&&window.clearTimeout(st.current)},[]);const[St,at]=v.useState(Date.now());v.useEffect(()=>{if(!He)return;const Be=window.setInterval(()=>at(Date.now()),1e3);return()=>window.clearInterval(Be)},[He]);const Ke=v.useMemo(()=>{try{const Be=i?.gameState?.currentRollerId??null;if(!Be)return null;const je=i?.players?.find(ot=>ot.id===Be);return je?.name||je?.id||null}catch{return null}},[i?.gameState,i?.players]),it=5,mt=500,Je=v.useMemo(()=>[1,5,10,25,100],[]);return g.jsx(g_e,{roomId:c,balance:t,point:pe,phase:ce,shooterName:Ke,minBet:it,maxBet:mt,oddsMultiple:{pass:3,dontPass:3,place:1},chips:Je,pendingBets:h,onChangeBets:ee,onClearAll:()=>{m([]),A.clearBets()},disabled:G,onRoll:()=>w(),canRoll:re,myPlayerPlaceTotal:F,myCommittedByType:X,readyPlayers:P,meId:f,onBetDelta:K,showReadyButton:!ve,onReadyClick:Ne,readyStateLabel:"Ready",readyButtonDisabled:!1,recentSettlements:D.recentSettlements,myPlayerLineTotals:D.myLine,othersTotals:J})}function E_e({balance:t,meId:e,readyPlayers:r}){return g.jsx("div",{className:"craps-bet-panel",children:g.jsx(S_e,{balance:t,meId:e,readyPlayers:r})})}function T_e(){const{infoNow:t}=Cs(),{room:e}=Li(),{meId:r}=Vr(),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 Da({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 D=f(T.playerId),P=Math.max(0,Math.trunc(Number(T.amount)||0));P>0&&t("Main bet placed",`+z${P} — ${D}`)}else if(T.type==="SIDE"){const D=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 ${D}`)}else{if(a&&r&&T.playerId===r)continue;P>0&&t("Side bet created",`+z${P} — on ${D}`)}}}for(const[T,D]of b.entries()){const P=E.get(T);if(D&&D.type==="SIDE"&&P&&P.type==="SIDE"&&!D.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,D]of b.entries()){if(D?.type!=="SIDE")continue;if(!E.has(T)&&!D.acceptedById){const A=f(D.subjectId),C=Math.max(0,Math.trunc(Number(D.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=(D,P)=>{w.set(D,(w.get(D)||0)+(Number.isFinite(P)?P:0))},E=D=>{const P=D.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=D=>Array.isArray(D)?D:[];for(const{playerId:D,amount:P}of T(m.crapsPassBets))b(`${D}|pass`,P);for(const{playerId:D,amount:P}of T(m.crapsDontPassBets))b(`${D}|dontPass`,P);for(const{playerId:D,amount:P}of T(m.crapsFieldBets))b(`${D}|field`,P);for(const{playerId:D,kind:P,amount:A}of T(m.crapsBigBets))b(`${D}|${P}`,A);for(const{playerId:D,point:P,amount:A}of T(m.crapsPlaceBets))b(`${D}|place:${P}`,A);for(const{playerId:D,amount:P,status:A,point:C}of T(m.crapsComeBets))b(`${D}|come${A==="POINT"&&C?":"+C:""}`,P);for(const{playerId:D,amount:P,status:A,point:C}of T(m.crapsDontComeBets))b(`${D}|dontCome${A==="POINT"&&C?":"+C:""}`,P);if(_.size===0){u.current=w;return}for(const[D,P]of w.entries()){const A=_.get(D)||0,C=Math.trunc(P-A);if(C>0){if(r&&D.startsWith(r+"|"))continue;t("Bet Placed",`+z${C} — ${E(D)}`)}}u.current=w}catch{}}}),v.useEffect(()=>{},[]),null}function C_e(t,e){const{rollDice:r,placeMainBet:n,cancelMainBet:a,createSideBet:i,acceptSideBet:o,cancelSideBet:c,confirmBets:u,bankerGiveUp:d,setSpectate:f,getWagers:h}=ga(),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 x_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 gL(t,e){return e&&t.find(n=>n.id===e)?.name||"Anonymous"}function P_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 qE(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 Xf(t);!i&&o!==null&&n(o)}catch{}a.current=!0})(),()=>{i=!0}},[t]),v.useEffect(()=>{t&&a.current&&(async()=>{try{await Ab(t,r)}catch{}})()},[t,r]),[r,n]}function UA(t,e,r){const{info:n}=uP(),a=r?.autoJoin??!0,i=rn(),o=cu(),{leaveRoom:c}=ga(),{joinRoom:u}=Li(),d=u,f=C_e(t||null),{reveal:h,rollTrigger:m,triggerSpin:_}=Zo(),{user:w}=Vr(),[b,E]=v.useState(null),{room:T}=Li(),P=(()=>{try{return Li&&Li()}catch{return null}})()?.setRoom??null;v.useRef(null);const[A,C]=v.useState(!0),[O,I]=v.useState(null),[x,R]=v.useState(null),N=v.useRef(null),L=v.useRef(null);v.useRef([]);const[j,q]=v.useState(!0),[U,Y]=v.useState(void 0),[F,X]=qE(t?`gp:${t}:${e}:deadline`:void 0,30),[J,ee]=qE(t?`gp:${t}:${e}:serverNow`:void 0,30),[H,B]=qE(t?`gp:${t}:${e}:feed`:void 0,[]),[K,ae]=v.useState([]),[te,pe]=v.useState(null),[ce,Re]=v.useState([]),[He,ie]=v.useState(!1),[xe,re]=v.useState(!1),G=v.useRef(null),ve=v.useRef(null);v.useEffect(()=>{t&&(async()=>{try{await Jf(`gp:${t}:${e}:diceSettled`),await Jf(`gp:${t}:${e}:diceResults`)}catch{}})()},[t,e]),v.useEffect(()=>()=>{G.current&&(window.clearTimeout(G.current),G.current=null)},[]),v.useEffect(()=>{if(!b||!b.singlePlayer){ie(!1),re(!1),G.current&&(window.clearTimeout(G.current),G.current=null),ve.current=null;return}const tt=(b.gameState?.gameMode||b.gameState?.mode)==="craps"?1:3;if(b.players.length>=tt+1){xe||re(!0),ie(!1),G.current&&(window.clearTimeout(G.current),G.current=null),ve.current=null;return}xe||(G.current||(G.current=window.setTimeout(()=>{ie(!0),G.current=null},250)),ve.current?Date.now()>ve.current&&(re(!0),ie(!1)):ve.current=Date.now()+5e3)},[b,xe]);const Oe=r?.listeners??!0;Da(Oe?{onJoinedRoom:({room:Me})=>{E(Me),B(tt=>[{kind:"system",message:`You joined ${Me.name}`,ts:Date.now()},...tt]);try{j===!1&&(L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{j===!1&&!N.current&&q(!0),L.current=null},la.diceSettleClientMs));const tt=Me?.gameState||{};!tt?.bankRoll&&!tt?.lastRoll&&j===!1&&!N.current&&q(!0)}catch{}},onRejoinedRoom:({room:Me})=>{E(Me),B(tt=>[{kind:"system",message:`Rejoined ${Me.name}`,ts:Date.now()},...tt])},onOtherLeft:({room:Me})=>{E(Me)},onOtherPlayerJoined:({room:Me})=>{E(Me),B(tt=>[{kind:"system",message:"Another player joined.",ts:Date.now()},...tt])},onSpectatorsUpdated:Me=>{const{spectators:tt,roundSeq:rt}=Me||{};E(be=>{if(!be)return be;const lt=be.gameState?.roundSeq;return typeof rt=="number"&&typeof lt=="number"&&rt!==lt?be:{...be,gameState:{...be.gameState,spectators:tt??[]}}})},onDiceRolled:Me=>{const{rollerId:tt,results:rt,rank:be,room:lt,deadline:yt,serverNow:tr}=Me;X(yt),q(!1),L.current&&(window.clearTimeout(L.current),L.current=null),N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{q(!0),lt&&E(lt);try{N.current&&window.clearTimeout(N.current)}catch{}N.current=null},la.diceSettleClientMs),ee(tr),R(tt),_(),Y(rt)},onBetsUpdated:Me=>{setTimeout(()=>{Me.room&&E(Me.room)},2e3)},onSideBetCreated:Me=>{if(!Me||Me.acceptedById||!Me.subjectId||Me.subjectId!==e)return;const rt=`${gL(b?.players??[],Me.playerId)} offered: ${P_e(Me.predicate)} for $${Me.amount}`;o.info(rt,{title:"New Side Bet"})},onLobbyRooms:void 0,onNotYourTurn:()=>{B(Me=>[{kind:"system",message:"It’s not your turn.",ts:Date.now()},...Me])},onForceLogout:Me=>{Me?.reason==="session_superseded"?(V3(),B(tt=>[{kind:"system",message:"You logged in from another device.",ts:Date.now()},...tt])):B(tt=>[{kind:"system",message:"You were logged out.",ts:Date.now()},...tt]),i("/login",{replace:!0})},onError:Me=>I(Me),onTurnOrderUpdated:Me=>{if(!Me.room||!Me.room.gameState)return;E(Me.room);const tt=gL(Me.room.players,Me.banker);B(rt=>[{kind:"system",message:`${tt} is now the banker for the new round.`,ts:Date.now()},...rt])},onRoomUpdateState:Me=>{const{roomId:tt,gameState:rt,room:be}=Me||{},lt=be?.gameState??rt;!tt||!lt||E(yt=>{if(!yt||yt.roomId!==tt||yt?.id!==tt)return{...yt,gameState:lt};const tr=yt.gameState?.roundSeq,Or=lt?.roundSeq,ur=typeof tr=="number"&&typeof Or=="number"&&tr!==Or,dr={...yt,gameState:{...yt.gameState,...lt}};if(ur){try{q(!0)}catch{}try{Y(void 0)}catch{}try{R(null)}catch{}}return dr})}}:{}),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},la.diceSettleClientMs)):j===!0&&L.current&&(window.clearTimeout(L.current),L.current=null)},[j]);const Ce=v.useRef(null),st=v.useRef(void 0),Ne=v.useRef(!1);Ce.current=d,v.useEffect(()=>{if(!a)return;let Me=!1;if(st.current!==t)return st.current=t,Ne.current=!1,(async()=>{if(!t){I("No room id provided."),C(!1);return}if(C(!0),I(null),!Ce.current){I("No join ref");return}const tt=(()=>{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 rt=null;try{tt?rt=await Promise.race([Ce.current(t),new Promise(lt=>setTimeout(()=>lt({ok:!1,error:"e2e-timeout"}),1800))]):rt=await Ce.current(t)}catch(be){if(!tt){I(be?.message||"Failed to join room."),C(!1);return}}if(typeof window<"u"&&(window.__e2eJoinAttempt={roomId:t,res:rt,ts:Date.now()}),!Me){if(!rt?.ok){if(!tt){I(rt?.error??"Failed to join room."),C(!1);return}const be=Date.now(),lt=w?.id||"e2e-user",yt=w?.name||"E2E User",Or=((()=>{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",ur=[{id:lt,name:yt,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],dr=Or?{id:t,name:"E2E Cee-Lo Room",gameMode:"cee-lo",createdAt:be,updatedAt:be,bankerId:lt,players:ur,gameState:{gameMode:"cee-lo",currentRollerId:lt,banker:lt,turnOrder:[lt],roundSeq:1,bankRoll:null,turnHistory:[]}}:{id:t,name:"E2E Craps Room",gameMode:"craps",createdAt:be,updatedAt:be,bankerId:"bank",players:ur,gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:lt,turnOrder:[lt],roundSeq:1,crapsPassBets:[],crapsDontPassBets:[],crapsPlaceBets:[]}};E(dr);try{P?.(dr)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:dr.id,players:dr.players.map(fn=>fn.id),gameMode:dr.gameState.gameMode,ts:Date.now()}),C(!1);return}E(rt.room);try{P?.(rt.room)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:rt.room?.id,players:rt.room?.players?.map(be=>be.id),gameMode:rt.room?.gameState?.gameMode,ts:Date.now()});try{rp("room_join",{roomId:t})}catch{}C(!1)}})(),()=>{Me=!0,st.current===t&&(st.current=void 0)}},[t,a]);const St=v.useMemo(()=>{if(!b||!e)return!1;const Me=b.gameState||{};return(Me?.gameMode??"cee-lo")==="craps",Me?.currentRollerId===e},[b,e]),at=v.useMemo(()=>!b||!e?!1:(b.gameState||{})?.banker===e,[b,e]),{open:Ke,openAll:it}=v0(t,e),mt=v.useMemo(()=>(Ke||[]).some(Me=>Me.type==="MAIN"&&Number(Me.amount)>0),[Ke]),Je=v.useMemo(()=>(it||[]).some(Me=>Me.type==="MAIN"),[it]),ue=b?.gameState?.currentRollerId??null,Be=v.useMemo(()=>{const Me=b?.gameState||T?.gameState||{},tt=Me?.gameMode??"cee-lo",rt=!!Me?.roundEnded;if(tt==="craps"){const tr=!!St&&!!j&&!rt;return pe(tr?null:St?j?"Round transition in progress":"Dice not settled":"Not your turn"),Re([]),tr}if(!Me?.currentRollerId)return pe("Initializing…"),Re([]),!1;const be=!b?.singlePlayer;if(at&&be&&!Je)return pe("No open challenges"),Re([]),!1;const lt=!!Me?.bankRoll,yt=x_e({isMyTurn:St,isBanker:at,diceSettled:j,hasMainBetPlaced:mt,bankPointExists:lt,roundEnded:rt});return pe(yt.reason??null),Re([]),yt.canRoll},[b?.gameState,T?.gameState,St,at,mt,j,Je,b?.singlePlayer]),je=v.useCallback(()=>{t&&(c(t),i("/lobby"))},[t,c,i]),ot=v.useCallback(()=>{if(!t||!Be)return;const Me=!b?.singlePlayer;if(at&&Me&&!Je){try{n("No open challenges")}catch{}return}if(!at&&!mt){try{n("No open challenges")}catch{}return}try{rp("roll_click",{game:"cee-lo",role:at?"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 tt=await f.roll(),rt=tt?.error||tt?.message||"";if(!tt||tt.ok===!1){if(q(!0),/no open main bets/i.test(rt)){const be=!!b?.singlePlayer;try{f.refreshWagers()}catch{}if(!be||!at)try{n("No open challenges")}catch{}return}return}})()},[t,f,_,Be,at,mt,Je,b?.gameState]),Pt=v.useCallback(async()=>{if(t)return f.giveUpBank?.()},[t,f]),Ft=v.useCallback(async Me=>{if(t)return f.spectate?.(Me)},[t,f]);return{room:b,joining:A,botsHydrating:He,error:O,isMyTurn:St,isBanker:at,lastRollerId:x,rollTrigger:m,diceSettled:j,diceResults:U,deadline:F,serverNow:J,canRoll:Be,canRollReason:te,canRollBlocking:ce,handleRoll:ot,handleLeave:je,giveUpBank:Pt,setSpectateMode:Ft,currentRollerId:ue,readyPlayers:K}}function A_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=cu(),[_,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,R)=>{if(!a)return;if(R&&h?.(R)){m.info("Subject already rolled. Side bets are closed for this subject.");return}try{Lr()}catch{}const N=await a(x);N.ok||m.error(N.error||"Failed to accept side bet")},[a,h,m]),D=v.useCallback((x,R)=>{const N=(R||"").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(R=>R.id===x)?.name||"Player":"Player",[e]);v.useEffect(()=>{const x=R=>{b.current&&!b.current.contains(R.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 R=P(x.subjectId),N=D(R,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(Qs,{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 R=P(x.subjectId),N=D(R,x.predicate),L=x.acceptedById,j=x.playerId===t,q=P(j?L||void 0:x.playerId),U=!!L,Y=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(Qs,{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 "+(Y?"felt-btn--danger":"felt-btn--secondary"),"aria-label":"Cancel side bet",title:Y?"Cancel this side bet":F||"Cannot cancel",disabled:!Y||!!u,onClick:async()=>{if(!Y)return;try{Lr()}catch{}const X=await n(x.id);X.ok||m.error(X.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 R_e({roomId:t,meId:e,bankerId:r,players:n,gameState:a,gameplay:i}){const o=cu(),c=r===e,{myOpenMain:u,myOpenSides:d,placeSideBet:f,cancelSideBet:h,acceptSideBet:m,offersToMe:_,newOfferCount:w,markOffersAsSeen:b}=v0(t,e),E=UA(t,e,{autoJoin:!1}),T=i?.giveUpBank??E.giveUpBank,D=i?.setSpectateMode??E.setSpectateMode,P=!!a?.betsLocked,A=!!a?.bankRoll,C=a?.spectators??[],O=C.includes(e),x=!c&&!P&&!A&&!!!u,R=c&&!P&&!A,N=v.useCallback(async()=>{try{Lr()}catch{}const U=await D(!O);U&&!U.ok&&o.error(U.error||"Failed to update spectate mode")},[D,O,o]),L=v.useCallback(async()=>{try{Lr()}catch{}try{}catch{}try{await ld("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(Y=>(Y.roundSeq??j)===j):U},[a,j]);return g.jsxs(g.Fragment,{children:[c&&g.jsx("button",{className:"btn btn--ghost",disabled:!R,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(A_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(Y=>Y.playerId===U&&(Y.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 bd({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 D_e=new TextEncoder;function O_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 N_e(t){const e=await crypto.subtle.digest("SHA-256",D_e.encode(t));return O_e(e)}async function I_e(t,e){return!t||!e?!1:(await N_e(t)).toLowerCase()===e.toLowerCase()}const zE=(t,e)=>`${t}:${e}`;function e6(t){const[e,r]=v.useState({}),[n,a]=v.useState({}),i=v.useRef({});v.useEffect(()=>{r({}),a({}),i.current={}},[t]),Da({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=zE(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=zE(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=zE(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 I_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 ca=null,w_=null,XC=null;async function Gg(){if(ca)return!0;try{const t=await zr(()=>import("./index-DpGGSCfG.js"),[],import.meta.url);return ca=t.AdMob,w_=t.RewardAdPluginEvents,XC=t.InterstitialAdPluginEvents,!0}catch{return!1}}let mp=!1;async function Mp(){if(mp)return!0;if(Wr.getPlatform()==="web"||!await Gg()||!ca)return!1;try{return await ca.initialize({requestTrackingAuthorization:!0,initializeForTesting:Wg??!1}),mp=!0,!0}catch{return!1}}const Wg=typeof process<"u"&&!1;function t6(){const t=Wr.getPlatform();return t==="ios"?A9:XD}function r6(){const t=Wr.getPlatform();return t==="ios"?j9:JD}async function M_e(){if(Wr.getPlatform()==="web"||!await Gg()||!ca)return!1;mp||await Mp();try{const r=t6();return await ca.prepareRewardVideoAd({adId:r,isTesting:Wg??!1}),!0}catch{return!1}}async function j_e(){return Wr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Gg()||!ca?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!mp&&!await Mp()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{let n=!1,a,i;const o=ca.addListener(w_.Rewarded,f=>{n=!0,a=f?.type||"chips",i=f?.amount||hf}),c=ca.addListener(w_.Dismissed,()=>{d(),r(n?{ok:!0,rewardType:a,rewardAmount:i}:{ok:!1,error:"AD_DISMISSED"})}),u=ca.addListener(w_.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=t6();await ca.prepareRewardVideoAd({adId:f,isTesting:Wg??!1}),await ca.showRewardVideoAd()}catch(f){d(),r({ok:!1,error:f?.message||"UNKNOWN_ERROR"})}})}async function Nf(){if(Wr.getPlatform()==="web"||!await Gg()||!ca)return!1;mp||await Mp();try{const r=r6();return await ca.prepareInterstitial({adId:r,isTesting:Wg??!1}),!0}catch{return!1}}async function S_(){return Wr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Gg()||!ca?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!mp&&!await Mp()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{const n=ca.addListener(XC.Dismissed,()=>{i(),r({ok:!0}),Nf().catch(()=>{})}),a=ca.addListener(XC.FailedToShow,o=>{i(),r({ok:!1,error:"FAILED_TO_SHOW"})}),i=()=>{try{n?.remove?.()}catch{}try{a?.remove?.()}catch{}};try{const o=r6();await ca.prepareInterstitial({adId:o,isTesting:Wg??!1}),await ca.showInterstitial()}catch(o){i(),r({ok:!1,error:o?.message||"UNKNOWN_ERROR"})}})}function n6(){const t=Wr.getPlatform();return t==="ios"||t==="android"}const $E={initializeAdMob:Mp,prepareRewardedAd:M_e,showRewardedAd:j_e,prepareInterstitialAd:Nf,showInterstitialAd:S_,isNativeAdSupported:n6},yL=w3,vL=S3,_L=E3,VE="ad:complete",a6=v.createContext({onHandEnd:async()=>{},onCrapsShooterTurnEnd:async()=>{},showAdNow:async()=>{},isAdEnabled:!1,isAdShowing:!1,adConfig:{handsPerAd:S3,crapsShooterTurnsPerAd:E3,minIntervalMs:zh,displayDelayMs:$h}}),S0=()=>v.useContext(a6);function L_e({children:t}){const[e,r]=v.useState(!1),[n,a]=v.useState(!1),i=n6(),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=Mi();if(!T)return;const P=(await T.getCustomerInfo?.())?.entitlements?.active||{},A=Object.keys(P).length>0;let C=!1;yL&&(C=!!P?.[yL]||A),r(C)}catch{}};b();const E=setInterval(b,6e4);return()=>clearInterval(E)},[]),v.useEffect(()=>{o&&Nf().catch(()=>{})},[o]);const h=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<zh)&&(u.current+=1,!(u.current<vL))){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,$h));try{await S_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(VE))}catch{}Nf().catch(()=>{})}}},[o]),m=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<zh)&&(d.current+=1,!(d.current<_L))){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,$h));try{await S_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(VE))}catch{}Nf().catch(()=>{})}}},[o]),_=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<zh)){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,$h));try{await S_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(VE))}catch{}Nf().catch(()=>{})}}},[o]),w={handsPerAd:vL,crapsShooterTurnsPerAd:_L,minIntervalMs:zh,displayDelayMs:$h};return g.jsx(a6.Provider,{value:{onHandEnd:h,onCrapsShooterTurnEnd:m,showAdNow:_,isAdEnabled:o,isAdShowing:n,adConfig:w},children:t})}const i6=ui();async function B_e(t){if(!t)return null;try{const e=await li(),r=`${i6}/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 U_e(t){if(!t)return null;try{const e=await li(),n=await(await fetch(`${i6}/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 s6=""+new URL("avatars-BLAbFok_.webp",import.meta.url).href,o6=""+new URL("avatars2-BhCQ9Hmk.webp",import.meta.url).href,c6=""+new URL("bikini_avatars-D9_A_byG.webp",import.meta.url).href,l6=""+new URL("bikini_avatars2-CqEDCn9Y.webp",import.meta.url).href,u6=""+new URL("car_avatars-C2asmsaV.webp",import.meta.url).href,d6=""+new URL("cowboy_avatars-Dh4o-H8O.webp",import.meta.url).href,f6=""+new URL("surf_avatars-BNzNQWcq.webp",import.meta.url).href,p6=""+new URL("surf_avatars2-CP3KwVoE.webp",import.meta.url).href,h6=""+new URL("toy_avatars-CYoTJdP7.webp",import.meta.url).href,m6=[s6,o6,c6,l6,u6,d6,f6,p6,h6];function F_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 bL({seed:t}){const e=F_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 q_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")},D=()=>{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",D),()=>{window.removeEventListener("ui:roll",E),window.removeEventListener("ui:placeMainBet",E),window.removeEventListener("ui:cancelMainBet",E),document.removeEventListener("visibilitychange",T),m.removeEventListener("pause",D)}},[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(bL,{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(bL,{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 z_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 $_e=v.memo(q_e,z_e),g6=v.createContext(void 0),V_e=({children:t})=>{const{user:e}=Vr(),[r,n]=v.useState([]),[a,i]=v.useState([]),[o,c]=v.useState([]),{blockUser:u,unblockUser:d,getFriendsList:f,sendFriendRequest:h,unfriend:m,respondFriendRequest:_}=ga();Da({onFriendRequestReceived:x=>{x?.request&&i(R=>[...R.filter(N=>N.id!==x.request.id),x.request])},onFriendRequestCancelled:x=>{x?.requestId&&i(R=>R.filter(N=>N.id!==x.requestId))},onFriendRequestResponded:x=>{x?.requestId&&x?.action&&i(R=>R.map(N=>N.id===x.requestId?{...N,status:x.action==="ACCEPT"?"ACCEPTED":"DECLINED"}:N))},onUnfriended:x=>{x?.byUserId&&n(R=>R.filter(N=>N.id!==x.byUserId))},onUserBlocked:x=>{x?.byUserId&&c(R=>R.find(N=>N.id===x.byUserId)?R:[...R,{id:x.byUserId}])},onUserUnblocked:x=>{x?.byUserId&&c(R=>R.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(R=>{R?.ok&&n(N=>N.filter(L=>L.id!==x))}).catch(()=>{})},[m]),T=v.useCallback(x=>{i(R=>[...R.filter(N=>N.id!==x.id),x])},[]),D=v.useCallback(x=>{i(R=>R.map(N=>N.id===x.id?x:N))},[]),P=v.useCallback(x=>{i(R=>R.filter(N=>N.id!==x))},[]),A=v.useCallback(async(x,R)=>{try{(await _(x,R))?.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(R=>R.id===x),[o]);return g.jsx(g6.Provider,{value:{friends:r,friendRequests:a,blockedUsers:o,addFriend:b,removeFriend:E,addFriendRequest:T,updateFriendRequest:D,removeFriendRequest:P,respondToFriendRequest:A,blockUser:C,unblockUser:O,isBlocked:I,refreshSocial:w},children:t})};function FA(){const t=v.useContext(g6);if(!t)throw new Error("useSocial must be used within a SocialProvider");return t}function y6(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,R=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+R,e.top-A.height-I)),L<I+N+R&&(L=I+N+R),j<I&&(j=I),_({top:L,left:j})},[e,w]),v.useEffect(()=>{const P=x=>{if(Date.now()-T.current<120)return;const R=x.target;r&&(r===R||r.contains(R))||E.current&&(E.current.contains(R)||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 D=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"?Wc.createPortal(D,document.body):D}function v6({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:_}=FA(),w=u.some(b=>b.status==="PENDING"&&b.fromUserId===o&&b.toUserId===t);return g.jsx(y6,{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 H_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:D},P){const A=Sye(r);return g.jsxs(Js.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($_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 ${mb(i)}`,children:mb(i)})]}),a&&g.jsx("span",{className:"status-dot","aria-hidden":!0}),!a&&D&&g.jsx("span",{className:`presence-dot presence-dot--${D}`,"aria-label":D==="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(v6,{..._})]})}),_6=[s6,o6,c6,l6,u6,d6,f6,p6,h6];function G_e(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)>>>0;return e%(_6.length*6)}function W_e({seed:t}){const e=G_e(t),r=Math.floor(e/6),n=e%6,a=_6[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 E_({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(W_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 qA(){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 b6({players:t,meId:e,className:r,onOpenDM:n,onOpenSendMoney:a,renderActionsOverride:i}){const{forUserId:o,anchorRect:c,anchorEl:u,openFor:d,close:f}=qA(),h=(_,w)=>{!w||_===e||d(_,w)},m=()=>f();return g.jsxs("div",{className:r,children:[g.jsx(E_,{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(v6,{targetId:o,anchorRect:c,anchorEl:u,onClose:m,onOpenDM:n,onOpenSendMoney:a,meId:e})]})}function K_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;Sm(_,m.playerId===e)!=="nothing"&&f(m.playerId)}d.current=t.length},[t,f,e]),v.useEffect(()=>{if(!e||!r.bankRoll?.raw)return;Sm(r.bankRoll.raw)!=="nothing"&&f(e)},[e,r.bankRoll,f]),{revealedPlayers:a.current,revealTimesRef:i,revealVersion:o,markRevealed:f}}function Y_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 X_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 zA(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=md(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(Y_e(t.predicate)),t.subjectId&&_.push(`on ${t.subjectId}`),_.length&&(o=_.join(" "))}}return{outcome:n,isChallenger:a,subtitle:o,needsAnimation:i}}function J_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 k6(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 Q_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",Z_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",ebe="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",tbe="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",rbe="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",nbe="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",abe={1:Q_e,2:Z_e,3:ebe,4:tbe,5:rbe,6:nbe};function ibe({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:abe[e],alt:`Dice face ${e}`,style:{width:22,height:22,borderRadius:"4px"}},r))})}function $A(){const[t,e]=v.useState(!1),[r,n]=v.useState(!0);v.useEffect(()=>{let i=!0;return(async()=>{try{const o=await au();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 au(),u={...Oc,...c,showAnimations:o};await y0(u)}catch{}},[r]);return{ready:t,showAnimations:r,toggleAnimations:a}}function w6({anim:t,onComplete:e}){const{showAnimations:r}=$A(),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 _=LA(o),w=Math.max(0,i.startDelaySec??.25),b=Math.min(8,Math.ceil(_.length/2)),E=(_.length-1)/2;h.current=_.map((T,D)=>({id:`${t.id}-sub-${D}`,value:T,delay:w+D*.05,yOffset:(D-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,D=u-18+w.yOffset,P=f-18+w.yOffset;return g.jsx(Js.div,{initial:{x:E,y:D,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(Qs,{mini:!0,value:w.value,className:"chip--flight"})},w.id)})})()})}const JC=new Set;function sbe(t){return JC.add(t),()=>JC.delete(t)}function obe(t){t&&JC.forEach(e=>{try{e(t)}catch{}})}function cbe({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(R=>(w.current.add(R),R),[]),D=v.useCallback(()=>{w.current.forEach(R=>clearTimeout(R)),w.current.clear(),b.current!=null&&(cancelAnimationFrame(b.current),b.current=null)},[]);v.useEffect(()=>()=>{D()},[D]);const P=v.useCallback(R=>r(R),[r]),A=v.useCallback(R=>J_e(R,P),[P]),C=v.useCallback((R,N=0)=>{if(c&&R?.type==="MAIN"){const J=R?.playerId,ee=R?.acceptedById||R?.bankerId;if(!(!!J&&c(J)&&!!ee&&c(ee))){T(setTimeout(()=>C(R,N),120));return}}const j=R?.acceptedById||R?.bankerId,q=R?.playerId;if(!j||!q){if(N>25)return;const J=80+N*60;T(setTimeout(()=>C(R,N+1),J));return}const U=String(R.result||"").toUpperCase();let Y,F;if(U==="WIN"?(Y=j,F=q):U==="LOSE"&&(Y=q,F=j),Y&&F){const J=P(Y),ee=P(F);if(!J||!ee){if(N>25)return;if(N<5&&typeof requestAnimationFrame<"u")b.current=requestAnimationFrame(()=>C(R,N+1));else{const H=80+N*60;T(setTimeout(()=>C(R,N+1),H))}return}}if(N>25)return;const X=A(R);if(!X){const J=80+N*60;N<5&&typeof requestAnimationFrame<"u"?b.current=requestAnimationFrame(()=>C(R,N+1)):T(setTimeout(()=>C(R,N+1),J));return}f(J=>[...J,[X]])},[A,c,T]);v.useEffect(()=>{if(!t.length)return;const R=k6(t,e,_.current,o);for(const N of R){if(E.current.has(N.id))continue;E.current.add(N.id);const{outcome:L,needsAnimation:j}=zA(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(R=>R.slice(1)))},[h.length,d]);const O=v.useCallback(R=>{m(N=>{const L=N.filter(q=>q.id!==R),j=N.find(q=>q.id===R);try{j?.settlementId&&typeof u=="function"&&u(j.settlementId),j?.settlementId&&(obe(j.settlementId),_.current.add(j.settlementId))}catch{}return L})},[u]),I=v.useCallback(()=>{D(),f([]),m([]),_.current.clear(),E.current.clear()},[D]),x=v.useCallback(R=>{R?.length&&f(N=>[...N,R])},[]);return{activeBatch:h,handleAnimItemComplete:O,resetForRound:I,queueBatch:x}}function lbe(){const{hasActive:t}=Cs(),e=v.useRef([]),r=v.useRef(!1),n=v.useRef(null),a=v.useRef(new Set),i=v.useCallback(()=>{ld("Light").catch(()=>{})},[]),o=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),c=la?.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,D=T.challengerId?T.getRevealTime(T.challengerId):void 0,P=T.bankerId?T.getRevealTime(T.bankerId):void 0;if(typeof D=="number"&&typeof P=="number"){const C=Math.max(D,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 ube({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}=Cs(),m=v.useRef(new Set),{schedule:_,nudge:w}=lbe(),b=v.useRef(null),E=v.useRef(!1),T=v.useRef(!1);v.useRef(new Set);const D=v.useRef(null);v.useEffect(()=>{const C=n;if(!C||C.length!==3){b.current=null,E.current=!1;return}const O={};for(const R of C)O[R]=(O[R]||0)+1;const I=Object.keys(O).map(Number);I.length===2&&I.some(R=>O[R]===1)?b.current=I.find(R=>O[R]===1):b.current=null;try{const R=[...C].sort((N,L)=>N-L).join(",");E.current=R==="4,5,6",T.current=R==="1,2,3"}catch{E.current=!1,T.current=!1}},[n]);const P=v.useCallback((C,O,I,x,R)=>{const N=O?" Clutch":"";x?C==="win"?d(`${x}${N}`):C==="lose"?f(x):h(x):R?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,R,N={})=>{const L=O&&(b.current??0)>5&&C==="win";_(()=>P(C,L,I,x,R),N)},[_,P]);v.useEffect(()=>{const C=k6(t,e,m.current,u);if(C.length)for(const O of C){const{outcome:I,isChallenger:x,subtitle:R,needsAnimation:N}=zA(O,r);if(!I)continue;let L=R,j=!1;if(O.type==="SIDE"){const te=O.subjectId&&a(O.subjectId)||O.subjectId||"Player",pe=X_e(O.predicate);let ce;I==="win"?ce=`${te} ${pe}`:I==="lose"?pe==="beats banker"?ce=`${te} does not beat banker`:pe==="loses to banker"?ce=`${te} does not lose to banker`:pe==="ties banker"?ce=`${te} does not tie banker`:ce=`${te} ${pe}`:ce=`${te} ${pe}`,L=ce,j=!0}else R&&O.subjectId&&R.includes("on ")&&(L=R.replace(/on \S+$/,`on ${a(O.subjectId)||O.subjectId}`));try{const te=md(O,r);if(te&&te.label&&!(O.type==="SIDE"&&j)){const ce=String(te.label||"").trim(),Re=String(L||"").trim();if(Re.length===0)L=ce;else if(ce.length>0){const He=Re.toLowerCase(),ie=ce.toLowerCase();He.includes(ie)||(L=`${Re} — ${ce}`)}}}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,Y=!!(E.current||T.current),F=Y||O.type==="SIDE"?!1:N,X=Y?!0:!F,J=!Y&&F?la.diceToChipDelayMs+50:0,ee=q,H=U,B=o?la.revealFlashPostDelayMs:0,K=o&&!Y?{getRevealTime:o,challengerId:ee,bankerId:H,postRevealDelayMs:B}:void 0,ae=K?0:F?J:0;O.type==="MAIN"?_(()=>{let pe;try{const He=md(O,r);pe=String(He?.label||"").trim()||void 0}catch{}let ce;try{if(i&&u){const He=i(u),ie=i(O.playerId);if(He&&ie){const xe=wb(He),re=wb(ie);xe.kind==="456"?ce="Banker rolled 4-5-6":xe.kind==="123"?ce="Banker rolled 1-2-3":re.kind==="456"?ce="Challenger rolled 4-5-6":re.kind==="123"?ce="Challenger rolled 1-2-3":xe.kind==="triple"&&re.kind==="point"?ce="Trips beat point":xe.kind==="point"&&re.kind==="triple"?ce="Point loses to trips":xe.kind==="triple"&&re.kind==="triple"?ce=xe.score===re.score?"Equal trips (push)":"Higher trips win":typeof xe.point=="number"&&typeof re.point=="number"&&(xe.point===re.point?ce="Same point (push)":ce=`${Math.max(xe.point,re.point)} beats ${Math.min(xe.point,re.point)}!`),ce||(I==="win"?ce=x?re.label||"Win":xe.label||"Win":I==="lose"?ce=x?xe.label||"Loss":re.label||"Loss":ce=void 0)}}}catch{}let Re;I==="push"?Re=ce||pe||"No Action":pe&&ce?Re=`${pe} ${ce}`:Re=pe||ce,P(I,x,Re,void 0,j)},{immediate:Y?!0:X&&!K,delayMs:ae,revealGate:K,key:String(O.id)}):A(I,x,L,void 0,j,{immediate:Y?!0:X&&!K,delayMs:ae,revealGate:K,key:String(O.id)})}},[t,e,r,a,A,u]),v.useEffect(()=>{if(!(E.current||T.current)||D.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",R=u&&r&&u===r,N=I?R?"win":"lose":R?"lose":"win";_(()=>P(N,!1,void 0,x,!0),{immediate:!0,key:`auto-${e}`}),D.current=e},[t,e,r,u,_,P]),v.useEffect(()=>{const C=sbe(O=>{try{w()}catch{}});return()=>{try{C()}catch{}}},[w])}function S6({open:t,onClose:e,message:r}){if(!t)return null;const n=rn(),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 Wc.createPortal(o,document.body)}function dbe({isUserTurn:t=!1,onOpen:e,isConnected:r=!0}){const{micEnabled:n,speaking:a}=gu(),[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{ar("Light")}catch{}e()}},[t,e]),h=v.useCallback(()=>{c.current=setTimeout(()=>{if(o(!0),t){try{ar("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(fbe,{}),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 fbe(){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 pbe({open:t,onClose:e,roomId:r,onLeaveVoice:n,onBlockReport:a}){const{micEnabled:i,setMicEnabled:o,videoEnabled:c,setVideoEnabled:u,leaveRoom:d}=gu(),[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{ar("Light")}catch{}o(!i)},[i,o]),b=v.useCallback(()=>{try{ar("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{ar("Medium")}catch{}d(r),n?.(),e()},[r,d,n,e]),D=v.useCallback(()=>{try{ar("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:D,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 hbe({roomId:t,isUserTurn:e=!1,leftSlot:r}){gu();const{user:n}=Vr(),[a,i]=v.useState(!1),[o,c]=v.useState(!1),[u,d]=v.useState(kG()),f=(()=>{try{return n?.isGuest===!0}catch{return!1}})(),h=v.useCallback(_=>()=>{try{ar("Light")}catch{}try{}catch{}_()},[]);v.useEffect(()=>{let _=!0;return(async()=>{try{const w=await au();if(!_)return;const b=!!w.diceAudio;d(b),pO(b)}catch{}})(),()=>{_=!1}},[]),h(()=>{const _=!u;if(d(_),pO(_),_)try{Lr()}catch{}(async()=>{try{const b={...await au(),diceAudio:_};await y0(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(dbe,{isUserTurn:e,onOpen:m,isConnected:!!t})}),g.jsx(pbe,{open:o,onClose:()=>c(!1),roomId:t}),g.jsx(S6,{open:a,onClose:()=>i(!1)})]})}const E6=v.createContext(void 0),mbe=({children:t})=>{const[e,r]=v.useState([]),[n,a]=v.useState(null),{sendGameInvite:i,respondGameInvite:o}=ga(),c=cu();Da({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(E6.Provider,{value:{pendingInvites:e,currentInvite:n,sendInvite:u,acceptInvite:d,declineInvite:f,dismissCurrentInvite:h},children:t})};function T6(){return v.useContext(E6)}function gbe({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=T6(),{friends:h}=FA();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&&Wc.createPortal(w,document.body)]})}function VA(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:D,renderFacesOverride:P,headerCommsLeftSlot:A}=t;if(m)return g.jsx(b6,{players:r,meId:i,className:h,onOpenDM:u,onOpenSendMoney:d});const{handleLeave:C}=UA(c,i,{autoJoin:!1}),O=rn(),{onBuyChips:I,busy:x,ready:R,purchasesReady:N,isWeb:L}=Lg(),{onHandEnd:j}=S0(),q=gu(),{remoteStreams:U,myVideo:Y,remoteVideoFlags:F}=q,{proofs:X,reveals:J,verifyFor:ee}=e6(c),{user:H,refreshUser:B}=Vr(),K=(()=>{try{return H?.isGuest===!0}catch{return!1}})(),[ae,te]=v.useState(!1),[pe,ce]=v.useState({}),{settledAll:Re,playerBalance:He,mySettledAll:ie,newSettlements:xe,openAllMain:re}=v0(c,i),{leaveRoom:G}=ga();o?.betsLocked;const ve=v.useCallback(()=>{if(o?.gameMode==="poker"){c&&G(c),O("/lobby");return}C()},[o,c,G,O,C]),Oe=v.useCallback(_e=>()=>{try{ar("Light")}catch{}try{}catch{}_e()},[]),he=v.useMemo(()=>r.find(_e=>_e.id===i)?.balance,[r,i]),Ce=o?.gameMode,st=(()=>{const _e=typeof He=="number"?He:void 0,et=typeof he=="number"?he:void 0;return Ce==="craps"?et??_e??0:_e??et??0})(),[Ne,St]=v.useState(st),[at,Ke]=v.useState(!1),it=v.useRef(st),mt=v.useRef(new Set),Je=v.useRef({}),ue=v.useRef(!1);v.useEffect(()=>{it.current!==st&&(it.current=st,St(st))},[st]);const Be=v.useMemo(()=>{if(o?.gameMode!=="poker")return null;const et=Array.isArray(o?.pokerSeats)?o.pokerSeats:[],ut=new Set;for(const Qe of et)Qe?.playerId&&ut.add(String(Qe.playerId));return ut},[o?.gameMode,o?.pokerSeats]),je=v.useCallback(_e=>{if(o?.gameMode==="poker"){const ut=typeof _e.balance=="number"?_e.balance:0,Mt=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(Nr=>Nr.playerId===_e.id);if(Mt&&typeof Mt.stack=="number")return Math.max(0,Mt.stack);const Ht=typeof Mt?.committed=="number"?Mt.committed:0;return Math.max(0,ut-Ht)}return _e.id===i?Number(Ne??0):typeof _e.balance=="number"?_e.balance:0},[o,i,Ne]),ot=v.useMemo(()=>{const _e=o?.gameMode;return _e==="poker"?Be?r.filter(ut=>Be.has(ut.id)):r:_e==="craps"||o?.mode==="single"||t.roomId?.includes("single")?r:r.filter(ut=>ut.id===i||ut.id?.startsWith("bot_")||ut.id?.startsWith("craps_bot_")?!0:je(ut)>0)},[r,Be,o?.gameMode,o?.mode,i,je,t.roomId]),Pt=v.useMemo(()=>Object.fromEntries(ot.map(_e=>[_e.id,_e])),[ot]),Ft=v.useRef(void 0),Me=v.useRef(new Map);v.useEffect(()=>{if(o?.gameMode!=="poker")return;const et=t.roomId||"unknown";Ft.current!==et&&(Ft.current=et,Me.current=new Map);const ut=Me.current;let Qe=-1;ut.forEach(Mt=>{Mt>Qe&&(Qe=Mt)});for(const Mt of ot)ut.has(Mt.id)||(Qe+=1,ut.set(Mt.id,Qe))},[ot,t.roomId,o?.gameMode]);const tt=v.useMemo(()=>{if(o?.gameMode==="poker"){const Ht=Me.current;return ot.map(Nr=>Nr.id).slice().sort((Nr,an)=>(Ht.get(Nr)??0)-(Ht.get(an)??0))}const et=Array.isArray(o?.turnOrder)?o.turnOrder:[];if(!et.length)return r.map(Ht=>Ht.id);const ut=new Set(r.map(Ht=>Ht.id)),Qe=et.filter(Ht=>ut.has(Ht)),Mt=r.map(Ht=>Ht.id).filter(Ht=>!Qe.includes(Ht));return[...Qe,...Mt]},[ot,r,o?.turnOrder,o?.gameMode]),rt=o.roundSeq??1;v.useEffect(()=>{if(!(!xe||!xe.length)){for(const _e of xe){if(!_e||_e.roundSeq!==rt||mt.current.has(_e.id))continue;const et={..._e,type:_e.type||(_e.predicate||_e.subjectId?"SIDE":"MAIN")},ut=zA(et,i);if(!ut.outcome)continue;mt.current.add(_e.id);let Qe=0,Mt=0;try{const Rn=md(_e,i);Rn&&(Rn.myResult==="WIN"?Qe=Rn.myPayout||0:Rn.myResult==="LOSE"&&(Mt=_e.amount||0))}catch{}const Ht=Qe>0?Qe:Mt>0?-Mt:0;if(Ht===0)continue;const Nr=ut.needsAnimation?2e3:0,an=window.setTimeout(()=>{St(Rn=>Rn+Ht),Ke(!0),window.setTimeout(()=>Ke(!1),2e3),delete Je.current[_e.id]},Nr);Je.current[_e.id]=an}return()=>{Object.values(Je.current).forEach(_e=>window.clearTimeout(_e)),Je.current={}}}},[xe,rt,i,B]);const be=v.useMemo(()=>typeof o.roundSeq=="number"?(o.turnHistory??[]).filter(_e=>_e.roundSeq===o.roundSeq):o.turnHistory??[],[o.turnHistory,o.roundSeq]),[lt,yt]=v.useState(!1),[tr,Or]=v.useState(0),[ur,dr]=v.useState(void 0);v.useEffect(()=>{if(!(!xe||!xe.length||o?.gameMode==="poker"))for(const et of xe){if(!et||et.roundSeq!==rt||et.playerId!==i)continue;const ut=md(et,i);if(ut&&ut.myResult==="LOSE"){const Qe=Number(et.amount||0);Or(Qe>0?Qe:0),dr(void 0),yt(!0);break}}},[xe,rt,i,o]);const[fn,Z]=v.useState(null),[fe,ge]=v.useState(null),[Pe,De]=v.useState(!1),[W,$]=v.useState(!1),oe=v.useRef(null),[ct,Nt]=v.useState(new Map),{sendVisibilityChange:Qt}=ga();v.useEffect(()=>{Z(null)},[c]);const Rt=v.useCallback(async()=>{if(c)try{const _e=await B_e(c);_e&&Z(_e)}catch{}},[c]),mr=v.useCallback(async()=>{if(c)try{De(!0);const _e=await U_e(c);ge(_e||null)}catch{ge(null)}finally{De(!1)}},[c]);v.useEffect(()=>{W&&o?.gameMode==="craps"&&Rt()},[W,o,Rt]),v.useEffect(()=>{if(!c||!X||typeof X!="object")return;let _e=!1;const et=rt,ut=`${et}:`,Qe=Object.keys(X||{}).filter(Mt=>Mt.startsWith(ut));if(Qe.length)return Qe.forEach(Mt=>{const Ht=Mt.split(":")[1];Ht&&(async()=>{try{const Nr=await ee(Ht,et);_e||ce(an=>an[Mt]===Nr?an:{...an,[Mt]:Nr})}catch{_e||ce(Nr=>Nr[Mt]==="unverifiable"?Nr:{...Nr,[Mt]:"unverifiable"})}})()}),()=>{_e=!0}},[X,J,ee,c,rt]);const Kr=v.useMemo(()=>{if(!n)return null;for(let _e=be.length-1;_e>=0;_e--){const et=be[_e];if(et.playerId===n&&Array.isArray(et.result)&&et.result.length===3){const ut=et.result;if(Sm(ut)!=="nothing")return ut}}if(o.bankRoll?.raw&&Array.isArray(o.bankRoll.raw)&&o.bankRoll.raw.length===3){const _e=o.bankRoll.raw;if(Sm(_e)!=="nothing")return _e}return null},[n,be,o.bankRoll]),{revealedPlayers:Ge,revealTimesRef:Gt}=K_e(be,n,o,rt),{show:xt,activeKind:qt,hasActive:Ot,onIdle:An,info:Cn}=Cs(),hn=v.useRef(new Set),xn=v.useRef(!1);v.useEffect(()=>{if(!xn.current){const _e=new Set(r.map(et=>String(et.id)));hn.current=_e,xn.current=!0}},[r]);const Vi=v.useRef(new Map),nn=v.useRef({}),ua=v.useMemo(()=>{const _e=new Map;try{const et=Array.isArray(re)?re:[];for(const ut of et){const Qe=ut?.roundSeq;typeof Qe=="number"&&Qe!==rt||ut&&ut.playerId&&typeof ut.amount=="number"&&_e.set(ut.playerId,ut.amount)}}catch{}return _e},[re,rt]);v.useEffect(()=>{try{for(const _e of r){const et=String(_e.id);if(!Ge.get(et))continue;const ut=jE(et,be,n,o.bankRoll,Kr);if(!ut||ut.length!==3)continue;const Qe=`${rt}:${[...ut].sort((an,Rn)=>an-Rn).join("")}`;if(Vi.current.get(et)===Qe)continue;Vi.current.set(et,Qe);const Ht=nn.current[et];Ht&&(window.clearTimeout(Ht),nn.current[et]=null);const Nr=_e?.name||_e?.email||et;nn.current[et]=window.setTimeout(()=>{const an=()=>{const Rn=wb(ut);xt({kind:"roll",title:String((n&&et===n?"Banker":Nr)||et),subtitle:`${Rn.label}`,duration:500})};Ot&&["win","lose","push"].includes(qt||"")?An(an):an(),nn.current[et]=null},1e3)}}catch{}return()=>{try{Object.values(nn.current).forEach(_e=>{_e&&window.clearTimeout(_e)}),nn.current={}}catch{}}},[r,Ge,be,n,Kr,rt,Ot,qt,An,xt,o.bankRoll]);const mn=v.useRef({});v.useRef(0),v.useRef(null),Da({onOtherPlayerJoined:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const et=hn.current,ut=new Set(_e.players.map(Mt=>String(Mt.id)));if(!xn.current){hn.current=ut,xn.current=!0;return}const Qe=[...ut].filter(Mt=>!et.has(Mt));if(Qe.length>0){const Mt=new Map(_e.players.map(Ht=>[String(Ht.id),Ht]));for(const Ht of Qe){if(Ht===i)continue;const Nr=Mt.get(Ht),an=Nr?.name||Nr?.email||Ht;try{Cn&&Cn("Player Joined",String(an))}catch{}}}hn.current=ut}catch{}},onOtherLeft:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const et=hn.current,ut=new Set(_e.players.map(Mt=>String(Mt.id)));if(!xn.current){hn.current=ut,xn.current=!0;return}const Qe=[...et].filter(Mt=>!ut.has(Mt));if(Qe.length>0){const Mt=new Map;try{r.forEach(Ht=>Mt.set(String(Ht.id),Ht.name||Ht.email||String(Ht.id)))}catch{}for(const Ht of Qe){if(Ht===i)continue;const Nr=Mt.get(Ht)||Ht;try{Cn&&Cn("Player Left",String(Nr))}catch{}}}hn.current=ut}catch{}},onPlayerBalanceUpdated:({playerId:_e,balance:et})=>{_e===i&&(Object.values(Je.current).forEach(ut=>window.clearTimeout(ut)),Je.current={},mt.current.clear(),ue.current=!0,it.current=et,St(et),Ke(!0),window.setTimeout(()=>Ke(!1),2e3))},onCrapsBetResults:_e=>{!_e||_e.roomId!==c||(oe.current&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{Rt()},350))},onCrapsBetsUpdate:_e=>{!_e||_e.roomId!==c||(oe.current&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{Rt()},250))},onCrapsPointSet:_e=>{!_e||_e.roomId!==c||(oe.current&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{Rt()},300))},onCrapsPointMade:_e=>{!_e||_e.roomId!==c||(oe.current&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{Rt()},300))},onPlayerPresenceUpdate:_e=>{if(!_e||_e.roomId!==c)return;const{playerId:et,status:ut}=_e;!et||!ut||Nt(Qe=>{const Mt=new Map(Qe);return Mt.set(et,ut),Mt})}}),v.useEffect(()=>()=>{oe.current&&window.clearTimeout(oe.current)},[]),v.useEffect(()=>{if(!c)return;const _e=()=>{const ut=!document.hidden;Qt(c,ut)};Qt(c,!document.hidden),document.addEventListener("visibilitychange",_e);let et=null;return(async()=>{try{const{App:ut}=await zr(async()=>{const{App:Qe}=await Promise.resolve().then(()=>eW);return{App:Qe}},void 0,import.meta.url);et=await ut.addListener("appStateChange",Qe=>{Qt(c,Qe.isActive)})}catch{}})(),()=>{document.removeEventListener("visibilitychange",_e),et&&typeof et.remove=="function"&&et.remove()}},[c,Qt]);const xs=v.useCallback(_e=>{let et=mn.current[_e];if(et&&et.getAttribute("data-player-id")!==_e&&(et=null),!et)try{const Mt=window.CSS&&typeof window.CSS.escape=="function"?window.CSS.escape(_e):String(_e).replace(/[^a-zA-Z0-9_-]/g,"_");et=document.querySelector(`.players.players--avatars [data-player-id="${Mt}"]`)}catch{}if(!et)return null;const ut=et.querySelector(".avatar-ring");let Qe=null;if(ut)Qe=ut.getBoundingClientRect();else try{Qe=et.getBoundingClientRect()}catch{}return!Qe||Qe.width===0&&Qe.height===0?null:{x:Qe.left+Qe.width/2,y:Qe.top+Qe.height/2}},[]),ki=v.useRef(be.length),ta=v.useRef(null),gn=v.useRef(null),Ps=v.useRef(null);v.useEffect(()=>{ki.current=be.length},[rt]),v.useEffect(()=>{Ps.current=null},[rt]);const{forUserId:As,anchorRect:Rs,anchorEl:Hi,openFor:Lp,close:kd}=qA(),wd=(_e,et)=>{!et||_e===i||Lp(_e,et)},Bp=()=>kd(),nc=v.useMemo(()=>{const _e=new Map;for(const et of r)_e.set(et.id,et.name||et.email||et.id);for(const et of Re){const ut=et?.playerId,Qe=et?.bankerId;ut&&!_e.has(ut)&&_e.set(ut,ut),Qe&&!_e.has(Qe)&&_e.set(Qe,Qe)}return _e},[r,Re]),fo=v.useCallback(_e=>nc.get(_e||"")||_e||"Unknown",[nc]),va=v.useCallback(_e=>fo(_e),[fo]),_a=v.useCallback(_e=>jE(_e,be,n,o.bankRoll,Kr),[be,n,o.bankRoll,Kr]);ube({newSettlements:xe,roundSeqNow:rt,myId:i,bankerDice:Kr,getPlayerName:va,getPlayerDice:_a,getRevealTime:_e=>Gt?.current?.get?.(_e),postRevealDelayMs:0,bankerId:n});const Fa=v.useRef(null);v.useEffect(()=>{!(o?.gameMode==="cee-lo"||o?.gameMode==="ceeLo"||!o?.gameMode)||!xe.length||!xe.filter(ut=>ut.playerId===i||ut.bankerId===i).length||Fa.current!==rt&&(Fa.current=rt,setTimeout(async()=>{try{await j()}catch{}},2500))},[xe,rt,i,o,j]);const Yc=o?.gameMode==="cee-lo"||o?.gameMode==="ceeLo"||!o?.gameMode,vu=o?.gameMode==="craps",Xc=v.useCallback(_e=>{if(!Yc)return!0;if(!_e||!(Ge.get(_e)===!0))return!1;const ut=Gt?.current?.get?.(_e);return(typeof ut=="number"?performance.now()-ut:0)>=la.diceToChipDelayMs},[Yc,Ge,Gt]),{activeBatch:po,handleAnimItemComplete:Sd,resetForRound:da}=cbe({newSettlements:xe,roundSeqNow:rt,getAvatarCenter:xs,getPlayerName:va,myId:i,bankerDice:Kr,bankerId:n,isPartyReady:Xc});v.useEffect(()=>{da()},[rt,da]);const ho=v.useRef(null),wi=v.useRef(null),Jc=v.useMemo(()=>{if(o?.gameMode==="poker"){const et=Number(o?.pokerUiLockedUntilTs||0),ut=et>0&&Date.now()<et,Qe=7e3;ut&&ho.current==null&&(ho.current=Date.now());const Mt=ho.current||0,Ht=Mt>0?Date.now()-Mt:Number.POSITIVE_INFINITY,Nr=ut&&Ht<=Qe,an=Array.isArray(o?.pokerSeats)?o.pokerSeats:[],Rn=typeof o?.pokerActingSeat=="number"?o.pokerActingSeat:void 0,fa=typeof Rn=="number"&&an.find(Ds=>Ds.seatIndex===Rn)?.playerId||null;return Nr?wi.current??fa??null:(wi.current=fa??null,ho.current=null,fa??null)}return(o?.currentRollerId??a)||null},[o?.gameMode,o?.pokerSeats,o?.pokerActingSeat,o?.currentRollerId,a]);return v.useEffect(()=>{const _e=gn.current,et=Jc||void 0;if(!_e||!et||Ps.current===et)return;const ut=mn.current[et];if(!ut)return;const Qe=()=>{try{const Mt=Math.max(0,Math.min(ut.offsetLeft-_e.clientWidth/2+ut.offsetWidth/2,_e.scrollWidth-_e.clientWidth));_e.scrollTo({left:Mt,behavior:"smooth"}),Ps.current=et}catch{}};return ta.current&&clearTimeout(ta.current),ta.current=setTimeout(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(Qe):Qe()},100),()=>{ta.current&&(clearTimeout(ta.current),ta.current=null)}},[Jc,tt]),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:Oe(ve),"aria-label":"Back",style:{display:"flex"},children:g.jsx(bd,{className:"icon",style:{color:"var(--gold, #caa64d)"}})}),(()=>{const _e=x||!R||!N,et=_e?"Balance (login to Buy 1000 Z Credits)":L?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",ut=_e?"Login to Buy 1000 Z Credits":L?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",Qe=Oe(()=>{if(K){te(!0);return}I()});return g.jsx("a",{className:"gold-link balance-display"+(_e?" disabled":"")+(at?" balance--pulse":""),role:"button","aria-label":et,title:ut,"aria-disabled":_e||void 0,onClick:Qe,children:g.jsxs("b",{children:[g.jsx("span",{className:"lowercase",children:"z"}),rd.formatMoney(Ne,"",0)]})})})(),g.jsx("a",{role:"button",className:"gold-link white-link"+(t.historyHalo?" history-halo":""),onClick:Oe(()=>{if(K){te(!0);return}const _e=o?.gameMode;_e==="craps"?(Rt(),$(!0)):_e==="poker"?t.onOpenHistory&&t.onOpenHistory():mr().then(()=>$(!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(gbe,{roomId:c,gameMode:o?.gameMode||"cee-lo"}),g.jsx(hbe,{roomId:c,leftSlot:A}),_?g.jsx("div",{className:"panel-header-extras",children:_}):null]})]})}),po.length>0&&g.jsxs("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:1e4},children:[po.map(_e=>g.jsx(w6,{anim:_e,onComplete:()=>Sd(_e.id)},_e.id)),!1]}),g.jsx("div",{className:"chip-fly-container",children:g.jsx(Js.ul,{className:"players players--avatars",role:"list",ref:gn,layout:!0,transition:{type:"spring",stiffness:420,damping:38,mass:.6},children:tt.map(_e=>{const et=o?.currentRollerId??a,ut=Pt[_e];if(!ut)return null;const Qe=ut.id,Mt=[];if(o?.gameMode==="poker"){const Br=o,ra=Array.isArray(Br.pokerSeats)?Br.pokerSeats:[],na=typeof Br.pokerDealerSeat=="number"?Br.pokerDealerSeat:void 0,qa=ra.find(Na=>Na.playerId===Qe);if(qa&&typeof na=="number"){qa.seatIndex===na&&Mt.push("D");const Na=ra.filter($n=>!!$n.playerId).map($n=>$n.seatIndex).sort(($n,Wi)=>$n-Wi),aa=Na.length;if(aa>=2){const $n=Na.indexOf(na);if($n!==-1){let Wi,ac;aa===2?(Wi=na,ac=Na[($n+1)%aa]):(Wi=Na[($n+1)%aa],ac=Na[($n+2)%aa]),qa.seatIndex===Wi&&Mt.push("SB"),typeof ac=="number"&&qa.seatIndex===ac&&Mt.push("BB")}}}}Qe===et&&!Ge.get(Qe)&&Mt.push("Rolling"),Qe===et&&Mt.push("Shooter");let Ht=!1;if(o?.gameMode==="poker"){const Br=o,ra=typeof Br.pokerActingSeat=="number"?Br.pokerActingSeat:void 0;typeof ra=="number"&&Array.isArray(Br.pokerSeats)&&(Ht=Br.pokerSeats.find(qa=>qa.seatIndex===ra)?.playerId===Qe)}else Ht=Qe===et;let Nr=!1;if(o?.gameMode==="poker"){const ra=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(na=>na.playerId===Qe);ra&&String(ra.status||"").toLowerCase()==="folded"&&(Nr=!0)}const an=Qe===i?Y:U[Qe],Rn=F[Qe]?an:void 0,fa=!w&&Ge.get(Qe)?jE(Qe,be,n,o.bankRoll,Kr):null;let Ds=!w&&fa&&Array.isArray(fa)&&fa.length===3&&!fa.every(Br=>Br===0)&&Sm(fa)!=="nothing"?g.jsx(ibe,{dice:fa}):null;const Qc=(o.spectators??[]).includes(Qe);let Os;if(P)Os=P(ut);else if(Qc)Os=null;else if(Yc&&!Ge.get(Qe)){const Br=ua.get(Qe);Os=typeof Br=="number"&&Br>0?g.jsxs("span",{className:"player-bet-pill","aria-label":`Bet z${rd.formatMoney(Br,"",0)}`,children:["z",rd.formatMoney(Br,"",0)]}):null}else Os=Ds;const Si=o?.gameMode==="poker",Ei=vu&&(Qe.startsWith("craps_bot_")||Qe.startsWith("bot_")),Gi=je(ut),mo=Ei?void 0:Number.isFinite(Gi)?Gi:void 0;return g.jsx(H_e,{ref:Br=>{mn.current[Qe]=Br},id:Qe,display:ut.name??ut.email??Qe,isCurrentRoller:Ht,isMe:Qe===i,balance:mo,isSpectating:Qc,folded:Nr,tags:Mt,stream:Rn,isMuted:Qe===i,diceResult:Os,onOpenMenu:(Br,ra)=>wd(Br,ra),showMenu:As===Qe,menuProps:As===Qe?{targetId:Qe,anchorRect:Rs,anchorEl:Hi,onClose:Bp,onOpenDM:u,onOpenSendMoney:d,meId:i}:null,forceHideVideo:!F[Qe],avatarUrl:ut.avatarUrl,showActingTimerRing:Si,presenceStatus:ct.get(Qe)},Qe)})})}),W&&g.jsx(g4,{onClose:()=>$(!1),items:Array.isArray(fe)&&fe.length>0?fe:ie,meId:i,nameOf:fo,crapsRollHistory:E,gameMode:o?.gameMode,crapsLedgerItems:(fn||[]).slice().sort((_e,et)=>Number(et.ts)-Number(_e.ts))}),g.jsx(S6,{open:ae,onClose:()=>te(!1),message:"This feature is for logged in users."})]})}function ybe(t){const{gameState:e,roomId:r,meId:n}=t,{show:a,hasActive:i,activeKind:o,onIdle:c,rollNow:u}=Cs(),{onHandEnd:d}=S0(),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:D}=Zo(),{recentSettlements:P,lastSettlementRoll:A,pointSetEvent:C,pointMadeEvent:O}=Zz({roomId:r||null,myPlayerId:n}),I=v.useCallback((x,R,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:R,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),D&&(_.current=setTimeout(()=>{const R=m.current;if(R){if(h.current.has(R.key)){m.current=null;return}f.current=R.key,h.current.add(R.key);try{yO({volume:.15})}catch{}typeof u=="function"?u("Point Established",`${R.point} is the point`):a({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),m.current=null}},la.revealFlashPostDelayMs)))},[C,r,u,a,D]),v.useEffect(()=>{!D||!m.current||(_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{const R=m.current;if(R){if(h.current.has(R.key)){m.current=null;return}f.current=R.key,h.current.add(R.key);try{yO({volume:.15})}catch{}typeof u=="function"?u("Point Established",`${R.point} is the point`):a({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),m.current=null}},la.revealFlashPostDelayMs))},[D,u,a]),v.useEffect(()=>{O&&(!r||O.roomId!==r||(w.current={key:O._key,point:O.point},b.current&&clearTimeout(b.current),D&&(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{vO({sfxVolume:.15,voiceVolume:.55})}catch{}w.current=null}},la.revealFlashPostDelayMs))))},[O,r,I,D]),v.useEffect(()=>{!D||!w.current||(b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{const R=w.current;if(R){if(h.current.has(R.key)){w.current=null;return}I("win","Point Made!",`${R.point} hit`,1300,R.key);try{vO({sfxVolume:.15,voiceVolume:.55})}catch{}w.current=null}},la.revealFlashPostDelayMs))},[D,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}})(),R=n||(x?e?.currentRollerId||"e2e-user":void 0),N=Ne=>{const St=Ne.betType;return St==="pass"||St==="dontPass"||St.startsWith("place")||St==="field"||St==="big6"||St==="big8"||St==="come"||St==="dontCome"||St==="atsSmall"||St==="atsTall"||St==="atsAll"},L=P.filter(Ne=>(R?Ne.playerId===R:!0)&&N(Ne));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(Ne=>`${Ne.betType}:${Ne.outcome}:${Ne.amount}:${Ne.payout}`).sort().join("|"),Y=`${j}:${q}:${U}`;if(E.current===Y)return;E.current=Y;const F=L.filter(Ne=>Ne.betType==="pass"||Ne.betType==="dontPass"),X=L.filter(Ne=>Ne.betType.startsWith("place")&&Ne.outcome==="WIN"),J=L.filter(Ne=>Ne.betType==="field"),ee=L.filter(Ne=>Ne.betType==="big6"||Ne.betType==="big8"),H=L.filter(Ne=>Ne.betType==="come"||Ne.betType==="dontCome"),B=L.filter(Ne=>Ne.betType==="atsSmall"||Ne.betType==="atsTall"||Ne.betType==="atsAll"),K=F.some(Ne=>Ne.outcome==="WIN"),ae=X.length>0,te=J.some(Ne=>Ne.outcome==="WIN"),pe=ee.some(Ne=>Ne.outcome==="WIN"),ce=H.some(Ne=>Ne.outcome==="WIN"),Re=B.some(Ne=>Ne.outcome==="WIN"),He=B.some(Ne=>Ne.outcome==="LOSE"),ie=F.some(Ne=>Ne.outcome==="LOSE"),xe=J.some(Ne=>Ne.outcome==="LOSE"),re=ee.some(Ne=>Ne.outcome==="LOSE"),G=H.some(Ne=>Ne.outcome==="LOSE"),ve=H.some(Ne=>Ne.outcome==="PUSH"),Oe=!K&&!ie&&F.some(Ne=>Ne.outcome==="PUSH");let he="",Ce="";T.current&&clearTimeout(T.current);const st=(()=>{try{return typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1"))}catch{return!1}})();T.current=setTimeout(()=>{const Ne=typeof q=="number"?q:Number(q),St=A?.currentRollerId,at=X.some(Ke=>{const it=Number(String(Ke.betType).replace(/^place/,""));return Number.isFinite(it)&&it===Ne});if(Re){const Ke=B.filter(Je=>Je.outcome==="WIN"),it=Ke.reduce((Je,ue)=>Je+ue.payout,0),mt=Ke.map(Je=>Je.betType==="atsAll"?"ALL":Je.betType==="atsSmall"?"SMALL":Je.betType==="atsTall"?"TALL":Je.betType);he=Ke.length>1?`ATS ${mt.join(" & ")}!`:`ATS ${mt[0]}!`,Ce=`+${it}`,a({kind:"win",title:he,subtitle:Ce,duration:2e3});return}if(K){if(ae&&at&&n&&St===n){const it=X.reduce((mt,Je)=>mt+Je.payout,0);he=X.length>1?"Place Wins":"Place Win",Ce=`+${it}`,a({kind:"win",title:he,subtitle:Ce,duration:1e3});return}const Ke=F.filter(it=>it.outcome==="WIN").reduce((it,mt)=>it+(mt.payout+mt.amount),0);he="Line Win",Ce=`+${Ke}`,a({kind:"win",title:he,subtitle:Ce,duration:1100});return}if(ae){const Ke=X.reduce((it,mt)=>it+mt.payout,0);he=X.length>1?"Place Wins":"Place Win",Ce=`+${Ke}`,a({kind:"win",title:he,subtitle:Ce,duration:1e3});return}if(te){const Ke=J.filter(it=>it.outcome==="WIN").reduce((it,mt)=>it+mt.payout,0);he="Field Win",Ce=`+${Ke}`,a({kind:"win",title:he,subtitle:Ce,duration:1e3});return}if(pe){const Ke=ee.filter(Je=>Je.outcome==="WIN"),it=Ke.reduce((Je,ue)=>Je+ue.payout,0);he=Ke.length>1?"Big Wins":Ke[0]?.betType==="big6"?"Big 6 Win":"Big 8 Win",Ce=`+${it}`,a({kind:"win",title:he,subtitle:Ce,duration:1e3});return}if(ce){const Ke=H.filter(Je=>Je.outcome==="WIN"),it=Ke.reduce((Je,ue)=>Je+ue.payout,0);he=Ke.length>1?"Come Wins":Ke[0]?.betType==="dontCome"?"DC Win":"Come Win",Ce=`+${it}`,a({kind:"win",title:he,subtitle:Ce,duration:1e3});return}if(ie){const Ke=F.filter(it=>it.outcome==="LOSE").reduce((it,mt)=>it+mt.amount,0);he="Line Lose",Ce=`-${Ke}`,a({kind:"lose",title:he,subtitle:Ce,duration:1100});return}if(xe){const Ke=J.filter(it=>it.outcome==="LOSE").reduce((it,mt)=>it+mt.amount,0);he="Field Lose",Ce=`-${Ke}`,a({kind:"lose",title:he,subtitle:Ce,duration:1e3});return}if(re){const Ke=ee.filter(Je=>Je.outcome==="LOSE"),it=Ke.reduce((Je,ue)=>Je+ue.amount,0);he=Ke.length>1?"Big Bets Lose":Ke[0]?.betType==="big6"?"Big 6 Lose":"Big 8 Lose",Ce=`-${it}`,a({kind:"lose",title:he,subtitle:Ce,duration:1e3});return}if(G){const Ke=H.filter(Je=>Je.outcome==="LOSE"),it=Ke.reduce((Je,ue)=>Je+ue.amount,0);he=Ke.length>1?"Come Bets Lose":Ke[0]?.betType==="dontCome"?"DC Lose":"Come Lose",Ce=`-${it}`,a({kind:"lose",title:he,subtitle:Ce,duration:1e3});return}if(ve){he="DC Push",Ce="No action",a({kind:"push",title:he,subtitle:Ce,duration:1e3});return}if(Oe){he="Line Push",Ce="No action",a({kind:"push",title:he,subtitle:Ce,duration:1e3});return}if(He){const it=B.filter(mt=>mt.outcome==="LOSE").reduce((mt,Je)=>mt+Je.amount,0);he="ATS Busted",Ce=`-${it}`,a({kind:"lose",title:he,subtitle:Ce,duration:1200});return}try{d()}catch{}},st?200:2e3)},[P,n,A,a,d]),g.jsx(VA,{...t,hideDiceResults:!0,className:"craps-player-panel"})}function vbe(t){return g.jsx(VA,{...t})}function _be({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 HA(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,D=E==="H"||E==="D",P=E==="H"?"♥":E==="D"?"♦":E==="C"?"♣":"♠";return g.jsxs("div",{className:["poker-card","poker-card--mini",D?"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(b6,{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(_be,{deadlineTs:t.turnDeadlineTs,isActive:!!t.isBettingStreet&&!!t.turnDeadlineTs,showTurnLabel:!!t.isHeroTurn}),[t.turnDeadlineTs,t.isBettingStreet,t.isHeroTurn]);return g.jsx(VA,{...t,className:"player-panel",players:o,hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,headerExtras:e,headerCommsLeftSlot:c,renderFacesOverride:u=>i(u)})}function kL(t){const e=t.gameState?.gameMode||"cee-lo";return e==="craps"?g.jsx(ybe,{...t}):e==="poker"?g.jsx(HA,{...t}):g.jsx(vbe,{...t})}function bbe(){const{remoteStreams:t}=gu(),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 C6=v.createContext(null),kbe=()=>v.useContext(C6),Bu=t=>`room:${t}`,Oo=(t,e)=>`dm:${[t,e].sort().join("|")}`,wbe=t=>{if(!t.startsWith("dm:"))return null;const r=t.slice(3).split("|");return r.length===2?r:null},HE=(t,e)=>t.ts===e.ts?t.id<e.id?-1:t.id>e.id?1:0:t.ts-e.ts,wL=()=>"tmp:"+Math.random().toString(36).slice(2)+Date.now().toString(36),GE=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,roomId:t.roomId}),WE=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,toUserId:t.toUserId});function Sbe({children:t}){const{user:e}=Vr(),r=e?.id??"anon",{roomSendMessage:n,roomFetchHistory:a,dmSendMessage:i,dmFetchHistory:o}=ga(),[c,u]=v.useState({}),[d,f]=v.useState({}),[h,m]=v.useState(null),[_,w]=v.useState({}),b=v.useRef(new Set),{info:E}=uP(),T=H=>H?H.length>100?H.slice(0,100)+"…":H:"",D=v.useCallback((H,B,K)=>{if(B?.length&&(u(ae=>{const te=ae[H]??[],pe=new Map;for(const Re of te)Re?.id&&pe.set(Re.id,Re);for(const Re of B){if(!Re?.id)continue;const He=pe.get(Re.id);pe.set(Re.id,{...He??{},...Re,pending:!1,error:void 0})}const ce=Array.from(pe.values()).sort(HE);return{...ae,[H]:ce}}),H.startsWith("dm:")&&K?.fromPeerId)){const ae=K.fromPeerId,te=Oo(r,ae),pe=h===ae,ce=B.filter(Re=>Re.senderId===ae).length;ce>0&&!pe&&f(Re=>({...Re,[te]:(Re[te]??0)+ce}))}},[h,r]),P=v.useCallback((H,B,K)=>{u(ae=>{const te=(ae[H]??[]).slice();return te.push(B),te.sort(HE),{...ae,[H]: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(pe=>{const ce=pe[H]??[],Re=ce.some(ie=>ie.id===te);let He;return Re?He=ce.filter(ie=>ie.id!==B.id):He=ce.map(ie=>ie.id===B.id?{...ie,id:te,pending:!1,error:void 0}:ie),He.sort(HE),{...pe,[H]:He}})}catch(ae){u(te=>{const pe=(te[H]??[]).map(ce=>ce.id===B.id?{...ce,pending:!1,error:ae?.message||"send failed"}:ce);return{...te,[H]:pe}})}})()},[]),A=v.useCallback(H=>{u(B=>{if(!B[H])return B;const K={...B};return delete K[H],K}),H.startsWith("dm:")&&(f(B=>{if(!(H in B))return B;const K={...B};return delete K[H],K}),w(B=>{if(!(H in B))return B;const K={...B};return delete K[H],K}))},[]),C=v.useCallback(H=>(c[H]??[]).some(B=>B.pending),[c]),O=v.useCallback(H=>{const B=Bu(H);return J(H),(c[B]??[]).slice()},[c]),I=v.useCallback((H,B)=>{const K=(B??"").trim();if(!K)return null;const ae=Bu(H),te=wL(),pe={id:te,ts:Date.now(),senderId:r,text:K,roomId:H,pending:!0};return P(ae,pe,()=>n(H,K)),te},[r,n,P]),x=v.useCallback(H=>A(Bu(H)),[A]),R=v.useCallback(H=>C(Bu(H)),[C]),N=v.useCallback(async H=>{const B=Oo(r,H);if(!_[B])try{const K=await o?.(H);if(K?.ok&&Array.isArray(K.messages)){const ae=K.messages.map(WE);D(B,ae),f(te=>({...te,[B]:0}))}}finally{w(K=>({...K,[B]:!0}))}},[o,D,r,_]),L=v.useCallback(H=>{const B=Oo(r,H);return N(H),(c[B]??[]).slice()},[c,r,N]),j=v.useCallback((H,B)=>{const K=(B??"").trim();if(!K)return null;const ae=Oo(r,H),te=wL(),pe={id:te,ts:Date.now(),senderId:r,text:K,toUserId:H,pending:!0};return P(ae,pe,()=>i(H,K)),te},[r,P,i]),q=v.useCallback(H=>A(Oo(r,H)),[A,r]),U=v.useCallback(H=>C(Oo(r,H)),[C,r]),Y=v.useCallback(H=>{const B=Oo(r,H);f(K=>{if(!(B in K))return K;const ae={...K};return ae[B]=0,ae})},[r]),F=v.useCallback(H=>{m(H),H&&(Y(H),N(H))},[Y,N]),X=v.useCallback(H=>{const B=[];for(const[K,ae]of Object.entries(c??{})){if(!K.startsWith("dm:"))continue;const te=wbe(K);if(!te)continue;const pe=te[0]===r?te[1]:te[0];if(H&&pe!==H)continue;const ce=ae[ae.length-1];B.push({peerUserId:pe,last:ce,unread:d?.[K]??0,hasPending:ae.some(Re=>Re.pending)})}return B.sort((K,ae)=>(ae.last?.ts??0)-(K.last?.ts??0)),B},[c,d,r]);async function J(H){const B=Bu(H);if(!(c[B]??[]).length)try{const K=await a?.(H);if(K?.ok&&Array.isArray(K.messages)){const ae=K.messages.map(GE);D(B,ae)}}catch{}}Da({onRoomMessage:H=>{if(!(!H?.id||!H.roomId)&&!b.current.has(H.id)){b.current.add(H.id),D(Bu(H.roomId),[GE(H)]);try{E("Message",T(H.text))}catch{}}},onRoomHistory:({roomId:H,messages:B})=>{!H||!Array.isArray(B)||D(Bu(H),B.map(GE))},onDmMessage:H=>{if(!H?.id)return;const B=H.fromUserId===r?H.toUserId:H.fromUserId;if(!B)return;const K=Oo(r,B),ae=WE(H);if(D(K,[ae],{fromPeerId:H.fromUserId!==r?H.fromUserId:void 0}),H.fromUserId!==r)try{E("Direct Message",T(H.text))}catch{}h===B&&f(te=>({...te,[K]:0}))},onDmHistory:({peerUserId:H,messages:B})=>{if(!H||!Array.isArray(B))return;const K=Oo(r,H);D(K,B.map(WE)),h===H&&f(ae=>({...ae,[K]:0})),w(ae=>({...ae,[K]:!0}))}});const ee=v.useMemo(()=>({getRoomMessages:O,sendRoomMessage:I,clearRoom:x,roomHasPending:R,getDmMessages:L,sendDmMessage:j,clearDm:q,dmHasPending:U,getDmSummary:X,markDmRead:Y,setActiveDm:F,loadDmHistory:N,threads:c}),[O,I,x,R,L,j,q,U,X,Y,F,N,c]);return g.jsx(C6.Provider,{value:ee,children:t})}const Ebe="_overlay_axsq0_3",Tbe="_overlayClosed_axsq0_14",Cbe="_drawer_axsq0_20",xbe="_drawerClosed_axsq0_54",Pbe="_header_axsq0_65",Abe="_closeBtn_axsq0_75",Rbe="_body_axsq0_91",Dbe="_threadList_axsq0_98",Obe="_noPeers_axsq0_106",Nbe="_threadBtn_axsq0_113",Ibe="_threadBtnActive_axsq0_132",Mbe="_avatar_axsq0_137",jbe="_threadLabel_axsq0_151",Lbe="_threadName_axsq0_156",Bbe="_threadPreview_axsq0_165",Ube="_unreadBadge_axsq0_173",Fbe="_activeThread_axsq0_186",qbe="_scroller_axsq0_194",zbe="_scrollerEmpty_axsq0_208",$be="_message_axsq0_215",Vbe="_messageMine_axsq0_230",Hbe="_messageContent_axsq0_238",Gbe="_messageTime_axsq0_246",Wbe="_pending_axsq0_257",Kbe="_error_axsq0_265",Ybe="_composer_axsq0_273",Xbe="_composerInput_axsq0_283",Jbe="_composerSend_axsq0_307",Qbe="_composerSendDisabled_axsq0_329",Zbe="_headerTitle_axsq0_394",Hr={overlay:Ebe,overlayClosed:Tbe,drawer:Cbe,drawerClosed:xbe,header:Pbe,closeBtn:Abe,body:Rbe,threadList:Dbe,noPeers:Obe,threadBtn:Nbe,threadBtnActive:Ibe,avatar:Mbe,threadLabel:jbe,threadName:Lbe,threadPreview:Bbe,unreadBadge:Ube,activeThread:Fbe,scroller:qbe,scrollerEmpty:zbe,message:$be,messageMine:Vbe,messageContent:Hbe,messageTime:Gbe,pending:Wbe,error:Kbe,composer:Ybe,composerInput:Xbe,composerSend:Jbe,composerSendDisabled:Qbe,headerTitle:Zbe};function e0e(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 x6({open:t,onClose:e,peers:r,initialPeerId:n}){const{user:a}=Vr(),i=a?.id??a?.email??"",{getDmSummary:o,getDmMessages:c,sendDmMessage:u,markDmRead:d,setActiveDm:f,threads:h,loadDmHistory:m}=kbe(),[_,w]=v.useState(n??null),[b,E]=v.useState(""),T=v.useRef(!1),D=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(Y=>Y.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||!_||D.current!==_&&(D.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?.[Oo(_,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("")},R=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:`${Hr.overlay} ${t?"":Hr.overlayClosed}`}),g.jsxs("aside",{"aria-hidden":!t,role:"dialog","aria-label":"Direct Messages",className:`${Hr.drawer} ${t?"":Hr.drawerClosed}`,onClick:j=>j.stopPropagation(),children:[g.jsxs("div",{className:Hr.header,children:[g.jsx("strong",{className:Hr.headerTitle,children:"Messages"}),g.jsx("button",{onClick:e,className:Hr.closeBtn,"aria-label":"Close messages",children:"✕"})]}),g.jsxs("div",{className:Hr.body,children:[g.jsxs("div",{className:Hr.threadList,children:[r.length===0&&g.jsx("div",{className:Hr.noPeers,children:"No other players yet."}),r.map(j=>{const q=j.id===_,U=e0e(j.name||j.email||j.id),Y=C.get(j.id)?.unread??0,F=L(j.id);return g.jsxs("button",{onClick:()=>I(j.id),className:`${Hr.threadBtn} ${q?Hr.threadBtnActive:""}`,title:N(j.id),children:[g.jsx("div",{className:Hr.avatar,"aria-hidden":!0,children:U}),g.jsxs("div",{className:Hr.threadLabel,children:[g.jsx("div",{className:Hr.threadName,children:N(j.id)}),g.jsx("div",{className:Hr.threadPreview,children:F})]}),Y>0&&g.jsx("span",{"aria-label":`${Y} unread`,className:Hr.unreadBadge,children:Y>99?"99+":Y})]},j.id)})]}),g.jsxs("div",{className:Hr.activeThread,children:[g.jsxs("div",{ref:O,className:Hr.scroller,children:[!_&&g.jsx("div",{className:Hr.scrollerEmpty,children:"Select a conversation to begin."}),_&&P.map(j=>{const q=j.senderId===i,U=new Date(j.ts),Y=U.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return g.jsxs("div",{className:`${Hr.message} ${q?Hr.messageMine:""}`,title:U.toLocaleString(),children:[g.jsx("div",{className:Hr.messageContent,children:j.text}),g.jsx("div",{className:Hr.messageTime,children:Y}),j.pending&&g.jsx("div",{className:Hr.pending,children:"sending…"}),j.error&&g.jsx("div",{className:Hr.error,children:j.error})]},j.id)})]}),g.jsxs("div",{className:Hr.composer,children:[g.jsx("input",{value:b,onChange:j=>E(j.target.value),onKeyDown:R,placeholder:_?`Message ${N(_)}…`:"Pick a conversation…",disabled:!_,className:Hr.composerInput}),g.jsx("button",{onClick:x,disabled:!_||b.trim()==="",className:`${Hr.composerSend} ${!_||b.trim()===""?Hr.composerSendDisabled:""}`,children:"Send"})]})]})]})]})]})}function t0e({roomId:t,lastRollerId:e,roundSeq:r,className:n,autoHideMs:a}){const{verifyFor:i,lastRoundWithReveal:o,proofs:c,reveals:u}=e6(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||_(R=>R[O]===x?R:{...R,[O]:x})}catch{C||_(x=>x[O]==="unverifiable"?x:{...x,[O]:"unverifiable"})}})()}),()=>{C=!0}},[i,E,r,o]);const D=typeof r=="number"?!!u?.[r]:!1;if(v.useEffect(()=>{if(!a||a<=0||!D)return;b(!0);const C=window.setTimeout(()=>b(!1),a);return()=>window.clearTimeout(C)},[a,r,D]),!D||!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(bP,{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 r0e=({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 Wc.createPortal(f,document.body)},n0e=({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 Wc.createPortal(f,document.body)},SL=v.lazy(()=>zr(()=>import("./DiceBoard.component-COLtDXCi.js"),__vite__mapDeps([3,4]),import.meta.url));function a0e(){const{roomId:t}=c3(),e=rn(),{user:r,meId:n}=Vr(),{error:a}=cu();v.useEffect(()=>{const je=()=>{try{Dx()||Lr()}catch{}};je();const ot=["pointerdown","touchstart","mousedown","click","keydown"];return ot.forEach(Pt=>{document.addEventListener(Pt,je,{once:!0,capture:!0})}),()=>{ot.forEach(Pt=>{document.removeEventListener(Pt,je,{capture:!0})})}},[]);const i=n||r?.id||r?.email||"",[o,c]=v.useState(0),{rollTrigger:u,resetSpin:d}=Zo(),f=v.useRef(null),h=UA(t,i,{autoJoin:!0}),{room:m,joining:_,error:w,lastRollerId:b,deadline:E,serverNow:T,diceSettled:D}=h,P=Qz({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 ot=P.lastRoll?.point??null,Pt=ot??je.crapsPoint??null,Ft=A?{...A}:{},Me={...je,...Ft,crapsPoint:Pt};return Me.crapsPhase=Pt?"point":"come-out",Me}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??[],ot=A?.turnOrder||m?.gameState?.turnOrder||[];if(!ot.length)return je;const Pt=new Map(je.map(rt=>[rt.id,rt])),Ft=new Set(ot),Me=ot.map((rt,be)=>{const lt=Pt.get(rt);if(lt)return lt;const yt=rt.includes("craps_bot_")||rt.includes("bot_"),tr=["Bones Bot","Stickman","Railbird","High Roller"];return{id:rt,name:yt?tr[be%tr.length]||`Bot ${be+1}`:"Player",isReady:!0,balance:yt?500:0,avatarUrl:null,isBot:yt}}),tt=je.filter(rt=>!Ft.has(rt.id));return[...Me,...tt]},[m?.gameState?.gameMode,m?.players,A?.turnOrder,m?.gameState?.turnOrder]),{onCrapsShooterTurnEnd:x}=S0(),R=v.useRef(null);v.useEffect(()=>{if(m?.gameState?.gameMode!=="craps")return;const je=P.lastRoll;if(!je||R.current===je)return;R.current=je;const{currentRollerId:ot,nextRollerId:Pt}=je;ot&&Pt&&ot!==Pt&&x()},[P.lastRoll,m?.gameState?.gameMode,x]);const N=v.useRef(null),[L,j]=v.useState(1),[q,U]=v.useState(null),[Y,F]=v.useState(!1),[X,J]=v.useState(void 0),ee=v.useMemo(()=>(m?.players??[]).filter(je=>je.id!==i).map(je=>({id:je.id,name:je.name})),[m?.players,i]),H=m?.gameState?.phase==="waiting"&&!u,B=v.useCallback(je=>{J(je),F(!0)},[]),K=v.useCallback(()=>{F(!1),J(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 ot=m?.gameState?.banker,Pt=ot&&i&&ot===i;try{Pt||gT({volume:.6})}catch{}}typeof je=="number"&&(ae.current=je)},[m?.gameState?.roundSeq]);const te=Ss(),{joinRoom:pe}=Li(),[ce,Re]=v.useState(!1);v.useCallback(async()=>{if(!ce&&!(!te||!t)){Re(!0);try{if(pe)try{await pe(t)}catch{}}catch{}finally{Re(!1)}}},[ce,te,t,pe]),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,ie]=v.useState(()=>typeof window>"u"?!1:window.innerWidth>window.innerHeight);v.useEffect(()=>{const je=()=>ie(window.innerWidth>window.innerHeight);window.addEventListener("resize",je);const ot=setTimeout(je,0);return()=>{window.removeEventListener("resize",je),clearTimeout(ot)}},[]),v.useEffect(()=>{w&&a(w,{title:"Room Error",duration:5e3})},[w,a]);const xe=v.useRef(0),re=v.useRef(!1),G=v.useRef(!1),ve=v.useRef(!1),Oe=v.useRef(null),he=v.useRef(null),[Ce,st]=v.useState(0),[Ne,St]=v.useState(!1),[at,Ke]=v.useState(!1),[it,mt]=v.useState(!1);v.useEffect(()=>{const je=m?.gameState?.gameMode;if(!je)return;let ot=!0;return(async()=>{try{const{Preferences:Pt}=await zr(async()=>{const{Preferences:tt}=await Promise.resolve().then(()=>Ic);return{Preferences:tt}},void 0,import.meta.url),Ft=je==="craps"?"onb_craps_v1":"onb_ceelo_v1",{value:Me}=await Pt.get({key:Ft});if(!ot)return;mt(Me!=="1")}catch{if(!ot)return;mt(!0)}})(),()=>{ot=!1}},[m?.gameState?.gameMode]);const Je=v.useCallback(()=>{const je=m?.gameState?.gameMode;(async()=>{try{const{Preferences:ot}=await zr(async()=>{const{Preferences:Pt}=await Promise.resolve().then(()=>Ic);return{Preferences:Pt}},void 0,import.meta.url);await ot.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,G.current=!1;return}const je=m?.singlePlayer===!0,ot=m?.gameState?.banker,Pt=ot&&i&&ot===i,Ft=h?.diceResults;if(!Ft||Ft.length!==3){re.current=!1,G.current=!1,Oe.current=null;return}const Me=Ft.join(",");if(Me===Oe.current)return;Oe.current=Me;const tt=[...Ft].sort().join(","),rt=tt==="4,5,6",be=rt||tt==="1,2,3";je||!Pt?(re.current=be,G.current=rt):(re.current=!1,G.current=!1)},[h?.diceResults,m?.gameState?.gameMode,m?.gameState,i]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){he.current=null;return}const je=m?.gameState?.bankRoll;if(!je||!Array.isArray(je.raw)||je.raw.length!==3){he.current=null;return}const ot=je.raw,Pt={};for(const tt of ot)Pt[tt]=(Pt[tt]||0)+1;const Ft=Object.keys(Pt).map(Number);Ft.length===2&&Ft.some(tt=>Pt[tt]===1)?he.current=Ft.find(tt=>Pt[tt]===1)||null:he.current=null},[m?.gameState?.bankRoll,m?.gameState?.gameMode]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){ve.current=!1;return}const je=m?.gameState?.banker;if(je&&i&&je===i){ve.current=!1;return}const Pt=he.current;if(Pt!==6){ve.current=!1;return}const Ft=h?.diceResults;if(!Ft||Ft.length!==3){ve.current=!1;return}const Me={};for(const be of Ft)Me[be]=(Me[be]||0)+1;const tt=Object.keys(Me).map(Number);if(tt.length===2&&tt.some(be=>Me[be]===1)){const be=tt.find(lt=>Me[lt]===1);be&&be>Pt?ve.current=!0:ve.current=!1}else{const be=tt.length===1;ve.current=be}},[h?.diceResults,m?.gameState,i,m?.gameState?.gameMode]),v.useEffect(()=>{if(!h?.diceSettled)return;const je=Date.now();if(re.current||G.current||ve.current){if(je-xe.current<800){re.current=!1,G.current=!1,ve.current=!1;return}xe.current=je,G.current&&St(!0),ve.current&&Ke(!0),re.current=!1,G.current=!1,ve.current=!1,st(ot=>ot+1)}},[h?.diceSettled]),_)return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(Bi,{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(Bi,{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 ue=m.gameState?.gameMode==="craps",Be=m.gameState?.gameMode!=="craps";return g.jsxs(i0e,{className:ue?"mode-craps":Be?"mode-ceelo":void 0,bgShakeTrigger:Ce,children:[g.jsx(Bi,{className:"page-gameroom"}),g.jsx(T_e,{}),g.jsx(fP,{open:it,onClose:Je,title:ue?"Craps":"Cee‑Lo",tagline:ue?"Place your bets and roll the point.":"Banker vs challengers. Roll to win.",steps:ue?["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:ue?"onb_craps_v1":"onb_ceelo_v1"}),g.jsxs("div",{className:"room-grid-fit",style:!He&&q&&!ue?{height:q}:void 0,children:[g.jsx("div",{className:"fairness-container",children:g.jsx(t0e,{roomId:t,lastRollerId:b,roundSeq:m?.gameState?.roundSeq,autoHideMs:ue?3e3:void 0})}),g.jsx("div",{ref:N,className:"room-grid"+(ue?" room-grid--craps":"")+(L<.999?" room-grid--scaled":""),style:L<.999?{transform:`scale(${L})`,transformOrigin:"top center",height:q||void 0}:void 0,children:ue?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"players-row",children:g.jsx(kL,{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 ${H?"is-muted":""}`,children:g.jsx(SL,{isWaiting:H,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 ot=m.players.find(Pt=>Pt.id===i)?.balance??r?.balance??1e3;return g.jsx(E_e,{meId:i,balance:ot})})()})]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"players-row",children:g.jsx(kL,{className:"player-panel",roomId:t,roomName:m.name,players:m.gameState.turnOrder.map(je=>m.players.find(ot=>ot.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(Eye,{gameMode:m.gameState?.gameMode,gameState:C}),g.jsx("div",{className:"table-wrap",children:g.jsx("div",{className:`felt ${H?"is-muted":""}`,children:g.jsx(SL,{isWaiting:H,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(kye,{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(R_e,{roomId:t,meId:i,bankerId:m.gameState.banker,players:m.players,gameState:C,gameplay:h})})]})]})})]}),g.jsx(bbe,{}),g.jsx(x6,{open:Y,onClose:K,peers:ee,initialPeerId:X}),g.jsx(r0e,{show:Ne,onComplete:()=>St(!1)}),g.jsx(n0e,{show:at,onComplete:()=>Ke(!1)})]})}function i0e({children:t,className:e,bgShakeTrigger:r}){const n=v.useRef(null),a=v.useRef(!0),{showAnimations:i}=$A();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 s0e(){const{user:t,refreshUser:e,logout:r}=Vr(),{updateProfile:n}=ga(),{membershipModalOpen:a,setMembershipModalOpen:i}=Bb(),{friends:o,friendRequests:c,blockedUsers:u,refreshSocial:d,isBlocked:f,blockUser:h,unblockUser:m,removeFriend:_,respondToFriendRequest:w}=FA(),[b,E]=v.useState(!1),[T,D]=v.useState(),{forUserId:P,anchorRect:A,anchorEl:C,openFor:O,close:I}=qA(),[x,R]=v.useState(null),[N,L]=v.useState(null),j=v.useCallback((Ge,Gt,xt,qt)=>{O(Ge,Gt),R(xt),L(qt||null)},[O]),q=v.useCallback(()=>{I(),R(null),L(null)},[I]),[U,Y]=v.useState(t?.name??""),[F,X]=v.useState(t?.email??""),[J,ee]=v.useState(t?.avatarUrl??""),[H,B]=v.useState(!1),[K,ae]=v.useState(null),[te,pe]=v.useState(!1),[ce,Re]=v.useState(null),[He,ie]=v.useState(!1),[xe,re]=v.useState(null),G=v.useRef(null),{onBuyChips:ve,onGoPremium:Oe,onRestore:he,busy:Ce,busyChips:st,ready:Ne,purchasesReady:St,isWeb:at,premiumActive:Ke,hasPremiumPackage:it,premiumLabel:mt,premiumSubtitle:Je,premiumDescription:ue,premiumPrice:Be,premiumInterval:je}=Lg(),[ot,Pt]=v.useState(!!t?.botChatDisabled),[Ft,Me]=v.useState(t?.ceeloBotsPerRoom??null),[tt,rt]=v.useState(t?.crapsBotsPerRoom??null),[be,lt]=v.useState(t?.pokerBotsPerRoom??null);v.useEffect(()=>{Y(t?.name??""),X(t?.email??""),ee(t?.avatarUrl??""),Pt(!!t?.botChatDisabled),Me(t?.ceeloBotsPerRoom??null),rt(t?.crapsBotsPerRoom??null),lt(t?.pokerBotsPerRoom??null)},[t?.id,t?.name,t?.email,t?.avatarUrl,t?.botChatDisabled,t?.ceeloBotsPerRoom,t?.crapsBotsPerRoom,t?.pokerBotsPerRoom]),v.useEffect(()=>{d()},[]);const yt=v.useCallback(async()=>{B(!0),ae(null);try{const Ge={};U!==t?.name&&(Ge.name=U),F!==t?.email&&(Ge.email=F),J!==t?.avatarUrl&&(Ge.avatarUrl=J),typeof ot=="boolean"&&(Ge.botChatDisabled=ot);const Gt=rf||WD,xt=rf||Go,qt=rf||Wo;Gt&&Ft!==(t?.ceeloBotsPerRoom??null)&&(Ge.ceeloBotsPerRoom=Ft),xt&&tt!==(t?.crapsBotsPerRoom??null)&&(Ge.crapsBotsPerRoom=tt),qt&&be!==(t?.pokerBotsPerRoom??null)&&(Ge.pokerBotsPerRoom=be);const Ot=await n(Ge);if(!Ot?.ok)ae(Ot?.error||"Failed to save");else{try{await e({force:!0})}catch{}await d()}}catch(Ge){ae(Ge?.message||"Failed to save")}finally{B(!1)}},[U,F,J,t?.name,t?.email,t?.avatarUrl,n,d,e,Ft,tt,be,ot]),tr=v.useCallback(async Ge=>{f(Ge)?await m(Ge):await h(Ge)},[f,h,m]),Or=v.useCallback(Ge=>{_(Ge)},[_]),ur=v.useCallback(Ge=>{D(Ge),E(!0)},[]),dr=v.useCallback(()=>{E(!1),D(void 0)},[]),fn=v.useCallback(async Ge=>{await w(Ge.id,"ACCEPT")},[w]);v.useCallback(async Ge=>{await w(Ge.id,"DECLINE")},[w]);const Z=v.useCallback(async Ge=>{pe(!0),Re(null);try{if(Ge.size>5242880){Re("File size must be less than 5MB");return}if(!["image/jpeg","image/jpg","image/png","image/webp","image/gif"].includes(Ge.type)){Re("File must be a valid image (JPEG, PNG, WebP, or GIF)");return}const qt=new FormData;qt.append("avatar",Ge);const Ot=String(GD??"http://localhost:4000").replace(/\/+$/,"");let An={},Cn;try{const nn=await li();nn&&(An={Authorization:`Bearer ${nn}`},Cn=nn)}catch{}const hn=new URL(`${Ot}/api/avatar/upload`);Cn&&hn.searchParams.set("token",Cn);const xn=await fetch(hn.toString(),{method:"POST",body:qt,headers:An,credentials:"include"});if(!xn.ok){const nn=await xn.json().catch(()=>({error:"Upload failed"}));throw new Error(nn.error||`Upload failed with status ${xn.status}`)}const Vi=await xn.json();Vi.avatarUrl&&ee(Vi.avatarUrl)}catch(Gt){Re(Gt?.message||"Failed to upload avatar")}finally{pe(!1)}},[]),fe=v.useCallback(Ge=>{const Gt=Ge.target.files?.[0];Gt&&Z(Gt),G.current&&(G.current.value="")},[Z]),ge=v.useCallback(()=>{if(!(t?.membershipTier==="PREMIUM")){try{i(!0)}catch{}return}G.current?.click()},[t,i]),Pe=v.useMemo(()=>{const Ge=new Map;for(const Gt of o)Ge.set(Gt.id,Gt);for(const Gt of u)Ge.has(Gt.id)||Ge.set(Gt.id,Gt);return Ge},[o,u]),De=v.useMemo(()=>c.map(Ge=>{const Gt=t?.id===Ge.toUserId,xt=Gt?Ge.fromUserId:Ge.toUserId;if(!xt)return null;const qt=(Gt?Ge.fromUser:Ge.toUser)||Pe.get(xt),Ot=qt?.name??xt,An=qt?.avatarUrl??void 0;return{id:xt,name:Ot,avatarUrl:An,_req:Ge,_incoming:Gt}}).filter(Boolean),[c,t?.id,Pe]),{showAnimations:W,toggleAnimations:$,ready:oe}=$A(),[ct,Nt]=v.useState(Oc.diceColorTheme);v.useEffect(()=>{(async()=>{try{const Ge=await au();Nt(Ge.diceColorTheme??Oc.diceColorTheme)}catch{Nt(Oc.diceColorTheme)}})()},[]);const Qt=v.useCallback(async Ge=>{try{if(!(t?.membershipTier==="PREMIUM")&&Ge!=="dice_white_black"){try{i(!0)}catch{}return}const xt=await au(),qt={...Oc,...xt,diceColorTheme:Ge};await y0(qt),Nt(Ge)}catch{}},[t,i]),Rt=v.useCallback(()=>i(!1),[i]);v.useEffect(()=>{e()},[]);const mr=rn(),Kr=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 Gt=String(GD??"http://localhost:4000").replace(/\/+$/,"");let xt;try{const Ot=await li();Ot&&(xt={Authorization:`Bearer ${Ot}`})}catch{}const qt=await fetch(`${Gt}/api/account`,{method:"DELETE",credentials:"include",headers:xt});if(!qt.ok){const Ot=await qt.json().catch(()=>({error:"Deletion failed"}));throw new Error(Ot.error||`Failed with status ${qt.status}`)}}catch(Ge){re(Ge?.message||"Failed to delete account")}finally{r()}},[mr]);return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(Bi,{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{ar("Light")}catch{}history.back()},children:[g.jsx(bd,{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:[J&&g.jsx("img",{src:J,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:G,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp,image/gif",onChange:fe,disabled:te,style:{display:"none"}}),g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{ar("Light")}catch{}ge()},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"}),ce&&g.jsxs("div",{className:"error-message",style:{marginTop:"8px"},children:[ce,ce.includes("Premium")&&g.jsx("div",{style:{marginTop:"8px"},children:g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{ar("Light")}catch{}Oe()},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(E_,{className:"friends-panel",players:o,meId:t?.id||"",onPlayerClick:Ge=>{const xt=document.querySelector(`[data-player-id="${Ge}"]`)?.querySelector(".avatar-ring");xt&&j(Ge,xt,"friends")}})}):g.jsx("span",{children:"No friends yet"})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Friend Requests:"}),De.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(E_,{className:"friends-panel",players:De,meId:t?.id||"",onPlayerClick:Ge=>{const xt=document.querySelector(`[data-player-id="${Ge}"]`)?.querySelector(".avatar-ring"),qt=De.find(Ot=>Ot.id===Ge);xt&&qt?._req&&j(Ge,xt,"requests",{id:qt._req.id,incoming:!!qt._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(E_,{className:"friends-panel",players:u,meId:t?.id||"",onPlayerClick:Ge=>{const xt=document.querySelector(`[data-player-id="${Ge}"]`)?.querySelector(".avatar-ring");xt&&j(Ge,xt,"blocked")}})}):g.jsx("span",{children:"No blocked users"})]}),P&&A&&x&&g.jsx(y6,{anchorRect:A,anchorEl:C,onClose:q,onMessages:x==="friends"?()=>{ur(P),q()}:void 0,onUnfriend:x==="friends"?()=>{Or(P),q()}:void 0,onBlockUser:x!=="requests"?async()=>{await tr(P),q()}:void 0,isFriend:x==="friends",isBlocked:x==="blocked",...x==="requests"&&N?.incoming?{onAddFriend:()=>{fn({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:Ge=>Y(Ge.target.value),disabled:H})})]}),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:Ge=>X(Ge.target.value),disabled:H})})]})]}),(()=>{const Ge=rf||WD,Gt=rf||Go,xt=rf||Wo;return g.jsxs(g.Fragment,{children:[(Ge||Gt)&&g.jsxs("div",{className:"profile-row profile-row--two",children:[Ge&&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:Ft==null?"":String(Ft),onChange:qt=>{const Ot=qt.target.value;Me(Ot===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Ot)))))},disabled:H,"aria-label":"Preferred number of bots in single-player Cee‑Lo rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((qt,Ot)=>g.jsx("option",{value:Ot,children:Ot},Ot))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]}),Gt&&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:tt==null?"":String(tt),onChange:qt=>{const Ot=qt.target.value;rt(Ot===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Ot)))))},disabled:H,"aria-label":"Preferred number of bots in single-player Craps rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((qt,Ot)=>g.jsx("option",{value:Ot,children:Ot},Ot))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})]}),xt&&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:be==null?"":String(be),onChange:qt=>{const Ot=qt.target.value;lt(Ot===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Ot)))))},disabled:H,"aria-label":"Preferred number of bots in single-player Poker rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((qt,Ot)=>g.jsx("option",{value:Ot,children:Ot},Ot))]}),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{ar("Light")}catch{}yt()},disabled:H,children:H?"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:!!W,onChange:()=>$(),"aria-label":W?"Disable animations (dice physics, chip flights, background shake)":"Enable animations (dice physics, chip flights, background shake)"}),g.jsx("span",{children:W?"Enabled":"Disabled"})]}),g.jsx("div",{className:"subtle",style:{opacity:.7},children:W?"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:ct==="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:ct==="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:ct==="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: ",rd.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{ar("Light")}catch{}try{ve()}catch{}},disabled:H||Ce||!Ne||!St,"aria-label":at?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",title:at?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",children:st?"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{ar("Light")}catch{}try{he()}catch{}},disabled:Ce||!Ne||!St,title:"Restore Purchases","aria-label":"Restore Purchases",children:"Restore"})})]}),g.jsxs("div",{className:"profile-section",children:[g.jsxs("strong",{children:["Membership:                                         ",t?.membershipTier===k_.PREMIUM?"Premium Active":"Free",g.jsx("span",{className:"badge","aria-live":"polite",children:t?.membershipTier===k_.PREMIUM?"P":""})]}),g.jsxs("div",{className:"editable-field",children:[t?.membershipTier===k_.PREMIUM?g.jsx(dP,{isPremium:!0,className:"felt-btn"}):it&&g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{ar("Light")}catch{}try{Oe()}catch{}},disabled:Ce,"aria-label":mt,title:mt,children:"Go Premium"}),!Ke&&it&&g.jsx("div",{className:"meta",style:{marginTop:6},children:(()=>{const Ge="$1.99",Gt="Monthly",xt=Be||Ge,qt=je||Gt,Ot=Je||`${xt} Mo`,An=ue||"Remove ads and unlock premium features.";return g.jsxs(g.Fragment,{children:[Ot&&g.jsx("div",{className:"subtle","aria-hidden":!0,children:Ot}),g.jsx("div",{className:"legal-note","aria-hidden":!0,children:An}),g.jsxs("div",{className:"legal-note",role:"note",children:[g.jsx("strong",{children:"Premium Subscription"})," — ",xt," (",qt,"). 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{ar("Light")}catch{}Kr()},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(pF,{open:a,onClose:Rt,planId:t?.membershipTier,featureDescription:"Upload custom avatars and create multiplayer rooms with Premium membership."}),g.jsx(x6,{open:b,onClose:dr,peers:o,initialPeerId:T}),g.jsx(_P,{})]})}function o0e(){const[t,e]=v.useState(Oc),[r,n]=v.useState(!1),a=v.useRef(null);v.useEffect(()=>{let o=!0;return(async()=>{const c=await au();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(()=>{y0(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 P6=ui();async function c0e(){try{const t=await li(),e=await fetch(`${P6}/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 l0e(){try{const t=await li(),e=await fetch(`${P6}/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 EL={claimAdReward:c0e,getAdRewardCooldown:l0e};function u0e(){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}=Lg(),{refreshUser:T}=Vr(),{infoNow:D,successNow:P}=Cs(),[A,C]=v.useState(!1),[O,I]=v.useState(0),[x,R]=v.useState(()=>Date.now()),N=Math.max(0,O-x),L=N>0,j=$E.isNativeAdSupported(),q=!i&&j,U=v.useCallback(ie=>{const xe=Math.ceil(ie/1e3),re=Math.floor(xe/60),G=xe%60;return`${re}m ${G}s`},[]);v.useEffect(()=>{q&&(async()=>{try{const ie=await EL.getAdRewardCooldown();ie?.ok&&ie.nextAt&&ie.nextAt>Date.now()&&I(ie.nextAt)}catch{}})()},[q]),v.useEffect(()=>{!q||L||$E.prepareRewardedAd().catch(()=>{})},[q,L]),v.useEffect(()=>{if(!L)return;const ie=setInterval(()=>R(Date.now()),1e3);return()=>clearInterval(ie)},[L]);const Y=v.useCallback(async()=>{if(!(A||L||!q)){ar("Light"),C(!0);try{const ie=await $E.showRewardedAd();if(!ie.ok){ie.error==="AD_DISMISSED"?D?.("Ad skipped - watch the full ad to earn credits!"):D?.(`Ad unavailable: ${ie.error}`),C(!1);return}const xe=await EL.claimAdReward();if(xe.ok){const re=QD*60*1e3;I(Date.now()+re),P?.(`+${hf} Z Credits earned!`);try{T()}catch{}}else if(xe.error==="COOLDOWN_ACTIVE"){const re=xe.retryInMs??QD*60*1e3;I(Date.now()+re),D?.("Please wait before watching another ad.")}else D?.(`Reward failed: ${xe.error}`)}catch{D?.("Something went wrong. Please try again.")}finally{C(!1)}}},[A,L,q,D,P,T]),F="$1.99",X="Monthly",J=b||F,ee=E||X,H=m||`${J} 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,pe=_||ae,ce=()=>{try{ar("Light")}catch{}try{u()}catch{}},Re=()=>{try{ar("Light")}catch{}try{d()}catch{}},He=()=>{try{ar("Light")}catch{}try{f()}catch{}};return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(Bi,{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{ar("Light")}catch{}history.back()},children:[g.jsx(bd,{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:Y,disabled:A||L,"aria-label":`Watch ad for ${hf} free credits`,title:`Watch ad for ${hf} free credits`,style:{background:"linear-gradient(135deg, #2d5a2d 0%, #1a3d1a 100%)",borderColor:"#4a8f4a"},children:A?"Loading Ad…":L?`Available in ${U(N)}`:`🎬 WATCH AD → +${hf}`}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[g.jsxs("div",{className:"subtle","aria-hidden":!0,children:["Free ",hf," 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:ce,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:pe})]})]}),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:Re,disabled:t,"aria-label":c,title:c,children:"GO PREMIUM"}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[H&&g.jsx("div",{className:"subtle","aria-hidden":!0,children:H}),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"})," — ",J," (",ee,"). 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(dP,{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(_P,{})]})}function GA({open:t,onClose:e,title:r="Error",message:n}){return lB(!!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 d0e(){const[t,e]=v.useState("verifying"),r=rn(),{refreshUser:n}=Vr();v.useEffect(()=>{(async()=>{const c=new URLSearchParams(window.location.search).get("token");if(!c)return e("error");try{const u=await W9(c);if(u?.success){u.token&&await Zf(u.token);try{await n({force:!0})}catch{}try{setTimeout(()=>{n({force:!0}).catch(()=>{})},400)}catch{}if(await Rb()){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(GA,{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(Bi,{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 f0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=rn(),i=ui();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 Zf(h.token)}catch{}if(f=await Rb(),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(GA,{open:r,onClose:()=>n(!1),title:"Review login failed",message:"Review login failed. Please check your link."})})}function p0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=rn(),i=ui();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 Zf(h.token)}catch{}if(await Rb()){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(GA,{open:r,onClose:()=>n(!1),title:"QA login failed",message:"QA login failed. Please check your link."})})}function h0e({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=la.chipFlyDurationMs,o=0,c=100;n.current=window.setTimeout(()=>{try{MG({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(Js.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:la.chipFlyDurationMs/1e3},onAnimationComplete:e,style:{pointerEvents:"none"},children:g.jsx(Qs,{mini:!0,value:r.amount,disabled:!0,className:"chip--flight",selectedTimes:0})})}function Em({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 jo({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]=Ct.useState(!1),m=Ct.useCallback(()=>{try{Lr()}catch{}h(!1),requestAnimationFrame(()=>{h(!0),window.setTimeout(()=>h(!1),260)});try{ar("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(Em,{label:t,subtitle:e,onClick:m,disabled:n,size:a,ariaLabel:i,className:d,showHalo:_})})}function m0e(){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 R=x.getBoundingClientRect();return{x:R.left+R.width/2,y:R.top+R.height/2}},b=v.useCallback((x,R,N)=>{const L=w(x),j=w(R);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(Y=>[...Y,U])},[]),E=()=>{b(_.current.c1,m.current,25)},T=()=>{["c1","c2","c3","c4"].forEach((x,R)=>{setTimeout(()=>b(_.current[x],m.current,5*(R+1)),R*40)})},D=()=>{["c1","c2","c3","c4"].forEach((x,R)=>{setTimeout(()=>b(m.current,_.current[x],10*(R+1)),R*40)})},P=x=>{h(R=>R.filter(N=>N.id!==x))},A=x=>{n(R=>({...R,[x]:(R[x]||0)+1})),i(R=>R+x)},C=x=>{n(R=>({...R,[x]:0})),i(R=>R-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(Bi,{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:D,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:R=>{_.current[x]=R},children:g.jsx(Qs,{mini:!0,value:5,disabled:!0,className:"chip--flight"})},x))}),g.jsxs("div",{ref:m,children:[g.jsx(Qs,{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:R=>{_.current[x]=R},children:g.jsx(Qs,{mini:!0,value:25,disabled:!0,className:"chip--flight"})},x))})]})]}),f.map(x=>g.jsx(h0e,{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(jo,{label:"Check",ariaLabel:"Check",size:"md",className:"poker-action--green poker-action--secondary poker-action--check",onClick:()=>{}}),g.jsx(jo,{label:"Call",subtitle:"z120",ariaLabel:"Call 120",size:"md",className:"poker-action--green poker-action--primary poker-action--call",onClick:()=>{}}),g.jsx(jo,{label:"Bet",subtitle:"z250",ariaLabel:"Bet 250",size:"md",className:"poker-action--flat poker-action--secondary poker-action--bet",onClick:()=>{}}),g.jsx(jo,{label:"Raise",subtitle:"z400",ariaLabel:"Raise 400",size:"md",className:"poker-action--flat poker-action--secondary poker-action--raise",onClick:()=>{}}),g.jsx(jo,{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(Xz,{onClick:()=>{},label:"ROLL",busy:!1,disabled:!1})}),g.jsx("div",{className:"button-item",children:g.jsx(YC,{onClick:()=>{},busy:!1,disabled:!1,label:"Cancel Bet"})}),g.jsx("div",{className:"button-item",children:o?g.jsx(YC,{onClick:I,busy:!1,disabled:!1,label:"Cancel Bet"}):g.jsx(Yz,{disabled:a<=0,onClick:O,busy:!1,label:"✓"})}),g.jsx("div",{className:"button-item",children:g.jsx(w0,{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(bP,{state:"verified"})})]})]})}function g0e(){const t=rn(),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(bd,{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 y0e(){const t=rn();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(bd,{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 v0e(){const t=rn();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(bd,{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 _0e(){const t=rn();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(bd,{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."]})]})})}ui();function WA({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(Bi,{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 b0e({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(TL,{value:n,revealed:!!e||!!r}),g.jsx(TL,{value:a,revealed:!!r})]})}function TL({value:t,revealed:e=!1}){if(!t)return g.jsx("span",{className:"poker-card"+(e?" revealed":""),"aria-hidden":!0});const{rank:r,suit:n}=k0e(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:w0e(n)})]})}function k0e(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 w0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function S0e({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}=Cs();v.useEffect(()=>{const f=o.current,h=t||{};o.current=h;const m=h?.pokerLastAction;if(m&&typeof m.seq=="number"){const X=(Array.isArray(h?.pokerSeats)?h.pokerSeats:[]).find(J=>J.seatIndex===m.seatIndex);if(X){const J=e.find(te=>te.id===X.playerId),ee=J?.name||J?.email||"Player";let H;const B=te=>typeof te=="number"?`z${te.toLocaleString("en-US")}`:"";switch((m.action||"").toLowerCase()){case"fold":H="Fold";break;case"check":H="Check";break;case"call":H=`Call ${B(m.amountDelta)}`;break;case"bet":H=`Bet ${B(m.amountDelta)}`;break;case"raise":H=m.toBet?`Raise to ${B(m.toBet)}`:`Raise ${B(m.amountDelta)}`;break;default:H="Action";break}const ae=`srv:${Number(h?.pokerRoundSeq||0)||0}:${m.seq}`;u.current!==ae&&(d(`${ee}: ${H}`,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 X=new Map;for(const J of F)X.set(J.seatIndex,J);return X},D=T(b),P=T(E),A=f?.pokerActingSeat,C=h?.pokerActingSeat,O=f?.pokerCurrentBet||0,I=h?.pokerCurrentBet||0;let x=null,R=null;for(const F of E){const X=D.get(F.seatIndex);if(X&&(X.status==="active"||X.status==="all-in")&&F.status==="folded"){x=F,R="Fold";break}}if(!R)for(const F of E){const X=D.get(F.seatIndex);if(!X)continue;const J=(F.committed||0)-(X.committed||0);if(J>0){x=F,O===0?R=`Bet z${J}`:I>O?R=`Raise to z${I}`:R=`Call z${J}`;break}}if(!R&&A!=null&&C!=null&&A!==C){const F=D.get(A),X=P.get(A);F&&X&&F.status==="active"&&X.status==="active"&&(F.committed||0)===(X.committed||0)&&(x=X,R="Check")}if(!R||!x)return;const N=e.find(F=>F.id===x.playerId),j=`${N?.name||N?.email||"Player"}: ${R}`,q=Number(h?.pokerRoundSeq||0)||0;try{const F=typeof window<"u"?window:void 0,X=F&&F.__pokerWinnersFlashGuard;if(X&&X.roundSeq===q)return}catch{}const U=Number(x?.committed||0),Y=`heur:${q}:${x.seatIndex}:${R}:${U}:${I}`;u.current!==Y&&(d(j,void 0),u.current=Y)},[t,e,d,a])}function CL({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,D=a?.yPct??.78;return{x:E.width*T,y:E.height*D}},[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{np(["cardSwoosh"])}catch{}(async()=>{const D=await O_(["cardSwoosh"],900);m(D)})();const b=d.length*Math.max(1,c);if(b===0){const D=setTimeout(()=>e?.(),10);return()=>clearTimeout(D)}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 D=0;D<d.length;D++){const P=T*d.length+D;b.push({key:`card-${T}-${D}`,delay:P*n,to:d[D]})}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 D=0,P=!0;for(const A of w){const C=Math.max(0,(A.delay||0)*1e3),I=Math.max(C+(P?30:0),D+T),x=window.setTimeout(()=>{try{jG({volume:.0125})}catch{}},I);D=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(Js.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 E0e({players:t,entries:e,onClose:r}){const n=Ct.useCallback((o,c)=>t.find(u=>u.id===o)?.name||`Seat ${c+1}`,[t]),a=Ct.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=Ct.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 T0e(){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 QC=["A","K","Q","J","10","9","8","7","6","5","4","3","2"],C0e={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 A6(t){const e=String(t||"").trim().toUpperCase();if(!e)return null;const r=e.slice(0,-1),n=r==="T"?"10":r;return QC.includes(n)?n:null}function R6(t){return t.map(A6).filter(e=>e!==null)}function KA(t){const e=R6(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 x0e(t){return KA(t).length>0}function P0e(t){const e=R6(t);if(e.length===0)return null;let r=null,n=QC.length;for(const a of e){const i=QC.indexOf(a);i!==-1&&i<n&&(n=i,r=a)}return r}function A0e(t){const e=P0e(t);return e?`${C0e[e]} High`:null}function R0e(t,e){if(e<0||e>=t.length)return!1;const r=A6(t[e]);return r?KA(t).includes(r):!1}function D0e(t){const e=[];if(!t||t.length===0)return e;x0e(t)&&e.push({label:"Paired Board",type:"paired"});const r=A0e(t);return r&&e.push({label:r,type:"high"}),e}function O0e(t){return t<0||t>4?null:t<=2?"flop":t===3?"turn":"river"}function N0e({boardCards:t}){const e=D0e(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 I0e(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 M0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function j0e({value:t,concealed:e,position:r,isPaired:n,animateEntrance:a}){if(!t)return null;const{rank:i,suit:o}=I0e(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:M0e(o)})]})}const Uh=Object.create(null),KE=Object.create(null);function L0e(){const{roomId:t}=c3(),{user:e,refreshUser:r}=Vr(),n=Ss(),{onHandEnd:a}=S0(),i=String(e?.id??e?.email??""),{joinRoom:o,leaveRoom:c,connected:u,participants:d,localParticipant:f}=gu(),h=T0e();v.useEffect(()=>{const Q=()=>{try{Dx()||Lr()}catch{}};Q();const de=["pointerdown","touchstart","mousedown","click","keydown"];return de.forEach(me=>{document.addEventListener(me,Q,{once:!0,capture:!0})}),()=>{de.forEach(me=>{document.removeEventListener(me,Q,{capture:!0})})}},[]);const{pokerJoinRoom:m,pokerStartHand:_,pokerFold:w,pokerCheck:b,pokerCall:E,pokerBet:T,pokerRaise:D,pokerFetchHistory:P}=ga(),{info:A,win:C,onIdle:O,show:I}=Cs(),[x,R]=v.useState(null);v.useEffect(()=>{const Q=x?.gameState?.pokerPhase;return Q&&Q!=="waiting"?h.acquire():h.release(),()=>{h.release()}},[x?.gameState,h]);const[N,L]=v.useState(!1),j=Ct.useRef(!1),[q,U]=v.useState(null),[Y,F]=v.useState(!1),[X,J]=v.useState(!1),[ee,H]=v.useState(!1),B=Ct.useRef(!1),K=Ct.useRef(!1),ae=Ct.useRef(null);Ct.useEffect(()=>{B.current=ee},[ee]),Ct.useEffect(()=>{K.current=Y},[Y]),Ct.useEffect(()=>{ae.current=q},[q]),Ct.useEffect(()=>{j.current=N},[N]),Ct.useEffect(()=>{(!q||q.length!==2)&&(Be.current=0)},[q]);const te=Ct.useRef(null),pe=Ct.useRef(0);Ct.useRef(0);const ce=Ct.useRef(null),Re=Ct.useRef(null),He=Ct.useRef(null),[ie,xe]=v.useState(0),[re,G]=v.useState(0),[ve,Oe]=v.useState([]),[he,Ce]=v.useState([]),[st,Ne]=v.useState(!1),[St,at]=v.useState([]),Ke=Ct.useRef(0),it=Ct.useRef(0),mt=Ct.useRef(0),Je=Ct.useRef(!1),ue=Ct.useRef(null),Be=Ct.useRef(0),je=Ct.useRef(void 0),ot=Ct.useRef(0),[Pt,Ft]=Ct.useState([]),Me=Ct.useRef(0),tt=Ct.useRef(0),rt=Ct.useRef(0),[be,lt]=Ct.useState(!1),yt=Ct.useRef(0),tr=Ct.useRef(new Set),Or=Ct.useRef(null),ur=Ct.useRef(null),[dr,fn]=v.useState(0),[Z,fe]=v.useState(0),[ge,Pe]=Ct.useState(new Set),De=Ct.useRef([]),W=Ct.useRef(null),$=Ct.useRef(0),oe=!0,[ct,Nt]=v.useState(!0),Qt=Ct.useRef(0),Rt=Ct.useRef(null),mr=Ct.useRef(null),Kr=Ct.useRef(null),Ge=Ct.useMemo(()=>e?e.id:"",[e]),[Gt,xt]=v.useState(!1);v.useEffect(()=>{let Q=!0;return(async()=>{try{const{Preferences:de}=await zr(async()=>{const{Preferences:Le}=await Promise.resolve().then(()=>Ic);return{Preferences:Le}},void 0,import.meta.url),{value:me}=await de.get({key:"onb_poker_v1"});if(!Q)return;xt(me!=="1")}catch{if(!Q)return;xt(!0)}})(),()=>{Q=!1}},[]);const qt=Ct.useCallback(()=>{(async()=>{try{const{Preferences:Q}=await zr(async()=>{const{Preferences:de}=await Promise.resolve().then(()=>Ic);return{Preferences:de}},void 0,import.meta.url);await Q.set({key:"onb_poker_v1",value:"1"})}catch{}xt(!1)})()},[]);Ct.useEffect(()=>{let Q=!1,de=null,me=null,Le=null;const we=Ze=>{try{const bt=Ze.getBoundingClientRect();if(bt&&isFinite(bt.height)){const sn=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 480px)").matches?85:Math.round(bt.height);document.body.style.setProperty("--poker-header-height",`${sn}px`)}}catch{}},Ve=()=>{if(Q||typeof document>"u")return;const Ze=document.querySelector(".card-header.card-header--two-rows");if(Ze){Rt.current=Ze;try{de=new ResizeObserver(()=>we(Ze)),de.observe(Ze)}catch{Le=()=>we(Ze),window.addEventListener("resize",Le)}we(Ze)}};if(Ve(),!Rt.current)try{me=window.setTimeout(Ve,0)}catch{}return()=>{Q=!0;try{document.body.style.removeProperty("--poker-header-height")}catch{}if(de)try{de.disconnect()}catch{}if(Le){try{window.removeEventListener("resize",Le)}catch{}Le=null}if(me!=null){try{clearTimeout(me)}catch{}me=null}}},[]);const Ot=Ct.useCallback(Q=>{try{const me=document.body.querySelector(`li.player--avatar[data-player-id="${Q}"]`),we=(me?.querySelector(".avatar-ring")||me)?.getBoundingClientRect();return we?{x:we.left+we.width/2,y:we.top+we.height/2}:null}catch{return null}},[]),An=Ct.useCallback(()=>{try{const Q=ue.current;if(!Q)return null;const de=Q.querySelectorAll(".poker-pot-stack");if(!de||de.length===0){const Ze=Q.getBoundingClientRect();return Ze?{x:Ze.left+Ze.width/2,y:Ze.top+Ze.height/2}:null}let me=1/0,Le=1/0,we=-1/0,Ve=-1/0;return de.forEach(Ze=>{const bt=Ze.getBoundingClientRect();bt&&(me=Math.min(me,bt.left),Le=Math.min(Le,bt.top),we=Math.max(we,bt.right),Ve=Math.max(Ve,bt.bottom))}),!isFinite(me)||!isFinite(Le)||!isFinite(we)||!isFinite(Ve)?null:{x:(me+we)/2,y:(Le+Ve)/2}}catch{return null}},[]);v.useEffect(()=>{O(()=>{try{const Q=he||[];if(!Q.length)return;Qt.current=Date.now();const de=An();if(!de)return;const me=[],Le=Number(re||x?.gameState?.pokerRoundSeq||0)||Date.now();if(Le&&Me.current===Le)return;Q.forEach((we,Ve)=>{const Ze=Ot(we.playerId);Ze&&me.push({id:`poker-pot-${Le}-${Ve}`,amount:Math.max(1,Number(we.amount||0)),fromId:"pot",toId:we.playerId,startX:de.x,startY:de.y,endX:Ze.x,endY:Ze.y})}),me.length&&(Me.current=Le,tt.current=Le,rt.current=me.length,Ft(we=>[...we,...me]),Nt(!1))}catch{}})},[he,re,x?.gameState]),v.useEffect(()=>{const Q=x?.gameState?.pokerPhase,de=Array.isArray(he)&&he.length>0&&Q!=="pre-flop"?he.map(Ve=>String(Ve.playerId)):[],me=tr.current,Le=new Set(de),we=(Ve,Ze)=>{try{const bt=document.querySelector(`li.player--avatar[data-player-id="${Ve}"]`);bt&&(Ze?bt.classList.add("player--winner-shake"):bt.classList.remove("player--winner-shake"))}catch{}};return me.forEach(Ve=>{Le.has(Ve)||we(Ve,!1)}),Le.forEach(Ve=>{me.has(Ve)||we(Ve,!0)}),tr.current=Le,()=>{tr.current.forEach(Ve=>we(Ve,!1)),tr.current.clear()}},[he,x?.gameState]),v.useEffect(()=>{try{window.__pokerRoomMounted=Date.now()}catch{}},[]),v.useEffect(()=>()=>{if(De.current.forEach(Q=>clearTimeout(Q)),De.current=[],W.current&&(clearTimeout(W.current),W.current=null),ce.current!=null&&(clearTimeout(ce.current),ce.current=null),Re.current!=null&&(clearTimeout(Re.current),Re.current=null),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}He.current=null;try{const Q=String(t||"");if(Q&&ae.current&&ae.current.length===2){const de=x?.gameState||{},me=Number(de?.pokerRoundSeq||Be.current||0)||0;Uh[Q]={myHole:ae.current.slice(),roundSeq:me,first:!!X,both:!!Y,ts:Date.now()};try{const Le=window;Le&&(Le.__pokerHoleDiag=Le.__pokerHoleDiag||[],Le.__pokerHoleDiag.push({kind:"persist_hole_on_unmount",at:Date.now(),round:me}))}catch{}}}catch{}},[]),v.useEffect(()=>{const Q=String(t||"");if(Q)try{const de=Uh[Q];if(!de)return;if(!(Date.now()-(de.ts||0)<3e4)){delete Uh[Q];return}if(Array.isArray(de.myHole)&&de.myHole.length===2){U(de.myHole.slice()),Be.current=Number(de.roundSeq||0)||Be.current||0,de.first&&J(!0),de.both&&F(!0);try{const Le=window;Le&&(Le.__pokerHoleDiag=Le.__pokerHoleDiag||[],Le.__pokerHoleDiag.push({kind:"restore_persisted_hole_on_mount",at:Date.now(),round:de.roundSeq}))}catch{}}}catch{}},[t]);function Cn(Q){if(!Q||typeof Q.category!="number")return;const de=Q.category|0,me=Array.isArray(Q.tiebreak)?Q.tiebreak:[],Le=Ve=>"23456789TJQKA"[Math.max(0,Math.min(12,Ve))]||"?",we=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"})[Le(Ve)]||Le(Ve);switch(de){case 8:return`Straight Flush (${we(me[0]??0)} high)`;case 7:return`Four of a Kind (${we(me[0]??0)}s)`;case 6:return`Full House (${we(me[0]??0)}s over ${we(me[1]??0)}s)`;case 5:return`Flush (${[me[0],me[1],me[2],me[3],me[4]].filter(Ve=>Ve!=null).map(Ve=>Le(Ve)).join("")})`;case 4:return`Straight (${we(me[0]??0)} high)`;case 3:return`Three of a Kind (${we(me[0]??0)}s)`;case 2:return`Two Pair (${we(me[0]??0)}s & ${we(me[1]??0)}s)`;case 1:return`One Pair (${we(me[0]??0)}s)`;default:return`High Card (${we(me[0]??0)})`}}v.useEffect(()=>{if(!t)return;let Q=!1;const de=m,me=r;return(async()=>{if(Or.current!==t&&!(x&&x.id===t))try{const Le=KE[t]||(async()=>de(t))();KE[t]=Le;const we=await Le;if(!Q&&we?.ok){Or.current=t,R(we.room);try{o&&ur.current!==t&&(await Promise.resolve(o(t)),ur.current=t)}catch{}try{await me()}catch{}}else if(!Q&&we&&!we.ok)try{A("Poker",we.error||"Failed to join room")}catch{}}catch{}finally{delete KE[t]}})(),()=>{Q=!0,Or.current===t&&(Or.current=null),c&&ur.current===t&&(ur.current=null,c().catch(()=>{}))}},[t]);const hn=Ct.useCallback((Q,de)=>{if(!Q||Q.id&&de?.id&&Q.id!==de.id)return de;try{const me=Array.isArray(Q.players)?Q.players:[],Le=Array.isArray(de?.players)?de.players:[];if(Le.length===0&&me.length>0)return{...Q,...de,players:me};const we=Le.map(Ve=>{const Ze=me.find(bt=>String(bt.id)===String(Ve.id));return Ze?{...Ze,...Ve}:Ve});return{...Q,...de,players:we}}catch{return de||Q}},[]);Da({onJoinedRoom:({room:Q})=>{try{if(Q&&Q.id===t){R(de=>de&&de.id===Q.id?hn(de,Q):Q),Or.current=t||null;try{const de=Q?.gameState;if(!j.current&&de&&typeof de.pokerPhase=="string"&&de.pokerPhase.length>0){L(!0);const me=de.pokerPhase;me&&me!=="pre-flop"&&me!=="waiting"&&H(!1)}}catch{}}}catch{}},onRejoinedRoom:({room:Q})=>{try{if(Q&&Q.id===t){R(de=>de&&de.id===Q.id?hn(de,Q):Q),Or.current=t||null,H(!1);try{const de=Q?.gameState;!j.current&&de&&typeof de.pokerPhase=="string"&&de.pokerPhase.length>0&&L(!0)}catch{}}}catch{}},onOtherPlayerJoined:({room:Q})=>{try{Q&&Q.id===t&&R(de=>de&&de.id===Q.id?hn(de,Q):Q)}catch{}},onOtherLeft:({room:Q})=>{try{Q&&Q.id===t&&R(de=>de&&de.id===Q.id?hn(de,Q):Q)}catch{}},onPlayerBalanceUpdated:({playerId:Q,balance:de})=>{R(me=>{if(!me||!Array.isArray(me.players))return me;const Le=me.players.findIndex(Ze=>String(Ze.id)===String(Q));if(Le===-1)return me;const we=me.players.slice(),Ve=we[Le];return typeof Ve?.balance=="number"&&Ve.balance===de?me:(we[Le]={...Ve,balance:de},{...me,players:we})})},onRoomUpdateState:Q=>{if(!Q||Q.roomId!==t)return;if(Q.myHole&&Array.isArray(Q.myHole)&&Q.myHole.length===2){const we=Number(Q?.room?.gameState?.pokerRoundSeq||0);if(!ae.current||ae.current.length!==2||Be.current&&Be.current!==we){U(Q.myHole),we>0&&(Be.current=we),pe.current=Date.now();try{const Ze=typeof window<"u"?window:void 0;Ze&&(Ze.__pokerHoleDiag=Ze.__pokerHoleDiag||[],Ze.__pokerHoleDiag.push({kind:"hole_from_state",at:Date.now(),round:we}))}catch{}const Ve=Q?.room?.gameState?.pokerPhase;!B.current&&Ve!=="pre-flop"&&(J(!0),setTimeout(()=>F(!0),180))}}R(we=>{try{const Ve=Q?.room,Ze=Ve?.gameState;if(!we||we.id&&we.id!==Q.roomId)return Ve&&Ve.id===Q.roomId?Ve:we;let bt=Ze?{...we,gameState:Ze}:{...we};return Ve&&Ve.id===we.id&&(bt=hn(bt,Ve),Ze&&(bt.gameState=Ze)),bt}catch{return we}});try{const we=Q?.room?.gameState;!j.current&&we&&typeof we.pokerPhase=="string"&&we.pokerPhase.length>0&&L(!0)}catch{}const de=Q?.room?.gameState?.pokerPhase,me=Number(Q?.room?.gameState?.pokerRoundSeq||0),Le=je.current;if(je.current=de,(de||"")==="pre-flop"){const we=me>0&&me!==Ke.current&&me!==it.current,Ve=!Le||["waiting","showdown","complete"].includes(String(Le));if(we&&Ve){if(F(!1),J(!1),ae.current&&ae.current.length===2)if(Be.current===0){Be.current=me;try{const bt=typeof window<"u"?window:void 0;bt&&(bt.__pokerHoleDiag=bt.__pokerHoleDiag||[],bt.__pokerHoleDiag.push({kind:"assign_hole_round_on_preflop",at:Date.now(),round:me}))}catch{}}else if(Be.current!==me){U(null);try{const bt=String(t||"");bt&&delete Uh[bt]}catch{}try{const bt=typeof window<"u"?window:void 0;bt&&(bt.__pokerHoleDiag=bt.__pokerHoleDiag||[],bt.__pokerHoleDiag.push({kind:"clear_hole_new_round",at:Date.now(),toRound:me,prevHoleRound:Be.current}))}catch{}}else try{const bt=typeof window<"u"?window:void 0;bt&&(bt.__pokerHoleDiag=bt.__pokerHoleDiag||[],bt.__pokerHoleDiag.push({kind:"keep_hole_new_round",at:Date.now(),round:me}))}catch{}else Be.current=0;it.current=me,$.current=Date.now(),xe(me);try{np(["cardSwoosh"])}catch{}const Ze=ot.current!==me;Ze&&(ot.current=me),(async()=>{if(await O_(["cardSwoosh"],900),H(!0),Ze)try{gT({volume:.6})}catch{}})()}else if(we&&!Ve)try{const Ze=window;Ze&&(Ze.__pokerHoleDiag=Ze.__pokerHoleDiag||[],Ze.__pokerHoleDiag.push({kind:"skip_preflop_midhand",at:Date.now(),round:me,prevPhase:Le}))}catch{}G(0),Oe([]),Ce([]),Nt(!0)}else if((de||"")==="waiting"){if(F(!1),J(!1),H(!1),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}xe(we=>we+1),it.current=0,ae.current||(Be.current=0);try{const we=String(t||"");we&&!ae.current&&delete Uh[we]}catch{}}},onPokerMyHole:Q=>{if(!(!Q||Q.roomId!==t)&&Array.isArray(Q.hole)&&Q.hole.length===2){U(Q.hole);try{const Le=x?.gameState||{},we=Number(Le?.pokerRoundSeq||0);we>0&&(Be.current=we)}catch{}pe.current=Date.now();try{const Le=typeof window<"u"?window:void 0;Le&&(Le.__pokerHoleDiag=Le.__pokerHoleDiag||[],Le.__pokerHoleDiag.push({kind:"hole",at:Date.now(),phase:x?.gameState?.pokerPhase,dealing:B.current,round:Number(x?.gameState?.pokerRoundSeq||0)}))}catch{}const me=(x?.gameState?.pokerPhase||"")==="pre-flop";if(j.current)if(!ee&&!me)J(!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 Le=Date.now();if(B.current&&Le-(pe.current||Le)>3e3&&H(!1),!j.current&&Le-(pe.current||Le)<4e3){try{te.current=window.setTimeout(()=>{},500)}catch{}return}J(!0),F(!0);try{const Ve=typeof window<"u"?window:void 0;Ve&&(Ve.__pokerHoleDiag=Ve.__pokerHoleDiag||[],Ve.__pokerHoleDiag.push({kind:"fallback_reveal",at:Le}))}catch{}},1800)}catch{}}}},onPokerRevealAll:Q=>{if(!Q||Q.roomId!==t)return;const de=Number(Q?.roundSeq||0),me=Number(x?.gameState?.pokerRoundSeq||0);if(de&&me){const Le=de===me,we=me===de+1;if(!Le&&!we)return}if(!(re&&re===de)&&Array.isArray(Q.hands)){Oe(Q.hands.filter(we=>Array.isArray(we?.hole)&&we.hole.length===2)),G(de||me||Date.now());const Le=Array.isArray(he)&&he.length>0?he:[];if((de||me)&&Le.length>0){const we=Number(de||me),Ze=Le.reduce((bt,Er)=>bt+(Number(Er.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;at(bt=>{const Er=bt.findIndex(fr=>fr.roundSeq===we),sn={roundSeq:we,ts:Date.now(),winners:Le.slice(),hands:(Q.hands||[]).slice(),pot:Ze,seats:Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats.map(fr=>({playerId:fr.playerId,seatIndex:fr.seatIndex,status:fr.status,rank:Le.find(on=>on.playerId===fr.playerId)?.rank||void 0,winnings:Le.find(on=>on.playerId===fr.playerId)?.amount})):void 0};if(Er>=0){const fr=bt.slice();return fr[Er]=sn,fr}return[...bt,sn].slice(-20)})}}},onPokerWinners:Q=>{if(!Q||Q.roomId!==t)return;const de=Number(Q?.roundSeq||0),me=Number(x?.gameState?.pokerRoundSeq||0);if(de&&me){const we=de===me,Ve=me===de+1;if(!we&&!Ve)return}re&&re===de?Ce(we=>we.length?we:Array.isArray(Q.winners)?Q.winners:[]):(Ce(Array.isArray(Q.winners)?Q.winners:[]),re||G(de||me||Date.now()));try{const we=Number(de||me||0)||0;if(we&&mt.current!==we){const Ve=Array.isArray(Q.winners)?Q.winners:[],bt=Ve.slice().sort((fr,on)=>String(fr.playerId).localeCompare(String(on.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,sn=Er&&Er.__pokerWinnersFlashGuard;if(!sn||sn.roundSeq!==we||sn.content!==bt){const fr=Ve.find(za=>za&&za.rank&&typeof za.rank.category=="number"),on=Cn(fr?.rank),oc=Ve.reduce((za,tl)=>za+(Number(tl.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0,_u=oc>0?`Pot: z${oc}`:void 0,Ki=[on,_u].filter(Boolean).join(" ");Er&&(Er.__pokerWinnersFlashGuard={roundSeq:we,content:bt,at:Date.now()});try{Er&&(Er.__pokerWinnersFlashed=!0)}catch{}const Cd=String(e?.id??e?.email??"");if(Ve.some(za=>String(za.playerId)===Cd)){const za=Ve.find(P0=>String(P0.playerId)===Cd),tl=Number(za?.amount||0),Jg=tl>0?`You won: z${tl}`:"You won!";try{I({kind:"win",title:Jg,subtitle:Ki,duration:4e3})}catch{}try{Er&&(Er.__E2E===!0||(Er.location?.search||"").includes("e2e=1"))&&(Er.__pokerWinnersFlashed={title:Jg,subtitle:Ki,roundSeq:we,at:Date.now(),__viaServer:!0})}catch{}}mt.current=we}}}catch{}try{const we=String(e?.id??e?.email??""),Ve=Array.isArray(Q.winners)?Q.winners:[];if(!Ve.some(bt=>String(bt.playerId)===we)){let bt=0;const sn=(Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats:[]).find(Ki=>String(Ki.playerId||"")===we),fr=Number(sn?.committed||0),on=Number(sn?.returned||0);fr>0&&(bt=Math.max(0,fr-(Number.isFinite(on)?on:0)));const Ns=Ve.find(Ki=>Ki&&Ki.rank&&typeof Ki.rank.category=="number"),oc=Ns?`Winner: ${Cn(Ns.rank)}`:void 0,_u=bt>0?`You lost: z${bt}`:"You lost";try{O(()=>{try{I({kind:"lose",title:_u,subtitle:oc})}catch{}})}catch{}}}catch{}try{const we=Number(de||me||0);we&&yt.current!==we&&(yt.current=we,lt(!0),setTimeout(()=>lt(!1),5200))}catch{}const Le=Array.isArray(ve)&&ve.length>0?ve:[];if((de||me)&&Le.length>0){const we=Number(de||me),Ve=Array.isArray(Q.winners)?Q.winners:[],bt=Ve.reduce((Er,sn)=>Er+(Number(sn.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;at(Er=>{const sn=Er.findIndex(on=>on.roundSeq===we),fr={roundSeq:we,ts:Date.now(),winners:Ve.slice(),hands:Le.slice(),pot:bt,seats:Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats.map(on=>({playerId:on.playerId,seatIndex:on.seatIndex,status:on.status,rank:Ve.find(Ns=>Ns.playerId===on.playerId)?.rank||void 0,winnings:Ve.find(Ns=>Ns.playerId===on.playerId)?.amount})):void 0};if(sn>=0){const on=Er.slice();return on[sn]=fr,on}return[...Er,fr].slice(-20)})}try{a()}catch{}},onPokerTimedOut:Q=>{try{if(!Q||Q.roomId!==t)return;const de=String(e?.id??e?.email??"");if(Q.playerId!==de)return;const me=Q.action==="check"?"auto-check":"auto-fold";x0(`🕒 Timed out — ${me}`)}catch{}}}),v.useEffect(()=>{if(!n||!t)return;const Q=Le=>{Le.roomId===t&&(Ht(Le.readyPlayers||[]),an(Le.requiredPlayers||[]),Le.allReady&&(Qe(!1),fn(0)))},de=Le=>{Le.roomId===t&&(fn(Le.endsAt),Ht(Le.readyPlayers||[]),an(Le.requiredPlayers||[]))},me=Le=>{Le.roomId===t&&(fn(0),fe(0))};return n.on("poker:start_ready_update",Q),n.on("poker:start_countdown",de),n.on("poker:start_countdown_cancelled",me),()=>{n.off("poker:start_ready_update",Q),n.off("poker:start_countdown",de),n.off("poker:start_countdown_cancelled",me)}},[n,t]),v.useEffect(()=>{if(!dr||dr<=Date.now()){fe(0);return}const Q=()=>{const me=Math.max(0,Math.ceil((dr-Date.now())/1e3));fe(me),me<=0&&fn(0)};Q();const de=setInterval(Q,1e3);return()=>clearInterval(de)},[dr]);const xn=Ct.useRef("waiting");v.useEffect(()=>{const Q=x?.gameState?.pokerPhase||"waiting",de=xn.current;xn.current=Q;const me=!["waiting","complete"].includes(Q),Le=!["waiting","complete"].includes(de);(me||Q==="waiting"&&Le)&&(Ht([]),an([]),fn(0),fe(0),Qe(!1))},[x?.gameState?.pokerPhase]),v.useEffect(()=>{const Q=x?.gameState;if(!Q)return;const de=Q?.pokerPhase,me=Number(Q?.pokerRoundSeq||0);if((de||"")==="pre-flop"&&me>0&&me!==Ke.current&&me!==it.current){if(F(!1),J(!1),ae.current&&ae.current.length===2)if(Be.current===0){Be.current=me;try{const we=typeof window<"u"?window:void 0;we&&(we.__pokerHoleDiag=we.__pokerHoleDiag||[],we.__pokerHoleDiag.push({kind:"assign_hole_round_on_initial_preflop",at:Date.now(),round:me}))}catch{}}else if(Be.current!==me){U(null);try{const we=typeof window<"u"?window:void 0;we&&(we.__pokerHoleDiag=we.__pokerHoleDiag||[],we.__pokerHoleDiag.push({kind:"clear_hole_initial_preflop",at:Date.now(),toRound:me,prevHoleRound:Be.current}))}catch{}}else try{const we=typeof window<"u"?window:void 0;we&&(we.__pokerHoleDiag=we.__pokerHoleDiag||[],we.__pokerHoleDiag.push({kind:"keep_hole_initial_preflop",at:Date.now(),round:me}))}catch{}else Be.current=0;it.current=me,$.current=Date.now(),xe(me);try{np(["cardSwoosh"])}catch{}const Le=ot.current!==me;Le&&(ot.current=me),(async()=>{if(await O_(["cardSwoosh"],900),H(!0),Le)try{gT({volume:.6})}catch{}})()}},[x?.gameState]),Ct.useEffect(()=>{try{const Q=typeof window<"u"?window:void 0;if(!(!!Q&&(Q.__E2E===!0||typeof Q.location?.search=="string"&&Q.location.search.includes("e2e=1")||Q.sessionStorage&&Q.sessionStorage.getItem("e2e")==="1")))return;const me=(t||"").startsWith("e2e-"),Le=!x||!x.gameState||!Array.isArray(x.gameState.pokerSeats);if(!me||!Le||Je.current)return;Je.current=!0;try{window.__pokerFallbackArmed=Date.now()}catch{}const we=setTimeout(()=>{try{const Ve=Date.now()%1e5,Ze={playerId:String(Ge||i||"hero"),seatIndex:0,amount:120,rank:{category:1,tiebreak:[12,7,5,4,2]}},bt=[{playerId:String(Ge||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"]}];Ce([Ze]),Oe(bt),G(Ve);const Er=`You: +z${Number(Ze.amount||0)}`,sn=`Pot: z${Number(Ze.amount||0)}`,fr=`${Cn(Ze.rank)} ${sn}`;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(we)}catch{}},[]),Ct.useEffect(()=>{try{const Q=typeof window<"u"?window:void 0;if(!(!!Q&&(Q.__E2E===!0||typeof Q.location?.search=="string"&&Q.location.search.includes("e2e=1")||Q.sessionStorage&&Q.sessionStorage.getItem("e2e")==="1")))return;const me=setTimeout(()=>{try{if(window.__pokerWinnersFlashed)return;const Le=Date.now()%1e5,we={playerId:String(Ge||i||"hero"),seatIndex:0,amount:80,rank:{category:1,tiebreak:[11,9,6,4,2]}},Ve=[{playerId:String(Ge||i||"hero"),seatIndex:0,hole:["As","Ad"]}];Ce([we]),Oe(Ve),G(Le);const Ze=`You: +z${Number(we.amount||0)}`,bt=`Pot: z${Number(we.amount||0)}`,Er=`${Cn(we.rank)} ${bt}`;try{window.__pokerWinnersFlashed={title:Ze,subtitle:Er,roundSeq:Le,at:Date.now(),__safety:!0}}catch{}}catch{}},1e4);return()=>clearTimeout(me)}catch{}},[C,Ge,i]),v.useEffect(()=>{const Q=x?.gameState?.pokerPhase,de=["flop","turn","river","showdown"].includes(Q||"");N&&de&&q&&q.length===2&&!Y&&!ee&&(J(!0),F(!0))},[x?.gameState,q,Y,ee,N]),v.useEffect(()=>{const de=(x?.gameState?.pokerPhase||"")==="pre-flop";if(N&&de&&!ee&&q&&q.length===2&&!Y){J(!0);const me=setTimeout(()=>F(!0),220);return()=>clearTimeout(me)}},[ee,x?.gameState,q,Y,N]),v.useEffect(()=>{if(!N||!q||q.length!==2||Y)return;const Q=setTimeout(()=>{!K.current&&ae.current&&ae.current.length===2&&(J(!0),setTimeout(()=>F(!0),180))},300);return()=>clearTimeout(Q)},[N,q,Y]),v.useEffect(()=>()=>{Be.current=0},[]);const Vi=x?.name||"Poker Room",nn=v.useMemo(()=>(Array.isArray(x?.players)?x.players:[]).map(de=>({id:String(de.id??""),name:String(de.name||de.email||de.id||""),balance:typeof de.balance=="number"?de.balance:0,avatarUrl:de.avatarUrl||void 0})),[x?.players]);Ct.useCallback((Q,de)=>nn.find(me=>me.id===Q)?.name||`Seat ${de+1}`,[nn]);const ua=v.useMemo(()=>x?.gameState?x.gameState:{gameMode:"poker",roundSeq:1},[x?.gameState]);S0e({gameState:ua,players:nn,winners:he,hands:ve,meId:Ge});const[mn]=v.useState(()=>Date.now()),xs=v.useMemo(()=>{const Q=x?.gameState?.pokerPhase;return Q==="pre-flop"||Q==="flop"||Q==="turn"||Q==="river"||Q==="showdown"},[x?.gameState]),ki=Number(x?.gameState?.pokerUiLockedUntilTs||0),ta=ki>0&&Date.now()<ki,gn=7e3,Ps=Ct.useRef(null);Ct.useEffect(()=>{const Q=String(x?.gameState?.pokerPhase||"");ta?Ps.current==null&&(Ps.current=Date.now()):Q==="waiting"&&(Ps.current=null)},[ta,x?.gameState]);const As=Ps.current??($.current||0),Rs=As>0?Date.now()-As:Number.POSITIVE_INFINITY,Hi=ta&&Rs<=gn,[,Lp]=Ct.useReducer(Q=>Q+1,0);Ct.useEffect(()=>{if(!ta)return;const Q=As>0?As+gn:Number.POSITIVE_INFINITY,de=ki>0?ki:Number.POSITIVE_INFINITY,me=Math.min(Q,de);if(!isFinite(me))return;const Le=Math.max(0,Math.min(15e3,Math.ceil(me-Date.now()+2))),we=window.setTimeout(()=>{try{Lp()}catch{}},Le);return()=>{window.clearTimeout(we)}},[ta,ki,As,gn]);const kd=v.useMemo(()=>{const Q=x?.gameState||{},de=Q?.pokerPhase||"",me=Array.isArray(Q?.pokerCommunity)?Q.pokerCommunity:[];return de==="flop"?me.length>=3&&![0,1,2].some(Le=>ge.has(Le)):de==="turn"?me.length>=4&&!ge.has(3):de==="river"?me.length>=5&&!ge.has(4):!0},[x?.gameState,ge]),wd=x?.gameState?.pokerPhase||"",Bp=["showdown","complete"].includes(wd),nc=Date.now()-mn<800||!xs||ee||Hi||!kd||Bp,{isBettingStreet:fo,isHeroTurn:va,heroStatus:_a,toCall:Fa,canCheck:Yc,canCall:vu,canBet:Xc,canRaise:po,showActions:Sd,minRaiseTo:da,currentBet:ho,heroStack:wi,turnDeadlineTs:Jc}=v.useMemo(()=>{const Q=x?.gameState||{},de=Q?.pokerPhase||"",me=["pre-flop","flop","turn","river"].includes(de),we=(Array.isArray(Q?.pokerSeats)?Q.pokerSeats:[]).find(tl=>String(tl.playerId)===String(Ge)),Ve=typeof Q?.pokerActingSeat=="number"?Q.pokerActingSeat:void 0,Ze=!!we&&typeof Ve=="number"&&we.seatIndex===Ve,bt=Number(Q?.pokerCurrentBet||0),Er=Number(we?.committed||0),sn=Number(we?.stack||0),fr=String(we?.status||"active"),on=Math.max(0,bt-Er),Ns=on===0&&fr==="active",oc=on>0&&fr==="active"&&sn>0,_u=bt===0&&fr==="active"&&sn>0,Ki=bt>0&&fr==="active"&&sn>0,Cd=me&&!!we&&fr==="active",Xg=Number(Q?.pokerMinRaiseTo||0),za=Number(Q?.pokerTurnDeadlineTs||0)||void 0;return{isBettingStreet:me,isHeroTurn:Ze,heroStatus:fr,toCall:on,canCheck:Ns,canCall:oc,canBet:_u,canRaise:Ki,showActions:Cd,minRaiseTo:Xg,currentBet:bt,heroStack:sn,turnDeadlineTs:za}},[x?.gameState,Ge]),_e=nc||!va||_a!=="active",et=v.useMemo(()=>{const Q=x?.gameState||{},de=Q?.pokerPhase||"waiting",me=Array.isArray(Q?.pokerSeats)?Q.pokerSeats:[];return["waiting","complete"].includes(de)&&me.length>=2&&!ee&&!Hi&&!!t},[x?.gameState,ee,Hi,t]),[ut,Qe]=v.useState(!1),[Mt,Ht]=v.useState([]),[Nr,an]=v.useState([]),Rn=v.useMemo(()=>Mt.includes(Ge),[Mt,Ge]),fa=Ct.useCallback(()=>{ce.current!=null&&(clearTimeout(ce.current),ce.current=null),Re.current!=null&&(clearTimeout(Re.current),Re.current=null),He.current=null},[]),{rack:Ds,totalAmount:ba,addChip:Qc,clearChip:Os,clearAllChips:Si}=BA(),[Ei,Gi]=v.useState(!1),[mo,Br]=v.useState(null),ra=Ge,na=!!xs&&!ee&&!(Array.isArray(ve)&&ve.length>0),[qa,Na]=v.useState({active:!1,key:0,indices:[]}),aa=Ct.useRef(0);v.useEffect(()=>{const de=(Array.isArray(x?.gameState?.pokerCommunity)?x.gameState.pokerCommunity:[]).length,me=aa.current;if(de>me){const Le=Array.from({length:de-me},(we,Ve)=>me+Ve);Pe(we=>{const Ve=new Set(we);return Le.forEach(Ze=>Ve.add(Ze)),Ve}),W.current&&(clearTimeout(W.current),W.current=null),W.current=window.setTimeout(()=>{Na({active:!0,key:Date.now(),indices:Le}),W.current=null},3e3),aa.current=de}else aa.current=de},[x?.gameState]),Ct.useEffect(()=>{const Q=Kr.current;if(!Q)return;Q.style.marginTop=Q.style.marginTop==="0px"?"0.01px":"0px";const de=window.setTimeout(()=>{Q&&(Q.style.marginTop="")},0);return()=>window.clearTimeout(de)},[ee,Y,X,Ei]);const $n=(Q,de)=>{!Q&&de&&A("Poker",de)},Wi=async()=>{if(!t)return;fa();const Q=await b(t);$n(Q?.ok,Q?.error)},ac=async()=>{if(!t)return;fa();const Q=await E(t);$n(Q?.ok,Q?.error)},Ed=async()=>{if(!t)return;fa();const Q=await w(t);$n(Q?.ok,Q?.error)},Td=()=>{_e||!Xc||(Br("bet"),Gi(!0))},Yg=()=>{_e||!po||(Br("raise"),Gi(!0))},Ia=async()=>{if(!t||!mo)return;fa();let Q=ba;if(mo==="bet"){(!Q||Q<=0)&&(Q=Math.max(1,da||1));const de=Math.floor(Q),me=await T(t,de);$n(me?.ok,me?.error),me?.ok&&(Si(),Gi(!1),Br(null))}else if(mo==="raise"){if(!Q||Q<=0){const Le=Math.max(0,da-ho);Q=Math.max(1,Le)}Q=Math.min(Q,Math.max(0,wi));const de=Math.floor(Q),me=await D(t,de);$n(me?.ok,me?.error),me?.ok&&(Si(),Gi(!1),Br(null))}},ic=()=>{Si(),Gi(!1),Br(null)},[sc,Zc]=Ct.useState(null),x0=Ct.useCallback(Q=>{try{const de=Ot(Ge);de&&Zc({x:de.x,y:Math.max(0,de.y-70),text:Q});const me=document.querySelector(`li.player--avatar[data-player-id="${Ge}"]`);me&&(me.classList.add("player--timeout"),setTimeout(()=>{try{me.classList.remove("player--timeout")}catch{}},2500)),setTimeout(()=>Zc(null),2600)}catch{}},[Ot,Ge]);v.useEffect(()=>{(_e||!Sd)&&(Gi(!1),Br(null),Si())},[_e,Sd]);const el=Ct.useRef(0);return v.useEffect(()=>{const Q=x?.gameState;if(!Q)return;const de=Q?.pokerLastAction;if(!de||typeof de.seq!="number"||el.current===de.seq)return;const me=String(de.action||"").toLowerCase();if(!["bet","raise","call"].includes(me)){el.current=de.seq;return}const Le=Math.max(0,Number(de.amountDelta||0));if(Le<=0){el.current=de.seq;return}const Ve=(Array.isArray(Q?.pokerSeats)?Q.pokerSeats:[]).find(bt=>bt.seatIndex===de.seatIndex),Ze=Ve?.playerId?String(Ve.playerId):void 0;O(()=>{try{const bt=An();if(!bt)return;const Er=Ze?Ot(Ze):null;if(!Er)return;const sn=`poker-commit-${de.seq}-${Ze||de.seatIndex}-${Date.now()}`;Ft(fr=>[...fr,{id:`${sn}-to-pot`,amount:Le,fromId:Ze||`seat:${de.seatIndex}`,toId:"pot",startX:Er.x,startY:Er.y,endX:bt.x,endY:bt.y,startDelaySec:.1}])}catch{}}),el.current=de.seq},[x?.gameState,O,Ot,oe]),g.jsxs(g.Fragment,{children:[g.jsx(Bi,{className:"page-poker-room"}),g.jsx(fP,{open:Gt,onClose:qt,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(WA,{showAvatarBacks:na,header:g.jsx("div",{className:"poker-room-header",children:g.jsx(HA,{roomName:Vi,roomId:t,players:nn,meId:ra,gameState:ua,lastRollerId:null,showHeader:!0,revealedHands:ve,historyHalo:be,singlePlayer:x?.singlePlayer,turnDeadlineTs:Jc,isBettingStreet:fo,isHeroTurn:va,onOpenHistory:async()=>{if(Ne(!0),!!t)try{const Q=await P(t,20);if(Q?.ok&&Array.isArray(Q?.data?.items)){const de=Q.data.items;at(me=>{const Le=de.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(Ze=>(Ze.winnings||0)>0).map(Ze=>({playerId:Ze.playerId,seatIndex:Ze.seatIndex,amount:Ze.winnings||0,rank:Ze.rank?Ze.rank:Ze.handRank!=null?{category:Ze.handRank,tiebreak:Ze.tiebreak||[]}:void 0})):[],hands:Array.isArray(Ve.seats)?Ve.seats.map(Ze=>({playerId:Ze.playerId,seatIndex:Ze.seatIndex,hole:Array.isArray(Ze.hole)?Ze.hole:Array.isArray(Ze.holeCards)?Ze.holeCards:[]})):[],seats:Array.isArray(Ve.seats)?Ve.seats.map(Ze=>({playerId:Ze.playerId,seatIndex:Ze.seatIndex,status:Ze.status,rank:Ze.rank?Ze.rank:Ze.handRank!=null?{category:Ze.handRank,tiebreak:Ze.tiebreak||[]}:void 0,winnings:Ze.winnings})):void 0})),we=new Map;for(const Ve of[...me,...Le])we.set(Ve.roundSeq,Ve);return Array.from(we.values()).sort((Ve,Ze)=>Ze.roundSeq-Ve.roundSeq).slice(0,20)})}}catch{}}})}),children:[g.jsx(CL,{enabled:ee,handKey:ie,perCardSec:.6,staggerSec:.14,onComplete:()=>{H(!1);const Q=it.current;if(Q>0&&(Ke.current=Q),q&&!Y&&(J(!0),setTimeout(()=>F(!0),200)),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}try{const de=typeof window<"u"?window:void 0;de&&(de.__pokerHoleDiag=de.__pokerHoleDiag||[],de.__pokerHoleDiag.push({kind:"dealing_complete",at:Date.now()}))}catch{}}}),g.jsx(CL,{enabled:qa.active,handKey:`board-${qa.key}`,perCardSec:.5,staggerSec:.12,passes:1,getTargets:Q=>{try{const de=Q.getBoundingClientRect(),me=Q.ownerDocument?.querySelector(".poker-board");if(!me)return[];const Le=Array.from(me.querySelectorAll(".poker-card"));return qa.indices.map(Ve=>{const Ze=Le[Ve];if(!Ze)return null;const bt=Ze.getBoundingClientRect();return{x:(bt.left+bt.right)/2-de.left,y:(bt.top+bt.bottom)/2-de.top}}).filter(Boolean)}catch{return[]}},onComplete:()=>{const Q=qa.indices.slice();if(Na(de=>({...de,active:!1})),Q.length>0){Pe(me=>{const Le=new Set(me);return Q.forEach(we=>Le.add(we)),Le});const de=window.setTimeout(()=>{Pe(me=>{const Le=new Set(me);return Q.forEach(we=>Le.delete(we)),Le})},250);De.current.push(de)}}}),g.jsxs("div",{className:"poker-mock",children:[et&&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"]}),Nr.length>1&&g.jsxs("div",{className:"poker-start-hand__readiness",style:{marginBottom:4,fontSize:"0.75rem",color:"#ccc",textAlign:"center"},children:[Mt.length,"/",Nr.length," ready"]}),g.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",ut?"is-busy":"",Rn?"is-ready":""].filter(Boolean).join(" "),"aria-label":Rn?"Waiting for others":"Start Hand",disabled:ut||Rn,onClick:async()=>{if(t){try{const{hapticClick:Q}=await zr(async()=>{const{hapticClick:de}=await Promise.resolve().then(()=>yne);return{hapticClick:de}},void 0,import.meta.url);Q("Medium")}catch{}Qe(!0);try{const Q=await _(t);if(Q?.countdown&&fn(Q?.countdown),Q?.waiting){Ht(Q?.readyPlayers||[]),an(Q?.requiredPlayers||[]);return}if(!Q?.ok)try{A("Poker",Q?.error||"Unable to start hand")}catch{}Qe(!1)}catch{try{A("Poker","Unable to start hand")}catch{}Qe(!1)}}},children:Rn?"✓ 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:ue,style:ct?void 0:{visibility:"hidden"},children:(()=>{const Q=Number(ua?.wagerPool?.totalAmount||0),de=LA(Q);return Object.entries(de.reduce((me,Le)=>{const we=String(Le);return me[we]=(me[we]||0)+1,me},{})).sort((me,Le)=>Number(Le[0])-Number(me[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",wi]}),g.jsx("span",{className:"poker-pot__divider","aria-hidden":"true",children:"•"}),g.jsxs("span",{className:`poker-pot__pot-info ${Fa>0&&wi>0&&Fa/wi>=.25?"poker-pot__pot-info--high":""}`,children:[Fa>0?`To Call: z${Fa}`:`Pot: z${Q}`,Fa>0&&wi>0&&Fa/wi>=.5&&g.jsxs("span",{className:"poker-pot__high-pct","aria-label":"High percentage of stack",children:[Math.round(Fa/wi*100),"%"]})]})]})})})()}),g.jsx(N0e,{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((Q,de)=>{const me=ge.has(de)||de>=(aa.current||0),Le=x.gameState.pokerCommunity,we=O0e(de),Ve=R0e(Le,de),Ze=we==="river"&&Le.length===5;return g.jsx(j0e,{value:Q,concealed:me,position:we,isPaired:Ve,animateEntrance:Ze&&!me},`${Q}-${de}`)})}),g.jsx("div",{className:["poker-hole",ee?"poker-hole--concealed":"",Y?"is-revealed":"",!Y&&X?"is-partial":"",va&&!_e?"poker-hole--active-turn":""].filter(Boolean).join(" "),"aria-label":"hole-cards",ref:mr,children:g.jsxs("div",{className:"poker-hole-stack",children:[g.jsx("div",{className:"poker-hole-label","aria-hidden":!0,children:"--"}),X,Y,g.jsx(b0e,{cards:q,firstRevealed:!!X,bothRevealed:!!Y}),Array.isArray(x?.gameState?.pokerCommunity)&&x.gameState.pokerCommunity.length>0&&(()=>{const Q=x.gameState.pokerCommunity;return KA(Q).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})()]})})]}),sc&&g.jsx("div",{className:"poker-timeout-toast","aria-live":"polite",style:{position:"fixed",left:sc.x,top:sc.y,transform:"translate(-50%, -100%)"},children:sc.text})]}),st&&g.jsx(E0e,{players:nn,entries:St,onClose:()=>Ne(!1)}),Pt.length>0&&g.jsx(w6,{anim:Pt[0],onComplete:()=>{Pt[0],Ft(Q=>Q.slice(1))}},Pt[0].id)]}),g.jsxs("div",{className:"poker-actions-wrap",ref:Kr,children:[g.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented",va&&!_e?"poker-actions--halo":""].filter(Boolean).join(" "),role:"group","aria-label":"Action buttons","aria-disabled":_e||void 0,children:[Yc&&g.jsx(jo,{label:"Check",ariaLabel:"Check",size:"md",disabled:_e,onClick:Wi,className:"poker-action--flat poker-action--secondary poker-action--check"}),!Yc&&vu&&g.jsx(jo,{label:"Call",subtitle:`z${Fa}`,ariaLabel:`Call ${Fa}`,size:"md",disabled:_e,onClick:ac,className:"poker-action--flat poker-action--primary poker-action--call"}),Xc&&g.jsx(jo,{label:"Bet",subtitle:ba>0?`z${ba}`:void 0,ariaLabel:"Bet",size:"md",disabled:_e,onClick:Td,className:"poker-action--green poker-action--secondary poker-action--bet"}),!Xc&&po&&g.jsx(jo,{label:"Raise",subtitle:ba>0?`z${ba}`:void 0,ariaLabel:"Raise",size:"md",disabled:_e,onClick:Yg,className:["poker-action--green","poker-action--secondary","poker-action--raise",mo==="raise"&&Ei?"raise-active":""].filter(Boolean).join(" ")}),_a==="active"&&g.jsx(jo,{label:"Fold",ariaLabel:"Fold",size:"md",disabled:_e,onClick:Ed,className:"poker-action--flat poker-action--danger poker-action--fold"})]}),g.jsx("div",{className:"poker-chiprack",style:Ei?void 0:{visibility:"hidden",pointerEvents:"none"},children:g.jsx(w0,{selectedTimes:Ds,onAdd:Qc,onClear:Os,onPlaceBet:Ia,onCancelBet:ic,disabled:_e,collapsed:!Ei,mainAmt:ba,betTokenProps:{isBanker:!1,meId:ra,open:[],players:nn,show:!0,labelPrefix:""}})})]})]})]})}function B0e(){const t=rn(),{user:e}=Vr(),[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(WA,{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(Em,{label:"Check",ariaLabel:"Check",size:"md",onClick:()=>{},className:"poker-action--flat"}),g.jsx(Em,{label:"Bet",ariaLabel:"Bet",size:"md",onClick:()=>{},className:"poker-action--flat"}),g.jsx(Em,{label:"Fold",ariaLabel:"Fold",size:"md",onClick:()=>{},className:"poker-action--flat poker-action--fold"})]})})]})}const Uu=(t,e)=>({rank:t,suit:e}),Fh={name:"Texas Hold’em",pot:295,community:[Uu("5","♠"),Uu("8","♦"),Uu("A","♣"),Uu("10","♣"),Uu("2","♥")],players:[{id:"p1",name:"Hero",stack:295,bet:25,isHero:!0,isActing:!0,hole:[Uu("K","♠"),Uu("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}]},U0e=[{kind:"call",amount:25},{kind:"fold"},{kind:"check"},{kind:"bet",amount:0},{kind:"raise",to:0}];function xL(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 PL(t){return`${t.rank}${t.suit}`}function F0e(){const{user:t}=Vr(),[e,r]=Ct.useState(!1),n=Fh.players.find(m=>m.isHero),a=Fh.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}=BA();return g.jsx(g.Fragment,{children:g.jsx(WA,{header:g.jsx("div",{className:"poker-room-header",children:g.jsx(HA,{roomName:Fh.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:Fh.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":PL(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:["$",Fh.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":PL(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:U0e.map((m,_)=>g.jsx(Em,{label:xL(m),ariaLabel:xL(m),size:"md",onClick:()=>{}},_))})}),g.jsx("div",{className:"poker-chiprack",children:g.jsx(w0,{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 q0e(){const t=rn(),e=_i();return v.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&t(n),rO()},[t]),v.useEffect(()=>{rO(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(XV,{children:[g.jsxs(_n,{element:g.jsx(Qoe,{}),children:[g.jsx(_n,{path:"/verify",element:g.jsx(d0e,{})}),g.jsx(_n,{path:"/review-login",element:g.jsx(f0e,{})}),g.jsx(_n,{path:"/qa-login",element:g.jsx(p0e,{})}),g.jsx(_n,{path:"/login",element:g.jsx(Joe,{})}),g.jsx(_n,{path:"/verification-failed",element:g.jsx(iG,{})})]}),g.jsxs(_n,{element:g.jsx(aG,{}),children:[g.jsx(_n,{path:"/profile",element:g.jsx(s0e,{})}),g.jsx(_n,{path:"/settings",element:g.jsx(o0e,{})}),g.jsx(_n,{path:"/add-chips",element:g.jsx(u0e,{})}),g.jsx(_n,{path:"/admin",element:g.jsx(tm,{to:"/lobby",replace:!0})}),g.jsx(_n,{path:"/",element:g.jsx(tm,{to:"/lobby",replace:!0})}),g.jsx(_n,{path:"/lobby",element:g.jsx(gae,{})}),g.jsx(_n,{path:"/room/:roomId",element:g.jsx(a0e,{})}),g.jsx(_n,{path:"/poker",element:g.jsx(B0e,{})}),g.jsx(_n,{path:"/poker/mock",element:g.jsx(F0e,{})}),g.jsx(_n,{path:"/poker/room/:roomId",element:g.jsx(L0e,{})})]}),g.jsx(_n,{path:"/disclaimer",element:g.jsx(g0e,{})}),g.jsx(_n,{path:"/support",element:g.jsx(y0e,{})}),g.jsx(_n,{path:"/privacy",element:g.jsx(v0e,{})}),g.jsx(_n,{path:"/terms",element:g.jsx(_0e,{})}),g.jsx(_n,{path:"/button-sandbox",element:g.jsx(m0e,{})}),g.jsx(_n,{path:"/how-to-play",element:g.jsx(mF,{})}),g.jsx(_n,{path:"*",element:g.jsx(tm,{to:"/lobby",replace:!0})})]})}const z0e="ceelolounge",AL=c9.toLowerCase(),$0e=new Set(["","verify","auth","ceelolounge","review-login","qa-login"]);function YE(t){return!t||t.length===0||t.length>2048||!/^[A-Za-z0-9._-]+$/.test(t)?null:t}function V0e(t){try{const e=new URL(t),r=e.protocol.replace(":","").toLowerCase(),n=(e.hostname||"").toLowerCase(),a=(e.pathname||"").toLowerCase(),i=r===z0e,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(!$0e.has(n)||!c&&!u&&!d&&!(n==="verify"||n==="review-login"||n==="qa-login")&&!((n===""||n==="ceelolounge")&&(a==="/"||a==="")))return null}else if(o){if(AL&&n!==AL||!c&&!u&&!d)return null}else return null;const f=YE(e.searchParams.get("token"));if(f)return f;const h=a.split("/").filter(Boolean),m=h.lastIndexOf("verify");return m>=0&&h[m+1]?YE(h[m+1]):h.length===1&&!["verify","auth","review-login","qa-login"].includes(h[0])?YE(h[0]):null}catch{return null}}function H0e(){const t=rn(),e=v.useRef(null);return v.useEffect(()=>{let r;const n=a=>{if(!a||e.current===a)return;const i=V0e(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 Fo.getLaunchUrl().then(a=>n(a?.url)).catch(()=>{}),(async()=>r=await Fo.addListener("appUrlOpen",({url:a})=>n(a)))(),()=>r?.remove?.()},[t]),null}function G0e(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 W0e(){const{info:t}=Cs();return Da({onCrapsBetError:e=>{try{const{title:r,subtitle:n}=G0e(e);t(r,n)}catch{}}}),null}function YA(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function RL(t){return YA(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const D6="2.37.8";let XE={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${D6}`},uo=class ZC extends Error{constructor(e,r={}){const n=r.cause instanceof ZC?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof ZC&&r.cause.docsPath||r.docsPath,i=XE.getDocsUrl?.({...r,docsPath:a}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...XE.version?[`Version: ${XE.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=D6}walk(e){return O6(this,e)}};function O6(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?O6(t.cause,e):e?null:t}class K0e extends uo{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 N6 extends uo{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 jp(t,{dir:e,size:r=32}={}){return typeof t=="string"?Y0e(t,{dir:e,size:r}):X0e(t,{dir:e,size:r})}function Y0e(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new N6({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function X0e(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new N6({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 J0e extends uo{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 Q0e extends uo{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Kg(t,{size:e}){if(RL(t)>e)throw new Q0e({givenSize:RL(t),maxSize:e})}const Z0e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function HSe(t,e={}){return typeof t=="number"||typeof t=="bigint"?gp(t,e):typeof t=="string"?M6(t,e):typeof t=="boolean"?eke(t,e):I6(t,e)}function eke(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Kg(r,{size:e.size}),jp(r,{size:e.size})):r}function I6(t,e={}){let r="";for(let a=0;a<t.length;a++)r+=Z0e[t[a]];const n=`0x${r}`;return typeof e.size=="number"?(Kg(n,{size:e.size}),jp(n,{dir:"right",size:e.size})):n}function gp(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 J0e({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?jp(c,{size:n}):c}const tke=new TextEncoder;function M6(t,e={}){const r=tke.encode(t);return I6(r,e)}const rke=new TextEncoder;function nke(t,e={}){return typeof t=="number"||typeof t=="bigint"?ike(t,e):typeof t=="boolean"?ake(t,e):YA(t)?j6(t,e):L6(t,e)}function ake(t,e={}){const r=new Uint8Array(1);return r[0]=Number(t),typeof e.size=="number"?(Kg(r,{size:e.size}),jp(r,{size:e.size})):r}const Ec={zero:48,nine:57,A:65,F:70,a:97,f:102};function DL(t){if(t>=Ec.zero&&t<=Ec.nine)return t-Ec.zero;if(t>=Ec.A&&t<=Ec.F)return t-(Ec.A-10);if(t>=Ec.a&&t<=Ec.f)return t-(Ec.a-10)}function j6(t,e={}){let r=t;e.size&&(Kg(r,{size:e.size}),r=jp(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=DL(n.charCodeAt(c++)),d=DL(n.charCodeAt(c++));if(u===void 0||d===void 0)throw new uo(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);i[o]=u*16+d}return i}function ike(t,e){const r=gp(t,e);return j6(r)}function L6(t,e={}){const r=rke.encode(t);return typeof e.size=="number"?(Kg(r,{size:e.size}),jp(r,{dir:"right",size:e.size})):r}const Pv=BigInt(2**32-1),OL=BigInt(32);function ske(t,e=!1){return e?{h:Number(t&Pv),l:Number(t>>OL&Pv)}:{h:Number(t>>OL&Pv)|0,l:Number(t&Pv)|0}}function oke(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}=ske(t[i],e);[n[i],a[i]]=[o,c]}return[n,a]}const cke=(t,e,r)=>t<<r|e>>>32-r,lke=(t,e,r)=>e<<r|t>>>32-r,uke=(t,e,r)=>e<<r-32|t>>>64-r,dke=(t,e,r)=>t<<r-32|e>>>64-r;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fke(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function NL(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Sb(t,...e){if(!fke(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 IL(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 pke(t,e){Sb(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function hke(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function B6(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const mke=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function gke(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function yke(t){for(let e=0;e<t.length;e++)t[e]=gke(t[e]);return t}const ML=mke?t=>t:yke;function vke(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function U6(t){return typeof t=="string"&&(t=vke(t)),Sb(t),t}class _ke{}function bke(t){const e=n=>t().update(U6(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}const kke=BigInt(0),qh=BigInt(1),wke=BigInt(2),Ske=BigInt(7),Eke=BigInt(256),Tke=BigInt(113),F6=[],q6=[],z6=[];for(let t=0,e=qh,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],F6.push(2*(5*n+r)),q6.push((t+1)*(t+2)/2%64);let a=kke;for(let i=0;i<7;i++)e=(e<<qh^(e>>Ske)*Tke)%Eke,e&wke&&(a^=qh<<(qh<<BigInt(i))-qh);z6.push(a)}const $6=oke(z6,!0),Cke=$6[0],xke=$6[1],jL=(t,e,r)=>r>32?uke(t,e,r):cke(t,e,r),LL=(t,e,r)=>r>32?dke(t,e,r):lke(t,e,r);function Pke(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=jL(d,f,1)^r[c],m=LL(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=q6[o],u=jL(a,i,c),d=LL(a,i,c),f=F6[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]^=Cke[n],t[1]^=xke[n]}B6(r)}class XA extends _ke{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,NL(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=hke(this.state)}clone(){return this._cloneInto()}keccak(){ML(this.state32),Pke(this.state32,this.rounds),ML(this.state32),this.posOut=0,this.pos=0}update(e){IL(this),e=U6(e),Sb(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){IL(this,!1),Sb(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 NL(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(pke(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,B6(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:a,rounds:i,enableXOF:o}=this;return e||(e=new XA(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 Ake=(t,e,r)=>bke(()=>new XA(e,t,r)),Rke=Ake(1,136,256/8);function Dke(t,e){return Rke(YA(t,{strict:!1})?nke(t):t)}class JA 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 Oke=/^0x[a-fA-F0-9]{40}$/,JE=new JA(8192);function Nke(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(JE.has(n))return JE.get(n);const a=Oke.test(t)?t.toLowerCase()===t?!0:r?V6(t)===t:!0:!1;return JE.set(n,a),a}const QE=new JA(8192);function V6(t,e){if(QE.has(`${t}.${e}`))return QE.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Dke(L6(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 QE.set(`${t}.${e}`,i),i}function Ju(t,e){if(!Nke(t,{strict:!1}))throw new K0e({address:t});return V6(t,e)}function Ike(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const id=(t,e,r)=>JSON.stringify(t,(n,a)=>typeof a=="bigint"?a.toString():a,r),QA=t=>t;class Tm extends uo{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: ${QA(o)}`,e&&`Request body: ${id(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 H6 extends uo{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${QA(n)}`,`Request body: ${id(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 BL extends uo{constructor({body:e,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${QA(r)}`,`Request body: ${id(e)}`],name:"TimeoutError"})}}const Mke=-1;class bi extends uo{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 H6?e.code:r??Mke}}class $i extends bi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class tg extends bi{constructor(e){super(e,{code:tg.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(tg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class rg extends bi{constructor(e){super(e,{code:rg.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(rg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ng extends bi{constructor(e,{method:r}={}){super(e,{code:ng.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(ng,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ag extends bi{constructor(e){super(e,{code:ag.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(ag,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class yp extends bi{constructor(e){super(e,{code:yp.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(yp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ig extends bi{constructor(e){super(e,{code:ig.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(ig,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class sg extends bi{constructor(e){super(e,{code:sg.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(sg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Wl extends bi{constructor(e){super(e,{code:Wl.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Wl,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class og extends bi{constructor(e){super(e,{code:og.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(og,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Qu extends bi{constructor(e,{method:r}={}){super(e,{code:Qu.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Qu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class vp extends bi{constructor(e){super(e,{code:vp.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(vp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class cg extends bi{constructor(e){super(e,{code:cg.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(cg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class sa extends $i{constructor(e){super(e,{code:sa.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(sa,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class lg extends $i{constructor(e){super(e,{code:lg.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(lg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ug extends $i{constructor(e,{method:r}={}){super(e,{code:ug.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(ug,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class dg extends $i{constructor(e){super(e,{code:dg.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(dg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class fg extends $i{constructor(e){super(e,{code:fg.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(fg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ou extends $i{constructor(e){super(e,{code:ou.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ou,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class pg extends $i{constructor(e){super(e,{code:pg.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(pg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class hg extends $i{constructor(e){super(e,{code:hg.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(hg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class mg extends $i{constructor(e){super(e,{code:mg.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(mg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class gg extends $i{constructor(e){super(e,{code:gg.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(gg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class yg extends $i{constructor(e){super(e,{code:yg.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(yg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class vg extends $i{constructor(e){super(e,{code:vg.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(vg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class _g extends $i{constructor(e){super(e,{code:_g.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(_g,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class jke extends bi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function Lke(){let t=()=>{},e=()=>{};return{promise:new Promise((n,a)=>{t=n,e=a}),resolve:t,reject:e}}const ZE=new Map;function Bke({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=()=>ZE.delete(e),c=()=>u().map(({args:f})=>f),u=()=>ZE.get(e)||[],d=f=>ZE.set(e,[...u(),f]);return{flush:o,async schedule(f){const{promise:h,resolve:m,reject:_}=Lke();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 Av=new JA(8192);function Uke(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Av.get(r))return Av.get(r);const n=t().finally(()=>Av.delete(r));return Av.set(r,n),n}async function Fke(t){return new Promise(e=>setTimeout(e,t))}function G6(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 Fke(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 qke(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 Qu(new Error("method not supported"),{method:d});if(i?.include&&!i.include.includes(d))throw new Qu(new Error("method not supported"),{method:d});const f=a?M6(`${u}.${id(r)}`):void 0;return Uke(()=>G6(async()=>{try{return await t(r)}catch(h){const m=h;switch(m.code){case tg.code:throw new tg(m);case rg.code:throw new rg(m);case ng.code:throw new ng(m,{method:r.method});case ag.code:throw new ag(m);case yp.code:throw new yp(m);case ig.code:throw new ig(m);case sg.code:throw new sg(m);case Wl.code:throw new Wl(m);case og.code:throw new og(m);case Qu.code:throw new Qu(m,{method:r.method});case vp.code:throw new vp(m);case cg.code:throw new cg(m);case sa.code:throw new sa(m);case lg.code:throw new lg(m);case ug.code:throw new ug(m);case dg.code:throw new dg(m);case fg.code:throw new fg(m);case ou.code:throw new ou(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 _g.code:throw new _g(m);case 5e3:throw new sa(m);default:throw h instanceof uo?h:new jke(m)}}},{delay:({count:h,error:m})=>{if(m&&m instanceof Tm){const _=m?.headers?.get("Retry-After");if(_?.match(/\d/))return Number.parseInt(_,10)*1e3}return~~(1<<h)*o},retryCount:c,shouldRetry:({error:h})=>zke(h)}),{enabled:a,id:f})}}function zke(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===vp.code||t.code===yp.code:t instanceof Tm&&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 W6(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}function K6(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 $ke(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const UL=$ke();function Vke(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 K6(async({signal:w})=>{const b={...u,body:Array.isArray(n)?id(n.map(P=>({jsonrpc:"2.0",id:P.id??UL.take(),...P}))):id({jsonrpc:"2.0",id:n.id??UL.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 BL({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 Tm({body:n,details:id(_.error)||m.statusText,headers:m.headers,status:m.status,url:t});return _}catch(m){throw m instanceof Tm||m instanceof BL?m:new Tm({body:n,cause:m,url:t})}}}}const T_="2.21.2",Hke=()=>`@wagmi/core@${T_}`;var Y6=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)},Eb,X6;class bg extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Hke()}constructor(e,r={}){super(),Eb.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 bg?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof bg&&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 Y6(this,Eb,"m",X6).call(this,this,e)}}Eb=new WeakSet,X6=function t(e,r){return r?.(e)?e:e.cause?Y6(this,Eb,"m",t).call(this,e.cause,r):e};class Tb extends bg{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}const ex=256;let Rv=ex,Dv;function J6(t=11){if(!Dv||Rv+t>ex*2){Dv="",Rv=0;for(let e=0;e<ex;e++)Dv+=(256+Math.random()*256|0).toString(16).substring(1)}return Dv.substring(Rv,Rv+++t)}function Gke(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?Ike(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:J6(),...c?{experimental_blockTag:c}:{}};function D(P){return A=>{const C=A(P);for(const I in T)delete C[I];const O={...P,...C};return Object.assign(O,{extend:D(O)})}}return Object.assign(T,{extend:D(T)})}function Wke({key:t,methods:e,name:r,request:n,retryCount:a=3,retryDelay:i=150,timeout:o,type:c},u){const d=J6();return{config:{key:t,methods:e,name:r,request:n,retryCount:a,retryDelay:i,timeout:o,type:c},request:qke(n,{methods:e,retryCount:a,retryDelay:i,uid:d}),value:u}}class Kke extends uo{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 FL(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??_,D=w??e.timeout??1e4,P=t||m?.rpcUrls.default.http[0];if(!P)throw new Kke;const A=Vke(P,{fetchFn:n,fetchOptions:a,onRequest:u,onResponse:d,timeout:D});return Wke({key:i,methods:o,name:c,async request({method:C,params:O}){const I={method:C,params:O},{schedule:x}=Bke({id:P,wait:E,shouldSplitBatch(j){return j.length>b},fn:j=>A.request({body:j}),sort:(j,q)=>j.id-q.id}),R=async j=>r?x(j):[await A.request({body:j})],[{error:N,result:L}]=await R(I);if(h)return{error:N,result:L};if(N)throw new H6({body:I,error:N,url:P});return L},retryCount:T,retryDelay:f,timeout:D,type:"http"},{fetchOptions:a,url:P})}}let eT=!1;async function Yke(t,e={}){if(eT)return[];eT=!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"}))),eT=!1,c}class Dl extends bg{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}E0.type="injected";function E0(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"?{...Xke[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:E0.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 Dl;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=>Ju(b)),_.length>0&&(_=await this.getAccounts())}catch(w){const b=w;if(b.code===sa.code)throw new sa(b);if(b.code===Wl.code)throw b}try{!_?.length&&!f&&(_=(await m.request({method:"eth_requestAccounts"})).map(E=>Ju(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===sa.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===sa.code?new sa(b):b.code===Wl.code?new Wl(b):b}},async disconnect(){const d=await this.getProvider();if(!d)throw new Dl;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 K6(()=>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 Dl;return(await d.request({method:"eth_accounts"})).map(h=>Ju(h))},async getChainId(){const d=await this.getProvider();if(!d)throw new Dl;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=C_(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 Dl}return!!(await G6(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:d,chainId:f}){const h=await this.getProvider();if(!h)throw new Dl;const m=u.chains.find(w=>w.id===f);if(!m)throw new ou(new Tb);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:gp(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 D;d?.blockExplorerUrls?D=d.blockExplorerUrls:E&&(D=[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:D,chainId:gp(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 sa(new Error("User rejected switch after adding network."))}),_]),m}catch(E){throw new sa(E)}throw b.code===sa.code?new sa(b):new ou(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=>Ju(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 Xke={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t?.coinbaseWalletExtension?t.coinbaseWalletExtension:C_(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return C_(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:C_(t,"isPhantom")}}};function C_(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 Jke(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 Qke(){const t=new Set;let e=[];const r=()=>Jke(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 Zke=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)},ewe=Zke;function twe(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 tx=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return tx(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return tx(n)(r)}}}},rwe=(t,e)=>(r,n,a)=>{let i={storage:twe(()=>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(D=>{var P;return D((P=n())!=null?P:m)});const T=((E=i.onRehydrateStorage)==null?void 0:E.call(i,(b=n())!=null?b:m))||void 0;return tx(d.getItem.bind(d))(i.name).then(D=>{if(D)if(typeof D.version=="number"&&D.version!==i.version){if(i.migrate)return[!0,i.migrate(D.state,D.version)]}else return[!1,D.state];return[!1,void 0]}).then(D=>{var P;const[A,C]=D;if(_=i.merge(C,(P=n())!=null?P:m),r(_,!0),A)return f()}).then(()=>{T?.(_,void 0),_=n(),o=!0,u.forEach(D=>D(_))}).catch(D=>{T?.(void 0,D)})};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},nwe=rwe,qL=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},tT=t=>t?qL(t):qL;var rT={exports:{}},zL;function awe(){return zL||(zL=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,D,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,D=new Array(T-1);P<T;P++)D[P-1]=arguments[P];E.fn.apply(E.context,D)}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(!D)for(C=1,D=new Array(T-1);C<T;C++)D[C-1]=arguments[C];E[P].fn.apply(E[P].context,D)}}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})(rT)),rT.exports}var iwe=awe();const swe=Sg(iwe);class owe{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 swe})}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 cwe(t){return new owe(t)}function lwe(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 $L(t,e){return t.slice(0,e).join(".")||"."}function VL(t,e){const{length:r}=t;for(let n=0;n<r;++n)if(t[n]===e)return n+1;return 0}function uwe(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=VL(a,this);d===0?a[a.length]=this:(a.splice(d),i.splice(d)),i[i.length]=c;const f=VL(a,u);if(f!==0)return n?e.call(this,c,u,$L(i,f)):`[ref=${$L(i,f)}]`}else a[0]=u,i[0]=c;return r?t.call(this,c,u):u}}function dwe(t,e,r,n){return JSON.stringify(t,uwe((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 Q6(t){const{deserialize:e=lwe,key:r="wagmi",serialize:n=dwe,storage:a=Z6}=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 Z6={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function fwe(){const t=typeof window<"u"&&window.localStorage?window.localStorage:Z6;return{getItem(e){return t.getItem(e)},removeItem(e){t.removeItem(e)},setItem(e,r){try{t.setItem(e,r)}catch{}}}}const rx=256;let Ov=rx,Nv;function pwe(t=11){if(!Nv||Ov+t>rx*2){Nv="",Ov=0;for(let e=0;e<rx;e++)Nv+=(256+Math.random()*256|0).toString(16).substring(1)}return Nv.substring(Ov,Ov+++t)}function hwe(t){const{multiInjectedProviderDiscovery:e=!0,storage:r=Q6({storage:fwe()}),syncConnectedChain:n=!0,ssr:a=!1,...i}=t,o=typeof window<"u"&&e?Qke():void 0,c=tT(()=>i.chains),u=tT(()=>{const C=[],O=new Set;for(const I of i.connectors??[]){const x=d(I);if(C.push(x),!a&&x.rdns){const R=typeof x.rdns=="string"?[x.rdns]:x.rdns;for(const N of R)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=cwe(pwe()),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 E0({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(R=>R.id===O);if(C.chainId&&!I)throw new Tb;{const R=h.get(E.getState().chainId);if(R&&!I)return R;if(!I)throw new Tb}{const R=h.get(O);if(R)return R}let x;if(i.client)x=i.client({chain:I});else{const R=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(R in U)L[q]=U[R];else{if(N.some(F=>F in U))continue;L[q]=U}else L[q]=U;x=Gke({...L,chain:I,batch:L.batch??{multicall:!0},transport:q=>i.transports[R]({...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-";T_.startsWith(b)?w=Number.parseInt(T_.replace(b,""),10):w=Number.parseInt(T_.split(".")[0]??"0",10);const E=tT(ewe(r?nwe(_,{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:R,type:N,uid:L}=I.connector;return[O,{...I,connector:{id:x,name:R,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 R of u.getState())if(O.add(R.id),R.rdns){const N=typeof R.rdns=="string"?[R.rdns]:R.rdns;for(const L of N)I.add(L)}const x=[];for(const R of C){if(I.has(R.info.rdns))continue;const N=d(f(R));O.has(N.id)||x.push(N)}r&&!E.persist.hasHydrated()||u.setState(R=>[...R,...x],!0)});function D(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",D),I.emitter.listenerCount("change")||I.emitter.on("change",D),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 R=I.connector;R.emitter.listenerCount("change")&&I.connector.emitter.off("change",D),R.emitter.listenerCount("disconnect")&&I.connector.emitter.off("disconnect",A),R.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(R=>!(R 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 R=x.connector;R.isAuthorized&&await R.isAuthorized()||(O.delete(R.uid),I===R.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:D,connect:P,disconnect:A}}}}function mwe(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?Yke(t):t.storage&&t.setState(a=>({...a,connections:new Map}))}}}const gwe={getItem(t){return typeof window>"u"?null:ywe(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 ywe(t,e){const r=t.split("; ").find(n=>n.startsWith(`${e}=`));if(r)return r.substring(e.length+1)}function vwe(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 _we(t){const{children:e,config:r,initialState:n,reconnectOnMount:a=!0}=t,{onMount:i}=mwe(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 bwe=v.createContext(void 0);function kwe(t){const{children:e,config:r}=t,n={value:r};return v.createElement(_we,t,v.createElement(bwe.Provider,n,e))}var T0=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(){}},wwe={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Swe=class{#e=wwe;#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)}},nx=new Swe;function Ewe(t){setTimeout(t,0)}var C0=typeof window>"u"||"Deno"in globalThis;function qs(){}function Twe(t,e){return typeof t=="function"?t(e):t}function Cwe(t){return typeof t=="number"&&t>=0&&t!==1/0}function xwe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ax(t,e){return typeof t=="function"?t(e):t}function Pwe(t,e){return typeof t=="function"?t(e):t}function HL(t,e){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:o,stale:c}=t;if(o){if(n){if(e.queryHash!==ZA(o,e.options))return!1}else if(!wg(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 GL(t,e){const{exact:r,status:n,predicate:a,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(kg(e.options.mutationKey)!==kg(i))return!1}else if(!wg(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||a&&!a(e))}function ZA(t,e){return(e?.queryKeyHashFn||kg)(t)}function kg(t){return JSON.stringify(t,(e,r)=>ix(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function wg(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>wg(t[r],e[r])):!1}var Awe=Object.prototype.hasOwnProperty;function e$(t,e){if(t===e)return t;const r=WL(t)&&WL(e);if(!r&&!(ix(t)&&ix(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:Awe.call(t,f))&&u++;continue}if(h===null||m===null||typeof h!="object"||typeof m!="object"){c[f]=m;continue}const _=e$(h,m);c[f]=_,_===h&&u++}return a===o&&u===a?t:c}function WL(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ix(t){if(!KL(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!KL(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function KL(t){return Object.prototype.toString.call(t)==="[object Object]"}function Rwe(t){return new Promise(e=>{nx.setTimeout(e,t)})}function Dwe(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?e$(t,e):e}function Owe(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Nwe(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var e1=Symbol();function t$(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===e1?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Iwe=class extends T0{#e;#t;#r;constructor(){super(),this.#r=t=>{if(!C0&&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"}},r$=new Iwe;function Mwe(){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 jwe=Ewe;function Lwe(){let t=[],e=0,r=c=>{c()},n=c=>{c()},a=jwe;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 Wa=Lwe(),Bwe=class extends T0{#e=!0;#t;#r;constructor(){super(),this.#r=t=>{if(!C0&&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}},Cb=new Bwe;function Uwe(t){return Math.min(1e3*2**t,3e4)}function n$(t){return(t??"online")==="online"?Cb.isOnline():!0}var sx=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function a$(t){let e=!1,r=0,n;const a=Mwe(),i=()=>a.status!=="pending",o=b=>{if(!i()){const E=new sx(b);m(E),t.onCancel?.(E)}},c=()=>{e=!0},u=()=>{e=!1},d=()=>r$.isFocused()&&(t.networkMode==="always"||Cb.isOnline())&&t.canRun(),f=()=>n$(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 D=t.retry??(C0?0:3),P=t.retryDelay??Uwe,A=typeof P=="function"?P(r,T):P,C=D===!0||typeof D=="number"&&r<D||typeof D=="function"&&D(r,T);if(e||!C){m(T);return}r++,t.onFail?.(r,T),Rwe(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 i$=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cwe(this.gcTime)&&(this.#e=nx.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(C0?1/0:300*1e3))}clearGcTimeout(){this.#e&&(nx.clearTimeout(this.#e),this.#e=void 0)}},Fwe=class extends i${#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=YL(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=YL(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=Dwe(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(qs).catch(qs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Pwe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===e1||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ax(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:!xwe(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=t$(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=a$({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:c=>{c instanceof sx&&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 sx){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,...qwe(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),Wa.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function qwe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:n$(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function YL(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 XL(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=t$(e.options,e.fetchOptions),_=async(w,b,E)=>{if(f)return Promise.reject();if(b==null&&w.pages.length)return Promise.resolve(w);const D=(()=>{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(D),{maxPages:A}=e.options,C=E?Nwe:Owe;return{pages:C(w.pages,P,A),pageParams:C(w.pageParams,b,A)}};if(a&&i.length){const w=a==="backward",b=w?zwe:JL,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:JL(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 JL(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 zwe(t,{pages:e,pageParams:r}){return e.length>0?t.getPreviousPageParam?.(e[0],e,r[0],r):void 0}var $we=class extends i${#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||Vwe(),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=a$({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),Wa.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(t)}),this.#r.notify({mutation:this,type:"updated",action:t})})}};function Vwe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hwe=class extends T0{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 $we({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=Iv(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=Iv(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=Iv(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=Iv(t);return typeof e=="string"?this.#t.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Wa.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=>GL(e,r))}findAll(t={}){return this.getAll().filter(e=>GL(t,e))}notify(t){Wa.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Wa.batch(()=>Promise.all(t.map(e=>e.continue().catch(qs))))}};function Iv(t){return t.options.scope?.id}var Gwe=class extends T0{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,r){const n=e.queryKey,a=e.queryHash??ZA(n,e);let i=this.get(a);return i||(i=new Fwe({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(){Wa.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=>HL(e,r))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(r=>HL(t,r)):e}notify(t){Wa.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Wa.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Wa.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Wwe=class{#e;#t;#r;#a;#n;#s;#o;#i;constructor(t={}){this.#e=t.queryCache||new Gwe,this.#t=t.mutationCache||new Hwe,this.#r=t.defaultOptions||{},this.#a=new Map,this.#n=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=r$.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=Cb.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(ax(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=Twe(e,i);if(o!==void 0)return this.#e.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return Wa.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;Wa.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=this.#e;return Wa.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=Wa.batch(()=>this.#e.findAll(t).map(a=>a.cancel(r)));return Promise.all(n).then(qs).catch(qs)}invalidateQueries(t,e={}){return Wa.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=Wa.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(qs)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(qs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=this.#e.build(this,e);return r.isStaleByTime(ax(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(qs).catch(qs)}fetchInfiniteQuery(t){return t.behavior=XL(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(qs).catch(qs)}ensureInfiniteQueryData(t){return t.behavior=XL(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Cb.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(kg(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#a.values()],r={};return e.forEach(n=>{wg(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){this.#n.set(kg(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],r={};return e.forEach(n=>{wg(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=ZA(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===e1&&(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()}},Kwe=v.createContext(void 0),Ywe=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(Kwe.Provider,{value:t,children:e}));const s$=W6({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}}}),o$=W6({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}}});t1.type="walletConnect";function t1(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:t1.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 Dl;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 D=(await b.enable()).map(A=>Ju(A));let P=await this.getChainId();return m&&P!==m&&(P=(await this.switchChain({chainId:m}).catch(C=>{if(C.code===sa.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:_?D.map(A=>({address:A,capabilities:{}})):D,chainId:P}}catch(b){throw/(user rejected|connection request reset)/i.test(b?.message)?new sa(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(_=>Ju(_))},async getProvider({chainId:m}={}){async function _(){const w=h.chains.map(E=>E.id);if(!w.length)return;const{EthereumProvider:b}=await zr(async()=>{const{EthereumProvider:E}=await import("./index.es-BReoGAS9.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]=vwe({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 Dl;const b=h.chains.find(E=>E.id===_);if(!b)throw new ou(new Tb);try{await Promise.all([new Promise(T=>{const D=({chainId:P})=>{P===_&&(h.emitter.off("change",D),T())};h.emitter.on("change",D)}),w.request({method:"wallet_switchEthereumChain",params:[{chainId:gp(_)}]})]);const E=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...E,_]),b}catch(E){const T=E;if(/(user rejected)/i.test(T.message))throw new sa(T);try{let D;m?.blockExplorerUrls?D=m.blockExplorerUrls:D=b.blockExplorers?.default.url?[b.blockExplorers?.default.url]:[];let P;m?.rpcUrls?.length?P=m.rpcUrls:P=[...b.rpcUrls.default.http];const A={blockExplorerUrls:D,chainId:gp(_),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(D){throw new sa(D)}}},onAccountsChanged(m){m.length===0?this.onDisconnect():h.emitter.emit("change",{accounts:m.map(_=>Ju(_))})},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 Xwe={};const Jwe=[s$,o$],Qwe=new Wwe,Zwe=Q6({storage:gwe});function eSe(){const t=!!(import.meta.vitest||typeof process<"u"&&Xwe?.VITEST_WORKER_ID),e=[E0({shimDisconnect:!0})];if(!t)try{e.push(t1({projectId:"demo",showQrModal:!0}))}catch{}return hwe({chains:Jwe,multiInjectedProviderDiscovery:!0,transports:{[s$.id]:FL(),[o$.id]:FL()},connectors:e,ssr:!1,storage:Zwe,syncConnectedChain:!0})}function tSe({children:t}){const e=eSe();return g.jsx(kwe,{config:e,children:g.jsx(Ywe,{client:Qwe,children:t})})}v.createContext(void 0);const c$=v.createContext(void 0);async function rSe(){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 nSe({children:t}){const[e,r]=v.useState(!1),[n,a]=v.useState(!1),i=async()=>{const o=await rSe();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(c$.Provider,{value:{loaded:e,walletEnabled:n,refresh:i},children:t})}function aSe(){return v.useContext(c$)??{loaded:!0,walletEnabled:!1,refresh:()=>{}}}const nT=io("SafeArea",{web:()=>zr(()=>import("./web-OXAE-1ch.js"),[],import.meta.url).then(t=>new t.SafeAreaWeb)});function Mv(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 iSe(){Mv("top"),Mv("left"),Mv("bottom"),Mv("right")}iSe();class l$ extends Ct.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 QL;(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"})(QL||(QL={}));const aT=io("LocalNotifications",{web:()=>zr(()=>import("./web-DYFZJPRM.js"),[],import.meta.url).then(t=>new t.LocalNotificationsWeb)}),pf=io("PushNotifications",{}),sSe={};let ZL=!1;async function oSe(t={}){if(ZL||(ZL=!0,!(Wr.getPlatform()==="ios"||Wr.getPlatform()==="android")))return;const r=t.enableLocal!==!1,n=t.enablePush??sSe?.VITE_ENABLE_PUSH==="1";if(r)try{await cSe()}catch{}if(n)try{await lSe(t.onPushToken)}catch{}}async function cSe(){try{if((await aT.requestPermissions()).display!=="granted")return}catch{}try{await aT.createChannel?.({id:"default",name:"General",description:"General notifications",importance:4,visibility:1,sound:void 0,lights:!0,vibration:!0})}catch{}try{aT.addListener("localNotificationActionPerformed",t=>{})}catch{}}async function lSe(t){try{if((await pf.requestPermissions()).receive!=="granted")return}catch{return}try{await pf.register()}catch{}pf.addListener("registration",e=>{try{t?.(e.value)}catch{}}),pf.addListener("registrationError",e=>{}),pf.addListener("pushNotificationReceived",e=>{}),pf.addListener("pushNotificationActionPerformed",e=>{})}function uSe({cooldownMs:t=5e3,initialGraceMs:e=900}){const r=Ss(),{room:n}=Li(),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,D=!1)=>{if(d)return;const P=Date.now();if(!(!D&&P-c.current<e)&&!i.current&&!(!D&&P-a.current<t)){i.current=!0;try{const A=n?.id||void 0;if(r)if(f)try{const C=await vT(r,Tt.BOTS_NUDGE,{roomId:A},{timeoutMs:5e3});try{window.__fgLastAck=C}catch{}}catch{}else await aB(r,Tt.BOTS_NUDGE,{roomId:A});a.current=P}catch{}finally{i.current=!1}}},m=async(T,D=!1)=>{if(d)return;const P=Date.now();if(!(!D&&P-c.current<e)&&!o.current){if(o.current=!0,!D&&P-a.current<t){o.current=!1;return}try{const A=n?.id||void 0;if(!r)return;try{await im(r)}catch{}try{(await vT(r,Tt.ROOM_REFRESH_STATE,{roomId:A},{timeoutMs:5e3}))?.ok,a.current=P}catch{}}catch{}finally{o.current=!1}}};try{window.__fgNudge=(T,D)=>{h(T||"manual",!!D)}}catch{}(async()=>{try{const T=await Fo.addListener("appStateChange",D=>{if(!d)if(D.isActive)(async()=>{try{await im(r)}catch{}h("native_appstate_active",!0),m("native_appstate_active")})();else try{Zu(r,"BotNudgeOnForeground: appStateChange inactive")}catch{}});try{window.__fgAppStateListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})(),(async()=>{try{const T=await Fo.addListener("pause",()=>{try{window?.Capacitor?.isNativePlatform&&Zu(r,"BotNudgeOnForeground: pause event")}catch{}});try{window.__fgPauseListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})(),(async()=>{try{const T=await Fo.addListener("resume",async()=>{try{await im(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 dSe(){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 fSe(){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 p4().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 pSe(){const{meId:t}=Vr(),e=rn(),r=_i(),{info:n,onIdle:a}=Cs(),{room:i,setRoom:o}=Li(),{leaveRoom:c}=gu(),u=Ct.useRef(!1);return Ct.useEffect(()=>{const d=r.pathname||"";/^\/(room|poker\/room)\//.test(d)||(u.current=!1)},[r.pathname]),Da({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 hSe(t){switch(t){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return t}}function mSe(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 gSe(){const t=T6(),e=rn(),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=mSe(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:hSe(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 Wc.createPortal(o,document.body)}function ySe(){const t=Ss(),e=v.useRef(0);return v.useEffect(()=>{let r;const n=()=>{try{const a=Hv(),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{Ws(t,"SocketWatchdog")}catch{}}}catch{}r=setTimeout(n,2e3),r.unref?.()};return n(),()=>clearTimeout(r)},[t]),null}try{const t=Wr.getPlatform();if((t==="ios"||t==="android")&&(Promise.resolve(nT.enable?.({config:{customColorsForSystemBars:!0,statusBarColor:"#00000000",statusBarContent:"light",navigationBarColor:"#00000000",navigationBarContent:"light"}})).catch(()=>{}),Mp().catch(e=>{})),t==="ios"||t==="android"){let e=0,r=0;const n=async()=>{try{const i=await nT.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{nT.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(Wr.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 vSe(){const{loaded:t,walletEnabled:e}=aSe(),r=rn(),n=_i(),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(tSe,{children:c}):g.jsx(g.Fragment,{children:c}))(g.jsx(nG,{children:g.jsx(Yre,{children:g.jsxs(L_e,{children:[g.jsx(H0e,{}),g.jsx(KG,{children:g.jsx(dne,{children:g.jsxs(tG,{children:[g.jsx(W0e,{}),g.jsx(Dfe,{children:g.jsx(wfe,{children:g.jsx(V_e,{children:g.jsx(mbe,{children:g.jsx(Sbe,{children:g.jsx(Nfe,{children:g.jsx(sG,{children:g.jsxs(l$,{children:[g.jsx(q0e,{}),g.jsx(gSe,{}),g.jsx(pSe,{}),g.jsx(uSe,{}),g.jsx(dSe,{}),g.jsx(fSe,{}),g.jsx(ySe,{})]})})})})})})})})]})})})]})})})):g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(Bi,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]})}function _Se(){return v.useEffect(()=>{const t={current:null};return t.current=()=>{try{Lr()}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{oSe()}catch{}},[]),g.jsx(WH,{children:g.jsx(_7,{children:g.jsx(nSe,{children:g.jsx(vSe,{})})})})}function bSe(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{$G?.(),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 _O=="function"&&(_O(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 R=0;const N=()=>new Promise(L=>{let j=!1;const q=U=>{j||(j=!0,L(U))};try{const U=VG?.(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(;R<=r;){if(await N())return d.current.plays+=1,R>0&&(d.current.recovered+=1),f.current[O]=0,!0;if(R+=1,d.current.failures+=1,f.current[O]=(f.current[O]||0)+1,f.current[O]>=3&&E(O),R>r)break;await new Promise(j=>setTimeout(j,60*R))}return!1},[i,n,b,c,r,w]),D=v.useCallback(O=>{try{HG?.(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 R=I.failures/(x||1);if(R>.4){w("elevated failure ratio",R.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:D,setMuted:P,setVolume:A,activationPrompt:b,isActivated:n,isMuted:i,volume:c,stats:d.current}}function kSe({children:t,config:e}){return bSe(e),g.jsx(g.Fragment,{children:t})}const wSe=[{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 SSe({id:t,variant:e}){const r=wSe.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 ESe(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 TSe=[{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"}],u$={"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 CSe(t){const e=/^\/capture\/cee-lo\/([a-z0-9-]+)$/i.exec(t);if(!e)return null;const r=e[1];return u$[r]?{scene:r}:null}function xSe({scene:t}){const e=u$[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(PSe,{banker:e.banker,results:e.results,chipDeltas:e.chipDeltas}),g.jsx(ASe,{dice:e.dice,rolling:e.rolling}),e.point!=null&&e.point!==void 0&&g.jsx(DSe,{point:e.point}),e.showRoll&&g.jsx(OSe,{}),e.roundSummary&&g.jsx(NSe,{text:e.roundSummary})]})}):g.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}function PSe({banker:t,results:e,chipDeltas:r}){return g.jsx("div",{className:"cl-seats",children:TSe.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 ASe({dice:t,rolling:e}){return g.jsx("div",{className:"cl-dice","aria-label":"dice",children:t.map((r,n)=>g.jsx(RSe,{value:r,rolling:e},n))})}function RSe({value:t,rolling:e}){const r=t===0?"?":String(t);return g.jsx("div",{className:"cl-die"+(e?" is-rolling":""),children:r})}function DSe({point:t}){return g.jsxs("div",{className:"cl-point",children:["POINT: ",t]})}function OSe(){return g.jsx("div",{className:"cl-roll-btn",children:"ROLL"})}function NSe({text:t}){return g.jsx("div",{className:"cl-summary",children:t})}async function ISe(){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{ar("Light")}catch{}},{passive:!0});try{Q9()}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";Xs.get(t).then(e=>{if(!e)return Xs.clearSessionKeys().then(()=>Xs.set(t,"1"))}).catch(()=>{})}catch{}function MSe(){window.__APP_MOUNTED__=!0,v.useEffect(()=>{try{const e=window.Capacitor?.getPlatform?.();(e==="ios"||e==="android")&&T3().catch(()=>{})}catch{}},[]);try{const e=window.Capacitor?.getPlatform?.();(e==="ios"||e==="android")&&Promise.resolve().then(()=>{try{kf.notifyAppReady()}catch{}})}catch{}return g.jsx(_Se,{})}function iT(){try{const t=ESe(window.location.pathname,window.location.search);if(t){document.body.classList.add("ad-capture"),Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(SSe,{id:t.id,variant:t.variant})}));return}const e=CSe(window.location.pathname);if(e){document.body.classList.add("ad-capture"),Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(xSe,{scene:e.scene})}));return}}catch{}Aw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(l$,{children:g.jsx(kSe,{config:{debug:!1},children:g.jsx(MSe,{})})})}))}function jSe(){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 us.init()}catch{}iT();try{await ISe()}catch{}try{us.healthCheck().catch(()=>{})}catch{}})():iT()}catch{iT()}}window.APP_TARGET||jSe();export{uo as B,ibe as D,VSe as F,um as I,k_ as M,lN as N,Ct as R,og as T,sa as U,v3 as W,zr as _,ox as a,v as b,FSe as c,Zo as d,y0 as e,gu as f,Sg as g,BSe as h,LSe as i,g as j,Wke as k,au as l,FL as m,io as r,Ox as s,HSe as t,Vr as u,Fke as w};
