function yv(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function xv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dm={exports:{}},Ha={},zm={exports:{}},fe={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ts=Symbol.for("react.element"),vv=Symbol.for("react.portal"),Sv=Symbol.for("react.fragment"),wv=Symbol.for("react.strict_mode"),Cv=Symbol.for("react.profiler"),bv=Symbol.for("react.provider"),kv=Symbol.for("react.context"),jv=Symbol.for("react.forward_ref"),Tv=Symbol.for("react.suspense"),Ev=Symbol.for("react.memo"),Pv=Symbol.for("react.lazy"),Tf=Symbol.iterator;function Rv(e){return e===null||typeof e!="object"?null:(e=Tf&&e[Tf]||e["@@iterator"],typeof e=="function"?e:null)}var Fm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Mm=Object.assign,Im={};function Vo(e,t,n){this.props=e,this.context=t,this.refs=Im,this.updater=n||Fm}Vo.prototype.isReactComponent={};Vo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Vo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Lm(){}Lm.prototype=Vo.prototype;function zc(e,t,n){this.props=e,this.context=t,this.refs=Im,this.updater=n||Fm}var Fc=zc.prototype=new Lm;Fc.constructor=zc;Mm(Fc,Vo.prototype);Fc.isPureReactComponent=!0;var Ef=Array.isArray,Om=Object.prototype.hasOwnProperty,Mc={current:null},_m={key:!0,ref:!0,__self:!0,__source:!0};function Vm(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)Om.call(t,r)&&!_m.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1>>1,de=F[q];if(0>>1;qo(Re,G))Xo(Ze,Re)?(F[q]=Ze,F[X]=G,q=X):(F[q]=Re,F[Ne]=G,q=Ne);else if(Xo(Ze,G))F[q]=Ze,F[X]=G,q=X;else break e}}return W}function o(F,W){var G=F.sortIndex-W.sortIndex;return G!==0?G:F.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],d=1,f=null,p=3,v=!1,x=!1,w=!1,m=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(F){for(var W=n(c);W!==null;){if(W.callback===null)r(c);else if(W.startTime<=F)r(c),W.sortIndex=W.expirationTime,t(l,W);else break;W=n(c)}}function k(F){if(w=!1,S(F),!x)if(n(l)!==null)x=!0,je(j);else{var W=n(c);W!==null&&D(k,W.startTime-F)}}function j(F,W){x=!1,w&&(w=!1,g(b),b=-1),v=!0;var G=p;try{for(S(W),f=n(l);f!==null&&(!(f.expirationTime>W)||F&&!V());){var q=f.callback;if(typeof q=="function"){f.callback=null,p=f.priorityLevel;var de=q(f.expirationTime<=W);W=e.unstable_now(),typeof de=="function"?f.callback=de:f===n(l)&&r(l),S(W)}else r(l);f=n(l)}if(f!==null)var Be=!0;else{var Ne=n(c);Ne!==null&&D(k,Ne.startTime-W),Be=!1}return Be}finally{f=null,p=G,v=!1}}var E=!1,N=null,b=-1,B=5,I=-1;function V(){return!(e.unstable_now()-IF||125q?(F.sortIndex=G,t(c,F),n(l)===null&&F===n(c)&&(w?(g(b),b=-1):w=!0,D(k,G-q))):(F.sortIndex=de,t(l,F),x||v||(x=!0,je(j))),F},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(F){var W=p;return function(){var G=p;p=W;try{return F.apply(this,arguments)}finally{p=G}}}})(Km);Hm.exports=Km;var Bv=Hm.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Uv=h,Ot=Bv;function M(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mu=Object.prototype.hasOwnProperty,$v=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Rf={},Af={};function Wv(e){return mu.call(Af,e)?!0:mu.call(Rf,e)?!1:$v.test(e)?Af[e]=!0:(Rf[e]=!0,!1)}function Hv(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Kv(e,t,n,r){if(t===null||typeof t>"u"||Hv(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function St(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var st={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){st[e]=new St(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];st[t]=new St(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){st[e]=new St(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){st[e]=new St(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){st[e]=new St(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){st[e]=new St(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){st[e]=new St(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){st[e]=new St(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){st[e]=new St(e,5,!1,e.toLowerCase(),null,!1,!1)});var Lc=/[\-:]([a-z])/g;function Oc(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Lc,Oc);st[t]=new St(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Lc,Oc);st[t]=new St(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Lc,Oc);st[t]=new St(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){st[e]=new St(e,1,!1,e.toLowerCase(),null,!1,!1)});st.xlinkHref=new St("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){st[e]=new St(e,1,!1,e.toLowerCase(),null,!0,!0)});function _c(e,t,n,r){var o=st.hasOwnProperty(t)?st[t]:null;(o!==null?o.type!==0:r||!(2a||o[s]!==i[a]){var l=` `+o[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{kl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?di(e):""}function Gv(e){switch(e.tag){case 5:return di(e.type);case 16:return di("Lazy");case 13:return di("Suspense");case 19:return di("SuspenseList");case 0:case 2:case 15:return e=jl(e.type,!1),e;case 11:return e=jl(e.type.render,!1),e;case 1:return e=jl(e.type,!0),e;default:return""}}function vu(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case so:return"Fragment";case io:return"Portal";case gu:return"Profiler";case Vc:return"StrictMode";case yu:return"Suspense";case xu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case qm:return(e.displayName||"Context")+".Consumer";case Ym:return(e._context.displayName||"Context")+".Provider";case Bc:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Uc:return t=e.displayName||null,t!==null?t:vu(e.type)||"Memo";case Jn:t=e._payload,e=e._init;try{return vu(e(t))}catch{}}return null}function Yv(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vu(t);case 8:return t===Vc?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function hr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Qm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function qv(e){var t=Qm(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ks(e){e._valueTracker||(e._valueTracker=qv(e))}function Jm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Qm(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ca(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Su(e,t){var n=t.checked;return Me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Df(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=hr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Zm(e,t){t=t.checked,t!=null&&_c(e,"checked",t,!1)}function wu(e,t){Zm(e,t);var n=hr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Cu(e,t.type,n):t.hasOwnProperty("defaultValue")&&Cu(e,t.type,hr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function zf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Cu(e,t,n){(t!=="number"||ca(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var fi=Array.isArray;function bo(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=js.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Di(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Xv=["Webkit","ms","Moz","O"];Object.keys(xi).forEach(function(e){Xv.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xi[t]=xi[e]})});function rg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xi.hasOwnProperty(e)&&xi[e]?(""+t).trim():t+"px"}function og(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=rg(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Qv=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ju(e,t){if(t){if(Qv[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62))}}function Tu(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Eu=null;function $c(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pu=null,ko=null,jo=null;function If(e){if(e=os(e)){if(typeof Pu!="function")throw Error(M(280));var t=e.stateNode;t&&(t=Xa(t),Pu(e.stateNode,e.type,t))}}function ig(e){ko?jo?jo.push(e):jo=[e]:ko=e}function sg(){if(ko){var e=ko,t=jo;if(jo=ko=null,If(e),t)for(e=0;e>>=0,e===0?32:31-(l1(e)/u1|0)|0}var Ts=64,Es=4194304;function pi(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ha(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=pi(a):(i&=s,i!==0&&(r=pi(i)))}else s=n&~o,s!==0?r=pi(s):i!==0&&(r=pi(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ns(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ln(t),e[t]=n}function p1(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Si),Hf=" ",Kf=!1;function Tg(e,t){switch(e){case"keyup":return B1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Eg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ao=!1;function $1(e,t){switch(e){case"compositionend":return Eg(t);case"keypress":return t.which!==32?null:(Kf=!0,Hf);case"textInput":return e=t.data,e===Hf&&Kf?null:e;default:return null}}function W1(e,t){if(ao)return e==="compositionend"||!Qc&&Tg(e,t)?(e=kg(),Ys=Yc=nr=null,ao=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Xf(n)}}function Ng(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ng(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dg(){for(var e=window,t=ca();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ca(e.document)}return t}function Jc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Z1(e){var t=Dg(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ng(n.ownerDocument.documentElement,n)){if(r!==null&&Jc(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Qf(n,i);var s=Qf(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,lo=null,Fu=null,Ci=null,Mu=!1;function Jf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mu||lo==null||lo!==ca(r)||(r=lo,"selectionStart"in r&&Jc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ci&&Oi(Ci,r)||(Ci=r,r=ya(Fu,"onSelect"),0fo||(e.current=Bu[fo],Bu[fo]=null,fo--)}function ke(e,t){fo++,Bu[fo]=e.current,e.current=t}var mr={},ht=vr(mr),jt=vr(!1),$r=mr;function Ao(e,t){var n=e.type.contextTypes;if(!n)return mr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Tt(e){return e=e.childContextTypes,e!=null}function va(){Ee(jt),Ee(ht)}function ip(e,t,n){if(ht.current!==mr)throw Error(M(168));ke(ht,t),ke(jt,n)}function Bg(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(M(108,Yv(e)||"Unknown",o));return Me({},n,r)}function Sa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mr,$r=ht.current,ke(ht,e),ke(jt,jt.current),!0}function sp(e,t,n){var r=e.stateNode;if(!r)throw Error(M(169));n?(e=Bg(e,t,$r),r.__reactInternalMemoizedMergedChildContext=e,Ee(jt),Ee(ht),ke(ht,e)):Ee(jt),ke(jt,n)}var Dn=null,Qa=!1,_l=!1;function Ug(e){Dn===null?Dn=[e]:Dn.push(e)}function dS(e){Qa=!0,Ug(e)}function Sr(){if(!_l&&Dn!==null){_l=!0;var e=0,t=ve;try{var n=Dn;for(ve=1;e>=s,o-=s,zn=1<<32-ln(t)+o|n<b?(B=N,N=null):B=N.sibling;var I=p(g,N,S[b],k);if(I===null){N===null&&(N=B);break}e&&N&&I.alternate===null&&t(g,N),y=i(I,y,b),E===null?j=I:E.sibling=I,E=I,N=B}if(b===S.length)return n(g,N),Ae&&Ar(g,b),j;if(N===null){for(;bb?(B=N,N=null):B=N.sibling;var V=p(g,N,I.value,k);if(V===null){N===null&&(N=B);break}e&&N&&V.alternate===null&&t(g,N),y=i(V,y,b),E===null?j=V:E.sibling=V,E=V,N=B}if(I.done)return n(g,N),Ae&&Ar(g,b),j;if(N===null){for(;!I.done;b++,I=S.next())I=f(g,I.value,k),I!==null&&(y=i(I,y,b),E===null?j=I:E.sibling=I,E=I);return Ae&&Ar(g,b),j}for(N=r(g,N);!I.done;b++,I=S.next())I=v(N,g,b,I.value,k),I!==null&&(e&&I.alternate!==null&&N.delete(I.key===null?b:I.key),y=i(I,y,b),E===null?j=I:E.sibling=I,E=I);return e&&N.forEach(function(oe){return t(g,oe)}),Ae&&Ar(g,b),j}function m(g,y,S,k){if(typeof S=="object"&&S!==null&&S.type===so&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case bs:e:{for(var j=S.key,E=y;E!==null;){if(E.key===j){if(j=S.type,j===so){if(E.tag===7){n(g,E.sibling),y=o(E,S.props.children),y.return=g,g=y;break e}}else if(E.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Jn&&up(j)===E.type){n(g,E.sibling),y=o(E,S.props),y.ref=si(g,E,S),y.return=g,g=y;break e}n(g,E);break}else t(g,E);E=E.sibling}S.type===so?(y=Vr(S.props.children,g.mode,k,S.key),y.return=g,g=y):(k=na(S.type,S.key,S.props,null,g.mode,k),k.ref=si(g,y,S),k.return=g,g=k)}return s(g);case io:e:{for(E=S.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===S.containerInfo&&y.stateNode.implementation===S.implementation){n(g,y.sibling),y=o(y,S.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else t(g,y);y=y.sibling}y=Gl(S,g.mode,k),y.return=g,g=y}return s(g);case Jn:return E=S._init,m(g,y,E(S._payload),k)}if(fi(S))return x(g,y,S,k);if(ti(S))return w(g,y,S,k);Fs(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,y!==null&&y.tag===6?(n(g,y.sibling),y=o(y,S),y.return=g,g=y):(n(g,y),y=Kl(S,g.mode,k),y.return=g,g=y),s(g)):n(g,y)}return m}var Do=Kg(!0),Gg=Kg(!1),ba=vr(null),ka=null,mo=null,nd=null;function rd(){nd=mo=ka=null}function od(e){var t=ba.current;Ee(ba),e._currentValue=t}function Wu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Eo(e,t){ka=e,nd=mo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(kt=!0),e.firstContext=null)}function Jt(e){var t=e._currentValue;if(nd!==e)if(e={context:e,memoizedValue:t,next:null},mo===null){if(ka===null)throw Error(M(308));mo=e,ka.dependencies={lanes:0,firstContext:e}}else mo=mo.next=e;return t}var Mr=null;function id(e){Mr===null?Mr=[e]:Mr.push(e)}function Yg(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,id(t)):(n.next=o.next,o.next=n),t.interleaved=n,Vn(e,r)}function Vn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Zn=!1;function sd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Mn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ur(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ge&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Vn(e,n)}return o=r.interleaved,o===null?(t.next=t,id(r)):(t.next=o.next,o.next=t),r.interleaved=t,Vn(e,n)}function Xs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hc(e,n)}}function cp(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ja(e,t,n,r){var o=e.updateQueue;Zn=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var f=o.baseState;s=0,d=c=l=null,a=i;do{var p=a.lane,v=a.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:v,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,w=a;switch(p=t,v=n,w.tag){case 1:if(x=w.payload,typeof x=="function"){f=x.call(v,f,p);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=w.payload,p=typeof x=="function"?x.call(v,f,p):x,p==null)break e;f=Me({},f,p);break e;case 2:Zn=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[a]:p.push(a))}else v={eventTime:v,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=v,l=f):d=d.next=v,s|=p;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;p=a,a=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);if(d===null&&(l=f),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Kr|=s,e.lanes=s,e.memoizedState=f}}function dp(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Bl.transition;Bl.transition={};try{e(!1),t()}finally{ve=n,Bl.transition=r}}function f0(){return Zt().memoizedState}function mS(e,t,n){var r=dr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},p0(e))h0(t,n);else if(n=Yg(e,t,n,r),n!==null){var o=xt();un(n,e,r,o),m0(n,t,r)}}function gS(e,t,n){var r=dr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(p0(e))h0(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,cn(a,s)){var l=t.interleaved;l===null?(o.next=o,id(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=Yg(e,t,o,r),n!==null&&(o=xt(),un(n,e,r,o),m0(n,t,r))}}function p0(e){var t=e.alternate;return e===Fe||t!==null&&t===Fe}function h0(e,t){bi=Ea=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function m0(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hc(e,n)}}var Pa={readContext:Jt,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useInsertionEffect:lt,useLayoutEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useMutableSource:lt,useSyncExternalStore:lt,useId:lt,unstable_isNewReconciler:!1},yS={readContext:Jt,useCallback:function(e,t){return Sn().memoizedState=[e,t===void 0?null:t],e},useContext:Jt,useEffect:pp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Js(4194308,4,a0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Js(4194308,4,e,t)},useInsertionEffect:function(e,t){return Js(4,2,e,t)},useMemo:function(e,t){var n=Sn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Sn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=mS.bind(null,Fe,e),[r.memoizedState,e]},useRef:function(e){var t=Sn();return e={current:e},t.memoizedState=e},useState:fp,useDebugValue:hd,useDeferredValue:function(e){return Sn().memoizedState=e},useTransition:function(){var e=fp(!1),t=e[0];return e=hS.bind(null,e[1]),Sn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Fe,o=Sn();if(Ae){if(n===void 0)throw Error(M(407));n=n()}else{if(n=t(),Je===null)throw Error(M(349));Hr&30||Zg(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,pp(t0.bind(null,r,i,e),[e]),r.flags|=2048,Ki(9,e0.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Sn(),t=Je.identifierPrefix;if(Ae){var n=Fn,r=zn;n=(r&~(1<<32-ln(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Wi++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[wn]=t,e[Bi]=r,j0(e,t,!1,!1),t.stateNode=e;e:{switch(s=Tu(n,r),n){case"dialog":Te("cancel",e),Te("close",e),o=r;break;case"iframe":case"object":case"embed":Te("load",e),o=r;break;case"video":case"audio":for(o=0;oMo&&(t.flags|=128,r=!0,ai(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ta(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ai(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ae)return ut(t),null}else 2*$e()-i.renderingStartTime>Mo&&n!==1073741824&&(t.flags|=128,r=!0,ai(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=$e(),t.sibling=null,n=De.current,ke(De,r?n&1|2:n&1),t):(ut(t),null);case 22:case 23:return Sd(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ft&1073741824&&(ut(t),t.subtreeFlags&6&&(t.flags|=8192)):ut(t),null;case 24:return null;case 25:return null}throw Error(M(156,t.tag))}function jS(e,t){switch(ed(t),t.tag){case 1:return Tt(t.type)&&va(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zo(),Ee(jt),Ee(ht),ud(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ld(t),null;case 13:if(Ee(De),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));No()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ee(De),null;case 4:return zo(),null;case 10:return od(t.type._context),null;case 22:case 23:return Sd(),null;case 24:return null;default:return null}}var Is=!1,dt=!1,TS=typeof WeakSet=="function"?WeakSet:Set,$=null;function go(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ve(e,t,r)}else n.current=null}function Zu(e,t,n){try{n()}catch(r){Ve(e,t,r)}}var kp=!1;function ES(e,t){if(Iu=ma,e=Dg(),Jc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,d=0,f=e,p=null;t:for(;;){for(var v;f!==n||o!==0&&f.nodeType!==3||(a=s+o),f!==i||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(v=f.firstChild)!==null;)p=f,f=v;for(;;){if(f===e)break t;if(p===n&&++c===o&&(a=s),p===i&&++d===r&&(l=s),(v=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=v}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Lu={focusedElem:e,selectionRange:n},ma=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var w=x.memoizedProps,m=x.memoizedState,g=t.stateNode,y=g.getSnapshotBeforeUpdate(t.elementType===t.type?w:on(t.type,w),m);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(M(163))}}catch(k){Ve(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return x=kp,kp=!1,x}function ki(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Zu(t,n,i)}o=o.next}while(o!==r)}}function el(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ec(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function P0(e){var t=e.alternate;t!==null&&(e.alternate=null,P0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[wn],delete t[Bi],delete t[Vu],delete t[uS],delete t[cS])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function R0(e){return e.tag===5||e.tag===3||e.tag===4}function jp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||R0(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=xa));else if(r!==4&&(e=e.child,e!==null))for(tc(e,t,n),e=e.sibling;e!==null;)tc(e,t,n),e=e.sibling}function nc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(nc(e,t,n),e=e.sibling;e!==null;)nc(e,t,n),e=e.sibling}var rt=null,sn=!1;function Xn(e,t,n){for(n=n.child;n!==null;)A0(e,t,n),n=n.sibling}function A0(e,t,n){if(bn&&typeof bn.onCommitFiberUnmount=="function")try{bn.onCommitFiberUnmount(Ka,n)}catch{}switch(n.tag){case 5:dt||go(n,t);case 6:var r=rt,o=sn;rt=null,Xn(e,t,n),rt=r,sn=o,rt!==null&&(sn?(e=rt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):rt.removeChild(n.stateNode));break;case 18:rt!==null&&(sn?(e=rt,n=n.stateNode,e.nodeType===8?Ol(e.parentNode,n):e.nodeType===1&&Ol(e,n),Ii(e)):Ol(rt,n.stateNode));break;case 4:r=rt,o=sn,rt=n.stateNode.containerInfo,sn=!0,Xn(e,t,n),rt=r,sn=o;break;case 0:case 11:case 14:case 15:if(!dt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Zu(n,t,s),o=o.next}while(o!==r)}Xn(e,t,n);break;case 1:if(!dt&&(go(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ve(n,t,a)}Xn(e,t,n);break;case 21:Xn(e,t,n);break;case 22:n.mode&1?(dt=(r=dt)||n.memoizedState!==null,Xn(e,t,n),dt=r):Xn(e,t,n);break;default:Xn(e,t,n)}}function Tp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new TS),t.forEach(function(r){var o=IS.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function nn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=$e()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*RS(r/1960))-r,10e?16:e,rr===null)var r=!1;else{if(e=rr,rr=null,Na=0,ge&6)throw Error(M(331));var o=ge;for(ge|=4,$=e.current;$!==null;){var i=$,s=i.child;if($.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l$e()-xd?_r(e,0):yd|=n),Et(e,t)}function O0(e,t){t===0&&(e.mode&1?(t=Es,Es<<=1,!(Es&130023424)&&(Es=4194304)):t=1);var n=xt();e=Vn(e,t),e!==null&&(ns(e,t,n),Et(e,n))}function MS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),O0(e,n)}function IS(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(M(314))}r!==null&&r.delete(t),O0(e,n)}var _0;_0=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||jt.current)kt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return kt=!1,bS(e,t,n);kt=!!(e.flags&131072)}else kt=!1,Ae&&t.flags&1048576&&$g(t,Ca,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Zs(e,t),e=t.pendingProps;var o=Ao(t,ht.current);Eo(t,n),o=dd(null,t,r,e,o,n);var i=fd();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Tt(r)?(i=!0,Sa(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,sd(t),o.updater=Za,t.stateNode=o,o._reactInternals=t,Ku(t,r,e,n),t=qu(null,t,r,!0,i,n)):(t.tag=0,Ae&&i&&Zc(t),yt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Zs(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=OS(r),e=on(r,e),o){case 0:t=Yu(null,t,r,e,n);break e;case 1:t=wp(null,t,r,e,n);break e;case 11:t=vp(null,t,r,e,n);break e;case 14:t=Sp(null,t,r,on(r.type,e),n);break e}throw Error(M(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:on(r,o),Yu(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:on(r,o),wp(e,t,r,o,n);case 3:e:{if(C0(t),e===null)throw Error(M(387));r=t.pendingProps,i=t.memoizedState,o=i.element,qg(e,t),ja(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Fo(Error(M(423)),t),t=Cp(e,t,r,n,o);break e}else if(r!==o){o=Fo(Error(M(424)),t),t=Cp(e,t,r,n,o);break e}else for(Mt=lr(t.stateNode.containerInfo.firstChild),It=t,Ae=!0,an=null,n=Gg(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(No(),r===o){t=Bn(e,t,n);break e}yt(e,t,r,n)}t=t.child}return t;case 5:return Xg(t),e===null&&$u(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Ou(r,o)?s=null:i!==null&&Ou(r,i)&&(t.flags|=32),w0(e,t),yt(e,t,s,n),t.child;case 6:return e===null&&$u(t),null;case 13:return b0(e,t,n);case 4:return ad(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Do(t,null,r,n):yt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:on(r,o),vp(e,t,r,o,n);case 7:return yt(e,t,t.pendingProps,n),t.child;case 8:return yt(e,t,t.pendingProps.children,n),t.child;case 12:return yt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,ke(ba,r._currentValue),r._currentValue=s,i!==null)if(cn(i.value,s)){if(i.children===o.children&&!jt.current){t=Bn(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Mn(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Wu(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(M(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Wu(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}yt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Eo(t,n),o=Jt(o),r=r(o),t.flags|=1,yt(e,t,r,n),t.child;case 14:return r=t.type,o=on(r,t.pendingProps),o=on(r.type,o),Sp(e,t,r,o,n);case 15:return v0(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:on(r,o),Zs(e,t),t.tag=1,Tt(r)?(e=!0,Sa(t)):e=!1,Eo(t,n),g0(t,r,o),Ku(t,r,o,n),qu(null,t,r,!0,e,n);case 19:return k0(e,t,n);case 22:return S0(e,t,n)}throw Error(M(156,t.tag))};function V0(e,t){return pg(e,t)}function LS(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qt(e,t,n,r){return new LS(e,t,n,r)}function Cd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function OS(e){if(typeof e=="function")return Cd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Bc)return 11;if(e===Uc)return 14}return 2}function fr(e,t){var n=e.alternate;return n===null?(n=qt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function na(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Cd(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case so:return Vr(n.children,o,i,t);case Vc:s=8,o|=8;break;case gu:return e=qt(12,n,t,o|2),e.elementType=gu,e.lanes=i,e;case yu:return e=qt(13,n,t,o),e.elementType=yu,e.lanes=i,e;case xu:return e=qt(19,n,t,o),e.elementType=xu,e.lanes=i,e;case Xm:return nl(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ym:s=10;break e;case qm:s=9;break e;case Bc:s=11;break e;case Uc:s=14;break e;case Jn:s=16,r=null;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=qt(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Vr(e,t,n,r){return e=qt(7,e,r,t),e.lanes=n,e}function nl(e,t,n,r){return e=qt(22,e,r,t),e.elementType=Xm,e.lanes=n,e.stateNode={isHidden:!1},e}function Kl(e,t,n){return e=qt(6,e,null,t),e.lanes=n,e}function Gl(e,t,n){return t=qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function _S(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=El(0),this.expirationTimes=El(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=El(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function bd(e,t,n,r,o,i,s,a,l){return e=new _S(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=qt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},sd(i),e}function VS(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(W0)}catch(e){console.error(e)}}W0(),Wm.exports=Vt;var H0=Wm.exports,Fp=H0;hu.createRoot=Fp.createRoot,hu.hydrateRoot=Fp.hydrateRoot;/** * @remix-run/router v1.23.0 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Yi(){return Yi=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function K0(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function KS(){return Math.random().toString(36).substr(2,8)}function Ip(e,t){return{usr:e.state,key:e.key,idx:t}}function ac(e,t,n,r){return n===void 0&&(n=null),Yi({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?$o(t):t,{state:n,key:t&&t.key||r||KS()})}function Fa(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function $o(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function GS(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,a=or.Pop,l=null,c=d();c==null&&(c=0,s.replaceState(Yi({},s.state,{idx:c}),""));function d(){return(s.state||{idx:null}).idx}function f(){a=or.Pop;let m=d(),g=m==null?null:m-c;c=m,l&&l({action:a,location:w.location,delta:g})}function p(m,g){a=or.Push;let y=ac(w.location,m,g);c=d()+1;let S=Ip(y,c),k=w.createHref(y);try{s.pushState(S,"",k)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;o.location.assign(k)}i&&l&&l({action:a,location:w.location,delta:1})}function v(m,g){a=or.Replace;let y=ac(w.location,m,g);c=d();let S=Ip(y,c),k=w.createHref(y);s.replaceState(S,"",k),i&&l&&l({action:a,location:w.location,delta:0})}function x(m){let g=o.location.origin!=="null"?o.location.origin:o.location.href,y=typeof m=="string"?m:Fa(m);return y=y.replace(/ $/,"%20"),Ge(g,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,g)}let w={get action(){return a},get location(){return e(o,s)},listen(m){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(Mp,f),l=m,()=>{o.removeEventListener(Mp,f),l=null}},createHref(m){return t(o,m)},createURL:x,encodeLocation(m){let g=x(m);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:p,replace:v,go(m){return s.go(m)}};return w}var Lp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Lp||(Lp={}));function YS(e,t,n){return n===void 0&&(n="/"),qS(e,t,n)}function qS(e,t,n,r){let o=typeof t=="string"?$o(t):t,i=Ed(o.pathname||"/",n);if(i==null)return null;let s=G0(e);XS(s);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};l.relativePath.startsWith("/")&&(Ge(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let c=pr([r,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(Ge(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),G0(i.children,t,d,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:rw(c,i.index),routesMeta:d})};return e.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let l of Y0(i.path))o(i,s,l)}),t}function Y0(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=Y0(r.join("/")),a=[];return a.push(...s.map(l=>l===""?i:[i,l].join("/"))),o&&a.push(...s),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function XS(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ow(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const QS=/^:[\w-]+$/,JS=3,ZS=2,ew=1,tw=10,nw=-2,Op=e=>e==="*";function rw(e,t){let n=e.split("/"),r=n.length;return n.some(Op)&&(r+=nw),t&&(r+=ZS),n.filter(o=>!Op(o)).reduce((o,i)=>o+(QS.test(i)?JS:i===""?ew:tw),r)}function ow(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function iw(e,t,n){let{routesMeta:r}=e,o={},i="/",s=[];for(let a=0;a{let{paramName:p,isOptional:v}=d;if(p==="*"){let w=a[f]||"";s=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const x=a[f];return v&&!x?c[p]=void 0:c[p]=(x||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:s,pattern:e}}function aw(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),K0(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function lw(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return K0(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ed(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function uw(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?$o(e):e;return{pathname:n?n.startsWith("/")?n:cw(n,t):t,search:pw(r),hash:hw(o)}}function cw(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Yl(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function dw(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function q0(e,t){let n=dw(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function X0(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=$o(e):(o=Yi({},e),Ge(!o.pathname||!o.pathname.includes("?"),Yl("?","pathname","search",o)),Ge(!o.pathname||!o.pathname.includes("#"),Yl("#","pathname","hash",o)),Ge(!o.search||!o.search.includes("#"),Yl("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,a;if(s==null)a=n;else{let f=t.length-1;if(!r&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),f-=1;o.pathname=p.join("/")}a=f>=0?t[f]:"/"}let l=uw(o,a),c=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}const pr=e=>e.join("/").replace(/\/\/+/g,"/"),fw=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),pw=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,hw=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function mw(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Q0=["post","put","patch","delete"];new Set(Q0);const gw=["get",...Q0];new Set(gw);/** * React Router v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function qi(){return qi=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),h.useCallback(function(c,d){if(d===void 0&&(d={}),!a.current)return;if(typeof c=="number"){r.go(c);return}let f=X0(c,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:pr([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,s,i,e])}function Sw(){let{matches:e}=h.useContext(wr),t=e[e.length-1];return t?t.params:{}}function ey(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=h.useContext(Qr),{matches:o}=h.useContext(wr),{pathname:i}=Wo(),s=JSON.stringify(q0(o,r.v7_relativeSplatPath));return h.useMemo(()=>X0(e,JSON.parse(s),i,n==="path"),[e,s,i,n])}function ww(e,t){return Cw(e,t)}function Cw(e,t,n,r){ss()||Ge(!1);let{navigator:o}=h.useContext(Qr),{matches:i}=h.useContext(wr),s=i[i.length-1],a=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let c=Wo(),d;if(t){var f;let m=typeof t=="string"?$o(t):t;l==="/"||(f=m.pathname)!=null&&f.startsWith(l)||Ge(!1),d=m}else d=c;let p=d.pathname||"/",v=p;if(l!=="/"){let m=l.replace(/^\//,"").split("/");v="/"+p.replace(/^\//,"").split("/").slice(m.length).join("/")}let x=YS(e,{pathname:v}),w=Ew(x&&x.map(m=>Object.assign({},m,{params:Object.assign({},a,m.params),pathname:pr([l,o.encodeLocation?o.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?l:pr([l,o.encodeLocation?o.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),i,n,r);return t&&w?h.createElement(al.Provider,{value:{location:qi({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:or.Pop}},w):w}function bw(){let e=Nw(),t=mw(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:o},n):null,null)}const kw=h.createElement(bw,null);class jw extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(wr.Provider,{value:this.props.routeContext},h.createElement(J0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Tw(e){let{routeContext:t,match:n,children:r}=e,o=h.useContext(Pd);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(wr.Provider,{value:t},r)}function Ew(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,a=(o=n)==null?void 0:o.errors;if(a!=null){let d=s.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||Ge(!1),s=s.slice(0,Math.min(s.length,d+1))}let l=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((d,f,p)=>{let v,x=!1,w=null,m=null;n&&(v=a&&f.route.id?a[f.route.id]:void 0,w=f.route.errorElement||kw,l&&(c<0&&p===0?(zw("route-fallback"),x=!0,m=null):c===p&&(x=!0,m=f.route.hydrateFallbackElement||null)));let g=t.concat(s.slice(0,p+1)),y=()=>{let S;return v?S=w:x?S=m:f.route.Component?S=h.createElement(f.route.Component,null):f.route.element?S=f.route.element:S=d,h.createElement(Tw,{match:f,routeContext:{outlet:d,matches:g,isDataRoute:n!=null},children:S})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?h.createElement(jw,{location:n.location,revalidation:n.revalidation,component:w,error:v,children:y(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):y()},null)}var ty=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ty||{}),ny=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ny||{});function Pw(e){let t=h.useContext(Pd);return t||Ge(!1),t}function Rw(e){let t=h.useContext(yw);return t||Ge(!1),t}function Aw(e){let t=h.useContext(wr);return t||Ge(!1),t}function ry(e){let t=Aw(),n=t.matches[t.matches.length-1];return n.route.id||Ge(!1),n.route.id}function Nw(){var e;let t=h.useContext(J0),n=Rw(),r=ry();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Dw(){let{router:e}=Pw(ty.UseNavigateStable),t=ry(ny.UseNavigateStable),n=h.useRef(!1);return Z0(()=>{n.current=!0}),h.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,qi({fromRouteId:t},i)))},[e,t])}const _p={};function zw(e,t,n){_p[e]||(_p[e]=!0)}function Fw(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function ro(e){Ge(!1)}function Mw(e){let{basename:t="/",children:n=null,location:r,navigationType:o=or.Pop,navigator:i,static:s=!1,future:a}=e;ss()&&Ge(!1);let l=t.replace(/^\/*/,"/"),c=h.useMemo(()=>({basename:l,navigator:i,static:s,future:qi({v7_relativeSplatPath:!1},a)}),[l,a,i,s]);typeof r=="string"&&(r=$o(r));let{pathname:d="/",search:f="",hash:p="",state:v=null,key:x="default"}=r,w=h.useMemo(()=>{let m=Ed(d,l);return m==null?null:{location:{pathname:m,search:f,hash:p,state:v,key:x},navigationType:o}},[l,d,f,p,v,x,o]);return w==null?null:h.createElement(Qr.Provider,{value:c},h.createElement(al.Provider,{children:n,value:w}))}function Iw(e){let{children:t,location:n}=e;return ww(lc(t),n)}new Promise(()=>{});function lc(e,t){t===void 0&&(t=[]);let n=[];return h.Children.forEach(e,(r,o)=>{if(!h.isValidElement(r))return;let i=[...t,o];if(r.type===h.Fragment){n.push.apply(n,lc(r.props.children,i));return}r.type!==ro&&Ge(!1),!r.props.index||!r.props.children||Ge(!1);let s={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=lc(r.props.children,i)),n.push(s)}),n}/** * React Router DOM v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function uc(){return uc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function Ow(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _w(e,t){return e.button===0&&(!t||t==="_self")&&!Ow(e)}function cc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function Vw(e,t){let n=cc(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}const Bw=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Uw="6";try{window.__reactRouterVersion=Uw}catch{}const $w="startTransition",Vp=Fv[$w];function Ww(e){let{basename:t,children:n,future:r,window:o}=e,i=h.useRef();i.current==null&&(i.current=HS({window:o,v5Compat:!0}));let s=i.current,[a,l]=h.useState({action:s.action,location:s.location}),{v7_startTransition:c}=r||{},d=h.useCallback(f=>{c&&Vp?Vp(()=>l(f)):l(f)},[l,c]);return h.useLayoutEffect(()=>s.listen(d),[s,d]),h.useEffect(()=>Fw(r),[r]),h.createElement(Mw,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:s,future:r})}const Hw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Kw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ql=h.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:i,replace:s,state:a,target:l,to:c,preventScrollReset:d,viewTransition:f}=t,p=Lw(t,Bw),{basename:v}=h.useContext(Qr),x,w=!1;if(typeof c=="string"&&Kw.test(c)&&(x=c,Hw))try{let S=new URL(window.location.href),k=c.startsWith("//")?new URL(S.protocol+c):new URL(c),j=Ed(k.pathname,v);k.origin===S.origin&&j!=null?c=j+k.search+k.hash:w=!0}catch{}let m=xw(c,{relative:o}),g=Gw(c,{replace:s,state:a,target:l,preventScrollReset:d,relative:o,viewTransition:f});function y(S){r&&r(S),S.defaultPrevented||g(S)}return h.createElement("a",uc({},p,{href:x||m,onClick:w||i?r:y,ref:n,target:l}))});var Bp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Bp||(Bp={}));var Up;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Up||(Up={}));function Gw(e,t){let{target:n,replace:r,state:o,preventScrollReset:i,relative:s,viewTransition:a}=t===void 0?{}:t,l=Ho(),c=Wo(),d=ey(e,{relative:s});return h.useCallback(f=>{if(_w(f,n)){f.preventDefault();let p=r!==void 0?r:Fa(c)===Fa(d);l(e,{replace:p,state:o,preventScrollReset:i,relative:s,viewTransition:a})}},[c,l,d,r,o,n,e,i,s,a])}function Yw(e){let t=h.useRef(cc(e)),n=h.useRef(!1),r=Wo(),o=h.useMemo(()=>Vw(r.search,n.current?null:t.current),[r.search]),i=Ho(),s=h.useCallback((a,l)=>{const c=cc(typeof a=="function"?a(o):a);n.current=!0,i("?"+c,l)},[i,o]);return[o,s]}function Wn(e){const[t,n]=h.useState(()=>window.matchMedia(e).matches);return h.useEffect(()=>{const r=window.matchMedia(e),o=i=>n(i.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[e]),t}function oy(e,t){return function(){return e.apply(t,arguments)}}const{toString:qw}=Object.prototype,{getPrototypeOf:Rd}=Object,{iterator:ll,toStringTag:iy}=Symbol,ul=(e=>t=>{const n=qw.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),dn=e=>(e=e.toLowerCase(),t=>ul(t)===e),cl=e=>t=>typeof t===e,{isArray:Ko}=Array,Io=cl("undefined");function as(e){return e!==null&&!Io(e)&&e.constructor!==null&&!Io(e.constructor)&&Pt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const sy=dn("ArrayBuffer");function Xw(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&sy(e.buffer),t}const Qw=cl("string"),Pt=cl("function"),ay=cl("number"),ls=e=>e!==null&&typeof e=="object",Jw=e=>e===!0||e===!1,ra=e=>{if(ul(e)!=="object")return!1;const t=Rd(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(iy in e)&&!(ll in e)},Zw=e=>{if(!ls(e)||as(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},eC=dn("Date"),tC=dn("File"),nC=dn("Blob"),rC=dn("FileList"),oC=e=>ls(e)&&Pt(e.pipe),iC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Pt(e.append)&&((t=ul(e))==="formdata"||t==="object"&&Pt(e.toString)&&e.toString()==="[object FormData]"))},sC=dn("URLSearchParams"),[aC,lC,uC,cC]=["ReadableStream","Request","Response","Headers"].map(dn),dC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function us(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),Ko(e))for(r=0,o=e.length;r0;)if(o=n[r],t===o.toLowerCase())return o;return null}const Lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,uy=e=>!Io(e)&&e!==Lr;function dc(){const{caseless:e,skipUndefined:t}=uy(this)&&this||{},n={},r=(o,i)=>{const s=e&&ly(n,i)||i;ra(n[s])&&ra(o)?n[s]=dc(n[s],o):ra(o)?n[s]=dc({},o):Ko(o)?n[s]=o.slice():(!t||!Io(o))&&(n[s]=o)};for(let o=0,i=arguments.length;o(us(t,(o,i)=>{n&&Pt(o)?e[i]=oy(o,n):e[i]=o},{allOwnKeys:r}),e),pC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),hC=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},mC=(e,t,n,r)=>{let o,i,s;const a={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],(!r||r(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=n!==!1&&Rd(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},gC=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},yC=e=>{if(!e)return null;if(Ko(e))return e;let t=e.length;if(!ay(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},xC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Rd(Uint8Array)),vC=(e,t)=>{const r=(e&&e[ll]).call(e);let o;for(;(o=r.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},SC=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},wC=dn("HTMLFormElement"),CC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),$p=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),bC=dn("RegExp"),cy=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};us(n,(o,i)=>{let s;(s=t(o,i,e))!==!1&&(r[i]=s||o)}),Object.defineProperties(e,r)},kC=e=>{cy(e,(t,n)=>{if(Pt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Pt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},jC=(e,t)=>{const n={},r=o=>{o.forEach(i=>{n[i]=!0})};return Ko(e)?r(e):r(String(e).split(t)),n},TC=()=>{},EC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function PC(e){return!!(e&&Pt(e.append)&&e[iy]==="FormData"&&e[ll])}const RC=e=>{const t=new Array(10),n=(r,o)=>{if(ls(r)){if(t.indexOf(r)>=0)return;if(as(r))return r;if(!("toJSON"in r)){t[o]=r;const i=Ko(r)?[]:{};return us(r,(s,a)=>{const l=n(s,o+1);!Io(l)&&(i[a]=l)}),t[o]=void 0,i}}return r};return n(e,0)},AC=dn("AsyncFunction"),NC=e=>e&&(ls(e)||Pt(e))&&Pt(e.then)&&Pt(e.catch),dy=((e,t)=>e?setImmediate:t?((n,r)=>(Lr.addEventListener("message",({source:o,data:i})=>{o===Lr&&i===n&&r.length&&r.shift()()},!1),o=>{r.push(o),Lr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Pt(Lr.postMessage)),DC=typeof queueMicrotask<"u"?queueMicrotask.bind(Lr):typeof process<"u"&&process.nextTick||dy,zC=e=>e!=null&&Pt(e[ll]),P={isArray:Ko,isArrayBuffer:sy,isBuffer:as,isFormData:iC,isArrayBufferView:Xw,isString:Qw,isNumber:ay,isBoolean:Jw,isObject:ls,isPlainObject:ra,isEmptyObject:Zw,isReadableStream:aC,isRequest:lC,isResponse:uC,isHeaders:cC,isUndefined:Io,isDate:eC,isFile:tC,isBlob:nC,isRegExp:bC,isFunction:Pt,isStream:oC,isURLSearchParams:sC,isTypedArray:xC,isFileList:rC,forEach:us,merge:dc,extend:fC,trim:dC,stripBOM:pC,inherits:hC,toFlatObject:mC,kindOf:ul,kindOfTest:dn,endsWith:gC,toArray:yC,forEachEntry:vC,matchAll:SC,isHTMLForm:wC,hasOwnProperty:$p,hasOwnProp:$p,reduceDescriptors:cy,freezeMethods:kC,toObjectSet:jC,toCamelCase:CC,noop:TC,toFiniteNumber:EC,findKey:ly,global:Lr,isContextDefined:uy,isSpecCompliantForm:PC,toJSONObject:RC,isAsyncFn:AC,isThenable:NC,setImmediate:dy,asap:DC,isIterable:zC};function ae(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}P.inherits(ae,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:P.toJSONObject(this.config),code:this.code,status:this.status}}});const fy=ae.prototype,py={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{py[e]={value:e}});Object.defineProperties(ae,py);Object.defineProperty(fy,"isAxiosError",{value:!0});ae.from=(e,t,n,r,o,i)=>{const s=Object.create(fy);P.toFlatObject(e,s,function(d){return d!==Error.prototype},c=>c!=="isAxiosError");const a=e&&e.message?e.message:"Error",l=t==null&&e?e.code:t;return ae.call(s,a,l,n,r,o),e&&s.cause==null&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",i&&Object.assign(s,i),s};const FC=null;function fc(e){return P.isPlainObject(e)||P.isArray(e)}function hy(e){return P.endsWith(e,"[]")?e.slice(0,-2):e}function Wp(e,t,n){return e?e.concat(t).map(function(o,i){return o=hy(o),!n&&i?"["+o+"]":o}).join(n?".":""):t}function MC(e){return P.isArray(e)&&!e.some(fc)}const IC=P.toFlatObject(P,{},null,function(t){return/^is[A-Z]/.test(t)});function dl(e,t,n){if(!P.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=P.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,m){return!P.isUndefined(m[w])});const r=n.metaTokens,o=n.visitor||d,i=n.dots,s=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&P.isSpecCompliantForm(t);if(!P.isFunction(o))throw new TypeError("visitor must be a function");function c(x){if(x===null)return"";if(P.isDate(x))return x.toISOString();if(P.isBoolean(x))return x.toString();if(!l&&P.isBlob(x))throw new ae("Blob is not supported. Use a Buffer instead.");return P.isArrayBuffer(x)||P.isTypedArray(x)?l&&typeof Blob=="function"?new Blob([x]):Buffer.from(x):x}function d(x,w,m){let g=x;if(x&&!m&&typeof x=="object"){if(P.endsWith(w,"{}"))w=r?w:w.slice(0,-2),x=JSON.stringify(x);else if(P.isArray(x)&&MC(x)||(P.isFileList(x)||P.endsWith(w,"[]"))&&(g=P.toArray(x)))return w=hy(w),g.forEach(function(S,k){!(P.isUndefined(S)||S===null)&&t.append(s===!0?Wp([w],k,i):s===null?w:w+"[]",c(S))}),!1}return fc(x)?!0:(t.append(Wp(m,w,i),c(x)),!1)}const f=[],p=Object.assign(IC,{defaultVisitor:d,convertValue:c,isVisitable:fc});function v(x,w){if(!P.isUndefined(x)){if(f.indexOf(x)!==-1)throw Error("Circular reference detected in "+w.join("."));f.push(x),P.forEach(x,function(g,y){(!(P.isUndefined(g)||g===null)&&o.call(t,g,P.isString(y)?y.trim():y,w,p))===!0&&v(g,w?w.concat(y):[y])}),f.pop()}}if(!P.isObject(e))throw new TypeError("data must be an object");return v(e),t}function Hp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ad(e,t){this._pairs=[],e&&dl(e,this,t)}const my=Ad.prototype;my.append=function(t,n){this._pairs.push([t,n])};my.toString=function(t){const n=t?function(r){return t.call(this,r,Hp)}:Hp;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function LC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function gy(e,t,n){if(!t)return e;const r=n&&n.encode||LC;P.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let i;if(o?i=o(t,n):i=P.isURLSearchParams(t)?t.toString():new Ad(t,n).toString(r),i){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Kp{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){P.forEach(this.handlers,function(r){r!==null&&t(r)})}}const yy={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},OC=typeof URLSearchParams<"u"?URLSearchParams:Ad,_C=typeof FormData<"u"?FormData:null,VC=typeof Blob<"u"?Blob:null,BC={isBrowser:!0,classes:{URLSearchParams:OC,FormData:_C,Blob:VC},protocols:["http","https","file","blob","url","data"]},Nd=typeof window<"u"&&typeof document<"u",pc=typeof navigator=="object"&&navigator||void 0,UC=Nd&&(!pc||["ReactNative","NativeScript","NS"].indexOf(pc.product)<0),$C=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",WC=Nd&&window.location.href||"http://localhost",HC=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Nd,hasStandardBrowserEnv:UC,hasStandardBrowserWebWorkerEnv:$C,navigator:pc,origin:WC},Symbol.toStringTag,{value:"Module"})),ft={...HC,...BC};function KC(e,t){return dl(e,new ft.classes.URLSearchParams,{visitor:function(n,r,o,i){return ft.isNode&&P.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function GC(e){return P.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function YC(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r=n.length;return s=!s&&P.isArray(o)?o.length:s,l?(P.hasOwnProp(o,s)?o[s]=[o[s],r]:o[s]=r,!a):((!o[s]||!P.isObject(o[s]))&&(o[s]=[]),t(n,r,o[s],i)&&P.isArray(o[s])&&(o[s]=YC(o[s])),!a)}if(P.isFormData(e)&&P.isFunction(e.entries)){const n={};return P.forEachEntry(e,(r,o)=>{t(GC(r),o,n,0)}),n}return null}function qC(e,t,n){if(P.isString(e))try{return(t||JSON.parse)(e),P.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const cs={transitional:yy,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,i=P.isObject(t);if(i&&P.isHTMLForm(t)&&(t=new FormData(t)),P.isFormData(t))return o?JSON.stringify(xy(t)):t;if(P.isArrayBuffer(t)||P.isBuffer(t)||P.isStream(t)||P.isFile(t)||P.isBlob(t)||P.isReadableStream(t))return t;if(P.isArrayBufferView(t))return t.buffer;if(P.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return KC(t,this.formSerializer).toString();if((a=P.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return dl(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return i||o?(n.setContentType("application/json",!1),qC(t)):t}],transformResponse:[function(t){const n=this.transitional||cs.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(P.isResponse(t)||P.isReadableStream(t))return t;if(t&&P.isString(t)&&(r&&!this.responseType||o)){const s=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t,this.parseReviver)}catch(a){if(s)throw a.name==="SyntaxError"?ae.from(a,ae.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ft.classes.FormData,Blob:ft.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};P.forEach(["delete","get","head","post","put","patch"],e=>{cs.headers[e]={}});const XC=P.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),QC=e=>{const t={};let n,r,o;return e&&e.split(` `).forEach(function(s){o=s.indexOf(":"),n=s.substring(0,o).trim().toLowerCase(),r=s.substring(o+1).trim(),!(!n||t[n]&&XC[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Gp=Symbol("internals");function ui(e){return e&&String(e).trim().toLowerCase()}function oa(e){return e===!1||e==null?e:P.isArray(e)?e.map(oa):String(e)}function JC(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const ZC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Xl(e,t,n,r,o){if(P.isFunction(r))return r.call(this,t,n);if(o&&(t=n),!!P.isString(t)){if(P.isString(r))return t.indexOf(r)!==-1;if(P.isRegExp(r))return r.test(t)}}function eb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function tb(e,t){const n=P.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(o,i,s){return this[r].call(this,t,o,i,s)},configurable:!0})})}let Rt=class{constructor(t){t&&this.set(t)}set(t,n,r){const o=this;function i(a,l,c){const d=ui(l);if(!d)throw new Error("header name must be a non-empty string");const f=P.findKey(o,d);(!f||o[f]===void 0||c===!0||c===void 0&&o[f]!==!1)&&(o[f||l]=oa(a))}const s=(a,l)=>P.forEach(a,(c,d)=>i(c,d,l));if(P.isPlainObject(t)||t instanceof this.constructor)s(t,n);else if(P.isString(t)&&(t=t.trim())&&!ZC(t))s(QC(t),n);else if(P.isObject(t)&&P.isIterable(t)){let a={},l,c;for(const d of t){if(!P.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[c=d[0]]=(l=a[c])?P.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}s(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=ui(t),t){const r=P.findKey(this,t);if(r){const o=this[r];if(!n)return o;if(n===!0)return JC(o);if(P.isFunction(n))return n.call(this,o,r);if(P.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=ui(t),t){const r=P.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Xl(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let o=!1;function i(s){if(s=ui(s),s){const a=P.findKey(r,s);a&&(!n||Xl(r,r[a],a,n))&&(delete r[a],o=!0)}}return P.isArray(t)?t.forEach(i):i(t),o}clear(t){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const i=n[r];(!t||Xl(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const n=this,r={};return P.forEach(this,(o,i)=>{const s=P.findKey(r,i);if(s){n[s]=oa(o),delete n[i];return}const a=t?eb(i):String(i).trim();a!==i&&delete n[i],n[a]=oa(o),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return P.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=t&&P.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[Gp]=this[Gp]={accessors:{}}).accessors,o=this.prototype;function i(s){const a=ui(s);r[a]||(tb(o,s),r[a]=!0)}return P.isArray(t)?t.forEach(i):i(t),this}};Rt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);P.reduceDescriptors(Rt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});P.freezeMethods(Rt);function Ql(e,t){const n=this||cs,r=t||n,o=Rt.from(r.headers);let i=r.data;return P.forEach(e,function(a){i=a.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function vy(e){return!!(e&&e.__CANCEL__)}function Go(e,t,n){ae.call(this,e??"canceled",ae.ERR_CANCELED,t,n),this.name="CanceledError"}P.inherits(Go,ae,{__CANCEL__:!0});function Sy(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new ae("Request failed with status code "+n.status,[ae.ERR_BAD_REQUEST,ae.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function nb(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function rb(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,s;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),d=r[i];s||(s=c),n[o]=l,r[o]=c;let f=i,p=0;for(;f!==o;)p+=n[f++],f=f%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s{n=d,o=null,i&&(clearTimeout(i),i=null),e(...c)};return[(...c)=>{const d=Date.now(),f=d-n;f>=r?s(c,d):(o=c,i||(i=setTimeout(()=>{i=null,s(o)},r-f)))},()=>o&&s(o)]}const Ma=(e,t,n=3)=>{let r=0;const o=rb(50,250);return ob(i=>{const s=i.loaded,a=i.lengthComputable?i.total:void 0,l=s-r,c=o(l),d=s<=a;r=s;const f={loaded:s,total:a,progress:a?s/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&d?(a-s)/c:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},Yp=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},qp=e=>(...t)=>P.asap(()=>e(...t)),ib=ft.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ft.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ft.origin),ft.navigator&&/(msie|trident)/i.test(ft.navigator.userAgent)):()=>!0,sb=ft.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];P.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),P.isString(r)&&a.push(`path=${r}`),P.isString(o)&&a.push(`domain=${o}`),i===!0&&a.push("secure"),P.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ab(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function wy(e,t,n){let r=!ab(t);return e&&(r||n==!1)?lb(e,t):t}const Xp=e=>e instanceof Rt?{...e}:e;function Yr(e,t){t=t||{};const n={};function r(c,d,f,p){return P.isPlainObject(c)&&P.isPlainObject(d)?P.merge.call({caseless:p},c,d):P.isPlainObject(d)?P.merge({},d):P.isArray(d)?d.slice():d}function o(c,d,f,p){if(P.isUndefined(d)){if(!P.isUndefined(c))return r(void 0,c,f,p)}else return r(c,d,f,p)}function i(c,d){if(!P.isUndefined(d))return r(void 0,d)}function s(c,d){if(P.isUndefined(d)){if(!P.isUndefined(c))return r(void 0,c)}else return r(void 0,d)}function a(c,d,f){if(f in t)return r(c,d);if(f in e)return r(void 0,c)}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(c,d,f)=>o(Xp(c),Xp(d),f,!0)};return P.forEach(Object.keys({...e,...t}),function(d){const f=l[d]||o,p=f(e[d],t[d],d);P.isUndefined(p)&&f!==a||(n[d]=p)}),n}const Cy=e=>{const t=Yr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=Rt.from(s),t.url=gy(wy(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),P.isFormData(n)){if(ft.hasStandardBrowserEnv||ft.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(P.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([d,f])=>{c.includes(d.toLowerCase())&&s.set(d,f)})}}if(ft.hasStandardBrowserEnv&&(r&&P.isFunction(r)&&(r=r(t)),r||r!==!1&&ib(t.url))){const l=o&&i&&sb.read(i);l&&s.set(o,l)}return t},ub=typeof XMLHttpRequest<"u",cb=ub&&function(e){return new Promise(function(n,r){const o=Cy(e);let i=o.data;const s=Rt.from(o.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=o,d,f,p,v,x;function w(){v&&v(),x&&x(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let m=new XMLHttpRequest;m.open(o.method.toUpperCase(),o.url,!0),m.timeout=o.timeout;function g(){if(!m)return;const S=Rt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),j={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:S,config:e,request:m};Sy(function(N){n(N),w()},function(N){r(N),w()},j),m=null}"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(g)},m.onabort=function(){m&&(r(new ae("Request aborted",ae.ECONNABORTED,e,m)),m=null)},m.onerror=function(k){const j=k&&k.message?k.message:"Network Error",E=new ae(j,ae.ERR_NETWORK,e,m);E.event=k||null,r(E),m=null},m.ontimeout=function(){let k=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const j=o.transitional||yy;o.timeoutErrorMessage&&(k=o.timeoutErrorMessage),r(new ae(k,j.clarifyTimeoutError?ae.ETIMEDOUT:ae.ECONNABORTED,e,m)),m=null},i===void 0&&s.setContentType(null),"setRequestHeader"in m&&P.forEach(s.toJSON(),function(k,j){m.setRequestHeader(j,k)}),P.isUndefined(o.withCredentials)||(m.withCredentials=!!o.withCredentials),a&&a!=="json"&&(m.responseType=o.responseType),c&&([p,x]=Ma(c,!0),m.addEventListener("progress",p)),l&&m.upload&&([f,v]=Ma(l),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",v)),(o.cancelToken||o.signal)&&(d=S=>{m&&(r(!S||S.type?new Go(null,e,m):S),m.abort(),m=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const y=nb(o.url);if(y&&ft.protocols.indexOf(y)===-1){r(new ae("Unsupported protocol "+y+":",ae.ERR_BAD_REQUEST,e));return}m.send(i||null)})},db=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const i=function(c){if(!o){o=!0,a();const d=c instanceof Error?c:this.reason;r.abort(d instanceof ae?d:new Go(d instanceof Error?d.message:d))}};let s=t&&setTimeout(()=>{s=null,i(new ae(`timeout ${t} of ms exceeded`,ae.ETIMEDOUT))},t);const a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),e=null)};e.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>P.asap(a),l}},fb=function*(e,t){let n=e.byteLength;if(n{const o=pb(e,t);let i=0,s,a=l=>{s||(s=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:d}=await o.next();if(c){a(),l.close();return}let f=d.byteLength;if(n){let p=i+=f;n(p)}l.enqueue(new Uint8Array(d))}catch(c){throw a(c),c}},cancel(l){return a(l),o.return()}},{highWaterMark:2})},Jp=64*1024,{isFunction:_s}=P,mb=(({Request:e,Response:t})=>({Request:e,Response:t}))(P.global),{ReadableStream:Zp,TextEncoder:eh}=P.global,th=(e,...t)=>{try{return!!e(...t)}catch{return!1}},gb=e=>{e=P.merge.call({skipUndefined:!0},mb,e);const{fetch:t,Request:n,Response:r}=e,o=t?_s(t):typeof fetch=="function",i=_s(n),s=_s(r);if(!o)return!1;const a=o&&_s(Zp),l=o&&(typeof eh=="function"?(x=>w=>x.encode(w))(new eh):async x=>new Uint8Array(await new n(x).arrayBuffer())),c=i&&a&&th(()=>{let x=!1;const w=new n(ft.origin,{body:new Zp,method:"POST",get duplex(){return x=!0,"half"}}).headers.has("Content-Type");return x&&!w}),d=s&&a&&th(()=>P.isReadableStream(new r("").body)),f={stream:d&&(x=>x.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!f[x]&&(f[x]=(w,m)=>{let g=w&&w[x];if(g)return g.call(w);throw new ae(`Response type '${x}' is not supported`,ae.ERR_NOT_SUPPORT,m)})});const p=async x=>{if(x==null)return 0;if(P.isBlob(x))return x.size;if(P.isSpecCompliantForm(x))return(await new n(ft.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(P.isArrayBufferView(x)||P.isArrayBuffer(x))return x.byteLength;if(P.isURLSearchParams(x)&&(x=x+""),P.isString(x))return(await l(x)).byteLength},v=async(x,w)=>{const m=P.toFiniteNumber(x.getContentLength());return m??p(w)};return async x=>{let{url:w,method:m,data:g,signal:y,cancelToken:S,timeout:k,onDownloadProgress:j,onUploadProgress:E,responseType:N,headers:b,withCredentials:B="same-origin",fetchOptions:I}=Cy(x),V=t||fetch;N=N?(N+"").toLowerCase():"text";let oe=db([y,S&&S.toAbortSignal()],k),le=null;const he=oe&&oe.unsubscribe&&(()=>{oe.unsubscribe()});let Ce;try{if(E&&c&&m!=="get"&&m!=="head"&&(Ce=await v(b,g))!==0){let q=new n(w,{method:"POST",body:g,duplex:"half"}),de;if(P.isFormData(g)&&(de=q.headers.get("content-type"))&&b.setContentType(de),q.body){const[Be,Ne]=Yp(Ce,Ma(qp(E)));g=Qp(q.body,Jp,Be,Ne)}}P.isString(B)||(B=B?"include":"omit");const je=i&&"credentials"in n.prototype,D={...I,signal:oe,method:m.toUpperCase(),headers:b.normalize().toJSON(),body:g,duplex:"half",credentials:je?B:void 0};le=i&&new n(w,D);let F=await(i?V(le,I):V(w,D));const W=d&&(N==="stream"||N==="response");if(d&&(j||W&&he)){const q={};["status","statusText","headers"].forEach(Re=>{q[Re]=F[Re]});const de=P.toFiniteNumber(F.headers.get("content-length")),[Be,Ne]=j&&Yp(de,Ma(qp(j),!0))||[];F=new r(Qp(F.body,Jp,Be,()=>{Ne&&Ne(),he&&he()}),q)}N=N||"text";let G=await f[P.findKey(f,N)||"text"](F,x);return!W&&he&&he(),await new Promise((q,de)=>{Sy(q,de,{data:G,headers:Rt.from(F.headers),status:F.status,statusText:F.statusText,config:x,request:le})})}catch(je){throw he&&he(),je&&je.name==="TypeError"&&/Load failed|fetch/i.test(je.message)?Object.assign(new ae("Network Error",ae.ERR_NETWORK,x,le),{cause:je.cause||je}):ae.from(je,je&&je.code,x,le)}}},yb=new Map,by=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s=i.length,a=s,l,c,d=yb;for(;a--;)l=i[a],c=d.get(l),c===void 0&&d.set(l,c=a?new Map:gb(t)),d=c;return c};by();const Dd={http:FC,xhr:cb,fetch:{get:by}};P.forEach(Dd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const nh=e=>`- ${e}`,xb=e=>P.isFunction(e)||e===null||e===!1;function vb(e,t){e=P.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?s.length>1?`since : `+s.map(nh).join(` `):" "+nh(s[0]):"as no adapter specified";throw new ae("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o}const ky={getAdapter:vb,adapters:Dd};function Jl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Go(null,e)}function rh(e){return Jl(e),e.headers=Rt.from(e.headers),e.data=Ql.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ky.getAdapter(e.adapter||cs.adapter,e)(e).then(function(r){return Jl(e),r.data=Ql.call(e,e.transformResponse,r),r.headers=Rt.from(r.headers),r},function(r){return vy(r)||(Jl(e),r&&r.response&&(r.response.data=Ql.call(e,e.transformResponse,r.response),r.response.headers=Rt.from(r.response.headers))),Promise.reject(r)})}const jy="1.13.1",fl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{fl[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const oh={};fl.transitional=function(t,n,r){function o(i,s){return"[Axios v"+jy+"] Transitional option '"+i+"'"+s+(r?". "+r:"")}return(i,s,a)=>{if(t===!1)throw new ae(o(s," has been removed"+(n?" in "+n:"")),ae.ERR_DEPRECATED);return n&&!oh[s]&&(oh[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,s,a):!0}};fl.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Sb(e,t,n){if(typeof e!="object")throw new ae("options must be an object",ae.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const a=e[i],l=a===void 0||s(a,i,e);if(l!==!0)throw new ae("option "+i+" must be "+l,ae.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ae("Unknown option "+i,ae.ERR_BAD_OPTION)}}const ia={assertOptions:Sb,validators:fl},xn=ia.validators;let Br=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Kp,response:new Kp}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Yr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&ia.assertOptions(r,{silentJSONParsing:xn.transitional(xn.boolean),forcedJSONParsing:xn.transitional(xn.boolean),clarifyTimeoutError:xn.transitional(xn.boolean)},!1),o!=null&&(P.isFunction(o)?n.paramsSerializer={serialize:o}:ia.assertOptions(o,{encode:xn.function,serialize:xn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ia.assertOptions(n,{baseUrl:xn.spelling("baseURL"),withXsrfToken:xn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&P.merge(i.common,i[n.method]);i&&P.forEach(["delete","get","head","post","put","patch","common"],x=>{delete i[x]}),n.headers=Rt.concat(s,i);const a=[];let l=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(l=l&&w.synchronous,a.unshift(w.fulfilled,w.rejected))});const c=[];this.interceptors.response.forEach(function(w){c.push(w.fulfilled,w.rejected)});let d,f=0,p;if(!l){const x=[rh.bind(this),void 0];for(x.unshift(...a),x.push(...c),p=x.length,d=Promise.resolve(n);f{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(a=>{r.subscribe(a),i=a}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i,s,a){r.reason||(r.reason=new Go(i,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ty(function(o){t=o}),cancel:t}}};function Cb(e){return function(n){return e.apply(null,n)}}function bb(e){return P.isObject(e)&&e.isAxiosError===!0}const hc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(hc).forEach(([e,t])=>{hc[t]=e});function Ey(e){const t=new Br(e),n=oy(Br.prototype.request,t);return P.extend(n,Br.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Ey(Yr(e,o))},n}const ie=Ey(cs);ie.Axios=Br;ie.CanceledError=Go;ie.CancelToken=wb;ie.isCancel=vy;ie.VERSION=jy;ie.toFormData=dl;ie.AxiosError=ae;ie.Cancel=ie.CanceledError;ie.all=function(t){return Promise.all(t)};ie.spread=Cb;ie.isAxiosError=bb;ie.mergeConfig=Yr;ie.AxiosHeaders=Rt;ie.formToJSON=e=>xy(P.isHTMLForm(e)?new FormData(e):e);ie.getAdapter=ky.getAdapter;ie.HttpStatusCode=hc;ie.default=ie;const{Axios:JE,AxiosError:ZE,CanceledError:e5,isCancel:t5,CancelToken:n5,VERSION:r5,all:o5,Cancel:i5,isAxiosError:s5,spread:a5,toFormData:l5,AxiosHeaders:u5,HttpStatusCode:c5,formToJSON:d5,getAdapter:f5,mergeConfig:p5}=ie,We="https://d1mjhw1mqe0nf4.cloudfront.net",pl=async()=>(await ie.get(`${We}/posts`,{params:{_t:Date.now()}})).data,ih=async(e,t,n)=>(await ie.post(`${We}/posts/${e}/vote`,{direction:t,userId:n})).data,kb=async(e,t,n)=>(await ie.post(`${We}/posts/bulk-vote`,{postIds:e,direction:t,userId:n})).data,jb=async(e,t)=>(await ie.post(`${We}/posts`,{content:e,authorId:t})).data,Tb=async e=>(await ie.get(`${We}/api/vote-cooldown/${e}`)).data,sh=async e=>(await ie.post(`${We}/api/vote-cooldown`,{userId:e})).data,Eb=async e=>(await ie.post(`${We}/api/clear-user-votes`,{userId:e})).data,Pb=async e=>{const t={_t:Date.now()};return(await ie.get(`${We}/posts/archive`,{params:t})).data},Rb=async e=>(await ie.get(`${We}/api/donor/bulk-status`,{params:{usernames:e.join(",")}})).data,Ab=async e=>(await ie.get(`${We}/api/donor/my-status`,{params:{username:e}})).data,Nb=async(e,t)=>(await ie.post(`${We}/api/donor/link-email`,{paypalEmail:e,username:t})).data,Db=async()=>(await ie.get(`${We}/api/donor/tiers`)).data,zb=async e=>(await ie.post(`${We}/api/stripe/create-checkout-session`,{amount:e})).data,ah=async e=>{const t=e?{params:{since:e}}:{};return(await ie.get(`${We}/api/chat/messages`,t)).data},lh=async(e,t)=>(await ie.post(`${We}/api/chat/messages`,{username:e,message:t})).data,Fb=async(e,t)=>(await ie.post(`${We}/api/chat/report`,{messageId:e,reporterUsername:t})).data,Py=async e=>(await ie.get(`${We}/api/comments/${e}`)).data,uh=async(e,t,n,r)=>(await ie.post(`${We}/api/comments/${e}`,{username:t,text:n,parentId:r})).data,Mb=async(e,t,n,r)=>(await ie.post(`${We}/api/comments/${e}/${t}/vote`,{direction:n,userId:r})).data,Ib=async(e,t,n,r)=>(await ie.put(`${We}/api/comments/${e}/${t}`,{username:n,text:r})).data,Lb=async(e,t,n)=>(await ie.delete(`${We}/api/comments/${e}/${t}`,{data:{username:n}})).data;function Ob({onComplete:e}){const[t,n]=h.useState(1),[r,o]=h.useState(!1),i=h.useRef(e);i.current=e;const s=h.useMemo(()=>Array.from({length:24},(a,l)=>({id:l,emoji:l%2===0?"🙏":"🔥",left:`${5+Math.random()*90}%`,delay:`${Math.random()*2}s`,duration:`${2.5+Math.random()*2}s`,size:`${1.5+Math.random()*1.5}rem`})),[]);return h.useEffect(()=>{const a=setTimeout(()=>n(0),4e3),l=setTimeout(()=>{o(!0),i.current()},5500);return()=>{clearTimeout(a),clearTimeout(l)}},[]),r?null:u.jsxs("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100dvh",background:"radial-gradient(ellipse at center, #1a1510 0%, #0a0804 100%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:99999,overflow:"hidden",opacity:t,transition:"opacity 1.5s ease",pointerEvents:t===0?"none":"auto"},children:[s.map(a=>u.jsx("span",{className:"qr-emoji",style:{left:a.left,animationDelay:a.delay,animationDuration:a.duration,fontSize:a.size},children:a.emoji},a.id)),u.jsxs("div",{style:{textAlign:"center",zIndex:2},children:[u.jsx("div",{className:"qr-welcome-line1",children:"Welcome To The"}),u.jsx("div",{className:"qr-welcome-line2",children:"World's First"}),u.jsx("div",{className:"qr-welcome-line3",children:"Democratic Religion"})]}),u.jsx("div",{className:"qr-emoji-row",children:["🙏","🔥","🙏","🔥","🙏","🔥","🙏"].map((a,l)=>u.jsx("span",{className:"qr-emoji-bounce",style:{animationDelay:`${l*.15}s`},children:a},l))})]})}const _b=400,Zl=5e3,ch=5e3,Vb=800;function Bb({isMobile:e,onComplete:t}){const[n,r]=h.useState(null),[o,i]=h.useState(!1);if(h.useEffect(()=>{const c=_b,d=c+Zl,f=d+ch,p=f+Zl,v=p+ch,x=v+Zl,w=x+Vb,m=[setTimeout(()=>{r("commandments"),i(!0)},c),setTimeout(()=>i(!1),d),setTimeout(()=>{r("vote"),i(!0)},f),setTimeout(()=>i(!1),p),setTimeout(()=>{r("hamburger"),i(!0)},v),setTimeout(()=>i(!1),x),setTimeout(()=>{r("done"),t()},w)];return()=>m.forEach(clearTimeout)},[]),!e||n==="done"||n===null)return null;if(n==="hamburger")return u.jsx("div",{className:"qr-tutorial-overlay",children:u.jsxs("div",{className:`qr-tutorial-bubble qr-tutorial-bubble-row ${o?"qr-tutorial-visible":"qr-tutorial-hidden"}`,style:{top:"0.5rem",left:"68px",transform:"none"},children:[u.jsx("div",{className:"qr-tutorial-arrow qr-tutorial-arrow-left"}),u.jsx("span",{className:"qr-tutorial-text",children:"Learn more here"})]})});const s=n==="commandments",a=s?{top:"22%",left:"50%",transform:"translateX(-50%)"}:{top:"80%",left:"26%",transform:"translateX(-50%)",maxWidth:"44vw"},l=s?"Here are your temporary morals":"Vote for your morals here";return u.jsx("div",{className:"qr-tutorial-overlay",children:u.jsxs("div",{className:`qr-tutorial-bubble ${o?"qr-tutorial-visible":"qr-tutorial-hidden"}`,style:a,children:[u.jsx("span",{className:"qr-tutorial-text",style:s?void 0:{whiteSpace:"normal",textAlign:"center"},children:l}),u.jsx("div",{className:"qr-tutorial-arrow qr-tutorial-arrow-down"})]})})}const dh="0x3c0BC1BF347b63d893900F60e30df5cB446Dc",Ub="https://www.paypal.com/donate/?business=E9ZG5U75GEYBQ&no_recurring=0&item_name=Thank+you+for+keeping+the+vision+alive%21¤cy_code=USD",$b=[{label:"$3",cents:300},{label:"$5",cents:500},{label:"$25",cents:2500},{label:"$100",cents:1e4}];function Ry({isOpen:e,onClose:t}){const[n,r]=h.useState(!1),[o,i]=h.useState(!1),[s,a]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState(""),[p,v]=h.useState(!1),[x,w]=h.useState(""),m=Wn("(max-width: 768px)");if(!e)return null;const g=async()=>{try{await navigator.clipboard.writeText(dh),a(!0),setTimeout(()=>a(!1),2e3)}catch(V){console.error("Failed to copy:",V)}},y=()=>{window.open(Ub,"_blank","noopener,noreferrer")},S=()=>{r(!1),i(!1),c(null),f(""),w("")},k=()=>{r(!1),i(!1),a(!1),c(null),f(""),w(""),v(!1),t()},j=V=>{c(V),f(""),w("")},E=V=>{const oe=V.replace(/[^0-9.]/g,""),le=oe.split("."),he=le.length>2?le[0]+"."+le.slice(1).join(""):oe;f(he),c(null),w("")},N=()=>{if(l)return l;if(d){const V=parseFloat(d);if(!isNaN(V)&&V>=1)return Math.round(V*100)}return 0},b=async()=>{var oe,le;const V=N();if(V<100){w("Minimum donation is $1.00");return}v(!0),w("");try{const{url:he}=await zb(V);he?window.location.href=he:(w("Failed to create checkout session"),v(!1))}catch(he){w(((le=(oe=he.response)==null?void 0:oe.data)==null?void 0:le.error)||"Something went wrong"),v(!1)}},B=u.jsxs("div",{style:{display:"flex",gap:"10px"},children:[u.jsx("button",{onClick:S,style:{flex:1,padding:m?"10px 14px":"10px 16px",borderRadius:"6px",border:"2px solid #555",backgroundColor:"transparent",color:"#aaa",fontSize:m?"0.9rem":"1rem",cursor:"pointer"},children:"← Back"}),u.jsx("button",{onClick:k,className:"popup-close",style:{flex:1},children:"Close"})]}),I=()=>{if(o){const V=N();return u.jsxs(u.Fragment,{children:[u.jsx("h2",{style:{color:"#635bff",marginBottom:m?"0.4rem":"0.5rem",fontSize:m?"1.3rem":"1.8rem",fontFamily:"'Cinzel', serif"},children:"Credit Card Donation"}),u.jsx("p",{style:{color:"#ccc",marginBottom:m?"0.6rem":"1rem",fontSize:m?"0.85rem":"0.95rem"},children:"Choose an amount"}),u.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:m?"8px":"10px",marginBottom:m?"0.6rem":"1rem"},children:$b.map(({label:oe,cents:le})=>u.jsx("button",{onClick:()=>j(le),style:{padding:m?"12px":"16px",borderRadius:m?"6px":"8px",border:l===le?"2px solid #635bff":"2px solid #444",backgroundColor:l===le?"rgba(99, 91, 255, 0.15)":"#2a2a2a",color:l===le?"#635bff":"#ccc",fontSize:m?"1.1rem":"1.3rem",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},children:oe},le))}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:m?"0.6rem":"1rem"},children:[u.jsx("span",{style:{color:"#ccc",fontSize:m?"1.1rem":"1.3rem",fontWeight:700},children:"$"}),u.jsx("input",{type:"text",inputMode:"decimal",placeholder:"Custom amount",value:d,onChange:oe=>E(oe.target.value),style:{flex:1,padding:m?"10px 12px":"12px 14px",borderRadius:"6px",border:d?"2px solid #635bff":"2px solid #444",backgroundColor:"#2a2a2a",color:"#fdf8e6",fontSize:m?"1rem":"1.1rem",outline:"none",boxSizing:"border-box"}})]}),x&&u.jsx("p",{style:{color:"#f44336",fontSize:"0.85rem",marginBottom:"0.5rem"},children:x}),u.jsx("button",{onClick:b,disabled:V<100||p,style:{width:"100%",padding:m?"12px":"16px",borderRadius:m?"6px":"8px",border:"none",backgroundColor:V>=100&&!p?"#635bff":"#444",color:V>=100&&!p?"#fff":"#888",fontSize:m?"1rem":"1.15rem",fontWeight:700,cursor:V>=100&&!p?"pointer":"not-allowed",transition:"all 0.2s ease",marginBottom:m?"0.6rem":"1rem"},children:p?"Redirecting...":V>=100?`Proceed to Checkout — $${(V/100).toFixed(2)}`:"Select an amount"}),u.jsx("p",{style:{color:"#999",fontSize:m?"0.7rem":"0.78rem",marginBottom:m?"0.6rem":"1rem",textAlign:"center"},children:"You'll be securely redirected to Stripe to complete your payment"}),B]})}return n?u.jsxs(u.Fragment,{children:[u.jsx("h2",{style:{color:"#d4af37",marginBottom:m?"0.4rem":"0.5rem",fontSize:m?"1.4rem":"1.8rem"},children:"Crypto Donation"}),u.jsx("p",{style:{color:"#aaa",marginBottom:m?"0.6rem":"1rem",fontSize:m?"0.9rem":"1rem"},children:"Send ETH to the address below"}),u.jsxs("div",{style:{backgroundColor:"#2a2a2a",border:"2px solid #627eea",borderRadius:m?"8px":"10px",padding:m?"12px":"16px",marginBottom:m?"0.6rem":"1rem"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[u.jsx("span",{style:{fontSize:m?"1.1rem":"1.2rem"},children:"⟠"}),u.jsx("span",{style:{color:"#627eea",fontWeight:600,fontSize:m?"0.9rem":void 0},children:"Ethereum (ETH)"})]}),u.jsx("div",{style:{backgroundColor:"#1a1a1a",borderRadius:"6px",padding:m?"10px":"12px",fontFamily:"monospace",fontSize:m?"0.75rem":"0.85rem",color:"#fdf8e6",wordBreak:"break-all",marginBottom:"10px"},children:dh}),u.jsx("button",{onClick:g,style:{width:"100%",padding:"10px",borderRadius:"6px",border:"none",backgroundColor:s?"#4caf50":"#627eea",color:"white",fontSize:m?"0.9rem":"1rem",fontWeight:600,cursor:"pointer",transition:"all 0.2s ease-in-out"},children:s?"✓ Copied!":"Copy Address"})]}),u.jsx("p",{style:{color:"#888",fontSize:m?"0.8rem":"0.85rem",marginBottom:m?"0.6rem":"1rem"},children:"After donating, visit your Donor Profile to link your wallet and receive your flair!"}),B]}):u.jsxs(u.Fragment,{children:[u.jsx("h2",{style:{color:"#d4af37",marginBottom:m?"0.3rem":"0.5rem",fontSize:m?"1.3rem":"1.8rem",fontFamily:"'Cinzel', serif"},children:"Make an Offering"}),u.jsxs("div",{style:{backgroundColor:"rgba(212, 175, 55, 0.06)",border:"1px solid rgba(212, 175, 55, 0.2)",borderRadius:m?"6px":"10px",padding:m?"6px 10px":"14px 16px",marginBottom:m?"0.4rem":"1rem"},children:[u.jsxs("p",{style:{color:"#e0d8c8",fontSize:m?"0.78rem":"0.9rem",lineHeight:m?1.4:1.6,margin:m?"0 0 3px 0":"0 0 8px 0"},children:["Our goal is ",u.jsx("span",{style:{color:"#d4af37",fontWeight:600},children:"not to make a profit"}),". Every cent goes directly toward promoting this movement across the world — server costs, outreach, and spreading the word. Nothing else."]}),u.jsx("p",{style:{color:"#c0b89a",fontSize:m?"0.72rem":"0.8rem",margin:0,fontStyle:"italic"},children:"Your offering fuels a global movement. Thank you for believing."})]}),u.jsxs("div",{style:{marginBottom:m?"0.4rem":"1.2rem",padding:m?"5px 10px":"12px 16px",backgroundColor:"rgba(0,0,0,0.3)",borderRadius:m?"6px":"10px",border:"1px solid #333"},children:[u.jsx("p",{style:{color:"#ccc",fontSize:m?"0.68rem":"0.8rem",marginBottom:m?"4px":"10px",textTransform:"uppercase",letterSpacing:"0.1em",fontWeight:600},children:"Donor Flair Tiers"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:m?"2px":"8px"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:m?"6px":"10px"},children:[u.jsx("span",{style:{fontSize:m?"0.95rem":"1.3rem",textShadow:"0 0 6px rgba(205, 127, 50, 0.6)"},children:"⭐"}),u.jsx("span",{style:{color:"#cd7f32",fontWeight:600,fontSize:m?"0.8rem":"0.95rem"},children:"Supporter"}),u.jsx("span",{style:{color:"#b0a880",fontSize:m?"0.7rem":"0.8rem",marginLeft:"auto"},children:"$1+"})]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:m?"6px":"10px"},children:[u.jsx("span",{style:{fontSize:m?"0.95rem":"1.3rem",textShadow:"0 0 6px rgba(192, 192, 192, 0.6)"},children:"🙏"}),u.jsx("span",{style:{color:"#c0c0c0",fontWeight:600,fontSize:m?"0.8rem":"0.95rem"},children:"Patron"}),u.jsx("span",{style:{color:"#b0a880",fontSize:m?"0.7rem":"0.8rem",marginLeft:"auto"},children:"$25+"})]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:m?"6px":"10px"},children:[u.jsx("span",{style:{fontSize:m?"0.95rem":"1.3rem",textShadow:"0 0 6px rgba(212, 175, 55, 0.8)"},children:"👑"}),u.jsx("span",{style:{color:"#d4af37",fontWeight:600,fontSize:m?"0.8rem":"0.95rem"},children:"Benefactor"}),u.jsx("span",{style:{color:"#b0a880",fontSize:m?"0.7rem":"0.8rem",marginLeft:"auto"},children:"$100+"})]})]}),u.jsx("p",{style:{color:"#999",fontSize:m?"0.65rem":"0.75rem",margin:m?"3px 0 0 0":"10px 0 0 0",fontStyle:"italic"},children:"Your flair appears next to your name across the site"})]}),u.jsx("p",{style:{color:"#ccc",marginBottom:m?"0.3rem":"0.75rem",fontSize:m?"0.82rem":"0.95rem"},children:"Choose your preferred method"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:m?"7px":"12px"},children:[u.jsxs("button",{onClick:()=>i(!0),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:m?"8px":"12px",padding:m?"10px 14px":"16px 24px",borderRadius:m?"6px":"10px",border:"2px solid #635bff",backgroundColor:"rgba(99, 91, 255, 0.1)",color:"#635bff",fontSize:m?"0.95rem":"1.2rem",cursor:"pointer",transition:"all 0.2s ease-in-out"},onMouseOver:V=>{V.currentTarget.style.backgroundColor="rgba(99, 91, 255, 0.2)",V.currentTarget.style.transform="scale(1.02)"},onMouseOut:V=>{V.currentTarget.style.backgroundColor="rgba(99, 91, 255, 0.1)",V.currentTarget.style.transform="scale(1)"},children:[u.jsx("span",{style:{fontSize:m?"1.1rem":"1.5rem"},children:"💳"}),u.jsx("span",{children:"Credit Card"})]}),u.jsxs("button",{onClick:()=>r(!0),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:m?"8px":"12px",padding:m?"10px 14px":"16px 24px",borderRadius:m?"6px":"10px",border:"2px solid #d4af37",backgroundColor:"rgba(212, 175, 55, 0.1)",color:"#d4af37",fontSize:m?"0.95rem":"1.2rem",cursor:"pointer",transition:"all 0.2s ease-in-out"},onMouseOver:V=>{V.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.2)",V.currentTarget.style.transform="scale(1.02)"},onMouseOut:V=>{V.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.1)",V.currentTarget.style.transform="scale(1)"},children:[u.jsx("span",{style:{fontSize:m?"1.1rem":"1.5rem"},children:"🪙"}),u.jsx("span",{children:"Crypto (ETH)"})]}),u.jsxs("button",{onClick:y,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:m?"8px":"12px",padding:m?"10px 14px":"16px 24px",borderRadius:m?"6px":"10px",border:"2px solid #0070ba",backgroundColor:"rgba(0, 112, 186, 0.1)",color:"#0070ba",fontSize:m?"0.95rem":"1.2rem",cursor:"pointer",transition:"all 0.2s ease-in-out"},onMouseOver:V=>{V.currentTarget.style.backgroundColor="rgba(0, 112, 186, 0.2)",V.currentTarget.style.transform="scale(1.02)"},onMouseOut:V=>{V.currentTarget.style.backgroundColor="rgba(0, 112, 186, 0.1)",V.currentTarget.style.transform="scale(1)"},children:[u.jsx("span",{style:{fontSize:m?"1.1rem":"1.5rem"},children:"🅿️"}),u.jsx("span",{children:"PayPal"})]})]}),u.jsx("button",{onClick:k,className:"popup-close",style:{marginTop:m?"0.6rem":"1.5rem"},children:"Close"})]})};return u.jsx("div",{className:"popup-overlay",onClick:k,children:u.jsx("div",{className:"popup-box",onClick:V=>V.stopPropagation(),style:{maxWidth:"520px",padding:m?"0.8rem 1rem 0.7rem":"2rem",backgroundColor:"#1a1a1a",border:"2px solid #d4af37",maxHeight:m?"none":"90vh",overflowY:m?"visible":"auto"},children:I()})})}const Wb=[{file:"Microwave_Fish_In_Office.mp4",title:"Fish For Lunch"},{file:"plane_clapping.mp4",title:"Landing Etiquette"},{file:"door_holding.mp4",title:"Door Holding"},{file:"Ticket_Agent.mp4",title:"Ticket Agent"},{file:"phone_conversation.mp4",title:"Phone Conversation"}];function Ay({isOpen:e,onClose:t}){const n=Wn("(max-width: 768px)");return e?u.jsx("div",{className:"popup-overlay",onClick:t,children:u.jsxs("div",{className:"popup-box",onClick:r=>r.stopPropagation(),style:{maxWidth:"640px",width:"92%",padding:n?"1rem":"2rem",backgroundColor:"#1a1a1a",border:"2px solid #d4af37",maxHeight:"90vh",overflowY:"auto"},children:[u.jsx("button",{onClick:t,style:{position:"sticky",top:0,float:"right",background:"none",border:"none",color:"#d4af37",fontSize:"1.5rem",cursor:"pointer",fontFamily:"'Cinzel', serif",fontWeight:700,lineHeight:1,padding:"4px 8px",zIndex:10},"aria-label":"Close",children:"✕"}),u.jsx("h2",{style:{color:"#d4af37",marginBottom:n?"0.5rem":"1rem",fontSize:n?"1.2rem":"1.5rem",fontFamily:"'Cinzel', serif",textAlign:"center"},children:"Videos"}),Wb.map(({file:r,title:o})=>u.jsxs("div",{style:{marginBottom:n?"1rem":"1.5rem"},children:[u.jsx("h3",{style:{color:"#c8b070",fontSize:n?"0.9rem":"1rem",fontFamily:"'Cinzel', serif",marginBottom:"0.4rem"},children:o}),u.jsx("video",{controls:!0,playsInline:!0,preload:"metadata",style:{width:"100%",borderRadius:"8px",border:"1px solid rgba(212, 175, 55, 0.3)"},children:u.jsx("source",{src:`/videos/${r}#t=0.001`,type:"video/mp4"})})]},r)),u.jsx("button",{onClick:t,className:"popup-close",style:{marginTop:n?"0.5rem":"1rem",display:"block",margin:"0 auto"},children:"Close"})]})}):null}const Ia={supporter:{icon:"⭐",color:"#cd7f32",label:"Supporter",glow:"rgba(205, 127, 50, 0.6)"},patron:{icon:"🙏",color:"#c0c0c0",label:"Patron",glow:"rgba(192, 192, 192, 0.6)"},benefactor:{icon:"👑",color:"#d4af37",label:"Benefactor",glow:"rgba(212, 175, 55, 0.8)"}},Hb={small:{fontSize:"0.9rem",padding:"0 2px"},medium:{fontSize:"1.2rem",padding:"0 4px"},large:{fontSize:"1.6rem",padding:"0 6px"}};function Xt({tier:e,size:t="small",showLabel:n=!1}){if(!e||!Ia[e])return null;const r=Ia[e],o=Hb[t];return u.jsxs("span",{className:`donor-badge donor-badge-${t} donor-tier-${e}`,title:r.label,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",marginLeft:"4px",fontWeight:"bold",color:r.color,textShadow:`0 0 6px ${r.glow}`,fontSize:o.fontSize,padding:o.padding,animation:"badgeGlow 2s ease-in-out infinite"},children:[r.icon,n&&u.jsx("span",{style:{marginLeft:"4px",fontSize:"0.75em",fontWeight:600},children:r.label})]})}const ds="https://d1mjhw1mqe0nf4.cloudfront.net",Cn={ACCESS_TOKEN:"fm_accessToken",REFRESH_TOKEN:"fm_refreshToken",ID_TOKEN:"fm_idToken",USERNAME:"fm_username",AUTH_PROVIDER:"fm_authProvider"};async function Kb(e,t,n){return(await ie.post(`${ds}/auth/signup`,{username:e,password:t,email:n})).data}async function Gb(e,t){return(await ie.post(`${ds}/auth/confirm`,{username:e,code:t})).data}async function Yb(e){return(await ie.post(`${ds}/auth/resend-code`,{username:e})).data}async function qb(e,t){const r=(await ie.post(`${ds}/auth/login`,{username:e,password:t})).data;return localStorage.setItem(Cn.ACCESS_TOKEN,r.accessToken),localStorage.setItem(Cn.USERNAME,r.username),localStorage.setItem(Cn.AUTH_PROVIDER,r.authProvider),r.refreshToken&&localStorage.setItem(Cn.REFRESH_TOKEN,r.refreshToken),r.idToken&&localStorage.setItem(Cn.ID_TOKEN,r.idToken),r}async function Xb(){const e=localStorage.getItem(Cn.ACCESS_TOKEN),t=localStorage.getItem(Cn.REFRESH_TOKEN);try{await ie.post(`${ds}/auth/logout`,{token:t,accessToken:e})}catch{}Zb()}function Qb(){return localStorage.getItem(Cn.USERNAME)}function Jb(){return localStorage.getItem(Cn.AUTH_PROVIDER)}function Zb(){Object.values(Cn).forEach(e=>localStorage.removeItem(e))}function e2({onClose:e}){const{login:t}=Cr(),[n,r]=h.useState("login"),[o,i]=h.useState(""),[s,a]=h.useState(""),[l,c]=h.useState(""),[d,f]=h.useState(""),[p,v]=h.useState(""),[x,w]=h.useState(""),[m,g]=h.useState(!1),y=async()=>{var E,N,b,B;if(!o.trim())return v("Username required");if(!s)return v("Password required");v(""),g(!0);try{await t(o.trim(),s),e()}catch(I){const V=((N=(E=I==null?void 0:I.response)==null?void 0:E.data)==null?void 0:N.error)||(I==null?void 0:I.message)||"Login failed";((B=(b=I==null?void 0:I.response)==null?void 0:b.data)==null?void 0:B.code)==="UserNotConfirmedException"?(r("confirm"),v(""),w("Account not confirmed. Enter the code from your email.")):v(V)}finally{g(!1)}},S=async()=>{var E,N;if(!o.trim()||!s||!l.trim())return v("All fields are required");if(s.length<8)return v("Password must be at least 8 characters");v(""),g(!0);try{const b=await Kb(o.trim(),s,l.trim());w(b.message),b.confirmed?(r("login"),w("Account created! You can now log in.")):r("confirm")}catch(b){v(((N=(E=b==null?void 0:b.response)==null?void 0:E.data)==null?void 0:N.error)||(b==null?void 0:b.message)||"Sign-up failed")}finally{g(!1)}},k=async()=>{var E,N;if(!d.trim())return v("Confirmation code required");v(""),g(!0);try{await Gb(o.trim(),d.trim()),w("Confirmed! Logging you in..."),s?(await t(o.trim(),s),e()):(r("login"),w("Account confirmed! Enter your password to log in."))}catch(b){v(((N=(E=b==null?void 0:b.response)==null?void 0:E.data)==null?void 0:N.error)||(b==null?void 0:b.message)||"Confirmation failed")}finally{g(!1)}},j=async()=>{var E,N;v(""),g(!0);try{const b=await Yb(o.trim());w(b.message)}catch(b){v(((N=(E=b==null?void 0:b.response)==null?void 0:E.data)==null?void 0:N.error)||"Failed to resend code")}finally{g(!1)}};return u.jsx("div",{className:"login-modal-overlay",onClick:e,children:u.jsxs("div",{className:"login-modal",onClick:E=>E.stopPropagation(),children:[u.jsx("button",{className:"login-modal-close",onClick:e,children:"×"}),n==="login"&&u.jsxs(u.Fragment,{children:[u.jsx("h2",{className:"login-modal-title",children:"Enter the Temple"}),u.jsx("p",{className:"login-modal-subtitle",children:"Sign in to decree your morals"}),u.jsx("input",{type:"text",placeholder:"Username",className:"login-modal-input",value:o,onChange:E=>i(E.target.value),onKeyDown:E=>E.key==="Enter"&&y(),autoFocus:!0}),u.jsx("input",{type:"password",placeholder:"Password",className:"login-modal-input",value:s,onChange:E=>a(E.target.value),onKeyDown:E=>E.key==="Enter"&&y()}),p&&u.jsx("p",{className:"login-modal-error",children:p}),x&&u.jsx("p",{className:"login-modal-message",children:x}),u.jsx("button",{className:"login-modal-btn primary",onClick:y,disabled:m,children:m?"...":"Sign In"}),u.jsxs("p",{className:"login-modal-switch",children:["New disciple?"," ",u.jsx("span",{onClick:()=>{r("signup"),v(""),w("")},children:"Create Account"})]})]}),n==="signup"&&u.jsxs(u.Fragment,{children:[u.jsx("h2",{className:"login-modal-title",children:"Join the Order"}),u.jsx("p",{className:"login-modal-subtitle",children:"Create your sacred account"}),u.jsx("input",{type:"text",placeholder:"Username",className:"login-modal-input",value:o,onChange:E=>i(E.target.value),autoFocus:!0}),u.jsx("input",{type:"email",placeholder:"Email",className:"login-modal-input",value:l,onChange:E=>c(E.target.value)}),u.jsx("input",{type:"password",placeholder:"Password (min 8 characters)",className:"login-modal-input",value:s,onChange:E=>a(E.target.value),onKeyDown:E=>E.key==="Enter"&&S()}),p&&u.jsx("p",{className:"login-modal-error",children:p}),x&&u.jsx("p",{className:"login-modal-message",children:x}),u.jsx("button",{className:"login-modal-btn primary",onClick:S,disabled:m,children:m?"...":"Create Account"}),u.jsxs("p",{className:"login-modal-switch",children:["Already a disciple?"," ",u.jsx("span",{onClick:()=>{r("login"),v(""),w("")},children:"Sign In"})]})]}),n==="confirm"&&u.jsxs(u.Fragment,{children:[u.jsx("h2",{className:"login-modal-title",children:"Verify Thy Identity"}),u.jsx("p",{className:"login-modal-subtitle",children:"Enter the sacred code sent to your email"}),u.jsx("input",{type:"text",placeholder:"Confirmation Code",className:"login-modal-input",value:d,onChange:E=>f(E.target.value),onKeyDown:E=>E.key==="Enter"&&k(),autoFocus:!0}),p&&u.jsx("p",{className:"login-modal-error",children:p}),x&&u.jsx("p",{className:"login-modal-message",children:x}),u.jsx("button",{className:"login-modal-btn primary",onClick:k,disabled:m,children:m?"...":"Confirm"}),u.jsxs("p",{className:"login-modal-switch",children:[u.jsx("span",{onClick:j,children:"Resend Code"})," | ",u.jsx("span",{onClick:()=>{r("login"),v(""),w("")},children:"Back to Login"})]})]})]})})}const Ny=h.createContext(void 0);function t2({children:e}){const[t,n]=h.useState(()=>Qb()),[r,o]=h.useState(()=>Jb()),[i,s]=h.useState(!1),a=h.useCallback(()=>s(!0),[]),l=h.useCallback(()=>s(!1),[]),c=h.useCallback(async(f,p)=>{const v=await qb(f,p);n(v.username),o(v.authProvider)},[]),d=h.useCallback(()=>{localStorage.removeItem("fm_username"),Xb(),n(null),o(null)},[]);return u.jsxs(Ny.Provider,{value:{user:t,authProvider:r,login:c,logout:d,showLoginModal:i,openLoginModal:a,closeLoginModal:l},children:[e,i&&u.jsx(e2,{onClose:l})]})}function Cr(){const e=h.useContext(Ny);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const Dy=h.createContext(void 0);function n2({children:e}){const[t,n]=h.useState({}),[r,o]=h.useState(null),[i,s]=h.useState(new Set),a=h.useCallback(async f=>{const p=f.filter(v=>!i.has(v));if(p.length!==0)try{const x=(await Rb(p)).donors||{};n(w=>({...w,...x})),s(w=>{const m=new Set(w);return p.forEach(g=>m.add(g)),m})}catch(v){console.error("Failed to load donor statuses:",v)}},[i]),l=h.useCallback(async f=>{try{const p=await Ab(f);o(p)}catch(p){console.error("Failed to load my donor status:",p)}},[]),c=h.useCallback(f=>t[f]||null,[t]),d=h.useCallback(()=>{n({}),o(null),s(new Set)},[]);return u.jsx(Dy.Provider,{value:{donorStatuses:t,myDonorStatus:r,loadDonorStatuses:a,loadMyDonorStatus:l,getDonorStatus:c,clearCache:d},children:e})}function Jr(){const e=h.useContext(Dy);if(!e)throw new Error("useDonor must be used within DonorProvider");return e}function La(){const{user:e,logout:t,openLoginModal:n}=Cr(),{getDonorStatus:r,loadDonorStatuses:o}=Jr();h.useEffect(()=>{e&&o([e])},[e,o]);const i=e?r(e):null;return u.jsx("div",{className:`login-button-container${e?" logged-in":""}`,children:e?u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"login-welcome",children:["Welcome disciple"," ",u.jsx("span",{className:"login-username",children:e}),(i==null?void 0:i.tier)&&u.jsx(Xt,{tier:i.tier,size:"small"})]}),u.jsx("button",{onClick:t,className:"logout-btn",children:"Logout"})]}):u.jsx("button",{onClick:n,className:"login-btn",children:"Login"})})}const r2={":)":"😊",":D":"😃",":d":"😃",":(":"😞",":P":"😛",":p":"😛",";)":"😉",":O":"😮",":o":"😮",XD:"😆",xD:"😆",xd:"😆","<3":"❤️",":*":"😘","B)":"😎",":/":"😕",":|":"😐",">:(":"😡",":'(":"😢",":')":"🥲","O:)":"😇","o:)":"😇",">:)":"😈",":fire:":"🔥",":skull:":"💀",":100:":"💯",":pray:":"🙏",":clap:":"👏",":thumbsup:":"👍",":thumbsdown:":"👎",":heart:":"❤️",":star:":"⭐",":crown:":"👑",":trophy:":"🏆",":eyes:":"👀",":muscle:":"💪",":party:":"🎉",":poop:":"💩",":brain:":"🧠",":diamond:":"💎",":offer:":"🙏",":tablet:":"🪨",":amend:":"🔄",":witness:":"👁️",":heresy:":"🔥",":vote:":"🗳️",":moralgray:":"🧠",":repent:":"🧎",":canon:":"✨",":goodword:":"🕊️"};function sa(e){let t=e;for(const[n,r]of Object.entries(r2)){const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp(o+"(?=\\s|$)","g"),r)}return t}const mc=[{emoji:"🙏",label:":offer:"},{emoji:"🪨",label:":tablet:"},{emoji:"🔄",label:":amend:"},{emoji:"👁️",label:":witness:"},{emoji:"🔥",label:":heresy:"},{emoji:"🗳️",label:":vote:"},{emoji:"🧠",label:":moralgray:"},{emoji:"🧎",label:":repent:"},{emoji:"✨",label:":canon:"},{emoji:"🕊️",label:":goodword:"}],gc=["😀","😂","🤣","😍","🥰","😎","🤔","😱","😡","🥺","👍","👎","👏","🙏","🔥","❤️","💀","💯","✨","⭐","🎉","🎊","😈","👀","🤡","💪","🫡","😤","🥳","😇","⚡","🌟","💎","🏆","👑","🗡️","⚖️","📜","🛡️","✝️"],fh=["A faithful disciple of the moral code.","Sworn to uphold the flexible commandments.","Wandering the path of righteous voting.","Blessed by the algorithm of morality.","A humble servant of the collective conscience.","Destined to judge all commandments, great and small.","Touched grass exactly once. It was enough.","Their moral compass spins... flexibly."];function o2(e){let t=0;for(let n=0;n{const v=w=>{s.current&&!s.current.contains(w.target)&&i()},x=setTimeout(()=>{document.addEventListener("mousedown",v)},10);return()=>{clearTimeout(x),document.removeEventListener("mousedown",v)}},[i]),h.useEffect(()=>{const v=x=>{x.key==="Escape"&&i()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]);const l=n&&Ia[n]?Ia[n]:null,c=o2(e),d=a?{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e4,backgroundColor:"rgba(15, 12, 5, 0.97)",border:"2px solid #d4af37",borderRadius:"14px",padding:"24px 20px",width:"calc(100vw - 48px)",maxWidth:"340px",boxShadow:"0 8px 40px rgba(0,0,0,0.7), 0 0 20px rgba(212, 175, 55, 0.25)",fontFamily:"'Cinzel', serif",color:"#fdf8e6"}:{position:"fixed",left:Math.min(o.x,window.innerWidth-160),top:Math.min(o.y+8,window.innerHeight-200),zIndex:9999,backgroundColor:"rgba(15, 12, 5, 0.97)",border:"2px solid #d4af37",borderRadius:"14px",padding:"20px 22px",minWidth:"240px",maxWidth:"320px",boxShadow:"0 8px 40px rgba(0,0,0,0.7), 0 0 20px rgba(212, 175, 55, 0.25)",fontFamily:"'Cinzel', serif",color:"#fdf8e6",transform:"translateX(-50%)"},f=a?{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",zIndex:9999}:{},p=u.jsxs(u.Fragment,{children:[a&&u.jsx("div",{style:f,onClick:i}),u.jsxs("div",{ref:s,style:d,children:[u.jsx("button",{onClick:i,style:{position:"absolute",top:"8px",right:"10px",background:"none",border:"none",color:"#d4af37",fontSize:"1.2rem",cursor:"pointer",fontFamily:"'Cinzel', serif",fontWeight:700,lineHeight:1,padding:"2px 6px",opacity:.8},"aria-label":"Close",children:"✕"}),u.jsxs("div",{style:{fontSize:a?"1.3rem":"1.1rem",fontWeight:700,color:"#d4af37",marginBottom:"4px",textAlign:"center",letterSpacing:"0.06em",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"},children:[e,n&&u.jsx(Xt,{tier:n,size:"medium"})]}),u.jsxs("p",{style:{textAlign:"center",fontSize:a?"0.8rem":"0.75rem",color:"#999",fontStyle:"italic",margin:"4px 0 14px 0",lineHeight:1.4},children:['"',c,'"']}),u.jsx("div",{style:{borderTop:"1px solid rgba(212, 175, 55, 0.3)",margin:"0 0 12px 0"}}),u.jsxs("div",{style:{textAlign:"center",fontSize:a?"0.95rem":"0.85rem",color:"#c8b070",marginBottom:"10px"},children:[u.jsx("span",{style:{fontSize:a?"1.6rem":"1.3rem",fontWeight:700,color:"#d4af37"},children:t})," ","blessing",t!==1?"s":""," received"]}),l?u.jsxs("div",{style:{textAlign:"center",fontSize:a?"1rem":"0.85rem",color:l.color,fontWeight:700,textShadow:`0 0 10px ${l.glow}`,marginBottom:"10px",padding:"6px 0",borderRadius:"6px",backgroundColor:"rgba(212, 175, 55, 0.08)"},children:[l.icon," ",l.label," ",l.icon]}):u.jsx("div",{style:{textAlign:"center",fontSize:a?"0.8rem":"0.75rem",color:"#666",marginBottom:"10px"},children:"Not yet a supporter"}),r&&u.jsxs(u.Fragment,{children:[u.jsx("div",{style:{borderTop:"1px solid rgba(212, 175, 55, 0.2)",margin:"0 0 10px 0"}}),u.jsxs("div",{style:{textAlign:"center",fontSize:a?"0.8rem":"0.75rem",color:"#888"},children:["Disciple since ",i2(r)]})]})]})]});return H0.createPortal(p,document.body)}const Vs="",ph=["#FF0000","#0000FF","#00FF00","#B22222","#FF7F50","#9ACD32","#FF4500","#2E8B57","#DAA520","#D2691E","#5F9EA0","#1E90FF","#FF69B4","#8A2BE2","#00FF7F"];function eu(e){let t=0;for(let n=0;n({expand:()=>{c(!0),requestAnimationFrame(()=>ue(!1)),setTimeout(()=>ue(!1),100),setTimeout(()=>ue(!1),300)}}));const[d,f]=h.useState([]),[p,v]=h.useState(""),[x,w]=h.useState(!1),[m,g]=h.useState(0),[y,S]=h.useState(!1),[k,j]=h.useState(0),[E,N]=h.useState([]),[b,B]=h.useState(!1),I=h.useRef(null),V=h.useRef(null),[oe,le]=h.useState(null),[he,Ce]=h.useState(null),[je,D]=h.useState(null),[F,W]=h.useState(()=>{try{const T=localStorage.getItem("fm_reported_messages");return T?new Set(JSON.parse(T)):new Set}catch{return new Set}}),G=h.useRef(F);G.current=F;const[q,de]=h.useState(!1),[Be,Ne]=h.useState(""),[Re,X]=h.useState([]),[Ze,ye]=h.useState(!1),fn=h.useRef(null),en=h.useRef(null),En=h.useRef(null),Se=h.useRef(null),mt=h.useRef(null),L=h.useRef(new Set),te=h.useCallback(()=>{const T=Se.current;return T?T.scrollHeight-T.scrollTop-T.clientHeight<80:!0},[]),ue=h.useCallback((T=!0)=>{const _=Se.current;if(!_)return;const H=()=>{_.scrollTop=_.scrollHeight};if(!T){H(),requestAnimationFrame(H);return}_.scrollTo({top:_.scrollHeight,behavior:"smooth"}),setTimeout(()=>{_&&(_.scrollTop=_.scrollHeight)},350)},[]),we=h.useCallback(()=>{const T=te();S(!T),T&&j(0)},[te]),et=h.useCallback(()=>{ue(),S(!1),j(0)},[ue]);h.useEffect(()=>{const T=Se.current;if(!T)return;const _=new MutationObserver(()=>{te()&&requestAnimationFrame(()=>{T&&(T.scrollTop=T.scrollHeight)})});return _.observe(T,{childList:!0,subtree:!0,attributes:!0}),()=>_.disconnect()},[te]);const tt=h.useCallback(async T=>{},[]);h.useEffect(()=>{q&&Re.length},[q,Re.length,tt]),h.useEffect(()=>{if(!q)return;const T=_=>{fn.current&&!fn.current.contains(_.target)&&de(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[q]);const pn=T=>{Ne(T),en.current&&clearTimeout(en.current),en.current=setTimeout(()=>{tt(T)},400)},Ut=async T=>{var H;if(!r){o();return}if(m>0)return;const _=T.images.original.url;de(!1),Ne(""),w(!0);try{const ee=await lh(r,_);f(se=>{const at=[...se,ee];return at.length>200?at.slice(-200):at}),mt.current=ee.createdAt,Ce(null),g(15),requestAnimationFrame(()=>ue())}catch(ee){const se=(H=ee==null?void 0:ee.response)==null?void 0:H.data,at=(se==null?void 0:se.error)||"Failed to send GIF";if(se!=null&&se.cooldown&&g(se.cooldown),se!=null&&se.muted){const $t={id:`mute-${Date.now()}`,username:"⚠️ System",message:at,createdAt:new Date().toISOString()};f(eo=>[...eo,$t]),requestAnimationFrame(()=>ue())}console.error("GIF send error:",at)}finally{w(!1)}},At=h.useCallback(T=>{const _=T.map(H=>H.username).filter(H=>!L.current.has(H));_.length>0&&(_.forEach(H=>L.current.add(H)),s(_))},[s]);h.useEffect(()=>{pl().then(T=>N(T)).catch(()=>{})},[]);const Nt=h.useCallback(T=>E.filter(_=>_.username===T).reduce((_,H)=>_+(H.votes??0),0),[E]);h.useEffect(()=>{(async()=>{try{const H=((await ah()).messages||[]).filter(se=>!G.current.has(se.id));f(H);const ee=H;ee.length>0&&(mt.current=ee[ee.length-1].createdAt),At(ee),requestAnimationFrame(()=>ue(!1))}catch(_){console.error("Failed to load chat:",_)}})()},[At,ue]),h.useEffect(()=>{const T=setInterval(async()=>{try{const _=mt.current,ee=(await ah(_||void 0)).messages||[];if(ee.length>0){const se=te();let at=0;f($t=>{const eo=new Set($t.map(hn=>hn.id)),kr=ee.filter(hn=>!eo.has(hn.id)&&!G.current.has(hn.id));if(kr.length===0)return $t;at=kr.length;const wt=[...$t,...kr];return wt.length>200?wt.slice(-200):wt}),mt.current=ee[ee.length-1].createdAt,At(ee),se?requestAnimationFrame(()=>ue()):at>0&&j($t=>$t+at)}}catch{}},3e3);return()=>clearInterval(T)},[te,ue,At]),h.useEffect(()=>{if(m<=0)return;const T=setInterval(()=>{g(_=>_-1)},1e3);return()=>clearInterval(T)},[m]),h.useEffect(()=>{l&&(requestAnimationFrame(()=>ue(!1)),setTimeout(()=>ue(!1),150),setTimeout(()=>ue(!1),400))},[l,ue]),h.useEffect(()=>{if(!b)return;const T=_=>{I.current&&!I.current.contains(_.target)&&B(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[b]);const tn=T=>{var _;v(H=>H+T),a||(B(!1),(_=V.current)==null||_.focus())},gt=T=>/https?:\/\/|www\.|\.com|\.org|\.net|\.io|\.gg|\.co|\.xyz|\.dev/i.test(T),Pn=[/^https:\/\/media[0-9]*\.giphy\.com\//,/^https:\/\/i\.giphy\.com\//,/^https:\/\/giphy\.com\/gifs\//,/^https:\/\/media\.tenor\.com\//,/^https:\/\/c\.tenor\.com\//,/^https:\/\/tenor\.com\/view\//,/^https:\/\/i\.imgur\.com\//,/^https:\/\/media\.discordapp\.net\//],Dt=T=>{const _=T.trim();return!(_.includes(" ")||_.includes(` `)||!_.startsWith("https://")||!Pn.some(H=>H.test(_)))},He=async()=>{var T;if(p.trim()&&!(m>0)){if(!r){o();return}if(gt(p)&&!Dt(p)){alert("Links are not allowed in chat. (GIFs from Giphy, Tenor, and Imgur are allowed)");return}w(!0);try{const _=await lh(r,p.trim());f(H=>{const ee=[...H,_];return ee.length>200?ee.slice(-200):ee}),mt.current=_.createdAt,v(""),Ce(null),g(15),requestAnimationFrame(()=>ue())}catch(_){const H=(T=_==null?void 0:_.response)==null?void 0:T.data,ee=(H==null?void 0:H.error)||"Failed to send message";if(H!=null&&H.cooldown&&g(H.cooldown),H!=null&&H.muted){const se={id:`mute-${Date.now()}`,username:"⚠️ System",message:ee,createdAt:new Date().toISOString()};f(at=>[...at,se]),requestAnimationFrame(()=>ue())}console.error("Chat send error:",ee)}finally{w(!1)}}},A=T=>{var _;if(!(T.username==="⚠️ System"||T.username==="SYSTEM")){if(!r){o();return}Ce({username:T.username,message:T.message}),v(`@${T.username} `),(_=V.current)==null||_.focus()}},U=()=>{Ce(null),v(T=>he&&T.startsWith(`@${he.username} `)?T.slice(`@${he.username} `.length):T)},ce=T=>{if(!r){o();return}T.username!==r&&(F.has(T.id)||D(T.id))},Y=async T=>{D(null);const _=d.find(ee=>ee.id===T);if(!_)return;const H=new Set(F);H.add(_.id),W(H),localStorage.setItem("fm_reported_messages",JSON.stringify([...H])),f(ee=>[...ee.filter(se=>se.id!==_.id),{id:`report-${Date.now()}`,username:"⚠️ System",message:"Message reported and hidden. Thank you for keeping the discourse sacred.",createdAt:new Date().toISOString()}]),requestAnimationFrame(()=>ue());try{await Fb(_.id,r)}catch(ee){console.error("Failed to report message:",ee)}},K=T=>{const _=T.clipboardData,H=_.getData("text/html");if(H){const se=H.match(/]+src=["']([^"']+)["']/i);if(se&&se[1]&&Dt(se[1])){T.preventDefault(),v(se[1]);return}}const ee=_.getData("text/plain");if(ee&&Dt(ee.trim())){T.preventDefault(),v(ee.trim());return}},be=T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),He()),T.key==="Escape"&&he&&U()},Ie=T=>{if(Dt(T))return u.jsx("div",{className:"chat-gif-container",children:u.jsx("img",{src:T.trim(),alt:"GIF",className:"chat-gif",loading:"lazy",onLoad:()=>{if(te()){const H=Se.current;H&&(H.scrollTop=H.scrollHeight)}},onError:H=>{if(H.currentTarget.style.display="none",H.currentTarget.parentElement){const ee=document.createElement("span");ee.className="chat-text",ee.textContent="[GIF failed to load]",H.currentTarget.parentElement.appendChild(ee)}}})});const _=T.match(/^@(\S+)\s(.*)/s);if(_){const H=_[1],ee=_[2];return u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"chat-reply-tag",style:{color:eu(H)},children:["↩ @",H]}),u.jsx("span",{className:"chat-text",children:ee})]})}return u.jsx("span",{className:"chat-text",children:T})};return u.jsxs("div",{className:`chat-box${a&&l?" chat-mobile-expanded":""}${t?" chat-mobile-hidden":""}`,children:[u.jsx("button",{className:"chat-mobile-toggle",onClick:()=>c(!0),"aria-label":"Open chat",children:"💬"}),u.jsxs("div",{className:"chat-header",children:[u.jsx("h3",{children:"Sacred Discourse"}),u.jsx("button",{className:"chat-mobile-close",onClick:()=>c(!1),"aria-label":"Close chat",children:"✕"})]}),u.jsxs("div",{className:"chat-messages",ref:Se,onScroll:we,children:[d.length===0&&u.jsx("div",{className:"chat-empty",children:"No messages yet. Be the first to speak."}),d.map(T=>{const _=i(T.username),H=T.username===r,ee=T.username==="⚠️ System";return u.jsxs("div",{className:"chat-message",onClick:()=>!ee&&A(T),style:{cursor:ee?"default":"pointer"},children:[u.jsx("span",{className:"chat-username",onClick:se=>{se.stopPropagation(),le({username:T.username,x:se.clientX,y:se.clientY})},style:{cursor:"pointer",color:eu(T.username)},children:T.username}),(_==null?void 0:_.tier)&&u.jsx(Xt,{tier:_.tier,size:"small"}),Ie(T.message),!H&&!ee&&je!==T.id&&u.jsx("button",{className:"chat-report-btn",onClick:se=>{se.stopPropagation(),ce(T)},title:"Report message",children:"⚑"}),je===T.id&&u.jsxs("div",{className:"chat-report-confirm",onClick:se=>se.stopPropagation(),style:{position:"absolute",top:0,right:0,background:"rgba(20, 20, 20, 0.95)",border:"1px solid #c85a4a",borderRadius:"4px",padding:"4px 8px",display:"flex",alignItems:"center",gap:"6px",zIndex:10,fontSize:"0.75rem"},children:[u.jsx("span",{style:{color:"#ccc"},children:"Report?"}),u.jsx("button",{onClick:()=>Y(T.id),style:{background:"#c85a4a",color:"#fff",border:"none",borderRadius:"3px",padding:"2px 8px",cursor:"pointer",fontSize:"0.7rem",fontWeight:600},children:"Yes"}),u.jsx("button",{onClick:()=>D(null),style:{background:"transparent",color:"#999",border:"1px solid #555",borderRadius:"3px",padding:"2px 8px",cursor:"pointer",fontSize:"0.7rem",fontWeight:600},children:"No"})]})]},T.id)}),u.jsx("div",{ref:En}),y&&u.jsxs("div",{className:"chat-paused-banner",children:[u.jsx("span",{className:"chat-paused-text",children:"Chat paused"}),u.jsxs("button",{className:"chat-resume-btn",onClick:et,children:["▼ Resume",k>0?` (${k} new)`:""]})]})]}),he&&u.jsxs("div",{className:"chat-reply-banner",children:[u.jsxs("span",{className:"chat-reply-banner-text",children:["Replying to ",u.jsxs("strong",{style:{color:eu(he.username)},children:["@",he.username]})]}),u.jsx("button",{className:"chat-reply-cancel",onClick:U,"aria-label":"Cancel reply",children:"✕"})]}),u.jsxs("div",{className:"chat-input-area",style:{position:"relative"},children:[b&&u.jsxs("div",{className:"chat-emoji-picker",ref:I,children:[u.jsx("div",{className:"emoji-section-label",children:"Flexible Morals"}),mc.map(T=>u.jsx("button",{className:"chat-emoji-btn chat-emoji-custom",onClick:()=>tn(T.emoji),title:T.label,children:T.emoji},T.label)),u.jsx("div",{className:"emoji-section-label",children:"Standard"}),gc.map(T=>u.jsx("button",{className:"chat-emoji-btn",onClick:()=>tn(T),children:T},`std-${T}`))]}),q&&u.jsxs("div",{className:"chat-gif-picker",ref:fn,children:[u.jsx("div",{className:"gif-picker-header",children:u.jsx("input",{className:"gif-search-input",type:"text",value:Be,onChange:T=>pn(T.target.value),placeholder:"Search GIFs...",autoFocus:!0})}),u.jsxs("div",{className:"gif-picker-grid",children:[Ze&&u.jsx("div",{className:"gif-picker-loading",children:"Searching..."}),!Ze&&Re.length===0&&!Vs&&u.jsx("div",{className:"gif-picker-empty",children:"Giphy API key not configured"}),!Ze&&Re.length===0&&Vs,Re.map(T=>u.jsx("button",{className:"gif-picker-item",onClick:()=>Ut(T),title:T.title,children:u.jsx("img",{src:T.images.fixed_height_small.url,alt:T.title,loading:"lazy"})},T.id))]}),u.jsx("div",{className:"gif-picker-attribution",children:"Powered by GIPHY"})]}),u.jsx("button",{className:"chat-emoji-toggle",onClick:()=>{B(T=>!T),de(!1)},type:"button",children:"😀"}),Vs,u.jsx("input",{ref:V,className:"chat-input",type:"text",value:p,onChange:T=>v(sa(T.target.value)),onKeyDown:be,onPaste:K,placeholder:r?"Speak thy mind...":"Click here to chat...",disabled:x,onFocus:T=>{r||(T.target.blur(),o())},maxLength:500}),u.jsx("button",{className:"chat-send-btn",onClick:He,disabled:!p.trim()||x||m>0,children:m>0?`${m}s`:"Proclaim"})]}),oe&&u.jsx(hl,{username:oe.username,blessings:Nt(oe.username),donorTier:(me=i(oe.username))==null?void 0:me.tier,position:{x:oe.x,y:oe.y},onClose:()=>le(null)})]})});function zy({onOfferingClick:e,onMerchClick:t,onCharterClick:n,onVideosClick:r}){const{user:o,logout:i,openLoginModal:s}=Cr(),{getDonorStatus:a,loadDonorStatuses:l}=Jr(),[c,d]=h.useState(!1),f=h.useRef(null);h.useEffect(()=>{o&&l([o])},[o,l]);const p=o?a(o):null;h.useEffect(()=>{if(!c)return;const x=w=>{f.current&&!f.current.contains(w.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]);const v=x=>{d(!1),x()};return u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:`hamburger-icon${o?"":" hamburger-icon-glow"}`,onClick:()=>d(!0),"aria-label":"Open menu",children:[u.jsx("span",{className:"hamburger-bar"}),u.jsx("span",{className:"hamburger-bar"}),u.jsx("span",{className:"hamburger-bar"})]}),c&&u.jsx("div",{className:"hamburger-backdrop",onClick:()=>d(!1)}),u.jsxs("div",{ref:f,className:`hamburger-panel${c?" open":""}`,children:[u.jsx("button",{className:"hamburger-close",onClick:()=>d(!1),"aria-label":"Close menu",children:"✕"}),u.jsx("div",{className:"hamburger-auth",children:o?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"hamburger-welcome",children:"Welcome disciple"}),u.jsxs("span",{className:"hamburger-username",children:[o,(p==null?void 0:p.tier)&&u.jsx(Xt,{tier:p.tier,size:"small"})]}),u.jsx("button",{onClick:()=>v(i),className:"hamburger-logout-btn",children:"Logout"})]}):u.jsx("button",{onClick:()=>v(s),className:"hamburger-login-btn",children:"Login"})}),u.jsx("div",{className:"hamburger-divider"}),u.jsxs("nav",{className:"hamburger-nav",children:[u.jsx("button",{onClick:()=>v(e),className:"hamburger-nav-btn",children:"Offering"}),u.jsx("button",{onClick:()=>v(t),className:"hamburger-nav-btn",children:"Merch"}),u.jsx("button",{onClick:()=>v(n),className:`hamburger-nav-btn${o?"":" hamburger-nav-glow"}`,children:"Our Charter"}),u.jsx("button",{onClick:()=>v(r),className:"hamburger-nav-btn",children:"Promotional Content"})]})]})]})}const a2=e=>{const t=[[10,"X"],[9,"IX"],[8,"VIII"],[7,"VII"],[6,"VI"],[5,"V"],[4,"IV"],[3,"III"],[2,"II"],[1,"I"]];let n="";for(const[r,o]of t)for(;e>=r;)n+=o,e-=r;return n};function l2(){var mt;const[e,t]=h.useState([]),[n,r]=h.useState(!0),[o,i]=h.useState(null),[s,a]=h.useState(!1),[l,c]=h.useState(!1),[d,f]=h.useState(!1),[p,v]=h.useState(!1),[x,w]=h.useState(!1),[m,g]=h.useState({days:0,hours:0,minutes:0,seconds:0}),[y,S]=h.useState(!1),[k,j]=h.useState(!1),[E,N]=h.useState(!1),[b,B]=h.useState(null),I=["/mobile_bg_1.png","/mobile_bg_2.png","/mobile_bg_3.png","/mobile_bg_4.png","/mobile_bg_5.png","/mobile_bg_6.png","/mobile_bg_7.png"],[V]=h.useState(()=>I[Math.floor(Math.random()*I.length)]),[oe,le]=Yw(),he=oe.get("source")==="qr",[Ce,je]=h.useState(()=>he),[D,F]=h.useState(!1);h.useEffect(()=>{oe.get("source")==="qr"&&(oe.delete("source"),le(oe,{replace:!0}))},[]);const W=h.useRef(null),G=h.useRef(null),q=Ho(),{donorStatuses:de,loadDonorStatuses:Be,getDonorStatus:Ne}=Jr(),{user:Re}=Cr(),X=Wn("(max-width: 768px)"),Ze=h.useCallback(L=>e.filter(te=>te.username===L).reduce((te,ue)=>te+(ue.votes??0),0),[e]);h.useEffect(()=>{const L=()=>{const ue=new Date,we=new Date(2026,3,1,0,0,0).getTime(),et=90*24*60*60*1e3,tt=Math.floor((ue.getTime()-we)/et),Ut=new Date(we+(tt+1)*et).getTime()-ue.getTime(),At=Math.floor(Ut/(1e3*60*60*24)),Nt=Math.floor(Ut/(1e3*60*60)%24),tn=Math.floor(Ut/(1e3*60)%60),gt=Math.floor(Ut/1e3%60);g({days:At,hours:Nt,minutes:tn,seconds:gt})};L();const te=setInterval(L,1e3);return()=>clearInterval(te)},[]),h.useEffect(()=>{const L=()=>{S(!0),setTimeout(()=>S(!1),3e3)};L();const te=setInterval(L,3e4);return()=>clearInterval(te)},[]),h.useEffect(()=>{const L=()=>{j(!0),setTimeout(()=>j(!1),3e3)};setTimeout(L,2e3);const te=setInterval(L,6e4);return()=>clearInterval(te)},[]),h.useEffect(()=>{if(X)return;const L=()=>{const ue=15e3+Math.random()*3e4;return setTimeout(()=>{N(!0),setTimeout(()=>N(!1),3e3),te=L()},ue)};let te=L();return()=>clearTimeout(te)},[X]),h.useEffect(()=>{if(X)return;const L=setTimeout(()=>w(!0),5e3);return()=>clearTimeout(L)},[X]),h.useEffect(()=>{const L=async()=>{try{const we=await pl();t(Array.isArray(we)?we:[])}catch(we){console.error("❌ Error fetching posts:",we),i("Failed to load commandments.")}finally{r(!1)}};L();const te=setInterval(L,3e4),ue=()=>L();return window.addEventListener("focus",ue),()=>{clearInterval(te),window.removeEventListener("focus",ue)}},[]),h.useEffect(()=>{if(e.length>0){const L=e.map(te=>te.username).filter(te=>!!te&&te!=="unknown");L.length>0&&Be(L)}},[e,Be]),h.useEffect(()=>{if(!X||n||e.length===0)return;const L=G.current;if(!L)return;let te;const ue=()=>{const tt=L.querySelectorAll(".wheel-item"),pn=L.getBoundingClientRect(),At=pn.height*.18,Nt=pn.bottom-At;tt.forEach(tn=>{const gt=tn.getBoundingClientRect(),Pn=gt.top+gt.height/2;let Dt=0;Pn>Nt&&(Dt=Math.min((Pn-Nt)/At,1));const He=1-Dt*.2,A=1-Dt*.65;tn.style.transform=`scale(${He})`,tn.style.opacity=`${Math.max(A,.25)}`})},we=()=>{cancelAnimationFrame(te),te=requestAnimationFrame(ue)},et=L.querySelector(".wheel-spacer-bottom");return et&&(et.style.height=`${L.clientHeight*.2}px`),L.addEventListener("scroll",we,{passive:!0}),setTimeout(()=>{L.scrollTop=0,ue()},50),()=>{L.removeEventListener("scroll",we),cancelAnimationFrame(te)}},[X,e,n]);const ye=[...e].sort((L,te)=>(te.votes??0)-(L.votes??0)),fn=ye.slice(0,5),en=ye.slice(5,10),En=ye.slice(0,10),Se=(L,te,ue)=>{const we=L.username?de[L.username]:null;return u.jsxs("div",{className:"commandment-border",onClick:()=>q(`/comments/${L.id}`,{state:{from:"home"}}),style:{cursor:"pointer"},children:[u.jsxs("div",{className:"commandment-text",children:[u.jsxs("span",{className:"commandment-number",children:[a2(te+1),". "]}),L.title||L.content]}),u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"6px",marginTop:"2px"},children:[L.votes!==void 0&&u.jsxs("span",{className:"vote-count",style:{margin:0},children:[L.votes," votes"]}),u.jsxs("span",{onClick:et=>{et.stopPropagation(),L.username&&L.username!=="unknown"&&B({username:L.username,x:et.clientX,y:et.clientY})},style:{fontSize:"0.8rem",color:"#c8b070",cursor:"pointer",fontStyle:"italic"},children:["— ",L.username||"unknown",(we==null?void 0:we.tier)&&u.jsx(Xt,{tier:we.tier,size:"small"})]})]})]},L.id)};return n&&!Ce?u.jsxs("div",{className:"loading-screen",children:[u.jsxs("div",{className:"loading-tablets",children:[u.jsxs("div",{className:"loading-tablet left-tablet",children:[u.jsx("div",{className:"tablet-arch"}),u.jsx("div",{className:"tablet-body"}),u.jsxs("div",{className:"chisel-sparks",children:[u.jsx("span",{className:"spark",children:"✦"}),u.jsx("span",{className:"spark",children:"✧"}),u.jsx("span",{className:"spark",children:"✦"})]})]}),u.jsx("div",{className:"loading-chisel",children:u.jsx("div",{className:"chisel-tool",children:"🪨"})}),u.jsxs("div",{className:"loading-tablet right-tablet",children:[u.jsx("div",{className:"tablet-arch"}),u.jsx("div",{className:"tablet-body"})]})]}),u.jsx("p",{className:"loading-text",children:"Loading morals...."})]}):u.jsxs("div",{className:"home-root",children:[Ce&&u.jsx(Ob,{onComplete:()=>{je(!1),F(!0)}}),D&&u.jsx(Bb,{isMobile:X,onComplete:()=>F(!1)}),X?u.jsxs("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100dvh",overflow:"hidden",backgroundImage:`url(${V})`,backgroundSize:"100% 100%",backgroundPosition:"center center",backgroundRepeat:"no-repeat"},children:[u.jsxs("div",{style:{position:"absolute",top:"0.4rem",right:"0.5rem",zIndex:20,textAlign:"center"},children:[u.jsx("div",{style:{display:"flex",gap:"6px",justifyContent:"center"},children:[{val:m.days,label:"D"},{val:m.hours,label:"H"},{val:m.minutes,label:"M"},{val:m.seconds,label:"S"}].map(L=>u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[u.jsx("span",{style:{fontFamily:"'Cinzel', serif",fontSize:"1.6rem",fontWeight:900,color:"#c8b070",textShadow:"2px 2px 0px #3a2e0b, -1px -1px 0px #3a2e0b, 1px -1px 0px #3a2e0b, -1px 1px 0px #3a2e0b, 0 0 10px rgba(200, 176, 112, 0.3)",lineHeight:1,minWidth:"1.8rem"},children:String(L.val).padStart(2,"0")}),u.jsx("span",{style:{fontFamily:"'Cinzel', serif",fontSize:"0.55rem",fontWeight:700,color:"#c8b070",textShadow:"1px 1px 0px #3a2e0b",letterSpacing:"0.08em",marginTop:"1px"},children:L.label})]},L.label))}),u.jsx("span",{style:{fontFamily:"'Cinzel', serif",fontSize:"0.65rem",fontWeight:700,color:"#c8b070",textShadow:"1px 1px 0px #3a2e0b, 0 0 10px rgba(200, 176, 112, 0.3)",letterSpacing:"0.1em",textTransform:"uppercase",marginTop:"3px",display:"block"},children:"until moral reset"})]}),u.jsxs("div",{className:"mobile-tablet-overlay",ref:G,children:[!n&&!o&&e.length===0&&u.jsxs("div",{className:"empty-state",style:{textAlign:"center",zIndex:10},children:[u.jsx("p",{style:{fontFamily:"'Cinzel', serif",fontSize:"1.1rem",fontWeight:700,color:"#3a2e0b",textShadow:"0 0 4px rgba(200,176,112,0.3)",margin:"0 0 8px 0"},children:"The tablet is empty."}),u.jsx("p",{style:{fontFamily:"'Cinzel', serif",fontSize:"0.85rem",color:"#5a4a2a",margin:"0 0 12px 0"},children:"Be the first to inscribe a commandment."}),u.jsx("button",{onClick:()=>q("/vote"),style:{fontFamily:"'Cinzel', serif",fontSize:"0.9rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"8px",padding:"8px 20px",cursor:"pointer",textShadow:"1px 1px 2px rgba(0,0,0,0.5)"},children:"Inscribe a Commandment"})]}),u.jsxs("div",{className:"stone-column",children:[n&&u.jsx("div",{className:"commandment-border",children:"Loading..."}),o&&u.jsx("div",{className:"commandment-border",children:o}),!n&&!o&&u.jsxs(u.Fragment,{children:[En.map((L,te)=>u.jsx("div",{className:"wheel-item",children:Se(L,te)},L.id)),u.jsx("div",{className:"wheel-spacer wheel-spacer-bottom"})]})]})]}),u.jsxs("div",{className:"mobile-buttons-overlay",children:[u.jsx("button",{onClick:()=>q("/vote"),className:"vote-button mobile-btn",children:"Vote"}),u.jsx("button",{onClick:()=>{var L;return(L=W.current)==null?void 0:L.expand()},className:"vote-button mobile-btn",children:"Live Chat"})]})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"home-bg-wrapper",children:[u.jsx("img",{src:"/FlexibleMoralsPicture.png",alt:"Flexible Morals Background",className:"home-background-balanced"}),E&&u.jsxs("div",{className:"robe-eyes",children:[u.jsx("div",{className:"robe-eye"}),u.jsx("div",{className:"robe-eye"})]})]}),u.jsxs("div",{style:{position:"fixed",top:"1rem",right:"1rem",zIndex:999,textAlign:"center"},children:[u.jsx("div",{style:{display:"flex",gap:"10px",justifyContent:"center"},children:[{val:m.days,label:"DAYS"},{val:m.hours,label:"HRS"},{val:m.minutes,label:"MIN"},{val:m.seconds,label:"SEC"}].map(L=>u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[u.jsx("span",{style:{fontFamily:"'Cinzel', serif",fontSize:"2.8rem",fontWeight:900,color:"#c8b070",textShadow:"2px 2px 0px #3a2e0b, -1px -1px 0px #3a2e0b, 1px -1px 0px #3a2e0b, -1px 1px 0px #3a2e0b, 0 0 20px rgba(200, 176, 112, 0.3)",lineHeight:1,minWidth:"3.2rem"},children:String(L.val).padStart(2,"0")}),u.jsx("span",{style:{fontFamily:"'Cinzel', serif",fontSize:"0.7rem",fontWeight:700,color:"#c8b070",textShadow:"1px 1px 0px #3a2e0b",letterSpacing:"0.1em",marginTop:"4px"},children:L.label})]},L.label))}),u.jsx("span",{style:{fontFamily:"'Cinzel', serif",fontSize:"0.85rem",fontWeight:700,color:"#c8b070",textShadow:"2px 2px 0px #3a2e0b, -1px -1px 0px #3a2e0b, 1px -1px 0px #3a2e0b, -1px 1px 0px #3a2e0b, 0 0 20px rgba(200, 176, 112, 0.3)",letterSpacing:"0.15em",textTransform:"uppercase",marginTop:"8px",display:"block"},children:"until moral reset"})]})]}),X?u.jsx(zy,{onOfferingClick:()=>f(!0),onMerchClick:()=>a(!0),onCharterClick:()=>c(!0),onVideosClick:()=>v(!0)}):u.jsxs(u.Fragment,{children:[u.jsx(La,{}),u.jsx("div",{className:`videos-float-link${x?" videos-float-visible":""}`,onClick:()=>v(!0),children:"Promotional Content"})]}),u.jsx(s2,{ref:W,hideMobileFab:X}),u.jsxs("div",{className:"vote-button-container",children:[y&&!X&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"prayer-hands prayer-right",children:"🙏"}),u.jsx("span",{className:"prayer-hands prayer-top",children:"🙏"}),u.jsx("span",{className:"prayer-hands prayer-bottom",children:"🙏"})]}),u.jsx("button",{onClick:()=>q("/vote"),className:"vote-button",children:"Vote"})]}),u.jsxs("div",{className:"offering-link-container",children:[k&&u.jsxs("div",{className:"coin-animation",children:[u.jsx("div",{className:"coin coin-1",children:"$"}),u.jsx("div",{className:"coin coin-2",children:"$"})]}),u.jsx("button",{onClick:()=>f(!0),className:"offering-link",style:{fontFamily:"inherit"},children:"Offering"})]}),u.jsx(Ry,{isOpen:d,onClose:()=>f(!1)}),u.jsx(Ay,{isOpen:p,onClose:()=>v(!1)}),u.jsx("div",{className:"merch-link-container",children:u.jsx("button",{onClick:()=>a(!0),className:"merch-link",children:"Merch"})}),u.jsx("div",{className:"info-link-container",children:u.jsx("button",{onClick:()=>c(!0),className:`info-link${Re?"":" charter-glow"}`,children:"OUR CHARTER"})}),s&&u.jsx("div",{className:"popup-overlay",onClick:()=>a(!1),children:u.jsxs("div",{className:"popup-box",onClick:L=>L.stopPropagation(),style:{maxWidth:"520px",width:"92%",padding:X?"1rem":"2rem",backgroundColor:"#1a1a1a",maxHeight:"90vh",overflowY:"auto"},children:[u.jsx("h2",{style:{color:"#d4af37",marginBottom:"0.5rem",fontSize:X?"1.2rem":"1.5rem"},children:"Flexible Morals Tee"}),u.jsx("p",{style:{marginBottom:X?"0.5rem":"1rem",color:"#aaa",fontSize:X?"0.8rem":"0.9rem"},children:"Coming Soon! Each month's top commandments on the back."}),u.jsx("img",{src:"/merch_tee_back.png",alt:"Flexible Morals Tee - Back with Commandments",style:{width:"100%",borderRadius:"8px",display:"block",margin:"0 auto"}}),u.jsx("img",{src:"/merch_tee_2.png",alt:"Flexible Morals Tee - Modeled Front and Back",style:{width:"100%",borderRadius:"8px",display:"block",margin:X?"0.5rem auto 0":"1rem auto 0"}}),u.jsx("p",{style:{marginTop:X?"0.5rem":"1rem",fontSize:X?"0.75rem":"0.85rem",color:"#d4af37",fontFamily:"'Cinzel', serif",fontWeight:600},children:"Shirts updated with our most recent morals!"}),u.jsx("button",{onClick:()=>a(!1),className:"popup-close",style:{marginTop:X?"0.5rem":"1rem"},children:"Close"})]})}),l&&u.jsx("div",{className:"popup-overlay",onClick:()=>c(!1),children:u.jsxs("div",{className:"popup-box",onClick:L=>L.stopPropagation(),style:{maxWidth:"700px",lineHeight:X?"1.4":"1.6",textAlign:"center",position:"relative",padding:X?"1rem 1rem 0.8rem":void 0,fontSize:X?"0.85rem":void 0},children:[u.jsx("button",{onClick:()=>c(!1),style:{position:X?"sticky":"absolute",top:X?0:"12px",right:X?void 0:"16px",float:X?"right":void 0,background:X?"rgba(253, 248, 230, 0.95)":"none",border:"none",color:"#d4af37",fontSize:X?"1.3rem":"1.5rem",cursor:"pointer",fontFamily:"'Cinzel', serif",fontWeight:700,lineHeight:1,padding:X?"2px 6px":"4px 8px",zIndex:10,borderRadius:X?"4px":void 0},"aria-label":"Close",children:"✕"}),u.jsx("h1",{style:{color:"#d4af37",marginBottom:X?"0.5rem":"1rem",fontFamily:"'Cinzel', serif",letterSpacing:"0.1em",fontSize:X?"1.2rem":void 0},children:"OUR CHARTER"}),u.jsxs("p",{children:["Flexible Morals was founded to create a collaborative, ad-free, bot-free space where people can actively shape a modern moral framework inspired by timeless principles. Readers and future disciples are invited to participate in the ",u.jsx("strong",{style:{color:"#d4af37",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 6px",borderRadius:"3px"},children:"World's First Democratic Religion"})," by sharing opinions, helping guide daily commandments, and voting monthly to determine the top ten moral standards."]}),u.jsx("p",{style:{marginTop:X?"0.6rem":"1rem"},children:"The mission is to foster thoughtful dialogue across cultures and generations, sustain the platform through optional support, and build a movement focused not on profit, but on making a positive impact—supporting meaningful causes and promoting hope and care for humanity's future."}),u.jsx("button",{onClick:()=>c(!1),className:"popup-close",style:{marginTop:X?"0.6rem":void 0},children:"Close"})]})}),!X&&u.jsxs("div",{className:"overlay-stones",children:[!n&&!o&&e.length===0&&u.jsxs("div",{className:"empty-state",style:{position:"absolute",top:"30%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center",zIndex:10,width:"60%"},children:[u.jsx("p",{style:{fontFamily:"'Cinzel', serif",fontSize:"1.3rem",fontWeight:700,color:"#d4af37",textShadow:"1px 1px 4px rgba(0,0,0,0.8)",margin:"0 0 8px 0"},children:"The tablets are empty."}),u.jsx("p",{style:{fontFamily:"'Cinzel', serif",fontSize:"0.95rem",color:"#c8b070",textShadow:"1px 1px 3px rgba(0,0,0,0.8)",margin:"0 0 12px 0"},children:"Be the first to create a commandment and define the morals for humanity."}),u.jsx("button",{onClick:()=>q("/vote"),style:{fontFamily:"'Cinzel', serif",fontSize:"1rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"8px",padding:"10px 24px",cursor:"pointer",textShadow:"1px 1px 2px rgba(0,0,0,0.5)"},children:"Inscribe a Commandment"})]}),u.jsxs("div",{className:"stone-column",children:[n&&u.jsx("div",{className:"commandment-border",children:"Loading..."}),o&&u.jsx("div",{className:"commandment-border",children:o}),!n&&!o&&fn.map((L,te)=>Se(L,te))]}),u.jsxs("div",{className:"stone-column",children:[n&&u.jsx("div",{className:"commandment-border",children:"Loading..."}),o&&u.jsx("div",{className:"commandment-border",children:o}),!n&&!o&&en.map((L,te)=>Se(L,te+5))]})]}),b&&u.jsx(hl,{username:b.username,blessings:Ze(b.username),donorTier:(mt=Ne(b.username))==null?void 0:mt.tier,position:{x:b.x,y:b.y},onClose:()=>B(null)})]})}const zd=h.createContext({});function Fd(e){const t=h.useRef(null);return t.current===null&&(t.current=e()),t.current}const ml=h.createContext(null),Md=h.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class u2 extends h.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function c2({children:e,isPresent:t}){const n=h.useId(),r=h.useRef(null),o=h.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=h.useContext(Md);return h.useInsertionEffect(()=>{const{width:s,height:a,top:l,left:c}=o.current;if(t||!r.current||!s||!a)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${s}px !important; height: ${a}px !important; top: ${l}px !important; left: ${c}px !important; } `),()=>{document.head.removeChild(d)}},[t]),u.jsx(u2,{isPresent:t,childRef:r,sizeRef:o,children:h.cloneElement(e,{ref:r})})}const d2=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:i,mode:s})=>{const a=Fd(f2),l=h.useId(),c=h.useCallback(f=>{a.set(f,!0);for(const p of a.values())if(!p)return;r&&r()},[a,r]),d=h.useMemo(()=>({id:l,initial:t,isPresent:n,custom:o,onExitComplete:c,register:f=>(a.set(f,!1),()=>a.delete(f))}),i?[Math.random(),c]:[n,c]);return h.useMemo(()=>{a.forEach((f,p)=>a.set(p,!1))},[n]),h.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),s==="popLayout"&&(e=u.jsx(c2,{isPresent:n,children:e})),u.jsx(ml.Provider,{value:d,children:e})};function f2(){return new Map}function Fy(e=!0){const t=h.useContext(ml);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,i=h.useId();h.useEffect(()=>{e&&o(i)},[e]);const s=h.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,s]:[!0]}const Bs=e=>e.key||"";function hh(e){const t=[];return h.Children.forEach(e,n=>{h.isValidElement(n)&&t.push(n)}),t}const Id=typeof window<"u",My=Id?h.useLayoutEffect:h.useEffect,no=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:i="sync",propagate:s=!1})=>{const[a,l]=Fy(s),c=h.useMemo(()=>hh(e),[e]),d=s&&!a?[]:c.map(Bs),f=h.useRef(!0),p=h.useRef(c),v=Fd(()=>new Map),[x,w]=h.useState(c),[m,g]=h.useState(c);My(()=>{f.current=!1,p.current=c;for(let k=0;k{const j=Bs(k),E=s&&!a?!1:c===m||d.includes(j),N=()=>{if(v.has(j))v.set(j,!0);else return;let b=!0;v.forEach(B=>{B||(b=!1)}),b&&(S==null||S(),g(p.current),s&&(l==null||l()),r&&r())};return u.jsx(d2,{isPresent:E,initial:!f.current||n?void 0:!1,custom:E?void 0:t,presenceAffectsLayout:o,mode:i,onExitComplete:E?void 0:N,children:k},j)})})},Lt=e=>e;let Iy=Lt;function Ld(e){let t;return()=>(t===void 0&&(t=e()),t)}const Lo=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},In=e=>e*1e3,Ln=e=>e/1e3,p2={useManualTiming:!1};function h2(e){let t=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function a(c){i.has(c)&&(l.schedule(c),e()),c(s)}const l={schedule:(c,d=!1,f=!1)=>{const v=f&&r?t:n;return d&&i.add(c),v.has(c)||v.add(c),c},cancel:c=>{n.delete(c),i.delete(c)},process:c=>{if(s=c,r){o=!0;return}r=!0,[t,n]=[n,t],t.forEach(a),t.clear(),r=!1,o&&(o=!1,l.process(c))}};return l}const Us=["read","resolveKeyframes","update","preRender","render","postRender"],m2=40;function Ly(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,s=Us.reduce((g,y)=>(g[y]=h2(i),g),{}),{read:a,resolveKeyframes:l,update:c,preRender:d,render:f,postRender:p}=s,v=()=>{const g=performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(g-o.timestamp,m2),1),o.timestamp=g,o.isProcessing=!0,a.process(o),l.process(o),c.process(o),d.process(o),f.process(o),p.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(v))},x=()=>{n=!0,r=!0,o.isProcessing||e(v)};return{schedule:Us.reduce((g,y)=>{const S=s[y];return g[y]=(k,j=!1,E=!1)=>(n||x(),S.schedule(k,j,E)),g},{}),cancel:g=>{for(let y=0;ymh[e].some(n=>!!t[n])};function g2(e){for(const t in e)Oo[t]={...Oo[t],...e[t]}}const y2=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Oa(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||y2.has(e)}let _y=e=>!Oa(e);function x2(e){e&&(_y=t=>t.startsWith("on")?!Oa(t):e(t))}try{x2(require("@emotion/is-prop-valid").default)}catch{}function v2(e,t,n){const r={};for(const o in e)o==="values"&&typeof e.values=="object"||(_y(o)||n===!0&&Oa(o)||!t&&!Oa(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}function S2(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,o)=>o==="create"?e:(t.has(o)||t.set(o,e(o)),t.get(o))})}const gl=h.createContext({});function Xi(e){return typeof e=="string"||Array.isArray(e)}function yl(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Od=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],_d=["initial",...Od];function xl(e){return yl(e.animate)||_d.some(t=>Xi(e[t]))}function Vy(e){return!!(xl(e)||e.variants)}function w2(e,t){if(xl(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Xi(n)?n:void 0,animate:Xi(r)?r:void 0}}return e.inherit!==!1?t:{}}function C2(e){const{initial:t,animate:n}=w2(e,h.useContext(gl));return h.useMemo(()=>({initial:t,animate:n}),[gh(t),gh(n)])}function gh(e){return Array.isArray(e)?e.join(" "):e}const b2=Symbol.for("motionComponentSymbol");function xo(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function k2(e,t,n){return h.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):xo(n)&&(n.current=r))},[t])}const Vd=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),j2="framerAppearId",By="data-"+Vd(j2),{schedule:Bd}=Ly(queueMicrotask,!1),Uy=h.createContext({});function T2(e,t,n,r,o){var i,s;const{visualElement:a}=h.useContext(gl),l=h.useContext(Oy),c=h.useContext(ml),d=h.useContext(Md).reducedMotion,f=h.useRef(null);r=r||l.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:a,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d}));const p=f.current,v=h.useContext(Uy);p&&!p.projection&&o&&(p.type==="html"||p.type==="svg")&&E2(f.current,n,o,v);const x=h.useRef(!1);h.useInsertionEffect(()=>{p&&x.current&&p.update(n,c)});const w=n[By],m=h.useRef(!!w&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,w))&&((s=window.MotionHasOptimisedAnimation)===null||s===void 0?void 0:s.call(window,w)));return My(()=>{p&&(x.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),Bd.render(p.render),m.current&&p.animationState&&p.animationState.animateChanges())}),h.useEffect(()=>{p&&(!m.current&&p.animationState&&p.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,w)}),m.current=!1))}),p}function E2(e,t,n,r){const{layoutId:o,layout:i,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:c}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:$y(e.parent)),e.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:!!s||a&&xo(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:c})}function $y(e){if(e)return e.options.allowProjection!==!1?e.projection:$y(e.parent)}function P2({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:o}){var i,s;e&&g2(e);function a(c,d){let f;const p={...h.useContext(Md),...c,layoutId:R2(c)},{isStatic:v}=p,x=C2(c),w=r(c,v);if(!v&&Id){A2();const m=N2(p);f=m.MeasureLayout,x.visualElement=T2(o,w,p,t,m.ProjectionNode)}return u.jsxs(gl.Provider,{value:x,children:[f&&x.visualElement?u.jsx(f,{visualElement:x.visualElement,...p}):null,n(o,c,k2(w,x.visualElement,d),w,v,x.visualElement)]})}a.displayName=`motion.${typeof o=="string"?o:`create(${(s=(i=o.displayName)!==null&&i!==void 0?i:o.name)!==null&&s!==void 0?s:""})`}`;const l=h.forwardRef(a);return l[b2]=o,l}function R2({layoutId:e}){const t=h.useContext(zd).id;return t&&e!==void 0?t+"-"+e:e}function A2(e,t){h.useContext(Oy).strict}function N2(e){const{drag:t,layout:n}=Oo;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const D2=["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 Ud(e){return typeof e!="string"||e.includes("-")?!1:!!(D2.indexOf(e)>-1||/[A-Z]/u.test(e))}function yh(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function $d(e,t,n,r){if(typeof t=="function"){const[o,i]=yh(r);t=t(n!==void 0?n:e.custom,o,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,i]=yh(r);t=t(n!==void 0?n:e.custom,o,i)}return t}const yc=e=>Array.isArray(e),z2=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),F2=e=>yc(e)?e[e.length-1]||0:e,pt=e=>!!(e&&e.getVelocity);function aa(e){const t=pt(e)?e.get():e;return z2(t)?t.toValue():t}function M2({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,o,i){const s={latestValues:I2(r,o,i,e),renderState:t()};return n&&(s.onMount=a=>n({props:r,current:a,...s}),s.onUpdate=a=>n(a)),s}const Wy=e=>(t,n)=>{const r=h.useContext(gl),o=h.useContext(ml),i=()=>M2(e,t,r,o);return n?i():Fd(i)};function I2(e,t,n,r){const o={},i=r(e,{});for(const p in i)o[p]=aa(i[p]);let{initial:s,animate:a}=e;const l=xl(e),c=Vy(e);t&&c&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let d=n?n.initial===!1:!1;d=d||s===!1;const f=d?a:s;if(f&&typeof f!="boolean"&&!yl(f)){const p=Array.isArray(f)?f:[f];for(let v=0;vt=>typeof t=="string"&&t.startsWith(e),Ky=Hy("--"),L2=Hy("var(--"),Wd=e=>L2(e)?O2.test(e.split("/*")[0].trim()):!1,O2=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Gy=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Un=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},Qi={...qo,transform:e=>Un(0,1,e)},$s={...qo,default:1},fs=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Qn=fs("deg"),jn=fs("%"),Z=fs("px"),_2=fs("vh"),V2=fs("vw"),xh={...jn,parse:e=>jn.parse(e)/100,transform:e=>jn.transform(e*100)},B2={borderWidth:Z,borderTopWidth:Z,borderRightWidth:Z,borderBottomWidth:Z,borderLeftWidth:Z,borderRadius:Z,radius:Z,borderTopLeftRadius:Z,borderTopRightRadius:Z,borderBottomRightRadius:Z,borderBottomLeftRadius:Z,width:Z,maxWidth:Z,height:Z,maxHeight:Z,top:Z,right:Z,bottom:Z,left:Z,padding:Z,paddingTop:Z,paddingRight:Z,paddingBottom:Z,paddingLeft:Z,margin:Z,marginTop:Z,marginRight:Z,marginBottom:Z,marginLeft:Z,backgroundPositionX:Z,backgroundPositionY:Z},U2={rotate:Qn,rotateX:Qn,rotateY:Qn,rotateZ:Qn,scale:$s,scaleX:$s,scaleY:$s,scaleZ:$s,skew:Qn,skewX:Qn,skewY:Qn,distance:Z,translateX:Z,translateY:Z,translateZ:Z,x:Z,y:Z,z:Z,perspective:Z,transformPerspective:Z,opacity:Qi,originX:xh,originY:xh,originZ:Z},vh={...qo,transform:Math.round},Hd={...B2,...U2,zIndex:vh,size:Z,fillOpacity:Qi,strokeOpacity:Qi,numOctaves:vh},$2={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},W2=Yo.length;function H2(e,t,n){let r="",o=!0;for(let i=0;i({style:{},transform:{},transformOrigin:{},vars:{}}),Yy=()=>({...Yd(),attrs:{}}),qd=e=>typeof e=="string"&&e.toLowerCase()==="svg";function qy(e,{style:t,vars:n},r,o){Object.assign(e.style,t,o&&o.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const Xy=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Qy(e,t,n,r){qy(e,t,void 0,r);for(const o in t.attrs)e.setAttribute(Xy.has(o)?o:Vd(o),t.attrs[o])}const _a={};function X2(e){Object.assign(_a,e)}function Jy(e,{layout:t,layoutId:n}){return Zr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!_a[e]||e==="opacity")}function Xd(e,t,n){var r;const{style:o}=e,i={};for(const s in o)(pt(o[s])||t.style&&pt(t.style[s])||Jy(s,e)||((r=n==null?void 0:n.getValue(s))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[s]=o[s]);return i}function Zy(e,t,n){const r=Xd(e,t,n);for(const o in e)if(pt(e[o])||pt(t[o])){const i=Yo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[i]=e[o]}return r}function Q2(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const wh=["x","y","width","height","cx","cy","r"],J2={useVisualState:Wy({scrapeMotionValuesFromProps:Zy,createRenderState:Yy,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:o})=>{if(!n)return;let i=!!e.drag;if(!i){for(const a in o)if(Zr.has(a)){i=!0;break}}if(!i)return;let s=!t;if(t)for(let a=0;a{Q2(n,r),Pe.render(()=>{Gd(r,o,qd(n.tagName),e.transformTemplate),Qy(n,r)})})}})},Z2={useVisualState:Wy({scrapeMotionValuesFromProps:Xd,createRenderState:Yd})};function ex(e,t,n){for(const r in t)!pt(t[r])&&!Jy(r,n)&&(e[r]=t[r])}function ek({transformTemplate:e},t){return h.useMemo(()=>{const n=Yd();return Kd(n,t,e),Object.assign({},n.vars,n.style)},[t])}function tk(e,t){const n=e.style||{},r={};return ex(r,n,e),Object.assign(r,ek(e,t)),r}function nk(e,t){const n={},r=tk(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function rk(e,t,n,r){const o=h.useMemo(()=>{const i=Yy();return Gd(i,t,qd(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};ex(i,e.style,e),o.style={...i,...o.style}}return o}function ok(e=!1){return(n,r,o,{latestValues:i},s)=>{const l=(Ud(n)?rk:nk)(r,i,s,n),c=v2(r,typeof n=="string",e),d=n!==h.Fragment?{...c,...l,ref:o}:{},{children:f}=r,p=h.useMemo(()=>pt(f)?f.get():f,[f]);return h.createElement(n,{...d,children:p})}}function ik(e,t){return function(r,{forwardMotionProps:o}={forwardMotionProps:!1}){const s={...Ud(r)?J2:Z2,preloadedFeatures:e,useRender:ok(o),createVisualElement:t,Component:r};return P2(s)}}function tx(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rwindow.ScrollTimeline!==void 0);class ak{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(sk()&&o.attachTimeline)return o.attachTimeline(t);if(typeof n=="function")return n(o)});return()=>{r.forEach((o,i)=>{o&&o(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class lk extends ak{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function Qd(e,t){return e?e[t]||e.default||e:void 0}const xc=2e4;function nx(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=xc?1/0:t}function Jd(e){return typeof e=="function"}function Ch(e,t){e.timeline=t,e.onfinish=null}const Zd=e=>Array.isArray(e)&&typeof e[0]=="number",uk={linearEasing:void 0};function ck(e,t){const n=Ld(e);return()=>{var r;return(r=uk[t])!==null&&r!==void 0?r:n()}}const Va=ck(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),rx=(e,t,n=10)=>{let r="";const o=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,vc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:mi([0,.65,.55,1]),circOut:mi([.55,0,1,.45]),backIn:mi([.31,.01,.66,-.59]),backOut:mi([.33,1.53,.69,.99])};function ix(e,t){if(e)return typeof e=="function"&&Va()?rx(e,t):Zd(e)?mi(e):Array.isArray(e)?e.map(n=>ix(n,t)||vc.easeOut):vc[e]}const rn={x:!1,y:!1};function sx(){return rn.x||rn.y}function dk(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let o=document;const i=(r=void 0)!==null&&r!==void 0?r:o.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function ax(e,t){const n=dk(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[n,o,()=>r.abort()]}function bh(e){return t=>{t.pointerType==="touch"||sx()||e(t)}}function fk(e,t,n={}){const[r,o,i]=ax(e,n),s=bh(a=>{const{target:l}=a,c=t(a);if(typeof c!="function"||!l)return;const d=bh(f=>{c(f),l.removeEventListener("pointerleave",d)});l.addEventListener("pointerleave",d,o)});return r.forEach(a=>{a.addEventListener("pointerenter",s,o)}),i}const lx=(e,t)=>t?e===t?!0:lx(e,t.parentElement):!1,ef=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,pk=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function hk(e){return pk.has(e.tagName)||e.tabIndex!==-1}const gi=new WeakSet;function kh(e){return t=>{t.key==="Enter"&&e(t)}}function nu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const mk=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=kh(()=>{if(gi.has(n))return;nu(n,"down");const o=kh(()=>{nu(n,"up")}),i=()=>nu(n,"cancel");n.addEventListener("keyup",o,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function jh(e){return ef(e)&&!sx()}function gk(e,t,n={}){const[r,o,i]=ax(e,n),s=a=>{const l=a.currentTarget;if(!jh(a)||gi.has(l))return;gi.add(l);const c=t(a),d=(v,x)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",p),!(!jh(v)||!gi.has(l))&&(gi.delete(l),typeof c=="function"&&c(v,{success:x}))},f=v=>{d(v,n.useGlobalTarget||lx(l,v.target))},p=v=>{d(v,!1)};window.addEventListener("pointerup",f,o),window.addEventListener("pointercancel",p,o)};return r.forEach(a=>{!hk(a)&&a.getAttribute("tabindex")===null&&(a.tabIndex=0),(n.useGlobalTarget?window:a).addEventListener("pointerdown",s,o),a.addEventListener("focus",c=>mk(c,o),o)}),i}function yk(e){return e==="x"||e==="y"?rn[e]?null:(rn[e]=!0,()=>{rn[e]=!1}):rn.x||rn.y?null:(rn.x=rn.y=!0,()=>{rn.x=rn.y=!1})}const ux=new Set(["width","height","top","left","right","bottom",...Yo]);let la;function xk(){la=void 0}const Tn={now:()=>(la===void 0&&Tn.set(ot.isProcessing||p2.useManualTiming?ot.timestamp:performance.now()),la),set:e=>{la=e,queueMicrotask(xk)}};function tf(e,t){e.indexOf(t)===-1&&e.push(t)}function nf(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class rf{constructor(){this.subscriptions=[]}add(t){return tf(this.subscriptions,t),()=>nf(this.subscriptions,t)}notify(t,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class Sk{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{const i=Tn.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),o&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Tn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=vk(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new rf);const r=this.events[t].add(n);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,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Tn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Th)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Th);return cx(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),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.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ji(e,t){return new Sk(e,t)}function wk(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ji(n))}function Ck(e,t){const n=vl(e,t);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const s in i){const a=F2(i[s]);wk(e,s,a)}}function bk(e){return!!(pt(e)&&e.add)}function Sc(e,t){const n=e.getValue("willChange");if(bk(n))return n.add(t)}function dx(e){return e.props[By]}const fx=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,kk=1e-7,jk=12;function Tk(e,t,n,r,o){let i,s,a=0;do s=t+(n-t)/2,i=fx(s,r,o)-e,i>0?n=s:t=s;while(Math.abs(i)>kk&&++aTk(i,0,1,e,n);return i=>i===0||i===1?i:fx(o(i),t,r)}const px=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,hx=e=>t=>1-e(1-t),mx=ps(.33,1.53,.69,.99),of=hx(mx),gx=px(of),yx=e=>(e*=2)<1?.5*of(e):.5*(2-Math.pow(2,-10*(e-1))),sf=e=>1-Math.sin(Math.acos(e)),xx=hx(sf),vx=px(sf),Sx=e=>/^0[^.\s]+$/u.test(e);function Ek(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Sx(e):!0}const Ei=e=>Math.round(e*1e5)/1e5,af=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Pk(e){return e==null}const Rk=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lf=(e,t)=>n=>!!(typeof n=="string"&&Rk.test(n)&&n.startsWith(e)||t&&!Pk(n)&&Object.prototype.hasOwnProperty.call(n,t)),wx=(e,t,n)=>r=>{if(typeof r!="string")return r;const[o,i,s,a]=r.match(af);return{[e]:parseFloat(o),[t]:parseFloat(i),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},Ak=e=>Un(0,255,e),ru={...qo,transform:e=>Math.round(Ak(e))},Or={test:lf("rgb","red"),parse:wx("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+ru.transform(e)+", "+ru.transform(t)+", "+ru.transform(n)+", "+Ei(Qi.transform(r))+")"};function Nk(e){let t="",n="",r="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const wc={test:lf("#"),parse:Nk,transform:Or.transform},vo={test:lf("hsl","hue"),parse:wx("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+jn.transform(Ei(t))+", "+jn.transform(Ei(n))+", "+Ei(Qi.transform(r))+")"},ct={test:e=>Or.test(e)||wc.test(e)||vo.test(e),parse:e=>Or.test(e)?Or.parse(e):vo.test(e)?vo.parse(e):wc.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Or.transform(e):vo.transform(e)},Dk=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function zk(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(af))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Dk))===null||n===void 0?void 0:n.length)||0)>0}const Cx="number",bx="color",Fk="var",Mk="var(",Eh="${}",Ik=/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 Zi(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=t.replace(Ik,l=>(ct.test(l)?(r.color.push(i),o.push(bx),n.push(ct.parse(l))):l.startsWith(Mk)?(r.var.push(i),o.push(Fk),n.push(l)):(r.number.push(i),o.push(Cx),n.push(parseFloat(l))),++i,Eh)).split(Eh);return{values:n,split:a,indexes:r,types:o}}function kx(e){return Zi(e).values}function jx(e){const{split:t,types:n}=Zi(e),r=t.length;return o=>{let i="";for(let s=0;stypeof e=="number"?0:e;function Ok(e){const t=kx(e);return jx(e)(t.map(Lk))}const yr={test:zk,parse:kx,createTransformer:jx,getAnimatableNone:Ok},_k=new Set(["brightness","contrast","saturate","opacity"]);function Vk(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(af)||[];if(!r)return e;const o=n.replace(r,"");let i=_k.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+o+")"}const Bk=/\b([a-z-]*)\(.*?\)/gu,Cc={...yr,getAnimatableNone:e=>{const t=e.match(Bk);return t?t.map(Vk).join(" "):e}},Uk={...Hd,color:ct,backgroundColor:ct,outlineColor:ct,fill:ct,stroke:ct,borderColor:ct,borderTopColor:ct,borderRightColor:ct,borderBottomColor:ct,borderLeftColor:ct,filter:Cc,WebkitFilter:Cc},uf=e=>Uk[e];function Tx(e,t){let n=uf(e);return n!==Cc&&(n=yr),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const $k=new Set(["auto","none","0"]);function Wk(e,t,n){let r=0,o;for(;re===qo||e===Z,Rh=(e,t)=>parseFloat(e.split(", ")[t]),Ah=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Rh(o[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?Rh(i[1],e):0}},Hk=new Set(["x","y","z"]),Kk=Yo.filter(e=>!Hk.has(e));function Gk(e){const t=[];return Kk.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const _o={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Ah(4,13),y:Ah(5,14)};_o.translateX=_o.x;_o.translateY=_o.y;const Ur=new Set;let bc=!1,kc=!1;function Ex(){if(kc){const e=Array.from(Ur).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const o=Gk(r);o.length&&(n.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([i,s])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(s)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}kc=!1,bc=!1,Ur.forEach(e=>e.complete()),Ur.clear()}function Px(){Ur.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(kc=!0)})}function Yk(){Px(),Ex()}class cf{constructor(t,n,r,o,i,s=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=o,this.element=i,this.isAsync=s}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ur.add(this),bc||(bc=!0,Pe.read(Px),Pe.resolveKeyframes(Ex))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:o}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),qk=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Xk(e){const t=qk.exec(e);if(!t)return[,];const[,n,r,o]=t;return[`--${n??r}`,o]}function Ax(e,t,n=1){const[r,o]=Xk(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const s=i.trim();return Rx(s)?parseFloat(s):s}return Wd(o)?Ax(o,t,n+1):o}const Nx=e=>t=>t.test(e),Qk={test:e=>e==="auto",parse:e=>e},Dx=[qo,Z,jn,Qn,V2,_2,Qk],Nh=e=>Dx.find(Nx(e));class zx extends cf{constructor(t,n,r,o,i){super(t,n,r,o,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l{n.getValue(l).set(c)}),this.resolveNoneKeyframes()}}const Dh=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(yr.test(e)||e==="0")&&!e.startsWith("url("));function Jk(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Sl(e,{repeat:t,repeatType:n="loop"},r){const o=e.filter(ej),i=t&&n!=="loop"&&t%2===1?0:o.length-1;return!i||r===void 0?o[i]:r}const tj=40;class Fx{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:i=0,repeatType:s="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Tn.now(),this.options={autoplay:t,delay:n,type:r,repeat:o,repeatDelay:i,repeatType:s,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>tj?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Yk(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Tn.now(),this.hasAttemptedResolve=!0;const{name:r,type:o,velocity:i,delay:s,onComplete:a,onUpdate:l,isGenerator:c}=this.options;if(!c&&!Zk(t,r,o,i))if(s)this.options.duration=0;else{l&&l(Sl(t,this.options,n)),a&&a(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const ze=(e,t,n)=>e+(t-e)*n;function ou(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function nj({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let o=0,i=0,s=0;if(!t)o=i=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;o=ou(l,a,e+1/3),i=ou(l,a,e),s=ou(l,a,e-1/3)}return{red:Math.round(o*255),green:Math.round(i*255),blue:Math.round(s*255),alpha:r}}function Ba(e,t){return n=>n>0?t:e}const iu=(e,t,n)=>{const r=e*e,o=n*(t*t-r)+r;return o<0?0:Math.sqrt(o)},rj=[wc,Or,vo],oj=e=>rj.find(t=>t.test(e));function zh(e){const t=oj(e);if(!t)return!1;let n=t.parse(e);return t===vo&&(n=nj(n)),n}const Fh=(e,t)=>{const n=zh(e),r=zh(t);if(!n||!r)return Ba(e,t);const o={...n};return i=>(o.red=iu(n.red,r.red,i),o.green=iu(n.green,r.green,i),o.blue=iu(n.blue,r.blue,i),o.alpha=ze(n.alpha,r.alpha,i),Or.transform(o))},ij=(e,t)=>n=>t(e(n)),hs=(...e)=>e.reduce(ij),jc=new Set(["none","hidden"]);function sj(e,t){return jc.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function aj(e,t){return n=>ze(e,t,n)}function df(e){return typeof e=="number"?aj:typeof e=="string"?Wd(e)?Ba:ct.test(e)?Fh:cj:Array.isArray(e)?Mx:typeof e=="object"?ct.test(e)?Fh:lj:Ba}function Mx(e,t){const n=[...e],r=n.length,o=e.map((i,s)=>df(i)(i,t[s]));return i=>{for(let s=0;s{for(const i in r)n[i]=r[i](o);return n}}function uj(e,t){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i{const n=yr.createTransformer(t),r=Zi(e),o=Zi(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?jc.has(e)&&!o.values.length||jc.has(t)&&!r.values.length?sj(e,t):hs(Mx(uj(r,o),o.values),n):Ba(e,t)};function Ix(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?ze(e,t,n):df(e)(e,t)}const dj=5;function Lx(e,t,n){const r=Math.max(t-dj,0);return cx(n-e(r),t-r)}const _e={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},su=.001;function fj({duration:e=_e.duration,bounce:t=_e.bounce,velocity:n=_e.velocity,mass:r=_e.mass}){let o,i,s=1-t;s=Un(_e.minDamping,_e.maxDamping,s),e=Un(_e.minDuration,_e.maxDuration,Ln(e)),s<1?(o=c=>{const d=c*s,f=d*e,p=d-n,v=Tc(c,s),x=Math.exp(-f);return su-p/v*x},i=c=>{const f=c*s*e,p=f*n+n,v=Math.pow(s,2)*Math.pow(c,2)*e,x=Math.exp(-f),w=Tc(Math.pow(c,2),s);return(-o(c)+su>0?-1:1)*((p-v)*x)/w}):(o=c=>{const d=Math.exp(-c*e),f=(c-n)*e+1;return-su+d*f},i=c=>{const d=Math.exp(-c*e),f=(n-c)*(e*e);return d*f});const a=5/e,l=hj(o,i,a);if(e=In(e),isNaN(l))return{stiffness:_e.stiffness,damping:_e.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:s*2*Math.sqrt(r*c),duration:e}}}const pj=12;function hj(e,t,n){let r=n;for(let o=1;oe[n]!==void 0)}function yj(e){let t={velocity:_e.velocity,stiffness:_e.stiffness,damping:_e.damping,mass:_e.mass,isResolvedFromDuration:!1,...e};if(!Mh(e,gj)&&Mh(e,mj))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,i=2*Un(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:_e.mass,stiffness:o,damping:i}}else{const n=fj(e);t={...t,...n,mass:_e.mass},t.isResolvedFromDuration=!0}return t}function Ox(e=_e.visualDuration,t=_e.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=n;const i=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:c,mass:d,duration:f,velocity:p,isResolvedFromDuration:v}=yj({...n,velocity:-Ln(n.velocity||0)}),x=p||0,w=c/(2*Math.sqrt(l*d)),m=s-i,g=Ln(Math.sqrt(l/d)),y=Math.abs(m)<5;r||(r=y?_e.restSpeed.granular:_e.restSpeed.default),o||(o=y?_e.restDelta.granular:_e.restDelta.default);let S;if(w<1){const j=Tc(g,w);S=E=>{const N=Math.exp(-w*g*E);return s-N*((x+w*g*m)/j*Math.sin(j*E)+m*Math.cos(j*E))}}else if(w===1)S=j=>s-Math.exp(-g*j)*(m+(x+g*m)*j);else{const j=g*Math.sqrt(w*w-1);S=E=>{const N=Math.exp(-w*g*E),b=Math.min(j*E,300);return s-N*((x+w*g*m)*Math.sinh(b)+j*m*Math.cosh(b))/j}}const k={calculatedDuration:v&&f||null,next:j=>{const E=S(j);if(v)a.done=j>=f;else{let N=0;w<1&&(N=j===0?In(x):Lx(S,j,E));const b=Math.abs(N)<=r,B=Math.abs(s-E)<=o;a.done=b&&B}return a.value=a.done?s:E,a},toString:()=>{const j=Math.min(nx(k),xc),E=rx(N=>k.next(j*N).value,j,30);return j+"ms "+E}};return k}function Ih({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:s,min:a,max:l,restDelta:c=.5,restSpeed:d}){const f=e[0],p={done:!1,value:f},v=b=>a!==void 0&&bl,x=b=>a===void 0?l:l===void 0||Math.abs(a-b)-w*Math.exp(-b/r),S=b=>g+y(b),k=b=>{const B=y(b),I=S(b);p.done=Math.abs(B)<=c,p.value=p.done?g:I};let j,E;const N=b=>{v(p.value)&&(j=b,E=Ox({keyframes:[p.value,x(p.value)],velocity:Lx(S,b,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:d}))};return N(0),{calculatedDuration:null,next:b=>{let B=!1;return!E&&j===void 0&&(B=!0,k(b),N(b)),j!==void 0&&b>=j?E.next(b-j):(!B&&k(b),p)}}}const xj=ps(.42,0,1,1),vj=ps(0,0,.58,1),_x=ps(.42,0,.58,1),Sj=e=>Array.isArray(e)&&typeof e[0]!="number",wj={linear:Lt,easeIn:xj,easeInOut:_x,easeOut:vj,circIn:sf,circInOut:vx,circOut:xx,backIn:of,backInOut:gx,backOut:mx,anticipate:yx},Lh=e=>{if(Zd(e)){Iy(e.length===4);const[t,n,r,o]=e;return ps(t,n,r,o)}else if(typeof e=="string")return wj[e];return e};function Cj(e,t,n){const r=[],o=n||Ix,i=e.length-1;for(let s=0;st[0];if(i===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Cj(t,r,o),l=a.length,c=d=>{if(s&&d1)for(;fc(Un(e[0],e[i-1],d)):c}function kj(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const o=Lo(0,t,r);e.push(ze(n,1,o))}}function jj(e){const t=[0];return kj(t,e.length-1),t}function Tj(e,t){return e.map(n=>n*t)}function Ej(e,t){return e.map(()=>t||_x).splice(0,e.length-1)}function Ua({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const o=Sj(r)?r.map(Lh):Lh(r),i={done:!1,value:t[0]},s=Tj(n&&n.length===t.length?n:jj(t),e),a=bj(s,t,{ease:Array.isArray(o)?o:Ej(t,o)});return{calculatedDuration:e,next:l=>(i.value=a(l),i.done=l>=e,i)}}const Pj=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Pe.update(t,!0),stop:()=>gr(t),now:()=>ot.isProcessing?ot.timestamp:Tn.now()}},Rj={decay:Ih,inertia:Ih,tween:Ua,keyframes:Ua,spring:Ox},Aj=e=>e/100;class ff extends Fx{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:r,element:o,keyframes:i}=this.options,s=(o==null?void 0:o.KeyframeResolver)||cf,a=(l,c)=>this.onKeyframesResolved(l,c);this.resolver=new s(i,a,n,r,o),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i,velocity:s=0}=this.options,a=Jd(n)?n:Rj[n]||Ua;let l,c;a!==Ua&&typeof t[0]!="number"&&(l=hs(Aj,Ix(t[0],t[1])),t=[0,100]);const d=a({...this.options,keyframes:t});i==="mirror"&&(c=a({...this.options,keyframes:[...t].reverse(),velocity:-s})),d.calculatedDuration===null&&(d.calculatedDuration=nx(d));const{calculatedDuration:f}=d,p=f+o,v=p*(r+1)-o;return{generator:d,mirroredGenerator:c,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:p,totalDuration:v}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:b}=this.options;return{done:!0,value:b[b.length-1]}}const{finalKeyframe:o,generator:i,mirroredGenerator:s,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:c,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:p,repeat:v,repeatType:x,repeatDelay:w,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-p*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>d;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let S=this.currentTime,k=i;if(v){const b=Math.min(this.currentTime,d)/f;let B=Math.floor(b),I=b%1;!I&&b>=1&&(I=1),I===1&&B--,B=Math.min(B,v+1),!!(B%2)&&(x==="reverse"?(I=1-I,w&&(I-=w/f)):x==="mirror"&&(k=s)),S=Un(0,1,I)*f}const j=y?{done:!1,value:l[0]}:k.next(S);a&&(j.value=a(j.value));let{done:E}=j;!y&&c!==null&&(E=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const N=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return N&&o!==void 0&&(j.value=Sl(l,this.options,o)),m&&m(j.value),N&&this.finish(),j}get duration(){const{resolved:t}=this;return t?Ln(t.calculatedDuration):0}get time(){return Ln(this.currentTime)}set time(t){t=In(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Ln(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=Pj,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const o=this.driver.now();this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=o):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Nj=new Set(["opacity","clipPath","filter","transform"]);function Dj(e,t,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:s="loop",ease:a="easeInOut",times:l}={}){const c={[t]:n};l&&(c.offset=l);const d=ix(a,o);return Array.isArray(d)&&(c.easing=d),e.animate(c,{delay:r,duration:o,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:s==="reverse"?"alternate":"normal"})}const zj=Ld(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),$a=10,Fj=2e4;function Mj(e){return Jd(e.type)||e.type==="spring"||!ox(e.ease)}function Ij(e,t){const n=new ff({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const o=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(s,a),n,r,o),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:o,ease:i,type:s,motionValue:a,name:l,startTime:c}=this.options;if(!a.owner||!a.owner.current)return!1;if(typeof i=="string"&&Va()&&Lj(i)&&(i=Vx[i]),Mj(this.options)){const{onComplete:f,onUpdate:p,motionValue:v,element:x,...w}=this.options,m=Ij(t,w);t=m.keyframes,t.length===1&&(t[1]=t[0]),r=m.duration,o=m.times,i=m.ease,s="keyframes"}const d=Dj(a.owner.current,l,t,{...this.options,duration:r,times:o,ease:i});return d.startTime=c??this.calcStartTime(),this.pendingTimeline?(Ch(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;a.set(Sl(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:o,type:s,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Ln(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Ln(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=In(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Lt;const{animation:r}=n;Ch(r,t)}return Lt}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:o,type:i,ease:s,times:a}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:c,onUpdate:d,onComplete:f,element:p,...v}=this.options,x=new ff({...v,keyframes:r,duration:o,type:i,ease:s,times:a,isGenerator:!0}),w=In(this.time);c.setWithVelocity(x.sample(w-$a).value,x.sample(w).value,$a)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:o,repeatType:i,damping:s,type:a}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=n.owner.getProps();return zj()&&r&&Nj.has(r)&&!l&&!c&&!o&&i!=="mirror"&&s!==0&&a!=="inertia"}}const Oj={type:"spring",stiffness:500,damping:25,restSpeed:10},_j=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Vj={type:"keyframes",duration:.8},Bj={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Uj=(e,{keyframes:t})=>t.length>2?Vj:Zr.has(e)?e.startsWith("scale")?_j(t[1]):Oj:Bj;function $j({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:s,repeatDelay:a,from:l,elapsed:c,...d}){return!!Object.keys(d).length}const pf=(e,t,n,r={},o,i)=>s=>{const a=Qd(r,e)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-In(l);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:p=>{t.set(p),a.onUpdate&&a.onUpdate(p)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:i?void 0:o};$j(a)||(d={...d,...Uj(e,d)}),d.duration&&(d.duration=In(d.duration)),d.repeatDelay&&(d.repeatDelay=In(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const p=Sl(d.keyframes,a);if(p!==void 0)return Pe.update(()=>{d.onUpdate(p),d.onComplete()}),new lk([])}return!i&&Oh.supports(d)?new Oh(d):new ff(d)};function Wj({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Bx(e,t,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:s=e.getDefaultTransition(),transitionEnd:a,...l}=t;r&&(s=r);const c=[],d=o&&e.animationState&&e.animationState.getState()[o];for(const f in l){const p=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),v=l[f];if(v===void 0||d&&Wj(d,f))continue;const x={delay:n,...Qd(s||{},f)};let w=!1;if(window.MotionHandoffAnimation){const g=dx(e);if(g){const y=window.MotionHandoffAnimation(g,f,Pe);y!==null&&(x.startTime=y,w=!0)}}Sc(e,f),p.start(pf(f,p,v,e.shouldReduceMotion&&ux.has(f)?{type:!1}:x,e,w));const m=p.animation;m&&c.push(m)}return a&&Promise.all(c).then(()=>{Pe.update(()=>{a&&Ck(e,a)})}),c}function Ec(e,t,n={}){var r;const o=vl(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const s=o?()=>Promise.all(Bx(e,o,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:p}=i;return Hj(e,t,d+c,f,p,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[c,d]=l==="beforeChildren"?[s,a]:[a,s];return c().then(()=>d())}else return Promise.all([s(),a(n.delay)])}function Hj(e,t,n=0,r=0,o=1,i){const s=[],a=(e.variantChildren.size-1)*r,l=o===1?(c=0)=>c*r:(c=0)=>a-c*r;return Array.from(e.variantChildren).sort(Kj).forEach((c,d)=>{c.notify("AnimationStart",t),s.push(Ec(c,t,{...i,delay:n+l(d)}).then(()=>c.notify("AnimationComplete",t)))}),Promise.all(s)}function Kj(e,t){return e.sortNodePosition(t)}function Gj(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const o=t.map(i=>Ec(e,i,n));r=Promise.all(o)}else if(typeof t=="string")r=Ec(e,t,n);else{const o=typeof t=="function"?vl(e,t,n.custom):t;r=Promise.all(Bx(e,o,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const Yj=_d.length;function Ux(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Ux(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>Gj(e,n,r)))}function Jj(e){let t=Qj(e),n=_h(),r=!0;const o=l=>(c,d)=>{var f;const p=vl(e,d,l==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(p){const{transition:v,transitionEnd:x,...w}=p;c={...c,...w,...x}}return c};function i(l){t=l(e)}function s(l){const{props:c}=e,d=Ux(e.parent)||{},f=[],p=new Set;let v={},x=1/0;for(let m=0;mx&&k,B=!1;const I=Array.isArray(S)?S:[S];let V=I.reduce(o(g),{});j===!1&&(V={});const{prevResolvedValues:oe={}}=y,le={...oe,...V},he=D=>{b=!0,p.has(D)&&(B=!0,p.delete(D)),y.needsAnimating[D]=!0;const F=e.getValue(D);F&&(F.liveStyle=!1)};for(const D in le){const F=V[D],W=oe[D];if(v.hasOwnProperty(D))continue;let G=!1;yc(F)&&yc(W)?G=!tx(F,W):G=F!==W,G?F!=null?he(D):p.add(D):F!==void 0&&p.has(D)?he(D):y.protectedKeys[D]=!0}y.prevProp=S,y.prevResolvedValues=V,y.isActive&&(v={...v,...V}),r&&e.blockInitialAnimation&&(b=!1),b&&(!(E&&N)||B)&&f.push(...I.map(D=>({animation:D,options:{type:g}})))}if(p.size){const m={};p.forEach(g=>{const y=e.getBaseTarget(g),S=e.getValue(g);S&&(S.liveStyle=!0),m[g]=y??null}),f.push({animation:m})}let w=!!f.length;return r&&(c.initial===!1||c.initial===c.animate)&&!e.manuallyAnimateOnMount&&(w=!1),r=!1,w?t(f):Promise.resolve()}function a(l,c){var d;if(n[l].isActive===c)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(p=>{var v;return(v=p.animationState)===null||v===void 0?void 0:v.setActive(l,c)}),n[l].isActive=c;const f=s(l);for(const p in n)n[p].protectedKeys={};return f}return{animateChanges:s,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=_h(),r=!0}}}function Zj(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!tx(t,e):!1}function Rr(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function _h(){return{animate:Rr(!0),whileInView:Rr(),whileHover:Rr(),whileTap:Rr(),whileDrag:Rr(),whileFocus:Rr(),exit:Rr()}}class br{constructor(t){this.isMounted=!1,this.node=t}update(){}}class eT extends br{constructor(t){super(t),t.animationState||(t.animationState=Jj(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();yl(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let tT=0;class nT extends br{constructor(){super(...arguments),this.id=tT++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const o=this.node.animationState.setActive("exit",!t);n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const rT={animation:{Feature:eT},exit:{Feature:nT}};function es(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function ms(e){return{point:{x:e.pageX,y:e.pageY}}}const oT=e=>t=>ef(t)&&e(t,ms(t));function Pi(e,t,n,r){return es(e,t,oT(n),r)}const Vh=(e,t)=>Math.abs(e-t);function iT(e,t){const n=Vh(e.x,t.x),r=Vh(e.y,t.y);return Math.sqrt(n**2+r**2)}class $x{constructor(t,n,{transformPagePoint:r,contextWindow:o,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=lu(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,v=iT(f.offset,{x:0,y:0})>=3;if(!p&&!v)return;const{point:x}=f,{timestamp:w}=ot;this.history.push({...x,timestamp:w});const{onStart:m,onMove:g}=this.handlers;p||(m&&m(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=au(p,this.transformPagePoint),Pe.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:v,onSessionEnd:x,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=lu(f.type==="pointercancel"?this.lastMoveEventInfo:au(p,this.transformPagePoint),this.history);this.startEvent&&v&&v(f,m),x&&x(f,m)},!ef(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=o||window;const s=ms(t),a=au(s,this.transformPagePoint),{point:l}=a,{timestamp:c}=ot;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=n;d&&d(t,lu(a,this.history)),this.removeListeners=hs(Pi(this.contextWindow,"pointermove",this.handlePointerMove),Pi(this.contextWindow,"pointerup",this.handlePointerUp),Pi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),gr(this.updatePoint)}}function au(e,t){return t?{point:t(e.point)}:e}function Bh(e,t){return{x:e.x-t.x,y:e.y-t.y}}function lu({point:e},t){return{point:e,delta:Bh(e,Wx(t)),offset:Bh(e,sT(t)),velocity:aT(t,.1)}}function sT(e){return e[0]}function Wx(e){return e[e.length-1]}function aT(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=Wx(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>In(t)));)n--;if(!r)return{x:0,y:0};const i=Ln(o.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const s={x:(o.x-r.x)/i,y:(o.y-r.y)/i};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}const Hx=1e-4,lT=1-Hx,uT=1+Hx,Kx=.01,cT=0-Kx,dT=0+Kx;function _t(e){return e.max-e.min}function fT(e,t,n){return Math.abs(e-t)<=n}function Uh(e,t,n,r=.5){e.origin=r,e.originPoint=ze(t.min,t.max,e.origin),e.scale=_t(n)/_t(t),e.translate=ze(n.min,n.max,e.origin)-e.originPoint,(e.scale>=lT&&e.scale<=uT||isNaN(e.scale))&&(e.scale=1),(e.translate>=cT&&e.translate<=dT||isNaN(e.translate))&&(e.translate=0)}function Ri(e,t,n,r){Uh(e.x,t.x,n.x,r?r.originX:void 0),Uh(e.y,t.y,n.y,r?r.originY:void 0)}function $h(e,t,n){e.min=n.min+t.min,e.max=e.min+_t(t)}function pT(e,t,n){$h(e.x,t.x,n.x),$h(e.y,t.y,n.y)}function Wh(e,t,n){e.min=t.min-n.min,e.max=e.min+_t(t)}function Ai(e,t,n){Wh(e.x,t.x,n.x),Wh(e.y,t.y,n.y)}function hT(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?ze(n,e,r.max):Math.min(e,n)),e}function Hh(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function mT(e,{top:t,left:n,bottom:r,right:o}){return{x:Hh(e.x,n,o),y:Hh(e.y,t,r)}}function Kh(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Lo(t.min,t.max-r,e.min):r>o&&(n=Lo(e.min,e.max-o,t.min)),Un(0,1,n)}function xT(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Pc=.35;function vT(e=Pc){return e===!1?e=0:e===!0&&(e=Pc),{x:Gh(e,"left","right"),y:Gh(e,"top","bottom")}}function Gh(e,t,n){return{min:Yh(e,t),max:Yh(e,n)}}function Yh(e,t){return typeof e=="number"?e:e[t]||0}const qh=()=>({translate:0,scale:1,origin:0,originPoint:0}),So=()=>({x:qh(),y:qh()}),Xh=()=>({min:0,max:0}),Ue=()=>({x:Xh(),y:Xh()});function Kt(e){return[e("x"),e("y")]}function Gx({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function ST({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function wT(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function uu(e){return e===void 0||e===1}function Rc({scale:e,scaleX:t,scaleY:n}){return!uu(e)||!uu(t)||!uu(n)}function Dr(e){return Rc(e)||Yx(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Yx(e){return Qh(e.x)||Qh(e.y)}function Qh(e){return e&&e!=="0%"}function Wa(e,t,n){const r=e-n,o=t*r;return n+o}function Jh(e,t,n,r,o){return o!==void 0&&(e=Wa(e,o,r)),Wa(e,n,r)+t}function Ac(e,t=0,n=1,r,o){e.min=Jh(e.min,t,n,r,o),e.max=Jh(e.max,t,n,r,o)}function qx(e,{x:t,y:n}){Ac(e.x,t.translate,t.scale,t.originPoint),Ac(e.y,n.translate,n.scale,n.originPoint)}const Zh=.999999999999,em=1.0000000000001;function CT(e,t,n,r=!1){const o=n.length;if(!o)return;t.x=t.y=1;let i,s;for(let a=0;aZh&&(t.x=1),t.yZh&&(t.y=1)}function wo(e,t){e.min=e.min+t,e.max=e.max+t}function tm(e,t,n,r,o=.5){const i=ze(e.min,e.max,o);Ac(e,t,n,i,r)}function Co(e,t){tm(e.x,t.x,t.scaleX,t.scale,t.originX),tm(e.y,t.y,t.scaleY,t.scale,t.originY)}function Xx(e,t){return Gx(wT(e.getBoundingClientRect(),t))}function bT(e,t,n){const r=Xx(e,n),{scroll:o}=t;return o&&(wo(r.x,o.offset.x),wo(r.y,o.offset.y)),r}const Qx=({current:e})=>e?e.ownerDocument.defaultView:null,kT=new WeakMap;class jT{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=Ue(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const o=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ms(d).point)},i=(d,f)=>{const{drag:p,dragPropagation:v,onDragStart:x}=this.getProps();if(p&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=yk(p),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Kt(m=>{let g=this.getAxisMotionValue(m).get()||0;if(jn.test(g)){const{projection:y}=this.visualElement;if(y&&y.layout){const S=y.layout.layoutBox[m];S&&(g=_t(S)*(parseFloat(g)/100))}}this.originPoint[m]=g}),x&&Pe.postRender(()=>x(d,f)),Sc(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},s=(d,f)=>{const{dragPropagation:p,dragDirectionLock:v,onDirectionLock:x,onDrag:w}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:m}=f;if(v&&this.currentDirection===null){this.currentDirection=TT(m),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",f.point,m),this.updateAxis("y",f.point,m),this.visualElement.render(),w&&w(d,f)},a=(d,f)=>this.stop(d,f),l=()=>Kt(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new $x(t,{onSessionStart:o,onStart:i,onMove:s,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:Qx(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:i}=this.getProps();i&&Pe.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!Ws(t,o,this.currentDirection))return;const i=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=hT(s,this.constraints[t],this.elastic[t])),i.set(s)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&xo(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&o?this.constraints=mT(o.layoutBox,n):this.constraints=!1,this.elastic=vT(r),i!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&Kt(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=xT(o.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!xo(t))return!1;const r=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const i=bT(r,o.root,this.visualElement.getTransformPagePoint());let s=gT(o.layout.layoutBox,i);if(n){const a=n(ST(s));this.hasMutatedConstraints=!!a,a&&(s=Gx(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Kt(d=>{if(!Ws(d,n,this.currentDirection))return;let f=l&&l[d]||{};s&&(f={min:0,max:0});const p=o?200:1e6,v=o?40:1e7,x={type:"inertia",velocity:r?t[d]:0,bounceStiffness:p,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,x)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Sc(this.visualElement,t),r.start(pf(t,r,0,n,this.visualElement,!1))}stopAnimation(){Kt(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Kt(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Kt(n=>{const{drag:r}=this.getProps();if(!Ws(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,i=this.getAxisMotionValue(n);if(o&&o.layout){const{min:s,max:a}=o.layout.layoutBox[n];i.set(t[n]-ze(s,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!xo(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Kt(s=>{const a=this.getAxisMotionValue(s);if(a&&this.constraints!==!1){const l=a.get();o[s]=yT({min:l,max:l},this.constraints[s])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Kt(s=>{if(!Ws(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:c}=this.constraints[s];a.set(ze(l,c,o[s]))})}addListeners(){if(!this.visualElement.current)return;kT.set(this.visualElement,this);const t=this.visualElement.current,n=Pi(t,"pointerdown",l=>{const{drag:c,dragListener:d=!0}=this.getProps();c&&d&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();xo(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,i=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Pe.read(r);const s=es(window,"resize",()=>this.scalePositionWithinConstraints()),a=o.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(Kt(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=l[d].translate,f.set(f.get()+l[d].translate))}),this.visualElement.render())});return()=>{s(),n(),i(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:i=!1,dragElastic:s=Pc,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:i,dragElastic:s,dragMomentum:a}}}function Ws(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function TT(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class ET extends br{constructor(t){super(t),this.removeGroupControls=Lt,this.removeListeners=Lt,this.controls=new jT(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Lt}unmount(){this.removeGroupControls(),this.removeListeners()}}const nm=e=>(t,n)=>{e&&Pe.postRender(()=>e(t,n))};class PT extends br{constructor(){super(...arguments),this.removePointerDownListener=Lt}onPointerDown(t){this.session=new $x(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Qx(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:nm(t),onStart:nm(n),onMove:r,onEnd:(i,s)=>{delete this.session,o&&Pe.postRender(()=>o(i,s))}}}mount(){this.removePointerDownListener=Pi(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ua={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function rm(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ci={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Z.test(e))e=parseFloat(e);else return e;const n=rm(e,t.target.x),r=rm(e,t.target.y);return`${n}% ${r}%`}},RT={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,o=yr.parse(e);if(o.length>5)return r;const i=yr.createTransformer(e),s=typeof o[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;o[0+s]/=a,o[1+s]/=l;const c=ze(a,l,.5);return typeof o[2+s]=="number"&&(o[2+s]/=c),typeof o[3+s]=="number"&&(o[3+s]/=c),i(o)}};class AT extends h.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:i}=t;X2(NT),i&&(n.group&&n.group.add(i),r&&r.register&&o&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),ua.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:i}=this.props,s=r.projection;return s&&(s.isPresent=i,o||t.layoutDependency!==n||n===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?s.promote():s.relegate()||Pe.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Bd.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Jx(e){const[t,n]=Fy(),r=h.useContext(zd);return u.jsx(AT,{...e,layoutGroup:r,switchLayoutGroup:h.useContext(Uy),isPresent:t,safeToRemove:n})}const NT={borderRadius:{...ci,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ci,borderTopRightRadius:ci,borderBottomLeftRadius:ci,borderBottomRightRadius:ci,boxShadow:RT};function DT(e,t,n){const r=pt(e)?e:Ji(e);return r.start(pf("",r,t,n)),r.animation}function zT(e){return e instanceof SVGElement&&e.tagName!=="svg"}const FT=(e,t)=>e.depth-t.depth;class MT{constructor(){this.children=[],this.isDirty=!1}add(t){tf(this.children,t),this.isDirty=!0}remove(t){nf(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(FT),this.isDirty=!1,this.children.forEach(t)}}function IT(e,t){const n=Tn.now(),r=({timestamp:o})=>{const i=o-n;i>=t&&(gr(r),e(i-t))};return Pe.read(r,!0),()=>gr(r)}const Zx=["TopLeft","TopRight","BottomLeft","BottomRight"],LT=Zx.length,om=e=>typeof e=="string"?parseFloat(e):e,im=e=>typeof e=="number"||Z.test(e);function OT(e,t,n,r,o,i){o?(e.opacity=ze(0,n.opacity!==void 0?n.opacity:1,_T(r)),e.opacityExit=ze(t.opacity!==void 0?t.opacity:1,0,VT(r))):i&&(e.opacity=ze(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let s=0;srt?1:n(Lo(e,t,r))}function am(e,t){e.min=t.min,e.max=t.max}function Ht(e,t){am(e.x,t.x),am(e.y,t.y)}function lm(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function um(e,t,n,r,o){return e-=t,e=Wa(e,1/n,r),o!==void 0&&(e=Wa(e,1/o,r)),e}function BT(e,t=0,n=1,r=.5,o,i=e,s=e){if(jn.test(t)&&(t=parseFloat(t),t=ze(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=ze(i.min,i.max,r);e===i&&(a-=t),e.min=um(e.min,t,n,a,o),e.max=um(e.max,t,n,a,o)}function cm(e,t,[n,r,o],i,s){BT(e,t[n],t[r],t[o],t.scale,i,s)}const UT=["x","scaleX","originX"],$T=["y","scaleY","originY"];function dm(e,t,n,r){cm(e.x,t,UT,n?n.x:void 0,r?r.x:void 0),cm(e.y,t,$T,n?n.y:void 0,r?r.y:void 0)}function fm(e){return e.translate===0&&e.scale===1}function tv(e){return fm(e.x)&&fm(e.y)}function pm(e,t){return e.min===t.min&&e.max===t.max}function WT(e,t){return pm(e.x,t.x)&&pm(e.y,t.y)}function hm(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function nv(e,t){return hm(e.x,t.x)&&hm(e.y,t.y)}function mm(e){return _t(e.x)/_t(e.y)}function gm(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class HT{constructor(){this.members=[]}add(t){tf(this.members,t),t.scheduleRender()}remove(t){if(nf(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(o=>t===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const i=this.members[o];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(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:o}=t.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.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)}}function KT(e,t,n){let r="";const o=e.x.translate/t.x,i=e.y.translate/t.y,s=(n==null?void 0:n.z)||0;if((o||i||s)&&(r=`translate3d(${o}px, ${i}px, ${s}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:d,rotateX:f,rotateY:p,skewX:v,skewY:x}=n;c&&(r=`perspective(${c}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),p&&(r+=`rotateY(${p}deg) `),v&&(r+=`skewX(${v}deg) `),x&&(r+=`skewY(${x}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const zr={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},yi=typeof window<"u"&&window.MotionDebug!==void 0,cu=["","X","Y","Z"],GT={visibility:"hidden"},ym=1e3;let YT=0;function du(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function rv(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=dx(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Pe,!(o||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&rv(r)}function ov({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(s={},a=t==null?void 0:t()){this.id=YT++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,yi&&(zr.totalNodes=zr.resolvedTargetDeltas=zr.recalculatedProjection=0),this.nodes.forEach(QT),this.nodes.forEach(nE),this.nodes.forEach(rE),this.nodes.forEach(JT),yi&&window.MotionDebug.record(zr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=IT(p,250),ua.hasAnimatedSinceResize&&(ua.hasAnimatedSinceResize=!1,this.nodes.forEach(vm))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:p,hasRelativeTargetChanged:v,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||d.getDefaultTransition()||lE,{onLayoutAnimationStart:m,onLayoutAnimationComplete:g}=d.getProps(),y=!this.targetLayout||!nv(this.targetLayout,x)||v,S=!p&&v;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||S||p&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,S);const k={...Qd(w,"layout"),onPlay:m,onComplete:g};(d.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k)}else p||vm(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,gr(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(oE),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&rv(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const j=k/1e3;Sm(f.x,s.x,j),Sm(f.y,s.y,j),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ai(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),sE(this.relativeTarget,this.relativeTargetOrigin,p,j),S&&WT(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=Ue()),Ht(S,this.relativeTarget)),w&&(this.animationValues=d,OT(d,c,this.latestValues,j,y,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(gr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Pe.update(()=>{ua.hasAnimatedSinceResize=!0,this.currentAnimation=DT(0,ym,{...s,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onComplete:()=>{s.onComplete&&s.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 s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ym),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:d}=s;if(!(!a||!l||!c)){if(this!==s&&this.layout&&c&&iv(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Ue();const f=_t(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+f;const p=_t(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+p}Ht(a,l),Co(a,d),Ri(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new HT),this.sharedNodes.get(s).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var s;const{layoutId:a}=this.options;return a?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:a}=this.options;return a?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&du("z",s,c,this.animationValues);for(let d=0;d{var a;return(a=s.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(xm),this.root.sharedNodes.clear()}}}function qT(e){e.updateLayout()}function XT(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:o}=e.layout,{animationType:i}=e.options,s=n.source!==e.layout.source;i==="size"?Kt(f=>{const p=s?n.measuredBox[f]:n.layoutBox[f],v=_t(p);p.min=r[f].min,p.max=p.min+v}):iv(i,n.layoutBox,r)&&Kt(f=>{const p=s?n.measuredBox[f]:n.layoutBox[f],v=_t(r[f]);p.max=p.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+v)});const a=So();Ri(a,r,n.layoutBox);const l=So();s?Ri(l,e.applyTransform(o,!0),n.measuredBox):Ri(l,r,n.layoutBox);const c=!tv(a);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:p,layout:v}=f;if(p&&v){const x=Ue();Ai(x,n.layoutBox,p.layoutBox);const w=Ue();Ai(w,r,v.layoutBox),nv(x,w)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=x,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function QT(e){yi&&zr.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function JT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ZT(e){e.clearSnapshot()}function xm(e){e.clearMeasurements()}function eE(e){e.isLayoutDirty=!1}function tE(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function vm(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function nE(e){e.resolveTargetDelta()}function rE(e){e.calcProjection()}function oE(e){e.resetSkewAndRotation()}function iE(e){e.removeLeadSnapshot()}function Sm(e,t,n){e.translate=ze(t.translate,0,n),e.scale=ze(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function wm(e,t,n,r){e.min=ze(t.min,n.min,r),e.max=ze(t.max,n.max,r)}function sE(e,t,n,r){wm(e.x,t.x,n.x,r),wm(e.y,t.y,n.y,r)}function aE(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const lE={duration:.45,ease:[.4,0,.1,1]},Cm=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),bm=Cm("applewebkit/")&&!Cm("chrome/")?Math.round:Lt;function km(e){e.min=bm(e.min),e.max=bm(e.max)}function uE(e){km(e.x),km(e.y)}function iv(e,t,n){return e==="position"||e==="preserve-aspect"&&!fT(mm(t),mm(n),.2)}function cE(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const dE=ov({attachResizeListener:(e,t)=>es(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),fu={current:void 0},sv=ov({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!fu.current){const e=new dE({});e.mount(window),e.setOptions({layoutScroll:!0}),fu.current=e}return fu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),fE={pan:{Feature:PT},drag:{Feature:ET,ProjectionNode:sv,MeasureLayout:Jx}};function jm(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,i=r[o];i&&Pe.postRender(()=>i(t,ms(t)))}class pE extends br{mount(){const{current:t}=this.node;t&&(this.unmount=fk(t,n=>(jm(this.node,n,"Start"),r=>jm(this.node,r,"End"))))}unmount(){}}class hE extends br{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=hs(es(this.node.current,"focus",()=>this.onFocus()),es(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Tm(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),i=r[o];i&&Pe.postRender(()=>i(t,ms(t)))}class mE extends br{mount(){const{current:t}=this.node;t&&(this.unmount=gk(t,n=>(Tm(this.node,n,"Start"),(r,{success:o})=>Tm(this.node,r,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Nc=new WeakMap,pu=new WeakMap,gE=e=>{const t=Nc.get(e.target);t&&t(e)},yE=e=>{e.forEach(gE)};function xE({root:e,...t}){const n=e||document;pu.has(n)||pu.set(n,{});const r=pu.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(yE,{root:e,...t})),r[o]}function vE(e,t,n){const r=xE(t);return Nc.set(e,n),r.observe(e),()=>{Nc.delete(e),r.unobserve(e)}}const SE={some:0,all:1};class wE extends br{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:i}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:SE[o]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),p=c?d:f;p&&p(l)};return vE(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(CE(t,n))&&this.startObserver()}unmount(){}}function CE({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const bE={inView:{Feature:wE},tap:{Feature:mE},focus:{Feature:hE},hover:{Feature:pE}},kE={layout:{ProjectionNode:sv,MeasureLayout:Jx}},Dc={current:null},av={current:!1};function jE(){if(av.current=!0,!!Id)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Dc.current=e.matches;e.addListener(t),t()}else Dc.current=!1}const TE=[...Dx,ct,yr],EE=e=>TE.find(Nx(e)),Em=new WeakMap;function PE(e,t,n){for(const r in t){const o=t[r],i=n[r];if(pt(o))e.addValue(r,o);else if(pt(i))e.addValue(r,Ji(o,{owner:e}));else if(i!==o)if(e.hasValue(r)){const s=e.getValue(r);s.liveStyle===!0?s.jump(o):s.hasAnimated||s.set(o)}else{const s=e.getStaticValue(r);e.addValue(r,Ji(s!==void 0?s:o,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Pm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class RE{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:i,visualState:s},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=cf,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const v=Tn.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),av.current||jE(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Dc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Em.delete(this.current),this.projection&&this.projection.unmount(),gr(this.notifyUpdate),gr(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Zr.has(t),o=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Pe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{o(),i(),s&&s(),n.owner&&n.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 Oo){const n=Oo[t];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[t]&&o&&r(this.props)&&(this.features[t]=new o(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ue()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Ji(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let o=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return o!=null&&(typeof o=="string"&&(Rx(o)||Sx(o))?o=parseFloat(o):!EE(o)&&yr.test(n)&&(o=Tx(t,n)),this.setBaseTarget(t,pt(o)?o.get():o)),pt(o)?o.get():o}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let o;if(typeof r=="string"||typeof r=="object"){const s=$d(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);s&&(o=s[t])}if(r&&o!==void 0)return o;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!pt(i)?i:this.initialValues[t]!==void 0&&o===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new rf),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class lv extends RE{constructor(){super(...arguments),this.KeyframeResolver=zx}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;pt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function AE(e){return window.getComputedStyle(e)}class NE extends lv{constructor(){super(...arguments),this.type="html",this.renderInstance=qy}readValueFromInstance(t,n){if(Zr.has(n)){const r=uf(n);return r&&r.default||0}else{const r=AE(t),o=(Ky(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Xx(t,n)}build(t,n,r){Kd(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Xd(t,n,r)}}class DE extends lv{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ue}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Zr.has(n)){const r=uf(n);return r&&r.default||0}return n=Xy.has(n)?n:Vd(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Zy(t,n,r)}build(t,n,r){Gd(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,o){Qy(t,n,r,o)}mount(t){this.isSVGTag=qd(t.tagName),super.mount(t)}}const zE=(e,t)=>Ud(e)?new DE(t):new NE(t,{allowProjection:e!==h.Fragment}),FE=ik({...rT,...bE,...fE,...kE},zE),vn=S2(FE),ME=4,oo=5,uv=-5;function IE(e,t,n,r,o){for(const s of e){const a=String(s.id);if(!t.has(a)&&!n.has(a)&&!r[a]&&s.username!==o)return s}if(e.some(s=>!t.has(String(s.id))&&!r[String(s.id)]&&s.username!==o))for(const s of e){const a=String(s.id);if(!t.has(a)&&!r[a]&&s.username!==o)return s}return null}function LE(e,t,n,r,o){const i=new Set(t?[t]:[]);let s=null;for(const l of e){const c=String(l.id);if(!i.has(c)&&!n.has(c)&&!r[c]&&l.username!==o){s=l;break}}if(s)return{nextPost:s,shouldResetShown:!1};if(e.some(l=>!i.has(String(l.id))&&!r[String(l.id)]&&l.username!==o)){for(const l of e){const c=String(l.id);if(!i.has(c)&&!r[c]&&l.username!==o){s=l;break}}return{nextPost:s,shouldResetShown:!0}}return{nextPost:null,shouldResetShown:!1}}function Rm(e,t,n=uv){return t?e.filter(r=>(r.votes??0)>n):e}function OE(e,t,n,r,o=uv){return e.filter(i=>!t[String(i.id)]&&i.username!==n&&(!r||(i.votes??0)>o))}function _E(e,t,n,r,o,i,s,a){return s===0||a||!r?!1:(e==="swipe"&&!t||e!=="swipe"&&n===0)&&!o&&!i}function Am(e,t,n=10){let r;return e.direction===t?r={direction:t,count:e.count+1}:r={direction:t,count:1},{newStreak:r,triggerPopup:r.count===n}}function Nm(e,t){return`voteCooldownEnd_${e!==void 0&&e||t}`}function VE(e,t,n=oo){return!e&&t>=n}function BE(e,t,n,r,o){if(o==="swipe"){const d=e.find(f=>f.username!==r&&!t[String(f.id)]);return d?{slots:[],swipePostId:String(d.id)}:{slots:[],swipePostId:null}}const i=e.filter(d=>d.username!==r),s=i.filter(d=>!t[String(d.id)]),a=i.filter(d=>!!t[String(d.id)]);return{slots:[...s,...a].slice(0,n).map(d=>({postId:String(d.id),animState:"visible"})),swipePostId:null}}function UE(e,t,n){var o;let r=0;for(const i of e)((o=i.userVotes)!=null&&o[n]||t[String(i.id)])&&r++;return r}const $E=["Bless you, child!","A righteous decree!","The heavens approve!","Divine wisdom!","Hallelujah!","Most holy!","The angels sing!","Heaven smiles upon thee!","A blessed choice!","Virtue rewarded!","Grace be with you!","So it is written!","Amen to that!","Truly inspired!","The light shines!"],WE=["Deliciously wicked...","Yes, yessss!","Chaos reigns!","How sinfully good...","I approve...","Mwahahaha!","Embrace the dark!","A soul after my own...","Wicked choice!","Burn it all!","Sweet corruption...","Diabolically good!","Feed the flames!","The abyss applauds!","Perfectly evil..."];function HE(){var kf;const[e,t]=h.useState([]),[n,r]=h.useState(!0),[o,i]=h.useState(null),[s,a]=h.useState(""),[l,c]=h.useState(()=>{try{const C=b?`userVotes_${b}`:"userVotes_guest",R=localStorage.getItem(C);if(R)return JSON.parse(R)}catch{}return{}}),[d,f]=h.useState("random"),[p,v]=h.useState(0),[x,w]=h.useState(0),[m,g]=h.useState({}),[y,S]=h.useState([]),[k,j]=h.useState(!1),[E,N]=h.useState(!1),{user:b,openLoginModal:B}=Cr(),I=localStorage.getItem("guestSwipeCount"),V=parseInt(I||"0",10),oe=VE(b,V),le=h.useRef(oe);le.current=oe;const he=Ho(),{getDonorStatus:Ce,loadDonorStatuses:je}=Jr(),D=Wn("(max-width: 768px)"),[F,W]=h.useState(null),[G,q]=h.useState(!1),[de,Be]=h.useState(!1),[Ne,Re]=h.useState(!1),[X,Ze]=h.useState(!1),[ye,fn]=h.useState(()=>{const C=localStorage.getItem("hideDownvoted");return C===null?!0:C==="true"}),en=h.useRef(ye);h.useEffect(()=>{en.current=ye},[ye]);const En=h.useCallback(()=>{fn(C=>{const R=!C;return localStorage.setItem("hideDownvoted",String(R)),R})},[]),[Se,mt]=h.useState("swipe"),[L,te]=h.useState("top"),[ue,we]=h.useState(10),et=h.useRef(null),[tt,pn]=h.useState("month"),[Ut,At]=h.useState([]),Nt=h.useRef(!1),[tn,gt]=h.useState(null),[Pn,Dt]=h.useState(0),[He,A]=h.useState(null),U=h.useRef(null),[ce,Y]=h.useState(null),[K,be]=h.useState(null),Ie=h.useRef({direction:"up",count:0}),[me,T]=h.useState(null),_=h.useRef(null),[H,ee]=h.useState(!1),[se,at]=h.useState(null),$t=h.useRef(null),eo=h.useRef(Array.from({length:250},()=>({x:Math.random()*96+1,y:Math.random()*96+1,size:14+Math.random()*24,delay:Math.random()*1}))),kr=C=>`shownPostIds_${C!==void 0?C||localStorage.getItem("guestVoterId")||"guest":localStorage.getItem("fm_username")||localStorage.getItem("guestVoterId")||"guest"}`,wt=h.useRef((()=>{try{const C=localStorage.getItem(kr());if(C)return new Set(JSON.parse(C))}catch{}return new Set})()),hn=()=>{try{localStorage.setItem(kr(b),JSON.stringify([...wt.current]))}catch{}},gs=()=>{wt.current=new Set;try{localStorage.removeItem(kr(b))}catch{}},Hn=h.useRef(parseInt(localStorage.getItem("guestSwipeCount")||"0",10)),[Le,mn]=h.useState(()=>b?!1:parseInt(localStorage.getItem("guestSwipeCount")||"0",10)>=oo),Rn=h.useRef((()=>{const C=localStorage.getItem("guestVoterId");if(C)return C;const R=`guest_${Math.random().toString(36).slice(2,10)}`;return localStorage.setItem("guestVoterId",R),R})()),Xo=5*60,gn=C=>C!==void 0?Nm(C,Rn.current):Nm(void 0,localStorage.getItem("fm_username")||Rn.current),[Oe,jr]=h.useState(()=>{const C=gn(),R=localStorage.getItem(C);if(R){const z=parseInt(R,10);if(z>Date.now())return z;localStorage.removeItem(C)}return null}),[Kn,Tr]=h.useState(()=>Oe?Math.max(0,Math.ceil((Oe-Date.now())/1e3)):0);h.useEffect(()=>{if(tt==="month"||Nt.current)return;(async()=>{try{const R=await Pb();At(Array.isArray(R)?R:[]),Nt.current=!0}catch(R){console.error("Failed to fetch archived posts:",R)}})()},[tt]);const ys=h.useMemo(()=>{if(tt==="month")return e;const C=new Set(e.map(z=>String(z.id))),R=Ut.filter(z=>!C.has(String(z.id)));if(tt==="year"){const z=new Date().getFullYear().toString(),O=R.filter(Q=>{var ne;return(ne=Q.createdAt)==null?void 0:ne.startsWith(z)});return[...e,...O]}return[...e,...R]},[e,Ut,tt]),Er=h.useMemo(()=>{const R=[...Rm(ys,ye)];switch(d){case"top":return R.sort((z,O)=>(O.votes??0)-(z.votes??0));case"hot":return R.sort((z,O)=>{const Q=Date.now(),ne=z.createdAt?new Date(z.createdAt).getTime():0,J=O.createdAt?new Date(O.createdAt).getTime():0,pe=Math.max((Q-ne)/36e5,.1),Xe=Math.max((Q-J)/36e5,.1),nt=(z.votes??0)/Math.pow(pe,1.5);return(O.votes??0)/Math.pow(Xe,1.5)-nt});case"new":return R.sort((z,O)=>{const Q=z.createdAt?new Date(z.createdAt).getTime():0;return(O.createdAt?new Date(O.createdAt).getTime():0)-Q});case"random":return R.sort(()=>Math.random()-.5);case"swipe":return R.sort(()=>Math.random()-.5);default:return R}},[ys,d,p,ye]),Wt=h.useMemo(()=>{const R=[...Rm(ys,ye)];switch(L){case"top":return R.sort((z,O)=>(O.votes??0)-(z.votes??0));case"hot":return R.sort((z,O)=>{const Q=Date.now(),ne=z.createdAt?new Date(z.createdAt).getTime():0,J=O.createdAt?new Date(O.createdAt).getTime():0,pe=Math.max((Q-ne)/36e5,.1),Xe=Math.max((Q-J)/36e5,.1),nt=(z.votes??0)/Math.pow(pe,1.5);return(O.votes??0)/Math.pow(Xe,1.5)-nt});case"new":return R.sort((z,O)=>{const Q=z.createdAt?new Date(z.createdAt).getTime():0;return(O.createdAt?new Date(O.createdAt).getTime():0)-Q});case"random":return R.sort(()=>Math.random()-.5);default:return R}},[ys,L,p,ye]),xs=h.useMemo(()=>Wt.slice(0,ue),[Wt,ue]),hf=h.useCallback(C=>IE(Er,C,wt.current,Ct.current,b),[Er]),Ct=h.useRef(l);h.useEffect(()=>{Ct.current=l},[l]);const vs=h.useRef(Er);h.useEffect(()=>{vs.current=Er},[Er]);const Qo=h.useRef(Oe);h.useEffect(()=>{Qo.current=Oe},[Oe]),h.useEffect(()=>{_.current=me},[me]);const Jo=h.useCallback(()=>{if(Qo.current&&Qo.current>Date.now())return;if(le.current){mn(!0),A(null),S([]);return}const{slots:C,swipePostId:R}=BE(vs.current,Ct.current,ME,b,d);if(d==="swipe"){S([]),R?(A(R),wt.current.add(R),hn()):A(null),gt(null),Y(null),U.current=null;return}A(null),gt(null),Y(null),U.current=null,C.forEach(z=>wt.current.add(z.postId)),hn(),S(C)},[d,b]);h.useEffect(()=>{(async()=>{try{const R=await pl();t(R);const z=b?`userVotes_${b}`:"userVotes_guest",O=localStorage.getItem(z);if(O){const ne=JSON.parse(O);c(ne)}const Q={};await Promise.all(R.map(async ne=>{try{const J=await Py(String(ne.id));Q[String(ne.id)]=(J.comments||[]).length}catch{Q[String(ne.id)]=0}})),g(Q)}catch(R){console.error("Error fetching posts:",R),i("Failed to load posts.")}finally{r(!1)}})()},[b,x]),h.useEffect(()=>{if(e.length>0){const C=e.map(R=>R.username).filter(R=>!!R&&R!=="unknown");C.length>0&&je(C)}},[e,je]);const cv=h.useCallback(C=>e.filter(R=>R.username===C).reduce((R,z)=>R+(z.votes??0),0),[e]),dv=h.useCallback(C=>{const R=e.filter(z=>z.username===C&&z.createdAt);return R.length===0?null:R.reduce((z,O)=>new Date(O.createdAt).getTime(){if(e.length===0)return;const C=b?`userVotes_${b}`:"userVotes_guest",R=localStorage.getItem(C),z=R?JSON.parse(R):{};c(O=>({...O,...z}))},[b,e]);const[Gn,fv]=h.useState(!1);h.useEffect(()=>{Er.length>0&&!Gn&&fv(!0)},[Er.length]),h.useEffect(()=>{if(Gn){if(oe){mn(!0),A(null),S([]);return}Jo()}},[Gn,d,p,oe]),h.useEffect(()=>{Gn&&(gs(),setTimeout(()=>Jo(),50))},[ye]),h.useEffect(()=>{D&&Gn&&f("swipe")},[D,Gn]),h.useEffect(()=>{const C=b?`userVotes_${b}`:"userVotes_guest";localStorage.setItem(C,JSON.stringify(l))},[l,b]);const mf=h.useMemo(()=>UE(e,l,b||Rn.current),[e,l,b]),gf=e.length,yf=h.useCallback(()=>{const C=et.current;C&&C.scrollHeight-C.scrollTop-C.clientHeight<200&&we(R=>{const z=Wt.length;return R>=z?R:Math.min(R+10,z)})},[Wt.length]),Zo=h.useCallback(C=>{mt(C),we(10),at(null),C==="swipe"&&(f(D?"swipe":"random"),v(R=>R+1))},[D]),pv=()=>b?!0:(B(),!1),xf=async C=>{var R;if(C.preventDefault(),!!pv()&&s.trim())try{const z=await jb(s.trim(),b);z.createdAt||(z.createdAt=new Date().toISOString()),t(O=>[...O,z]),a(""),j(!0),setTimeout(()=>j(!1),4e3),mt("comments"),te("new"),we(10),gs(),setTimeout(()=>v(O=>O+1),0)}catch(z){console.error("Failed to create post:",z),((R=z.response)==null?void 0:R.status)===429?N(!0):alert("Could not create new commandment.")}},hv=(C,R)=>{const z=String(C),O=l[z],Q=R==="up"?1:-1;t(J=>J.map(pe=>String(pe.id)!==z?pe:{...pe,votes:(pe.votes??0)+Q})),c(J=>({...J,[z]:R}));const ne=b||Rn.current;ih(z,R,ne).then(J=>{t(pe=>pe.map(Xe=>String(Xe.id)===String(J.id)?{...Xe,votes:J.votes,userVotes:J.userVotes}:Xe))}).catch(J=>{var pe,Xe,nt;if(t(xe=>xe.map(re=>String(re.id)!==z?re:{...re,votes:(re.votes??0)-Q})),c(xe=>{const re={...xe};return O?re[z]=O:delete re[z],re}),((pe=J==null?void 0:J.response)==null?void 0:pe.status)===429&&((nt=(Xe=J==null?void 0:J.response)==null?void 0:Xe.data)!=null&&nt.cooldownEnd)){const xe=J.response.data.cooldownEnd;jr(xe),Tr(Math.max(0,Math.ceil((xe-Date.now())/1e3))),An.current=!0,localStorage.setItem(gn(b),String(xe))}console.error("Vote failed:",J)})},vf=h.useCallback(C=>{const R=b,z=R||Rn.current,O=Ct.current,Q=vs.current,ne=OE(Q,O,R,en.current),J={},pe=[];for(const xe of ne){const re=String(xe.id);J[re]=C,pe.push(re)}if(pe.length>0&&kb(pe,C,z).catch(xe=>console.error("Bulk vote failed:",xe)),c(xe=>({...xe,...J})),t(xe=>xe.map(re=>{const zt=String(re.id);if(!J[zt])return re;const Yn=re.votes??0;return{...re,votes:Yn+(C==="up"?1:-1)}})),A(null),S([]),!An.current){An.current=!0;const xe=Date.now()+Xo*1e3;jr(xe),Tr(Xo),Qo.current=xe,localStorage.setItem(gn(b),String(xe));const re=b||Rn.current;sh(re).catch(()=>{})}at({type:C,emojiCount:250});const nt=setTimeout(()=>{const xe=setInterval(()=>{at(re=>!re||re.emojiCount<=2?(clearInterval(xe),$t.current=null,re?{...re,emojiCount:0}:null):{...re,emojiCount:re.emojiCount-2})},30);$t.current=xe},1500);return()=>{clearTimeout(nt)}},[b]);h.useEffect(()=>()=>{$t.current&&clearInterval($t.current)},[]);const wl=h.useRef(He);h.useEffect(()=>{wl.current=He},[He]);const Ss=h.useCallback(()=>{if(le.current){mn(!0),A(null);return}const C=wl.current,{nextPost:R,shouldResetShown:z}=LE(vs.current,C,wt.current,Ct.current,b);if(z&&(wt.current=new Set),R){const O=String(R.id);wt.current.add(O),hn(),A(O),Dt(Q=>Q+1)}else A(null)},[b]);h.useEffect(()=>{b&&Le&&(mn(!1),Hn.current=0,localStorage.removeItem("guestSwipeCount"),d==="swipe"?Ss():Jo())},[b,Le,Ss,d,Jo]),h.useEffect(()=>{!b&&e.length>0&&Hn.current>=oo&&(mn(!0),A(null),S([]))},[b,e.length]);const An=h.useRef(!1),ei=h.useRef(!1),Sf=h.useRef(b);h.useEffect(()=>{const C=Sf.current;if(Sf.current=b,C&&!b){const ne=gn(C),J=localStorage.getItem(ne);if(J){const pe=parseInt(J,10);if(pe>Date.now()){const Xe=gn(null);localStorage.setItem(Xe,String(pe))}}}const R=ne=>{jr(ne),Tr(Math.max(0,Math.ceil((ne-Date.now())/1e3))),An.current=!0,localStorage.setItem(gn(b),String(ne))},z=()=>{jr(null),Tr(0),An.current=!1,ei.current=!1,gs(),c({}),Ct.current={};const ne=b?`userVotes_${b}`:"userVotes_guest";localStorage.removeItem(ne),v(J=>J+1)},O=gn(b),Q=localStorage.getItem(O);if(Q){const ne=parseInt(Q,10);if(ne>Date.now()){R(ne);return}localStorage.removeItem(O)}b?Tb(b).then(ne=>{ne.cooldown&&ne.cooldownEnd>Date.now()?R(ne.cooldownEnd):z()}).catch(()=>{z()}):z()},[b]),h.useEffect(()=>{if(ei.current||!Gn)return;(d==="swipe"?!!He:y.length>0)&&(ei.current=!0)},[Gn,d,He,y.length]),h.useEffect(()=>{if(_E(d,He,y.length,ei.current,Oe,An.current,e.length,Le)){An.current=!0,Ie.current={direction:"up",count:0};const C=Date.now()+Xo*1e3;jr(C),Tr(Xo),localStorage.setItem(gn(b),String(C));const R=b||Rn.current;sh(R).catch(()=>{})}},[He,y.length,e.length,d,Oe,Le,Xo,b]),h.useEffect(()=>{Oe&&Oe>Date.now()&&(A(null),S([]))},[Oe]),h.useEffect(()=>{if(!Oe)return;const C=setInterval(()=>{const R=Math.max(0,Math.ceil((Oe-Date.now())/1e3));if(Tr(R),R<=0){clearInterval(C),jr(null),Qo.current=null,localStorage.removeItem(gn(b)),gs(),Ie.current={direction:"up",count:0},An.current=!1,ei.current=!1,c({}),Ct.current={};const z=b?`userVotes_${b}`:"userVotes_guest";localStorage.removeItem(z);const O=b||Rn.current;Eb(O).catch(()=>{}),w(Q=>Q+1),v(Q=>Q+1)}},1e3);return()=>clearInterval(C)},[Oe,Jo,b]);const ws=C=>{const R=Math.floor(C/60),z=C%60;return`${R}:${z.toString().padStart(2,"0")}`},wf=h.useCallback(C=>{if(_.current)return;const R=parseInt(localStorage.getItem("guestSwipeCount")||"0",10);if(!localStorage.getItem("fm_username")&&R>=oo){mn(!0),A(null);return}if(Oe&&Oe>Date.now()){ee(!0),setTimeout(()=>ee(!1),600);return}if(le.current){mn(!0),A(null);return}const O=wl.current;if(!O)return;const Q=e.find(re=>String(re.id)===O);if(!Q)return;const ne=Ct.current[O],J=C==="up"?1:-1,pe=(Q.votes??0)+J;t(re=>re.map(zt=>String(zt.id)!==O?zt:{...zt,votes:(zt.votes??0)+J})),Ct.current={...Ct.current,[O]:C},c(re=>({...re,[O]:C}));const Xe=b||Rn.current;if(ih(O,C,Xe).then(re=>{t(zt=>zt.map(Yn=>String(Yn.id)===String(re.id)?{...Yn,votes:re.votes,userVotes:re.userVotes}:Yn))}).catch(re=>{var zt,Yn,jf;if(t(Pr=>Pr.map(qn=>String(qn.id)!==O?qn:{...qn,votes:(qn.votes??0)-J})),c(Pr=>{const qn={...Pr};return ne?qn[O]=ne:delete qn[O],qn}),Ct.current={...Ct.current},ne?Ct.current[O]=ne:delete Ct.current[O],((zt=re==null?void 0:re.response)==null?void 0:zt.status)===429&&((jf=(Yn=re==null?void 0:re.response)==null?void 0:Yn.data)!=null&&jf.cooldownEnd)){const Pr=re.response.data.cooldownEnd;jr(Pr),Tr(Math.max(0,Math.ceil((Pr-Date.now())/1e3))),An.current=!0,localStorage.setItem(gn(b),String(Pr))}console.error("Vote failed:",re)}),!b&&(Hn.current+=1,localStorage.setItem("guestSwipeCount",String(Hn.current)),Hn.current>=oo)){le.current=!0,mn(!0),A(null);return}if(U.current=C,gt({direction:C,delta:J,newTotal:pe}),Y(C),setTimeout(()=>Y(null),700),Math.random()<.35){const re=C==="up"?$E:WE,zt=re[Math.floor(Math.random()*re.length)];be({text:zt,type:C==="up"?"angel":"demon"}),setTimeout(()=>be(null),2e3)}const{newStreak:nt,triggerPopup:xe}=Am(Ie.current,C);Ie.current=nt,xe&&T(C),Ss()},[e,b,Ss,Oe]),Cf=(C,R)=>{if(me)return;if(Oe&&Oe>Date.now()){ee(!0),setTimeout(()=>ee(!1),600);return}if(le.current){mn(!0),S([]);return}const z=String(C),O=e.find(J=>String(J.id)===z);if(b&&(O==null?void 0:O.username)===b)return;hv(z,R);const{newStreak:Q,triggerPopup:ne}=Am(Ie.current,R);if(Ie.current=Q,ne&&T(R),!b&&(Hn.current+=1,localStorage.setItem("guestSwipeCount",String(Hn.current)),Hn.current>=oo)){le.current=!0,mn(!0),S([]);return}S(J=>J.map(pe=>pe.postId===z?{...pe,animState:"voted"}:pe)),setTimeout(()=>{S(J=>J.map(pe=>pe.postId===z?{...pe,animState:"fadingOut"}:pe))},150),setTimeout(()=>{S(J=>{const pe=new Set(J.map(nt=>nt.postId)),Xe=hf(pe);if(Xe){const nt=String(Xe.id);return wt.current.add(nt),hn(),J.map(xe=>xe.postId===z?{postId:nt,animState:"fadingIn"}:xe)}else return J.filter(nt=>nt.postId!==z)}),setTimeout(()=>{S(J=>J.map(pe=>pe.animState==="fadingIn"?{...pe,animState:"visible"}:pe))},50)},450)},mv=C=>{const R=String(C);S(z=>z.map(O=>O.postId===R?{...O,animState:"fadingOut"}:O)),setTimeout(()=>{S(z=>{const O=new Set(z.map(ne=>ne.postId)),Q=hf(O);if(Q){const ne=String(Q.id);return wt.current.add(ne),hn(),z.map(J=>J.postId===R?{postId:ne,animState:"fadingIn"}:J)}else return z.filter(ne=>ne.postId!==R)}),setTimeout(()=>{S(z=>z.map(O=>O.animState==="fadingIn"?{...O,animState:"visible"}:O))},50)},300)},gv=C=>{switch(C){case"voted":return{opacity:.6,transform:"scale(0.97)",borderColor:"#d4af37"};case"fadingOut":return{opacity:0,transform:"translateY(-10px) scale(0.95)"};case"fadingIn":return{opacity:0,transform:"translateY(10px)"};case"visible":default:return{opacity:1,transform:"translateY(0)"}}},bf=C=>e.find(R=>String(R.id)===C);return n?u.jsxs("div",{className:"loading-screen",children:[u.jsxs("div",{className:"loading-tablets",children:[u.jsxs("div",{className:"loading-tablet left-tablet",children:[u.jsx("div",{className:"tablet-arch"}),u.jsx("div",{className:"tablet-body"}),u.jsxs("div",{className:"chisel-sparks",children:[u.jsx("span",{className:"spark",children:"✦"}),u.jsx("span",{className:"spark",children:"✧"}),u.jsx("span",{className:"spark",children:"✦"})]})]}),u.jsx("div",{className:"loading-chisel",children:u.jsx("div",{className:"chisel-tool"})}),u.jsxs("div",{className:"loading-tablet right-tablet",children:[u.jsx("div",{className:"tablet-arch"}),u.jsx("div",{className:"tablet-body"})]})]}),u.jsx("p",{className:"loading-text",children:"Loading morals...."})]}):o?u.jsx("p",{className:"p-4 text-red-600",children:o}):u.jsxs("div",{style:{background:D?"#0a0804":"linear-gradient(180deg, #1a2a4a 0%, #2a4a7a 20%, #4a7ab5 40%, #7ab0e0 60%, #a8d4f0 80%, #d4ecfa 100%)",position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:D?"0":"0.5rem",overflow:D?"hidden":"auto"},children:[Array.from({length:32},(C,R)=>u.jsx("div",{className:`cloud cloud-${R+1}`},R)),u.jsxs("div",{style:{backgroundColor:D?"#0a0804":"rgba(20, 15, 5, 0.92)",borderRadius:D?"0":"10px",padding:D?"0.3rem 0.75rem 0.3rem":"0.75rem 1.5rem",maxWidth:D?"100%":"1100px",width:D?"100%":"95%",height:D?"100%":void 0,boxShadow:D?"none":"0 4px 20px rgba(0,0,0,0.5), 0 0 15px rgba(212, 175, 55, 0.15)",border:D?"none":"2px solid #d4af37",position:"relative",zIndex:2,boxSizing:"border-box",display:D?"flex":void 0,flexDirection:D?"column":void 0,overflow:D?"hidden":void 0},children:[D?u.jsxs(u.Fragment,{children:[u.jsx(zy,{onOfferingClick:()=>Re(!0),onMerchClick:()=>q(!0),onCharterClick:()=>Be(!0),onVideosClick:()=>Ze(!0)}),u.jsxs("div",{style:{position:"fixed",top:"0.5rem",right:"0.5rem",zIndex:1e3,display:"flex",gap:"6px",alignItems:"center"},children:[(Se==="swipe"||Se==="comments")&&u.jsxs("div",{onClick:En,style:{backgroundColor:"rgba(20, 15, 5, 0.85)",border:"2px solid rgba(212, 175, 55, 0.3)",borderRadius:"7px",padding:"4px 8px",display:"flex",flexDirection:"column",alignItems:"center",gap:"2px",cursor:"pointer",minHeight:"50px",justifyContent:"center"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[u.jsx("span",{style:{color:ye?"#888":"#d4af37",fontFamily:"'Cinzel', serif",fontWeight:700,fontSize:"0.5rem",letterSpacing:"0.02em",whiteSpace:"nowrap",transition:"color 0.2s ease"},children:"Show"}),u.jsx("div",{style:{width:"32px",height:"18px",borderRadius:"9px",backgroundColor:ye?"rgba(100, 80, 40, 0.5)":"#b79b3d",border:`1.5px solid ${ye?"#555":"#d4af37"}`,position:"relative",transition:"all 0.25s ease",flexShrink:0},children:u.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",backgroundColor:ye?"#888":"#fdf8e6",position:"absolute",top:"2px",left:ye?"2px":"16px",transition:"all 0.25s ease",boxShadow:ye?"none":"0 0 6px rgba(212, 175, 55, 0.4)"}})}),u.jsx("span",{style:{color:ye?"#d4af37":"#888",fontFamily:"'Cinzel', serif",fontWeight:700,fontSize:"0.5rem",letterSpacing:"0.02em",whiteSpace:"nowrap",transition:"color 0.2s ease"},children:"Hide"})]}),u.jsx("span",{style:{color:"#c8b070",fontFamily:"'Cinzel', serif",fontWeight:600,fontSize:"0.4rem",letterSpacing:"0.01em",whiteSpace:"nowrap",opacity:.7},children:"deplorable commandments"})]}),u.jsx("button",{onClick:()=>he("/"),style:{backgroundColor:"rgba(20, 15, 5, 0.85)",border:"2px solid #d4af37",borderRadius:"7px",padding:"12px 13px",boxShadow:"0 0 8px rgba(212, 175, 55, 0.2)",color:"#d4af37",fontFamily:"'Cinzel', serif",fontWeight:700,fontSize:"0.85rem",cursor:"pointer",letterSpacing:"0.06em",minWidth:"50px",minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"},children:"Home"})]})]}):u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:"0.25rem"},children:[u.jsx("div",{className:"login-inline-wrapper",children:u.jsx(La,{})}),u.jsxs("div",{style:{display:"flex",gap:"14px",alignItems:"center"},children:[u.jsxs("div",{onClick:En,style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",padding:"6px 14px",borderRadius:"8px",border:"2px solid rgba(212, 175, 55, 0.3)",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.08)"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent"},children:[u.jsx("span",{style:{color:ye?"#888":"#d4af37",fontFamily:"'Cinzel', serif",fontWeight:700,fontSize:"0.75rem",letterSpacing:"0.03em",transition:"color 0.2s ease",whiteSpace:"nowrap"},children:"Show"}),u.jsx("div",{style:{width:"42px",height:"24px",borderRadius:"12px",backgroundColor:ye?"rgba(100, 80, 40, 0.5)":"#b79b3d",border:`1.5px solid ${ye?"#555":"#d4af37"}`,position:"relative",transition:"all 0.25s ease",flexShrink:0},children:u.jsx("div",{style:{width:"18px",height:"18px",borderRadius:"50%",backgroundColor:ye?"#888":"#fdf8e6",position:"absolute",top:"2px",left:ye?"2px":"20px",transition:"all 0.25s ease",boxShadow:ye?"none":"0 0 8px rgba(212, 175, 55, 0.4)"}})}),u.jsx("span",{style:{color:ye?"#d4af37":"#888",fontFamily:"'Cinzel', serif",fontWeight:700,fontSize:"0.75rem",letterSpacing:"0.03em",transition:"color 0.2s ease",whiteSpace:"nowrap"},children:"Hide"}),u.jsx("span",{style:{color:"#c8b070",fontFamily:"'Cinzel', serif",fontWeight:600,fontSize:"0.7rem",letterSpacing:"0.02em",whiteSpace:"nowrap",opacity:.7},children:"deplorable commandments"})]}),u.jsx("button",{onClick:()=>he("/"),style:{backgroundColor:"transparent",border:"2px solid #d4af37",borderRadius:"8px",padding:"10px 24px",boxShadow:"0 0 10px rgba(212, 175, 55, 0.2)",color:"#d4af37",fontFamily:"'Cinzel', serif",fontWeight:700,fontSize:"1.15rem",cursor:"pointer",letterSpacing:"0.06em",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.12)",C.currentTarget.style.boxShadow="0 0 16px rgba(212, 175, 55, 0.4)"},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent",C.currentTarget.style.boxShadow="0 0 10px rgba(212, 175, 55, 0.2)"},children:"Home"})]})]}),u.jsx("h1",{style:{fontFamily:"'Cinzel', serif",fontSize:D?"2.2rem":"2.5rem",fontWeight:900,textAlign:"center",color:"#c8b070",textShadow:"2px 2px 0px #3a2e0b, -1px -1px 0px #3a2e0b, 1px -1px 0px #3a2e0b, -1px 1px 0px #3a2e0b, 0 0 15px rgba(200, 176, 112, 0.25)",letterSpacing:"0.08em",marginBottom:D?"0.5rem":"0.4rem",marginTop:D?"4rem":void 0,textTransform:"uppercase"},children:D?"Commandments":"Vote on Commandments"}),k&&u.jsx("div",{style:{textAlign:"center",padding:D?"4px 8px":"8px 16px",marginBottom:D?"0.2rem":"0.5rem",backgroundColor:"rgba(90, 122, 80, 0.3)",border:"1px solid #5a7a50",borderRadius:"8px",color:"#a8d89a",fontSize:D?"0.75rem":"0.95rem",fontFamily:"'Cinzel', serif",animation:"fadeIn 0.3s ease"},children:"✦ Commandment submitted! ✦"}),u.jsx("div",{style:{display:"flex",justifyContent:"center",gap:D?"6px":"10px",marginBottom:D?"0.15rem":"0.75rem",width:"100%",padding:D?"0 4px":"0"},children:["swipe","comments","declare"].map(C=>u.jsx("button",{onClick:()=>Zo(C),style:{flex:D?1:void 0,padding:D?"28px 0":"10px 32px",cursor:"pointer",fontWeight:700,fontSize:D?"1.1rem":"1rem",fontFamily:"'Cinzel', serif",letterSpacing:"0.06em",backgroundColor:Se===C?"#b79b3d":"rgba(255,255,255,0.05)",color:Se===C?"#fdf8e6":"#d1b97b",border:Se===C?"2px solid #d4af37":"1.5px solid #555",borderRadius:"8px",transition:"all 0.2s ease",boxShadow:Se===C?"0 0 12px rgba(212, 175, 55, 0.25)":"none",minHeight:D?void 0:"44px"},children:C==="swipe"?"Vote":C.charAt(0).toUpperCase()+C.slice(1)},C))}),Se==="comments"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{style:{display:"flex",justifyContent:"center",gap:D?"5px":"8px",marginBottom:D?"0.15rem":"0.3rem",marginTop:"0.15rem"},children:[["month","Current"],["year","Year"],["all","All Time"]].map(([C,R])=>u.jsx("button",{onClick:()=>{pn(C),we(10)},style:{padding:D?"4px 12px":"6px 18px",borderRadius:"5px",cursor:"pointer",fontWeight:600,fontSize:D?"0.7rem":"0.8rem",fontFamily:"'Cinzel', serif",backgroundColor:tt===C?"#b79b3d":"transparent",color:tt===C?"#fdf8e6":"#d1b97b",border:tt===C?"1.5px solid #d4af37":"1.5px solid #555",transition:"all 0.2s ease"},children:R},C))}),u.jsx("div",{style:{display:"flex",justifyContent:"center",gap:D?"5px":"8px",marginBottom:D?"0.2rem":"0.5rem",flexWrap:"wrap"},children:["top","hot","new","random"].map(C=>u.jsx("button",{onClick:()=>{te(C),we(10),v(R=>R+1)},style:{padding:D?"4px 14px":"6px 20px",borderRadius:"5px",cursor:"pointer",fontWeight:600,fontSize:D?"0.75rem":"0.85rem",fontFamily:"'Cinzel', serif",backgroundColor:L===C?"#b79b3d":"transparent",color:L===C?"#fdf8e6":"#d1b97b",border:L===C?"1.5px solid #d4af37":"1.5px solid #555",transition:"all 0.2s ease"},children:C.charAt(0).toUpperCase()+C.slice(1)},C))})]}),D?u.jsxs(u.Fragment,{children:[e.length===0&&u.jsxs("div",{style:{textAlign:"center",padding:"2.5rem 1rem"},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.2rem",margin:"0 0 12px 0"},children:"The tablets are empty."}),u.jsx("p",{style:{color:"#c8b070",fontSize:"0.9rem",margin:"0 0 8px 0",fontFamily:"'Cinzel', serif"},children:"Be the first to inscribe a commandment."})]}),Se==="swipe"&&e.length>0&&u.jsx("div",{className:"swipe-mode-active",style:{display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"center",flex:1,minHeight:0,position:"relative",width:"100%",padding:"0",overflow:"visible"},children:se?u.jsxs("div",{style:{position:"relative",flex:1,width:"100%",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.92)",borderRadius:"12px"},children:[eo.current.slice(0,se.emojiCount).map((C,R)=>u.jsx(vn.span,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},exit:{opacity:0,scale:0},transition:{duration:.3,delay:C.delay},style:{position:"absolute",left:`${C.x}%`,top:`${C.y}%`,fontSize:`${C.size}px`,lineHeight:1,pointerEvents:"none",filter:"drop-shadow(0 0 4px rgba(0,0,0,0.5))"},children:se.type==="up"?"🙏":"🔥"},R)),u.jsxs(vn.div,{initial:{opacity:0},animate:{opacity:se.emojiCount<=20?1:0},transition:{duration:.6},style:{textAlign:"center",padding:"1.5rem 1rem",zIndex:1},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.1rem",fontWeight:700,margin:"0 0 8px 0",lineHeight:1.4},children:"You've judged all commandments!"}),u.jsx("p",{style:{color:"#c8b070",fontFamily:"'Cinzel', serif",fontSize:"0.85rem",margin:"0 0 6px 0"},children:se.type==="up"?"The heavens rejoice at your mercy.":"The abyss welcomes your wrath."}),Oe&&Kn>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:H?"cooldown-pulse":"",style:{color:"#fdf8e6",fontFamily:"'Cinzel', serif",fontSize:"2rem",fontWeight:900,margin:"12px 0",textShadow:"0 0 12px rgba(212, 175, 55, 0.4)"},children:ws(Kn)}),u.jsx("p",{style:{color:"#c8b070",fontSize:"0.85rem",margin:"0 0 6px 0",fontFamily:"'Cinzel', serif",lineHeight:1.5},children:"Voting reopens soon. In the meantime..."}),u.jsx("p",{style:{color:"#d4af37",fontSize:"0.9rem",margin:"8px 0",fontFamily:"'Cinzel', serif",fontWeight:600},children:"Declare a commandment of your own!"})]}):u.jsx("p",{style:{color:"#c8b070",fontSize:"0.85rem",margin:"8px 0 0 0",fontFamily:"'Cinzel', serif"},children:"Declare a commandment of your own!"}),u.jsx("button",{onClick:()=>Zo("declare"),style:{fontFamily:"'Cinzel', serif",fontSize:"0.95rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"10px",padding:"12px 24px",cursor:"pointer",boxShadow:"0 0 12px rgba(212, 175, 55, 0.25)",marginBottom:"12px"},children:"Declare"}),u.jsx("p",{style:{color:"#888",fontSize:"0.8rem",margin:"8px 0 0 0",fontStyle:"italic"},children:"Or perhaps... go touch some grass."})]})]}):oe||Le?u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1,textAlign:"center",padding:"2rem 1rem"},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.1rem",margin:"0 0 10px 0",fontWeight:700},children:"Create an account to keep voting!"}),u.jsx("p",{style:{color:"#c8b070",fontSize:"0.8rem",margin:"0 0 16px 0",fontFamily:"'Cinzel', serif"},children:"Log in to make your votes count."}),u.jsx("button",{onClick:()=>{B()},style:{fontFamily:"'Cinzel', serif",fontSize:"0.95rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"10px",padding:"12px 24px",cursor:"pointer",textShadow:"1px 1px 2px rgba(0,0,0,0.5)",boxShadow:"0 0 12px rgba(212, 175, 55, 0.4)"},children:"Log In / Sign Up"})]}):u.jsxs(u.Fragment,{children:[He&&u.jsxs("div",{style:{display:"flex",flexDirection:"row",width:"100%",flex:1,minHeight:0},children:[u.jsxs("div",{style:{flex:"1 1 50%",minWidth:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},children:[u.jsx("img",{src:"/angel.png",alt:"Angel",style:{width:"100%",height:"100%",objectFit:"contain",filter:"drop-shadow(0 0 14px rgba(138, 180, 122, 0.6))"}}),u.jsx(no,{children:(K==null?void 0:K.type)==="angel"&&u.jsx(vn.div,{className:"speech-bubble speech-bubble-angel",initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.7},transition:{duration:.25},children:K.text})})]}),u.jsxs("button",{onClick:()=>!Le&&wf("up"),disabled:Le,style:{flex:"1 1 50%",minWidth:0,height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"4px",overflow:"hidden",background:"linear-gradient(180deg, rgba(138, 180, 122, 0.25) 0%, rgba(90, 138, 74, 0.15) 100%)",border:"2px solid rgba(138, 180, 122, 0.5)",borderRadius:"10px",cursor:Le?"default":"pointer",opacity:Le?.3:1,transition:"all 0.15s ease",boxShadow:"0 0 10px rgba(138, 180, 122, 0.2)"},onMouseDown:C=>{Le||(C.currentTarget.style.transform="scale(0.94)")},onMouseUp:C=>{C.currentTarget.style.transform="scale(1)"},onTouchStart:C=>{Le||(C.currentTarget.style.transform="scale(0.94)")},onTouchEnd:C=>{C.currentTarget.style.transform="scale(1)"},children:[u.jsx("span",{style:{fontSize:"clamp(3rem, 12vh, 10rem)",lineHeight:.7,fontFamily:"monospace",color:"#8ab47a"},children:"↑"}),u.jsx("span",{style:{fontSize:"clamp(0.7rem, 2vh, 1.4rem)",fontFamily:"'Cinzel', serif",fontWeight:700,color:"#8ab47a",letterSpacing:"0.08em"},children:"Upvote"})]})]}),u.jsxs("div",{style:{position:"relative",padding:"6px 12px",flexShrink:0,overflow:"visible"},children:[u.jsx(no,{mode:"wait",custom:U.current,onExitComplete:()=>{gt(null),U.current=null},children:He&&!oe&&!Le&&(()=>{var R;const C=bf(He);return C?u.jsxs(vn.div,{className:"swipe-card",custom:U.current,initial:{opacity:0,y:30,scale:.95},animate:{opacity:1,y:0,scale:1,scaleX:1,x:0},exit:z=>{const O=z??U.current,Q=O==="up"?"25%":"-25%";return{opacity:[1,1,1,0],scaleX:[1,.5,.5,.5],x:["0%",Q,Q,Q],y:O==="up"?[0,0,-500,-700]:[0,0,500,700],transition:{duration:.7,times:[0,.3,.75,1],ease:[.4,0,.2,1]}}},transition:{type:"spring",stiffness:300,damping:25},style:{border:"2px solid #d4af37",padding:"20px 10px",borderRadius:"12px",backgroundColor:"rgba(255,255,255,0.05)",boxShadow:"0 0 12px rgba(212, 175, 55, 0.15)",textAlign:"center"},children:[u.jsx("h2",{style:{fontWeight:700,color:"#fdf8e6",fontSize:"1.2rem",margin:"0 0 10px 0",lineHeight:1.4,wordBreak:"break-word"},children:C.title||C.content}),u.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",flexWrap:"wrap"},children:u.jsxs("span",{onClick:z=>{z.stopPropagation(),C.username&&C.username!=="unknown"&&W({username:C.username,x:z.clientX,y:z.clientY})},style:{fontSize:"14px",color:"#d4af37",fontStyle:"italic",cursor:"pointer",textDecoration:"underline",textDecorationColor:"rgba(212, 175, 55, 0.4)",textUnderlineOffset:"3px"},children:["— ",C.username||"unknown",((R=Ce(C.username||""))==null?void 0:R.tier)&&u.jsx(Xt,{tier:Ce(C.username||"").tier,size:"small"})]})})]},Pn):null})()}),u.jsx(no,{children:ce&&u.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,pointerEvents:"none"},children:u.jsx(vn.div,{initial:{opacity:0,scale:.3},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1.8},transition:{duration:.3},style:{fontSize:"6rem",lineHeight:1,filter:"drop-shadow(0 0 30px rgba(0,0,0,0.6))"},children:ce==="down"?"🔥":"🙏"},"swipe-emoji")})}),u.jsx(no,{children:me&&u.jsxs(vn.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.3},style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:20,background:"rgba(0,0,0,0.95)",border:"2px solid #d4af37",borderRadius:"12px",padding:"1rem",textAlign:"center"},children:[u.jsx("p",{style:{color:me==="up"?"#8ab47a":"#c85a4a",fontFamily:"'Cinzel', serif",fontSize:"1rem",fontWeight:700,margin:"0 0 14px 0",lineHeight:1.4},children:me==="up"?"Do you just want to upvote every single commandment?":"Do you just want to downvote every single commandment?"}),u.jsxs("div",{style:{display:"flex",gap:"12px"},children:[u.jsx("button",{onClick:()=>{const C=me;T(null),vf(C)},style:{fontFamily:"'Cinzel', serif",fontSize:"0.85rem",fontWeight:700,color:"#fdf8e6",backgroundColor:me==="up"?"#5a8a4a":"#8a3a2a",border:`2px solid ${me==="up"?"#8ab47a":"#c85a4a"}`,borderRadius:"8px",padding:"8px 20px",cursor:"pointer"},children:me==="up"?"Bless All":"Banish All"}),u.jsx("button",{onClick:()=>{T(null),Ie.current={direction:me,count:0}},style:{fontFamily:"'Cinzel', serif",fontSize:"0.85rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"rgba(255,255,255,0.1)",border:"2px solid rgba(255,255,255,0.3)",borderRadius:"8px",padding:"8px 20px",cursor:"pointer"},children:"No"})]})]},"streak-popup")}),!He&&!Le&&u.jsxs("div",{style:{textAlign:"center",padding:"1.5rem 0.5rem"},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.1rem",margin:"0 0 8px 0",fontWeight:700},children:"You've judged all commandments!"}),Oe&&Kn>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:H?"cooldown-pulse":"",style:{color:"#fdf8e6",fontFamily:"'Cinzel', serif",fontSize:"2rem",fontWeight:900,margin:"12px 0",textShadow:"0 0 12px rgba(212, 175, 55, 0.4)"},children:ws(Kn)}),u.jsx("p",{style:{color:"#c8b070",fontSize:"0.85rem",margin:"0 0 6px 0",fontFamily:"'Cinzel', serif",lineHeight:1.5},children:"Voting reopens soon. In the meantime..."}),u.jsx("p",{style:{color:"#d4af37",fontSize:"0.9rem",margin:"8px 0",fontFamily:"'Cinzel', serif",fontWeight:600},children:"Declare a commandment of your own!"}),u.jsx("button",{onClick:()=>Zo("declare"),style:{fontFamily:"'Cinzel', serif",fontSize:"0.95rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"10px",padding:"12px 24px",cursor:"pointer",boxShadow:"0 0 12px rgba(212, 175, 55, 0.25)",marginBottom:"12px"},children:"Declare"}),u.jsx("p",{style:{color:"#888",fontSize:"0.8rem",margin:"8px 0 0 0",fontStyle:"italic"},children:"Or perhaps... go touch some grass."})]}):u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:()=>w(C=>C+1),style:{fontFamily:"'Cinzel', serif",fontSize:"0.85rem",fontWeight:700,color:"#d4af37",backgroundColor:"transparent",border:"2px solid #d4af37",borderRadius:"10px",padding:"10px 20px",cursor:"pointer",boxShadow:"0 0 10px rgba(212, 175, 55, 0.15)",marginBottom:"8px"},children:"Check for new commandments"}),u.jsx("p",{style:{color:"#888",fontSize:"13px",margin:0},children:"Or submit a new one or switch tabs."})]})]})]}),He&&u.jsxs("div",{style:{display:"flex",flexDirection:"row",width:"100%",flex:1,minHeight:0},children:[u.jsxs("button",{onClick:()=>!Le&&wf("down"),disabled:Le,style:{flex:"1 1 50%",minWidth:0,height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"4px",overflow:"hidden",background:"linear-gradient(180deg, rgba(200, 90, 74, 0.25) 0%, rgba(138, 58, 42, 0.15) 100%)",border:"2px solid rgba(200, 90, 74, 0.5)",borderRadius:"10px",cursor:Le?"default":"pointer",opacity:Le?.3:1,transition:"all 0.15s ease",boxShadow:"0 0 10px rgba(200, 90, 74, 0.2)"},onMouseDown:C=>{Le||(C.currentTarget.style.transform="scale(0.94)")},onMouseUp:C=>{C.currentTarget.style.transform="scale(1)"},onTouchStart:C=>{Le||(C.currentTarget.style.transform="scale(0.94)")},onTouchEnd:C=>{C.currentTarget.style.transform="scale(1)"},children:[u.jsx("span",{style:{fontSize:"clamp(0.7rem, 2vh, 1.4rem)",fontFamily:"'Cinzel', serif",fontWeight:700,color:"#c85a4a",letterSpacing:"0.08em"},children:"Downvote"}),u.jsx("span",{style:{fontSize:"clamp(3rem, 12vh, 10rem)",lineHeight:.7,fontFamily:"monospace",color:"#c85a4a"},children:"↓"})]}),u.jsxs("div",{style:{flex:"1 1 50%",minWidth:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},children:[u.jsx("img",{src:"/demon.png",alt:"Demon",style:{width:"100%",height:"100%",objectFit:"contain",filter:"drop-shadow(0 0 14px rgba(200, 90, 74, 0.6))"}}),u.jsx(no,{children:(K==null?void 0:K.type)==="demon"&&u.jsx(vn.div,{className:"speech-bubble speech-bubble-demon",initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.7},transition:{duration:.25},children:K.text})})]})]})]})}),Se==="comments"&&u.jsxs("div",{ref:et,onScroll:yf,className:"mobile-comments-feed",style:{flex:1,overflowY:"auto",overflowX:"hidden",WebkitOverflowScrolling:"touch",padding:"0 2px"},children:[xs.length===0?u.jsx("div",{style:{textAlign:"center",padding:"2rem 0"},children:u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1rem"},children:"The tablets are empty."})}):xs.map(C=>{var R;return u.jsxs("div",{className:"mobile-comment-card",style:{border:"1px solid #555",padding:"10px 12px",borderRadius:"8px",marginBottom:"8px",backgroundColor:"rgba(255,255,255,0.05)"},children:[u.jsx("h3",{style:{fontWeight:700,color:"#fdf8e6",fontSize:"1rem",margin:"0 0 6px 0",lineHeight:1.3,wordBreak:"break-word"},children:C.title||C.content}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[u.jsxs("span",{style:{fontSize:"13px",color:"#d1b97b",fontWeight:600},children:[C.votes??0," votes"]}),u.jsxs("span",{onClick:z=>{z.stopPropagation(),C.username&&C.username!=="unknown"&&W({username:C.username,x:z.clientX,y:z.clientY})},style:{fontSize:"13px",color:"#888",fontStyle:"italic",cursor:"pointer"},children:[C.username||"unknown",((R=Ce(C.username||""))==null?void 0:R.tier)&&u.jsx(Xt,{tier:Ce(C.username||"").tier,size:"small"})]}),u.jsxs(ql,{to:`/comments/${C.id}`,state:{from:"vote"},style:{fontSize:"13px",color:"#d4af37",textDecoration:"none",padding:"3px 8px",borderRadius:"4px",backgroundColor:"rgba(212, 175, 55, 0.12)",border:"1px solid rgba(212, 175, 55, 0.3)",fontWeight:600,fontFamily:"'Cinzel', serif"},children:["💬 ",m[String(C.id)]??0]})]})]},String(C.id))}),ue=Wt.length&&Wt.length>0&&u.jsxs("div",{style:{textAlign:"center",padding:"12px 0",color:"#666",fontSize:"12px",fontStyle:"italic"},children:["All ",Wt.length," commandments shown"]})]}),Se==="declare"&&u.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"1.5rem 1.5rem"},children:[u.jsx("h2",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.8rem",fontWeight:700,textAlign:"center",marginBottom:"1.5rem",letterSpacing:"0.06em",textShadow:"0 0 18px rgba(212, 175, 55, 0.35)",lineHeight:1.3},children:"Declare Your Commandment"}),u.jsxs("form",{onSubmit:xf,style:{width:"100%",maxWidth:"500px"},children:[u.jsx("input",{type:"text",placeholder:"Enter a new commandment...",value:s,onChange:C=>a(C.target.value.slice(0,80)),maxLength:80,style:{width:"100%",border:"2px solid #d4af37",borderRadius:"10px",padding:"18px 18px",fontSize:"1.2rem",boxSizing:"border-box",backgroundColor:"rgba(26, 26, 26, 0.9)",color:"#fdf8e6",fontFamily:"'Cinzel', serif"}}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"14px"},children:[u.jsxs("span",{style:{fontSize:"13px",color:s.length>=65?"#e07050":"#999"},children:[s.length,"/80"]}),u.jsx("button",{type:"submit",style:{backgroundColor:"#b79b3d",color:"#fdf8e6",padding:"16px 40px",borderRadius:"10px",fontSize:"1.15rem",fontWeight:700,fontFamily:"'Cinzel', serif",border:"2px solid #d4af37",cursor:"pointer",letterSpacing:"0.06em",boxShadow:"0 0 12px rgba(212, 175, 55, 0.25)"},children:"Submit"})]})]})]}),e.length>0&&Se!=="declare"&&u.jsx("div",{style:{textAlign:"center",marginTop:"4px",paddingTop:"3px",borderTop:"1px solid #555"},children:u.jsxs("span",{style:{color:"#d1b97b",fontSize:"12px"},children:["Voted on ",mf," of ",gf," commandments"]})})]}):u.jsxs(u.Fragment,{children:[Se==="swipe"&&u.jsxs(u.Fragment,{children:[e.length===0&&u.jsxs("div",{style:{textAlign:"center",padding:"2.5rem 1rem"},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.4rem",margin:"0 0 12px 0"},children:"The tablets are empty."}),u.jsx("p",{style:{color:"#c8b070",fontSize:"1rem",margin:"0 0 8px 0",fontFamily:"'Cinzel', serif"},children:"Be the first to inscribe a commandment and define the morals for humanity."})]}),e.length>0&&u.jsx(u.Fragment,{children:se?u.jsxs("div",{style:{position:"relative",width:"100%",minHeight:"400px",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.92)",borderRadius:"12px",border:"2px solid #d4af37"},children:[eo.current.slice(0,se.emojiCount).map((C,R)=>u.jsx(vn.span,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.3,delay:C.delay},style:{position:"absolute",left:`${C.x}%`,top:`${C.y}%`,fontSize:`${C.size+4}px`,lineHeight:1,pointerEvents:"none",filter:"drop-shadow(0 0 4px rgba(0,0,0,0.5))"},children:se.type==="up"?"🙏":"🔥"},R)),u.jsxs(vn.div,{initial:{opacity:0},animate:{opacity:se.emojiCount<=20?1:0},transition:{duration:.6},style:{textAlign:"center",padding:"2rem",zIndex:1},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.4rem",fontWeight:700,margin:"0 0 8px 0"},children:"You've judged all commandments!"}),u.jsx("p",{style:{color:"#c8b070",fontFamily:"'Cinzel', serif",fontSize:"1rem",margin:"0 0 8px 0"},children:se.type==="up"?"The heavens rejoice at your mercy.":"The abyss welcomes your wrath."}),Oe&&Kn>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:H?"cooldown-pulse":"",style:{color:"#fdf8e6",fontFamily:"'Cinzel', serif",fontSize:"2.5rem",fontWeight:900,margin:"16px 0",textShadow:"0 0 14px rgba(212, 175, 55, 0.4)"},children:ws(Kn)}),u.jsx("p",{style:{color:"#c8b070",fontSize:"1rem",margin:"0 0 8px 0",fontFamily:"'Cinzel', serif"},children:"Voting reopens soon. In the meantime..."})]}):u.jsx("p",{style:{color:"#c8b070",fontSize:"1rem",margin:"10px 0",fontFamily:"'Cinzel', serif"},children:"Declare a commandment of your own!"}),u.jsx("button",{onClick:()=>Zo("declare"),style:{fontFamily:"'Cinzel', serif",fontSize:"1.05rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"10px",padding:"14px 32px",cursor:"pointer",boxShadow:"0 0 12px rgba(212, 175, 55, 0.25)",marginBottom:"14px"},children:"Declare"}),u.jsx("p",{style:{color:"#888",fontSize:"0.9rem",margin:"10px 0 0 0",fontStyle:"italic"},children:"Or perhaps... go touch some grass."})]})]}):u.jsxs(u.Fragment,{children:[y.length===0&&e.length>0&&!Le&&u.jsxs("div",{style:{textAlign:"center",padding:"2.5rem 1.5rem",width:"100%",boxSizing:"border-box",border:"2px solid #d4af37",borderRadius:"12px",backgroundColor:"rgba(255,255,255,0.03)"},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.4rem",margin:"0 0 10px 0",fontWeight:700},children:"You've judged all commandments!"}),Oe&&Kn>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:H?"cooldown-pulse":"",style:{color:"#fdf8e6",fontFamily:"'Cinzel', serif",fontSize:"2.5rem",fontWeight:900,margin:"16px 0",textShadow:"0 0 14px rgba(212, 175, 55, 0.4)"},children:ws(Kn)}),u.jsx("p",{style:{color:"#c8b070",fontSize:"1rem",margin:"0 0 8px 0",fontFamily:"'Cinzel', serif",lineHeight:1.6},children:"Voting reopens soon. In the meantime..."}),u.jsx("p",{style:{color:"#d4af37",fontSize:"1.05rem",margin:"10px 0",fontFamily:"'Cinzel', serif",fontWeight:600},children:"Declare a commandment of your own!"}),u.jsx("button",{onClick:()=>Zo("declare"),style:{fontFamily:"'Cinzel', serif",fontSize:"1.05rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"10px",padding:"14px 32px",cursor:"pointer",boxShadow:"0 0 12px rgba(212, 175, 55, 0.25)",marginBottom:"14px"},children:"Declare"}),u.jsx("p",{style:{color:"#888",fontSize:"0.9rem",margin:"10px 0 0 0",fontStyle:"italic"},children:"Or perhaps... go touch some grass."})]}):u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:()=>w(C=>C+1),style:{fontFamily:"'Cinzel', serif",fontSize:"0.95rem",fontWeight:700,color:"#d4af37",backgroundColor:"transparent",border:"2px solid #d4af37",borderRadius:"10px",padding:"12px 24px",cursor:"pointer",boxShadow:"0 0 10px rgba(212, 175, 55, 0.15)",marginBottom:"10px"},children:"Check for new commandments"}),u.jsx("p",{style:{color:"#888",fontSize:"13px",margin:0},children:"Or switch to the Declare tab to submit a new one."})]})]}),(oe||!b&&Le)&&u.jsxs("div",{style:{textAlign:"center",padding:"2.5rem 1rem",border:"2px solid #d4af37",borderRadius:"12px",backgroundColor:"rgba(212, 175, 55, 0.05)",boxShadow:"0 0 20px rgba(212, 175, 55, 0.15)",marginBottom:"1rem"},children:[u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.4rem",margin:"0 0 12px 0",fontWeight:700},children:"Create an account to keep voting!"}),u.jsx("p",{style:{color:"#c8b070",fontSize:"1rem",margin:"0 0 24px 0",fontFamily:"'Cinzel', serif"},children:"Log in to make your votes count and see all commandments."}),u.jsx("button",{onClick:()=>{B()},style:{fontFamily:"'Cinzel', serif",fontSize:"1.1rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"#b79b3d",border:"2px solid #d4af37",borderRadius:"10px",padding:"14px 32px",cursor:"pointer",textShadow:"1px 1px 2px rgba(0,0,0,0.5)",boxShadow:"0 0 12px rgba(212, 175, 55, 0.4)"},children:"Log In / Sign Up"})]}),!oe&&!Le&&u.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",width:"100%"},children:y.map(C=>{var O;const R=bf(C.postId);if(!R)return null;const z=R.username===b;return u.jsxs("div",{style:{border:"1px solid #555",padding:"16px 20px",borderRadius:"12px",display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:"rgba(255,255,255,0.05)",overflow:"hidden",minHeight:"140px",transition:"all 0.25s ease",...gv(C.animState)},children:[u.jsxs("div",{children:[u.jsx("h2",{style:{fontWeight:700,color:"#fdf8e6",fontSize:"1.4rem",margin:"0 0 6px 0",lineHeight:1.35,wordBreak:"break-word",whiteSpace:"normal"},children:R.title||R.content}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginTop:"4px",flexWrap:"wrap"},children:[u.jsxs("span",{style:{fontSize:"16px",color:"#d1b97b",fontWeight:600},children:[R.votes??0," votes"]}),u.jsxs("span",{onClick:Q=>{Q.stopPropagation(),R.username&&R.username!=="unknown"&&W({username:R.username,x:Q.clientX,y:Q.clientY})},style:{fontSize:"15px",color:"#888",fontStyle:"italic",cursor:"pointer"},children:[R.username||"unknown",((O=Ce(R.username||""))==null?void 0:O.tier)&&u.jsx(Xt,{tier:Ce(R.username||"").tier,size:"small"})]}),u.jsxs(ql,{to:`/comments/${R.id}`,style:{fontSize:"16px",color:"#d4af37",textDecoration:"none",padding:"5px 10px",borderRadius:"4px",backgroundColor:"rgba(212, 175, 55, 0.12)",border:"1px solid rgba(212, 175, 55, 0.3)",fontWeight:600,fontFamily:"'Cinzel', serif",letterSpacing:"0.02em",transition:"all 0.2s ease"},onMouseEnter:Q=>{Q.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.25)",Q.currentTarget.style.borderColor="rgba(212, 175, 55, 0.6)"},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.12)",Q.currentTarget.style.borderColor="rgba(212, 175, 55, 0.3)"},children:["💬 ",m[String(R.id)]??0]})]})]}),z?u.jsxs("div",{style:{marginTop:"auto",paddingTop:"8px"},children:[u.jsx("p",{style:{textAlign:"center",color:"#888",fontSize:"0.85rem",fontStyle:"italic",margin:"0 0 4px 0"},children:"Your commandment"}),u.jsx("button",{style:{width:"100%",padding:"10px 0",borderRadius:"8px",border:"1px solid #555",cursor:"pointer",backgroundColor:"rgba(255,255,255,0.08)",color:"#d1b97b",fontSize:"0.95rem",fontWeight:600,fontFamily:"'Cinzel', serif",minHeight:"44px"},onClick:()=>mv(R.id),children:"Skip"})]}):u.jsxs("div",{style:{display:"flex",gap:"10px",marginTop:"auto",paddingTop:"8px"},children:[u.jsx("button",{style:{flex:1,padding:"12px 0",borderRadius:"8px",border:"none",cursor:"pointer",backgroundColor:"#7a9a6a",background:"linear-gradient(180deg, #8ab47a 0%, #5a8a4a 100%)",color:"#fdf8e6",fontSize:"26px",minHeight:"48px",boxShadow:"0 0 12px rgba(200, 220, 140, 0.25)"},onClick:()=>Cf(R.id,"up"),children:u.jsx("span",{style:{filter:"drop-shadow(0 0 6px rgba(255, 223, 100, 0.8))"},children:"👍"})}),u.jsx("button",{style:{flex:1,padding:"12px 0",borderRadius:"8px",border:"none",cursor:"pointer",backgroundColor:"#a87a6a",background:"linear-gradient(180deg, #c85a4a 0%, #8a3a2a 100%)",color:"#fdf8e6",fontSize:"26px",minHeight:"48px",boxShadow:"0 0 12px rgba(255, 80, 40, 0.2)"},onClick:()=>Cf(R.id,"down"),children:u.jsx("span",{style:{filter:"drop-shadow(0 0 6px rgba(255, 50, 20, 0.8))"},children:"👎"})})]})]},C.postId)})}),u.jsx(no,{children:me&&u.jsx(vn.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.3},style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:1e3,background:"rgba(0,0,0,0.92)"},onClick:()=>{T(null),Ie.current={direction:me,count:0}},children:u.jsxs("div",{onClick:C=>C.stopPropagation(),style:{background:"rgba(20, 15, 5, 0.95)",border:"2px solid #d4af37",borderRadius:"16px",padding:"2rem 3rem",textAlign:"center",boxShadow:"0 0 30px rgba(212, 175, 55, 0.3)",maxWidth:"500px"},children:[u.jsx("p",{style:{color:me==="up"?"#8ab47a":"#c85a4a",fontFamily:"'Cinzel', serif",fontSize:"1.2rem",fontWeight:700,margin:"0 0 20px 0",lineHeight:1.4},children:me==="up"?"Do you just want to upvote every single commandment?":"Do you just want to downvote every single commandment?"}),u.jsxs("div",{style:{display:"flex",gap:"16px",justifyContent:"center"},children:[u.jsx("button",{onClick:()=>{const C=me;T(null),vf(C)},style:{fontFamily:"'Cinzel', serif",fontSize:"1rem",fontWeight:700,color:"#fdf8e6",backgroundColor:me==="up"?"#5a8a4a":"#8a3a2a",border:`2px solid ${me==="up"?"#8ab47a":"#c85a4a"}`,borderRadius:"10px",padding:"12px 28px",cursor:"pointer"},children:me==="up"?"Bless All":"Banish All"}),u.jsx("button",{onClick:()=>{T(null),Ie.current={direction:me,count:0}},style:{fontFamily:"'Cinzel', serif",fontSize:"1rem",fontWeight:700,color:"#fdf8e6",backgroundColor:"rgba(255,255,255,0.1)",border:"2px solid rgba(255,255,255,0.3)",borderRadius:"10px",padding:"12px 28px",cursor:"pointer"},children:"No"})]})]})},"desktop-streak-popup")})]})})]}),Se==="comments"&&u.jsxs("div",{ref:et,onScroll:yf,style:{overflowY:"auto",overflowX:"hidden",padding:"0 2px",maxHeight:"60vh"},children:[xs.length===0?u.jsx("div",{style:{textAlign:"center",padding:"2rem 0"},children:u.jsx("p",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.2rem"},children:"The tablets are empty."})}):xs.map(C=>{var R;return u.jsxs("div",{style:{border:"1px solid #555",padding:"12px 16px",borderRadius:"8px",marginBottom:"10px",backgroundColor:"rgba(255,255,255,0.05)"},children:[u.jsx("h3",{style:{fontWeight:700,color:"#fdf8e6",fontSize:"1.1rem",margin:"0 0 8px 0",lineHeight:1.3,wordBreak:"break-word"},children:C.title||C.content}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flexWrap:"wrap"},children:[u.jsxs("span",{style:{fontSize:"14px",color:"#d1b97b",fontWeight:600},children:[C.votes??0," votes"]}),u.jsxs("span",{onClick:z=>{z.stopPropagation(),C.username&&C.username!=="unknown"&&W({username:C.username,x:z.clientX,y:z.clientY})},style:{fontSize:"14px",color:"#888",fontStyle:"italic",cursor:"pointer"},children:[C.username||"unknown",((R=Ce(C.username||""))==null?void 0:R.tier)&&u.jsx(Xt,{tier:Ce(C.username||"").tier,size:"small"})]}),u.jsxs(ql,{to:`/comments/${C.id}`,state:{from:"vote"},style:{fontSize:"14px",color:"#d4af37",textDecoration:"none",padding:"4px 10px",borderRadius:"4px",backgroundColor:"rgba(212, 175, 55, 0.12)",border:"1px solid rgba(212, 175, 55, 0.3)",fontWeight:600,fontFamily:"'Cinzel', serif",transition:"all 0.2s ease"},onMouseEnter:z=>{z.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.25)",z.currentTarget.style.borderColor="rgba(212, 175, 55, 0.6)"},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="rgba(212, 175, 55, 0.12)",z.currentTarget.style.borderColor="rgba(212, 175, 55, 0.3)"},children:["💬 ",m[String(C.id)]??0]})]})]},String(C.id))}),ue=Wt.length&&Wt.length>0&&u.jsxs("div",{style:{textAlign:"center",padding:"12px 0",color:"#666",fontSize:"13px",fontStyle:"italic"},children:["All ",Wt.length," commandments shown"]})]}),Se==="declare"&&u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"2rem 2rem"},children:[u.jsx("h2",{style:{color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"2rem",fontWeight:700,textAlign:"center",marginBottom:"1.5rem",letterSpacing:"0.06em",textShadow:"0 0 18px rgba(212, 175, 55, 0.35)",lineHeight:1.3},children:"Declare Your Commandment"}),u.jsxs("form",{onSubmit:xf,style:{width:"100%",maxWidth:"600px"},children:[u.jsx("input",{type:"text",placeholder:"Enter a new commandment...",value:s,onChange:C=>a(C.target.value.slice(0,80)),maxLength:80,style:{width:"100%",border:"2px solid #d4af37",borderRadius:"10px",padding:"16px 18px",fontSize:"1.15rem",boxSizing:"border-box",backgroundColor:"rgba(26, 26, 26, 0.9)",color:"#fdf8e6",fontFamily:"'Cinzel', serif"}}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"14px"},children:[u.jsxs("span",{style:{fontSize:"13px",color:s.length>=65?"#e07050":"#999"},children:[s.length,"/80"]}),u.jsx("button",{type:"submit",style:{backgroundColor:"#b79b3d",color:"#fdf8e6",padding:"14px 40px",borderRadius:"10px",fontSize:"1.1rem",fontWeight:700,fontFamily:"'Cinzel', serif",border:"2px solid #d4af37",cursor:"pointer",letterSpacing:"0.06em",boxShadow:"0 0 12px rgba(212, 175, 55, 0.25)"},children:"Submit"})]})]})]}),e.length>0&&Se!=="declare"&&u.jsx("div",{style:{textAlign:"center",marginTop:"10px",paddingTop:"8px",borderTop:"1px solid #555"},children:u.jsxs("span",{style:{color:"#d1b97b",fontSize:"12px"},children:["Voted on ",mf," of ",gf," commandments"]})})]})]}),F&&u.jsx(hl,{username:F.username,blessings:cv(F.username),donorTier:(kf=Ce(F.username))==null?void 0:kf.tier,memberSince:dv(F.username),position:{x:F.x,y:F.y},onClose:()=>W(null)}),E&&u.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},children:u.jsxs("div",{onClick:C=>C.stopPropagation(),style:{backgroundColor:"#1a1408",border:"2px solid #d4af37",borderRadius:"12px",padding:D?"1.5rem 1.25rem":"2rem 2.5rem",maxWidth:D?"90%":"420px",width:"100%",textAlign:"center",boxShadow:"0 0 30px rgba(212, 175, 55, 0.3)",fontFamily:"'Cinzel', serif"},children:[u.jsx("div",{style:{fontSize:D?"2rem":"2.5rem",marginBottom:"0.75rem"},children:"⏳"}),u.jsx("h2",{style:{color:"#d4af37",fontSize:D?"1.1rem":"1.3rem",fontWeight:700,margin:"0 0 0.75rem 0",letterSpacing:"0.08em"},children:"Daily Limit Reached"}),u.jsx("p",{style:{color:"#c8b070",fontSize:D?"0.85rem":"0.95rem",lineHeight:1.6,margin:"0 0 1.25rem 0"},children:"You may only inscribe 1 commandment per day. Return tomorrow to share new wisdom with the collective."}),u.jsx("button",{onClick:()=>N(!1),style:{backgroundColor:"#b79b3d",color:"#fdf8e6",border:"none",borderRadius:"8px",padding:D?"10px 28px":"10px 32px",fontSize:D?"0.9rem":"1rem",fontWeight:700,fontFamily:"'Cinzel', serif",cursor:"pointer",letterSpacing:"0.05em"},children:"Understood"})]})}),u.jsx(Ry,{isOpen:Ne,onClose:()=>Re(!1)}),u.jsx(Ay,{isOpen:X,onClose:()=>Ze(!1)}),G&&u.jsx("div",{className:"popup-overlay",onClick:()=>q(!1),children:u.jsxs("div",{className:"popup-box",onClick:C=>C.stopPropagation(),style:{maxWidth:"520px",width:"92%",padding:D?"1rem":"2rem",backgroundColor:"#1a1a1a",maxHeight:"90vh",overflowY:"auto"},children:[u.jsx("h2",{style:{color:"#d4af37",marginBottom:"0.5rem",fontSize:D?"1.2rem":"1.5rem"},children:"Flexible Morals Tee"}),u.jsx("p",{style:{marginBottom:D?"0.5rem":"1rem",color:"#aaa",fontSize:D?"0.8rem":"0.9rem"},children:"Coming Soon! Each month's top commandments on the back."}),u.jsx("img",{src:"/merch_tee_back.png",alt:"Flexible Morals Tee - Back with Commandments",style:{width:"100%",borderRadius:"8px",display:"block",margin:"0 auto"}}),u.jsx("img",{src:"/merch_tee_2.png",alt:"Flexible Morals Tee - Modeled Front and Back",style:{width:"100%",borderRadius:"8px",display:"block",margin:D?"0.5rem auto 0":"1rem auto 0"}}),u.jsx("p",{style:{marginTop:D?"0.5rem":"1rem",fontSize:D?"0.75rem":"0.85rem",color:"#d4af37",fontFamily:"'Cinzel', serif",fontWeight:600},children:"Shirts updated with our most recent morals!"}),u.jsx("button",{onClick:()=>q(!1),className:"popup-close",style:{marginTop:D?"0.5rem":"1rem"},children:"Close"})]})}),de&&u.jsx("div",{className:"popup-overlay",onClick:()=>Be(!1),children:u.jsxs("div",{className:"popup-box",onClick:C=>C.stopPropagation(),style:{maxWidth:"700px",lineHeight:D?"1.4":"1.6",textAlign:"center",position:"relative",padding:D?"1rem 1rem 0.8rem":void 0,fontSize:D?"0.85rem":void 0},children:[u.jsx("button",{onClick:()=>Be(!1),style:{position:D?"sticky":"absolute",top:D?0:"12px",right:D?void 0:"16px",float:D?"right":void 0,background:D?"rgba(253, 248, 230, 0.95)":"none",border:"none",color:"#d4af37",fontSize:D?"1.3rem":"1.5rem",cursor:"pointer",fontFamily:"'Cinzel', serif",fontWeight:700,lineHeight:1,padding:D?"2px 6px":"4px 8px",zIndex:10,borderRadius:D?"4px":void 0},"aria-label":"Close",children:"✕"}),u.jsx("h1",{style:{color:"#d4af37",marginBottom:D?"0.5rem":"1rem",fontFamily:"'Cinzel', serif",letterSpacing:"0.1em",fontSize:D?"1.2rem":void 0},children:"OUR CHARTER"}),u.jsxs("p",{children:["Flexible Morals was founded to create a collaborative, ad-free, bot-free space where people can actively shape a modern moral framework inspired by timeless principles. Readers and future disciples are invited to participate in the ",u.jsx("strong",{style:{color:"#d4af37",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 6px",borderRadius:"3px"},children:"World's First Democratic Religion"})," by sharing opinions, helping guide daily commandments, and voting monthly to determine the top ten moral standards."]}),u.jsx("p",{style:{marginTop:D?"0.6rem":"1rem"},children:"The mission is to foster thoughtful dialogue across cultures and generations, sustain the platform through optional support, and build a movement focused not on profit, but on making a positive impact—supporting meaningful causes and promoting hope and care for humanity's future."}),u.jsx("button",{onClick:()=>Be(!1),className:"popup-close",style:{marginTop:D?"0.6rem":void 0},children:"Close"})]})})]})}function KE(){var Pn,Dt,He;const{postId:e}=Sw(),t=Ho(),r=(Pn=Wo().state)==null?void 0:Pn.from,{user:o,openLoginModal:i}=Cr(),s=Wn("(max-width: 768px)"),{getDonorStatus:a,loadDonorStatuses:l}=Jr(),[c,d]=h.useState(null),[f,p]=h.useState([]),[v,x]=h.useState(!0),[w,m]=h.useState(""),[g,y]=h.useState(null),[S,k]=h.useState(""),[j,E]=h.useState({}),[N,b]=h.useState("top"),[B,I]=h.useState(!1),[V,oe]=h.useState(new Set),[le,he]=h.useState(new Set),[Ce,je]=h.useState([]),[D,F]=h.useState(null),[W,G]=h.useState(!1),[q,de]=h.useState(!1),[Be,Ne]=h.useState(null),[Re,X]=h.useState(""),Ze=h.useRef(null),ye=h.useRef(null),fn=h.useRef(null),en=h.useRef(null);h.useEffect(()=>{const A=localStorage.getItem(`commentVotes_${e}`);A&&E(JSON.parse(A))},[e]),h.useEffect(()=>{localStorage.setItem(`commentVotes_${e}`,JSON.stringify(j))},[j,e]),h.useEffect(()=>{(async()=>{try{const[U,ce]=await Promise.all([pl(),Py(e)]);je(U);const Y=U.find(me=>String(me.id)===String(e));d(Y||null);const K=ce.comments||[];p(K);const be=localStorage.getItem(`commentVotes_${e}`),Ie=be?JSON.parse(be):{};o&&K.forEach(me=>{me.userVotes[o]&&!Ie[me.id]&&(Ie[me.id]=me.userVotes[o])}),E(Ie)}catch(U){console.error("Failed to load comments:",U)}finally{x(!1)}})()},[e]),h.useEffect(()=>{const A=[];c!=null&&c.username&&A.push(c.username),f.forEach(U=>{U.username&&!A.includes(U.username)&&A.push(U.username)}),A.length>0&&l(A)},[c,f,l]),h.useEffect(()=>{if(!W&&!q)return;const A=U=>{W&&Ze.current&&!Ze.current.contains(U.target)&&G(!1),q&&ye.current&&!ye.current.contains(U.target)&&de(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[W,q]);const En=A=>{var U;m(ce=>ce+A),G(!1),(U=fn.current)==null||U.focus()},Se=A=>{var U;k(ce=>ce+A),de(!1),(U=en.current)==null||U.focus()},mt=h.useCallback(()=>o?!0:(i(),!1),[o,i]),L=h.useCallback(A=>Ce.filter(U=>U.username===A).reduce((U,ce)=>U+(ce.votes??0),0),[Ce]),te=h.useCallback(A=>{const U=[...A];N==="top"?U.sort((K,be)=>be.votes-K.votes):U.sort((K,be)=>new Date(be.createdAt).getTime()-new Date(K.createdAt).getTime());const ce=U.filter(K=>!K.parentId),Y={};return U.forEach(K=>{K.parentId&&(Y[K.parentId]||(Y[K.parentId]=[]),Y[K.parentId].push(K))}),{topLevel:ce,childMap:Y}},[N]),{topLevel:ue,childMap:we}=h.useMemo(()=>te(f),[f,te]),et=async A=>{var U,ce;if(A.preventDefault(),!!mt()&&w.trim()){I(!0);try{const Y=await uh(e,o,w.trim());p(K=>[...K,Y]),E(K=>({...K,[Y.id]:"up"})),m("")}catch(Y){const K=((ce=(U=Y==null?void 0:Y.response)==null?void 0:U.data)==null?void 0:ce.error)||"Failed to post comment";alert(K)}finally{I(!1)}}},tt=async A=>{var U,ce;if(mt()&&S.trim()){I(!0);try{const Y=await uh(e,o,S.trim(),A);p(K=>[...K,Y]),E(K=>({...K,[Y.id]:"up"})),k(""),y(null)}catch(Y){const K=((ce=(U=Y==null?void 0:Y.response)==null?void 0:U.data)==null?void 0:ce.error)||"Failed to post reply";alert(K)}finally{I(!1)}}},pn=async(A,U)=>{if(!mt())return;const ce=j[A];if(ce!==U){p(Y=>Y.map(K=>{if(K.id!==A)return K;let be=K.votes;return ce?ce==="up"&&U==="down"?be-=2:ce==="down"&&U==="up"&&(be+=2):be+=U==="up"?1:-1,{...K,votes:be}})),E(Y=>({...Y,[A]:U}));try{const Y=await Mb(e,A,U,o||"guest");p(K=>K.map(be=>be.id===Y.id?{...be,votes:Y.votes}:be))}catch(Y){console.error("Vote failed:",Y)}}},Ut=async A=>{var U,ce;if(Re.trim()){I(!0);try{const Y=await Ib(e,A,o,Re.trim());p(K=>K.map(be=>be.id===A?{...be,text:Y.text,editedAt:Y.editedAt}:be)),Ne(null),X("")}catch(Y){const K=((ce=(U=Y==null?void 0:Y.response)==null?void 0:U.data)==null?void 0:ce.error)||"Failed to edit comment";alert(K)}finally{I(!1)}}},At=async A=>{var U,ce;if(window.confirm("Are you sure you want to delete this comment? This cannot be undone."))try{await Lb(e,A,o),p(Y=>Y.map(K=>K.id===A?{...K,text:"[deleted]",username:"[deleted]",deleted:!0}:K))}catch(Y){const K=((ce=(U=Y==null?void 0:Y.response)==null?void 0:U.data)==null?void 0:ce.error)||"Failed to delete comment";alert(K)}},Nt=h.useCallback(A=>(we[A]||[]).reduce((ce,Y)=>ce+1+Nt(Y.id),0),[we]),tn=A=>{he(U=>{const ce=new Set(U);return ce.has(A)?ce.delete(A):ce.add(A),ce})},gt=(A,U)=>{var me;const ce=we[A.id]||[],Y=j[A.id],K=3,be=A.votes<-5&&!V.has(A.id),Ie=le.has(A.id);return be?u.jsxs("div",{style:{marginLeft:U>0?s?12:24:0},children:[u.jsx("div",{style:{backgroundColor:"rgba(255,255,255,0.02)",border:"1px solid #333",borderLeft:U>0?"3px solid #555":"1px solid #333",borderRadius:U>0?"0 6px 6px 0":"6px",padding:"8px 14px",marginBottom:"8px",cursor:"pointer"},onClick:()=>oe(T=>{const _=new Set(T);return _.add(A.id),_}),children:u.jsx("span",{style:{color:"#666",fontSize:"12px",fontStyle:"italic"},children:"Comment hidden (score below -5) — click to reveal"})}),ce.map(T=>gt(T,Math.min(U+1,K)))]},A.id):u.jsxs("div",{style:{marginLeft:U>0?s?12:24:0},children:[u.jsxs("div",{style:{backgroundColor:"rgba(255,255,255,0.05)",border:"1px solid #555",borderLeft:U>0?"3px solid #d4af37":"1px solid #555",borderRadius:U>0?"0 6px 6px 0":"6px",padding:"10px 14px",marginBottom:"8px"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:Ie?0:"6px"},children:[u.jsx("button",{onClick:()=>tn(A.id),style:{background:"none",border:"none",cursor:"pointer",color:"#888",fontSize:"12px",padding:"0 4px 0 0",fontFamily:"monospace",lineHeight:1},title:Ie?"Expand thread":"Collapse thread",children:Ie?"[+]":"[–]"}),A.deleted?u.jsx("span",{style:{color:"#666",fontWeight:600,fontSize:"13px",fontStyle:"italic"},children:"[deleted]"}):u.jsxs("span",{onClick:T=>{T.stopPropagation(),F({username:A.username,x:T.clientX,y:T.clientY})},style:{color:"#d4af37",fontWeight:600,fontSize:"13px",fontFamily:"'Cinzel', serif",cursor:"pointer"},children:[A.username,((me=a(A.username))==null?void 0:me.tier)&&u.jsx(Xt,{tier:a(A.username).tier,size:"small"})]}),u.jsx("span",{style:{color:"#666",fontSize:"11px"},children:new Date(A.createdAt).toLocaleString()}),A.editedAt&&!A.deleted&&u.jsx("span",{style:{color:"#666",fontSize:"10px",fontStyle:"italic"},title:`Edited ${new Date(A.editedAt).toLocaleString()}`,children:"(edited)"}),Ie&&u.jsxs("span",{style:{color:"#555",fontSize:"11px",fontStyle:"italic"},children:["(",Nt(A.id)+1," comment",Nt(A.id)+1!==1?"s":"",")"]})]}),!Ie&&u.jsxs(u.Fragment,{children:[A.deleted?u.jsx("p",{style:{color:"#666",fontSize:"14px",margin:"0 0 8px 0",lineHeight:1.5,fontStyle:"italic"},children:"[deleted]"}):Be===A.id?u.jsxs("div",{style:{margin:"0 0 8px 0"},children:[u.jsx("textarea",{value:Re,onChange:T=>X(sa(T.target.value)),maxLength:500,style:{width:"100%",height:"70px",border:"1px solid #d4af37",borderRadius:"6px",padding:"8px",fontSize:"13px",resize:"none",boxSizing:"border-box",backgroundColor:"#1a1a1a",color:"#fdf8e6"},autoFocus:!0}),u.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"4px",justifyContent:"flex-end"},children:[u.jsx("button",{onClick:()=>{Ne(null),X("")},style:{background:"none",border:"1px solid #555",cursor:"pointer",color:"#888",fontSize:"12px",padding:"4px 12px",borderRadius:"4px"},children:"Cancel"}),u.jsx("button",{onClick:()=>Ut(A.id),disabled:!Re.trim()||B,style:{backgroundColor:!Re.trim()||B?"#555":"#b79b3d",color:"#fdf8e6",padding:"4px 14px",borderRadius:"4px",fontSize:"12px",fontWeight:600,border:"none",cursor:!Re.trim()||B?"not-allowed":"pointer"},children:B?"Saving...":"Save"})]})]}):u.jsx("p",{style:{color:"#fdf8e6",fontSize:"14px",margin:"0 0 8px 0",lineHeight:1.5,wordBreak:"break-word"},children:A.text}),!A.deleted&&Be!==A.id&&u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",fontSize:"12px"},children:[o&&u.jsx("button",{onClick:()=>pn(A.id,"up"),style:{background:"none",border:"none",cursor:"pointer",color:Y==="up"?"#5a7a50":"#888",fontSize:s?"16px":"14px",padding:s?"8px 10px":"2px 4px",minHeight:s?"44px":void 0},title:"Upvote",children:"▲"}),u.jsx("span",{style:{color:"#d1b97b",fontWeight:600,minWidth:"20px",textAlign:"center"},children:A.votes}),o&&u.jsx("button",{onClick:()=>pn(A.id,"down"),style:{background:"none",border:"none",cursor:"pointer",color:Y==="down"?"#8a5a4a":"#888",fontSize:s?"16px":"14px",padding:s?"8px 10px":"2px 4px",minHeight:s?"44px":void 0},title:"Downvote",children:"▼"}),U{y(g===A.id?null:A.id),k("")},style:{background:"none",border:"none",cursor:"pointer",color:"#888",fontSize:s?"14px":"12px",padding:s?"8px 10px":"2px 6px",minHeight:s?"44px":void 0},children:g===A.id?"Cancel":"Reply"}),o&&o===A.username&&u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:()=>{Ne(A.id),X(A.text),y(null)},style:{background:"none",border:"none",cursor:"pointer",color:"#888",fontSize:s?"14px":"12px",padding:s?"8px 10px":"2px 6px",minHeight:s?"44px":void 0},children:"Edit"}),u.jsx("button",{onClick:()=>At(A.id),style:{background:"none",border:"none",cursor:"pointer",color:"#8a5a4a",fontSize:s?"14px":"12px",padding:s?"8px 10px":"2px 6px",minHeight:s?"44px":void 0},children:"Delete"})]})]}),g===A.id&&u.jsxs("div",{style:{marginTop:"8px"},children:[u.jsxs("div",{style:{position:"relative"},children:[u.jsx("textarea",{ref:en,placeholder:o?"Write a reply...":"Click here to reply...",value:S,onChange:T=>k(sa(T.target.value)),onFocus:T=>{o||(T.target.blur(),i())},maxLength:500,style:{width:"100%",height:"60px",border:"1px solid #555",borderRadius:"6px",padding:"8px",fontSize:"13px",resize:"none",boxSizing:"border-box",backgroundColor:"#1a1a1a",color:"#fdf8e6"}}),q&&u.jsxs("div",{ref:ye,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:"#1a1a1a",border:"1px solid #d4af37",borderRadius:"8px 8px 0 0",padding:"6px",display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"2px",maxHeight:"160px",overflowY:"auto",zIndex:10,boxShadow:"0 -4px 12px rgba(0, 0, 0, 0.5)"},children:[u.jsx("div",{style:{gridColumn:"1 / -1",color:"#d4af37",fontSize:"0.6rem",fontFamily:"'Cinzel', serif",fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",padding:"4px 2px 2px",borderBottom:"1px solid rgba(212, 175, 55, 0.2)",marginBottom:"2px"},children:"Flexible Morals"}),mc.map(T=>u.jsx("button",{onClick:()=>Se(T.emoji),title:T.label,type:"button",style:{background:"none",border:"1px solid rgba(212, 175, 55, 0.25)",backgroundColor:"rgba(212, 175, 55, 0.06)",fontSize:"1.2rem",cursor:"pointer",padding:"4px",borderRadius:"4px",lineHeight:1},children:T.emoji},T.label)),u.jsx("div",{style:{gridColumn:"1 / -1",color:"#d4af37",fontSize:"0.6rem",fontFamily:"'Cinzel', serif",fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",padding:"4px 2px 2px",borderBottom:"1px solid rgba(212, 175, 55, 0.2)",marginBottom:"2px"},children:"Standard"}),gc.map(T=>u.jsx("button",{onClick:()=>Se(T),type:"button",style:{background:"none",border:"none",fontSize:"1.2rem",cursor:"pointer",padding:"4px",borderRadius:"4px",lineHeight:1},children:T},`std-${T}`))]})]}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[u.jsx("button",{type:"button",onClick:()=>de(T=>!T),style:{background:"none",border:"none",fontSize:"1.1rem",cursor:"pointer",opacity:.7,padding:"2px 4px",lineHeight:1},children:"😀"}),u.jsx("button",{onClick:()=>tt(A.id),disabled:!S.trim()||B,style:{backgroundColor:!S.trim()||B?"#555":"#b79b3d",color:"#fdf8e6",padding:"4px 14px",borderRadius:"4px",fontSize:"12px",fontWeight:600,border:"none",cursor:!S.trim()||B?"not-allowed":"pointer"},children:"Reply"})]})]})]})]}),!Ie&&ce.map(T=>gt(T,Math.min(U+1,K)))]},A.id)};return v?u.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#0a0a0a",color:"#d4af37",fontFamily:"'Cinzel', serif",fontSize:"1.2rem"},children:"Loading..."}):u.jsxs("div",{style:{backgroundImage:s?"none":"url('/Voting_Background.png')",backgroundColor:s?"#0a0804":void 0,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:s?"0":"0.5rem",overflow:"auto",overflowX:"hidden"},children:[!s&&u.jsx(La,{}),u.jsxs("div",{style:{backgroundColor:s?"#0a0804":"rgba(20, 15, 5, 0.92)",borderRadius:s?"0":"10px",padding:s?"0.75rem 1rem 2rem":"1rem 1.5rem",maxWidth:"800px",width:s?"100%":"95%",boxShadow:s?"none":"0 4px 20px rgba(0,0,0,0.5), 0 0 15px rgba(212, 175, 55, 0.15)",border:s?"none":"2px solid #d4af37",marginBottom:s?"0":"2rem",minHeight:s?"100vh":void 0,boxSizing:"border-box"},children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem",paddingTop:s?"0.5rem":0},children:[u.jsx("button",{onClick:()=>t(r==="home"?"/":"/vote"),style:{backgroundColor:"transparent",color:"#d4af37",padding:s?"8px 14px":"4px 12px",borderRadius:"4px",border:"1px solid #d4af37",cursor:"pointer",fontSize:s?"13px":"12px",fontWeight:600},children:r==="home"?"← Back to Home":"← Back to Voting"}),s&&u.jsx("div",{className:"login-inline-wrapper",children:u.jsx(La,{})})]}),c&&u.jsxs("div",{style:{backgroundColor:"rgba(212, 175, 55, 0.08)",border:"1px solid #d4af37",borderRadius:s?"6px":"8px",padding:s?"12px 14px":"16px 20px",marginBottom:"1rem"},children:[u.jsx("h1",{style:{fontFamily:"'Cinzel', serif",fontSize:s?"1rem":"1.4rem",fontWeight:700,color:"#c8b070",textShadow:"1px 1px 0px #3a2e0b, -1px -1px 0px #3a2e0b, 0 0 10px rgba(200, 176, 112, 0.2)",margin:"0 0 4px 0",letterSpacing:"0.03em",wordBreak:"break-word"},children:c.title||c.content}),u.jsxs("p",{style:{color:"#d1b97b",fontSize:"13px",margin:0,display:"flex",alignItems:"center",gap:"8px"},children:[u.jsxs("span",{children:[c.votes??0," votes"]}),c.username&&u.jsxs("span",{onClick:A=>{A.stopPropagation(),F({username:c.username,x:A.clientX,y:A.clientY})},style:{color:"#888",fontStyle:"italic",cursor:"pointer"},children:[c.username,((Dt=a(c.username))==null?void 0:Dt.tier)&&u.jsx(Xt,{tier:a(c.username).tier,size:"small"})]})]})]}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem"},children:[u.jsx("div",{style:{display:"flex",gap:"4px"},children:["top","new"].map(A=>u.jsx("button",{onClick:()=>b(A),style:{padding:"4px 10px",borderRadius:"4px",cursor:"pointer",fontWeight:600,fontSize:"12px",backgroundColor:N===A?"#b79b3d":"transparent",color:N===A?"#fdf8e6":"#d1b97b",border:N===A?"1px solid #d4af37":"1px solid #555"},children:A.charAt(0).toUpperCase()+A.slice(1)},A))}),u.jsxs("span",{style:{color:"#888",fontSize:"12px"},children:[f.length," comment",f.length!==1?"s":""]})]}),u.jsxs("form",{onSubmit:et,style:{marginBottom:"1rem"},children:[u.jsxs("div",{style:{position:"relative"},children:[u.jsx("textarea",{ref:fn,placeholder:o?"Share thy thoughts on this commandment...":"Click here to comment...",value:w,onChange:A=>m(sa(A.target.value)),onFocus:A=>{o||(A.target.blur(),i())},maxLength:500,style:{width:"100%",height:"70px",border:"1px solid #555",borderRadius:"6px",padding:"10px 12px",fontSize:"14px",resize:"none",boxSizing:"border-box",backgroundColor:"#1a1a1a",color:"#fdf8e6",cursor:o?"text":"pointer"}}),W&&u.jsxs("div",{ref:Ze,style:{position:"absolute",bottom:"100%",left:0,right:0,backgroundColor:"#1a1a1a",border:"1px solid #d4af37",borderRadius:"8px 8px 0 0",padding:"6px",display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"2px",maxHeight:"180px",overflowY:"auto",zIndex:10,boxShadow:"0 -4px 12px rgba(0, 0, 0, 0.5)"},children:[u.jsx("div",{style:{gridColumn:"1 / -1",color:"#d4af37",fontSize:"0.6rem",fontFamily:"'Cinzel', serif",fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",padding:"4px 2px 2px",borderBottom:"1px solid rgba(212, 175, 55, 0.2)",marginBottom:"2px"},children:"Flexible Morals"}),mc.map(A=>u.jsx("button",{onClick:()=>En(A.emoji),title:A.label,type:"button",style:{background:"none",border:"1px solid rgba(212, 175, 55, 0.25)",backgroundColor:"rgba(212, 175, 55, 0.06)",fontSize:"1.2rem",cursor:"pointer",padding:"4px",borderRadius:"4px",lineHeight:1},children:A.emoji},A.label)),u.jsx("div",{style:{gridColumn:"1 / -1",color:"#d4af37",fontSize:"0.6rem",fontFamily:"'Cinzel', serif",fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",padding:"4px 2px 2px",borderBottom:"1px solid rgba(212, 175, 55, 0.2)",marginBottom:"2px"},children:"Standard"}),gc.map(A=>u.jsx("button",{onClick:()=>En(A),type:"button",style:{background:"none",border:"none",fontSize:"1.2rem",cursor:"pointer",padding:"4px",borderRadius:"4px",lineHeight:1},children:A},`std-${A}`))]})]}),u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[u.jsx("button",{type:"button",onClick:()=>G(A=>!A),style:{background:"none",border:"none",fontSize:"1.2rem",cursor:"pointer",opacity:.7,padding:"2px 4px",lineHeight:1},children:"😀"}),u.jsxs("span",{style:{fontSize:"11px",color:w.length>=450?"#e07050":"#888"},children:[w.length,"/500"]})]}),u.jsx("button",{type:"submit",disabled:!w.trim()||B,style:{backgroundColor:!w.trim()||B?"#555":"#b79b3d",color:"#fdf8e6",padding:"6px 18px",borderRadius:"4px",fontSize:"13px",fontWeight:600,border:"none",cursor:!w.trim()||B?"not-allowed":"pointer"},children:"Proclaim"})]})]}),f.length===0&&u.jsx("p",{style:{textAlign:"center",color:"#666",fontStyle:"italic",padding:"2rem 0"},children:"No comments yet. Be the first to speak."}),u.jsx("div",{children:ue.map(A=>gt(A,0))})]}),D&&u.jsx(hl,{username:D.username,blessings:L(D.username),donorTier:(He=a(D.username))==null?void 0:He.tier,position:{x:D.x,y:D.y},onClose:()=>F(null)})]})}function GE(){const e=Wn("(max-width: 768px)");return u.jsxs("div",{style:{backgroundColor:"black",color:"white",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:e?"1.5rem 1rem":"2rem",textAlign:"center"},children:[u.jsx("h1",{style:{fontSize:e?"1.5rem":"2rem",marginBottom:"1rem",color:"#d4af37",fontFamily:"'Cinzel', serif",letterSpacing:"0.1em"},children:"OUR CHARTER"}),u.jsx("p",{style:{maxWidth:"700px",lineHeight:"1.6"},children:"Flexible Morals was founded by two individuals looking for a framework of morality that would proactively evolve with the times. Our goal is to create an ad-free, bot-free space to serve as a forum for what the internet believes to be the present day ten commandments for living a moral life. Will the internet reinforce human principles like not murdering others, or will it reward timely meme-like reactions to inform our moral code?"}),u.jsxs("p",{style:{maxWidth:"700px",lineHeight:"1.6",marginTop:"1rem"},children:["You, dear reader and future disciple, can voice your opinion in the ",u.jsx("strong",{style:{color:"#d4af37",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 6px",borderRadius:"3px"},children:"world's first democratic religion"}),". Share the daily commandment guiding your life, and vote on the commandments of others. The collective will decide our top ten commandments, with voting resetting every month."]}),u.jsx("p",{style:{maxWidth:"700px",lineHeight:"1.6",marginTop:"1rem"},children:"If you are compelled by the mission of navigating morality through the flexible nature of culture and time, please consider making an offering to support keeping this website alive, ad-free, and bot-free."}),u.jsx("p",{style:{maxWidth:"700px",lineHeight:"1.6",marginTop:"1rem"},children:"If you would like to spread the word, share the website with your friends or consider buying our merchandise to represent the good word."}),u.jsx("p",{style:{maxWidth:"700px",lineHeight:"1.6",marginTop:"1rem"},children:"Our objective is not to make a profit, but to facilitate a movement. One inflexible principle of our founding is that we will donate to Save the Children, in support of those providing hope and care for humanity's future."}),u.jsx("button",{onClick:()=>window.history.back(),style:{marginTop:"2rem",backgroundColor:"#d4af37",border:"none",borderRadius:"8px",padding:e?"12px 20px":"10px 18px",color:"white",fontWeight:600,cursor:"pointer",minHeight:"44px"},children:"Back to Home"})]})}function YE(){var m;const e=Ho(),{user:t,openLoginModal:n}=Cr(),{myDonorStatus:r,loadMyDonorStatus:o}=Jr(),i=Wn("(max-width: 768px)"),[s,a]=h.useState(""),[l,c]=h.useState(null),[d,f]=h.useState(!1),[p,v]=h.useState([]);h.useEffect(()=>{Db().then(g=>v(g.tiers||[]))},[]),h.useEffect(()=>{t&&o(t)},[t,o]);const x=()=>t?!0:(n(),!1),w=async g=>{var y,S;if(g.preventDefault(),!!x()&&s.trim()){f(!0),c(null);try{const k=await Nb(s.trim(),t);c({success:!0,message:k.message}),a(""),o(t)}catch(k){c({success:!1,message:((S=(y=k.response)==null?void 0:y.data)==null?void 0:S.error)||"Failed to link email"})}finally{f(!1)}}};return u.jsx("div",{style:{backgroundImage:"url('/Voting_Background.png')",backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",minHeight:"100vh",width:"100vw",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"2rem",paddingBottom:"2rem"},children:u.jsxs("div",{style:{backgroundColor:"rgba(26, 26, 26, 0.95)",borderRadius:"12px",padding:i?"1rem":"2rem",maxWidth:"600px",width:i?"95%":"90%",boxShadow:"0 4px 20px rgba(0,0,0,0.4)",border:"2px solid #d4af37",color:"#fdf8e6"},children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[u.jsx("h1",{style:{color:"#d4af37",margin:0,fontSize:i?"1.4rem":"1.8rem"},children:"Donor Profile"}),u.jsx("button",{onClick:()=>e("/"),className:"home-button",children:"🏠 Home"})]}),t?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{backgroundColor:"rgba(212, 175, 55, 0.1)",border:"1px solid #d4af37",borderRadius:"10px",padding:"1.5rem",marginBottom:"1.5rem",textAlign:"center"},children:[u.jsx("p",{style:{color:"#aaa",marginBottom:"0.5rem",fontSize:"0.9rem"},children:"Logged in as"}),u.jsxs("h2",{style:{color:"#d4af37",margin:"0 0 1rem 0",fontSize:"1.5rem"},children:[t,(r==null?void 0:r.tier)&&u.jsx(Xt,{tier:r.tier,size:"large"})]}),r!=null&&r.isDonor?u.jsxs("div",{children:[u.jsxs("p",{style:{fontSize:"2rem",fontWeight:"bold",margin:"0.5rem 0"},children:["$",((r.totalDonated||0)/100).toFixed(2)]}),u.jsxs("p",{style:{color:"#aaa",fontSize:"0.9rem"},children:["Total donated • ",(m=r.tier)==null?void 0:m.toUpperCase()," tier"]}),r.nextTier&&r.amountToNextTier>0&&u.jsxs("p",{style:{color:"#888",fontSize:"0.85rem",marginTop:"0.5rem"},children:["$",(r.amountToNextTier/100).toFixed(2)," more to reach ",r.nextTier]})]}):u.jsx("p",{style:{color:"#888"},children:"You haven't donated yet. Link your donation email below to get started!"})]}),u.jsxs("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.3)",borderRadius:"10px",padding:"1.5rem",marginBottom:"1.5rem"},children:[u.jsx("h3",{style:{color:"#d4af37",marginTop:0,marginBottom:"0.5rem"},children:"Link Your Donation Email"}),u.jsx("p",{style:{color:"#888",fontSize:"0.9rem",marginBottom:"1rem"},children:"Enter the email you use for PayPal or credit card donations to receive your donor flair. Any past donations from this email will be credited to your account."}),u.jsxs("form",{onSubmit:w,children:[u.jsx("input",{type:"email",placeholder:"your.email@example.com",value:s,onChange:g=>a(g.target.value),style:{width:"100%",padding:"12px",borderRadius:"6px",border:"1px solid #555",backgroundColor:"#2a2a2a",color:"#fdf8e6",fontSize:"1rem",marginBottom:"0.75rem",boxSizing:"border-box"}}),u.jsx("button",{type:"submit",disabled:d||!s.trim(),style:{width:"100%",padding:"12px",borderRadius:"6px",border:"none",backgroundColor:d?"#555":"#b79b3d",color:"#fdf8e6",fontSize:"1rem",fontWeight:600,cursor:d?"not-allowed":"pointer"},children:d?"Linking...":"Link Email"})]}),l&&u.jsx("p",{style:{marginTop:"1rem",padding:"10px",borderRadius:"6px",backgroundColor:l.success?"rgba(76, 175, 80, 0.2)":"rgba(244, 67, 54, 0.2)",color:l.success?"#4caf50":"#f44336",fontSize:"0.9rem"},children:l.message}),(r==null?void 0:r.linkedEmail)&&u.jsxs("p",{style:{color:"#888",fontSize:"0.85rem",marginTop:"1rem"},children:["Currently linked: ",r.linkedEmail]})]}),u.jsxs("div",{children:[u.jsx("h3",{style:{color:"#d4af37",marginBottom:"1rem"},children:"Donor Tiers"}),u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:p.map(g=>u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",borderRadius:"8px",backgroundColor:(r==null?void 0:r.tier)===g.name?"rgba(212, 175, 55, 0.2)":"rgba(0, 0, 0, 0.2)",border:(r==null?void 0:r.tier)===g.name?"1px solid #d4af37":"1px solid #333"},children:[u.jsx("span",{style:{fontSize:"1.5rem"},children:g.icon}),u.jsxs("div",{style:{flex:1},children:[u.jsx("p",{style:{margin:0,fontWeight:600,color:g.color},children:g.label}),u.jsxs("p",{style:{margin:0,fontSize:"0.85rem",color:"#888"},children:["$",(g.threshold/100).toFixed(0),"+ donated"]})]}),(r==null?void 0:r.tier)===g.name&&u.jsx("span",{style:{color:"#4caf50",fontSize:"0.9rem"},children:"✓ Current"})]},g.name))})]})]}):u.jsxs("div",{style:{textAlign:"center",padding:"2rem 0"},children:[u.jsx("p",{style:{color:"#aaa",marginBottom:"1rem"},children:"Please log in to view your donor profile."}),u.jsx("button",{onClick:x,style:{backgroundColor:"#b79b3d",color:"#fdf8e6",padding:"10px 24px",borderRadius:"6px",border:"none",fontSize:"1rem",fontWeight:600,cursor:"pointer"},children:"Log In"})]})]})})}function qE(){return u.jsxs(Iw,{children:[u.jsx(ro,{path:"/",element:u.jsx(l2,{})}),u.jsx(ro,{path:"/vote",element:u.jsx(HE,{})}),u.jsx(ro,{path:"/comments/:postId",element:u.jsx(KE,{})}),u.jsx(ro,{path:"/about",element:u.jsx(GE,{})}),u.jsx(ro,{path:"/donor",element:u.jsx(YE,{})})]})}hu.createRoot(document.getElementById("root")).render(u.jsx(Um.StrictMode,{children:u.jsx(t2,{children:u.jsx(n2,{children:u.jsx(Ww,{children:u.jsx(qE,{})})})})}));