/")+"/"),tt(G,g,V,"",function(Le){return Le})):G!=null&&(Qe(G)&&(G=St(G,V+(!G.key||se&&se.key===G.key?"":(""+G.key).replace(et,"/")+"/")+f)),g.push(G)),1;if(se=0,W=W===""?".":W+":",we(f))for(var ee=0;ee>>1,g=R[f];if(0>>1;fk(G,T))Jk(se,G)?(R[f]=se,R[J]=T,f=J):(R[f]=G,R[W]=T,f=W);else if(Jk(se,T))R[f]=se,R[J]=T,f=J;else break e}}return I}function k(R,I){var T=R.sortIndex-I.sortIndex;return T!==0?T:R.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var _=performance;v.unstable_now=function(){return _.now()}}else{var P=Date,D=P.now();v.unstable_now=function(){return P.now()-D}}var N=[],Y=[],H=1,Q=null,X=3,Ne=!1,Te=!1,q=!1,$=typeof setTimeout=="function"?setTimeout:null,We=typeof clearTimeout=="function"?clearTimeout:null,ge=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function He(R){for(var I=c(Y);I!==null;){if(I.callback===null)E(Y);else if(I.startTime<=R)E(Y),I.sortIndex=I.expirationTime,y(N,I);else break;I=c(Y)}}function we(R){if(q=!1,He(R),!Te)if(c(N)!==null)Te=!0,Ee(Ye);else{var I=c(Y);I!==null&&ae(we,I.startTime-R)}}function Ye(R,I){Te=!1,q&&(q=!1,We(Be),Be=-1),Ne=!0;var T=X;try{for(He(I),Q=c(N);Q!==null&&(!(Q.expirationTime>I)||R&&!_t());){var f=Q.callback;if(typeof f=="function"){Q.callback=null,X=Q.priorityLevel;var g=f(Q.expirationTime<=I);I=v.unstable_now(),typeof g=="function"?Q.callback=g:Q===c(N)&&E(N),He(I)}else E(N);Q=c(N)}if(Q!==null)var V=!0;else{var W=c(Y);W!==null&&ae(we,W.startTime-I),V=!1}return V}finally{Q=null,X=T,Ne=!1}}var Ce=!1,De=null,Be=-1,St=5,Qe=-1;function _t(){return!(v.unstable_now()-QeR||125f?(R.sortIndex=T,y(Y,R),c(N)===null&&R===c(Y)&&(q?(We(Be),Be=-1):q=!0,ae(we,T-f))):(R.sortIndex=g,y(N,R),Te||Ne||(Te=!0,Ee(Ye))),R},v.unstable_shouldYield=_t,v.unstable_wrapCallback=function(R){var I=X;return function(){var T=X;X=I;try{return R.apply(this,arguments)}finally{X=T}}}})(Is)),Is}var Aa;function Jd(){return Aa||(Aa=1,Ds.exports=Zd()),Ds.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 Ha;function bd(){if(Ha)return Je;Ha=1;var v=Us(),y=Jd();function c(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"),N=Object.prototype.hasOwnProperty,Y=/^[: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]*$/,H={},Q={};function X(e){return N.call(Q,e)?!0:N.call(H,e)?!1:Y.test(e)?Q[e]=!0:(H[e]=!0,!1)}function Ne(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 Te(e,t,n,r){if(t===null||typeof t>"u"||Ne(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 q(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var $={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){$[e]=new q(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];$[t]=new q(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){$[e]=new q(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){$[e]=new q(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){$[e]=new q(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){$[e]=new q(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){$[e]=new q(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){$[e]=new q(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){$[e]=new q(e,5,!1,e.toLowerCase(),null,!1,!1)});var We=/[\-:]([a-z])/g;function ge(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(We,ge);$[t]=new q(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(We,ge);$[t]=new q(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(We,ge);$[t]=new q(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){$[e]=new q(e,1,!1,e.toLowerCase(),null,!1,!1)}),$.xlinkHref=new q("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){$[e]=new q(e,1,!1,e.toLowerCase(),null,!0,!0)});function He(e,t,n,r){var l=$.hasOwnProperty(t)?$[t]:null;(l!==null?l.type!==0:r||!(2u||l[o]!==i[u]){var a=` `+l[o].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=u);break}}}finally{V=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?g(e):""}function G(e){switch(e.tag){case 5:return g(e.type);case 16:return g("Lazy");case 13:return g("Suspense");case 19:return g("SuspenseList");case 0:case 2:case 15:return e=W(e.type,!1),e;case 11:return e=W(e.type.render,!1),e;case 1:return e=W(e.type,!0),e;default:return""}}function J(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 De:return"Fragment";case Ce:return"Portal";case St:return"Profiler";case Be:return"StrictMode";case Se:return"Suspense";case tt:return"SuspenseList"}if(typeof e=="object")switch(e.$typeof){case _t:return(e.displayName||"Context")+".Consumer";case Qe:return(e._context.displayName||"Context")+".Provider";case et:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case nt:return t=e.displayName||null,t!==null?t:J(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return J(e(t))}catch{}}return null}function se(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 J(t);case 8:return t===Be?"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 ee(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function oe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Le(e){var t=oe(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 l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function rn(e){e._valueTracker||(e._valueTracker=Le(e))}function w(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=oe(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Z(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 ne(e,t){var n=t.checked;return T({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function re(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ee(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 It(e,t){t=t.checked,t!=null&&He(e,"checked",t,!1)}function Hl(e,t){It(e,t);var n=ee(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")?Bl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Bl(e,t.type,ee(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Vs(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 Bl(e,t,n){(t!=="number"||Z(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $n=Array.isArray;function gn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Rr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yn={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},Ja=["Webkit","ms","Moz","O"];Object.keys(Yn).forEach(function(e){Ja.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yn[t]=Yn[e]})});function Gs(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yn.hasOwnProperty(e)&&Yn[e]?(""+t).trim():t+"px"}function Xs(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Gs(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var ba=T({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 Wl(e,t){if(t){if(ba[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(c(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(c(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(c(61))}if(t.style!=null&&typeof t.style!="object")throw Error(c(62))}}function Yl(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 Ql=null;function Kl(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Gl=null,xn=null,wn=null;function qs(e){if(e=pr(e)){if(typeof Gl!="function")throw Error(c(280));var t=e.stateNode;t&&(t=Jr(t),Gl(e.stateNode,e.type,t))}}function Zs(e){xn?wn?wn.push(e):wn=[e]:xn=e}function Js(){if(xn){var e=xn,t=wn;if(wn=xn=null,qs(e),t)for(e=0;e>>=0,e===0?32:31-(cc(e)/dc|0)|0}var Or=64,Dr=4194304;function Xn(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 Ir(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var u=o&~l;u!==0?r=Xn(u):(i&=o,i!==0&&(r=Xn(i)))}else o=n&~l,o!==0?r=Xn(o):i!==0&&(r=Xn(i));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function qn(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-pt(t),e[t]=n}function mc(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=lr),_o=" ",Po=!1;function Ro(e,t){switch(e){case"keyup":return $c.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zo(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jn=!1;function Yc(e,t){switch(e){case"compositionend":return zo(t);case"keypress":return t.which!==32?null:(Po=!0,_o);case"textInput":return e=t.data,e===_o&&Po?null:e;default:return null}}function Qc(e,t){if(jn)return e==="compositionend"||!fi&&Ro(e,t)?(e=So(),Br=si=Bt=null,jn=!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=Fo(n)}}function Ao(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ao(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ho(){for(var e=window,t=Z();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Z(e.document)}return t}function mi(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 td(e){var t=Ho(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ao(n.ownerDocument.documentElement,n)){if(r!==null&&mi(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 l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Uo(n,i);var o=Uo(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Nn=null,vi=null,ur=null,yi=!1;function Bo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yi||Nn==null||Nn!==Z(r)||(r=Nn,"selectionStart"in r&&mi(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}),ur&&or(ur,r)||(ur=r,r=Xr(vi,"onSelect"),0Rn||(e.current=Ri[Rn],Ri[Rn]=null,Rn--)}function ue(e,t){Rn++,Ri[Rn]=e.current,e.current=t}var Yt={},Ie=Wt(Yt),Ke=Wt(!1),on=Yt;function zn(e,t){var n=e.type.contextTypes;if(!n)return Yt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Ge(e){return e=e.childContextTypes,e!=null}function br(){de(Ke),de(Ie)}function nu(e,t,n){if(Ie.current!==Yt)throw Error(c(168));ue(Ie,t),ue(Ke,n)}function ru(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(c(108,se(e)||"Unknown",l));return T({},n,r)}function el(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yt,on=Ie.current,ue(Ie,e),ue(Ke,Ke.current),!0}function lu(e,t,n){var r=e.stateNode;if(!r)throw Error(c(169));n?(e=ru(e,t,on),r.__reactInternalMemoizedMergedChildContext=e,de(Ke),de(Ie),ue(Ie,e)):de(Ke),ue(Ke,n)}var Rt=null,tl=!1,zi=!1;function iu(e){Rt===null?Rt=[e]:Rt.push(e)}function pd(e){tl=!0,iu(e)}function Qt(){if(!zi&&Rt!==null){zi=!0;var e=0,t=ie;try{var n=Rt;for(ie=1;e>=o,l-=o,zt=1<<32-pt(t)+l|n<B?(Re=A,A=null):Re=A.sibling;var te=x(p,A,h[B],C);if(te===null){A===null&&(A=Re);break}e&&A&&te.alternate===null&&t(p,A),d=i(te,d,B),U===null?F=te:U.sibling=te,U=te,A=Re}if(B===h.length)return n(p,A),fe&&an(p,B),F;if(A===null){for(;BB?(Re=A,A=null):Re=A.sibling;var tn=x(p,A,te.value,C);if(tn===null){A===null&&(A=Re);break}e&&A&&tn.alternate===null&&t(p,A),d=i(tn,d,B),U===null?F=tn:U.sibling=tn,U=tn,A=Re}if(te.done)return n(p,A),fe&&an(p,B),F;if(A===null){for(;!te.done;B++,te=h.next())te=j(p,te.value,C),te!==null&&(d=i(te,d,B),U===null?F=te:U.sibling=te,U=te);return fe&&an(p,B),F}for(A=r(p,A);!te.done;B++,te=h.next())te=z(A,p,B,te.value,C),te!==null&&(e&&te.alternate!==null&&A.delete(te.key===null?B:te.key),d=i(te,d,B),U===null?F=te:U.sibling=te,U=te);return e&&A.forEach(function(Kd){return t(p,Kd)}),fe&&an(p,B),F}function ye(p,d,h,C){if(typeof h=="object"&&h!==null&&h.type===De&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$typeof){case Ye:e:{for(var F=h.key,U=d;U!==null;){if(U.key===F){if(F=h.type,F===De){if(U.tag===7){n(p,U.sibling),d=l(U,h.props.children),d.return=p,p=d;break e}}else if(U.elementType===F||typeof F=="object"&&F!==null&&F.$typeof===Ee&&du(F)===U.type){n(p,U.sibling),d=l(U,h.props),d.ref=hr(p,U,h),d.return=p,p=d;break e}n(p,U);break}else t(p,U);U=U.sibling}h.type===De?(d=yn(h.props.children,p.mode,C,h.key),d.return=p,p=d):(C=Rl(h.type,h.key,h.props,null,p.mode,C),C.ref=hr(p,d,h),C.return=p,p=C)}return o(p);case Ce:e:{for(U=h.key;d!==null;){if(d.key===U)if(d.tag===4&&d.stateNode.containerInfo===h.containerInfo&&d.stateNode.implementation===h.implementation){n(p,d.sibling),d=l(d,h.children||[]),d.return=p,p=d;break e}else{n(p,d);break}else t(p,d);d=d.sibling}d=_s(h,p.mode,C),d.return=p,p=d}return o(p);case Ee:return U=h._init,ye(p,d,U(h._payload),C)}if($n(h))return M(p,d,h,C);if(I(h))return O(p,d,h,C);il(p,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,d!==null&&d.tag===6?(n(p,d.sibling),d=l(d,h),d.return=p,p=d):(n(p,d),d=Es(h,p.mode,C),d.return=p,p=d),o(p)):n(p,d)}return ye}var On=fu(!0),pu=fu(!1),sl=Wt(null),ol=null,Dn=null,Ii=null;function Fi(){Ii=Dn=ol=null}function Ui(e){var t=sl.current;de(sl),e._currentValue=t}function Ai(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 In(e,t){ol=e,Ii=Dn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Xe=!0),e.firstContext=null)}function at(e){var t=e._currentValue;if(Ii!==e)if(e={context:e,memoizedValue:t,next:null},Dn===null){if(ol===null)throw Error(c(308));Dn=e,ol.dependencies={lanes:0,firstContext:e}}else Dn=Dn.next=e;return t}var cn=null;function Hi(e){cn===null?cn=[e]:cn.push(e)}function hu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Hi(t)):(n.next=l.next,l.next=n),t.interleaved=n,Lt(e,r)}function Lt(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 Kt=!1;function Bi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mu(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 Mt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Gt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(b&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Lt(e,n)}return l=r.interleaved,l===null?(t.next=t,Hi(r)):(t.next=l.next,l.next=t),r.interleaved=t,Lt(e,n)}function ul(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,ti(e,n)}}function vu(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,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 al(e,t,n,r){var l=e.updateQueue;Kt=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,m=a.next;a.next=null,o===null?i=m:o.next=m,o=a;var S=e.alternate;S!==null&&(S=S.updateQueue,u=S.lastBaseUpdate,u!==o&&(u===null?S.firstBaseUpdate=m:u.next=m,S.lastBaseUpdate=a))}if(i!==null){var j=l.baseState;o=0,S=m=a=null,u=i;do{var x=u.lane,z=u.eventTime;if((r&x)===x){S!==null&&(S=S.next={eventTime:z,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var M=e,O=u;switch(x=t,z=n,O.tag){case 1:if(M=O.payload,typeof M=="function"){j=M.call(z,j,x);break e}j=M;break e;case 3:M.flags=M.flags&-65537|128;case 0:if(M=O.payload,x=typeof M=="function"?M.call(z,j,x):M,x==null)break e;j=T({},j,x);break e;case 2:Kt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,x=l.effects,x===null?l.effects=[u]:x.push(u))}else z={eventTime:z,lane:x,tag:u.tag,payload:u.payload,callback:u.callback,next:null},S===null?(m=S=z,a=j):S=S.next=z,o|=x;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;x=u,u=x.next,x.next=null,l.lastBaseUpdate=x,l.shared.pending=null}}while(!0);if(S===null&&(a=j),l.baseState=a,l.firstBaseUpdate=m,l.lastBaseUpdate=S,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);pn|=o,e.lanes=o,e.memoizedState=j}}function yu(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Qi.transition;Qi.transition={};try{e(!1),t()}finally{ie=n,Qi.transition=r}}function Iu(){return ct().memoizedState}function yd(e,t,n){var r=Jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Fu(e))Uu(t,n);else if(n=hu(e,t,n,r),n!==null){var l=$e();xt(n,e,r,l),Au(n,t,r)}}function gd(e,t,n){var r=Jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fu(e))Uu(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,u=i(o,n);if(l.hasEagerState=!0,l.eagerState=u,ht(u,o)){var a=t.interleaved;a===null?(l.next=l,Hi(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=hu(e,t,l,r),n!==null&&(l=$e(),xt(n,e,r,l),Au(n,t,r))}}function Fu(e){var t=e.alternate;return e===he||t!==null&&t===he}function Uu(e,t){gr=fl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Au(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ti(e,n)}}var ml={readContext:at,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useInsertionEffect:Fe,useLayoutEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useMutableSource:Fe,useSyncExternalStore:Fe,useId:Fe,unstable_isNewReconciler:!1},xd={readContext:at,useCallback:function(e,t){return Ct().memoizedState=[e,t===void 0?null:t],e},useContext:at,useEffect:Pu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pl(4194308,4,Tu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pl(4194308,4,e,t)},useInsertionEffect:function(e,t){return pl(4,2,e,t)},useMemo:function(e,t){var n=Ct();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ct();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=yd.bind(null,he,e),[r.memoizedState,e]},useRef:function(e){var t=Ct();return e={current:e},t.memoizedState=e},useState:Eu,useDebugValue:bi,useDeferredValue:function(e){return Ct().memoizedState=e},useTransition:function(){var e=Eu(!1),t=e[0];return e=vd.bind(null,e[1]),Ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=he,l=Ct();if(fe){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),Pe===null)throw Error(c(349));(fn&30)!==0||Su(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Pu(ju.bind(null,r,i,e),[e]),r.flags|=2048,Sr(9,ku.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ct(),t=Pe.identifierPrefix;if(fe){var n=Tt,r=zt;n=(r&~(1<<32-pt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=xr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[jt]=t,e[fr]=r,ia(e,t,!1,!1),t.stateNode=e;e:{switch(o=Yl(n,r),n){case"dialog":ce("cancel",e),ce("close",e),l=r;break;case"iframe":case"object":case"embed":ce("load",e),l=r;break;case"video":case"audio":for(l=0;lBn&&(t.flags|=128,r=!0,kr(i,!1),t.lanes=4194304)}else{if(!r)if(e=cl(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!fe)return Ue(t),null}else 2*ve()-i.renderingStartTime>Bn&&n!==1073741824&&(t.flags|=128,r=!0,kr(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ve(),t.sibling=null,n=pe.current,ue(pe,r?n&1|2:n&1),t):(Ue(t),null);case 22:case 23:return js(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(st&1073741824)!==0&&(Ue(t),t.subtreeFlags&6&&(t.flags|=8192)):Ue(t),null;case 24:return null;case 25:return null}throw Error(c(156,t.tag))}function _d(e,t){switch(Li(t),t.tag){case 1:return Ge(t.type)&&br(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Fn(),de(Ke),de(Ie),Yi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return $i(t),null;case 13:if(de(pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return de(pe),null;case 4:return Fn(),null;case 10:return Ui(t.type._context),null;case 22:case 23:return js(),null;case 24:return null;default:return null}}var xl=!1,Ae=!1,Pd=typeof WeakSet=="function"?WeakSet:Set,L=null;function An(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){me(e,t,r)}else n.current=null}function ds(e,t,n){try{n()}catch(r){me(e,t,r)}}var ua=!1;function Rd(e,t){if(ji=Ar,e=Ho(),mi(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 l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,u=-1,a=-1,m=0,S=0,j=e,x=null;t:for(;;){for(var z;j!==n||l!==0&&j.nodeType!==3||(u=o+l),j!==i||r!==0&&j.nodeType!==3||(a=o+r),j.nodeType===3&&(o+=j.nodeValue.length),(z=j.firstChild)!==null;)x=j,j=z;for(;;){if(j===e)break t;if(x===n&&++m===l&&(u=o),x===i&&++S===r&&(a=o),(z=j.nextSibling)!==null)break;j=x,x=j.parentNode}j=z}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},Ar=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var M=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var O=M.memoizedProps,ye=M.memoizedState,p=t.stateNode,d=p.getSnapshotBeforeUpdate(t.elementType===t.type?O:vt(t.type,O),ye);p.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(C){me(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return M=ua,ua=!1,M}function jr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&ds(t,n,i)}l=l.next}while(l!==r)}}function wl(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 fs(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 aa(e){var t=e.alternate;t!==null&&(e.alternate=null,aa(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[jt],delete t[fr],delete t[Pi],delete t[dd],delete t[fd])),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 ca(e){return e.tag===5||e.tag===3||e.tag===4}function da(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ca(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 ps(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=Zr));else if(r!==4&&(e=e.child,e!==null))for(ps(e,t,n),e=e.sibling;e!==null;)ps(e,t,n),e=e.sibling}function hs(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(hs(e,t,n),e=e.sibling;e!==null;)hs(e,t,n),e=e.sibling}var Me=null,yt=!1;function Xt(e,t,n){for(n=n.child;n!==null;)fa(e,t,n),n=n.sibling}function fa(e,t,n){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(Mr,n)}catch{}switch(n.tag){case 5:Ae||An(n,t);case 6:var r=Me,l=yt;Me=null,Xt(e,t,n),Me=r,yt=l,Me!==null&&(yt?(e=Me,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Me.removeChild(n.stateNode));break;case 18:Me!==null&&(yt?(e=Me,n=n.stateNode,e.nodeType===8?_i(e.parentNode,n):e.nodeType===1&&_i(e,n),tr(e)):_i(Me,n.stateNode));break;case 4:r=Me,l=yt,Me=n.stateNode.containerInfo,yt=!0,Xt(e,t,n),Me=r,yt=l;break;case 0:case 11:case 14:case 15:if(!Ae&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&((i&2)!==0||(i&4)!==0)&&ds(n,t,o),l=l.next}while(l!==r)}Xt(e,t,n);break;case 1:if(!Ae&&(An(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){me(n,t,u)}Xt(e,t,n);break;case 21:Xt(e,t,n);break;case 22:n.mode&1?(Ae=(r=Ae)||n.memoizedState!==null,Xt(e,t,n),Ae=r):Xt(e,t,n);break;default:Xt(e,t,n)}}function pa(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Pd),t.forEach(function(r){var l=Ud.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function gt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=ve()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Td(r/1960))-r,10e?16:e,Zt===null)var r=!1;else{if(e=Zt,Zt=null,Cl=0,(b&6)!==0)throw Error(c(331));var l=b;for(b|=4,L=e.current;L!==null;){var i=L,o=i.child;if((L.flags&16)!==0){var u=i.deletions;if(u!==null){for(var a=0;ave()-ys?mn(e,0):vs|=n),Ze(e,t)}function Ea(e,t){t===0&&((e.mode&1)===0?t=1:(t=Dr,Dr<<=1,(Dr&130023424)===0&&(Dr=4194304)));var n=$e();e=Lt(e,t),e!==null&&(qn(e,t,n),Ze(e,n))}function Fd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ea(e,n)}function Ud(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(c(314))}r!==null&&r.delete(t),Ea(e,n)}var _a;_a=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ke.current)Xe=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return Xe=!1,Cd(e,t,n);Xe=(e.flags&131072)!==0}else Xe=!1,fe&&(t.flags&1048576)!==0&&su(t,rl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gl(e,t),e=t.pendingProps;var l=zn(t,Ie.current);In(t,n),l=Gi(null,t,r,e,l,n);var i=Xi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ge(r)?(i=!0,el(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Bi(t),l.updater=vl,t.stateNode=l,l._reactInternals=t,ts(t,r,e,n),t=is(null,t,r,!0,i,n)):(t.tag=0,fe&&i&&Ti(t),Ve(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(gl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Hd(r),e=vt(r,e),l){case 0:t=ls(null,t,r,e,n);break e;case 1:t=bu(null,t,r,e,n);break e;case 11:t=Gu(null,t,r,e,n);break e;case 14:t=Xu(null,t,r,vt(r.type,e),n);break e}throw Error(c(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),ls(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),bu(e,t,r,l,n);case 3:e:{if(ea(t),e===null)throw Error(c(387));r=t.pendingProps,i=t.memoizedState,l=i.element,mu(e,t),al(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=Un(Error(c(423)),t),t=ta(e,t,r,n,l);break e}else if(r!==l){l=Un(Error(c(424)),t),t=ta(e,t,r,n,l);break e}else for(it=$t(t.stateNode.containerInfo.firstChild),lt=t,fe=!0,mt=null,n=pu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Mn(),r===l){t=Ot(e,t,n);break e}Ve(e,t,r,n)}t=t.child}return t;case 5:return gu(t),e===null&&Oi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,Ci(r,l)?o=null:i!==null&&Ci(r,i)&&(t.flags|=32),Ju(e,t),Ve(e,t,o,n),t.child;case 6:return e===null&&Oi(t),null;case 13:return na(e,t,n);case 4:return Vi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=On(t,null,r,n):Ve(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),Gu(e,t,r,l,n);case 7:return Ve(e,t,t.pendingProps,n),t.child;case 8:return Ve(e,t,t.pendingProps.children,n),t.child;case 12:return Ve(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,ue(sl,r._currentValue),r._currentValue=o,i!==null)if(ht(i.value,o)){if(i.children===l.children&&!Ke.current){t=Ot(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){o=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Mt(-1,n&-n),a.tag=2;var m=i.updateQueue;if(m!==null){m=m.shared;var S=m.pending;S===null?a.next=a:(a.next=S.next,S.next=a),m.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Ai(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(c(341));o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Ai(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Ve(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,In(t,n),l=at(l),r=r(l),t.flags|=1,Ve(e,t,r,n),t.child;case 14:return r=t.type,l=vt(r,t.pendingProps),l=vt(r.type,l),Xu(e,t,r,l,n);case 15:return qu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),gl(e,t),t.tag=1,Ge(r)?(e=!0,el(t)):e=!1,In(t,n),Bu(t,r,l),ts(t,r,l,n),is(null,t,r,!0,e,n);case 19:return la(e,t,n);case 22:return Zu(e,t,n)}throw Error(c(156,t.tag))};function Pa(e,t){return so(e,t)}function Ad(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 ft(e,t,n,r){return new Ad(e,t,n,r)}function Cs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hd(e){if(typeof e=="function")return Cs(e)?1:0;if(e!=null){if(e=e.$typeof,e===et)return 11;if(e===nt)return 14}return 2}function en(e,t){var n=e.alternate;return n===null?(n=ft(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 Rl(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Cs(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case De:return yn(n.children,l,i,t);case Be:o=8,l|=8;break;case St:return e=ft(12,n,t,l|2),e.elementType=St,e.lanes=i,e;case Se:return e=ft(13,n,t,l),e.elementType=Se,e.lanes=i,e;case tt:return e=ft(19,n,t,l),e.elementType=tt,e.lanes=i,e;case ae:return zl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$typeof){case Qe:o=10;break e;case _t:o=9;break e;case et:o=11;break e;case nt:o=14;break e;case Ee:o=16,r=null;break e}throw Error(c(130,e==null?e:typeof e,""))}return t=ft(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function yn(e,t,n,r){return e=ft(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=ft(22,e,r,t),e.elementType=ae,e.lanes=n,e.stateNode={isHidden:!1},e}function Es(e,t,n){return e=ft(6,e,null,t),e.lanes=n,e}function _s(e,t,n){return t=ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bd(e,t,n,r,l){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=ei(0),this.expirationTimes=ei(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ei(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ps(e,t,n,r,l,i,o,u,a){return e=new Bd(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ft(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bi(i),e}function Vd(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(v)}catch(y){console.error(y)}}return v(),Os.exports=bd(),Os.exports}var Va;function tf(){if(Va)return Fl;Va=1;var v=ef();return Fl.createRoot=v.createRoot,Fl.hydrateRoot=v.hydrateRoot,Fl}var nf=tf();/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rf=v=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$a=(...v)=>v.filter((y,c,E)=>!!y&&y.trim()!==""&&E.indexOf(y)===c).join(" ").trim();/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var lf={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sf=le.forwardRef(({color:v="currentColor",size:y=24,strokeWidth:c=2,absoluteStrokeWidth:E,className:k="",children:_,iconNode:P,...D},N)=>le.createElement("svg",{ref:N,...lf,width:y,height:y,stroke:v,strokeWidth:E?Number(c)*24/Number(y):c,className:$a("lucide",k),...D},[...P.map(([Y,H])=>le.createElement(Y,H)),...Array.isArray(_)?_:[_]]));/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ze=(v,y)=>{const c=le.forwardRef(({className:E,...k},_)=>le.createElement(sf,{ref:_,iconNode:y,className:$a(`lucide-${rf(v)}`,E),...k}));return c.displayName=`${v}`,c};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wt=ze("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const of=ze("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uf=ze("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const As=ze("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const af=ze("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cf=ze("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fs=ze("Club",[["path",{d:"M17.28 9.05a5.5 5.5 0 1 0-10.56 0A5.5 5.5 0 1 0 12 17.66a5.5 5.5 0 1 0 5.28-8.6Z",key:"27yuqz"}],["path",{d:"M12 17.66L12 22",key:"ogfahf"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wa=ze("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const df=ze("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ya=ze("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qa=ze("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ka=ze("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hs=ze("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ga=ze("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ff=ze("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pf=ze("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Al=ze("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hf=ze("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Bs={Excellent:1,Good:.75,Decent:.45,OK:.25};function Xa(v,y="yd"){return y==="m"?v*1.09361:v}function mf(v){if(!v.length)return null;const y=[...v].sort((E,k)=>E-k),c=Math.floor(y.length/2);return y.length%2?y[c]:(y[c-1]+y[c])/2}function vf(v){const y=v.map(k=>({d:Xa(k.distance,k.unit),w:Bs[k.quality]||0})).filter(k=>k.w>0).sort((k,_)=>k.d-_.d),c=y.reduce((k,_)=>k+_.w,0)/2;let E=0;for(const k of y)if(E+=k.w,E>=c)return k.d;return null}function qa(v,y){const c=v.filter(N=>Bs[N.quality]>0&&N.effort===y);if(!c.length)return null;const E=new Map;for(const N of c){const Y=N.session_id||"single-session";E.set(Y,[...E.get(Y)||[],N])}const k=[...E.values()].map(vf).filter(N=>N!==null),_=mf(k),P=new Set(c.map(N=>N.session_id).filter(Boolean)).size,D=c.length<5||P<2?"Early estimate":c.length<12||P<3?"Developing":"Reliable";return{distanceYards:Math.round(_),shots:c.length,sessions:P,confidence:D,measured:!0}}function yf(v,y){return y>0?[...new Set(v.map(c=>c.club_id))].flatMap(c=>{const E=v.filter(k=>k.club_id===c);return[50,75,100,110].flatMap(k=>{const _=qa(E,k);if(!_)return[];const P=E.filter(X=>X.effort===k),D=P.map(X=>Xa(X.distance,X.unit)).sort((X,Ne)=>X-Ne),N=D.length>1?D[Math.floor(D.length*.75)]-D[Math.floor(D.length*.25)]:0,Y=Math.min(18,(P.length<3?7:0)+N*.12),H=P.reduce((X,Ne)=>X+(1-(Bs[Ne.quality]||0))*5,0)/P.length,Q=_.confidence==="Early estimate"?8:_.confidence==="Developing"?4:0;return[{club_id:c,club_name:E[0].club_name,effort:k,distanceYards:_.distanceYards,shots:_.shots,sessions:_.sessions,confidence:_.confidence,measured:!0,errorYards:Math.abs(_.distanceYards-y),score:Math.abs(_.distanceYards-y)+Q+Y+H}]})}).sort((c,E)=>c.score-E.score).slice(0,4):[]}const gf="/api";async function be(v,y={}){const c=await fetch(gf+v,{...y,headers:{"Content-Type":"application/json",...y.headers||{}},credentials:"include"}),E=await c.json().catch(()=>({error:"Something went wrong"}));if(!c.ok)throw new Error(E.error||"Request failed");return E}function xf(){var rn;const[v,y]=le.useState(null),[c,E]=le.useState("Home"),[k,_]=le.useState([]),[P,D]=le.useState([]),[N,Y]=le.useState([]),[H,Q]=le.useState({theme:"system",units:"yd"}),[X,Ne]=le.useState(!0),[Te,q]=le.useState(""),[$,We]=le.useState(null),[ge,He]=le.useState(null),[we,Ye]=le.useState(""),[Ce,De]=le.useState(100),[Be,St]=le.useState("Good"),[Qe,_t]=le.useState(""),[et,Se]=le.useState(""),[tt,nt]=le.useState(""),[Ee,ae]=le.useState(!1),R=async()=>{const w=await be("/auth/me");if(y(w.user),w.user){const[Z,ne,re,It]=await Promise.all([be("/clubs"),be("/shots"),be("/sessions"),be("/settings")]);_(Z.clubs),D(ne.shots),Y(re.sessions),Q(It.settings)}};le.useEffect(()=>{R().catch(()=>{}).finally(()=>Ne(!1))},[]),le.useEffect(()=>{document.documentElement.dataset.theme=H.theme,document.documentElement.dataset.units=H.units},[H]),le.useEffect(()=>{if(Te){const w=setTimeout(()=>q(""),2400);return()=>clearTimeout(w)}},[Te]);const I=k.filter(w=>!w.archived_at),T=le.useMemo(()=>new Set(P.map(w=>w.club_id)).size,[P]),f=["Home","Range","Distances","Caddy","My Bag"],g=w=>{E(w),Se(""),window.scrollTo(0,0)},V=async()=>{await be("/auth/logout",{method:"POST"}),y(null),E("Home"),We(null)},W=async(w,Z)=>{try{const ne={username:w.get("username"),password:w.get("password"),confirm:w.get("confirm")},re=await be(`/auth/${Z}`,{method:"POST",body:JSON.stringify(ne)});y(re.user),await R(),g(Z==="register"?"Onboarding":"Home")}catch(ne){q(ne.message)}},G=async()=>{if(!I.length){g("My Bag");return}const w=await be("/sessions",{method:"POST",body:JSON.stringify({name:`Range session · ${new Date().toLocaleDateString()}`,club_ids:I.map(Z=>Z.id)})});We(w.session),He(I[0]),E("RangeActive")},J=async()=>{const w=Number(we);if(!w||!ge||!$)return q("Add a distance first");if(Ee)return;const Z=tt||crypto.randomUUID();nt(Z),ae(!0);try{const ne=await be("/shots",{method:"POST",body:JSON.stringify({session_id:$.id,club_id:ge.id,distance:w,unit:H.units,effort:Ce,quality:Be,idempotency_key:Z})});D(re=>re.some(It=>It.id===ne.shot.id)?re:[ne.shot,...re]),Ye(""),nt(""),q("Shot recorded")}catch(ne){q(ne.message)}finally{ae(!1)}},se=async()=>{&(await be(`/sessions/${$.id}/finish`,{method:"POST"}),We(null),await R(),g("Session Results"),q("Session finished"))},ee=async(w,Z)=>{const ne=await be("/clubs",{method:"POST",body:JSON.stringify({name:w,category:Z})});_(re=>[...re,ne.club]),Se(""),q("Club added")},oe=(w,Z)=>{const ne=qa(P.filter(re=>re.club_id===w),Z);return ne?Math.round(H.units==="m"?ne.distanceYards/1.09361:ne.distanceYards):null},Le=()=>{const w=Number(Qe);if(!w)return null;const Z=w*(H.units==="m"?1.09361:1),ne=new Map(I.map(re=>[re.id,re.name]));return yf(P.filter(re=>ne.has(re.club_id)).map(re=>({...re,club_name:ne.get(re.club_id)})),Z).map(re=>({c:I.find(It=>It.id===re.club_id),e:re.effort,d:Math.round(H.units==="m"?re.distanceYards/1.09361:re.distanceYards),n:re.shots,error:Math.round(H.units==="m"?re.errorYards/1.09361:re.errorYards),confidence:re.confidence}))};return X?s.jsxs("div",{className:"loader",children:[s.jsx("div",{className:"mark",children:"R"}),s.jsx("span",{children:"Loading your range…"})]}):v?s.jsxs("div",{className:"app-shell",children:[s.jsxs("aside",{className:"sidebar",children:[s.jsxs("div",{className:"brand",onClick:()=>g("Home"),children:[s.jsx("div",{className:"mark",children:"R"}),s.jsxs("span",{children:["Range",s.jsx("span",{className:"brand-light",children:"GPT"})]})]}),s.jsx("div",{className:"side-label",children:"YOUR GAME"}),f.map((w,Z)=>s.jsxs("button",{onClick:()=>g(w),className:`nav-item ${c===w?"selected":""}`,children:[s.jsx(Ul,{name:w}),w,w==="Range"&&&s.jsx("i",{className:"live-dot"})]},w)),s.jsx("div",{className:"side-label secondary-label",children:"MORE"}),["Practice History","Settings"].map(w=>s.jsxs("button",{onClick:()=>g(w),className:`nav-item ${c===w?"selected":""}`,children:[s.jsx(Ul,{name:w}),w]},w)),s.jsx("div",{className:"sidebar-bottom",children:s.jsxs("div",{className:"user-chip",children:[s.jsx("div",{className:"avatar",children:v.username.slice(0,1).toUpperCase()}),s.jsxs("div",{children:[s.jsx("b",{children:v.username}),s.jsx("small",{children:"Personal bag"})]}),s.jsx("button",{className:"icon-btn",onClick:V,"aria-label":"Log out",children:s.jsx(Ya,{size:17})})]})})]}),s.jsxs("main",{className:"main",children:[s.jsxs("header",{className:"topbar",children:[s.jsxs("button",{className:"mobile-brand",onClick:()=>g("Home"),children:[s.jsx("div",{className:"mark",children:"R"}),"RangeGPT"]}),s.jsx("span",{className:"breadcrumb",children:c==="RangeActive"?"Range session":c}),s.jsxs("div",{className:"top-actions",children:[s.jsx("button",{className:"icon-btn",onClick:()=>g("Settings"),"aria-label":"Settings",children:s.jsx(Ka,{size:18})}),s.jsx("button",{className:"avatar small",onClick:()=>g("Settings"),children:v.username.slice(0,1).toUpperCase()})]})]}),s.jsxs("div",{className:"content",children:[c==="Home"&&s.jsx(kf,{user:v,clubs:I,shots:P,sessions:N,usable:T,start:G,go:g}),c==="Range"&&s.jsx(jf,{clubs:I,start:G}),c==="RangeActive"&&&ge&&s.jsxs("div",{className:"range-layout",children:[s.jsxs("div",{className:"range-main",children:[s.jsxs("div",{className:"range-topline",children:[s.jsxs("span",{className:"live-pill",children:[s.jsx("i",{})," SESSION IN PROGRESS"]}),s.jsxs("button",{className:"text-btn",onClick:se,children:["Finish session ",s.jsx(wt,{size:15})]})]}),s.jsxs("div",{className:"session-head",children:[s.jsx("div",{className:"eyebrow",children:"CURRENT CLUB"}),s.jsx("select",{value:ge.id,onChange:w=>He(I.find(Z=>Z.id===w.target.value)),children:I.map(w=>s.jsx("option",{value:w.id,children:w.name},w.id))}),s.jsx("button",{className:"text-btn",onClick:()=>Se("Add range club"),children:"+ Add club"})]}),s.jsxs("div",{className:"entry-panel",children:[s.jsxs("label",{className:"eyebrow",htmlFor:"distance",children:["SHOT DISTANCE ",s.jsxs("span",{children:["(",H.units,")"]})]}),s.jsxs("div",{className:"distance-field",children:[s.jsx("input",{id:"distance",type:"number",inputMode:"decimal",value:we,onChange:w=>Ye(w.target.value),placeholder:"—"}),s.jsx("span",{children:H.units})]}),s.jsx("div",{className:"entry-label",children:"Effort"}),s.jsx("div",{className:"choice-row",children:[50,75,100,110].map(w=>s.jsxs("button",{onClick:()=>De(w),className:Ce===w?"active":"",children:[w,"%"]},w))}),s.jsx("div",{className:"entry-label",children:"Shot quality"}),s.jsx("div",{className:"choice-row quality",children:["Excellent","Good","Decent","OK"].map(w=>s.jsx("button",{onClick:()=>St(w),className:Be===w?"active":"",children:w},w))}),s.jsxs("button",{className:"primary full record-btn",onClick:J,disabled:Ee,children:[s.jsx(Qa,{size:18})," ",Ee?"Saving…":"Record shot"]})]}),s.jsx(Za,{shots:P.filter(w=>w.session_id===$.id&&w.club_id===ge.id).slice(0,8),undo:async()=>{const w=P.find(Z=>Z.session_id===$.id&&Z.club_id===ge.id);w&&(await be(`/shots/${w.id}`,{method:"DELETE"}),D(Z=>Z.filter(ne=>ne.id!==w.id)),q("Shot removed"))}})]}),s.jsx("aside",{className:"range-summary",children:s.jsxs("div",{className:"summary-card",children:[s.jsx("div",{className:"eyebrow",children:"THIS SESSION"}),s.jsx("strong",{children:P.filter(w=>w.session_id===$.id).length}),s.jsx("span",{children:"shots recorded"}),s.jsx("div",{className:"summary-divider"}),s.jsx("div",{className:"eyebrow",children:"CLUBS PRACTICED"}),s.jsx("div",{className:"chip-row",children:[...new Set(P.filter(w=>w.session_id===$.id).map(w=>{var Z;return w.club_name||((Z=I.find(ne=>ne.id===w.club_id))==null?void 0:Z.name)}))].map(w=>s.jsx("span",{className:"chip",children:w},w))}),s.jsx("p",{className:"muted",children:"Each accepted shot helps build a more personal distance profile."})]})})]}),c==="Distances"&&s.jsx(Nf,{clubs:I,shots:P,estimate:oe,go:g,setClub:He}),c==="Club Detail"&&ge&&s.jsx(Cf,{club:ge,shots:P.filter(w=>w.club_id===ge.id),estimate:oe,go:g}),c==="Caddy"&&s.jsxs("section",{children:[s.jsx(nn,{eyebrow:"YOUR PERSONAL CADDY",title:"Caddy",subtitle:"Choose the shot you need. I'll use your practice data."}),s.jsxs("div",{className:"caddy-layout",children:[s.jsxs("div",{className:"target-card",children:[s.jsx("label",{className:"eyebrow",htmlFor:"target",children:"TARGET DISTANCE"}),s.jsxs("div",{className:"target-entry",children:[s.jsx("input",{id:"target",type:"number",inputMode:"decimal",value:Qe,onChange:w=>_t(w.target.value),placeholder:"160"}),s.jsx("span",{children:H.units})]}),s.jsx("p",{className:"muted",children:"Enter the distance you want to play."})]}),s.jsx("div",{className:"recommend-panel",children:Qe?(rn=Le())!=null&&rn.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"eyebrow",children:"BEST SUPPORTED MATCH"}),(()=>{const w=Le()[0];return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"recommend-name",children:w.c.name}),s.jsxs("div",{className:"effort-readout",children:["~",w.e,"% effort ",s.jsx("span",{children:"·"})," ",w.d," ",H.units]}),s.jsxs("div",{className:"target-result",children:[s.jsxs("span",{children:["Target ",Qe," ",H.units]}),s.jsxs("b",{children:[w.error," ",H.units," away"]})]}),s.jsxs("div",{className:"confidence",children:[s.jsx(Hs,{size:16}),s.jsxs("span",{children:[w.n<5?"Early estimate":w.n<12?"Developing":"Reliable"," confidence"]})]}),s.jsxs("details",{className:"why",children:[s.jsxs("summary",{children:["Why this recommendation? ",s.jsx(uf,{size:16})]}),s.jsxs("p",{children:["Closest distance among your recorded effort levels. This estimate uses ",w.n," accepted shots and is based on your observed range data."]})]})]})})(),s.jsx("h4",{className:"alternatives-title",children:"Other options"}),Le().slice(1,4).map(w=>s.jsxs("div",{className:"alternative",children:[s.jsx("b",{children:w.c.name}),s.jsxs("span",{children:[w.e,"% · ",w.d," ",H.units]}),s.jsxs("small",{children:[w.error," ",H.units," away"]})]},w.c.id+w.e))]}):s.jsxs("div",{className:"caddy-empty",children:[s.jsx("div",{className:"caddy-icon",children:s.jsx(Al,{})}),s.jsx("h3",{children:"More practice will help"}),s.jsx("p",{children:"Caddy needs a few recorded shots before it can make a personalized recommendation."}),s.jsx("button",{className:"primary",onClick:G,children:"Start practicing"})]}):s.jsxs("div",{className:"caddy-empty",children:[s.jsx("div",{className:"caddy-icon",children:s.jsx(ff,{})}),s.jsx("h3",{children:"What’s the number?"}),s.jsx("p",{children:"Enter a target distance and I’ll find a shot that fits your real range data."})]})})]})]}),c==="My Bag"&&s.jsx(Ef,{clubs:k,shots:P,estimate:oe,addClub:()=>Se("Add club"),archive:async w=>{await be(`/clubs/${w.id}/archive`,{method:"POST"}),_(Z=>Z.map(ne=>ne.id===w.id?{...ne,archived_at:new Date().toISOString()}:ne)),q("Club archived")}}),c==="Practice History"&&s.jsx(_f,{sessions:N,shots:P,go:g,setActive:We}),c==="Session Results"&&s.jsx(Pf,{active:$,sessions:N,shots:P,clubs:k,prefs:H,go:g}),c==="Settings"&&s.jsx(Rf,{prefs:H,save:async w=>{const Z=await be("/settings",{method:"PATCH",body:JSON.stringify(w)});Q(Z.settings),q("Preferences saved")},logout:V}),c==="Onboarding"&&s.jsx(zf,{clubs:k,addClub:ee,go:g,start:G})]}),s.jsx(wf,{nav:f,page:c,go:g})]}),Te&&s.jsx("div",{className:"toast",role:"status",children:Te}),et&&s.jsx(Tf,{title:et,close:()=>Se(""),add:ee})]}):s.jsx(Sf,{onSubmit:W})}function Ul({name:v}){const y={size:18,strokeWidth:1.8};return v==="Home"?s.jsx(df,{...y}):v==="Range"?s.jsx(Al,{...y}):v==="Distances"?s.jsx(of,{...y}):v==="Caddy"?s.jsx(Wa,{...y}):v==="My Bag"?s.jsx(Fs,{...y}):v==="Settings"?s.jsx(Ka,{...y}):s.jsx(cf,{...y})}function wf({nav:v,page:y,go:c}){return s.jsx("nav",{className:"mobile-nav",children:v.map(E=>s.jsxs("button",{onClick:()=>c(E),className:y===E||y==="RangeActive"&&E==="Range"?"selected":"",children:[s.jsx(Ul,{name:E}),s.jsx("span",{children:E==="Distances"?"Distances":E==="My Bag"?"Bag":E})]},E))})}function Sf({onSubmit:v}){const[y,c]=le.useState("login"),[E,k]=le.useState(!1);return s.jsxs("div",{className:"auth-page",children:[s.jsxs("div",{className:"auth-aside",children:[s.jsxs("div",{className:"brand",children:[s.jsx("div",{className:"mark",children:"R"}),s.jsxs("span",{children:["Range",s.jsx("span",{className:"brand-light",children:"GPT"})]})]}),s.jsxs("div",{className:"auth-message",children:[s.jsx("span",{className:"eyebrow",children:"PRACTICE WITH PURPOSE"}),s.jsxs("h1",{children:["Know your",s.jsx("br",{}),s.jsx("em",{children:"real distances."})]}),s.jsx("p",{children:"Your range sessions, turned into a game you can trust."}),s.jsxs("div",{className:"auth-visual",children:[s.jsx("div",{className:"orbit orbit-one"}),s.jsx("div",{className:"orbit orbit-two"}),s.jsx("div",{className:"ball"}),s.jsx("span",{children:"YOUR GAME, LEARNED"})]})]}),s.jsx("div",{className:"auth-footer",children:"© 2026 RangeGPT"})]}),s.jsx("div",{className:"auth-form-wrap",children:s.jsxs("form",{className:"auth-form",onSubmit:_=>{_.preventDefault(),v(new FormData(_.currentTarget),y)},children:[s.jsx("div",{className:"eyebrow",children:y==="login"?"WELCOME BACK":"GET STARTED"}),s.jsx("h2",{children:y==="login"?"Sign in":"Create your account"}),s.jsx("p",{className:"muted",children:y==="login"?"Pick up where your practice left off.":"Your personal golf distance profile starts here."}),s.jsxs("label",{children:["Username",s.jsx("input",{name:"username",autoComplete:"username",required:!0,minLength:3,maxLength:24,placeholder:"Your username"})]}),s.jsxs("label",{children:["Password",s.jsxs("div",{className:"password-input",children:[s.jsx("input",{name:"password",type:E?"text":"password",autoComplete:y==="login"?"current-password":"new-password",required:!0,minLength:y==="register"?10:1,placeholder:y==="login"?"Your password":"At least 10 characters"}),s.jsx("button",{type:"button",onClick:()=>k(!E),children:E?"Hide":"Show"})]})]}),y==="register"&&s.jsxs("label",{children:["Confirm password",s.jsx("input",{name:"confirm",type:E?"text":"password",required:!0,minLength:10,placeholder:"Repeat your password"})]}),s.jsx("button",{className:"primary full auth-submit",children:y==="login"?"Sign in":"Create account"}),s.jsx("div",{className:"auth-switch",children:y==="login"?s.jsxs(s.Fragment,{children:["New to RangeGPT? ",s.jsx("button",{type:"button",onClick:()=>c("register"),children:"Create an account"})]}):s.jsxs(s.Fragment,{children:["Already have an account? ",s.jsx("button",{type:"button",onClick:()=>c("login"),children:"Sign in"})]})}),s.jsxs("small",{className:"auth-safe",children:[s.jsx(Hs,{size:14})," Your account and practice data stay private."]})]})})]})}function nn({eyebrow:v,title:y,subtitle:c,action:E}){return s.jsxs("div",{className:"page-title",children:[s.jsxs("div",{children:[v&&s.jsx("div",{className:"eyebrow",children:v}),s.jsx("h1",{children:y}),c&&s.jsx("p",{children:c})]}),E]})}function kf({user:v,clubs:y,shots:c,sessions:E,usable:k,start:_,go:P}){var Y;const D=E[0],N=c.length;return s.jsxs("section",{children:[s.jsxs("div",{className:"welcome-row",children:[s.jsxs("div",{children:[s.jsx("span",{className:"eyebrow",children:new Date().toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}),s.jsxs("h1",{children:["Good ",new Date().getHours()<12?"morning":new Date().getHours()<18?"afternoon":"evening",", ",v.username,"."]}),s.jsx("p",{children:"Every shot tells you a little more about your game."})]}),s.jsx("div",{className:"welcome-avatar",children:v.username.slice(0,1).toUpperCase()})]}),s.jsxs("div",{className:"home-actions",children:[s.jsxs("button",{className:"start-card",onClick:_,children:[s.jsx("div",{className:"start-icon",children:s.jsx(Al,{})}),s.jsxs("span",{children:[s.jsx("small",{children:"READY WHEN YOU ARE"}),s.jsx("b",{children:"Start a range session"}),s.jsx("em",{children:"Record shots and build your real distances"})]}),s.jsx(wt,{})]}),s.jsxs("button",{className:"caddy-card",onClick:()=>P("Caddy"),children:[s.jsx("div",{className:"caddy-icon",children:s.jsx(Wa,{})}),s.jsxs("span",{children:[s.jsx("small",{children:"ON THE COURSE?"}),s.jsx("b",{children:"Ask your Caddy"}),s.jsx("em",{children:"Find a club for your target"})]}),s.jsx(wt,{})]})]}),s.jsxs("div",{className:"home-grid",children:[s.jsxs("button",{className:"panel progress-panel",onClick:()=>P("Distances"),children:[s.jsxs("div",{className:"section-heading",children:[s.jsxs("span",{children:[s.jsx("span",{className:"eyebrow",children:"YOUR BAG"}),s.jsx("h3",{children:"Your distances"})]}),s.jsx(wt,{size:18})]}),s.jsxs("div",{className:"progress-count",children:[s.jsx("strong",{children:k}),s.jsxs("span",{children:["of ",y.length," clubs",s.jsx("br",{}),"with shot data"]})]}),s.jsx("div",{className:"progress-track",children:s.jsx("i",{style:{width:`${y.length?Math.min(100,k/y.length*100):0}%`}})}),s.jsx("div",{className:"panel-foot",children:y.length&&kP("Practice History"),children:["View all ",s.jsx(wt,{size:14})]})]}),D?s.jsxs("button",{className:"recent-session",onClick:()=>P("Session Results"),children:[s.jsxs("div",{className:"session-date",children:[s.jsx("small",{children:new Date(D.started_at).toLocaleDateString(void 0,{month:"short"}).toUpperCase()}),s.jsx("b",{children:new Date(D.started_at).getDate()})]}),s.jsxs("span",{children:[s.jsx("b",{children:D.name||"Range session"}),s.jsxs("small",{children:[D.shot_count||N," shots · ",((Y=D.clubs)==null?void 0:Y.length)||1," clubs"]})]}),s.jsx(As,{className:"chev-right",size:18})]}):s.jsxs("div",{className:"empty-inline",children:[s.jsx("p",{children:"No sessions yet. Your first one is a great place to start."}),s.jsxs("button",{className:"link-btn",onClick:_,children:["Start your first session ",s.jsx(wt,{size:14})]})]})]})]}),s.jsxs("div",{className:"insight-strip",children:[s.jsx("div",{className:"insight-icon",children:s.jsx(Ga,{size:18})}),s.jsxs("div",{children:[s.jsx("span",{className:"eyebrow",children:"A THOUGHT FOR YOUR NEXT SESSION"}),s.jsx("p",{children:N?`Your practice is taking shape across ${k} ${k===1?"club":"clubs"}. Keep gathering shots at different effort levels to sharpen your profile.`:"Your distances are yours to discover. Start with a club you know well, and record a few comfortable swings."})]}),s.jsxs("button",{className:"link-btn",onClick:_,children:["Practice now ",s.jsx(wt,{size:14})]})]})]})}function jf({clubs:v,start:y}){return s.jsxs("section",{children:[s.jsx(nn,{eyebrow:"PRACTICE WITH PURPOSE",title:"Range",subtitle:"A few real swings are all it takes to get started."}),s.jsxs("div",{className:"setup-card",children:[s.jsx("div",{className:"setup-number",children:"01"}),s.jsxs("div",{children:[s.jsx("h3",{children:"Choose your bag and go"}),s.jsx("p",{children:"Your clubs are ready. You can switch clubs or add one at any point during your session."}),s.jsxs("div",{className:"club-chips",children:[v.slice(0,8).map(c=>s.jsx("span",{className:"chip",children:c.name},c.id)),v.length>8&&s.jsxs("span",{className:"chip",children:["+",v.length-8]})]}),s.jsxs("button",{className:"primary",onClick:y,children:["Start session ",s.jsx(wt,{size:17})]})]})]})]})}function Za({shots:v,undo:y}){return s.jsxs("div",{className:"shots-list",children:[s.jsxs("div",{className:"section-heading",children:[s.jsx("h3",{children:"Recent shots"}),v.length>0&&s.jsx("button",{className:"link-btn",onClick:y,children:"Undo last"})]}),v.length?v.map((c,E)=>s.jsxs("div",{className:"shot-row",children:[s.jsx("span",{className:"shot-index",children:String(v.length-E).padStart(2,"0")}),s.jsxs("b",{children:[c.distance," yd"]}),s.jsxs("span",{children:[c.effort,"% effort"]}),s.jsx("span",{className:"quality-dot",children:c.quality})]},c.id)):s.jsx("div",{className:"empty-shots",children:"Your shots will show up here as you record them."})]})}function Nf({clubs:v,shots:y,estimate:c,go:E,setClub:k}){const[_,P]=le.useState("all"),D=v.filter(N=>_==="all"||N.category===_);return s.jsxs("section",{children:[s.jsx(nn,{eyebrow:"BUILT FROM YOUR RANGE SESSIONS",title:"My Distances",subtitle:"Your personal distance library, learned from the shots you record."}),s.jsxs("div",{className:"stat-strip",children:[s.jsxs("div",{children:[s.jsx("strong",{children:new Set(y.map(N=>N.club_id)).size}),s.jsx("span",{children:"clubs with data"})]}),s.jsxs("div",{children:[s.jsx("strong",{children:v.length-new Set(y.map(N=>N.club_id)).size}),s.jsx("span",{children:"still developing"})]}),s.jsxs("div",{children:[s.jsx("strong",{children:y.length}),s.jsx("span",{children:"shots recorded"})]})]}),s.jsxs("div",{className:"filter-row",children:[s.jsx("span",{className:"eyebrow",children:"CLUBS IN YOUR BAG"}),s.jsxs("select",{value:_,onChange:N=>P(N.target.value),children:[s.jsx("option",{value:"all",children:"All categories"}),["driver","fairway","hybrid","iron","wedge","putter"].map(N=>s.jsx("option",{children:N},N))]})]}),s.jsx("div",{className:"club-list",children:D.map(N=>{const Y=c(N.id,100),H=y.filter(Q=>Q.club_id===N.id).length;return s.jsxs("button",{className:"club-row",onClick:()=>{k(N),E("Club Detail")},children:[s.jsx("div",{className:"club-glyph",children:s.jsx(Ul,{name:N.category})}),s.jsxs("div",{className:"club-copy",children:[s.jsx("b",{children:N.name}),s.jsxs("small",{children:[N.category," · ",H," ",H===1?"shot":"shots"]})]}),s.jsx("div",{className:"club-distance",children:Y?s.jsxs(s.Fragment,{children:[s.jsxs("b",{children:[Y," yd"]}),s.jsx("small",{children:H<5?"Early estimate":H<12?"Developing":"Reliable"})]}):s.jsx("small",{className:"needs-data",children:"Needs data"})}),s.jsx(wt,{size:17})]},N.id)})})]})}function Cf({club:v,shots:y,estimate:c,go:E}){return s.jsxs("section",{children:[s.jsxs("button",{className:"back-link",onClick:()=>E("Distances"),children:[s.jsx(As,{size:16})," My Distances"]}),s.jsx(nn,{eyebrow:v.category.toUpperCase(),title:v.name,subtitle:"Distances reflect the shots you have recorded. Carry and roll are not separated."}),s.jsxs("div",{className:"detail-hero",children:[s.jsxs("div",{children:[s.jsx("span",{className:"eyebrow",children:"FULL EFFORT PROFILE"}),s.jsxs("strong",{children:[c(v.id,100)||"—"," ",s.jsx("small",{children:"yd"})]}),s.jsx("span",{className:"muted",children:y.length?`${y.length} accepted shots`:"No shots recorded yet"})]}),s.jsxs("div",{className:"detail-note",children:[s.jsx(af,{size:17}),s.jsx("span",{children:"Based on your actual practice, not manufacturer averages."})]})]}),s.jsxs("div",{className:"panel effort-panel",children:[s.jsx("div",{className:"section-heading",children:s.jsxs("span",{children:[s.jsx("span",{className:"eyebrow",children:"EFFORT PROFILE"}),s.jsx("h3",{children:"Distance by effort"})]})}),s.jsx("div",{className:"effort-bars",children:[50,75,100,110].map(k=>{const _=c(v.id,k);return s.jsxs("div",{className:"effort-col",children:[s.jsx("b",{children:_?`${_} yd`:"—"}),s.jsx("div",{className:"bar-shell",children:s.jsx("i",{style:{height:_?`${Math.max(14,Math.min(100,_/(c(v.id,110)||1)*100))}%`:"0%"}})}),s.jsxs("span",{children:[k,"%"]})]},k)})}),s.jsx("p",{className:"muted",children:"Effort distances come from recorded shots at that level. No unsupported extrapolation."})]}),s.jsxs("div",{className:"shots-list",children:[s.jsxs("div",{className:"section-heading",children:[s.jsx("h3",{children:"Shot history"}),s.jsxs("span",{className:"muted",children:[y.length," total"]})]}),s.jsx(Za,{shots:y.slice(0,12),undo:()=>{}})]})]})}function Ef({clubs:v,shots:y,estimate:c,addClub:E,archive:k}){const _=["driver","fairway","hybrid","iron","wedge","putter","custom"];return s.jsxs("section",{children:[s.jsx(nn,{eyebrow:"WHAT'S IN YOUR BAG",title:"My Bag",subtitle:"Your clubs, organized the way you play.",action:s.jsxs("button",{className:"primary",onClick:E,children:[s.jsx(Qa,{size:17})," Add club"]})}),_.map(P=>{const D=v.filter(N=>N.category===P);return D.length?s.jsxs("div",{className:"bag-group",children:[s.jsxs("div",{className:"group-title",children:[P==="fairway"?"Fairway Woods":P.charAt(0).toUpperCase()+P.slice(1)," ",s.jsx("span",{children:D.length})]}),D.map(N=>s.jsxs("div",{className:"bag-row",children:[s.jsx("div",{className:"club-glyph",children:s.jsx(Fs,{size:18})}),s.jsxs("div",{className:"club-copy",children:[s.jsx("b",{children:N.name}),s.jsxs("small",{children:[N.loft?`${N.loft}° loft · `:"",y.filter(Y=>Y.club_id===N.id).length," shots"]})]}),s.jsx("span",{className:"bag-distance",children:c(N.id,100)?`${c(N.id,100)} yd`:"—"}),s.jsx("button",{className:"icon-btn danger",onClick:()=>k(N),title:"Archive club",children:s.jsx(pf,{size:16})})]},N.id))]},P):null}),v.length===0&&s.jsxs("div",{className:"empty-block",children:[s.jsx(Fs,{size:28}),s.jsx("h3",{children:"Start building your bag"}),s.jsx("p",{children:"Add the clubs you carry to get your personal distance profile started."}),s.jsx("button",{className:"primary",onClick:E,children:"Add your first club"})]})]})}function _f({sessions:v,shots:y,go:c,setActive:E}){return s.jsxs("section",{children:[s.jsx(nn,{eyebrow:"YOUR PRACTICE, OVER TIME",title:"Practice History",subtitle:"Every session adds another piece to your game."}),s.jsx("div",{className:"history-list",children:v.length?v.map(k=>{var _;return s.jsxs("button",{className:"history-row",onClick:()=>{E(k),c("Session Results")},children:[s.jsxs("div",{className:"session-date",children:[s.jsx("small",{children:new Date(k.started_at).toLocaleDateString(void 0,{month:"short"}).toUpperCase()}),s.jsx("b",{children:new Date(k.started_at).getDate()})]}),s.jsxs("span",{children:[s.jsx("b",{children:k.name||"Range session"}),s.jsxs("small",{children:[k.shot_count??y.filter(P=>P.session_id===k.id).length," shots · ",((_=k.clubs)==null?void 0:_.join(", "))||"Practice session"]})]}),s.jsx(wt,{size:17})]},k.id)}):s.jsxs("div",{className:"empty-block",children:[s.jsx(Al,{size:28}),s.jsx("h3",{children:"Your practice starts here"}),s.jsx("p",{children:"Completed sessions will appear here."}),s.jsx("button",{className:"primary",onClick:()=>c("Range"),children:"Start a session"})]})})]})}function Pf({active:v,sessions:y,shots:c,clubs:E,prefs:k,go:_}){const P=v||y[0],D=c.filter(N=>N.session_id===(P==null?void 0:P.id)).reduce((N,Y)=>{var H;return(N[H=Y.club_id]||(N[H]=[])).push(Y),N},{});return s.jsxs("section",{children:[s.jsxs("button",{className:"back-link",onClick:()=>_("Practice History"),children:[s.jsx(As,{size:16})," Practice History"]}),s.jsx(nn,{eyebrow:"SESSION RESULTS",title:(P==null?void 0:P.name)||"Your range session",subtitle:P?new Date(P.started_at).toLocaleString():""}),s.jsxs("div",{className:"stat-strip",children:[s.jsxs("div",{children:[s.jsx("strong",{children:c.filter(N=>N.session_id===(P==null?void 0:P.id)).length}),s.jsx("span",{children:"shots recorded"})]}),s.jsxs("div",{children:[s.jsx("strong",{children:Object.keys(D||{}).length}),s.jsx("span",{children:"clubs practiced"})]}),s.jsxs("div",{children:[s.jsx("strong",{children:P!=null&&P.finished_at?"Complete":"In progress"}),s.jsx("span",{children:"session status"})]})]}),Object.entries(D||{}).map(([N,Y])=>{var H;return s.jsxs("div",{className:"panel result-club",children:[s.jsxs("div",{className:"section-heading",children:[s.jsx("h3",{children:((H=E.find(Q=>Q.id===N))==null?void 0:H.name)||"Club"}),s.jsxs("span",{className:"muted",children:[Y.length," shots"]})]}),s.jsx("div",{className:"shot-pills",children:Y.map(Q=>s.jsxs("span",{className:"chip",children:[Q.distance," ",Q.unit," · ",Q.effort,"% · ",Q.quality]},Q.id))})]},N)}),s.jsxs("div",{className:"button-row",children:[s.jsx("button",{className:"secondary",onClick:()=>_("Distances"),children:"View distances"}),s.jsx("button",{className:"primary",onClick:()=>_("Range"),children:"Practice again"})]})]})}function Rf({prefs:v,save:y,logout:c}){return s.jsxs("section",{children:[s.jsx(nn,{eyebrow:"MAKE IT YOURS",title:"Settings",subtitle:"A few preferences to make RangeGPT feel right."}),s.jsxs("div",{className:"settings-section",children:[s.jsx("div",{className:"group-title",children:"Appearance"}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Theme"}),s.jsx("small",{children:"Choose how RangeGPT looks"})]}),s.jsxs("select",{value:v.theme,onChange:E=>y({theme:E.target.value}),children:[s.jsx("option",{value:"system",children:"System"}),s.jsx("option",{value:"light",children:"Light"}),s.jsx("option",{value:"dark",children:"Dark"})]})]}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Distance units"}),s.jsx("small",{children:"Used across your range and Caddy"})]}),s.jsxs("select",{value:v.units,onChange:E=>y({units:E.target.value}),children:[s.jsx("option",{value:"yd",children:"Yards"}),s.jsx("option",{value:"m",children:"Meters"})]})]})]}),s.jsxs("div",{className:"settings-section",children:[s.jsx("div",{className:"group-title",children:"Account"}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Account security"}),s.jsx("small",{children:"Your data is private to your account"})]}),s.jsx(Hs,{size:19})]}),s.jsxs("button",{className:"setting-row logout-row",onClick:c,children:[s.jsxs("div",{children:[s.jsx("b",{children:"Log out"}),s.jsx("small",{children:"Sign out of this device"})]}),s.jsx(Ya,{size:18})]})]}),s.jsxs("div",{className:"settings-section",children:[s.jsx("div",{className:"group-title",children:"Your data"}),s.jsxs("div",{className:"setting-row",children:[s.jsxs("div",{children:[s.jsx("b",{children:"Export practice data"}),s.jsx("small",{children:"Download a full JSON backup"})]}),s.jsx("a",{className:"secondary small-button",href:"/api/export",children:"Export JSON"})]})]}),s.jsx("div",{className:"about-note",children:"RangeGPT · Made for better practice."})]})}function zf({clubs:v,addClub:y,go:c,start:E}){return s.jsx("section",{children:s.jsxs("div",{className:"onboarding",children:[s.jsx("div",{className:"welcome-mark",children:s.jsx(Ga,{})}),s.jsx("span",{className:"eyebrow",children:"WELCOME TO RANGEGPT"}),s.jsx("h1",{children:"Let’s get your bag ready."}),s.jsx("p",{children:"RangeGPT learns your distances from your real practice shots. Start with the clubs you carry. You can change your bag any time."}),s.jsx("div",{className:"onboard-clubs",children:v.length?v.map(k=>s.jsx("span",{className:"chip",children:k.name},k.id)):s.jsx("span",{className:"muted",children:"A starter bag is ready to add."})}),s.jsxs("div",{className:"button-row",children:[s.jsx("button",{className:"secondary",onClick:()=>c("My Bag"),children:"Customize my bag"}),s.jsxs("button",{className:"primary",onClick:E,children:["Start my first range session ",s.jsx(wt,{size:16})]})]})]})})}function Tf({title:v,close:y,add:c}){const[E,k]=le.useState(""),[_,P]=le.useState("iron");return s.jsx("div",{className:"modal-backdrop",onClick:y,children:s.jsxs("form",{className:"modal",onSubmit:D=>{D.preventDefault(),E.trim()&&c(E.trim(),_)},onClick:D=>D.stopPropagation(),children:[s.jsx("button",{type:"button",className:"modal-close",onClick:y,children:s.jsx(hf,{size:18})}),s.jsx("span",{className:"eyebrow",children:"MY BAG"}),s.jsx("h2",{children:v}),s.jsxs("label",{children:["Club name",s.jsx("input",{autoFocus:!0,value:E,onChange:D=>k(D.target.value),placeholder:"e.g. 7 Iron",maxLength:40,required:!0})]}),s.jsxs("label",{children:["Category",s.jsx("select",{value:_,onChange:D=>P(D.target.value),children:["driver","fairway","hybrid","iron","wedge","putter","custom"].map(D=>s.jsx("option",{value:D,children:D[0].toUpperCase()+D.slice(1)},D))})]}),s.jsx("button",{className:"primary full",children:"Add club"})]})})}nf.createRoot(document.getElementById("root")).render(s.jsx(xf,{}));