function Qx(t,r){for(var a=0;al[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function a(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerPolicy&&(c.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?c.credentials="include":s.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(s){if(s.ep)return;s.ep=!0;const c=a(s);fetch(s.href,c)}})();function Vx(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fh={exports:{}},$o={};var Yb;function Jj(){if(Yb)return $o;Yb=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(l,s,c){var u=null;if(c!==void 0&&(u=""+c),s.key!==void 0&&(u=""+s.key),"key"in s){c={};for(var d in s)d!=="key"&&(c[d]=s[d])}else c=s;return s=c.ref,{$$typeof:t,type:l,key:u,ref:s!==void 0?s:null,props:c}}return $o.Fragment=r,$o.jsx=a,$o.jsxs=a,$o}var Kb;function Wj(){return Kb||(Kb=1,Fh.exports=Jj()),Fh.exports}var h=Wj(),Gh={exports:{}},Le={};var Xb;function e2(){if(Xb)return Le;Xb=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.iterator;function C(D){return D===null||typeof D!="object"?null:(D=w&&D[w]||D["@@iterator"],typeof D=="function"?D:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,R={};function M(D,Q,J){this.props=D,this.context=Q,this.refs=R,this.updater=J||E}M.prototype.isReactComponent={},M.prototype.setState=function(D,Q){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,Q,"setState")},M.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function O(){}O.prototype=M.prototype;function _(D,Q,J){this.props=D,this.context=Q,this.refs=R,this.updater=J||E}var z=_.prototype=new O;z.constructor=_,S(z,M.prototype),z.isPureReactComponent=!0;var k=Array.isArray;function I(){}var N={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function A(D,Q,J){var ne=J.ref;return{$$typeof:t,type:D,key:Q,ref:ne!==void 0?ne:null,props:J}}function q(D,Q){return A(D.type,Q,D.props)}function K(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function W(D){var Q={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(J){return Q[J]})}var ue=/\/+/g;function le(D,Q){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):Q.toString(36)}function de(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(I,I):(D.status="pending",D.then(function(Q){D.status==="pending"&&(D.status="fulfilled",D.value=Q)},function(Q){D.status==="pending"&&(D.status="rejected",D.reason=Q)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function L(D,Q,J,ne,fe){var me=typeof D;(me==="undefined"||me==="boolean")&&(D=null);var re=!1;if(D===null)re=!0;else switch(me){case"bigint":case"string":case"number":re=!0;break;case"object":switch(D.$$typeof){case t:case r:re=!0;break;case b:return re=D._init,L(re(D._payload),Q,J,ne,fe)}}if(re)return fe=fe(D),re=ne===""?"."+le(D,0):ne,k(fe)?(J="",re!=null&&(J=re.replace(ue,"$&/")+"/"),L(fe,Q,J,"",function(Te){return Te})):fe!=null&&(K(fe)&&(fe=q(fe,J+(fe.key==null||D&&D.key===fe.key?"":(""+fe.key).replace(ue,"$&/")+"/")+re)),Q.push(fe)),1;re=0;var De=ne===""?".":ne+":";if(k(D))for(var Ae=0;Ae>>1,ie=L[ee];if(0>>1;ees(J,B))nes(fe,J)?(L[ee]=fe,L[ne]=B,ee=ne):(L[ee]=J,L[Q]=B,ee=Q);else if(nes(fe,B))L[ee]=fe,L[ne]=B,ee=ne;else break e}}return G}function s(L,G){var B=L.sortIndex-G.sortIndex;return B!==0?B:L.id-G.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var m=[],v=[],b=1,y=null,w=3,C=!1,E=!1,S=!1,R=!1,M=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function z(L){for(var G=a(v);G!==null;){if(G.callback===null)l(v);else if(G.startTime<=L)l(v),G.sortIndex=G.expirationTime,r(m,G);else break;G=a(v)}}function k(L){if(S=!1,z(L),!E)if(a(m)!==null)E=!0,I||(I=!0,W());else{var G=a(v);G!==null&&de(k,G.startTime-L)}}var I=!1,N=-1,T=5,A=-1;function q(){return R?!0:!(t.unstable_now()-AL&&q());){var ee=y.callback;if(typeof ee=="function"){y.callback=null,w=y.priorityLevel;var ie=ee(y.expirationTime<=L);if(L=t.unstable_now(),typeof ie=="function"){y.callback=ie,z(L),G=!0;break t}y===a(m)&&l(m),z(L)}else l(m);y=a(m)}if(y!==null)G=!0;else{var D=a(v);D!==null&&de(k,D.startTime-L),G=!1}}break e}finally{y=null,w=B,C=!1}G=void 0}}finally{G?W():I=!1}}}var W;if(typeof _=="function")W=function(){_(K)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,le=ue.port2;ue.port1.onmessage=K,W=function(){le.postMessage(null)}}else W=function(){M(K,0)};function de(L,G){N=M(function(){L(t.unstable_now())},G)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125ee?(L.sortIndex=B,r(v,L),a(m)===null&&L===a(v)&&(S?(O(N),N=-1):S=!0,de(k,B-ee))):(L.sortIndex=ie,r(m,L),E||C||(E=!0,I||(I=!0,W()))),L},t.unstable_shouldYield=q,t.unstable_wrapCallback=function(L){var G=w;return function(){var B=w;w=G;try{return L.apply(this,arguments)}finally{w=B}}}})(Xh)),Xh}var Jb;function n2(){return Jb||(Jb=1,Kh.exports=t2()),Kh.exports}var $h={exports:{}},dn={};var Wb;function r2(){if(Wb)return dn;Wb=1;var t=rp();function r(m){var v="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),$h.exports=r2(),$h.exports}var t0;function a2(){if(t0)return Zo;t0=1;var t=n2(),r=rp(),a=Fx();function l(e){var n="https://react.dev/errors/"+e;if(1ie||(e.current=ee[ie],ee[ie]=null,ie--)}function J(e,n){ie++,ee[ie]=e.current,e.current=n}var ne=D(null),fe=D(null),me=D(null),re=D(null);function De(e,n){switch(J(me,n),J(fe,e),J(ne,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?vb(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=vb(n),e=gb(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Q(ne),J(ne,e)}function Ae(){Q(ne),Q(fe),Q(me)}function Te(e){e.memoizedState!==null&&J(re,e);var n=ne.current,i=gb(n,e.type);n!==i&&(J(fe,e),J(ne,i))}function Ue(e){fe.current===e&&(Q(ne),Q(fe)),re.current===e&&(Q(re),Go._currentValue=B)}var he,dt;function pt(e){if(he===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);he=n&&n[1]||"",dt=-1)":-1f||P[o]!==X[f]){var ae=` `+P[o].replace(" at new "," at ");return e.displayName&&ae.includes("")&&(ae=ae.replace("",e.displayName)),ae}while(1<=o&&0<=f);break}}}finally{Sn=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?pt(i):""}function Rr(e,n){switch(e.tag){case 26:case 27:case 5:return pt(e.type);case 16:return pt("Lazy");case 13:return e.child!==n&&n!==null?pt("Suspense Fallback"):pt("Suspense");case 19:return pt("SuspenseList");case 0:case 15:return jt(e.type,!1);case 11:return jt(e.type.render,!1);case 1:return jt(e.type,!0);case 31:return pt("Activity");default:return""}}function fi(e){try{var n="",i=null;do n+=Rr(e,i),i=e,e=e.return;while(e);return n}catch(o){return` Error generating stack: `+o.message+` `+o.stack}}var Mr=Object.prototype.hasOwnProperty,wn=t.unstable_scheduleCallback,Or=t.unstable_cancelCallback,Ca=t.unstable_shouldYield,tl=t.unstable_requestPaint,wt=t.unstable_now,Fr=t.unstable_getCurrentPriorityLevel,hi=t.unstable_ImmediatePriority,Ln=t.unstable_UserBlockingPriority,Ut=t.unstable_NormalPriority,tn=t.unstable_LowPriority,Na=t.unstable_IdlePriority,mn=t.log,nl=t.unstable_setDisableYieldValue,cn=null,Jt=null;function pn(e){if(typeof mn=="function"&&nl(e),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(cn,e)}catch{}}var Vt=Math.clz32?Math.clz32:Ea,oo=Math.log,mi=Math.LN2;function Ea(e){return e>>>=0,e===0?32:31-(oo(e)/mi|0)|0}var Gr=256,Dr=262144,gt=4194304;function Et(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Tt(e,n,i){var o=e.pendingLanes;if(o===0)return 0;var f=0,p=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var j=o&134217727;return j!==0?(o=j&~p,o!==0?f=Et(o):(x&=j,x!==0?f=Et(x):i||(i=j&~e,i!==0&&(f=Et(i))))):(j=o&~p,j!==0?f=Et(j):x!==0?f=Et(x):i||(i=o&~e,i!==0&&(f=Et(i)))),f===0?0:n!==0&&n!==f&&(n&p)===0&&(p=f&-f,i=n&-n,p>=i||p===32&&(i&4194048)!==0)?n:f}function un(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function nn(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function _t(){var e=gt;return gt<<=1,(gt&62914560)===0&&(gt=4194304),e}function Ft(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function Cn(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function At(e,n,i,o,f,p){var x=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var j=e.entanglements,P=e.expirationTimes,X=e.hiddenUpdates;for(i=x&~i;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var GN=/[\n"\\]/g;function Jn(e){return e.replace(GN,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Ud(e,n,i,o,f,p,x,j){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Nn(n)):e.value!==""+Nn(n)&&(e.value=""+Nn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Bd(e,x,Nn(n)):i!=null?Bd(e,x,Nn(i)):o!=null&&e.removeAttribute("value"),f==null&&p!=null&&(e.defaultChecked=!!p),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+Nn(j):e.removeAttribute("name")}function uv(e,n,i,o,f,p,x,j){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),n!=null||i!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){Pd(e);return}i=i!=null?""+Nn(i):"",n=n!=null?""+Nn(n):i,j||n===e.value||(e.value=n),e.defaultValue=n}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=j?e.checked:!!o,e.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Pd(e)}function Bd(e,n,i){n==="number"&&Gs(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function rl(e,n,i,o){if(e=e.options,n){n={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vd=!1;if(Xr)try{var co={};Object.defineProperty(co,"passive",{get:function(){Vd=!0}}),window.addEventListener("test",co,co),window.removeEventListener("test",co,co)}catch{Vd=!1}var Ra=null,Fd=null,Ks=null;function gv(){if(Ks)return Ks;var e,n=Fd,i=n.length,o,f="value"in Ra?Ra.value:Ra.textContent,p=f.length;for(e=0;e=ho),Cv=" ",Nv=!1;function Ev(e,n){switch(e){case"keyup":return xE.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ol=!1;function wE(e,n){switch(e){case"compositionend":return jv(n);case"keypress":return n.which!==32?null:(Nv=!0,Cv);case"textInput":return e=n.data,e===Cv&&Nv?null:e;default:return null}}function CE(e,n){if(ol)return e==="compositionend"||!$d&&Ev(e,n)?(e=gv(),Ks=Fd=Ra=null,ol=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:i,offset:n-e};e=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=zv(i)}}function kv(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?kv(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Pv(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Gs(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=Gs(e.document)}return n}function Wd(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var TE=Xr&&"documentMode"in document&&11>=document.documentMode,sl=null,ef=null,go=null,tf=!1;function Uv(e,n,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;tf||sl==null||sl!==Gs(o)||(o=sl,"selectionStart"in o&&Wd(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),go&&vo(go,o)||(go=o,o=qc(ef,"onSelect"),0>=x,f-=x,_r=1<<32-Vt(n)+f|i<Be?(Xe=je,je=null):Xe=je.sibling;var et=Z(F,je,Y[Be],oe);if(et===null){je===null&&(je=Xe);break}e&&je&&et.alternate===null&&n(F,je),H=p(et,H,Be),We===null?Oe=et:We.sibling=et,We=et,je=Xe}if(Be===Y.length)return i(F,je),Ze&&Zr(F,Be),Oe;if(je===null){for(;BeBe?(Xe=je,je=null):Xe=je.sibling;var Xa=Z(F,je,et.value,oe);if(Xa===null){je===null&&(je=Xe);break}e&&je&&Xa.alternate===null&&n(F,je),H=p(Xa,H,Be),We===null?Oe=Xa:We.sibling=Xa,We=Xa,je=Xe}if(et.done)return i(F,je),Ze&&Zr(F,Be),Oe;if(je===null){for(;!et.done;Be++,et=Y.next())et=se(F,et.value,oe),et!==null&&(H=p(et,H,Be),We===null?Oe=et:We.sibling=et,We=et);return Ze&&Zr(F,Be),Oe}for(je=o(je);!et.done;Be++,et=Y.next())et=te(je,F,Be,et.value,oe),et!==null&&(e&&et.alternate!==null&&je.delete(et.key===null?Be:et.key),H=p(et,H,Be),We===null?Oe=et:We.sibling=et,We=et);return e&&je.forEach(function(Zj){return n(F,Zj)}),Ze&&Zr(F,Be),Oe}function ut(F,H,Y,oe){if(typeof Y=="object"&&Y!==null&&Y.type===S&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case C:e:{for(var Oe=Y.key;H!==null;){if(H.key===Oe){if(Oe=Y.type,Oe===S){if(H.tag===7){i(F,H.sibling),oe=f(H,Y.props.children),oe.return=F,F=oe;break e}}else if(H.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===T&&Ei(Oe)===H.type){i(F,H.sibling),oe=f(H,Y.props),Co(oe,Y),oe.return=F,F=oe;break e}i(F,H);break}else n(F,H);H=H.sibling}Y.type===S?(oe=xi(Y.props.children,F.mode,oe,Y.key),oe.return=F,F=oe):(oe=ac(Y.type,Y.key,Y.props,null,F.mode,oe),Co(oe,Y),oe.return=F,F=oe)}return x(F);case E:e:{for(Oe=Y.key;H!==null;){if(H.key===Oe)if(H.tag===4&&H.stateNode.containerInfo===Y.containerInfo&&H.stateNode.implementation===Y.implementation){i(F,H.sibling),oe=f(H,Y.children||[]),oe.return=F,F=oe;break e}else{i(F,H);break}else n(F,H);H=H.sibling}oe=cf(Y,F.mode,oe),oe.return=F,F=oe}return x(F);case T:return Y=Ei(Y),ut(F,H,Y,oe)}if(de(Y))return we(F,H,Y,oe);if(W(Y)){if(Oe=W(Y),typeof Oe!="function")throw Error(l(150));return Y=Oe.call(Y),_e(F,H,Y,oe)}if(typeof Y.then=="function")return ut(F,H,dc(Y),oe);if(Y.$$typeof===_)return ut(F,H,oc(F,Y),oe);fc(F,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,H!==null&&H.tag===6?(i(F,H.sibling),oe=f(H,Y),oe.return=F,F=oe):(i(F,H),oe=sf(Y,F.mode,oe),oe.return=F,F=oe),x(F)):i(F,H)}return function(F,H,Y,oe){try{wo=0;var Oe=ut(F,H,Y,oe);return bl=null,Oe}catch(je){if(je===yl||je===cc)throw je;var We=Un(29,je,null,F.mode);return We.lanes=oe,We.return=F,We}finally{}}}var Ri=og(!0),sg=og(!1),_a=!1;function Sf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Aa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,n,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(nt&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=rc(e),Fv(e,null,i),n}return nc(e,o,n,i),rc(e)}function No(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,i|=o,n.lanes=i,V(e,i)}}function Cf(e,n){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var f=null,p=null;if(i=i.firstBaseUpdate,i!==null){do{var x={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};p===null?f=p=x:p=p.next=x,i=i.next}while(i!==null);p===null?f=p=n:p=p.next=n}else f=p=n;i={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var Nf=!1;function Eo(){if(Nf){var e=gl;if(e!==null)throw e}}function jo(e,n,i,o){Nf=!1;var f=e.updateQueue;_a=!1;var p=f.firstBaseUpdate,x=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var P=j,X=P.next;P.next=null,x===null?p=X:x.next=X,x=P;var ae=e.alternate;ae!==null&&(ae=ae.updateQueue,j=ae.lastBaseUpdate,j!==x&&(j===null?ae.firstBaseUpdate=X:j.next=X,ae.lastBaseUpdate=P))}if(p!==null){var se=f.baseState;x=0,ae=X=P=null,j=p;do{var Z=j.lane&-536870913,te=Z!==j.lane;if(te?(Ke&Z)===Z:(o&Z)===Z){Z!==0&&Z===vl&&(Nf=!0),ae!==null&&(ae=ae.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var we=e,_e=j;Z=n;var ut=i;switch(_e.tag){case 1:if(we=_e.payload,typeof we=="function"){se=we.call(ut,se,Z);break e}se=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=_e.payload,Z=typeof we=="function"?we.call(ut,se,Z):we,Z==null)break e;se=y({},se,Z);break e;case 2:_a=!0}}Z=j.callback,Z!==null&&(e.flags|=64,te&&(e.flags|=8192),te=f.callbacks,te===null?f.callbacks=[Z]:te.push(Z))}else te={lane:Z,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ae===null?(X=ae=te,P=se):ae=ae.next=te,x|=Z;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;te=j,j=te.next,te.next=null,f.lastBaseUpdate=te,f.shared.pending=null}}while(!0);ae===null&&(P=se),f.baseState=P,f.firstBaseUpdate=X,f.lastBaseUpdate=ae,p===null&&(f.shared.lanes=0),Ba|=x,e.lanes=x,e.memoizedState=se}}function cg(e,n){if(typeof e!="function")throw Error(l(191,e));e.call(n)}function ug(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;ep?p:8;var x=L.T,j={};L.T=j,Qf(e,!1,n,i);try{var P=f(),X=L.S;if(X!==null&&X(j,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var ae=HE(P,o);Oo(e,n,ae,Qn(e))}else Oo(e,n,o,Qn(e))}catch(se){Oo(e,n,{then:function(){},status:"rejected",reason:se},Qn())}finally{G.p=p,x!==null&&j.types!==null&&(x.types=j.types),L.T=x}}function GE(){}function qf(e,n,i,o){if(e.tag!==5)throw Error(l(476));var f=Ig(e).queue;qg(e,f,n,B,i===null?GE:function(){return Qg(e),i(o)})}function Ig(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ta,lastRenderedState:B},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ta,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Qg(e){var n=Ig(e);n.next===null&&(n=e.alternate.memoizedState),Oo(e,n.next.queue,{},Qn())}function If(){return ln(Go)}function Vg(){return Lt().memoizedState}function Fg(){return Lt().memoizedState}function YE(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Qn();e=Aa(i);var o=za(n,e,i);o!==null&&(Dn(o,n,i),No(o,n,i)),n={cache:gf()},e.payload=n;return}n=n.return}}function KE(e,n,i){var o=Qn();i={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},wc(e)?Yg(n,i):(i=lf(e,n,i,o),i!==null&&(Dn(i,e,o),Kg(i,n,o)))}function Gg(e,n,i){var o=Qn();Oo(e,n,i,o)}function Oo(e,n,i,o){var f={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(wc(e))Yg(n,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var x=n.lastRenderedState,j=p(x,i);if(f.hasEagerState=!0,f.eagerState=j,Pn(j,x))return nc(e,n,f,0),ft===null&&tc(),!1}catch{}finally{}if(i=lf(e,n,f,o),i!==null)return Dn(i,e,o),Kg(i,n,o),!0}return!1}function Qf(e,n,i,o){if(o={lane:2,revertLane:Sh(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},wc(e)){if(n)throw Error(l(479))}else n=lf(e,i,o,2),n!==null&&Dn(n,e,2)}function wc(e){var n=e.alternate;return e===ke||n!==null&&n===ke}function Yg(e,n){Sl=pc=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function Kg(e,n,i){if((i&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,i|=o,n.lanes=i,V(e,i)}}var Do={readContext:ln,use:yc,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};Do.useEffectEvent=Mt;var Xg={readContext:ln,use:yc,useCallback:function(e,n){return gn().memoizedState=[e,n===void 0?null:n],e},useContext:ln,useEffect:_g,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,xc(4194308,4,kg.bind(null,n,e),i)},useLayoutEffect:function(e,n){return xc(4194308,4,e,n)},useInsertionEffect:function(e,n){xc(4,2,e,n)},useMemo:function(e,n){var i=gn();n=n===void 0?null:n;var o=e();if(Mi){pn(!0);try{e()}finally{pn(!1)}}return i.memoizedState=[o,n],o},useReducer:function(e,n,i){var o=gn();if(i!==void 0){var f=i(n);if(Mi){pn(!0);try{i(n)}finally{pn(!1)}}}else f=n;return o.memoizedState=o.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},o.queue=e,e=e.dispatch=KE.bind(null,ke,e),[o.memoizedState,e]},useRef:function(e){var n=gn();return e={current:e},n.memoizedState=e},useState:function(e){e=kf(e);var n=e.queue,i=Gg.bind(null,ke,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:Bf,useDeferredValue:function(e,n){var i=gn();return Hf(i,e,n)},useTransition:function(){var e=kf(!1);return e=qg.bind(null,ke,e.queue,!0,!1),gn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var o=ke,f=gn();if(Ze){if(i===void 0)throw Error(l(407));i=i()}else{if(i=n(),ft===null)throw Error(l(349));(Ke&127)!==0||vg(o,n,i)}f.memoizedState=i;var p={value:i,getSnapshot:n};return f.queue=p,_g(yg.bind(null,o,p,e),[e]),o.flags|=2048,Cl(9,{destroy:void 0},gg.bind(null,o,p,i,n),null),i},useId:function(){var e=gn(),n=ft.identifierPrefix;if(Ze){var i=Ar,o=_r;i=(o&~(1<<32-Vt(o)-1)).toString(32)+i,n="_"+n+"R_"+i,i=vc++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?x.createElement(f,{is:o.is}):x.createElement(f)}}p[ge]=n,p[ve]=o;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=p;e:switch(sn(p,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&ra(n)}}return St(n),rh(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&ra(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(l(166));if(e=me.current,ml(n)){if(e=n.stateNode,i=n.memoizedProps,o=null,f=an,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}e[ge]=n,e=!!(e.nodeValue===i||o!==null&&o.suppressHydrationWarning===!0||mb(e.nodeValue,i)),e||Da(n,!0)}else e=Ic(e).createTextNode(o),e[ge]=n,n.stateNode=e}return St(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(o=ml(n),i!==null){if(e===null){if(!o)throw Error(l(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[ge]=n}else Si(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),e=!1}else i=hf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(Hn(n),n):(Hn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return St(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=ml(n),o!==null&&o.dehydrated!==null){if(e===null){if(!f)throw Error(l(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[ge]=n}else Si(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),f=!1}else f=hf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Hn(n),n):(Hn(n),null)}return Hn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=o!==null,e=e!==null&&e.memoizedState!==null,i&&(o=n.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==f&&(o.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),Rc(n,n.updateQueue),St(n),null);case 4:return Ae(),e===null&&Eh(n.stateNode.containerInfo),St(n),null;case 10:return Wr(n.type),St(n),null;case 19:if(Q(zt),o=n.memoizedState,o===null)return St(n),null;if(f=(n.flags&128)!==0,p=o.rendering,p===null)if(f)_o(o,!1);else{if(Ot!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(p=mc(e),p!==null){for(n.flags|=128,_o(o,!1),e=p.updateQueue,n.updateQueue=e,Rc(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)Gv(i,e),i=i.sibling;return J(zt,zt.current&1|2),Ze&&Zr(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&wt()>_c&&(n.flags|=128,f=!0,_o(o,!1),n.lanes=4194304)}else{if(!f)if(e=mc(p),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Rc(n,e),_o(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!Ze)return St(n),null}else 2*wt()-o.renderingStartTime>_c&&i!==536870912&&(n.flags|=128,f=!0,_o(o,!1),n.lanes=4194304);o.isBackwards?(p.sibling=n.child,n.child=p):(e=o.last,e!==null?e.sibling=p:n.child=p,o.last=p)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=wt(),e.sibling=null,i=zt.current,J(zt,f?i&1|2:i&1),Ze&&Zr(n,o.treeForkCount),e):(St(n),null);case 22:case 23:return Hn(n),jf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(i&536870912)!==0&&(n.flags&128)===0&&(St(n),n.subtreeFlags&6&&(n.flags|=8192)):St(n),i=n.updateQueue,i!==null&&Rc(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==i&&(n.flags|=2048),e!==null&&Q(Ni),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Wr(Bt),St(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function WE(e,n){switch(df(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Wr(Bt),Ae(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Ue(n),null;case 31:if(n.memoizedState!==null){if(Hn(n),n.alternate===null)throw Error(l(340));Si()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Hn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));Si()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Q(zt),null;case 4:return Ae(),null;case 10:return Wr(n.type),null;case 22:case 23:return Hn(n),jf(),e!==null&&Q(Ni),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Wr(Bt),null;case 25:return null;default:return null}}function by(e,n){switch(df(n),n.tag){case 3:Wr(Bt),Ae();break;case 26:case 27:case 5:Ue(n);break;case 4:Ae();break;case 31:n.memoizedState!==null&&Hn(n);break;case 13:Hn(n);break;case 19:Q(zt);break;case 10:Wr(n.type);break;case 22:case 23:Hn(n),jf(),e!==null&&Q(Ni);break;case 24:Wr(Bt)}}function Ao(e,n){try{var i=n.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var f=o.next;i=f;do{if((i.tag&e)===e){o=void 0;var p=i.create,x=i.inst;o=p(),x.destroy=o}i=i.next}while(i!==f)}}catch(j){it(n,n.return,j)}}function Pa(e,n,i){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var p=f.next;o=p;do{if((o.tag&e)===e){var x=o.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,f=n;var P=i,X=j;try{X()}catch(ae){it(f,P,ae)}}}o=o.next}while(o!==p)}}catch(ae){it(n,n.return,ae)}}function xy(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{ug(n,i)}catch(o){it(e,e.return,o)}}}function Sy(e,n,i){i.props=Oi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(o){it(e,n,o)}}function zo(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof i=="function"?e.refCleanup=i(o):i.current=o}}catch(f){it(e,n,f)}}function zr(e,n){var i=e.ref,o=e.refCleanup;if(i!==null)if(typeof o=="function")try{o()}catch(f){it(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){it(e,n,f)}else i.current=null}function wy(e){var n=e.type,i=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&o.focus();break e;case"img":i.src?o.src=i.src:i.srcSet&&(o.srcset=i.srcSet)}}catch(f){it(e,e.return,f)}}function ah(e,n,i){try{var o=e.stateNode;Sj(o,e.type,i,n),o[ve]=n}catch(f){it(e,e.return,f)}}function Cy(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Va(e.type)||e.tag===4}function ih(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cy(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Va(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lh(e,n,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Kr));else if(o!==4&&(o===27&&Va(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(lh(e,n,i),e=e.sibling;e!==null;)lh(e,n,i),e=e.sibling}function Mc(e,n,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(o!==4&&(o===27&&Va(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Mc(e,n,i),e=e.sibling;e!==null;)Mc(e,n,i),e=e.sibling}function Ny(e){var n=e.stateNode,i=e.memoizedProps;try{for(var o=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);sn(n,o,i),n[ge]=e,n[ve]=i}catch(p){it(e,e.return,p)}}var aa=!1,It=!1,oh=!1,Ey=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function ej(e,n){if(e=e.containerInfo,Mh=Xc,e=Pv(e),Wd(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var f=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{i.nodeType,p.nodeType}catch{i=null;break e}var x=0,j=-1,P=-1,X=0,ae=0,se=e,Z=null;t:for(;;){for(var te;se!==i||f!==0&&se.nodeType!==3||(j=x+f),se!==p||o!==0&&se.nodeType!==3||(P=x+o),se.nodeType===3&&(x+=se.nodeValue.length),(te=se.firstChild)!==null;)Z=se,se=te;for(;;){if(se===e)break t;if(Z===i&&++X===f&&(j=x),Z===p&&++ae===o&&(P=x),(te=se.nextSibling)!==null)break;se=Z,Z=se.parentNode}se=te}i=j===-1||P===-1?null:{start:j,end:P}}else i=null}i=i||{start:0,end:0}}else i=null;for(Oh={focusedElem:e,selectionRange:i},Xc=!1,Wt=n;Wt!==null;)if(n=Wt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Wt=e;else for(;Wt!==null;){switch(n=Wt,p=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i title"))),sn(p,o,i),p[ge]=e,Rt(p),o=p;break e;case"link":var x=Tb("link","href",f).get(o+(i.href||""));if(x){for(var j=0;jut&&(x=ut,ut=_e,_e=x);var F=Lv(j,_e),H=Lv(j,ut);if(F&&H&&(te.rangeCount!==1||te.anchorNode!==F.node||te.anchorOffset!==F.offset||te.focusNode!==H.node||te.focusOffset!==H.offset)){var Y=se.createRange();Y.setStart(F.node,F.offset),te.removeAllRanges(),_e>ut?(te.addRange(Y),te.extend(H.node,H.offset)):(Y.setEnd(H.node,H.offset),te.addRange(Y))}}}}for(se=[],te=j;te=te.parentNode;)te.nodeType===1&&se.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;ji?32:i,L.T=null,i=mh,mh=null;var p=qa,x=ca;if(Yt=0,Ml=qa=null,ca=0,(nt&6)!==0)throw Error(l(331));var j=nt;if(nt|=4,ky(p.current),Ay(p,p.current,x,i),nt=j,Ho(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(cn,p)}catch{}return!0}finally{G.p=f,L.T=o,eb(e,n)}}function nb(e,n,i){n=er(i,n),n=Yf(e.stateNode,n,2),e=za(e,n,2),e!==null&&(Cn(e,2),Lr(e))}function it(e,n,i){if(e.tag===3)nb(e,e,i);else for(;n!==null;){if(n.tag===3){nb(n,e,i);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Ha===null||!Ha.has(o))){e=er(i,e),i=ry(2),o=za(n,i,2),o!==null&&(ay(i,o,n,e),Cn(o,2),Lr(o));break}}n=n.return}}function yh(e,n,i){var o=e.pingCache;if(o===null){o=e.pingCache=new rj;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(i)||(uh=!0,f.add(i),e=sj.bind(null,e,n,i),n.then(e,e))}function sj(e,n,i){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,ft===e&&(Ke&i)===i&&(Ot===4||Ot===3&&(Ke&62914560)===Ke&&300>wt()-Tc?(nt&2)===0&&Ol(e,0):dh|=i,Rl===Ke&&(Rl=0)),Lr(e)}function rb(e,n){n===0&&(n=_t()),e=bi(e,n),e!==null&&(Cn(e,n),Lr(e))}function cj(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),rb(e,i)}function uj(e,n){var i=0;switch(e.tag){case 31:case 13:var o=e.stateNode,f=e.memoizedState;f!==null&&(i=f.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(l(314))}o!==null&&o.delete(n),rb(e,i)}function dj(e,n){return wn(e,n)}var Uc=null,Tl=null,bh=!1,Bc=!1,xh=!1,Qa=0;function Lr(e){e!==Tl&&e.next===null&&(Tl===null?Uc=Tl=e:Tl=Tl.next=e),Bc=!0,bh||(bh=!0,hj())}function Ho(e,n){if(!xh&&Bc){xh=!0;do for(var i=!1,o=Uc;o!==null;){if(e!==0){var f=o.pendingLanes;if(f===0)var p=0;else{var x=o.suspendedLanes,j=o.pingedLanes;p=(1<<31-Vt(42|e)+1)-1,p&=f&~(x&~j),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(i=!0,ob(o,p))}else p=Ke,p=Tt(o,o===ft?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||un(o,p)||(i=!0,ob(o,p));o=o.next}while(i);xh=!1}}function fj(){ab()}function ab(){Bc=bh=!1;var e=0;Qa!==0&&Cj()&&(e=Qa);for(var n=wt(),i=null,o=Uc;o!==null;){var f=o.next,p=ib(o,n);p===0?(o.next=null,i===null?Uc=f:i.next=f,f===null&&(Tl=i)):(i=o,(e!==0||(p&3)!==0)&&(Bc=!0)),o=f}Yt!==0&&Yt!==5||Ho(e),Qa!==0&&(Qa=0)}function ib(e,n){for(var i=e.suspendedLanes,o=e.pingedLanes,f=e.expirationTimes,p=e.pendingLanes&-62914561;0j)break;var ae=P.transferSize,se=P.initiatorType;ae&&pb(se)&&(P=P.responseEnd,x+=ae*(P"u"?null:document;function Rb(e,n,i){var o=_l;if(o&&typeof n=="string"&&n){var f=Jn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),jb.has(f)||(jb.add(f),e={rel:e,crossOrigin:i,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),sn(n,"link",e),Rt(n),o.head.appendChild(n)))}}function _j(e){ua.D(e),Rb("dns-prefetch",e,null)}function Aj(e,n){ua.C(e,n),Rb("preconnect",e,n)}function zj(e,n,i){ua.L(e,n,i);var o=_l;if(o&&e&&n){var f='link[rel="preload"][as="'+Jn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+Jn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+Jn(i.imageSizes)+'"]')):f+='[href="'+Jn(e)+'"]';var p=f;switch(n){case"style":p=Al(e);break;case"script":p=zl(e)}lr.has(p)||(e=y({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),lr.set(p,e),o.querySelector(f)!==null||n==="style"&&o.querySelector(Vo(p))||n==="script"&&o.querySelector(Fo(p))||(n=o.createElement("link"),sn(n,"link",e),Rt(n),o.head.appendChild(n)))}}function Lj(e,n){ua.m(e,n);var i=_l;if(i&&e){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Jn(o)+'"][href="'+Jn(e)+'"]',p=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=zl(e)}if(!lr.has(p)&&(e=y({rel:"modulepreload",href:e},n),lr.set(p,e),i.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Fo(p)))return}o=i.createElement("link"),sn(o,"link",e),Rt(o),i.head.appendChild(o)}}}function kj(e,n,i){ua.S(e,n,i);var o=_l;if(o&&e){var f=rn(o).hoistableStyles,p=Al(e);n=n||"default";var x=f.get(p);if(!x){var j={loading:0,preload:null};if(x=o.querySelector(Vo(p)))j.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},i),(i=lr.get(p))&&kh(e,i);var P=x=o.createElement("link");Rt(P),sn(P,"link",e),P._p=new Promise(function(X,ae){P.onload=X,P.onerror=ae}),P.addEventListener("load",function(){j.loading|=1}),P.addEventListener("error",function(){j.loading|=2}),j.loading|=4,Vc(x,n,o)}x={type:"stylesheet",instance:x,count:1,state:j},f.set(p,x)}}}function Pj(e,n){ua.X(e,n);var i=_l;if(i&&e){var o=rn(i).hoistableScripts,f=zl(e),p=o.get(f);p||(p=i.querySelector(Fo(f)),p||(e=y({src:e,async:!0},n),(n=lr.get(f))&&Ph(e,n),p=i.createElement("script"),Rt(p),sn(p,"link",e),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(f,p))}}function Uj(e,n){ua.M(e,n);var i=_l;if(i&&e){var o=rn(i).hoistableScripts,f=zl(e),p=o.get(f);p||(p=i.querySelector(Fo(f)),p||(e=y({src:e,async:!0,type:"module"},n),(n=lr.get(f))&&Ph(e,n),p=i.createElement("script"),Rt(p),sn(p,"link",e),i.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(f,p))}}function Mb(e,n,i,o){var f=(f=me.current)?Qc(f):null;if(!f)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=Al(i.href),i=rn(f).hoistableStyles,o=i.get(n),o||(o={type:"style",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Al(i.href);var p=rn(f).hoistableStyles,x=p.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,x),(p=f.querySelector(Vo(e)))&&!p._p&&(x.instance=p,x.state.loading=5),lr.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},lr.set(e,i),p||Bj(f,e,i,x.state))),n&&o===null)throw Error(l(528,""));return x}if(n&&o!==null)throw Error(l(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=zl(i),i=rn(f).hoistableScripts,o=i.get(n),o||(o={type:"script",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Al(e){return'href="'+Jn(e)+'"'}function Vo(e){return'link[rel="stylesheet"]['+e+"]"}function Ob(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function Bj(e,n,i,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),sn(n,"link",i),Rt(n),e.head.appendChild(n))}function zl(e){return'[src="'+Jn(e)+'"]'}function Fo(e){return"script[async]"+e}function Db(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Jn(i.href)+'"]');if(o)return n.instance=o,Rt(o),o;var f=y({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),Rt(o),sn(o,"style",f),Vc(o,i.precedence,e),n.instance=o;case"stylesheet":f=Al(i.href);var p=e.querySelector(Vo(f));if(p)return n.state.loading|=4,n.instance=p,Rt(p),p;o=Ob(i),(f=lr.get(f))&&kh(o,f),p=(e.ownerDocument||e).createElement("link"),Rt(p);var x=p;return x._p=new Promise(function(j,P){x.onload=j,x.onerror=P}),sn(p,"link",o),n.state.loading|=4,Vc(p,i.precedence,e),n.instance=p;case"script":return p=zl(i.src),(f=e.querySelector(Fo(p)))?(n.instance=f,Rt(f),f):(o=i,(f=lr.get(p))&&(o=y({},i),Ph(o,f)),e=e.ownerDocument||e,f=e.createElement("script"),Rt(f),sn(f,"link",o),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Vc(o,i.precedence,e));return n.instance}function Vc(e,n,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,p=f,x=0;x title"):null)}function Hj(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Ab(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function qj(e,n,i,o){if(i.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=Al(o.href),p=n.querySelector(Vo(f));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Gc.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=p,Rt(p);return}p=n.ownerDocument||n,o=Ob(o),(f=lr.get(f))&&kh(o,f),p=p.createElement("link"),Rt(p);var x=p;x._p=new Promise(function(j,P){x.onload=j,x.onerror=P}),sn(p,"link",o),i.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Gc.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var Uh=0;function Ij(e,n){return e.stylesheets&&e.count===0&&Kc(e,e.stylesheets),0Uh?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function Gc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yc=null;function Kc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yc=new Map,n.forEach(Qj,e),Yc=null,Gc.call(e))}function Qj(e,n){if(!(n.state.loading&4)){var i=Yc.get(e);if(i)var o=i.get(null);else{i=new Map,Yc.set(e,i);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),Yh.exports=a2(),Yh.exports}var l2=i2(),Sr=Fx();const Gx=Vx(Sr),o2=Qx({__proto__:null,default:Gx},[Sr]);function Nt(){return Nt=Object.assign?Object.assign.bind():function(t){for(var r=1;r"u")throw new Error(r)}function Bi(t,r){if(!t){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function c2(){return Math.random().toString(36).substr(2,8)}function a0(t,r){return{usr:t.state,key:t.key,idx:r}}function us(t,r,a,l){return a===void 0&&(a=null),Nt({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof r=="string"?li(r):r,{state:a,key:r&&r.key||l||c2()})}function Hi(t){let{pathname:r="/",search:a="",hash:l=""}=t;return a&&a!=="?"&&(r+=a.charAt(0)==="?"?a:"?"+a),l&&l!=="#"&&(r+=l.charAt(0)==="#"?l:"#"+l),r}function li(t){let r={};if(t){let a=t.indexOf("#");a>=0&&(r.hash=t.substr(a),t=t.substr(0,a));let l=t.indexOf("?");l>=0&&(r.search=t.substr(l),t=t.substr(0,l)),t&&(r.pathname=t)}return r}function u2(t,r,a,l){l===void 0&&(l={});let{window:s=document.defaultView,v5Compat:c=!1}=l,u=s.history,d=Qt.Pop,m=null,v=b();v==null&&(v=0,u.replaceState(Nt({},u.state,{idx:v}),""));function b(){return(u.state||{idx:null}).idx}function y(){d=Qt.Pop;let R=b(),M=R==null?null:R-v;v=R,m&&m({action:d,location:S.location,delta:M})}function w(R,M){d=Qt.Push;let O=us(S.location,R,M);v=b()+1;let _=a0(O,v),z=S.createHref(O);try{u.pushState(_,"",z)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;s.location.assign(z)}c&&m&&m({action:d,location:S.location,delta:1})}function C(R,M){d=Qt.Replace;let O=us(S.location,R,M);v=b();let _=a0(O,v),z=S.createHref(O);u.replaceState(_,"",z),c&&m&&m({action:d,location:S.location,delta:0})}function E(R){let M=s.location.origin!=="null"?s.location.origin:s.location.href,O=typeof R=="string"?R:Hi(R);return O=O.replace(/ $/,"%20"),qe(M,"No window.location.(origin|href) available to create URL for href: "+O),new URL(O,M)}let S={get action(){return d},get location(){return t(s,u)},listen(R){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(r0,y),m=R,()=>{s.removeEventListener(r0,y),m=null}},createHref(R){return r(s,R)},createURL:E,encodeLocation(R){let M=E(R);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:w,replace:C,go(R){return u.go(R)}};return S}var lt;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(lt||(lt={}));const d2=new Set(["lazy","caseSensitive","path","id","index","children"]);function f2(t){return t.index===!0}function Cu(t,r,a,l){return a===void 0&&(a=[]),l===void 0&&(l={}),t.map((s,c)=>{let u=[...a,String(c)],d=typeof s.id=="string"?s.id:u.join("-");if(qe(s.index!==!0||!s.children,"Cannot specify children on an index route"),qe(!l[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),f2(s)){let m=Nt({},s,r(s),{id:d});return l[d]=m,m}else{let m=Nt({},s,r(s),{id:d,children:void 0});return l[d]=m,s.children&&(m.children=Cu(s.children,r,u,l)),m}})}function zi(t,r,a){return a===void 0&&(a="/"),pu(t,r,a,!1)}function pu(t,r,a,l){let s=typeof r=="string"?li(r):r,c=ha(s.pathname||"/",a);if(c==null)return null;let u=Yx(t);m2(u);let d=null;for(let m=0;d==null&&m{let m={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:u,route:c};m.relativePath.startsWith("/")&&(qe(m.relativePath.startsWith(l),'Absolute route path "'+m.relativePath+'" nested under path '+('"'+l+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),m.relativePath=m.relativePath.slice(l.length));let v=fa([l,m.relativePath]),b=a.concat(m);c.children&&c.children.length>0&&(qe(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+v+'".')),Yx(c.children,r,b,v)),!(c.path==null&&!c.index)&&r.push({path:v,score:S2(v,c.index),routesMeta:b})};return t.forEach((c,u)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))s(c,u);else for(let m of Kx(c.path))s(c,u,m)}),r}function Kx(t){let r=t.split("/");if(r.length===0)return[];let[a,...l]=r,s=a.endsWith("?"),c=a.replace(/\?$/,"");if(l.length===0)return s?[c,""]:[c];let u=Kx(l.join("/")),d=[];return d.push(...u.map(m=>m===""?c:[c,m].join("/"))),s&&d.push(...u),d.map(m=>t.startsWith("/")&&m===""?"/":m)}function m2(t){t.sort((r,a)=>r.score!==a.score?a.score-r.score:w2(r.routesMeta.map(l=>l.childrenIndex),a.routesMeta.map(l=>l.childrenIndex)))}const p2=/^:[\w-]+$/,v2=3,g2=2,y2=1,b2=10,x2=-2,i0=t=>t==="*";function S2(t,r){let a=t.split("/"),l=a.length;return a.some(i0)&&(l+=x2),r&&(l+=g2),a.filter(s=>!i0(s)).reduce((s,c)=>s+(p2.test(c)?v2:c===""?y2:b2),l)}function w2(t,r){return t.length===r.length&&t.slice(0,-1).every((l,s)=>l===r[s])?t[t.length-1]-r[r.length-1]:0}function C2(t,r,a){a===void 0&&(a=!1);let{routesMeta:l}=t,s={},c="/",u=[];for(let d=0;d{let{paramName:w,isOptional:C}=b;if(w==="*"){let S=d[y]||"";u=c.slice(0,c.length-S.length).replace(/(.)\/+$/,"$1")}const E=d[y];return C&&!E?v[w]=void 0:v[w]=(E||"").replace(/%2F/g,"/"),v},{}),pathname:c,pathnameBase:u,pattern:t}}function N2(t,r,a){r===void 0&&(r=!1),a===void 0&&(a=!0),Bi(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let l=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m)=>(l.push({paramName:d,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(l.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,r?void 0:"i"),l]}function E2(t){try{return t.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return Bi(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+r+").")),t}}function ha(t,r){if(r==="/")return t;if(!t.toLowerCase().startsWith(r.toLowerCase()))return null;let a=r.endsWith("/")?r.length-1:r.length,l=t.charAt(a);return l&&l!=="/"?null:t.slice(a)||"/"}const j2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,R2=t=>j2.test(t);function M2(t,r){r===void 0&&(r="/");let{pathname:a,search:l="",hash:s=""}=typeof t=="string"?li(t):t,c;if(a)if(R2(a))c=a;else{if(a.includes("//")){let u=a;a=a.replace(/\/\/+/g,"/"),Bi(!1,"Pathnames cannot have embedded double slashes - normalizing "+(u+" -> "+a))}a.startsWith("/")?c=l0(a.substring(1),"/"):c=l0(a,r)}else c=r;return{pathname:c,search:D2(l),hash:T2(s)}}function l0(t,r){let a=r.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?a.length>1&&a.pop():s!=="."&&a.push(s)}),a.length>1?a.join("/"):"/"}function Zh(t,r,a,l){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+r+"` field ["+JSON.stringify(l)+"]. Please separate it out to the ")+("`to."+a+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Xx(t){return t.filter((r,a)=>a===0||r.route.path&&r.route.path.length>0)}function ap(t,r){let a=Xx(t);return r?a.map((l,s)=>s===a.length-1?l.pathname:l.pathnameBase):a.map(l=>l.pathnameBase)}function ip(t,r,a,l){l===void 0&&(l=!1);let s;typeof t=="string"?s=li(t):(s=Nt({},t),qe(!s.pathname||!s.pathname.includes("?"),Zh("?","pathname","search",s)),qe(!s.pathname||!s.pathname.includes("#"),Zh("#","pathname","hash",s)),qe(!s.search||!s.search.includes("#"),Zh("#","search","hash",s)));let c=t===""||s.pathname==="",u=c?"/":s.pathname,d;if(u==null)d=a;else{let y=r.length-1;if(!l&&u.startsWith("..")){let w=u.split("/");for(;w[0]==="..";)w.shift(),y-=1;s.pathname=w.join("/")}d=y>=0?r[y]:"/"}let m=M2(s,d),v=u&&u!=="/"&&u.endsWith("/"),b=(c||u===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(v||b)&&(m.pathname+="/"),m}const fa=t=>t.join("/").replace(/\/\/+/g,"/"),O2=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),D2=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,T2=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class Eu{constructor(r,a,l,s){s===void 0&&(s=!1),this.status=r,this.statusText=a||"",this.internal=s,l instanceof Error?(this.data=l.toString(),this.error=l):this.data=l}}function ds(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const $x=["post","put","patch","delete"],_2=new Set($x),A2=["get",...$x],z2=new Set(A2),L2=new Set([301,302,303,307,308]),k2=new Set([307,308]),Jh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},P2={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Jo={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},lp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,U2=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),Zx="remix-router-transitions";function B2(t){const r=t.window?t.window:typeof window<"u"?window:void 0,a=typeof r<"u"&&typeof r.document<"u"&&typeof r.document.createElement<"u",l=!a;qe(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let s;if(t.mapRouteProperties)s=t.mapRouteProperties;else if(t.detectErrorBoundary){let U=t.detectErrorBoundary;s=V=>({hasErrorBoundary:U(V)})}else s=U2;let c={},u=Cu(t.routes,s,void 0,c),d,m=t.basename||"/",v=t.dataStrategy||Q2,b=t.patchRoutesOnNavigation,y=Nt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),w=null,C=new Set,E=null,S=null,R=null,M=t.hydrationData!=null,O=zi(u,t.history.location,m),_=!1,z=null;if(O==null&&!b){let U=Tn(404,{pathname:t.history.location.pathname}),{matches:V,route:$}=g0(u);O=V,z={[$.id]:U}}O&&!t.hydrationData&&_t(O,u,t.history.location.pathname).active&&(O=null);let k;if(O)if(O.some(U=>U.route.lazy))k=!1;else if(!O.some(U=>U.route.loader))k=!0;else if(y.v7_partialHydration){let U=t.hydrationData?t.hydrationData.loaderData:null,V=t.hydrationData?t.hydrationData.errors:null;if(V){let $=O.findIndex(ce=>V[ce.route.id]!==void 0);k=O.slice(0,$+1).every(ce=>!Sm(ce.route,U,V))}else k=O.every($=>!Sm($.route,U,V))}else k=t.hydrationData!=null;else if(k=!1,O=[],y.v7_partialHydration){let U=_t(null,u,t.history.location.pathname);U.active&&U.matches&&(_=!0,O=U.matches)}let I,N={historyAction:t.history.action,location:t.history.location,matches:O,initialized:k,navigation:Jh,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||z,fetchers:new Map,blockers:new Map},T=Qt.Pop,A=!1,q,K=!1,W=new Map,ue=null,le=!1,de=!1,L=[],G=new Set,B=new Map,ee=0,ie=-1,D=new Map,Q=new Set,J=new Map,ne=new Map,fe=new Set,me=new Map,re=new Map,De;function Ae(){if(w=t.history.listen(U=>{let{action:V,location:$,delta:ce}=U;if(De){De(),De=void 0;return}Bi(re.size===0||ce!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let pe=Gr({currentLocation:N.location,nextLocation:$,historyAction:V});if(pe&&ce!=null){let Se=new Promise(Me=>{De=Me});t.history.go(ce*-1),Ea(pe,{state:"blocked",location:$,proceed(){Ea(pe,{state:"proceeding",proceed:void 0,reset:void 0,location:$}),Se.then(()=>t.history.go(ce))},reset(){let Me=new Map(N.blockers);Me.set(pe,Jo),he({blockers:Me})}});return}return jt(V,$)}),a){rR(r,W);let U=()=>aR(r,W);r.addEventListener("pagehide",U),ue=()=>r.removeEventListener("pagehide",U)}return N.initialized||jt(Qt.Pop,N.location,{initialHydration:!0}),I}function Te(){w&&w(),ue&&ue(),C.clear(),q&&q.abort(),N.fetchers.forEach((U,V)=>mn(V)),N.blockers.forEach((U,V)=>mi(V))}function Ue(U){return C.add(U),()=>C.delete(U)}function he(U,V){V===void 0&&(V={}),N=Nt({},N,U);let $=[],ce=[];y.v7_fetcherPersist&&N.fetchers.forEach((pe,Se)=>{pe.state==="idle"&&(fe.has(Se)?ce.push(Se):$.push(Se))}),fe.forEach(pe=>{!N.fetchers.has(pe)&&!B.has(pe)&&ce.push(pe)}),[...C].forEach(pe=>pe(N,{deletedFetchers:ce,viewTransitionOpts:V.viewTransitionOpts,flushSync:V.flushSync===!0})),y.v7_fetcherPersist?($.forEach(pe=>N.fetchers.delete(pe)),ce.forEach(pe=>mn(pe))):ce.forEach(pe=>fe.delete(pe))}function dt(U,V,$){var ce,pe;let{flushSync:Se}=$===void 0?{}:$,Me=N.actionData!=null&&N.navigation.formMethod!=null&&xr(N.navigation.formMethod)&&N.navigation.state==="loading"&&((ce=U.state)==null?void 0:ce._isRedirect)!==!0,be;V.actionData?Object.keys(V.actionData).length>0?be=V.actionData:be=null:Me?be=N.actionData:be=null;let ge=V.loaderData?p0(N.loaderData,V.loaderData,V.matches||[],V.errors):N.loaderData,ve=N.blockers;ve.size>0&&(ve=new Map(ve),ve.forEach((Ye,Gt)=>ve.set(Gt,Jo)));let Ce=A===!0||N.navigation.formMethod!=null&&xr(N.navigation.formMethod)&&((pe=U.state)==null?void 0:pe._isRedirect)!==!0;d&&(u=d,d=void 0),le||T===Qt.Pop||(T===Qt.Push?t.history.push(U,U.state):T===Qt.Replace&&t.history.replace(U,U.state));let ze;if(T===Qt.Pop){let Ye=W.get(N.location.pathname);Ye&&Ye.has(U.pathname)?ze={currentLocation:N.location,nextLocation:U}:W.has(U.pathname)&&(ze={currentLocation:U,nextLocation:N.location})}else if(K){let Ye=W.get(N.location.pathname);Ye?Ye.add(U.pathname):(Ye=new Set([U.pathname]),W.set(N.location.pathname,Ye)),ze={currentLocation:N.location,nextLocation:U}}he(Nt({},V,{actionData:be,loaderData:ge,historyAction:T,location:U,initialized:!0,navigation:Jh,revalidation:"idle",restoreScrollPosition:nn(U,V.matches||N.matches),preventScrollReset:Ce,blockers:ve}),{viewTransitionOpts:ze,flushSync:Se===!0}),T=Qt.Pop,A=!1,K=!1,le=!1,de=!1,L=[]}async function pt(U,V){if(typeof U=="number"){t.history.go(U);return}let $=xm(N.location,N.matches,m,y.v7_prependBasename,U,y.v7_relativeSplatPath,V?.fromRouteId,V?.relative),{path:ce,submission:pe,error:Se}=o0(y.v7_normalizeFormMethod,!1,$,V),Me=N.location,be=us(N.location,ce,V&&V.state);be=Nt({},be,t.history.encodeLocation(be));let ge=V&&V.replace!=null?V.replace:void 0,ve=Qt.Push;ge===!0?ve=Qt.Replace:ge===!1||pe!=null&&xr(pe.formMethod)&&pe.formAction===N.location.pathname+N.location.search&&(ve=Qt.Replace);let Ce=V&&"preventScrollReset"in V?V.preventScrollReset===!0:void 0,ze=(V&&V.flushSync)===!0,Ye=Gr({currentLocation:Me,nextLocation:be,historyAction:ve});if(Ye){Ea(Ye,{state:"blocked",location:be,proceed(){Ea(Ye,{state:"proceeding",proceed:void 0,reset:void 0,location:be}),pt(U,V)},reset(){let Gt=new Map(N.blockers);Gt.set(Ye,Jo),he({blockers:Gt})}});return}return await jt(ve,be,{submission:pe,pendingError:Se,preventScrollReset:Ce,replace:V&&V.replace,enableViewTransition:V&&V.viewTransition,flushSync:ze})}function Sn(){if(Ln(),he({revalidation:"loading"}),N.navigation.state!=="submitting"){if(N.navigation.state==="idle"){jt(N.historyAction,N.location,{startUninterruptedRevalidation:!0});return}jt(T||N.historyAction,N.navigation.location,{overrideNavigation:N.navigation,enableViewTransition:K===!0})}}async function jt(U,V,$){q&&q.abort(),q=null,T=U,le=($&&$.startUninterruptedRevalidation)===!0,un(N.location,N.matches),A=($&&$.preventScrollReset)===!0,K=($&&$.enableViewTransition)===!0;let ce=d||u,pe=$&&$.overrideNavigation,Se=$!=null&&$.initialHydration&&N.matches&&N.matches.length>0&&!_?N.matches:zi(ce,V,m),Me=($&&$.flushSync)===!0;if(Se&&N.initialized&&!de&&X2(N.location,V)&&!($&&$.submission&&xr($.submission.formMethod))){dt(V,{matches:Se},{flushSync:Me});return}let be=_t(Se,ce,V.pathname);if(be.active&&be.matches&&(Se=be.matches),!Se){let{error:rt,notFoundMatches:Qe,route:vt}=Dr(V.pathname);dt(V,{matches:Qe,loaderData:{},errors:{[vt.id]:rt}},{flushSync:Me});return}q=new AbortController;let ge=kl(t.history,V,q.signal,$&&$.submission),ve;if($&&$.pendingError)ve=[Li(Se).route.id,{type:lt.error,error:$.pendingError}];else if($&&$.submission&&xr($.submission.formMethod)){let rt=await Rr(ge,V,$.submission,Se,be.active,{replace:$.replace,flushSync:Me});if(rt.shortCircuited)return;if(rt.pendingActionResult){let[Qe,vt]=rt.pendingActionResult;if(Vn(vt)&&ds(vt.error)&&vt.error.status===404){q=null,dt(V,{matches:rt.matches,loaderData:{},errors:{[Qe]:vt.error}});return}}Se=rt.matches||Se,ve=rt.pendingActionResult,pe=Wh(V,$.submission),Me=!1,be.active=!1,ge=kl(t.history,ge.url,ge.signal)}let{shortCircuited:Ce,matches:ze,loaderData:Ye,errors:Gt}=await fi(ge,V,Se,be.active,pe,$&&$.submission,$&&$.fetcherSubmission,$&&$.replace,$&&$.initialHydration===!0,Me,ve);Ce||(q=null,dt(V,Nt({matches:ze||Se},v0(ve),{loaderData:Ye,errors:Gt})))}async function Rr(U,V,$,ce,pe,Se){Se===void 0&&(Se={}),Ln();let Me=tR(V,$);if(he({navigation:Me},{flushSync:Se.flushSync===!0}),pe){let ve=await Ft(ce,V.pathname,U.signal);if(ve.type==="aborted")return{shortCircuited:!0};if(ve.type==="error"){let Ce=Li(ve.partialMatches).route.id;return{matches:ve.partialMatches,pendingActionResult:[Ce,{type:lt.error,error:ve.error}]}}else if(ve.matches)ce=ve.matches;else{let{notFoundMatches:Ce,error:ze,route:Ye}=Dr(V.pathname);return{matches:Ce,pendingActionResult:[Ye.id,{type:lt.error,error:ze}]}}}let be,ge=rs(ce,V);if(!ge.route.action&&!ge.route.lazy)be={type:lt.error,error:Tn(405,{method:U.method,pathname:V.pathname,routeId:ge.route.id})};else if(be=(await Fr("action",N,U,[ge],ce,null))[ge.route.id],U.signal.aborted)return{shortCircuited:!0};if(ki(be)){let ve;return Se&&Se.replace!=null?ve=Se.replace:ve=f0(be.response.headers.get("Location"),new URL(U.url),m)===N.location.pathname+N.location.search,await wt(U,be,!0,{submission:$,replace:ve}),{shortCircuited:!0}}if(ei(be))throw Tn(400,{type:"defer-action"});if(Vn(be)){let ve=Li(ce,ge.route.id);return(Se&&Se.replace)!==!0&&(T=Qt.Push),{matches:ce,pendingActionResult:[ve.route.id,be]}}return{matches:ce,pendingActionResult:[ge.route.id,be]}}async function fi(U,V,$,ce,pe,Se,Me,be,ge,ve,Ce){let ze=pe||Wh(V,Se),Ye=Se||Me||b0(ze),Gt=!le&&(!y.v7_partialHydration||!ge);if(ce){if(Gt){let yt=Mr(Ce);he(Nt({navigation:ze},yt!==void 0?{actionData:yt}:{}),{flushSync:ve})}let Je=await Ft($,V.pathname,U.signal);if(Je.type==="aborted")return{shortCircuited:!0};if(Je.type==="error"){let yt=Li(Je.partialMatches).route.id;return{matches:Je.partialMatches,loaderData:{},errors:{[yt]:Je.error}}}else if(Je.matches)$=Je.matches;else{let{error:yt,notFoundMatches:Yr,route:pi}=Dr(V.pathname);return{matches:Yr,loaderData:{},errors:{[pi.id]:yt}}}}let rt=d||u,[Qe,vt]=c0(t.history,N,$,Ye,V,y.v7_partialHydration&&ge===!0,y.v7_skipActionErrorRevalidation,de,L,G,fe,J,Q,rt,m,Ce);if(gt(Je=>!($&&$.some(yt=>yt.route.id===Je))||Qe&&Qe.some(yt=>yt.route.id===Je)),ie=++ee,Qe.length===0&&vt.length===0){let Je=pn();return dt(V,Nt({matches:$,loaderData:{},errors:Ce&&Vn(Ce[1])?{[Ce[0]]:Ce[1].error}:null},v0(Ce),Je?{fetchers:new Map(N.fetchers)}:{}),{flushSync:ve}),{shortCircuited:!0}}if(Gt){let Je={};if(!ce){Je.navigation=ze;let yt=Mr(Ce);yt!==void 0&&(Je.actionData=yt)}vt.length>0&&(Je.fetchers=wn(vt)),he(Je,{flushSync:ve})}vt.forEach(Je=>{cn(Je.key),Je.controller&&B.set(Je.key,Je.controller)});let kn=()=>vt.forEach(Je=>cn(Je.key));q&&q.signal.addEventListener("abort",kn);let{loaderResults:Xn,fetcherResults:vn}=await hi(N,$,Qe,vt,U);if(U.signal.aborted)return{shortCircuited:!0};q&&q.signal.removeEventListener("abort",kn),vt.forEach(Je=>B.delete(Je.key));let rn=nu(Xn);if(rn)return await wt(U,rn.result,!0,{replace:be}),{shortCircuited:!0};if(rn=nu(vn),rn)return Q.add(rn.key),await wt(U,rn.result,!0,{replace:be}),{shortCircuited:!0};let{loaderData:Rt,errors:ja}=m0(N,$,Xn,Ce,vt,vn,me);me.forEach((Je,yt)=>{Je.subscribe(Yr=>{(Yr||Je.done)&&me.delete(yt)})}),y.v7_partialHydration&&ge&&N.errors&&(ja=Nt({},N.errors,ja));let Tr=pn(),$n=Vt(ie),mr=Tr||$n||vt.length>0;return Nt({matches:$,loaderData:Rt,errors:ja},mr?{fetchers:new Map(N.fetchers)}:{})}function Mr(U){if(U&&!Vn(U[1]))return{[U[0]]:U[1].data};if(N.actionData)return Object.keys(N.actionData).length===0?null:N.actionData}function wn(U){return U.forEach(V=>{let $=N.fetchers.get(V.key),ce=Wo(void 0,$?$.data:void 0);N.fetchers.set(V.key,ce)}),new Map(N.fetchers)}function Or(U,V,$,ce){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");cn(U);let pe=(ce&&ce.flushSync)===!0,Se=d||u,Me=xm(N.location,N.matches,m,y.v7_prependBasename,$,y.v7_relativeSplatPath,V,ce?.relative),be=zi(Se,Me,m),ge=_t(be,Se,Me);if(ge.active&&ge.matches&&(be=ge.matches),!be){tn(U,V,Tn(404,{pathname:Me}),{flushSync:pe});return}let{path:ve,submission:Ce,error:ze}=o0(y.v7_normalizeFormMethod,!0,Me,ce);if(ze){tn(U,V,ze,{flushSync:pe});return}let Ye=rs(be,ve),Gt=(ce&&ce.preventScrollReset)===!0;if(Ce&&xr(Ce.formMethod)){Ca(U,V,ve,Ye,be,ge.active,pe,Gt,Ce);return}J.set(U,{routeId:V,path:ve}),tl(U,V,ve,Ye,be,ge.active,pe,Gt,Ce)}async function Ca(U,V,$,ce,pe,Se,Me,be,ge){Ln(),J.delete(U);function ve(bt){if(!bt.route.action&&!bt.route.lazy){let pr=Tn(405,{method:ge.formMethod,pathname:$,routeId:V});return tn(U,V,pr,{flushSync:Me}),!0}return!1}if(!Se&&ve(ce))return;let Ce=N.fetchers.get(U);Ut(U,nR(ge,Ce),{flushSync:Me});let ze=new AbortController,Ye=kl(t.history,$,ze.signal,ge);if(Se){let bt=await Ft(pe,new URL(Ye.url).pathname,Ye.signal,U);if(bt.type==="aborted")return;if(bt.type==="error"){tn(U,V,bt.error,{flushSync:Me});return}else if(bt.matches){if(pe=bt.matches,ce=rs(pe,$),ve(ce))return}else{tn(U,V,Tn(404,{pathname:$}),{flushSync:Me});return}}B.set(U,ze);let Gt=ee,Qe=(await Fr("action",N,Ye,[ce],pe,U))[ce.route.id];if(Ye.signal.aborted){B.get(U)===ze&&B.delete(U);return}if(y.v7_fetcherPersist&&fe.has(U)){if(ki(Qe)||Vn(Qe)){Ut(U,Za(void 0));return}}else{if(ki(Qe))if(B.delete(U),ie>Gt){Ut(U,Za(void 0));return}else return Q.add(U),Ut(U,Wo(ge)),wt(Ye,Qe,!1,{fetcherSubmission:ge,preventScrollReset:be});if(Vn(Qe)){tn(U,V,Qe.error);return}}if(ei(Qe))throw Tn(400,{type:"defer-action"});let vt=N.navigation.location||N.location,kn=kl(t.history,vt,ze.signal),Xn=d||u,vn=N.navigation.state!=="idle"?zi(Xn,N.navigation.location,m):N.matches;qe(vn,"Didn't find any matches after fetcher action");let rn=++ee;D.set(U,rn);let Rt=Wo(ge,Qe.data);N.fetchers.set(U,Rt);let[ja,Tr]=c0(t.history,N,vn,ge,vt,!1,y.v7_skipActionErrorRevalidation,de,L,G,fe,J,Q,Xn,m,[ce.route.id,Qe]);Tr.filter(bt=>bt.key!==U).forEach(bt=>{let pr=bt.key,Zn=N.fetchers.get(pr),Nn=Wo(void 0,Zn?Zn.data:void 0);N.fetchers.set(pr,Nn),cn(pr),bt.controller&&B.set(pr,bt.controller)}),he({fetchers:new Map(N.fetchers)});let $n=()=>Tr.forEach(bt=>cn(bt.key));ze.signal.addEventListener("abort",$n);let{loaderResults:mr,fetcherResults:Je}=await hi(N,vn,ja,Tr,kn);if(ze.signal.aborted)return;ze.signal.removeEventListener("abort",$n),D.delete(U),B.delete(U),Tr.forEach(bt=>B.delete(bt.key));let yt=nu(mr);if(yt)return wt(kn,yt.result,!1,{preventScrollReset:be});if(yt=nu(Je),yt)return Q.add(yt.key),wt(kn,yt.result,!1,{preventScrollReset:be});let{loaderData:Yr,errors:pi}=m0(N,vn,mr,void 0,Tr,Je,me);if(N.fetchers.has(U)){let bt=Za(Qe.data);N.fetchers.set(U,bt)}Vt(rn),N.navigation.state==="loading"&&rn>ie?(qe(T,"Expected pending action"),q&&q.abort(),dt(N.navigation.location,{matches:vn,loaderData:Yr,errors:pi,fetchers:new Map(N.fetchers)})):(he({errors:pi,loaderData:p0(N.loaderData,Yr,vn,pi),fetchers:new Map(N.fetchers)}),de=!1)}async function tl(U,V,$,ce,pe,Se,Me,be,ge){let ve=N.fetchers.get(U);Ut(U,Wo(ge,ve?ve.data:void 0),{flushSync:Me});let Ce=new AbortController,ze=kl(t.history,$,Ce.signal);if(Se){let Qe=await Ft(pe,new URL(ze.url).pathname,ze.signal,U);if(Qe.type==="aborted")return;if(Qe.type==="error"){tn(U,V,Qe.error,{flushSync:Me});return}else if(Qe.matches)pe=Qe.matches,ce=rs(pe,$);else{tn(U,V,Tn(404,{pathname:$}),{flushSync:Me});return}}B.set(U,Ce);let Ye=ee,rt=(await Fr("loader",N,ze,[ce],pe,U))[ce.route.id];if(ei(rt)&&(rt=await op(rt,ze.signal,!0)||rt),B.get(U)===Ce&&B.delete(U),!ze.signal.aborted){if(fe.has(U)){Ut(U,Za(void 0));return}if(ki(rt))if(ie>Ye){Ut(U,Za(void 0));return}else{Q.add(U),await wt(ze,rt,!1,{preventScrollReset:be});return}if(Vn(rt)){tn(U,V,rt.error);return}qe(!ei(rt),"Unhandled fetcher deferred data"),Ut(U,Za(rt.data))}}async function wt(U,V,$,ce){let{submission:pe,fetcherSubmission:Se,preventScrollReset:Me,replace:be}=ce===void 0?{}:ce;V.response.headers.has("X-Remix-Revalidate")&&(de=!0);let ge=V.response.headers.get("Location");qe(ge,"Expected a Location header on the redirect Response"),ge=f0(ge,new URL(U.url),m);let ve=us(N.location,ge,{_isRedirect:!0});if(a){let Qe=!1;if(V.response.headers.has("X-Remix-Reload-Document"))Qe=!0;else if(lp.test(ge)){const vt=t.history.createURL(ge);Qe=vt.origin!==r.location.origin||ha(vt.pathname,m)==null}if(Qe){be?r.location.replace(ge):r.location.assign(ge);return}}q=null;let Ce=be===!0||V.response.headers.has("X-Remix-Replace")?Qt.Replace:Qt.Push,{formMethod:ze,formAction:Ye,formEncType:Gt}=N.navigation;!pe&&!Se&&ze&&Ye&&Gt&&(pe=b0(N.navigation));let rt=pe||Se;if(k2.has(V.response.status)&&rt&&xr(rt.formMethod))await jt(Ce,ve,{submission:Nt({},rt,{formAction:ge}),preventScrollReset:Me||A,enableViewTransition:$?K:void 0});else{let Qe=Wh(ve,pe);await jt(Ce,ve,{overrideNavigation:Qe,fetcherSubmission:Se,preventScrollReset:Me||A,enableViewTransition:$?K:void 0})}}async function Fr(U,V,$,ce,pe,Se){let Me,be={};try{Me=await V2(v,U,V,$,ce,pe,Se,c,s)}catch(ge){return ce.forEach(ve=>{be[ve.route.id]={type:lt.error,error:ge}}),be}for(let[ge,ve]of Object.entries(Me))if($2(ve)){let Ce=ve.result;be[ge]={type:lt.redirect,response:Y2(Ce,$,ge,pe,m,y.v7_relativeSplatPath)}}else be[ge]=await G2(ve);return be}async function hi(U,V,$,ce,pe){let Se=U.matches,Me=Fr("loader",U,pe,$,V,null),be=Promise.all(ce.map(async Ce=>{if(Ce.matches&&Ce.match&&Ce.controller){let Ye=(await Fr("loader",U,kl(t.history,Ce.path,Ce.controller.signal),[Ce.match],Ce.matches,Ce.key))[Ce.match.route.id];return{[Ce.key]:Ye}}else return Promise.resolve({[Ce.key]:{type:lt.error,error:Tn(404,{pathname:Ce.path})}})})),ge=await Me,ve=(await be).reduce((Ce,ze)=>Object.assign(Ce,ze),{});return await Promise.all([W2(V,ge,pe.signal,Se,U.loaderData),eR(V,ve,ce)]),{loaderResults:ge,fetcherResults:ve}}function Ln(){de=!0,L.push(...gt()),J.forEach((U,V)=>{B.has(V)&&G.add(V),cn(V)})}function Ut(U,V,$){$===void 0&&($={}),N.fetchers.set(U,V),he({fetchers:new Map(N.fetchers)},{flushSync:($&&$.flushSync)===!0})}function tn(U,V,$,ce){ce===void 0&&(ce={});let pe=Li(N.matches,V);mn(U),he({errors:{[pe.route.id]:$},fetchers:new Map(N.fetchers)},{flushSync:(ce&&ce.flushSync)===!0})}function Na(U){return ne.set(U,(ne.get(U)||0)+1),fe.has(U)&&fe.delete(U),N.fetchers.get(U)||P2}function mn(U){let V=N.fetchers.get(U);B.has(U)&&!(V&&V.state==="loading"&&D.has(U))&&cn(U),J.delete(U),D.delete(U),Q.delete(U),y.v7_fetcherPersist&&fe.delete(U),G.delete(U),N.fetchers.delete(U)}function nl(U){let V=(ne.get(U)||0)-1;V<=0?(ne.delete(U),fe.add(U),y.v7_fetcherPersist||mn(U)):ne.set(U,V),he({fetchers:new Map(N.fetchers)})}function cn(U){let V=B.get(U);V&&(V.abort(),B.delete(U))}function Jt(U){for(let V of U){let $=Na(V),ce=Za($.data);N.fetchers.set(V,ce)}}function pn(){let U=[],V=!1;for(let $ of Q){let ce=N.fetchers.get($);qe(ce,"Expected fetcher: "+$),ce.state==="loading"&&(Q.delete($),U.push($),V=!0)}return Jt(U),V}function Vt(U){let V=[];for(let[$,ce]of D)if(ce0}function oo(U,V){let $=N.blockers.get(U)||Jo;return re.get(U)!==V&&re.set(U,V),$}function mi(U){N.blockers.delete(U),re.delete(U)}function Ea(U,V){let $=N.blockers.get(U)||Jo;qe($.state==="unblocked"&&V.state==="blocked"||$.state==="blocked"&&V.state==="blocked"||$.state==="blocked"&&V.state==="proceeding"||$.state==="blocked"&&V.state==="unblocked"||$.state==="proceeding"&&V.state==="unblocked","Invalid blocker state transition: "+$.state+" -> "+V.state);let ce=new Map(N.blockers);ce.set(U,V),he({blockers:ce})}function Gr(U){let{currentLocation:V,nextLocation:$,historyAction:ce}=U;if(re.size===0)return;re.size>1&&Bi(!1,"A router only supports one blocker at a time");let pe=Array.from(re.entries()),[Se,Me]=pe[pe.length-1],be=N.blockers.get(Se);if(!(be&&be.state==="proceeding")&&Me({currentLocation:V,nextLocation:$,historyAction:ce}))return Se}function Dr(U){let V=Tn(404,{pathname:U}),$=d||u,{matches:ce,route:pe}=g0($);return gt(),{notFoundMatches:ce,route:pe,error:V}}function gt(U){let V=[];return me.forEach(($,ce)=>{(!U||U(ce))&&($.cancel(),V.push(ce),me.delete(ce))}),V}function Et(U,V,$){if(E=U,R=V,S=$||null,!M&&N.navigation===Jh){M=!0;let ce=nn(N.location,N.matches);ce!=null&&he({restoreScrollPosition:ce})}return()=>{E=null,R=null,S=null}}function Tt(U,V){return S&&S(U,V.map(ce=>h2(ce,N.loaderData)))||U.key}function un(U,V){if(E&&R){let $=Tt(U,V);E[$]=R()}}function nn(U,V){if(E){let $=Tt(U,V),ce=E[$];if(typeof ce=="number")return ce}return null}function _t(U,V,$){if(b)if(U){if(Object.keys(U[0].params).length>0)return{active:!0,matches:pu(V,$,m,!0)}}else return{active:!0,matches:pu(V,$,m,!0)||[]};return{active:!1,matches:null}}async function Ft(U,V,$,ce){if(!b)return{type:"success",matches:U};let pe=U;for(;;){let Se=d==null,Me=d||u,be=c;try{await b({signal:$,path:V,matches:pe,fetcherKey:ce,patch:(Ce,ze)=>{$.aborted||d0(Ce,ze,Me,be,s)}})}catch(Ce){return{type:"error",error:Ce,partialMatches:pe}}finally{Se&&!$.aborted&&(u=[...u])}if($.aborted)return{type:"aborted"};let ge=zi(Me,V,m);if(ge)return{type:"success",matches:ge};let ve=pu(Me,V,m,!0);if(!ve||pe.length===ve.length&&pe.every((Ce,ze)=>Ce.route.id===ve[ze].route.id))return{type:"success",matches:null};pe=ve}}function Cn(U){c={},d=Cu(U,s,void 0,c)}function At(U,V){let $=d==null;d0(U,V,d||u,c,s),$&&(u=[...u],he({}))}return I={get basename(){return m},get future(){return y},get state(){return N},get routes(){return u},get window(){return r},initialize:Ae,subscribe:Ue,enableScrollRestoration:Et,navigate:pt,fetch:Or,revalidate:Sn,createHref:U=>t.history.createHref(U),encodeLocation:U=>t.history.encodeLocation(U),getFetcher:Na,deleteFetcher:nl,dispose:Te,getBlocker:oo,deleteBlocker:mi,patchRoutes:At,_internalFetchControllers:B,_internalActiveDeferreds:me,_internalSetRoutes:Cn},I}function H2(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function xm(t,r,a,l,s,c,u,d){let m,v;if(u){m=[];for(let y of r)if(m.push(y),y.route.id===u){v=y;break}}else m=r,v=r[r.length-1];let b=ip(s||".",ap(m,c),ha(t.pathname,a)||t.pathname,d==="path");if(s==null&&(b.search=t.search,b.hash=t.hash),(s==null||s===""||s===".")&&v){let y=sp(b.search);if(v.route.index&&!y)b.search=b.search?b.search.replace(/^\?/,"?index&"):"?index";else if(!v.route.index&&y){let w=new URLSearchParams(b.search),C=w.getAll("index");w.delete("index"),C.filter(S=>S).forEach(S=>w.append("index",S));let E=w.toString();b.search=E?"?"+E:""}}return l&&a!=="/"&&(b.pathname=b.pathname==="/"?a:fa([a,b.pathname])),Hi(b)}function o0(t,r,a,l){if(!l||!H2(l))return{path:a};if(l.formMethod&&!J2(l.formMethod))return{path:a,error:Tn(405,{method:l.formMethod})};let s=()=>({path:a,error:Tn(400,{type:"invalid-body"})}),c=l.formMethod||"get",u=t?c.toUpperCase():c.toLowerCase(),d=eS(a);if(l.body!==void 0){if(l.formEncType==="text/plain"){if(!xr(u))return s();let w=typeof l.body=="string"?l.body:l.body instanceof FormData||l.body instanceof URLSearchParams?Array.from(l.body.entries()).reduce((C,E)=>{let[S,R]=E;return""+C+S+"="+R+` `},""):String(l.body);return{path:a,submission:{formMethod:u,formAction:d,formEncType:l.formEncType,formData:void 0,json:void 0,text:w}}}else if(l.formEncType==="application/json"){if(!xr(u))return s();try{let w=typeof l.body=="string"?JSON.parse(l.body):l.body;return{path:a,submission:{formMethod:u,formAction:d,formEncType:l.formEncType,formData:void 0,json:w,text:void 0}}}catch{return s()}}}qe(typeof FormData=="function","FormData is not available in this environment");let m,v;if(l.formData)m=wm(l.formData),v=l.formData;else if(l.body instanceof FormData)m=wm(l.body),v=l.body;else if(l.body instanceof URLSearchParams)m=l.body,v=h0(m);else if(l.body==null)m=new URLSearchParams,v=new FormData;else try{m=new URLSearchParams(l.body),v=h0(m)}catch{return s()}let b={formMethod:u,formAction:d,formEncType:l&&l.formEncType||"application/x-www-form-urlencoded",formData:v,json:void 0,text:void 0};if(xr(b.formMethod))return{path:a,submission:b};let y=li(a);return r&&y.search&&sp(y.search)&&m.append("index",""),y.search="?"+m,{path:Hi(y),submission:b}}function s0(t,r,a){a===void 0&&(a=!1);let l=t.findIndex(s=>s.route.id===r);return l>=0?t.slice(0,a?l+1:l):t}function c0(t,r,a,l,s,c,u,d,m,v,b,y,w,C,E,S){let R=S?Vn(S[1])?S[1].error:S[1].data:void 0,M=t.createURL(r.location),O=t.createURL(s),_=a;c&&r.errors?_=s0(a,Object.keys(r.errors)[0],!0):S&&Vn(S[1])&&(_=s0(a,S[0]));let z=S?S[1].statusCode:void 0,k=u&&z&&z>=400,I=_.filter((T,A)=>{let{route:q}=T;if(q.lazy)return!0;if(q.loader==null)return!1;if(c)return Sm(q,r.loaderData,r.errors);if(q2(r.loaderData,r.matches[A],T)||m.some(ue=>ue===T.route.id))return!0;let K=r.matches[A],W=T;return u0(T,Nt({currentUrl:M,currentParams:K.params,nextUrl:O,nextParams:W.params},l,{actionResult:R,actionStatus:z,defaultShouldRevalidate:k?!1:d||M.pathname+M.search===O.pathname+O.search||M.search!==O.search||Jx(K,W)}))}),N=[];return y.forEach((T,A)=>{if(c||!a.some(le=>le.route.id===T.routeId)||b.has(A))return;let q=zi(C,T.path,E);if(!q){N.push({key:A,routeId:T.routeId,path:T.path,matches:null,match:null,controller:null});return}let K=r.fetchers.get(A),W=rs(q,T.path),ue=!1;w.has(A)?ue=!1:v.has(A)?(v.delete(A),ue=!0):K&&K.state!=="idle"&&K.data===void 0?ue=d:ue=u0(W,Nt({currentUrl:M,currentParams:r.matches[r.matches.length-1].params,nextUrl:O,nextParams:a[a.length-1].params},l,{actionResult:R,actionStatus:z,defaultShouldRevalidate:k?!1:d})),ue&&N.push({key:A,routeId:T.routeId,path:T.path,matches:q,match:W,controller:new AbortController})}),[I,N]}function Sm(t,r,a){if(t.lazy)return!0;if(!t.loader)return!1;let l=r!=null&&r[t.id]!==void 0,s=a!=null&&a[t.id]!==void 0;return!l&&s?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!l&&!s}function q2(t,r,a){let l=!r||a.route.id!==r.route.id,s=t[a.route.id]===void 0;return l||s}function Jx(t,r){let a=t.route.path;return t.pathname!==r.pathname||a!=null&&a.endsWith("*")&&t.params["*"]!==r.params["*"]}function u0(t,r){if(t.route.shouldRevalidate){let a=t.route.shouldRevalidate(r);if(typeof a=="boolean")return a}return r.defaultShouldRevalidate}function d0(t,r,a,l,s){var c;let u;if(t){let v=l[t];qe(v,"No route found to patch children into: routeId = "+t),v.children||(v.children=[]),u=v.children}else u=a;let d=r.filter(v=>!u.some(b=>Wx(v,b))),m=Cu(d,s,[t||"_","patch",String(((c=u)==null?void 0:c.length)||"0")],l);u.push(...m)}function Wx(t,r){return"id"in t&&"id"in r&&t.id===r.id?!0:t.index===r.index&&t.path===r.path&&t.caseSensitive===r.caseSensitive?(!t.children||t.children.length===0)&&(!r.children||r.children.length===0)?!0:t.children.every((a,l)=>{var s;return(s=r.children)==null?void 0:s.some(c=>Wx(a,c))}):!1}async function I2(t,r,a){if(!t.lazy)return;let l=await t.lazy();if(!t.lazy)return;let s=a[t.id];qe(s,"No route found in manifest");let c={};for(let u in l){let m=s[u]!==void 0&&u!=="hasErrorBoundary";Bi(!m,'Route "'+s.id+'" has a static property "'+u+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+u+'" will be ignored.')),!m&&!d2.has(u)&&(c[u]=l[u])}Object.assign(s,c),Object.assign(s,Nt({},r(s),{lazy:void 0}))}async function Q2(t){let{matches:r}=t,a=r.filter(s=>s.shouldLoad);return(await Promise.all(a.map(s=>s.resolve()))).reduce((s,c,u)=>Object.assign(s,{[a[u].route.id]:c}),{})}async function V2(t,r,a,l,s,c,u,d,m,v){let b=c.map(C=>C.route.lazy?I2(C.route,m,d):void 0),y=c.map((C,E)=>{let S=b[E],R=s.some(O=>O.route.id===C.route.id);return Nt({},C,{shouldLoad:R,resolve:async O=>(O&&l.method==="GET"&&(C.route.lazy||C.route.loader)&&(R=!0),R?F2(r,l,C,S,O,v):Promise.resolve({type:lt.data,result:void 0}))})}),w=await t({matches:y,request:l,params:c[0].params,fetcherKey:u,context:v});try{await Promise.all(b)}catch{}return w}async function F2(t,r,a,l,s,c){let u,d,m=v=>{let b,y=new Promise((E,S)=>b=S);d=()=>b(),r.signal.addEventListener("abort",d);let w=E=>typeof v!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+a.route.id+"]"))):v({request:r,params:a.params,context:c},...E!==void 0?[E]:[]),C=(async()=>{try{return{type:"data",result:await(s?s(S=>w(S)):w())}}catch(E){return{type:"error",result:E}}})();return Promise.race([C,y])};try{let v=a.route[t];if(l)if(v){let b,[y]=await Promise.all([m(v).catch(w=>{b=w}),l]);if(b!==void 0)throw b;u=y}else if(await l,v=a.route[t],v)u=await m(v);else if(t==="action"){let b=new URL(r.url),y=b.pathname+b.search;throw Tn(405,{method:r.method,pathname:y,routeId:a.route.id})}else return{type:lt.data,result:void 0};else if(v)u=await m(v);else{let b=new URL(r.url),y=b.pathname+b.search;throw Tn(404,{pathname:y})}qe(u.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+a.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(v){return{type:lt.error,result:v}}finally{d&&r.signal.removeEventListener("abort",d)}return u}async function G2(t){let{result:r,type:a}=t;if(tS(r)){let y;try{let w=r.headers.get("Content-Type");w&&/\bapplication\/json\b/.test(w)?r.body==null?y=null:y=await r.json():y=await r.text()}catch(w){return{type:lt.error,error:w}}return a===lt.error?{type:lt.error,error:new Eu(r.status,r.statusText,y),statusCode:r.status,headers:r.headers}:{type:lt.data,data:y,statusCode:r.status,headers:r.headers}}if(a===lt.error){if(y0(r)){var l,s;if(r.data instanceof Error){var c,u;return{type:lt.error,error:r.data,statusCode:(c=r.init)==null?void 0:c.status,headers:(u=r.init)!=null&&u.headers?new Headers(r.init.headers):void 0}}return{type:lt.error,error:new Eu(((l=r.init)==null?void 0:l.status)||500,void 0,r.data),statusCode:ds(r)?r.status:void 0,headers:(s=r.init)!=null&&s.headers?new Headers(r.init.headers):void 0}}return{type:lt.error,error:r,statusCode:ds(r)?r.status:void 0}}if(Z2(r)){var d,m;return{type:lt.deferred,deferredData:r,statusCode:(d=r.init)==null?void 0:d.status,headers:((m=r.init)==null?void 0:m.headers)&&new Headers(r.init.headers)}}if(y0(r)){var v,b;return{type:lt.data,data:r.data,statusCode:(v=r.init)==null?void 0:v.status,headers:(b=r.init)!=null&&b.headers?new Headers(r.init.headers):void 0}}return{type:lt.data,data:r}}function Y2(t,r,a,l,s,c){let u=t.headers.get("Location");if(qe(u,"Redirects returned/thrown from loaders/actions must have a Location header"),!lp.test(u)){let d=l.slice(0,l.findIndex(m=>m.route.id===a)+1);u=xm(new URL(r.url),d,s,!0,u,c),t.headers.set("Location",u)}return t}function f0(t,r,a){if(lp.test(t)){let l=t,s=l.startsWith("//")?new URL(r.protocol+l):new URL(l),c=ha(s.pathname,a)!=null;if(s.origin===r.origin&&c)return s.pathname+s.search+s.hash}return t}function kl(t,r,a,l){let s=t.createURL(eS(r)).toString(),c={signal:a};if(l&&xr(l.formMethod)){let{formMethod:u,formEncType:d}=l;c.method=u.toUpperCase(),d==="application/json"?(c.headers=new Headers({"Content-Type":d}),c.body=JSON.stringify(l.json)):d==="text/plain"?c.body=l.text:d==="application/x-www-form-urlencoded"&&l.formData?c.body=wm(l.formData):c.body=l.formData}return new Request(s,c)}function wm(t){let r=new URLSearchParams;for(let[a,l]of t.entries())r.append(a,typeof l=="string"?l:l.name);return r}function h0(t){let r=new FormData;for(let[a,l]of t.entries())r.append(a,l);return r}function K2(t,r,a,l,s){let c={},u=null,d,m=!1,v={},b=a&&Vn(a[1])?a[1].error:void 0;return t.forEach(y=>{if(!(y.route.id in r))return;let w=y.route.id,C=r[w];if(qe(!ki(C),"Cannot handle redirect results in processLoaderData"),Vn(C)){let E=C.error;b!==void 0&&(E=b,b=void 0),u=u||{};{let S=Li(t,w);u[S.route.id]==null&&(u[S.route.id]=E)}c[w]=void 0,m||(m=!0,d=ds(C.error)?C.error.status:500),C.headers&&(v[w]=C.headers)}else ei(C)?(l.set(w,C.deferredData),c[w]=C.deferredData.data,C.statusCode!=null&&C.statusCode!==200&&!m&&(d=C.statusCode),C.headers&&(v[w]=C.headers)):(c[w]=C.data,C.statusCode&&C.statusCode!==200&&!m&&(d=C.statusCode),C.headers&&(v[w]=C.headers))}),b!==void 0&&a&&(u={[a[0]]:b},c[a[0]]=void 0),{loaderData:c,errors:u,statusCode:d||200,loaderHeaders:v}}function m0(t,r,a,l,s,c,u){let{loaderData:d,errors:m}=K2(r,a,l,u);return s.forEach(v=>{let{key:b,match:y,controller:w}=v,C=c[b];if(qe(C,"Did not find corresponding fetcher result"),!(w&&w.signal.aborted))if(Vn(C)){let E=Li(t.matches,y?.route.id);m&&m[E.route.id]||(m=Nt({},m,{[E.route.id]:C.error})),t.fetchers.delete(b)}else if(ki(C))qe(!1,"Unhandled fetcher revalidation redirect");else if(ei(C))qe(!1,"Unhandled fetcher deferred data");else{let E=Za(C.data);t.fetchers.set(b,E)}}),{loaderData:d,errors:m}}function p0(t,r,a,l){let s=Nt({},r);for(let c of a){let u=c.route.id;if(r.hasOwnProperty(u)?r[u]!==void 0&&(s[u]=r[u]):t[u]!==void 0&&c.route.loader&&(s[u]=t[u]),l&&l.hasOwnProperty(u))break}return s}function v0(t){return t?Vn(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function Li(t,r){return(r?t.slice(0,t.findIndex(l=>l.route.id===r)+1):[...t]).reverse().find(l=>l.route.hasErrorBoundary===!0)||t[0]}function g0(t){let r=t.length===1?t[0]:t.find(a=>a.index||!a.path||a.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:r}],route:r}}function Tn(t,r){let{pathname:a,routeId:l,method:s,type:c,message:u}=r===void 0?{}:r,d="Unknown Server Error",m="Unknown @remix-run/router error";return t===400?(d="Bad Request",s&&a&&l?m="You made a "+s+' request to "'+a+'" but '+('did not provide a `loader` for route "'+l+'", ')+"so there is no way to handle the request.":c==="defer-action"?m="defer() is not supported in actions":c==="invalid-body"&&(m="Unable to encode submission body")):t===403?(d="Forbidden",m='Route "'+l+'" does not match URL "'+a+'"'):t===404?(d="Not Found",m='No route matches URL "'+a+'"'):t===405&&(d="Method Not Allowed",s&&a&&l?m="You made a "+s.toUpperCase()+' request to "'+a+'" but '+('did not provide an `action` for route "'+l+'", ')+"so there is no way to handle the request.":s&&(m='Invalid request method "'+s.toUpperCase()+'"')),new Eu(t||500,d,new Error(m),!0)}function nu(t){let r=Object.entries(t);for(let a=r.length-1;a>=0;a--){let[l,s]=r[a];if(ki(s))return{key:l,result:s}}}function eS(t){let r=typeof t=="string"?li(t):t;return Hi(Nt({},r,{hash:""}))}function X2(t,r){return t.pathname!==r.pathname||t.search!==r.search?!1:t.hash===""?r.hash!=="":t.hash===r.hash?!0:r.hash!==""}function $2(t){return tS(t.result)&&L2.has(t.result.status)}function ei(t){return t.type===lt.deferred}function Vn(t){return t.type===lt.error}function ki(t){return(t&&t.type)===lt.redirect}function y0(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Z2(t){let r=t;return r&&typeof r=="object"&&typeof r.data=="object"&&typeof r.subscribe=="function"&&typeof r.cancel=="function"&&typeof r.resolveData=="function"}function tS(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function J2(t){return z2.has(t.toLowerCase())}function xr(t){return _2.has(t.toLowerCase())}async function W2(t,r,a,l,s){let c=Object.entries(r);for(let u=0;uw?.route.id===d);if(!v)continue;let b=l.find(w=>w.route.id===v.route.id),y=b!=null&&!Jx(b,v)&&(s&&s[v.route.id])!==void 0;ei(m)&&y&&await op(m,a,!1).then(w=>{w&&(r[d]=w)})}}async function eR(t,r,a){for(let l=0;lv?.route.id===c)&&ei(d)&&(qe(u,"Expected an AbortController for revalidating fetcher deferred result"),await op(d,u.signal,!0).then(v=>{v&&(r[s]=v)}))}}async function op(t,r,a){if(a===void 0&&(a=!1),!await t.deferredData.resolveData(r)){if(a)try{return{type:lt.data,data:t.deferredData.unwrappedData}}catch(s){return{type:lt.error,error:s}}return{type:lt.data,data:t.deferredData.data}}}function sp(t){return new URLSearchParams(t).getAll("index").some(r=>r==="")}function rs(t,r){let a=typeof r=="string"?li(r).search:r.search;if(t[t.length-1].route.index&&sp(a||""))return t[t.length-1];let l=Xx(t);return l[l.length-1]}function b0(t){let{formMethod:r,formAction:a,formEncType:l,text:s,formData:c,json:u}=t;if(!(!r||!a||!l)){if(s!=null)return{formMethod:r,formAction:a,formEncType:l,formData:void 0,json:void 0,text:s};if(c!=null)return{formMethod:r,formAction:a,formEncType:l,formData:c,json:void 0,text:void 0};if(u!==void 0)return{formMethod:r,formAction:a,formEncType:l,formData:void 0,json:u,text:void 0}}}function Wh(t,r){return r?{state:"loading",location:t,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function tR(t,r){return{state:"submitting",location:t,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function Wo(t,r){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:r}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:r}}function nR(t,r){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:r?r.data:void 0}}function Za(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function rR(t,r){try{let a=t.sessionStorage.getItem(Zx);if(a){let l=JSON.parse(a);for(let[s,c]of Object.entries(l||{}))c&&Array.isArray(c)&&r.set(s,new Set(c||[]))}}catch{}}function aR(t,r){if(r.size>0){let a={};for(let[l,s]of r)a[l]=[...s];try{t.sessionStorage.setItem(Zx,JSON.stringify(a))}catch(l){Bi(!1,"Failed to save applied view transitions in sessionStorage ("+l+").")}}}function ju(){return ju=Object.assign?Object.assign.bind():function(t){for(var r=1;r{d.current=!0}),g.useCallback(function(v,b){if(b===void 0&&(b={}),!d.current)return;if(typeof v=="number"){l.go(v);return}let y=ip(v,JSON.parse(u),c,b.relative==="path");t==null&&r!=="/"&&(y.pathname=y.pathname==="/"?r:fa([r,y.pathname])),(b.replace?l.replace:l.push)(y,b.state,b)},[r,l,u,c,t])}const oR=g.createContext(null);function sR(t){let r=g.useContext(xa).outlet;return r&&g.createElement(oR.Provider,{value:t},r)}function cR(){let{matches:t}=g.useContext(xa),r=t[t.length-1];return r?r.params:{}}function Ku(t,r){let{relative:a}=r===void 0?{}:r,{future:l}=g.useContext(oi),{matches:s}=g.useContext(xa),{pathname:c}=Sa(),u=JSON.stringify(ap(s,l.v7_relativeSplatPath));return g.useMemo(()=>ip(t,JSON.parse(u),c,a==="path"),[t,u,c,a])}function uR(t,r,a,l){Es()||qe(!1);let{navigator:s}=g.useContext(oi),{matches:c}=g.useContext(xa),u=c[c.length-1],d=u?u.params:{};u&&u.pathname;let m=u?u.pathnameBase:"/";u&&u.route;let v=Sa(),b;b=v;let y=b.pathname||"/",w=y;if(m!=="/"){let S=m.replace(/^\//,"").split("/");w="/"+y.replace(/^\//,"").split("/").slice(S.length).join("/")}let C=zi(t,{pathname:w});return pR(C&&C.map(S=>Object.assign({},S,{params:Object.assign({},d,S.params),pathname:fa([m,s.encodeLocation?s.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?m:fa([m,s.encodeLocation?s.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),c,a,l)}function dR(){let t=bR(),r=ds(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},r),a?g.createElement("pre",{style:s},a):null,null)}const fR=g.createElement(dR,null);class hR extends g.Component{constructor(r){super(r),this.state={location:r.location,revalidation:r.revalidation,error:r.error}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,a){return a.location!==r.location||a.revalidation!=="idle"&&r.revalidation==="idle"?{error:r.error,location:r.location,revalidation:r.revalidation}:{error:r.error!==void 0?r.error:a.error,location:a.location,revalidation:r.revalidation||a.revalidation}}componentDidCatch(r,a){console.error("React Router caught the following error during render",r,a)}render(){return this.state.error!==void 0?g.createElement(xa.Provider,{value:this.props.routeContext},g.createElement(nS.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function mR(t){let{routeContext:r,match:a,children:l}=t,s=g.useContext(Ns);return s&&s.static&&s.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=a.route.id),g.createElement(xa.Provider,{value:r},l)}function pR(t,r,a,l){var s;if(r===void 0&&(r=[]),a===void 0&&(a=null),l===void 0&&(l=null),t==null){var c;if(!a)return null;if(a.errors)t=a.matches;else if((c=l)!=null&&c.v7_partialHydration&&r.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let u=t,d=(s=a)==null?void 0:s.errors;if(d!=null){let b=u.findIndex(y=>y.route.id&&d?.[y.route.id]!==void 0);b>=0||qe(!1),u=u.slice(0,Math.min(u.length,b+1))}let m=!1,v=-1;if(a&&l&&l.v7_partialHydration)for(let b=0;b=0?u=u.slice(0,v+1):u=[u[0]];break}}}return u.reduceRight((b,y,w)=>{let C,E=!1,S=null,R=null;a&&(C=d&&y.route.id?d[y.route.id]:void 0,S=y.route.errorElement||fR,m&&(v<0&&w===0?(SR("route-fallback"),E=!0,R=null):v===w&&(E=!0,R=y.route.hydrateFallbackElement||null)));let M=r.concat(u.slice(0,w+1)),O=()=>{let _;return C?_=S:E?_=R:y.route.Component?_=g.createElement(y.route.Component,null):y.route.element?_=y.route.element:_=b,g.createElement(mR,{match:y,routeContext:{outlet:b,matches:M,isDataRoute:a!=null},children:_})};return a&&(y.route.ErrorBoundary||y.route.errorElement||w===0)?g.createElement(hR,{location:a.location,revalidation:a.revalidation,component:S,error:C,children:O(),routeContext:{outlet:null,matches:M,isDataRoute:!0}}):O()},null)}var aS=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(aS||{}),iS=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(iS||{});function vR(t){let r=g.useContext(Ns);return r||qe(!1),r}function gR(t){let r=g.useContext(cp);return r||qe(!1),r}function yR(t){let r=g.useContext(xa);return r||qe(!1),r}function lS(t){let r=yR(),a=r.matches[r.matches.length-1];return a.route.id||qe(!1),a.route.id}function bR(){var t;let r=g.useContext(nS),a=gR(iS.UseRouteError),l=lS();return r!==void 0?r:(t=a.errors)==null?void 0:t[l]}function xR(){let{router:t}=vR(aS.UseNavigateStable),r=lS(),a=g.useRef(!1);return rS(()=>{a.current=!0}),g.useCallback(function(s,c){c===void 0&&(c={}),a.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,ju({fromRouteId:r},c)))},[t,r])}const x0={};function SR(t,r,a){x0[t]||(x0[t]=!0)}function wR(t,r){t?.v7_startTransition,t?.v7_relativeSplatPath===void 0&&(!r||r.v7_relativeSplatPath),r&&(r.v7_fetcherPersist,r.v7_normalizeFormMethod,r.v7_partialHydration,r.v7_skipActionErrorRevalidation)}function CR(t){return sR(t.context)}function NR(t){let{basename:r="/",children:a=null,location:l,navigationType:s=Qt.Pop,navigator:c,static:u=!1,future:d}=t;Es()&&qe(!1);let m=r.replace(/^\/*/,"/"),v=g.useMemo(()=>({basename:m,navigator:c,static:u,future:ju({v7_relativeSplatPath:!1},d)}),[m,d,c,u]);typeof l=="string"&&(l=li(l));let{pathname:b="/",search:y="",hash:w="",state:C=null,key:E="default"}=l,S=g.useMemo(()=>{let R=ha(b,m);return R==null?null:{location:{pathname:R,search:y,hash:w,state:C,key:E},navigationType:s}},[m,b,y,w,C,E,s]);return S==null?null:g.createElement(oi.Provider,{value:v},g.createElement(up.Provider,{children:a,value:S}))}new Promise(()=>{});function ER(t){let r={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(r,{element:g.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(r,{hydrateFallbackElement:g.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(r,{errorElement:g.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),r}function Fl(){return Fl=Object.assign?Object.assign.bind():function(t){for(var r=1;r=0)&&(a[s]=t[s]);return a}function jR(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function RR(t,r){return t.button===0&&(!r||r==="_self")&&!jR(t)}const MR=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],OR=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],DR="6";try{window.__reactRouterVersion=DR}catch{}function TR(t,r){return B2({basename:void 0,future:Fl({},void 0,{v7_prependBasename:!0}),history:s2({window:void 0}),hydrationData:_R(),routes:t,mapRouteProperties:ER,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function _R(){var t;let r=(t=window)==null?void 0:t.__staticRouterHydrationData;return r&&r.errors&&(r=Fl({},r,{errors:AR(r.errors)})),r}function AR(t){if(!t)return null;let r=Object.entries(t),a={};for(let[l,s]of r)if(s&&s.__type==="RouteErrorResponse")a[l]=new Eu(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let c=window[s.__subType];if(typeof c=="function")try{let u=new c(s.message);u.stack="",a[l]=u}catch{}}if(a[l]==null){let c=new Error(s.message);c.stack="",a[l]=c}}else a[l]=s;return a}const sS=g.createContext({isTransitioning:!1}),zR=g.createContext(new Map),LR="startTransition",S0=Cs[LR],kR="flushSync",w0=o2[kR];function PR(t){S0?S0(t):t()}function es(t){w0?w0(t):t()}class UR{constructor(){this.status="pending",this.promise=new Promise((r,a)=>{this.resolve=l=>{this.status==="pending"&&(this.status="resolved",r(l))},this.reject=l=>{this.status==="pending"&&(this.status="rejected",a(l))}})}}function BR(t){let{fallbackElement:r,router:a,future:l}=t,[s,c]=g.useState(a.state),[u,d]=g.useState(),[m,v]=g.useState({isTransitioning:!1}),[b,y]=g.useState(),[w,C]=g.useState(),[E,S]=g.useState(),R=g.useRef(new Map),{v7_startTransition:M}=l||{},O=g.useCallback(T=>{M?PR(T):T()},[M]),_=g.useCallback((T,A)=>{let{deletedFetchers:q,flushSync:K,viewTransitionOpts:W}=A;T.fetchers.forEach((le,de)=>{le.data!==void 0&&R.current.set(de,le.data)}),q.forEach(le=>R.current.delete(le));let ue=a.window==null||a.window.document==null||typeof a.window.document.startViewTransition!="function";if(!W||ue){K?es(()=>c(T)):O(()=>c(T));return}if(K){es(()=>{w&&(b&&b.resolve(),w.skipTransition()),v({isTransitioning:!0,flushSync:!0,currentLocation:W.currentLocation,nextLocation:W.nextLocation})});let le=a.window.document.startViewTransition(()=>{es(()=>c(T))});le.finished.finally(()=>{es(()=>{y(void 0),C(void 0),d(void 0),v({isTransitioning:!1})})}),es(()=>C(le));return}w?(b&&b.resolve(),w.skipTransition(),S({state:T,currentLocation:W.currentLocation,nextLocation:W.nextLocation})):(d(T),v({isTransitioning:!0,flushSync:!1,currentLocation:W.currentLocation,nextLocation:W.nextLocation}))},[a.window,w,b,R,O]);g.useLayoutEffect(()=>a.subscribe(_),[a,_]),g.useEffect(()=>{m.isTransitioning&&!m.flushSync&&y(new UR)},[m]),g.useEffect(()=>{if(b&&u&&a.window){let T=u,A=b.promise,q=a.window.document.startViewTransition(async()=>{O(()=>c(T)),await A});q.finished.finally(()=>{y(void 0),C(void 0),d(void 0),v({isTransitioning:!1})}),C(q)}},[O,u,b,a.window]),g.useEffect(()=>{b&&u&&s.location.key===u.location.key&&b.resolve()},[b,w,s.location,u]),g.useEffect(()=>{!m.isTransitioning&&E&&(d(E.state),v({isTransitioning:!0,flushSync:!1,currentLocation:E.currentLocation,nextLocation:E.nextLocation}),S(void 0))},[m.isTransitioning,E]),g.useEffect(()=>{},[]);let z=g.useMemo(()=>({createHref:a.createHref,encodeLocation:a.encodeLocation,go:T=>a.navigate(T),push:(T,A,q)=>a.navigate(T,{state:A,preventScrollReset:q?.preventScrollReset}),replace:(T,A,q)=>a.navigate(T,{replace:!0,state:A,preventScrollReset:q?.preventScrollReset})}),[a]),k=a.basename||"/",I=g.useMemo(()=>({router:a,navigator:z,static:!1,basename:k}),[a,z,k]),N=g.useMemo(()=>({v7_relativeSplatPath:a.future.v7_relativeSplatPath}),[a.future.v7_relativeSplatPath]);return g.useEffect(()=>wR(l,a.future),[l,a.future]),g.createElement(g.Fragment,null,g.createElement(Ns.Provider,{value:I},g.createElement(cp.Provider,{value:s},g.createElement(zR.Provider,{value:R.current},g.createElement(sS.Provider,{value:m},g.createElement(NR,{basename:k,location:s.location,navigationType:s.historyAction,navigator:z,future:N},s.initialized||a.future.v7_partialHydration?g.createElement(HR,{routes:a.routes,future:a.future,state:s}):r))))),null)}const HR=g.memo(qR);function qR(t){let{routes:r,future:a,state:l}=t;return uR(r,void 0,l,a)}const IR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",QR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cS=g.forwardRef(function(r,a){let{onClick:l,relative:s,reloadDocument:c,replace:u,state:d,target:m,to:v,preventScrollReset:b,viewTransition:y}=r,w=oS(r,MR),{basename:C}=g.useContext(oi),E,S=!1;if(typeof v=="string"&&QR.test(v)&&(E=v,IR))try{let _=new URL(window.location.href),z=v.startsWith("//")?new URL(_.protocol+v):new URL(v),k=ha(z.pathname,C);z.origin===_.origin&&k!=null?v=k+z.search+z.hash:S=!0}catch{}let R=iR(v,{relative:s}),M=FR(v,{replace:u,state:d,target:m,preventScrollReset:b,relative:s,viewTransition:y});function O(_){l&&l(_),_.defaultPrevented||M(_)}return g.createElement("a",Fl({},w,{href:E||R,onClick:S||c?l:O,ref:a,target:m}))}),C0=g.forwardRef(function(r,a){let{"aria-current":l="page",caseSensitive:s=!1,className:c="",end:u=!1,style:d,to:m,viewTransition:v,children:b}=r,y=oS(r,OR),w=Ku(m,{relative:y.relative}),C=Sa(),E=g.useContext(cp),{navigator:S,basename:R}=g.useContext(oi),M=E!=null&&GR(w)&&v===!0,O=S.encodeLocation?S.encodeLocation(w).pathname:w.pathname,_=C.pathname,z=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;s||(_=_.toLowerCase(),z=z?z.toLowerCase():null,O=O.toLowerCase()),z&&R&&(z=ha(z,R)||z);const k=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let I=_===O||!u&&_.startsWith(O)&&_.charAt(k)==="/",N=z!=null&&(z===O||!u&&z.startsWith(O)&&z.charAt(O.length)==="/"),T={isActive:I,isPending:N,isTransitioning:M},A=I?l:void 0,q;typeof c=="function"?q=c(T):q=[c,I?"active":null,N?"pending":null,M?"transitioning":null].filter(Boolean).join(" ");let K=typeof d=="function"?d(T):d;return g.createElement(cS,Fl({},y,{"aria-current":A,className:q,ref:a,style:K,to:m,viewTransition:v}),typeof b=="function"?b(T):b)});var Cm;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Cm||(Cm={}));var N0;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(N0||(N0={}));function VR(t){let r=g.useContext(Ns);return r||qe(!1),r}function FR(t,r){let{target:a,replace:l,state:s,preventScrollReset:c,relative:u,viewTransition:d}=r===void 0?{}:r,m=js(),v=Sa(),b=Ku(t,{relative:u});return g.useCallback(y=>{if(RR(y,a)){y.preventDefault();let w=l!==void 0?l:Hi(v)===Hi(b);m(t,{replace:w,state:s,preventScrollReset:c,relative:u,viewTransition:d})}},[v,m,b,l,s,a,t,c,u,d])}function GR(t,r){r===void 0&&(r={});let a=g.useContext(sS);a==null&&qe(!1);let{basename:l}=VR(Cm.useViewTransitionState),s=Ku(t,{relative:r.relative});if(!a.isTransitioning)return!1;let c=ha(a.currentLocation.pathname,l)||a.currentLocation.pathname,u=ha(a.nextLocation.pathname,l)||a.nextLocation.pathname;return Nu(s.pathname,u)!=null||Nu(s.pathname,c)!=null}var Xi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},YR={setTimeout:(t,r)=>setTimeout(t,r),clearTimeout:t=>clearTimeout(t),setInterval:(t,r)=>setInterval(t,r),clearInterval:t=>clearInterval(t)},KR=class{#t=YR;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,r){return this.#t.setTimeout(t,r)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,r){return this.#t.setInterval(t,r)}clearInterval(t){this.#t.clearInterval(t)}},Pi=new KR;function XR(t){setTimeout(t,0)}var qi=typeof window>"u"||"Deno"in globalThis;function fn(){}function $R(t,r){return typeof t=="function"?t(r):t}function Nm(t){return typeof t=="number"&&t>=0&&t!==1/0}function uS(t,r){return Math.max(t+(r||0)-Date.now(),0)}function ti(t,r){return typeof t=="function"?t(r):t}function or(t,r){return typeof t=="function"?t(r):t}function E0(t,r){const{type:a="all",exact:l,fetchStatus:s,predicate:c,queryKey:u,stale:d}=t;if(u){if(l){if(r.queryHash!==dp(u,r.options))return!1}else if(!fs(r.queryKey,u))return!1}if(a!=="all"){const m=r.isActive();if(a==="active"&&!m||a==="inactive"&&m)return!1}return!(typeof d=="boolean"&&r.isStale()!==d||s&&s!==r.state.fetchStatus||c&&!c(r))}function j0(t,r){const{exact:a,status:l,predicate:s,mutationKey:c}=t;if(c){if(!r.options.mutationKey)return!1;if(a){if(ri(r.options.mutationKey)!==ri(c))return!1}else if(!fs(r.options.mutationKey,c))return!1}return!(l&&r.state.status!==l||s&&!s(r))}function dp(t,r){return(r?.queryKeyHashFn||ri)(t)}function ri(t){return JSON.stringify(t,(r,a)=>Em(a)?Object.keys(a).sort().reduce((l,s)=>(l[s]=a[s],l),{}):a)}function fs(t,r){return t===r?!0:typeof t!=typeof r?!1:t&&r&&typeof t=="object"&&typeof r=="object"?Object.keys(r).every(a=>fs(t[a],r[a])):!1}var ZR=Object.prototype.hasOwnProperty;function fp(t,r){if(t===r)return t;const a=R0(t)&&R0(r);if(!a&&!(Em(t)&&Em(r)))return r;const s=(a?t:Object.keys(t)).length,c=a?r:Object.keys(r),u=c.length,d=a?new Array(u):{};let m=0;for(let v=0;v{Pi.setTimeout(r,t)})}function jm(t,r,a){return typeof a.structuralSharing=="function"?a.structuralSharing(t,r):a.structuralSharing!==!1?fp(t,r):r}function WR(t,r,a=0){const l=[...t,r];return a&&l.length>a?l.slice(1):l}function eM(t,r,a=0){const l=[r,...t];return a&&l.length>a?l.slice(0,-1):l}var Gn=Symbol();function dS(t,r){return!t.queryFn&&r?.initialPromise?()=>r.initialPromise:!t.queryFn||t.queryFn===Gn?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function hp(t,r){return typeof t=="function"?t(...r):!!t}function tM(t,r,a){let l=!1,s;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(s??=r(),l||(l=!0,s.aborted?a():s.addEventListener("abort",a,{once:!0})),s)}),t}var nM=class extends Xi{#t;#e;#n;constructor(){super(),this.#n=t=>{if(!qi&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#n=t,this.#e?.(),this.#e=t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},mp=new nM;function Rm(){let t,r;const a=new Promise((s,c)=>{t=s,r=c});a.status="pending",a.catch(()=>{});function l(s){Object.assign(a,s),delete a.resolve,delete a.reject}return a.resolve=s=>{l({status:"fulfilled",value:s}),t(s)},a.reject=s=>{l({status:"rejected",reason:s}),r(s)},a}var rM=XR;function aM(){let t=[],r=0,a=d=>{d()},l=d=>{d()},s=rM;const c=d=>{r?t.push(d):s(()=>{a(d)})},u=()=>{const d=t;t=[],d.length&&s(()=>{l(()=>{d.forEach(m=>{a(m)})})})};return{batch:d=>{let m;r++;try{m=d()}finally{r--,r||u()}return m},batchCalls:d=>(...m)=>{c(()=>{d(...m)})},schedule:c,setNotifyFunction:d=>{a=d},setBatchNotifyFunction:d=>{l=d},setScheduler:d=>{s=d}}}var Dt=aM(),iM=class extends Xi{#t=!0;#e;#n;constructor(){super(),this.#n=t=>{if(!qi&&window.addEventListener){const r=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",a)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#n=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(a=>{a(t)}))}isOnline(){return this.#t}},Ru=new iM;function lM(t){return Math.min(1e3*2**t,3e4)}function fS(t){return(t??"online")==="online"?Ru.isOnline():!0}var Mm=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function hS(t){let r=!1,a=0,l;const s=Rm(),c=()=>s.status!=="pending",u=S=>{if(!c()){const R=new Mm(S);w(R),t.onCancel?.(R)}},d=()=>{r=!0},m=()=>{r=!1},v=()=>mp.isFocused()&&(t.networkMode==="always"||Ru.isOnline())&&t.canRun(),b=()=>fS(t.networkMode)&&t.canRun(),y=S=>{c()||(l?.(),s.resolve(S))},w=S=>{c()||(l?.(),s.reject(S))},C=()=>new Promise(S=>{l=R=>{(c()||v())&&S(R)},t.onPause?.()}).then(()=>{l=void 0,c()||t.onContinue?.()}),E=()=>{if(c())return;let S;const R=a===0?t.initialPromise:void 0;try{S=R??t.fn()}catch(M){S=Promise.reject(M)}Promise.resolve(S).then(y).catch(M=>{if(c())return;const O=t.retry??(qi?0:3),_=t.retryDelay??lM,z=typeof _=="function"?_(a,M):_,k=O===!0||typeof O=="number"&&av()?void 0:C()).then(()=>{r?w(M):E()})})};return{promise:s,status:()=>s.status,cancel:u,continue:()=>(l?.(),s),cancelRetry:d,continueRetry:m,canStart:b,start:()=>(b()?E():C().then(E),s)}}var mS=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Nm(this.gcTime)&&(this.#t=Pi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(qi?1/0:300*1e3))}clearGcTimeout(){this.#t&&(Pi.clearTimeout(this.#t),this.#t=void 0)}},oM=class extends mS{#t;#e;#n;#a;#r;#i;#o;constructor(t){super(),this.#o=!1,this.#i=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#a=t.client,this.#n=this.#a.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=D0(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(t){if(this.options={...this.#i,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=D0(this.options);r.data!==void 0&&(this.setState(O0(r.data,r.dataUpdatedAt)),this.#t=r)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,r){const a=jm(this.state.data,t,this.options);return this.#l({data:a,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),a}setState(t,r){this.#l({type:"setState",state:t,setStateOptions:r})}cancel(t){const r=this.#r?.promise;return this.#r?.cancel(t),r?r.then(fn).catch(fn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>or(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Gn||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ti(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!uS(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(r=>r.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(r=>r.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(t,r){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&r?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(m=>m.options.queryFn);d&&this.setOptions(d.options)}const a=new AbortController,l=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(this.#o=!0,a.signal)})},s=()=>{const d=dS(this.options,r),v=(()=>{const b={client:this.#a,queryKey:this.queryKey,meta:this.meta};return l(b),b})();return this.#o=!1,this.options.persister?this.options.persister(d,v,this):d(v)},u=(()=>{const d={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:s};return l(d),d})();this.options.behavior?.onFetch(u,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#l({type:"fetch",meta:u.fetchOptions?.meta}),this.#r=hS({initialPromise:r?.initialPromise,fn:u.fetchFn,onCancel:d=>{d instanceof Mm&&d.revert&&this.setState({...this.#e,fetchStatus:"idle"}),a.abort()},onFail:(d,m)=>{this.#l({type:"failed",failureCount:d,error:m})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const d=await this.#r.start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#n.config.onSuccess?.(d,this),this.#n.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Mm){if(d.silent)return this.#r.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#l({type:"error",error:d}),this.#n.config.onError?.(d,this),this.#n.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#l(t){const r=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...pS(a.data,this.options),fetchMeta:t.meta??null};case"success":const l={...a,...O0(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?l:void 0,l;case"error":const s=t.error;return{...a,error:s,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=r(this.state),Dt.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function pS(t,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fS(r.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function O0(t,r){return{data:t,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function D0(t){const r=typeof t.initialData=="function"?t.initialData():t.initialData,a=r!==void 0,l=a?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Rs=class extends Xi{constructor(t,r){super(),this.options=r,this.#t=t,this.#l=null,this.#o=Rm(),this.bindMethods(),this.setOptions(r)}#t;#e=void 0;#n=void 0;#a=void 0;#r;#i;#o;#l;#h;#d;#f;#c;#u;#s;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),T0(this.#e,this.options)?this.#m():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Om(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Om(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#e.removeObserver(this)}setOptions(t){const r=this.options,a=this.#e;if(this.options=this.#t.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof or(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#e.setOptions(this.options),r._defaulted&&!hs(this.options,r)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const l=this.hasListeners();l&&_0(this.#e,a,this.options,r)&&this.#m(),this.updateResult(),l&&(this.#e!==a||or(this.options.enabled,this.#e)!==or(r.enabled,this.#e)||ti(this.options.staleTime,this.#e)!==ti(r.staleTime,this.#e))&&this.#v();const s=this.#g();l&&(this.#e!==a||or(this.options.enabled,this.#e)!==or(r.enabled,this.#e)||s!==this.#s)&&this.#y(s)}getOptimisticResult(t){const r=this.#t.getQueryCache().build(this.#t,t),a=this.createResult(r,t);return cM(this,a)&&(this.#a=a,this.#i=this.options,this.#r=this.#e.state),a}getCurrentResult(){return this.#a}trackResult(t,r){return new Proxy(t,{get:(a,l)=>(this.trackProp(l),r?.(l),l==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,l))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=this.#t.defaultQueryOptions(t),a=this.#t.getQueryCache().build(this.#t,r);return a.fetch().then(()=>this.createResult(a,r))}fetch(t){return this.#m({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#m(t){this.#w();let r=this.#e.fetch(this.options,t);return t?.throwOnError||(r=r.catch(fn)),r}#v(){this.#x();const t=ti(this.options.staleTime,this.#e);if(qi||this.#a.isStale||!Nm(t))return;const a=uS(this.#a.dataUpdatedAt,t)+1;this.#c=Pi.setTimeout(()=>{this.#a.isStale||this.updateResult()},a)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(t){this.#S(),this.#s=t,!(qi||or(this.options.enabled,this.#e)===!1||!Nm(this.#s)||this.#s===0)&&(this.#u=Pi.setInterval(()=>{(this.options.refetchIntervalInBackground||mp.isFocused())&&this.#m()},this.#s))}#b(){this.#v(),this.#y(this.#g())}#x(){this.#c&&(Pi.clearTimeout(this.#c),this.#c=void 0)}#S(){this.#u&&(Pi.clearInterval(this.#u),this.#u=void 0)}createResult(t,r){const a=this.#e,l=this.options,s=this.#a,c=this.#r,u=this.#i,m=t!==a?t.state:this.#n,{state:v}=t;let b={...v},y=!1,w;if(r._optimisticResults){const T=this.hasListeners(),A=!T&&T0(t,r),q=T&&_0(t,a,r,l);(A||q)&&(b={...b,...pS(v.data,t.options)}),r._optimisticResults==="isRestoring"&&(b.fetchStatus="idle")}let{error:C,errorUpdatedAt:E,status:S}=b;w=b.data;let R=!1;if(r.placeholderData!==void 0&&w===void 0&&S==="pending"){let T;s?.isPlaceholderData&&r.placeholderData===u?.placeholderData?(T=s.data,R=!0):T=typeof r.placeholderData=="function"?r.placeholderData(this.#f?.state.data,this.#f):r.placeholderData,T!==void 0&&(S="success",w=jm(s?.data,T,r),y=!0)}if(r.select&&w!==void 0&&!R)if(s&&w===c?.data&&r.select===this.#h)w=this.#d;else try{this.#h=r.select,w=r.select(w),w=jm(s?.data,w,r),this.#d=w,this.#l=null}catch(T){this.#l=T}this.#l&&(C=this.#l,w=this.#d,E=Date.now(),S="error");const M=b.fetchStatus==="fetching",O=S==="pending",_=S==="error",z=O&&M,k=w!==void 0,N={status:S,fetchStatus:b.fetchStatus,isPending:O,isSuccess:S==="success",isError:_,isInitialLoading:z,isLoading:z,data:w,dataUpdatedAt:b.dataUpdatedAt,error:C,errorUpdatedAt:E,failureCount:b.fetchFailureCount,failureReason:b.fetchFailureReason,errorUpdateCount:b.errorUpdateCount,isFetched:b.dataUpdateCount>0||b.errorUpdateCount>0,isFetchedAfterMount:b.dataUpdateCount>m.dataUpdateCount||b.errorUpdateCount>m.errorUpdateCount,isFetching:M,isRefetching:M&&!O,isLoadingError:_&&!k,isPaused:b.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:_&&k,isStale:pp(t,r),refetch:this.refetch,promise:this.#o,isEnabled:or(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const T=K=>{N.status==="error"?K.reject(N.error):N.data!==void 0&&K.resolve(N.data)},A=()=>{const K=this.#o=N.promise=Rm();T(K)},q=this.#o;switch(q.status){case"pending":t.queryHash===a.queryHash&&T(q);break;case"fulfilled":(N.status==="error"||N.data!==q.value)&&A();break;case"rejected":(N.status!=="error"||N.error!==q.reason)&&A();break}}return N}updateResult(){const t=this.#a,r=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#i=this.options,this.#r.data!==void 0&&(this.#f=this.#e),hs(r,t))return;this.#a=r;const a=()=>{if(!t)return!0;const{notifyOnChangeProps:l}=this.options,s=typeof l=="function"?l():l;if(s==="all"||!s&&!this.#p.size)return!0;const c=new Set(s??this.#p);return this.options.throwOnError&&c.add("error"),Object.keys(this.#a).some(u=>{const d=u;return this.#a[d]!==t[d]&&c.has(d)})};this.#C({listeners:a()})}#w(){const t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#e)return;const r=this.#e;this.#e=t,this.#n=t.state,this.hasListeners()&&(r?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#C(t){Dt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(this.#a)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function sM(t,r){return or(r.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&r.retryOnMount===!1)}function T0(t,r){return sM(t,r)||t.state.data!==void 0&&Om(t,r,r.refetchOnMount)}function Om(t,r,a){if(or(r.enabled,t)!==!1&&ti(r.staleTime,t)!=="static"){const l=typeof a=="function"?a(t):a;return l==="always"||l!==!1&&pp(t,r)}return!1}function _0(t,r,a,l){return(t!==r||or(l.enabled,t)===!1)&&(!a.suspense||t.state.status!=="error")&&pp(t,a)}function pp(t,r){return or(r.enabled,t)!==!1&&t.isStaleByTime(ti(r.staleTime,t))}function cM(t,r){return!hs(t.getCurrentResult(),r)}function Mu(t){return{onFetch:(r,a)=>{const l=r.options,s=r.fetchOptions?.meta?.fetchMore?.direction,c=r.state.data?.pages||[],u=r.state.data?.pageParams||[];let d={pages:[],pageParams:[]},m=0;const v=async()=>{let b=!1;const y=E=>{tM(E,()=>r.signal,()=>b=!0)},w=dS(r.options,r.fetchOptions),C=async(E,S,R)=>{if(b)return Promise.reject();if(S==null&&E.pages.length)return Promise.resolve(E);const O=(()=>{const I={client:r.client,queryKey:r.queryKey,pageParam:S,direction:R?"backward":"forward",meta:r.options.meta};return y(I),I})(),_=await w(O),{maxPages:z}=r.options,k=R?eM:WR;return{pages:k(E.pages,_,z),pageParams:k(E.pageParams,S,z)}};if(s&&c.length){const E=s==="backward",S=E?vS:Dm,R={pages:c,pageParams:u},M=S(l,R);d=await C(R,M,E)}else{const E=t??c.length;do{const S=m===0?u[0]??l.initialPageParam:Dm(l,d);if(m>0&&S==null)break;d=await C(d,S),m++}while(mr.options.persister?.(v,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},a):r.fetchFn=v}}}function Dm(t,{pages:r,pageParams:a}){const l=r.length-1;return r.length>0?t.getNextPageParam(r[l],r,a[l],a):void 0}function vS(t,{pages:r,pageParams:a}){return r.length>0?t.getPreviousPageParam?.(r[0],r,a[0],a):void 0}function uM(t,r){return r?Dm(t,r)!=null:!1}function dM(t,r){return!r||!t.getPreviousPageParam?!1:vS(t,r)!=null}var gS=class extends Rs{constructor(t,r){super(t,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Mu()})}getOptimisticResult(t){return t.behavior=Mu(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,r){const{state:a}=t,l=super.createResult(t,r),{isFetching:s,isRefetching:c,isError:u,isRefetchError:d}=l,m=a.fetchMeta?.fetchMore?.direction,v=u&&m==="forward",b=s&&m==="forward",y=u&&m==="backward",w=s&&m==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:uM(r,a.data),hasPreviousPage:dM(r,a.data),isFetchNextPageError:v,isFetchingNextPage:b,isFetchPreviousPageError:y,isFetchingPreviousPage:w,isRefetchError:d&&!v&&!y,isRefetching:c&&!b&&!w}}},fM=class extends mS{#t;#e;#n;#a;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#n=t.mutationCache,this.#e=[],this.state=t.state||yS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(r=>r!==t),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(t){const r=()=>{this.#r({type:"continue"})},a={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=hS({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(c,u)=>{this.#r({type:"failed",failureCount:c,error:u})},onPause:()=>{this.#r({type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const l=this.state.status==="pending",s=!this.#a.canStart();try{if(l)r();else{this.#r({type:"pending",variables:t,isPaused:s}),await this.#n.config.onMutate?.(t,this,a);const u=await this.options.onMutate?.(t,a);u!==this.state.context&&this.#r({type:"pending",context:u,variables:t,isPaused:s})}const c=await this.#a.start();return await this.#n.config.onSuccess?.(c,t,this.state.context,this,a),await this.options.onSuccess?.(c,t,this.state.context,a),await this.#n.config.onSettled?.(c,null,this.state.variables,this.state.context,this,a),await this.options.onSettled?.(c,null,t,this.state.context,a),this.#r({type:"success",data:c}),c}catch(c){try{await this.#n.config.onError?.(c,t,this.state.context,this,a)}catch(u){Promise.reject(u)}try{await this.options.onError?.(c,t,this.state.context,a)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,c,this.state.variables,this.state.context,this,a)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,c,t,this.state.context,a)}catch(u){Promise.reject(u)}throw this.#r({type:"error",error:c}),c}finally{this.#n.runNext(this)}}#r(t){const r=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Dt.batch(()=>{this.#e.forEach(a=>{a.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function yS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hM=class extends Xi{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(t,r,a){const l=new fM({client:t,mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(r),state:a});return this.add(l),l}add(t){this.#t.add(t);const r=ru(t);if(typeof r=="string"){const a=this.#e.get(r);a?a.push(t):this.#e.set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const r=ru(t);if(typeof r=="string"){const a=this.#e.get(r);if(a)if(a.length>1){const l=a.indexOf(t);l!==-1&&a.splice(l,1)}else a[0]===t&&this.#e.delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=ru(t);if(typeof r=="string"){const l=this.#e.get(r)?.find(s=>s.state.status==="pending");return!l||l===t}else return!0}runNext(t){const r=ru(t);return typeof r=="string"?this.#e.get(r)?.find(l=>l!==t&&l.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Dt.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const r={exact:!0,...t};return this.getAll().find(a=>j0(r,a))}findAll(t={}){return this.getAll().filter(r=>j0(t,r))}notify(t){Dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Dt.batch(()=>Promise.all(t.map(r=>r.continue().catch(fn))))}};function ru(t){return t.options.scope?.id}var mM=class extends Xi{#t;#e=void 0;#n;#a;constructor(r,a){super(),this.#t=r,this.setOptions(a),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){const a=this.options;this.options=this.#t.defaultMutationOptions(r),hs(this.options,a)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),a?.mutationKey&&this.options.mutationKey&&ri(a.mutationKey)!==ri(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(r){this.#r(),this.#i(r)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#i()}mutate(r,a){return this.#a=a,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(r)}#r(){const r=this.#n?.state??yS();this.#e={...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset}}#i(r){Dt.batch(()=>{if(this.#a&&this.hasListeners()){const a=this.#e.variables,l=this.#e.context,s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{this.#a.onSuccess?.(r.data,a,l,s)}catch(c){Promise.reject(c)}try{this.#a.onSettled?.(r.data,null,a,l,s)}catch(c){Promise.reject(c)}}else if(r?.type==="error"){try{this.#a.onError?.(r.error,a,l,s)}catch(c){Promise.reject(c)}try{this.#a.onSettled?.(void 0,r.error,a,l,s)}catch(c){Promise.reject(c)}}}this.listeners.forEach(a=>{a(this.#e)})})}};function A0(t,r){const a=new Set(r);return t.filter(l=>!a.has(l))}function pM(t,r,a){const l=t.slice(0);return l[r]=a,l}var vM=class extends Xi{#t;#e;#n;#a;#r;#i;#o;#l;#h=[];constructor(t,r,a){super(),this.#t=t,this.#a=a,this.#n=[],this.#r=[],this.#e=[],this.setQueries(r)}onSubscribe(){this.listeners.size===1&&this.#r.forEach(t=>{t.subscribe(r=>{this.#u(t,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#r.forEach(t=>{t.destroy()})}setQueries(t,r){this.#n=t,this.#a=r,Dt.batch(()=>{const a=this.#r,l=this.#c(this.#n);l.forEach(b=>b.observer.setOptions(b.defaultedQueryOptions));const s=l.map(b=>b.observer),c=s.map(b=>b.getCurrentResult()),u=a.length!==s.length,d=s.some((b,y)=>b!==a[y]),m=u||d,v=m?!0:c.some((b,y)=>{const w=this.#e[y];return!w||!hs(b,w)});!m&&!v||(m&&(this.#h=l,this.#r=s),this.#e=c,this.hasListeners()&&(m&&(A0(a,s).forEach(b=>{b.destroy()}),A0(s,a).forEach(b=>{b.subscribe(y=>{this.#u(b,y)})})),this.#s()))})}getCurrentResult(){return this.#e}getQueries(){return this.#r.map(t=>t.getCurrentQuery())}getObservers(){return this.#r}getOptimisticResult(t,r){const a=this.#c(t),l=a.map(s=>s.observer.getOptimisticResult(s.defaultedQueryOptions));return[l,s=>this.#f(s??l,r),()=>this.#d(l,a)]}#d(t,r){return r.map((a,l)=>{const s=t[l];return a.defaultedQueryOptions.notifyOnChangeProps?s:a.observer.trackResult(s,c=>{r.forEach(u=>{u.observer.trackProp(c)})})})}#f(t,r){return r?((!this.#i||this.#e!==this.#l||r!==this.#o)&&(this.#o=r,this.#l=this.#e,this.#i=fp(this.#i,r(t))),this.#i):t}#c(t){const r=new Map;this.#r.forEach(l=>{const s=l.options.queryHash;if(!s)return;const c=r.get(s);c?c.push(l):r.set(s,[l])});const a=[];return t.forEach(l=>{const s=this.#t.defaultQueryOptions(l),u=r.get(s.queryHash)?.shift()??new Rs(this.#t,s);a.push({defaultedQueryOptions:s,observer:u})}),a}#u(t,r){const a=this.#r.indexOf(t);a!==-1&&(this.#e=pM(this.#e,a,r),this.#s())}#s(){if(this.hasListeners()){const t=this.#i,r=this.#d(this.#e,this.#h),a=this.#f(r,this.#a?.combine);t!==a&&Dt.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}},gM=class extends Xi{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,r,a){const l=r.queryKey,s=r.queryHash??dp(l,r);let c=this.get(s);return c||(c=new oM({client:t,queryKey:l,queryHash:s,options:t.defaultQueryOptions(r),state:a,defaultOptions:t.getQueryDefaults(l)}),this.add(c)),c}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=this.#t.get(t.queryHash);r&&(t.destroy(),r===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Dt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const r={exact:!0,...t};return this.getAll().find(a=>E0(r,a))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(a=>E0(t,a)):r}notify(t){Dt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Dt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Dt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},yM=class{#t;#e;#n;#a;#r;#i;#o;#l;constructor(t={}){this.#t=t.queryCache||new gM,this.#e=t.mutationCache||new hM,this.#n=t.defaultOptions||{},this.#a=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=mp.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#l=Ru.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#l?.(),this.#l=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const r=this.defaultQueryOptions({queryKey:t});return this.#t.get(r.queryHash)?.state.data}ensureQueryData(t){const r=this.defaultQueryOptions(t),a=this.#t.build(this,r),l=a.state.data;return l===void 0?this.fetchQuery(t):(t.revalidateIfStale&&a.isStaleByTime(ti(r.staleTime,a))&&this.prefetchQuery(r),Promise.resolve(l))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:r,state:a})=>{const l=a.data;return[r,l]})}setQueryData(t,r,a){const l=this.defaultQueryOptions({queryKey:t}),c=this.#t.get(l.queryHash)?.state.data,u=$R(r,c);if(u!==void 0)return this.#t.build(this,l).setData(u,{...a,manual:!0})}setQueriesData(t,r,a){return Dt.batch(()=>this.#t.findAll(t).map(({queryKey:l})=>[l,this.setQueryData(l,r,a)]))}getQueryState(t){const r=this.defaultQueryOptions({queryKey:t});return this.#t.get(r.queryHash)?.state}removeQueries(t){const r=this.#t;Dt.batch(()=>{r.findAll(t).forEach(a=>{r.remove(a)})})}resetQueries(t,r){const a=this.#t;return Dt.batch(()=>(a.findAll(t).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...t},r)))}cancelQueries(t,r={}){const a={revert:!0,...r},l=Dt.batch(()=>this.#t.findAll(t).map(s=>s.cancel(a)));return Promise.all(l).then(fn).catch(fn)}invalidateQueries(t,r={}){return Dt.batch(()=>(this.#t.findAll(t).forEach(a=>{a.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},r)))}refetchQueries(t,r={}){const a={...r,cancelRefetch:r.cancelRefetch??!0},l=Dt.batch(()=>this.#t.findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let c=s.fetch(void 0,a);return a.throwOnError||(c=c.catch(fn)),s.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(l).then(fn)}fetchQuery(t){const r=this.defaultQueryOptions(t);r.retry===void 0&&(r.retry=!1);const a=this.#t.build(this,r);return a.isStaleByTime(ti(r.staleTime,a))?a.fetch(r):Promise.resolve(a.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(fn).catch(fn)}fetchInfiniteQuery(t){return t.behavior=Mu(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(fn).catch(fn)}ensureInfiniteQueryData(t){return t.behavior=Mu(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Ru.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(t){this.#n=t}setQueryDefaults(t,r){this.#a.set(ri(t),{queryKey:t,defaultOptions:r})}getQueryDefaults(t){const r=[...this.#a.values()],a={};return r.forEach(l=>{fs(t,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(t,r){this.#r.set(ri(t),{mutationKey:t,defaultOptions:r})}getMutationDefaults(t){const r=[...this.#r.values()],a={};return r.forEach(l=>{fs(t,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(t){if(t._defaulted)return t;const r={...this.#n.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return r.queryHash||(r.queryHash=dp(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===Gn&&(r.enabled=!1),r}defaultMutationOptions(t){return t?._defaulted?t:{...this.#n.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},bS=g.createContext(void 0),Ms=t=>{const r=g.useContext(bS);if(t)return t;if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},bM=({client:t,children:r})=>(g.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),h.jsx(bS.Provider,{value:t,children:r})),xS=g.createContext(!1),SS=()=>g.useContext(xS);xS.Provider;function xM(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var SM=g.createContext(xM()),wS=()=>g.useContext(SM),CS=(t,r,a)=>{const l=a?.state.error&&typeof t.throwOnError=="function"?hp(t.throwOnError,[a.state.error,a]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||l)&&(r.isReset()||(t.retryOnMount=!1))},NS=t=>{g.useEffect(()=>{t.clearReset()},[t])},ES=({result:t,errorResetBoundary:r,throwOnError:a,query:l,suspense:s})=>t.isError&&!r.isReset()&&!t.isFetching&&l&&(s&&t.data===void 0||hp(a,[t.error,l])),vp=(t,r)=>r.state.data===void 0,jS=t=>{if(t.suspense){const a=s=>s==="static"?s:Math.max(s??1e3,1e3),l=t.staleTime;t.staleTime=typeof l=="function"?(...s)=>a(l(...s)):a(l),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},RS=(t,r)=>t.isLoading&&t.isFetching&&!r,Tm=(t,r)=>t?.suspense&&r.isPending,Ou=(t,r,a)=>r.fetchOptimistic(t).catch(()=>{a.clearReset()});function MS({queries:t,...r},a){const l=Ms(a),s=SS(),c=wS(),u=g.useMemo(()=>t.map(S=>{const R=l.defaultQueryOptions(S);return R._optimisticResults=s?"isRestoring":"optimistic",R}),[t,l,s]);u.forEach(S=>{jS(S);const R=l.getQueryCache().get(S.queryHash);CS(S,c,R)}),NS(c);const[d]=g.useState(()=>new vM(l,u,r)),[m,v,b]=d.getOptimisticResult(u,r.combine),y=!s&&r.subscribed!==!1;g.useSyncExternalStore(g.useCallback(S=>y?d.subscribe(Dt.batchCalls(S)):fn,[d,y]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),g.useEffect(()=>{d.setQueries(u,r)},[u,r,d]);const C=m.some((S,R)=>Tm(u[R],S))?m.flatMap((S,R)=>{const M=u[R];if(M){const O=new Rs(l,M);if(Tm(M,S))return Ou(M,O,c);RS(S,s)&&Ou(M,O,c)}return[]}):[];if(C.length>0)throw Promise.all(C);const E=m.find((S,R)=>{const M=u[R];return M&&ES({result:S,errorResetBoundary:c,throwOnError:M.throwOnError,query:l.getQueryCache().get(M.queryHash),suspense:M.suspense})});if(E?.error)throw E.error;return v(b())}function Xu(t,r,a){const l=SS(),s=wS(),c=Ms(a),u=c.defaultQueryOptions(t);c.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=c.getQueryCache().get(u.queryHash);u._optimisticResults=l?"isRestoring":"optimistic",jS(u),CS(u,s,d),NS(s);const m=!c.getQueryCache().get(u.queryHash),[v]=g.useState(()=>new r(c,u)),b=v.getOptimisticResult(u),y=!l&&t.subscribed!==!1;if(g.useSyncExternalStore(g.useCallback(w=>{const C=y?v.subscribe(Dt.batchCalls(w)):fn;return v.updateResult(),C},[v,y]),()=>v.getCurrentResult(),()=>v.getCurrentResult()),g.useEffect(()=>{v.setOptions(u)},[u,v]),Tm(u,b))throw Ou(u,v,s);if(ES({result:b,errorResetBoundary:s,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw b.error;return c.getDefaultOptions().queries?._experimental_afterQuery?.(u,b),u.experimental_prefetchInRender&&!qi&&RS(b,l)&&(m?Ou(u,v,s):d?.promise)?.catch(fn).finally(()=>{v.updateResult()}),u.notifyOnChangeProps?b:v.trackResult(b)}function wM(t,r){return Xu(t,Rs,r)}function CM(t,r){return Xu({...t,enabled:!0,suspense:!0,throwOnError:vp,placeholderData:void 0},Rs,r)}function NM(t,r){return Xu({...t,enabled:!0,suspense:!0,throwOnError:vp},gS,r)}function EM(t,r){return MS({...t,queries:t.queries.map(a=>({...a,suspense:!0,throwOnError:vp,enabled:!0,placeholderData:void 0}))},r)}function jM(t,r){const a=Ms(r);a.getQueryState(t.queryKey)||a.prefetchQuery(t)}function RM(t,r){const a=Ms(r);a.getQueryState(t.queryKey)||a.prefetchInfiniteQuery(t)}function MM(t,r){const a=Ms(r),[l]=g.useState(()=>new mM(a,t));g.useEffect(()=>{l.setOptions(t)},[l,t]);const s=g.useSyncExternalStore(g.useCallback(u=>l.subscribe(Dt.batchCalls(u)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),c=g.useCallback((u,d)=>{l.mutate(u,d).catch(fn)},[l]);if(s.error&&hp(l.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:c,mutateAsync:s.mutate}}function OM(t,r){return Xu(t,gS,r)}const DM=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),TM=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,a,l)=>l?l.toUpperCase():a.toLowerCase()),z0=t=>{const r=TM(t);return r.charAt(0).toUpperCase()+r.slice(1)},OS=(...t)=>t.filter((r,a,l)=>!!r&&r.trim()!==""&&l.indexOf(r)===a).join(" ").trim(),_M=t=>{for(const r in t)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};var AM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const zM=g.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:s="",children:c,iconNode:u,...d},m)=>g.createElement("svg",{ref:m,...AM,width:r,height:r,stroke:t,strokeWidth:l?Number(a)*24/Number(r):a,className:OS("lucide",s),...!c&&!_M(d)&&{"aria-hidden":"true"},...d},[...u.map(([v,b])=>g.createElement(v,b)),...Array.isArray(c)?c:[c]]));const Pe=(t,r)=>{const a=g.forwardRef(({className:l,...s},c)=>g.createElement(zM,{ref:c,iconNode:r,className:OS(`lucide-${DM(z0(t))}`,`lucide-${t}`,l),...s}));return a.displayName=z0(t),a};const LM=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],kM=Pe("arrow-left",LM);const PM=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],ma=Pe("building-2",PM);const UM=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]],ms=Pe("calendar-check",UM);const BM=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],HM=Pe("calendar-plus",BM);const qM=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Os=Pe("calendar",qM);const IM=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],DS=Pe("check",IM);const QM=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$u=Pe("chevron-down",QM);const VM=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],TS=Pe("chevron-right",VM);const FM=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],GM=Pe("chevron-up",FM);const YM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ps=Pe("circle-check",YM);const KM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],XM=Pe("circle-x",KM);const $M=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],gp=Pe("circle",$M);const ZM=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],Ui=Pe("clipboard-list",ZM);const JM=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],WM=Pe("clock",JM);const eO=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],tO=Pe("database",eO);const nO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],rO=Pe("ellipsis",nO);const aO=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],_S=Pe("external-link",aO);const iO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],lO=Pe("eye",iO);const oO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],sO=Pe("file-check",oO);const cO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],uO=Pe("file-text",cO);const dO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],yp=Pe("globe",dO);const fO=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],hO=Pe("grip-vertical",fO);const mO=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],ni=Pe("handshake",mO);const pO=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],vO=Pe("layout-grid",pO);const gO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Yn=Pe("loader-circle",gO);const yO=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],bp=Pe("mail",yO);const bO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],xO=Pe("message-square",bO);const SO=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],wO=Pe("moon",SO);const CO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],NO=Pe("panel-left-close",CO);const EO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],jO=Pe("panel-left",EO);const RO=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],MO=Pe("pencil",RO);const OO=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],pa=Pe("phone",OO);const DO=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$i=Pe("plus",DO);const TO=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],Zu=Pe("presentation",TO);const _O=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],AO=Pe("search",_O);const zO=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],LO=Pe("sparkles",zO);const kO=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]],PO=Pe("sticky-note",kO);const UO=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],BO=Pe("sun",UO);const HO=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],qO=Pe("table",HO);const IO=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],AS=Pe("trash-2",IO);const QO=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],zn=Pe("users",QO);const VO=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xp=Pe("x",VO);function L0(t,r){if(typeof t=="function")return t(r);t!=null&&(t.current=r)}function Ds(...t){return r=>{let a=!1;const l=t.map(s=>{const c=L0(s,r);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let s=0;s{let{children:c,...u}=l;zS(c)&&typeof Du=="function"&&(c=Du(c._payload));const d=g.Children.toArray(c),m=d.find($O);if(m){const v=m.props.children,b=d.map(y=>y===m?g.Children.count(v)>1?g.Children.only(null):g.isValidElement(v)?v.props.children:null:y);return h.jsx(r,{...u,ref:s,children:g.isValidElement(v)?g.cloneElement(v,void 0,b):null})}return h.jsx(r,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}var YO=LS("Slot");function KO(t){const r=g.forwardRef((a,l)=>{let{children:s,...c}=a;if(zS(s)&&typeof Du=="function"&&(s=Du(s._payload)),g.isValidElement(s)){const u=JO(s),d=ZO(c,s.props);return s.type!==g.Fragment&&(d.ref=l?Ds(l,u):u),g.cloneElement(s,d)}return g.Children.count(s)>1?g.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var XO=Symbol("radix.slottable");function $O(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===XO}function ZO(t,r){const a={...r};for(const l in r){const s=t[l],c=r[l];/^on[A-Z]/.test(l)?s&&c?a[l]=(...d)=>{const m=c(...d);return s(...d),m}:s&&(a[l]=s):l==="style"?a[l]={...s,...c}:l==="className"&&(a[l]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function JO(t){let r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?t.ref:(r=Object.getOwnPropertyDescriptor(t,"ref")?.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}function kS(t){var r,a,l="";if(typeof t=="string"||typeof t=="number")l+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(r=0;rtypeof t=="boolean"?`${t}`:t===0?"0":t,P0=PS,Ts=(t,r)=>a=>{var l;if(r?.variants==null)return P0(t,a?.class,a?.className);const{variants:s,defaultVariants:c}=r,u=Object.keys(s).map(v=>{const b=a?.[v],y=c?.[v];if(b===null)return null;const w=k0(b)||k0(y);return s[v][w]}),d=a&&Object.entries(a).reduce((v,b)=>{let[y,w]=b;return w===void 0||(v[y]=w),v},{}),m=r==null||(l=r.compoundVariants)===null||l===void 0?void 0:l.reduce((v,b)=>{let{class:y,className:w,...C}=b;return Object.entries(C).every(E=>{let[S,R]=E;return Array.isArray(R)?R.includes({...c,...d}[S]):{...c,...d}[S]===R})?[...v,y,w]:v},[]);return P0(t,u,m,a?.class,a?.className)},WO=(t,r)=>{const a=new Array(t.length+r.length);for(let l=0;l({classGroupId:t,validator:r}),US=(t=new Map,r=null,a)=>({nextPart:t,validators:r,classGroupId:a}),Tu="-",U0=[],tD="arbitrary..",nD=t=>{const r=aD(t),{conflictingClassGroups:a,conflictingClassGroupModifiers:l}=t;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return rD(u);const d=u.split(Tu),m=d[0]===""&&d.length>1?1:0;return BS(d,m,r)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=l[u],v=a[u];return m?v?WO(v,m):m:v||U0}return a[u]||U0}}},BS=(t,r,a)=>{if(t.length-r===0)return a.classGroupId;const s=t[r],c=a.nextPart.get(s);if(c){const v=BS(t,r+1,c);if(v)return v}const u=a.validators;if(u===null)return;const d=r===0?t.join(Tu):t.slice(r).join(Tu),m=u.length;for(let v=0;vt.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=t.slice(1,-1),a=r.indexOf(":"),l=r.slice(0,a);return l?tD+l:void 0})(),aD=t=>{const{theme:r,classGroups:a}=t;return iD(a,r)},iD=(t,r)=>{const a=US();for(const l in t){const s=t[l];Sp(s,a,l,r)}return a},Sp=(t,r,a,l)=>{const s=t.length;for(let c=0;c{if(typeof t=="string"){oD(t,r,a);return}if(typeof t=="function"){sD(t,r,a,l);return}cD(t,r,a,l)},oD=(t,r,a)=>{const l=t===""?r:HS(r,t);l.classGroupId=a},sD=(t,r,a,l)=>{if(uD(t)){Sp(t(l),r,a,l);return}r.validators===null&&(r.validators=[]),r.validators.push(eD(a,t))},cD=(t,r,a,l)=>{const s=Object.entries(t),c=s.length;for(let u=0;u{let a=t;const l=r.split(Tu),s=l.length;for(let c=0;c"isThemeGetter"in t&&t.isThemeGetter===!0,dD=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,a=Object.create(null),l=Object.create(null);const s=(c,u)=>{a[c]=u,r++,r>t&&(r=0,l=a,a=Object.create(null))};return{get(c){let u=a[c];if(u!==void 0)return u;if((u=l[c])!==void 0)return s(c,u),u},set(c,u){c in a?a[c]=u:s(c,u)}}},_m="!",B0=":",fD=[],H0=(t,r,a,l,s)=>({modifiers:t,hasImportantModifier:r,baseClassName:a,maybePostfixModifierPosition:l,isExternal:s}),hD=t=>{const{prefix:r,experimentalParseClassName:a}=t;let l=s=>{const c=[];let u=0,d=0,m=0,v;const b=s.length;for(let S=0;Sm?v-m:void 0;return H0(c,C,w,E)};if(r){const s=r+B0,c=l;l=u=>u.startsWith(s)?c(u.slice(s.length)):H0(fD,!1,u,void 0,!0)}if(a){const s=l;l=c=>a({className:c,parseClassName:s})}return l},mD=t=>{const r=new Map;return t.orderSensitiveModifiers.forEach((a,l)=>{r.set(a,1e6+l)}),a=>{const l=[];let s=[];for(let c=0;c0&&(s.sort(),l.push(...s),s=[]),l.push(u)):s.push(u)}return s.length>0&&(s.sort(),l.push(...s)),l}},pD=t=>({cache:dD(t.cacheSize),parseClassName:hD(t),sortModifiers:mD(t),...nD(t)}),vD=/\s+/,gD=(t,r)=>{const{parseClassName:a,getClassGroupId:l,getConflictingClassGroupIds:s,sortModifiers:c}=r,u=[],d=t.trim().split(vD);let m="";for(let v=d.length-1;v>=0;v-=1){const b=d[v],{isExternal:y,modifiers:w,hasImportantModifier:C,baseClassName:E,maybePostfixModifierPosition:S}=a(b);if(y){m=b+(m.length>0?" "+m:m);continue}let R=!!S,M=l(R?E.substring(0,S):E);if(!M){if(!R){m=b+(m.length>0?" "+m:m);continue}if(M=l(E),!M){m=b+(m.length>0?" "+m:m);continue}R=!1}const O=w.length===0?"":w.length===1?w[0]:c(w).join(":"),_=C?O+_m:O,z=_+M;if(u.indexOf(z)>-1)continue;u.push(z);const k=s(M,R);for(let I=0;I0?" "+m:m)}return m},yD=(...t)=>{let r=0,a,l,s="";for(;r{if(typeof t=="string")return t;let r,a="";for(let l=0;l{let a,l,s,c;const u=m=>{const v=r.reduce((b,y)=>y(b),t());return a=pD(v),l=a.cache.get,s=a.cache.set,c=d,d(m)},d=m=>{const v=l(m);if(v)return v;const b=gD(m,a);return s(m,b),b};return c=u,(...m)=>c(yD(...m))},xD=[],Kt=t=>{const r=a=>a[t]||xD;return r.isThemeGetter=!0,r},IS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,QS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SD=/^\d+\/\d+$/,wD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ND=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ED=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pl=t=>SD.test(t),He=t=>!!t&&!Number.isNaN(Number(t)),$a=t=>!!t&&Number.isInteger(Number(t)),em=t=>t.endsWith("%")&&He(t.slice(0,-1)),da=t=>wD.test(t),RD=()=>!0,MD=t=>CD.test(t)&&!ND.test(t),VS=()=>!1,OD=t=>ED.test(t),DD=t=>jD.test(t),TD=t=>!Ne(t)&&!Ee(t),_D=t=>Jl(t,YS,VS),Ne=t=>IS.test(t),_i=t=>Jl(t,KS,MD),tm=t=>Jl(t,PD,He),q0=t=>Jl(t,FS,VS),AD=t=>Jl(t,GS,DD),au=t=>Jl(t,XS,OD),Ee=t=>QS.test(t),ts=t=>Wl(t,KS),zD=t=>Wl(t,UD),I0=t=>Wl(t,FS),LD=t=>Wl(t,YS),kD=t=>Wl(t,GS),iu=t=>Wl(t,XS,!0),Jl=(t,r,a)=>{const l=IS.exec(t);return l?l[1]?r(l[1]):a(l[2]):!1},Wl=(t,r,a=!1)=>{const l=QS.exec(t);return l?l[1]?r(l[1]):a:!1},FS=t=>t==="position"||t==="percentage",GS=t=>t==="image"||t==="url",YS=t=>t==="length"||t==="size"||t==="bg-size",KS=t=>t==="length",PD=t=>t==="number",UD=t=>t==="family-name",XS=t=>t==="shadow",BD=()=>{const t=Kt("color"),r=Kt("font"),a=Kt("text"),l=Kt("font-weight"),s=Kt("tracking"),c=Kt("leading"),u=Kt("breakpoint"),d=Kt("container"),m=Kt("spacing"),v=Kt("radius"),b=Kt("shadow"),y=Kt("inset-shadow"),w=Kt("text-shadow"),C=Kt("drop-shadow"),E=Kt("blur"),S=Kt("perspective"),R=Kt("aspect"),M=Kt("ease"),O=Kt("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...z(),Ee,Ne],I=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],T=()=>[Ee,Ne,m],A=()=>[Pl,"full","auto",...T()],q=()=>[$a,"none","subgrid",Ee,Ne],K=()=>["auto",{span:["full",$a,Ee,Ne]},$a,Ee,Ne],W=()=>[$a,"auto",Ee,Ne],ue=()=>["auto","min","max","fr",Ee,Ne],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...T()],G=()=>[Pl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],B=()=>[t,Ee,Ne],ee=()=>[...z(),I0,q0,{position:[Ee,Ne]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",LD,_D,{size:[Ee,Ne]}],Q=()=>[em,ts,_i],J=()=>["","none","full",v,Ee,Ne],ne=()=>["",He,ts,_i],fe=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[He,em,I0,q0],De=()=>["","none",E,Ee,Ne],Ae=()=>["none",He,Ee,Ne],Te=()=>["none",He,Ee,Ne],Ue=()=>[He,Ee,Ne],he=()=>[Pl,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[da],breakpoint:[da],color:[RD],container:[da],"drop-shadow":[da],ease:["in","out","in-out"],font:[TD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[da],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[da],shadow:[da],spacing:["px",He],text:[da],"text-shadow":[da],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Pl,Ne,Ee,R]}],container:["container"],columns:[{columns:[He,Ne,Ee,d]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[$a,"auto",Ee,Ne]}],basis:[{basis:[Pl,"full","auto",d,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[He,Pl,"auto","initial","none",Ne]}],grow:[{grow:["",He,Ee,Ne]}],shrink:[{shrink:["",He,Ee,Ne]}],order:[{order:[$a,"first","last","none",Ee,Ne]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],w:[{w:[d,"screen",...G()]}],"min-w":[{"min-w":[d,"screen","none",...G()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",a,ts,_i]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,Ee,tm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",em,Ne]}],"font-family":[{font:[zD,Ne,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ee,Ne]}],"line-clamp":[{"line-clamp":[He,"none",Ee,tm]}],leading:[{leading:[c,...T()]}],"list-image":[{"list-image":["none",Ee,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[He,"from-font","auto",Ee,_i]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[He,"auto",Ee,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$a,Ee,Ne],radial:["",Ee,Ne],conic:[$a,Ee,Ne]},kD,AD]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[He,Ee,Ne]}],"outline-w":[{outline:["",He,ts,_i]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",b,iu,au]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",y,iu,au]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[He,_i]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",w,iu,au]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[He,Ee,Ne]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[He]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[Ee,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[He]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ee,Ne]}],filter:[{filter:["","none",Ee,Ne]}],blur:[{blur:De()}],brightness:[{brightness:[He,Ee,Ne]}],contrast:[{contrast:[He,Ee,Ne]}],"drop-shadow":[{"drop-shadow":["","none",C,iu,au]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",He,Ee,Ne]}],"hue-rotate":[{"hue-rotate":[He,Ee,Ne]}],invert:[{invert:["",He,Ee,Ne]}],saturate:[{saturate:[He,Ee,Ne]}],sepia:[{sepia:["",He,Ee,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,Ne]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[He,Ee,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[He,Ee,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",He,Ee,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[He,Ee,Ne]}],"backdrop-invert":[{"backdrop-invert":["",He,Ee,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[He,Ee,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[He,Ee,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",He,Ee,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[He,"initial",Ee,Ne]}],ease:[{ease:["linear","initial",M,Ee,Ne]}],delay:[{delay:[He,Ee,Ne]}],animate:[{animate:["none",O,Ee,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ee,Ne]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:Ae()}],"rotate-x":[{"rotate-x":Ae()}],"rotate-y":[{"rotate-y":Ae()}],"rotate-z":[{"rotate-z":Ae()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ue()}],"skew-x":[{"skew-x":Ue()}],"skew-y":[{"skew-y":Ue()}],transform:[{transform:[Ee,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ee,Ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ee,Ne]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[He,ts,_i,tm]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},HD=bD(BD);function ye(...t){return HD(PS(t))}const qD=Ts("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ge=g.forwardRef(({className:t,variant:r,size:a,asChild:l=!1,...s},c)=>{const u=l?YO:"button";return h.jsx(u,{className:ye(qD({variant:r,size:a,className:t})),ref:c,...s})});Ge.displayName="Button";function Re(t,r,{checkForDefaultPrevented:a=!0}={}){return function(s){if(t?.(s),a===!1||!s.defaultPrevented)return r?.(s)}}function ID(t,r){const a=g.createContext(r),l=c=>{const{children:u,...d}=c,m=g.useMemo(()=>d,Object.values(d));return h.jsx(a.Provider,{value:m,children:u})};l.displayName=t+"Provider";function s(c){const u=g.useContext(a);if(u)return u;if(r!==void 0)return r;throw new Error(`\`${c}\` must be used within \`${t}\``)}return[l,s]}function si(t,r=[]){let a=[];function l(c,u){const d=g.createContext(u),m=a.length;a=[...a,u];const v=y=>{const{scope:w,children:C,...E}=y,S=w?.[t]?.[m]||d,R=g.useMemo(()=>E,Object.values(E));return h.jsx(S.Provider,{value:R,children:C})};v.displayName=c+"Provider";function b(y,w){const C=w?.[t]?.[m]||d,E=g.useContext(C);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${y}\` must be used within \`${c}\``)}return[v,b]}const s=()=>{const c=a.map(u=>g.createContext(u));return function(d){const m=d?.[t]||c;return g.useMemo(()=>({[`__scope${t}`]:{...d,[t]:m}}),[d,m])}};return s.scopeName=t,[l,QD(s,...r)]}function QD(...t){const r=t[0];if(t.length===1)return r;const a=()=>{const l=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(c){const u=l.reduce((d,{useScope:m,scopeName:v})=>{const y=m(c)[`__scope${v}`];return{...d,...y}},{});return g.useMemo(()=>({[`__scope${r.scopeName}`]:u}),[u])}};return a.scopeName=r.scopeName,a}var hn=globalThis?.document?g.useLayoutEffect:()=>{},VD=Cs[" useInsertionEffect ".trim().toString()]||hn;function Gl({prop:t,defaultProp:r,onChange:a=()=>{},caller:l}){const[s,c,u]=FD({defaultProp:r,onChange:a}),d=t!==void 0,m=d?t:s;{const b=g.useRef(t!==void 0);g.useEffect(()=>{const y=b.current;y!==d&&console.warn(`${l} is changing from ${y?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=d},[d,l])}const v=g.useCallback(b=>{if(d){const y=GD(b)?b(t):b;y!==t&&u.current?.(y)}else c(b)},[d,t,c,u]);return[m,v]}function FD({defaultProp:t,onChange:r}){const[a,l]=g.useState(t),s=g.useRef(a),c=g.useRef(r);return VD(()=>{c.current=r},[r]),g.useEffect(()=>{s.current!==a&&(c.current?.(a),s.current=a)},[a,s]),[a,l,c]}function GD(t){return typeof t=="function"}function Yl(t){const r=YD(t),a=g.forwardRef((l,s)=>{const{children:c,...u}=l,d=g.Children.toArray(c),m=d.find(XD);if(m){const v=m.props.children,b=d.map(y=>y===m?g.Children.count(v)>1?g.Children.only(null):g.isValidElement(v)?v.props.children:null:y);return h.jsx(r,{...u,ref:s,children:g.isValidElement(v)?g.cloneElement(v,void 0,b):null})}return h.jsx(r,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}function YD(t){const r=g.forwardRef((a,l)=>{const{children:s,...c}=a;if(g.isValidElement(s)){const u=ZD(s),d=$D(c,s.props);return s.type!==g.Fragment&&(d.ref=l?Ds(l,u):u),g.cloneElement(s,d)}return g.Children.count(s)>1?g.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var KD=Symbol("radix.slottable");function XD(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===KD}function $D(t,r){const a={...r};for(const l in r){const s=t[l],c=r[l];/^on[A-Z]/.test(l)?s&&c?a[l]=(...d)=>{const m=c(...d);return s(...d),m}:s&&(a[l]=s):l==="style"?a[l]={...s,...c}:l==="className"&&(a[l]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function ZD(t){let r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?t.ref:(r=Object.getOwnPropertyDescriptor(t,"ref")?.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}var JD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=JD.reduce((t,r)=>{const a=Yl(`Primitive.${r}`),l=g.forwardRef((s,c)=>{const{asChild:u,...d}=s,m=u?a:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(m,{...d,ref:c})});return l.displayName=`Primitive.${r}`,{...t,[r]:l}},{});function $S(t,r){t&&Sr.flushSync(()=>t.dispatchEvent(r))}function wp(t){const r=t+"CollectionProvider",[a,l]=si(r),[s,c]=a(r,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:R,children:M}=S,O=ot.useRef(null),_=ot.useRef(new Map).current;return h.jsx(s,{scope:R,itemMap:_,collectionRef:O,children:M})};u.displayName=r;const d=t+"CollectionSlot",m=Yl(d),v=ot.forwardRef((S,R)=>{const{scope:M,children:O}=S,_=c(d,M),z=mt(R,_.collectionRef);return h.jsx(m,{ref:z,children:O})});v.displayName=d;const b=t+"CollectionItemSlot",y="data-radix-collection-item",w=Yl(b),C=ot.forwardRef((S,R)=>{const{scope:M,children:O,..._}=S,z=ot.useRef(null),k=mt(R,z),I=c(b,M);return ot.useEffect(()=>(I.itemMap.set(z,{ref:z,..._}),()=>void I.itemMap.delete(z))),h.jsx(w,{[y]:"",ref:k,children:O})});C.displayName=b;function E(S){const R=c(t+"CollectionConsumer",S);return ot.useCallback(()=>{const O=R.collectionRef.current;if(!O)return[];const _=Array.from(O.querySelectorAll(`[${y}]`));return Array.from(R.itemMap.values()).sort((I,N)=>_.indexOf(I.ref.current)-_.indexOf(N.ref.current))},[R.collectionRef,R.itemMap])}return[{Provider:u,Slot:v,ItemSlot:C},E,l]}var WD=g.createContext(void 0);function Ju(t){const r=g.useContext(WD);return t||r||"ltr"}function qr(t){const r=g.useRef(t);return g.useEffect(()=>{r.current=t}),g.useMemo(()=>(...a)=>r.current?.(...a),[])}function eT(t,r=globalThis?.document){const a=qr(t);g.useEffect(()=>{const l=s=>{s.key==="Escape"&&a(s)};return r.addEventListener("keydown",l,{capture:!0}),()=>r.removeEventListener("keydown",l,{capture:!0})},[a,r])}var tT="DismissableLayer",Am="dismissableLayer.update",nT="dismissableLayer.pointerDownOutside",rT="dismissableLayer.focusOutside",Q0,ZS=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wu=g.forwardRef((t,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:l,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:u,onDismiss:d,...m}=t,v=g.useContext(ZS),[b,y]=g.useState(null),w=b?.ownerDocument??globalThis?.document,[,C]=g.useState({}),E=mt(r,N=>y(N)),S=Array.from(v.layers),[R]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),M=S.indexOf(R),O=b?S.indexOf(b):-1,_=v.layersWithOutsidePointerEventsDisabled.size>0,z=O>=M,k=lT(N=>{const T=N.target,A=[...v.branches].some(q=>q.contains(T));!z||A||(s?.(N),u?.(N),N.defaultPrevented||d?.())},w),I=oT(N=>{const T=N.target;[...v.branches].some(q=>q.contains(T))||(c?.(N),u?.(N),N.defaultPrevented||d?.())},w);return eT(N=>{O===v.layers.size-1&&(l?.(N),!N.defaultPrevented&&d&&(N.preventDefault(),d()))},w),g.useEffect(()=>{if(b)return a&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(Q0=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(b)),v.layers.add(b),V0(),()=>{a&&v.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=Q0)}},[b,w,a,v]),g.useEffect(()=>()=>{b&&(v.layers.delete(b),v.layersWithOutsidePointerEventsDisabled.delete(b),V0())},[b,v]),g.useEffect(()=>{const N=()=>C({});return document.addEventListener(Am,N),()=>document.removeEventListener(Am,N)},[]),h.jsx(Ie.div,{...m,ref:E,style:{pointerEvents:_?z?"auto":"none":void 0,...t.style},onFocusCapture:Re(t.onFocusCapture,I.onFocusCapture),onBlurCapture:Re(t.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Re(t.onPointerDownCapture,k.onPointerDownCapture)})});Wu.displayName=tT;var aT="DismissableLayerBranch",iT=g.forwardRef((t,r)=>{const a=g.useContext(ZS),l=g.useRef(null),s=mt(r,l);return g.useEffect(()=>{const c=l.current;if(c)return a.branches.add(c),()=>{a.branches.delete(c)}},[a.branches]),h.jsx(Ie.div,{...t,ref:s})});iT.displayName=aT;function lT(t,r=globalThis?.document){const a=qr(t),l=g.useRef(!1),s=g.useRef(()=>{});return g.useEffect(()=>{const c=d=>{if(d.target&&!l.current){let m=function(){JS(nT,a,v,{discrete:!0})};const v={originalEvent:d};d.pointerType==="touch"?(r.removeEventListener("click",s.current),s.current=m,r.addEventListener("click",s.current,{once:!0})):m()}else r.removeEventListener("click",s.current);l.current=!1},u=window.setTimeout(()=>{r.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),r.removeEventListener("pointerdown",c),r.removeEventListener("click",s.current)}},[r,a]),{onPointerDownCapture:()=>l.current=!0}}function oT(t,r=globalThis?.document){const a=qr(t),l=g.useRef(!1);return g.useEffect(()=>{const s=c=>{c.target&&!l.current&&JS(rT,a,{originalEvent:c},{discrete:!1})};return r.addEventListener("focusin",s),()=>r.removeEventListener("focusin",s)},[r,a]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function V0(){const t=new CustomEvent(Am);document.dispatchEvent(t)}function JS(t,r,a,{discrete:l}){const s=a.originalEvent.target,c=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:a});r&&s.addEventListener(t,r,{once:!0}),l?$S(s,c):s.dispatchEvent(c)}var nm=0;function Cp(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??F0()),document.body.insertAdjacentElement("beforeend",t[1]??F0()),nm++,()=>{nm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),nm--}},[])}function F0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var rm="focusScope.autoFocusOnMount",am="focusScope.autoFocusOnUnmount",G0={bubbles:!1,cancelable:!0},sT="FocusScope",ed=g.forwardRef((t,r)=>{const{loop:a=!1,trapped:l=!1,onMountAutoFocus:s,onUnmountAutoFocus:c,...u}=t,[d,m]=g.useState(null),v=qr(s),b=qr(c),y=g.useRef(null),w=mt(r,S=>m(S)),C=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(l){let S=function(_){if(C.paused||!d)return;const z=_.target;d.contains(z)?y.current=z:Ja(y.current,{select:!0})},R=function(_){if(C.paused||!d)return;const z=_.relatedTarget;z!==null&&(d.contains(z)||Ja(y.current,{select:!0}))},M=function(_){if(document.activeElement===document.body)for(const k of _)k.removedNodes.length>0&&Ja(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",R);const O=new MutationObserver(M);return d&&O.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",R),O.disconnect()}}},[l,d,C.paused]),g.useEffect(()=>{if(d){K0.add(C);const S=document.activeElement;if(!d.contains(S)){const M=new CustomEvent(rm,G0);d.addEventListener(rm,v),d.dispatchEvent(M),M.defaultPrevented||(cT(mT(WS(d)),{select:!0}),document.activeElement===S&&Ja(d))}return()=>{d.removeEventListener(rm,v),setTimeout(()=>{const M=new CustomEvent(am,G0);d.addEventListener(am,b),d.dispatchEvent(M),M.defaultPrevented||Ja(S??document.body,{select:!0}),d.removeEventListener(am,b),K0.remove(C)},0)}}},[d,v,b,C]);const E=g.useCallback(S=>{if(!a&&!l||C.paused)return;const R=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,M=document.activeElement;if(R&&M){const O=S.currentTarget,[_,z]=uT(O);_&&z?!S.shiftKey&&M===z?(S.preventDefault(),a&&Ja(_,{select:!0})):S.shiftKey&&M===_&&(S.preventDefault(),a&&Ja(z,{select:!0})):M===O&&S.preventDefault()}},[a,l,C.paused]);return h.jsx(Ie.div,{tabIndex:-1,...u,ref:w,onKeyDown:E})});ed.displayName=sT;function cT(t,{select:r=!1}={}){const a=document.activeElement;for(const l of t)if(Ja(l,{select:r}),document.activeElement!==a)return}function uT(t){const r=WS(t),a=Y0(r,t),l=Y0(r.reverse(),t);return[a,l]}function WS(t){const r=[],a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const s=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||s?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)r.push(a.currentNode);return r}function Y0(t,r){for(const a of t)if(!dT(a,{upTo:r}))return a}function dT(t,{upTo:r}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(r!==void 0&&t===r)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function fT(t){return t instanceof HTMLInputElement&&"select"in t}function Ja(t,{select:r=!1}={}){if(t&&t.focus){const a=document.activeElement;t.focus({preventScroll:!0}),t!==a&&fT(t)&&r&&t.select()}}var K0=hT();function hT(){let t=[];return{add(r){const a=t[0];r!==a&&a?.pause(),t=X0(t,r),t.unshift(r)},remove(r){t=X0(t,r),t[0]?.resume()}}}function X0(t,r){const a=[...t],l=a.indexOf(r);return l!==-1&&a.splice(l,1),a}function mT(t){return t.filter(r=>r.tagName!=="A")}var pT=Cs[" useId ".trim().toString()]||(()=>{}),vT=0;function Br(t){const[r,a]=g.useState(pT());return hn(()=>{a(l=>l??String(vT++))},[t]),r?`radix-${r}`:""}const gT=["top","right","bottom","left"],ai=Math.min,Fn=Math.max,_u=Math.round,lu=Math.floor,Hr=t=>({x:t,y:t}),yT={left:"right",right:"left",bottom:"top",top:"bottom"},bT={start:"end",end:"start"};function zm(t,r,a){return Fn(t,ai(r,a))}function va(t,r){return typeof t=="function"?t(r):t}function ga(t){return t.split("-")[0]}function eo(t){return t.split("-")[1]}function Np(t){return t==="x"?"y":"x"}function Ep(t){return t==="y"?"height":"width"}const xT=new Set(["top","bottom"]);function Ur(t){return xT.has(ga(t))?"y":"x"}function jp(t){return Np(Ur(t))}function ST(t,r,a){a===void 0&&(a=!1);const l=eo(t),s=jp(t),c=Ep(s);let u=s==="x"?l===(a?"end":"start")?"right":"left":l==="start"?"bottom":"top";return r.reference[c]>r.floating[c]&&(u=Au(u)),[u,Au(u)]}function wT(t){const r=Au(t);return[Lm(t),r,Lm(r)]}function Lm(t){return t.replace(/start|end/g,r=>bT[r])}const $0=["left","right"],Z0=["right","left"],CT=["top","bottom"],NT=["bottom","top"];function ET(t,r,a){switch(t){case"top":case"bottom":return a?r?Z0:$0:r?$0:Z0;case"left":case"right":return r?CT:NT;default:return[]}}function jT(t,r,a,l){const s=eo(t);let c=ET(ga(t),a==="start",l);return s&&(c=c.map(u=>u+"-"+s),r&&(c=c.concat(c.map(Lm)))),c}function Au(t){return t.replace(/left|right|bottom|top/g,r=>yT[r])}function RT(t){return{top:0,right:0,bottom:0,left:0,...t}}function ew(t){return typeof t!="number"?RT(t):{top:t,right:t,bottom:t,left:t}}function zu(t){const{x:r,y:a,width:l,height:s}=t;return{width:l,height:s,top:a,left:r,right:r+l,bottom:a+s,x:r,y:a}}function J0(t,r,a){let{reference:l,floating:s}=t;const c=Ur(r),u=jp(r),d=Ep(u),m=ga(r),v=c==="y",b=l.x+l.width/2-s.width/2,y=l.y+l.height/2-s.height/2,w=l[d]/2-s[d]/2;let C;switch(m){case"top":C={x:b,y:l.y-s.height};break;case"bottom":C={x:b,y:l.y+l.height};break;case"right":C={x:l.x+l.width,y};break;case"left":C={x:l.x-s.width,y};break;default:C={x:l.x,y:l.y}}switch(eo(r)){case"start":C[u]-=w*(a&&v?-1:1);break;case"end":C[u]+=w*(a&&v?-1:1);break}return C}const MT=async(t,r,a)=>{const{placement:l="bottom",strategy:s="absolute",middleware:c=[],platform:u}=a,d=c.filter(Boolean),m=await(u.isRTL==null?void 0:u.isRTL(r));let v=await u.getElementRects({reference:t,floating:r,strategy:s}),{x:b,y}=J0(v,l,m),w=l,C={},E=0;for(let S=0;S({name:"arrow",options:t,async fn(r){const{x:a,y:l,placement:s,rects:c,platform:u,elements:d,middlewareData:m}=r,{element:v,padding:b=0}=va(t,r)||{};if(v==null)return{};const y=ew(b),w={x:a,y:l},C=jp(s),E=Ep(C),S=await u.getDimensions(v),R=C==="y",M=R?"top":"left",O=R?"bottom":"right",_=R?"clientHeight":"clientWidth",z=c.reference[E]+c.reference[C]-w[C]-c.floating[E],k=w[C]-c.reference[C],I=await(u.getOffsetParent==null?void 0:u.getOffsetParent(v));let N=I?I[_]:0;(!N||!await(u.isElement==null?void 0:u.isElement(I)))&&(N=d.floating[_]||c.floating[E]);const T=z/2-k/2,A=N/2-S[E]/2-1,q=ai(y[M],A),K=ai(y[O],A),W=q,ue=N-S[E]-K,le=N/2-S[E]/2+T,de=zm(W,le,ue),L=!m.arrow&&eo(s)!=null&&le!==de&&c.reference[E]/2-(lele<=0)){var K,W;const le=(((K=c.flip)==null?void 0:K.index)||0)+1,de=N[le];if(de&&(!(y==="alignment"?O!==Ur(de):!1)||q.every(B=>Ur(B.placement)===O?B.overflows[0]>0:!0)))return{data:{index:le,overflows:q},reset:{placement:de}};let L=(W=q.filter(G=>G.overflows[0]<=0).sort((G,B)=>G.overflows[1]-B.overflows[1])[0])==null?void 0:W.placement;if(!L)switch(C){case"bestFit":{var ue;const G=(ue=q.filter(B=>{if(I){const ee=Ur(B.placement);return ee===O||ee==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(ee=>ee>0).reduce((ee,ie)=>ee+ie,0)]).sort((B,ee)=>B[1]-ee[1])[0])==null?void 0:ue[0];G&&(L=G);break}case"initialPlacement":L=d;break}if(s!==L)return{reset:{placement:L}}}return{}}}};function W0(t,r){return{top:t.top-r.height,right:t.right-r.width,bottom:t.bottom-r.height,left:t.left-r.width}}function ex(t){return gT.some(r=>t[r]>=0)}const TT=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(r){const{rects:a}=r,{strategy:l="referenceHidden",...s}=va(t,r);switch(l){case"referenceHidden":{const c=await vs(r,{...s,elementContext:"reference"}),u=W0(c,a.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:ex(u)}}}case"escaped":{const c=await vs(r,{...s,altBoundary:!0}),u=W0(c,a.floating);return{data:{escapedOffsets:u,escaped:ex(u)}}}default:return{}}}}},tw=new Set(["left","top"]);async function _T(t,r){const{placement:a,platform:l,elements:s}=t,c=await(l.isRTL==null?void 0:l.isRTL(s.floating)),u=ga(a),d=eo(a),m=Ur(a)==="y",v=tw.has(u)?-1:1,b=c&&m?-1:1,y=va(r,t);let{mainAxis:w,crossAxis:C,alignmentAxis:E}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return d&&typeof E=="number"&&(C=d==="end"?E*-1:E),m?{x:C*b,y:w*v}:{x:w*v,y:C*b}}const AT=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(r){var a,l;const{x:s,y:c,placement:u,middlewareData:d}=r,m=await _T(r,t);return u===((a=d.offset)==null?void 0:a.placement)&&(l=d.arrow)!=null&&l.alignmentOffset?{}:{x:s+m.x,y:c+m.y,data:{...m,placement:u}}}}},zT=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(r){const{x:a,y:l,placement:s}=r,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:R=>{let{x:M,y:O}=R;return{x:M,y:O}}},...m}=va(t,r),v={x:a,y:l},b=await vs(r,m),y=Ur(ga(s)),w=Np(y);let C=v[w],E=v[y];if(c){const R=w==="y"?"top":"left",M=w==="y"?"bottom":"right",O=C+b[R],_=C-b[M];C=zm(O,C,_)}if(u){const R=y==="y"?"top":"left",M=y==="y"?"bottom":"right",O=E+b[R],_=E-b[M];E=zm(O,E,_)}const S=d.fn({...r,[w]:C,[y]:E});return{...S,data:{x:S.x-a,y:S.y-l,enabled:{[w]:c,[y]:u}}}}}},LT=function(t){return t===void 0&&(t={}),{options:t,fn(r){const{x:a,y:l,placement:s,rects:c,middlewareData:u}=r,{offset:d=0,mainAxis:m=!0,crossAxis:v=!0}=va(t,r),b={x:a,y:l},y=Ur(s),w=Np(y);let C=b[w],E=b[y];const S=va(d,r),R=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(m){const _=w==="y"?"height":"width",z=c.reference[w]-c.floating[_]+R.mainAxis,k=c.reference[w]+c.reference[_]-R.mainAxis;Ck&&(C=k)}if(v){var M,O;const _=w==="y"?"width":"height",z=tw.has(ga(s)),k=c.reference[y]-c.floating[_]+(z&&((M=u.offset)==null?void 0:M[y])||0)+(z?0:R.crossAxis),I=c.reference[y]+c.reference[_]+(z?0:((O=u.offset)==null?void 0:O[y])||0)-(z?R.crossAxis:0);EI&&(E=I)}return{[w]:C,[y]:E}}}},kT=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(r){var a,l;const{placement:s,rects:c,platform:u,elements:d}=r,{apply:m=()=>{},...v}=va(t,r),b=await vs(r,v),y=ga(s),w=eo(s),C=Ur(s)==="y",{width:E,height:S}=c.floating;let R,M;y==="top"||y==="bottom"?(R=y,M=w===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(M=y,R=w==="end"?"top":"bottom");const O=S-b.top-b.bottom,_=E-b.left-b.right,z=ai(S-b[R],O),k=ai(E-b[M],_),I=!r.middlewareData.shift;let N=z,T=k;if((a=r.middlewareData.shift)!=null&&a.enabled.x&&(T=_),(l=r.middlewareData.shift)!=null&&l.enabled.y&&(N=O),I&&!w){const q=Fn(b.left,0),K=Fn(b.right,0),W=Fn(b.top,0),ue=Fn(b.bottom,0);C?T=E-2*(q!==0||K!==0?q+K:Fn(b.left,b.right)):N=S-2*(W!==0||ue!==0?W+ue:Fn(b.top,b.bottom))}await m({...r,availableWidth:T,availableHeight:N});const A=await u.getDimensions(d.floating);return E!==A.width||S!==A.height?{reset:{rects:!0}}:{}}}};function td(){return typeof window<"u"}function to(t){return nw(t)?(t.nodeName||"").toLowerCase():"#document"}function Kn(t){var r;return(t==null||(r=t.ownerDocument)==null?void 0:r.defaultView)||window}function Qr(t){var r;return(r=(nw(t)?t.ownerDocument:t.document)||window.document)==null?void 0:r.documentElement}function nw(t){return td()?t instanceof Node||t instanceof Kn(t).Node:!1}function wr(t){return td()?t instanceof Element||t instanceof Kn(t).Element:!1}function Ir(t){return td()?t instanceof HTMLElement||t instanceof Kn(t).HTMLElement:!1}function tx(t){return!td()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Kn(t).ShadowRoot}const PT=new Set(["inline","contents"]);function _s(t){const{overflow:r,overflowX:a,overflowY:l,display:s}=Cr(t);return/auto|scroll|overlay|hidden|clip/.test(r+l+a)&&!PT.has(s)}const UT=new Set(["table","td","th"]);function BT(t){return UT.has(to(t))}const HT=[":popover-open",":modal"];function nd(t){return HT.some(r=>{try{return t.matches(r)}catch{return!1}})}const qT=["transform","translate","scale","rotate","perspective"],IT=["transform","translate","scale","rotate","perspective","filter"],QT=["paint","layout","strict","content"];function Rp(t){const r=Mp(),a=wr(t)?Cr(t):t;return qT.some(l=>a[l]?a[l]!=="none":!1)||(a.containerType?a.containerType!=="normal":!1)||!r&&(a.backdropFilter?a.backdropFilter!=="none":!1)||!r&&(a.filter?a.filter!=="none":!1)||IT.some(l=>(a.willChange||"").includes(l))||QT.some(l=>(a.contain||"").includes(l))}function VT(t){let r=ii(t);for(;Ir(r)&&!Kl(r);){if(Rp(r))return r;if(nd(r))return null;r=ii(r)}return null}function Mp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const FT=new Set(["html","body","#document"]);function Kl(t){return FT.has(to(t))}function Cr(t){return Kn(t).getComputedStyle(t)}function rd(t){return wr(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ii(t){if(to(t)==="html")return t;const r=t.assignedSlot||t.parentNode||tx(t)&&t.host||Qr(t);return tx(r)?r.host:r}function rw(t){const r=ii(t);return Kl(r)?t.ownerDocument?t.ownerDocument.body:t.body:Ir(r)&&_s(r)?r:rw(r)}function gs(t,r,a){var l;r===void 0&&(r=[]),a===void 0&&(a=!0);const s=rw(t),c=s===((l=t.ownerDocument)==null?void 0:l.body),u=Kn(s);if(c){const d=km(u);return r.concat(u,u.visualViewport||[],_s(s)?s:[],d&&a?gs(d):[])}return r.concat(s,gs(s,[],a))}function km(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function aw(t){const r=Cr(t);let a=parseFloat(r.width)||0,l=parseFloat(r.height)||0;const s=Ir(t),c=s?t.offsetWidth:a,u=s?t.offsetHeight:l,d=_u(a)!==c||_u(l)!==u;return d&&(a=c,l=u),{width:a,height:l,$:d}}function Op(t){return wr(t)?t:t.contextElement}function Il(t){const r=Op(t);if(!Ir(r))return Hr(1);const a=r.getBoundingClientRect(),{width:l,height:s,$:c}=aw(r);let u=(c?_u(a.width):a.width)/l,d=(c?_u(a.height):a.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const GT=Hr(0);function iw(t){const r=Kn(t);return!Mp()||!r.visualViewport?GT:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function YT(t,r,a){return r===void 0&&(r=!1),!a||r&&a!==Kn(t)?!1:r}function Ii(t,r,a,l){r===void 0&&(r=!1),a===void 0&&(a=!1);const s=t.getBoundingClientRect(),c=Op(t);let u=Hr(1);r&&(l?wr(l)&&(u=Il(l)):u=Il(t));const d=YT(c,a,l)?iw(c):Hr(0);let m=(s.left+d.x)/u.x,v=(s.top+d.y)/u.y,b=s.width/u.x,y=s.height/u.y;if(c){const w=Kn(c),C=l&&wr(l)?Kn(l):l;let E=w,S=km(E);for(;S&&l&&C!==E;){const R=Il(S),M=S.getBoundingClientRect(),O=Cr(S),_=M.left+(S.clientLeft+parseFloat(O.paddingLeft))*R.x,z=M.top+(S.clientTop+parseFloat(O.paddingTop))*R.y;m*=R.x,v*=R.y,b*=R.x,y*=R.y,m+=_,v+=z,E=Kn(S),S=km(E)}}return zu({width:b,height:y,x:m,y:v})}function ad(t,r){const a=rd(t).scrollLeft;return r?r.left+a:Ii(Qr(t)).left+a}function lw(t,r){const a=t.getBoundingClientRect(),l=a.left+r.scrollLeft-ad(t,a),s=a.top+r.scrollTop;return{x:l,y:s}}function KT(t){let{elements:r,rect:a,offsetParent:l,strategy:s}=t;const c=s==="fixed",u=Qr(l),d=r?nd(r.floating):!1;if(l===u||d&&c)return a;let m={scrollLeft:0,scrollTop:0},v=Hr(1);const b=Hr(0),y=Ir(l);if((y||!y&&!c)&&((to(l)!=="body"||_s(u))&&(m=rd(l)),Ir(l))){const C=Ii(l);v=Il(l),b.x=C.x+l.clientLeft,b.y=C.y+l.clientTop}const w=u&&!y&&!c?lw(u,m):Hr(0);return{width:a.width*v.x,height:a.height*v.y,x:a.x*v.x-m.scrollLeft*v.x+b.x+w.x,y:a.y*v.y-m.scrollTop*v.y+b.y+w.y}}function XT(t){return Array.from(t.getClientRects())}function $T(t){const r=Qr(t),a=rd(t),l=t.ownerDocument.body,s=Fn(r.scrollWidth,r.clientWidth,l.scrollWidth,l.clientWidth),c=Fn(r.scrollHeight,r.clientHeight,l.scrollHeight,l.clientHeight);let u=-a.scrollLeft+ad(t);const d=-a.scrollTop;return Cr(l).direction==="rtl"&&(u+=Fn(r.clientWidth,l.clientWidth)-s),{width:s,height:c,x:u,y:d}}const nx=25;function ZT(t,r){const a=Kn(t),l=Qr(t),s=a.visualViewport;let c=l.clientWidth,u=l.clientHeight,d=0,m=0;if(s){c=s.width,u=s.height;const b=Mp();(!b||b&&r==="fixed")&&(d=s.offsetLeft,m=s.offsetTop)}const v=ad(l);if(v<=0){const b=l.ownerDocument,y=b.body,w=getComputedStyle(y),C=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,E=Math.abs(l.clientWidth-y.clientWidth-C);E<=nx&&(c-=E)}else v<=nx&&(c+=v);return{width:c,height:u,x:d,y:m}}const JT=new Set(["absolute","fixed"]);function WT(t,r){const a=Ii(t,!0,r==="fixed"),l=a.top+t.clientTop,s=a.left+t.clientLeft,c=Ir(t)?Il(t):Hr(1),u=t.clientWidth*c.x,d=t.clientHeight*c.y,m=s*c.x,v=l*c.y;return{width:u,height:d,x:m,y:v}}function rx(t,r,a){let l;if(r==="viewport")l=ZT(t,a);else if(r==="document")l=$T(Qr(t));else if(wr(r))l=WT(r,a);else{const s=iw(t);l={x:r.x-s.x,y:r.y-s.y,width:r.width,height:r.height}}return zu(l)}function ow(t,r){const a=ii(t);return a===r||!wr(a)||Kl(a)?!1:Cr(a).position==="fixed"||ow(a,r)}function e_(t,r){const a=r.get(t);if(a)return a;let l=gs(t,[],!1).filter(d=>wr(d)&&to(d)!=="body"),s=null;const c=Cr(t).position==="fixed";let u=c?ii(t):t;for(;wr(u)&&!Kl(u);){const d=Cr(u),m=Rp(u);!m&&d.position==="fixed"&&(s=null),(c?!m&&!s:!m&&d.position==="static"&&!!s&&JT.has(s.position)||_s(u)&&!m&&ow(t,u))?l=l.filter(b=>b!==u):s=d,u=ii(u)}return r.set(t,l),l}function t_(t){let{element:r,boundary:a,rootBoundary:l,strategy:s}=t;const u=[...a==="clippingAncestors"?nd(r)?[]:e_(r,this._c):[].concat(a),l],d=u[0],m=u.reduce((v,b)=>{const y=rx(r,b,s);return v.top=Fn(y.top,v.top),v.right=ai(y.right,v.right),v.bottom=ai(y.bottom,v.bottom),v.left=Fn(y.left,v.left),v},rx(r,d,s));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function n_(t){const{width:r,height:a}=aw(t);return{width:r,height:a}}function r_(t,r,a){const l=Ir(r),s=Qr(r),c=a==="fixed",u=Ii(t,!0,c,r);let d={scrollLeft:0,scrollTop:0};const m=Hr(0);function v(){m.x=ad(s)}if(l||!l&&!c)if((to(r)!=="body"||_s(s))&&(d=rd(r)),l){const C=Ii(r,!0,c,r);m.x=C.x+r.clientLeft,m.y=C.y+r.clientTop}else s&&v();c&&!l&&s&&v();const b=s&&!l&&!c?lw(s,d):Hr(0),y=u.left+d.scrollLeft-m.x-b.x,w=u.top+d.scrollTop-m.y-b.y;return{x:y,y:w,width:u.width,height:u.height}}function im(t){return Cr(t).position==="static"}function ax(t,r){if(!Ir(t)||Cr(t).position==="fixed")return null;if(r)return r(t);let a=t.offsetParent;return Qr(t)===a&&(a=a.ownerDocument.body),a}function sw(t,r){const a=Kn(t);if(nd(t))return a;if(!Ir(t)){let s=ii(t);for(;s&&!Kl(s);){if(wr(s)&&!im(s))return s;s=ii(s)}return a}let l=ax(t,r);for(;l&&BT(l)&&im(l);)l=ax(l,r);return l&&Kl(l)&&im(l)&&!Rp(l)?a:l||VT(t)||a}const a_=async function(t){const r=this.getOffsetParent||sw,a=this.getDimensions,l=await a(t.floating);return{reference:r_(t.reference,await r(t.floating),t.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function i_(t){return Cr(t).direction==="rtl"}const l_={convertOffsetParentRelativeRectToViewportRelativeRect:KT,getDocumentElement:Qr,getClippingRect:t_,getOffsetParent:sw,getElementRects:a_,getClientRects:XT,getDimensions:n_,getScale:Il,isElement:wr,isRTL:i_};function cw(t,r){return t.x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}function o_(t,r){let a=null,l;const s=Qr(t);function c(){var d;clearTimeout(l),(d=a)==null||d.disconnect(),a=null}function u(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),c();const v=t.getBoundingClientRect(),{left:b,top:y,width:w,height:C}=v;if(d||r(),!w||!C)return;const E=lu(y),S=lu(s.clientWidth-(b+w)),R=lu(s.clientHeight-(y+C)),M=lu(b),_={rootMargin:-E+"px "+-S+"px "+-R+"px "+-M+"px",threshold:Fn(0,ai(1,m))||1};let z=!0;function k(I){const N=I[0].intersectionRatio;if(N!==m){if(!z)return u();N?u(!1,N):l=setTimeout(()=>{u(!1,1e-7)},1e3)}N===1&&!cw(v,t.getBoundingClientRect())&&u(),z=!1}try{a=new IntersectionObserver(k,{..._,root:s.ownerDocument})}catch{a=new IntersectionObserver(k,_)}a.observe(t)}return u(!0),c}function s_(t,r,a,l){l===void 0&&(l={});const{ancestorScroll:s=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=l,v=Op(t),b=s||c?[...v?gs(v):[],...gs(r)]:[];b.forEach(M=>{s&&M.addEventListener("scroll",a,{passive:!0}),c&&M.addEventListener("resize",a)});const y=v&&d?o_(v,a):null;let w=-1,C=null;u&&(C=new ResizeObserver(M=>{let[O]=M;O&&O.target===v&&C&&(C.unobserve(r),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var _;(_=C)==null||_.observe(r)})),a()}),v&&!m&&C.observe(v),C.observe(r));let E,S=m?Ii(t):null;m&&R();function R(){const M=Ii(t);S&&!cw(S,M)&&a(),S=M,E=requestAnimationFrame(R)}return a(),()=>{var M;b.forEach(O=>{s&&O.removeEventListener("scroll",a),c&&O.removeEventListener("resize",a)}),y?.(),(M=C)==null||M.disconnect(),C=null,m&&cancelAnimationFrame(E)}}const c_=AT,u_=zT,d_=DT,f_=kT,h_=TT,ix=OT,m_=LT,p_=(t,r,a)=>{const l=new Map,s={platform:l_,...a},c={...s.platform,_c:l};return MT(t,r,{...s,platform:c})};var v_=typeof document<"u",g_=function(){},vu=v_?g.useLayoutEffect:g_;function Lu(t,r){if(t===r)return!0;if(typeof t!=typeof r)return!1;if(typeof t=="function"&&t.toString()===r.toString())return!0;let a,l,s;if(t&&r&&typeof t=="object"){if(Array.isArray(t)){if(a=t.length,a!==r.length)return!1;for(l=a;l--!==0;)if(!Lu(t[l],r[l]))return!1;return!0}if(s=Object.keys(t),a=s.length,a!==Object.keys(r).length)return!1;for(l=a;l--!==0;)if(!{}.hasOwnProperty.call(r,s[l]))return!1;for(l=a;l--!==0;){const c=s[l];if(!(c==="_owner"&&t.$$typeof)&&!Lu(t[c],r[c]))return!1}return!0}return t!==t&&r!==r}function uw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lx(t,r){const a=uw(t);return Math.round(r*a)/a}function lm(t){const r=g.useRef(t);return vu(()=>{r.current=t}),r}function y_(t){t===void 0&&(t={});const{placement:r="bottom",strategy:a="absolute",middleware:l=[],platform:s,elements:{reference:c,floating:u}={},transform:d=!0,whileElementsMounted:m,open:v}=t,[b,y]=g.useState({x:0,y:0,strategy:a,placement:r,middlewareData:{},isPositioned:!1}),[w,C]=g.useState(l);Lu(w,l)||C(l);const[E,S]=g.useState(null),[R,M]=g.useState(null),O=g.useCallback(B=>{B!==I.current&&(I.current=B,S(B))},[]),_=g.useCallback(B=>{B!==N.current&&(N.current=B,M(B))},[]),z=c||E,k=u||R,I=g.useRef(null),N=g.useRef(null),T=g.useRef(b),A=m!=null,q=lm(m),K=lm(s),W=lm(v),ue=g.useCallback(()=>{if(!I.current||!N.current)return;const B={placement:r,strategy:a,middleware:w};K.current&&(B.platform=K.current),p_(I.current,N.current,B).then(ee=>{const ie={...ee,isPositioned:W.current!==!1};le.current&&!Lu(T.current,ie)&&(T.current=ie,Sr.flushSync(()=>{y(ie)}))})},[w,r,a,K,W]);vu(()=>{v===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,y(B=>({...B,isPositioned:!1})))},[v]);const le=g.useRef(!1);vu(()=>(le.current=!0,()=>{le.current=!1}),[]),vu(()=>{if(z&&(I.current=z),k&&(N.current=k),z&&k){if(q.current)return q.current(z,k,ue);ue()}},[z,k,ue,q,A]);const de=g.useMemo(()=>({reference:I,floating:N,setReference:O,setFloating:_}),[O,_]),L=g.useMemo(()=>({reference:z,floating:k}),[z,k]),G=g.useMemo(()=>{const B={position:a,left:0,top:0};if(!L.floating)return B;const ee=lx(L.floating,b.x),ie=lx(L.floating,b.y);return d?{...B,transform:"translate("+ee+"px, "+ie+"px)",...uw(L.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:ee,top:ie}},[a,d,L.floating,b.x,b.y]);return g.useMemo(()=>({...b,update:ue,refs:de,elements:L,floatingStyles:G}),[b,ue,de,L,G])}const b_=t=>{function r(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:t,fn(a){const{element:l,padding:s}=typeof t=="function"?t(a):t;return l&&r(l)?l.current!=null?ix({element:l.current,padding:s}).fn(a):{}:l?ix({element:l,padding:s}).fn(a):{}}}},x_=(t,r)=>({...c_(t),options:[t,r]}),S_=(t,r)=>({...u_(t),options:[t,r]}),w_=(t,r)=>({...m_(t),options:[t,r]}),C_=(t,r)=>({...d_(t),options:[t,r]}),N_=(t,r)=>({...f_(t),options:[t,r]}),E_=(t,r)=>({...h_(t),options:[t,r]}),j_=(t,r)=>({...b_(t),options:[t,r]});var R_="Arrow",dw=g.forwardRef((t,r)=>{const{children:a,width:l=10,height:s=5,...c}=t;return h.jsx(Ie.svg,{...c,ref:r,width:l,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?a:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});dw.displayName=R_;var M_=dw;function O_(t){const[r,a]=g.useState(void 0);return hn(()=>{if(t){a({width:t.offsetWidth,height:t.offsetHeight});const l=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const c=s[0];let u,d;if("borderBoxSize"in c){const m=c.borderBoxSize,v=Array.isArray(m)?m[0]:m;u=v.inlineSize,d=v.blockSize}else u=t.offsetWidth,d=t.offsetHeight;a({width:u,height:d})});return l.observe(t,{box:"border-box"}),()=>l.unobserve(t)}else a(void 0)},[t]),r}var Dp="Popper",[fw,id]=si(Dp),[D_,hw]=fw(Dp),mw=t=>{const{__scopePopper:r,children:a}=t,[l,s]=g.useState(null);return h.jsx(D_,{scope:r,anchor:l,onAnchorChange:s,children:a})};mw.displayName=Dp;var pw="PopperAnchor",vw=g.forwardRef((t,r)=>{const{__scopePopper:a,virtualRef:l,...s}=t,c=hw(pw,a),u=g.useRef(null),d=mt(r,u),m=g.useRef(null);return g.useEffect(()=>{const v=m.current;m.current=l?.current||u.current,v!==m.current&&c.onAnchorChange(m.current)}),l?null:h.jsx(Ie.div,{...s,ref:d})});vw.displayName=pw;var Tp="PopperContent",[T_,__]=fw(Tp),gw=g.forwardRef((t,r)=>{const{__scopePopper:a,side:l="bottom",sideOffset:s=0,align:c="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:v=[],collisionPadding:b=0,sticky:y="partial",hideWhenDetached:w=!1,updatePositionStrategy:C="optimized",onPlaced:E,...S}=t,R=hw(Tp,a),[M,O]=g.useState(null),_=mt(r,re=>O(re)),[z,k]=g.useState(null),I=O_(z),N=I?.width??0,T=I?.height??0,A=l+(c!=="center"?"-"+c:""),q=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},K=Array.isArray(v)?v:[v],W=K.length>0,ue={padding:q,boundary:K.filter(z_),altBoundary:W},{refs:le,floatingStyles:de,placement:L,isPositioned:G,middlewareData:B}=y_({strategy:"fixed",placement:A,whileElementsMounted:(...re)=>s_(...re,{animationFrame:C==="always"}),elements:{reference:R.anchor},middleware:[x_({mainAxis:s+T,alignmentAxis:u}),m&&S_({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?w_():void 0,...ue}),m&&C_({...ue}),N_({...ue,apply:({elements:re,rects:De,availableWidth:Ae,availableHeight:Te})=>{const{width:Ue,height:he}=De.reference,dt=re.floating.style;dt.setProperty("--radix-popper-available-width",`${Ae}px`),dt.setProperty("--radix-popper-available-height",`${Te}px`),dt.setProperty("--radix-popper-anchor-width",`${Ue}px`),dt.setProperty("--radix-popper-anchor-height",`${he}px`)}}),z&&j_({element:z,padding:d}),L_({arrowWidth:N,arrowHeight:T}),w&&E_({strategy:"referenceHidden",...ue})]}),[ee,ie]=xw(L),D=qr(E);hn(()=>{G&&D?.()},[G,D]);const Q=B.arrow?.x,J=B.arrow?.y,ne=B.arrow?.centerOffset!==0,[fe,me]=g.useState();return hn(()=>{M&&me(window.getComputedStyle(M).zIndex)},[M]),h.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...de,transform:G?de.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:h.jsx(T_,{scope:a,placedSide:ee,onArrowChange:k,arrowX:Q,arrowY:J,shouldHideArrow:ne,children:h.jsx(Ie.div,{"data-side":ee,"data-align":ie,...S,ref:_,style:{...S.style,animation:G?void 0:"none"}})})})});gw.displayName=Tp;var yw="PopperArrow",A_={top:"bottom",right:"left",bottom:"top",left:"right"},bw=g.forwardRef(function(r,a){const{__scopePopper:l,...s}=r,c=__(yw,l),u=A_[c.placedSide];return h.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:h.jsx(M_,{...s,ref:a,style:{...s.style,display:"block"}})})});bw.displayName=yw;function z_(t){return t!==null}var L_=t=>({name:"transformOrigin",options:t,fn(r){const{placement:a,rects:l,middlewareData:s}=r,u=s.arrow?.centerOffset!==0,d=u?0:t.arrowWidth,m=u?0:t.arrowHeight,[v,b]=xw(a),y={start:"0%",center:"50%",end:"100%"}[b],w=(s.arrow?.x??0)+d/2,C=(s.arrow?.y??0)+m/2;let E="",S="";return v==="bottom"?(E=u?y:`${w}px`,S=`${-m}px`):v==="top"?(E=u?y:`${w}px`,S=`${l.floating.height+m}px`):v==="right"?(E=`${-m}px`,S=u?y:`${C}px`):v==="left"&&(E=`${l.floating.width+m}px`,S=u?y:`${C}px`),{data:{x:E,y:S}}}});function xw(t){const[r,a="center"]=t.split("-");return[r,a]}var Sw=mw,ww=vw,Cw=gw,Nw=bw,k_="Portal",ld=g.forwardRef((t,r)=>{const{container:a,...l}=t,[s,c]=g.useState(!1);hn(()=>c(!0),[]);const u=a||s&&globalThis?.document?.body;return u?Gx.createPortal(h.jsx(Ie.div,{...l,ref:r}),u):null});ld.displayName=k_;function P_(t,r){return g.useReducer((a,l)=>r[a][l]??a,t)}var wa=t=>{const{present:r,children:a}=t,l=U_(r),s=typeof a=="function"?a({present:l.isPresent}):g.Children.only(a),c=mt(l.ref,B_(s));return typeof a=="function"||l.isPresent?g.cloneElement(s,{ref:c}):null};wa.displayName="Presence";function U_(t){const[r,a]=g.useState(),l=g.useRef(null),s=g.useRef(t),c=g.useRef("none"),u=t?"mounted":"unmounted",[d,m]=P_(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const v=ou(l.current);c.current=d==="mounted"?v:"none"},[d]),hn(()=>{const v=l.current,b=s.current;if(b!==t){const w=c.current,C=ou(v);t?m("MOUNT"):C==="none"||v?.display==="none"?m("UNMOUNT"):m(b&&w!==C?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,m]),hn(()=>{if(r){let v;const b=r.ownerDocument.defaultView??window,y=C=>{const S=ou(l.current).includes(CSS.escape(C.animationName));if(C.target===r&&S&&(m("ANIMATION_END"),!s.current)){const R=r.style.animationFillMode;r.style.animationFillMode="forwards",v=b.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=R)})}},w=C=>{C.target===r&&(c.current=ou(l.current))};return r.addEventListener("animationstart",w),r.addEventListener("animationcancel",y),r.addEventListener("animationend",y),()=>{b.clearTimeout(v),r.removeEventListener("animationstart",w),r.removeEventListener("animationcancel",y),r.removeEventListener("animationend",y)}}else m("ANIMATION_END")},[r,m]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:g.useCallback(v=>{l.current=v?getComputedStyle(v):null,a(v)},[])}}function ou(t){return t?.animationName||"none"}function B_(t){let r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?t.ref:(r=Object.getOwnPropertyDescriptor(t,"ref")?.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}var om="rovingFocusGroup.onEntryFocus",H_={bubbles:!1,cancelable:!0},As="RovingFocusGroup",[Pm,Ew,q_]=wp(As),[I_,od]=si(As,[q_]),[Q_,V_]=I_(As),jw=g.forwardRef((t,r)=>h.jsx(Pm.Provider,{scope:t.__scopeRovingFocusGroup,children:h.jsx(Pm.Slot,{scope:t.__scopeRovingFocusGroup,children:h.jsx(F_,{...t,ref:r})})}));jw.displayName=As;var F_=g.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,orientation:l,loop:s=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:v,preventScrollOnEntryFocus:b=!1,...y}=t,w=g.useRef(null),C=mt(r,w),E=Ju(c),[S,R]=Gl({prop:u,defaultProp:d??null,onChange:m,caller:As}),[M,O]=g.useState(!1),_=qr(v),z=Ew(a),k=g.useRef(!1),[I,N]=g.useState(0);return g.useEffect(()=>{const T=w.current;if(T)return T.addEventListener(om,_),()=>T.removeEventListener(om,_)},[_]),h.jsx(Q_,{scope:a,orientation:l,dir:E,loop:s,currentTabStopId:S,onItemFocus:g.useCallback(T=>R(T),[R]),onItemShiftTab:g.useCallback(()=>O(!0),[]),onFocusableItemAdd:g.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:g.useCallback(()=>N(T=>T-1),[]),children:h.jsx(Ie.div,{tabIndex:M||I===0?-1:0,"data-orientation":l,...y,ref:C,style:{outline:"none",...t.style},onMouseDown:Re(t.onMouseDown,()=>{k.current=!0}),onFocus:Re(t.onFocus,T=>{const A=!k.current;if(T.target===T.currentTarget&&A&&!M){const q=new CustomEvent(om,H_);if(T.currentTarget.dispatchEvent(q),!q.defaultPrevented){const K=z().filter(L=>L.focusable),W=K.find(L=>L.active),ue=K.find(L=>L.id===S),de=[W,ue,...K].filter(Boolean).map(L=>L.ref.current);Ow(de,b)}}k.current=!1}),onBlur:Re(t.onBlur,()=>O(!1))})})}),Rw="RovingFocusGroupItem",Mw=g.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,focusable:l=!0,active:s=!1,tabStopId:c,children:u,...d}=t,m=Br(),v=c||m,b=V_(Rw,a),y=b.currentTabStopId===v,w=Ew(a),{onFocusableItemAdd:C,onFocusableItemRemove:E,currentTabStopId:S}=b;return g.useEffect(()=>{if(l)return C(),()=>E()},[l,C,E]),h.jsx(Pm.ItemSlot,{scope:a,id:v,focusable:l,active:s,children:h.jsx(Ie.span,{tabIndex:y?0:-1,"data-orientation":b.orientation,...d,ref:r,onMouseDown:Re(t.onMouseDown,R=>{l?b.onItemFocus(v):R.preventDefault()}),onFocus:Re(t.onFocus,()=>b.onItemFocus(v)),onKeyDown:Re(t.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){b.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const M=K_(R,b.orientation,b.dir);if(M!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let _=w().filter(z=>z.focusable).map(z=>z.ref.current);if(M==="last")_.reverse();else if(M==="prev"||M==="next"){M==="prev"&&_.reverse();const z=_.indexOf(R.currentTarget);_=b.loop?X_(_,z+1):_.slice(z+1)}setTimeout(()=>Ow(_))}}),children:typeof u=="function"?u({isCurrentTabStop:y,hasTabStop:S!=null}):u})})});Mw.displayName=Rw;var G_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Y_(t,r){return r!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function K_(t,r,a){const l=Y_(t.key,a);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(l))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(l)))return G_[l]}function Ow(t,r=!1){const a=document.activeElement;for(const l of t)if(l===a||(l.focus({preventScroll:r}),document.activeElement!==a))return}function X_(t,r){return t.map((a,l)=>t[(r+l)%t.length])}var Dw=jw,Tw=Mw,$_=function(t){if(typeof document>"u")return null;var r=Array.isArray(t)?t[0]:t;return r.ownerDocument.body},Ul=new WeakMap,su=new WeakMap,cu={},sm=0,_w=function(t){return t&&(t.host||_w(t.parentNode))},Z_=function(t,r){return r.map(function(a){if(t.contains(a))return a;var l=_w(a);return l&&t.contains(l)?l:(console.error("aria-hidden",a,"in not contained inside",t,". Doing nothing"),null)}).filter(function(a){return!!a})},J_=function(t,r,a,l){var s=Z_(r,Array.isArray(t)?t:[t]);cu[a]||(cu[a]=new WeakMap);var c=cu[a],u=[],d=new Set,m=new Set(s),v=function(y){!y||d.has(y)||(d.add(y),v(y.parentNode))};s.forEach(v);var b=function(y){!y||m.has(y)||Array.prototype.forEach.call(y.children,function(w){if(d.has(w))b(w);else try{var C=w.getAttribute(l),E=C!==null&&C!=="false",S=(Ul.get(w)||0)+1,R=(c.get(w)||0)+1;Ul.set(w,S),c.set(w,R),u.push(w),S===1&&E&&su.set(w,!0),R===1&&w.setAttribute(a,"true"),E||w.setAttribute(l,"true")}catch(M){console.error("aria-hidden: cannot operate on ",w,M)}})};return b(r),d.clear(),sm++,function(){u.forEach(function(y){var w=Ul.get(y)-1,C=c.get(y)-1;Ul.set(y,w),c.set(y,C),w||(su.has(y)||y.removeAttribute(l),su.delete(y)),C||y.removeAttribute(a)}),sm--,sm||(Ul=new WeakMap,Ul=new WeakMap,su=new WeakMap,cu={})}},_p=function(t,r,a){a===void 0&&(a="data-aria-hidden");var l=Array.from(Array.isArray(t)?t:[t]),s=$_(t);return s?(l.push.apply(l,Array.from(s.querySelectorAll("[aria-live], script"))),J_(l,s,a,"aria-hidden")):function(){return null}},Pr=function(){return Pr=Object.assign||function(r){for(var a,l=1,s=arguments.length;l"u")return pA;var r=vA(t),a=document.documentElement.clientWidth,l=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,l-a+r[2]-r[0])}},yA=kw(),Ql="data-scroll-locked",bA=function(t,r,a,l){var s=t.left,c=t.top,u=t.right,d=t.gap;return a===void 0&&(a="margin"),` .`.concat(eA,` { overflow: hidden `).concat(l,`; padding-right: `).concat(d,"px ").concat(l,`; } body[`).concat(Ql,`] { overflow: hidden `).concat(l,`; overscroll-behavior: contain; `).concat([r&&"position: relative ".concat(l,";"),a==="margin"&&` padding-left: `.concat(s,`px; padding-top: `).concat(c,`px; padding-right: `).concat(u,`px; margin-left:0; margin-top:0; margin-right: `).concat(d,"px ").concat(l,`; `),a==="padding"&&"padding-right: ".concat(d,"px ").concat(l,";")].filter(Boolean).join(""),` } .`).concat(gu,` { right: `).concat(d,"px ").concat(l,`; } .`).concat(yu,` { margin-right: `).concat(d,"px ").concat(l,`; } .`).concat(gu," .").concat(gu,` { right: 0 `).concat(l,`; } .`).concat(yu," .").concat(yu,` { margin-right: 0 `).concat(l,`; } body[`).concat(Ql,`] { `).concat(tA,": ").concat(d,`px; } `)},sx=function(){var t=parseInt(document.body.getAttribute(Ql)||"0",10);return isFinite(t)?t:0},xA=function(){g.useEffect(function(){return document.body.setAttribute(Ql,(sx()+1).toString()),function(){var t=sx()-1;t<=0?document.body.removeAttribute(Ql):document.body.setAttribute(Ql,t.toString())}},[])},SA=function(t){var r=t.noRelative,a=t.noImportant,l=t.gapMode,s=l===void 0?"margin":l;xA();var c=g.useMemo(function(){return gA(s)},[s]);return g.createElement(yA,{styles:bA(c,!r,s,a?"":"!important")})},Um=!1;if(typeof window<"u")try{var uu=Object.defineProperty({},"passive",{get:function(){return Um=!0,!0}});window.addEventListener("test",uu,uu),window.removeEventListener("test",uu,uu)}catch{Um=!1}var Bl=Um?{passive:!1}:!1,wA=function(t){return t.tagName==="TEXTAREA"},Pw=function(t,r){if(!(t instanceof Element))return!1;var a=window.getComputedStyle(t);return a[r]!=="hidden"&&!(a.overflowY===a.overflowX&&!wA(t)&&a[r]==="visible")},CA=function(t){return Pw(t,"overflowY")},NA=function(t){return Pw(t,"overflowX")},cx=function(t,r){var a=r.ownerDocument,l=r;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var s=Uw(t,l);if(s){var c=Bw(t,l),u=c[1],d=c[2];if(u>d)return!0}l=l.parentNode}while(l&&l!==a.body);return!1},EA=function(t){var r=t.scrollTop,a=t.scrollHeight,l=t.clientHeight;return[r,a,l]},jA=function(t){var r=t.scrollLeft,a=t.scrollWidth,l=t.clientWidth;return[r,a,l]},Uw=function(t,r){return t==="v"?CA(r):NA(r)},Bw=function(t,r){return t==="v"?EA(r):jA(r)},RA=function(t,r){return t==="h"&&r==="rtl"?-1:1},MA=function(t,r,a,l,s){var c=RA(t,window.getComputedStyle(r).direction),u=c*l,d=a.target,m=r.contains(d),v=!1,b=u>0,y=0,w=0;do{if(!d)break;var C=Bw(t,d),E=C[0],S=C[1],R=C[2],M=S-R-c*E;(E||M)&&Uw(t,d)&&(y+=M,w+=E);var O=d.parentNode;d=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!m&&d!==document.body||m&&(r.contains(d)||r===d));return(b&&Math.abs(y)<1||!b&&Math.abs(w)<1)&&(v=!0),v},du=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},ux=function(t){return[t.deltaX,t.deltaY]},dx=function(t){return t&&"current"in t?t.current:t},OA=function(t,r){return t[0]===r[0]&&t[1]===r[1]},DA=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},TA=0,Hl=[];function _A(t){var r=g.useRef([]),a=g.useRef([0,0]),l=g.useRef(),s=g.useState(TA++)[0],c=g.useState(kw)[0],u=g.useRef(t);g.useEffect(function(){u.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var S=W_([t.lockRef.current],(t.shards||[]).map(dx),!0).filter(Boolean);return S.forEach(function(R){return R.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(R){return R.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var d=g.useCallback(function(S,R){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var M=du(S),O=a.current,_="deltaX"in S?S.deltaX:O[0]-M[0],z="deltaY"in S?S.deltaY:O[1]-M[1],k,I=S.target,N=Math.abs(_)>Math.abs(z)?"h":"v";if("touches"in S&&N==="h"&&I.type==="range")return!1;var T=window.getSelection(),A=T&&T.anchorNode,q=A?A===I||A.contains(I):!1;if(q)return!1;var K=cx(N,I);if(!K)return!0;if(K?k=N:(k=N==="v"?"h":"v",K=cx(N,I)),!K)return!1;if(!l.current&&"changedTouches"in S&&(_||z)&&(l.current=k),!k)return!0;var W=l.current||k;return MA(W,R,S,W==="h"?_:z)},[]),m=g.useCallback(function(S){var R=S;if(!(!Hl.length||Hl[Hl.length-1]!==c)){var M="deltaY"in R?ux(R):du(R),O=r.current.filter(function(k){return k.name===R.type&&(k.target===R.target||R.target===k.shadowParent)&&OA(k.delta,M)})[0];if(O&&O.should){R.cancelable&&R.preventDefault();return}if(!O){var _=(u.current.shards||[]).map(dx).filter(Boolean).filter(function(k){return k.contains(R.target)}),z=_.length>0?d(R,_[0]):!u.current.noIsolation;z&&R.cancelable&&R.preventDefault()}}},[]),v=g.useCallback(function(S,R,M,O){var _={name:S,delta:R,target:M,should:O,shadowParent:AA(M)};r.current.push(_),setTimeout(function(){r.current=r.current.filter(function(z){return z!==_})},1)},[]),b=g.useCallback(function(S){a.current=du(S),l.current=void 0},[]),y=g.useCallback(function(S){v(S.type,ux(S),S.target,d(S,t.lockRef.current))},[]),w=g.useCallback(function(S){v(S.type,du(S),S.target,d(S,t.lockRef.current))},[]);g.useEffect(function(){return Hl.push(c),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:w}),document.addEventListener("wheel",m,Bl),document.addEventListener("touchmove",m,Bl),document.addEventListener("touchstart",b,Bl),function(){Hl=Hl.filter(function(S){return S!==c}),document.removeEventListener("wheel",m,Bl),document.removeEventListener("touchmove",m,Bl),document.removeEventListener("touchstart",b,Bl)}},[]);var C=t.removeScrollBar,E=t.inert;return g.createElement(g.Fragment,null,E?g.createElement(c,{styles:DA(s)}):null,C?g.createElement(SA,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function AA(t){for(var r=null;t!==null;)t instanceof ShadowRoot&&(r=t.host,t=t.host),t=t.parentNode;return r}const zA=sA(Lw,_A);var cd=g.forwardRef(function(t,r){return g.createElement(sd,Pr({},t,{ref:r,sideCar:zA}))});cd.classNames=sd.classNames;var Bm=["Enter"," "],LA=["ArrowDown","PageUp","Home"],Hw=["ArrowUp","PageDown","End"],kA=[...LA,...Hw],PA={ltr:[...Bm,"ArrowRight"],rtl:[...Bm,"ArrowLeft"]},UA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zs="Menu",[ys,BA,HA]=wp(zs),[Zi,qw]=si(zs,[HA,id,od]),ud=id(),Iw=od(),[qA,Ji]=Zi(zs),[IA,Ls]=Zi(zs),Qw=t=>{const{__scopeMenu:r,open:a=!1,children:l,dir:s,onOpenChange:c,modal:u=!0}=t,d=ud(r),[m,v]=g.useState(null),b=g.useRef(!1),y=qr(c),w=Ju(s);return g.useEffect(()=>{const C=()=>{b.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>b.current=!1;return document.addEventListener("keydown",C,{capture:!0}),()=>{document.removeEventListener("keydown",C,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),h.jsx(Sw,{...d,children:h.jsx(qA,{scope:r,open:a,onOpenChange:y,content:m,onContentChange:v,children:h.jsx(IA,{scope:r,onClose:g.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:b,dir:w,modal:u,children:l})})})};Qw.displayName=zs;var QA="MenuAnchor",Ap=g.forwardRef((t,r)=>{const{__scopeMenu:a,...l}=t,s=ud(a);return h.jsx(ww,{...s,...l,ref:r})});Ap.displayName=QA;var zp="MenuPortal",[VA,Vw]=Zi(zp,{forceMount:void 0}),Fw=t=>{const{__scopeMenu:r,forceMount:a,children:l,container:s}=t,c=Ji(zp,r);return h.jsx(VA,{scope:r,forceMount:a,children:h.jsx(wa,{present:a||c.open,children:h.jsx(ld,{asChild:!0,container:s,children:l})})})};Fw.displayName=zp;var hr="MenuContent",[FA,Lp]=Zi(hr),Gw=g.forwardRef((t,r)=>{const a=Vw(hr,t.__scopeMenu),{forceMount:l=a.forceMount,...s}=t,c=Ji(hr,t.__scopeMenu),u=Ls(hr,t.__scopeMenu);return h.jsx(ys.Provider,{scope:t.__scopeMenu,children:h.jsx(wa,{present:l||c.open,children:h.jsx(ys.Slot,{scope:t.__scopeMenu,children:u.modal?h.jsx(GA,{...s,ref:r}):h.jsx(YA,{...s,ref:r})})})})}),GA=g.forwardRef((t,r)=>{const a=Ji(hr,t.__scopeMenu),l=g.useRef(null),s=mt(r,l);return g.useEffect(()=>{const c=l.current;if(c)return _p(c)},[]),h.jsx(kp,{...t,ref:s,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:Re(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)})}),YA=g.forwardRef((t,r)=>{const a=Ji(hr,t.__scopeMenu);return h.jsx(kp,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>a.onOpenChange(!1)})}),KA=Yl("MenuContent.ScrollLock"),kp=g.forwardRef((t,r)=>{const{__scopeMenu:a,loop:l=!1,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:v,onPointerDownOutside:b,onFocusOutside:y,onInteractOutside:w,onDismiss:C,disableOutsideScroll:E,...S}=t,R=Ji(hr,a),M=Ls(hr,a),O=ud(a),_=Iw(a),z=BA(a),[k,I]=g.useState(null),N=g.useRef(null),T=mt(r,N,R.onContentChange),A=g.useRef(0),q=g.useRef(""),K=g.useRef(0),W=g.useRef(null),ue=g.useRef("right"),le=g.useRef(0),de=E?cd:g.Fragment,L=E?{as:KA,allowPinchZoom:!0}:void 0,G=ee=>{const ie=q.current+ee,D=z().filter(re=>!re.disabled),Q=document.activeElement,J=D.find(re=>re.ref.current===Q)?.textValue,ne=D.map(re=>re.textValue),fe=l4(ne,ie,J),me=D.find(re=>re.textValue===fe)?.ref.current;(function re(De){q.current=De,window.clearTimeout(A.current),De!==""&&(A.current=window.setTimeout(()=>re(""),1e3))})(ie),me&&setTimeout(()=>me.focus())};g.useEffect(()=>()=>window.clearTimeout(A.current),[]),Cp();const B=g.useCallback(ee=>ue.current===W.current?.side&&s4(ee,W.current?.area),[]);return h.jsx(FA,{scope:a,searchRef:q,onItemEnter:g.useCallback(ee=>{B(ee)&&ee.preventDefault()},[B]),onItemLeave:g.useCallback(ee=>{B(ee)||(N.current?.focus(),I(null))},[B]),onTriggerLeave:g.useCallback(ee=>{B(ee)&&ee.preventDefault()},[B]),pointerGraceTimerRef:K,onPointerGraceIntentChange:g.useCallback(ee=>{W.current=ee},[]),children:h.jsx(de,{...L,children:h.jsx(ed,{asChild:!0,trapped:s,onMountAutoFocus:Re(c,ee=>{ee.preventDefault(),N.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:h.jsx(Wu,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:v,onPointerDownOutside:b,onFocusOutside:y,onInteractOutside:w,onDismiss:C,children:h.jsx(Dw,{asChild:!0,..._,dir:M.dir,orientation:"vertical",loop:l,currentTabStopId:k,onCurrentTabStopIdChange:I,onEntryFocus:Re(m,ee=>{M.isUsingKeyboardRef.current||ee.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(Cw,{role:"menu","aria-orientation":"vertical","data-state":s1(R.open),"data-radix-menu-content":"",dir:M.dir,...O,...S,ref:T,style:{outline:"none",...S.style},onKeyDown:Re(S.onKeyDown,ee=>{const D=ee.target.closest("[data-radix-menu-content]")===ee.currentTarget,Q=ee.ctrlKey||ee.altKey||ee.metaKey,J=ee.key.length===1;D&&(ee.key==="Tab"&&ee.preventDefault(),!Q&&J&&G(ee.key));const ne=N.current;if(ee.target!==ne||!kA.includes(ee.key))return;ee.preventDefault();const me=z().filter(re=>!re.disabled).map(re=>re.ref.current);Hw.includes(ee.key)&&me.reverse(),a4(me)}),onBlur:Re(t.onBlur,ee=>{ee.currentTarget.contains(ee.target)||(window.clearTimeout(A.current),q.current="")}),onPointerMove:Re(t.onPointerMove,bs(ee=>{const ie=ee.target,D=le.current!==ee.clientX;if(ee.currentTarget.contains(ie)&&D){const Q=ee.clientX>le.current?"right":"left";ue.current=Q,le.current=ee.clientX}}))})})})})})})});Gw.displayName=hr;var XA="MenuGroup",Pp=g.forwardRef((t,r)=>{const{__scopeMenu:a,...l}=t;return h.jsx(Ie.div,{role:"group",...l,ref:r})});Pp.displayName=XA;var $A="MenuLabel",Yw=g.forwardRef((t,r)=>{const{__scopeMenu:a,...l}=t;return h.jsx(Ie.div,{...l,ref:r})});Yw.displayName=$A;var ku="MenuItem",fx="menu.itemSelect",dd=g.forwardRef((t,r)=>{const{disabled:a=!1,onSelect:l,...s}=t,c=g.useRef(null),u=Ls(ku,t.__scopeMenu),d=Lp(ku,t.__scopeMenu),m=mt(r,c),v=g.useRef(!1),b=()=>{const y=c.current;if(!a&&y){const w=new CustomEvent(fx,{bubbles:!0,cancelable:!0});y.addEventListener(fx,C=>l?.(C),{once:!0}),$S(y,w),w.defaultPrevented?v.current=!1:u.onClose()}};return h.jsx(Kw,{...s,ref:m,disabled:a,onClick:Re(t.onClick,b),onPointerDown:y=>{t.onPointerDown?.(y),v.current=!0},onPointerUp:Re(t.onPointerUp,y=>{v.current||y.currentTarget?.click()}),onKeyDown:Re(t.onKeyDown,y=>{const w=d.searchRef.current!=="";a||w&&y.key===" "||Bm.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});dd.displayName=ku;var Kw=g.forwardRef((t,r)=>{const{__scopeMenu:a,disabled:l=!1,textValue:s,...c}=t,u=Lp(ku,a),d=Iw(a),m=g.useRef(null),v=mt(r,m),[b,y]=g.useState(!1),[w,C]=g.useState("");return g.useEffect(()=>{const E=m.current;E&&C((E.textContent??"").trim())},[c.children]),h.jsx(ys.ItemSlot,{scope:a,disabled:l,textValue:s??w,children:h.jsx(Tw,{asChild:!0,...d,focusable:!l,children:h.jsx(Ie.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":l||void 0,"data-disabled":l?"":void 0,...c,ref:v,onPointerMove:Re(t.onPointerMove,bs(E=>{l?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Re(t.onPointerLeave,bs(E=>u.onItemLeave(E))),onFocus:Re(t.onFocus,()=>y(!0)),onBlur:Re(t.onBlur,()=>y(!1))})})})}),ZA="MenuCheckboxItem",Xw=g.forwardRef((t,r)=>{const{checked:a=!1,onCheckedChange:l,...s}=t;return h.jsx(e1,{scope:t.__scopeMenu,checked:a,children:h.jsx(dd,{role:"menuitemcheckbox","aria-checked":Pu(a)?"mixed":a,...s,ref:r,"data-state":Bp(a),onSelect:Re(s.onSelect,()=>l?.(Pu(a)?!0:!a),{checkForDefaultPrevented:!1})})})});Xw.displayName=ZA;var $w="MenuRadioGroup",[JA,WA]=Zi($w,{value:void 0,onValueChange:()=>{}}),Zw=g.forwardRef((t,r)=>{const{value:a,onValueChange:l,...s}=t,c=qr(l);return h.jsx(JA,{scope:t.__scopeMenu,value:a,onValueChange:c,children:h.jsx(Pp,{...s,ref:r})})});Zw.displayName=$w;var Jw="MenuRadioItem",Ww=g.forwardRef((t,r)=>{const{value:a,...l}=t,s=WA(Jw,t.__scopeMenu),c=a===s.value;return h.jsx(e1,{scope:t.__scopeMenu,checked:c,children:h.jsx(dd,{role:"menuitemradio","aria-checked":c,...l,ref:r,"data-state":Bp(c),onSelect:Re(l.onSelect,()=>s.onValueChange?.(a),{checkForDefaultPrevented:!1})})})});Ww.displayName=Jw;var Up="MenuItemIndicator",[e1,e4]=Zi(Up,{checked:!1}),t1=g.forwardRef((t,r)=>{const{__scopeMenu:a,forceMount:l,...s}=t,c=e4(Up,a);return h.jsx(wa,{present:l||Pu(c.checked)||c.checked===!0,children:h.jsx(Ie.span,{...s,ref:r,"data-state":Bp(c.checked)})})});t1.displayName=Up;var t4="MenuSeparator",n1=g.forwardRef((t,r)=>{const{__scopeMenu:a,...l}=t;return h.jsx(Ie.div,{role:"separator","aria-orientation":"horizontal",...l,ref:r})});n1.displayName=t4;var n4="MenuArrow",r1=g.forwardRef((t,r)=>{const{__scopeMenu:a,...l}=t,s=ud(a);return h.jsx(Nw,{...s,...l,ref:r})});r1.displayName=n4;var r4="MenuSub",[kk,a1]=Zi(r4),as="MenuSubTrigger",i1=g.forwardRef((t,r)=>{const a=Ji(as,t.__scopeMenu),l=Ls(as,t.__scopeMenu),s=a1(as,t.__scopeMenu),c=Lp(as,t.__scopeMenu),u=g.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=c,v={__scopeMenu:t.__scopeMenu},b=g.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return g.useEffect(()=>b,[b]),g.useEffect(()=>{const y=d.current;return()=>{window.clearTimeout(y),m(null)}},[d,m]),h.jsx(Ap,{asChild:!0,...v,children:h.jsx(Kw,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":s.contentId,"data-state":s1(a.open),...t,ref:Ds(r,s.onTriggerChange),onClick:y=>{t.onClick?.(y),!(t.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:Re(t.onPointerMove,bs(y=>{c.onItemEnter(y),!y.defaultPrevented&&!t.disabled&&!a.open&&!u.current&&(c.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{a.onOpenChange(!0),b()},100))})),onPointerLeave:Re(t.onPointerLeave,bs(y=>{b();const w=a.content?.getBoundingClientRect();if(w){const C=a.content?.dataset.side,E=C==="right",S=E?-5:5,R=w[E?"left":"right"],M=w[E?"right":"left"];c.onPointerGraceIntentChange({area:[{x:y.clientX+S,y:y.clientY},{x:R,y:w.top},{x:M,y:w.top},{x:M,y:w.bottom},{x:R,y:w.bottom}],side:C}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(y),y.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:Re(t.onKeyDown,y=>{const w=c.searchRef.current!=="";t.disabled||w&&y.key===" "||PA[l.dir].includes(y.key)&&(a.onOpenChange(!0),a.content?.focus(),y.preventDefault())})})})});i1.displayName=as;var l1="MenuSubContent",o1=g.forwardRef((t,r)=>{const a=Vw(hr,t.__scopeMenu),{forceMount:l=a.forceMount,...s}=t,c=Ji(hr,t.__scopeMenu),u=Ls(hr,t.__scopeMenu),d=a1(l1,t.__scopeMenu),m=g.useRef(null),v=mt(r,m);return h.jsx(ys.Provider,{scope:t.__scopeMenu,children:h.jsx(wa,{present:l||c.open,children:h.jsx(ys.Slot,{scope:t.__scopeMenu,children:h.jsx(kp,{id:d.contentId,"aria-labelledby":d.triggerId,...s,ref:v,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:b=>{u.isUsingKeyboardRef.current&&m.current?.focus(),b.preventDefault()},onCloseAutoFocus:b=>b.preventDefault(),onFocusOutside:Re(t.onFocusOutside,b=>{b.target!==d.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:Re(t.onEscapeKeyDown,b=>{u.onClose(),b.preventDefault()}),onKeyDown:Re(t.onKeyDown,b=>{const y=b.currentTarget.contains(b.target),w=UA[u.dir].includes(b.key);y&&w&&(c.onOpenChange(!1),d.trigger?.focus(),b.preventDefault())})})})})})});o1.displayName=l1;function s1(t){return t?"open":"closed"}function Pu(t){return t==="indeterminate"}function Bp(t){return Pu(t)?"indeterminate":t?"checked":"unchecked"}function a4(t){const r=document.activeElement;for(const a of t)if(a===r||(a.focus(),document.activeElement!==r))return}function i4(t,r){return t.map((a,l)=>t[(r+l)%t.length])}function l4(t,r,a){const s=r.length>1&&Array.from(r).every(v=>v===r[0])?r[0]:r,c=a?t.indexOf(a):-1;let u=i4(t,Math.max(c,0));s.length===1&&(u=u.filter(v=>v!==a));const m=u.find(v=>v.toLowerCase().startsWith(s.toLowerCase()));return m!==a?m:void 0}function o4(t,r){const{x:a,y:l}=t;let s=!1;for(let c=0,u=r.length-1;cl!=w>l&&a<(y-v)*(l-b)/(w-b)+v&&(s=!s)}return s}function s4(t,r){if(!r)return!1;const a={x:t.clientX,y:t.clientY};return o4(a,r)}function bs(t){return r=>r.pointerType==="mouse"?t(r):void 0}var c4=Qw,u4=Ap,d4=Fw,f4=Gw,h4=Pp,m4=Yw,p4=dd,v4=Xw,g4=Zw,y4=Ww,b4=t1,x4=n1,S4=r1,w4=i1,C4=o1,fd="DropdownMenu",[N4]=si(fd,[qw]),bn=qw(),[E4,c1]=N4(fd),u1=t=>{const{__scopeDropdownMenu:r,children:a,dir:l,open:s,defaultOpen:c,onOpenChange:u,modal:d=!0}=t,m=bn(r),v=g.useRef(null),[b,y]=Gl({prop:s,defaultProp:c??!1,onChange:u,caller:fd});return h.jsx(E4,{scope:r,triggerId:Br(),triggerRef:v,contentId:Br(),open:b,onOpenChange:y,onOpenToggle:g.useCallback(()=>y(w=>!w),[y]),modal:d,children:h.jsx(c4,{...m,open:b,onOpenChange:y,dir:l,modal:d,children:a})})};u1.displayName=fd;var d1="DropdownMenuTrigger",f1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,disabled:l=!1,...s}=t,c=c1(d1,a),u=bn(a);return h.jsx(u4,{asChild:!0,...u,children:h.jsx(Ie.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":l?"":void 0,disabled:l,...s,ref:Ds(r,c.triggerRef),onPointerDown:Re(t.onPointerDown,d=>{!l&&d.button===0&&d.ctrlKey===!1&&(c.onOpenToggle(),c.open||d.preventDefault())}),onKeyDown:Re(t.onKeyDown,d=>{l||(["Enter"," "].includes(d.key)&&c.onOpenToggle(),d.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});f1.displayName=d1;var j4="DropdownMenuPortal",h1=t=>{const{__scopeDropdownMenu:r,...a}=t,l=bn(r);return h.jsx(d4,{...l,...a})};h1.displayName=j4;var m1="DropdownMenuContent",p1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=c1(m1,a),c=bn(a),u=g.useRef(!1);return h.jsx(f4,{id:s.contentId,"aria-labelledby":s.triggerId,...c,...l,ref:r,onCloseAutoFocus:Re(t.onCloseAutoFocus,d=>{u.current||s.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Re(t.onInteractOutside,d=>{const m=d.detail.originalEvent,v=m.button===0&&m.ctrlKey===!0,b=m.button===2||v;(!s.modal||b)&&(u.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});p1.displayName=m1;var R4="DropdownMenuGroup",M4=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(h4,{...s,...l,ref:r})});M4.displayName=R4;var O4="DropdownMenuLabel",v1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(m4,{...s,...l,ref:r})});v1.displayName=O4;var D4="DropdownMenuItem",g1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(p4,{...s,...l,ref:r})});g1.displayName=D4;var T4="DropdownMenuCheckboxItem",y1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(v4,{...s,...l,ref:r})});y1.displayName=T4;var _4="DropdownMenuRadioGroup",A4=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(g4,{...s,...l,ref:r})});A4.displayName=_4;var z4="DropdownMenuRadioItem",b1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(y4,{...s,...l,ref:r})});b1.displayName=z4;var L4="DropdownMenuItemIndicator",x1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(b4,{...s,...l,ref:r})});x1.displayName=L4;var k4="DropdownMenuSeparator",S1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(x4,{...s,...l,ref:r})});S1.displayName=k4;var P4="DropdownMenuArrow",U4=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(S4,{...s,...l,ref:r})});U4.displayName=P4;var B4="DropdownMenuSubTrigger",w1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(w4,{...s,...l,ref:r})});w1.displayName=B4;var H4="DropdownMenuSubContent",C1=g.forwardRef((t,r)=>{const{__scopeDropdownMenu:a,...l}=t,s=bn(a);return h.jsx(C4,{...s,...l,ref:r,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});C1.displayName=H4;var q4=u1,I4=f1,Q4=h1,N1=p1,E1=v1,j1=g1,R1=y1,M1=b1,O1=x1,D1=S1,T1=w1,_1=C1;const Hm=q4,qm=I4,V4=g.forwardRef(({className:t,inset:r,children:a,...l},s)=>h.jsxs(T1,{ref:s,className:ye("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",r&&"pl-8",t),...l,children:[a,h.jsx(TS,{className:"ml-auto"})]}));V4.displayName=T1.displayName;const F4=g.forwardRef(({className:t,...r},a)=>h.jsx(_1,{ref:a,className:ye("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...r}));F4.displayName=_1.displayName;const Uu=g.forwardRef(({className:t,sideOffset:r=4,...a},l)=>h.jsx(Q4,{children:h.jsx(N1,{ref:l,sideOffset:r,className:ye("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...a})}));Uu.displayName=N1.displayName;const xs=g.forwardRef(({className:t,inset:r,...a},l)=>h.jsx(j1,{ref:l,className:ye("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",r&&"pl-8",t),...a}));xs.displayName=j1.displayName;const G4=g.forwardRef(({className:t,children:r,checked:a,...l},s)=>h.jsxs(R1,{ref:s,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...l,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(O1,{children:h.jsx(DS,{className:"h-4 w-4"})})}),r]}));G4.displayName=R1.displayName;const Y4=g.forwardRef(({className:t,children:r,...a},l)=>h.jsxs(M1,{ref:l,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(O1,{children:h.jsx(gp,{className:"h-2 w-2 fill-current"})})}),r]}));Y4.displayName=M1.displayName;const Im=g.forwardRef(({className:t,inset:r,...a},l)=>h.jsx(E1,{ref:l,className:ye("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",t),...a}));Im.displayName=E1.displayName;const Qm=g.forwardRef(({className:t,...r},a)=>h.jsx(D1,{ref:a,className:ye("-mx-1 my-1 h-px bg-muted",t),...r}));Qm.displayName=D1.displayName;const bu=[{id:"purple",name:"Purple",color:"hsl(270 80% 60%)"},{id:"ocean",name:"Ocean",color:"hsl(210 90% 55%)"},{id:"sunset",name:"Sunset",color:"hsl(25 95% 55%)"},{id:"forest",name:"Forest",color:"hsl(145 70% 40%)"},{id:"rose",name:"Rose",color:"hsl(350 80% 60%)"},{id:"slate",name:"Slate",color:"hsl(220 15% 35%)"}],K4=()=>{if(typeof window>"u")return"purple";const t=localStorage.getItem("color-theme");return bu.some(r=>r.id===t)?t:"purple"},X4=()=>{if(typeof window>"u")return"light";const t=localStorage.getItem("mode");return t==="light"||t==="dark"?t:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},$4=()=>typeof window>"u"?!0:localStorage.getItem("sidebar-expanded")!=="false",Z4=[{to:"/companies",label:"Companies",icon:ma},{to:"/contacts",label:"Contacts",icon:zn},{to:"/deals",label:"Deals",icon:ni},{to:"/activities",label:"Activities",icon:ms}],J4=[{label:"New Company",icon:ma,path:"/companies",action:"create-company"},{label:"New Contact",icon:zn,path:"/contacts",action:"create-contact"},{label:"New Deal",icon:ni,path:"/deals",action:"create-deal"},{label:"New Activity",icon:ms,path:"/activities",action:"create-activity"}];function W4(){const[t,r]=g.useState(K4),[a,l]=g.useState(X4),[s,c]=g.useState($4),u=js();g.useEffect(()=>{const v=document.documentElement;bu.forEach(b=>v.classList.remove(`theme-${b.id}`)),v.classList.add(`theme-${t}`),v.classList.toggle("dark",a==="dark"),localStorage.setItem("color-theme",t),localStorage.setItem("mode",a)},[t,a]),g.useEffect(()=>{localStorage.setItem("sidebar-expanded",String(s))},[s]);const d=v=>{u(v.path,{state:{openCreate:!0}})},m=bu.find(v=>v.id===t);return h.jsxs("div",{className:"h-screen bg-background text-foreground flex overflow-hidden",children:[h.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r border-border/50 bg-card/50 backdrop-blur-sm transition-all duration-300",s?"w-56":"w-16"),children:[h.jsxs("div",{className:ye("flex items-center h-14 border-b border-border/50 px-3",s?"justify-between":"justify-center"),children:[h.jsxs(C0,{to:"/",className:"flex items-center gap-2.5",children:[h.jsx("div",{className:"p-1.5 rounded-lg bg-gradient-to-br from-primary to-accent",children:h.jsx(tO,{className:"h-4 w-4 text-white"})}),s&&h.jsx("span",{className:"text-base font-semibold gradient-text",children:"CRM"})]}),s&&h.jsx(Ge,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>c(!1),children:h.jsx(NO,{className:"h-4 w-4"})})]}),h.jsxs("nav",{className:"flex-1 flex flex-col gap-1 p-2 overflow-y-auto",children:[!s&&h.jsx(Ge,{variant:"ghost",size:"icon",className:"h-9 w-full mb-2",onClick:()=>c(!0),children:h.jsx(jO,{className:"h-4 w-4"})}),Z4.map(v=>h.jsxs(C0,{to:v.to,className:({isActive:b})=>ye("flex items-center gap-3 rounded-lg text-sm font-medium transition-all duration-200",s?"px-3 py-2.5":"px-0 py-2.5 justify-center",b?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:s?void 0:v.label,children:[h.jsx(v.icon,{className:"h-4 w-4 shrink-0"}),s&&h.jsx("span",{children:v.label})]},v.to))]}),h.jsxs("div",{className:ye("border-t border-border/50 p-2 space-y-1",!s&&"flex flex-col items-center"),children:[h.jsxs(Hm,{children:[h.jsx(qm,{asChild:!0,children:h.jsxs(Ge,{variant:"ghost",className:ye("h-9 gap-2",s?"w-full justify-start px-3":"w-9 p-0"),children:[h.jsx("div",{className:"w-4 h-4 rounded-full shrink-0 border border-border",style:{backgroundColor:m?.color}}),s&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"flex-1 text-left text-sm",children:m?.name}),h.jsx($u,{className:"h-3 w-3 opacity-50"})]})]})}),h.jsxs(Uu,{side:s?"top":"right",align:s?"start":"center",className:"w-40",children:[h.jsx(Im,{className:"text-xs",children:"Theme Color"}),h.jsx(Qm,{}),bu.map(v=>h.jsxs(xs,{onClick:()=>r(v.id),className:"flex items-center gap-2.5 cursor-pointer",children:[h.jsx("div",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-border",style:{backgroundColor:v.color}}),h.jsx("span",{className:t===v.id?"font-medium":"",children:v.name})]},v.id))]})]}),h.jsxs(Ge,{variant:"ghost",className:ye("h-9 gap-2",s?"w-full justify-start px-3":"w-9 p-0"),onClick:()=>l(v=>v==="dark"?"light":"dark"),children:[a==="dark"?h.jsx(BO,{className:"h-4 w-4 shrink-0"}):h.jsx(wO,{className:"h-4 w-4 shrink-0"}),s&&h.jsx("span",{className:"text-sm",children:a==="dark"?"Light Mode":"Dark Mode"})]})]})]}),h.jsxs("div",{className:ye("flex-1 flex flex-col min-w-0 transition-all duration-300",s?"ml-56":"ml-16"),children:[h.jsx("header",{className:"flex-shrink-0 z-40 h-14 border-b border-border/50 bg-background/80 backdrop-blur-sm flex items-center justify-end px-6",children:h.jsxs(Hm,{children:[h.jsx(qm,{asChild:!0,children:h.jsx(Ge,{size:"icon",className:"h-9 w-9",children:h.jsx($i,{className:"h-4 w-4"})})}),h.jsxs(Uu,{align:"end",className:"w-48",children:[h.jsx(Im,{className:"text-xs",children:"Quick Create"}),h.jsx(Qm,{}),J4.map(v=>h.jsxs(xs,{onClick:()=>d(v),className:"flex items-center gap-2.5 cursor-pointer",children:[h.jsx(v.icon,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:v.label})]},v.action))]})]})}),h.jsx("main",{className:"flex-1 min-h-0 overflow-auto",children:h.jsx(CR,{})})]})]})}function Qi(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function e3(){return Object.create(null)}const t3=typeof Symbol=="function"&&!!Symbol.asyncIterator;function A1(t){return t3&&Qi(t)&&Symbol.asyncIterator in t}var n3=Object.create,z1=Object.defineProperty,r3=Object.getOwnPropertyDescriptor,L1=Object.getOwnPropertyNames,a3=Object.getPrototypeOf,i3=Object.prototype.hasOwnProperty,ks=(t,r)=>function(){return r||(0,t[L1(t)[0]])((r={exports:{}}).exports,r),r.exports},l3=(t,r,a,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(var s=L1(r),c=0,u=s.length,d;cr[m]).bind(null,d),enumerable:!(l=r3(r,d))||l.enumerable});return t},hd=(t,r,a)=>(a=t!=null?n3(a3(t)):{},l3(z1(a,"default",{value:t,enumerable:!0}),t));const k1=()=>{},hx=t=>{Object.freeze&&Object.freeze(t)};function P1(t,r,a){var l;const s=r.join(".");return(l=a[s])!==null&&l!==void 0||(a[s]=new Proxy(k1,{get(c,u){if(!(typeof u!="string"||u==="then"))return P1(t,[...r,u],a)},apply(c,u,d){const m=r[r.length-1];let v={args:d,path:r};return m==="call"?v={args:d.length>=2?[d[1]]:[],path:r.slice(0,-1)}:m==="apply"&&(v={args:d.length>=2?d[1]:[],path:r.slice(0,-1)}),hx(v.args),hx(v.path),t(v)}})),a[s]}const md=t=>P1(t,[],e3()),Hp=t=>new Proxy(k1,{get(r,a){if(a!=="then")return t(a)}});var U1=ks({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,r){function a(l){"@babel/helpers - typeof";return r.exports=a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r.exports.__esModule=!0,r.exports.default=r.exports,a(l)}r.exports=a,r.exports.__esModule=!0,r.exports.default=r.exports}}),o3=ks({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,r){var a=U1().default;function l(s,c){if(a(s)!="object"||!s)return s;var u=s[Symbol.toPrimitive];if(u!==void 0){var d=u.call(s,c||"default");if(a(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(s)}r.exports=l,r.exports.__esModule=!0,r.exports.default=r.exports}}),s3=ks({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,r){var a=U1().default,l=o3();function s(c){var u=l(c,"string");return a(u)=="symbol"?u:u+""}r.exports=s,r.exports.__esModule=!0,r.exports.default=r.exports}}),B1=ks({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,r){var a=s3();function l(s,c,u){return(c=a(c))in s?Object.defineProperty(s,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):s[c]=u,s}r.exports=l,r.exports.__esModule=!0,r.exports.default=r.exports}}),qp=ks({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,r){var a=B1();function l(c,u){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(c);u&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(c,v).enumerable})),d.push.apply(d,m)}return d}function s(c){for(var u=1;u{let c=!1;function u(){c||(c=!0,d.unsubscribe())}r.signal.addEventListener("abort",()=>{s(r.signal.reason)});const d=t.subscribe({next(m){c=!0,l(m),u()},error(m){s(m)},complete(){r.abort(),u()}})})}var h3=Object.create,H1=Object.defineProperty,m3=Object.getOwnPropertyDescriptor,q1=Object.getOwnPropertyNames,p3=Object.getPrototypeOf,v3=Object.prototype.hasOwnProperty,ci=(t,r)=>function(){return r||(0,t[q1(t)[0]])((r={exports:{}}).exports,r),r.exports},g3=(t,r,a,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(var s=q1(r),c=0,u=s.length,d;cr[m]).bind(null,d),enumerable:!(l=m3(r,d))||l.enumerable});return t},Wi=(t,r,a)=>(a=t!=null?h3(p3(t)):{},g3(r||!t||!t.__esModule?H1(a,"default",{value:t,enumerable:!0}):a,t)),y3=ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(t,r){function a(l,s){if(l==null)return{};var c={};for(var u in l)if({}.hasOwnProperty.call(l,u)){if(s.includes(u))continue;c[u]=l[u]}return c}r.exports=a,r.exports.__esModule=!0,r.exports.default=r.exports}}),b3=ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(t,r){var a=y3();function l(s,c){if(s==null)return{};var u,d,m=a(s,c);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(s);for(d=0;ds.split("."));if(!r&&(!a||a==="any"))return l.length?[l]:[];if(a==="infinite"&&Qi(r)&&("direction"in r||"cursor"in r)){const{cursor:s,direction:c}=r,u=(0,C3.default)(r,N3);return[l,{input:u,type:"infinite"}]}return[l,(0,mx.default)((0,mx.default)({},typeof r<"u"&&r!==Gn&&{input:r}),a&&a!=="any"&&{type:a})]}function xu(t){return kr(t,void 0,"any")}var E3=Object.create,Q1=Object.defineProperty,j3=Object.getOwnPropertyDescriptor,V1=Object.getOwnPropertyNames,R3=Object.getPrototypeOf,M3=Object.prototype.hasOwnProperty,Vr=(t,r)=>function(){return r||(0,t[V1(t)[0]])((r={exports:{}}).exports,r),r.exports},O3=(t,r,a,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(var s=V1(r),c=0,u=s.length,d;cr[m]).bind(null,d),enumerable:!(l=j3(r,d))||l.enumerable});return t},Pt=(t,r,a)=>(a=t!=null?E3(R3(t)):{},O3(Q1(a,"default",{value:t,enumerable:!0}),t)),F1=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,r){function a(l){"@babel/helpers - typeof";return r.exports=a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r.exports.__esModule=!0,r.exports.default=r.exports,a(l)}r.exports=a,r.exports.__esModule=!0,r.exports.default=r.exports}}),D3=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,r){var a=F1().default;function l(s,c){if(a(s)!="object"||!s)return s;var u=s[Symbol.toPrimitive];if(u!==void 0){var d=u.call(s,c||"default");if(a(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(s)}r.exports=l,r.exports.__esModule=!0,r.exports.default=r.exports}}),T3=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,r){var a=F1().default,l=D3();function s(c){var u=l(c,"string");return a(u)=="symbol"?u:u+""}r.exports=s,r.exports.__esModule=!0,r.exports.default=r.exports}}),el=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,r){var a=T3();function l(s,c,u){return(c=a(c))in s?Object.defineProperty(s,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):s[c]=u,s}r.exports=l,r.exports.__esModule=!0,r.exports.default=r.exports}}),Er=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,r){var a=el();function l(c,u){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(c);u&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(c,v).enumerable})),d.push.apply(d,m)}return d}function s(c){for(var u=1;u{let a=0,l=null;const s=[];function c(){l||(l=r.subscribe({next(d){for(const v of s){var m;(m=v.next)===null||m===void 0||m.call(v,d)}},error(d){for(const v of s){var m;(m=v.error)===null||m===void 0||m.call(v,d)}},complete(){for(const m of s){var d;(d=m.complete)===null||d===void 0||d.call(m)}}}))}function u(){if(a===0&&l){const d=l;l=null,d.unsubscribe()}}return pd(d=>(a++,s.push(d),c(),{unsubscribe(){a--,u();const m=s.findIndex(v=>v===d);m>-1&&s.splice(m,1)}}))}}function A3(t){let r=t;const a=[],l=u=>{r!==void 0&&u.next(r),a.push(u)},s=u=>{a.splice(a.indexOf(u),1)},c=pd(u=>(l(u),()=>{s(u)}));return c.next=u=>{if(r!==u){r=u;for(const d of a)d.next(u)}},c.get=()=>r,c}function z3(t){return pd(r=>{function a(s=0,c=t.op){const u=t.links[s];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:c,next(m){return a(s+1,m)}})}return a().subscribe(r)})}var hu=Pt(el()),ql=Pt(Er());function L3(t){return t instanceof Bu}function k3(t){return Qi(t)&&Qi(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function P3(t,r){return typeof t=="string"?t:Qi(t)&&typeof t.message=="string"?t.message:r}var Bu=class Su extends Error{constructor(r,a){var l,s;const c=a?.cause;super(r,{cause:c}),(0,hu.default)(this,"cause",void 0),(0,hu.default)(this,"shape",void 0),(0,hu.default)(this,"data",void 0),(0,hu.default)(this,"meta",void 0),this.meta=a?.meta,this.cause=c,this.shape=a==null||(l=a.result)===null||l===void 0?void 0:l.error,this.data=a==null||(s=a.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Su.prototype)}static from(r,a={}){const l=r;return L3(l)?(a.meta&&(l.meta=(0,ql.default)((0,ql.default)({},l.meta),a.meta)),l):k3(l)?new Su(l.error.message,(0,ql.default)((0,ql.default)({},a),{},{result:l})):new Su(P3(l,"Unknown error"),(0,ql.default)((0,ql.default)({},a),{},{cause:l}))}};function U3(t){const r=t;return r?"input"in r?r:{input:r,output:r}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}}const px=t=>typeof t=="function";function B3(t){if(t)return t;if(typeof window<"u"&&px(window.fetch))return window.fetch;if(typeof globalThis<"u"&&px(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var ls=Pt(Er());function H3(t){return{url:t.url.toString(),fetch:t.fetch,transformer:U3(t.transformer),methodOverride:t.methodOverride}}function q3(t){const r={};for(let a=0;at.transformer.input.serialize(r)))}const Y1=t=>{const r=t.url.split("?");let l=r[0].replace(/\/$/,"")+"/"+t.path;const s=[];if(r[1]&&s.push(r[1]),"inputs"in t&&s.push("batch=1"),t.type==="query"||t.type==="subscription"){const c=G1(t);c!==void 0&&t.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(c))}`)}return s.length&&(l+="?"+s.join("&")),l},Q3=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const r=G1(t);return r!==void 0?JSON.stringify(r):void 0},V3=t=>K3((0,ls.default)((0,ls.default)({},t),{},{contentTypeHeader:"application/json",getUrl:Y1,getBody:Q3}));var F3=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const G3=t=>{var r;if(t?.aborted)throw(r=t.throwIfAborted)===null||r===void 0||r.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new F3};async function Y3(t){var r;G3(t.signal);const a=t.getUrl(t),l=t.getBody(t),s=(r=t.methodOverride)!==null&&r!==void 0?r:I3[t.type],c=await(async()=>{const d=await t.headers();return Symbol.iterator in d?Object.fromEntries(d):d})(),u=(0,ls.default)((0,ls.default)((0,ls.default)({},t.contentTypeHeader&&s!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),c);return B3(t.fetch)(a,{method:s,signal:t.signal,body:l,headers:u})}async function K3(t){const r={},a=await Y3(t);r.response=a;const l=await a.json();return r.responseJSON=l,{json:l,meta:r}}Pt(Er());const vx=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function gx(t){let r=null,a=null;const l=()=>{clearTimeout(a),a=null,r=null};function s(d){const m=[[]];let v=0;for(;;){const w=d[v];if(!w)break;const C=m[m.length-1];if(w.aborted){var b;(b=w.reject)===null||b===void 0||b.call(w,new Error("Aborted")),v++;continue}if(t.validate(C.concat(w).map(S=>S.key))){C.push(w),v++;continue}if(C.length===0){var y;(y=w.reject)===null||y===void 0||y.call(w,new Error("Input is too big for a single dispatch")),v++;continue}m.push([])}return m}function c(){const d=s(r);l();for(const m of d){if(!m.length)continue;const v={items:m};for(const y of m)y.batch=v;t.fetch(v.items.map(y=>y.key)).then(async y=>{await Promise.all(y.map(async(C,E)=>{const S=v.items[E];try{var R;const O=await Promise.resolve(C);(R=S.resolve)===null||R===void 0||R.call(S,O)}catch(O){var M;(M=S.reject)===null||M===void 0||M.call(S,O)}S.batch=null,S.reject=null,S.resolve=null}));for(const C of v.items){var w;(w=C.reject)===null||w===void 0||w.call(C,new Error("Missing result")),C.batch=null}}).catch(y=>{for(const C of v.items){var w;(w=C.reject)===null||w===void 0||w.call(C,y),C.batch=null}})}}function u(d){var m;const v={aborted:!1,key:d,batch:null,resolve:vx,reject:vx},b=new Promise((y,w)=>{var C;v.reject=w,v.resolve=y,(C=r)!==null&&C!==void 0||(r=[]),r.push(v)});return(m=a)!==null&&m!==void 0||(a=setTimeout(c)),b}return{load:u}}function X3(...t){const r=new AbortController,a=t.length;let l=0;const s=()=>{++l===a&&r.abort()};for(const c of t)c?.aborted?s():c?.addEventListener("abort",s,{once:!0});return r.signal}var mu=Pt(Er());function $3(t){var r,a;const l=H3(t),s=(r=t.maxURLLength)!==null&&r!==void 0?r:1/0,c=(a=t.maxItems)!==null&&a!==void 0?a:1/0;return()=>{const u=b=>({validate(y){if(s===1/0&&c===1/0)return!0;if(y.length>c)return!1;const w=y.map(S=>S.path).join(","),C=y.map(S=>S.input);return Y1((0,mu.default)((0,mu.default)({},l),{},{type:b,path:w,inputs:C,signal:null})).length<=s},async fetch(y){const w=y.map(O=>O.path).join(","),C=y.map(O=>O.input),E=X3(...y.map(O=>O.signal)),S=await V3((0,mu.default)((0,mu.default)({},l),{},{path:w,inputs:C,type:b,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:y}):t.headers:{}},signal:E}));return(Array.isArray(S.json)?S.json:y.map(()=>S.json)).map(O=>({meta:S.meta,json:O}))}}),d=gx(u("query")),m=gx(u("mutation")),v={query:d,mutation:m};return({op:b})=>pd(y=>{if(b.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const C=v[b.type].load(b);let E;return C.then(S=>{E=S;const R=u3(S.json,l.transformer.output);if(!R.ok){y.error(Bu.from(R.error,{meta:S.meta}));return}y.next({context:S.meta,result:R.result}),y.complete()}).catch(S=>{y.error(Bu.from(S,{meta:E?.meta}))}),()=>{}})}}Pt(Er());const K1=(t,...r)=>typeof t=="function"?t(...r):t;Pt(el());function Z3(){let t,r;return{promise:new Promise((l,s)=>{t=l,r=s}),resolve:t,reject:r}}async function J3(t){const r=await K1(t.url);if(!t.connectionParams)return r;const l=`${r.includes("?")?"&":"?"}connectionParams=1`;return r+l}async function W3(t){const r={method:"connectionParams",data:await K1(t)};return JSON.stringify(r)}Pt(el());var Ai=Pt(el());function e5(t){const{promise:r,resolve:a,reject:l}=Z3();return t.addEventListener("open",()=>{t.removeEventListener("error",l),a()}),t.addEventListener("error",l),r}function t5(t,{intervalMs:r,pongTimeoutMs:a}){let l,s;function c(){l=setTimeout(()=>{t.send("PING"),s=setTimeout(()=>{t.close()},a)},r)}function u(){clearTimeout(l),c()}function d(){clearTimeout(s),u()}t.addEventListener("open",c),t.addEventListener("message",({data:m})=>{clearTimeout(l),c(),m==="PONG"&&d()}),t.addEventListener("close",()=>{clearTimeout(l),clearTimeout(s)})}var n5=class Vm{constructor(r){var a;if((0,Ai.default)(this,"id",++Vm.connectCount),(0,Ai.default)(this,"WebSocketPonyfill",void 0),(0,Ai.default)(this,"urlOptions",void 0),(0,Ai.default)(this,"keepAliveOpts",void 0),(0,Ai.default)(this,"wsObservable",A3(null)),(0,Ai.default)(this,"openPromise",null),this.WebSocketPonyfill=(a=r.WebSocketPonyfill)!==null&&a!==void 0?a:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=r.urlOptions,this.keepAliveOpts=r.keepAlive}get ws(){return this.wsObservable.get()}set ws(r){this.wsObservable.next(r)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var r=this;if(r.openPromise)return r.openPromise;r.id=++Vm.connectCount;const a=J3(r.urlOptions).then(l=>new r.WebSocketPonyfill(l));r.openPromise=a.then(async l=>{r.ws=l,l.addEventListener("message",function({data:s}){s==="PING"&&this.send("PONG")}),r.keepAliveOpts.enabled&&t5(l,r.keepAliveOpts),l.addEventListener("close",()=>{r.ws===l&&(r.ws=null)}),await e5(l),r.urlOptions.connectionParams&&l.send(await W3(r.urlOptions.connectionParams))});try{await r.openPromise}finally{r.openPromise=null}}async close(){var r=this;try{await r.openPromise}finally{var a;(a=r.ws)===null||a===void 0||a.close()}}};(0,Ai.default)(n5,"connectCount",0);Pt(el());Pt(Er());var hm=Pt(el()),yx=Pt(Er()),vd=class{constructor(t){(0,hm.default)(this,"links",void 0),(0,hm.default)(this,"runtime",void 0),(0,hm.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(r=>r(this.runtime))}$request(t){var r;return z3({links:this.links,op:(0,yx.default)((0,yx.default)({},t),{},{context:(r=t.context)!==null&&r!==void 0?r:{},id:++this.requestId})}).pipe(_3())}async requestAsPromise(t){var r=this;try{const a=r.$request(t);return(await f3(a)).result.data}catch(a){throw Bu.from(a)}}query(t,r,a){return this.requestAsPromise({type:"query",path:t,input:r,context:a?.context,signal:a?.signal})}mutation(t,r,a){return this.requestAsPromise({type:"mutation",path:t,input:r,context:a?.context,signal:a?.signal})}subscription(t,r,a){return this.$request({type:"subscription",path:t,input:r,context:a.context,signal:a.signal}).subscribe({next(s){switch(s.result.type){case"state":{var c;(c=a.onConnectionStateChange)===null||c===void 0||c.call(a,s.result);break}case"started":{var u;(u=a.onStarted)===null||u===void 0||u.call(a,{context:s.context});break}case"stopped":{var d;(d=a.onStopped)===null||d===void 0||d.call(a);break}case"data":case void 0:{var m;(m=a.onData)===null||m===void 0||m.call(a,s.result.data);break}}},error(s){var c;(c=a.onError)===null||c===void 0||c.call(a,s)},complete(){var s;(s=a.onComplete)===null||s===void 0||s.call(a)}})}};const X1=Symbol.for("trpc_untypedClient"),r5={query:"query",mutate:"mutation",subscribe:"subscription"},a5=t=>r5[t];function $1(t){const r=md(({path:a,args:l})=>{const s=[...a],c=a5(s.pop()),u=s.join(".");return t[c](u,...l)});return Hp(a=>a===X1?t:r[a])}function i5(t){const r=new vd(t);return $1(r)}function Ip(t){return t[X1]}Pt(Er());Pt(Er());var l5=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,r){function a(s){var c,u,d,m=2;for(typeof Symbol<"u"&&(u=Symbol.asyncIterator,d=Symbol.iterator);m--;){if(u&&(c=s[u])!=null)return c.call(s);if(d&&(c=s[d])!=null)return new l(c.call(s));u="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function l(s){function c(u){if(Object(u)!==u)return Promise.reject(new TypeError(u+" is not an object."));var d=u.done;return Promise.resolve(u.value).then(function(m){return{value:m,done:d}})}return l=function(d){this.s=d,this.n=d.next},l.prototype={s:null,n:null,next:function(){return c(this.n.apply(this.s,arguments))},return:function(d){var m=this.s.return;return m===void 0?Promise.resolve({value:d,done:!0}):c(m.apply(this.s,arguments))},throw:function(d){var m=this.s.return;return m===void 0?Promise.reject(d):c(m.apply(this.s,arguments))}},new l(s)}r.exports=a,r.exports.__esModule=!0,r.exports.default=r.exports}});Pt(l5());Pt(Er());var o5=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,r){function a(){var l=typeof SuppressedError=="function"?SuppressedError:function(d,m){var v=Error();return v.name="SuppressedError",v.error=d,v.suppressed=m,v},s={},c=[];function u(d,m){if(m!=null){if(Object(m)!==m)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var v=m[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(v===void 0&&(v=m[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var b=v;if(typeof v!="function")throw new TypeError("Object is not disposable.");b&&(v=function(){try{b.call(m)}catch(w){return Promise.reject(w)}}),c.push({v:m,d:v,a:d})}else d&&c.push({d:m,a:d});return m}return{e:s,u:u.bind(null,!1),a:u.bind(null,!0),d:function(){var m,v=this.e,b=0;function y(){for(;m=c.pop();)try{if(!m.a&&b===1)return b=0,c.push(m),Promise.resolve().then(y);if(m.d){var C=m.d.call(m.v);if(m.a)return b|=2,Promise.resolve(C).then(y,w)}else b|=1}catch(E){return w(E)}if(b===1)return v!==s?Promise.reject(v):Promise.resolve();if(v!==s)throw v}function w(C){return v=v!==s?new l(C,v):C,y()}return y()}}}r.exports=a,r.exports.__esModule=!0,r.exports.default=r.exports}}),Z1=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,r){function a(l,s){this.v=l,this.k=s}r.exports=a,r.exports.__esModule=!0,r.exports.default=r.exports}}),s5=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,r){var a=Z1();function l(s){return new a(s,0)}r.exports=l,r.exports.__esModule=!0,r.exports.default=r.exports}}),c5=Vr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,r){var a=Z1();function l(c){return function(){return new s(c.apply(this,arguments))}}function s(c){var u,d;function m(b,y){try{var w=c[b](y),C=w.value,E=C instanceof a;Promise.resolve(E?C.v:C).then(function(S){if(E){var R=b==="return"?"return":"next";if(!C.k||S.done)return m(R,S);S=c[R](S).value}v(w.done?"return":"normal",S)},function(S){m("throw",S)})}catch(S){v("throw",S)}}function v(b,y){switch(b){case"return":u.resolve({value:y,done:!0});break;case"throw":u.reject(y);break;default:u.resolve({value:y,done:!1})}(u=u.next)?m(u.key,u.arg):d=null}this._invoke=function(b,y){return new Promise(function(w,C){var E={key:b,arg:y,resolve:w,reject:C,next:null};d?d=d.next=E:(u=d=E,m(b,y))})},typeof c.return!="function"&&(this.return=void 0)}s.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},s.prototype.next=function(c){return this._invoke("next",c)},s.prototype.throw=function(c){return this._invoke("throw",c)},s.prototype.return=function(c){return this._invoke("return",c)},r.exports=l,r.exports.__esModule=!0,r.exports.default=r.exports}});Pt(o5());Pt(s5());Pt(c5());Pt(Er());function u5(t){return md(({path:r,args:a})=>{var l;const s=[...r],c=s.pop();if(c==="useMutation")return t[c](s,...a);if(c==="_def")return{path:s};const[u,...d]=a,m=(l=d[0])!==null&&l!==void 0?l:{};return t[c](s,u,m)})}var mm;const d5=["client","ssrContext","ssrState","abortOnUnmount"],f5=(mm=g.createContext)===null||mm===void 0?void 0:mm.call(Cs,null),h5=t=>{switch(t){case"queryOptions":case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":case"setQueriesData":return"query";case"infiniteQueryOptions":case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"setMutationDefaults":case"getMutationDefaults":case"isMutating":case"cancel":case"invalidate":case"refetch":case"reset":return"any"}};function m5(t){return md(r=>{const a=[...r.path],l=a.pop(),s=[...r.args],c=s.shift(),u=h5(l),d=kr(a,c,u);return{infiniteQueryOptions:()=>t.infiniteQueryOptions(a,d,s[0]),queryOptions:()=>t.queryOptions(a,d,...s),fetch:()=>t.fetchQuery(d,...s),fetchInfinite:()=>t.fetchInfiniteQuery(d,s[0]),prefetch:()=>t.prefetchQuery(d,...s),prefetchInfinite:()=>t.prefetchInfiniteQuery(d,s[0]),ensureData:()=>t.ensureQueryData(d,...s),invalidate:()=>t.invalidateQueries(d,...s),reset:()=>t.resetQueries(d,...s),refetch:()=>t.refetchQueries(d,...s),cancel:()=>t.cancelQuery(d,...s),setData:()=>{t.setQueryData(d,s[0],s[1])},setQueriesData:()=>t.setQueriesData(d,s[0],s[1],s[2]),setInfiniteData:()=>{t.setInfiniteQueryData(d,s[0],s[1])},getData:()=>t.getQueryData(d),getInfiniteData:()=>t.getInfiniteQueryData(d),setMutationDefaults:()=>t.setMutationDefaults(xu(a),c),getMutationDefaults:()=>t.getMutationDefaults(xu(a)),isMutating:()=>t.isMutating({mutationKey:xu(a)})}[l]()})}function p5(t){const r=$1(t.client),a=m5(t);return Hp(l=>{const s=l;return s==="client"?r:d5.includes(s)?t[s]:a[l]})}var v5=Wi(Ps(),1);function bx(t){const r=t instanceof vd?t:Ip(t);return md(a=>{const l=a.path,s=l.join("."),[c,u]=a.args;return(0,v5.default)({queryKey:kr(l,c,"query"),queryFn:()=>r.query(s,c,u?.trpc)},u)})}var pm=Wi(Ps(),1);function yn(t,r,a){var l;const s=t[0];let c=(l=t[1])===null||l===void 0?void 0:l.input;if(a){var u;c=(0,pm.default)((0,pm.default)((0,pm.default)({},(u=c)!==null&&u!==void 0?u:{}),a.pageParam?{cursor:a.pageParam}:{}),{},{direction:a.direction})}return[s.join("."),c,r?.trpc]}var g5=ci({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,r){function a(s){var c,u,d,m=2;for(typeof Symbol<"u"&&(u=Symbol.asyncIterator,d=Symbol.iterator);m--;){if(u&&(c=s[u])!=null)return c.call(s);if(d&&(c=s[d])!=null)return new l(c.call(s));u="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function l(s){function c(u){if(Object(u)!==u)return Promise.reject(new TypeError(u+" is not an object."));var d=u.done;return Promise.resolve(u.value).then(function(m){return{value:m,done:d}})}return l=function(d){this.s=d,this.n=d.next},l.prototype={s:null,n:null,next:function(){return c(this.n.apply(this.s,arguments))},return:function(d){var m=this.s.return;return m===void 0?Promise.resolve({value:d,done:!0}):c(m.apply(this.s,arguments))},throw:function(d){var m=this.s.return;return m===void 0?Promise.reject(d):c(m.apply(this.s,arguments))}},new l(s)}r.exports=a,r.exports.__esModule=!0,r.exports.default=r.exports}}),y5=Wi(g5(),1);function Fm(t){return{path:t.path.join(".")}}function ns(t){const r=Fm(t);return g.useMemo(()=>r,[r])}async function J1(t,r,a){const s=r.getQueryCache().build(r,{queryKey:a});s.setState({data:[],status:"success"});const c=[];var u=!1,d=!1,m;try{for(var v=(0,y5.default)(t),b;u=!(b=await v.next()).done;u=!1){const y=b.value;c.push(y),s.setState({data:[...c]})}}catch(y){d=!0,m=y}finally{try{u&&v.return!=null&&await v.return()}finally{if(d)throw m}}return c}var tt=Wi(Ps(),1);function b5(t){const{client:r,queryClient:a}=t,l=r instanceof vd?r:Ip(r);return{infiniteQueryOptions:(s,c,u)=>{var d,m;const v=((d=c[1])===null||d===void 0?void 0:d.input)===Gn,b=async y=>{var w;const C=(0,tt.default)((0,tt.default)({},u),{},{trpc:(0,tt.default)((0,tt.default)({},u?.trpc),!(u==null||(w=u.trpc)===null||w===void 0)&&w.abortOnUnmount?{signal:y.signal}:{signal:null})});return await l.query(...yn(c,C,{direction:y.direction,pageParam:y.pageParam}))};return Object.assign((0,tt.default)((0,tt.default)({},u),{},{initialData:u?.initialData,queryKey:c,queryFn:v?Gn:b,initialPageParam:(m=u?.initialCursor)!==null&&m!==void 0?m:null}),{trpc:Fm({path:s})})},queryOptions:(s,c,u)=>{var d;const m=((d=c[1])===null||d===void 0?void 0:d.input)===Gn,v=async b=>{var y;const w=(0,tt.default)((0,tt.default)({},u),{},{trpc:(0,tt.default)((0,tt.default)({},u?.trpc),!(u==null||(y=u.trpc)===null||y===void 0)&&y.abortOnUnmount?{signal:b.signal}:{signal:null})}),C=await l.query(...yn(c,w));return A1(C)?J1(C,a,c):C};return Object.assign((0,tt.default)((0,tt.default)({},u),{},{initialData:u?.initialData,queryKey:c,queryFn:m?Gn:v}),{trpc:Fm({path:s})})},fetchQuery:(s,c)=>a.fetchQuery((0,tt.default)((0,tt.default)({},c),{},{queryKey:s,queryFn:()=>l.query(...yn(s,c))})),fetchInfiniteQuery:(s,c)=>{var u;return a.fetchInfiniteQuery((0,tt.default)((0,tt.default)({},c),{},{queryKey:s,queryFn:({pageParam:d,direction:m})=>l.query(...yn(s,c,{pageParam:d,direction:m})),initialPageParam:(u=c?.initialCursor)!==null&&u!==void 0?u:null}))},prefetchQuery:(s,c)=>a.prefetchQuery((0,tt.default)((0,tt.default)({},c),{},{queryKey:s,queryFn:()=>l.query(...yn(s,c))})),prefetchInfiniteQuery:(s,c)=>{var u;return a.prefetchInfiniteQuery((0,tt.default)((0,tt.default)({},c),{},{queryKey:s,queryFn:({pageParam:d,direction:m})=>l.query(...yn(s,c,{pageParam:d,direction:m})),initialPageParam:(u=c?.initialCursor)!==null&&u!==void 0?u:null}))},ensureQueryData:(s,c)=>a.ensureQueryData((0,tt.default)((0,tt.default)({},c),{},{queryKey:s,queryFn:()=>l.query(...yn(s,c))})),invalidateQueries:(s,c,u)=>a.invalidateQueries((0,tt.default)((0,tt.default)({},c),{},{queryKey:s}),u),resetQueries:(s,c,u)=>a.resetQueries((0,tt.default)((0,tt.default)({},c),{},{queryKey:s}),u),refetchQueries:(s,c,u)=>a.refetchQueries((0,tt.default)((0,tt.default)({},c),{},{queryKey:s}),u),cancelQuery:(s,c)=>a.cancelQueries({queryKey:s},c),setQueryData:(s,c,u)=>a.setQueryData(s,c,u),setQueriesData:(s,c,u,d)=>a.setQueriesData((0,tt.default)((0,tt.default)({},c),{},{queryKey:s}),u,d),getQueryData:s=>a.getQueryData(s),setInfiniteQueryData:(s,c,u)=>a.setQueryData(s,c,u),getInfiniteQueryData:s=>a.getQueryData(s),setMutationDefaults:(s,c)=>{const u=s[0],d=m=>l.mutation(...yn([u,{input:m}],t));return a.setMutationDefaults(s,typeof c=="function"?c({canonicalMutationFn:d}):c)},getMutationDefaults:s=>a.getMutationDefaults(s),isMutating:s=>a.isMutating((0,tt.default)((0,tt.default)({},s),{},{exact:!0}))}}var xe=Wi(Ps());const xx=(t,r)=>new Proxy(t,{get(l,s){return r(s),l[s]}});function x5(t){var r,a;const l=(r=void 0)!==null&&r!==void 0?r:k=>k.originalFn(),s=(a=void 0)!==null&&a!==void 0?a:f5,c=i5,u=k=>{var I;const{abortOnUnmount:N=!1,queryClient:T,ssrContext:A}=k,[q,K]=g.useState((I=k.ssrState)!==null&&I!==void 0?I:!1),W=k.client instanceof vd?k.client:Ip(k.client),ue=g.useMemo(()=>b5({client:W,queryClient:T}),[W,T]),le=g.useMemo(()=>(0,xe.default)({abortOnUnmount:N,queryClient:T,client:W,ssrContext:A??null,ssrState:q},ue),[N,W,ue,T,A,q]);return g.useEffect(()=>{K(de=>de?"mounted":!1)},[]),h.jsx(s.Provider,{value:le,children:k.children})};function d(){const k=g.useContext(s);if(!k)throw new Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return k}function m(k,I){var N;const{queryClient:T,ssrState:A}=d();return A&&A!=="mounted"&&((N=T.getQueryCache().find({queryKey:k}))===null||N===void 0?void 0:N.state.status)==="error"?(0,xe.default)({retryOnMount:!1},I):I}function v(k,I,N){var T,A,q,K,W;const ue=d(),{abortOnUnmount:le,client:de,ssrState:L,queryClient:G,prefetchQuery:B}=ue,ee=kr(k,I,"query"),ie=G.getQueryDefaults(ee),D=I===Gn;typeof window>"u"&&L==="prepass"&&(N==null||(T=N.trpc)===null||T===void 0?void 0:T.ssr)!==!1&&((A=N?.enabled)!==null&&A!==void 0?A:ie?.enabled)!==!1&&!D&&!G.getQueryCache().find({queryKey:ee})&&B(ee,N);const Q=m(ee,(0,xe.default)((0,xe.default)({},ie),N)),J=(q=(K=N==null||(W=N.trpc)===null||W===void 0?void 0:W.abortOnUnmount)!==null&&K!==void 0?K:void 0)!==null&&q!==void 0?q:le,ne=wM((0,xe.default)((0,xe.default)({},Q),{},{queryKey:ee,queryFn:D?I:async fe=>{const me=(0,xe.default)((0,xe.default)({},Q),{},{trpc:(0,xe.default)((0,xe.default)({},Q?.trpc),J?{signal:fe.signal}:{signal:null})}),re=await de.query(...yn(ee,me));return A1(re)?J1(re,G,ee):re}}),G);return ne.trpc=ns({path:k}),ne}function b(k,I,N){var T,A,q;const K=d(),W=kr(k,I,"query"),ue=I===Gn,le=(T=(A=N==null||(q=N.trpc)===null||q===void 0?void 0:q.abortOnUnmount)!==null&&A!==void 0?A:void 0)!==null&&T!==void 0?T:K.abortOnUnmount;jM((0,xe.default)((0,xe.default)({},N),{},{queryKey:W,queryFn:ue?I:de=>{const L={trpc:(0,xe.default)((0,xe.default)({},N?.trpc),le?{signal:de.signal}:{})};return K.client.query(...yn(W,L))}}))}function y(k,I,N){var T,A,q;const K=d(),W=kr(k,I,"query"),ue=(T=(A=N==null||(q=N.trpc)===null||q===void 0?void 0:q.abortOnUnmount)!==null&&A!==void 0?A:void 0)!==null&&T!==void 0?T:K.abortOnUnmount,le=CM((0,xe.default)((0,xe.default)({},N),{},{queryKey:W,queryFn:de=>{const L=(0,xe.default)((0,xe.default)({},N),{},{trpc:(0,xe.default)((0,xe.default)({},N?.trpc),ue?{signal:de.signal}:{signal:null})});return K.client.query(...yn(W,L))}}),K.queryClient);return le.trpc=ns({path:k}),[le.data,le]}function w(k,I){const{client:N,queryClient:T}=d(),A=xu(k),q=T.defaultMutationOptions(T.getMutationDefaults(A)),K=MM((0,xe.default)((0,xe.default)({},I),{},{mutationKey:A,mutationFn:W=>N.mutation(...yn([k,{input:W}],I)),onSuccess(...W){var ue,le;return l({originalFn:()=>{var L,G,B;return(L=I==null||(G=I.onSuccess)===null||G===void 0?void 0:G.call(I,...W))!==null&&L!==void 0?L:q==null||(B=q.onSuccess)===null||B===void 0?void 0:B.call(q,...W)},queryClient:T,meta:(ue=(le=I?.meta)!==null&&le!==void 0?le:q?.meta)!==null&&ue!==void 0?ue:{}})}}),T);return K.trpc=ns({path:k}),K}const C={data:void 0,error:null,status:"idle"},E={data:void 0,error:null,status:"connecting"};function S(k,I,N){var T;const A=(T=N?.enabled)!==null&&T!==void 0?T:I!==Gn,q=ri(kr(k,I,"any")),{client:K}=d(),W=g.useRef(N);g.useEffect(()=>{W.current=N});const[ue]=g.useState(new Set([])),le=g.useCallback(D=>{ue.add(D)},[ue]),de=g.useRef(null),L=g.useCallback(D=>{const Q=B.current,J=B.current=D(Q);let ne=!1;for(const fe of ue)if(Q[fe]!==J[fe]){ne=!0;break}ne&&ie(xx(J,le))},[le,ue]),G=g.useCallback(()=>{var D;if((D=de.current)===null||D===void 0||D.unsubscribe(),!A){L(()=>(0,xe.default)((0,xe.default)({},C),{},{reset:G}));return}L(()=>(0,xe.default)((0,xe.default)({},E),{},{reset:G}));const Q=K.subscription(k.join("."),I??void 0,{onStarted:()=>{var J,ne;(J=(ne=W.current).onStarted)===null||J===void 0||J.call(ne),L(fe=>(0,xe.default)((0,xe.default)({},fe),{},{status:"pending",error:null}))},onData:J=>{var ne,fe;(ne=(fe=W.current).onData)===null||ne===void 0||ne.call(fe,J),L(me=>(0,xe.default)((0,xe.default)({},me),{},{status:"pending",data:J,error:null}))},onError:J=>{var ne,fe;(ne=(fe=W.current).onError)===null||ne===void 0||ne.call(fe,J),L(me=>(0,xe.default)((0,xe.default)({},me),{},{status:"error",error:J}))},onConnectionStateChange:J=>{L(ne=>{switch(J.state){case"idle":return(0,xe.default)((0,xe.default)({},ne),{},{status:J.state,error:null,data:void 0});case"connecting":return(0,xe.default)((0,xe.default)({},ne),{},{error:J.error,status:J.state});case"pending":return ne}})},onComplete:()=>{var J,ne;(J=(ne=W.current).onComplete)===null||J===void 0||J.call(ne),L(fe=>(0,xe.default)((0,xe.default)({},fe),{},{status:"idle",error:null,data:void 0}))}});de.current=Q},[K,q,A,L]);g.useEffect(()=>(G(),()=>{var D;(D=de.current)===null||D===void 0||D.unsubscribe()}),[G]);const B=g.useRef(A?(0,xe.default)((0,xe.default)({},E),{},{reset:G}):(0,xe.default)((0,xe.default)({},C),{},{reset:G})),[ee,ie]=g.useState(xx(B.current,le));return ee}function R(k,I,N){var T,A,q,K,W;const{client:ue,ssrState:le,prefetchInfiniteQuery:de,queryClient:L,abortOnUnmount:G}=d(),B=kr(k,I,"infinite"),ee=L.getQueryDefaults(B),ie=I===Gn;typeof window>"u"&&le==="prepass"&&(N==null||(T=N.trpc)===null||T===void 0?void 0:T.ssr)!==!1&&((A=N?.enabled)!==null&&A!==void 0?A:ee?.enabled)!==!1&&!ie&&!L.getQueryCache().find({queryKey:B})&&de(B,(0,xe.default)((0,xe.default)({},ee),N));const D=m(B,(0,xe.default)((0,xe.default)({},ee),N)),Q=(q=N==null||(K=N.trpc)===null||K===void 0?void 0:K.abortOnUnmount)!==null&&q!==void 0?q:G,J=OM((0,xe.default)((0,xe.default)({},D),{},{initialPageParam:(W=N.initialCursor)!==null&&W!==void 0?W:null,persister:N.persister,queryKey:B,queryFn:ie?I:ne=>{var fe;const me=(0,xe.default)((0,xe.default)({},D),{},{trpc:(0,xe.default)((0,xe.default)({},D?.trpc),Q?{signal:ne.signal}:{signal:null})});return ue.query(...yn(B,me,{pageParam:(fe=ne.pageParam)!==null&&fe!==void 0?fe:N.initialCursor,direction:ne.direction}))}}),L);return J.trpc=ns({path:k}),J}function M(k,I,N){var T,A,q;const K=d(),W=kr(k,I,"infinite"),ue=K.queryClient.getQueryDefaults(W),le=I===Gn,de=m(W,(0,xe.default)((0,xe.default)({},ue),N)),L=(T=N==null||(A=N.trpc)===null||A===void 0?void 0:A.abortOnUnmount)!==null&&T!==void 0?T:K.abortOnUnmount;RM((0,xe.default)((0,xe.default)({},N),{},{initialPageParam:(q=N.initialCursor)!==null&&q!==void 0?q:null,queryKey:W,queryFn:le?I:G=>{var B;const ee=(0,xe.default)((0,xe.default)({},de),{},{trpc:(0,xe.default)((0,xe.default)({},de?.trpc),L?{signal:G.signal}:{})});return K.client.query(...yn(W,ee,{pageParam:(B=G.pageParam)!==null&&B!==void 0?B:N.initialCursor,direction:G.direction}))}}))}function O(k,I,N){var T,A,q;const K=d(),W=kr(k,I,"infinite"),ue=K.queryClient.getQueryDefaults(W),le=m(W,(0,xe.default)((0,xe.default)({},ue),N)),de=(T=N==null||(A=N.trpc)===null||A===void 0?void 0:A.abortOnUnmount)!==null&&T!==void 0?T:K.abortOnUnmount,L=NM((0,xe.default)((0,xe.default)({},N),{},{initialPageParam:(q=N.initialCursor)!==null&&q!==void 0?q:null,queryKey:W,queryFn:G=>{var B;const ee=(0,xe.default)((0,xe.default)({},le),{},{trpc:(0,xe.default)((0,xe.default)({},le?.trpc),de?{signal:G.signal}:{})});return K.client.query(...yn(W,ee,{pageParam:(B=G.pageParam)!==null&&B!==void 0?B:N.initialCursor,direction:G.direction}))}}),K.queryClient);return L.trpc=ns({path:k}),[L.data,L]}return{Provider:u,createClient:c,useContext:d,useUtils:d,useQuery:v,usePrefetchQuery:b,useSuspenseQuery:y,useQueries:(k,I)=>{const{ssrState:N,queryClient:T,prefetchQuery:A,client:q}=d(),K=bx(q),W=k(K);if(typeof window>"u"&&N==="prepass")for(const le of W){var ue;const de=le;((ue=de.trpc)===null||ue===void 0?void 0:ue.ssr)!==!1&&!T.getQueryCache().find({queryKey:de.queryKey})&&A(de.queryKey,de)}return MS({queries:W.map(le=>(0,xe.default)((0,xe.default)({},le),{},{queryKey:le.queryKey})),combine:I?.combine},T)},useSuspenseQueries:k=>{const{queryClient:I,client:N}=d(),T=bx(N),A=k(T),q=EM({queries:A.map(K=>(0,xe.default)((0,xe.default)({},K),{},{queryFn:K.queryFn,queryKey:K.queryKey}))},I);return[q.map(K=>K.data),q]},useMutation:w,useSubscription:S,useInfiniteQuery:R,usePrefetchInfiniteQuery:M,useSuspenseInfiniteQuery:O}}function S5(t){const r=u5(t);return Hp(a=>a==="useContext"||a==="useUtils"?()=>{const l=t.useUtils();return g.useMemo(()=>p5(l),[l])}:t.hasOwnProperty(a)?t[a]:r[a])}function w5(t){const r=x5();return S5(r)}var C5={};const $e=w5(),N5=typeof globalThis.process<"u"&&C5?.VITE_TRPC_URL||"https://honest-dolls-move.preview-develop.taylordb.ai/api",E5=$e.createClient({links:[$3({url:`${N5}/trpc`})]}),Us=g.forwardRef(({className:t,...r},a)=>h.jsx("div",{className:"relative w-full overflow-auto",children:h.jsx("table",{ref:a,className:ye("w-full caption-bottom text-sm",t),...r})}));Us.displayName="Table";const Bs=g.forwardRef(({className:t,...r},a)=>h.jsx("thead",{ref:a,className:ye("[&_tr]:border-b",t),...r}));Bs.displayName="TableHeader";const Hs=g.forwardRef(({className:t,...r},a)=>h.jsx("tbody",{ref:a,className:ye("[&_tr:last-child]:border-0",t),...r}));Hs.displayName="TableBody";const j5=g.forwardRef(({className:t,...r},a)=>h.jsx("tfoot",{ref:a,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...r}));j5.displayName="TableFooter";const ya=g.forwardRef(({className:t,...r},a)=>h.jsx("tr",{ref:a,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...r}));ya.displayName="TableRow";const $t=g.forwardRef(({className:t,...r},a)=>h.jsx("th",{ref:a,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...r}));$t.displayName="TableHead";const Zt=g.forwardRef(({className:t,...r},a)=>h.jsx("td",{ref:a,className:ye("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...r}));Zt.displayName="TableCell";const R5=g.forwardRef(({className:t,...r},a)=>h.jsx("caption",{ref:a,className:ye("mt-4 text-sm text-muted-foreground",t),...r}));R5.displayName="TableCaption";const cr=g.forwardRef(({className:t,...r},a)=>h.jsx("div",{ref:a,className:ye("rounded-lg border bg-card text-card-foreground shadow-sm",t),...r}));cr.displayName="Card";const ur=g.forwardRef(({className:t,...r},a)=>h.jsx("div",{ref:a,className:ye("flex flex-col space-y-1.5 p-6",t),...r}));ur.displayName="CardHeader";const dr=g.forwardRef(({className:t,...r},a)=>h.jsx("div",{ref:a,className:ye("text-2xl font-semibold leading-none tracking-tight",t),...r}));dr.displayName="CardTitle";const no=g.forwardRef(({className:t,...r},a)=>h.jsx("div",{ref:a,className:ye("text-sm text-muted-foreground",t),...r}));no.displayName="CardDescription";const fr=g.forwardRef(({className:t,...r},a)=>h.jsx("div",{ref:a,className:ye("p-6 pt-0",t),...r}));fr.displayName="CardContent";const M5=g.forwardRef(({className:t,...r},a)=>h.jsx("div",{ref:a,className:ye("flex items-center p-6 pt-0",t),...r}));M5.displayName="CardFooter";const An=g.forwardRef(({className:t,type:r,...a},l)=>h.jsx("input",{type:r,className:ye("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm transition-colors",t),ref:l,...a}));An.displayName="Input";var O5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D5=O5.reduce((t,r)=>{const a=LS(`Primitive.${r}`),l=g.forwardRef((s,c)=>{const{asChild:u,...d}=s,m=u?a:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(m,{...d,ref:c})});return l.displayName=`Primitive.${r}`,{...t,[r]:l}},{}),T5="Label",W1=g.forwardRef((t,r)=>h.jsx(D5.label,{...t,ref:r,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(t.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));W1.displayName=T5;var eC=W1;const _5=Ts("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),kt=g.forwardRef(({className:t,...r},a)=>h.jsx(eC,{ref:a,className:ye(_5(),t),...r}));kt.displayName=eC.displayName;const gd=g.forwardRef(({className:t,...r},a)=>h.jsx("textarea",{className:ye("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm transition-colors",t),ref:a,...r}));gd.displayName="Textarea";var yd="Dialog",[tC]=si(yd),[A5,jr]=tC(yd),nC=t=>{const{__scopeDialog:r,children:a,open:l,defaultOpen:s,onOpenChange:c,modal:u=!0}=t,d=g.useRef(null),m=g.useRef(null),[v,b]=Gl({prop:l,defaultProp:s??!1,onChange:c,caller:yd});return h.jsx(A5,{scope:r,triggerRef:d,contentRef:m,contentId:Br(),titleId:Br(),descriptionId:Br(),open:v,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(y=>!y),[b]),modal:u,children:a})};nC.displayName=yd;var rC="DialogTrigger",z5=g.forwardRef((t,r)=>{const{__scopeDialog:a,...l}=t,s=jr(rC,a),c=mt(r,s.triggerRef);return h.jsx(Ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Fp(s.open),...l,ref:c,onClick:Re(t.onClick,s.onOpenToggle)})});z5.displayName=rC;var Qp="DialogPortal",[L5,aC]=tC(Qp,{forceMount:void 0}),iC=t=>{const{__scopeDialog:r,forceMount:a,children:l,container:s}=t,c=jr(Qp,r);return h.jsx(L5,{scope:r,forceMount:a,children:g.Children.map(l,u=>h.jsx(wa,{present:a||c.open,children:h.jsx(ld,{asChild:!0,container:s,children:u})}))})};iC.displayName=Qp;var Hu="DialogOverlay",lC=g.forwardRef((t,r)=>{const a=aC(Hu,t.__scopeDialog),{forceMount:l=a.forceMount,...s}=t,c=jr(Hu,t.__scopeDialog);return c.modal?h.jsx(wa,{present:l||c.open,children:h.jsx(P5,{...s,ref:r})}):null});lC.displayName=Hu;var k5=Yl("DialogOverlay.RemoveScroll"),P5=g.forwardRef((t,r)=>{const{__scopeDialog:a,...l}=t,s=jr(Hu,a);return h.jsx(cd,{as:k5,allowPinchZoom:!0,shards:[s.contentRef],children:h.jsx(Ie.div,{"data-state":Fp(s.open),...l,ref:r,style:{pointerEvents:"auto",...l.style}})})}),Vi="DialogContent",oC=g.forwardRef((t,r)=>{const a=aC(Vi,t.__scopeDialog),{forceMount:l=a.forceMount,...s}=t,c=jr(Vi,t.__scopeDialog);return h.jsx(wa,{present:l||c.open,children:c.modal?h.jsx(U5,{...s,ref:r}):h.jsx(B5,{...s,ref:r})})});oC.displayName=Vi;var U5=g.forwardRef((t,r)=>{const a=jr(Vi,t.__scopeDialog),l=g.useRef(null),s=mt(r,a.contentRef,l);return g.useEffect(()=>{const c=l.current;if(c)return _p(c)},[]),h.jsx(sC,{...t,ref:s,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Re(t.onCloseAutoFocus,c=>{c.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:Re(t.onPointerDownOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&c.preventDefault()}),onFocusOutside:Re(t.onFocusOutside,c=>c.preventDefault())})}),B5=g.forwardRef((t,r)=>{const a=jr(Vi,t.__scopeDialog),l=g.useRef(!1),s=g.useRef(!1);return h.jsx(sC,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{t.onCloseAutoFocus?.(c),c.defaultPrevented||(l.current||a.triggerRef.current?.focus(),c.preventDefault()),l.current=!1,s.current=!1},onInteractOutside:c=>{t.onInteractOutside?.(c),c.defaultPrevented||(l.current=!0,c.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=c.target;a.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.current&&c.preventDefault()}})}),sC=g.forwardRef((t,r)=>{const{__scopeDialog:a,trapFocus:l,onOpenAutoFocus:s,onCloseAutoFocus:c,...u}=t,d=jr(Vi,a),m=g.useRef(null),v=mt(r,m);return Cp(),h.jsxs(h.Fragment,{children:[h.jsx(ed,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:s,onUnmountAutoFocus:c,children:h.jsx(Wu,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Fp(d.open),...u,ref:v,onDismiss:()=>d.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(H5,{titleId:d.titleId}),h.jsx(I5,{contentRef:m,descriptionId:d.descriptionId})]})]})}),Vp="DialogTitle",cC=g.forwardRef((t,r)=>{const{__scopeDialog:a,...l}=t,s=jr(Vp,a);return h.jsx(Ie.h2,{id:s.titleId,...l,ref:r})});cC.displayName=Vp;var uC="DialogDescription",dC=g.forwardRef((t,r)=>{const{__scopeDialog:a,...l}=t,s=jr(uC,a);return h.jsx(Ie.p,{id:s.descriptionId,...l,ref:r})});dC.displayName=uC;var fC="DialogClose",hC=g.forwardRef((t,r)=>{const{__scopeDialog:a,...l}=t,s=jr(fC,a);return h.jsx(Ie.button,{type:"button",...l,ref:r,onClick:Re(t.onClick,()=>s.onOpenChange(!1))})});hC.displayName=fC;function Fp(t){return t?"open":"closed"}var mC="DialogTitleWarning",[Pk,pC]=ID(mC,{contentName:Vi,titleName:Vp,docsSlug:"dialog"}),H5=({titleId:t})=>{const r=pC(mC),a=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return g.useEffect(()=>{t&&(document.getElementById(t)||console.error(a))},[a,t]),null},q5="DialogDescriptionWarning",I5=({contentRef:t,descriptionId:r})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pC(q5).contentName}}.`;return g.useEffect(()=>{const s=t.current?.getAttribute("aria-describedby");r&&s&&(document.getElementById(r)||console.warn(l))},[l,t,r]),null},vC=nC,gC=iC,bd=lC,qs=oC,xd=cC,Sd=dC,Gp=hC;const Q5=vC,yC=gC,Yp=g.forwardRef(({className:t,...r},a)=>h.jsx(bd,{className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:a}));Yp.displayName=bd.displayName;const V5=Ts("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),F5=g.forwardRef(({side:t="right",className:r,children:a,...l},s)=>h.jsxs(yC,{children:[h.jsx(Yp,{}),h.jsxs(qs,{ref:s,className:ye(V5({side:t}),r),...l,children:[a,h.jsxs(Gp,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[h.jsx(xp,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));F5.displayName=qs.displayName;const bC=({className:t,...r})=>h.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...r});bC.displayName="SheetHeader";const xC=g.forwardRef(({className:t,...r},a)=>h.jsx(xd,{ref:a,className:ye("text-lg font-semibold text-foreground",t),...r}));xC.displayName=xd.displayName;const SC=g.forwardRef(({className:t,...r},a)=>h.jsx(Sd,{ref:a,className:ye("text-sm text-muted-foreground",t),...r}));SC.displayName=Sd.displayName;const Kp=vC,G5=gC,wC=g.forwardRef(({className:t,...r},a)=>h.jsx(bd,{ref:a,className:ye("fixed inset-0 z-[300] bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));wC.displayName=bd.displayName;const wd=g.forwardRef(({className:t,children:r,...a},l)=>h.jsxs(G5,{children:[h.jsx(wC,{}),h.jsxs(qs,{ref:l,className:ye("fixed left-[50%] top-[50%] z-[301] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[r,h.jsxs(Gp,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(xp,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wd.displayName=qs.displayName;const Cd=({className:t,...r})=>h.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});Cd.displayName="DialogHeader";const Nd=({className:t,...r})=>h.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Nd.displayName="DialogFooter";const Ed=g.forwardRef(({className:t,...r},a)=>h.jsx(xd,{ref:a,className:ye("text-lg font-semibold leading-none tracking-tight",t),...r}));Ed.displayName=xd.displayName;const jd=g.forwardRef(({className:t,...r},a)=>h.jsx(Sd,{ref:a,className:ye("text-sm text-muted-foreground",t),...r}));jd.displayName=Sd.displayName;const Y5=Ts("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}});function Rd({open:t,onOpenChange:r,title:a,description:l,icon:s,isCreateMode:c,isLoading:u=!1,hasChanges:d,isPending:m,isDeletePending:v=!1,onSave:b,onDelete:y,children:w,footer:C,className:E,layer:S=0}){const[R,M]=g.useState(!1),O=50+S*10,_=O,z=O+1,k=g.useCallback(A=>{!A&&d?M(!0):(M(!1),r(A))},[d,r]),I=g.useCallback(()=>{M(!1)},[]),N=g.useCallback(()=>{M(!1),r(!1)},[r]),T=g.useCallback(()=>{y&&confirm("Are you sure you want to delete this item?")&&y()},[y]);return h.jsxs(h.Fragment,{children:[h.jsx(Q5,{open:t,onOpenChange:k,children:h.jsxs(yC,{children:[h.jsx(Yp,{className:ye(S>0&&"bg-black/60"),style:{zIndex:_},onClick:A=>{d&&(A.preventDefault(),A.stopPropagation(),M(!0))}}),h.jsxs(qs,{className:ye(Y5({side:"right"}),"sm:max-w-[480px] flex flex-col",E),style:{zIndex:z},onPointerDownOutside:A=>{d&&A.preventDefault()},onEscapeKeyDown:A=>{d&&(A.preventDefault(),M(!0))},onInteractOutside:A=>{d&&A.preventDefault()},children:[h.jsx(bC,{className:"space-y-3",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-br from-primary/20 to-primary/5 border border-primary/20",children:s}),h.jsxs("div",{className:"flex-1",children:[h.jsx(xC,{children:a}),h.jsx(SC,{children:l})]})]})}),u&&!c?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx(Yn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):h.jsx("div",{className:"flex-1 flex flex-col gap-6 py-6 overflow-y-auto",children:w}),C,h.jsxs("div",{className:"flex items-center gap-3 pt-4 border-t",children:[!c&&y&&h.jsxs(Ge,{variant:"destructive",size:"sm",onClick:T,disabled:v,children:[v?h.jsx(Yn,{className:"h-4 w-4 animate-spin"}):h.jsx(AS,{className:"h-4 w-4"}),h.jsx("span",{className:"ml-2",children:"Delete"})]}),h.jsx("div",{className:"flex-1"}),h.jsx(Ge,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),h.jsxs(Ge,{onClick:b,disabled:m||!d,children:[m&&h.jsx(Yn,{className:"h-4 w-4 animate-spin mr-2"}),c?"Create":"Save Changes"]})]}),h.jsxs(Gp,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none data-[state=open]:bg-secondary",children:[h.jsx("span",{className:"h-4 w-4 flex items-center justify-center text-lg",children:"×"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}),h.jsx(Kp,{open:R,onOpenChange:M,children:h.jsxs(wd,{className:"sm:max-w-[425px]",children:[h.jsxs(Cd,{children:[h.jsx(Ed,{children:"Unsaved Changes"}),h.jsx(jd,{children:"You have unsaved changes. Do you want to continue editing or discard your changes?"})]}),h.jsxs(Nd,{className:"gap-2 sm:gap-0",children:[h.jsx(Ge,{variant:"outline",onClick:N,children:"Discard Changes"}),h.jsx(Ge,{onClick:I,children:"Continue Editing"})]})]})})]})}function CC({open:t,onOpenChange:r,companyId:a,onSuccess:l,layer:s=0}){const c=!a,{data:u,isLoading:d}=$e.companies.getById.useQuery({id:a},{enabled:!!a&&t}),m=c?"":u?.name||"",v=c?"":u?.website||"",b=c?"":u?.notes||"",[y,w]=g.useState(""),[C,E]=g.useState(""),[S,R]=g.useState(""),[M,O]=g.useState(!1);t&&!d&&!M&&(w(m),E(v),R(b),O(!0)),!t&&M&&O(!1);const _=c?y.trim().length>0:y!==m||C!==v||S!==b,z=$e.companies.create.useMutation({onSuccess:q=>{const K=q?.id?{id:q.id,name:y,website:C||void 0}:void 0;l?.(K),r(!1)}}),k=$e.companies.update.useMutation({onSuccess:()=>{l?.(),r(!1)}}),I=$e.companies.delete.useMutation({onSuccess:()=>{l?.(),r(!1)}}),N=()=>{c?y.trim()&&z.mutate({name:y,website:C||void 0,notes:S||void 0}):a&&_&&k.mutate({id:a,name:y||void 0,website:C||void 0,notes:S||void 0})},T=()=>{a&&I.mutate({id:a})},A=z.isPending||k.isPending;return h.jsxs(Rd,{open:t,onOpenChange:r,title:c?"New Company":"Company Details",description:c?"Create a new company record":"View and edit company information",icon:h.jsx(ma,{className:"h-5 w-5 text-primary"}),isCreateMode:c,isLoading:d,hasChanges:_,isPending:A,isDeletePending:I.isPending,onSave:N,onDelete:c?void 0:T,layer:s,footer:!c&&u?h.jsx("div",{className:"pt-4 border-t",children:h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Created: ",u.createdAt?new Date(u.createdAt).toLocaleDateString():"-",u.updatedAt&&h.jsxs(h.Fragment,{children:[" | Updated: ",new Date(u.updatedAt).toLocaleDateString()]})]})}):void 0,children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"name",children:"Company Name *"}),h.jsx(An,{id:"name",value:y,onChange:q=>w(q.target.value),placeholder:"Acme Inc."})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"website",children:"Website"}),h.jsxs("div",{className:"relative",children:[h.jsx(yp,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(An,{id:"website",value:C,onChange:q=>E(q.target.value),placeholder:"https://example.com",className:"pl-10"})]})]}),h.jsxs("div",{className:"space-y-2 flex-1",children:[h.jsx(kt,{htmlFor:"notes",children:"Notes"}),h.jsx(gd,{id:"notes",value:S,onChange:q=>R(q.target.value),placeholder:"Add any notes about this company...",className:"min-h-[120px] resize-none"})]})]})}function Sx(){const r=!!Sa().state?.openCreate,[a,l]=g.useState(r),[s,c]=g.useState(null);g.useLayoutEffect(()=>{r&&window.history.replaceState({},document.title)},[r]);const{data:u,isLoading:d,refetch:m}=$e.companies.getAll.useQuery(),v=C=>C?new Date(C).toLocaleDateString():"-",b=C=>{c(C),l(!0)},y=()=>{c(null),l(!0)},w=()=>{m()};return h.jsxs("div",{className:"container mx-auto p-6 max-w-6xl space-y-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 border border-primary/20",children:h.jsx(ma,{className:"h-6 w-6 text-primary"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Companies"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your company records"})]})]}),h.jsxs(Ge,{onClick:y,children:[h.jsx($i,{className:"h-4 w-4 mr-2"}),"New Company"]})]}),h.jsxs(cr,{children:[h.jsxs(ur,{className:"pb-4",children:[h.jsx(dr,{className:"text-lg",children:"All Companies"}),h.jsxs(no,{children:[u?.length??0," ",u?.length===1?"company":"companies"]})]}),h.jsx(fr,{children:d?h.jsx("div",{className:"flex items-center justify-center py-12",children:h.jsx(Yn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):u&&u.length>0?h.jsx("div",{className:"rounded-lg border",children:h.jsxs(Us,{children:[h.jsx(Bs,{children:h.jsxs(ya,{children:[h.jsx($t,{children:"Name"}),h.jsx($t,{children:"Website"}),h.jsx($t,{children:"Created"})]})}),h.jsx(Hs,{children:u.map(C=>h.jsxs(ya,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>C.id&&b(C.id),children:[h.jsx(Zt,{className:"font-medium",children:C.name||"-"}),h.jsx(Zt,{children:C.website?h.jsxs("span",{className:"inline-flex items-center gap-1.5 text-primary",onClick:E=>{E.stopPropagation(),window.open(C.website,"_blank")},children:[h.jsx(yp,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"truncate max-w-[200px] hover:underline",children:C.website}),h.jsx(_S,{className:"h-3 w-3"})]}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Zt,{className:"text-muted-foreground",children:v(C.createdAt)})]},C.id))})]})}):h.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[h.jsx(ma,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),h.jsx("p",{children:"No companies yet."}),h.jsx(Ge,{variant:"link",onClick:y,className:"mt-2",children:"Create your first company"})]})})]}),h.jsx(CC,{open:a,onOpenChange:l,companyId:s,onSuccess:w})]})}function wx({text:t,highlight:r}){if(!r.trim())return h.jsx(h.Fragment,{children:t});const a=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),l=t.split(a);return h.jsx(h.Fragment,{children:l.map((s,c)=>a.test(s)?h.jsx("mark",{className:"bg-primary/20 text-foreground rounded-sm px-0.5",children:s},c):h.jsx("span",{children:s},c))})}function Xp({value:t,onChange:r,onSearch:a,onCreateNew:l,options:s,isLoading:c=!1,placeholder:u="Search...",icon:d,entityName:m,disabled:v=!1}){const[b,y]=g.useState(!1),[w,C]=g.useState(""),E=g.useRef(null),S=g.useRef(null),R=z=>{const k=z.target.value;C(k),a(k)},M=z=>{r(z),y(!1),C("")},O=z=>{z.stopPropagation(),r(null),C("")},_=()=>{y(!1),C(""),l()};return g.useEffect(()=>{const z=k=>{E.current&&!E.current.contains(k.target)&&y(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]),g.useEffect(()=>{b&&S.current&&S.current.focus()},[b]),g.useEffect(()=>{b&&a(w)},[b]),h.jsxs("div",{ref:E,className:"relative",children:[t?h.jsxs("div",{className:ye("flex items-center gap-2 h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",!v&&"cursor-pointer hover:bg-muted/50",v&&"opacity-50 cursor-not-allowed"),onClick:()=>!v&&y(!0),children:[h.jsx(d,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:"truncate block",children:t.name}),t.subtitle&&h.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:t.subtitle})]}),!v&&h.jsx(Ge,{type:"button",variant:"ghost",size:"sm",className:"h-5 w-5 p-0 hover:bg-muted",onClick:O,children:h.jsx(xp,{className:"h-3 w-3"})})]}):h.jsxs("div",{className:ye("flex items-center gap-2 h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-muted-foreground",!v&&"cursor-pointer hover:bg-muted/50",v&&"opacity-50 cursor-not-allowed"),onClick:()=>!v&&y(!0),children:[h.jsx(d,{className:"h-4 w-4 flex-shrink-0"}),h.jsx("span",{children:u})]}),b&&h.jsxs("div",{className:"absolute z-[100] top-full left-0 right-0 mt-1 bg-popover border border-border rounded-md shadow-lg overflow-hidden",children:[h.jsx("div",{className:"p-2 border-b",children:h.jsxs("div",{className:"relative",children:[h.jsx(AO,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(An,{ref:S,value:w,onChange:R,placeholder:"Search by name or email...",className:"pl-8 h-9"})]})}),h.jsx("div",{className:"max-h-[200px] overflow-y-auto",children:c?h.jsx("div",{className:"flex items-center justify-center py-4",children:h.jsx(Yn,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):s.length>0?h.jsx("div",{className:"py-1",children:s.map(z=>h.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-muted/50 transition-colors text-left",onClick:()=>M(z),children:[h.jsx(d,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:"block truncate",children:h.jsx(wx,{text:z.name,highlight:w})}),z.subtitle&&h.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:h.jsx(wx,{text:z.subtitle,highlight:w})})]})]},z.id))}):h.jsxs("div",{className:"py-4 text-center text-sm text-muted-foreground",children:["No ",m.toLowerCase()," found"]})}),h.jsx("div",{className:"p-2 border-t",children:h.jsxs(Ge,{type:"button",variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-primary hover:text-primary hover:bg-primary/10",onClick:_,children:[h.jsx($i,{className:"h-4 w-4"}),"Create new ",m.toLowerCase()]})})]})]})}function $p({open:t,onOpenChange:r,contactId:a,onSuccess:l,layer:s=0}){const c=!a,[u,d]=g.useState(""),[m,v]=g.useState(!1),{data:b,isLoading:y}=$e.contacts.getById.useQuery({id:a},{enabled:!!a&&t}),{data:w,isLoading:C}=$e.companies.search.useQuery({query:u,limit:5},{enabled:t}),E=()=>{if(c||!b?.company?.[0])return null;const he=b.company[0];return!he.id||!he.name?null:{id:he.id,name:he.name,subtitle:he.website}},S=c?"":b?.firstName||"",R=c?"":b?.lastName||"",M=c?"":b?.mail||"",O=c?"":b?.phone1||"",_=c?"":b?.phone2||"",z=c?"":b?.notes||"",k=E(),[I,N]=g.useState(""),[T,A]=g.useState(""),[q,K]=g.useState(""),[W,ue]=g.useState(""),[le,de]=g.useState(""),[L,G]=g.useState(""),[B,ee]=g.useState(null),[ie,D]=g.useState(!1);t&&!y&&!ie&&(N(S),A(R),K(M),ue(O),de(_),G(z),ee(k),D(!0)),!t&&ie&&D(!1);const Q=c?B!==null:B?.id!==k?.id,J=c?I.trim().length>0||T.trim().length>0:I!==S||T!==R||q!==M||W!==O||le!==_||L!==z||Q,ne=$e.contacts.create.useMutation({onSuccess:he=>{const dt=he?.id?{id:he.id,firstName:I,lastName:T,mail:q||void 0}:void 0;l?.(dt),r(!1)}}),fe=$e.contacts.update.useMutation({onSuccess:()=>{l?.(),r(!1)}}),me=$e.contacts.delete.useMutation({onSuccess:()=>{l?.(),r(!1)}}),re=()=>{c?I.trim()&&T.trim()&&ne.mutate({firstName:I,lastName:T,mail:q||void 0,phone1:W||void 0,phone2:le||void 0,notes:L||void 0,company:B?[B.id]:void 0}):a&&J&&fe.mutate({id:a,firstName:I||void 0,lastName:T||void 0,mail:q||void 0,phone1:W||void 0,phone2:le||void 0,notes:L||void 0,company:B?[B.id]:[]})},De=()=>{a&&me.mutate({id:a})},Ae=()=>{d("")},Te=ne.isPending||fe.isPending,Ue=(w||[]).filter(he=>he.id!==void 0&&he.name!==void 0).map(he=>({id:he.id,name:he.name,subtitle:he.website}));return h.jsxs(h.Fragment,{children:[h.jsxs(Rd,{open:t,onOpenChange:r,title:c?"New Contact":"Contact Details",description:c?"Create a new contact record":"View and edit contact information",icon:h.jsx(zn,{className:"h-5 w-5 text-primary"}),isCreateMode:c,isLoading:y,hasChanges:J,isPending:Te,isDeletePending:me.isPending,onSave:re,onDelete:c?void 0:De,layer:s,footer:!c&&b?h.jsx("div",{className:"pt-4 border-t",children:h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Created: ",b.createdAt?new Date(b.createdAt).toLocaleDateString():"-",b.updatedAt&&h.jsxs(h.Fragment,{children:[" | Updated: ",new Date(b.updatedAt).toLocaleDateString()]})]})}):void 0,children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"firstName",children:"First Name *"}),h.jsx(An,{id:"firstName",value:I,onChange:he=>N(he.target.value),placeholder:"John"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"lastName",children:"Last Name *"}),h.jsx(An,{id:"lastName",value:T,onChange:he=>A(he.target.value),placeholder:"Doe"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"mail",children:"Email"}),h.jsxs("div",{className:"relative",children:[h.jsx(bp,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(An,{id:"mail",type:"email",value:q,onChange:he=>K(he.target.value),placeholder:"john@example.com",className:"pl-10"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"phone1",children:"Phone 1"}),h.jsxs("div",{className:"relative",children:[h.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(An,{id:"phone1",value:W,onChange:he=>ue(he.target.value),placeholder:"+1 234 567 890",className:"pl-10"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"phone2",children:"Phone 2"}),h.jsxs("div",{className:"relative",children:[h.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(An,{id:"phone2",value:le,onChange:he=>de(he.target.value),placeholder:"+1 234 567 890",className:"pl-10"})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{children:"Company"}),h.jsx(Xp,{value:B,onChange:ee,onSearch:d,onCreateNew:()=>v(!0),options:Ue,isLoading:C,placeholder:"Select a company...",icon:ma,entityName:"Company"})]}),h.jsxs("div",{className:"space-y-2 flex-1",children:[h.jsx(kt,{htmlFor:"notes",children:"Notes"}),h.jsx(gd,{id:"notes",value:L,onChange:he=>G(he.target.value),placeholder:"Add any notes about this contact...",className:"min-h-[120px] resize-none"})]})]}),h.jsx(CC,{open:m,onOpenChange:v,companyId:null,layer:s+1,onSuccess:he=>{Ae(),he&&ee({id:he.id,name:he.name,subtitle:he.website}),v(!1)}})]})}function K5(){const r=!!Sa().state?.openCreate,[a,l]=g.useState(r),[s,c]=g.useState(null);g.useLayoutEffect(()=>{r&&window.history.replaceState({},document.title)},[r]);const{data:u,isLoading:d,refetch:m}=$e.contacts.getAll.useQuery(),v=C=>C?new Date(C).toLocaleDateString():"-",b=C=>{c(C),l(!0)},y=()=>{c(null),l(!0)},w=()=>{m()};return h.jsxs("div",{className:"container mx-auto p-6 max-w-6xl space-y-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 border border-primary/20",children:h.jsx(zn,{className:"h-6 w-6 text-primary"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Contacts"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your contact records"})]})]}),h.jsxs(Ge,{onClick:y,children:[h.jsx($i,{className:"h-4 w-4 mr-2"}),"New Contact"]})]}),h.jsxs(cr,{children:[h.jsxs(ur,{className:"pb-4",children:[h.jsx(dr,{className:"text-lg",children:"All Contacts"}),h.jsxs(no,{children:[u?.length??0," ",u?.length===1?"contact":"contacts"]})]}),h.jsx(fr,{children:d?h.jsx("div",{className:"flex items-center justify-center py-12",children:h.jsx(Yn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):u&&u.length>0?h.jsx("div",{className:"rounded-lg border",children:h.jsxs(Us,{children:[h.jsx(Bs,{children:h.jsxs(ya,{children:[h.jsx($t,{children:"Name"}),h.jsx($t,{children:"Email"}),h.jsx($t,{children:"Phone"}),h.jsx($t,{children:"Created"})]})}),h.jsx(Hs,{children:u.map(C=>h.jsxs(ya,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>C.id&&b(C.id),children:[h.jsx(Zt,{className:"font-medium",children:[C.firstName,C.lastName].filter(Boolean).join(" ")||"-"}),h.jsx(Zt,{children:C.mail?h.jsxs("span",{className:"inline-flex items-center gap-1.5 text-primary",onClick:E=>{E.stopPropagation(),window.location.href=`mailto:${C.mail}`},children:[h.jsx(bp,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hover:underline",children:C.mail})]}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Zt,{children:C.phone1?h.jsxs("span",{className:"inline-flex items-center gap-1.5 text-primary",onClick:E=>{E.stopPropagation(),window.location.href=`tel:${C.phone1}`},children:[h.jsx(pa,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hover:underline",children:C.phone1})]}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Zt,{className:"text-muted-foreground",children:v(C.createdAt)})]},C.id))})]})}):h.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[h.jsx(zn,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),h.jsx("p",{children:"No contacts yet."}),h.jsx(Ge,{variant:"link",onClick:y,className:"mt-2",children:"Create your first contact"})]})})]}),h.jsx($p,{open:a,onOpenChange:l,contactId:s,onSuccess:w})]})}function Cx(t,[r,a]){return Math.min(a,Math.max(r,t))}function X5(t){const r=g.useRef({value:t,previous:t});return g.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}var NC=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),$5="VisuallyHidden",Z5=g.forwardRef((t,r)=>h.jsx(Ie.span,{...t,ref:r,style:{...NC,...t.style}}));Z5.displayName=$5;var J5=[" ","Enter","ArrowUp","ArrowDown"],W5=[" ","Enter"],Fi="Select",[Md,Od,ez]=wp(Fi),[ro]=si(Fi,[ez,id]),Dd=id(),[tz,ui]=ro(Fi),[nz,rz]=ro(Fi),EC=t=>{const{__scopeSelect:r,children:a,open:l,defaultOpen:s,onOpenChange:c,value:u,defaultValue:d,onValueChange:m,dir:v,name:b,autoComplete:y,disabled:w,required:C,form:E}=t,S=Dd(r),[R,M]=g.useState(null),[O,_]=g.useState(null),[z,k]=g.useState(!1),I=Ju(v),[N,T]=Gl({prop:l,defaultProp:s??!1,onChange:c,caller:Fi}),[A,q]=Gl({prop:u,defaultProp:d,onChange:m,caller:Fi}),K=g.useRef(null),W=R?E||!!R.closest("form"):!0,[ue,le]=g.useState(new Set),de=Array.from(ue).map(L=>L.props.value).join(";");return h.jsx(Sw,{...S,children:h.jsxs(tz,{required:C,scope:r,trigger:R,onTriggerChange:M,valueNode:O,onValueNodeChange:_,valueNodeHasChildren:z,onValueNodeHasChildrenChange:k,contentId:Br(),value:A,onValueChange:q,open:N,onOpenChange:T,dir:I,triggerPointerDownPosRef:K,disabled:w,children:[h.jsx(Md.Provider,{scope:r,children:h.jsx(nz,{scope:t.__scopeSelect,onNativeOptionAdd:g.useCallback(L=>{le(G=>new Set(G).add(L))},[]),onNativeOptionRemove:g.useCallback(L=>{le(G=>{const B=new Set(G);return B.delete(L),B})},[]),children:a})}),W?h.jsxs(XC,{"aria-hidden":!0,required:C,tabIndex:-1,name:b,autoComplete:y,value:A,onChange:L=>q(L.target.value),disabled:w,form:E,children:[A===void 0?h.jsx("option",{value:""}):null,Array.from(ue)]},de):null]})})};EC.displayName=Fi;var jC="SelectTrigger",RC=g.forwardRef((t,r)=>{const{__scopeSelect:a,disabled:l=!1,...s}=t,c=Dd(a),u=ui(jC,a),d=u.disabled||l,m=mt(r,u.onTriggerChange),v=Od(a),b=g.useRef("touch"),[y,w,C]=ZC(S=>{const R=v().filter(_=>!_.disabled),M=R.find(_=>_.value===u.value),O=JC(R,S,M);O!==void 0&&u.onValueChange(O.value)}),E=S=>{d||(u.onOpenChange(!0),C()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return h.jsx(ww,{asChild:!0,...c,children:h.jsx(Ie.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":$C(u.value)?"":void 0,...s,ref:m,onClick:Re(s.onClick,S=>{S.currentTarget.focus(),b.current!=="mouse"&&E(S)}),onPointerDown:Re(s.onPointerDown,S=>{b.current=S.pointerType;const R=S.target;R.hasPointerCapture(S.pointerId)&&R.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(E(S),S.preventDefault())}),onKeyDown:Re(s.onKeyDown,S=>{const R=y.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(R&&S.key===" ")&&J5.includes(S.key)&&(E(),S.preventDefault())})})})});RC.displayName=jC;var MC="SelectValue",OC=g.forwardRef((t,r)=>{const{__scopeSelect:a,className:l,style:s,children:c,placeholder:u="",...d}=t,m=ui(MC,a),{onValueNodeHasChildrenChange:v}=m,b=c!==void 0,y=mt(r,m.onValueNodeChange);return hn(()=>{v(b)},[v,b]),h.jsx(Ie.span,{...d,ref:y,style:{pointerEvents:"none"},children:$C(m.value)?h.jsx(h.Fragment,{children:u}):c})});OC.displayName=MC;var az="SelectIcon",DC=g.forwardRef((t,r)=>{const{__scopeSelect:a,children:l,...s}=t;return h.jsx(Ie.span,{"aria-hidden":!0,...s,ref:r,children:l||"▼"})});DC.displayName=az;var iz="SelectPortal",TC=t=>h.jsx(ld,{asChild:!0,...t});TC.displayName=iz;var Gi="SelectContent",_C=g.forwardRef((t,r)=>{const a=ui(Gi,t.__scopeSelect),[l,s]=g.useState();if(hn(()=>{s(new DocumentFragment)},[]),!a.open){const c=l;return c?Sr.createPortal(h.jsx(AC,{scope:t.__scopeSelect,children:h.jsx(Md.Slot,{scope:t.__scopeSelect,children:h.jsx("div",{children:t.children})})}),c):null}return h.jsx(zC,{...t,ref:r})});_C.displayName=Gi;var br=10,[AC,di]=ro(Gi),lz="SelectContentImpl",oz=Yl("SelectContent.RemoveScroll"),zC=g.forwardRef((t,r)=>{const{__scopeSelect:a,position:l="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:c,onPointerDownOutside:u,side:d,sideOffset:m,align:v,alignOffset:b,arrowPadding:y,collisionBoundary:w,collisionPadding:C,sticky:E,hideWhenDetached:S,avoidCollisions:R,...M}=t,O=ui(Gi,a),[_,z]=g.useState(null),[k,I]=g.useState(null),N=mt(r,re=>z(re)),[T,A]=g.useState(null),[q,K]=g.useState(null),W=Od(a),[ue,le]=g.useState(!1),de=g.useRef(!1);g.useEffect(()=>{if(_)return _p(_)},[_]),Cp();const L=g.useCallback(re=>{const[De,...Ae]=W().map(he=>he.ref.current),[Te]=Ae.slice(-1),Ue=document.activeElement;for(const he of re)if(he===Ue||(he?.scrollIntoView({block:"nearest"}),he===De&&k&&(k.scrollTop=0),he===Te&&k&&(k.scrollTop=k.scrollHeight),he?.focus(),document.activeElement!==Ue))return},[W,k]),G=g.useCallback(()=>L([T,_]),[L,T,_]);g.useEffect(()=>{ue&&G()},[ue,G]);const{onOpenChange:B,triggerPointerDownPosRef:ee}=O;g.useEffect(()=>{if(_){let re={x:0,y:0};const De=Te=>{re={x:Math.abs(Math.round(Te.pageX)-(ee.current?.x??0)),y:Math.abs(Math.round(Te.pageY)-(ee.current?.y??0))}},Ae=Te=>{re.x<=10&&re.y<=10?Te.preventDefault():_.contains(Te.target)||B(!1),document.removeEventListener("pointermove",De),ee.current=null};return ee.current!==null&&(document.addEventListener("pointermove",De),document.addEventListener("pointerup",Ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",Ae,{capture:!0})}}},[_,B,ee]),g.useEffect(()=>{const re=()=>B(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[B]);const[ie,D]=ZC(re=>{const De=W().filter(Ue=>!Ue.disabled),Ae=De.find(Ue=>Ue.ref.current===document.activeElement),Te=JC(De,re,Ae);Te&&setTimeout(()=>Te.ref.current.focus())}),Q=g.useCallback((re,De,Ae)=>{const Te=!de.current&&!Ae;(O.value!==void 0&&O.value===De||Te)&&(A(re),Te&&(de.current=!0))},[O.value]),J=g.useCallback(()=>_?.focus(),[_]),ne=g.useCallback((re,De,Ae)=>{const Te=!de.current&&!Ae;(O.value!==void 0&&O.value===De||Te)&&K(re)},[O.value]),fe=l==="popper"?Gm:LC,me=fe===Gm?{side:d,sideOffset:m,align:v,alignOffset:b,arrowPadding:y,collisionBoundary:w,collisionPadding:C,sticky:E,hideWhenDetached:S,avoidCollisions:R}:{};return h.jsx(AC,{scope:a,content:_,viewport:k,onViewportChange:I,itemRefCallback:Q,selectedItem:T,onItemLeave:J,itemTextRefCallback:ne,focusSelectedItem:G,selectedItemText:q,position:l,isPositioned:ue,searchRef:ie,children:h.jsx(cd,{as:oz,allowPinchZoom:!0,children:h.jsx(ed,{asChild:!0,trapped:O.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Re(s,re=>{O.trigger?.focus({preventScroll:!0}),re.preventDefault()}),children:h.jsx(Wu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:h.jsx(fe,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:re=>re.preventDefault(),...M,...me,onPlaced:()=>le(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:Re(M.onKeyDown,re=>{const De=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!De&&re.key.length===1&&D(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let Te=W().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);if(["ArrowUp","End"].includes(re.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Ue=re.target,he=Te.indexOf(Ue);Te=Te.slice(he+1)}setTimeout(()=>L(Te)),re.preventDefault()}})})})})})})});zC.displayName=lz;var sz="SelectItemAlignedPosition",LC=g.forwardRef((t,r)=>{const{__scopeSelect:a,onPlaced:l,...s}=t,c=ui(Gi,a),u=di(Gi,a),[d,m]=g.useState(null),[v,b]=g.useState(null),y=mt(r,N=>b(N)),w=Od(a),C=g.useRef(!1),E=g.useRef(!0),{viewport:S,selectedItem:R,selectedItemText:M,focusSelectedItem:O}=u,_=g.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&v&&S&&R&&M){const N=c.trigger.getBoundingClientRect(),T=v.getBoundingClientRect(),A=c.valueNode.getBoundingClientRect(),q=M.getBoundingClientRect();if(c.dir!=="rtl"){const Ue=q.left-T.left,he=A.left-Ue,dt=N.left-he,pt=N.width+dt,Sn=Math.max(pt,T.width),jt=window.innerWidth-br,Rr=Cx(he,[br,Math.max(br,jt-Sn)]);d.style.minWidth=pt+"px",d.style.left=Rr+"px"}else{const Ue=T.right-q.right,he=window.innerWidth-A.right-Ue,dt=window.innerWidth-N.right-he,pt=N.width+dt,Sn=Math.max(pt,T.width),jt=window.innerWidth-br,Rr=Cx(he,[br,Math.max(br,jt-Sn)]);d.style.minWidth=pt+"px",d.style.right=Rr+"px"}const K=w(),W=window.innerHeight-br*2,ue=S.scrollHeight,le=window.getComputedStyle(v),de=parseInt(le.borderTopWidth,10),L=parseInt(le.paddingTop,10),G=parseInt(le.borderBottomWidth,10),B=parseInt(le.paddingBottom,10),ee=de+L+ue+B+G,ie=Math.min(R.offsetHeight*5,ee),D=window.getComputedStyle(S),Q=parseInt(D.paddingTop,10),J=parseInt(D.paddingBottom,10),ne=N.top+N.height/2-br,fe=W-ne,me=R.offsetHeight/2,re=R.offsetTop+me,De=de+L+re,Ae=ee-De;if(De<=ne){const Ue=K.length>0&&R===K[K.length-1].ref.current;d.style.bottom="0px";const he=v.clientHeight-S.offsetTop-S.offsetHeight,dt=Math.max(fe,me+(Ue?J:0)+he+G),pt=De+dt;d.style.height=pt+"px"}else{const Ue=K.length>0&&R===K[0].ref.current;d.style.top="0px";const dt=Math.max(ne,de+S.offsetTop+(Ue?Q:0)+me)+Ae;d.style.height=dt+"px",S.scrollTop=De-ne+S.offsetTop}d.style.margin=`${br}px 0`,d.style.minHeight=ie+"px",d.style.maxHeight=W+"px",l?.(),requestAnimationFrame(()=>C.current=!0)}},[w,c.trigger,c.valueNode,d,v,S,R,M,c.dir,l]);hn(()=>_(),[_]);const[z,k]=g.useState();hn(()=>{v&&k(window.getComputedStyle(v).zIndex)},[v]);const I=g.useCallback(N=>{N&&E.current===!0&&(_(),O?.(),E.current=!1)},[_,O]);return h.jsx(uz,{scope:a,contentWrapper:d,shouldExpandOnScrollRef:C,onScrollButtonChange:I,children:h.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:h.jsx(Ie.div,{...s,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});LC.displayName=sz;var cz="SelectPopperPosition",Gm=g.forwardRef((t,r)=>{const{__scopeSelect:a,align:l="start",collisionPadding:s=br,...c}=t,u=Dd(a);return h.jsx(Cw,{...u,...c,ref:r,align:l,collisionPadding:s,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Gm.displayName=cz;var[uz,Zp]=ro(Gi,{}),Ym="SelectViewport",kC=g.forwardRef((t,r)=>{const{__scopeSelect:a,nonce:l,...s}=t,c=di(Ym,a),u=Zp(Ym,a),d=mt(r,c.onViewportChange),m=g.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),h.jsx(Md.Slot,{scope:a,children:h.jsx(Ie.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Re(s.onScroll,v=>{const b=v.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:w}=u;if(w?.current&&y){const C=Math.abs(m.current-b.scrollTop);if(C>0){const E=window.innerHeight-br*2,S=parseFloat(y.style.minHeight),R=parseFloat(y.style.height),M=Math.max(S,R);if(M0?z:0,y.style.justifyContent="flex-end")}}}m.current=b.scrollTop})})})]})});kC.displayName=Ym;var PC="SelectGroup",[dz,fz]=ro(PC),hz=g.forwardRef((t,r)=>{const{__scopeSelect:a,...l}=t,s=Br();return h.jsx(dz,{scope:a,id:s,children:h.jsx(Ie.div,{role:"group","aria-labelledby":s,...l,ref:r})})});hz.displayName=PC;var UC="SelectLabel",BC=g.forwardRef((t,r)=>{const{__scopeSelect:a,...l}=t,s=fz(UC,a);return h.jsx(Ie.div,{id:s.id,...l,ref:r})});BC.displayName=UC;var qu="SelectItem",[mz,HC]=ro(qu),qC=g.forwardRef((t,r)=>{const{__scopeSelect:a,value:l,disabled:s=!1,textValue:c,...u}=t,d=ui(qu,a),m=di(qu,a),v=d.value===l,[b,y]=g.useState(c??""),[w,C]=g.useState(!1),E=mt(r,O=>m.itemRefCallback?.(O,l,s)),S=Br(),R=g.useRef("touch"),M=()=>{s||(d.onValueChange(l),d.onOpenChange(!1))};if(l==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(mz,{scope:a,value:l,disabled:s,textId:S,isSelected:v,onItemTextChange:g.useCallback(O=>{y(_=>_||(O?.textContent??"").trim())},[]),children:h.jsx(Md.ItemSlot,{scope:a,value:l,disabled:s,textValue:b,children:h.jsx(Ie.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":v&&w,"data-state":v?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:E,onFocus:Re(u.onFocus,()=>C(!0)),onBlur:Re(u.onBlur,()=>C(!1)),onClick:Re(u.onClick,()=>{R.current!=="mouse"&&M()}),onPointerUp:Re(u.onPointerUp,()=>{R.current==="mouse"&&M()}),onPointerDown:Re(u.onPointerDown,O=>{R.current=O.pointerType}),onPointerMove:Re(u.onPointerMove,O=>{R.current=O.pointerType,s?m.onItemLeave?.():R.current==="mouse"&&O.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Re(u.onPointerLeave,O=>{O.currentTarget===document.activeElement&&m.onItemLeave?.()}),onKeyDown:Re(u.onKeyDown,O=>{m.searchRef?.current!==""&&O.key===" "||(W5.includes(O.key)&&M(),O.key===" "&&O.preventDefault())})})})})});qC.displayName=qu;var is="SelectItemText",IC=g.forwardRef((t,r)=>{const{__scopeSelect:a,className:l,style:s,...c}=t,u=ui(is,a),d=di(is,a),m=HC(is,a),v=rz(is,a),[b,y]=g.useState(null),w=mt(r,M=>y(M),m.onItemTextChange,M=>d.itemTextRefCallback?.(M,m.value,m.disabled)),C=b?.textContent,E=g.useMemo(()=>h.jsx("option",{value:m.value,disabled:m.disabled,children:C},m.value),[m.disabled,m.value,C]),{onNativeOptionAdd:S,onNativeOptionRemove:R}=v;return hn(()=>(S(E),()=>R(E)),[S,R,E]),h.jsxs(h.Fragment,{children:[h.jsx(Ie.span,{id:m.textId,...c,ref:w}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Sr.createPortal(c.children,u.valueNode):null]})});IC.displayName=is;var QC="SelectItemIndicator",VC=g.forwardRef((t,r)=>{const{__scopeSelect:a,...l}=t;return HC(QC,a).isSelected?h.jsx(Ie.span,{"aria-hidden":!0,...l,ref:r}):null});VC.displayName=QC;var Km="SelectScrollUpButton",FC=g.forwardRef((t,r)=>{const a=di(Km,t.__scopeSelect),l=Zp(Km,t.__scopeSelect),[s,c]=g.useState(!1),u=mt(r,l.onScrollButtonChange);return hn(()=>{if(a.viewport&&a.isPositioned){let d=function(){const v=m.scrollTop>0;c(v)};const m=a.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),s?h.jsx(YC,{...t,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=a;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});FC.displayName=Km;var Xm="SelectScrollDownButton",GC=g.forwardRef((t,r)=>{const a=di(Xm,t.__scopeSelect),l=Zp(Xm,t.__scopeSelect),[s,c]=g.useState(!1),u=mt(r,l.onScrollButtonChange);return hn(()=>{if(a.viewport&&a.isPositioned){let d=function(){const v=m.scrollHeight-m.clientHeight,b=Math.ceil(m.scrollTop)m.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),s?h.jsx(YC,{...t,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=a;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});GC.displayName=Xm;var YC=g.forwardRef((t,r)=>{const{__scopeSelect:a,onAutoScroll:l,...s}=t,c=di("SelectScrollButton",a),u=g.useRef(null),d=Od(a),m=g.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return g.useEffect(()=>()=>m(),[m]),hn(()=>{d().find(b=>b.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),h.jsx(Ie.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:Re(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(l,50))}),onPointerMove:Re(s.onPointerMove,()=>{c.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(l,50))}),onPointerLeave:Re(s.onPointerLeave,()=>{m()})})}),pz="SelectSeparator",KC=g.forwardRef((t,r)=>{const{__scopeSelect:a,...l}=t;return h.jsx(Ie.div,{"aria-hidden":!0,...l,ref:r})});KC.displayName=pz;var $m="SelectArrow",vz=g.forwardRef((t,r)=>{const{__scopeSelect:a,...l}=t,s=Dd(a),c=ui($m,a),u=di($m,a);return c.open&&u.position==="popper"?h.jsx(Nw,{...s,...l,ref:r}):null});vz.displayName=$m;var gz="SelectBubbleInput",XC=g.forwardRef(({__scopeSelect:t,value:r,...a},l)=>{const s=g.useRef(null),c=mt(l,s),u=X5(r);return g.useEffect(()=>{const d=s.current;if(!d)return;const m=window.HTMLSelectElement.prototype,b=Object.getOwnPropertyDescriptor(m,"value").set;if(u!==r&&b){const y=new Event("change",{bubbles:!0});b.call(d,r),d.dispatchEvent(y)}},[u,r]),h.jsx(Ie.select,{...a,style:{...NC,...a.style},ref:c,defaultValue:r})});XC.displayName=gz;function $C(t){return t===""||t===void 0}function ZC(t){const r=qr(t),a=g.useRef(""),l=g.useRef(0),s=g.useCallback(u=>{const d=a.current+u;r(d),(function m(v){a.current=v,window.clearTimeout(l.current),v!==""&&(l.current=window.setTimeout(()=>m(""),1e3))})(d)},[r]),c=g.useCallback(()=>{a.current="",window.clearTimeout(l.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(l.current),[]),[a,s,c]}function JC(t,r,a){const s=r.length>1&&Array.from(r).every(v=>v===r[0])?r[0]:r,c=a?t.indexOf(a):-1;let u=yz(t,Math.max(c,0));s.length===1&&(u=u.filter(v=>v!==a));const m=u.find(v=>v.textValue.toLowerCase().startsWith(s.toLowerCase()));return m!==a?m:void 0}function yz(t,r){return t.map((a,l)=>t[(r+l)%t.length])}var bz=EC,WC=RC,xz=OC,Sz=DC,wz=TC,eN=_C,Cz=kC,tN=BC,nN=qC,Nz=IC,Ez=VC,rN=FC,aN=GC,iN=KC;const Xl=bz,$l=xz,Yi=g.forwardRef(({className:t,children:r,...a},l)=>h.jsxs(WC,{ref:l,className:ye("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[r,h.jsx(Sz,{asChild:!0,children:h.jsx($u,{className:"h-4 w-4 opacity-50"})})]}));Yi.displayName=WC.displayName;const lN=g.forwardRef(({className:t,...r},a)=>h.jsx(rN,{ref:a,className:ye("flex cursor-default items-center justify-center py-1",t),...r,children:h.jsx(GM,{className:"h-4 w-4"})}));lN.displayName=rN.displayName;const oN=g.forwardRef(({className:t,...r},a)=>h.jsx(aN,{ref:a,className:ye("flex cursor-default items-center justify-center py-1",t),...r,children:h.jsx($u,{className:"h-4 w-4"})}));oN.displayName=aN.displayName;const Ki=g.forwardRef(({className:t,children:r,position:a="popper",...l},s)=>h.jsx(wz,{children:h.jsxs(eN,{ref:s,className:ye("relative z-[350] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...l,children:[h.jsx(lN,{}),h.jsx(Cz,{className:ye("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),h.jsx(oN,{})]})}));Ki.displayName=eN.displayName;const jz=g.forwardRef(({className:t,...r},a)=>h.jsx(tN,{ref:a,className:ye("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...r}));jz.displayName=tN.displayName;const _n=g.forwardRef(({className:t,children:r,...a},l)=>h.jsxs(nN,{ref:l,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Ez,{children:h.jsx(DS,{className:"h-4 w-4"})})}),h.jsx(Nz,{children:r})]}));_n.displayName=nN.displayName;const Rz=g.forwardRef(({className:t,...r},a)=>h.jsx(iN,{ref:a,className:ye("-mx-1 my-1 h-px bg-muted",t),...r}));Rz.displayName=iN.displayName;const ao={New:{label:"New",icon:LO,color:"text-blue-500",bgColor:"bg-blue-500/10"},"Demo scheduled":{label:"Demo scheduled",icon:Os,color:"text-amber-500",bgColor:"bg-amber-500/10"},"Contract signed":{label:"Contract signed",icon:sO,color:"text-green-500",bgColor:"bg-green-500/10"},Lost:{label:"Lost",icon:XM,color:"text-red-500",bgColor:"bg-red-500/10"}},sN=Object.keys(ao);function Mz({phase:t}){const r=ao[t];if(!r)return h.jsx("span",{children:t});const a=r.icon;return h.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[h.jsx("div",{className:`p-1 rounded ${r.bgColor}`,children:h.jsx(a,{className:`h-3.5 w-3.5 ${r.color}`})}),h.jsx("span",{className:r.color,children:r.label})]})}function Nx({phase:t}){const r=ao[t];if(!r)return h.jsx("span",{children:t});const a=r.icon;return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:`p-1 rounded ${r.bgColor}`,children:h.jsx(a,{className:`h-3.5 w-3.5 ${r.color}`})}),h.jsx("span",{children:r.label})]})}function Oz(t){return[t.firstName,t.lastName].filter(Boolean).join(" ")||"Unknown"}function Dz({open:t,onOpenChange:r,dealId:a,onSuccess:l,layer:s=0}){const c=!a,[u,d]=g.useState(""),[m,v]=g.useState(!1),{data:b,isLoading:y}=$e.deals.getById.useQuery({id:a},{enabled:!!a&&t}),{data:w,isLoading:C}=$e.contacts.search.useQuery({query:u,limit:5},{enabled:t}),E=b,S=()=>{if(c||!E?.mainContact?.[0])return null;const D=E.mainContact[0];return D.id?{id:D.id,name:Oz(D),subtitle:D.mail}:null},R=c?"":E?.name||"",M=c?"New":E?.phase||"New",O=S(),[_,z]=g.useState(""),[k,I]=g.useState("New"),[N,T]=g.useState(null),[A,q]=g.useState(!1);t&&!y&&!A&&(z(R),I(M),T(O),q(!0)),!t&&A&&q(!1);const K=c?N!==null:N?.id!==O?.id,W=c?_.trim().length>0:_!==R||k!==M||K,ue=$e.deals.create.useMutation({onSuccess:()=>{l?.(),r(!1)}}),le=$e.deals.update.useMutation({onSuccess:()=>{l?.(),r(!1)}}),de=$e.deals.delete.useMutation({onSuccess:()=>{l?.(),r(!1)}}),L=()=>{c?_.trim()&&ue.mutate({name:_,phase:k,mainContact:N?[N.id]:void 0}):a&&W&&le.mutate({id:a,name:_||void 0,phase:k,mainContact:N?[N.id]:[]})},G=()=>{a&&de.mutate({id:a})},B=()=>{d("")},ee=ue.isPending||le.isPending,ie=(w||[]).filter(D=>D.id!==void 0&&D.firstName!==void 0&&D.lastName!==void 0).map(D=>({id:D.id,name:`${D.firstName} ${D.lastName}`,subtitle:D.mail}));return h.jsxs(h.Fragment,{children:[h.jsxs(Rd,{open:t,onOpenChange:r,title:c?"New Deal":"Deal Details",description:c?"Create a new deal record":"View and edit deal information",icon:h.jsx(ni,{className:"h-5 w-5 text-primary"}),isCreateMode:c,isLoading:y,hasChanges:W,isPending:ee,isDeletePending:de.isPending,onSave:L,onDelete:c?void 0:G,layer:s,footer:!c&&E?h.jsx("div",{className:"pt-4 border-t",children:h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Created: ",E.createdAt?new Date(E.createdAt).toLocaleDateString():"-",E.updatedAt&&h.jsxs(h.Fragment,{children:[" | Updated: ",new Date(E.updatedAt).toLocaleDateString()]})]})}):void 0,children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"name",children:"Deal Name *"}),h.jsx(An,{id:"name",value:_,onChange:D=>z(D.target.value),placeholder:"Enterprise Contract Q1"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"phase",children:"Phase *"}),h.jsxs(Xl,{value:k,onValueChange:D=>I(D),children:[h.jsx(Yi,{id:"phase",children:h.jsx($l,{children:h.jsx(Nx,{phase:k})})}),h.jsx(Ki,{children:sN.map(D=>h.jsx(_n,{value:D,children:h.jsx(Nx,{phase:D})},D))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{children:"Main Contact"}),h.jsx(Xp,{value:N,onChange:T,onSearch:d,onCreateNew:()=>v(!0),options:ie,isLoading:C,placeholder:"Select a contact...",icon:zn,entityName:"Contact"})]})]}),h.jsx($p,{open:m,onOpenChange:v,contactId:null,layer:s+1,onSuccess:D=>{B(),D&&T({id:D.id,name:`${D.firstName} ${D.lastName}`,subtitle:D.mail}),v(!1)}})]})}const Td=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function io(t){const r=Object.prototype.toString.call(t);return r==="[object Window]"||r==="[object global]"}function Jp(t){return"nodeType"in t}function xn(t){var r,a;return t?io(t)?t:Jp(t)&&(r=(a=t.ownerDocument)==null?void 0:a.defaultView)!=null?r:window:window}function Wp(t){const{Document:r}=xn(t);return t instanceof r}function Is(t){return io(t)?!1:t instanceof xn(t).HTMLElement}function cN(t){return t instanceof xn(t).SVGElement}function lo(t){return t?io(t)?t.document:Jp(t)?Wp(t)?t:Is(t)||cN(t)?t.ownerDocument:document:document:document}const ba=Td?g.useLayoutEffect:g.useEffect;function _d(t){const r=g.useRef(t);return ba(()=>{r.current=t}),g.useCallback(function(){for(var a=arguments.length,l=new Array(a),s=0;s{t.current=setInterval(l,s)},[]),a=g.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[r,a]}function Ss(t,r){r===void 0&&(r=[t]);const a=g.useRef(t);return ba(()=>{a.current!==t&&(a.current=t)},r),a}function Qs(t,r){const a=g.useRef();return g.useMemo(()=>{const l=t(a.current);return a.current=l,l},[...r])}function Iu(t){const r=_d(t),a=g.useRef(null),l=g.useCallback(s=>{s!==a.current&&r?.(s,a.current),a.current=s},[]);return[a,l]}function Qu(t){const r=g.useRef();return g.useEffect(()=>{r.current=t},[t]),r.current}let vm={};function Ad(t,r){return g.useMemo(()=>{if(r)return r;const a=vm[t]==null?0:vm[t]+1;return vm[t]=a,t+"-"+a},[t,r])}function uN(t){return function(r){for(var a=arguments.length,l=new Array(a>1?a-1:0),s=1;s{const d=Object.entries(u);for(const[m,v]of d){const b=c[m];b!=null&&(c[m]=b+t*v)}return c},{...r})}}const Vl=uN(1),Vu=uN(-1);function _z(t){return"clientX"in t&&"clientY"in t}function ev(t){if(!t)return!1;const{KeyboardEvent:r}=xn(t.target);return r&&t instanceof r}function Az(t){if(!t)return!1;const{TouchEvent:r}=xn(t.target);return r&&t instanceof r}function Fu(t){if(Az(t)){if(t.touches&&t.touches.length){const{clientX:r,clientY:a}=t.touches[0];return{x:r,y:a}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:r,clientY:a}=t.changedTouches[0];return{x:r,y:a}}}return _z(t)?{x:t.clientX,y:t.clientY}:null}const Zl=Object.freeze({Translate:{toString(t){if(!t)return;const{x:r,y:a}=t;return"translate3d("+(r?Math.round(r):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:r,scaleY:a}=t;return"scaleX("+r+") scaleY("+a+")"}},Transform:{toString(t){if(t)return[Zl.Translate.toString(t),Zl.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:r,duration:a,easing:l}=t;return r+" "+a+"ms "+l}}}),Ex="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function zz(t){return t.matches(Ex)?t:t.querySelector(Ex)}const Lz={display:"none"};function kz(t){let{id:r,value:a}=t;return ot.createElement("div",{id:r,style:Lz},a)}function Pz(t){let{id:r,announcement:a,ariaLiveType:l="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ot.createElement("div",{id:r,style:s,role:"status","aria-live":l,"aria-atomic":!0},a)}function Uz(){const[t,r]=g.useState("");return{announce:g.useCallback(l=>{l!=null&&r(l)},[]),announcement:t}}const dN=g.createContext(null);function Bz(t){const r=g.useContext(dN);g.useEffect(()=>{if(!r)throw new Error("useDndMonitor must be used within a children of ");return r(t)},[t,r])}function Hz(){const[t]=g.useState(()=>new Set),r=g.useCallback(l=>(t.add(l),()=>t.delete(l)),[t]);return[g.useCallback(l=>{let{type:s,event:c}=l;t.forEach(u=>{var d;return(d=u[s])==null?void 0:d.call(u,c)})},[t]),r]}const qz={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},Iz={onDragStart(t){let{active:r}=t;return"Picked up draggable item "+r.id+"."},onDragOver(t){let{active:r,over:a}=t;return a?"Draggable item "+r.id+" was moved over droppable area "+a.id+".":"Draggable item "+r.id+" is no longer over a droppable area."},onDragEnd(t){let{active:r,over:a}=t;return a?"Draggable item "+r.id+" was dropped over droppable area "+a.id:"Draggable item "+r.id+" was dropped."},onDragCancel(t){let{active:r}=t;return"Dragging was cancelled. Draggable item "+r.id+" was dropped."}};function Qz(t){let{announcements:r=Iz,container:a,hiddenTextDescribedById:l,screenReaderInstructions:s=qz}=t;const{announce:c,announcement:u}=Uz(),d=Ad("DndLiveRegion"),[m,v]=g.useState(!1);if(g.useEffect(()=>{v(!0)},[]),Bz(g.useMemo(()=>({onDragStart(y){let{active:w}=y;c(r.onDragStart({active:w}))},onDragMove(y){let{active:w,over:C}=y;r.onDragMove&&c(r.onDragMove({active:w,over:C}))},onDragOver(y){let{active:w,over:C}=y;c(r.onDragOver({active:w,over:C}))},onDragEnd(y){let{active:w,over:C}=y;c(r.onDragEnd({active:w,over:C}))},onDragCancel(y){let{active:w,over:C}=y;c(r.onDragCancel({active:w,over:C}))}}),[c,r])),!m)return null;const b=ot.createElement(ot.Fragment,null,ot.createElement(kz,{id:l,value:s.draggable}),ot.createElement(Pz,{id:d,announcement:u}));return a?Sr.createPortal(b,a):b}var Xt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Xt||(Xt={}));function Gu(){}function Vz(t,r){return g.useMemo(()=>({sensor:t,options:r??{}}),[t,r])}function Fz(){for(var t=arguments.length,r=new Array(t),a=0;a[...r].filter(l=>l!=null),[...r])}const Nr=Object.freeze({x:0,y:0});function Gz(t,r){const a=Fu(t);if(!a)return"0 0";const l={x:(a.x-r.left)/r.width*100,y:(a.y-r.top)/r.height*100};return l.x+"% "+l.y+"%"}function Yz(t,r){let{data:{value:a}}=t,{data:{value:l}}=r;return l-a}function Kz(t,r){if(!t||t.length===0)return null;const[a]=t;return a[r]}function Xz(t,r){const a=Math.max(r.top,t.top),l=Math.max(r.left,t.left),s=Math.min(r.left+r.width,t.left+t.width),c=Math.min(r.top+r.height,t.top+t.height),u=s-l,d=c-a;if(l{let{collisionRect:r,droppableRects:a,droppableContainers:l}=t;const s=[];for(const c of l){const{id:u}=c,d=a.get(u);if(d){const m=Xz(d,r);m>0&&s.push({id:u,data:{droppableContainer:c,value:m}})}}return s.sort(Yz)};function Zz(t,r,a){return{...t,scaleX:r&&a?r.width/a.width:1,scaleY:r&&a?r.height/a.height:1}}function fN(t,r){return t&&r?{x:t.left-r.left,y:t.top-r.top}:Nr}function Jz(t){return function(a){for(var l=arguments.length,s=new Array(l>1?l-1:0),c=1;c({...u,top:u.top+t*d.y,bottom:u.bottom+t*d.y,left:u.left+t*d.x,right:u.right+t*d.x}),{...a})}}const Wz=Jz(1);function hN(t){if(t.startsWith("matrix3d(")){const r=t.slice(9,-1).split(/, /);return{x:+r[12],y:+r[13],scaleX:+r[0],scaleY:+r[5]}}else if(t.startsWith("matrix(")){const r=t.slice(7,-1).split(/, /);return{x:+r[4],y:+r[5],scaleX:+r[0],scaleY:+r[3]}}return null}function eL(t,r,a){const l=hN(r);if(!l)return t;const{scaleX:s,scaleY:c,x:u,y:d}=l,m=t.left-u-(1-s)*parseFloat(a),v=t.top-d-(1-c)*parseFloat(a.slice(a.indexOf(" ")+1)),b=s?t.width/s:t.width,y=c?t.height/c:t.height;return{width:b,height:y,top:v,right:m+b,bottom:v+y,left:m}}const tL={ignoreTransform:!1};function Vs(t,r){r===void 0&&(r=tL);let a=t.getBoundingClientRect();if(r.ignoreTransform){const{transform:v,transformOrigin:b}=xn(t).getComputedStyle(t);v&&(a=eL(a,v,b))}const{top:l,left:s,width:c,height:u,bottom:d,right:m}=a;return{top:l,left:s,width:c,height:u,bottom:d,right:m}}function jx(t){return Vs(t,{ignoreTransform:!0})}function nL(t){const r=t.innerWidth,a=t.innerHeight;return{top:0,left:0,right:r,bottom:a,width:r,height:a}}function rL(t,r){return r===void 0&&(r=xn(t).getComputedStyle(t)),r.position==="fixed"}function aL(t,r){r===void 0&&(r=xn(t).getComputedStyle(t));const a=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const c=r[s];return typeof c=="string"?a.test(c):!1})}function tv(t,r){const a=[];function l(s){if(r!=null&&a.length>=r||!s)return a;if(Wp(s)&&s.scrollingElement!=null&&!a.includes(s.scrollingElement))return a.push(s.scrollingElement),a;if(!Is(s)||cN(s)||a.includes(s))return a;const c=xn(t).getComputedStyle(s);return s!==t&&aL(s,c)&&a.push(s),rL(s,c)?a:l(s.parentNode)}return t?l(t):a}function mN(t){const[r]=tv(t,1);return r??null}function gm(t){return!Td||!t?null:io(t)?t:Jp(t)?Wp(t)||t===lo(t).scrollingElement?window:Is(t)?t:null:null}function pN(t){return io(t)?t.scrollX:t.scrollLeft}function vN(t){return io(t)?t.scrollY:t.scrollTop}function Zm(t){return{x:pN(t),y:vN(t)}}var en;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(en||(en={}));function gN(t){return!Td||!t?!1:t===document.scrollingElement}function yN(t){const r={x:0,y:0},a=gN(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},l={x:t.scrollWidth-a.width,y:t.scrollHeight-a.height},s=t.scrollTop<=r.y,c=t.scrollLeft<=r.x,u=t.scrollTop>=l.y,d=t.scrollLeft>=l.x;return{isTop:s,isLeft:c,isBottom:u,isRight:d,maxScroll:l,minScroll:r}}const iL={x:.2,y:.2};function lL(t,r,a,l,s){let{top:c,left:u,right:d,bottom:m}=a;l===void 0&&(l=10),s===void 0&&(s=iL);const{isTop:v,isBottom:b,isLeft:y,isRight:w}=yN(t),C={x:0,y:0},E={x:0,y:0},S={height:r.height*s.y,width:r.width*s.x};return!v&&c<=r.top+S.height?(C.y=en.Backward,E.y=l*Math.abs((r.top+S.height-c)/S.height)):!b&&m>=r.bottom-S.height&&(C.y=en.Forward,E.y=l*Math.abs((r.bottom-S.height-m)/S.height)),!w&&d>=r.right-S.width?(C.x=en.Forward,E.x=l*Math.abs((r.right-S.width-d)/S.width)):!y&&u<=r.left+S.width&&(C.x=en.Backward,E.x=l*Math.abs((r.left+S.width-u)/S.width)),{direction:C,speed:E}}function oL(t){if(t===document.scrollingElement){const{innerWidth:c,innerHeight:u}=window;return{top:0,left:0,right:c,bottom:u,width:c,height:u}}const{top:r,left:a,right:l,bottom:s}=t.getBoundingClientRect();return{top:r,left:a,right:l,bottom:s,width:t.clientWidth,height:t.clientHeight}}function bN(t){return t.reduce((r,a)=>Vl(r,Zm(a)),Nr)}function sL(t){return t.reduce((r,a)=>r+pN(a),0)}function cL(t){return t.reduce((r,a)=>r+vN(a),0)}function xN(t,r){if(r===void 0&&(r=Vs),!t)return;const{top:a,left:l,bottom:s,right:c}=r(t);mN(t)&&(s<=0||c<=0||a>=window.innerHeight||l>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const uL=[["x",["left","right"],sL],["y",["top","bottom"],cL]];class nv{constructor(r,a){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const l=tv(a),s=bN(l);this.rect={...r},this.width=r.width,this.height=r.height;for(const[c,u,d]of uL)for(const m of u)Object.defineProperty(this,m,{get:()=>{const v=d(l),b=s[c]-v;return this.rect[m]+b},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class os{constructor(r){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(a=>{var l;return(l=this.target)==null?void 0:l.removeEventListener(...a)})},this.target=r}add(r,a,l){var s;(s=this.target)==null||s.addEventListener(r,a,l),this.listeners.push([r,a,l])}}function dL(t){const{EventTarget:r}=xn(t);return t instanceof r?t:lo(t)}function ym(t,r){const a=Math.abs(t.x),l=Math.abs(t.y);return typeof r=="number"?Math.sqrt(a**2+l**2)>r:"x"in r&&"y"in r?a>r.x&&l>r.y:"x"in r?a>r.x:"y"in r?l>r.y:!1}var sr;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(sr||(sr={}));function Rx(t){t.preventDefault()}function fL(t){t.stopPropagation()}var ht;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(ht||(ht={}));const SN={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},hL=(t,r)=>{let{currentCoordinates:a}=r;switch(t.code){case ht.Right:return{...a,x:a.x+25};case ht.Left:return{...a,x:a.x-25};case ht.Down:return{...a,y:a.y+25};case ht.Up:return{...a,y:a.y-25}}};class wN{constructor(r){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=r;const{event:{target:a}}=r;this.props=r,this.listeners=new os(lo(a)),this.windowListeners=new os(xn(a)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sr.Resize,this.handleCancel),this.windowListeners.add(sr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:r,onStart:a}=this.props,l=r.node.current;l&&xN(l),a(Nr)}handleKeyDown(r){if(ev(r)){const{active:a,context:l,options:s}=this.props,{keyboardCodes:c=SN,coordinateGetter:u=hL,scrollBehavior:d="smooth"}=s,{code:m}=r;if(c.end.includes(m)){this.handleEnd(r);return}if(c.cancel.includes(m)){this.handleCancel(r);return}const{collisionRect:v}=l.current,b=v?{x:v.left,y:v.top}:Nr;this.referenceCoordinates||(this.referenceCoordinates=b);const y=u(r,{active:a,context:l.current,currentCoordinates:b});if(y){const w=Vu(y,b),C={x:0,y:0},{scrollableAncestors:E}=l.current;for(const S of E){const R=r.code,{isTop:M,isRight:O,isLeft:_,isBottom:z,maxScroll:k,minScroll:I}=yN(S),N=oL(S),T={x:Math.min(R===ht.Right?N.right-N.width/2:N.right,Math.max(R===ht.Right?N.left:N.left+N.width/2,y.x)),y:Math.min(R===ht.Down?N.bottom-N.height/2:N.bottom,Math.max(R===ht.Down?N.top:N.top+N.height/2,y.y))},A=R===ht.Right&&!O||R===ht.Left&&!_,q=R===ht.Down&&!z||R===ht.Up&&!M;if(A&&T.x!==y.x){const K=S.scrollLeft+w.x,W=R===ht.Right&&K<=k.x||R===ht.Left&&K>=I.x;if(W&&!w.y){S.scrollTo({left:K,behavior:d});return}W?C.x=S.scrollLeft-K:C.x=R===ht.Right?S.scrollLeft-k.x:S.scrollLeft-I.x,C.x&&S.scrollBy({left:-C.x,behavior:d});break}else if(q&&T.y!==y.y){const K=S.scrollTop+w.y,W=R===ht.Down&&K<=k.y||R===ht.Up&&K>=I.y;if(W&&!w.x){S.scrollTo({top:K,behavior:d});return}W?C.y=S.scrollTop-K:C.y=R===ht.Down?S.scrollTop-k.y:S.scrollTop-I.y,C.y&&S.scrollBy({top:-C.y,behavior:d});break}}this.handleMove(r,Vl(Vu(y,this.referenceCoordinates),C))}}}handleMove(r,a){const{onMove:l}=this.props;r.preventDefault(),l(a)}handleEnd(r){const{onEnd:a}=this.props;r.preventDefault(),this.detach(),a()}handleCancel(r){const{onCancel:a}=this.props;r.preventDefault(),this.detach(),a()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}wN.activators=[{eventName:"onKeyDown",handler:(t,r,a)=>{let{keyboardCodes:l=SN,onActivation:s}=r,{active:c}=a;const{code:u}=t.nativeEvent;if(l.start.includes(u)){const d=c.activatorNode.current;return d&&t.target!==d?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function Mx(t){return!!(t&&"distance"in t)}function Ox(t){return!!(t&&"delay"in t)}class rv{constructor(r,a,l){var s;l===void 0&&(l=dL(r.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=r,this.events=a;const{event:c}=r,{target:u}=c;this.props=r,this.events=a,this.document=lo(u),this.documentListeners=new os(this.document),this.listeners=new os(l),this.windowListeners=new os(xn(u)),this.initialCoordinates=(s=Fu(c))!=null?s:Nr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:r,props:{options:{activationConstraint:a,bypassActivationConstraint:l}}}=this;if(this.listeners.add(r.move.name,this.handleMove,{passive:!1}),this.listeners.add(r.end.name,this.handleEnd),r.cancel&&this.listeners.add(r.cancel.name,this.handleCancel),this.windowListeners.add(sr.Resize,this.handleCancel),this.windowListeners.add(sr.DragStart,Rx),this.windowListeners.add(sr.VisibilityChange,this.handleCancel),this.windowListeners.add(sr.ContextMenu,Rx),this.documentListeners.add(sr.Keydown,this.handleKeydown),a){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ox(a)){this.timeoutId=setTimeout(this.handleStart,a.delay),this.handlePending(a);return}if(Mx(a)){this.handlePending(a);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(r,a){const{active:l,onPending:s}=this.props;s(l,r,this.initialCoordinates,a)}handleStart(){const{initialCoordinates:r}=this,{onStart:a}=this.props;r&&(this.activated=!0,this.documentListeners.add(sr.Click,fL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sr.SelectionChange,this.removeTextSelection),a(r))}handleMove(r){var a;const{activated:l,initialCoordinates:s,props:c}=this,{onMove:u,options:{activationConstraint:d}}=c;if(!s)return;const m=(a=Fu(r))!=null?a:Nr,v=Vu(s,m);if(!l&&d){if(Mx(d)){if(d.tolerance!=null&&ym(v,d.tolerance))return this.handleCancel();if(ym(v,d.distance))return this.handleStart()}if(Ox(d)&&ym(v,d.tolerance))return this.handleCancel();this.handlePending(d,v);return}r.cancelable&&r.preventDefault(),u(m)}handleEnd(){const{onAbort:r,onEnd:a}=this.props;this.detach(),this.activated||r(this.props.active),a()}handleCancel(){const{onAbort:r,onCancel:a}=this.props;this.detach(),this.activated||r(this.props.active),a()}handleKeydown(r){r.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var r;(r=this.document.getSelection())==null||r.removeAllRanges()}}const mL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class av extends rv{constructor(r){const{event:a}=r,l=lo(a.target);super(r,mL,l)}}av.activators=[{eventName:"onPointerDown",handler:(t,r)=>{let{nativeEvent:a}=t,{onActivation:l}=r;return!a.isPrimary||a.button!==0?!1:(l?.({event:a}),!0)}}];const pL={move:{name:"mousemove"},end:{name:"mouseup"}};var Jm;(function(t){t[t.RightClick=2]="RightClick"})(Jm||(Jm={}));class vL extends rv{constructor(r){super(r,pL,lo(r.event.target))}}vL.activators=[{eventName:"onMouseDown",handler:(t,r)=>{let{nativeEvent:a}=t,{onActivation:l}=r;return a.button===Jm.RightClick?!1:(l?.({event:a}),!0)}}];const bm={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class gL extends rv{constructor(r){super(r,bm)}static setup(){return window.addEventListener(bm.move.name,r,{capture:!1,passive:!1}),function(){window.removeEventListener(bm.move.name,r)};function r(){}}}gL.activators=[{eventName:"onTouchStart",handler:(t,r)=>{let{nativeEvent:a}=t,{onActivation:l}=r;const{touches:s}=a;return s.length>1?!1:(l?.({event:a}),!0)}}];var ss;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ss||(ss={}));var Yu;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Yu||(Yu={}));function yL(t){let{acceleration:r,activator:a=ss.Pointer,canScroll:l,draggingRect:s,enabled:c,interval:u=5,order:d=Yu.TreeOrder,pointerCoordinates:m,scrollableAncestors:v,scrollableAncestorRects:b,delta:y,threshold:w}=t;const C=xL({delta:y,disabled:!c}),[E,S]=Tz(),R=g.useRef({x:0,y:0}),M=g.useRef({x:0,y:0}),O=g.useMemo(()=>{switch(a){case ss.Pointer:return m?{top:m.y,bottom:m.y,left:m.x,right:m.x}:null;case ss.DraggableRect:return s}},[a,s,m]),_=g.useRef(null),z=g.useCallback(()=>{const I=_.current;if(!I)return;const N=R.current.x*M.current.x,T=R.current.y*M.current.y;I.scrollBy(N,T)},[]),k=g.useMemo(()=>d===Yu.TreeOrder?[...v].reverse():v,[d,v]);g.useEffect(()=>{if(!c||!v.length||!O){S();return}for(const I of k){if(l?.(I)===!1)continue;const N=v.indexOf(I),T=b[N];if(!T)continue;const{direction:A,speed:q}=lL(I,T,O,r,w);for(const K of["x","y"])C[K][A[K]]||(q[K]=0,A[K]=0);if(q.x>0||q.y>0){S(),_.current=I,E(z,u),R.current=q,M.current=A;return}}R.current={x:0,y:0},M.current={x:0,y:0},S()},[r,z,l,S,c,u,JSON.stringify(O),JSON.stringify(C),E,v,k,b,JSON.stringify(w)])}const bL={x:{[en.Backward]:!1,[en.Forward]:!1},y:{[en.Backward]:!1,[en.Forward]:!1}};function xL(t){let{delta:r,disabled:a}=t;const l=Qu(r);return Qs(s=>{if(a||!l||!s)return bL;const c={x:Math.sign(r.x-l.x),y:Math.sign(r.y-l.y)};return{x:{[en.Backward]:s.x[en.Backward]||c.x===-1,[en.Forward]:s.x[en.Forward]||c.x===1},y:{[en.Backward]:s.y[en.Backward]||c.y===-1,[en.Forward]:s.y[en.Forward]||c.y===1}}},[a,r,l])}function SL(t,r){const a=r!=null?t.get(r):void 0,l=a?a.node.current:null;return Qs(s=>{var c;return r==null?null:(c=l??s)!=null?c:null},[l,r])}function wL(t,r){return g.useMemo(()=>t.reduce((a,l)=>{const{sensor:s}=l,c=s.activators.map(u=>({eventName:u.eventName,handler:r(u.handler,l)}));return[...a,...c]},[]),[t,r])}var ws;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ws||(ws={}));var Wm;(function(t){t.Optimized="optimized"})(Wm||(Wm={}));const Dx=new Map;function CL(t,r){let{dragging:a,dependencies:l,config:s}=r;const[c,u]=g.useState(null),{frequency:d,measure:m,strategy:v}=s,b=g.useRef(t),y=R(),w=Ss(y),C=g.useCallback(function(M){M===void 0&&(M=[]),!w.current&&u(O=>O===null?M:O.concat(M.filter(_=>!O.includes(_))))},[w]),E=g.useRef(null),S=Qs(M=>{if(y&&!a)return Dx;if(!M||M===Dx||b.current!==t||c!=null){const O=new Map;for(let _ of t){if(!_)continue;if(c&&c.length>0&&!c.includes(_.id)&&_.rect.current){O.set(_.id,_.rect.current);continue}const z=_.node.current,k=z?new nv(m(z),z):null;_.rect.current=k,k&&O.set(_.id,k)}return O}return M},[t,c,a,y,m]);return g.useEffect(()=>{b.current=t},[t]),g.useEffect(()=>{y||C()},[a,y]),g.useEffect(()=>{c&&c.length>0&&u(null)},[JSON.stringify(c)]),g.useEffect(()=>{y||typeof d!="number"||E.current!==null||(E.current=setTimeout(()=>{C(),E.current=null},d))},[d,y,C,...l]),{droppableRects:S,measureDroppableContainers:C,measuringScheduled:c!=null};function R(){switch(v){case ws.Always:return!1;case ws.BeforeDragging:return a;default:return!a}}}function iv(t,r){return Qs(a=>t?a||(typeof r=="function"?r(t):t):null,[r,t])}function NL(t,r){return iv(t,r)}function EL(t){let{callback:r,disabled:a}=t;const l=_d(r),s=g.useMemo(()=>{if(a||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(l)},[l,a]);return g.useEffect(()=>()=>s?.disconnect(),[s]),s}function zd(t){let{callback:r,disabled:a}=t;const l=_d(r),s=g.useMemo(()=>{if(a||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(l)},[a]);return g.useEffect(()=>()=>s?.disconnect(),[s]),s}function jL(t){return new nv(Vs(t),t)}function Tx(t,r,a){r===void 0&&(r=jL);const[l,s]=g.useState(null);function c(){s(m=>{if(!t)return null;if(t.isConnected===!1){var v;return(v=m??a)!=null?v:null}const b=r(t);return JSON.stringify(m)===JSON.stringify(b)?m:b})}const u=EL({callback(m){if(t)for(const v of m){const{type:b,target:y}=v;if(b==="childList"&&y instanceof HTMLElement&&y.contains(t)){c();break}}}}),d=zd({callback:c});return ba(()=>{c(),t?(d?.observe(t),u?.observe(document.body,{childList:!0,subtree:!0})):(d?.disconnect(),u?.disconnect())},[t]),l}function RL(t){const r=iv(t);return fN(t,r)}const _x=[];function ML(t){const r=g.useRef(t),a=Qs(l=>t?l&&l!==_x&&t&&r.current&&t.parentNode===r.current.parentNode?l:tv(t):_x,[t]);return g.useEffect(()=>{r.current=t},[t]),a}function OL(t){const[r,a]=g.useState(null),l=g.useRef(t),s=g.useCallback(c=>{const u=gm(c.target);u&&a(d=>d?(d.set(u,Zm(u)),new Map(d)):null)},[]);return g.useEffect(()=>{const c=l.current;if(t!==c){u(c);const d=t.map(m=>{const v=gm(m);return v?(v.addEventListener("scroll",s,{passive:!0}),[v,Zm(v)]):null}).filter(m=>m!=null);a(d.length?new Map(d):null),l.current=t}return()=>{u(t),u(c)};function u(d){d.forEach(m=>{const v=gm(m);v?.removeEventListener("scroll",s)})}},[s,t]),g.useMemo(()=>t.length?r?Array.from(r.values()).reduce((c,u)=>Vl(c,u),Nr):bN(t):Nr,[t,r])}function Ax(t,r){r===void 0&&(r=[]);const a=g.useRef(null);return g.useEffect(()=>{a.current=null},r),g.useEffect(()=>{const l=t!==Nr;l&&!a.current&&(a.current=t),!l&&a.current&&(a.current=null)},[t]),a.current?Vu(t,a.current):Nr}function DL(t){g.useEffect(()=>{if(!Td)return;const r=t.map(a=>{let{sensor:l}=a;return l.setup==null?void 0:l.setup()});return()=>{for(const a of r)a?.()}},t.map(r=>{let{sensor:a}=r;return a}))}function TL(t,r){return g.useMemo(()=>t.reduce((a,l)=>{let{eventName:s,handler:c}=l;return a[s]=u=>{c(u,r)},a},{}),[t,r])}function CN(t){return g.useMemo(()=>t?nL(t):null,[t])}const zx=[];function _L(t,r){r===void 0&&(r=Vs);const[a]=t,l=CN(a?xn(a):null),[s,c]=g.useState(zx);function u(){c(()=>t.length?t.map(m=>gN(m)?l:new nv(r(m),m)):zx)}const d=zd({callback:u});return ba(()=>{d?.disconnect(),u(),t.forEach(m=>d?.observe(m))},[t]),s}function NN(t){if(!t)return null;if(t.children.length>1)return t;const r=t.children[0];return Is(r)?r:t}function AL(t){let{measure:r}=t;const[a,l]=g.useState(null),s=g.useCallback(v=>{for(const{target:b}of v)if(Is(b)){l(y=>{const w=r(b);return y?{...y,width:w.width,height:w.height}:w});break}},[r]),c=zd({callback:s}),u=g.useCallback(v=>{const b=NN(v);c?.disconnect(),b&&c?.observe(b),l(b?r(b):null)},[r,c]),[d,m]=Iu(u);return g.useMemo(()=>({nodeRef:d,rect:a,setRef:m}),[a,d,m])}const zL=[{sensor:av,options:{}},{sensor:wN,options:{}}],LL={current:{}},wu={draggable:{measure:jx},droppable:{measure:jx,strategy:ws.WhileDragging,frequency:Wm.Optimized},dragOverlay:{measure:Vs}};class cs extends Map{get(r){var a;return r!=null&&(a=super.get(r))!=null?a:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(r=>{let{disabled:a}=r;return!a})}getNodeFor(r){var a,l;return(a=(l=this.get(r))==null?void 0:l.node.current)!=null?a:void 0}}const kL={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new cs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Gu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wu,measureDroppableContainers:Gu,windowRect:null,measuringScheduled:!1},EN={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Gu,draggableNodes:new Map,over:null,measureDroppableContainers:Gu},Fs=g.createContext(EN),jN=g.createContext(kL);function PL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new cs}}}function UL(t,r){switch(r.type){case Xt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:r.initialCoordinates,active:r.active}};case Xt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:r.coordinates.x-t.draggable.initialCoordinates.x,y:r.coordinates.y-t.draggable.initialCoordinates.y}}};case Xt.DragEnd:case Xt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Xt.RegisterDroppable:{const{element:a}=r,{id:l}=a,s=new cs(t.droppable.containers);return s.set(l,a),{...t,droppable:{...t.droppable,containers:s}}}case Xt.SetDroppableDisabled:{const{id:a,key:l,disabled:s}=r,c=t.droppable.containers.get(a);if(!c||l!==c.key)return t;const u=new cs(t.droppable.containers);return u.set(a,{...c,disabled:s}),{...t,droppable:{...t.droppable,containers:u}}}case Xt.UnregisterDroppable:{const{id:a,key:l}=r,s=t.droppable.containers.get(a);if(!s||l!==s.key)return t;const c=new cs(t.droppable.containers);return c.delete(a),{...t,droppable:{...t.droppable,containers:c}}}default:return t}}function BL(t){let{disabled:r}=t;const{active:a,activatorEvent:l,draggableNodes:s}=g.useContext(Fs),c=Qu(l),u=Qu(a?.id);return g.useEffect(()=>{if(!r&&!l&&c&&u!=null){if(!ev(c)||document.activeElement===c.target)return;const d=s.get(u);if(!d)return;const{activatorNode:m,node:v}=d;if(!m.current&&!v.current)return;requestAnimationFrame(()=>{for(const b of[m.current,v.current]){if(!b)continue;const y=zz(b);if(y){y.focus();break}}})}},[l,r,s,u,c]),null}function RN(t,r){let{transform:a,...l}=r;return t!=null&&t.length?t.reduce((s,c)=>c({transform:s,...l}),a):a}function HL(t){return g.useMemo(()=>({draggable:{...wu.draggable,...t?.draggable},droppable:{...wu.droppable,...t?.droppable},dragOverlay:{...wu.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function qL(t){let{activeNode:r,measure:a,initialRect:l,config:s=!0}=t;const c=g.useRef(!1),{x:u,y:d}=typeof s=="boolean"?{x:s,y:s}:s;ba(()=>{if(!u&&!d||!r){c.current=!1;return}if(c.current||!l)return;const v=r?.node.current;if(!v||v.isConnected===!1)return;const b=a(v),y=fN(b,l);if(u||(y.x=0),d||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const w=mN(v);w&&w.scrollBy({top:y.y,left:y.x})}},[r,u,d,l,a])}const Ld=g.createContext({...Nr,scaleX:1,scaleY:1});var Wa;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Wa||(Wa={}));const IL=g.memo(function(r){var a,l,s,c;let{id:u,accessibility:d,autoScroll:m=!0,children:v,sensors:b=zL,collisionDetection:y=$z,measuring:w,modifiers:C,...E}=r;const S=g.useReducer(UL,void 0,PL),[R,M]=S,[O,_]=Hz(),[z,k]=g.useState(Wa.Uninitialized),I=z===Wa.Initialized,{draggable:{active:N,nodes:T,translate:A},droppable:{containers:q}}=R,K=N!=null?T.get(N):null,W=g.useRef({initial:null,translated:null}),ue=g.useMemo(()=>{var gt;return N!=null?{id:N,data:(gt=K?.data)!=null?gt:LL,rect:W}:null},[N,K]),le=g.useRef(null),[de,L]=g.useState(null),[G,B]=g.useState(null),ee=Ss(E,Object.values(E)),ie=Ad("DndDescribedBy",u),D=g.useMemo(()=>q.getEnabled(),[q]),Q=HL(w),{droppableRects:J,measureDroppableContainers:ne,measuringScheduled:fe}=CL(D,{dragging:I,dependencies:[A.x,A.y],config:Q.droppable}),me=SL(T,N),re=g.useMemo(()=>G?Fu(G):null,[G]),De=Dr(),Ae=NL(me,Q.draggable.measure);qL({activeNode:N!=null?T.get(N):null,config:De.layoutShiftCompensation,initialRect:Ae,measure:Q.draggable.measure});const Te=Tx(me,Q.draggable.measure,Ae),Ue=Tx(me?me.parentElement:null),he=g.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:J,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:q,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),dt=q.getNodeFor((a=he.current.over)==null?void 0:a.id),pt=AL({measure:Q.dragOverlay.measure}),Sn=(l=pt.nodeRef.current)!=null?l:me,jt=I?(s=pt.rect)!=null?s:Te:null,Rr=!!(pt.nodeRef.current&&pt.rect),fi=RL(Rr?null:Te),Mr=CN(Sn?xn(Sn):null),wn=ML(I?dt??me:null),Or=_L(wn),Ca=RN(C,{transform:{x:A.x-fi.x,y:A.y-fi.y,scaleX:1,scaleY:1},activatorEvent:G,active:ue,activeNodeRect:Te,containerNodeRect:Ue,draggingNodeRect:jt,over:he.current.over,overlayNodeRect:pt.rect,scrollableAncestors:wn,scrollableAncestorRects:Or,windowRect:Mr}),tl=re?Vl(re,A):null,wt=OL(wn),Fr=Ax(wt),hi=Ax(wt,[Te]),Ln=Vl(Ca,Fr),Ut=jt?Wz(jt,Ca):null,tn=ue&&Ut?y({active:ue,collisionRect:Ut,droppableRects:J,droppableContainers:D,pointerCoordinates:tl}):null,Na=Kz(tn,"id"),[mn,nl]=g.useState(null),cn=Rr?Ca:Vl(Ca,hi),Jt=Zz(cn,(c=mn?.rect)!=null?c:null,Te),pn=g.useRef(null),Vt=g.useCallback((gt,Et)=>{let{sensor:Tt,options:un}=Et;if(le.current==null)return;const nn=T.get(le.current);if(!nn)return;const _t=gt.nativeEvent,Ft=new Tt({active:le.current,activeNode:nn,event:_t,options:un,context:he,onAbort(At){if(!T.get(At))return;const{onDragAbort:V}=ee.current,$={id:At};V?.($),O({type:"onDragAbort",event:$})},onPending(At,U,V,$){if(!T.get(At))return;const{onDragPending:pe}=ee.current,Se={id:At,constraint:U,initialCoordinates:V,offset:$};pe?.(Se),O({type:"onDragPending",event:Se})},onStart(At){const U=le.current;if(U==null)return;const V=T.get(U);if(!V)return;const{onDragStart:$}=ee.current,ce={activatorEvent:_t,active:{id:U,data:V.data,rect:W}};Sr.unstable_batchedUpdates(()=>{$?.(ce),k(Wa.Initializing),M({type:Xt.DragStart,initialCoordinates:At,active:U}),O({type:"onDragStart",event:ce}),L(pn.current),B(_t)})},onMove(At){M({type:Xt.DragMove,coordinates:At})},onEnd:Cn(Xt.DragEnd),onCancel:Cn(Xt.DragCancel)});pn.current=Ft;function Cn(At){return async function(){const{active:V,collisions:$,over:ce,scrollAdjustedTranslate:pe}=he.current;let Se=null;if(V&&pe){const{cancelDrop:Me}=ee.current;Se={activatorEvent:_t,active:V,collisions:$,delta:pe,over:ce},At===Xt.DragEnd&&typeof Me=="function"&&await Promise.resolve(Me(Se))&&(At=Xt.DragCancel)}le.current=null,Sr.unstable_batchedUpdates(()=>{M({type:At}),k(Wa.Uninitialized),nl(null),L(null),B(null),pn.current=null;const Me=At===Xt.DragEnd?"onDragEnd":"onDragCancel";if(Se){const be=ee.current[Me];be?.(Se),O({type:Me,event:Se})}})}}},[T]),oo=g.useCallback((gt,Et)=>(Tt,un)=>{const nn=Tt.nativeEvent,_t=T.get(un);if(le.current!==null||!_t||nn.dndKit||nn.defaultPrevented)return;const Ft={active:_t};gt(Tt,Et.options,Ft)===!0&&(nn.dndKit={capturedBy:Et.sensor},le.current=un,Vt(Tt,Et))},[T,Vt]),mi=wL(b,oo);DL(b),ba(()=>{Te&&z===Wa.Initializing&&k(Wa.Initialized)},[Te,z]),g.useEffect(()=>{const{onDragMove:gt}=ee.current,{active:Et,activatorEvent:Tt,collisions:un,over:nn}=he.current;if(!Et||!Tt)return;const _t={active:Et,activatorEvent:Tt,collisions:un,delta:{x:Ln.x,y:Ln.y},over:nn};Sr.unstable_batchedUpdates(()=>{gt?.(_t),O({type:"onDragMove",event:_t})})},[Ln.x,Ln.y]),g.useEffect(()=>{const{active:gt,activatorEvent:Et,collisions:Tt,droppableContainers:un,scrollAdjustedTranslate:nn}=he.current;if(!gt||le.current==null||!Et||!nn)return;const{onDragOver:_t}=ee.current,Ft=un.get(Na),Cn=Ft&&Ft.rect.current?{id:Ft.id,rect:Ft.rect.current,data:Ft.data,disabled:Ft.disabled}:null,At={active:gt,activatorEvent:Et,collisions:Tt,delta:{x:nn.x,y:nn.y},over:Cn};Sr.unstable_batchedUpdates(()=>{nl(Cn),_t?.(At),O({type:"onDragOver",event:At})})},[Na]),ba(()=>{he.current={activatorEvent:G,active:ue,activeNode:me,collisionRect:Ut,collisions:tn,droppableRects:J,draggableNodes:T,draggingNode:Sn,draggingNodeRect:jt,droppableContainers:q,over:mn,scrollableAncestors:wn,scrollAdjustedTranslate:Ln},W.current={initial:jt,translated:Ut}},[ue,me,tn,Ut,T,Sn,jt,J,q,mn,wn,Ln]),yL({...De,delta:A,draggingRect:Ut,pointerCoordinates:tl,scrollableAncestors:wn,scrollableAncestorRects:Or});const Ea=g.useMemo(()=>({active:ue,activeNode:me,activeNodeRect:Te,activatorEvent:G,collisions:tn,containerNodeRect:Ue,dragOverlay:pt,draggableNodes:T,droppableContainers:q,droppableRects:J,over:mn,measureDroppableContainers:ne,scrollableAncestors:wn,scrollableAncestorRects:Or,measuringConfiguration:Q,measuringScheduled:fe,windowRect:Mr}),[ue,me,Te,G,tn,Ue,pt,T,q,J,mn,ne,wn,Or,Q,fe,Mr]),Gr=g.useMemo(()=>({activatorEvent:G,activators:mi,active:ue,activeNodeRect:Te,ariaDescribedById:{draggable:ie},dispatch:M,draggableNodes:T,over:mn,measureDroppableContainers:ne}),[G,mi,ue,Te,M,ie,T,mn,ne]);return ot.createElement(dN.Provider,{value:_},ot.createElement(Fs.Provider,{value:Gr},ot.createElement(jN.Provider,{value:Ea},ot.createElement(Ld.Provider,{value:Jt},v)),ot.createElement(BL,{disabled:d?.restoreFocus===!1})),ot.createElement(Qz,{...d,hiddenTextDescribedById:ie}));function Dr(){const gt=de?.autoScrollEnabled===!1,Et=typeof m=="object"?m.enabled===!1:m===!1,Tt=I&&!gt&&!Et;return typeof m=="object"?{...m,enabled:Tt}:{enabled:Tt}}}),QL=g.createContext(null),Lx="button",VL="Draggable";function FL(t){let{id:r,data:a,disabled:l=!1,attributes:s}=t;const c=Ad(VL),{activators:u,activatorEvent:d,active:m,activeNodeRect:v,ariaDescribedById:b,draggableNodes:y,over:w}=g.useContext(Fs),{role:C=Lx,roleDescription:E="draggable",tabIndex:S=0}=s??{},R=m?.id===r,M=g.useContext(R?Ld:QL),[O,_]=Iu(),[z,k]=Iu(),I=TL(u,r),N=Ss(a);ba(()=>(y.set(r,{id:r,key:c,node:O,activatorNode:z,data:N}),()=>{const A=y.get(r);A&&A.key===c&&y.delete(r)}),[y,r]);const T=g.useMemo(()=>({role:C,tabIndex:S,"aria-disabled":l,"aria-pressed":R&&C===Lx?!0:void 0,"aria-roledescription":E,"aria-describedby":b.draggable}),[l,C,S,R,E,b.draggable]);return{active:m,activatorEvent:d,activeNodeRect:v,attributes:T,isDragging:R,listeners:l?void 0:I,node:O,over:w,setNodeRef:_,setActivatorNodeRef:k,transform:M}}function GL(){return g.useContext(jN)}const YL="Droppable",KL={timeout:25};function XL(t){let{data:r,disabled:a=!1,id:l,resizeObserverConfig:s}=t;const c=Ad(YL),{active:u,dispatch:d,over:m,measureDroppableContainers:v}=g.useContext(Fs),b=g.useRef({disabled:a}),y=g.useRef(!1),w=g.useRef(null),C=g.useRef(null),{disabled:E,updateMeasurementsFor:S,timeout:R}={...KL,...s},M=Ss(S??l),O=g.useCallback(()=>{if(!y.current){y.current=!0;return}C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{v(Array.isArray(M.current)?M.current:[M.current]),C.current=null},R)},[R]),_=zd({callback:O,disabled:E||!u}),z=g.useCallback((T,A)=>{_&&(A&&(_.unobserve(A),y.current=!1),T&&_.observe(T))},[_]),[k,I]=Iu(z),N=Ss(r);return g.useEffect(()=>{!_||!k.current||(_.disconnect(),y.current=!1,_.observe(k.current))},[k,_]),g.useEffect(()=>(d({type:Xt.RegisterDroppable,element:{id:l,key:c,disabled:a,node:k,rect:w,data:N}}),()=>d({type:Xt.UnregisterDroppable,key:c,id:l})),[l]),g.useEffect(()=>{a!==b.current.disabled&&(d({type:Xt.SetDroppableDisabled,id:l,key:c,disabled:a}),b.current.disabled=a)},[l,c,a,d]),{active:u,rect:w,isOver:m?.id===l,node:k,over:m,setNodeRef:I}}function $L(t){let{animation:r,children:a}=t;const[l,s]=g.useState(null),[c,u]=g.useState(null),d=Qu(a);return!a&&!l&&d&&s(d),ba(()=>{if(!c)return;const m=l?.key,v=l?.props.id;if(m==null||v==null){s(null);return}Promise.resolve(r(v,c)).then(()=>{s(null)})},[r,l,c]),ot.createElement(ot.Fragment,null,a,l?g.cloneElement(l,{ref:u}):null)}const ZL={x:0,y:0,scaleX:1,scaleY:1};function JL(t){let{children:r}=t;return ot.createElement(Fs.Provider,{value:EN},ot.createElement(Ld.Provider,{value:ZL},r))}const WL={position:"fixed",touchAction:"none"},ek=t=>ev(t)?"transform 250ms ease":void 0,tk=g.forwardRef((t,r)=>{let{as:a,activatorEvent:l,adjustScale:s,children:c,className:u,rect:d,style:m,transform:v,transition:b=ek}=t;if(!d)return null;const y=s?v:{...v,scaleX:1,scaleY:1},w={...WL,width:d.width,height:d.height,top:d.top,left:d.left,transform:Zl.Transform.toString(y),transformOrigin:s&&l?Gz(l,d):void 0,transition:typeof b=="function"?b(l):b,...m};return ot.createElement(a,{className:u,style:w,ref:r},c)}),nk=t=>r=>{let{active:a,dragOverlay:l}=r;const s={},{styles:c,className:u}=t;if(c!=null&&c.active)for(const[d,m]of Object.entries(c.active))m!==void 0&&(s[d]=a.node.style.getPropertyValue(d),a.node.style.setProperty(d,m));if(c!=null&&c.dragOverlay)for(const[d,m]of Object.entries(c.dragOverlay))m!==void 0&&l.node.style.setProperty(d,m);return u!=null&&u.active&&a.node.classList.add(u.active),u!=null&&u.dragOverlay&&l.node.classList.add(u.dragOverlay),function(){for(const[m,v]of Object.entries(s))a.node.style.setProperty(m,v);u!=null&&u.active&&a.node.classList.remove(u.active)}},rk=t=>{let{transform:{initial:r,final:a}}=t;return[{transform:Zl.Transform.toString(r)},{transform:Zl.Transform.toString(a)}]},ak={duration:250,easing:"ease",keyframes:rk,sideEffects:nk({styles:{active:{opacity:"0"}}})};function ik(t){let{config:r,draggableNodes:a,droppableContainers:l,measuringConfiguration:s}=t;return _d((c,u)=>{if(r===null)return;const d=a.get(c);if(!d)return;const m=d.node.current;if(!m)return;const v=NN(u);if(!v)return;const{transform:b}=xn(u).getComputedStyle(u),y=hN(b);if(!y)return;const w=typeof r=="function"?r:lk(r);return xN(m,s.draggable.measure),w({active:{id:c,data:d.data,node:m,rect:s.draggable.measure(m)},draggableNodes:a,dragOverlay:{node:u,rect:s.dragOverlay.measure(v)},droppableContainers:l,measuringConfiguration:s,transform:y})})}function lk(t){const{duration:r,easing:a,sideEffects:l,keyframes:s}={...ak,...t};return c=>{let{active:u,dragOverlay:d,transform:m,...v}=c;if(!r)return;const b={x:d.rect.left-u.rect.left,y:d.rect.top-u.rect.top},y={scaleX:m.scaleX!==1?u.rect.width*m.scaleX/d.rect.width:1,scaleY:m.scaleY!==1?u.rect.height*m.scaleY/d.rect.height:1},w={x:m.x-b.x,y:m.y-b.y,...y},C=s({...v,active:u,dragOverlay:d,transform:{initial:m,final:w}}),[E]=C,S=C[C.length-1];if(JSON.stringify(E)===JSON.stringify(S))return;const R=l?.({active:u,dragOverlay:d,...v}),M=d.node.animate(C,{duration:r,easing:a,fill:"forwards"});return new Promise(O=>{M.onfinish=()=>{R?.(),O()}})}}let kx=0;function ok(t){return g.useMemo(()=>{if(t!=null)return kx++,kx},[t])}const sk=ot.memo(t=>{let{adjustScale:r=!1,children:a,dropAnimation:l,style:s,transition:c,modifiers:u,wrapperElement:d="div",className:m,zIndex:v=999}=t;const{activatorEvent:b,active:y,activeNodeRect:w,containerNodeRect:C,draggableNodes:E,droppableContainers:S,dragOverlay:R,over:M,measuringConfiguration:O,scrollableAncestors:_,scrollableAncestorRects:z,windowRect:k}=GL(),I=g.useContext(Ld),N=ok(y?.id),T=RN(u,{activatorEvent:b,active:y,activeNodeRect:w,containerNodeRect:C,draggingNodeRect:R.rect,over:M,overlayNodeRect:R.rect,scrollableAncestors:_,scrollableAncestorRects:z,transform:I,windowRect:k}),A=iv(w),q=ik({config:l,draggableNodes:E,droppableContainers:S,measuringConfiguration:O}),K=A?R.setRef:void 0;return ot.createElement(JL,null,ot.createElement($L,{animation:q},y&&N?ot.createElement(tk,{key:N,id:y.id,ref:K,as:d,activatorEvent:b,adjustScale:r,className:m,transition:c,rect:A,style:{zIndex:v,...s},transform:T},a):null))}),Px=["New","Demo scheduled","Contract signed","Lost"];function ck({phase:t,deals:r,onDealClick:a,onContactClick:l}){const{setNodeRef:s,isOver:c}=XL({id:t}),u=ao[t],d=u.icon;return h.jsxs("div",{ref:s,className:ye("flex flex-col w-[280px] flex-shrink-0 rounded-xl border bg-muted/30 transition-colors",c&&"ring-2 ring-primary/50 bg-primary/5"),children:[h.jsxs("div",{className:ye("flex items-center gap-2 p-3 border-b",u.bgColor),children:[h.jsx("div",{className:ye("p-1.5 rounded-lg",u.bgColor),children:h.jsx(d,{className:ye("h-4 w-4",u.color)})}),h.jsx("span",{className:"font-semibold text-sm",children:u.label}),h.jsx("span",{className:"ml-auto text-xs text-muted-foreground bg-background/50 px-2 py-0.5 rounded-full",children:r.length})]}),h.jsx("div",{className:"flex-1 p-2 space-y-2 overflow-y-auto min-h-[200px] max-h-[calc(100vh-300px)]",children:r.length===0?h.jsx("div",{className:"flex items-center justify-center h-24 text-muted-foreground text-sm opacity-50",children:"Drop deals here"}):r.map(m=>h.jsx(uk,{deal:m,onDealClick:a,onContactClick:l},m.id))})]})}function uk({deal:t,onDealClick:r,onContactClick:a}){const{attributes:l,listeners:s,setNodeRef:c,transform:u,isDragging:d}=FL({id:t.id,data:{deal:t}}),m={transform:Zl.Translate.toString(u),opacity:d?.5:1};return h.jsx("div",{ref:c,style:m,children:h.jsx(MN,{deal:t,onDealClick:r,onContactClick:a,isDragging:d,dragHandleProps:{...l,...s}})})}function MN({deal:t,onDealClick:r,onContactClick:a,isDragging:l,dragHandleProps:s}){const c=js(),u=t.mainContact?.[0],d=v=>[v.firstName,v.lastName].filter(Boolean).join(" ")||"Unknown",m=v=>v?new Date(v).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"";return h.jsx("div",{className:ye("bg-background rounded-lg border shadow-sm p-3 cursor-pointer hover:shadow-md hover:border-primary/30 transition-all group",l&&"shadow-lg ring-2 ring-primary/30"),onClick:()=>t.id&&r(t.id),children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("div",{...s,className:"opacity-0 group-hover:opacity-100 transition-opacity cursor-grab active:cursor-grabbing mt-0.5 -ml-1",onClick:v=>v.stopPropagation(),children:h.jsx(hO,{className:"h-4 w-4 text-muted-foreground"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("h4",{className:"font-medium text-sm truncate",children:t.name||"Untitled Deal"}),h.jsx("button",{onClick:v=>{v.stopPropagation(),t.id&&c(`/deals/${t.id}`)},className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-muted",title:"View deal details",children:h.jsx(lO,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),u?.id&&h.jsxs("button",{onClick:v=>{v.stopPropagation(),a(v,u.id)},className:"inline-flex items-center gap-1 mt-2 px-2 py-0.5 rounded bg-blue-500/10 text-blue-600 hover:bg-blue-500/20 transition-colors text-xs",children:[h.jsx(zn,{className:"h-3 w-3"}),h.jsx("span",{className:"truncate max-w-[120px]",children:d(u)})]}),t.createdAt&&h.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:m(t.createdAt)})]})]})})}function dk({deal:t,onDealClick:r,onContactClick:a}){return h.jsx("div",{className:"w-[280px]",children:h.jsx(MN,{deal:t,onDealClick:r,onContactClick:a,isDragging:!0})})}function fk({deals:t,onDealClick:r,onContactClick:a,onPhaseChange:l}){const[s,c]=g.useState(null),[u,d]=g.useState({}),m=Fz(Vz(av,{activationConstraint:{distance:8}})),v=g.useMemo(()=>t.map(C=>C.id&&u[C.id]?{...C,phase:u[C.id]}:C),[t,u]);g.useMemo(()=>{const C={};for(const[E,S]of Object.entries(u)){const R=Number(E),M=t.find(O=>O.id===R);M&&M.phase!==S&&(C[R]=S)}Object.keys(C).length!==Object.keys(u).length&&d(C)},[t,u]);const b=g.useMemo(()=>{const C={};return Px.forEach(E=>{C[E]=[]}),v.forEach(E=>{const S=E.phase||"New";C[S]?C[S].push(E):C.New.push(E)}),C},[v]),y=C=>{const{active:E}=C,S=v.find(R=>R.id===E.id);S&&c(S)},w=C=>{const{active:E,over:S}=C;if(c(null),!S)return;const R=E.id,M=S.id,O=v.find(_=>_.id===R);O&&O.phase!==M&&(d(_=>({..._,[R]:M})),l(R,M))};return h.jsxs(IL,{sensors:m,onDragStart:y,onDragEnd:w,children:[h.jsx("div",{className:"inline-flex gap-4 pb-4 h-full",children:Px.map(C=>h.jsx(ck,{phase:C,deals:b[C]||[],onDealClick:r,onContactClick:a},C))}),h.jsx(sk,{children:s?h.jsx(dk,{deal:s,onDealClick:r,onContactClick:a}):null})]})}function hk(){const t=js(),a=!!Sa().state?.openCreate,[l,s]=g.useState("kanban"),[c,u]=g.useState(a),[d,m]=g.useState(null),[v,b]=g.useState(!1),[y,w]=g.useState(null);g.useLayoutEffect(()=>{a&&window.history.replaceState({},document.title)},[a]);const{data:C,isLoading:E,refetch:S}=$e.deals.getAll.useQuery(),R=$e.deals.update.useMutation({onSuccess:()=>{S()}}),M=C,O=A=>A?new Date(A).toLocaleDateString():"-",_=A=>{m(A),u(!0)},z=()=>{m(null),u(!0)},k=(A,q)=>{A.stopPropagation(),w(q),b(!0)},I=()=>{S()},N=(A,q)=>{R.mutate({id:A,phase:q})},T=A=>[A.firstName,A.lastName].filter(Boolean).join(" ")||"Unknown";return h.jsxs("div",{className:"p-6 h-full flex flex-col gap-6 min-w-0",children:[h.jsxs("div",{className:"flex items-center justify-between flex-shrink-0 flex-wrap gap-4 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 border border-primary/20",children:h.jsx(ni,{className:"h-6 w-6 text-primary"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Deals"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your deal pipeline"})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"flex items-center rounded-lg border bg-muted/30 p-1",children:[h.jsxs("button",{onClick:()=>s("kanban"),className:ye("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors",l==="kanban"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[h.jsx(vO,{className:"h-4 w-4"}),"Kanban"]}),h.jsxs("button",{onClick:()=>s("table"),className:ye("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors",l==="table"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[h.jsx(qO,{className:"h-4 w-4"}),"Table"]})]}),h.jsxs(Ge,{onClick:z,children:[h.jsx($i,{className:"h-4 w-4 mr-2"}),"New Deal"]})]})]}),E?h.jsx("div",{className:"flex items-center justify-center py-12 flex-1",children:h.jsx(Yn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l==="kanban"?M&&M.length>0?h.jsx("div",{className:"flex-1 min-h-0 min-w-0 overflow-x-auto overflow-y-hidden",children:h.jsx(fk,{deals:M,onDealClick:_,onContactClick:k,onPhaseChange:N})}):h.jsxs("div",{className:"text-center py-12 text-muted-foreground flex-1",children:[h.jsx(ni,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),h.jsx("p",{children:"No deals yet."}),h.jsx(Ge,{variant:"link",onClick:z,className:"mt-2",children:"Create your first deal"})]}):h.jsxs(cr,{children:[h.jsxs(ur,{className:"pb-4",children:[h.jsx(dr,{className:"text-lg",children:"All Deals"}),h.jsxs(no,{children:[M?.length??0," ",M?.length===1?"deal":"deals"]})]}),h.jsx(fr,{children:M&&M.length>0?h.jsx("div",{className:"rounded-lg border",children:h.jsxs(Us,{children:[h.jsx(Bs,{children:h.jsxs(ya,{children:[h.jsx($t,{children:"Name"}),h.jsx($t,{children:"Phase"}),h.jsx($t,{children:"Contact"}),h.jsx($t,{children:"Created"}),h.jsx($t,{className:"w-[80px]"})]})}),h.jsx(Hs,{children:M.map(A=>{const q=A.mainContact?.[0];return h.jsxs(ya,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>A.id&&_(A.id),children:[h.jsx(Zt,{className:"font-medium",children:A.name||"-"}),h.jsx(Zt,{children:A.phase?h.jsx(Mz,{phase:A.phase}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Zt,{children:q?.id?h.jsxs("button",{onClick:K=>k(K,q.id),className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-md bg-blue-500/10 text-blue-600 hover:bg-blue-500/20 transition-colors text-sm",children:[h.jsx(zn,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:T(q)})]}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Zt,{className:"text-muted-foreground",children:O(A.createdAt)}),h.jsx(Zt,{children:h.jsx(Ge,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:K=>{K.stopPropagation(),A.id&&t(`/deals/${A.id}`)},children:h.jsx(_S,{className:"h-4 w-4"})})})]},A.id)})})]})}):h.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[h.jsx(ni,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),h.jsx("p",{children:"No deals yet."}),h.jsx(Ge,{variant:"link",onClick:z,className:"mt-2",children:"Create your first deal"})]})})]}),h.jsx(Dz,{open:c,onOpenChange:u,dealId:d,onSuccess:I}),h.jsx($p,{open:v,onOpenChange:b,contactId:y,onSuccess:I})]})}const mk=Ts("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function lv({className:t,variant:r,...a}){return h.jsx("div",{className:ye(mk({variant:r}),t),...a})}var kd="Tabs",[pk]=si(kd,[od]),ON=od(),[vk,ov]=pk(kd),DN=g.forwardRef((t,r)=>{const{__scopeTabs:a,value:l,onValueChange:s,defaultValue:c,orientation:u="horizontal",dir:d,activationMode:m="automatic",...v}=t,b=Ju(d),[y,w]=Gl({prop:l,onChange:s,defaultProp:c??"",caller:kd});return h.jsx(vk,{scope:a,baseId:Br(),value:y,onValueChange:w,orientation:u,dir:b,activationMode:m,children:h.jsx(Ie.div,{dir:b,"data-orientation":u,...v,ref:r})})});DN.displayName=kd;var TN="TabsList",_N=g.forwardRef((t,r)=>{const{__scopeTabs:a,loop:l=!0,...s}=t,c=ov(TN,a),u=ON(a);return h.jsx(Dw,{asChild:!0,...u,orientation:c.orientation,dir:c.dir,loop:l,children:h.jsx(Ie.div,{role:"tablist","aria-orientation":c.orientation,...s,ref:r})})});_N.displayName=TN;var AN="TabsTrigger",zN=g.forwardRef((t,r)=>{const{__scopeTabs:a,value:l,disabled:s=!1,...c}=t,u=ov(AN,a),d=ON(a),m=PN(u.baseId,l),v=UN(u.baseId,l),b=l===u.value;return h.jsx(Tw,{asChild:!0,...d,focusable:!s,active:b,children:h.jsx(Ie.button,{type:"button",role:"tab","aria-selected":b,"aria-controls":v,"data-state":b?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:m,...c,ref:r,onMouseDown:Re(t.onMouseDown,y=>{!s&&y.button===0&&y.ctrlKey===!1?u.onValueChange(l):y.preventDefault()}),onKeyDown:Re(t.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&u.onValueChange(l)}),onFocus:Re(t.onFocus,()=>{const y=u.activationMode!=="manual";!b&&!s&&y&&u.onValueChange(l)})})})});zN.displayName=AN;var LN="TabsContent",kN=g.forwardRef((t,r)=>{const{__scopeTabs:a,value:l,forceMount:s,children:c,...u}=t,d=ov(LN,a),m=PN(d.baseId,l),v=UN(d.baseId,l),b=l===d.value,y=g.useRef(b);return g.useEffect(()=>{const w=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(w)},[]),h.jsx(wa,{present:s||b,children:({present:w})=>h.jsx(Ie.div,{"data-state":b?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!w,id:v,tabIndex:0,...u,ref:r,style:{...t.style,animationDuration:y.current?"0s":void 0},children:w&&c})})});kN.displayName=LN;function PN(t,r){return`${t}-trigger-${r}`}function UN(t,r){return`${t}-content-${r}`}var gk=DN,BN=_N,HN=zN,qN=kN;const yk=gk,IN=g.forwardRef(({className:t,...r},a)=>h.jsx(BN,{ref:a,className:ye("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r}));IN.displayName=BN.displayName;const ep=g.forwardRef(({className:t,...r},a)=>h.jsx(HN,{ref:a,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...r}));ep.displayName=HN.displayName;const tp=g.forwardRef(({className:t,...r},a)=>h.jsx(qN,{ref:a,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r}));tp.displayName=qN.displayName;function bk(t){return[t.firstName,t.lastName].filter(Boolean).join(" ")||"Unknown"}function np(t){return t?new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"-"}function xk(t){return t?new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"-"}function Ux(t){if(!t)return"";const r=new Date(t),a=new Date,l=r.getTime()-a.getTime(),s=Math.ceil(l/(1e3*60*60*24));return s===0?"Today":s===1?"Tomorrow":s===-1?"Yesterday":s>0&&s<=7?`In ${s} days`:s<0&&s>=-7?`${Math.abs(s)} days ago`:np(t)}function QN(t,r){return!t||r?!1:new Date(t)0,w=Nk(t.type),C=t.type?Ck[t.type]:"";return h.jsx("div",{className:ye("group border rounded-lg transition-all",v?"bg-muted/30 border-muted":b?"bg-red-50/50 border-red-200 dark:bg-red-950/20 dark:border-red-800":"bg-background hover:border-primary/30"),children:h.jsx("div",{className:"p-4",children:h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx("button",{onClick:()=>t.id&&(v?a(t.id):r(t.id)),disabled:u,className:ye("mt-0.5 flex-shrink-0 transition-colors",v?"text-green-500 hover:text-green-600":b?"text-red-400 hover:text-red-500":"text-muted-foreground hover:text-primary"),children:u?h.jsx(Yn,{className:"h-5 w-5 animate-spin"}):v?h.jsx(ps,{className:"h-5 w-5"}):h.jsx(gp,{className:"h-5 w-5"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsxs("div",{className:"flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("p",{className:ye("font-medium",v&&"line-through text-muted-foreground"),children:t.name||"Untitled Activity"}),t.type&&h.jsxs("span",{className:ye("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border",C),children:[h.jsx(w,{className:"h-3 w-3"}),t.type]})]}),h.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.plannedAt&&h.jsxs("span",{className:ye("text-sm flex items-center gap-1",v?"text-muted-foreground":b?"text-red-500 font-medium":"text-muted-foreground"),children:[h.jsx(Os,{className:"h-3.5 w-3.5"}),Ux(t.plannedAt)]}),v&&t.doneAt&&h.jsxs("span",{className:"text-sm text-green-600 flex items-center gap-1",children:[h.jsx(ps,{className:"h-3.5 w-3.5"}),"Completed ",Ux(t.doneAt)]})]})]}),h.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx(Ge,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>t.id&&c(t.id),children:h.jsx(PO,{className:"h-4 w-4"})}),h.jsxs(Hm,{children:[h.jsx(qm,{asChild:!0,children:h.jsx(Ge,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:h.jsx(rO,{className:"h-4 w-4"})})}),h.jsxs(Uu,{align:"end",children:[h.jsxs(xs,{onClick:()=>l(t),children:[h.jsx(MO,{className:"h-4 w-4 mr-2"}),"Edit"]}),h.jsxs(xs,{className:"text-destructive",onClick:()=>t.id&&s(t.id),children:[h.jsx(AS,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]}),y&&h.jsxs("div",{className:"mt-3",children:[h.jsxs("button",{onClick:m,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[d?h.jsx($u,{className:"h-4 w-4"}):h.jsx(TS,{className:"h-4 w-4"}),h.jsx(xO,{className:"h-3.5 w-3.5"}),t.notes?.length," note",t.notes?.length!==1&&"s"]}),d&&h.jsx("div",{className:"mt-2 space-y-2 pl-5 border-l-2 border-muted",children:t.notes?.map(E=>h.jsxs("div",{className:"p-2 bg-muted/50 rounded text-sm",children:[h.jsx("p",{children:E.name}),h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:xk(E.createdAt)})]},E.id))})]})]})]})})})}function Sk({contact:t,onViewContact:r}){const a=t.company?.[0];return h.jsxs(cr,{children:[h.jsx(ur,{className:"pb-3",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:h.jsx(zn,{className:"h-4 w-4 text-blue-500"})}),h.jsx(dr,{className:"text-base",children:"Contact"})]}),r&&h.jsx(Ge,{variant:"ghost",size:"sm",onClick:r,children:"View"})]})}),h.jsxs(fr,{className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-semibold text-lg",children:bk(t)}),a&&h.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[h.jsx(ma,{className:"h-3.5 w-3.5"}),a.name]})]}),h.jsxs("div",{className:"space-y-2",children:[t.mail&&h.jsxs("a",{href:`mailto:${t.mail}`,className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(bp,{className:"h-4 w-4"}),t.mail]}),t.phone1&&h.jsxs("a",{href:`tel:${t.phone1}`,className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(pa,{className:"h-4 w-4"}),t.phone1]}),t.phone2&&h.jsxs("a",{href:`tel:${t.phone2}`,className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(pa,{className:"h-4 w-4"}),t.phone2]})]}),t.notes&&h.jsxs("div",{className:"pt-2 border-t",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Notes"}),h.jsx("p",{className:"text-sm",children:t.notes})]})]})]})}function wk({company:t,onViewCompany:r}){return h.jsxs(cr,{children:[h.jsx(ur,{className:"pb-3",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"p-2 rounded-lg bg-purple-500/10",children:h.jsx(ma,{className:"h-4 w-4 text-purple-500"})}),h.jsx(dr,{className:"text-base",children:"Company"})]}),r&&h.jsx(Ge,{variant:"ghost",size:"sm",onClick:r,children:"View"})]})}),h.jsxs(fr,{className:"space-y-3",children:[h.jsx("p",{className:"font-semibold text-lg",children:t.name}),t.website&&h.jsxs("a",{href:t.website.startsWith("http")?t.website:`https://${t.website}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(yp,{className:"h-4 w-4"}),t.website]}),t.notes&&h.jsxs("div",{className:"pt-2 border-t",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Notes"}),h.jsx("p",{className:"text-sm",children:t.notes})]})]})]})}const VN=[{value:"Call",label:"Call",icon:pa},{value:"Meeting",label:"Meeting",icon:zn},{value:"Task",label:"Task",icon:Ui},{value:"Demo",label:"Demo",icon:Zu}],Ck={Call:"bg-blue-500/10 text-blue-600 border-blue-500/20",Meeting:"bg-purple-500/10 text-purple-600 border-purple-500/20",Task:"bg-amber-500/10 text-amber-600 border-amber-500/20",Demo:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20"};function Nk(t){return VN.find(a=>a.value===t)?.icon||Ui}function Ek({open:t,onOpenChange:r,activity:a,dealId:l,onSuccess:s}){const c=!a,[u,d]=g.useState(""),[m,v]=g.useState(""),[b,y]=g.useState(""),[w,C]=g.useState(!1);t&&!w&&(a?(d(a.name||""),v(a.type||""),y(a.plannedAt?a.plannedAt.split("T")[0]:"")):(d(""),v(""),y("")),C(!0)),!t&&w&&C(!1);const E=z=>{r(z)},S=$e.activities.create.useMutation({onSuccess:()=>{s(),r(!1)}}),R=$e.activities.update.useMutation({onSuccess:()=>{s(),r(!1)}}),M=()=>{c?u.trim()&&m&&S.mutate({name:u,type:m,deal:[l],plannedAt:b||void 0}):a?.id&&R.mutate({id:a.id,name:u,type:m||void 0,plannedAt:b||void 0})},O=S.isPending||R.isPending,_=c?u.trim()&&m:u.trim();return h.jsx(Kp,{open:t,onOpenChange:E,children:h.jsxs(wd,{children:[h.jsxs(Cd,{children:[h.jsx(Ed,{children:c?"New Activity":"Edit Activity"}),h.jsx(jd,{children:c?"Create a new activity for this deal":"Update the activity details"})]}),h.jsxs("div",{className:"space-y-4 py-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"activity-name",children:"Activity Name *"}),h.jsx(An,{id:"activity-name",value:u,onChange:z=>d(z.target.value),placeholder:"e.g., Follow-up call, Send proposal..."})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"activity-type",children:"Type *"}),h.jsxs(Xl,{value:m,onValueChange:z=>v(z),children:[h.jsx(Yi,{id:"activity-type",children:h.jsx($l,{placeholder:"Select activity type..."})}),h.jsx(Ki,{children:VN.map(z=>{const k=z.icon;return h.jsx(_n,{value:z.value,children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(k,{className:"h-4 w-4"}),z.label]})},z.value)})})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"planned-at",children:"Planned Date"}),h.jsx(An,{id:"planned-at",type:"date",value:b,onChange:z=>y(z.target.value)})]})]}),h.jsxs(Nd,{children:[h.jsx(Ge,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),h.jsxs(Ge,{onClick:M,disabled:O||!_,children:[O&&h.jsx(Yn,{className:"h-4 w-4 animate-spin mr-2"}),c?"Create":"Save"]})]})]})})}function jk({open:t,onOpenChange:r,activityId:a,onSuccess:l}){const[s,c]=g.useState(""),u=$e.notes.create.useMutation({onSuccess:()=>{c(""),l(),r(!1)}}),d=()=>{a&&s.trim()&&u.mutate({name:s,activities1:[a]})};return h.jsx(Kp,{open:t,onOpenChange:r,children:h.jsxs(wd,{children:[h.jsxs(Cd,{children:[h.jsx(Ed,{children:"Add Note"}),h.jsx(jd,{children:"Add a note to this activity"})]}),h.jsx("div",{className:"py-4",children:h.jsx(gd,{value:s,onChange:m=>c(m.target.value),placeholder:"Write your note here...",className:"min-h-[120px]"})}),h.jsxs(Nd,{children:[h.jsx(Ge,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),h.jsxs(Ge,{onClick:d,disabled:u.isPending||!s.trim(),children:[u.isPending&&h.jsx(Yn,{className:"h-4 w-4 animate-spin mr-2"}),"Add Note"]})]})]})})}function Rk({phase:t}){const r=ao[t];if(!r)return h.jsx(lv,{variant:"outline",children:t});const a=r.icon;return h.jsxs("div",{className:ye("inline-flex items-center gap-2 px-3 py-1.5 rounded-full",r.bgColor),children:[h.jsx(a,{className:ye("h-4 w-4",r.color)}),h.jsx("span",{className:ye("font-medium",r.color),children:r.label})]})}function Mk(){const{id:t}=cR(),r=js(),a=t?parseInt(t,10):null,[l,s]=g.useState(!1),[c,u]=g.useState(null),[d,m]=g.useState(!1),[v,b]=g.useState(null),[y,w]=g.useState(new Set),[C,E]=g.useState(null),[S,R]=g.useState(!1),{data:M,isLoading:O,refetch:_}=$e.deals.getDetails.useQuery({id:a},{enabled:!!a}),z=M,k=$e.activities.complete.useMutation({onSuccess:()=>{E(null),_()}}),I=$e.activities.uncomplete.useMutation({onSuccess:()=>{E(null),_()}}),N=$e.activities.delete.useMutation({onSuccess:()=>_()}),T=$e.deals.update.useMutation({onSuccess:()=>{R(!1),_()}}),A=ie=>{E(ie),k.mutate({id:ie})},q=ie=>{E(ie),I.mutate({id:ie})},K=ie=>{confirm("Are you sure you want to delete this activity?")&&N.mutate({id:ie})},W=ie=>{u(ie),s(!0)},ue=ie=>{b(ie),m(!0)},le=ie=>{w(D=>{const Q=new Set(D);return Q.has(ie)?Q.delete(ie):Q.add(ie),Q})},de=ie=>{a&&T.mutate({id:a,phase:ie})},L=z?.activities?.filter(ie=>!ie.doneAt)||[],G=z?.activities?.filter(ie=>ie.doneAt)||[],B=z?.mainContact?.[0],ee=B?.company?.[0];return a?O?h.jsx("div",{className:"container mx-auto p-6 max-w-7xl",children:h.jsx("div",{className:"flex items-center justify-center py-20",children:h.jsx(Yn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):z?h.jsxs("div",{className:"container mx-auto p-6 max-w-7xl space-y-6",children:[h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex items-start gap-4",children:[h.jsx(Ge,{variant:"ghost",size:"icon",onClick:()=>r("/deals"),className:"mt-1",children:h.jsx(kM,{className:"h-5 w-5"})}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 border border-primary/20",children:h.jsx(ni,{className:"h-6 w-6 text-primary"})}),h.jsx("h1",{className:"text-2xl font-bold",children:z.name})]})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[S?h.jsxs(Xl,{value:z.phase||"New",onValueChange:ie=>{de(ie)},children:[h.jsx(Yi,{className:"w-[200px]",children:h.jsx($l,{})}),h.jsx(Ki,{children:sN.map(ie=>{const D=ao[ie],Q=D.icon;return h.jsx(_n,{value:ie,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Q,{className:ye("h-4 w-4",D.color)}),h.jsx("span",{children:D.label})]})},ie)})})]}):h.jsx("button",{onClick:()=>R(!0),className:"hover:opacity-80 transition-opacity",children:h.jsx(Rk,{phase:z.phase||"New"})}),h.jsxs("span",{className:"text-sm text-muted-foreground",children:["Created ",np(z.createdAt)]})]})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[h.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[h.jsxs(cr,{children:[h.jsxs(ur,{children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(HM,{className:"h-5 w-5 text-primary"}),h.jsx(dr,{className:"text-lg",children:"Activities"}),h.jsxs(lv,{variant:"secondary",className:"ml-2",children:[L.length," pending"]})]}),h.jsxs(Ge,{onClick:()=>{u(null),s(!0)},size:"sm",children:[h.jsx($i,{className:"h-4 w-4 mr-2"}),"Add Activity"]})]}),h.jsx(no,{children:"Manage tasks and follow-ups for this deal"})]}),h.jsx(fr,{children:h.jsxs(yk,{defaultValue:"pending",className:"w-full",children:[h.jsxs(IN,{className:"mb-4",children:[h.jsxs(ep,{value:"pending",className:"gap-2",children:[h.jsx(WM,{className:"h-4 w-4"}),"Pending (",L.length,")"]}),h.jsxs(ep,{value:"completed",className:"gap-2",children:[h.jsx(ps,{className:"h-4 w-4"}),"Completed (",G.length,")"]})]}),h.jsx(tp,{value:"pending",className:"space-y-3",children:L.length===0?h.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[h.jsx(Os,{className:"h-12 w-12 mx-auto mb-3 opacity-20"}),h.jsx("p",{children:"No pending activities"}),h.jsx(Ge,{variant:"link",onClick:()=>{u(null),s(!0)},className:"mt-2",children:"Create your first activity"})]}):L.map(ie=>h.jsx(Bx,{activity:ie,onComplete:A,onUncomplete:q,onEdit:W,onDelete:K,onAddNote:ue,isCompleting:C===ie.id,expanded:y.has(ie.id||0),onToggleExpand:()=>ie.id&&le(ie.id)},ie.id))}),h.jsx(tp,{value:"completed",className:"space-y-3",children:G.length===0?h.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[h.jsx(ps,{className:"h-12 w-12 mx-auto mb-3 opacity-20"}),h.jsx("p",{children:"No completed activities yet"})]}):G.map(ie=>h.jsx(Bx,{activity:ie,onComplete:A,onUncomplete:q,onEdit:W,onDelete:K,onAddNote:ue,isCompleting:C===ie.id,expanded:y.has(ie.id||0),onToggleExpand:()=>ie.id&&le(ie.id)},ie.id))})]})})]}),z.notes&&h.jsxs(cr,{children:[h.jsx(ur,{className:"pb-3",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(uO,{className:"h-5 w-5 text-primary"}),h.jsx(dr,{className:"text-lg",children:"Deal Notes"})]})}),h.jsx(fr,{children:h.jsx("p",{className:"text-sm whitespace-pre-wrap",children:z.notes})})]})]}),h.jsxs("div",{className:"space-y-6",children:[B?h.jsx(Sk,{contact:B}):h.jsxs(cr,{children:[h.jsx(ur,{className:"pb-3",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:h.jsx(zn,{className:"h-4 w-4 text-blue-500"})}),h.jsx(dr,{className:"text-base",children:"Contact"})]})}),h.jsx(fr,{children:h.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact assigned to this deal"})})]}),ee?h.jsx(wk,{company:ee}):B?h.jsxs(cr,{children:[h.jsx(ur,{className:"pb-3",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"p-2 rounded-lg bg-purple-500/10",children:h.jsx(ma,{className:"h-4 w-4 text-purple-500"})}),h.jsx(dr,{className:"text-base",children:"Company"})]})}),h.jsx(fr,{children:h.jsx("p",{className:"text-sm text-muted-foreground",children:"No company linked to this contact"})})]}):null,h.jsxs(cr,{children:[h.jsx(ur,{className:"pb-3",children:h.jsx(dr,{className:"text-base",children:"Summary"})}),h.jsxs(fr,{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Total Activities"}),h.jsx("span",{className:"font-medium",children:z.activities?.length||0})]}),h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Pending"}),h.jsx("span",{className:"font-medium text-amber-600",children:L.length})]}),h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Completed"}),h.jsx("span",{className:"font-medium text-green-600",children:G.length})]}),h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Overdue"}),h.jsx("span",{className:"font-medium text-red-600",children:L.filter(ie=>QN(ie.plannedAt,ie.doneAt)).length})]}),h.jsx("div",{className:"pt-3 border-t",children:h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Last Updated"}),h.jsx("span",{children:np(z.updatedAt)})]})})]})]})]})]}),h.jsx(Ek,{open:l,onOpenChange:s,activity:c,dealId:a,onSuccess:_}),h.jsx(jk,{open:d,onOpenChange:m,activityId:v,onSuccess:_})]}):h.jsxs("div",{className:"container mx-auto p-6 max-w-7xl",children:[h.jsx("p",{className:"text-muted-foreground",children:"Deal not found"}),h.jsx(Ge,{variant:"link",onClick:()=>r("/deals"),className:"mt-2",children:"Back to Deals"})]}):h.jsx("div",{className:"container mx-auto p-6 max-w-7xl",children:h.jsx("p",{className:"text-muted-foreground",children:"Invalid deal ID"})})}const Ok=[{value:"Call",label:"Call",icon:pa},{value:"Meeting",label:"Meeting",icon:zn},{value:"Task",label:"Task",icon:Ui},{value:"Demo",label:"Demo",icon:Zu}];function Dk({open:t,onOpenChange:r,activityId:a,dealId:l,onSuccess:s,layer:c=0}){const u=!a,[d,m]=g.useState(""),{data:v,isLoading:b}=$e.activities.getById.useQuery({id:a},{enabled:!!a&&t}),{data:y,isLoading:w}=$e.deals.search.useQuery({query:d,limit:5},{enabled:t}),C=()=>{if(u){if(l){const J=y?.find(ne=>ne.id===l);if(J?.id&&J?.name)return{id:J.id,name:J.name}}return null}if(!v?.deal?.[0])return null;const Q=v.deal[0];return!Q.id||!Q.name?null:{id:Q.id,name:Q.name}},E=u?"":v?.name||"",S=u?void 0:v?.type,R=u?"":v?.plannedAt?Tk(v.plannedAt):"",M=C(),[O,_]=g.useState(""),[z,k]=g.useState(void 0),[I,N]=g.useState(""),[T,A]=g.useState(null),[q,K]=g.useState(!1);t&&!b&&!q&&(_(E),k(S),N(R),A(M),K(!0)),!t&&q&&K(!1);const W=u?T!==null:T?.id!==M?.id,ue=u?O.trim().length>0||z!==void 0||I!==""||T!==null:O!==E||z!==S||I!==R||W,le=u?O.trim().length>0&&z!==void 0:ue,de=$e.activities.create.useMutation({onSuccess:()=>{s?.(),r(!1)}}),L=$e.activities.update.useMutation({onSuccess:()=>{s?.(),r(!1)}}),G=$e.activities.delete.useMutation({onSuccess:()=>{s?.(),r(!1)}}),B=()=>{u?O.trim()&&z&&de.mutate({name:O,type:z,plannedAt:I?new Date(I).toISOString():void 0,deal:T?[T.id]:void 0}):a&&ue&&L.mutate({id:a,name:O||void 0,type:z,plannedAt:I?new Date(I).toISOString():void 0})},ee=()=>{a&&G.mutate({id:a})},ie=de.isPending||L.isPending,D=(y||[]).filter(Q=>Q.id!==void 0&&Q.name!==void 0).map(Q=>({id:Q.id,name:Q.name}));return h.jsxs(Rd,{open:t,onOpenChange:r,title:u?"New Activity":"Activity Details",description:u?"Create a new activity":"View and edit activity information",icon:h.jsx(ms,{className:"h-5 w-5 text-primary"}),isCreateMode:u,isLoading:b,hasChanges:le,isPending:ie,isDeletePending:G.isPending,onSave:B,onDelete:u?void 0:ee,layer:c,footer:!u&&v?h.jsx("div",{className:"pt-4 border-t",children:h.jsxs("p",{className:"text-xs text-muted-foreground",children:["Created: ",v.createdAt?new Date(v.createdAt).toLocaleDateString():"-",v.updatedAt&&h.jsxs(h.Fragment,{children:[" | Updated: ",new Date(v.updatedAt).toLocaleDateString()]})]})}):void 0,children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"name",children:"Activity Name *"}),h.jsx(An,{id:"name",value:O,onChange:Q=>_(Q.target.value),placeholder:"e.g., Follow-up call with client"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"type",children:"Type *"}),h.jsxs(Xl,{value:z,onValueChange:Q=>k(Q),children:[h.jsx(Yi,{id:"type",children:h.jsx($l,{placeholder:"Select activity type..."})}),h.jsx(Ki,{children:Ok.map(Q=>{const J=Q.icon;return h.jsx(_n,{value:Q.value,children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(J,{className:"h-4 w-4"}),Q.label]})},Q.value)})})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{htmlFor:"plannedAt",children:"Planned Date & Time"}),h.jsxs("div",{className:"relative",children:[h.jsx(Os,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(An,{id:"plannedAt",type:"datetime-local",value:I,onChange:Q=>N(Q.target.value),className:"pl-10"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(kt,{children:"Related Deal"}),h.jsx(Xp,{value:T,onChange:A,onSearch:m,onCreateNew:()=>{},options:D,isLoading:w,placeholder:"Select a deal...",icon:ni,entityName:"Deal",disabled:!u}),!u&&h.jsx("p",{className:"text-xs text-muted-foreground",children:"Deal association cannot be changed after creation"})]})]})}function Tk(t){const r=new Date(t),a=r.getFullYear(),l=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0"),c=String(r.getHours()).padStart(2,"0"),u=String(r.getMinutes()).padStart(2,"0");return`${a}-${l}-${s}T${c}:${u}`}const Hx={Call:pa,Meeting:zn,Task:Ui,Demo:Zu},qx={Call:"bg-blue-500/10 text-blue-600 border-blue-500/20",Meeting:"bg-purple-500/10 text-purple-600 border-purple-500/20",Task:"bg-amber-500/10 text-amber-600 border-amber-500/20",Demo:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20"};function _k(){const r=!!Sa().state?.openCreate,[a,l]=g.useState(r),[s,c]=g.useState(null),[u,d]=g.useState("all"),[m,v]=g.useState("all"),[b,y]=g.useState(null);g.useLayoutEffect(()=>{r&&window.history.replaceState({},document.title)},[r]);const{data:w,isLoading:C,refetch:E}=$e.activities.getAll.useQuery({dateFilter:u,typeFilter:m}),S=$e.activities.complete.useMutation({onSuccess:()=>{E(),y(null)},onError:()=>y(null)}),R=$e.activities.uncomplete.useMutation({onSuccess:()=>{E(),y(null)},onError:()=>y(null)}),M=A=>A?new Date(A).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"-",O=A=>A?new Date(A).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"-",_=A=>{c(A),l(!0)},z=()=>{c(null),l(!0)},k=()=>{E()},I=(A,q,K)=>{A.stopPropagation(),y(q),K?R.mutate({id:q}):S.mutate({id:q})},N=A=>A&&A in Hx?Hx[A]:Ui,T=A=>A&&A in qx?qx[A]:"bg-muted text-muted-foreground border-muted";return h.jsxs("div",{className:"container mx-auto p-6 max-w-6xl space-y-6",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 border border-primary/20",children:h.jsx(ms,{className:"h-6 w-6 text-primary"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Activities"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Track calls, meetings, tasks and demos"})]})]}),h.jsxs(Ge,{onClick:z,children:[h.jsx($i,{className:"h-4 w-4 mr-2"}),"New Activity"]})]}),h.jsxs(cr,{children:[h.jsx(ur,{className:"pb-4",children:h.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[h.jsxs("div",{children:[h.jsx(dr,{className:"text-lg",children:"All Activities"}),h.jsxs(no,{children:[w?.length??0," ",w?.length===1?"activity":"activities"]})]}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs(Xl,{value:u,onValueChange:A=>d(A),children:[h.jsxs(Yi,{className:"w-[140px]",children:[h.jsx(Os,{className:"h-4 w-4 mr-2 text-muted-foreground"}),h.jsx($l,{placeholder:"Date filter"})]}),h.jsxs(Ki,{children:[h.jsx(_n,{value:"all",children:"All Dates"}),h.jsx(_n,{value:"today",children:"Today"}),h.jsx(_n,{value:"thisWeek",children:"This Week"}),h.jsx(_n,{value:"thisMonth",children:"This Month"})]})]}),h.jsxs(Xl,{value:m,onValueChange:A=>v(A),children:[h.jsxs(Yi,{className:"w-[140px]",children:[h.jsx(Ui,{className:"h-4 w-4 mr-2 text-muted-foreground"}),h.jsx($l,{placeholder:"Type filter"})]}),h.jsxs(Ki,{children:[h.jsx(_n,{value:"all",children:"All Types"}),h.jsx(_n,{value:"Call",children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(pa,{className:"h-3.5 w-3.5"}),"Call"]})}),h.jsx(_n,{value:"Meeting",children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(zn,{className:"h-3.5 w-3.5"}),"Meeting"]})}),h.jsx(_n,{value:"Task",children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(Ui,{className:"h-3.5 w-3.5"}),"Task"]})}),h.jsx(_n,{value:"Demo",children:h.jsxs("span",{className:"flex items-center gap-2",children:[h.jsx(Zu,{className:"h-3.5 w-3.5"}),"Demo"]})})]})]})]})]})}),h.jsx(fr,{children:C?h.jsx("div",{className:"flex items-center justify-center py-12",children:h.jsx(Yn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):w&&w.length>0?h.jsx("div",{className:"rounded-lg border",children:h.jsxs(Us,{children:[h.jsx(Bs,{children:h.jsxs(ya,{children:[h.jsx($t,{className:"w-[50px]",children:"Status"}),h.jsx($t,{children:"Activity"}),h.jsx($t,{children:"Type"}),h.jsx($t,{children:"Deal"}),h.jsx($t,{children:"Planned"}),h.jsx($t,{children:"Completed"})]})}),h.jsx(Hs,{children:w.map(A=>{const q=N(A.type),K=!!A.doneAt;return h.jsxs(ya,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>A.id&&_(A.id),children:[h.jsx(Zt,{children:h.jsx("button",{onClick:W=>A.id&&I(W,A.id,K),className:"p-1 rounded-md hover:bg-muted transition-colors disabled:opacity-50",disabled:b===A.id,children:b===A.id?h.jsx(Yn,{className:"h-5 w-5 animate-spin text-primary"}):K?h.jsx(ps,{className:"h-5 w-5 text-emerald-500 transition-all duration-300 animate-in zoom-in-50"}):h.jsx(gp,{className:"h-5 w-5 text-muted-foreground hover:text-primary transition-colors"})})}),h.jsx(Zt,{className:`font-medium ${K?"line-through text-muted-foreground":""}`,children:A.name||"-"}),h.jsx(Zt,{children:A.type?h.jsxs(lv,{variant:"outline",className:`${T(A.type)} gap-1.5`,children:[h.jsx(q,{className:"h-3 w-3"}),A.type]}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Zt,{children:A.deal&&A.deal.length>0?h.jsx("span",{className:"text-primary font-medium",children:A.deal[0].name}):h.jsx("span",{className:"text-muted-foreground",children:"-"})}),h.jsx(Zt,{className:"text-muted-foreground",children:O(A.plannedAt)}),h.jsx(Zt,{className:"text-muted-foreground",children:A.doneAt?h.jsx("span",{className:"text-emerald-600",children:M(A.doneAt)}):"-"})]},A.id)})})]})}):h.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[h.jsx(ms,{className:"h-12 w-12 mx-auto mb-4 opacity-20"}),h.jsx("p",{children:"No activities found."}),u!=="all"||m!=="all"?h.jsx(Ge,{variant:"link",onClick:()=>{d("all"),v("all")},className:"mt-2",children:"Clear filters"}):h.jsx(Ge,{variant:"link",onClick:z,className:"mt-2",children:"Create your first activity"})]})})]}),h.jsx(Dk,{open:a,onOpenChange:l,activityId:s,onSuccess:k})]})}const Ak=()=>h.jsxs("section",{className:"space-y-4 text-center",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-sm uppercase tracking-wide text-muted-foreground",children:"404"}),h.jsx("h1",{className:"text-2xl font-semibold",children:"Page not found"}),h.jsx("p",{className:"text-muted-foreground",children:"The page you are looking for does not exist or has moved."})]}),h.jsx("div",{className:"flex justify-center",children:h.jsx(Ge,{asChild:!0,children:h.jsx(cS,{to:"/",children:"Go back home"})})})]}),Ix=new yM({defaultOptions:{queries:{staleTime:5*1e3}}}),zk=TR([{path:"/",element:h.jsx(W4,{}),children:[{index:!0,element:h.jsx(Sx,{})},{path:"companies",element:h.jsx(Sx,{})},{path:"contacts",element:h.jsx(K5,{})},{path:"deals",element:h.jsx(hk,{})},{path:"deals/:id",element:h.jsx(Mk,{})},{path:"activities",element:h.jsx(_k,{})}]},{path:"*",element:h.jsx(Ak,{})}]);l2.createRoot(document.getElementById("root")).render(h.jsx(g.StrictMode,{children:h.jsx($e.Provider,{client:E5,queryClient:Ix,children:h.jsx(bM,{client:Ix,children:h.jsx(BR,{router:zk})})})}));