(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function a(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(l){if(l.ep)return;l.ep=!0;const c=a(l);fetch(l.href,c)}})();var od={exports:{}},lr={};var n0;function Y1(){if(n0)return lr;n0=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(r,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:n,type:r,key:d,ref:l!==void 0?l:null,props:c}}return lr.Fragment=t,lr.jsx=a,lr.jsxs=a,lr}var i0;function K1(){return i0||(i0=1,od.exports=Y1()),od.exports}var v=K1(),ld={exports:{}},me={};var a0;function X1(){if(a0)return me;a0=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),w=Symbol.iterator;function _(C){return C===null||typeof C!="object"?null:(C=w&&C[w]||C["@@iterator"],typeof C=="function"?C:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,E={};function j(C,H,F){this.props=C,this.context=H,this.refs=E,this.updater=F||S}j.prototype.isReactComponent={},j.prototype.setState=function(C,H){if(typeof C!="object"&&typeof C!="function"&&C!=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,C,H,"setState")},j.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function O(){}O.prototype=j.prototype;function k(C,H,F){this.props=C,this.context=H,this.refs=E,this.updater=F||S}var z=k.prototype=new O;z.constructor=k,A(z,j.prototype),z.isPureReactComponent=!0;var G=Array.isArray;function Y(){}var I={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ee(C,H,F){var Z=F.ref;return{$$typeof:n,type:C,key:H,ref:Z!==void 0?Z:null,props:F}}function ve(C,H){return ee(C.type,H,C.props)}function Re(C){return typeof C=="object"&&C!==null&&C.$$typeof===n}function Ae(C){var H={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(F){return H[F]})}var ae=/\/+/g;function re(C,H){return typeof C=="object"&&C!==null&&C.key!=null?Ae(""+C.key):H.toString(36)}function se(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(Y,Y):(C.status="pending",C.then(function(H){C.status==="pending"&&(C.status="fulfilled",C.value=H)},function(H){C.status==="pending"&&(C.status="rejected",C.reason=H)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function D(C,H,F,Z,de){var ye=typeof C;(ye==="undefined"||ye==="boolean")&&(C=null);var Ee=!1;if(C===null)Ee=!0;else switch(ye){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(C.$$typeof){case n:case t:Ee=!0;break;case g:return Ee=C._init,D(Ee(C._payload),H,F,Z,de)}}if(Ee)return de=de(C),Ee=Z===""?"."+re(C,0):Z,G(de)?(F="",Ee!=null&&(F=Ee.replace(ae,"$&/")+"/"),D(de,H,F,"",function(It){return It})):de!=null&&(Re(de)&&(de=ve(de,F+(de.key==null||C&&C.key===de.key?"":(""+de.key).replace(ae,"$&/")+"/")+Ee)),H.push(de)),1;Ee=0;var lt=Z===""?".":Z+":";if(G(C))for(var He=0;He>>1,fe=D[he];if(0>>1;hel(F,J))Zl(de,F)?(D[he]=de,D[Z]=J,he=Z):(D[he]=F,D[H]=J,he=H);else if(Zl(de,J))D[he]=de,D[Z]=J,he=Z;else break e}}return V}function l(D,V){var J=D.sortIndex-V.sortIndex;return J!==0?J:D.id-V.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();n.unstable_now=function(){return d.now()-f}}var m=[],p=[],g=1,b=null,w=3,_=!1,S=!1,A=!1,E=!1,j=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function z(D){for(var V=a(p);V!==null;){if(V.callback===null)r(p);else if(V.startTime<=D)r(p),V.sortIndex=V.expirationTime,t(m,V);else break;V=a(p)}}function G(D){if(A=!1,z(D),!S)if(a(m)!==null)S=!0,Y||(Y=!0,Ae());else{var V=a(p);V!==null&&se(G,V.startTime-D)}}var Y=!1,I=-1,X=5,ee=-1;function ve(){return E?!0:!(n.unstable_now()-eeD&&ve());){var he=b.callback;if(typeof he=="function"){b.callback=null,w=b.priorityLevel;var fe=he(b.expirationTime<=D);if(D=n.unstable_now(),typeof fe=="function"){b.callback=fe,z(D),V=!0;break t}b===a(m)&&r(m),z(D)}else r(m);b=a(m)}if(b!==null)V=!0;else{var C=a(p);C!==null&&se(G,C.startTime-D),V=!1}}break e}finally{b=null,w=J,_=!1}V=void 0}}finally{V?Ae():Y=!1}}}var Ae;if(typeof k=="function")Ae=function(){k(Re)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,re=ae.port2;ae.port1.onmessage=Re,Ae=function(){re.postMessage(null)}}else Ae=function(){j(Re,0)};function se(D,V){I=j(function(){D(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(D){D.callback=null},n.unstable_forceFrameRate=function(D){0>D||125he?(D.sortIndex=J,t(p,D),a(m)===null&&D===a(p)&&(A?(O(I),I=-1):A=!0,se(G,J-he))):(D.sortIndex=fe,t(m,D),S||_||(S=!0,Y||(Y=!0,Ae()))),D},n.unstable_shouldYield=ve,n.unstable_wrapCallback=function(D){var V=w;return function(){var J=w;w=V;try{return D.apply(this,arguments)}finally{w=J}}}})(dd)),dd}var o0;function J1(){return o0||(o0=1,ud.exports=F1()),ud.exports}var hd={exports:{}},wt={};var l0;function Z1(){if(l0)return wt;l0=1;var n=Th();function t(m){var p="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),hd.exports=Z1(),hd.exports}var u0;function e_(){if(u0)return cr;u0=1;var n=J1(),t=Th(),a=W1();function r(e){var i="https://react.dev/errors/"+e;if(1fe||(e.current=he[fe],he[fe]=null,fe--)}function F(e,i){fe++,he[fe]=e.current,e.current=i}var Z=C(null),de=C(null),ye=C(null),Ee=C(null);function lt(e,i){switch(F(ye,i),F(de,e),F(Z,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?Eg(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=Eg(i),e=Ag(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}H(Z),F(Z,e)}function He(){H(Z),H(de),H(ye)}function It(e){e.memoizedState!==null&&F(Ee,e);var i=Z.current,s=Ag(i,e.type);i!==s&&(F(de,e),F(Z,s))}function Ei(e){de.current===e&&(H(Z),H(de)),Ee.current===e&&(H(Ee),ar._currentValue=J)}var ia,ms;function rn(e){if(ia===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);ia=i&&i[1]||"",ms=-1)":-1u||T[o]!==U[u]){var q=` `+T[o].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=o&&0<=u);break}}}finally{En=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?rn(s):""}function K(e,i){switch(e.tag){case 26:case 27:case 5:return rn(e.type);case 16:return rn("Lazy");case 13:return e.child!==i&&i!==null?rn("Suspense Fallback"):rn("Suspense");case 19:return rn("SuspenseList");case 0:case 15:return aa(e.type,!1);case 11:return aa(e.type.render,!1);case 1:return aa(e.type,!0);case 31:return rn("Activity");default:return""}}function Te(e){try{var i="",s=null;do i+=K(e,s),s=e,e=e.return;while(e);return i}catch(o){return` Error generating stack: `+o.message+` `+o.stack}}var at=Object.prototype.hasOwnProperty,sa=n.unstable_scheduleCallback,Ai=n.unstable_cancelCallback,jt=n.unstable_shouldYield,Lt=n.unstable_requestPaint,dt=n.unstable_now,Il=n.unstable_getCurrentPriorityLevel,ps=n.unstable_ImmediatePriority,Yl=n.unstable_UserBlockingPriority,Yn=n.unstable_NormalPriority,zr=n.unstable_LowPriority,gs=n.unstable_IdlePriority,Pr=n.log,Kl=n.unstable_setDisableYieldValue,Kn=null,_t=null;function yn(e){if(typeof Pr=="function"&&Kl(e),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(Kn,e)}catch{}}var St=Math.clz32?Math.clz32:Mw,Ow=Math.log,Nw=Math.LN2;function Mw(e){return e>>>=0,e===0?32:31-(Ow(e)/Nw|0)|0}var Vr=256,qr=262144,Hr=4194304;function ji(e){var i=e&42;if(i!==0)return i;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Gr(e,i,s){var o=e.pendingLanes;if(o===0)return 0;var u=0,h=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var x=o&134217727;return x!==0?(o=x&~h,o!==0?u=ji(o):(y&=x,y!==0?u=ji(y):s||(s=x&~e,s!==0&&(u=ji(s))))):(x=o&~h,x!==0?u=ji(x):y!==0?u=ji(y):s||(s=o&~e,s!==0&&(u=ji(s)))),u===0?0:i!==0&&i!==u&&(i&h)===0&&(h=u&-u,s=i&-i,h>=s||h===32&&(s&4194048)!==0)?i:u}function ys(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function Dw(e,i){switch(e){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 rf(){var e=Hr;return Hr<<=1,(Hr&62914560)===0&&(Hr=4194304),e}function Xl(e){for(var i=[],s=0;31>s;s++)i.push(e);return i}function vs(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Lw(e,i,s,o,u,h){var y=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var x=e.entanglements,T=e.expirationTimes,U=e.hiddenUpdates;for(s=y&~s;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var qw=/[\n"\\]/g;function Kt(e){return e.replace(qw,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function tc(e,i,s,o,u,h,y,x){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),i!=null?y==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+Yt(i)):e.value!==""+Yt(i)&&(e.value=""+Yt(i)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),i!=null?nc(e,y,Yt(i)):s!=null?nc(e,y,Yt(s)):o!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+Yt(x):e.removeAttribute("name")}function bf(e,i,s,o,u,h,y,x){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),i!=null||s!=null){if(!(h!=="submit"&&h!=="reset"||i!=null)){ec(e);return}s=s!=null?""+Yt(s):"",i=i!=null?""+Yt(i):s,x||i===e.value||(e.value=i),e.defaultValue=i}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=x?e.checked:!!o,e.defaultChecked=!!o,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),ec(e)}function nc(e,i,s){i==="number"&&Ir(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function da(e,i,s,o){if(e=e.options,i){i={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(Cn)try{var _s={};Object.defineProperty(_s,"passive",{get:function(){oc=!0}}),window.addEventListener("test",_s,_s),window.removeEventListener("test",_s,_s)}catch{oc=!1}var Fn=null,lc=null,Kr=null;function Af(){if(Kr)return Kr;var e,i=lc,s=i.length,o,u="value"in Fn?Fn.value:Fn.textContent,h=u.length;for(e=0;e=Es),Nf=" ",Mf=!1;function Df(e,i){switch(e){case"keyup":return px.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var pa=!1;function yx(e,i){switch(e){case"compositionend":return Lf(i);case"keypress":return i.which!==32?null:(Mf=!0,Nf);case"textInput":return e=i.data,e===Nf&&Mf?null:e;default:return null}}function vx(e,i){if(pa)return e==="compositionend"||!fc&&Df(e,i)?(e=Af(),Kr=lc=Fn=null,pa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:s,offset:i-e};e=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Gf(s)}}function Qf(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?Qf(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function If(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=Ir(e.document);i instanceof e.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)e=i.contentWindow;else break;i=Ir(e.document)}return i}function gc(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var Ax=Cn&&"documentMode"in document&&11>=document.documentMode,ga=null,yc=null,Rs=null,vc=!1;function Yf(e,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;vc||ga==null||ga!==Ir(o)||(o=ga,"selectionStart"in o&&gc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Rs&&Cs(Rs,o)||(Rs=o,o=Ho(yc,"onSelect"),0>=y,u-=y,vn=1<<32-St(i)+u|s<ge?(_e=ne,ne=null):_e=ne.sibling;var Ce=B(N,ne,L[ge],$);if(Ce===null){ne===null&&(ne=_e);break}e&&ne&&Ce.alternate===null&&i(N,ne),R=h(Ce,R,ge),je===null?oe=Ce:je.sibling=Ce,je=Ce,ne=_e}if(ge===L.length)return s(N,ne),Se&&kn(N,ge),oe;if(ne===null){for(;gege?(_e=ne,ne=null):_e=ne.sibling;var vi=B(N,ne,Ce.value,$);if(vi===null){ne===null&&(ne=_e);break}e&&ne&&vi.alternate===null&&i(N,ne),R=h(vi,R,ge),je===null?oe=vi:je.sibling=vi,je=vi,ne=_e}if(Ce.done)return s(N,ne),Se&&kn(N,ge),oe;if(ne===null){for(;!Ce.done;ge++,Ce=L.next())Ce=Q(N,Ce.value,$),Ce!==null&&(R=h(Ce,R,ge),je===null?oe=Ce:je.sibling=Ce,je=Ce);return Se&&kn(N,ge),oe}for(ne=o(ne);!Ce.done;ge++,Ce=L.next())Ce=P(ne,N,ge,Ce.value,$),Ce!==null&&(e&&Ce.alternate!==null&&ne.delete(Ce.key===null?ge:Ce.key),R=h(Ce,R,ge),je===null?oe=Ce:je.sibling=Ce,je=Ce);return e&&ne.forEach(function(I1){return i(N,I1)}),Se&&kn(N,ge),oe}function Le(N,R,L,$){if(typeof L=="object"&&L!==null&&L.type===A&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case _:e:{for(var oe=L.key;R!==null;){if(R.key===oe){if(oe=L.type,oe===A){if(R.tag===7){s(N,R.sibling),$=u(R,L.props.children),$.return=N,N=$;break e}}else if(R.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===X&&zi(oe)===R.type){s(N,R.sibling),$=u(R,L.props),Ls($,L),$.return=N,N=$;break e}s(N,R);break}else i(N,R);R=R.sibling}L.type===A?($=Mi(L.props.children,N.mode,$,L.key),$.return=N,N=$):($=ao(L.type,L.key,L.props,null,N.mode,$),Ls($,L),$.return=N,N=$)}return y(N);case S:e:{for(oe=L.key;R!==null;){if(R.key===oe)if(R.tag===4&&R.stateNode.containerInfo===L.containerInfo&&R.stateNode.implementation===L.implementation){s(N,R.sibling),$=u(R,L.children||[]),$.return=N,N=$;break e}else{s(N,R);break}else i(N,R);R=R.sibling}$=Ec(L,N.mode,$),$.return=N,N=$}return y(N);case X:return L=zi(L),Le(N,R,L,$)}if(se(L))return W(N,R,L,$);if(Ae(L)){if(oe=Ae(L),typeof oe!="function")throw Error(r(150));return L=oe.call(L),le(N,R,L,$)}if(typeof L.then=="function")return Le(N,R,ho(L),$);if(L.$$typeof===k)return Le(N,R,oo(N,L),$);fo(N,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,R!==null&&R.tag===6?(s(N,R.sibling),$=u(R,L),$.return=N,N=$):(s(N,R),$=Tc(L,N.mode,$),$.return=N,N=$),y(N)):s(N,R)}return function(N,R,L,$){try{Ds=0;var oe=Le(N,R,L,$);return ja=null,oe}catch(ne){if(ne===Aa||ne===co)throw ne;var je=Bt(29,ne,null,N.mode);return je.lanes=$,je.return=N,je}}}var Vi=gm(!0),ym=gm(!1),ti=!1;function Bc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zc(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ni(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ii(e,i,s){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(ke&2)!==0){var u=o.pending;return u===null?i.next=i:(i.next=u.next,u.next=i),o.pending=i,i=io(e),em(e,null,s),i}return no(e,o,i,s),io(e)}function Us(e,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var o=i.lanes;o&=e.pendingLanes,s|=o,i.lanes=s,lf(e,s)}}function Pc(e,i){var s=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var u=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var y={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};h===null?u=h=y:h=h.next=y,s=s.next}while(s!==null);h===null?u=h=i:h=h.next=i}else u=h=i;s={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=i:e.next=i,s.lastBaseUpdate=i}var Vc=!1;function Bs(){if(Vc){var e=Ea;if(e!==null)throw e}}function zs(e,i,s,o){Vc=!1;var u=e.updateQueue;ti=!1;var h=u.firstBaseUpdate,y=u.lastBaseUpdate,x=u.shared.pending;if(x!==null){u.shared.pending=null;var T=x,U=T.next;T.next=null,y===null?h=U:y.next=U,y=T;var q=e.alternate;q!==null&&(q=q.updateQueue,x=q.lastBaseUpdate,x!==y&&(x===null?q.firstBaseUpdate=U:x.next=U,q.lastBaseUpdate=T))}if(h!==null){var Q=u.baseState;y=0,q=U=T=null,x=h;do{var B=x.lane&-536870913,P=B!==x.lane;if(P?(xe&B)===B:(o&B)===B){B!==0&&B===Ta&&(Vc=!0),q!==null&&(q=q.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var W=e,le=x;B=i;var Le=s;switch(le.tag){case 1:if(W=le.payload,typeof W=="function"){Q=W.call(Le,Q,B);break e}Q=W;break e;case 3:W.flags=W.flags&-65537|128;case 0:if(W=le.payload,B=typeof W=="function"?W.call(Le,Q,B):W,B==null)break e;Q=b({},Q,B);break e;case 2:ti=!0}}B=x.callback,B!==null&&(e.flags|=64,P&&(e.flags|=8192),P=u.callbacks,P===null?u.callbacks=[B]:P.push(B))}else P={lane:B,tag:x.tag,payload:x.payload,callback:x.callback,next:null},q===null?(U=q=P,T=Q):q=q.next=P,y|=B;if(x=x.next,x===null){if(x=u.shared.pending,x===null)break;P=x,x=P.next,P.next=null,u.lastBaseUpdate=P,u.shared.pending=null}}while(!0);q===null&&(T=Q),u.baseState=T,u.firstBaseUpdate=U,u.lastBaseUpdate=q,h===null&&(u.shared.lanes=0),li|=y,e.lanes=y,e.memoizedState=Q}}function vm(e,i){if(typeof e!="function")throw Error(r(191,e));e.call(i)}function bm(e,i){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;eh?h:8;var y=D.T,x={};D.T=x,su(e,!1,i,s);try{var T=u(),U=D.S;if(U!==null&&U(x,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var q=Lx(T,o);qs(e,i,q,Ht(e))}else qs(e,i,o,Ht(e))}catch(Q){qs(e,i,{then:function(){},status:"rejected",reason:Q},Ht())}finally{V.p=h,y!==null&&x.types!==null&&(y.types=x.types),D.T=y}}function qx(){}function iu(e,i,s,o){if(e.tag!==5)throw Error(r(476));var u=Jm(e).queue;Fm(e,u,i,J,s===null?qx:function(){return Zm(e),s(o)})}function Jm(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:J},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:s},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function Zm(e){var i=Jm(e);i.next===null&&(i=e.alternate.memoizedState),qs(e,i.next.queue,{},Ht())}function au(){return mt(ar)}function Wm(){return Je().memoizedState}function ep(){return Je().memoizedState}function Hx(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var s=Ht();e=ni(s);var o=ii(i,e,s);o!==null&&(Dt(o,i,s),Us(o,i,s)),i={cache:Mc()},e.payload=i;return}i=i.return}}function Gx(e,i,s){var o=Ht();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},So(e)?np(i,s):(s=_c(e,i,s,o),s!==null&&(Dt(s,e,o),ip(s,i,o)))}function tp(e,i,s){var o=Ht();qs(e,i,s,o)}function qs(e,i,s,o){var u={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(So(e))np(i,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=i.lastRenderedReducer,h!==null))try{var y=i.lastRenderedState,x=h(y,s);if(u.hasEagerState=!0,u.eagerState=x,Ut(x,y))return no(e,i,u,0),Be===null&&to(),!1}catch{}if(s=_c(e,i,u,o),s!==null)return Dt(s,e,o),ip(s,i,o),!0}return!1}function su(e,i,s,o){if(o={lane:2,revertLane:Bu(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},So(e)){if(i)throw Error(r(479))}else i=_c(e,s,o,2),i!==null&&Dt(i,e,2)}function So(e){var i=e.alternate;return e===pe||i!==null&&i===pe}function np(e,i){Ra=go=!0;var s=e.pending;s===null?i.next=i:(i.next=s.next,s.next=i),e.pending=i}function ip(e,i,s){if((s&4194048)!==0){var o=i.lanes;o&=e.pendingLanes,s|=o,i.lanes=s,lf(e,s)}}var Hs={readContext:mt,use:bo,useCallback:Ie,useContext:Ie,useEffect:Ie,useImperativeHandle:Ie,useLayoutEffect:Ie,useInsertionEffect:Ie,useMemo:Ie,useReducer:Ie,useRef:Ie,useState:Ie,useDebugValue:Ie,useDeferredValue:Ie,useTransition:Ie,useSyncExternalStore:Ie,useId:Ie,useHostTransitionStatus:Ie,useFormState:Ie,useActionState:Ie,useOptimistic:Ie,useMemoCache:Ie,useCacheRefresh:Ie};Hs.useEffectEvent=Ie;var ap={readContext:mt,use:bo,useCallback:function(e,i){return Tt().memoizedState=[e,i===void 0?null:i],e},useContext:mt,useEffect:qm,useImperativeHandle:function(e,i,s){s=s!=null?s.concat([e]):null,xo(4194308,4,Qm.bind(null,i,e),s)},useLayoutEffect:function(e,i){return xo(4194308,4,e,i)},useInsertionEffect:function(e,i){xo(4,2,e,i)},useMemo:function(e,i){var s=Tt();i=i===void 0?null:i;var o=e();if(qi){yn(!0);try{e()}finally{yn(!1)}}return s.memoizedState=[o,i],o},useReducer:function(e,i,s){var o=Tt();if(s!==void 0){var u=s(i);if(qi){yn(!0);try{s(i)}finally{yn(!1)}}}else u=i;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=Gx.bind(null,pe,e),[o.memoizedState,e]},useRef:function(e){var i=Tt();return e={current:e},i.memoizedState=e},useState:function(e){e=Zc(e);var i=e.queue,s=tp.bind(null,pe,i);return i.dispatch=s,[e.memoizedState,s]},useDebugValue:tu,useDeferredValue:function(e,i){var s=Tt();return nu(s,e,i)},useTransition:function(){var e=Zc(!1);return e=Fm.bind(null,pe,e.queue,!0,!1),Tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,s){var o=pe,u=Tt();if(Se){if(s===void 0)throw Error(r(407));s=s()}else{if(s=i(),Be===null)throw Error(r(349));(xe&127)!==0||Em(o,i,s)}u.memoizedState=s;var h={value:s,getSnapshot:i};return u.queue=h,qm(jm.bind(null,o,h,e),[e]),o.flags|=2048,Oa(9,{destroy:void 0},Am.bind(null,o,h,s,i),null),s},useId:function(){var e=Tt(),i=Be.identifierPrefix;if(Se){var s=bn,o=vn;s=(o&~(1<<32-St(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=yo++,0<\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?y.createElement("select",{is:o.is}):y.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?y.createElement(u,{is:o.is}):y.createElement(u)}}h[ht]=i,h[Ct]=o;e:for(y=i.child;y!==null;){if(y.tag===5||y.tag===6)h.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===i)break e;for(;y.sibling===null;){if(y.return===null||y.return===i)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}i.stateNode=h;e:switch(gt(h,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Un(i)}}return qe(i),bu(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,s),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==o&&Un(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(r(166));if(e=ye.current,_a(i)){if(e=i.stateNode,s=i.memoizedProps,o=null,u=ft,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[ht]=i,e=!!(e.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||Sg(e.nodeValue,s)),e||Wn(i,!0)}else e=Go(e).createTextNode(o),e[ht]=i,i.stateNode=e}return qe(i),null;case 31:if(s=i.memoizedState,e===null||e.memoizedState!==null){if(o=_a(i),s!==null){if(e===null){if(!o)throw Error(r(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ht]=i}else Di(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;qe(i),e=!1}else s=Rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return i.flags&256?(Pt(i),i):(Pt(i),null);if((i.flags&128)!==0)throw Error(r(558))}return qe(i),null;case 13:if(o=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=_a(i),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=i.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[ht]=i}else Di(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;qe(i),u=!1}else u=Rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return i.flags&256?(Pt(i),i):(Pt(i),null)}return Pt(i),(i.flags&128)!==0?(i.lanes=s,i):(s=o!==null,e=e!==null&&e.memoizedState!==null,s&&(o=i.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==u&&(o.flags|=2048)),s!==e&&s&&(i.child.flags|=8192),Co(i,i.updateQueue),qe(i),null);case 4:return He(),e===null&&qu(i.stateNode.containerInfo),qe(i),null;case 10:return Nn(i.type),qe(i),null;case 19:if(H(Fe),o=i.memoizedState,o===null)return qe(i),null;if(u=(i.flags&128)!==0,h=o.rendering,h===null)if(u)$s(o,!1);else{if(Ye!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(h=po(e),h!==null){for(i.flags|=128,$s(o,!1),e=h.updateQueue,i.updateQueue=e,Co(i,e),i.subtreeFlags=0,e=s,s=i.child;s!==null;)tm(s,e),s=s.sibling;return F(Fe,Fe.current&1|2),Se&&kn(i,o.treeForkCount),i.child}e=e.sibling}o.tail!==null&&dt()>Mo&&(i.flags|=128,u=!0,$s(o,!1),i.lanes=4194304)}else{if(!u)if(e=po(h),e!==null){if(i.flags|=128,u=!0,e=e.updateQueue,i.updateQueue=e,Co(i,e),$s(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!Se)return qe(i),null}else 2*dt()-o.renderingStartTime>Mo&&s!==536870912&&(i.flags|=128,u=!0,$s(o,!1),i.lanes=4194304);o.isBackwards?(h.sibling=i.child,i.child=h):(e=o.last,e!==null?e.sibling=h:i.child=h,o.last=h)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=dt(),e.sibling=null,s=Fe.current,F(Fe,u?s&1|2:s&1),Se&&kn(i,o.treeForkCount),e):(qe(i),null);case 22:case 23:return Pt(i),Hc(),o=i.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(s&536870912)!==0&&(i.flags&128)===0&&(qe(i),i.subtreeFlags&6&&(i.flags|=8192)):qe(i),s=i.updateQueue,s!==null&&Co(i,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==s&&(i.flags|=2048),e!==null&&H(Bi),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Nn(Ze),qe(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function Kx(e,i){switch(jc(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return Nn(Ze),He(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return Ei(i),null;case 31:if(i.memoizedState!==null){if(Pt(i),i.alternate===null)throw Error(r(340));Di()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(Pt(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(r(340));Di()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return H(Fe),null;case 4:return He(),null;case 10:return Nn(i.type),null;case 22:case 23:return Pt(i),Hc(),e!==null&&H(Bi),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return Nn(Ze),null;case 25:return null;default:return null}}function Cp(e,i){switch(jc(i),i.tag){case 3:Nn(Ze),He();break;case 26:case 27:case 5:Ei(i);break;case 4:He();break;case 31:i.memoizedState!==null&&Pt(i);break;case 13:Pt(i);break;case 19:H(Fe);break;case 10:Nn(i.type);break;case 22:case 23:Pt(i),Hc(),e!==null&&H(Bi);break;case 24:Nn(Ze)}}function Qs(e,i){try{var s=i.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var u=o.next;s=u;do{if((s.tag&e)===e){o=void 0;var h=s.create,y=s.inst;o=h(),y.destroy=o}s=s.next}while(s!==u)}}catch(x){Ne(i,i.return,x)}}function ri(e,i,s){try{var o=i.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var h=u.next;o=h;do{if((o.tag&e)===e){var y=o.inst,x=y.destroy;if(x!==void 0){y.destroy=void 0,u=i;var T=s,U=x;try{U()}catch(q){Ne(u,T,q)}}}o=o.next}while(o!==h)}}catch(q){Ne(i,i.return,q)}}function Rp(e){var i=e.updateQueue;if(i!==null){var s=e.stateNode;try{bm(i,s)}catch(o){Ne(e,e.return,o)}}}function kp(e,i,s){s.props=Hi(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(o){Ne(e,i,o)}}function Is(e,i){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof s=="function"?e.refCleanup=s(o):s.current=o}}catch(u){Ne(e,i,u)}}function wn(e,i){var s=e.ref,o=e.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(u){Ne(e,i,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){Ne(e,i,u)}else s.current=null}function Op(e){var i=e.type,s=e.memoizedProps,o=e.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&o.focus();break e;case"img":s.src?o.src=s.src:s.srcSet&&(o.srcset=s.srcSet)}}catch(u){Ne(e,e.return,u)}}function wu(e,i,s){try{var o=e.stateNode;g1(o,e.type,s,i),o[Ct]=i}catch(u){Ne(e,e.return,u)}}function Np(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&fi(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Np(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&fi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _u(e,i,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(e),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=jn));else if(o!==4&&(o===27&&fi(e.type)&&(s=e.stateNode,i=null),e=e.child,e!==null))for(_u(e,i,s),e=e.sibling;e!==null;)_u(e,i,s),e=e.sibling}function Ro(e,i,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?s.insertBefore(e,i):s.appendChild(e);else if(o!==4&&(o===27&&fi(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(Ro(e,i,s),e=e.sibling;e!==null;)Ro(e,i,s),e=e.sibling}function Mp(e){var i=e.stateNode,s=e.memoizedProps;try{for(var o=e.type,u=i.attributes;u.length;)i.removeAttributeNode(u[0]);gt(i,o,s),i[ht]=e,i[Ct]=s}catch(h){Ne(e,e.return,h)}}var Bn=!1,tt=!1,Su=!1,Dp=typeof WeakSet=="function"?WeakSet:Set,ut=null;function Xx(e,i){if(e=e.containerInfo,$u=Fo,e=If(e),gc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var u=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var y=0,x=-1,T=-1,U=0,q=0,Q=e,B=null;t:for(;;){for(var P;Q!==s||u!==0&&Q.nodeType!==3||(x=y+u),Q!==h||o!==0&&Q.nodeType!==3||(T=y+o),Q.nodeType===3&&(y+=Q.nodeValue.length),(P=Q.firstChild)!==null;)B=Q,Q=P;for(;;){if(Q===e)break t;if(B===s&&++U===u&&(x=y),B===h&&++q===o&&(T=y),(P=Q.nextSibling)!==null)break;Q=B,B=Q.parentNode}Q=P}s=x===-1||T===-1?null:{start:x,end:T}}else s=null}s=s||{start:0,end:0}}else s=null;for(Qu={focusedElem:e,selectionRange:s},Fo=!1,ut=i;ut!==null;)if(i=ut,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,ut=e;else for(;ut!==null;){switch(i=ut,h=i.alternate,e=i.flags,i.tag){case 0:if((e&4)!==0&&(e=i.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s title"))),gt(h,o,s),h[ht]=e,ct(h),o=h;break e;case"link":var y=Vg("link","href",u).get(o+(s.href||""));if(y){for(var x=0;xLe&&(y=Le,Le=le,le=y);var N=$f(x,le),R=$f(x,Le);if(N&&R&&(P.rangeCount!==1||P.anchorNode!==N.node||P.anchorOffset!==N.offset||P.focusNode!==R.node||P.focusOffset!==R.offset)){var L=Q.createRange();L.setStart(N.node,N.offset),P.removeAllRanges(),le>Le?(P.addRange(L),P.extend(R.node,R.offset)):(L.setEnd(R.node,R.offset),P.addRange(L))}}}}for(Q=[],P=x;P=P.parentNode;)P.nodeType===1&&Q.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;xs?32:s,D.T=null,s=ku,ku=null;var h=ui,y=Hn;if(st=0,Ua=ui=null,Hn=0,(ke&6)!==0)throw Error(r(331));var x=ke;if(ke|=4,Qp(h.current),Hp(h,h.current,y,s),ke=x,Zs(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(Kn,h)}catch{}return!0}finally{V.p=u,D.T=o,cg(e,i)}}function dg(e,i,s){i=Ft(s,i),i=cu(e.stateNode,i,2),e=ii(e,i,2),e!==null&&(vs(e,2),xn(e))}function Ne(e,i,s){if(e.tag===3)dg(e,e,s);else for(;i!==null;){if(i.tag===3){dg(i,e,s);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(ci===null||!ci.has(o))){e=Ft(s,e),s=hp(2),o=ii(i,s,2),o!==null&&(fp(s,o,i,e),vs(o,2),xn(o));break}}i=i.return}}function Du(e,i,s){var o=e.pingCache;if(o===null){o=e.pingCache=new Zx;var u=new Set;o.set(i,u)}else u=o.get(i),u===void 0&&(u=new Set,o.set(i,u));u.has(s)||(Au=!0,u.add(s),e=i1.bind(null,e,i,s),i.then(e,e))}function i1(e,i,s){var o=e.pingCache;o!==null&&o.delete(i),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Be===e&&(xe&s)===s&&(Ye===4||Ye===3&&(xe&62914560)===xe&&300>dt()-No?(ke&2)===0&&Ba(e,0):ju|=s,La===xe&&(La=0)),xn(e)}function hg(e,i){i===0&&(i=rf()),e=Ni(e,i),e!==null&&(vs(e,i),xn(e))}function a1(e){var i=e.memoizedState,s=0;i!==null&&(s=i.retryLane),hg(e,s)}function s1(e,i){var s=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(i),hg(e,s)}function r1(e,i){return sa(e,i)}var Po=null,Pa=null,Lu=!1,Vo=!1,Uu=!1,hi=0;function xn(e){e!==Pa&&e.next===null&&(Pa===null?Po=Pa=e:Pa=Pa.next=e),Vo=!0,Lu||(Lu=!0,l1())}function Zs(e,i){if(!Uu&&Vo){Uu=!0;do for(var s=!1,o=Po;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var h=0;else{var y=o.suspendedLanes,x=o.pingedLanes;h=(1<<31-St(42|e)+1)-1,h&=u&~(y&~x),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(s=!0,gg(o,h))}else h=xe,h=Gr(o,o===Be?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||ys(o,h)||(s=!0,gg(o,h));o=o.next}while(s);Uu=!1}}function o1(){fg()}function fg(){Vo=Lu=!1;var e=0;hi!==0&&v1()&&(e=hi);for(var i=dt(),s=null,o=Po;o!==null;){var u=o.next,h=mg(o,i);h===0?(o.next=null,s===null?Po=u:s.next=u,u===null&&(Pa=s)):(s=o,(e!==0||(h&3)!==0)&&(Vo=!0)),o=u}st!==0&&st!==5||Zs(e),hi!==0&&(hi=0)}function mg(e,i){for(var s=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0x)break;var q=T.transferSize,Q=T.initiatorType;q&&Tg(Q)&&(T=T.responseEnd,y+=q*(T"u"?null:document;function Ug(e,i,s){var o=Va;if(o&&typeof i=="string"&&i){var u=Kt(i);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),Lg.has(u)||(Lg.add(u),e={rel:e,crossOrigin:s,href:i},o.querySelector(u)===null&&(i=o.createElement("link"),gt(i,"link",e),ct(i),o.head.appendChild(i)))}}function j1(e){Gn.D(e),Ug("dns-prefetch",e,null)}function C1(e,i){Gn.C(e,i),Ug("preconnect",e,i)}function R1(e,i,s){Gn.L(e,i,s);var o=Va;if(o&&e&&i){var u='link[rel="preload"][as="'+Kt(i)+'"]';i==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+Kt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+Kt(s.imageSizes)+'"]')):u+='[href="'+Kt(e)+'"]';var h=u;switch(i){case"style":h=qa(e);break;case"script":h=Ha(e)}nn.has(h)||(e=b({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:e,as:i},s),nn.set(h,e),o.querySelector(u)!==null||i==="style"&&o.querySelector(nr(h))||i==="script"&&o.querySelector(ir(h))||(i=o.createElement("link"),gt(i,"link",e),ct(i),o.head.appendChild(i)))}}function k1(e,i){Gn.m(e,i);var s=Va;if(s&&e){var o=i&&typeof i.as=="string"?i.as:"script",u='link[rel="modulepreload"][as="'+Kt(o)+'"][href="'+Kt(e)+'"]',h=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ha(e)}if(!nn.has(h)&&(e=b({rel:"modulepreload",href:e},i),nn.set(h,e),s.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(ir(h)))return}o=s.createElement("link"),gt(o,"link",e),ct(o),s.head.appendChild(o)}}}function O1(e,i,s){Gn.S(e,i,s);var o=Va;if(o&&e){var u=ca(o).hoistableStyles,h=qa(e);i=i||"default";var y=u.get(h);if(!y){var x={loading:0,preload:null};if(y=o.querySelector(nr(h)))x.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":i},s),(s=nn.get(h))&&Zu(e,s);var T=y=o.createElement("link");ct(T),gt(T,"link",e),T._p=new Promise(function(U,q){T.onload=U,T.onerror=q}),T.addEventListener("load",function(){x.loading|=1}),T.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Qo(y,i,o)}y={type:"stylesheet",instance:y,count:1,state:x},u.set(h,y)}}}function N1(e,i){Gn.X(e,i);var s=Va;if(s&&e){var o=ca(s).hoistableScripts,u=Ha(e),h=o.get(u);h||(h=s.querySelector(ir(u)),h||(e=b({src:e,async:!0},i),(i=nn.get(u))&&Wu(e,i),h=s.createElement("script"),ct(h),gt(h,"link",e),s.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function M1(e,i){Gn.M(e,i);var s=Va;if(s&&e){var o=ca(s).hoistableScripts,u=Ha(e),h=o.get(u);h||(h=s.querySelector(ir(u)),h||(e=b({src:e,async:!0,type:"module"},i),(i=nn.get(u))&&Wu(e,i),h=s.createElement("script"),ct(h),gt(h,"link",e),s.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(u,h))}}function Bg(e,i,s,o){var u=(u=ye.current)?$o(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=qa(s.href),s=ca(u).hoistableStyles,o=s.get(i),o||(o={type:"style",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=qa(s.href);var h=ca(u).hoistableStyles,y=h.get(e);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,y),(h=u.querySelector(nr(e)))&&!h._p&&(y.instance=h,y.state.loading=5),nn.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},nn.set(e,s),h||D1(u,e,s,y.state))),i&&o===null)throw Error(r(528,""));return y}if(i&&o!==null)throw Error(r(529,""));return null;case"script":return i=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ha(s),s=ca(u).hoistableScripts,o=s.get(i),o||(o={type:"script",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function qa(e){return'href="'+Kt(e)+'"'}function nr(e){return'link[rel="stylesheet"]['+e+"]"}function zg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function D1(e,i,s,o){e.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=e.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),gt(i,"link",s),ct(i),e.head.appendChild(i))}function Ha(e){return'[src="'+Kt(e)+'"]'}function ir(e){return"script[async]"+e}function Pg(e,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=e.querySelector('style[data-href~="'+Kt(s.href)+'"]');if(o)return i.instance=o,ct(o),o;var u=b({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),ct(o),gt(o,"style",u),Qo(o,s.precedence,e),i.instance=o;case"stylesheet":u=qa(s.href);var h=e.querySelector(nr(u));if(h)return i.state.loading|=4,i.instance=h,ct(h),h;o=zg(s),(u=nn.get(u))&&Zu(o,u),h=(e.ownerDocument||e).createElement("link"),ct(h);var y=h;return y._p=new Promise(function(x,T){y.onload=x,y.onerror=T}),gt(h,"link",o),i.state.loading|=4,Qo(h,s.precedence,e),i.instance=h;case"script":return h=Ha(s.src),(u=e.querySelector(ir(h)))?(i.instance=u,ct(u),u):(o=s,(u=nn.get(h))&&(o=b({},s),Wu(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),ct(u),gt(u,"link",o),e.head.appendChild(u),i.instance=u);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Qo(o,s.precedence,e));return i.instance}function Qo(e,i,s){for(var o=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,h=u,y=0;y title"):null)}function L1(e,i,s){if(s===1||i.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(e=i.disabled,typeof i.precedence=="string"&&e==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Hg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function U1(e,i,s,o){if(s.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=qa(o.href),h=i.querySelector(nr(u));if(h){i=h._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=Yo.bind(e),i.then(e,e)),s.state.loading|=4,s.instance=h,ct(h);return}h=i.ownerDocument||i,o=zg(o),(u=nn.get(u))&&Zu(o,u),h=h.createElement("link"),ct(h);var y=h;y._p=new Promise(function(x,T){y.onload=x,y.onerror=T}),gt(h,"link",o),s.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Yo.bind(e),i.addEventListener("load",s),i.addEventListener("error",s))}}var ed=0;function B1(e,i){return e.stylesheets&&e.count===0&&Xo(e,e.stylesheets),0ed?50:800)+i);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Yo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ko=null;function Xo(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ko=new Map,i.forEach(z1,e),Ko=null,Yo.call(e))}function z1(e,i){if(!(i.state.loading&4)){var s=Ko.get(e);if(s)var o=s.get(null);else{s=new Map,Ko.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),cd.exports=e_(),cd.exports}var n_=t_();const Eh=M.createContext({});function Ah(n){const t=M.useRef(null);return t.current===null&&(t.current=n()),t.current}const fv=typeof window<"u",mv=fv?M.useLayoutEffect:M.useEffect,zl=M.createContext(null);function jh(n,t){n.indexOf(t)===-1&&n.push(t)}function Al(n,t){const a=n.indexOf(t);a>-1&&n.splice(a,1)}const Tn=(n,t,a)=>a>t?t:a{};const Qn={},pv=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n);function gv(n){return typeof n=="object"&&n!==null}const yv=n=>/^0[^.\s]+$/u.test(n);function vv(n){let t;return()=>(t===void 0&&(t=n()),t)}const sn=n=>n,i_=(n,t)=>a=>t(n(a)),Mr=(...n)=>n.reduce(i_),xr=(n,t,a)=>{const r=t-n;return r===0?1:(a-n)/r};class Rh{constructor(){this.subscriptions=[]}add(t){return jh(this.subscriptions,t),()=>Al(this.subscriptions,t)}notify(t,a,r){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](t,a,r);else for(let c=0;cn*1e3,an=n=>n/1e3;function bv(n,t){return t?n*(1e3/t):0}const wv=(n,t,a)=>(((1-3*a+3*t)*n+(3*a-6*t))*n+3*t)*n,a_=1e-7,s_=12;function r_(n,t,a,r,l){let c,d,f=0;do d=t+(a-t)/2,c=wv(d,r,l)-n,c>0?a=d:t=d;while(Math.abs(c)>a_&&++fr_(c,0,1,n,a);return c=>c===0||c===1?c:wv(l(c),t,r)}const xv=n=>t=>t<=.5?n(2*t)/2:(2-n(2*(1-t)))/2,_v=n=>t=>1-n(1-t),Sv=Dr(.33,1.53,.69,.99),kh=_v(Sv),Tv=xv(kh),Ev=n=>(n*=2)<1?.5*kh(n):.5*(2-Math.pow(2,-10*(n-1))),Oh=n=>1-Math.sin(Math.acos(n)),Av=_v(Oh),jv=xv(Oh),o_=Dr(.42,0,1,1),l_=Dr(0,0,.58,1),Cv=Dr(.42,0,.58,1),c_=n=>Array.isArray(n)&&typeof n[0]!="number",Rv=n=>Array.isArray(n)&&typeof n[0]=="number",u_={linear:sn,easeIn:o_,easeInOut:Cv,easeOut:l_,circIn:Oh,circInOut:jv,circOut:Av,backIn:kh,backInOut:Tv,backOut:Sv,anticipate:Ev},d_=n=>typeof n=="string",h0=n=>{if(Rv(n)){Ch(n.length===4);const[t,a,r,l]=n;return Dr(t,a,r,l)}else if(d_(n))return u_[n];return n},il=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function h_(n,t){let a=new Set,r=new Set,l=!1,c=!1;const d=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function m(g){d.has(g)&&(p.schedule(g),n()),g(f)}const p={schedule:(g,b=!1,w=!1)=>{const S=w&&l?a:r;return b&&d.add(g),S.has(g)||S.add(g),g},cancel:g=>{r.delete(g),d.delete(g)},process:g=>{if(f=g,l){c=!0;return}l=!0,[a,r]=[r,a],a.forEach(m),a.clear(),l=!1,c&&(c=!1,p.process(g))}};return p}const f_=40;function kv(n,t){let a=!1,r=!0;const l={delta:0,timestamp:0,isProcessing:!1},c=()=>a=!0,d=il.reduce((k,z)=>(k[z]=h_(c),k),{}),{setup:f,read:m,resolveKeyframes:p,preUpdate:g,update:b,preRender:w,render:_,postRender:S}=d,A=()=>{const k=Qn.useManualTiming?l.timestamp:performance.now();a=!1,Qn.useManualTiming||(l.delta=r?1e3/60:Math.max(Math.min(k-l.timestamp,f_),1)),l.timestamp=k,l.isProcessing=!0,f.process(l),m.process(l),p.process(l),g.process(l),b.process(l),w.process(l),_.process(l),S.process(l),l.isProcessing=!1,a&&t&&(r=!1,n(A))},E=()=>{a=!0,r=!0,l.isProcessing||n(A)};return{schedule:il.reduce((k,z)=>{const G=d[z];return k[z]=(Y,I=!1,X=!1)=>(a||E(),G.schedule(Y,I,X)),k},{}),cancel:k=>{for(let z=0;z(vl===void 0&&Et.set(bt.isProcessing||Qn.useManualTiming?bt.timestamp:performance.now()),vl),set:n=>{vl=n,queueMicrotask(m_)}},Ov=n=>t=>typeof t=="string"&&t.startsWith(n),Nv=Ov("--"),p_=Ov("var(--"),Nh=n=>p_(n)?g_.test(n.split("/*")[0].trim()):!1,g_=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function f0(n){return typeof n!="string"?!1:n.split("/*")[0].includes("var(--")}const us={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},_r={...us,transform:n=>Tn(0,1,n)},al={...us,default:1},pr=n=>Math.round(n*1e5)/1e5,Mh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function y_(n){return n==null}const v_=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Dh=(n,t)=>a=>!!(typeof a=="string"&&v_.test(a)&&a.startsWith(n)||t&&!y_(a)&&Object.prototype.hasOwnProperty.call(a,t)),Mv=(n,t,a)=>r=>{if(typeof r!="string")return r;const[l,c,d,f]=r.match(Mh);return{[n]:parseFloat(l),[t]:parseFloat(c),[a]:parseFloat(d),alpha:f!==void 0?parseFloat(f):1}},b_=n=>Tn(0,255,n),md={...us,transform:n=>Math.round(b_(n))},Wi={test:Dh("rgb","red"),parse:Mv("red","green","blue"),transform:({red:n,green:t,blue:a,alpha:r=1})=>"rgba("+md.transform(n)+", "+md.transform(t)+", "+md.transform(a)+", "+pr(_r.transform(r))+")"};function w_(n){let t="",a="",r="",l="";return n.length>5?(t=n.substring(1,3),a=n.substring(3,5),r=n.substring(5,7),l=n.substring(7,9)):(t=n.substring(1,2),a=n.substring(2,3),r=n.substring(3,4),l=n.substring(4,5),t+=t,a+=a,r+=r,l+=l),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:l?parseInt(l,16)/255:1}}const Vd={test:Dh("#"),parse:w_,transform:Wi.transform},Lr=n=>({test:t=>typeof t=="string"&&t.endsWith(n)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${n}`}),bi=Lr("deg"),Sn=Lr("%"),te=Lr("px"),x_=Lr("vh"),__=Lr("vw"),m0={...Sn,parse:n=>Sn.parse(n)/100,transform:n=>Sn.transform(n*100)},es={test:Dh("hsl","hue"),parse:Mv("hue","saturation","lightness"),transform:({hue:n,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(n)+", "+Sn.transform(pr(t))+", "+Sn.transform(pr(a))+", "+pr(_r.transform(r))+")"},it={test:n=>Wi.test(n)||Vd.test(n)||es.test(n),parse:n=>Wi.test(n)?Wi.parse(n):es.test(n)?es.parse(n):Vd.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?Wi.transform(n):es.transform(n),getAnimatableNone:n=>{const t=it.parse(n);return t.alpha=0,it.transform(t)}},S_=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function T_(n){return isNaN(n)&&typeof n=="string"&&(n.match(Mh)?.length||0)+(n.match(S_)?.length||0)>0}const Dv="number",Lv="color",E_="var",A_="var(",p0="${}",j_=/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 Sr(n){const t=n.toString(),a=[],r={color:[],number:[],var:[]},l=[];let c=0;const f=t.replace(j_,m=>(it.test(m)?(r.color.push(c),l.push(Lv),a.push(it.parse(m))):m.startsWith(A_)?(r.var.push(c),l.push(E_),a.push(m)):(r.number.push(c),l.push(Dv),a.push(parseFloat(m))),++c,p0)).split(p0);return{values:a,split:f,indexes:r,types:l}}function Uv(n){return Sr(n).values}function Bv(n){const{split:t,types:a}=Sr(n),r=t.length;return l=>{let c="";for(let d=0;dtypeof n=="number"?0:it.test(n)?it.getAnimatableNone(n):n;function R_(n){const t=Uv(n);return Bv(n)(t.map(C_))}const gn={test:T_,parse:Uv,createTransformer:Bv,getAnimatableNone:R_};function pd(n,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?n+(t-n)*6*a:a<1/2?t:a<2/3?n+(t-n)*(2/3-a)*6:n}function k_({hue:n,saturation:t,lightness:a,alpha:r}){n/=360,t/=100,a/=100;let l=0,c=0,d=0;if(!t)l=c=d=a;else{const f=a<.5?a*(1+t):a+t-a*t,m=2*a-f;l=pd(m,f,n+1/3),c=pd(m,f,n),d=pd(m,f,n-1/3)}return{red:Math.round(l*255),green:Math.round(c*255),blue:Math.round(d*255),alpha:r}}function jl(n,t){return a=>a>0?t:n}const Qe=(n,t,a)=>n+(t-n)*a,gd=(n,t,a)=>{const r=n*n,l=a*(t*t-r)+r;return l<0?0:Math.sqrt(l)},O_=[Vd,Wi,es],N_=n=>O_.find(t=>t.test(n));function g0(n){const t=N_(n);if(!t)return!1;let a=t.parse(n);return t===es&&(a=k_(a)),a}const y0=(n,t)=>{const a=g0(n),r=g0(t);if(!a||!r)return jl(n,t);const l={...a};return c=>(l.red=gd(a.red,r.red,c),l.green=gd(a.green,r.green,c),l.blue=gd(a.blue,r.blue,c),l.alpha=Qe(a.alpha,r.alpha,c),Wi.transform(l))},qd=new Set(["none","hidden"]);function M_(n,t){return qd.has(n)?a=>a<=0?n:t:a=>a>=1?t:n}function D_(n,t){return a=>Qe(n,t,a)}function Lh(n){return typeof n=="number"?D_:typeof n=="string"?Nh(n)?jl:it.test(n)?y0:B_:Array.isArray(n)?zv:typeof n=="object"?it.test(n)?y0:L_:jl}function zv(n,t){const a=[...n],r=a.length,l=n.map((c,d)=>Lh(c)(c,t[d]));return c=>{for(let d=0;d{for(const c in r)a[c]=r[c](l);return a}}function U_(n,t){const a=[],r={color:0,var:0,number:0};for(let l=0;l{const a=gn.createTransformer(t),r=Sr(n),l=Sr(t);return r.indexes.var.length===l.indexes.var.length&&r.indexes.color.length===l.indexes.color.length&&r.indexes.number.length>=l.indexes.number.length?qd.has(n)&&!l.values.length||qd.has(t)&&!r.values.length?M_(n,t):Mr(zv(U_(r,l),l.values),a):jl(n,t)};function Pv(n,t,a){return typeof n=="number"&&typeof t=="number"&&typeof a=="number"?Qe(n,t,a):Lh(n)(n,t)}const z_=n=>{const t=({timestamp:a})=>n(a);return{start:(a=!0)=>Pe.update(t,a),stop:()=>Si(t),now:()=>bt.isProcessing?bt.timestamp:Et.now()}},Vv=(n,t,a=10)=>{let r="";const l=Math.max(Math.round(t/a),2);for(let c=0;c=Cl?1/0:t}function P_(n,t=100,a){const r=a({...n,keyframes:[0,t]}),l=Math.min(Uh(r),Cl);return{type:"keyframes",ease:c=>r.next(l*c).value/t,duration:an(l)}}const V_=5;function qv(n,t,a){const r=Math.max(t-V_,0);return bv(a-n(r),t-r)}const Xe={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},yd=.001;function q_({duration:n=Xe.duration,bounce:t=Xe.bounce,velocity:a=Xe.velocity,mass:r=Xe.mass}){let l,c,d=1-t;d=Tn(Xe.minDamping,Xe.maxDamping,d),n=Tn(Xe.minDuration,Xe.maxDuration,an(n)),d<1?(l=p=>{const g=p*d,b=g*n,w=g-a,_=Hd(p,d),S=Math.exp(-b);return yd-w/_*S},c=p=>{const b=p*d*n,w=b*a+a,_=Math.pow(d,2)*Math.pow(p,2)*n,S=Math.exp(-b),A=Hd(Math.pow(p,2),d);return(-l(p)+yd>0?-1:1)*((w-_)*S)/A}):(l=p=>{const g=Math.exp(-p*n),b=(p-a)*n+1;return-yd+g*b},c=p=>{const g=Math.exp(-p*n),b=(a-p)*(n*n);return g*b});const f=5/n,m=G_(l,c,f);if(n=pn(n),isNaN(m))return{stiffness:Xe.stiffness,damping:Xe.damping,duration:n};{const p=Math.pow(m,2)*r;return{stiffness:p,damping:d*2*Math.sqrt(r*p),duration:n}}}const H_=12;function G_(n,t,a){let r=a;for(let l=1;ln[a]!==void 0)}function I_(n){let t={velocity:Xe.velocity,stiffness:Xe.stiffness,damping:Xe.damping,mass:Xe.mass,isResolvedFromDuration:!1,...n};if(!v0(n,Q_)&&v0(n,$_))if(n.visualDuration){const a=n.visualDuration,r=2*Math.PI/(a*1.2),l=r*r,c=2*Tn(.05,1,1-(n.bounce||0))*Math.sqrt(l);t={...t,mass:Xe.mass,stiffness:l,damping:c}}else{const a=q_(n);t={...t,...a,mass:Xe.mass},t.isResolvedFromDuration=!0}return t}function Rl(n=Xe.visualDuration,t=Xe.bounce){const a=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:t}:n;let{restSpeed:r,restDelta:l}=a;const c=a.keyframes[0],d=a.keyframes[a.keyframes.length-1],f={done:!1,value:c},{stiffness:m,damping:p,mass:g,duration:b,velocity:w,isResolvedFromDuration:_}=I_({...a,velocity:-an(a.velocity||0)}),S=w||0,A=p/(2*Math.sqrt(m*g)),E=d-c,j=an(Math.sqrt(m/g)),O=Math.abs(E)<5;r||(r=O?Xe.restSpeed.granular:Xe.restSpeed.default),l||(l=O?Xe.restDelta.granular:Xe.restDelta.default);let k;if(A<1){const G=Hd(j,A);k=Y=>{const I=Math.exp(-A*j*Y);return d-I*((S+A*j*E)/G*Math.sin(G*Y)+E*Math.cos(G*Y))}}else if(A===1)k=G=>d-Math.exp(-j*G)*(E+(S+j*E)*G);else{const G=j*Math.sqrt(A*A-1);k=Y=>{const I=Math.exp(-A*j*Y),X=Math.min(G*Y,300);return d-I*((S+A*j*E)*Math.sinh(X)+G*E*Math.cosh(X))/G}}const z={calculatedDuration:_&&b||null,next:G=>{const Y=k(G);if(_)f.done=G>=b;else{let I=G===0?S:0;A<1&&(I=G===0?pn(S):qv(k,G,Y));const X=Math.abs(I)<=r,ee=Math.abs(d-Y)<=l;f.done=X&&ee}return f.value=f.done?d:Y,f},toString:()=>{const G=Math.min(Uh(z),Cl),Y=Vv(I=>z.next(G*I).value,G,30);return G+"ms "+Y},toTransition:()=>{}};return z}Rl.applyToOptions=n=>{const t=P_(n,100,Rl);return n.ease=t.ease,n.duration=pn(t.duration),n.type="keyframes",n};function Gd({keyframes:n,velocity:t=0,power:a=.8,timeConstant:r=325,bounceDamping:l=10,bounceStiffness:c=500,modifyTarget:d,min:f,max:m,restDelta:p=.5,restSpeed:g}){const b=n[0],w={done:!1,value:b},_=X=>f!==void 0&&Xm,S=X=>f===void 0?m:m===void 0||Math.abs(f-X)-A*Math.exp(-X/r),k=X=>j+O(X),z=X=>{const ee=O(X),ve=k(X);w.done=Math.abs(ee)<=p,w.value=w.done?j:ve};let G,Y;const I=X=>{_(w.value)&&(G=X,Y=Rl({keyframes:[w.value,S(w.value)],velocity:qv(k,X,w.value),damping:l,stiffness:c,restDelta:p,restSpeed:g}))};return I(0),{calculatedDuration:null,next:X=>{let ee=!1;return!Y&&G===void 0&&(ee=!0,z(X),I(X)),G!==void 0&&X>=G?Y.next(X-G):(!ee&&z(X),w)}}}function Y_(n,t,a){const r=[],l=a||Qn.mix||Pv,c=n.length-1;for(let d=0;dt[0];if(c===2&&t[0]===t[1])return()=>t[1];const d=n[0]===n[1];n[0]>n[c-1]&&(n=[...n].reverse(),t=[...t].reverse());const f=Y_(t,r,l),m=f.length,p=g=>{if(d&&g1)for(;bp(Tn(n[0],n[c-1],g)):p}function X_(n,t){const a=n[n.length-1];for(let r=1;r<=t;r++){const l=xr(0,t,r);n.push(Qe(a,1,l))}}function F_(n){const t=[0];return X_(t,n.length-1),t}function J_(n,t){return n.map(a=>a*t)}function Z_(n,t){return n.map(()=>t||Cv).splice(0,n.length-1)}function gr({duration:n=300,keyframes:t,times:a,ease:r="easeInOut"}){const l=c_(r)?r.map(h0):h0(r),c={done:!1,value:t[0]},d=J_(a&&a.length===t.length?a:F_(t),n),f=K_(d,t,{ease:Array.isArray(l)?l:Z_(t,l)});return{calculatedDuration:n,next:m=>(c.value=f(m),c.done=m>=n,c)}}const W_=n=>n!==null;function Bh(n,{repeat:t,repeatType:a="loop"},r,l=1){const c=n.filter(W_),f=l<0||t&&a!=="loop"&&t%2===1?0:c.length-1;return!f||r===void 0?c[f]:r}const eS={decay:Gd,inertia:Gd,tween:gr,keyframes:gr,spring:Rl};function Hv(n){typeof n.type=="string"&&(n.type=eS[n.type])}class zh{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,a){return this.finished.then(t,a)}}const tS=n=>n/100;class Ph extends zh{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:a}=this.options;a&&a.updatedAt!==Et.now()&&this.tick(Et.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Hv(t);const{type:a=gr,repeat:r=0,repeatDelay:l=0,repeatType:c,velocity:d=0}=t;let{keyframes:f}=t;const m=a||gr;m!==gr&&typeof f[0]!="number"&&(this.mixKeyframes=Mr(tS,Pv(f[0],f[1])),f=[0,100]);const p=m({...t,keyframes:f});c==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...f].reverse(),velocity:-d})),p.calculatedDuration===null&&(p.calculatedDuration=Uh(p));const{calculatedDuration:g}=p;this.calculatedDuration=g,this.resolvedDuration=g+l,this.totalDuration=this.resolvedDuration*(r+1)-l,this.generator=p}updateTime(t){const a=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=a}tick(t,a=!1){const{generator:r,totalDuration:l,mixKeyframes:c,mirroredGenerator:d,resolvedDuration:f,calculatedDuration:m}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:g,repeat:b,repeatType:w,repeatDelay:_,type:S,onUpdate:A,finalKeyframe:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/this.speed,this.startTime)),a?this.currentTime=t:this.updateTime(t);const j=this.currentTime-p*(this.playbackSpeed>=0?1:-1),O=this.playbackSpeed>=0?j<0:j>l;this.currentTime=Math.max(j,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=l);let k=this.currentTime,z=r;if(b){const X=Math.min(this.currentTime,l)/f;let ee=Math.floor(X),ve=X%1;!ve&&X>=1&&(ve=1),ve===1&&ee--,ee=Math.min(ee,b+1),ee%2&&(w==="reverse"?(ve=1-ve,_&&(ve-=_/f)):w==="mirror"&&(z=d)),k=Tn(0,1,ve)*f}const G=O?{done:!1,value:g[0]}:z.next(k);c&&(G.value=c(G.value));let{done:Y}=G;!O&&m!==null&&(Y=this.playbackSpeed>=0?this.currentTime>=l:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&Y);return I&&S!==Gd&&(G.value=Bh(g,this.options,E,this.speed)),A&&A(G.value),I&&this.finish(),G}then(t,a){return this.finished.then(t,a)}get duration(){return an(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+an(t)}get time(){return an(this.currentTime)}set time(t){t=pn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Et.now());const a=this.playbackSpeed!==t;this.playbackSpeed=t,a&&(this.time=an(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=z_,startTime:a}=this.options;this.driver||(this.driver=t(l=>this.tick(l))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=a??r),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(Et.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(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function nS(n){for(let t=1;tn*180/Math.PI,$d=n=>{const t=ea(Math.atan2(n[1],n[0]));return Qd(t)},iS={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:n=>(Math.abs(n[0])+Math.abs(n[3]))/2,rotate:$d,rotateZ:$d,skewX:n=>ea(Math.atan(n[1])),skewY:n=>ea(Math.atan(n[2])),skew:n=>(Math.abs(n[1])+Math.abs(n[2]))/2},Qd=n=>(n=n%360,n<0&&(n+=360),n),b0=$d,w0=n=>Math.sqrt(n[0]*n[0]+n[1]*n[1]),x0=n=>Math.sqrt(n[4]*n[4]+n[5]*n[5]),aS={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:w0,scaleY:x0,scale:n=>(w0(n)+x0(n))/2,rotateX:n=>Qd(ea(Math.atan2(n[6],n[5]))),rotateY:n=>Qd(ea(Math.atan2(-n[2],n[0]))),rotateZ:b0,rotate:b0,skewX:n=>ea(Math.atan(n[4])),skewY:n=>ea(Math.atan(n[1])),skew:n=>(Math.abs(n[1])+Math.abs(n[4]))/2};function Id(n){return n.includes("scale")?1:0}function Yd(n,t){if(!n||n==="none")return Id(t);const a=n.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,l;if(a)r=aS,l=a;else{const f=n.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=iS,l=f}if(!l)return Id(t);const c=r[t],d=l[1].split(",").map(rS);return typeof c=="function"?c(d):d[c]}const sS=(n,t)=>{const{transform:a="none"}=getComputedStyle(n);return Yd(a,t)};function rS(n){return parseFloat(n.trim())}const ds=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],hs=new Set(ds),_0=n=>n===us||n===te,oS=new Set(["x","y","z"]),lS=ds.filter(n=>!oS.has(n));function cS(n){const t=[];return lS.forEach(a=>{const r=n.getValue(a);r!==void 0&&(t.push([a,r.get()]),r.set(a.startsWith("scale")?1:0))}),t}const _i={width:({x:n},{paddingLeft:t="0",paddingRight:a="0"})=>n.max-n.min-parseFloat(t)-parseFloat(a),height:({y:n},{paddingTop:t="0",paddingBottom:a="0"})=>n.max-n.min-parseFloat(t)-parseFloat(a),top:(n,{top:t})=>parseFloat(t),left:(n,{left:t})=>parseFloat(t),bottom:({y:n},{top:t})=>parseFloat(t)+(n.max-n.min),right:({x:n},{left:t})=>parseFloat(t)+(n.max-n.min),x:(n,{transform:t})=>Yd(t,"x"),y:(n,{transform:t})=>Yd(t,"y")};_i.translateX=_i.x;_i.translateY=_i.y;const na=new Set;let Kd=!1,Xd=!1,Fd=!1;function Gv(){if(Xd){const n=Array.from(na).filter(r=>r.needsMeasurement),t=new Set(n.map(r=>r.element)),a=new Map;t.forEach(r=>{const l=cS(r);l.length&&(a.set(r,l),r.render())}),n.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const l=a.get(r);l&&l.forEach(([c,d])=>{r.getValue(c)?.set(d)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Xd=!1,Kd=!1,na.forEach(n=>n.complete(Fd)),na.clear()}function $v(){na.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Xd=!0)})}function uS(){Fd=!0,$v(),Gv(),Fd=!1}class Vh{constructor(t,a,r,l,c,d=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=a,this.name=r,this.motionValue=l,this.element=c,this.isAsync=d}scheduleResolve(){this.state="scheduled",this.isAsync?(na.add(this),Kd||(Kd=!0,Pe.read($v),Pe.resolveKeyframes(Gv))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:a,element:r,motionValue:l}=this;if(t[0]===null){const c=l?.get(),d=t[t.length-1];if(c!==void 0)t[0]=c;else if(r&&a){const f=r.readValue(a,d);f!=null&&(t[0]=f)}t[0]===void 0&&(t[0]=d),l&&c===void 0&&l.set(t[0])}nS(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),na.delete(this)}cancel(){this.state==="scheduled"&&(na.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const dS=n=>n.startsWith("--");function hS(n,t,a){dS(t)?n.style.setProperty(t,a):n.style[t]=a}const fS={};function Qv(n,t){const a=vv(n);return()=>fS[t]??a()}const mS=Qv(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Iv=Qv(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),hr=([n,t,a,r])=>`cubic-bezier(${n}, ${t}, ${a}, ${r})`,S0={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:hr([0,.65,.55,1]),circOut:hr([.55,0,1,.45]),backIn:hr([.31,.01,.66,-.59]),backOut:hr([.33,1.53,.69,.99])};function Yv(n,t){if(n)return typeof n=="function"?Iv()?Vv(n,t):"ease-out":Rv(n)?hr(n):Array.isArray(n)?n.map(a=>Yv(a,t)||S0.easeOut):S0[n]}function pS(n,t,a,{delay:r=0,duration:l=300,repeat:c=0,repeatType:d="loop",ease:f="easeOut",times:m}={},p=void 0){const g={[t]:a};m&&(g.offset=m);const b=Yv(f,l);Array.isArray(b)&&(g.easing=b);const w={delay:r,duration:l,easing:Array.isArray(b)?"linear":b,fill:"both",iterations:c+1,direction:d==="reverse"?"alternate":"normal"};return p&&(w.pseudoElement=p),n.animate(g,w)}function Kv(n){return typeof n=="function"&&"applyToOptions"in n}function gS({type:n,...t}){return Kv(n)&&Iv()?n.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Xv extends zh{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:a,name:r,keyframes:l,pseudoElement:c,allowFlatten:d=!1,finalKeyframe:f,onComplete:m}=t;this.isPseudoElement=!!c,this.allowFlatten=d,this.options=t,Ch(typeof t.type!="string");const p=gS(t);this.animation=pS(a,r,l,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const g=Bh(l,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(g):hS(a,r,g),this.animation.cancel()}m?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,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:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return an(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+an(t)}get time(){return an(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=pn(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&mS()?(this.animation.timeline=t,sn):a(this)}}const Fv={anticipate:Ev,backInOut:Tv,circInOut:jv};function yS(n){return n in Fv}function vS(n){typeof n.ease=="string"&&yS(n.ease)&&(n.ease=Fv[n.ease])}const vd=10;class bS extends Xv{constructor(t){vS(t),Hv(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:a,onUpdate:r,onComplete:l,element:c,...d}=this.options;if(!a)return;if(t!==void 0){a.set(t);return}const f=new Ph({...d,autoplay:!1}),m=Math.max(vd,Et.now()-this.startTime),p=Tn(0,vd,m-vd);a.setWithVelocity(f.sample(Math.max(0,m-p)).value,f.sample(m).value,p),f.stop()}}const T0=(n,t)=>t==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(gn.test(n)||n==="0")&&!n.startsWith("url("));function wS(n){const t=n[0];if(n.length===1)return!0;for(let a=0;aObject.hasOwnProperty.call(Element.prototype,"animate"));function TS(n){const{motionValue:t,name:a,repeatDelay:r,repeatType:l,damping:c,type:d}=n;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:p}=t.owner.getProps();return SS()&&a&&_S.has(a)&&(a!=="transform"||!p)&&!m&&!r&&l!=="mirror"&&c!==0&&d!=="inertia"}const ES=40;class AS extends zh{constructor({autoplay:t=!0,delay:a=0,type:r="keyframes",repeat:l=0,repeatDelay:c=0,repeatType:d="loop",keyframes:f,name:m,motionValue:p,element:g,...b}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Et.now();const w={autoplay:t,delay:a,type:r,repeat:l,repeatDelay:c,repeatType:d,name:m,motionValue:p,element:g,...b},_=g?.KeyframeResolver||Vh;this.keyframeResolver=new _(f,(S,A,E)=>this.onKeyframesResolved(S,A,w,!E),m,p,g),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,a,r,l){this.keyframeResolver=void 0;const{name:c,type:d,velocity:f,delay:m,isHandoff:p,onUpdate:g}=r;this.resolvedAt=Et.now(),xS(t,c,d,f)||((Qn.instantAnimations||!m)&&g?.(Bh(t,r,a)),t[0]=t[t.length-1],Jd(r),r.repeat=0);const w={startTime:l?this.resolvedAt?this.resolvedAt-this.createdAt>ES?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:a,...r,keyframes:t},_=!p&&TS(w),S=w.motionValue?.owner?.current,A=_?new bS({...w,element:S}):new Ph(w);A.finished.then(()=>{this.notifyFinished()}).catch(sn),this.pendingTimeline&&(this.stopTimeline=A.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=A}get finished(){return this._animation?this.animation.finished:this._finished}then(t,a){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),uS()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Jv(n,t,a,r=0,l=1){const c=Array.from(n).sort((p,g)=>p.sortNodePosition(g)).indexOf(t),d=n.size,f=(d-1)*r;return typeof a=="function"?a(c,d):l===1?c*r:f-c*r}const jS=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function CS(n){const t=jS.exec(n);if(!t)return[,];const[,a,r,l]=t;return[`--${a??r}`,l]}function Zv(n,t,a=1){const[r,l]=CS(n);if(!r)return;const c=window.getComputedStyle(t).getPropertyValue(r);if(c){const d=c.trim();return pv(d)?parseFloat(d):d}return Nh(l)?Zv(l,t,a+1):l}const RS={type:"spring",stiffness:500,damping:25,restSpeed:10},kS=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),OS={type:"keyframes",duration:.8},NS={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},MS=(n,{keyframes:t})=>t.length>2?OS:hs.has(n)?n.startsWith("scale")?kS(t[1]):RS:NS,DS=n=>n!==null;function LS(n,{repeat:t,repeatType:a="loop"},r){const l=n.filter(DS),c=t&&a!=="loop"&&t%2===1?0:l.length-1;return l[c]}function Wv(n,t){if(n?.inherit&&t){const{inherit:a,...r}=n;return{...t,...r}}return n}function qh(n,t){const a=n?.[t]??n?.default??n;return a!==n?Wv(a,n):a}function US({when:n,delay:t,delayChildren:a,staggerChildren:r,staggerDirection:l,repeat:c,repeatType:d,repeatDelay:f,from:m,elapsed:p,...g}){return!!Object.keys(g).length}const Hh=(n,t,a,r={},l,c)=>d=>{const f=qh(r,n)||{},m=f.delay||r.delay||0;let{elapsed:p=0}=r;p=p-pn(m);const g={keyframes:Array.isArray(a)?a:[null,a],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-p,onUpdate:w=>{t.set(w),f.onUpdate&&f.onUpdate(w)},onComplete:()=>{d(),f.onComplete&&f.onComplete()},name:n,motionValue:t,element:c?void 0:l};US(f)||Object.assign(g,MS(n,g)),g.duration&&(g.duration=pn(g.duration)),g.repeatDelay&&(g.repeatDelay=pn(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let b=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(Jd(g),g.delay===0&&(b=!0)),(Qn.instantAnimations||Qn.skipAnimations||l?.shouldSkipAnimations)&&(b=!0,Jd(g),g.delay=0),g.allowFlatten=!f.type&&!f.ease,b&&!c&&t.get()!==void 0){const w=LS(g.keyframes,f);if(w!==void 0){Pe.update(()=>{g.onUpdate(w),g.onComplete()});return}}return f.isSync?new Ph(g):new AS(g)};function E0(n){const t=[{},{}];return n?.values.forEach((a,r)=>{t[0][r]=a.get(),t[1][r]=a.getVelocity()}),t}function Gh(n,t,a,r){if(typeof t=="function"){const[l,c]=E0(r);t=t(a!==void 0?a:n.custom,l,c)}if(typeof t=="string"&&(t=n.variants&&n.variants[t]),typeof t=="function"){const[l,c]=E0(r);t=t(a!==void 0?a:n.custom,l,c)}return t}function os(n,t,a){const r=n.getProps();return Gh(r,t,a!==void 0?a:r.custom,n)}const eb=new Set(["width","height","top","left","right","bottom",...ds]),A0=30,BS=n=>!isNaN(parseFloat(n));class zS{constructor(t,a={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const l=Et.now();if(this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const c of this.dependents)c.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=a.owner}setCurrent(t){this.current=t,this.updatedAt=Et.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=BS(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,a){this.events[t]||(this.events[t]=new Rh);const r=this.events[t].add(a);return t==="change"?()=>{r(),Pe.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,a){this.passiveEffect=t,this.stopPassiveEffect=a}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,a,r){this.set(a),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,a=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Et.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>A0)return 0;const a=Math.min(this.updatedAt-this.prevUpdatedAt,A0);return bv(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(t){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=t(a),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 cs(n,t){return new zS(n,t)}const Zd=n=>Array.isArray(n);function PS(n,t,a){n.hasValue(t)?n.getValue(t).set(a):n.addValue(t,cs(a))}function VS(n){return Zd(n)?n[n.length-1]||0:n}function qS(n,t){const a=os(n,t);let{transitionEnd:r={},transition:l={},...c}=a||{};c={...c,...r};for(const d in c){const f=VS(c[d]);PS(n,d,f)}}const xt=n=>!!(n&&n.getVelocity);function HS(n){return!!(xt(n)&&n.add)}function Wd(n,t){const a=n.getValue("willChange");if(HS(a))return a.add(t);if(!a&&Qn.WillChange){const r=new Qn.WillChange("auto");n.addValue("willChange",r),r.add(t)}}function $h(n){return n.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const GS="framerAppearId",tb="data-"+$h(GS);function nb(n){return n.props[tb]}function $S({protectedKeys:n,needsAnimating:t},a){const r=n.hasOwnProperty(a)&&t[a]!==!0;return t[a]=!1,r}function ib(n,t,{delay:a=0,transitionOverride:r,type:l}={}){let{transition:c,transitionEnd:d,...f}=t;const m=n.getDefaultTransition();c=c?Wv(c,m):m;const p=c?.reduceMotion;r&&(c=r);const g=[],b=l&&n.animationState&&n.animationState.getState()[l];for(const w in f){const _=n.getValue(w,n.latestValues[w]??null),S=f[w];if(S===void 0||b&&$S(b,w))continue;const A={delay:a,...qh(c||{},w)},E=_.get();if(E!==void 0&&!_.isAnimating&&!Array.isArray(S)&&S===E&&!A.velocity)continue;let j=!1;if(window.MotionHandoffAnimation){const z=nb(n);if(z){const G=window.MotionHandoffAnimation(z,w,Pe);G!==null&&(A.startTime=G,j=!0)}}Wd(n,w);const O=p??n.shouldReduceMotion;_.start(Hh(w,_,S,O&&eb.has(w)?{type:!1}:A,n,j));const k=_.animation;k&&g.push(k)}if(d){const w=()=>Pe.update(()=>{d&&qS(n,d)});g.length?Promise.all(g).then(w):w()}return g}function eh(n,t,a={}){const r=os(n,t,a.type==="exit"?n.presenceContext?.custom:void 0);let{transition:l=n.getDefaultTransition()||{}}=r||{};a.transitionOverride&&(l=a.transitionOverride);const c=r?()=>Promise.all(ib(n,r,a)):()=>Promise.resolve(),d=n.variantChildren&&n.variantChildren.size?(m=0)=>{const{delayChildren:p=0,staggerChildren:g,staggerDirection:b}=l;return QS(n,t,m,p,g,b,a)}:()=>Promise.resolve(),{when:f}=l;if(f){const[m,p]=f==="beforeChildren"?[c,d]:[d,c];return m().then(()=>p())}else return Promise.all([c(),d(a.delay)])}function QS(n,t,a=0,r=0,l=0,c=1,d){const f=[];for(const m of n.variantChildren)m.notify("AnimationStart",t),f.push(eh(m,t,{...d,delay:a+(typeof r=="function"?0:r)+Jv(n.variantChildren,m,r,l,c)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(f)}function IS(n,t,a={}){n.notify("AnimationStart",t);let r;if(Array.isArray(t)){const l=t.map(c=>eh(n,c,a));r=Promise.all(l)}else if(typeof t=="string")r=eh(n,t,a);else{const l=typeof t=="function"?os(n,t,a.custom):t;r=Promise.all(ib(n,l,a))}return r.then(()=>{n.notify("AnimationComplete",t)})}const YS={test:n=>n==="auto",parse:n=>n},ab=n=>t=>t.test(n),sb=[us,te,Sn,bi,__,x_,YS],j0=n=>sb.find(ab(n));function KS(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||yv(n):!0}const XS=new Set(["brightness","contrast","saturate","opacity"]);function FS(n){const[t,a]=n.slice(0,-1).split("(");if(t==="drop-shadow")return n;const[r]=a.match(Mh)||[];if(!r)return n;const l=a.replace(r,"");let c=XS.has(t)?1:0;return r!==a&&(c*=100),t+"("+c+l+")"}const JS=/\b([a-z-]*)\(.*?\)/gu,th={...gn,getAnimatableNone:n=>{const t=n.match(JS);return t?t.map(FS).join(" "):n}},nh={...gn,getAnimatableNone:n=>{const t=gn.parse(n);return gn.createTransformer(n)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},C0={...us,transform:Math.round},ZS={rotate:bi,rotateX:bi,rotateY:bi,rotateZ:bi,scale:al,scaleX:al,scaleY:al,scaleZ:al,skew:bi,skewX:bi,skewY:bi,distance:te,translateX:te,translateY:te,translateZ:te,x:te,y:te,z:te,perspective:te,transformPerspective:te,opacity:_r,originX:m0,originY:m0,originZ:te},Qh={borderWidth:te,borderTopWidth:te,borderRightWidth:te,borderBottomWidth:te,borderLeftWidth:te,borderRadius:te,borderTopLeftRadius:te,borderTopRightRadius:te,borderBottomRightRadius:te,borderBottomLeftRadius:te,width:te,maxWidth:te,height:te,maxHeight:te,top:te,right:te,bottom:te,left:te,inset:te,insetBlock:te,insetBlockStart:te,insetBlockEnd:te,insetInline:te,insetInlineStart:te,insetInlineEnd:te,padding:te,paddingTop:te,paddingRight:te,paddingBottom:te,paddingLeft:te,paddingBlock:te,paddingBlockStart:te,paddingBlockEnd:te,paddingInline:te,paddingInlineStart:te,paddingInlineEnd:te,margin:te,marginTop:te,marginRight:te,marginBottom:te,marginLeft:te,marginBlock:te,marginBlockStart:te,marginBlockEnd:te,marginInline:te,marginInlineStart:te,marginInlineEnd:te,fontSize:te,backgroundPositionX:te,backgroundPositionY:te,...ZS,zIndex:C0,fillOpacity:_r,strokeOpacity:_r,numOctaves:C0},WS={...Qh,color:it,backgroundColor:it,outlineColor:it,fill:it,stroke:it,borderColor:it,borderTopColor:it,borderRightColor:it,borderBottomColor:it,borderLeftColor:it,filter:th,WebkitFilter:th,mask:nh,WebkitMask:nh},rb=n=>WS[n],eT=new Set([th,nh]);function ob(n,t){let a=rb(n);return eT.has(a)||(a=gn),a.getAnimatableNone?a.getAnimatableNone(t):void 0}const tT=new Set(["auto","none","0"]);function nT(n,t,a){let r=0,l;for(;r{t.getValue(f).set(m)}),this.resolveNoneKeyframes()}}const aT=new Set(["opacity","clipPath","filter","transform"]);function Ih(n,t,a){if(n==null)return[];if(n instanceof EventTarget)return[n];if(typeof n=="string"){const l=document.querySelectorAll(n);return l?Array.from(l):[]}return Array.from(n).filter(r=>r!=null)}const lb=(n,t)=>t&&typeof n=="number"?t.transform(n):n;function ih(n){return gv(n)&&"offsetHeight"in n}const{schedule:Yh}=kv(queueMicrotask,!1),hn={x:!1,y:!1};function cb(){return hn.x||hn.y}function sT(n){return n==="x"||n==="y"?hn[n]?null:(hn[n]=!0,()=>{hn[n]=!1}):hn.x||hn.y?null:(hn.x=hn.y=!0,()=>{hn.x=hn.y=!1})}function ub(n,t){const a=Ih(n),r=new AbortController,l={passive:!0,...t,signal:r.signal};return[a,l,()=>r.abort()]}function rT(n){return!(n.pointerType==="touch"||cb())}function oT(n,t,a={}){const[r,l,c]=ub(n,a);return r.forEach(d=>{let f=!1,m=!1,p;const g=()=>{d.removeEventListener("pointerleave",S)},b=E=>{p&&(p(E),p=void 0),g()},w=E=>{f=!1,window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),m&&(m=!1,b(E))},_=()=>{f=!0,window.addEventListener("pointerup",w,l),window.addEventListener("pointercancel",w,l)},S=E=>{if(E.pointerType!=="touch"){if(f){m=!0;return}b(E)}},A=E=>{if(!rT(E))return;m=!1;const j=t(d,E);typeof j=="function"&&(p=j,d.addEventListener("pointerleave",S,l))};d.addEventListener("pointerenter",A,l),d.addEventListener("pointerdown",_,l)}),c}const db=(n,t)=>t?n===t?!0:db(n,t.parentElement):!1,Kh=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,lT=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function cT(n){return lT.has(n.tagName)||n.isContentEditable===!0}const uT=new Set(["INPUT","SELECT","TEXTAREA"]);function dT(n){return uT.has(n.tagName)||n.isContentEditable===!0}const bl=new WeakSet;function R0(n){return t=>{t.key==="Enter"&&n(t)}}function bd(n,t){n.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const hT=(n,t)=>{const a=n.currentTarget;if(!a)return;const r=R0(()=>{if(bl.has(a))return;bd(a,"down");const l=R0(()=>{bd(a,"up")}),c=()=>bd(a,"cancel");a.addEventListener("keyup",l,t),a.addEventListener("blur",c,t)});a.addEventListener("keydown",r,t),a.addEventListener("blur",()=>a.removeEventListener("keydown",r),t)};function k0(n){return Kh(n)&&!cb()}const O0=new WeakSet;function fT(n,t,a={}){const[r,l,c]=ub(n,a),d=f=>{const m=f.currentTarget;if(!k0(f)||O0.has(f))return;bl.add(m),a.stopPropagation&&O0.add(f);const p=t(m,f),g=(_,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",w),bl.has(m)&&bl.delete(m),k0(_)&&typeof p=="function"&&p(_,{success:S})},b=_=>{g(_,m===window||m===document||a.useGlobalTarget||db(m,_.target))},w=_=>{g(_,!1)};window.addEventListener("pointerup",b,l),window.addEventListener("pointercancel",w,l)};return r.forEach(f=>{(a.useGlobalTarget?window:f).addEventListener("pointerdown",d,l),ih(f)&&(f.addEventListener("focus",p=>hT(p,l)),!cT(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),c}function Xh(n){return gv(n)&&"ownerSVGElement"in n}const wl=new WeakMap;let xl;const hb=(n,t,a)=>(r,l)=>l&&l[0]?l[0][n+"Size"]:Xh(r)&&"getBBox"in r?r.getBBox()[t]:r[a],mT=hb("inline","width","offsetWidth"),pT=hb("block","height","offsetHeight");function gT({target:n,borderBoxSize:t}){wl.get(n)?.forEach(a=>{a(n,{get width(){return mT(n,t)},get height(){return pT(n,t)}})})}function yT(n){n.forEach(gT)}function vT(){typeof ResizeObserver>"u"||(xl=new ResizeObserver(yT))}function bT(n,t){xl||vT();const a=Ih(n);return a.forEach(r=>{let l=wl.get(r);l||(l=new Set,wl.set(r,l)),l.add(t),xl?.observe(r)}),()=>{a.forEach(r=>{const l=wl.get(r);l?.delete(t),l?.size||xl?.unobserve(r)})}}const _l=new Set;let ts;function wT(){ts=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};_l.forEach(t=>t(n))},window.addEventListener("resize",ts)}function xT(n){return _l.add(n),ts||wT(),()=>{_l.delete(n),!_l.size&&typeof ts=="function"&&(window.removeEventListener("resize",ts),ts=void 0)}}function N0(n,t){return typeof n=="function"?xT(n):bT(n,t)}function _T(n){return Xh(n)&&n.tagName==="svg"}const ST=[...sb,it,gn],TT=n=>ST.find(ab(n)),M0=()=>({translate:0,scale:1,origin:0,originPoint:0}),ns=()=>({x:M0(),y:M0()}),D0=()=>({min:0,max:0}),ot=()=>({x:D0(),y:D0()}),ET=new WeakMap;function Pl(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}function Tr(n){return typeof n=="string"||Array.isArray(n)}const Fh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Jh=["initial",...Fh];function Vl(n){return Pl(n.animate)||Jh.some(t=>Tr(n[t]))}function fb(n){return!!(Vl(n)||n.variants)}function AT(n,t,a){for(const r in t){const l=t[r],c=a[r];if(xt(l))n.addValue(r,l);else if(xt(c))n.addValue(r,cs(l,{owner:n}));else if(c!==l)if(n.hasValue(r)){const d=n.getValue(r);d.liveStyle===!0?d.jump(l):d.hasAnimated||d.set(l)}else{const d=n.getStaticValue(r);n.addValue(r,cs(d!==void 0?d:l,{owner:n}))}}for(const r in a)t[r]===void 0&&n.removeValue(r);return t}const ah={current:null},mb={current:!1},jT=typeof window<"u";function CT(){if(mb.current=!0,!!jT)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),t=()=>ah.current=n.matches;n.addEventListener("change",t),t()}else ah.current=!1}const L0=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let kl={};function pb(n){kl=n}function RT(){return kl}class kT{scrapeMotionValuesFromProps(t,a,r){return{}}constructor({parent:t,props:a,presenceContext:r,reducedMotionConfig:l,skipAnimations:c,blockInitialAnimation:d,visualState:f},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Vh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,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 _=Et.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Pe.render(this.render,!1,!0))};const{latestValues:p,renderState:g}=f;this.latestValues=p,this.baseTarget={...p},this.initialValues=a.initial?{...p}:{},this.renderState=g,this.parent=t,this.props=a,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=l,this.skipAnimationsConfig=c,this.options=m,this.blockInitialAnimation=!!d,this.isControllingVariants=Vl(a),this.isVariantNode=fb(a),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:b,...w}=this.scrapeMotionValuesFromProps(a,{},this);for(const _ in w){const S=w[_];p[_]!==void 0&&xt(S)&&S.set(p[_])}}mount(t){if(this.hasBeenMounted)for(const a in this.initialValues)this.values.get(a)?.jump(this.initialValues[a]),this.latestValues[a]=this.initialValues[a];this.current=t,ET.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,r)=>this.bindToMotionValue(r,a)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(mb.current||CT(),this.shouldReduceMotion=ah.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Si(this.notifyUpdate),Si(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const a=this.features[t];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,a){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),a.accelerate&&aT.has(t)&&this.current instanceof HTMLElement){const{factory:d,keyframes:f,times:m,ease:p,duration:g}=a.accelerate,b=new Xv({element:this.current,name:t,keyframes:f,times:m,ease:p,duration:pn(g)}),w=d(b);this.valueSubscriptions.set(t,()=>{w(),b.cancel()});return}const r=hs.has(t);r&&this.onBindTransform&&this.onBindTransform();const l=a.on("change",d=>{this.latestValues[t]=d,this.props.onUpdate&&Pe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let c;typeof window<"u"&&window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,t,a)),this.valueSubscriptions.set(t,()=>{l(),c&&c(),a.owner&&a.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in kl){const a=kl[t];if(!a)continue;const{isEnabled:r,Feature:l}=a;if(!this.features[t]&&l&&r(this.props)&&(this.features[t]=new l(this)),this.features[t]){const c=this.features[t];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ot()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,a){this.latestValues[t]=a}update(t,a){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=a;for(let r=0;ra.variantChildren.delete(t)}addValue(t,a){const r=this.values.get(t);a!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,a),this.values.set(t,a),this.latestValues[t]=a.get())}removeValue(t){this.values.delete(t);const a=this.valueSubscriptions.get(t);a&&(a(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,a){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&a!==void 0&&(r=cs(a===null?void 0:a,{owner:this}),this.addValue(t,r)),r}readValue(t,a){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(pv(r)||yv(r))?r=parseFloat(r):!TT(r)&&gn.test(a)&&(r=ob(t,a)),this.setBaseTarget(t,xt(r)?r.get():r)),xt(r)?r.get():r}setBaseTarget(t,a){this.baseTarget[t]=a}getBaseTarget(t){const{initial:a}=this.props;let r;if(typeof a=="string"||typeof a=="object"){const c=Gh(this.props,a,this.presenceContext?.custom);c&&(r=c[t])}if(a&&r!==void 0)return r;const l=this.getBaseTargetFromProps(this.props,t);return l!==void 0&&!xt(l)?l:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,a){return this.events[t]||(this.events[t]=new Rh),this.events[t].add(a)}notify(t,...a){this.events[t]&&this.events[t].notify(...a)}scheduleRenderMicrotask(){Yh.render(this.render)}}class gb extends kT{constructor(){super(...arguments),this.KeyframeResolver=iT}sortInstanceNodePosition(t,a){return t.compareDocumentPosition(a)&2?1:-1}getBaseTargetFromProps(t,a){const r=t.style;return r?r[a]:void 0}removeValueFromRenderState(t,{vars:a,style:r}){delete a[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;xt(t)&&(this.childSubscription=t.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}}class Ti{constructor(t){this.isMounted=!1,this.node=t}update(){}}function yb({top:n,left:t,right:a,bottom:r}){return{x:{min:t,max:a},y:{min:n,max:r}}}function OT({x:n,y:t}){return{top:t.min,right:n.max,bottom:t.max,left:n.min}}function NT(n,t){if(!t)return n;const a=t({x:n.left,y:n.top}),r=t({x:n.right,y:n.bottom});return{top:a.y,left:a.x,bottom:r.y,right:r.x}}function wd(n){return n===void 0||n===1}function sh({scale:n,scaleX:t,scaleY:a}){return!wd(n)||!wd(t)||!wd(a)}function Xi(n){return sh(n)||vb(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function vb(n){return U0(n.x)||U0(n.y)}function U0(n){return n&&n!=="0%"}function Ol(n,t,a){const r=n-a,l=t*r;return a+l}function B0(n,t,a,r,l){return l!==void 0&&(n=Ol(n,l,r)),Ol(n,a,r)+t}function rh(n,t=0,a=1,r,l){n.min=B0(n.min,t,a,r,l),n.max=B0(n.max,t,a,r,l)}function bb(n,{x:t,y:a}){rh(n.x,t.translate,t.scale,t.originPoint),rh(n.y,a.translate,a.scale,a.originPoint)}const z0=.999999999999,P0=1.0000000000001;function MT(n,t,a,r=!1){const l=a.length;if(!l)return;t.x=t.y=1;let c,d;for(let f=0;fz0&&(t.x=1),t.yz0&&(t.y=1)}function is(n,t){n.min=n.min+t,n.max=n.max+t}function V0(n,t,a,r,l=.5){const c=Qe(n.min,n.max,l);rh(n,t,a,c,r)}function as(n,t){V0(n.x,t.x,t.scaleX,t.scale,t.originX),V0(n.y,t.y,t.scaleY,t.scale,t.originY)}function wb(n,t){return yb(NT(n.getBoundingClientRect(),t))}function DT(n,t,a){const r=wb(n,a),{scroll:l}=t;return l&&(is(r.x,l.offset.x),is(r.y,l.offset.y)),r}const LT={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},UT=ds.length;function BT(n,t,a){let r="",l=!0;for(let c=0;c{if(!t.target)return n;if(typeof n=="string")if(te.test(n))n=parseFloat(n);else return n;const a=q0(n,t.target.x),r=q0(n,t.target.y);return`${a}% ${r}%`}},zT={correct:(n,{treeScale:t,projectionDelta:a})=>{const r=n,l=gn.parse(n);if(l.length>5)return r;const c=gn.createTransformer(n),d=typeof l[0]!="number"?1:0,f=a.x.scale*t.x,m=a.y.scale*t.y;l[0+d]/=f,l[1+d]/=m;const p=Qe(f,m,.5);return typeof l[2+d]=="number"&&(l[2+d]/=p),typeof l[3+d]=="number"&&(l[3+d]/=p),c(l)}},oh={borderRadius:{...ur,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ur,borderTopRightRadius:ur,borderBottomLeftRadius:ur,borderBottomRightRadius:ur,boxShadow:zT};function _b(n,{layout:t,layoutId:a}){return hs.has(n)||n.startsWith("origin")||(t||a!==void 0)&&(!!oh[n]||n==="opacity")}function Wh(n,t,a){const r=n.style,l=t?.style,c={};if(!r)return c;for(const d in r)(xt(r[d])||l&&xt(l[d])||_b(d,n)||a?.getValue(d)?.liveStyle!==void 0)&&(c[d]=r[d]);return c}function PT(n){return window.getComputedStyle(n)}class VT extends gb{constructor(){super(...arguments),this.type="html",this.renderInstance=xb}readValueFromInstance(t,a){if(hs.has(a))return this.projection?.isProjecting?Id(a):sS(t,a);{const r=PT(t),l=(Nv(a)?r.getPropertyValue(a):r[a])||0;return typeof l=="string"?l.trim():l}}measureInstanceViewportBox(t,{transformPagePoint:a}){return wb(t,a)}build(t,a,r){Zh(t,a,r.transformTemplate)}scrapeMotionValuesFromProps(t,a,r){return Wh(t,a,r)}}const qT={offset:"stroke-dashoffset",array:"stroke-dasharray"},HT={offset:"strokeDashoffset",array:"strokeDasharray"};function GT(n,t,a=1,r=0,l=!0){n.pathLength=1;const c=l?qT:HT;n[c.offset]=`${-r}`,n[c.array]=`${t} ${a}`}const $T=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Sb(n,{attrX:t,attrY:a,attrScale:r,pathLength:l,pathSpacing:c=1,pathOffset:d=0,...f},m,p,g){if(Zh(n,f,p),m){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:b,style:w}=n;b.transform&&(w.transform=b.transform,delete b.transform),(w.transform||b.transformOrigin)&&(w.transformOrigin=b.transformOrigin??"50% 50%",delete b.transformOrigin),w.transform&&(w.transformBox=g?.transformBox??"fill-box",delete b.transformBox);for(const _ of $T)b[_]!==void 0&&(w[_]=b[_],delete b[_]);t!==void 0&&(b.x=t),a!==void 0&&(b.y=a),r!==void 0&&(b.scale=r),l!==void 0&>(b,l,c,d,!1)}const Tb=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"]),Eb=n=>typeof n=="string"&&n.toLowerCase()==="svg";function QT(n,t,a,r){xb(n,t,void 0,r);for(const l in t.attrs)n.setAttribute(Tb.has(l)?l:$h(l),t.attrs[l])}function Ab(n,t,a){const r=Wh(n,t,a);for(const l in n)if(xt(n[l])||xt(t[l])){const c=ds.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;r[c]=n[l]}return r}class IT extends gb{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ot}getBaseTargetFromProps(t,a){return t[a]}readValueFromInstance(t,a){if(hs.has(a)){const r=rb(a);return r&&r.default||0}return a=Tb.has(a)?a:$h(a),t.getAttribute(a)}scrapeMotionValuesFromProps(t,a,r){return Ab(t,a,r)}build(t,a,r){Sb(t,a,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,a,r,l){QT(t,a,r,l)}mount(t){this.isSVGTag=Eb(t.tagName),super.mount(t)}}const YT=Jh.length;function jb(n){if(!n)return;if(!n.isControllingVariants){const a=n.parent?jb(n.parent)||{}:{};return n.props.initial!==void 0&&(a.initial=n.props.initial),a}const t={};for(let a=0;aPromise.all(t.map(({animation:a,options:r})=>IS(n,a,r)))}function JT(n){let t=FT(n),a=H0(),r=!0;const l=m=>(p,g)=>{const b=os(n,g,m==="exit"?n.presenceContext?.custom:void 0);if(b){const{transition:w,transitionEnd:_,...S}=b;p={...p,...S,..._}}return p};function c(m){t=m(n)}function d(m){const{props:p}=n,g=jb(n.parent)||{},b=[],w=new Set;let _={},S=1/0;for(let E=0;ES&&z,ee=!1;const ve=Array.isArray(k)?k:[k];let Re=ve.reduce(l(j),{});G===!1&&(Re={});const{prevResolvedValues:Ae={}}=O,ae={...Ae,...Re},re=V=>{X=!0,w.has(V)&&(ee=!0,w.delete(V)),O.needsAnimating[V]=!0;const J=n.getValue(V);J&&(J.liveStyle=!1)};for(const V in ae){const J=Re[V],he=Ae[V];if(_.hasOwnProperty(V))continue;let fe=!1;Zd(J)&&Zd(he)?fe=!Cb(J,he):fe=J!==he,fe?J!=null?re(V):w.add(V):J!==void 0&&w.has(V)?re(V):O.protectedKeys[V]=!0}O.prevProp=k,O.prevResolvedValues=Re,O.isActive&&(_={..._,...Re}),r&&n.blockInitialAnimation&&(X=!1);const se=Y&&I;X&&(!se||ee)&&b.push(...ve.map(V=>{const J={type:j};if(typeof V=="string"&&r&&!se&&n.manuallyAnimateOnMount&&n.parent){const{parent:he}=n,fe=os(he,V);if(he.enteringChildren&&fe){const{delayChildren:C}=fe.transition||{};J.delay=Jv(he.enteringChildren,n,C)}}return{animation:V,options:J}}))}if(w.size){const E={};if(typeof p.initial!="boolean"){const j=os(n,Array.isArray(p.initial)?p.initial[0]:p.initial);j&&j.transition&&(E.transition=j.transition)}w.forEach(j=>{const O=n.getBaseTarget(j),k=n.getValue(j);k&&(k.liveStyle=!0),E[j]=O??null}),b.push({animation:E})}let A=!!b.length;return r&&(p.initial===!1||p.initial===p.animate)&&!n.manuallyAnimateOnMount&&(A=!1),r=!1,A?t(b):Promise.resolve()}function f(m,p){if(a[m].isActive===p)return Promise.resolve();n.variantChildren?.forEach(b=>b.animationState?.setActive(m,p)),a[m].isActive=p;const g=d(m);for(const b in a)a[b].protectedKeys={};return g}return{animateChanges:d,setActive:f,setAnimateFunction:c,getState:()=>a,reset:()=>{a=H0()}}}function ZT(n,t){return typeof t=="string"?t!==n:Array.isArray(t)?!Cb(t,n):!1}function Qi(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function H0(){return{animate:Qi(!0),whileInView:Qi(),whileHover:Qi(),whileTap:Qi(),whileDrag:Qi(),whileFocus:Qi(),exit:Qi()}}function G0(n,t){n.min=t.min,n.max=t.max}function un(n,t){G0(n.x,t.x),G0(n.y,t.y)}function $0(n,t){n.translate=t.translate,n.scale=t.scale,n.originPoint=t.originPoint,n.origin=t.origin}const Rb=1e-4,WT=1-Rb,eE=1+Rb,kb=.01,tE=0-kb,nE=0+kb;function At(n){return n.max-n.min}function iE(n,t,a){return Math.abs(n-t)<=a}function Q0(n,t,a,r=.5){n.origin=r,n.originPoint=Qe(t.min,t.max,n.origin),n.scale=At(a)/At(t),n.translate=Qe(a.min,a.max,n.origin)-n.originPoint,(n.scale>=WT&&n.scale<=eE||isNaN(n.scale))&&(n.scale=1),(n.translate>=tE&&n.translate<=nE||isNaN(n.translate))&&(n.translate=0)}function yr(n,t,a,r){Q0(n.x,t.x,a.x,r?r.originX:void 0),Q0(n.y,t.y,a.y,r?r.originY:void 0)}function I0(n,t,a){n.min=a.min+t.min,n.max=n.min+At(t)}function aE(n,t,a){I0(n.x,t.x,a.x),I0(n.y,t.y,a.y)}function Y0(n,t,a){n.min=t.min-a.min,n.max=n.min+At(t)}function Nl(n,t,a){Y0(n.x,t.x,a.x),Y0(n.y,t.y,a.y)}function K0(n,t,a,r,l){return n-=t,n=Ol(n,1/a,r),l!==void 0&&(n=Ol(n,1/l,r)),n}function sE(n,t=0,a=1,r=.5,l,c=n,d=n){if(Sn.test(t)&&(t=parseFloat(t),t=Qe(d.min,d.max,t/100)-d.min),typeof t!="number")return;let f=Qe(c.min,c.max,r);n===c&&(f-=t),n.min=K0(n.min,t,a,f,l),n.max=K0(n.max,t,a,f,l)}function X0(n,t,[a,r,l],c,d){sE(n,t[a],t[r],t[l],t.scale,c,d)}const rE=["x","scaleX","originX"],oE=["y","scaleY","originY"];function F0(n,t,a,r){X0(n.x,t,rE,a?a.x:void 0,r?r.x:void 0),X0(n.y,t,oE,a?a.y:void 0,r?r.y:void 0)}function J0(n){return n.translate===0&&n.scale===1}function Ob(n){return J0(n.x)&&J0(n.y)}function Z0(n,t){return n.min===t.min&&n.max===t.max}function lE(n,t){return Z0(n.x,t.x)&&Z0(n.y,t.y)}function W0(n,t){return Math.round(n.min)===Math.round(t.min)&&Math.round(n.max)===Math.round(t.max)}function Nb(n,t){return W0(n.x,t.x)&&W0(n.y,t.y)}function ey(n){return At(n.x)/At(n.y)}function ty(n,t){return n.translate===t.translate&&n.scale===t.scale&&n.originPoint===t.originPoint}function _n(n){return[n("x"),n("y")]}function cE(n,t,a){let r="";const l=n.x.translate/t.x,c=n.y.translate/t.y,d=a?.z||0;if((l||c||d)&&(r=`translate3d(${l}px, ${c}px, ${d}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),a){const{transformPerspective:p,rotate:g,rotateX:b,rotateY:w,skewX:_,skewY:S}=a;p&&(r=`perspective(${p}px) ${r}`),g&&(r+=`rotate(${g}deg) `),b&&(r+=`rotateX(${b}deg) `),w&&(r+=`rotateY(${w}deg) `),_&&(r+=`skewX(${_}deg) `),S&&(r+=`skewY(${S}deg) `)}const f=n.x.scale*t.x,m=n.y.scale*t.y;return(f!==1||m!==1)&&(r+=`scale(${f}, ${m})`),r||"none"}const Mb=["TopLeft","TopRight","BottomLeft","BottomRight"],uE=Mb.length,ny=n=>typeof n=="string"?parseFloat(n):n,iy=n=>typeof n=="number"||te.test(n);function dE(n,t,a,r,l,c){l?(n.opacity=Qe(0,a.opacity??1,hE(r)),n.opacityExit=Qe(t.opacity??1,0,fE(r))):c&&(n.opacity=Qe(t.opacity??1,a.opacity??1,r));for(let d=0;drt?1:a(xr(n,t,r))}function mE(n,t,a){const r=xt(n)?n:cs(n);return r.start(Hh("",r,t,a)),r.animation}function Er(n,t,a,r={passive:!0}){return n.addEventListener(t,a,r),()=>n.removeEventListener(t,a)}const pE=(n,t)=>n.depth-t.depth;class gE{constructor(){this.children=[],this.isDirty=!1}add(t){jh(this.children,t),this.isDirty=!0}remove(t){Al(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(pE),this.isDirty=!1,this.children.forEach(t)}}function yE(n,t){const a=Et.now(),r=({timestamp:l})=>{const c=l-a;c>=t&&(Si(r),n(c-t))};return Pe.setup(r,!0),()=>Si(r)}function Sl(n){return xt(n)?n.get():n}class vE{constructor(){this.members=[]}add(t){jh(this.members,t);for(let a=this.members.length-1;a>=0;a--){const r=this.members[a];if(r===t||r===this.lead||r===this.prevLead)continue;const l=r.instance;l&&l.isConnected===!1&&r.isPresent!==!1&&!r.snapshot&&Al(this.members,r)}t.scheduleRender()}remove(t){if(Al(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(t){const a=this.members.findIndex(l=>t===l);if(a===0)return!1;let r;for(let l=a;l>=0;l--){const c=this.members[l],d=c.instance;if(c.isPresent!==!1&&(!d||d.isConnected!==!1)){r=c;break}}return r?(this.promote(r),!0):!1}promote(t,a){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender();const l=r.options.layoutDependency,c=t.options.layoutDependency;if(!(l!==void 0&&c!==void 0&&l===c)){const m=r.instance;m&&m.isConnected===!1&&!r.snapshot||(t.resumeFrom=r,a&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0))}const{crossfade:f}=t.options;f===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:a,resumingFrom:r}=t;a.onExitComplete&&a.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Tl={hasAnimatedSinceResize:!0,hasEverUpdated:!1},xd=["","X","Y","Z"],bE=1e3;let wE=0;function _d(n,t,a,r){const{latestValues:l}=t;l[n]&&(a[n]=l[n],t.setStaticValue(n,0),r&&(r[n]=0))}function Lb(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:t}=n.options;if(!t)return;const a=nb(t);if(window.MotionHasOptimisedAnimation(a,"transform")){const{layout:l,layoutId:c}=n.options;window.MotionCancelOptimisedAnimation(a,"transform",Pe,!(l||c))}const{parent:r}=n;r&&!r.hasCheckedOptimisedAppear&&Lb(r)}function Ub({attachResizeListener:n,defaultParent:t,measureScroll:a,checkIsScrollRoot:r,resetTransform:l}){return class{constructor(d={},f=t?.()){this.id=wE++,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.layoutVersion=0,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(SE),this.nodes.forEach(jE),this.nodes.forEach(CE),this.nodes.forEach(TE)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let m=0;mthis.root.updateBlockedByResize=!1;Pe.read(()=>{b=window.innerWidth}),n(d,()=>{const _=window.innerWidth;_!==b&&(b=_,this.root.updateBlockedByResize=!0,g&&g(),g=yE(w,250),Tl.hasAnimatedSinceResize&&(Tl.hasAnimatedSinceResize=!1,this.nodes.forEach(oy)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&p&&(f||m)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:b,hasRelativeLayoutChanged:w,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||p.getDefaultTransition()||ME,{onLayoutAnimationStart:A,onLayoutAnimationComplete:E}=p.getProps(),j=!this.targetLayout||!Nb(this.targetLayout,_),O=!b&&w;if(this.options.layoutRoot||this.resumeFrom||O||b&&(j||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...qh(S,"layout"),onPlay:A,onComplete:E};(p.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(g,O)}else b||oy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Si(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(RE),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Lb(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!At(this.snapshot.measuredBox.x)&&!At(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 m=0;m{const G=z/1e3;ly(b.x,d.x,G),ly(b.y,d.y,G),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Nl(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox),OE(this.relativeTarget,this.relativeTargetOrigin,w,G),k&&lE(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=ot()),un(k,this.relativeTarget)),A&&(this.animationValues=g,dE(g,p,this.latestValues,G,O,j)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=G},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Si(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Pe.update(()=>{Tl.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=cs(0)),this.currentAnimation=mE(this.motionValue,[0,1e3],{...d,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),d.onUpdate&&d.onUpdate(f)},onStop:()=>{},onComplete:()=>{d.onComplete&&d.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 d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bE),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:f,target:m,layout:p,latestValues:g}=d;if(!(!f||!m||!p)){if(this!==d&&this.layout&&p&&Bb(this.options.animationType,this.layout.layoutBox,p.layoutBox)){m=this.target||ot();const b=At(this.layout.layoutBox.x);m.x.min=d.target.x.min,m.x.max=m.x.min+b;const w=At(this.layout.layoutBox.y);m.y.min=d.target.y.min,m.y.max=m.y.min+w}un(f,m),as(f,g),yr(this.projectionDeltaWithTransform,this.layoutCorrected,f,g)}}registerSharedNode(d,f){this.sharedNodes.has(d)||this.sharedNodes.set(d,new vE),this.sharedNodes.get(d).add(f);const p=f.options.initialPromotionConfig;f.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(f):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){const{layoutId:d}=this.options;return d?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:d}=this.options;return d?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:f,preserveFollowOpacity:m}={}){const p=this.getStack();p&&p.promote(this,m),d&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let f=!1;const{latestValues:m}=d;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const p={};m.z&&_d("z",d,p,this.animationValues);for(let g=0;gd.currentAnimation?.stop()),this.root.nodes.forEach(sy),this.root.sharedNodes.clear()}}}function xE(n){n.updateLayout()}function _E(n){const t=n.resumeFrom?.snapshot||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:r}=n.layout,{animationType:l}=n.options,c=t.source!==n.layout.source;l==="size"?_n(g=>{const b=c?t.measuredBox[g]:t.layoutBox[g],w=At(b);b.min=a[g].min,b.max=b.min+w}):Bb(l,t.layoutBox,a)&&_n(g=>{const b=c?t.measuredBox[g]:t.layoutBox[g],w=At(a[g]);b.max=b.min+w,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[g].max=n.relativeTarget[g].min+w)});const d=ns();yr(d,a,t.layoutBox);const f=ns();c?yr(f,n.applyTransform(r,!0),t.measuredBox):yr(f,a,t.layoutBox);const m=!Ob(d);let p=!1;if(!n.resumeFrom){const g=n.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:b,layout:w}=g;if(b&&w){const _=ot();Nl(_,t.layoutBox,b.layoutBox);const S=ot();Nl(S,a,w.layoutBox),Nb(_,S)||(p=!0),g.options.layoutRoot&&(n.relativeTarget=S,n.relativeTargetOrigin=_,n.relativeParent=g)}}}n.notifyListeners("didUpdate",{layout:a,snapshot:t,delta:f,layoutDelta:d,hasLayoutChanged:m,hasRelativeLayoutChanged:p})}else if(n.isLead()){const{onExitComplete:a}=n.options;a&&a()}n.options.transition=void 0}function SE(n){n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function TE(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function EE(n){n.clearSnapshot()}function sy(n){n.clearMeasurements()}function ry(n){n.isLayoutDirty=!1}function AE(n){const{visualElement:t}=n.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),n.resetTransform()}function oy(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function jE(n){n.resolveTargetDelta()}function CE(n){n.calcProjection()}function RE(n){n.resetSkewAndRotation()}function kE(n){n.removeLeadSnapshot()}function ly(n,t,a){n.translate=Qe(t.translate,0,a),n.scale=Qe(t.scale,1,a),n.origin=t.origin,n.originPoint=t.originPoint}function cy(n,t,a,r){n.min=Qe(t.min,a.min,r),n.max=Qe(t.max,a.max,r)}function OE(n,t,a,r){cy(n.x,t.x,a.x,r),cy(n.y,t.y,a.y,r)}function NE(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const ME={duration:.45,ease:[.4,0,.1,1]},uy=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),dy=uy("applewebkit/")&&!uy("chrome/")?Math.round:sn;function hy(n){n.min=dy(n.min),n.max=dy(n.max)}function DE(n){hy(n.x),hy(n.y)}function Bb(n,t,a){return n==="position"||n==="preserve-aspect"&&!iE(ey(t),ey(a),.2)}function LE(n){return n!==n.root&&n.scroll?.wasRoot}const UE=Ub({attachResizeListener:(n,t)=>Er(n,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Sd={current:void 0},zb=Ub({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!Sd.current){const n=new UE({});n.mount(window),n.setOptions({layoutScroll:!0}),Sd.current=n}return Sd.current},resetTransform:(n,t)=>{n.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),ef=M.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function fy(n,t){if(typeof n=="function")return n(t);n!=null&&(n.current=t)}function BE(...n){return t=>{let a=!1;const r=n.map(l=>{const c=fy(l,t);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let l=0;l{const{width:w,height:_,top:S,left:A,right:E,bottom:j}=m.current;if(t||c===!1||!f.current||!w||!_)return;const O=a==="left"?`left: ${A}`:`right: ${E}`,k=r==="bottom"?`bottom: ${j}`:`top: ${S}`;f.current.dataset.motionPopId=d;const z=document.createElement("style");p&&(z.nonce=p);const G=l??document.head;return G.appendChild(z),z.sheet&&z.sheet.insertRule(` [data-motion-pop-id="${d}"] { position: absolute !important; width: ${w}px !important; height: ${_}px !important; ${O}px !important; ${k}px !important; } `),()=>{G.contains(z)&&G.removeChild(z)}},[t]),v.jsx(PE,{isPresent:t,childRef:f,sizeRef:m,pop:c,children:c===!1?n:M.cloneElement(n,{ref:b})})}const qE=({children:n,initial:t,isPresent:a,onExitComplete:r,custom:l,presenceAffectsLayout:c,mode:d,anchorX:f,anchorY:m,root:p})=>{const g=Ah(HE),b=M.useId();let w=!0,_=M.useMemo(()=>(w=!1,{id:b,initial:t,isPresent:a,custom:l,onExitComplete:S=>{g.set(S,!0);for(const A of g.values())if(!A)return;r&&r()},register:S=>(g.set(S,!1),()=>g.delete(S))}),[a,g,r]);return c&&w&&(_={..._}),M.useMemo(()=>{g.forEach((S,A)=>g.set(A,!1))},[a]),M.useEffect(()=>{!a&&!g.size&&r&&r()},[a]),n=v.jsx(VE,{pop:d==="popLayout",isPresent:a,anchorX:f,anchorY:m,root:p,children:n}),v.jsx(zl.Provider,{value:_,children:n})};function HE(){return new Map}function Pb(n=!0){const t=M.useContext(zl);if(t===null)return[!0,null];const{isPresent:a,onExitComplete:r,register:l}=t,c=M.useId();M.useEffect(()=>{if(n)return l(c)},[n]);const d=M.useCallback(()=>n&&r&&r(c),[c,r,n]);return!a&&r?[!1,d]:[!0]}const sl=n=>n.key||"";function my(n){const t=[];return M.Children.forEach(n,a=>{M.isValidElement(a)&&t.push(a)}),t}const fr=({children:n,custom:t,initial:a=!0,onExitComplete:r,presenceAffectsLayout:l=!0,mode:c="sync",propagate:d=!1,anchorX:f="left",anchorY:m="top",root:p})=>{const[g,b]=Pb(d),w=M.useMemo(()=>my(n),[n]),_=d&&!g?[]:w.map(sl),S=M.useRef(!0),A=M.useRef(w),E=Ah(()=>new Map),j=M.useRef(new Set),[O,k]=M.useState(w),[z,G]=M.useState(w);mv(()=>{S.current=!1,A.current=w;for(let X=0;X{const ee=sl(X),ve=d&&!g?!1:w===z||_.includes(ee),Re=()=>{if(j.current.has(ee))return;if(j.current.add(ee),E.has(ee))E.set(ee,!0);else return;let Ae=!0;E.forEach(ae=>{ae||(Ae=!1)}),Ae&&(I?.(),G(A.current),d&&b?.(),r&&r())};return v.jsx(qE,{isPresent:ve,initial:!S.current||a?void 0:!1,custom:t,presenceAffectsLayout:l,mode:c,root:p,onExitComplete:ve?void 0:Re,anchorX:f,anchorY:m,children:X},ee)})})},Vb=M.createContext({strict:!1}),py={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"]};let gy=!1;function GE(){if(gy)return;const n={};for(const t in py)n[t]={isEnabled:a=>py[t].some(r=>!!a[r])};pb(n),gy=!0}function qb(){return GE(),RT()}function $E(n){const t=qb();for(const a in n)t[a]={...t[a],...n[a]};pb(t)}const QE=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","propagate","ignoreStrict","viewport"]);function Ml(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||QE.has(n)}let Hb=n=>!Ml(n);function IE(n){typeof n=="function"&&(Hb=t=>t.startsWith("on")?!Ml(t):n(t))}try{IE(require("@emotion/is-prop-valid").default)}catch{}function YE(n,t,a){const r={};for(const l in n)l==="values"&&typeof n.values=="object"||(Hb(l)||a===!0&&Ml(l)||!t&&!Ml(l)||n.draggable&&l.startsWith("onDrag"))&&(r[l]=n[l]);return r}const ql=M.createContext({});function KE(n,t){if(Vl(n)){const{initial:a,animate:r}=n;return{initial:a===!1||Tr(a)?a:void 0,animate:Tr(r)?r:void 0}}return n.inherit!==!1?t:{}}function XE(n){const{initial:t,animate:a}=KE(n,M.useContext(ql));return M.useMemo(()=>({initial:t,animate:a}),[yy(t),yy(a)])}function yy(n){return Array.isArray(n)?n.join(" "):n}const tf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Gb(n,t,a){for(const r in t)!xt(t[r])&&!_b(r,a)&&(n[r]=t[r])}function FE({transformTemplate:n},t){return M.useMemo(()=>{const a=tf();return Zh(a,t,n),Object.assign({},a.vars,a.style)},[t])}function JE(n,t){const a=n.style||{},r={};return Gb(r,a,n),Object.assign(r,FE(n,t)),r}function ZE(n,t){const a={},r=JE(n,t);return n.drag&&n.dragListener!==!1&&(a.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(a.tabIndex=0),a.style=r,a}const $b=()=>({...tf(),attrs:{}});function WE(n,t,a,r){const l=M.useMemo(()=>{const c=$b();return Sb(c,t,Eb(r),n.transformTemplate,n.style),{...c.attrs,style:{...c.style}}},[t]);if(n.style){const c={};Gb(c,n.style,n),l.style={...c,...l.style}}return l}const eA=["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 nf(n){return typeof n!="string"||n.includes("-")?!1:!!(eA.indexOf(n)>-1||/[A-Z]/u.test(n))}function tA(n,t,a,{latestValues:r},l,c=!1,d){const m=(d??nf(n)?WE:ZE)(t,r,l,n),p=YE(t,typeof n=="string",c),g=n!==M.Fragment?{...p,...m,ref:a}:{},{children:b}=t,w=M.useMemo(()=>xt(b)?b.get():b,[b]);return M.createElement(n,{...g,children:w})}function nA({scrapeMotionValuesFromProps:n,createRenderState:t},a,r,l){return{latestValues:iA(a,r,l,n),renderState:t()}}function iA(n,t,a,r){const l={},c=r(n,{});for(const w in c)l[w]=Sl(c[w]);let{initial:d,animate:f}=n;const m=Vl(n),p=fb(n);t&&p&&!m&&n.inherit!==!1&&(d===void 0&&(d=t.initial),f===void 0&&(f=t.animate));let g=a?a.initial===!1:!1;g=g||d===!1;const b=g?f:d;if(b&&typeof b!="boolean"&&!Pl(b)){const w=Array.isArray(b)?b:[b];for(let _=0;_(t,a)=>{const r=M.useContext(ql),l=M.useContext(zl),c=()=>nA(n,t,r,l);return a?c():Ah(c)},aA=Qb({scrapeMotionValuesFromProps:Wh,createRenderState:tf}),sA=Qb({scrapeMotionValuesFromProps:Ab,createRenderState:$b}),rA=Symbol.for("motionComponentSymbol");function oA(n,t,a){const r=M.useRef(a);M.useInsertionEffect(()=>{r.current=a});const l=M.useRef(null);return M.useCallback(c=>{c&&n.onMount?.(c),t&&(c?t.mount(c):t.unmount());const d=r.current;if(typeof d=="function")if(c){const f=d(c);typeof f=="function"&&(l.current=f)}else l.current?(l.current(),l.current=null):d(c);else d&&(d.current=c)},[t])}const Ib=M.createContext({});function Fa(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function lA(n,t,a,r,l,c){const{visualElement:d}=M.useContext(ql),f=M.useContext(Vb),m=M.useContext(zl),p=M.useContext(ef),g=p.reducedMotion,b=p.skipAnimations,w=M.useRef(null),_=M.useRef(!1);r=r||f.renderer,!w.current&&r&&(w.current=r(n,{visualState:t,parent:d,props:a,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:g,skipAnimations:b,isSVG:c}),_.current&&w.current&&(w.current.manuallyAnimateOnMount=!0));const S=w.current,A=M.useContext(Ib);S&&!S.projection&&l&&(S.type==="html"||S.type==="svg")&&cA(w.current,a,l,A);const E=M.useRef(!1);M.useInsertionEffect(()=>{S&&E.current&&S.update(a,m)});const j=a[tb],O=M.useRef(!!j&&!window.MotionHandoffIsComplete?.(j)&&window.MotionHasOptimisedAnimation?.(j));return mv(()=>{_.current=!0,S&&(E.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),O.current&&S.animationState&&S.animationState.animateChanges())}),M.useEffect(()=>{S&&(!O.current&&S.animationState&&S.animationState.animateChanges(),O.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(j)}),O.current=!1),S.enteringChildren=void 0)}),S}function cA(n,t,a,r){const{layoutId:l,layout:c,drag:d,dragConstraints:f,layoutScroll:m,layoutRoot:p,layoutCrossfade:g}=t;n.projection=new a(n.latestValues,t["data-framer-portal-id"]?void 0:Yb(n.parent)),n.projection.setOptions({layoutId:l,layout:c,alwaysMeasureLayout:!!d||f&&Fa(f),visualElement:n,animationType:typeof c=="string"?c:"both",initialPromotionConfig:r,crossfade:g,layoutScroll:m,layoutRoot:p})}function Yb(n){if(n)return n.options.allowProjection!==!1?n.projection:Yb(n.parent)}function Td(n,{forwardMotionProps:t=!1,type:a}={},r,l){r&&$E(r);const c=a?a==="svg":nf(n),d=c?sA:aA;function f(p,g){let b;const w={...M.useContext(ef),...p,layoutId:uA(p)},{isStatic:_}=w,S=XE(p),A=d(p,_);if(!_&&fv){dA();const E=hA(w);b=E.MeasureLayout,S.visualElement=lA(n,A,w,l,E.ProjectionNode,c)}return v.jsxs(ql.Provider,{value:S,children:[b&&S.visualElement?v.jsx(b,{visualElement:S.visualElement,...w}):null,tA(n,p,oA(A,S.visualElement,g),A,_,t,c)]})}f.displayName=`motion.${typeof n=="string"?n:`create(${n.displayName??n.name??""})`}`;const m=M.forwardRef(f);return m[rA]=n,m}function uA({layoutId:n}){const t=M.useContext(Eh).id;return t&&n!==void 0?t+"-"+n:n}function dA(n,t){M.useContext(Vb).strict}function hA(n){const t=qb(),{drag:a,layout:r}=t;if(!a&&!r)return{};const l={...a,...r};return{MeasureLayout:a?.isEnabled(n)||r?.isEnabled(n)?l.MeasureLayout:void 0,ProjectionNode:l.ProjectionNode}}function fA(n,t){if(typeof Proxy>"u")return Td;const a=new Map,r=(c,d)=>Td(c,d,n,t),l=(c,d)=>r(c,d);return new Proxy(l,{get:(c,d)=>d==="create"?r:(a.has(d)||a.set(d,Td(d,void 0,n,t)),a.get(d))})}const mA=(n,t)=>t.isSVG??nf(n)?new IT(t):new VT(t,{allowProjection:n!==M.Fragment});class pA extends Ti{constructor(t){super(t),t.animationState||(t.animationState=JT(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Pl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:a}=this.node.prevProps||{};t!==a&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let gA=0;class yA extends Ti{constructor(){super(...arguments),this.id=gA++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:a}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const l=this.node.animationState.setActive("exit",!t);a&&!t&&l.then(()=>{a(this.id)})}mount(){const{register:t,onExitComplete:a}=this.node.presenceContext||{};a&&a(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const vA={animation:{Feature:pA},exit:{Feature:yA}};function Ur(n){return{point:{x:n.pageX,y:n.pageY}}}const bA=n=>t=>Kh(t)&&n(t,Ur(t));function vr(n,t,a,r){return Er(n,t,bA(a),r)}const Kb=({current:n})=>n?n.ownerDocument.defaultView:null,vy=(n,t)=>Math.abs(n-t);function wA(n,t){const a=vy(n.x,t.x),r=vy(n.y,t.y);return Math.sqrt(a**2+r**2)}const by=new Set(["auto","scroll"]);class Xb{constructor(t,a,{transformPagePoint:r,contextWindow:l=window,dragSnapToOrigin:c=!1,distanceThreshold:d=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=_=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Ad(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,A=wA(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!A)return;const{point:E}=_,{timestamp:j}=bt;this.history.push({...E,timestamp:j});const{onStart:O,onMove:k}=this.handlers;S||(O&&O(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,_)},this.handlePointerMove=(_,S)=>{this.lastMoveEvent=_,this.lastMoveEventInfo=Ed(S,this.transformPagePoint),Pe.update(this.updatePoint,!0)},this.handlePointerUp=(_,S)=>{this.end();const{onEnd:A,onSessionEnd:E,resumeAnimation:j}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const O=Ad(_.type==="pointercancel"?this.lastMoveEventInfo:Ed(S,this.transformPagePoint),this.history);this.startEvent&&A&&A(_,O),E&&E(_,O)},!Kh(t))return;this.dragSnapToOrigin=c,this.handlers=a,this.transformPagePoint=r,this.distanceThreshold=d,this.contextWindow=l||window;const m=Ur(t),p=Ed(m,this.transformPagePoint),{point:g}=p,{timestamp:b}=bt;this.history=[{...g,timestamp:b}];const{onSessionStart:w}=a;w&&w(t,Ad(p,this.history)),this.removeListeners=Mr(vr(this.contextWindow,"pointermove",this.handlePointerMove),vr(this.contextWindow,"pointerup",this.handlePointerUp),vr(this.contextWindow,"pointercancel",this.handlePointerUp)),f&&this.startScrollTracking(f)}startScrollTracking(t){let a=t.parentElement;for(;a;){const r=getComputedStyle(a);(by.has(r.overflowX)||by.has(r.overflowY))&&this.scrollPositions.set(a,{x:a.scrollLeft,y:a.scrollTop}),a=a.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const a=this.scrollPositions.get(t);if(!a)return;const r=t===window,l=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},c={x:l.x-a.x,y:l.y-a.y};c.x===0&&c.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=c.x,this.lastMoveEventInfo.point.y+=c.y):this.history.length>0&&(this.history[0].x-=c.x,this.history[0].y-=c.y),this.scrollPositions.set(t,l),Pe.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Si(this.updatePoint)}}function Ed(n,t){return t?{point:t(n.point)}:n}function wy(n,t){return{x:n.x-t.x,y:n.y-t.y}}function Ad({point:n},t){return{point:n,delta:wy(n,Fb(t)),offset:wy(n,xA(t)),velocity:_A(t,.1)}}function xA(n){return n[0]}function Fb(n){return n[n.length-1]}function _A(n,t){if(n.length<2)return{x:0,y:0};let a=n.length-1,r=null;const l=Fb(n);for(;a>=0&&(r=n[a],!(l.timestamp-r.timestamp>pn(t)));)a--;if(!r)return{x:0,y:0};r===n[0]&&n.length>2&&l.timestamp-r.timestamp>pn(t)*2&&(r=n[1]);const c=an(l.timestamp-r.timestamp);if(c===0)return{x:0,y:0};const d={x:(l.x-r.x)/c,y:(l.y-r.y)/c};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}function SA(n,{min:t,max:a},r){return t!==void 0&&na&&(n=r?Qe(a,n,r.max):Math.min(n,a)),n}function xy(n,t,a){return{min:t!==void 0?n.min+t:void 0,max:a!==void 0?n.max+a-(n.max-n.min):void 0}}function TA(n,{top:t,left:a,bottom:r,right:l}){return{x:xy(n.x,a,l),y:xy(n.y,t,r)}}function _y(n,t){let a=t.min-n.min,r=t.max-n.max;return t.max-t.minr?a=xr(t.min,t.max-r,n.min):r>l&&(a=xr(n.min,n.max-l,t.min)),Tn(0,1,a)}function jA(n,t){const a={};return t.min!==void 0&&(a.min=t.min-n.min),t.max!==void 0&&(a.max=t.max-n.min),a}const lh=.35;function CA(n=lh){return n===!1?n=0:n===!0&&(n=lh),{x:Sy(n,"left","right"),y:Sy(n,"top","bottom")}}function Sy(n,t,a){return{min:Ty(n,t),max:Ty(n,a)}}function Ty(n,t){return typeof n=="number"?n:n[t]||0}const RA=new WeakMap;class kA{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ot(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:a=!1,distanceThreshold:r}={}){const{presenceContext:l}=this.visualElement;if(l&&l.isPresent===!1)return;const c=b=>{a&&this.snapToCursor(Ur(b).point),this.stopAnimation()},d=(b,w)=>{const{drag:_,dragPropagation:S,onDragStart:A}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=sT(_),!this.openDragLock))return;this.latestPointerEvent=b,this.latestPanInfo=w,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_n(j=>{let O=this.getAxisMotionValue(j).get()||0;if(Sn.test(O)){const{projection:k}=this.visualElement;if(k&&k.layout){const z=k.layout.layoutBox[j];z&&(O=At(z)*(parseFloat(O)/100))}}this.originPoint[j]=O}),A&&Pe.update(()=>A(b,w),!1,!0),Wd(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},f=(b,w)=>{this.latestPointerEvent=b,this.latestPanInfo=w;const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:A,onDrag:E}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:j}=w;if(S&&this.currentDirection===null){this.currentDirection=NA(j),this.currentDirection!==null&&A&&A(this.currentDirection);return}this.updateAxis("x",w.point,j),this.updateAxis("y",w.point,j),this.visualElement.render(),E&&Pe.update(()=>E(b,w),!1,!0)},m=(b,w)=>{this.latestPointerEvent=b,this.latestPanInfo=w,this.stop(b,w),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>{const{dragSnapToOrigin:b}=this.getProps();(b||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:g}=this.getProps();this.panSession=new Xb(t,{onSessionStart:c,onStart:d,onMove:f,onSessionEnd:m,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:r,contextWindow:Kb(this.visualElement),element:this.visualElement.current})}stop(t,a){const r=t||this.latestPointerEvent,l=a||this.latestPanInfo,c=this.isDragging;if(this.cancel(),!c||!l||!r)return;const{velocity:d}=l;this.startAnimation(d);const{onDragEnd:f}=this.getProps();f&&Pe.postRender(()=>f(r,l))}cancel(){this.isDragging=!1;const{projection:t,animationState:a}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),a&&a.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,a,r){const{drag:l}=this.getProps();if(!r||!rl(t,l,this.currentDirection))return;const c=this.getAxisMotionValue(t);let d=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(d=SA(d,this.constraints[t],this.elastic[t])),c.set(d)}resolveConstraints(){const{dragConstraints:t,dragElastic:a}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,l=this.constraints;t&&Fa(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=TA(r.layoutBox,t):this.constraints=!1,this.elastic=CA(a),l!==this.constraints&&!Fa(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&_n(c=>{this.constraints!==!1&&this.getAxisMotionValue(c)&&(this.constraints[c]=jA(r.layoutBox[c],this.constraints[c]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:a}=this.getProps();if(!t||!Fa(t))return!1;const r=t.current,{projection:l}=this.visualElement;if(!l||!l.layout)return!1;const c=DT(r,l.root,this.visualElement.getTransformPagePoint());let d=EA(l.layout.layoutBox,c);if(a){const f=a(OT(d));this.hasMutatedConstraints=!!f,f&&(d=yb(f))}return d}startAnimation(t){const{drag:a,dragMomentum:r,dragElastic:l,dragTransition:c,dragSnapToOrigin:d,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},p=_n(g=>{if(!rl(g,a,this.currentDirection))return;let b=m&&m[g]||{};d&&(b={min:0,max:0});const w=l?200:1e6,_=l?40:1e7,S={type:"inertia",velocity:r?t[g]:0,bounceStiffness:w,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...c,...b};return this.startAxisValueAnimation(g,S)});return Promise.all(p).then(f)}startAxisValueAnimation(t,a){const r=this.getAxisMotionValue(t);return Wd(this.visualElement,t),r.start(Hh(t,r,0,a,this.visualElement,!1))}stopAnimation(){_n(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const a=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),l=r[a];return l||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){_n(a=>{const{drag:r}=this.getProps();if(!rl(a,r,this.currentDirection))return;const{projection:l}=this.visualElement,c=this.getAxisMotionValue(a);if(l&&l.layout){const{min:d,max:f}=l.layout.layoutBox[a],m=c.get()||0;c.set(t[a]-Qe(d,f,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:a}=this.getProps(),{projection:r}=this.visualElement;if(!Fa(a)||!r||!this.constraints)return;this.stopAnimation();const l={x:0,y:0};_n(d=>{const f=this.getAxisMotionValue(d);if(f&&this.constraints!==!1){const m=f.get();l[d]=AA({min:m,max:m},this.constraints[d])}});const{transformTemplate:c}=this.visualElement.getProps();this.visualElement.current.style.transform=c?c({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),_n(d=>{if(!rl(d,t,null))return;const f=this.getAxisMotionValue(d),{min:m,max:p}=this.constraints[d];f.set(Qe(m,p,l[d]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;RA.set(this.visualElement,this);const t=this.visualElement.current,a=vr(t,"pointerdown",p=>{const{drag:g,dragListener:b=!0}=this.getProps(),w=p.target,_=w!==t&&dT(w);g&&b&&!_&&this.start(p)});let r;const l=()=>{const{dragConstraints:p}=this.getProps();Fa(p)&&p.current&&(this.constraints=this.resolveRefConstraints(),r||(r=OA(t,p.current,()=>this.scalePositionWithinConstraints())))},{projection:c}=this.visualElement,d=c.addEventListener("measure",l);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),Pe.read(l);const f=Er(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:g})=>{this.isDragging&&g&&(_n(b=>{const w=this.getAxisMotionValue(b);w&&(this.originPoint[b]+=p[b].translate,w.set(w.get()+p[b].translate))}),this.visualElement.render())}));return()=>{f(),a(),d(),m&&m(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:a=!1,dragDirectionLock:r=!1,dragPropagation:l=!1,dragConstraints:c=!1,dragElastic:d=lh,dragMomentum:f=!0}=t;return{...t,drag:a,dragDirectionLock:r,dragPropagation:l,dragConstraints:c,dragElastic:d,dragMomentum:f}}}function Ey(n){let t=!0;return()=>{if(t){t=!1;return}n()}}function OA(n,t,a){const r=N0(n,Ey(a)),l=N0(t,Ey(a));return()=>{r(),l()}}function rl(n,t,a){return(t===!0||t===n)&&(a===null||a===n)}function NA(n,t=10){let a=null;return Math.abs(n.y)>t?a="y":Math.abs(n.x)>t&&(a="x"),a}class MA extends Ti{constructor(t){super(t),this.removeGroupControls=sn,this.removeListeners=sn,this.controls=new kA(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||sn}update(){const{dragControls:t}=this.node.getProps(),{dragControls:a}=this.node.prevProps||{};t!==a&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const jd=n=>(t,a)=>{n&&Pe.update(()=>n(t,a),!1,!0)};class DA extends Ti{constructor(){super(...arguments),this.removePointerDownListener=sn}onPointerDown(t){this.session=new Xb(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Kb(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:a,onPan:r,onPanEnd:l}=this.node.getProps();return{onSessionStart:jd(t),onStart:jd(a),onMove:jd(r),onEnd:(c,d)=>{delete this.session,l&&Pe.postRender(()=>l(c,d))}}}mount(){this.removePointerDownListener=vr(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Cd=!1;class LA extends M.Component{componentDidMount(){const{visualElement:t,layoutGroup:a,switchLayoutGroup:r,layoutId:l}=this.props,{projection:c}=t;c&&(a.group&&a.group.add(c),r&&r.register&&l&&r.register(c),Cd&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Tl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:a,visualElement:r,drag:l,isPresent:c}=this.props,{projection:d}=r;return d&&(d.isPresent=c,t.layoutDependency!==a&&d.setOptions({...d.options,layoutDependency:a}),Cd=!0,l||t.layoutDependency!==a||a===void 0||t.isPresent!==c?d.willUpdate():this.safeToRemove(),t.isPresent!==c&&(c?d.promote():d.relegate()||Pe.postRender(()=>{const f=d.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Yh.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:a,switchLayoutGroup:r}=this.props,{projection:l}=t;Cd=!0,l&&(l.scheduleCheckAfterUnmount(),a&&a.group&&a.group.remove(l),r&&r.deregister&&r.deregister(l))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Jb(n){const[t,a]=Pb(),r=M.useContext(Eh);return v.jsx(LA,{...n,layoutGroup:r,switchLayoutGroup:M.useContext(Ib),isPresent:t,safeToRemove:a})}const UA={pan:{Feature:DA},drag:{Feature:MA,ProjectionNode:zb,MeasureLayout:Jb}};function Ay(n,t,a){const{props:r}=n;n.animationState&&r.whileHover&&n.animationState.setActive("whileHover",a==="Start");const l="onHover"+a,c=r[l];c&&Pe.postRender(()=>c(t,Ur(t)))}class BA extends Ti{mount(){const{current:t}=this.node;t&&(this.unmount=oT(t,(a,r)=>(Ay(this.node,r,"Start"),l=>Ay(this.node,l,"End"))))}unmount(){}}class zA extends Ti{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Mr(Er(this.node.current,"focus",()=>this.onFocus()),Er(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function jy(n,t,a){const{props:r}=n;if(n.current instanceof HTMLButtonElement&&n.current.disabled)return;n.animationState&&r.whileTap&&n.animationState.setActive("whileTap",a==="Start");const l="onTap"+(a==="End"?"":a),c=r[l];c&&Pe.postRender(()=>c(t,Ur(t)))}class PA extends Ti{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:a,propagate:r}=this.node.props;this.unmount=fT(t,(l,c)=>(jy(this.node,c,"Start"),(d,{success:f})=>jy(this.node,d,f?"End":"Cancel")),{useGlobalTarget:a,stopPropagation:r?.tap===!1})}unmount(){}}const ch=new WeakMap,Rd=new WeakMap,VA=n=>{const t=ch.get(n.target);t&&t(n)},qA=n=>{n.forEach(VA)};function HA({root:n,...t}){const a=n||document;Rd.has(a)||Rd.set(a,{});const r=Rd.get(a),l=JSON.stringify(t);return r[l]||(r[l]=new IntersectionObserver(qA,{root:n,...t})),r[l]}function GA(n,t,a){const r=HA(t);return ch.set(n,a),r.observe(n),()=>{ch.delete(n),r.unobserve(n)}}const $A={some:0,all:1};class QA extends Ti{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:a,margin:r,amount:l="some",once:c}=t,d={root:a?a.current:void 0,rootMargin:r,threshold:typeof l=="number"?l:$A[l]},f=m=>{const{isIntersecting:p}=m;if(this.isInView===p||(this.isInView=p,c&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:g,onViewportLeave:b}=this.node.getProps(),w=p?g:b;w&&w(m)};return GA(this.node.current,d,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:a}=this.node;["amount","margin","root"].some(IA(t,a))&&this.startObserver()}unmount(){}}function IA({viewport:n={}},{viewport:t={}}={}){return a=>n[a]!==t[a]}const YA={inView:{Feature:QA},tap:{Feature:PA},focus:{Feature:zA},hover:{Feature:BA}},KA={layout:{ProjectionNode:zb,MeasureLayout:Jb}},XA={...vA,...YA,...UA,...KA},$e=fA(XA,mA),FA={some:0,all:1};function JA(n,t,{root:a,margin:r,amount:l="some"}={}){const c=Ih(n),d=new WeakMap,f=p=>{p.forEach(g=>{const b=d.get(g.target);if(g.isIntersecting!==!!b)if(g.isIntersecting){const w=t(g.target,g);typeof w=="function"?d.set(g.target,w):m.unobserve(g.target)}else typeof b=="function"&&(b(g),d.delete(g.target))})},m=new IntersectionObserver(f,{root:a,rootMargin:r,threshold:typeof l=="number"?l:FA[l]});return c.forEach(p=>m.observe(p)),()=>m.disconnect()}function ZA(n,{root:t,margin:a,amount:r,once:l=!1,initial:c=!1}={}){const[d,f]=M.useState(c);return M.useEffect(()=>{if(!n.current||l&&d)return;const m=()=>(f(!0),l?void 0:()=>f(!1)),p={root:t&&t.current||void 0,margin:a,amount:r};return JA(n.current,m,p)},[t,n,a,l,r]),d}const Zb=(...n)=>n.filter((t,a,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===a).join(" ").trim();const WA=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const ej=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,r)=>r?r.toUpperCase():a.toLowerCase());const Cy=n=>{const t=ej(n);return t.charAt(0).toUpperCase()+t.slice(1)};var tj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const nj=n=>{for(const t in n)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const ij=M.forwardRef(({color:n="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:l="",children:c,iconNode:d,...f},m)=>M.createElement("svg",{ref:m,...tj,width:t,height:t,stroke:n,strokeWidth:r?Number(a)*24/Number(t):a,className:Zb("lucide",l),...!c&&!nj(f)&&{"aria-hidden":"true"},...f},[...d.map(([p,g])=>M.createElement(p,g)),...Array.isArray(c)?c:[c]]));const Ue=(n,t)=>{const a=M.forwardRef(({className:r,...l},c)=>M.createElement(ij,{ref:c,iconNode:t,className:Zb(`lucide-${WA(Cy(n))}`,`lucide-${n}`,r),...l}));return a.displayName=Cy(n),a};const aj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ry=Ue("arrow-right",aj);const sj=[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]],rj=Ue("audio-waveform",sj);const oj=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],lj=Ue("brain",oj);const cj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],uj=Ue("chevron-down",cj);const dj=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],ky=Ue("flame",dj);const hj=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],fj=Ue("grid-3x3",hj);const mj=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],pj=Ue("layers",mj);const gj=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M11 19H3",key:"zflm78"}],["path",{d:"M21 16V5",key:"yxg4q8"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Oy=Ue("list-music",gj);const yj=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],vj=Ue("log-out",yj);const bj=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],wj=Ue("menu",bj);const xj=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],_j=Ue("message-square",xj);const Sj=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]],Wb=Ue("mic-off",Sj);const Tj=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],ss=Ue("mic",Tj);const Ej=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Ny=Ue("music",Ej);const Aj=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ew=Ue("pause",Aj);const jj=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],tw=Ue("play",jj);const Cj=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],nw=Ue("search",Cj);const Rj=[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]],iw=Ue("skip-back",Rj);const kj=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],aw=Ue("skip-forward",kj);const Oj=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Nj=Ue("sparkles",Oj);const Mj=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],El=Ue("star",Mj);const Dj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Lj=Ue("target",Dj);const Uj=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],sw=Ue("trending-up",Uj);const Bj=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],uh=Ue("trophy",Bj);const zj=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ol=Ue("user",zj);const Pj=[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]],Vj=Ue("waves",Pj);const qj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rw=Ue("x",qj);const Hj=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Gj=Ue("zap",Hj),$j=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function Qj(n){if(n<=0)return{note:"-",cents:0};const t=12*Math.log2(n/440),a=Math.round(t),r=Math.round((t-a)*100),l=(a%12+12)%12,c=Math.floor((a+9)/12)+4;return{note:`${$j[l]}${c}`,cents:r}}function Ij(n,t){const a=n.length;let r=0;for(let g=0;g0&&(b/=A),b>m&&(m=b,p=g)}if(p===-1||m<.3)return 0;if(p>d&&p1e-4){const S=(w-g)/(2*_);if(Math.abs(S)<1)return t/(p+S)}}return t/p}function kd(n,t){let a=0;const r=Math.min(n.length-t,Math.floor(n.length/2));for(let l=0;l{if(!c.current||!l.current)return;const j=performance.now();if(j-_.current<33){f.current=requestAnimationFrame(S);return}_.current=j;const O=c.current,k=new Uint8Array(O.frequencyBinCount),z=new Uint8Array(O.frequencyBinCount);O.getByteFrequencyData(k),O.getByteTimeDomainData(z);const Y=k.reduce((V,J)=>V+J,0)/k.length/255;(!w.current||w.current.length!==O.fftSize)&&(w.current=new Float32Array(O.fftSize)),O.getFloatTimeDomainData(w.current);const I=Ij(w.current,l.current.sampleRate),X=.4;I>0?b.current=b.current>0?b.current*(1-X)+I*X:I:(b.current*=.85,b.current<10&&(b.current=0));const ee=b.current,{note:ve,cents:Re}=Qj(ee),Ae=Date.now(),ae=2e3;let re=ve,se=Re,D=Y;if(Y>.008&&ve!=="-")m.current=ve,p.current=Re,g.current=Ae;else if(Ae-g.current{try{const j=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}});d.current=j;const O=new AudioContext;l.current=O;const k=O.createMediaStreamSource(j),z=O.createGain();z.gain.value=3;const G=O.createDynamicsCompressor();G.threshold.value=-40,G.knee.value=12,G.ratio.value=6,G.attack.value=.003,G.release.value=.15;const Y=O.createBiquadFilter();Y.type="highpass",Y.frequency.value=150,Y.Q.value=1;const I=O.createBiquadFilter();I.type="lowpass",I.frequency.value=1500,I.Q.value=1;const X=O.createAnalyser();X.fftSize=4096,X.smoothingTimeConstant=.75,k.connect(z),z.connect(G),G.connect(Y),Y.connect(I),I.connect(X),c.current=X,t(!0),_.current=0,b.current=0,f.current=requestAnimationFrame(S)}catch(j){console.error("Microphone access denied:",j)}},[S]),E=M.useCallback(()=>{f.current&&cancelAnimationFrame(f.current),f.current=0,d.current&&(d.current.getTracks().forEach(j=>j.stop()),d.current=null),l.current&&(l.current.close(),l.current=null),c.current=null,b.current=0,w.current=null,t(!1)},[]);return M.useEffect(()=>()=>{f.current&&cancelAnimationFrame(f.current),d.current?.getTracks().forEach(j=>j.stop()),l.current?.close()},[]),{isListening:n,analysis:a,startListening:A,stopListening:E}}const ll=1,Kj=.15;function Xj(){const[n,t]=M.useState(!1),[a,r]=M.useState(0),[l,c]=M.useState(0),[d,f]=M.useState(new Uint8Array(64)),[m,p]=M.useState(new Uint8Array(64)),[g,b]=M.useState("original"),[w,_]=M.useState(ll),S=M.useRef(null),A=M.useRef(null),E=M.useRef(null),j=M.useRef(null),O=M.useRef(null),k=M.useRef(null),z=M.useRef(0),G=M.useRef(0),Y=M.useCallback(()=>{if(!E.current)return;const se=performance.now();if(se-G.current<33){z.current=requestAnimationFrame(Y);return}G.current=se;const D=new Uint8Array(E.current.frequencyBinCount),V=new Uint8Array(E.current.frequencyBinCount);E.current.getByteFrequencyData(D),E.current.getByteTimeDomainData(V),f(D),p(V),z.current=requestAnimationFrame(Y)},[]),I=M.useCallback(se=>{if(z.current&&(cancelAnimationFrame(z.current),z.current=0),S.current&&(S.current.pause(),S.current.removeAttribute("src"),S.current.load()),j.current){try{j.current.disconnect()}catch{}j.current=null}if(A.current){try{A.current.close()}catch{}A.current=null}const D=new Audio;D.crossOrigin="anonymous",D.preload="auto",S.current=D,D.addEventListener("loadedmetadata",()=>c(D.duration)),D.addEventListener("timeupdate",()=>r(D.currentTime)),D.addEventListener("ended",()=>{t(!1),z.current&&cancelAnimationFrame(z.current)});const V=new AudioContext;A.current=V;const J=V.createMediaElementSource(D);j.current=J;const he=V.createAnalyser();he.fftSize=256,he.smoothingTimeConstant=.8,E.current=he;const fe=V.createGain();fe.gain.value=ll,O.current=fe;const C=V.createBiquadFilter();C.type="peaking",C.frequency.value=1e3,C.Q.value=.7,C.gain.value=0;const H=V.createBiquadFilter();H.type="peaking",H.frequency.value=3e3,H.Q.value=.5,H.gain.value=0,k.current={vocal:C,instrument:H},J.connect(C),C.connect(H),H.connect(fe),fe.connect(he),he.connect(V.destination),b("original"),_(ll),D.src=se},[]),X=M.useCallback(se=>{const D=Math.max(0,Math.min(1,se));_(D),O.current&&A.current&&(O.current.gain.cancelScheduledValues(A.current.currentTime),O.current.gain.setTargetAtTime(D,A.current.currentTime,.08))},[]),ee=M.useCallback(()=>X(Kj),[X]),ve=M.useCallback(()=>X(ll),[X]),Re=M.useCallback(se=>{if(b(se),!k.current||!O.current)return;const{vocal:D,instrument:V}=k.current,J=w;switch(se){case"original":D.type="peaking",D.frequency.value=1e3,D.Q.value=.7,D.gain.value=0,V.type="peaking",V.frequency.value=3e3,V.Q.value=.5,V.gain.value=0,O.current.gain.value=J;break;case"karaoke":D.type="notch",D.frequency.value=1e3,D.Q.value=.5,D.gain.value=0,V.type="notch",V.frequency.value=2500,V.Q.value=.5,V.gain.value=0,O.current.gain.value=J*1.1;break;case"vocals":D.type="bandpass",D.frequency.value=1200,D.Q.value=.8,D.gain.value=0,V.type="highshelf",V.frequency.value=4e3,V.Q.value=.5,V.gain.value=-20,O.current.gain.value=J*1.5;break}},[w]),Ae=M.useCallback(async()=>{if(S.current)try{A.current?.state==="suspended"&&await A.current.resume(),await S.current.play(),t(!0),G.current=0,z.current=requestAnimationFrame(Y)}catch(se){console.error("Play failed:",se)}},[Y]),ae=M.useCallback(()=>{S.current?.pause(),t(!1),z.current&&(cancelAnimationFrame(z.current),z.current=0)},[]),re=M.useCallback(se=>{S.current&&(S.current.currentTime=se)},[]);return M.useEffect(()=>()=>{if(z.current&&cancelAnimationFrame(z.current),S.current&&(S.current.pause(),S.current.removeAttribute("src")),j.current)try{j.current.disconnect()}catch{}if(A.current)try{A.current.close()}catch{}},[]),{isPlaying:n,currentTime:a,duration:l,frequencyData:d,waveformData:m,mode:g,musicVolume:w,loadSong:I,play:Ae,pause:ae,seek:re,applyMode:Re,setVolume:X,duckForMic:ee,restoreVolume:ve}}const Fj=[{id:"rock",label:"Rock",emoji:"๐ŸŽธ"},{id:"alternative",label:"Alternative",emoji:"๐ŸŽต"},{id:"metal",label:"Metal",emoji:"๐Ÿค˜"},{id:"latin",label:"Latin",emoji:"๐Ÿ”ฅ"},{id:"pop",label:"Pop & Otros",emoji:"๐ŸŽค"},{id:"instrumental",label:"Instrumental",emoji:"๐ŸŽน"}],Jj=[{id:"beginner",label:"Principiante",emoji:"๐ŸŸข",color:"text-emerald-400"},{id:"intermediate",label:"Intermedio",emoji:"๐ŸŸก",color:"text-yellow-400"},{id:"advanced",label:"Avanzado",emoji:"๐Ÿ”ด",color:"text-red-400"}];function Zj(n){const t=n.toLowerCase();return t.includes("reggaeton")||t.includes("bachata")||t.includes("salsa")||t.includes("latin")||t.includes("urbano")||t.includes("perreo")?"latin":t.includes("metal")||t.includes("progressive")?"metal":t.includes("alternative")||t.includes("grunge")||t.includes("new wave")||t.includes("britpop")||t.includes("punk")||t.includes("garage")||t.includes("british invasion")?"alternative":t.includes("pop")||t.includes("disney")||t.includes("hip-hop")||t.includes("hip hop")||t.includes("espaรฑol")?"pop":t.includes("cinematic")||t.includes("adventure")||t.includes("ai gen")||t.includes("voice memo")||t.includes("instrumental")?"instrumental":"rock"}const Wj={"bajo-el-mar":"beginner","born-in-the-usa":"beginner","come-as-you-are":"beginner",dreams:"beginner","fly-away":"beginner","fortunate-son":"beginner","i-cant-get-no-satisfaction":"beginner","i-love-rock-n-roll":"beginner","iron-man":"beginner",jump:"beginner","one-way-or-another":"beginner",paranoid:"beginner","seven-nation-army":"beginner","sharp-dressed-man":"beginner","smoke-on-the-water":"beginner","sweet-home-alabama":"beginner",wonderwall:"beginner","you-really-got-me":"beginner","you-shook-me-all-night-long":"beginner",zombie:"beginner","all-right-now":"beginner","all-day-and-all-of-the-night":"beginner","another-brick-in-the-wall":"beginner","another-one-bites-the-dust":"beginner","should-i-stay-or-should-i-go":"beginner",inception:"beginner",expedition:"beginner",pilar:"beginner",voice:"beginner",cuentale:"beginner",dile:"beginner","donde-estan-las-gatas":"beginner","ella-me-levanto":"beginner","ella-se-contradice":"beginner","hasta-abajo":"beginner","llamado-de-emergencia":"beginner","mayor-que-yo":"beginner","me-voy-pal-party":"beginner","mi-cama-huele-a-ti":"beginner","pa-que-retozen":"beginner",pasarela:"beginner","pobre-diabla":"beginner",rakata:"beginner","salio-el-sol":"beginner","si-no-le-contesto":"beginner","siente-el-boom":"beginner","soy-una-gargola":"beginner","yo-voy":"beginner","lento-lento-lento":"beginner","por-que-te-demoras":"beginner","sexo-violencia-y-llantas":"beginner",gente:"beginner","me-rehuso":"beginner","la-cancion":"beginner","te-pintaron-pajaritos":"beginner","ella-no-sigue-modas":"beginner","bad-day":"beginner","hey-soul-sister":"beginner","make-you-mine":"beginner","devuelveme-a-mi-chica":"beginner",zapatillas:"beginner","pan-y-mantequilla":"beginner","dancing-queen":"beginner","mamma-mia":"beginner",rosas:"intermediate","marta-sebas-guille":"intermediate","gritando-en-braille":"intermediate","cometas-por-el-cielo":"intermediate","cien-gaviotas":"intermediate","soldadito-marinero":"intermediate","la-playa":"intermediate","20-de-enero":"intermediate","el-universo-sobre-mi":"intermediate","nada-fue-un-error":"intermediate","limon-y-sal":"intermediate","drivers-license":"intermediate","tu-jardin-con-enanitos":"intermediate","antes-de-que-cuente-diez":"intermediate","por-la-raja-de-tu-falda":"intermediate","como-camaron":"intermediate","ave-maria":"advanced","mi-princesa":"advanced","bohemian-rhapsody":"advanced","dream-on":"advanced","edge-of-seventeen":"advanced","free-bird":"advanced",hurricane:"advanced",layla:"advanced","lose-yourself":"advanced","master-of-puppets":"advanced","purple-rain":"advanced","stairway-to-heaven":"advanced","sultans-of-swing":"advanced","tom-sawyer":"advanced","under-pressure":"advanced","carry-on-wayward-son":"advanced"};function dh(n){return{category:Zj(n.genre),difficulty:Wj[n.id]??"intermediate",hasLyrics:!!n.lrcQuery?.trim()}}function hh(n){if(!n?.trim())return[];const t=[],a=/\[(\d{1,2}):(\d{2})(?:\.(\d{2,3}))?\]/g;for(const l of n.split(` `)){const c=l.trim();if(!c)continue;const d=[];let f;for(a.lastIndex=0;(f=a.exec(c))!==null;){const p=parseInt(f[1],10),g=parseInt(f[2],10),b=f[3]?parseInt(f[3].padEnd(3,"0").slice(0,3),10)/1e3:0;d.push(p*60+g+b)}if(d.length===0)continue;const m=c.replace(/\[\d{1,2}:\d{2}(?:\.\d{2,3})?\]/g,"").trim();for(const p of d)t.push({time:p,text:m})}const r=t.filter(l=>!l.text.match(/^[a-z]{2,}:/i)||l.text.includes(" "));return r.sort((l,c)=>l.time-c.time),r}async function e2(n,t,a){if(!n?.trim())return[];const r={"User-Agent":"MusicAI/1.0 (https://github.com/gsietsetb/music-ai)"};if(t&&a)try{const l=`https://lrclib.net/api/get?artist_name=${encodeURIComponent(t)}&track_name=${encodeURIComponent(a)}`,c=await fetch(l,{headers:r});if(c.ok){const d=await c.json();if(d?.syncedLyrics)return hh(d.syncedLyrics);if(d?.plainLyrics)return d.plainLyrics.split(` `).filter(f=>f.trim()).map((f,m)=>({time:m*3.5,text:f}))}}catch{}try{const l=`https://lrclib.net/api/search?q=${encodeURIComponent(n.trim())}`,c=await fetch(l,{headers:r});if(!c.ok)return[];const d=await c.json();if(!Array.isArray(d)||d.length===0)return[];for(const f of d.slice(0,8))if(typeof f.syncedLyrics=="string"&&f.syncedLyrics.trim())return hh(f.syncedLyrics);for(const f of d.slice(0,5))if(typeof f.plainLyrics=="string"&&f.plainLyrics.trim())return f.plainLyrics.split(` `).filter(m=>m.trim()).map((m,p)=>({time:p*3.5,text:m}))}catch{}return[]}const Od=new Map,t2={"bajo-el-mar":[{time:0,text:"โ™ช โ™ช โ™ช (Intro)"},{time:5,text:"Bajo el mar, bajo el mar",note:"C4"},{time:10,text:"Vives contenta, siendo sirena",note:"E4"},{time:15,text:"Eres feliz, lo ves aquรญ",note:"G4"},{time:20,text:"Quieren llegar a algรบn lugar",note:"C4"},{time:25,text:"Pero van no a ningรบn lugar",note:"E4"},{time:30,text:"Bajo el mar, bajo el mar",note:"G4"},{time:35,text:"Nadie nos frรญe, ni nos cocina",note:"A4"},{time:40,text:"En la sartรฉn, estamos bien",note:"G4"},{time:45,text:"Bajo el mar, nadie nos para",note:"E4"},{time:50,text:"Hay siempre mรบsica, es muy natural",note:"C4"},{time:55,text:"El caracol y el coral saben tocar",note:"D4"},{time:60,text:"Y el pez que sopla va marcando el compรกs",note:"E4"},{time:65,text:"Con la marimba y el arpa vamos ya",note:"F4"},{time:70,text:"โ™ช (Solo instrumental) โ™ช"},{time:80,text:"Bajo el mar, bajo el mar",note:"C4"},{time:85,text:"Cada pececito aquรญ es feliz",note:"E4"},{time:90,text:"Mucha acciรณn, cada canciรณn",note:"G4"},{time:95,text:"La vida es burbujas, bajo el mar",note:"C5"},{time:100,text:"โ™ช (Outro) โ™ช"},{time:120,text:""}],"lose-yourself":[{time:0,text:"โ™ช โ™ช โ™ช (Guitar intro)"},{time:10,text:"Look, if you had one shot",note:"E3"},{time:12,text:"Or one opportunity",note:"E3"},{time:14,text:"To seize everything you ever wanted",note:"G3"},{time:17,text:"In one moment",note:"A3"},{time:19,text:"Would you capture it",note:"G3"},{time:21,text:"Or just let it slip?",note:"E3"},{time:24,text:"Yo"},{time:26,text:"His palms are sweaty, knees weak, arms are heavy",note:"E3"},{time:30,text:"There's vomit on his sweater already",note:"G3"},{time:33,text:"Mom's spaghetti",note:"A3"},{time:35,text:"He's nervous, but on the surface",note:"G3"},{time:37,text:"He looks calm and ready",note:"E3"},{time:39,text:"To drop bombs, but he keeps on forgetting",note:"G3"},{time:42,text:"What he wrote down, the whole crowd goes so loud",note:"A3"},{time:45,text:"He opens his mouth, but the words won't come out",note:"G3"},{time:48,text:"He's choking, how, everybody's joking now",note:"E3"},{time:52,text:"The clock's run out, time's up, over, blaow!",note:"A3"},{time:56,text:"Snap back to reality, ope there goes gravity",note:"G3"},{time:60,text:"Ope, there goes Rabbit, he choked",note:"E3"},{time:63,text:"He's so mad, but he won't give up that easy",note:"G3"},{time:67,text:""},{time:68,text:"You better lose yourself in the music",note:"C4"},{time:72,text:"The moment, you own it, you better never let it go",note:"D4"},{time:76,text:"You only get one shot, do not miss your chance to blow",note:"E4"},{time:80,text:"This opportunity comes once in a lifetime yo",note:"D4"},{time:84,text:""},{time:85,text:"You better lose yourself in the music",note:"C4"},{time:89,text:"The moment, you own it, you better never let it go",note:"D4"},{time:93,text:"You only get one shot, do not miss your chance to blow",note:"E4"},{time:97,text:"This opportunity comes once in a lifetime yo",note:"D4"},{time:101,text:"(You better)",note:"C4"},{time:110,text:""}],inception:[{time:0,text:"โ™ช (Piano begins softly)"},{time:8,text:"โ™ช โ™ช (Building...)"},{time:16,text:"โ™ช (Strings enter)"},{time:24,text:"โ™ช โ™ช โ™ช (Growing intensity)"},{time:32,text:"โ™ช (The famous chord progression)"},{time:40,text:"โ™ช โ™ช (Emotional peak building)"},{time:55,text:"โ™ช (The drop)"},{time:65,text:"โ™ช โ™ช โ™ช (Full orchestra)"},{time:80,text:"โ™ช (Powerful crescendo)"},{time:100,text:"โ™ช (Emotional climax)"},{time:120,text:"โ™ช (Resolving...)"},{time:140,text:"โ™ช โ™ช (Gentle outro)"},{time:160,text:""}],expedition:[{time:0,text:"โ™ช (Adventure begins)"},{time:10,text:"โ™ช โ™ช (Building momentum)"},{time:20,text:"โ™ช (Main theme)"},{time:35,text:"โ™ช โ™ช (Epic section)"},{time:50,text:"โ™ช (Exploration)"},{time:70,text:"โ™ช โ™ช (Climax)"},{time:90,text:"โ™ช (Resolution)"},{time:110,text:""}],pilar:[{time:0,text:"(AI-generated voice begins)"},{time:5,text:"โ™ช Escuchando voz sintetizada..."},{time:15,text:"โ™ช Pilar Duran โ€” ElevenLabs AI"},{time:25,text:"โ™ช (Continued...)"},{time:40,text:""}],voice:[{time:0,text:"(Voice recording begins)"},{time:5,text:"๐ŸŽ™๏ธ Listening..."},{time:15,text:""}]},Gt=[{id:"bajo-el-mar",title:"Bajo el Mar",artist:"Mireia Edition",file:"/songs/bajo-el-mar.mp3",color:"from-cyan-400 to-blue-500",emoji:"๐Ÿงœโ€โ™€๏ธ",genre:"Pop / Disney",lang:"es",lrcQuery:"bajo el mar sirenita"},{id:"lose-yourself",title:"Lose Yourself",artist:"Eminem",file:"/songs/lose-yourself.mp3",color:"from-orange-400 to-red-500",emoji:"๐Ÿ”ฅ",genre:"Hip-Hop",lang:"en",lrcQuery:"lose yourself eminem"},{id:"inception",title:"Time",artist:"Hans Zimmer",file:"/songs/inception-time.mp3",color:"from-purple-400 to-indigo-600",emoji:"โฐ",genre:"Cinematic",lang:"inst",lrcQuery:""},{id:"expedition",title:"Expedition",artist:"Chosic",file:"/songs/expedition.mp3",color:"from-emerald-400 to-teal-500",emoji:"๐Ÿ”๏ธ",genre:"Adventure",lang:"inst",lrcQuery:""},{id:"pilar",title:"Pilar Durรกn",artist:"AI Voice",file:"/songs/pilar-ai-voice.mp3",color:"from-pink-400 to-rose-500",emoji:"๐Ÿค–",genre:"AI Generated",lang:"es",lrcQuery:""},{id:"voice",title:"Voice Clip",artist:"Recording",file:"/songs/voice-clip.m4a",color:"from-amber-400 to-orange-500",emoji:"๐ŸŽ™๏ธ",genre:"Voice Memo",lang:"es",lrcQuery:""},{id:"all-along-the-watchtower",title:"All Along the Watchtower",artist:"Jimi Hendrix",file:"/songs/all-along-the-watchtower.mp3",color:"from-violet-500 to-purple-700",emoji:"๐ŸŽธ",genre:"Classic Rock",lang:"en",lrcQuery:"All Along the Watchtower Jimi Hendrix"},{id:"all-day-and-all-of-the-night",title:"All Day and All of the Night",artist:"The Kinks",file:"/songs/all-day-and-all-of-the-night.mp3",color:"from-amber-500 to-orange-600",emoji:"๐ŸŒ™",genre:"British Invasion",lang:"en",lrcQuery:"All Day and All of the Night The Kinks"},{id:"all-right-now",title:"All Right Now",artist:"Free",file:"/songs/all-right-now.mp3",color:"from-rose-400 to-red-500",emoji:"โœŠ",genre:"Classic Rock",lang:"en",lrcQuery:"All Right Now Free"},{id:"american-woman",title:"American Woman",artist:"The Guess Who",file:"/songs/american-woman-7_-single-version.mp3",color:"from-red-500 to-rose-600",emoji:"๐Ÿ‡บ๐Ÿ‡ธ",genre:"Classic Rock",lang:"en",lrcQuery:"American Woman The Guess Who"},{id:"another-brick-in-the-wall",title:"Another Brick in the Wall Pt. 2",artist:"Pink Floyd",file:"/songs/another-brick-in-the-wall-pt-2.mp3",color:"from-pink-500 to-rose-600",emoji:"๐Ÿงฑ",genre:"Progressive Rock",lang:"en",lrcQuery:"Another Brick in the Wall Pink Floyd"},{id:"another-one-bites-the-dust",title:"Another One Bites the Dust",artist:"Queen",file:"/songs/another-one-bites-the-dust-remastered-2011.mp3",color:"from-red-500 to-amber-600",emoji:"๐Ÿ’€",genre:"Rock",lang:"en",lrcQuery:"Another One Bites the Dust Queen"},{id:"are-you-gonna-go-my-way",title:"Are You Gonna Go My Way",artist:"Lenny Kravitz",file:"/songs/are-you-gonna-go-my-way.mp3",color:"from-orange-400 to-red-600",emoji:"๐Ÿ›ฃ๏ธ",genre:"Rock",lang:"en",lrcQuery:"Are You Gonna Go My Way Lenny Kravitz"},{id:"behind-blue-eyes",title:"Behind Blue Eyes",artist:"The Who",file:"/songs/behind-blue-eyes-original-album-version.mp3",color:"from-blue-400 to-indigo-600",emoji:"๐Ÿ‘๏ธ",genre:"Classic Rock",lang:"en",lrcQuery:"Behind Blue Eyes The Who"},{id:"black-magic-woman",title:"Black Magic Woman",artist:"Santana",file:"/songs/black-magic-woman-single-version.mp3",color:"from-purple-600 to-indigo-800",emoji:"๐Ÿช„",genre:"Latin Rock",lang:"en",lrcQuery:"Black Magic Woman Santana"},{id:"bohemian-rhapsody",title:"Bohemian Rhapsody",artist:"Queen",file:"/songs/bohemian-rhapsody-remastered-2011.mp3",color:"from-fuchsia-500 to-purple-700",emoji:"๐Ÿ‘‘",genre:"Rock",lang:"en",lrcQuery:"Bohemian Rhapsody Queen"},{id:"born-in-the-usa",title:"Born in the USA",artist:"Bruce Springsteen",file:"/songs/born-in-the-usa.mp3",color:"from-blue-500 to-red-600",emoji:"๐Ÿ‡บ๐Ÿ‡ธ",genre:"Rock",lang:"en",lrcQuery:"Born in the USA Bruce Springsteen"},{id:"californication",title:"Californication",artist:"Red Hot Chili Peppers",file:"/songs/californication.mp3",color:"from-amber-400 to-orange-600",emoji:"๐ŸŒด",genre:"Alternative Rock",lang:"en",lrcQuery:"Californication Red Hot Chili Peppers"},{id:"carry-on-wayward-son",title:"Carry On Wayward Son",artist:"Kansas",file:"/songs/carry-on-wayward-son.mp3",color:"from-amber-500 to-yellow-600",emoji:"๐ŸŒพ",genre:"Progressive Rock",lang:"en",lrcQuery:"Carry On Wayward Son Kansas"},{id:"changes",title:"Changes",artist:"David Bowie",file:"/songs/changes-2013-remaster.mp3",color:"from-teal-400 to-cyan-600",emoji:"๐Ÿฆ‹",genre:"Rock",lang:"en",lrcQuery:"Changes David Bowie"},{id:"come-as-you-are",title:"Come As You Are",artist:"Nirvana",file:"/songs/come-as-you-are.mp3",color:"from-slate-500 to-gray-700",emoji:"๐ŸŒง๏ธ",genre:"Grunge",lang:"en",lrcQuery:"Come As You Are Nirvana"},{id:"come-together",title:"Come Together",artist:"The Beatles",file:"/songs/come-together-remastered-2009.mp3",color:"from-yellow-500 to-amber-600",emoji:"๐Ÿค",genre:"Rock",lang:"en",lrcQuery:"Come Together The Beatles"},{id:"crazy-train",title:"Crazy Train",artist:"Ozzy Osbourne",file:"/songs/crazy-train.mp3",color:"from-red-600 to-orange-700",emoji:"๐Ÿš‚",genre:"Heavy Metal",lang:"en",lrcQuery:"Crazy Train Ozzy Osbourne"},{id:"creep",title:"Creep",artist:"Radiohead",file:"/songs/creep.mp3",color:"from-gray-500 to-slate-700",emoji:"๐Ÿ•ท๏ธ",genre:"Alternative Rock",lang:"en",lrcQuery:"Creep Radiohead"},{id:"detroit-rock-city",title:"Detroit Rock City",artist:"Kiss",file:"/songs/detroit-rock-city.mp3",color:"from-red-600 to-black",emoji:"๐Ÿค˜",genre:"Hard Rock",lang:"en",lrcQuery:"Detroit Rock City Kiss"},{id:"dont-cry",title:"Don't Cry",artist:"Guns N' Roses",file:"/songs/dont-cry-original.mp3",color:"from-rose-400 to-pink-600",emoji:"๐Ÿ˜ข",genre:"Hard Rock",lang:"en",lrcQuery:"Don't Cry Guns N Roses"},{id:"dream-on",title:"Dream On",artist:"Aerosmith",file:"/songs/dream-on.mp3",color:"from-indigo-500 to-purple-700",emoji:"๐Ÿ’ญ",genre:"Hard Rock",lang:"en",lrcQuery:"Dream On Aerosmith"},{id:"dreams",title:"Dreams",artist:"Fleetwood Mac",file:"/songs/dreams-2004-remaster.mp3",color:"from-sky-400 to-blue-600",emoji:"โ˜๏ธ",genre:"Rock",lang:"en",lrcQuery:"Dreams Fleetwood Mac"},{id:"edge-of-seventeen",title:"Edge of Seventeen",artist:"Stevie Nicks",file:"/songs/edge-of-seventeen-2016-remaster.mp3",color:"from-pink-400 to-rose-600",emoji:"๐Ÿฆ…",genre:"Rock",lang:"en",lrcQuery:"Edge of Seventeen Stevie Nicks"},{id:"enter-sandman",title:"Enter Sandman",artist:"Metallica",file:"/songs/enter-sandman.mp3",color:"from-gray-700 to-slate-900",emoji:"๐Ÿ˜ด",genre:"Heavy Metal",lang:"en",lrcQuery:"Enter Sandman Metallica"},{id:"even-flow",title:"Even Flow",artist:"Pearl Jam",file:"/songs/even-flow.mp3",color:"from-emerald-500 to-teal-700",emoji:"๐ŸŒŠ",genre:"Grunge",lang:"en",lrcQuery:"Even Flow Pearl Jam"},{id:"everlong",title:"Everlong",artist:"Foo Fighters",file:"/songs/everlong.mp3",color:"from-blue-500 to-indigo-700",emoji:"โณ",genre:"Alternative Rock",lang:"en",lrcQuery:"Everlong Foo Fighters"},{id:"fly-away",title:"Fly Away",artist:"Lenny Kravitz",file:"/songs/fly-away.mp3",color:"from-cyan-400 to-blue-600",emoji:"โœˆ๏ธ",genre:"Rock",lang:"en",lrcQuery:"Fly Away Lenny Kravitz"},{id:"fortunate-son",title:"Fortunate Son",artist:"Creedence Clearwater Revival",file:"/songs/fortunate-son.mp3",color:"from-green-600 to-emerald-800",emoji:"๐ŸŽ–๏ธ",genre:"Southern Rock",lang:"en",lrcQuery:"Fortunate Son Creedence Clearwater Revival"},{id:"free-bird",title:"Free Bird",artist:"Lynyrd Skynyrd",file:"/songs/free-bird.mp3",color:"from-amber-500 to-orange-700",emoji:"๐Ÿฆ…",genre:"Southern Rock",lang:"en",lrcQuery:"Free Bird Lynyrd Skynyrd"},{id:"golden-years",title:"Golden Years",artist:"David Bowie",file:"/songs/golden-years-2016-remaster.mp3",color:"from-yellow-400 to-amber-600",emoji:"โœจ",genre:"Rock",lang:"en",lrcQuery:"Golden Years David Bowie"},{id:"heroes",title:"Heroes",artist:"David Bowie",file:"/songs/_heroes_-2017-remaster.mp3",color:"from-blue-500 to-cyan-600",emoji:"๐Ÿฆธ",genre:"Rock",lang:"en",lrcQuery:"Heroes David Bowie"},{id:"hotel-california",title:"Hotel California",artist:"Eagles",file:"/songs/hotel-california-2013-remaster.mp3",color:"from-amber-600 to-yellow-700",emoji:"๐Ÿจ",genre:"Classic Rock",lang:"en",lrcQuery:"Hotel California Eagles"},{id:"house-of-the-rising-sun",title:"House of the Rising Sun",artist:"The Animals",file:"/songs/house-of-the-rising-sun.mp3",color:"from-orange-600 to-red-700",emoji:"๐Ÿ ",genre:"Folk Rock",lang:"en",lrcQuery:"House of the Rising Sun The Animals"},{id:"hurricane",title:"Hurricane",artist:"Bob Dylan",file:"/songs/hurricane.mp3",color:"from-stone-500 to-gray-700",emoji:"๐ŸŒ€",genre:"Folk Rock",lang:"en",lrcQuery:"Hurricane Bob Dylan"},{id:"i-cant-get-no-satisfaction",title:"(I Can't Get No) Satisfaction",artist:"The Rolling Stones",file:"/songs/i-cant-get-no-satisfaction-mono.mp3",color:"from-red-500 to-rose-700",emoji:"๐Ÿ˜ค",genre:"Rock",lang:"en",lrcQuery:"Satisfaction Rolling Stones"},{id:"i-love-rock-n-roll",title:"I Love Rock 'n' Roll",artist:"Joan Jett",file:"/songs/i-love-rock-n-roll.mp3",color:"from-red-500 to-pink-600",emoji:"โค๏ธ",genre:"Rock",lang:"en",lrcQuery:"I Love Rock n Roll Joan Jett"},{id:"immigrant-song",title:"Immigrant Song",artist:"Led Zeppelin",file:"/songs/immigrant-song-remaster.mp3",color:"from-amber-600 to-orange-800",emoji:"โš”๏ธ",genre:"Hard Rock",lang:"en",lrcQuery:"Immigrant Song Led Zeppelin"},{id:"iron-man",title:"Iron Man",artist:"Black Sabbath",file:"/songs/iron-man-2012-remaster.mp3",color:"from-gray-600 to-slate-800",emoji:"๐Ÿค–",genre:"Heavy Metal",lang:"en",lrcQuery:"Iron Man Black Sabbath"},{id:"jump",title:"Jump",artist:"Van Halen",file:"/songs/jump-2015-remaster.mp3",color:"from-red-500 to-orange-600",emoji:"โฌ†๏ธ",genre:"Hard Rock",lang:"en",lrcQuery:"Jump Van Halen"},{id:"kickstart-my-heart",title:"Kickstart My Heart",artist:"Mรถtley Crรผe",file:"/songs/kickstart-my-heart.mp3",color:"from-pink-500 to-red-600",emoji:"โค๏ธโ€๐Ÿ”ฅ",genre:"Hard Rock",lang:"en",lrcQuery:"Kickstart My Heart Motley Crue"},{id:"layla",title:"Layla",artist:"Derek and the Dominos",file:"/songs/layla-40th-anniversary-version-_-2010-remastered.mp3",color:"from-rose-500 to-red-700",emoji:"๐Ÿ’”",genre:"Blues Rock",lang:"en",lrcQuery:"Layla Derek and the Dominos"},{id:"livin-on-a-prayer",title:"Livin' on a Prayer",artist:"Bon Jovi",file:"/songs/livin-on-a-prayer.mp3",color:"from-blue-500 to-indigo-600",emoji:"๐Ÿ™",genre:"Rock",lang:"en",lrcQuery:"Livin on a Prayer Bon Jovi"},{id:"losing-my-religion",title:"Losing My Religion",artist:"R.E.M.",file:"/songs/losing-my-religion.mp3",color:"from-teal-500 to-cyan-600",emoji:"โ›ช",genre:"Alternative Rock",lang:"en",lrcQuery:"Losing My Religion REM"},{id:"mama-im-coming-home",title:"Mama I'm Coming Home",artist:"Ozzy Osbourne",file:"/songs/mama-im-coming-home.mp3",color:"from-purple-500 to-violet-700",emoji:"๐Ÿ ",genre:"Heavy Metal",lang:"en",lrcQuery:"Mama I'm Coming Home Ozzy Osbourne"},{id:"mary-janes-last-dance",title:"Mary Jane's Last Dance",artist:"Tom Petty and the Heartbreakers",file:"/songs/mary-janes-last-dance.mp3",color:"from-green-500 to-emerald-600",emoji:"๐ŸŒฟ",genre:"Rock",lang:"en",lrcQuery:"Mary Jane's Last Dance Tom Petty"},{id:"master-of-puppets",title:"Master of Puppets",artist:"Metallica",file:"/songs/master-of-puppets-remastered.mp3",color:"from-slate-600 to-gray-900",emoji:"๐ŸŽญ",genre:"Heavy Metal",lang:"en",lrcQuery:"Master of Puppets Metallica"},{id:"message-in-a-bottle",title:"Message in a Bottle",artist:"The Police",file:"/songs/message-in-a-bottle.mp3",color:"from-cyan-500 to-blue-600",emoji:"๐Ÿพ",genre:"New Wave",lang:"en",lrcQuery:"Message in a Bottle The Police"},{id:"one-way-or-another",title:"One Way or Another",artist:"Blondie",file:"/songs/one-way-or-another-remastered-2001.mp3",color:"from-pink-500 to-fuchsia-600",emoji:"๐Ÿ‘€",genre:"New Wave",lang:"en",lrcQuery:"One Way or Another Blondie"},{id:"paint-it-black",title:"Paint It Black",artist:"The Rolling Stones",file:"/songs/paint-it-black.mp3",color:"from-gray-800 to-black",emoji:"๐Ÿ–ค",genre:"Rock",lang:"en",lrcQuery:"Paint It Black Rolling Stones"},{id:"paranoid",title:"Paranoid",artist:"Black Sabbath",file:"/songs/paranoid-2012-remaster.mp3",color:"from-slate-600 to-gray-800",emoji:"๐Ÿ˜ต",genre:"Heavy Metal",lang:"en",lrcQuery:"Paranoid Black Sabbath"},{id:"psycho-killer",title:"Psycho Killer",artist:"Talking Heads",file:"/songs/psycho-killer-2005-remaster.mp3",color:"from-red-600 to-rose-700",emoji:"๐Ÿ”ช",genre:"New Wave",lang:"en",lrcQuery:"Psycho Killer Talking Heads"},{id:"purple-rain",title:"Purple Rain",artist:"Prince",file:"/songs/purple-rain.mp3",color:"from-purple-500 to-violet-700",emoji:"๐Ÿ’œ",genre:"Rock",lang:"en",lrcQuery:"Purple Rain Prince"},{id:"rock-you-like-a-hurricane",title:"Rock You Like a Hurricane",artist:"Scorpions",file:"/songs/rock-you-like-a-hurricane-2015-remaster.mp3",color:"from-orange-500 to-red-600",emoji:"๐ŸŒ€",genre:"Hard Rock",lang:"en",lrcQuery:"Rock You Like a Hurricane Scorpions"},{id:"runaway",title:"Runaway",artist:"Bon Jovi",file:"/songs/runaway.mp3",color:"from-blue-400 to-indigo-600",emoji:"๐Ÿƒ",genre:"Rock",lang:"en",lrcQuery:"Runaway Bon Jovi"},{id:"say-it-aint-so",title:"Say It Ain't So",artist:"Weezer",file:"/songs/say-it-aint-so.mp3",color:"from-sky-500 to-blue-600",emoji:"๐ŸŒŠ",genre:"Alternative Rock",lang:"en",lrcQuery:"Say It Ain't So Weezer"},{id:"seven-nation-army",title:"Seven Nation Army",artist:"The White Stripes",file:"/songs/seven-nation-army.mp3",color:"from-red-600 to-rose-700",emoji:"โš”๏ธ",genre:"Garage Rock",lang:"en",lrcQuery:"Seven Nation Army The White Stripes"},{id:"sharp-dressed-man",title:"Sharp Dressed Man",artist:"ZZ Top",file:"/songs/sharp-dressed-man-2008-remaster.mp3",color:"from-slate-500 to-gray-700",emoji:"๐Ÿ‘”",genre:"Blues Rock",lang:"en",lrcQuery:"Sharp Dressed Man ZZ Top"},{id:"should-i-stay-or-should-i-go",title:"Should I Stay or Should I Go",artist:"The Clash",file:"/songs/should-i-stay-or-should-i-go-remastered.mp3",color:"from-yellow-500 to-amber-600",emoji:"๐Ÿค”",genre:"Punk Rock",lang:"en",lrcQuery:"Should I Stay or Should I Go The Clash"},{id:"smoke-on-the-water",title:"Smoke on the Water",artist:"Deep Purple",file:"/songs/smoke-on-the-water.mp3",color:"from-purple-600 to-indigo-800",emoji:"๐Ÿ’จ",genre:"Hard Rock",lang:"en",lrcQuery:"Smoke on the Water Deep Purple"},{id:"stairway-to-heaven",title:"Stairway to Heaven",artist:"Led Zeppelin",file:"/songs/stairway-to-heaven-remaster.mp3",color:"from-amber-500 to-yellow-700",emoji:"๐Ÿชœ",genre:"Hard Rock",lang:"en",lrcQuery:"Stairway to Heaven Led Zeppelin"},{id:"starman",title:"Starman",artist:"David Bowie",file:"/songs/starman-2012-remaster.mp3",color:"from-indigo-400 to-purple-600",emoji:"โญ",genre:"Rock",lang:"en",lrcQuery:"Starman David Bowie"},{id:"sultans-of-swing",title:"Sultans of Swing",artist:"Dire Straits",file:"/songs/sultans-of-swing.mp3",color:"from-amber-600 to-orange-700",emoji:"๐ŸŽบ",genre:"Rock",lang:"en",lrcQuery:"Sultans of Swing Dire Straits"},{id:"sunshine-of-your-love",title:"Sunshine of Your Love",artist:"Cream",file:"/songs/sunshine-of-your-love.mp3",color:"from-yellow-500 to-orange-600",emoji:"โ˜€๏ธ",genre:"Blues Rock",lang:"en",lrcQuery:"Sunshine of Your Love Cream"},{id:"sweet-child-o-mine",title:"Sweet Child O' Mine",artist:"Guns N' Roses",file:"/songs/sweet-child-o-mine.mp3",color:"from-rose-500 to-pink-600",emoji:"๐Ÿ‘ถ",genre:"Hard Rock",lang:"en",lrcQuery:"Sweet Child O Mine Guns N Roses"},{id:"sweet-home-alabama",title:"Sweet Home Alabama",artist:"Lynyrd Skynyrd",file:"/songs/sweet-home-alabama.mp3",color:"from-red-500 to-amber-600",emoji:"๐Ÿ ",genre:"Southern Rock",lang:"en",lrcQuery:"Sweet Home Alabama Lynyrd Skynyrd"},{id:"the-chain",title:"The Chain",artist:"Fleetwood Mac",file:"/songs/the-chain.mp3",color:"from-slate-500 to-gray-700",emoji:"โ›“๏ธ",genre:"Rock",lang:"en",lrcQuery:"The Chain Fleetwood Mac"},{id:"thunderstruck",title:"Thunderstruck",artist:"AC/DC",file:"/songs/thunderstruck.mp3",color:"from-yellow-500 to-amber-700",emoji:"โšก",genre:"Hard Rock",lang:"en",lrcQuery:"Thunderstruck AC/DC"},{id:"tom-sawyer",title:"Tom Sawyer",artist:"Rush",file:"/songs/tom-sawyer.mp3",color:"from-blue-600 to-indigo-800",emoji:"๐Ÿ“–",genre:"Progressive Rock",lang:"en",lrcQuery:"Tom Sawyer Rush"},{id:"under-pressure",title:"Under Pressure",artist:"Queen & David Bowie",file:"/songs/under-pressure-remastered-2011.mp3",color:"from-blue-500 to-purple-600",emoji:"๐ŸŽญ",genre:"Rock",lang:"en",lrcQuery:"Under Pressure Queen David Bowie"},{id:"until-it-sleeps",title:"Until It Sleeps",artist:"Metallica",file:"/songs/until-it-sleeps-remastered.mp3",color:"from-gray-600 to-slate-800",emoji:"๐Ÿ˜ด",genre:"Heavy Metal",lang:"en",lrcQuery:"Until It Sleeps Metallica"},{id:"uprising",title:"Uprising",artist:"Muse",file:"/songs/uprising.mp3",color:"from-red-600 to-orange-700",emoji:"๐Ÿ”ฅ",genre:"Alternative Rock",lang:"en",lrcQuery:"Uprising Muse"},{id:"welcome-to-the-jungle",title:"Welcome to the Jungle",artist:"Guns N' Roses",file:"/songs/welcome-to-the-jungle.mp3",color:"from-green-600 to-emerald-800",emoji:"๐ŸŒด",genre:"Hard Rock",lang:"en",lrcQuery:"Welcome to the Jungle Guns N Roses"},{id:"where-is-my-mind",title:"Where Is My Mind?",artist:"Pixies",file:"/songs/where-is-my-mind_-2007-remaster.mp3",color:"from-violet-500 to-purple-700",emoji:"๐Ÿง ",genre:"Alternative Rock",lang:"en",lrcQuery:"Where Is My Mind Pixies"},{id:"white-wedding",title:"White Wedding (Pt. 1)",artist:"Billy Idol",file:"/songs/white-wedding-pt-1.mp3",color:"from-white to-gray-400",emoji:"๐Ÿ‘ฐ",genre:"New Wave",lang:"en",lrcQuery:"White Wedding Billy Idol"},{id:"whole-lotta-love",title:"Whole Lotta Love",artist:"Led Zeppelin",file:"/songs/whole-lotta-love-1990-remaster.mp3",color:"from-rose-500 to-red-700",emoji:"โค๏ธ",genre:"Hard Rock",lang:"en",lrcQuery:"Whole Lotta Love Led Zeppelin"},{id:"wish-you-were-here",title:"Wish You Were Here",artist:"Pink Floyd",file:"/songs/wish-you-were-here.mp3",color:"from-cyan-500 to-blue-600",emoji:"๐ŸŒŸ",genre:"Progressive Rock",lang:"en",lrcQuery:"Wish You Were Here Pink Floyd"},{id:"wonderwall",title:"Wonderwall",artist:"Oasis",file:"/songs/wonderwall-remastered.mp3",color:"from-amber-400 to-yellow-600",emoji:"๐Ÿงฑ",genre:"Britpop",lang:"en",lrcQuery:"Wonderwall Oasis"},{id:"you-really-got-me",title:"You Really Got Me",artist:"The Kinks",file:"/songs/you-really-got-me-2015-remaster.mp3",color:"from-orange-500 to-red-600",emoji:"๐ŸŽธ",genre:"British Invasion",lang:"en",lrcQuery:"You Really Got Me The Kinks"},{id:"you-shook-me-all-night-long",title:"You Shook Me All Night Long",artist:"AC/DC",file:"/songs/you-shook-me-all-night-long.mp3",color:"from-red-500 to-yellow-600",emoji:"๐Ÿค˜",genre:"Hard Rock",lang:"en",lrcQuery:"You Shook Me All Night Long AC/DC"},{id:"zombie",title:"Zombie",artist:"The Cranberries",file:"/songs/zombie.mp3",color:"from-green-600 to-teal-700",emoji:"๐ŸงŸ",genre:"Alternative Rock",lang:"en",lrcQuery:"Zombie The Cranberries"},{id:"obsesion",title:"Obsesion",artist:"Aventura",file:"/songs/obsesion.mp3",color:"from-rose-500 to-pink-700",emoji:"๐Ÿ’”",genre:"Bachata",lang:"es",lrcQuery:"Obsesion Aventura"},{id:"aventura-song",title:"Aventura",artist:"Aventura",file:"/songs/aventura.mp3",color:"from-rose-400 to-pink-600",emoji:"๐Ÿ’•",genre:"Bachata",lang:"es",lrcQuery:"Aventura Aventura"},{id:"ella-y-yo",title:"Ella Y Yo",artist:"Aventura ft. Don Omar",file:"/songs/ella_y_yo-featuring_don_omar.mp3",color:"from-fuchsia-500 to-pink-700",emoji:"๐Ÿ’‘",genre:"Bachata",lang:"es",lrcQuery:"Ella Y Yo Aventura Don Omar"},{id:"dile",title:"Dile",artist:"Don Omar",file:"/songs/dile.mp3",color:"from-amber-500 to-orange-600",emoji:"๐Ÿ—ฃ๏ธ",genre:"Reggaeton",lang:"es",lrcQuery:"Dile Don Omar"},{id:"pobre-diabla",title:"Pobre Diabla",artist:"Don Omar",file:"/songs/pobre_diabla.mp3",color:"from-red-500 to-rose-700",emoji:"๐Ÿ˜ˆ",genre:"Reggaeton",lang:"es",lrcQuery:"Pobre Diabla Don Omar"},{id:"hasta-abajo",title:"Hasta Abajo",artist:"Don Omar",file:"/songs/hasta_abajo.mp3",color:"from-orange-500 to-red-600",emoji:"โฌ‡๏ธ",genre:"Reggaeton",lang:"es",lrcQuery:"Hasta Abajo Don Omar"},{id:"salio-el-sol",title:"Salio El Sol",artist:"Don Omar",file:"/songs/salio_el_sol.mp3",color:"from-yellow-400 to-amber-600",emoji:"โ˜€๏ธ",genre:"Reggaeton",lang:"es",lrcQuery:"Salio El Sol Don Omar"},{id:"ella-me-levanto",title:"Ella Me Levanto",artist:"Daddy Yankee",file:"/songs/ella_me_levanto.mp3",color:"from-violet-500 to-purple-700",emoji:"๐Ÿ”ฅ",genre:"Reggaeton",lang:"es",lrcQuery:"Ella Me Levanto Daddy Yankee"},{id:"llamado-de-emergencia",title:"Llamado de Emergencia",artist:"Daddy Yankee",file:"/songs/llamado_de_emergencia.mp3",color:"from-red-600 to-rose-800",emoji:"๐Ÿšจ",genre:"Reggaeton",lang:"es",lrcQuery:"Llamado de Emergencia Daddy Yankee"},{id:"pasarela",title:"Pasarela",artist:"Daddy Yankee",file:"/songs/pasarela.mp3",color:"from-pink-400 to-fuchsia-600",emoji:"๐Ÿ‘ ",genre:"Reggaeton",lang:"es",lrcQuery:"Pasarela Daddy Yankee"},{id:"soy-una-gargola",title:"Soy una Gargola",artist:"Daddy Yankee",file:"/songs/soy_una_gargola.mp3",color:"from-slate-500 to-gray-700",emoji:"๐Ÿ—ฟ",genre:"Reggaeton",lang:"es",lrcQuery:"Soy una Gargola Daddy Yankee"},{id:"rakata",title:"Rakata",artist:"Wisin y Yandel",file:"/songs/rakata.mp3",color:"from-amber-600 to-orange-800",emoji:"๐Ÿ’ฅ",genre:"Reggaeton",lang:"es",lrcQuery:"Rakata Wisin y Yandel"},{id:"mayor-que-yo",title:"Mayor Que Yo",artist:"Wisin & Yandel, Daddy Yankee, Tego",file:"/songs/mayor_que_yo.mp3",color:"from-red-500 to-orange-600",emoji:"๐Ÿ‘‘",genre:"Reggaeton",lang:"es",lrcQuery:"Mayor Que Yo Wisin Yandel"},{id:"si-no-le-contesto",title:"Si No Le Contesto",artist:"Plan B",file:"/songs/si_no_le_contesto.mp3",color:"from-indigo-500 to-violet-700",emoji:"๐Ÿ“ต",genre:"Reggaeton",lang:"es",lrcQuery:"Si No Le Contesto Plan B"},{id:"ella-se-contradice",title:"Ella Se Contradice",artist:"Baby Rasta y Gringo ft. Plan B",file:"/songs/ella_se_contradice_feat_plan_b.mp3",color:"from-pink-500 to-rose-700",emoji:"๐Ÿ”„",genre:"Reggaeton",lang:"es",lrcQuery:"Ella Se Contradice Baby Rasta Gringo Plan B"},{id:"siente-el-boom",title:"Siente El Boom",artist:"Tito El Bambino",file:"/songs/siente_el_boom.mp3",color:"from-emerald-500 to-teal-700",emoji:"๐Ÿ’ฃ",genre:"Reggaeton",lang:"es",lrcQuery:"Siente El Boom Tito El Bambino"},{id:"mi-cama-huele-a-ti",title:"Mi Cama Huele a Ti",artist:"Tito El Bambino",file:"/songs/mi_cama_huele_a_ti.mp3",color:"from-rose-400 to-red-600",emoji:"๐Ÿ›๏ธ",genre:"Reggaeton",lang:"es",lrcQuery:"Mi Cama Huele a Ti Tito El Bambino"},{id:"pa-que-retozen",title:"Pa' Que Retozen",artist:"Tego Calderon",file:"/songs/pa_que_retozen.mp3",color:"from-lime-500 to-green-700",emoji:"๐ŸŽถ",genre:"Reggaeton",lang:"es",lrcQuery:"Pa Que Retozen Tego Calderon"},{id:"yo-voy",title:"Yo Voy",artist:"Zion y Lennox ft. Daddy Yankee",file:"/songs/yo_voy_feat_daddy_yankee.mp3",color:"from-cyan-500 to-blue-700",emoji:"๐Ÿš€",genre:"Reggaeton",lang:"es",lrcQuery:"Yo Voy Zion Lennox Daddy Yankee"},{id:"cuentale",title:"Cuentale",artist:"Don Omar",file:"/songs/cuentale.mp3",color:"from-teal-400 to-cyan-600",emoji:"๐Ÿ’ฌ",genre:"Reggaeton",lang:"es",lrcQuery:"Cuentale Don Omar"},{id:"donde-estan-las-gatas",title:"Donde Estan las Gatas",artist:"Arcangel",file:"/songs/donde_estan_las_gatas.mp3",color:"from-yellow-500 to-orange-600",emoji:"๐Ÿฑ",genre:"Reggaeton",lang:"es",lrcQuery:"Donde Estan las Gatas"},{id:"me-voy-pal-party",title:"Me Voy Pa'l Party",artist:"Daddy Yankee",file:"/songs/me_voy_pal_party.mp3",color:"from-fuchsia-400 to-purple-600",emoji:"๐ŸŽ‰",genre:"Reggaeton",lang:"es",lrcQuery:"Me Voy Pal Party"},{id:"lento-lento-lento",title:"Lento Lento Lento",artist:"Don Omar",file:"/songs/lento_lento_lento.mp3",color:"from-rose-500 to-pink-700",emoji:"๐ŸŒ",genre:"Reggaeton",lang:"es",lrcQuery:"Lento Don Omar"},{id:"por-que-te-demoras",title:"Por Que Te Demoras",artist:"Reggaeton Classic",file:"/songs/por_que_te_demoras_.mp3",color:"from-orange-400 to-amber-600",emoji:"โฐ",genre:"Reggaeton",lang:"es",lrcQuery:"Por Que Te Demoras"},{id:"sexo-violencia-y-llantas",title:"Sexo Violencia y Llantas",artist:"Reggaeton Classic",file:"/songs/sexo_violencia_y_llantas.mp3",color:"from-red-600 to-rose-800",emoji:"๐Ÿ”ž",genre:"Perreo",lang:"es",lrcQuery:"Sexo Violencia y Llantas"},{id:"las-de-la-intuicion",title:"Las de la Intuicion",artist:"Shakira",file:"/songs/las_de_la_intuicion.mp3",color:"from-amber-400 to-yellow-600",emoji:"๐Ÿ’ƒ",genre:"Pop Latino",lang:"es",lrcQuery:"Las de la Intuicion Shakira"},{id:"de-madruga",title:"De Madruga",artist:"Haze",file:"/songs/de_madruga.mp3",color:"from-indigo-400 to-blue-600",emoji:"๐ŸŒ™",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"De Madruga Haze"},{id:"dios-es-un-stalker",title:"Dios Es Un Stalker",artist:"Yung Beef",file:"/songs/dios_es_un_stalker.mp3",color:"from-violet-600 to-purple-800",emoji:"๐Ÿ‘๏ธ",genre:"Urbano Espaรฑol",lang:"es",lrcQuery:"Dios Es Un Stalker"},{id:"divinize",title:"Divinize",artist:"Divinize",file:"/songs/divinize.mp3",color:"from-cyan-400 to-teal-600",emoji:"โœจ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Divinize"},{id:"la-rumba-del-perdon",title:"La Rumba Del Perdon",artist:"Rumba Flamenca",file:"/songs/la_rumba_del_perdon.mp3",color:"from-orange-500 to-red-600",emoji:"๐ŸŽถ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"La Rumba Del Perdon"},{id:"la-yugular",title:"La Yugular",artist:"Rap Espaรฑol",file:"/songs/la_yugular.mp3",color:"from-gray-600 to-slate-800",emoji:"๐ŸŽค",genre:"Urbano Espaรฑol",lang:"es",lrcQuery:"La Yugular"},{id:"magnolias",title:"Magnolias",artist:"Indie Espaรฑol",file:"/songs/magnolias.mp3",color:"from-pink-300 to-rose-500",emoji:"๐ŸŒบ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Magnolias"},{id:"memoria",title:"Memoria",artist:"Artista",file:"/songs/memoria.mp3",color:"from-blue-400 to-indigo-600",emoji:"๐Ÿง ",genre:"Pop Latino",lang:"es",lrcQuery:"Memoria"},{id:"mundo-nuevo",title:"Mundo Nuevo",artist:"Latin Pop",file:"/songs/mundo_nuevo.mp3",color:"from-emerald-400 to-green-600",emoji:"๐ŸŒ",genre:"Pop Latino",lang:"es",lrcQuery:"Mundo Nuevo"},{id:"no-es-culpa-mia",title:"No Es Culpa Mia",artist:"Pop Espaรฑol",file:"/songs/no_es_culpa_mia-bonus_track.mp3",color:"from-rose-300 to-pink-500",emoji:"๐Ÿคท",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"No Es Culpa Mia"},{id:"purpurina",title:"Purpurina",artist:"Indie Espaรฑol",file:"/songs/purpurina.mp3",color:"from-fuchsia-400 to-violet-600",emoji:"โœจ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Purpurina"},{id:"reliquia",title:"Reliquia",artist:"Artista",file:"/songs/reliquia.mp3",color:"from-amber-500 to-orange-700",emoji:"๐Ÿบ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Reliquia"},{id:"sauvignon-blanc",title:"Sauvignon Blanc",artist:"Indie Latino",file:"/songs/sauvignon_blanc.mp3",color:"from-lime-400 to-emerald-600",emoji:"๐Ÿท",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Sauvignon Blanc"},{id:"rosas",title:"Rosas",artist:"La Oreja de Van Gogh",file:"/songs/rosas.mp3",color:"from-rose-400 to-pink-600",emoji:"๐ŸŒน",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Rosas La Oreja de Van Gogh"},{id:"marta-sebas-guille",title:"Marta, Sebas, Guille y los demas",artist:"Amaral",file:"/songs/marta_sebas_guille.mp3",color:"from-amber-400 to-orange-600",emoji:"๐Ÿ‘ซ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Marta Sebas Guille Amaral"},{id:"gritando-en-braille",title:"Gritando en Braille",artist:"Depresion Sonora",file:"/songs/gritando_en_braille.mp3",color:"from-slate-500 to-gray-700",emoji:"๐Ÿ“–",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Gritando en Braille"},{id:"kora",title:"Kora",artist:"Artista Espaรฑol",file:"/songs/kora.mp3",color:"from-teal-400 to-cyan-600",emoji:"๐ŸŽถ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Kora"},{id:"gente",title:"Gente",artist:"J Balvin",file:"/songs/gente.mp3",color:"from-yellow-400 to-amber-600",emoji:"๐Ÿ™Œ",genre:"Reggaeton",lang:"es",lrcQuery:"Mi Gente J Balvin"},{id:"unwritten",title:"Unwritten",artist:"Natasha Bedingfield",file:"/songs/unwritten.mp3",color:"from-sky-400 to-blue-600",emoji:"โœ๏ธ",genre:"Pop",lang:"en",lrcQuery:"Unwritten Natasha Bedingfield"},{id:"drag-me-down",title:"Drag Me Down",artist:"One Direction",file:"/songs/drag_me_down.mp3",color:"from-red-400 to-rose-600",emoji:"โฌ‡๏ธ",genre:"Pop",lang:"en",lrcQuery:"Drag Me Down One Direction"},{id:"steal-my-girl",title:"Steal My Girl",artist:"One Direction",file:"/songs/steal_my_girl.mp3",color:"from-pink-400 to-rose-600",emoji:"๐Ÿ’˜",genre:"Pop",lang:"en",lrcQuery:"Steal My Girl One Direction"},{id:"if-i-could-fly",title:"If I Could Fly",artist:"One Direction",file:"/songs/if_i_could_fly.mp3",color:"from-sky-300 to-blue-500",emoji:"๐Ÿ•Š๏ธ",genre:"Pop",lang:"en",lrcQuery:"If I Could Fly One Direction"},{id:"you-and-i-1d",title:"You & I",artist:"One Direction",file:"/songs/you_and_i.mp3",color:"from-violet-400 to-purple-600",emoji:"๐Ÿ’‘",genre:"Pop",lang:"en",lrcQuery:"You And I One Direction"},{id:"eighteen",title:"18",artist:"One Direction",file:"/songs/eighteen.mp3",color:"from-amber-400 to-orange-600",emoji:"๐Ÿ”ž",genre:"Pop",lang:"en",lrcQuery:"18 One Direction"},{id:"olivia-1d",title:"Olivia",artist:"One Direction",file:"/songs/olivia.mp3",color:"from-emerald-400 to-teal-600",emoji:"๐Ÿซ’",genre:"Pop",lang:"en",lrcQuery:"Olivia One Direction"},{id:"make-you-mine",title:"Make You Mine",artist:"PUBLIC",file:"/songs/make_you_mine.mp3",color:"from-pink-300 to-rose-500",emoji:"๐Ÿ’•",genre:"Pop",lang:"en",lrcQuery:"Make You Mine PUBLIC"},{id:"drivers-license",title:"Drivers License",artist:"Olivia Rodrigo",file:"/songs/drivers_license.mp3",color:"from-slate-400 to-gray-600",emoji:"๐Ÿš—",genre:"Pop",lang:"en",lrcQuery:"drivers license Olivia Rodrigo"},{id:"what-a-time",title:"What A Time",artist:"Julia Michaels ft. Niall Horan",file:"/songs/what_a_time.mp3",color:"from-amber-300 to-yellow-500",emoji:"โฐ",genre:"Pop",lang:"en",lrcQuery:"What A Time Julia Michaels"},{id:"bad-day",title:"Bad Day",artist:"Daniel Powter",file:"/songs/bad_day.mp3",color:"from-gray-400 to-slate-600",emoji:"๐Ÿ˜ž",genre:"Pop",lang:"en",lrcQuery:"Bad Day Daniel Powter"},{id:"hey-soul-sister",title:"Hey, Soul Sister",artist:"Train",file:"/songs/hey_soul_sister.mp3",color:"from-yellow-400 to-amber-600",emoji:"โœŒ๏ธ",genre:"Pop",lang:"en",lrcQuery:"Hey Soul Sister Train"},{id:"mamma-mia",title:"Mamma Mia",artist:"ABBA",file:"/songs/mamma_mia.mp3",color:"from-blue-400 to-indigo-600",emoji:"๐Ÿ‡ธ๐Ÿ‡ช",genre:"Pop",lang:"en",lrcQuery:"Mamma Mia ABBA"},{id:"dancing-queen",title:"Dancing Queen",artist:"ABBA",file:"/songs/dancing_queen.mp3",color:"from-yellow-300 to-amber-500",emoji:"๐Ÿ‘‘",genre:"Pop",lang:"en",lrcQuery:"Dancing Queen ABBA"},{id:"ave-maria",title:"Ave Maria",artist:"David Bisbal",file:"/songs/ave_maria.mp3",color:"from-amber-500 to-orange-700",emoji:"๐Ÿ™",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Ave Maria David Bisbal"},{id:"no-importa-que-llueva",title:"No Importa Que Llueva",artist:"Efecto Pasillo",file:"/songs/no_importa_que_llueva.mp3",color:"from-sky-400 to-blue-600",emoji:"๐ŸŒง๏ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"No importa que llueva"},{id:"volvera",title:"Volvera",artist:"El Canto del Loco",file:"/songs/volvera.mp3",color:"from-red-400 to-rose-600",emoji:"๐Ÿ”„",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Volvera El Canto del Loco"},{id:"caminando-por-la-vida",title:"Caminando por la Vida",artist:"Melendi",file:"/songs/caminando_por_la_vida.mp3",color:"from-green-400 to-emerald-600",emoji:"๐Ÿšถ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Caminando por la vida Melendi"},{id:"princesas",title:"Princesas",artist:"Pereza",file:"/songs/princesas.mp3",color:"from-pink-300 to-rose-500",emoji:"๐Ÿ‘ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Princesas Pereza"},{id:"devuelveme-a-mi-chica",title:"Devuelveme a Mi Chica",artist:"Hombres G",file:"/songs/devuelveme_a_mi_chica.mp3",color:"from-yellow-400 to-orange-500",emoji:"๐Ÿ’”",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Devuelveme a mi chica Hombres G"},{id:"cometas-por-el-cielo",title:"Cometas por el Cielo",artist:"Amaral",file:"/songs/cometas_por_el_cielo.mp3",color:"from-indigo-400 to-violet-600",emoji:"โ˜„๏ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Cometas por el Cielo Amaral"},{id:"no-podiamos-ser-agua",title:"No Podiamos Ser Agua",artist:"Artista Espaรฑol",file:"/songs/no_podiamos_ser_agua.mp3",color:"from-cyan-400 to-blue-600",emoji:"๐Ÿ’ง",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"No podiamos ser agua"},{id:"en-el-mundo-genial",title:"En el Mundo Genial de las Cosas Que Dices",artist:"Artista Espaรฑol",file:"/songs/en_el_mundo_genial.mp3",color:"from-purple-400 to-violet-600",emoji:"๐ŸŒŽ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"En el mundo genial de las cosas que dices"},{id:"cien-gaviotas",title:"Cien Gaviotas",artist:"Duncan Dhu",file:"/songs/cien_gaviotas.mp3",color:"from-sky-300 to-cyan-500",emoji:"๐Ÿฆ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Cien Gaviotas Duncan Dhu"},{id:"antes-de-que-cuente-diez",title:"Antes de Que Cuente Diez",artist:"Fito y Fitipaldis",file:"/songs/antes_de_que_cuente_diez.mp3",color:"from-orange-400 to-red-600",emoji:"๐Ÿ”Ÿ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Antes de que cuente diez Fito y Fitipaldis"},{id:"la-casa-por-el-tejado",title:"La Casa por el Tejado",artist:"Fito y Fitipaldis",file:"/songs/la_casa_por_el_tejado.mp3",color:"from-amber-400 to-orange-600",emoji:"๐Ÿ ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"La casa por el tejado Fito y Fitipaldis"},{id:"por-la-boca-vive-el-pez",title:"Por la Boca Vive el Pez",artist:"Fito y Fitipaldis",file:"/songs/por_la_boca_vive_el_pez.mp3",color:"from-teal-400 to-cyan-600",emoji:"๐ŸŸ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Por la boca vive el pez Fito y Fitipaldis"},{id:"lagrimas-desordenadas",title:"Lagrimas Desordenadas",artist:"Melendi",file:"/songs/lagrimas_desordenadas.mp3",color:"from-blue-400 to-indigo-600",emoji:"๐Ÿ˜ข",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Lagrimas desordenadas Melendi"},{id:"pan-y-mantequilla",title:"Pan y Mantequilla",artist:"Efecto Pasillo",file:"/songs/pan_y_mantequilla.mp3",color:"from-yellow-300 to-amber-500",emoji:"๐Ÿž",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Pan y mantequilla Efecto Pasillo"},{id:"tal-como-eres",title:"Tal Como Eres",artist:"Artista Espaรฑol",file:"/songs/tal_como_eres.mp3",color:"from-rose-400 to-pink-600",emoji:"๐Ÿซถ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Tal como eres"},{id:"te-voy-a-esperar",title:"Te Voy a Esperar",artist:"Cali y El Dandee ft. Belinda",file:"/songs/te_voy_a_esperar.mp3",color:"from-pink-400 to-rose-600",emoji:"โณ",genre:"Pop Latino",lang:"es",lrcQuery:"Te Voy a Esperar Cali y El Dandee"},{id:"entre-la-playa",title:"Entre la Playa Ella y Yo",artist:"Artista Latino",file:"/songs/entre_la_playa.mp3",color:"from-cyan-300 to-blue-500",emoji:"๐Ÿ–๏ธ",genre:"Pop Latino",lang:"es",lrcQuery:"Entre la playa ella y yo"},{id:"yo-te-esperare",title:"Yo Te Esperare",artist:"Cali y El Dandee",file:"/songs/yo_te_esperare.mp3",color:"from-violet-400 to-purple-600",emoji:"๐Ÿ’œ",genre:"Pop Latino",lang:"es",lrcQuery:"Yo Te Esperare Cali y El Dandee"},{id:"te-pintaron-pajaritos",title:"Te Pintaron Pajaritos",artist:"Yandar y Yostin",file:"/songs/te_pintaron_pajaritos.mp3",color:"from-green-400 to-teal-600",emoji:"๐Ÿฆ",genre:"Pop Latino",lang:"es",lrcQuery:"Te Pintaron Pajaritos"},{id:"ella-no-sigue-modas",title:"Ella No Sigue Modas",artist:"Juan Magan",file:"/songs/ella_no_sigue_modas.mp3",color:"from-fuchsia-400 to-pink-600",emoji:"๐Ÿ’ƒ",genre:"Pop Latino",lang:"es",lrcQuery:"Ella No Sigue Modas Juan Magan"},{id:"mi-reina",title:"Mi Reina",artist:"Artista Latino",file:"/songs/mi_reina.mp3",color:"from-amber-400 to-yellow-600",emoji:"๐Ÿ‘‘",genre:"Pop Latino",lang:"es",lrcQuery:"Mi Reina"},{id:"princesa-de-mi-cuento",title:"Princesa de Mi Cuento",artist:"Artista Latino",file:"/songs/princesa_de_mi_cuento.mp3",color:"from-pink-300 to-rose-500",emoji:"๐Ÿ“–",genre:"Pop Latino",lang:"es",lrcQuery:"Princesa de mi cuento"},{id:"16-anitos",title:"16 Anitos",artist:"Dani Martin",file:"/songs/16_anitos.mp3",color:"from-orange-400 to-red-600",emoji:"๐ŸŽ‚",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"16 Aรฑitos Dani Martin"},{id:"cuando-suba-la-marea",title:"Cuando Suba la Marea",artist:"Amaral",file:"/songs/cuando_suba_la_marea.mp3",color:"from-blue-300 to-indigo-500",emoji:"๐ŸŒŠ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Cuando Suba la Marea Amaral"},{id:"los-charcos",title:"Los Charcos",artist:"Dani Martin",file:"/songs/los_charcos.mp3",color:"from-cyan-400 to-teal-600",emoji:"๐Ÿ’ฆ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Los Charcos Dani Martin"},{id:"hijos-de-un-mismo-dios",title:"Hijos de un Mismo Dios",artist:"Macaco",file:"/songs/hijos_de_un_mismo_dios.mp3",color:"from-green-400 to-emerald-600",emoji:"๐ŸŒ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Hijos de un mismo dios Macaco"},{id:"por-la-raja-de-tu-falda",title:"Por la Raja de Tu Falda",artist:"Estopa",file:"/songs/por_la_raja_de_tu_falda.mp3",color:"from-red-500 to-orange-600",emoji:"๐Ÿ”ฅ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Por la raja de tu falda Estopa"},{id:"mi-princesa",title:"Mi Princesa",artist:"David Bisbal",file:"/songs/mi_princesa.mp3",color:"from-rose-400 to-pink-600",emoji:"๐Ÿ‘ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Mi Princesa David Bisbal"},{id:"la-cancion",title:"La Cancion",artist:"J Balvin & Bad Bunny",file:"/songs/la_cancion.mp3",color:"from-yellow-400 to-orange-600",emoji:"๐ŸŽต",genre:"Reggaeton",lang:"es",lrcQuery:"La Cancion J Balvin Bad Bunny"},{id:"peter-pan",title:"Peter Pan",artist:"El Canto del Loco",file:"/songs/peter_pan.mp3",color:"from-green-300 to-teal-500",emoji:"๐Ÿงš",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Peter Pan El Canto del Loco"},{id:"que-bonita-la-vida",title:"Que Bonita la Vida",artist:"Artista Espaรฑol",file:"/songs/que_bonita_la_vida.mp3",color:"from-yellow-300 to-amber-500",emoji:"๐ŸŒป",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Que bonita la vida"},{id:"emocional",title:"Emocional",artist:"Dani Martin",file:"/songs/emocional.mp3",color:"from-purple-400 to-violet-600",emoji:"๐Ÿ’œ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Emocional Dani Martin"},{id:"la-promesa",title:"La Promesa",artist:"Melendi",file:"/songs/la_promesa.mp3",color:"from-indigo-400 to-blue-600",emoji:"๐Ÿค",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"La promesa Melendi"},{id:"por-quererte",title:"Por Quererte",artist:"Artista Espaรฑol",file:"/songs/por_quererte.mp3",color:"from-rose-300 to-pink-500",emoji:"โค๏ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Por quererte"},{id:"no-me-crees",title:"No Me Crees",artist:"Artista Espaรฑol",file:"/songs/no_me_crees.mp3",color:"from-gray-400 to-slate-600",emoji:"๐Ÿ™„",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"No me crees"},{id:"besos",title:"Besos",artist:"El Canto del Loco",file:"/songs/besos.mp3",color:"from-red-400 to-rose-600",emoji:"๐Ÿ’‹",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Besos El Canto del Loco"},{id:"tu-jardin-con-enanitos",title:"Tu Jardin con Enanitos",artist:"Melendi",file:"/songs/tu_jardin_con_enanitos.mp3",color:"from-green-300 to-emerald-500",emoji:"๐Ÿ„",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Tu jardin con enanitos Melendi"},{id:"zapatillas",title:"Zapatillas",artist:"El Canto del Loco",file:"/songs/zapatillas.mp3",color:"from-blue-400 to-indigo-600",emoji:"๐Ÿ‘Ÿ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Zapatillas El Canto del Loco"},{id:"inmortal",title:"Inmortal",artist:"Artista Espaรฑol",file:"/songs/inmortal.mp3",color:"from-violet-400 to-purple-600",emoji:"โ™พ๏ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Inmortal"},{id:"inmortales",title:"Inmortales",artist:"Artista Espaรฑol",file:"/songs/inmortales.mp3",color:"from-amber-400 to-orange-600",emoji:"๐ŸŒŸ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Inmortales"},{id:"limon-y-sal",title:"Limon y Sal",artist:"Julieta Venegas",file:"/songs/limon_y_sal.mp3",color:"from-lime-400 to-green-600",emoji:"๐Ÿ‹",genre:"Pop Latino",lang:"es",lrcQuery:"Limon y Sal Julieta Venegas"},{id:"20-de-enero",title:"20 de Enero",artist:"La Oreja de Van Gogh",file:"/songs/20_de_enero.mp3",color:"from-blue-300 to-indigo-500",emoji:"โ„๏ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"20 de Enero La Oreja de Van Gogh"},{id:"el-universo-sobre-mi",title:"El Universo Sobre Mi",artist:"Amaral",file:"/songs/el_universo_sobre_mi.mp3",color:"from-indigo-400 to-violet-600",emoji:"๐ŸŒŒ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"El universo sobre mi Amaral"},{id:"la-playa",title:"La Playa",artist:"La Oreja de Van Gogh",file:"/songs/la_playa.mp3",color:"from-cyan-300 to-blue-500",emoji:"๐Ÿ–๏ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"La Playa La Oreja de Van Gogh"},{id:"lady-madrid",title:"Lady Madrid",artist:"Pereza",file:"/songs/lady_madrid.mp3",color:"from-red-400 to-orange-600",emoji:"๐Ÿ‡ช๐Ÿ‡ธ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Lady Madrid Pereza"},{id:"como-camaron",title:"Como Camaron",artist:"Estopa",file:"/songs/como_camaron.mp3",color:"from-orange-400 to-red-500",emoji:"๐Ÿฆ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Como Camaron Estopa"},{id:"un-violinista-en-tu-tejado",title:"Un Violinista en Tu Tejado",artist:"Melendi",file:"/songs/un_violinista_en_tu_tejado.mp3",color:"from-amber-400 to-yellow-600",emoji:"๐ŸŽป",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Un violinista en tu tejado Melendi"},{id:"popstar",title:"Popstar",artist:"Artista Espaรฑol",file:"/songs/popstar.mp3",color:"from-fuchsia-400 to-pink-600",emoji:"โญ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Popstar"},{id:"en-que-estrella-estara",title:"En Que Estrella Estara",artist:"Artista Espaรฑol",file:"/songs/en_que_estrella_estara.mp3",color:"from-indigo-300 to-blue-500",emoji:"โญ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"En que estrella estara"},{id:"pideme",title:"Pideme",artist:"Artista Espaรฑol",file:"/songs/pideme.mp3",color:"from-rose-400 to-pink-600",emoji:"๐Ÿ™",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Pideme"},{id:"nada-fue-un-error",title:"Nada Fue Un Error",artist:"Coti",file:"/songs/nada_fue_un_error.mp3",color:"from-amber-300 to-orange-500",emoji:"โœ…",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Nada fue un error Coti"},{id:"bailarina",title:"Bailarina",artist:"El Canto del Loco",file:"/songs/bailarina.mp3",color:"from-pink-400 to-rose-600",emoji:"๐Ÿ’ƒ",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Bailarina El Canto del Loco"},{id:"soldadito-marinero",title:"Soldadito Marinero",artist:"Fito y Fitipaldis",file:"/songs/soldadito_marinero.mp3",color:"from-blue-400 to-cyan-600",emoji:"โš“",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Soldadito marinero Fito y Fitipaldis"},{id:"para-que-cantarte",title:"Para Que Cantarte",artist:"Artista Espaรฑol",file:"/songs/para_que_cantarte.mp3",color:"from-violet-400 to-purple-600",emoji:"๐ŸŽค",genre:"Pop Espaรฑol",lang:"es",lrcQuery:"Para que cantarte"},{id:"me-rehuso",title:"Me Rehuso",artist:"Danny Ocean",file:"/songs/me_rehuso.mp3",color:"from-teal-400 to-cyan-600",emoji:"๐Ÿšซ",genre:"Pop Latino",lang:"es",lrcQuery:"Me Rehuso Danny Ocean"}];async function n2(n){const t=Od.get(n);if(t)return t;const a=Gt.find(c=>c.id===n),r=t2[n];if(a?.lrcQuery?.trim())try{const c=await e2(a.lrcQuery,a.artist,a.title);if(c.length>0)return Od.set(n,c),c}catch{}const l=r??[];return Od.set(n,l),l}function i2(n,t){if(!n?.length)return{current:null,next:null,progress:0,currentIdx:-1};let a=-1;for(let m=n.length-1;m>=0;m--)if(t>=n[m].time){a=m;break}const r=a>=0?n[a]:null,l=a>=0&&a+1r.trim()).map((r,l)=>({time:l*4,text:r})):[]}catch{return[]}}function Hl(n,t){var a={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(a[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,r=Object.getOwnPropertySymbols(n);ln?(...t)=>n(...t):(...t)=>fetch(...t);class af extends Error{constructor(t,a="FunctionsError",r){super(t),this.name=a,this.context=r}}class l2 extends af{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class My extends af{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Dy extends af{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var fh;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})(fh||(fh={}));class c2{constructor(t,{headers:a={},customFetch:r,region:l=fh.Any}={}){this.url=t,this.headers=a,this.region=l,this.fetch=o2(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return r2(this,arguments,void 0,function*(a,r={}){var l;let c,d;try{const{headers:f,method:m,body:p,signal:g,timeout:b}=r;let w={},{region:_}=r;_||(_=this.region);const S=new URL(`${this.url}/${a}`);_&&_!=="any"&&(w["x-region"]=_,S.searchParams.set("forceFunctionRegion",_));let A;p&&(f&&!Object.prototype.hasOwnProperty.call(f,"Content-Type")||!f)?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(w["Content-Type"]="application/octet-stream",A=p):typeof p=="string"?(w["Content-Type"]="text/plain",A=p):typeof FormData<"u"&&p instanceof FormData?A=p:(w["Content-Type"]="application/json",A=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?A=JSON.stringify(p):A=p;let E=g;b&&(d=new AbortController,c=setTimeout(()=>d.abort(),b),g?(E=d.signal,g.addEventListener("abort",()=>d.abort())):E=d.signal);const j=yield this.fetch(S.toString(),{method:m||"POST",headers:Object.assign(Object.assign(Object.assign({},w),this.headers),f),body:A,signal:E}).catch(G=>{throw new l2(G)}),O=j.headers.get("x-relay-error");if(O&&O==="true")throw new My(j);if(!j.ok)throw new Dy(j);let k=((l=j.headers.get("Content-Type"))!==null&&l!==void 0?l:"text/plain").split(";")[0].trim(),z;return k==="application/json"?z=yield j.json():k==="application/octet-stream"||k==="application/pdf"?z=yield j.blob():k==="text/event-stream"?z=j:k==="multipart/form-data"?z=yield j.formData():z=yield j.text(),{data:z,error:null,response:j}}catch(f){return{data:null,error:f,response:f instanceof Dy||f instanceof My?f.context:void 0}}finally{c&&clearTimeout(c)}})}}var u2=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}},d2=class{constructor(n){var t,a,r;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(t=n.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=n.signal,this.isMaybeSingle=(a=n.isMaybeSingle)!==null&&a!==void 0?a:!1,this.urlLengthLimit=(r=n.urlLengthLimit)!==null&&r!==void 0?r:8e3,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,t){return this.headers=new Headers(this.headers),this.headers.set(n,t),this}then(n,t){var a=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const r=this.fetch;let l=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async c=>{let d=null,f=null,m=null,p=c.status,g=c.statusText;if(c.ok){var b,w;if(a.method!=="HEAD"){var _;const j=await c.text();j===""||(a.headers.get("Accept")==="text/csv"||a.headers.get("Accept")&&(!((_=a.headers.get("Accept"))===null||_===void 0)&&_.includes("application/vnd.pgrst.plan+text"))?f=j:f=JSON.parse(j))}const A=(b=a.headers.get("Prefer"))===null||b===void 0?void 0:b.match(/count=(exact|planned|estimated)/),E=(w=c.headers.get("content-range"))===null||w===void 0?void 0:w.split("/");A&&E&&E.length>1&&(m=parseInt(E[1])),a.isMaybeSingle&&a.method==="GET"&&Array.isArray(f)&&(f.length>1?(d={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,m=null,p=406,g="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{var S;const A=await c.text();try{d=JSON.parse(A),Array.isArray(d)&&c.status===404&&(f=[],d=null,p=200,g="OK")}catch{c.status===404&&A===""?(p=204,g="No Content"):d={message:A}}if(d&&a.isMaybeSingle&&(!(d==null||(S=d.details)===null||S===void 0)&&S.includes("0 rows"))&&(d=null,p=200,g="OK"),d&&a.shouldThrowOnError)throw new u2(d)}return{error:d,data:f,count:m,status:p,statusText:g}});return this.shouldThrowOnError||(l=l.catch(c=>{var d;let f="",m="",p="";const g=c?.cause;if(g){var b,w,_,S;const j=(b=g?.message)!==null&&b!==void 0?b:"",O=(w=g?.code)!==null&&w!==void 0?w:"";f=`${(_=c?.name)!==null&&_!==void 0?_:"FetchError"}: ${c?.message}`,f+=` Caused by: ${(S=g?.name)!==null&&S!==void 0?S:"Error"}: ${j}`,O&&(f+=` (${O})`),g?.stack&&(f+=` ${g.stack}`)}else{var A;f=(A=c?.stack)!==null&&A!==void 0?A:""}const E=this.url.toString().length;return c?.name==="AbortError"||c?.code==="ABORT_ERR"?(p="",m="Request was aborted (timeout or manual cancellation)",E>this.urlLengthLimit&&(m+=`. Note: Your request URL is ${E} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(g?.name==="HeadersOverflowError"||g?.code==="UND_ERR_HEADERS_OVERFLOW")&&(p="",m="HTTP headers exceeded server limits (typically 16KB)",E>this.urlLengthLimit&&(m+=`. Your request URL is ${E} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(d=c?.name)!==null&&d!==void 0?d:"FetchError"}: ${c?.message}`,details:f,hint:m,code:p},data:null,count:null,status:0,statusText:""}})),l.then(n,t)}returns(){return this}overrideTypes(){return this}},h2=class extends d2{select(n){let t=!1;const a=(n??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:t=!0,nullsFirst:a,foreignTable:r,referencedTable:l=r}={}){const c=l?`${l}.order`:"order",d=this.url.searchParams.get(c);return this.url.searchParams.set(c,`${d?`${d},`:""}${n}.${t?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:t,referencedTable:a=t}={}){const r=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(r,`${n}`),this}range(n,t,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"offset":`${r}.offset`,c=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${n}`),this.url.searchParams.set(c,`${t-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:n=!1,verbose:t=!1,settings:a=!1,buffers:r=!1,wal:l=!1,format:c="text"}={}){var d;const f=[n?"analyze":null,t?"verbose":null,a?"settings":null,r?"buffers":null,l?"wal":null].filter(Boolean).join("|"),m=(d=this.headers.get("Accept"))!==null&&d!==void 0?d:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${c}; for="${m}"; options=${f};`),c==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const Ly=new RegExp("[,()]");var Ja=class extends h2{eq(n,t){return this.url.searchParams.append(n,`eq.${t}`),this}neq(n,t){return this.url.searchParams.append(n,`neq.${t}`),this}gt(n,t){return this.url.searchParams.append(n,`gt.${t}`),this}gte(n,t){return this.url.searchParams.append(n,`gte.${t}`),this}lt(n,t){return this.url.searchParams.append(n,`lt.${t}`),this}lte(n,t){return this.url.searchParams.append(n,`lte.${t}`),this}like(n,t){return this.url.searchParams.append(n,`like.${t}`),this}likeAllOf(n,t){return this.url.searchParams.append(n,`like(all).{${t.join(",")}}`),this}likeAnyOf(n,t){return this.url.searchParams.append(n,`like(any).{${t.join(",")}}`),this}ilike(n,t){return this.url.searchParams.append(n,`ilike.${t}`),this}ilikeAllOf(n,t){return this.url.searchParams.append(n,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(n,t){return this.url.searchParams.append(n,`ilike(any).{${t.join(",")}}`),this}regexMatch(n,t){return this.url.searchParams.append(n,`match.${t}`),this}regexIMatch(n,t){return this.url.searchParams.append(n,`imatch.${t}`),this}is(n,t){return this.url.searchParams.append(n,`is.${t}`),this}isDistinct(n,t){return this.url.searchParams.append(n,`isdistinct.${t}`),this}in(n,t){const a=Array.from(new Set(t)).map(r=>typeof r=="string"&&Ly.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(n,`in.(${a})`),this}notIn(n,t){const a=Array.from(new Set(t)).map(r=>typeof r=="string"&&Ly.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(n,`not.in.(${a})`),this}contains(n,t){return typeof t=="string"?this.url.searchParams.append(n,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(n,`cs.{${t.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(t)}`),this}containedBy(n,t){return typeof t=="string"?this.url.searchParams.append(n,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(n,`cd.{${t.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(t)}`),this}rangeGt(n,t){return this.url.searchParams.append(n,`sr.${t}`),this}rangeGte(n,t){return this.url.searchParams.append(n,`nxl.${t}`),this}rangeLt(n,t){return this.url.searchParams.append(n,`sl.${t}`),this}rangeLte(n,t){return this.url.searchParams.append(n,`nxr.${t}`),this}rangeAdjacent(n,t){return this.url.searchParams.append(n,`adj.${t}`),this}overlaps(n,t){return typeof t=="string"?this.url.searchParams.append(n,`ov.${t}`):this.url.searchParams.append(n,`ov.{${t.join(",")}}`),this}textSearch(n,t,{config:a,type:r}={}){let l="";r==="plain"?l="pl":r==="phrase"?l="ph":r==="websearch"&&(l="w");const c=a===void 0?"":`(${a})`;return this.url.searchParams.append(n,`${l}fts${c}.${t}`),this}match(n){return Object.entries(n).forEach(([t,a])=>{this.url.searchParams.append(t,`eq.${a}`)}),this}not(n,t,a){return this.url.searchParams.append(n,`not.${t}.${a}`),this}or(n,{foreignTable:t,referencedTable:a=t}={}){const r=a?`${a}.or`:"or";return this.url.searchParams.append(r,`(${n})`),this}filter(n,t,a){return this.url.searchParams.append(n,`${t}.${a}`),this}},f2=class{constructor(n,{headers:t={},schema:a,fetch:r,urlLengthLimit:l=8e3}){this.url=n,this.headers=new Headers(t),this.schema=a,this.fetch=r,this.urlLengthLimit=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,t){const{head:a=!1,count:r}=t??{},l=a?"HEAD":"GET";let c=!1;const d=(n??"*").split("").map(p=>/\s/.test(p)&&!c?"":(p==='"'&&(c=!c),p)).join(""),{url:f,headers:m}=this.cloneRequestState();return f.searchParams.set("select",d),r&&m.append("Prefer",`count=${r}`),new Ja({method:l,url:f,headers:m,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(n,{count:t,defaultToNull:a=!0}={}){var r;const l="POST",{url:c,headers:d}=this.cloneRequestState();if(t&&d.append("Prefer",`count=${t}`),a||d.append("Prefer","missing=default"),Array.isArray(n)){const f=n.reduce((m,p)=>m.concat(Object.keys(p)),[]);if(f.length>0){const m=[...new Set(f)].map(p=>`"${p}"`);c.searchParams.set("columns",m.join(","))}}return new Ja({method:l,url:c,headers:d,schema:this.schema,body:n,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(n,{onConflict:t,ignoreDuplicates:a=!1,count:r,defaultToNull:l=!0}={}){var c;const d="POST",{url:f,headers:m}=this.cloneRequestState();if(m.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),t!==void 0&&f.searchParams.set("on_conflict",t),r&&m.append("Prefer",`count=${r}`),l||m.append("Prefer","missing=default"),Array.isArray(n)){const p=n.reduce((g,b)=>g.concat(Object.keys(b)),[]);if(p.length>0){const g=[...new Set(p)].map(b=>`"${b}"`);f.searchParams.set("columns",g.join(","))}}return new Ja({method:d,url:f,headers:m,schema:this.schema,body:n,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch,urlLengthLimit:this.urlLengthLimit})}update(n,{count:t}={}){var a;const r="PATCH",{url:l,headers:c}=this.cloneRequestState();return t&&c.append("Prefer",`count=${t}`),new Ja({method:r,url:l,headers:c,schema:this.schema,body:n,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:n}={}){var t;const a="DELETE",{url:r,headers:l}=this.cloneRequestState();return n&&l.append("Prefer",`count=${n}`),new Ja({method:a,url:r,headers:l,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit})}};function Ar(n){"@babel/helpers - typeof";return Ar=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ar(n)}function m2(n,t){if(Ar(n)!="object"||!n)return n;var a=n[Symbol.toPrimitive];if(a!==void 0){var r=a.call(n,t);if(Ar(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function p2(n){var t=m2(n,"string");return Ar(t)=="symbol"?t:t+""}function g2(n,t,a){return(t=p2(t))in n?Object.defineProperty(n,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[t]=a,n}function Uy(n,t){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),a.push.apply(a,r)}return a}function cl(n){for(var t=1;t0?this.fetch=(m,p)=>{const g=new AbortController,b=setTimeout(()=>g.abort(),c),w=p?.signal;if(w){if(w.aborted)return clearTimeout(b),f(m,p);const _=()=>{clearTimeout(b),g.abort()};return w.addEventListener("abort",_,{once:!0}),f(m,cl(cl({},p),{},{signal:g.signal})).finally(()=>{clearTimeout(b),w.removeEventListener("abort",_)})}return f(m,cl(cl({},p),{},{signal:g.signal})).finally(()=>clearTimeout(b))}:this.fetch=f}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new f2(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(t){return new ow(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(t,a={},{head:r=!1,get:l=!1,count:c}={}){var d;let f;const m=new URL(`${this.url}/rpc/${t}`);let p;const g=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(g)),b=r&&Object.values(a).some(g);b?(f="POST",p=a):r||l?(f=r?"HEAD":"GET",Object.entries(a).filter(([_,S])=>S!==void 0).map(([_,S])=>[_,Array.isArray(S)?`{${S.join(",")}}`:`${S}`]).forEach(([_,S])=>{m.searchParams.append(_,S)})):(f="POST",p=a);const w=new Headers(this.headers);return b?w.set("Prefer",c?`count=${c},return=minimal`:"return=minimal"):c&&w.set("Prefer",`count=${c}`),new Ja({method:f,url:m,headers:w,schema:this.schemaName,body:p,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch,urlLengthLimit:this.urlLengthLimit})}};class v2{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const a=globalThis.process;if(a){const r=a.versions;if(r&&r.node){const l=r.node,c=parseInt(l.replace(/^v/,"").split(".")[0]);return c>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${c} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${c} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: import ws from "ws" new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let a=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(a+=` Suggested solution: ${t.workaround}`),new Error(a)}static createWebSocket(t,a){const r=this.getWebSocketConstructor();return new r(t,a)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const b2="2.96.0",w2=`realtime-js/${b2}`,x2="1.0.0",lw="2.0.0",By=lw,mh=1e4,_2=1e3,S2=100;var wi;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(wi||(wi={}));var rt;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(rt||(rt={}));var mn;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(mn||(mn={}));var ph;(function(n){n.websocket="websocket"})(ph||(ph={}));var Ji;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(Ji||(Ji={}));class T2{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,a){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return a(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return a(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var a;return this._isArrayBuffer((a=t.payload)===null||a===void 0?void 0:a.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var a,r;const l=(r=(a=t.payload)===null||a===void 0?void 0:a.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,l)}_encodeJsonUserBroadcastPush(t){var a,r;const l=(r=(a=t.payload)===null||a===void 0?void 0:a.payload)!==null&&r!==void 0?r:{},d=new TextEncoder().encode(JSON.stringify(l)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,d)}_encodeUserBroadcastPush(t,a,r){var l,c;const d=t.topic,f=(l=t.ref)!==null&&l!==void 0?l:"",m=(c=t.join_ref)!==null&&c!==void 0?c:"",p=t.payload.event,g=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},b=Object.keys(g).length===0?"":JSON.stringify(g);if(m.length>255)throw new Error(`joinRef length ${m.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`ref length ${f.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`topic length ${d.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(b.length>255)throw new Error(`metadata length ${b.length} exceeds maximum of 255`);const w=this.USER_BROADCAST_PUSH_META_LENGTH+m.length+f.length+d.length+p.length+b.length,_=new ArrayBuffer(this.HEADER_LENGTH+w);let S=new DataView(_),A=0;S.setUint8(A++,this.KINDS.userBroadcastPush),S.setUint8(A++,m.length),S.setUint8(A++,f.length),S.setUint8(A++,d.length),S.setUint8(A++,p.length),S.setUint8(A++,b.length),S.setUint8(A++,a),Array.from(m,j=>S.setUint8(A++,j.charCodeAt(0))),Array.from(f,j=>S.setUint8(A++,j.charCodeAt(0))),Array.from(d,j=>S.setUint8(A++,j.charCodeAt(0))),Array.from(p,j=>S.setUint8(A++,j.charCodeAt(0))),Array.from(b,j=>S.setUint8(A++,j.charCodeAt(0)));var E=new Uint8Array(_.byteLength+r.byteLength);return E.set(new Uint8Array(_),0),E.set(new Uint8Array(r),_.byteLength),E.buffer}decode(t,a){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return a(r)}if(typeof t=="string"){const r=JSON.parse(t),[l,c,d,f,m]=r;return a({join_ref:l,ref:c,topic:d,event:f,payload:m})}return a({})}_binaryDecode(t){const a=new DataView(t),r=a.getUint8(0),l=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,a,l)}_decodeUserBroadcast(t,a,r){const l=a.getUint8(1),c=a.getUint8(2),d=a.getUint8(3),f=a.getUint8(4);let m=this.HEADER_LENGTH+4;const p=r.decode(t.slice(m,m+l));m=m+l;const g=r.decode(t.slice(m,m+c));m=m+c;const b=r.decode(t.slice(m,m+d));m=m+d;const w=t.slice(m,t.byteLength),_=f===this.JSON_ENCODING?JSON.parse(r.decode(w)):w,S={type:this.BROADCAST_EVENT,event:g,payload:_};return d>0&&(S.meta=JSON.parse(b)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:S}}_isArrayBuffer(t){var a;return t instanceof ArrayBuffer||((a=t?.constructor)===null||a===void 0?void 0:a.name)==="ArrayBuffer"}_pick(t,a){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>a.includes(r)))}}class cw{constructor(t,a){this.callback=t,this.timerCalc=a,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=a}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var ze;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(ze||(ze={}));const zy=(n,t,a={})=>{var r;const l=(r=a.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((c,d)=>(c[d]=E2(d,n,t,l),c),{}):{}},E2=(n,t,a,r)=>{const l=t.find(f=>f.name===n),c=l?.type,d=a[n];return c&&!r.includes(c)?uw(c,d):gh(d)},uw=(n,t)=>{if(n.charAt(0)==="_"){const a=n.slice(1,n.length);return R2(t,a)}switch(n){case ze.bool:return A2(t);case ze.float4:case ze.float8:case ze.int2:case ze.int4:case ze.int8:case ze.numeric:case ze.oid:return j2(t);case ze.json:case ze.jsonb:return C2(t);case ze.timestamp:return k2(t);case ze.abstime:case ze.date:case ze.daterange:case ze.int4range:case ze.int8range:case ze.money:case ze.reltime:case ze.text:case ze.time:case ze.timestamptz:case ze.timetz:case ze.tsrange:case ze.tstzrange:return gh(t);default:return gh(t)}},gh=n=>n,A2=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},j2=n=>{if(typeof n=="string"){const t=parseFloat(n);if(!Number.isNaN(t))return t}return n},C2=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},R2=(n,t)=>{if(typeof n!="string")return n;const a=n.length-1,r=n[a];if(n[0]==="{"&&r==="}"){let c;const d=n.slice(1,a);try{c=JSON.parse("["+d+"]")}catch{c=d?d.split(","):[]}return c.map(f=>uw(t,f))}return n},k2=n=>typeof n=="string"?n.replace(" ","T"):n,dw=n=>{const t=new URL(n);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class Nd{constructor(t,a,r={},l=mh){this.channel=t,this.event=a,this.payload=r,this.timeout=l,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,a){var r;return this._hasReceived(t)&&a((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:t,callback:a}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=a=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=a,this._matchReceive(a)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,a){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:a})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:a}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(a))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var Py;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Py||(Py={}));class br{constructor(t,a){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=a?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},l=>{const{onJoin:c,onLeave:d,onSync:f}=this.caller;this.joinRef=this.channel._joinRef(),this.state=br.syncState(this.state,l,c,d),this.pendingDiffs.forEach(m=>{this.state=br.syncDiff(this.state,m,c,d)}),this.pendingDiffs=[],f()}),this.channel._on(r.diff,{},l=>{const{onJoin:c,onLeave:d,onSync:f}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(l):(this.state=br.syncDiff(this.state,l,c,d),f())}),this.onJoin((l,c,d)=>{this.channel._trigger("presence",{event:"join",key:l,currentPresences:c,newPresences:d})}),this.onLeave((l,c,d)=>{this.channel._trigger("presence",{event:"leave",key:l,currentPresences:c,leftPresences:d})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,a,r,l){const c=this.cloneDeep(t),d=this.transformState(a),f={},m={};return this.map(c,(p,g)=>{d[p]||(m[p]=g)}),this.map(d,(p,g)=>{const b=c[p];if(b){const w=g.map(E=>E.presence_ref),_=b.map(E=>E.presence_ref),S=g.filter(E=>_.indexOf(E.presence_ref)<0),A=b.filter(E=>w.indexOf(E.presence_ref)<0);S.length>0&&(f[p]=S),A.length>0&&(m[p]=A)}else f[p]=g}),this.syncDiff(c,{joins:f,leaves:m},r,l)}static syncDiff(t,a,r,l){const{joins:c,leaves:d}={joins:this.transformState(a.joins),leaves:this.transformState(a.leaves)};return r||(r=()=>{}),l||(l=()=>{}),this.map(c,(f,m)=>{var p;const g=(p=t[f])!==null&&p!==void 0?p:[];if(t[f]=this.cloneDeep(m),g.length>0){const b=t[f].map(_=>_.presence_ref),w=g.filter(_=>b.indexOf(_.presence_ref)<0);t[f].unshift(...w)}r(f,g,m)}),this.map(d,(f,m)=>{let p=t[f];if(!p)return;const g=m.map(b=>b.presence_ref);p=p.filter(b=>g.indexOf(b.presence_ref)<0),t[f]=p,l(f,p,m),p.length===0&&delete t[f]}),t}static map(t,a){return Object.getOwnPropertyNames(t).map(r=>a(r,t[r]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((a,r)=>{const l=t[r];return"metas"in l?a[r]=l.metas.map(c=>(c.presence_ref=c.phx_ref,delete c.phx_ref,delete c.phx_ref_prev,c)):a[r]=l,a},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Vy;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(Vy||(Vy={}));var wr;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(wr||(wr={}));var $n;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})($n||($n={}));class rs{constructor(t,a={config:{}},r){var l,c;if(this.topic=t,this.params=a,this.socket=r,this.bindings={},this.state=rt.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},a.config),this.timeout=this.socket.timeout,this.joinPush=new Nd(this,mn.join,this.params,this.timeout),this.rejoinTimer=new cw(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=rt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(d=>d.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=rt.closed,this.socket._remove(this)}),this._onError(d=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,d),this.state=rt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=rt.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",d=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,d),this.state=rt.errored,this.rejoinTimer.scheduleTimeout())}),this._on(mn.reply,{},(d,f)=>{this._trigger(this._replyEventName(f),d)}),this.presence=new br(this),this.broadcastEndpointURL=dw(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((c=(l=this.params.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,a=this.timeout){var r,l,c;if(this.socket.isConnected()||this.socket.connect(),this.state==rt.closed){const{config:{broadcast:d,presence:f,private:m}}=this.params,p=(l=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(_=>_.filter))!==null&&l!==void 0?l:[],g=!!this.bindings[wr.PRESENCE]&&this.bindings[wr.PRESENCE].length>0||((c=this.params.config.presence)===null||c===void 0?void 0:c.enabled)===!0,b={},w={broadcast:d,presence:Object.assign(Object.assign({},f),{enabled:g}),postgres_changes:p,private:m};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(_=>t?.($n.CHANNEL_ERROR,_)),this._onClose(()=>t?.($n.CLOSED)),this.updateJoinPayload(Object.assign({config:w},b)),this.joinedOnce=!0,this._rejoin(a),this.joinPush.receive("ok",async({postgres_changes:_})=>{var S;if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){t?.($n.SUBSCRIBED);return}else{const A=this.bindings.postgres_changes,E=(S=A?.length)!==null&&S!==void 0?S:0,j=[];for(let O=0;O{this.state=rt.errored,t?.($n.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(_).join(", ")||"error")))}).receive("timeout",()=>{t?.($n.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,a={}){return await this.send({type:"presence",event:"track",payload:t},a.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,a,r){return this.state===rt.joined&&t===wr.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(t,a,r)}async httpSend(t,a,r={}){var l;if(a==null)return Promise.reject("Payload is required for httpSend()");const c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:a,private:this.private}]})},f=await this._fetchWithTimeout(this.broadcastEndpointURL,d,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);if(f.status===202)return{success:!0};let m=f.statusText;try{const p=await f.json();m=p.error||p.message||m}catch{}return Promise.reject(new Error(m))}async send(t,a={}){var r,l;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:c,payload:d}=t,f={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(f.Authorization=`Bearer ${this.socket.accessTokenValue}`);const m={method:"POST",headers:f,body:JSON.stringify({messages:[{topic:this.subTopic,event:c,payload:d,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,m,(r=a.timeout)!==null&&r!==void 0?r:this.timeout);return await((l=p.body)===null||l===void 0?void 0:l.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(c=>{var d,f,m;const p=this._push(t.type,t,a.timeout||this.timeout);t.type==="broadcast"&&!(!((m=(f=(d=this.params)===null||d===void 0?void 0:d.config)===null||f===void 0?void 0:f.broadcast)===null||m===void 0)&&m.ack)&&c("ok"),p.receive("ok",()=>c("ok")),p.receive("error",()=>c("error")),p.receive("timeout",()=>c("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=rt.leaving;const a=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(mn.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(l=>{r=new Nd(this,mn.leave,{},t),r.receive("ok",()=>{a(),l("ok")}).receive("timeout",()=>{a(),l("timed out")}).receive("error",()=>{l("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r?.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=rt.closed,this.bindings={}}async _fetchWithTimeout(t,a,r){const l=new AbortController,c=setTimeout(()=>l.abort(),r),d=await this.socket.fetch(t,Object.assign(Object.assign({},a),{signal:l.signal}));return clearTimeout(c),d}_push(t,a,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let l=new Nd(this,t,a,r);return this._canPush()?l.send():this._addToPushBuffer(l),l}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>S2){const a=this.pushBuffer.shift();a&&(a.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${a.event}`,a.payload))}}_onMessage(t,a,r){return a}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,a,r){var l,c;const d=t.toLocaleLowerCase(),{close:f,error:m,leave:p,join:g}=mn;if(r&&[f,m,p,g].indexOf(d)>=0&&r!==this._joinRef())return;let w=this._onMessage(d,a,r);if(a&&!w)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(d)?(l=this.bindings.postgres_changes)===null||l===void 0||l.filter(_=>{var S,A,E;return((S=_.filter)===null||S===void 0?void 0:S.event)==="*"||((E=(A=_.filter)===null||A===void 0?void 0:A.event)===null||E===void 0?void 0:E.toLocaleLowerCase())===d}).map(_=>_.callback(w,r)):(c=this.bindings[d])===null||c===void 0||c.filter(_=>{var S,A,E,j,O,k;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in _){const z=_.id,G=(S=_.filter)===null||S===void 0?void 0:S.event;return z&&((A=a.ids)===null||A===void 0?void 0:A.includes(z))&&(G==="*"||G?.toLocaleLowerCase()===((E=a.data)===null||E===void 0?void 0:E.type.toLocaleLowerCase()))}else{const z=(O=(j=_?.filter)===null||j===void 0?void 0:j.event)===null||O===void 0?void 0:O.toLocaleLowerCase();return z==="*"||z===((k=a?.event)===null||k===void 0?void 0:k.toLocaleLowerCase())}else return _.type.toLocaleLowerCase()===d}).map(_=>{if(typeof w=="object"&&"ids"in w){const S=w.data,{schema:A,table:E,commit_timestamp:j,type:O,errors:k}=S;w=Object.assign(Object.assign({},{schema:A,table:E,commit_timestamp:j,eventType:O,new:{},old:{},errors:k}),this._getPayloadRecords(S))}_.callback(w,r)})}_isClosed(){return this.state===rt.closed}_isJoined(){return this.state===rt.joined}_isJoining(){return this.state===rt.joining}_isLeaving(){return this.state===rt.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,a,r){const l=t.toLocaleLowerCase(),c={type:l,filter:a,callback:r};return this.bindings[l]?this.bindings[l].push(c):this.bindings[l]=[c],this}_off(t,a){const r=t.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(l=>{var c;return!(((c=l.type)===null||c===void 0?void 0:c.toLocaleLowerCase())===r&&rs.isEqual(l.filter,a))})),this}static isEqual(t,a){if(Object.keys(t).length!==Object.keys(a).length)return!1;for(const r in t)if(t[r]!==a[r])return!1;return!0}static isFilterValueEqual(t,a){return(t??void 0)===(a??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(mn.close,{},t)}_onError(t){this._on(mn.error,{},a=>t(a))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=rt.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const a={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(a.new=zy(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(a.old=zy(t.columns,t.old_record)),a}}const Md=()=>{},ul={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},O2=[1e3,2e3,5e3,1e4],N2=1e4,M2=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class D2{constructor(t,a){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=mh,this.transport=null,this.heartbeatIntervalMs=ul.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Md,this.ref=0,this.reconnectTimer=null,this.vsn=By,this.logger=Md,this.conn=null,this.sendBuffer=[],this.serializer=new T2,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=l=>l?(...c)=>l(...c):(...c)=>fetch(...c),!(!((r=a?.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=a.params.apikey,this.endPoint=`${t}/${ph.websocket}`,this.httpEndpoint=dw(t),this._initializeOptions(a),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(a?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=v2.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const a=t.message;throw a.includes("Node.js")?new Error(`${a} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${a}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,a){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,a??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const a=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),a}async removeAllChannels(){const t=await Promise.all(this.channels.map(a=>a.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,a,r){this.logger(t,a,r)}connectionState(){switch(this.conn&&this.conn.readyState){case wi.connecting:return Ji.Connecting;case wi.open:return Ji.Open;case wi.closing:return Ji.Closing;default:return Ji.Closed}}isConnected(){return this.connectionState()===Ji.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,a={config:{}}){const r=`realtime:${t}`,l=this.getChannels().find(c=>c.topic===r);if(l)return l;{const c=new rs(`realtime:${t}`,a,this);return this.channels.push(c),c}}push(t){const{topic:a,event:r,payload:l,ref:c}=t,d=()=>{this.encode(t,f=>{var m;(m=this.conn)===null||m===void 0||m.send(f)})};this.log("push",`${a} ${r} (${c})`,l),this.isConnected()?d():this.sendBuffer.push(d)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(a){this.log("error","error in heartbeat callback",a)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(a){this.log("error","error in heartbeat callback",a)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(_2,"heartbeat timeout"),setTimeout(()=>{var a;this.isConnected()||(a=this.reconnectTimer)===null||a===void 0||a.scheduleTimeout()},ul.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(a){this.log("error","error in heartbeat callback",a)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let a=this.channels.find(r=>r.topic===t&&(r._isJoined()||r._isJoining()));a&&(this.log("transport",`leaving duplicate topic "${t}"`),a.unsubscribe())}_remove(t){this.channels=this.channels.filter(a=>a.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,a=>{if(a.topic==="phoenix"&&a.event==="phx_reply"&&a.ref&&a.ref===this.pendingHeartbeatRef){const p=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(a.payload.status==="ok"?"ok":"error",p)}catch(g){this.log("error","error in heartbeat callback",g)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:r,event:l,payload:c,ref:d}=a,f=d?`(${d})`:"",m=c.status||"";this.log("receive",`${m} ${r} ${l} ${f}`.trim(),c),this.channels.filter(p=>p._isMember(r)).forEach(p=>p._trigger(l,c,d)),this._triggerStateCallbacks("message",a)})}_clearTimer(t){var a;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((a=this.reconnectTimer)===null||a===void 0||a.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t),this.conn.readyState===wi.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===wi.open||this.conn.readyState===wi.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(a=>{this.log("error","error waiting for auth on connect",a),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=a=>{this.log("worker","worker error",a.message),this._terminateWorker()},this.workerRef.onmessage=a=>{a.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(t){var a;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(a=this.reconnectTimer)===null||a===void 0||a.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t);try{this.heartbeatCallback("error")}catch(a){this.log("error","error in heartbeat callback",a)}}_triggerChanError(){this.channels.forEach(t=>t._trigger(mn.error))}_appendParams(t,a){if(Object.keys(a).length===0)return t;const r=t.match(/\?/)?"&":"?",l=new URLSearchParams(a);return`${t}${r}${l}`}_workerObjectUrl(t){let a;if(t)a=t;else{const r=new Blob([M2],{type:"application/javascript"});a=URL.createObjectURL(r)}return a}_setConnectionState(t,a=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=a)}async _performAuth(t=null){let a,r=!1;if(t)a=t,r=!0;else if(this.accessToken)try{a=await this.accessToken()}catch(l){this.log("error","Error fetching access token from callback",l),a=this.accessTokenValue}else a=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=a&&(this.accessTokenValue=a,this.channels.forEach(l=>{const c={access_token:a,version:w2};a&&l.updateJoinPayload(c),l.joinedOnce&&l._isJoined()&&l._push(mn.access_token,{access_token:a})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(a=>{this.log("error",`Error setting auth in ${t}`,a)})}_triggerStateCallbacks(t,a){try{this.stateChangeCallbacks[t].forEach(r=>{try{r(a)}catch(l){this.log("error",`error in ${t} callback`,l)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new cw(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},ul.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var a,r,l,c,d,f,m,p,g,b,w,_;switch(this.transport=(a=t?.transport)!==null&&a!==void 0?a:null,this.timeout=(r=t?.timeout)!==null&&r!==void 0?r:mh,this.heartbeatIntervalMs=(l=t?.heartbeatIntervalMs)!==null&&l!==void 0?l:ul.HEARTBEAT_INTERVAL,this.worker=(c=t?.worker)!==null&&c!==void 0?c:!1,this.accessToken=(d=t?.accessToken)!==null&&d!==void 0?d:null,this.heartbeatCallback=(f=t?.heartbeatCallback)!==null&&f!==void 0?f:Md,this.vsn=(m=t?.vsn)!==null&&m!==void 0?m:By,t?.params&&(this.params=t.params),t?.logger&&(this.logger=t.logger),(t?.logLevel||t?.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(p=t?.reconnectAfterMs)!==null&&p!==void 0?p:(S=>O2[S-1]||N2),this.vsn){case x2:this.encode=(g=t?.encode)!==null&&g!==void 0?g:((S,A)=>A(JSON.stringify(S))),this.decode=(b=t?.decode)!==null&&b!==void 0?b:((S,A)=>A(JSON.parse(S)));break;case lw:this.encode=(w=t?.encode)!==null&&w!==void 0?w:this.serializer.encode.bind(this.serializer),this.decode=(_=t?.decode)!==null&&_!==void 0?_:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t?.workerUrl}}}var jr=class extends Error{constructor(n,t){super(n),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function L2(n,t,a){const r=new URL(t,n);if(a)for(const[l,c]of Object.entries(a))c!==void 0&&r.searchParams.set(l,c);return r.toString()}async function U2(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function B2(n){const t=n.fetchImpl??globalThis.fetch;return{async request({method:a,path:r,query:l,body:c,headers:d}){const f=L2(n.baseUrl,r,l),m=await U2(n.auth),p=await t(f,{method:a,headers:{...c?{"Content-Type":"application/json"}:{},...m,...d},body:c?JSON.stringify(c):void 0}),g=await p.text(),b=(p.headers.get("content-type")||"").includes("application/json"),w=b&&g?JSON.parse(g):g;if(!p.ok){const _=b?w:void 0,S=_?.error;throw new jr(S?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:S?.type,icebergCode:S?.code,details:_})}return{status:p.status,headers:p.headers,data:w}}}}function dl(n){return n.join("")}var z2=class{constructor(n,t=""){this.client=n,this.prefix=t}async listNamespaces(n){const t=n?{parent:dl(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(n,t){const a={namespace:n.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:a})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${dl(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${dl(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${dl(n.namespace)}`}),!0}catch(t){if(t instanceof jr&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(n,t){try{return await this.createNamespace(n,t)}catch(a){if(a instanceof jr&&a.status===409)return;throw a}}};function $a(n){return n.join("")}var P2=class{constructor(n,t="",a){this.client=n,this.prefix=t,this.accessDelegation=a}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${$a(n.namespace)}/tables`})).data.identifiers}async createTable(n,t){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$a(n.namespace)}/tables`,body:t,headers:a})).data.metadata}async updateTable(n,t){const a=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$a(n.namespace)}/tables/${n.name}`,body:t});return{"metadata-location":a.data["metadata-location"],metadata:a.data.metadata}}async dropTable(n,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${$a(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(n){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${$a(n.namespace)}/tables/${n.name}`,headers:t})).data.metadata}async tableExists(n){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${$a(n.namespace)}/tables/${n.name}`,headers:t}),!0}catch(a){if(a instanceof jr&&a.status===404)return!1;throw a}}async createTableIfNotExists(n,t){try{return await this.createTable(n,t)}catch(a){if(a instanceof jr&&a.status===409)return await this.loadTable({namespace:n.namespace,name:t.name});throw a}}},V2=class{constructor(n){let t="v1";n.catalogName&&(t+=`/${n.catalogName}`);const a=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=B2({baseUrl:a,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new z2(this.client,t),this.tableOps=new P2(this.client,t,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,t){return this.namespaceOps.createNamespace(n,t)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}async createTable(n,t){return this.tableOps.createTable(n,t)}async updateTable(n,t){return this.tableOps.updateTable(n,t)}async dropTable(n,t){await this.tableOps.dropTable(n,t)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,t){return this.namespaceOps.createNamespaceIfNotExists(n,t)}async createTableIfNotExists(n,t){return this.tableOps.createTableIfNotExists(n,t)}},Gl=class extends Error{constructor(n,t="storage",a,r){super(n),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=a,this.statusCode=r}};function $l(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var hl=class extends Gl{constructor(n,t,a,r="storage"){super(n,r,t,a),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=a}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},hw=class extends Gl{constructor(n,t,a="storage"){super(n,a),this.name=a==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};const q2=n=>n?(...t)=>n(...t):(...t)=>fetch(...t),H2=n=>{if(typeof n!="object"||n===null)return!1;const t=Object.getPrototypeOf(n);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},yh=n=>{if(Array.isArray(n))return n.map(a=>yh(a));if(typeof n=="function"||n!==Object(n))return n;const t={};return Object.entries(n).forEach(([a,r])=>{const l=a.replace(/([-_][a-z])/gi,c=>c.toUpperCase().replace(/[-_]/g,""));t[l]=yh(r)}),t},G2=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function Cr(n){"@babel/helpers - typeof";return Cr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cr(n)}function $2(n,t){if(Cr(n)!="object"||!n)return n;var a=n[Symbol.toPrimitive];if(a!==void 0){var r=a.call(n,t);if(Cr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function Q2(n){var t=$2(n,"string");return Cr(t)=="symbol"?t:t+""}function I2(n,t,a){return(t=Q2(t))in n?Object.defineProperty(n,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[t]=a,n}function qy(n,t){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),a.push.apply(a,r)}return a}function ce(n){for(var t=1;t{var t;return n.msg||n.message||n.error_description||(typeof n.error=="string"?n.error:(t=n.error)===null||t===void 0?void 0:t.message)||JSON.stringify(n)},Y2=async(n,t,a,r)=>{if(n&&typeof n=="object"&&"status"in n&&"ok"in n&&typeof n.status=="number"&&!a?.noResolveJson){const l=n,c=l.status||500;if(typeof l.json=="function")l.json().then(d=>{const f=d?.statusCode||d?.code||c+"";t(new hl(Hy(d),c,f,r))}).catch(()=>{if(r==="vectors"){const d=c+"";t(new hl(l.statusText||`HTTP ${c} error`,c,d,r))}else{const d=c+"";t(new hl(l.statusText||`HTTP ${c} error`,c,d,r))}});else{const d=c+"";t(new hl(l.statusText||`HTTP ${c} error`,c,d,r))}}else t(new hw(Hy(n),n,r))},K2=(n,t,a,r)=>{const l={method:n,headers:t?.headers||{}};return n==="GET"||n==="HEAD"||!r?ce(ce({},l),a):(H2(r)?(l.headers=ce({"Content-Type":"application/json"},t?.headers),l.body=JSON.stringify(r)):l.body=r,t?.duplex&&(l.duplex=t.duplex),ce(ce({},l),a))};async function dr(n,t,a,r,l,c,d){return new Promise((f,m)=>{n(a,K2(t,r,l,c)).then(p=>{if(!p.ok)throw p;if(r?.noResolveJson)return p;if(d==="vectors"){const g=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!g||!g.includes("application/json"))return{}}return p.json()}).then(p=>f(p)).catch(p=>Y2(p,m,r,d))})}function fw(n="storage"){return{get:async(t,a,r,l)=>dr(t,"GET",a,r,l,void 0,n),post:async(t,a,r,l,c)=>dr(t,"POST",a,l,c,r,n),put:async(t,a,r,l,c)=>dr(t,"PUT",a,l,c,r,n),head:async(t,a,r,l)=>dr(t,"HEAD",a,ce(ce({},r),{},{noResolveJson:!0}),l,void 0,n),remove:async(t,a,r,l,c)=>dr(t,"DELETE",a,l,c,r,n)}}const X2=fw("storage"),{get:Rr,post:fn,put:vh,head:F2,remove:sf}=X2,Qt=fw("vectors");var fs=class{constructor(n,t={},a,r="storage"){this.shouldThrowOnError=!1,this.url=n,this.headers=t,this.fetch=q2(a),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,t){return this.headers=ce(ce({},this.headers),{},{[n]:t}),this}async handleOperation(n){var t=this;try{return{data:await n(),error:null}}catch(a){if(t.shouldThrowOnError)throw a;if($l(a))return{data:null,error:a};throw a}}},J2=class{constructor(n,t){this.downloadFn=n,this.shouldThrowOnError=t}then(n,t){return this.execute().then(n,t)}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(t){if(n.shouldThrowOnError)throw t;if($l(t))return{data:null,error:t};throw t}}};let mw;mw=Symbol.toStringTag;var Z2=class{constructor(n,t){this.downloadFn=n,this.shouldThrowOnError=t,this[mw]="BlobDownloadBuilder",this.promise=null}asStream(){return new J2(this.downloadFn,this.shouldThrowOnError)}then(n,t){return this.getPromise().then(n,t)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(t){if(n.shouldThrowOnError)throw t;if($l(t))return{data:null,error:t};throw t}}};const W2={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Gy={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var eC=class extends fs{constructor(n,t={},a,r){super(n,t,r,"storage"),this.bucketId=a}async uploadOrUpdate(n,t,a,r){var l=this;return l.handleOperation(async()=>{let c;const d=ce(ce({},Gy),r);let f=ce(ce({},l.headers),n==="POST"&&{"x-upsert":String(d.upsert)});const m=d.metadata;typeof Blob<"u"&&a instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),m&&c.append("metadata",l.encodeMetadata(m)),c.append("",a)):typeof FormData<"u"&&a instanceof FormData?(c=a,c.has("cacheControl")||c.append("cacheControl",d.cacheControl),m&&!c.has("metadata")&&c.append("metadata",l.encodeMetadata(m))):(c=a,f["cache-control"]=`max-age=${d.cacheControl}`,f["content-type"]=d.contentType,m&&(f["x-metadata"]=l.toBase64(l.encodeMetadata(m))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!d.duplex&&(d.duplex="half")),r?.headers&&(f=ce(ce({},f),r.headers));const p=l._removeEmptyFolders(t),g=l._getFinalPath(p),b=await(n=="PUT"?vh:fn)(l.fetch,`${l.url}/object/${g}`,c,ce({headers:f},d?.duplex?{duplex:d.duplex}:{}));return{path:p,id:b.Id,fullPath:b.Key}})}async upload(n,t,a){return this.uploadOrUpdate("POST",n,t,a)}async uploadToSignedUrl(n,t,a,r){var l=this;const c=l._removeEmptyFolders(n),d=l._getFinalPath(c),f=new URL(l.url+`/object/upload/sign/${d}`);return f.searchParams.set("token",t),l.handleOperation(async()=>{let m;const p=ce({upsert:Gy.upsert},r),g=ce(ce({},l.headers),{"x-upsert":String(p.upsert)});return typeof Blob<"u"&&a instanceof Blob?(m=new FormData,m.append("cacheControl",p.cacheControl),m.append("",a)):typeof FormData<"u"&&a instanceof FormData?(m=a,m.append("cacheControl",p.cacheControl)):(m=a,g["cache-control"]=`max-age=${p.cacheControl}`,g["content-type"]=p.contentType),{path:c,fullPath:(await vh(l.fetch,f.toString(),m,{headers:g})).Key}})}async createSignedUploadUrl(n,t){var a=this;return a.handleOperation(async()=>{let r=a._getFinalPath(n);const l=ce({},a.headers);t?.upsert&&(l["x-upsert"]="true");const c=await fn(a.fetch,`${a.url}/object/upload/sign/${r}`,{},{headers:l}),d=new URL(a.url+c.url),f=d.searchParams.get("token");if(!f)throw new Gl("No token returned by API");return{signedUrl:d.toString(),path:n,token:f}})}async update(n,t,a){return this.uploadOrUpdate("PUT",n,t,a)}async move(n,t,a){var r=this;return r.handleOperation(async()=>await fn(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:n,destinationKey:t,destinationBucket:a?.destinationBucket},{headers:r.headers}))}async copy(n,t,a){var r=this;return r.handleOperation(async()=>({path:(await fn(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:n,destinationKey:t,destinationBucket:a?.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(n,t,a){var r=this;return r.handleOperation(async()=>{let l=r._getFinalPath(n),c=await fn(r.fetch,`${r.url}/object/sign/${l}`,ce({expiresIn:t},a?.transform?{transform:a.transform}:{}),{headers:r.headers});const d=a?.download?`&download=${a.download===!0?"":a.download}`:"";return{signedUrl:encodeURI(`${r.url}${c.signedURL}${d}`)}})}async createSignedUrls(n,t,a){var r=this;return r.handleOperation(async()=>{const l=await fn(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:n},{headers:r.headers}),c=a?.download?`&download=${a.download===!0?"":a.download}`:"";return l.map(d=>ce(ce({},d),{},{signedUrl:d.signedURL?encodeURI(`${r.url}${d.signedURL}${c}`):null}))})}download(n,t,a){const r=typeof t?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(t?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(n),f=()=>Rr(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0},a);return new Z2(f,this.shouldThrowOnError)}async info(n){var t=this;const a=t._getFinalPath(n);return t.handleOperation(async()=>yh(await Rr(t.fetch,`${t.url}/object/info/${a}`,{headers:t.headers})))}async exists(n){var t=this;const a=t._getFinalPath(n);try{return await F2(t.fetch,`${t.url}/object/${a}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if($l(r)&&r instanceof hw){const l=r.originalError;if([400,404].includes(l?.status))return{data:!1,error:r}}throw r}}getPublicUrl(n,t){const a=this._getFinalPath(n),r=[],l=t?.download?`download=${t.download===!0?"":t.download}`:"";l!==""&&r.push(l);const c=typeof t?.transform<"u"?"render/image":"object",d=this.transformOptsToQueryString(t?.transform||{});d!==""&&r.push(d);let f=r.join("&");return f!==""&&(f=`?${f}`),{data:{publicUrl:encodeURI(`${this.url}/${c}/public/${a}${f}`)}}}async remove(n){var t=this;return t.handleOperation(async()=>await sf(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:n},{headers:t.headers}))}async list(n,t,a){var r=this;return r.handleOperation(async()=>{const l=ce(ce(ce({},W2),t),{},{prefix:n||""});return await fn(r.fetch,`${r.url}/object/list/${r.bucketId}`,l,{headers:r.headers},a)})}async listV2(n,t){var a=this;return a.handleOperation(async()=>{const r=ce({},n);return await fn(a.fetch,`${a.url}/object/list-v2/${a.bucketId}`,r,{headers:a.headers},t)})}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){const t=[];return n.width&&t.push(`width=${n.width}`),n.height&&t.push(`height=${n.height}`),n.resize&&t.push(`resize=${n.resize}`),n.format&&t.push(`format=${n.format}`),n.quality&&t.push(`quality=${n.quality}`),t.join("&")}};const tC="2.96.0",Br={"X-Client-Info":`storage-js/${tC}`};var nC=class extends fs{constructor(n,t={},a,r){const l=new URL(n);r?.useNewHostname&&/supabase\.(co|in|red)$/.test(l.hostname)&&!l.hostname.includes("storage.supabase.")&&(l.hostname=l.hostname.replace("supabase.","storage.supabase."));const c=l.href.replace(/\/$/,""),d=ce(ce({},Br),t);super(c,d,a,"storage")}async listBuckets(n){var t=this;return t.handleOperation(async()=>{const a=t.listBucketOptionsToQueryString(n);return await Rr(t.fetch,`${t.url}/bucket${a}`,{headers:t.headers})})}async getBucket(n){var t=this;return t.handleOperation(async()=>await Rr(t.fetch,`${t.url}/bucket/${n}`,{headers:t.headers}))}async createBucket(n,t={public:!1}){var a=this;return a.handleOperation(async()=>await fn(a.fetch,`${a.url}/bucket`,{id:n,name:n,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:a.headers}))}async updateBucket(n,t){var a=this;return a.handleOperation(async()=>await vh(a.fetch,`${a.url}/bucket/${n}`,{id:n,name:n,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:a.headers}))}async emptyBucket(n){var t=this;return t.handleOperation(async()=>await fn(t.fetch,`${t.url}/bucket/${n}/empty`,{},{headers:t.headers}))}async deleteBucket(n){var t=this;return t.handleOperation(async()=>await sf(t.fetch,`${t.url}/bucket/${n}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(n){const t={};return n&&("limit"in n&&(t.limit=String(n.limit)),"offset"in n&&(t.offset=String(n.offset)),n.search&&(t.search=n.search),n.sortColumn&&(t.sortColumn=n.sortColumn),n.sortOrder&&(t.sortOrder=n.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},iC=class extends fs{constructor(n,t={},a){const r=n.replace(/\/$/,""),l=ce(ce({},Br),t);super(r,l,a,"storage")}async createBucket(n){var t=this;return t.handleOperation(async()=>await fn(t.fetch,`${t.url}/bucket`,{name:n},{headers:t.headers}))}async listBuckets(n){var t=this;return t.handleOperation(async()=>{const a=new URLSearchParams;n?.limit!==void 0&&a.set("limit",n.limit.toString()),n?.offset!==void 0&&a.set("offset",n.offset.toString()),n?.sortColumn&&a.set("sortColumn",n.sortColumn),n?.sortOrder&&a.set("sortOrder",n.sortOrder),n?.search&&a.set("search",n.search);const r=a.toString(),l=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await Rr(t.fetch,l,{headers:t.headers})})}async deleteBucket(n){var t=this;return t.handleOperation(async()=>await sf(t.fetch,`${t.url}/bucket/${n}`,{},{headers:t.headers}))}from(n){var t=this;if(!G2(n))throw new Gl("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const a=new V2({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(a,{get(l,c){const d=l[c];return typeof d!="function"?d:async(...f)=>{try{return{data:await d.apply(l,f),error:null}}catch(m){if(r)throw m;return{data:null,error:m}}}}})}},aC=class extends fs{constructor(n,t={},a){const r=n.replace(/\/$/,""),l=ce(ce({},Br),{},{"Content-Type":"application/json"},t);super(r,l,a,"vectors")}async createIndex(n){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/CreateIndex`,n,{headers:t.headers})||{})}async getIndex(n,t){var a=this;return a.handleOperation(async()=>await Qt.post(a.fetch,`${a.url}/GetIndex`,{vectorBucketName:n,indexName:t},{headers:a.headers}))}async listIndexes(n){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/ListIndexes`,n,{headers:t.headers}))}async deleteIndex(n,t){var a=this;return a.handleOperation(async()=>await Qt.post(a.fetch,`${a.url}/DeleteIndex`,{vectorBucketName:n,indexName:t},{headers:a.headers})||{})}},sC=class extends fs{constructor(n,t={},a){const r=n.replace(/\/$/,""),l=ce(ce({},Br),{},{"Content-Type":"application/json"},t);super(r,l,a,"vectors")}async putVectors(n){var t=this;if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/PutVectors`,n,{headers:t.headers})||{})}async getVectors(n){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/GetVectors`,n,{headers:t.headers}))}async listVectors(n){var t=this;if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/ListVectors`,n,{headers:t.headers}))}async queryVectors(n){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/QueryVectors`,n,{headers:t.headers}))}async deleteVectors(n){var t=this;if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/DeleteVectors`,n,{headers:t.headers})||{})}},rC=class extends fs{constructor(n,t={},a){const r=n.replace(/\/$/,""),l=ce(ce({},Br),{},{"Content-Type":"application/json"},t);super(r,l,a,"vectors")}async createBucket(n){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:t.headers})||{})}async getBucket(n){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:n},{headers:t.headers}))}async listBuckets(n={}){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/ListVectorBuckets`,n,{headers:t.headers}))}async deleteBucket(n){var t=this;return t.handleOperation(async()=>await Qt.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:t.headers})||{})}},oC=class extends rC{constructor(n,t={}){super(n,t.headers||{},t.fetch)}from(n){return new lC(this.url,this.headers,n,this.fetch)}async createBucket(n){var t=()=>super.createBucket,a=this;return t().call(a,n)}async getBucket(n){var t=()=>super.getBucket,a=this;return t().call(a,n)}async listBuckets(n={}){var t=()=>super.listBuckets,a=this;return t().call(a,n)}async deleteBucket(n){var t=()=>super.deleteBucket,a=this;return t().call(a,n)}},lC=class extends aC{constructor(n,t,a,r){super(n,t,r),this.vectorBucketName=a}async createIndex(n){var t=()=>super.createIndex,a=this;return t().call(a,ce(ce({},n),{},{vectorBucketName:a.vectorBucketName}))}async listIndexes(n={}){var t=()=>super.listIndexes,a=this;return t().call(a,ce(ce({},n),{},{vectorBucketName:a.vectorBucketName}))}async getIndex(n){var t=()=>super.getIndex,a=this;return t().call(a,a.vectorBucketName,n)}async deleteIndex(n){var t=()=>super.deleteIndex,a=this;return t().call(a,a.vectorBucketName,n)}index(n){return new cC(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},cC=class extends sC{constructor(n,t,a,r,l){super(n,t,l),this.vectorBucketName=a,this.indexName=r}async putVectors(n){var t=()=>super.putVectors,a=this;return t().call(a,ce(ce({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async getVectors(n){var t=()=>super.getVectors,a=this;return t().call(a,ce(ce({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async listVectors(n={}){var t=()=>super.listVectors,a=this;return t().call(a,ce(ce({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async queryVectors(n){var t=()=>super.queryVectors,a=this;return t().call(a,ce(ce({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}async deleteVectors(n){var t=()=>super.deleteVectors,a=this;return t().call(a,ce(ce({},n),{},{vectorBucketName:a.vectorBucketName,indexName:a.indexName}))}},uC=class extends nC{constructor(n,t={},a,r){super(n,t,a,r)}from(n){return new eC(this.url,this.headers,n,this.fetch)}get vectors(){return new oC(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new iC(this.url+"/iceberg",this.headers,this.fetch)}};const pw="2.96.0",Za=30*1e3,bh=3,Dd=bh*Za,dC="http://localhost:9999",hC="supabase.auth.token",fC={"X-Client-Info":`gotrue-js/${pw}`},wh="X-Supabase-Api-Version",gw={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},mC=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,pC=600*1e3;class kr extends Error{constructor(t,a,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=a,this.code=r}}function ie(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class gC extends kr{constructor(t,a,r){super(t,a,r),this.name="AuthApiError",this.status=a,this.code=r}}function yC(n){return ie(n)&&n.name==="AuthApiError"}class Zi extends kr{constructor(t,a){super(t),this.name="AuthUnknownError",this.originalError=a}}class In extends kr{constructor(t,a,r,l){super(t,r,l),this.name=a,this.status=r}}class $t extends In{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Ld(n){return ie(n)&&n.name==="AuthSessionMissingError"}class Qa extends In{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class fl extends In{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ml extends In{constructor(t,a=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=a}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function vC(n){return ie(n)&&n.name==="AuthImplicitGrantRedirectError"}class $y extends In{constructor(t,a=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=a}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class bC extends In{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class xh extends In{constructor(t,a){super(t,"AuthRetryableFetchError",a,void 0)}}function Ud(n){return ie(n)&&n.name==="AuthRetryableFetchError"}class Qy extends In{constructor(t,a,r){super(t,"AuthWeakPasswordError",a,"weak_password"),this.reasons=r}}class _h extends In{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Dl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Iy=` \r=`.split(""),wC=(()=>{const n=new Array(128);for(let t=0;t=6;){const r=t.queue>>t.queuedBits-6&63;a(Dl[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;a(Dl[r]),t.queuedBits-=6}}function yw(n,t,a){const r=wC[n];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)a(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function Ky(n){const t=[],a=d=>{t.push(String.fromCodePoint(d))},r={utf8seq:0,codepoint:0},l={queue:0,queuedBits:0},c=d=>{SC(d,r,a)};for(let d=0;d>6),t(128|n&63);return}else if(n<=65535){t(224|n>>12),t(128|n>>6&63),t(128|n&63);return}else if(n<=1114111){t(240|n>>18),t(128|n>>12&63),t(128|n>>6&63),t(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function _C(n,t){for(let a=0;a55295&&r<=56319){const l=(r-55296)*1024&65535;r=(n.charCodeAt(a+1)-56320&65535|l)+65536,a+=1}xC(r,t)}}function SC(n,t,a){if(t.utf8seq===0){if(n<=127){a(n);return}for(let r=1;r<6;r+=1)if((n>>7-r&1)===0){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=n&31;else if(t.utf8seq===3)t.codepoint=n&15;else if(t.utf8seq===4)t.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|n&63,t.utf8seq-=1,t.utf8seq===0&&a(t.codepoint)}}function ls(n){const t=[],a={queue:0,queuedBits:0},r=l=>{t.push(l)};for(let l=0;lt.push(a)),new Uint8Array(t)}function ta(n){const t=[],a={queue:0,queuedBits:0},r=l=>{t.push(l)};return n.forEach(l=>Yy(l,a,r)),Yy(null,a,r),t.join("")}function EC(n){return Math.round(Date.now()/1e3)+n}function AC(){return Symbol("auth-callback")}const vt=()=>typeof window<"u"&&typeof document<"u",Ii={tested:!1,writable:!1},vw=()=>{if(!vt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ii.tested)return Ii.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),Ii.tested=!0,Ii.writable=!0}catch{Ii.tested=!0,Ii.writable=!1}return Ii.writable};function jC(n){const t={},a=new URL(n);if(a.hash&&a.hash[0]==="#")try{new URLSearchParams(a.hash.substring(1)).forEach((l,c)=>{t[c]=l})}catch{}return a.searchParams.forEach((r,l)=>{t[l]=r}),t}const bw=n=>n?(...t)=>n(...t):(...t)=>fetch(...t),CC=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",Wa=async(n,t,a)=>{await n.setItem(t,JSON.stringify(a))},Yi=async(n,t)=>{const a=await n.getItem(t);if(!a)return null;try{return JSON.parse(a)}catch{return a}},yt=async(n,t)=>{await n.removeItem(t)};class Ql{constructor(){this.promise=new Ql.promiseConstructor((t,a)=>{this.resolve=t,this.reject=a})}}Ql.promiseConstructor=Promise;function pl(n){const t=n.split(".");if(t.length!==3)throw new _h("Invalid JWT structure");for(let r=0;r{setTimeout(()=>t(null),n)})}function kC(n,t){return new Promise((r,l)=>{(async()=>{for(let c=0;c<1/0;c++)try{const d=await n(c);if(!t(c,null,d)){r(d);return}}catch(d){if(!t(c,d)){l(d);return}}})()})}function OC(n){return("0"+n.toString(16)).substr(-2)}function NC(){const t=new Uint32Array(56);if(typeof crypto>"u"){const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=a.length;let l="";for(let c=0;c<56;c++)l+=a.charAt(Math.floor(Math.random()*r));return l}return crypto.getRandomValues(t),Array.from(t,OC).join("")}async function MC(n){const a=new TextEncoder().encode(n),r=await crypto.subtle.digest("SHA-256",a),l=new Uint8Array(r);return Array.from(l).map(c=>String.fromCharCode(c)).join("")}async function DC(n){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),n;const a=await MC(n);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ia(n,t,a=!1){const r=NC();let l=r;a&&(l+="/PASSWORD_RECOVERY"),await Wa(n,`${t}-code-verifier`,l);const c=await DC(r);return[c,r===c?"plain":"s256"]}const LC=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function UC(n){const t=n.headers.get(wh);if(!t||!t.match(LC))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function BC(n){if(!n)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(n<=t)throw new Error("JWT has expired")}function zC(n){switch(n){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const PC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ya(n){if(!PC.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Bd(){const n={};return new Proxy(n,{get:(t,a)=>{if(a==="__isUserNotAvailableProxy")return!0;if(typeof a=="symbol"){const r=a.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${a}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,a)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${a}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,a)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${a}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function VC(n,t){return new Proxy(n,{get:(a,r,l)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const c=r.toString();if(c==="Symbol(Symbol.toPrimitive)"||c==="Symbol(Symbol.toStringTag)"||c==="Symbol(util.inspect.custom)"||c==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(a,r,l)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(a,r,l)}})}function Xy(n){return JSON.parse(JSON.stringify(n))}const Fi=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),qC=[502,503,504];async function Fy(n){var t;if(!CC(n))throw new xh(Fi(n),0);if(qC.includes(n.status))throw new xh(Fi(n),n.status);let a;try{a=await n.json()}catch(c){throw new Zi(Fi(c),c)}let r;const l=UC(n);if(l&&l.getTime()>=gw["2024-01-01"].timestamp&&typeof a=="object"&&a&&typeof a.code=="string"?r=a.code:typeof a=="object"&&a&&typeof a.error_code=="string"&&(r=a.error_code),r){if(r==="weak_password")throw new Qy(Fi(a),n.status,((t=a.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new $t}else if(typeof a=="object"&&a&&typeof a.weak_password=="object"&&a.weak_password&&Array.isArray(a.weak_password.reasons)&&a.weak_password.reasons.length&&a.weak_password.reasons.reduce((c,d)=>c&&typeof d=="string",!0))throw new Qy(Fi(a),n.status,a.weak_password.reasons);throw new gC(Fi(a),n.status||500,r)}const HC=(n,t,a,r)=>{const l={method:n,headers:t?.headers||{}};return n==="GET"?l:(l.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),l.body=JSON.stringify(r),Object.assign(Object.assign({},l),a))};async function ue(n,t,a,r){var l;const c=Object.assign({},r?.headers);c[wh]||(c[wh]=gw["2024-01-01"].name),r?.jwt&&(c.Authorization=`Bearer ${r.jwt}`);const d=(l=r?.query)!==null&&l!==void 0?l:{};r?.redirectTo&&(d.redirect_to=r.redirectTo);const f=Object.keys(d).length?"?"+new URLSearchParams(d).toString():"",m=await GC(n,t,a+f,{headers:c,noResolveJson:r?.noResolveJson},{},r?.body);return r?.xform?r?.xform(m):{data:Object.assign({},m),error:null}}async function GC(n,t,a,r,l,c){const d=HC(t,r,l,c);let f;try{f=await n(a,Object.assign({},d))}catch(m){throw console.error(m),new xh(Fi(m),0)}if(f.ok||await Fy(f),r?.noResolveJson)return f;try{return await f.json()}catch(m){await Fy(m)}}function dn(n){var t;let a=null;IC(n)&&(a=Object.assign({},n),n.expires_at||(a.expires_at=EC(n.expires_in)));const r=(t=n.user)!==null&&t!==void 0?t:n;return{data:{session:a,user:r},error:null}}function Jy(n){const t=dn(n);return!t.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((a,r)=>a&&typeof r=="string",!0)&&(t.data.weak_password=n.weak_password),t}function xi(n){var t;return{data:{user:(t=n.user)!==null&&t!==void 0?t:n},error:null}}function $C(n){return{data:n,error:null}}function QC(n){const{action_link:t,email_otp:a,hashed_token:r,redirect_to:l,verification_type:c}=n,d=Hl(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),f={action_link:t,email_otp:a,hashed_token:r,redirect_to:l,verification_type:c},m=Object.assign({},d);return{data:{properties:f,user:m},error:null}}function Zy(n){return n}function IC(n){return n.access_token&&n.refresh_token&&n.expires_in}const zd=["global","local","others"];class YC{constructor({url:t="",headers:a={},fetch:r}){this.url=t,this.headers=a,this.fetch=bw(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(t,a=zd[0]){if(zd.indexOf(a)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${zd.join(", ")}`);try{return await ue(this.fetch,"POST",`${this.url}/logout?scope=${a}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ie(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,a={}){try{return await ue(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:a.data},headers:this.headers,redirectTo:a.redirectTo,xform:xi})}catch(r){if(ie(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:a}=t,r=Hl(t,["options"]),l=Object.assign(Object.assign({},r),a);return"newEmail"in r&&(l.new_email=r?.newEmail,delete l.newEmail),await ue(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:l,headers:this.headers,xform:QC,redirectTo:a?.redirectTo})}catch(a){if(ie(a))return{data:{properties:null,user:null},error:a};throw a}}async createUser(t){try{return await ue(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:xi})}catch(a){if(ie(a))return{data:{user:null},error:a};throw a}}async listUsers(t){var a,r,l,c,d,f,m;try{const p={nextPage:null,lastPage:0,total:0},g=await ue(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(a=t?.page)===null||a===void 0?void 0:a.toString())!==null&&r!==void 0?r:"",per_page:(c=(l=t?.perPage)===null||l===void 0?void 0:l.toString())!==null&&c!==void 0?c:""},xform:Zy});if(g.error)throw g.error;const b=await g.json(),w=(d=g.headers.get("x-total-count"))!==null&&d!==void 0?d:0,_=(m=(f=g.headers.get("link"))===null||f===void 0?void 0:f.split(","))!==null&&m!==void 0?m:[];return _.length>0&&(_.forEach(S=>{const A=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(S.split(";")[1].split("=")[1]);p[`${E}Page`]=A}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(ie(p))return{data:{users:[]},error:p};throw p}}async getUserById(t){Ya(t);try{return await ue(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:xi})}catch(a){if(ie(a))return{data:{user:null},error:a};throw a}}async updateUserById(t,a){Ya(t);try{return await ue(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:a,headers:this.headers,xform:xi})}catch(r){if(ie(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,a=!1){Ya(t);try{return await ue(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:a},xform:xi})}catch(r){if(ie(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){Ya(t.userId);try{const{data:a,error:r}=await ue(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:l=>({data:{factors:l},error:null})});return{data:a,error:r}}catch(a){if(ie(a))return{data:null,error:a};throw a}}async _deleteFactor(t){Ya(t.userId),Ya(t.id);try{return{data:await ue(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(a){if(ie(a))return{data:null,error:a};throw a}}async _listOAuthClients(t){var a,r,l,c,d,f,m;try{const p={nextPage:null,lastPage:0,total:0},g=await ue(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(a=t?.page)===null||a===void 0?void 0:a.toString())!==null&&r!==void 0?r:"",per_page:(c=(l=t?.perPage)===null||l===void 0?void 0:l.toString())!==null&&c!==void 0?c:""},xform:Zy});if(g.error)throw g.error;const b=await g.json(),w=(d=g.headers.get("x-total-count"))!==null&&d!==void 0?d:0,_=(m=(f=g.headers.get("link"))===null||f===void 0?void 0:f.split(","))!==null&&m!==void 0?m:[];return _.length>0&&(_.forEach(S=>{const A=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(S.split(";")[1].split("=")[1]);p[`${E}Page`]=A}),p.total=parseInt(w)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(ie(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(t){try{return await ue(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(ie(a))return{data:null,error:a};throw a}}async _getOAuthClient(t){try{return await ue(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(ie(a))return{data:null,error:a};throw a}}async _updateOAuthClient(t,a){try{return await ue(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ie(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await ue(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(a){if(ie(a))return{data:null,error:a};throw a}}async _regenerateOAuthClientSecret(t){try{return await ue(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(ie(a))return{data:null,error:a};throw a}}}function Wy(n={}){return{getItem:t=>n[t]||null,setItem:(t,a)=>{n[t]=a},removeItem:t=>{delete n[t]}}}const Ka={debug:!!(globalThis&&vw()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class ww extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class ev extends ww{}async function KC(n,t,a){Ka.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,t);const r=new globalThis.AbortController;t>0&&setTimeout(()=>{r.abort(),Ka.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",n)},t),await Promise.resolve();try{return await globalThis.navigator.locks.request(n,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async l=>{if(l){Ka.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",n,l.name);try{return await a()}finally{Ka.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,l.name)}}else{if(t===0)throw Ka.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new ev(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(Ka.debug)try{const c=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(c,null," "))}catch(c){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",c)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await a()}})}catch(l){throw l?.name==="AbortError"?new ev(`Acquiring an exclusive Navigator LockManager lock "${n}" timed out waiting ${t}ms`):l}}function XC(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function xw(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function FC(n){return parseInt(n,16)}function JC(n){const t=new TextEncoder().encode(n);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function ZC(n){var t;const{chainId:a,domain:r,expirationTime:l,issuedAt:c=new Date,nonce:d,notBefore:f,requestId:m,resources:p,scheme:g,uri:b,version:w}=n;{if(!Number.isInteger(a))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${a}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(d&&d.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${d}`);if(!b)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(w!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${w}`);if(!((t=n.statement)===null||t===void 0)&&t.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const _=xw(n.address),S=g?`${g}://${r}`:r,A=n.statement?`${n.statement} `:"",E=`${S} wants you to sign in with your Ethereum account: ${_} ${A}`;let j=`URI: ${b} Version: ${w} Chain ID: ${a}${d?` Nonce: ${d}`:""} Issued At: ${c.toISOString()}`;if(l&&(j+=` Expiration Time: ${l.toISOString()}`),f&&(j+=` Not Before: ${f.toISOString()}`),m&&(j+=` Request ID: ${m}`),p){let O=` Resources:`;for(const k of p){if(!k||typeof k!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${k}`);O+=` - ${k}`}j+=O}return`${E} ${j}`}class nt extends Error{constructor({message:t,code:a,cause:r,name:l}){var c;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(c=l??(r instanceof Error?r.name:void 0))!==null&&c!==void 0?c:"Unknown Error",this.code=a}}class Ll extends nt{constructor(t,a){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:a,message:t}),this.name="WebAuthnUnknownError",this.originalError=a}}function WC({error:n,options:t}){var a,r,l;const{publicKey:c}=t;if(!c)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(t.signal instanceof AbortSignal)return new nt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((a=c.authenticatorSelection)===null||a===void 0?void 0:a.requireResidentKey)===!0)return new nt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(t.mediation==="conditional"&&((r=c.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new nt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((l=c.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new nt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new nt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new nt({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return c.pubKeyCredParams.filter(f=>f.type==="public-key").length===0?new nt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new nt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const d=window.location.hostname;if(_w(d)){if(c.rp.id!==d)return new nt({message:`The RP ID "${c.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new nt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(c.user.id.byteLength<1||c.user.id.byteLength>64)return new nt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new nt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new nt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function eR({error:n,options:t}){const{publicKey:a}=t;if(!a)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(t.signal instanceof AbortSignal)return new nt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new nt({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const r=window.location.hostname;if(_w(r)){if(a.rpId!==r)return new nt({message:`The RP ID "${a.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new nt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new nt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new nt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class tR{createNewAbortSignal(){if(this.controller){const a=new Error("Cancelling existing WebAuthn API call for new one");a.name="AbortError",this.controller.abort(a)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const nR=new tR;function iR(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:t,user:a,excludeCredentials:r}=n,l=Hl(n,["challenge","user","excludeCredentials"]),c=ls(t).buffer,d=Object.assign(Object.assign({},a),{id:ls(a.id).buffer}),f=Object.assign(Object.assign({},l),{challenge:c,user:d});if(r&&r.length>0){f.excludeCredentials=new Array(r.length);for(let m=0;m0){c.allowCredentials=new Array(a.length);for(let d=0;dl!==null&&typeof l=="object"&&!Array.isArray(l),a=l=>l instanceof ArrayBuffer||ArrayBuffer.isView(l),r={};for(const l of n)if(l)for(const c in l){const d=l[c];if(d!==void 0)if(Array.isArray(d))r[c]=d;else if(a(d))r[c]=d;else if(t(d)){const f=r[c];t(f)?r[c]=Ul(f,d):r[c]=Ul(d)}else r[c]=d}return r}function dR(n,t){return Ul(cR,n,t||{})}function hR(n,t){return Ul(uR,n,t||{})}class fR{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:a,friendlyName:r,signal:l},c){var d;try{const{data:f,error:m}=await this.client.mfa.challenge({factorId:t,webauthn:a});if(!f)return{data:null,error:m};const p=l??nR.createNewAbortSignal();if(f.webauthn.type==="create"){const{user:g}=f.webauthn.credential_options.publicKey;if(!g.name){const b=r;if(b)g.name=`${g.id}:${b}`;else{const _=(await this.client.getUser()).data.user,S=((d=_?.user_metadata)===null||d===void 0?void 0:d.name)||_?.email||_?.id||"User";g.name=`${g.id}:${S}`}}g.displayName||(g.displayName=g.name)}switch(f.webauthn.type){case"create":{const g=dR(f.webauthn.credential_options.publicKey,c?.create),{data:b,error:w}=await oR({publicKey:g,signal:p});return b?{data:{factorId:t,challengeId:f.id,webauthn:{type:f.webauthn.type,credential_response:b}},error:null}:{data:null,error:w}}case"request":{const g=hR(f.webauthn.credential_options.publicKey,c?.request),{data:b,error:w}=await lR(Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:g,signal:p}));return b?{data:{factorId:t,challengeId:f.id,webauthn:{type:f.webauthn.type,credential_response:b}},error:null}:{data:null,error:w}}}}catch(f){return ie(f)?{data:null,error:f}:{data:null,error:new Zi("Unexpected error in challenge",f)}}}async _verify({challengeId:t,factorId:a,webauthn:r}){return this.client.mfa.verify({factorId:a,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:a=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},c){if(!a)return{data:null,error:new kr("rpId is required for WebAuthn authentication")};try{if(!tv())return{data:null,error:new Zi("Browser does not support WebAuthn",null)};const{data:d,error:f}=await this.challenge({factorId:t,webauthn:{rpId:a,rpOrigins:r},signal:l},{request:c});if(!d)return{data:null,error:f};const{webauthn:m}=d;return this._verify({factorId:t,challengeId:d.challengeId,webauthn:{type:m.type,rpId:a,rpOrigins:r,credential_response:m.credential_response}})}catch(d){return ie(d)?{data:null,error:d}:{data:null,error:new Zi("Unexpected error in authenticate",d)}}}async _register({friendlyName:t,webauthn:{rpId:a=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:l}={}},c){if(!a)return{data:null,error:new kr("rpId is required for WebAuthn registration")};try{if(!tv())return{data:null,error:new Zi("Browser does not support WebAuthn",null)};const{data:d,error:f}=await this._enroll({friendlyName:t});if(!d)return await this.client.mfa.listFactors().then(g=>{var b;return(b=g.data)===null||b===void 0?void 0:b.all.find(w=>w.factor_type==="webauthn"&&w.friendly_name===t&&w.status!=="unverified")}).then(g=>g?this.client.mfa.unenroll({factorId:g?.id}):void 0),{data:null,error:f};const{data:m,error:p}=await this._challenge({factorId:d.id,friendlyName:d.friendly_name,webauthn:{rpId:a,rpOrigins:r},signal:l},{create:c});return m?this._verify({factorId:d.id,challengeId:m.challengeId,webauthn:{rpId:a,rpOrigins:r,type:m.webauthn.type,credential_response:m.webauthn.credential_response}}):{data:null,error:p}}catch(d){return ie(d)?{data:null,error:d}:{data:null,error:new Zi("Unexpected error in register",d)}}}}XC();const mR={url:dC,storageKey:hC,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:fC,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function nv(n,t,a){return await a()}const Xa={};class Or{get jwks(){var t,a;return(a=(t=Xa[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&a!==void 0?a:{keys:[]}}set jwks(t){Xa[this.storageKey]=Object.assign(Object.assign({},Xa[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,a;return(a=(t=Xa[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&a!==void 0?a:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Xa[this.storageKey]=Object.assign(Object.assign({},Xa[this.storageKey]),{cachedAt:t})}constructor(t){var a,r,l;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const c=Object.assign(Object.assign({},mR),t);if(this.storageKey=c.storageKey,this.instanceID=(a=Or.nextInstanceID[this.storageKey])!==null&&a!==void 0?a:0,Or.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!c.debug,typeof c.debug=="function"&&(this.logger=c.debug),this.instanceID>0&&vt()){const d=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(d),this.logDebugMessages&&console.trace(d)}if(this.persistSession=c.persistSession,this.autoRefreshToken=c.autoRefreshToken,this.admin=new YC({url:c.url,headers:c.headers,fetch:c.fetch}),this.url=c.url,this.headers=c.headers,this.fetch=bw(c.fetch),this.lock=c.lock||nv,this.detectSessionInUrl=c.detectSessionInUrl,this.flowType=c.flowType,this.hasCustomAuthorizationHeader=c.hasCustomAuthorizationHeader,this.throwOnError=c.throwOnError,this.lockAcquireTimeout=c.lockAcquireTimeout,c.lock?this.lock=c.lock:this.persistSession&&vt()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=KC:this.lock=nv,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new fR(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(c.storage?this.storage=c.storage:vw()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Wy(this.memoryStorage)),c.userStorage&&(this.userStorage=c.userStorage)):(this.memoryStorage={},this.storage=Wy(this.memoryStorage)),vt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(d){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",d)}(l=this.broadcastChannel)===null||l===void 0||l.addEventListener("message",async d=>{this._debug("received broadcast notification from other tab or client",d);try{await this._notifyAllSubscribers(d.data.event,d.data.session,!1)}catch(f){this._debug("#broadcastChannel","error",f)}})}this.initialize().catch(d=>{this._debug("#initialize()","error",d)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${pw}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let a={},r="none";if(vt()&&(a=jC(window.location.href),this._isImplicitGrantCallback(a)?r="implicit":await this._isPKCECallback(a)&&(r="pkce")),vt()&&this.detectSessionInUrl&&r!=="none"){const{data:l,error:c}=await this._getSessionFromURL(a,r);if(c){if(this._debug("#_initialize()","error detecting session from URL",c),vC(c)){const m=(t=c.details)===null||t===void 0?void 0:t.code;if(m==="identity_already_exists"||m==="identity_not_found"||m==="single_identity_not_deletable")return{error:c}}return{error:c}}const{session:d,redirectType:f}=l;return this._debug("#_initialize()","detected session in URL",d,"redirect type",f),await this._saveSession(d),setTimeout(async()=>{f==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",d):await this._notifyAllSubscribers("SIGNED_IN",d)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(a){return ie(a)?this._returnResult({error:a}):this._returnResult({error:new Zi("Unexpected error during initialization",a)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var a,r,l;try{const c=await ue(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(a=t?.options)===null||a===void 0?void 0:a.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(l=t?.options)===null||l===void 0?void 0:l.captchaToken}},xform:dn}),{data:d,error:f}=c;if(f||!d)return this._returnResult({data:{user:null,session:null},error:f});const m=d.session,p=d.user;return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(c){if(ie(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signUp(t){var a,r,l;try{let c;if("email"in t){const{email:g,password:b,options:w}=t;let _=null,S=null;this.flowType==="pkce"&&([_,S]=await Ia(this.storage,this.storageKey)),c=await ue(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:w?.emailRedirectTo,body:{email:g,password:b,data:(a=w?.data)!==null&&a!==void 0?a:{},gotrue_meta_security:{captcha_token:w?.captchaToken},code_challenge:_,code_challenge_method:S},xform:dn})}else if("phone"in t){const{phone:g,password:b,options:w}=t;c=await ue(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:g,password:b,data:(r=w?.data)!==null&&r!==void 0?r:{},channel:(l=w?.channel)!==null&&l!==void 0?l:"sms",gotrue_meta_security:{captcha_token:w?.captchaToken}},xform:dn})}else throw new fl("You must provide either an email or phone number and a password");const{data:d,error:f}=c;if(f||!d)return await yt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:f});const m=d.session,p=d.user;return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(c){if(await yt(this.storage,`${this.storageKey}-code-verifier`),ie(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithPassword(t){try{let a;if("email"in t){const{email:c,password:d,options:f}=t;a=await ue(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:c,password:d,gotrue_meta_security:{captcha_token:f?.captchaToken}},xform:Jy})}else if("phone"in t){const{phone:c,password:d,options:f}=t;a=await ue(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:c,password:d,gotrue_meta_security:{captcha_token:f?.captchaToken}},xform:Jy})}else throw new fl("You must provide either an email or phone number and a password");const{data:r,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!r||!r.session||!r.user){const c=new Qa;return this._returnResult({data:{user:null,session:null},error:c})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:l})}catch(a){if(ie(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithOAuth(t){var a,r,l,c;return await this._handleProviderSignIn(t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:(c=t.options)===null||c===void 0?void 0:c.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:a}=t;switch(a){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${a}"`)}}async signInWithEthereum(t){var a,r,l,c,d,f,m,p,g,b,w;let _,S;if("message"in t)_=t.message,S=t.signature;else{const{chain:A,wallet:E,statement:j,options:O}=t;let k;if(vt())if(typeof E=="object")k=E;else{const ee=window;if("ethereum"in ee&&typeof ee.ethereum=="object"&&"request"in ee.ethereum&&typeof ee.ethereum.request=="function")k=ee.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!O?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=E}const z=new URL((a=O?.url)!==null&&a!==void 0?a:window.location.href),G=await k.request({method:"eth_requestAccounts"}).then(ee=>ee).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!G||G.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const Y=xw(G[0]);let I=(r=O?.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!I){const ee=await k.request({method:"eth_chainId"});I=FC(ee)}const X={domain:z.host,address:Y,statement:j,uri:z.href,version:"1",chainId:I,nonce:(l=O?.signInWithEthereum)===null||l===void 0?void 0:l.nonce,issuedAt:(d=(c=O?.signInWithEthereum)===null||c===void 0?void 0:c.issuedAt)!==null&&d!==void 0?d:new Date,expirationTime:(f=O?.signInWithEthereum)===null||f===void 0?void 0:f.expirationTime,notBefore:(m=O?.signInWithEthereum)===null||m===void 0?void 0:m.notBefore,requestId:(p=O?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(g=O?.signInWithEthereum)===null||g===void 0?void 0:g.resources};_=ZC(X),S=await k.request({method:"personal_sign",params:[JC(_),Y]})}try{const{data:A,error:E}=await ue(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:S},!((b=t.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(w=t.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:dn});if(E)throw E;if(!A||!A.session||!A.user){const j=new Qa;return this._returnResult({data:{user:null,session:null},error:j})}return A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),this._returnResult({data:Object.assign({},A),error:E})}catch(A){if(ie(A))return this._returnResult({data:{user:null,session:null},error:A});throw A}}async signInWithSolana(t){var a,r,l,c,d,f,m,p,g,b,w,_;let S,A;if("message"in t)S=t.message,A=t.signature;else{const{chain:E,wallet:j,statement:O,options:k}=t;let z;if(vt())if(typeof j=="object")z=j;else{const Y=window;if("solana"in Y&&typeof Y.solana=="object"&&("signIn"in Y.solana&&typeof Y.solana.signIn=="function"||"signMessage"in Y.solana&&typeof Y.solana.signMessage=="function"))z=Y.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof j!="object"||!k?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");z=j}const G=new URL((a=k?.url)!==null&&a!==void 0?a:window.location.href);if("signIn"in z&&z.signIn){const Y=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},k?.signInWithSolana),{version:"1",domain:G.host,uri:G.href}),O?{statement:O}:null));let I;if(Array.isArray(Y)&&Y[0]&&typeof Y[0]=="object")I=Y[0];else if(Y&&typeof Y=="object"&&"signedMessage"in Y&&"signature"in Y)I=Y;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in I&&"signature"in I&&(typeof I.signedMessage=="string"||I.signedMessage instanceof Uint8Array)&&I.signature instanceof Uint8Array)S=typeof I.signedMessage=="string"?I.signedMessage:new TextDecoder().decode(I.signedMessage),A=I.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in z)||typeof z.signMessage!="function"||!("publicKey"in z)||typeof z!="object"||!z.publicKey||!("toBase58"in z.publicKey)||typeof z.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");S=[`${G.host} wants you to sign in with your Solana account:`,z.publicKey.toBase58(),...O?["",O,""]:[""],"Version: 1",`URI: ${G.href}`,`Issued At: ${(l=(r=k?.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&l!==void 0?l:new Date().toISOString()}`,...!((c=k?.signInWithSolana)===null||c===void 0)&&c.notBefore?[`Not Before: ${k.signInWithSolana.notBefore}`]:[],...!((d=k?.signInWithSolana)===null||d===void 0)&&d.expirationTime?[`Expiration Time: ${k.signInWithSolana.expirationTime}`]:[],...!((f=k?.signInWithSolana)===null||f===void 0)&&f.chainId?[`Chain ID: ${k.signInWithSolana.chainId}`]:[],...!((m=k?.signInWithSolana)===null||m===void 0)&&m.nonce?[`Nonce: ${k.signInWithSolana.nonce}`]:[],...!((p=k?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${k.signInWithSolana.requestId}`]:[],...!((b=(g=k?.signInWithSolana)===null||g===void 0?void 0:g.resources)===null||b===void 0)&&b.length?["Resources",...k.signInWithSolana.resources.map(I=>`- ${I}`)]:[]].join(` `);const Y=await z.signMessage(new TextEncoder().encode(S),"utf8");if(!Y||!(Y instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");A=Y}}try{const{data:E,error:j}=await ue(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:S,signature:ta(A)},!((w=t.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=t.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:dn});if(j)throw j;if(!E||!E.session||!E.user){const O=new Qa;return this._returnResult({data:{user:null,session:null},error:O})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:j})}catch(E){if(ie(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(t){const a=await Yi(this.storage,`${this.storageKey}-code-verifier`),[r,l]=(a??"").split("/");try{if(!r&&this.flowType==="pkce")throw new bC;const{data:c,error:d}=await ue(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:dn});if(await yt(this.storage,`${this.storageKey}-code-verifier`),d)throw d;if(!c||!c.session||!c.user){const f=new Qa;return this._returnResult({data:{user:null,session:null,redirectType:null},error:f})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:Object.assign(Object.assign({},c),{redirectType:l??null}),error:d})}catch(c){if(await yt(this.storage,`${this.storageKey}-code-verifier`),ie(c))return this._returnResult({data:{user:null,session:null,redirectType:null},error:c});throw c}}async signInWithIdToken(t){try{const{options:a,provider:r,token:l,access_token:c,nonce:d}=t,f=await ue(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:l,access_token:c,nonce:d,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:dn}),{data:m,error:p}=f;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!m||!m.session||!m.user){const g=new Qa;return this._returnResult({data:{user:null,session:null},error:g})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:m,error:p})}catch(a){if(ie(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithOtp(t){var a,r,l,c,d;try{if("email"in t){const{email:f,options:m}=t;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await Ia(this.storage,this.storageKey));const{error:b}=await ue(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:f,data:(a=m?.data)!==null&&a!==void 0?a:{},create_user:(r=m?.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:m?.captchaToken},code_challenge:p,code_challenge_method:g},redirectTo:m?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:b})}if("phone"in t){const{phone:f,options:m}=t,{data:p,error:g}=await ue(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:f,data:(l=m?.data)!==null&&l!==void 0?l:{},create_user:(c=m?.shouldCreateUser)!==null&&c!==void 0?c:!0,gotrue_meta_security:{captcha_token:m?.captchaToken},channel:(d=m?.channel)!==null&&d!==void 0?d:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:g})}throw new fl("You must provide either an email or phone number.")}catch(f){if(await yt(this.storage,`${this.storageKey}-code-verifier`),ie(f))return this._returnResult({data:{user:null,session:null},error:f});throw f}}async verifyOtp(t){var a,r;try{let l,c;"options"in t&&(l=(a=t.options)===null||a===void 0?void 0:a.redirectTo,c=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:d,error:f}=await ue(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:c}}),redirectTo:l,xform:dn});if(f)throw f;if(!d)throw new Error("An error occurred on token verification.");const m=d.session,p=d.user;return m?.access_token&&(await this._saveSession(m),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",m)),this._returnResult({data:{user:p,session:m},error:null})}catch(l){if(ie(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithSSO(t){var a,r,l,c,d;try{let f=null,m=null;this.flowType==="pkce"&&([f,m]=await Ia(this.storage,this.storageKey));const p=await ue(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(a=t.options)===null||a===void 0?void 0:a.redirectTo)!==null&&r!==void 0?r:void 0}),!((l=t?.options)===null||l===void 0)&&l.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:f,code_challenge_method:m}),headers:this.headers,xform:$C});return!((c=p.data)===null||c===void 0)&&c.url&&vt()&&!(!((d=t.options)===null||d===void 0)&&d.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(f){if(await yt(this.storage,`${this.storageKey}-code-verifier`),ie(f))return this._returnResult({data:null,error:f});throw f}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:a},error:r}=t;if(r)throw r;if(!a)throw new $t;const{error:l}=await ue(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:a.access_token});return this._returnResult({data:{user:null,session:null},error:l})})}catch(t){if(ie(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const a=`${this.url}/resend`;if("email"in t){const{email:r,type:l,options:c}=t,{error:d}=await ue(this.fetch,"POST",a,{headers:this.headers,body:{email:r,type:l,gotrue_meta_security:{captcha_token:c?.captchaToken}},redirectTo:c?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}else if("phone"in t){const{phone:r,type:l,options:c}=t,{data:d,error:f}=await ue(this.fetch,"POST",a,{headers:this.headers,body:{phone:r,type:l,gotrue_meta_security:{captcha_token:c?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:d?.message_id},error:f})}throw new fl("You must provide either an email or phone number and a type")}catch(a){if(ie(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async a=>a))}async _acquireLock(t,a){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),l=(async()=>(await r,await a()))();return this.pendingInLock.push((async()=>{try{await l}catch{}})()),l}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=a();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const l=[...this.pendingInLock];await Promise.all(l),this.pendingInLock.splice(0,l.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const a=await this.__loadSession();return await t(a)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const a=await Yi(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",a),a!==null&&(this._isValidSession(a)?t=a:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()await this._getUser());return a.data.user&&(this.suppressGetSessionWarning=!0),a}async _getUser(t){try{return t?await ue(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:xi}):await this._useSession(async a=>{var r,l,c;const{data:d,error:f}=a;if(f)throw f;return!(!((r=d.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new $t}:await ue(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0,xform:xi})})}catch(a){if(ie(a))return Ld(a)&&(await this._removeSession(),await yt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:a});throw a}}async updateUser(t,a={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,a))}async _updateUser(t,a={}){try{return await this._useSession(async r=>{const{data:l,error:c}=r;if(c)throw c;if(!l.session)throw new $t;const d=l.session;let f=null,m=null;this.flowType==="pkce"&&t.email!=null&&([f,m]=await Ia(this.storage,this.storageKey));const{data:p,error:g}=await ue(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:a?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:f,code_challenge_method:m}),jwt:d.access_token,xform:xi});if(g)throw g;return d.user=p.user,await this._saveSession(d),await this._notifyAllSubscribers("USER_UPDATED",d),this._returnResult({data:{user:d.user},error:null})})}catch(r){if(await yt(this.storage,`${this.storageKey}-code-verifier`),ie(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new $t;const a=Date.now()/1e3;let r=a,l=!0,c=null;const{payload:d}=pl(t.access_token);if(d.exp&&(r=d.exp,l=r<=a),l){const{data:f,error:m}=await this._callRefreshToken(t.refresh_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!f)return{data:{user:null,session:null},error:null};c=f}else{const{data:f,error:m}=await this._getUser(t.access_token);if(m)return this._returnResult({data:{user:null,session:null},error:m});c={access_token:t.access_token,refresh_token:t.refresh_token,user:f.user,token_type:"bearer",expires_in:r-a,expires_at:r},await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)}return this._returnResult({data:{user:c.user,session:c},error:null})}catch(a){if(ie(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async a=>{var r;if(!t){const{data:d,error:f}=a;if(f)throw f;t=(r=d.session)!==null&&r!==void 0?r:void 0}if(!t?.refresh_token)throw new $t;const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);return c?this._returnResult({data:{user:null,session:null},error:c}):l?this._returnResult({data:{user:l.user,session:l},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(a){if(ie(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async _getSessionFromURL(t,a){try{if(!vt())throw new ml("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ml(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(a){case"implicit":if(this.flowType==="pkce")throw new $y("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ml("Not a valid implicit grant flow url.");break;default:}if(a==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new $y("No code detected.");const{data:O,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const z=new URL(window.location.href);return z.searchParams.delete("code"),window.history.replaceState(window.history.state,"",z.toString()),{data:{session:O.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:l,access_token:c,refresh_token:d,expires_in:f,expires_at:m,token_type:p}=t;if(!c||!f||!d||!p)throw new ml("No session defined in URL");const g=Math.round(Date.now()/1e3),b=parseInt(f);let w=g+b;m&&(w=parseInt(m));const _=w-g;_*1e3<=Za&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${_}s, should have been closer to ${b}s`);const S=w-b;g-S>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",S,w,g):g-S<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",S,w,g);const{data:A,error:E}=await this._getUser(c);if(E)throw E;const j={provider_token:r,provider_refresh_token:l,access_token:c,expires_in:b,expires_at:w,refresh_token:d,token_type:p,user:A.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:j,redirectType:t.type},error:null})}catch(r){if(ie(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const a=await Yi(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&a)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async a=>{var r;const{data:l,error:c}=a;if(c&&!Ld(c))return this._returnResult({error:c});const d=(r=l.session)===null||r===void 0?void 0:r.access_token;if(d){const{error:f}=await this.admin.signOut(d,t);if(f&&!(yC(f)&&(f.status===404||f.status===401||f.status===403)||Ld(f)))return this._returnResult({error:f})}return t!=="others"&&(await this._removeSession(),await yt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const a=AC(),r={id:a,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",a),this.stateChangeEmitters.delete(a)}};return this._debug("#onAuthStateChange()","registered callback with id",a),this.stateChangeEmitters.set(a,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(a)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async a=>{var r,l;try{const{data:{session:c},error:d}=a;if(d)throw d;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",c)),this._debug("INITIAL_SESSION","callback id",t,"session",c)}catch(c){await((l=this.stateChangeEmitters.get(t))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",c),console.error(c)}})}async resetPasswordForEmail(t,a={}){let r=null,l=null;this.flowType==="pkce"&&([r,l]=await Ia(this.storage,this.storageKey,!0));try{return await ue(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:l,gotrue_meta_security:{captcha_token:a.captchaToken}},headers:this.headers,redirectTo:a.redirectTo})}catch(c){if(await yt(this.storage,`${this.storageKey}-code-verifier`),ie(c))return this._returnResult({data:null,error:c});throw c}}async getUserIdentities(){var t;try{const{data:a,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=a.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var a;try{const{data:r,error:l}=await this._useSession(async c=>{var d,f,m,p,g;const{data:b,error:w}=c;if(w)throw w;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(d=t.options)===null||d===void 0?void 0:d.redirectTo,scopes:(f=t.options)===null||f===void 0?void 0:f.scopes,queryParams:(m=t.options)===null||m===void 0?void 0:m.queryParams,skipBrowserRedirect:!0});return await ue(this.fetch,"GET",_,{headers:this.headers,jwt:(g=(p=b.session)===null||p===void 0?void 0:p.access_token)!==null&&g!==void 0?g:void 0})});if(l)throw l;return vt()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(r?.url),this._returnResult({data:{provider:t.provider,url:r?.url},error:null})}catch(r){if(ie(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async a=>{var r;try{const{error:l,data:{session:c}}=a;if(l)throw l;const{options:d,provider:f,token:m,access_token:p,nonce:g}=t,b=await ue(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=c?.access_token)!==null&&r!==void 0?r:void 0,body:{provider:f,id_token:m,access_token:p,nonce:g,link_identity:!0,gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:dn}),{data:w,error:_}=b;return _?this._returnResult({data:{user:null,session:null},error:_}):!w||!w.session||!w.user?this._returnResult({data:{user:null,session:null},error:new Qa}):(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("USER_UPDATED",w.session)),this._returnResult({data:w,error:_}))}catch(l){if(await yt(this.storage,`${this.storageKey}-code-verifier`),ie(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}})}async unlinkIdentity(t){try{return await this._useSession(async a=>{var r,l;const{data:c,error:d}=a;if(d)throw d;return await ue(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(l=(r=c.session)===null||r===void 0?void 0:r.access_token)!==null&&l!==void 0?l:void 0})})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}}async _refreshAccessToken(t){const a=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{const r=Date.now();return await kC(async l=>(l>0&&await RC(200*Math.pow(2,l-1)),this._debug(a,"refreshing attempt",l),await ue(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:dn})),(l,c)=>{const d=200*Math.pow(2,l);return c&&Ud(c)&&Date.now()+d-r{try{await f.callback(t,a)}catch(m){c.push(m)}});if(await Promise.all(d),c.length>0){for(let f=0;fthis._autoRefreshTokenTick(),Za);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const a=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=a,a&&typeof a=="object"&&typeof a.unref=="function"?a.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(a)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const a=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,a&&clearTimeout(a)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async a=>{const{data:{session:r}}=a;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const l=Math.floor((r.expires_at*1e3-t)/Za);this._debug("#_autoRefreshTokenTick()",`access token expires in ${l} ticks, a tick lasts ${Za}ms, refresh threshold is ${bh} ticks`),l<=bh&&await this._callRefreshToken(r.refresh_token)})}catch(a){console.error("Auto refresh tick failed with error. This is likely a transient error.",a)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof ww)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!vt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const a=`#_onVisibilityChanged(${t})`;this._debug(a,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(a,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,a,r){const l=[`provider=${encodeURIComponent(a)}`];if(r?.redirectTo&&l.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r?.scopes&&l.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[c,d]=await Ia(this.storage,this.storageKey),f=new URLSearchParams({code_challenge:`${encodeURIComponent(c)}`,code_challenge_method:`${encodeURIComponent(d)}`});l.push(f.toString())}if(r?.queryParams){const c=new URLSearchParams(r.queryParams);l.push(c.toString())}return r?.skipBrowserRedirect&&l.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${l.join("&")}`}async _unenroll(t){try{return await this._useSession(async a=>{var r;const{data:l,error:c}=a;return c?this._returnResult({data:null,error:c}):await ue(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token})})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}}async _enroll(t){try{return await this._useSession(async a=>{var r,l;const{data:c,error:d}=a;if(d)return this._returnResult({data:null,error:d});const f=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:m,error:p}=await ue(this.fetch,"POST",`${this.url}/factors`,{body:f,headers:this.headers,jwt:(r=c?.session)===null||r===void 0?void 0:r.access_token});return p?this._returnResult({data:null,error:p}):(t.factorType==="totp"&&m.type==="totp"&&(!((l=m?.totp)===null||l===void 0)&&l.qr_code)&&(m.totp.qr_code=`data:image/svg+xml;utf-8,${m.totp.qr_code}`),this._returnResult({data:m,error:null}))})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async a=>{var r;const{data:l,error:c}=a;if(c)return this._returnResult({data:null,error:c});const d=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?sR(t.webauthn.credential_response):rR(t.webauthn.credential_response)})}:{code:t.code}),{data:f,error:m}=await ue(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:d,headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token});return m?this._returnResult({data:null,error:m}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+f.expires_in},f)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",f),this._returnResult({data:f,error:m}))})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async a=>{var r;const{data:l,error:c}=a;if(c)return this._returnResult({data:null,error:c});const d=await ue(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=l?.session)===null||r===void 0?void 0:r.access_token});if(d.error)return d;const{data:f}=d;if(f.type!=="webauthn")return{data:f,error:null};switch(f.webauthn.type){case"create":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:iR(f.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},f),{webauthn:Object.assign(Object.assign({},f.webauthn),{credential_options:Object.assign(Object.assign({},f.webauthn.credential_options),{publicKey:aR(f.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}})}async _challengeAndVerify(t){const{data:a,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:a.id,code:t.code})}async _listFactors(){var t;const{data:{user:a},error:r}=await this.getUser();if(r)return{data:null,error:r};const l={all:[],phone:[],totp:[],webauthn:[]};for(const c of(t=a?.factors)!==null&&t!==void 0?t:[])l.all.push(c),c.status==="verified"&&l[c.factor_type].push(c);return{data:l,error:null}}async _getAuthenticatorAssuranceLevel(t){var a,r,l,c;if(t)try{const{payload:_}=pl(t);let S=null;_.aal&&(S=_.aal);let A=S;const{data:{user:E},error:j}=await this.getUser(t);if(j)return this._returnResult({data:null,error:j});((r=(a=E?.factors)===null||a===void 0?void 0:a.filter(z=>z.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(A="aal2");const k=_.amr||[];return{data:{currentLevel:S,nextLevel:A,currentAuthenticationMethods:k},error:null}}catch(_){if(ie(_))return this._returnResult({data:null,error:_});throw _}const{data:{session:d},error:f}=await this.getSession();if(f)return this._returnResult({data:null,error:f});if(!d)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:m}=pl(d.access_token);let p=null;m.aal&&(p=m.aal);let g=p;((c=(l=d.user.factors)===null||l===void 0?void 0:l.filter(_=>_.status==="verified"))!==null&&c!==void 0?c:[]).length>0&&(g="aal2");const w=m.amr||[];return{data:{currentLevel:p,nextLevel:g,currentAuthenticationMethods:w},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;return l?this._returnResult({data:null,error:l}):r?await ue(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:c=>({data:c,error:null})}):this._returnResult({data:null,error:new $t})})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}}async _approveAuthorization(t,a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new $t});const d=await ue(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"approve"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&vt()&&!a?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(ie(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new $t});const d=await ue(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:l.access_token,body:{action:"deny"},xform:f=>({data:f,error:null})});return d.data&&d.data.redirect_url&&vt()&&!a?.skipBrowserRedirect&&window.location.assign(d.data.redirect_url),d})}catch(r){if(ie(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:a},error:r}=t;return r?this._returnResult({data:null,error:r}):a?await ue(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:a.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new $t})})}catch(t){if(ie(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;return l?this._returnResult({data:null,error:l}):r?(await ue(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new $t})})}catch(a){if(ie(a))return this._returnResult({data:null,error:a});throw a}}async fetchJwk(t,a={keys:[]}){let r=a.keys.find(f=>f.kid===t);if(r)return r;const l=Date.now();if(r=this.jwks.keys.find(f=>f.kid===t),r&&this.jwks_cached_at+pC>l)return r;const{data:c,error:d}=await ue(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(d)throw d;return!c.keys||c.keys.length===0||(this.jwks=c,this.jwks_cached_at=l,r=c.keys.find(f=>f.kid===t),!r)?null:r}async getClaims(t,a={}){try{let r=t;if(!r){const{data:_,error:S}=await this.getSession();if(S||!_.session)return this._returnResult({data:null,error:S});r=_.session.access_token}const{header:l,payload:c,signature:d,raw:{header:f,payload:m}}=pl(r);a?.allowExpired||BC(c.exp);const p=!l.alg||l.alg.startsWith("HS")||!l.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(l.kid,a?.keys?{keys:a.keys}:a?.jwks);if(!p){const{error:_}=await this.getUser(r);if(_)throw _;return{data:{claims:c,header:l,signature:d},error:null}}const g=zC(l.alg),b=await crypto.subtle.importKey("jwk",p,g,!0,["verify"]);if(!await crypto.subtle.verify(g,b,d,TC(`${f}.${m}`)))throw new _h("Invalid JWT signature");return{data:{claims:c,header:l,signature:d},error:null}}catch(r){if(ie(r))return this._returnResult({data:null,error:r});throw r}}}Or.nextInstanceID={};const pR=Or,gR="2.96.0";let mr="";typeof Deno<"u"?mr="deno":typeof document<"u"?mr="web":typeof navigator<"u"&&navigator.product==="ReactNative"?mr="react-native":mr="node";const yR={"X-Client-Info":`supabase-js-${mr}/${gR}`},vR={headers:yR},bR={schema:"public"},wR={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},xR={};function Nr(n){"@babel/helpers - typeof";return Nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nr(n)}function _R(n,t){if(Nr(n)!="object"||!n)return n;var a=n[Symbol.toPrimitive];if(a!==void 0){var r=a.call(n,t);if(Nr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function SR(n){var t=_R(n,"string");return Nr(t)=="symbol"?t:t+""}function TR(n,t,a){return(t=SR(t))in n?Object.defineProperty(n,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[t]=a,n}function iv(n,t){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(n,l).enumerable})),a.push.apply(a,r)}return a}function Ke(n){for(var t=1;tn?(...t)=>n(...t):(...t)=>fetch(...t),AR=()=>Headers,jR=(n,t,a)=>{const r=ER(a),l=AR();return async(c,d)=>{var f;const m=(f=await t())!==null&&f!==void 0?f:n;let p=new l(d?.headers);return p.has("apikey")||p.set("apikey",n),p.has("Authorization")||p.set("Authorization",`Bearer ${m}`),r(c,Ke(Ke({},d),{},{headers:p}))}};function CR(n){return n.endsWith("/")?n:n+"/"}function RR(n,t){var a,r;const{db:l,auth:c,realtime:d,global:f}=n,{db:m,auth:p,realtime:g,global:b}=t,w={db:Ke(Ke({},m),l),auth:Ke(Ke({},p),c),realtime:Ke(Ke({},g),d),storage:{},global:Ke(Ke(Ke({},b),f),{},{headers:Ke(Ke({},(a=b?.headers)!==null&&a!==void 0?a:{}),(r=f?.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return n.accessToken?w.accessToken=n.accessToken:delete w.accessToken,w}function kR(n){const t=n?.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(CR(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var OR=class extends pR{constructor(n){super(n)}},NR=class{constructor(n,t,a){var r,l;this.supabaseUrl=n,this.supabaseKey=t;const c=kR(n);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const d=`sb-${c.hostname.split(".")[0]}-auth-token`,f={db:bR,realtime:xR,auth:Ke(Ke({},wR),{},{storageKey:d}),global:vR},m=RR(a??{},f);if(this.storageKey=(r=m.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(l=m.global.headers)!==null&&l!==void 0?l:{},m.accessToken)this.accessToken=m.accessToken,this.auth=new Proxy({},{get:(g,b)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=m.auth)!==null&&p!==void 0?p:{},this.headers,m.global.fetch)}this.fetch=jR(t,this._getAccessToken.bind(this),m.global.fetch),this.realtime=this._initRealtimeClient(Ke({headers:this.headers,accessToken:this._getAccessToken.bind(this)},m.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(g=>this.realtime.setAuth(g)).catch(g=>console.warn("Failed to set initial Realtime auth token:",g)),this.rest=new y2(new URL("rest/v1",c).href,{headers:this.headers,schema:m.db.schema,fetch:this.fetch,timeout:m.db.timeout,urlLengthLimit:m.db.urlLengthLimit}),this.storage=new uC(this.storageUrl.href,this.headers,this.fetch,a?.storage),m.accessToken||this._listenForAuthEvents()}get functions(){return new c2(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,t={},a={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,t,a)}channel(n,t={config:{}}){return this.realtime.channel(n,t)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,t,a;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return(t=(a=r.session)===null||a===void 0?void 0:a.access_token)!==null&&t!==void 0?t:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:t,detectSessionInUrl:a,storage:r,userStorage:l,storageKey:c,flowType:d,lock:f,debug:m,throwOnError:p},g,b){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new OR({url:this.authUrl.href,headers:Ke(Ke({},w),g),storageKey:c,autoRefreshToken:n,persistSession:t,detectSessionInUrl:a,storage:r,userStorage:l,flowType:d,lock:f,debug:m,throwOnError:p,fetch:b,hasCustomAuthorizationHeader:Object.keys(this.headers).some(_=>_.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new D2(this.realtimeUrl.href,Ke(Ke({},n),{},{params:Ke(Ke({},{apikey:this.supabaseKey}),n?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,t)=>{this._handleTokenChanged(n,"CLIENT",t?.access_token)})}_handleTokenChanged(n,t,a){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==a?(this.changedAccessToken=a,this.realtime.setAuth(a)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const MR=(n,t,a)=>new NR(n,t,a);function DR(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const t=n.version;if(t==null)return!1;const a=t.match(/^v(\d+)\./);return a?parseInt(a[1],10)<=18:!1}DR()&&console.warn("โš ๏ธ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const av="https://placeholder.supabase.co",LR="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBsYWNlaG9sZGVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDAwMDAwMDAsImV4cCI6MjAwMDAwMDAwMH0.placeholder",Ki=av.includes("placeholder")?null:MR(av,LR),UR=500,sv=["Novato","Aprendiz","Cantante","Vocalista","Artista","Estrella","Superestrella","Leyenda","Diva","Icono","Maestro","Virtuoso","Fenomeno","Mito","Divinidad"];function BR(n){return sv[Math.min(n,sv.length-1)]}function Bl(n){return n*UR}function Sw(n,t){const a=Bl(t),r=Bl(t+1);return Math.min(1,(n-a)/(r-a))}const Tw="oralify_profile",Ew="oralify_history";function zR(){try{const n=localStorage.getItem(Tw);return n?JSON.parse(n):{}}catch{return{}}}function rv(n){localStorage.setItem(Tw,JSON.stringify(n))}function PR(){try{const n=localStorage.getItem(Ew);return n?JSON.parse(n):[]}catch{return[]}}function VR(n){localStorage.setItem(Ew,JSON.stringify(n.slice(-200)))}function Aw(n){let t=0;for(;n>=Bl(t+1);)t++;return t}function Pd(n){const t=zR();return{id:n?.id??"guest",email:n?.email??"",name:n?.user_metadata?.full_name??n?.user_metadata?.name??t.name??"Cantante",avatar:n?.user_metadata?.avatar_url??n?.user_metadata?.picture??t.avatar??"",xp:t.xp??0,level:Aw(t.xp??0),totalSongs:t.totalSongs??0,totalMinutes:t.totalMinutes??0,bestScore:t.bestScore??0,bestStreak:t.bestStreak??0,dailyStreak:t.dailyStreak??0,lastPlayedAt:t.lastPlayedAt??null,achievements:t.achievements??[],favoriteSongs:t.favoriteSongs??[],history:PR()}}const Sh=[{id:"first-song",title:"Primera cancion",desc:"Canta tu primera cancion",icon:"๐ŸŽค",condition:n=>n.totalSongs>=1},{id:"ten-songs",title:"Diez canciones",desc:"Canta 10 canciones",icon:"๐Ÿ”Ÿ",condition:n=>n.totalSongs>=10},{id:"fifty-songs",title:"Medio centenar",desc:"Canta 50 canciones",icon:"๐ŸŽต",condition:n=>n.totalSongs>=50},{id:"hundred-songs",title:"Centenario",desc:"Canta 100 canciones",icon:"๐Ÿ’ฏ",condition:n=>n.totalSongs>=100},{id:"perfect-note",title:"Nota perfecta",desc:"Consigue 90%+ en una cancion",icon:"โœจ",condition:n=>n.bestScore>=90},{id:"pitch-master",title:"Pitch Master",desc:"Consigue 95%+ en una cancion",icon:"๐ŸŽฏ",condition:n=>n.bestScore>=95},{id:"streak-5",title:"En racha",desc:"Racha de 5 notas perfectas",icon:"๐Ÿ”ฅ",condition:n=>n.bestStreak>=5},{id:"streak-20",title:"Imparable",desc:"Racha de 20 notas perfectas",icon:"โšก",condition:n=>n.bestStreak>=20},{id:"streak-50",title:"Leyenda",desc:"Racha de 50 notas perfectas",icon:"๐Ÿ‘‘",condition:n=>n.bestStreak>=50},{id:"one-hour",title:"Una hora cantando",desc:"Acumula 60 minutos cantando",icon:"โฑ๏ธ",condition:n=>n.totalMinutes>=60},{id:"five-hours",title:"Maraton vocal",desc:"Acumula 5 horas cantando",icon:"๐Ÿƒ",condition:n=>n.totalMinutes>=300},{id:"daily-3",title:"Constante",desc:"3 dias seguidos cantando",icon:"๐Ÿ“…",condition:n=>n.dailyStreak>=3},{id:"daily-7",title:"Semanal",desc:"7 dias seguidos cantando",icon:"๐Ÿ—“๏ธ",condition:n=>n.dailyStreak>=7},{id:"daily-30",title:"Dedicacion total",desc:"30 dias seguidos cantando",icon:"๐Ÿ†",condition:n=>n.dailyStreak>=30},{id:"level-5",title:"Artista",desc:"Llega al nivel 5",icon:"โญ",condition:n=>n.level>=5},{id:"level-10",title:"Estrella",desc:"Llega al nivel 10",icon:"๐ŸŒŸ",condition:n=>n.level>=10}];function qR(){const[n,t]=M.useState(null),[a,r]=M.useState(null),[l,c]=M.useState(!0),[d,f]=M.useState(()=>Pd(null)),[m,p]=M.useState([]);M.useEffect(()=>{if(!Ki){c(!1);return}Ki.auth.getSession().then(({data:{session:E}})=>{r(E),t(E?.user??null),f(Pd(E?.user)),c(!1)});const{data:{subscription:A}}=Ki.auth.onAuthStateChange((E,j)=>{r(j),t(j?.user??null),f(O=>({...O,...Pd(j?.user)}))});return()=>A.unsubscribe()},[]);const g=M.useCallback(async()=>{Ki&&await Ki.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}})},[]),b=M.useCallback(async()=>{Ki&&(await Ki.auth.signOut(),t(null),r(null))},[]),w=M.useCallback((A,E,j,O,k)=>{f(z=>{const G=new Date().toISOString(),Y=G.slice(0,10),I=z.lastPlayedAt?.slice(0,10);let X=z.dailyStreak;I===Y||(I?X=(new Date(Y).getTime()-new Date(I).getTime())/864e5<=1?X+1:1:X=1);const ee=Math.round(j/100*50+Math.min(O,50)*2+Math.min(k/60,5)*10),ve=z.xp+ee,Re=Aw(ve),Ae={songId:A,songTitle:E,score:Math.round(j),streak:O,playedAt:G,durationSecs:k},ae=[...z.history,Ae].slice(-200),re={...z,xp:ve,level:Re,totalSongs:z.totalSongs+1,totalMinutes:z.totalMinutes+Math.round(k/60),bestScore:Math.max(z.bestScore,Math.round(j)),bestStreak:Math.max(z.bestStreak,O),dailyStreak:X,lastPlayedAt:G,history:ae},se=Sh.filter(D=>D.condition(re)&&!z.achievements.includes(D.id));return se.length>0&&(re.achievements=[...z.achievements,...se.map(D=>D.id)],p(se),setTimeout(()=>p([]),5e3)),rv(re),VR(ae),re})},[]),_=M.useCallback(A=>{f(E=>{const j=E.favoriteSongs.includes(A)?E.favoriteSongs.filter(k=>k!==A):[...E.favoriteSongs,A],O={...E,favoriteSongs:j};return rv(O),O})},[]),S=M.useCallback(()=>p([]),[]);return{user:n,session:a,loading:l,profile:d,loginWithGoogle:g,logout:b,recordPlay:w,toggleFavorite:_,newAchievements:m,dismissAchievements:S,isGuest:!n}}const HR="https://oralify-songs.divenamic.workers.dev";function ov(n){if(!n)return"";if(n.startsWith("http"))return n;{const t=n.startsWith("/songs/")?n.slice(7):n.replace(/^\//,"");return`${HR}/${t}`}}function lv({data:n,color:t="brand",height:a=28}){const l=Math.max(1,Math.floor(n.length/300)),c=Array.from({length:300},(f,m)=>{const g=((n[m*l]||128)-128)/128*(a/2)+a/2;return`${m},${g.toFixed(1)}`}).join(" "),d=t==="brand"?"url(#wf-brand)":t==="green"?"url(#wf-green)":"#fff";return v.jsxs("svg",{viewBox:`0 0 300 ${a}`,className:"w-full",style:{height:a},preserveAspectRatio:"none",children:[v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"wf-brand",x1:"0",x2:"1",y1:"0",y2:"0",children:[v.jsx("stop",{offset:"0%",stopColor:"#a855f7"}),v.jsx("stop",{offset:"100%",stopColor:"#f43f5e"})]}),v.jsxs("linearGradient",{id:"wf-green",x1:"0",x2:"1",y1:"0",y2:"0",children:[v.jsx("stop",{offset:"0%",stopColor:"#34d399"}),v.jsx("stop",{offset:"100%",stopColor:"#22d3ee"})]})]}),v.jsx("polyline",{points:c,fill:"none",stroke:d,strokeWidth:"1.5",opacity:"0.6"})]})}function cv({data:n,color:t="brand",height:a=60,barCount:r=48}){const l=Math.max(1,Math.floor(n.length/r)),c=Array.from({length:r},(f,m)=>n[m*l]||0),d=t==="brand"?"from-brand-500 to-accent-500":t==="green"?"from-emerald-400 to-cyan-400":"from-white/20 to-white/40";return v.jsx("div",{className:"flex items-end justify-center gap-[2px]",style:{height:a},children:c.map((f,m)=>v.jsx("div",{className:`w-[3px] rounded-full bg-gradient-to-t ${d} transition-all duration-75`,style:{height:`${Math.max(2,f/255*100)}%`,opacity:.4+f/255*.6}},m))})}function GR({song:n,isActive:t,onSelect:a}){const r=dh(n),l=r.difficulty==="beginner"?"๐ŸŸข":r.difficulty==="advanced"?"๐Ÿ”ด":"๐ŸŸก",c=n.lang==="es"?"๐Ÿ‡ช๐Ÿ‡ธ":n.lang==="en"?"๐Ÿ‡ฌ๐Ÿ‡ง":"๐ŸŽน";return v.jsx("button",{onClick:a,className:`text-left p-2.5 rounded-xl transition-all duration-200 w-full ${t?"bg-brand-500/15 border border-brand-500/30 ring-1 ring-brand-500/20":"hover:bg-white/5 border border-transparent"}`,children:v.jsxs("div",{className:"flex items-center gap-2.5",children:[v.jsxs("div",{className:`w-9 h-9 rounded-lg bg-gradient-to-br ${n.color} flex items-center justify-center text-sm shrink-0 relative`,children:[n.emoji,r.hasLyrics&&v.jsx("div",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-emerald-400"})]}),v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsx("div",{className:"text-sm font-medium text-white truncate leading-tight",children:n.title}),v.jsxs("div",{className:"text-[11px] text-white/35 truncate flex items-center gap-1",children:[v.jsx("span",{children:n.artist}),v.jsx("span",{className:"text-[9px] opacity-60",children:l}),v.jsx("span",{className:"text-[9px] opacity-60",children:c})]})]}),t&&v.jsx("div",{className:"flex gap-0.5 items-center shrink-0",children:[1,2,3].map(d=>v.jsx("div",{className:"w-[2px] bg-brand-400 rounded-full animate-waveform",style:{animationDelay:`${d*.1}s`,height:12}},d))}),!n.file&&!t&&v.jsx("div",{className:"text-[9px] text-amber-400/60 shrink-0",children:"soon"})]})})}function $R({mode:n,onModeChange:t}){const a=[{id:"original",label:"Full",icon:"๐ŸŽต"},{id:"karaoke",label:"Karaoke",icon:"๐ŸŽค"},{id:"vocals",label:"Vocals",icon:"๐Ÿ—ฃ๏ธ"}];return v.jsx("div",{className:"flex gap-1.5",children:a.map(r=>v.jsxs("button",{onClick:()=>t(r.id),className:`flex items-center gap-1 px-2.5 py-1 rounded-full text-[11px] font-medium transition-all ${n===r.id?"bg-brand-500/30 text-brand-300 border border-brand-500/40":"text-white/30 hover:text-white/50"}`,children:[v.jsx("span",{className:"text-xs",children:r.icon}),v.jsx("span",{className:"hidden sm:inline",children:r.label})]},r.id))})}function QR({lyrics:n,currentTime:t,isPlaying:a}){const{current:r,currentIdx:l,progress:c}=i2(n,t),d=M.useRef(null);if(M.useEffect(()=>{if(l<0||!d.current)return;const b=d.current.children[l];b&&b.scrollIntoView({behavior:"smooth",block:"center"})},[l]),!n.length)return v.jsx("div",{className:"text-center py-6",children:v.jsx("div",{className:"text-white/20 text-sm",children:"Cargando letras..."})});const f=Math.max(0,l-1),m=Math.min(n.length,l+4),p=n.slice(f,m),g=(b,w)=>{if(!b)return v.jsx("span",{className:"text-white/15",children:"โ™ช โ™ช โ™ช"});const _=b.split(/(\s+)/),S=b.length,A=Math.floor(w*S);let E=0;return _.map((j,O)=>{const k=E;E+=j.length;const z=E;if(z<=A)return v.jsx("span",{className:"text-white transition-colors duration-100",children:j},O);if(kA){const G=A-k;return v.jsxs("span",{children:[v.jsx("span",{className:"text-white",children:j.slice(0,G)}),v.jsx("span",{className:"text-white/30",children:j.slice(G)})]},O)}return v.jsx("span",{className:"text-white/30 transition-colors duration-200",children:j},O)})};return v.jsxs("div",{className:"relative py-2 px-2",children:[a&&r&&v.jsx($e.div,{className:"absolute inset-0 rounded-xl bg-brand-500/[0.03] pointer-events-none",animate:{opacity:[.03,.08,.03]},transition:{duration:r?Math.max(.4,(n[l+1]?.time??t+2)-t):1.5,repeat:1/0,ease:"easeInOut"}}),v.jsx("div",{className:"space-y-2 text-center min-h-[8rem] flex flex-col justify-center",children:!a&&!r?v.jsx("div",{className:"text-lg text-white/30 font-medium",children:"Pulsa play para empezar"}):p.length===0&&a?v.jsx("div",{className:"text-lg text-white/20",children:"โ™ช โ™ช โ™ช"}):p.map((b,w)=>{const _=f+w,S=_===l,A=_l;return v.jsx($e.div,{initial:{opacity:0,y:6},animate:{opacity:S?1:A?.2:.35,y:0,scale:S?1:.92},transition:{duration:.3,ease:"easeOut"},className:`leading-snug transition-all ${S?"text-xl md:text-2xl font-bold":"text-sm md:text-base font-medium"} ${E?"text-white/25":""}`,children:S?v.jsx("span",{className:"inline-block",children:g(b.text,c)}):v.jsx("span",{className:A?"text-white/15":"text-white/25",children:b.text})},`${_}-${b.time}`)})}),r&&a&&v.jsx("div",{className:"w-32 h-[3px] mx-auto mt-2 bg-white/5 rounded-full overflow-hidden",children:v.jsx($e.div,{className:"h-full bg-gradient-to-r from-brand-500 to-accent-500 rounded-full",animate:{width:`${c*100}%`},transition:{duration:.15,ease:"linear"}})})]})}function uv({cents:n,volume:t,note:a}){const r=t>.008,l=Math.abs(n);if(!r||a==="-")return v.jsx("div",{className:"rounded-2xl p-4 bg-white/[0.03] border border-white/5 text-center",children:v.jsxs("div",{className:"flex items-center justify-center gap-3",children:[v.jsx("div",{className:"text-2xl opacity-30",children:"๐ŸŽค"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-sm text-white/25 font-medium",children:"Canta algo..."}),v.jsx("div",{className:"text-[11px] text-white/15",children:"Tu voz aparecera aqui en tiempo real"})]})]})});const c=n>0,d=l<10?"perfect":l<25?"good":l<50?"off":"bad",f={perfect:{bg:"from-emerald-500/25 to-emerald-900/15",border:"border-emerald-400/40",icon:"โœจ",label:"PERFECTO",sub:"Estas clavando la nota",color:"text-emerald-400",barColor:"bg-emerald-400"},good:{bg:"from-yellow-500/15 to-yellow-900/10",border:"border-yellow-400/30",icon:"๐Ÿ‘",label:"CASI",sub:c?"Un poco alto โ€” relaja":"Un poco bajo โ€” mas aire",color:"text-yellow-400",barColor:"bg-yellow-400"},off:{bg:"from-orange-500/15 to-orange-900/10",border:"border-orange-400/30",icon:c?"โฌ‡๏ธ":"โฌ†๏ธ",label:c?"BAJA":"SUBE",sub:c?"Relaja la garganta":"Mas soporte desde el diafragma",color:"text-orange-400",barColor:"bg-orange-400"},bad:{bg:"from-red-500/15 to-red-900/10",border:"border-red-400/30",icon:c?"โฌ‡๏ธโฌ‡๏ธ":"โฌ†๏ธโฌ†๏ธ",label:c?"MUY ALTO":"MUY BAJO",sub:c?"Abre la boca, relaja cuello":"Respira profundo, impulsa",color:"text-red-400",barColor:"bg-red-400"}}[d];return v.jsxs($e.div,{initial:{scale:.97,opacity:0},animate:{scale:1,opacity:1},className:`rounded-2xl p-4 bg-gradient-to-b ${f.bg} border ${f.border} transition-all duration-200`,children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"text-3xl shrink-0",children:f.icon}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:`text-lg font-black ${f.color} leading-tight`,children:f.label}),v.jsx("div",{className:"text-xs text-white/40 mt-0.5",children:f.sub})]}),v.jsxs("div",{className:"text-right shrink-0",children:[v.jsx("div",{className:`text-2xl font-black ${f.color}`,children:a}),v.jsxs("div",{className:`text-[11px] font-mono ${f.color}`,children:[n>0?"+":"",n,"ยข"]})]})]}),v.jsxs("div",{className:"mt-2.5 h-2 bg-black/20 rounded-full relative overflow-hidden",children:[v.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/15"}),v.jsx($e.div,{className:`absolute inset-y-0 w-5 rounded-full ${f.barColor}`,animate:{left:`${Math.max(5,Math.min(95,50+n*.8))}%`},transition:{type:"spring",stiffness:200,damping:20},style:{transform:"translateX(-50%)"}})]})]},d)}const gl={totalPoints:0,streak:0,bestStreak:0,multiplier:1,totalNotes:0,perfects:0,greats:0,goods:0,misses:0,accuracy:0,lastJudgement:null,lastPoints:0,popups:[]},jw={perfect:{label:"PERFECT!",emoji:"โœจ",color:"text-emerald-400",bg:"from-emerald-400/30",glow:"shadow-emerald-400/50",base:100},great:{label:"GREAT!",emoji:"๐Ÿ”ฅ",color:"text-cyan-400",bg:"from-cyan-400/30",glow:"shadow-cyan-400/50",base:75},good:{label:"GOOD",emoji:"๐Ÿ‘",color:"text-yellow-400",bg:"from-yellow-400/20",glow:"shadow-yellow-400/30",base:40},miss:{label:"MISS",emoji:"๐Ÿ’จ",color:"text-red-400/60",bg:"from-red-400/10",glow:"",base:0}};function Cw(n){return n>=95?5:n>=85?4:n>=70?3:n>=50?2:n>=25?1:0}function Rw({stars:n,animated:t=!1}){return v.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(a=>v.jsx($e.div,{initial:t?{scale:0,rotate:-180}:{},animate:t?{scale:1,rotate:0}:{},transition:t?{delay:a*.15,type:"spring",stiffness:300}:{},children:v.jsx(El,{className:`w-3 h-3 ${a<=n?"text-yellow-400 fill-yellow-400":"text-white/10"}`})},a))})}function dv({pitchHistory:n}){const t=M.useRef(null),a=M.useRef(null);return M.useEffect(()=>{const r=t.current,l=a.current;if(!r||!l)return;const c=r.getContext("2d");if(!c)return;const d=window.devicePixelRatio||1,f=l.clientWidth,m=70;r.width=f*d,r.height=m*d,r.style.width=`${f}px`,r.style.height=`${m}px`,c.scale(d,d),c.clearRect(0,0,f,m);const p=8,g=m-8,b=g-p;for(let E=0;E<5;E++){const j=p+b/4*E;c.beginPath(),c.strokeStyle="rgba(255,255,255,0.06)",c.lineWidth=1,c.moveTo(0,j),c.lineTo(f,j),c.stroke()}const w=["C5","A4","E4","C4","A3"];if(c.font="8px monospace",c.fillStyle="rgba(255,255,255,0.15)",w.forEach((E,j)=>{const O=p+b/4*j;c.fillText(E,2,O-2)}),n.length<2)return;const _=n.slice(-100),S=E=>{const j=E.match(/([A-G]#?)(\d)/);if(!j)return m/2;const k=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"].indexOf(j[1]),Y=(parseInt(j[2])*12+k-48)/36;return g-Y*b};c.beginPath(),c.strokeStyle="rgba(255,255,255,0.05)",c.lineWidth=1.5;let A=!1;_.forEach((E,j)=>{if(E.volume<.008||E.note==="-")return;const O=j/_.length*(f-20)+10,k=S(E.note);A?c.lineTo(O,k):(c.moveTo(O,k),A=!0)}),c.stroke(),_.forEach((E,j)=>{if(E.volume<.008||E.note==="-")return;const O=j/_.length*(f-20)+10,k=S(E.note),z=Math.abs(E.cents);let G,Y;z<10?(G="#34d399",Y="rgba(52,211,153,0.4)"):z<25?(G="#22d3ee",Y="rgba(34,211,238,0.3)"):z<50?(G="#fbbf24",Y="rgba(251,191,36,0.3)"):(G="#f87171",Y="rgba(248,113,113,0.2)");const I=j>_.length-5,X=I?4:2.5,ee=.3+j/_.length*.7;I&&z<25&&(c.beginPath(),c.arc(O,k,X+4,0,Math.PI*2),c.fillStyle=Y,c.fill()),c.beginPath(),c.arc(O,k,X,0,Math.PI*2),c.fillStyle=G,c.globalAlpha=ee,c.fill(),c.globalAlpha=1,j===_.length-1&&(c.font="bold 10px system-ui",c.fillStyle=G,c.fillText(E.note,O+6,k+3))})},[n]),v.jsx("div",{ref:a,className:"relative w-full",children:v.jsx("canvas",{ref:t,className:"w-full rounded-lg bg-white/[0.02]"})})}function IR({game:n,isActive:t}){if(!t)return null;const a=Cw(n.accuracy),r=n.lastJudgement?jw[n.lastJudgement]:null;return v.jsx("div",{className:"px-4 py-1.5",children:v.jsxs("div",{className:"flex items-center gap-3 bg-black/30 rounded-lg px-3 py-1.5 border border-white/5",children:[v.jsx("div",{className:"font-black text-white tabular-nums text-base",children:n.totalPoints.toLocaleString()}),r&&v.jsx(fr,{mode:"wait",children:v.jsx($e.span,{initial:{scale:1.4,opacity:1},animate:{scale:1,opacity:.8},exit:{opacity:0},className:`text-xs font-black ${r.color}`,children:r.label},n.popups.length)}),v.jsx("div",{className:"flex-1"}),n.streak>=3&&v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-sm",children:n.streak>=30?"๐Ÿ”ฅ๐Ÿ”ฅ":"๐Ÿ”ฅ"}),v.jsx("span",{className:"text-sm font-black text-amber-400",children:n.streak}),n.multiplier>1&&v.jsxs("span",{className:`text-[10px] font-bold ${n.multiplier>=4?"text-red-400":n.multiplier>=2?"text-yellow-400":"text-white/40"}`,children:["x",n.multiplier]})]}),v.jsx(Rw,{stars:a}),v.jsxs("span",{className:"text-[10px] text-white/30 font-mono",children:[Math.round(n.accuracy),"%"]})]})})}function YR({game:n,song:t,onClose:a}){const r=Cw(n.accuracy),l=n.accuracy>=95?"S":n.accuracy>=85?"A":n.accuracy>=70?"B":n.accuracy>=50?"C":"D",c=l==="S"?"text-emerald-400 border-emerald-400":l==="A"?"text-cyan-400 border-cyan-400":l==="B"?"text-yellow-400 border-yellow-400":"text-orange-400 border-orange-400";return v.jsx($e.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"absolute inset-0 z-50 bg-black/80 backdrop-blur-xl flex items-center justify-center p-6",children:v.jsxs("div",{className:"w-full max-w-sm text-center space-y-5",children:[v.jsxs("div",{children:[v.jsx("div",{className:"text-sm text-white/40 mb-1",children:t.artist}),v.jsx("div",{className:"text-xl font-bold text-white",children:t.title})]}),v.jsx($e.div,{initial:{scale:0,rotate:-20},animate:{scale:1,rotate:0},transition:{type:"spring",stiffness:200,delay:.3},className:`w-20 h-20 mx-auto rounded-full border-4 ${c} flex items-center justify-center`,children:v.jsx("span",{className:`text-4xl font-black ${c}`,children:l})}),v.jsx("div",{className:"flex justify-center",children:v.jsx(Rw,{stars:r,animated:!0})}),v.jsxs($e.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.5},className:"text-4xl font-black text-white",children:[n.totalPoints.toLocaleString(),v.jsx("span",{className:"text-sm text-white/30 ml-1",children:"pts"})]}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:[{label:"Perfect",val:n.perfects,color:"text-emerald-400"},{label:"Great",val:n.greats,color:"text-cyan-400"},{label:"Good",val:n.goods,color:"text-yellow-400"},{label:"Miss",val:n.misses,color:"text-red-400"}].map(d=>v.jsxs("div",{className:"text-center",children:[v.jsx("div",{className:`text-lg font-bold ${d.color}`,children:d.val}),v.jsx("div",{className:"text-[9px] text-white/30 uppercase",children:d.label})]},d.label))}),v.jsxs("div",{className:"flex justify-center gap-6 text-sm",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-amber-400 font-bold",children:n.bestStreak}),v.jsx("span",{className:"text-white/30 ml-1",children:"best combo"})]}),v.jsxs("div",{children:[v.jsxs("span",{className:"text-white font-bold",children:[Math.round(n.accuracy),"%"]}),v.jsx("span",{className:"text-white/30 ml-1",children:"accuracy"})]})]}),v.jsx("button",{onClick:a,className:"px-6 py-2.5 rounded-full bg-gradient-to-r from-brand-500 to-accent-500 text-white font-bold text-sm hover:scale-105 transition-transform",children:"Seguir cantando"})]})})}function KR({score:n,streak:t}){if(n===0)return null;const a=n>=90?"S":n>=80?"A":n>=70?"B":n>=60?"C":"D",r=n>=90?"text-emerald-400 border-emerald-400/30":n>=80?"text-cyan-400 border-cyan-400/30":n>=70?"text-yellow-400 border-yellow-400/30":"text-orange-400 border-orange-400/30";return v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:`w-8 h-8 rounded-full border-2 ${r} flex items-center justify-center text-xs font-black`,children:a}),v.jsxs("div",{className:"text-right",children:[v.jsxs("div",{className:"text-[11px] text-white/50 font-mono",children:[Math.round(n),"%"]}),t>=3&&v.jsxs("div",{className:"text-[9px] text-amber-400",children:["๐Ÿ”ฅ ",t]})]})]})}function XR({currentTime:n,duration:t,onSeek:a}){const r=l=>`${Math.floor(l/60)}:${String(Math.floor(l%60)).padStart(2,"0")}`;return v.jsxs("div",{className:"flex items-center gap-2 w-full",children:[v.jsx("span",{className:"text-[11px] text-white/30 font-mono w-8 text-right",children:r(n)}),v.jsx("div",{className:"flex-1 h-1 bg-white/10 rounded-full cursor-pointer relative group",onClick:l=>{const c=l.currentTarget.getBoundingClientRect();a((l.clientX-c.left)/c.width*t)},children:v.jsx("div",{className:"h-full bg-gradient-to-r from-brand-500 to-accent-500 rounded-full transition-all duration-100",style:{width:`${t?n/t*100:0}%`}})}),v.jsx("span",{className:"text-[11px] text-white/30 font-mono w-8",children:r(t)})]})}function FR({onSelectResult:n}){const[t,a]=M.useState(""),[r,l]=M.useState([]),[c,d]=M.useState(!1),f=M.useRef(void 0),m=M.useCallback(p=>{if(a(p),f.current&&clearTimeout(f.current),p.length<2){l([]);return}f.current=setTimeout(async()=>{d(!0);const g=await a2(p);l(g),d(!1)},400)},[]);return v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:"relative",children:[v.jsx(nw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-white/20"}),v.jsx("input",{type:"text",value:t,onChange:p=>m(p.target.value),placeholder:"Buscar en LRCLIB...",className:"w-full pl-9 pr-3 py-2 rounded-lg bg-white/5 border border-white/5 text-white text-xs placeholder:text-white/20 focus:outline-none focus:border-brand-500/40 transition-colors"}),c&&v.jsx("div",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3 h-3 border-2 border-brand-400 border-t-transparent rounded-full animate-spin"})]}),r.length>0&&v.jsx("div",{className:"absolute z-50 mt-1 w-full glass rounded-xl max-h-48 overflow-y-auto divide-y divide-white/5 shadow-xl",children:r.map(p=>v.jsxs("button",{onClick:()=>{n(p),a(""),l([])},className:"w-full text-left px-3 py-2 hover:bg-white/5 transition-colors flex items-center gap-2",children:[v.jsx("div",{className:"text-sm",children:p.hasSyncedLyrics?"๐ŸŽต":"๐Ÿ“"}),v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsx("div",{className:"text-xs text-white font-medium truncate",children:p.title}),v.jsx("div",{className:"text-[10px] text-white/30 truncate",children:p.artist})]}),p.hasSyncedLyrics&&v.jsx("div",{className:"text-[8px] text-emerald-400 bg-emerald-400/10 px-1 py-0.5 rounded",children:"SYNC"})]},p.id))})]})}function kw({onClick:n}){return v.jsxs("button",{onClick:n,className:"flex items-center gap-3 px-5 py-3 rounded-2xl bg-white text-gray-800 font-semibold text-sm hover:shadow-lg hover:shadow-white/10 hover:scale-[1.02] transition-all",children:[v.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[v.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),v.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),v.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),v.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Entrar con Google"]})}function JR({onClose:n,onLogin:t}){return v.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",onClick:n,children:v.jsxs($e.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},className:"glass rounded-3xl p-8 max-w-sm w-full text-center glow-border",onClick:a=>a.stopPropagation(),children:[v.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-brand-500 to-accent-500 flex items-center justify-center mx-auto mb-4",children:v.jsx(ss,{className:"w-8 h-8 text-white"})}),v.jsx("h3",{className:"text-xl font-bold mb-2",children:"Bienvenido a Oralify Music"}),v.jsx("p",{className:"text-white/40 text-sm mb-6",children:"Inicia sesion para guardar tu progreso, logros y estadisticas"}),v.jsx(kw,{onClick:t}),v.jsx("button",{onClick:n,className:"mt-4 text-sm text-white/30 hover:text-white/50 transition-colors",children:"Continuar como invitado"})]})})}function ZR({profile:n,onClick:t}){const a=Sw(n.xp,n.level);return v.jsxs("button",{onClick:t,className:"flex items-center gap-2 group","aria-label":"Profile",children:[v.jsxs("div",{className:"relative",children:[n.avatar?v.jsx("img",{src:n.avatar,alt:n.name,className:"w-8 h-8 rounded-full object-cover border-2 border-brand-500/40"}):v.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-brand-500 to-accent-500 flex items-center justify-center text-sm font-bold",children:n.name.charAt(0).toUpperCase()}),v.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 bg-surface-900 rounded-full px-1 py-0 text-[8px] font-bold text-brand-300 border border-brand-500/30",children:n.level})]}),v.jsxs("div",{className:"hidden sm:flex flex-col items-start",children:[v.jsx("span",{className:"text-[10px] text-white/50 font-medium leading-none",children:n.name.split(" ")[0]}),v.jsx("div",{className:"w-14 h-1 bg-white/10 rounded-full mt-0.5 overflow-hidden",children:v.jsx("div",{className:"h-full bg-brand-500 rounded-full transition-all",style:{width:`${a*100}%`}})})]})]})}function WR({profile:n,onClose:t,onLogout:a,isGuest:r,onLogin:l}){const c=Sw(n.xp,n.level),d=Bl(n.level+1),f=BR(n.level),m=new Set(n.achievements),p=[...n.history].reverse().slice(0,10);return v.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[60] flex justify-end bg-black/40 backdrop-blur-sm",onClick:t,children:v.jsx($e.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:"w-full max-w-sm h-full bg-surface-900/95 backdrop-blur-xl border-l border-white/10 overflow-y-auto",onClick:g=>g.stopPropagation(),children:v.jsxs("div",{className:"p-5",children:[v.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 rounded-full hover:bg-white/10 text-white/40",children:v.jsx(rw,{className:"w-5 h-5"})}),v.jsxs("div",{className:"text-center pt-4 pb-6",children:[v.jsxs("div",{className:"relative inline-block mb-3",children:[n.avatar?v.jsx("img",{src:n.avatar,alt:n.name,className:"w-20 h-20 rounded-full object-cover border-4 border-brand-500/30"}):v.jsx("div",{className:"w-20 h-20 rounded-full bg-gradient-to-br from-brand-500 to-accent-500 flex items-center justify-center text-3xl font-bold",children:n.name.charAt(0).toUpperCase()}),v.jsxs("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 bg-brand-600 rounded-full px-2.5 py-0.5 text-xs font-bold text-white border-2 border-surface-900",children:["Lv.",n.level]})]}),v.jsx("h3",{className:"text-lg font-bold",children:n.name}),v.jsx("p",{className:"text-sm text-brand-300 font-medium",children:f}),v.jsxs("div",{className:"mt-3 max-w-[200px] mx-auto",children:[v.jsxs("div",{className:"flex justify-between text-[10px] text-white/30 mb-1",children:[v.jsxs("span",{children:[n.xp," XP"]}),v.jsxs("span",{children:[d," XP"]})]}),v.jsx("div",{className:"h-2 bg-white/10 rounded-full overflow-hidden",children:v.jsx($e.div,{className:"h-full bg-gradient-to-r from-brand-500 to-accent-500 rounded-full",initial:{width:0},animate:{width:`${c*100}%`},transition:{duration:1,ease:"easeOut"}})})]})]}),v.jsx("div",{className:"grid grid-cols-3 gap-2 mb-5",children:[{label:"Canciones",value:n.totalSongs,icon:"๐ŸŽต"},{label:"Mejor",value:`${n.bestScore}%`,icon:"๐ŸŽฏ"},{label:"Racha",value:n.dailyStreak,icon:"๐Ÿ”ฅ"},{label:"Minutos",value:n.totalMinutes,icon:"โฑ๏ธ"},{label:"Best Streak",value:n.bestStreak,icon:"โšก"},{label:"Nivel",value:n.level,icon:"โญ"}].map(g=>v.jsxs("div",{className:"glass rounded-xl p-2.5 text-center",children:[v.jsx("div",{className:"text-lg",children:g.icon}),v.jsx("div",{className:"text-sm font-bold text-white",children:g.value}),v.jsx("div",{className:"text-[9px] text-white/30",children:g.label})]},g.label))}),v.jsxs("div",{className:"mb-5",children:[v.jsxs("h4",{className:"text-sm font-semibold text-white/60 mb-2 flex items-center gap-1.5",children:[v.jsx(uh,{className:"w-3.5 h-3.5"})," Logros (",m.size,"/",Sh.length,")"]}),v.jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Sh.map(g=>{const b=m.has(g.id);return v.jsxs("div",{title:`${g.title}: ${g.desc}`,className:`rounded-xl p-2 text-center transition-all ${b?"glass border-brand-500/20":"bg-white/[0.02] opacity-30"}`,children:[v.jsx("div",{className:`text-lg ${b?"":"grayscale"}`,children:g.icon}),v.jsx("div",{className:"text-[8px] text-white/40 mt-0.5 leading-tight truncate",children:g.title})]},g.id)})})]}),p.length>0&&v.jsxs("div",{className:"mb-5",children:[v.jsxs("h4",{className:"text-sm font-semibold text-white/60 mb-2 flex items-center gap-1.5",children:[v.jsx(sw,{className:"w-3.5 h-3.5"})," Historial reciente"]}),v.jsx("div",{className:"space-y-1",children:p.map((g,b)=>v.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-white/[0.03]",children:[v.jsx("div",{className:"text-lg",children:"๐ŸŽต"}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-white truncate",children:g.songTitle}),v.jsx("div",{className:"text-[9px] text-white/25",children:new Date(g.playedAt).toLocaleDateString("es")})]}),v.jsxs("div",{className:"text-xs font-bold text-brand-300",children:[g.score,"%"]})]},b))})]}),v.jsx("div",{className:"border-t border-white/5 pt-4",children:r?v.jsxs("div",{className:"text-center",children:[v.jsx("p",{className:"text-xs text-white/30 mb-3",children:"Inicia sesion para guardar tu progreso en la nube"}),v.jsx(kw,{onClick:l})]}):v.jsxs("button",{onClick:a,className:"flex items-center gap-2 px-4 py-2 rounded-xl text-sm text-white/40 hover:text-red-400 hover:bg-red-400/10 transition-all w-full justify-center",children:[v.jsx(vj,{className:"w-4 h-4"})," Cerrar sesion"]})})]})})})}function e3({achievements:n,onDismiss:t}){return n.length?v.jsx("div",{className:"fixed top-20 right-4 z-[70] space-y-2",children:n.map(a=>v.jsxs($e.div,{initial:{x:200,opacity:0},animate:{x:0,opacity:1},exit:{x:200,opacity:0},className:"glass rounded-2xl p-3 pr-4 flex items-center gap-3 glow-border cursor-pointer min-w-[220px]",onClick:t,children:[v.jsx("div",{className:"text-2xl",children:a.icon}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-bold text-brand-300",children:"Logro desbloqueado!"}),v.jsx("div",{className:"text-sm font-semibold text-white",children:a.title}),v.jsx("div",{className:"text-[10px] text-white/30",children:a.desc})]})]},a.id))}):null}function t3({amount:n,show:t}){return!t||!n?null:v.jsxs($e.div,{initial:{y:0,opacity:1},animate:{y:-40,opacity:0},transition:{duration:1.5},className:"absolute top-0 right-0 text-brand-300 text-sm font-bold pointer-events-none",children:["+",n," XP"]})}function n3({song:n,isPlaying:t,currentTime:a,duration:r,onPlayPause:l,onPrev:c,onNext:d,micOn:f,onMicToggle:m,analysis:p,score:g,streak:b}){const w=r>0?a/r*100:0,_=Math.abs(p.cents),S=!f||p.volume<.008?"bg-white/20":_<10?"bg-emerald-400":_<25?"bg-yellow-400":_<50?"bg-orange-400":"bg-red-400";return v.jsxs($e.div,{initial:{y:80,opacity:0},animate:{y:0,opacity:1},exit:{y:80,opacity:0},transition:{type:"spring",stiffness:300,damping:30},className:"fixed bottom-0 inset-x-0 z-50 safe-bottom",children:[v.jsx("div",{className:"h-[2px] bg-white/5 w-full",children:v.jsx("div",{className:"h-full bg-gradient-to-r from-brand-500 to-accent-500 transition-all duration-200",style:{width:`${w}%`}})}),v.jsx("div",{className:"glass border-t border-white/10 backdrop-blur-xl bg-surface-900/80 px-3 py-2",children:v.jsxs("div",{className:"max-w-7xl mx-auto flex items-center gap-2",children:[v.jsxs("a",{href:"#playground",className:"flex items-center gap-2 min-w-0 flex-1",children:[v.jsxs("div",{className:`w-9 h-9 rounded-lg bg-gradient-to-br ${n.color} flex items-center justify-center text-sm shrink-0 relative`,children:[n.emoji,t&&v.jsx("div",{className:"absolute inset-0 rounded-lg flex items-end justify-center gap-[2px] pb-1",children:[1,2,3].map(A=>v.jsx("div",{className:"w-[2px] bg-white/80 rounded-full animate-waveform",style:{animationDelay:`${A*.1}s`,height:8}},A))})]}),v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsx("div",{className:"text-xs font-semibold text-white truncate leading-tight",children:n.title}),v.jsx("div",{className:"text-[10px] text-white/35 truncate",children:n.artist})]})]}),f&&p.volume>.008&&v.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${S} animate-pulse`}),v.jsx("span",{className:"text-[10px] font-mono text-white/40 w-6 text-center",children:p.note!=="-"?p.note:""})]}),f&&g>0&&v.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v.jsxs("span",{className:"text-[10px] font-mono text-white/30",children:[Math.round(g),"%"]}),b>=3&&v.jsx("span",{className:"text-[9px]",children:"๐Ÿ”ฅ"})]}),v.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[v.jsx("button",{onClick:c,className:"p-1.5 text-white/30 hover:text-white transition-colors","aria-label":"Previous",children:v.jsx(iw,{className:"w-3.5 h-3.5"})}),v.jsx("button",{onClick:l,"aria-label":t?"Pause":"Play",className:"w-9 h-9 rounded-full bg-gradient-to-br from-brand-500 to-accent-500 flex items-center justify-center hover:scale-105 transition-transform shadow-lg shadow-brand-500/20",children:t?v.jsx(ew,{className:"w-4 h-4 text-white"}):v.jsx(tw,{className:"w-4 h-4 text-white ml-0.5"})}),v.jsx("button",{onClick:d,className:"p-1.5 text-white/30 hover:text-white transition-colors","aria-label":"Next",children:v.jsx(aw,{className:"w-3.5 h-3.5"})})]}),v.jsx("button",{onClick:m,"aria-label":f?"Stop mic":"Start mic",className:`p-2 rounded-full text-xs transition-all shrink-0 ${f?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20"}`,children:f?v.jsx(Wb,{className:"w-3.5 h-3.5"}):v.jsx(ss,{className:"w-3.5 h-3.5"})})]})})]})}function hv(){return v.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[v.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-brand-600/20 rounded-full blur-[128px] animate-float"}),v.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-80 h-80 bg-accent-500/15 rounded-full blur-[100px] animate-float",style:{animationDelay:"2s"}})]})}function yl({children:n,className:t="",id:a=""}){const r=M.useRef(null),l=ZA(r,{once:!0,margin:"-80px"});return v.jsx($e.section,{id:a,ref:r,initial:{opacity:0,y:30},animate:l?{opacity:1,y:0}:{},transition:{duration:.6},className:t,children:n})}function i3(){const[n,t]=M.useState(0),[a,r]=M.useState(!1),[l,c]=M.useState(()=>Gt.find(Te=>Te.id==="rosas")??Gt.find(Te=>Te.file&&Te.lang==="es")??Gt.find(Te=>!!Te.file)??null),[d,f]=M.useState([]),[m,p]=M.useState(""),[g,b]=M.useState("list"),[w,_]=M.useState("all"),[S,A]=M.useState("all"),[E,j]=M.useState("all"),[O,k]=M.useState(!1),[z,G]=M.useState(!1),[Y,I]=M.useState(!1),[X,ee]=M.useState(0),[ve,Re]=M.useState(!1),Ae=M.useRef(0),ae=Yj(),re=Xj(),se=qR(),D=M.useCallback(()=>{ae.isListening?(ae.stopListening(),re.restoreVolume()):(ae.startListening(),re.duckForMic())},[ae,re]),[V,J]=M.useState({...gl}),[he,fe]=M.useState(!1),C=M.useRef(0),[H,F]=M.useState([]),Z=V.accuracy,de=V.streak,ye=V.totalNotes;M.useEffect(()=>{const K=()=>t(window.scrollY);return window.addEventListener("scroll",K,{passive:!0}),()=>window.removeEventListener("scroll",K)},[]),M.useEffect(()=>{if(!l?.id){f([]);return}let K=!1;return n2(l.id).then(Te=>{K||f(Te)}),()=>{K=!0}},[l?.id]);const Ee=M.useRef(!1);M.useEffect(()=>{!Ee.current&&l?.file&&(Ee.current=!0,re.loadSong(ov(l.file)))},[l,re]),M.useEffect(()=>{if(!ae.isListening){V.totalNotes>10&&fe(!0),F([]);return}J({...gl}),fe(!1),C.current=0},[ae.isListening]);const lt=M.useRef(ae.analysis);lt.current=ae.analysis,M.useEffect(()=>{if(!ae.isListening)return;const K=setInterval(()=>{const{volume:Te,note:at,cents:sa}=lt.current;if(Te>.008&&at!=="-"){const Ai=Math.abs(sa);let jt;Ai<10?jt="perfect":Ai<25?jt="great":Ai<50?jt="good":jt="miss",F(Lt=>[...Lt.slice(-120),{note:at,cents:sa,time:Date.now(),volume:Te}]),J(Lt=>{const dt=jt!=="miss"?Lt.streak+1:0,Il=Math.max(Lt.bestStreak,dt),ps=Math.min(8,1+Math.floor(dt/10)),Yn=jw[jt].base*ps,zr=Lt.perfects+(jt==="perfect"?1:0),gs=Lt.greats+(jt==="great"?1:0),Pr=Lt.goods+(jt==="good"?1:0),Kl=Lt.misses+(jt==="miss"?1:0),Kn=Lt.totalNotes+1,_t=(zr*100+gs*75+Pr*40)/(Kn*100)*100,yn=++C.current,St=[...Lt.popups.slice(-4),{id:yn,judgement:jt,points:Yn}];return{totalPoints:Lt.totalPoints+Yn,streak:dt,bestStreak:Il,multiplier:ps,totalNotes:Kn,perfects:zr,greats:gs,goods:Pr,misses:Kl,accuracy:_t,lastJudgement:jt,lastPoints:Yn,popups:St}})}},150);return()=>clearInterval(K)},[ae.isListening]);const He=M.useCallback(()=>{if(l&&ye>5&&Ae.current>0){const K=(Date.now()-Ae.current)/1e3,Te=se.profile.xp;se.recordPlay(l.id,l.title,Z,de,K);const at=se.profile.xp-Te;at>0&&(ee(at),Re(!0),setTimeout(()=>Re(!1),2e3))}},[l,ye,Z,de,se]),It=M.useCallback(K=>{He(),c(K),J({...gl}),F([]),fe(!1),Ae.current=Date.now(),K.file&&re.loadSong(ov(K.file))},[re,He]),Ei=M.useCallback(()=>{re.isPlaying?(re.pause(),ae.isListening&&(ae.stopListening(),re.restoreVolume())):(re.play(),ae.isListening||(ae.startListening(),re.duckForMic()))},[re,ae]),ia=M.useCallback(()=>{const K=Gt.findIndex(at=>at.id===l?.id),Te=Gt[(K-1+Gt.length)%Gt.length];It(Te),Te.file&&setTimeout(()=>re.play(),100)},[l,It,re]),ms=M.useCallback(()=>{const K=Gt.findIndex(at=>at.id===l?.id),Te=Gt[(K+1)%Gt.length];It(Te),Te.file&&setTimeout(()=>re.play(),100)},[l,It,re]),rn=M.useMemo(()=>Gt.filter(K=>{const Te=dh(K);if(m.trim()){const at=m.toLowerCase();if(!K.title.toLowerCase().includes(at)&&!K.artist.toLowerCase().includes(at)&&!K.genre.toLowerCase().includes(at))return!1}return!(w!=="all"&&Te.category!==w||S!=="all"&&K.lang!==S||E!=="all"&&Te.difficulty!==E||O&&!Te.hasLyrics)}),[m,w,S,E,O]),En=M.useMemo(()=>Gt.filter(K=>K.file).length,[]),aa=[{href:"#playground",label:"Cantar",icon:"๐ŸŽค"},{href:"#how-it-works",label:"Como funciona",icon:"๐Ÿ’ก"},{href:"#features",label:"Funciones",icon:"โšก"}];return v.jsxs("div",{className:"min-h-screen bg-surface-900 text-white overflow-x-hidden",children:[v.jsx(fr,{children:v.jsx(e3,{achievements:se.newAchievements,onDismiss:se.dismissAchievements})}),v.jsx(fr,{children:z&&v.jsx(JR,{onClose:()=>G(!1),onLogin:()=>{se.loginWithGoogle(),G(!1)}})}),v.jsx(fr,{children:Y&&v.jsx(WR,{profile:se.profile,onClose:()=>I(!1),onLogout:()=>{se.logout(),I(!1)},isGuest:se.isGuest,onLogin:()=>{se.loginWithGoogle(),I(!1)}})}),v.jsx("nav",{className:`fixed top-0 inset-x-0 z-50 transition-all duration-300 ${n>50?"glass border-b border-white/5":""}`,children:v.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 flex items-center justify-between",children:[v.jsxs("a",{href:"#",className:"flex items-center gap-2",children:[v.jsx("img",{src:"/oralify-icon.png",alt:"Oralify Music",className:"w-8 h-8 rounded-lg"}),v.jsx("span",{className:"font-bold text-lg",children:"Oralify Music"})]}),v.jsx("div",{className:"hidden md:flex items-center gap-8 text-sm text-white/60",children:aa.map(K=>v.jsx("a",{href:K.href,className:"hover:text-white transition-colors",children:K.label},K.href))}),v.jsxs("div",{className:"flex items-center gap-3",children:[se.profile.dailyStreak>0&&v.jsxs("div",{className:"hidden sm:flex items-center gap-1 px-2 py-1 rounded-full bg-orange-500/10 border border-orange-500/20",children:[v.jsx(ky,{className:"w-3 h-3 text-orange-400"}),v.jsx("span",{className:"text-[10px] font-bold text-orange-300",children:se.profile.dailyStreak})]}),se.profile.xp>0&&v.jsxs("div",{className:"hidden sm:flex items-center gap-1 px-2 py-1 rounded-full bg-brand-500/10 border border-brand-500/20 relative",children:[v.jsx(El,{className:"w-3 h-3 text-brand-400"}),v.jsx("span",{className:"text-[10px] font-bold text-brand-300",children:se.profile.xp}),v.jsx(t3,{amount:X,show:ve})]}),se.isGuest?v.jsxs("button",{onClick:()=>G(!0),className:"flex items-center gap-2 px-3 py-1.5 rounded-full glass text-sm hover:bg-white/10 transition-colors",children:[v.jsx(ol,{className:"w-4 h-4"}),v.jsx("span",{className:"hidden sm:inline",children:"Entrar"})]}):v.jsx(ZR,{profile:se.profile,onClick:()=>I(!0)}),v.jsx("button",{onClick:()=>r(!a),className:"md:hidden p-2 rounded-lg hover:bg-white/10","aria-label":"Menu",children:a?v.jsx(rw,{className:"w-5 h-5"}):v.jsx(wj,{className:"w-5 h-5"})})]})]})}),a&&v.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},className:"fixed inset-0 z-40 pt-20 glass md:hidden",children:v.jsxs("div",{className:"flex flex-col items-center gap-6 py-12",children:[aa.map(K=>v.jsx("a",{href:K.href,onClick:()=>r(!1),className:"text-xl text-white/80 hover:text-white",children:K.label},K.href)),v.jsx("div",{className:"border-t border-white/10 pt-4 mt-2",children:se.isGuest?v.jsxs("button",{onClick:()=>{G(!0),r(!1)},className:"flex items-center gap-2 px-5 py-2 rounded-full glass text-white/80 hover:text-white",children:[v.jsx(ol,{className:"w-4 h-4"})," Iniciar sesion"]}):v.jsxs("button",{onClick:()=>{I(!0),r(!1)},className:"flex items-center gap-2 px-5 py-2 rounded-full glass text-white/80 hover:text-white",children:[v.jsx(ol,{className:"w-4 h-4"})," Mi perfil"]})})]})}),v.jsxs("header",{className:"relative min-h-[70vh] flex items-center justify-center pt-16",children:[v.jsx(hv,{}),v.jsxs("div",{className:"relative z-10 max-w-4xl mx-auto px-6 text-center",children:[v.jsxs($e.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8},children:[v.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 rounded-full glass text-xs text-white/70 mb-5",children:[v.jsx(Nj,{className:"w-3.5 h-3.5 text-brand-400"}),En,"+ canciones ยท AI vocal coach en tu navegador"]}),v.jsxs("h1",{className:"text-5xl md:text-7xl font-extrabold leading-[0.95] tracking-tight mb-4",children:["Sing. See.",v.jsx("br",{}),v.jsx("span",{className:"gradient-text",children:"Improve."})]}),v.jsx("p",{className:"text-lg md:text-xl text-white/50 max-w-xl mx-auto mb-8 leading-relaxed",children:"Elige una cancion, activa tu micro, y mira tu voz en tiempo real. Deteccion de pitch, letras sincronizadas, y coaching AI โ€” todo en el navegador."}),v.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[v.jsxs("a",{href:"#playground",className:"group flex items-center gap-2 px-8 py-4 rounded-full bg-gradient-to-r from-brand-600 to-accent-500 text-white font-semibold hover:shadow-lg hover:shadow-brand-500/25 transition-all hover:scale-105",children:[v.jsx(ss,{className:"w-5 h-5"}),"Empieza a cantar",v.jsx(Ry,{className:"w-4 h-4 group-hover:translate-x-1 transition-transform"})]}),se.isGuest?v.jsxs("button",{onClick:()=>G(!0),className:"flex items-center gap-2 px-6 py-4 rounded-full glass text-white/80 hover:text-white hover:bg-white/10 transition-all",children:[v.jsx(ol,{className:"w-4 h-4"}),"Crear cuenta gratis"]}):v.jsxs("button",{onClick:()=>I(!0),className:"flex items-center gap-2 px-6 py-4 rounded-full glass text-white/80 hover:text-white hover:bg-white/10 transition-all",children:[v.jsx(uh,{className:"w-4 h-4"}),"Mi progreso"]})]})]}),v.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:1.2},className:"mt-10",children:v.jsxs("a",{href:"#playground",className:"inline-flex flex-col items-center text-white/30 hover:text-white/50 transition-colors",children:[v.jsxs("span",{className:"text-xs mb-1",children:[En," canciones listas"]}),v.jsx(uj,{className:"w-5 h-5 animate-bounce"})]})})]})]}),v.jsx(yl,{id:"playground",className:"py-12 md:py-20",children:v.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6",children:[v.jsxs("div",{className:"text-center mb-6",children:[v.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-2",children:["Tu ",v.jsx("span",{className:"gradient-text",children:"Playground"})]}),v.jsxs("p",{className:"text-white/40 text-sm",children:[En," canciones ยท Letras sincronizadas ยท Coaching AI en tiempo real"]})]}),v.jsxs("div",{className:"grid lg:grid-cols-[1fr_340px] gap-5",children:[v.jsx("div",{className:"order-1 lg:order-1",children:v.jsx("div",{className:"glass rounded-3xl glow-border overflow-hidden",children:l?l.file?v.jsxs("div",{className:"flex flex-col relative",children:[he&&l&&v.jsx(YR,{game:V,song:l,onClose:()=>{fe(!1),J({...gl})}}),v.jsx(IR,{game:V,isActive:ae.isListening}),ae.isListening&&v.jsx("div",{className:"px-4 pb-1",children:v.jsx(uv,{cents:ae.analysis.cents,volume:ae.analysis.volume,note:ae.analysis.note})}),v.jsx("div",{className:"px-4 pt-1",children:v.jsx(QR,{lyrics:d,currentTime:re.currentTime,isPlaying:re.isPlaying})}),ae.isListening&&v.jsx("div",{className:"px-4 pb-1",children:v.jsx(dv,{pitchHistory:H})}),v.jsxs("div",{className:"flex items-center gap-3 px-4 py-1.5",children:[v.jsx("div",{className:`w-9 h-9 rounded-lg bg-gradient-to-br ${l.color} flex items-center justify-center text-base shrink-0`,children:l.emoji}),v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsx("div",{className:"font-bold text-sm truncate",children:l.title}),v.jsx("div",{className:"text-[11px] text-white/35",children:l.artist})]}),v.jsx($R,{mode:re.mode,onModeChange:re.applyMode})]}),v.jsxs("div",{className:"px-4 pb-1",children:[v.jsxs("div",{className:"flex gap-3",children:[v.jsx("div",{className:"flex-1",children:v.jsx(cv,{data:re.frequencyData,color:"brand",height:35,barCount:30})}),ae.isListening&&v.jsx("div",{className:"flex-1",children:v.jsx(cv,{data:ae.analysis.frequencyData,color:"green",height:35,barCount:30})})]}),v.jsxs("div",{className:"flex gap-3 -mt-1",children:[v.jsx("div",{className:"flex-1",children:v.jsx(lv,{data:re.waveformData,color:"brand",height:24})}),ae.isListening&&v.jsx("div",{className:"flex-1",children:v.jsx(lv,{data:ae.analysis.waveformData,color:"green",height:24})})]})]}),v.jsxs("div",{className:"px-4 pb-3 pt-1 border-t border-white/5",children:[v.jsx(XR,{currentTime:re.currentTime,duration:re.duration,onSeek:re.seek}),v.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2",children:[v.jsx("button",{onClick:ia,className:"text-white/30 hover:text-white transition-colors",children:v.jsx(iw,{className:"w-4 h-4"})}),v.jsx("button",{onClick:Ei,className:"w-12 h-12 rounded-full bg-gradient-to-br from-brand-500 to-accent-500 flex items-center justify-center hover:scale-105 transition-transform shadow-lg shadow-brand-500/25",children:re.isPlaying?v.jsx(ew,{className:"w-5 h-5 text-white"}):v.jsx(tw,{className:"w-5 h-5 text-white ml-0.5"})}),v.jsx("button",{onClick:ms,className:"text-white/30 hover:text-white transition-colors",children:v.jsx(aw,{className:"w-4 h-4"})})]}),ae.isListening&&v.jsxs("div",{className:"flex items-center justify-center gap-2 mt-1.5 text-[9px] text-white/25",children:[v.jsx("span",{className:"w-1 h-1 rounded-full bg-red-400 animate-pulse"}),v.jsxs("span",{children:["Micro activo ยท Vol ",Math.round(re.musicVolume*100),"%"]})]})]})]}):v.jsxs("div",{className:"flex flex-col p-5",children:[v.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[v.jsx("div",{className:`w-10 h-10 rounded-lg bg-gradient-to-br ${l.color} flex items-center justify-center text-lg shrink-0`,children:l.emoji}),v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsx("div",{className:"font-bold text-sm truncate",children:l.title}),v.jsx("div",{className:"text-[11px] text-white/35",children:l.artist})]}),v.jsx("div",{className:"text-[10px] text-amber-400 bg-amber-400/10 px-2 py-0.5 rounded-full",children:"Solo letras"})]}),ae.isListening&&v.jsx("div",{className:"mb-3",children:v.jsx(uv,{cents:ae.analysis.cents,volume:ae.analysis.volume,note:ae.analysis.note})}),d.length>0?v.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-1.5 pr-2 scrollbar-thin",children:d.filter(K=>K.text).map((K,Te)=>v.jsx("div",{className:"text-sm text-white/50 leading-relaxed",children:K.text},Te))}):v.jsx("div",{className:"py-12 text-center text-white/25 text-sm",children:"Cargando letras..."}),v.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("button",{onClick:D,className:`flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all ${ae.isListening?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30"}`,children:[ae.isListening?v.jsx(Wb,{className:"w-4 h-4"}):v.jsx(ss,{className:"w-4 h-4"}),ae.isListening?"Parar":"Practicar con micro"]}),ae.isListening&&v.jsx(KR,{score:Z,streak:de})]}),ae.isListening&&v.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-white/40 animate-pulse",children:[v.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-amber-400/60"}),"Musica al ",Math.round(re.musicVolume*100),"% โ€” Usa auriculares para mejor resultado"]})]}),ae.isListening&&v.jsx("div",{className:"mt-2 px-2",children:v.jsx(dv,{pitchHistory:H})})]}):v.jsxs("div",{className:"flex flex-col items-center justify-center text-white/30 gap-4 py-16 px-6",children:[v.jsx(Ny,{className:"w-12 h-12"}),v.jsx("p",{className:"text-base font-medium",children:"Elige una cancion abajo para empezar"}),v.jsx("p",{className:"text-sm text-white/20",children:"Pulsa play y activa tu micro"})]})})}),v.jsx("div",{className:"order-2 lg:order-2",children:v.jsxs("div",{className:"glass rounded-2xl p-3 lg:sticky lg:top-20",children:[v.jsxs("div",{className:"flex items-center justify-between mb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Oy,{className:"w-4 h-4 text-white/40"}),v.jsxs("span",{className:"text-xs font-medium text-white/50",children:[rn.length,"/",En]})]}),v.jsxs("div",{className:"flex gap-1",children:[v.jsx("button",{onClick:()=>b("list"),className:`p-1 rounded ${g==="list"?"bg-white/10 text-white":"text-white/20"}`,children:v.jsx(Oy,{className:"w-3.5 h-3.5"})}),v.jsx("button",{onClick:()=>b("grid"),className:`p-1 rounded ${g==="grid"?"bg-white/10 text-white":"text-white/20"}`,children:v.jsx(fj,{className:"w-3.5 h-3.5"})})]})]}),v.jsxs("div",{className:"flex gap-1 overflow-x-auto pb-1.5 mb-1.5 scrollbar-none -mx-1 px-1",children:[v.jsx("button",{onClick:()=>_("all"),className:`shrink-0 px-2 py-1 rounded-lg text-[10px] font-medium transition-all ${w==="all"?"bg-brand-500/20 text-brand-300 border border-brand-500/30":"text-white/25 hover:text-white/40 border border-transparent"}`,children:"Todas"}),Fj.map(K=>v.jsxs("button",{onClick:()=>_(K.id),className:`shrink-0 flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-medium transition-all ${w===K.id?"bg-brand-500/20 text-brand-300 border border-brand-500/30":"text-white/25 hover:text-white/40 border border-transparent"}`,children:[v.jsx("span",{children:K.emoji}),v.jsx("span",{className:"hidden sm:inline",children:K.label})]},K.id))]}),v.jsxs("div",{className:"flex flex-wrap gap-1 mb-1.5",children:[["all","en","es"].map(K=>v.jsx("button",{onClick:()=>A(K),className:`px-2 py-0.5 rounded-full text-[9px] font-medium transition-all ${S===K?"bg-cyan-500/20 text-cyan-300 border border-cyan-500/30":"text-white/20 hover:text-white/35 border border-white/5"}`,children:K==="all"?"๐ŸŒ":K==="en"?"๐Ÿ‡ฌ๐Ÿ‡ง EN":"๐Ÿ‡ช๐Ÿ‡ธ ES"},K)),v.jsx("div",{className:"w-px h-4 bg-white/10 self-center mx-0.5"}),Jj.map(K=>v.jsx("button",{onClick:()=>j(E===K.id?"all":K.id),className:`px-2 py-0.5 rounded-full text-[9px] font-medium transition-all ${E===K.id?"bg-white/10 text-white border border-white/20":"text-white/20 hover:text-white/35 border border-white/5"}`,children:K.emoji},K.id)),v.jsx("div",{className:"w-px h-4 bg-white/10 self-center mx-0.5"}),v.jsx("button",{onClick:()=>k(!O),className:`px-2 py-0.5 rounded-full text-[9px] font-medium transition-all ${O?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"text-white/20 hover:text-white/35 border border-white/5"}`,children:"๐ŸŽต Letra"})]}),v.jsxs("div",{className:"relative mb-2",children:[v.jsx(nw,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-white/20"}),v.jsx("input",{type:"text",value:m,onChange:K=>p(K.target.value),placeholder:"Buscar canciones...",className:"w-full pl-7 pr-3 py-1.5 rounded-lg bg-white/5 border border-white/5 text-white text-[11px] placeholder:text-white/15 focus:outline-none focus:border-brand-500/30 transition-colors"})]}),v.jsx("div",{className:"mb-2",children:v.jsx(FR,{onSelectResult:async K=>{const Te={id:`lrc-${K.id}`,title:K.title,artist:K.artist,file:"",color:"from-brand-400 to-accent-500",emoji:K.hasSyncedLyrics?"๐ŸŽต":"๐Ÿ“",genre:`${Math.floor(K.duration/60)}:${String(Math.floor(K.duration%60)).padStart(2,"0")}`,lang:"es",lrcQuery:`${K.title} ${K.artist}`};c(Te);const at=await s2(K.id);f(at)}})}),v.jsx("div",{className:`overflow-y-auto max-h-[55vh] pr-1 scrollbar-thin ${g==="grid"?"grid grid-cols-2 gap-1":"space-y-0.5"}`,children:rn.map(K=>{const Te=dh(K);return g==="grid"?v.jsxs("button",{onClick:()=>It(K),className:`p-2 rounded-lg transition-all text-center ${l?.id===K.id?"bg-brand-500/15 border border-brand-500/30":"hover:bg-white/5 border border-transparent"}`,children:[v.jsxs("div",{className:`w-10 h-10 mx-auto rounded-lg bg-gradient-to-br ${K.color} flex items-center justify-center text-lg mb-1 relative`,children:[K.emoji,Te.hasLyrics&&v.jsx("div",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-emerald-400"})]}),v.jsx("div",{className:"text-[10px] text-white truncate",children:K.title}),v.jsx("div",{className:"text-[9px] text-white/25 truncate",children:K.artist}),v.jsxs("div",{className:"flex items-center justify-center gap-1 mt-0.5",children:[v.jsx("span",{className:"text-[8px]",children:Te.difficulty==="beginner"?"๐ŸŸข":Te.difficulty==="advanced"?"๐Ÿ”ด":"๐ŸŸก"}),v.jsx("span",{className:"text-[8px] text-white/15",children:K.lang==="es"?"๐Ÿ‡ช๐Ÿ‡ธ":K.lang==="en"?"๐Ÿ‡ฌ๐Ÿ‡ง":"๐ŸŽน"})]})]},K.id):v.jsx(GR,{song:K,isActive:l?.id===K.id,onSelect:()=>It(K)},K.id)})}),rn.length===0&&v.jsx("div",{className:"text-center py-8 text-white/25 text-xs",children:"No se encontraron canciones con esos filtros"})]})})]})]})}),v.jsx(yl,{id:"how-it-works",className:"py-20 bg-surface-800/50",children:v.jsxs("div",{className:"max-w-5xl mx-auto px-6",children:[v.jsx("div",{className:"text-center mb-12",children:v.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-3",children:["Como ",v.jsx("span",{className:"gradient-text",children:"funciona"})]})}),v.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:[{step:"1",icon:Ny,title:"Elige cancion",desc:"Escoge de 120+ canciones: rock, reggaeton, pop latino. Filtra por categoria, idioma y dificultad.",color:"from-brand-500 to-brand-700"},{step:"2",icon:ss,title:"Canta",desc:"Activa tu micro y canta. La deteccion de pitch analiza tu voz en tiempo real con precision musical.",color:"from-accent-500 to-pink-600"},{step:"3",icon:lj,title:"Mejora",desc:"Ve tu afinacion en tiempo real. Recibe coaching AI visual: si estas alto, bajo, o perfecto. Con score y streak.",color:"from-emerald-500 to-teal-600"}].map(K=>v.jsxs($e.div,{whileHover:{y:-4},className:"glass rounded-2xl p-6 text-center group",children:[v.jsxs("div",{className:"relative mb-5",children:[v.jsx("div",{className:`w-14 h-14 rounded-2xl bg-gradient-to-br ${K.color} flex items-center justify-center mx-auto group-hover:scale-110 transition-transform`,children:v.jsx(K.icon,{className:"w-6 h-6 text-white"})}),v.jsx("div",{className:"absolute -top-2 -right-2 w-6 h-6 rounded-full bg-surface-900 border-2 border-brand-500/50 flex items-center justify-center text-[10px] font-bold text-brand-300",children:K.step})]}),v.jsx("h3",{className:"text-base font-semibold mb-2",children:K.title}),v.jsx("p",{className:"text-white/50 text-sm leading-relaxed",children:K.desc})]},K.step))})]})}),v.jsx(yl,{id:"features",className:"py-20",children:v.jsxs("div",{className:"max-w-6xl mx-auto px-6",children:[v.jsxs("div",{className:"text-center mb-10",children:[v.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-3",children:["Potenciado por ",v.jsx("span",{className:"gradient-text",children:"AI de investigacion"})]}),v.jsx("p",{className:"text-white/50 max-w-lg mx-auto text-sm",children:"La misma tecnologia de produccion musical profesional โ€” ahora en tu navegador."})]}),v.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[{icon:pj,title:"Separacion de fuentes",desc:"Demucs de Meta aisla voces de cualquier cancion completa.",g:"bg-gradient-to-br from-brand-600 to-brand-800"},{icon:Lj,title:"Deteccion de pitch",desc:"Red neuronal CREPE analiza tu afinacion cada 10ms con precision musical.",g:"bg-gradient-to-br from-accent-500 to-accent-600"},{icon:Vj,title:"Visualizador en vivo",desc:"Ve tu voz como barras de frecuencia, formas de onda, y notas detectadas.",g:"bg-gradient-to-br from-cyan-500 to-blue-600"},{icon:_j,title:"Coaching AI",desc:"Tips personalizados segun si cantas alto o bajo, con areas problematicas.",g:"bg-gradient-to-br from-emerald-500 to-green-600"},{icon:rj,title:"Scoring en cents",desc:"Medicion musical en cents. Sabe exactamente cuanto te desvias y en que direccion.",g:"bg-gradient-to-br from-orange-500 to-red-500"},{icon:Gj,title:"120+ canciones",desc:"Biblioteca masiva: rock clasico, reggaeton, pop latino y mas. Con letras sincronizadas y filtros por categoria.",g:"bg-gradient-to-br from-yellow-500 to-orange-500"}].map(K=>v.jsxs($e.div,{whileHover:{y:-3,scale:1.01},className:"glass rounded-2xl p-5 group hover:border-brand-500/30 transition-all",children:[v.jsx("div",{className:`w-10 h-10 rounded-xl ${K.g} flex items-center justify-center mb-3 group-hover:scale-110 transition-transform`,children:v.jsx(K.icon,{className:"w-5 h-5 text-white"})}),v.jsx("h3",{className:"text-base font-semibold mb-1",children:K.title}),v.jsx("p",{className:"text-white/50 text-sm leading-relaxed",children:K.desc})]},K.title))})]})}),v.jsx(yl,{className:"py-20",children:v.jsx("div",{className:"max-w-4xl mx-auto px-6 text-center",children:v.jsxs("div",{className:"glass rounded-3xl p-10 md:p-14 glow-border relative overflow-hidden",children:[v.jsx(hv,{}),v.jsxs("div",{className:"relative z-10",children:[v.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-5",children:["Listo para encontrar",v.jsx("br",{}),v.jsx("span",{className:"gradient-text",children:"tu voz?"})]}),v.jsx("p",{className:"text-white/60 max-w-lg mx-auto mb-7 text-sm",children:"Gana XP, desbloquea logros, sube de nivel y conviertete en el mejor cantante. Todo gratis, todo en tu navegador."}),v.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[v.jsxs("a",{href:"#playground",className:"group flex items-center gap-2 px-8 py-4 rounded-full bg-gradient-to-r from-brand-600 to-accent-500 text-white font-semibold hover:shadow-lg hover:shadow-brand-500/25 transition-all hover:scale-105",children:[v.jsx(ss,{className:"w-5 h-5"}),"Empieza a cantar",v.jsx(Ry,{className:"w-4 h-4 group-hover:translate-x-1 transition-transform"})]}),se.isGuest&&v.jsxs("button",{onClick:()=>G(!0),className:"flex items-center gap-2 px-6 py-4 rounded-full glass text-white/80 hover:text-white hover:bg-white/10 transition-all",children:[v.jsx(El,{className:"w-5 h-5"}),"Crear cuenta gratis"]})]}),v.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-3 text-white/30 text-xs",children:[v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(uh,{className:"w-3.5 h-3.5"})," 16 logros"]}),v.jsx("span",{className:"text-white/10",children:"ยท"}),v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(ky,{className:"w-3.5 h-3.5"})," Rachas diarias"]}),v.jsx("span",{className:"text-white/10",children:"ยท"}),v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(sw,{className:"w-3.5 h-3.5"})," 15 niveles"]}),v.jsx("span",{className:"text-white/10",children:"ยท"}),v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(El,{className:"w-3.5 h-3.5"})," XP y puntuacion"]})]})]})]})})}),v.jsx("footer",{className:`border-t border-white/5 py-8 ${l?.file?"pb-20":""}`,children:v.jsxs("div",{className:"max-w-6xl mx-auto px-6 flex flex-col md:flex-row items-center justify-between gap-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("img",{src:"/oralify-icon.png",alt:"Oralify Music",className:"w-6 h-6 rounded-md"}),v.jsx("span",{className:"font-semibold text-sm",children:"Oralify Music"}),v.jsx("span",{className:"text-white/30 text-sm",children:"โ€” Tu AI Singing Coach"})]}),v.jsxs("div",{className:"flex items-center gap-6 text-white/40 text-sm",children:[v.jsx("span",{children:"Hecho con IA y amor por la musica"}),v.jsx("span",{className:"text-white/15",children:"ยท"}),v.jsxs("span",{children:[En,"+ canciones"]})]})]})}),v.jsx(fr,{children:l?.file&&v.jsx(n3,{song:l,isPlaying:re.isPlaying,currentTime:re.currentTime,duration:re.duration,onPlayPause:Ei,onPrev:ia,onNext:ms,micOn:ae.isListening,onMicToggle:D,analysis:ae.analysis,score:Z,streak:de})})]})}n_.createRoot(document.getElementById("root")).render(v.jsx(M.StrictMode,{children:v.jsx(i3,{})}));