lt?(Qn=st,st=null):Qn=st.sibling;var Hi=Ce(he,st,Ot.value,Re);if(Hi===null){st===null&&(st=Qn);break}l&&st&&Hi.alternate===null&&d(he,st),ne=C(Hi,ne,lt),nt===null?Qe=Hi:nt.sibling=Hi,nt=Hi,st=Qn}if(Ot.done)return p(he,st),hn&&zo(he,lt),Qe;if(st===null){for(;!Ot.done;lt++,Ot=fe.next())Ot=Ae(he,Ot.value,Re),Ot!==null&&(ne=C(Ot,ne,lt),nt===null?Qe=Ot:nt.sibling=Ot,nt=Ot);return hn&&zo(he,lt),Qe}for(st=g(he,st);!Ot.done;lt++,Ot=fe.next())Ot=Be(st,he,lt,Ot.value,Re),Ot!==null&&(l&&Ot.alternate!==null&&st.delete(Ot.key===null?lt:Ot.key),ne=C(Ot,ne,lt),nt===null?Qe=Ot:nt.sibling=Ot,nt=Ot);return l&&st.forEach(function(AT){return d(he,AT)}),hn&&zo(he,lt),Qe}function Mn(he,ne,fe,Re){if(typeof fe=="object"&&fe!==null&&fe.type===z&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case O:e:{for(var Qe=fe.key,nt=ne;nt!==null;){if(nt.key===Qe){if(Qe=fe.type,Qe===z){if(nt.tag===7){p(he,nt.sibling),ne=k(nt,fe.props.children),ne.return=he,he=ne;break e}}else if(nt.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===$&&gb(Qe)===nt.type){p(he,nt.sibling),ne=k(nt,fe.props),ne.ref=nd(he,nt,fe),ne.return=he,he=ne;break e}p(he,nt);break}else d(he,nt);nt=nt.sibling}fe.type===z?(ne=Ko(fe.props.children,he.mode,Re,fe.key),ne.return=he,he=ne):(Re=Xu(fe.type,fe.key,fe.props,null,he.mode,Re),Re.ref=nd(he,ne,fe),Re.return=he,he=Re)}return M(he);case q:e:{for(nt=fe.key;ne!==null;){if(ne.key===nt)if(ne.tag===4&&ne.stateNode.containerInfo===fe.containerInfo&&ne.stateNode.implementation===fe.implementation){p(he,ne.sibling),ne=k(ne,fe.children||[]),ne.return=he,he=ne;break e}else{p(he,ne);break}else d(he,ne);ne=ne.sibling}ne=qm(fe,he.mode,Re),ne.return=he,he=ne}return M(he);case $:return nt=fe._init,Mn(he,ne,nt(fe._payload),Re)}if(Ft(fe))return We(he,ne,fe,Re);if(oe(fe))return Ge(he,ne,fe,Re);Eu(he,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,ne!==null&&ne.tag===6?(p(he,ne.sibling),ne=k(ne,fe),ne.return=he,he=ne):(p(he,ne),ne=Km(fe,he.mode,Re),ne.return=he,he=ne),M(he)):p(he,ne)}return Mn}var Vl=yb(!0),bb=yb(!1),Mu=Ri(null),Au=null,Hl=null,nm=null;function sm(){nm=Hl=Au=null}function rm(l){var d=Mu.current;on(Mu),l._currentValue=d}function am(l,d,p){for(;l!==null;){var g=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,g!==null&&(g.childLanes|=d)):g!==null&&(g.childLanes&d)!==d&&(g.childLanes|=d),l===p)break;l=l.return}}function Ul(l,d){Au=l,nm=Hl=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Bs=!0),l.firstContext=null)}function yr(l){var d=l._currentValue;if(nm!==l)if(l={context:l,memoizedValue:d,next:null},Hl===null){if(Au===null)throw Error(n(308));Hl=l,Au.dependencies={lanes:0,firstContext:l}}else Hl=Hl.next=l;return d}var $o=null;function im(l){$o===null?$o=[l]:$o.push(l)}function vb(l,d,p,g){var k=d.interleaved;return k===null?(p.next=p,im(d)):(p.next=k.next,k.next=p),d.interleaved=p,Ga(l,g)}function Ga(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var Li=!1;function om(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nb(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function Ja(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Di(l,d,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(It&2)!==0){var k=g.pending;return k===null?d.next=d:(d.next=k.next,k.next=d),g.pending=d,Ga(l,p)}return k=g.interleaved,k===null?(d.next=d,im(g)):(d.next=k.next,k.next=d),g.interleaved=d,Ga(l,p)}function Iu(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,Ls(l,p)}}function wb(l,d){var p=l.updateQueue,g=l.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var k=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var M={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};C===null?k=C=M:C=C.next=M,p=p.next}while(p!==null);C===null?k=C=d:C=C.next=d}else k=C=d;p={baseState:g.baseState,firstBaseUpdate:k,lastBaseUpdate:C,shared:g.shared,effects:g.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Ru(l,d,p,g){var k=l.updateQueue;Li=!1;var C=k.firstBaseUpdate,M=k.lastBaseUpdate,W=k.shared.pending;if(W!==null){k.shared.pending=null;var Z=W,pe=Z.next;Z.next=null,M===null?C=pe:M.next=pe,M=Z;var Te=l.alternate;Te!==null&&(Te=Te.updateQueue,W=Te.lastBaseUpdate,W!==M&&(W===null?Te.firstBaseUpdate=pe:W.next=pe,Te.lastBaseUpdate=Z))}if(C!==null){var Ae=k.baseState;M=0,Te=pe=Z=null,W=C;do{var Ce=W.lane,Be=W.eventTime;if((g&Ce)===Ce){Te!==null&&(Te=Te.next={eventTime:Be,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var We=l,Ge=W;switch(Ce=d,Be=p,Ge.tag){case 1:if(We=Ge.payload,typeof We=="function"){Ae=We.call(Be,Ae,Ce);break e}Ae=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=Ge.payload,Ce=typeof We=="function"?We.call(Be,Ae,Ce):We,Ce==null)break e;Ae=G({},Ae,Ce);break e;case 2:Li=!0}}W.callback!==null&&W.lane!==0&&(l.flags|=64,Ce=k.effects,Ce===null?k.effects=[W]:Ce.push(W))}else Be={eventTime:Be,lane:Ce,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Te===null?(pe=Te=Be,Z=Ae):Te=Te.next=Be,M|=Ce;if(W=W.next,W===null){if(W=k.shared.pending,W===null)break;Ce=W,W=Ce.next,Ce.next=null,k.lastBaseUpdate=Ce,k.shared.pending=null}}while(!0);if(Te===null&&(Z=Ae),k.baseState=Z,k.firstBaseUpdate=pe,k.lastBaseUpdate=Te,d=k.shared.interleaved,d!==null){k=d;do M|=k.lane,k=k.next;while(k!==d)}else C===null&&(k.shared.lanes=0);Vo|=M,l.lanes=M,l.memoizedState=Ae}}function jb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var g=hm.transition;hm.transition={};try{l(!1),d()}finally{kt=p,hm.transition=g}}function Vb(){return br().memoizedState}function eT(l,d,p){var g=Fi(l);if(p={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null},Hb(l))Ub(d,p);else if(p=vb(l,d,p,g),p!==null){var k=Ms();Wr(p,l,g,k),Wb(p,d,g)}}function tT(l,d,p){var g=Fi(l),k={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null};if(Hb(l))Ub(d,k);else{var C=l.alternate;if(l.lanes===0&&(C===null||C.lanes===0)&&(C=d.lastRenderedReducer,C!==null))try{var M=d.lastRenderedState,W=C(M,p);if(k.hasEagerState=!0,k.eagerState=W,Fr(W,M)){var Z=d.interleaved;Z===null?(k.next=k,im(d)):(k.next=Z.next,Z.next=k),d.interleaved=k;return}}catch{}finally{}p=vb(l,d,k,g),p!==null&&(k=Ms(),Wr(p,l,g,k),Wb(p,d,g))}}function Hb(l){var d=l.alternate;return l===yn||d!==null&&d===yn}function Ub(l,d){id=Lu=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Wb(l,d,p){if((p&4194240)!==0){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,Ls(l,p)}}var zu={readContext:yr,useCallback:xs,useContext:xs,useEffect:xs,useImperativeHandle:xs,useInsertionEffect:xs,useLayoutEffect:xs,useMemo:xs,useReducer:xs,useRef:xs,useState:xs,useDebugValue:xs,useDeferredValue:xs,useTransition:xs,useMutableSource:xs,useSyncExternalStore:xs,useId:xs,unstable_isNewReconciler:!1},nT={readContext:yr,useCallback:function(l,d){return fa().memoizedState=[l,d===void 0?null:d],l},useContext:yr,useEffect:Ob,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Du(4194308,4,_b.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Du(4194308,4,l,d)},useInsertionEffect:function(l,d){return Du(4,2,l,d)},useMemo:function(l,d){var p=fa();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var g=fa();return d=p!==void 0?p(d):d,g.memoizedState=g.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},g.queue=l,l=l.dispatch=eT.bind(null,yn,l),[g.memoizedState,l]},useRef:function(l){var d=fa();return l={current:l},d.memoizedState=l},useState:Rb,useDebugValue:bm,useDeferredValue:function(l){return fa().memoizedState=l},useTransition:function(){var l=Rb(!1),d=l[0];return l=Z4.bind(null,l[1]),fa().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var g=yn,k=fa();if(hn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Jn===null)throw Error(n(349));(Bo&30)!==0||Tb(g,d,p)}k.memoizedState=p;var C={value:p,getSnapshot:d};return k.queue=C,Ob(Mb.bind(null,g,C,l),[l]),g.flags|=2048,cd(9,Eb.bind(null,g,C,p,d),void 0,null),p},useId:function(){var l=fa(),d=Jn.identifierPrefix;if(hn){var p=qa,g=Ka;p=(g&~(1<<32-qn(g)-1)).toString(32)+p,d=":"+d+"R"+p,p=od++,0")&&(Z=Z.replace("",l.displayName)),Z}while(1<=M&&0<=W);break}}}finally{H=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?U(l):""}function me(l){switch(l.tag){case 5:return U(l.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return l=K(l.type,!1),l;case 11:return l=K(l.type.render,!1),l;case 1:return l=K(l.type,!0),l;default:return""}}function Y(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case z:return"Fragment";case q:return"Portal";case I:return"Profiler";case V:return"StrictMode";case re:return"Suspense";case ie:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case Q:return(l.displayName||"Context")+".Consumer";case te:return(l._context.displayName||"Context")+".Provider";case F:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case J:return d=l.displayName||null,d!==null?d:Y(l.type)||"Memo";case $:d=l._payload,l=l._init;try{return Y(l(d))}catch{}}return null}function le(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Y(d);case 8:return d===V?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function de(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ve(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ye(l){var d=ve(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),g=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var k=p.get,C=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return k.call(this)},set:function(M){g=""+M,C.call(this,M)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return g},setValue:function(M){g=""+M},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function ke(l){l._valueTracker||(l._valueTracker=ye(l))}function ze(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),g="";return l&&(g=ve(l)?l.checked?"true":"false":l.value),l=g,l!==p?(d.setValue(l),!0):!1}function ft(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function wt(l,d){var p=d.checked;return G({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function dt(l,d){var p=d.defaultValue==null?"":d.defaultValue,g=d.checked!=null?d.checked:d.defaultChecked;p=de(d.value!=null?d.value:p),l._wrapperState={initialChecked:g,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function Rt(l,d){d=d.checked,d!=null&&T(l,"checked",d,!1)}function Tt(l,d){Rt(l,d);var p=de(d.value),g=d.type;if(p!=null)g==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(g==="submit"||g==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?mn(l,d.type,p):d.hasOwnProperty("defaultValue")&&mn(l,d.type,de(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function Tn(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var g=d.type;if(!(g!=="submit"&&g!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function mn(l,d,p){(d!=="number"||ft(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Ft=Array.isArray;function qt(l,d,p,g){if(l=l.options,d){d={};for(var k=0;k"+d.valueOf().toString()+"",d=ge.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function $e(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var Xe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},jt=["Webkit","ms","Moz","O"];Object.keys(Xe).forEach(function(l){jt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),Xe[d]=Xe[l]})});function gt(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||Xe.hasOwnProperty(l)&&Xe[l]?(""+d).trim():d+"px"}function L(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var g=p.indexOf("--")===0,k=gt(p,d[p],g);p==="float"&&(p="cssFloat"),g?l.setProperty(p,k):l[p]=k}}var Me=G({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function pt(l,d){if(d){if(Me[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function Et(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ht=null;function tt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Pt=null,Wt=null,en=null;function ts(l){if(l=td(l)){if(typeof Pt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Nu(d),Pt(l.stateNode,l.type,d))}}function Qs(l){Wt?en?en.push(l):en=[l]:Wt=l}function bi(){if(Wt){var l=Wt,d=en;if(en=Wt=null,ts(l),d)for(l=0;l>>=0,l===0?32:31-(Cl(l)/Pr|0)|0}var wi=64,Ra=4194304;function ra(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function aa(l,d){var p=l.pendingLanes;if(p===0)return 0;var g=0,k=l.suspendedLanes,C=l.pingedLanes,M=p&268435455;if(M!==0){var W=M&~k;W!==0?g=ra(W):(C&=M,C!==0&&(g=ra(C)))}else M=p&~k,M!==0?g=ra(M):C!==0&&(g=ra(C));if(g===0)return 0;if(d!==0&&d!==g&&(d&k)===0&&(k=g&-g,C=d&-d,k>=C||k===16&&(C&4194240)!==0))return d;if((g&4)!==0&&(g|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=g;0p;p++)d.push(l);return d}function En(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-qn(d),l[d]=p}function Pa(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var g=l.eventTimes;for(l=l.expirationTimes;0=Kc),Py=" ",Oy=!1;function Ly(l,d){switch(l){case"keyup":return T4.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Il=!1;function M4(l,d){switch(l){case"compositionend":return Dy(d);case"keypress":return d.which!==32?null:(Oy=!0,Py);case"textInput":return l=d.data,l===Py&&Oy?null:l;default:return null}}function A4(l,d){if(Il)return l==="compositionend"||!Rp&&Ly(l,d)?(l=Po(),Ba=Ro=mr=null,Il=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=g}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=Hy(p)}}function Wy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Wy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function Ky(){for(var l=window,d=ft();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=ft(l.document)}return d}function Lp(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function $4(l){var d=Ky(),p=l.focusedElem,g=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&Wy(p.ownerDocument.documentElement,p)){if(g!==null&&Lp(p)){if(d=g.start,l=g.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var k=p.textContent.length,C=Math.min(g.start,k);g=g.end===void 0?C:Math.min(g.end,k),!l.extend&&C>g&&(k=g,g=C,C=k),k=Uy(p,C);var M=Uy(p,g);k&&M&&(l.rangeCount!==1||l.anchorNode!==k.node||l.anchorOffset!==k.offset||l.focusNode!==M.node||l.focusOffset!==M.offset)&&(d=d.createRange(),d.setStart(k.node,k.offset),l.removeAllRanges(),C>g?(l.addRange(d),l.extend(M.node,M.offset)):(d.setEnd(M.node,M.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,Rl=null,Dp=null,Qc=null,_p=!1;function qy(l,d,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;_p||Rl==null||Rl!==ft(g)||(g=Rl,"selectionStart"in g&&Lp(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Qc&&Jc(Qc,g)||(Qc=g,g=yu(Dp,"onSelect"),0_l||(l.current=Jp[_l],Jp[_l]=null,_l--)}function tn(l,d){_l++,Jp[_l]=l.current,l.current=d}var Pi={},ms=Ri(Pi),$s=Ri(!1),Do=Pi;function zl(l,d){var p=l.type.contextTypes;if(!p)return Pi;var g=l.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===d)return g.__reactInternalMemoizedMaskedChildContext;var k={},C;for(C in p)k[C]=d[C];return g&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=k),k}function Fs(l){return l=l.childContextTypes,l!=null}function wu(){on($s),on(ms)}function lb(l,d,p){if(ms.current!==Pi)throw Error(n(168));tn(ms,d),tn($s,p)}function cb(l,d,p){var g=l.stateNode;if(d=d.childContextTypes,typeof g.getChildContext!="function")return p;g=g.getChildContext();for(var k in g)if(!(k in d))throw Error(n(108,le(l)||"Unknown",k));return G({},p,g)}function ju(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Pi,Do=ms.current,tn(ms,l),tn($s,$s.current),!0}function db(l,d,p){var g=l.stateNode;if(!g)throw Error(n(169));p?(l=cb(l,d,Do),g.__reactInternalMemoizedMergedChildContext=l,on($s),on(ms),tn(ms,l)):on($s),tn($s,p)}var Wa=null,ku=!1,Qp=!1;function ub(l){Wa===null?Wa=[l]:Wa.push(l)}function Y4(l){ku=!0,ub(l)}function Oi(){if(!Qp&&Wa!==null){Qp=!0;var l=0,d=kt;try{var p=Wa;for(kt=1;l>=M,k-=M,Ka=1<<32-qn(d)+k|p<lt?(Qn=st,st=null):Qn=st.sibling;var Ot=Ce(he,st,fe[lt],Re);if(Ot===null){st===null&&(st=Qn);break}l&&st&&Ot.alternate===null&&d(he,st),ne=C(Ot,ne,lt),nt===null?Qe=Ot:nt.sibling=Ot,nt=Ot,st=Qn}if(lt===fe.length)return p(he,st),hn&&zo(he,lt),Qe;if(st===null){for(;ltlt?(Qn=st,st=null):Qn=st.sibling;var Hi=Ce(he,st,Ot.value,Re);if(Hi===null){st===null&&(st=Qn);break}l&&st&&Hi.alternate===null&&d(he,st),ne=C(Hi,ne,lt),nt===null?Qe=Hi:nt.sibling=Hi,nt=Hi,st=Qn}if(Ot.done)return p(he,st),hn&&zo(he,lt),Qe;if(st===null){for(;!Ot.done;lt++,Ot=fe.next())Ot=Ae(he,Ot.value,Re),Ot!==null&&(ne=C(Ot,ne,lt),nt===null?Qe=Ot:nt.sibling=Ot,nt=Ot);return hn&&zo(he,lt),Qe}for(st=g(he,st);!Ot.done;lt++,Ot=fe.next())Ot=Be(st,he,lt,Ot.value,Re),Ot!==null&&(l&&Ot.alternate!==null&&st.delete(Ot.key===null?lt:Ot.key),ne=C(Ot,ne,lt),nt===null?Qe=Ot:nt.sibling=Ot,nt=Ot);return l&&st.forEach(function(IT){return d(he,IT)}),hn&&zo(he,lt),Qe}function Mn(he,ne,fe,Re){if(typeof fe=="object"&&fe!==null&&fe.type===z&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case O:e:{for(var Qe=fe.key,nt=ne;nt!==null;){if(nt.key===Qe){if(Qe=fe.type,Qe===z){if(nt.tag===7){p(he,nt.sibling),ne=k(nt,fe.props.children),ne.return=he,he=ne;break e}}else if(nt.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===$&&gb(Qe)===nt.type){p(he,nt.sibling),ne=k(nt,fe.props),ne.ref=nd(he,nt,fe),ne.return=he,he=ne;break e}p(he,nt);break}else d(he,nt);nt=nt.sibling}fe.type===z?(ne=Ko(fe.props.children,he.mode,Re,fe.key),ne.return=he,he=ne):(Re=Xu(fe.type,fe.key,fe.props,null,he.mode,Re),Re.ref=nd(he,ne,fe),Re.return=he,he=Re)}return M(he);case q:e:{for(nt=fe.key;ne!==null;){if(ne.key===nt)if(ne.tag===4&&ne.stateNode.containerInfo===fe.containerInfo&&ne.stateNode.implementation===fe.implementation){p(he,ne.sibling),ne=k(ne,fe.children||[]),ne.return=he,he=ne;break e}else{p(he,ne);break}else d(he,ne);ne=ne.sibling}ne=qm(fe,he.mode,Re),ne.return=he,he=ne}return M(he);case $:return nt=fe._init,Mn(he,ne,nt(fe._payload),Re)}if(Ft(fe))return We(he,ne,fe,Re);if(oe(fe))return Ge(he,ne,fe,Re);Eu(he,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,ne!==null&&ne.tag===6?(p(he,ne.sibling),ne=k(ne,fe),ne.return=he,he=ne):(p(he,ne),ne=Km(fe,he.mode,Re),ne.return=he,he=ne),M(he)):p(he,ne)}return Mn}var Vl=yb(!0),bb=yb(!1),Mu=Ri(null),Au=null,Hl=null,nm=null;function sm(){nm=Hl=Au=null}function rm(l){var d=Mu.current;on(Mu),l._currentValue=d}function am(l,d,p){for(;l!==null;){var g=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,g!==null&&(g.childLanes|=d)):g!==null&&(g.childLanes&d)!==d&&(g.childLanes|=d),l===p)break;l=l.return}}function Ul(l,d){Au=l,nm=Hl=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Bs=!0),l.firstContext=null)}function yr(l){var d=l._currentValue;if(nm!==l)if(l={context:l,memoizedValue:d,next:null},Hl===null){if(Au===null)throw Error(n(308));Hl=l,Au.dependencies={lanes:0,firstContext:l}}else Hl=Hl.next=l;return d}var $o=null;function im(l){$o===null?$o=[l]:$o.push(l)}function vb(l,d,p,g){var k=d.interleaved;return k===null?(p.next=p,im(d)):(p.next=k.next,k.next=p),d.interleaved=p,Ga(l,g)}function Ga(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var Li=!1;function om(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nb(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function Ja(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Di(l,d,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(It&2)!==0){var k=g.pending;return k===null?d.next=d:(d.next=k.next,k.next=d),g.pending=d,Ga(l,p)}return k=g.interleaved,k===null?(d.next=d,im(g)):(d.next=k.next,k.next=d),g.interleaved=d,Ga(l,p)}function Iu(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,Ls(l,p)}}function wb(l,d){var p=l.updateQueue,g=l.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var k=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var M={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};C===null?k=C=M:C=C.next=M,p=p.next}while(p!==null);C===null?k=C=d:C=C.next=d}else k=C=d;p={baseState:g.baseState,firstBaseUpdate:k,lastBaseUpdate:C,shared:g.shared,effects:g.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Ru(l,d,p,g){var k=l.updateQueue;Li=!1;var C=k.firstBaseUpdate,M=k.lastBaseUpdate,W=k.shared.pending;if(W!==null){k.shared.pending=null;var Z=W,pe=Z.next;Z.next=null,M===null?C=pe:M.next=pe,M=Z;var Te=l.alternate;Te!==null&&(Te=Te.updateQueue,W=Te.lastBaseUpdate,W!==M&&(W===null?Te.firstBaseUpdate=pe:W.next=pe,Te.lastBaseUpdate=Z))}if(C!==null){var Ae=k.baseState;M=0,Te=pe=Z=null,W=C;do{var Ce=W.lane,Be=W.eventTime;if((g&Ce)===Ce){Te!==null&&(Te=Te.next={eventTime:Be,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var We=l,Ge=W;switch(Ce=d,Be=p,Ge.tag){case 1:if(We=Ge.payload,typeof We=="function"){Ae=We.call(Be,Ae,Ce);break e}Ae=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=Ge.payload,Ce=typeof We=="function"?We.call(Be,Ae,Ce):We,Ce==null)break e;Ae=G({},Ae,Ce);break e;case 2:Li=!0}}W.callback!==null&&W.lane!==0&&(l.flags|=64,Ce=k.effects,Ce===null?k.effects=[W]:Ce.push(W))}else Be={eventTime:Be,lane:Ce,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Te===null?(pe=Te=Be,Z=Ae):Te=Te.next=Be,M|=Ce;if(W=W.next,W===null){if(W=k.shared.pending,W===null)break;Ce=W,W=Ce.next,Ce.next=null,k.lastBaseUpdate=Ce,k.shared.pending=null}}while(!0);if(Te===null&&(Z=Ae),k.baseState=Z,k.firstBaseUpdate=pe,k.lastBaseUpdate=Te,d=k.shared.interleaved,d!==null){k=d;do M|=k.lane,k=k.next;while(k!==d)}else C===null&&(k.shared.lanes=0);Vo|=M,l.lanes=M,l.memoizedState=Ae}}function jb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var g=hm.transition;hm.transition={};try{l(!1),d()}finally{kt=p,hm.transition=g}}function Vb(){return br().memoizedState}function tT(l,d,p){var g=Fi(l);if(p={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null},Hb(l))Ub(d,p);else if(p=vb(l,d,p,g),p!==null){var k=Ms();Wr(p,l,g,k),Wb(p,d,g)}}function nT(l,d,p){var g=Fi(l),k={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null};if(Hb(l))Ub(d,k);else{var C=l.alternate;if(l.lanes===0&&(C===null||C.lanes===0)&&(C=d.lastRenderedReducer,C!==null))try{var M=d.lastRenderedState,W=C(M,p);if(k.hasEagerState=!0,k.eagerState=W,Fr(W,M)){var Z=d.interleaved;Z===null?(k.next=k,im(d)):(k.next=Z.next,Z.next=k),d.interleaved=k;return}}catch{}finally{}p=vb(l,d,k,g),p!==null&&(k=Ms(),Wr(p,l,g,k),Wb(p,d,g))}}function Hb(l){var d=l.alternate;return l===yn||d!==null&&d===yn}function Ub(l,d){id=Lu=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Wb(l,d,p){if((p&4194240)!==0){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,Ls(l,p)}}var zu={readContext:yr,useCallback:xs,useContext:xs,useEffect:xs,useImperativeHandle:xs,useInsertionEffect:xs,useLayoutEffect:xs,useMemo:xs,useReducer:xs,useRef:xs,useState:xs,useDebugValue:xs,useDeferredValue:xs,useTransition:xs,useMutableSource:xs,useSyncExternalStore:xs,useId:xs,unstable_isNewReconciler:!1},sT={readContext:yr,useCallback:function(l,d){return fa().memoizedState=[l,d===void 0?null:d],l},useContext:yr,useEffect:Ob,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Du(4194308,4,_b.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Du(4194308,4,l,d)},useInsertionEffect:function(l,d){return Du(4,2,l,d)},useMemo:function(l,d){var p=fa();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var g=fa();return d=p!==void 0?p(d):d,g.memoizedState=g.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},g.queue=l,l=l.dispatch=tT.bind(null,yn,l),[g.memoizedState,l]},useRef:function(l){var d=fa();return l={current:l},d.memoizedState=l},useState:Rb,useDebugValue:bm,useDeferredValue:function(l){return fa().memoizedState=l},useTransition:function(){var l=Rb(!1),d=l[0];return l=eT.bind(null,l[1]),fa().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var g=yn,k=fa();if(hn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Jn===null)throw Error(n(349));(Bo&30)!==0||Tb(g,d,p)}k.memoizedState=p;var C={value:p,getSnapshot:d};return k.queue=C,Ob(Mb.bind(null,g,C,l),[l]),g.flags|=2048,cd(9,Eb.bind(null,g,C,p,d),void 0,null),p},useId:function(){var l=fa(),d=Jn.identifierPrefix;if(hn){var p=qa,g=Ka;p=(g&~(1<<32-qn(g)-1)).toString(32)+p,d=":"+d+"R"+p,p=od++,0<\/script>",l=l.removeChild(l.firstChild)):typeof g.is=="string"?l=M.createElement(p,{is:g.is}):(l=M.createElement(p),p==="select"&&(M=l,g.multiple?M.multiple=!0:g.size&&(M.size=g.size))):l=M.createElementNS(l,p),l[ua]=d,l[ed]=g,uv(l,d,!1,!1),d.stateNode=l;e:{switch(M=Et(p,g),p){case"dialog":an("cancel",l),an("close",l),k=g;break;case"iframe":case"object":case"embed":an("load",l),k=g;break;case"video":case"audio":for(k=0;kJl&&(d.flags|=128,g=!0,dd(C,!1),d.lanes=4194304)}else{if(!g)if(l=Pu(M),l!==null){if(d.flags|=128,g=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),dd(C,!0),C.tail===null&&C.tailMode==="hidden"&&!M.alternate&&!hn)return gs(d),null}else 2*Mt()-C.renderingStartTime>Jl&&p!==1073741824&&(d.flags|=128,g=!0,dd(C,!1),d.lanes=4194304);C.isBackwards?(M.sibling=d.child,d.child=M):(p=C.last,p!==null?p.sibling=M:d.child=M,C.last=M)}return C.tail!==null?(d=C.tail,C.rendering=d,C.tail=d.sibling,C.renderingStartTime=Mt(),d.sibling=null,p=gn.current,tn(gn,g?p&1|2:p&1),d):(gs(d),null);case 22:case 23:return Hm(),g=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(d.flags|=8192),g&&(d.mode&1)!==0?(sr&1073741824)!==0&&(gs(d),d.subtreeFlags&6&&(d.flags|=8192)):gs(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function dT(l,d){switch(Xp(d),d.tag){case 1:return Fs(d.type)&&wu(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Wl(),on($s),on(ms),um(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return cm(d),null;case 13:if(on(gn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Bl()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return on(gn),null;case 4:return Wl(),null;case 10:return rm(d.type._context),null;case 22:case 23:return Hm(),null;case 24:return null;default:return null}}var Vu=!1,ys=!1,uT=typeof WeakSet=="function"?WeakSet:Set,He=null;function ql(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(g){Nn(l,d,g)}else p.current=null}function Im(l,d,p){try{p()}catch(g){Nn(l,d,g)}}var pv=!1;function hT(l,d){if(Hp=$a,l=Ky(),Lp(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var g=p.getSelection&&p.getSelection();if(g&&g.rangeCount!==0){p=g.anchorNode;var k=g.anchorOffset,C=g.focusNode;g=g.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var M=0,W=-1,Z=-1,pe=0,Te=0,Ae=l,Ce=null;t:for(;;){for(var Be;Ae!==p||k!==0&&Ae.nodeType!==3||(W=M+k),Ae!==C||g!==0&&Ae.nodeType!==3||(Z=M+g),Ae.nodeType===3&&(M+=Ae.nodeValue.length),(Be=Ae.firstChild)!==null;)Ce=Ae,Ae=Be;for(;;){if(Ae===l)break t;if(Ce===p&&++pe===k&&(W=M),Ce===C&&++Te===g&&(Z=M),(Be=Ae.nextSibling)!==null)break;Ae=Ce,Ce=Ae.parentNode}Ae=Be}p=W===-1||Z===-1?null:{start:W,end:Z}}else p=null}p=p||{start:0,end:0}}else p=null;for(Up={focusedElem:l,selectionRange:p},$a=!1,He=d;He!==null;)if(d=He,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,He=l;else for(;He!==null;){d=He;try{var We=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(We!==null){var Ge=We.memoizedProps,Mn=We.memoizedState,he=d.stateNode,ne=he.getSnapshotBeforeUpdate(d.elementType===d.type?Ge:Vr(d.type,Ge),Mn);he.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var fe=d.stateNode.containerInfo;fe.nodeType===1?fe.textContent="":fe.nodeType===9&&fe.documentElement&&fe.removeChild(fe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Re){Nn(d,d.return,Re)}if(l=d.sibling,l!==null){l.return=d.return,He=l;break}He=d.return}return We=pv,pv=!1,We}function ud(l,d,p){var g=d.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var k=g=g.next;do{if((k.tag&l)===l){var C=k.destroy;k.destroy=void 0,C!==void 0&&Im(d,p,C)}k=k.next}while(k!==g)}}function Hu(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var g=p.create;p.destroy=g()}p=p.next}while(p!==d)}}function Rm(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function mv(l){var d=l.alternate;d!==null&&(l.alternate=null,mv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[ua],delete d[ed],delete d[Gp],delete d[G4],delete d[J4])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function xv(l){return l.tag===5||l.tag===3||l.tag===4}function gv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||xv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Pm(l,d,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=vu));else if(g!==4&&(l=l.child,l!==null))for(Pm(l,d,p),l=l.sibling;l!==null;)Pm(l,d,p),l=l.sibling}function Om(l,d,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(g!==4&&(l=l.child,l!==null))for(Om(l,d,p),l=l.sibling;l!==null;)Om(l,d,p),l=l.sibling}var rs=null,Hr=!1;function _i(l,d,p){for(p=p.child;p!==null;)yv(l,d,p),p=p.sibling}function yv(l,d,p){if(ns&&typeof ns.onCommitFiberUnmount=="function")try{ns.onCommitFiberUnmount(na,p)}catch{}switch(p.tag){case 5:ys||ql(p,d);case 6:var g=rs,k=Hr;rs=null,_i(l,d,p),rs=g,Hr=k,rs!==null&&(Hr?(l=rs,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):rs.removeChild(p.stateNode));break;case 18:rs!==null&&(Hr?(l=rs,p=p.stateNode,l.nodeType===8?qp(l.parentNode,p):l.nodeType===1&&qp(l,p),Dr(l)):qp(rs,p.stateNode));break;case 4:g=rs,k=Hr,rs=p.stateNode.containerInfo,Hr=!0,_i(l,d,p),rs=g,Hr=k;break;case 0:case 11:case 14:case 15:if(!ys&&(g=p.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){k=g=g.next;do{var C=k,M=C.destroy;C=C.tag,M!==void 0&&((C&2)!==0||(C&4)!==0)&&Im(p,d,M),k=k.next}while(k!==g)}_i(l,d,p);break;case 1:if(!ys&&(ql(p,d),g=p.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=p.memoizedProps,g.state=p.memoizedState,g.componentWillUnmount()}catch(W){Nn(p,d,W)}_i(l,d,p);break;case 21:_i(l,d,p);break;case 22:p.mode&1?(ys=(g=ys)||p.memoizedState!==null,_i(l,d,p),ys=g):_i(l,d,p);break;default:_i(l,d,p)}}function bv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new uT),d.forEach(function(g){var k=NT.bind(null,l,g);p.has(g)||(p.add(g),g.then(k,k))})}}function Ur(l,d){var p=d.deletions;if(p!==null)for(var g=0;gk&&(k=M),g&=~C}if(g=k,g=Mt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*pT(g/1960))-g,10l?16:l,$i===null)var g=!1;else{if(l=$i,$i=null,Gu=0,(It&6)!==0)throw Error(n(331));var k=It;for(It|=4,He=l.current;He!==null;){var C=He,M=C.child;if((He.flags&16)!==0){var W=C.deletions;if(W!==null){for(var Z=0;ZMt()-_m?Uo(l,0):Dm|=p),Hs(l,d)}function Rv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ra,Ra<<=1,(Ra&130023424)===0&&(Ra=4194304)));var p=Ms();l=Ga(l,d),l!==null&&(En(l,d,p),Hs(l,p))}function vT(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),Rv(l,p)}function NT(l,d){var p=0;switch(l.tag){case 13:var g=l.stateNode,k=l.memoizedState;k!==null&&(p=k.retryLane);break;case 19:g=l.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(d),Rv(l,p)}var Pv;Pv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||$s.current)Bs=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return Bs=!1,lT(l,d,p);Bs=(l.flags&131072)!==0}else Bs=!1,hn&&(d.flags&1048576)!==0&&hb(d,Cu,d.index);switch(d.lanes=0,d.tag){case 2:var g=d.type;Bu(l,d),l=d.pendingProps;var k=zl(d,ms.current);Ul(d,p),k=pm(null,d,g,l,k,p);var C=mm();return d.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Fs(g)?(C=!0,ju(d)):C=!1,d.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,om(d),k.updater=$u,d.stateNode=k,k._reactInternals=d,Nm(d,g,l,p),d=Sm(null,d,g,!0,C,p)):(d.tag=0,hn&&C&&Yp(d),Es(null,d,k,p),d=d.child),d;case 16:g=d.elementType;e:{switch(Bu(l,d),l=d.pendingProps,k=g._init,g=k(g._payload),d.type=g,k=d.tag=jT(g),l=Vr(g,l),k){case 0:d=km(null,d,g,l,p);break e;case 1:d=av(null,d,g,l,p);break e;case 11:d=ev(null,d,g,l,p);break e;case 14:d=tv(null,d,g,Vr(g.type,l),p);break e}throw Error(n(306,g,""))}return d;case 0:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),km(l,d,g,k,p);case 1:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),av(l,d,g,k,p);case 3:e:{if(iv(d),l===null)throw Error(n(387));g=d.pendingProps,C=d.memoizedState,k=C.element,Nb(l,d),Ru(d,g,null,p);var M=d.memoizedState;if(g=M.element,C.isDehydrated)if(C={element:g,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},d.updateQueue.baseState=C,d.memoizedState=C,d.flags&256){k=Kl(Error(n(423)),d),d=ov(l,d,g,p,k);break e}else if(g!==k){k=Kl(Error(n(424)),d),d=ov(l,d,g,p,k);break e}else for(nr=Ii(d.stateNode.containerInfo.firstChild),tr=d,hn=!0,Br=null,p=bb(d,null,g,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Bl(),g===k){d=Qa(l,d,p);break e}Es(l,d,g,p)}d=d.child}return d;case 5:return kb(d),l===null&&em(d),g=d.type,k=d.pendingProps,C=l!==null?l.memoizedProps:null,M=k.children,Wp(g,k)?M=null:C!==null&&Wp(g,C)&&(d.flags|=32),rv(l,d),Es(l,d,M,p),d.child;case 6:return l===null&&em(d),null;case 13:return lv(l,d,p);case 4:return lm(d,d.stateNode.containerInfo),g=d.pendingProps,l===null?d.child=Vl(d,null,g,p):Es(l,d,g,p),d.child;case 11:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),ev(l,d,g,k,p);case 7:return Es(l,d,d.pendingProps,p),d.child;case 8:return Es(l,d,d.pendingProps.children,p),d.child;case 12:return Es(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(g=d.type._context,k=d.pendingProps,C=d.memoizedProps,M=k.value,tn(Mu,g._currentValue),g._currentValue=M,C!==null)if(Fr(C.value,M)){if(C.children===k.children&&!$s.current){d=Qa(l,d,p);break e}}else for(C=d.child,C!==null&&(C.return=d);C!==null;){var W=C.dependencies;if(W!==null){M=C.child;for(var Z=W.firstContext;Z!==null;){if(Z.context===g){if(C.tag===1){Z=Ja(-1,p&-p),Z.tag=2;var pe=C.updateQueue;if(pe!==null){pe=pe.shared;var Te=pe.pending;Te===null?Z.next=Z:(Z.next=Te.next,Te.next=Z),pe.pending=Z}}C.lanes|=p,Z=C.alternate,Z!==null&&(Z.lanes|=p),am(C.return,p,d),W.lanes|=p;break}Z=Z.next}}else if(C.tag===10)M=C.type===d.type?null:C.child;else if(C.tag===18){if(M=C.return,M===null)throw Error(n(341));M.lanes|=p,W=M.alternate,W!==null&&(W.lanes|=p),am(M,p,d),M=C.sibling}else M=C.child;if(M!==null)M.return=C;else for(M=C;M!==null;){if(M===d){M=null;break}if(C=M.sibling,C!==null){C.return=M.return,M=C;break}M=M.return}C=M}Es(l,d,k.children,p),d=d.child}return d;case 9:return k=d.type,g=d.pendingProps.children,Ul(d,p),k=yr(k),g=g(k),d.flags|=1,Es(l,d,g,p),d.child;case 14:return g=d.type,k=Vr(g,d.pendingProps),k=Vr(g.type,k),tv(l,d,g,k,p);case 15:return nv(l,d,d.type,d.pendingProps,p);case 17:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),Bu(l,d),d.tag=1,Fs(g)?(l=!0,ju(d)):l=!1,Ul(d,p),qb(d,g,k),Nm(d,g,k,p),Sm(null,d,g,!0,l,p);case 19:return dv(l,d,p);case 22:return sv(l,d,p)}throw Error(n(156,d.tag))};function Ov(l,d){return To(l,d)}function wT(l,d,p,g){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nr(l,d,p,g){return new wT(l,d,p,g)}function Wm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function jT(l){if(typeof l=="function")return Wm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===F)return 11;if(l===J)return 14}return 2}function Vi(l,d){var p=l.alternate;return p===null?(p=Nr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function Xu(l,d,p,g,k,C){var M=2;if(g=l,typeof l=="function")Wm(l)&&(M=1);else if(typeof l=="string")M=5;else e:switch(l){case z:return Ko(p.children,k,C,d);case V:M=8,k|=8;break;case I:return l=Nr(12,p,d,k|2),l.elementType=I,l.lanes=C,l;case re:return l=Nr(13,p,d,k),l.elementType=re,l.lanes=C,l;case ie:return l=Nr(19,p,d,k),l.elementType=ie,l.lanes=C,l;case D:return Zu(p,k,C,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case te:M=10;break e;case Q:M=9;break e;case F:M=11;break e;case J:M=14;break e;case $:M=16,g=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Nr(M,p,d,k),d.elementType=l,d.type=g,d.lanes=C,d}function Ko(l,d,p,g){return l=Nr(7,l,g,d),l.lanes=p,l}function Zu(l,d,p,g){return l=Nr(22,l,g,d),l.elementType=D,l.lanes=p,l.stateNode={isHidden:!1},l}function Km(l,d,p){return l=Nr(6,l,null,d),l.lanes=p,l}function qm(l,d,p){return d=Nr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function kT(l,d,p,g,k){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Os(0),this.expirationTimes=Os(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Os(0),this.identifierPrefix=g,this.onRecoverableError=k,this.mutableSourceEagerHydrationData=null}function Gm(l,d,p,g,k,C,M,W,Z){return l=new kT(l,d,p,W,Z),d===1?(d=1,C===!0&&(d|=8)):d=0,C=Nr(3,null,null,d),l.current=C,C.stateNode=l,C.memoizedState={element:g,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},om(C),l}function ST(l,d,p){var g=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ex.exports=_T(),ex.exports}var Gv;function zT(){if(Gv)return ih;Gv=1;var t=dj();return ih.createRoot=t.createRoot,ih.hydrateRoot=t.hydrateRoot,ih}var $T=zT(),au=dj();const uj=cj(au);/**
+`+C.stack}return{value:l,source:d,stack:k,digest:null}}function wm(l,d,p){return{value:l,source:null,stack:p??null,digest:d??null}}function jm(l,d){try{console.error(d.value)}catch(p){setTimeout(function(){throw p})}}var iT=typeof WeakMap=="function"?WeakMap:Map;function Jb(l,d,p){p=Ja(-1,p),p.tag=3,p.payload={element:null};var g=d.value;return p.callback=function(){Ku||(Ku=!0,zm=g),jm(l,d)},p}function Qb(l,d,p){p=Ja(-1,p),p.tag=3;var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var k=d.value;p.payload=function(){return g(k)},p.callback=function(){jm(l,d)}}var C=l.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(p.callback=function(){jm(l,d),typeof g!="function"&&(zi===null?zi=new Set([this]):zi.add(this));var M=d.stack;this.componentDidCatch(d.value,{componentStack:M!==null?M:""})}),p}function Yb(l,d,p){var g=l.pingCache;if(g===null){g=l.pingCache=new iT;var k=new Set;g.set(d,k)}else k=g.get(d),k===void 0&&(k=new Set,g.set(d,k));k.has(p)||(k.add(p),l=vT.bind(null,l,d,p),d.then(l,l))}function Xb(l){do{var d;if((d=l.tag===13)&&(d=l.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return l;l=l.return}while(l!==null);return null}function Zb(l,d,p,g,k){return(l.mode&1)===0?(l===d?l.flags|=65536:(l.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(d=Ja(-1,1),d.tag=2,Di(p,d,1))),p.lanes|=1),l):(l.flags|=65536,l.lanes=k,l)}var oT=P.ReactCurrentOwner,Bs=!1;function Es(l,d,p,g){d.child=l===null?bb(d,null,p,g):Vl(d,l.child,p,g)}function ev(l,d,p,g,k){p=p.render;var C=d.ref;return Ul(d,k),g=pm(l,d,p,g,C,k),p=mm(),l!==null&&!Bs?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~k,Qa(l,d,k)):(hn&&p&&Yp(d),d.flags|=1,Es(l,d,g,k),d.child)}function tv(l,d,p,g,k){if(l===null){var C=p.type;return typeof C=="function"&&!Wm(C)&&C.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(d.tag=15,d.type=C,nv(l,d,C,g,k)):(l=Xu(p.type,null,g,d,d.mode,k),l.ref=d.ref,l.return=d,d.child=l)}if(C=l.child,(l.lanes&k)===0){var M=C.memoizedProps;if(p=p.compare,p=p!==null?p:Jc,p(M,g)&&l.ref===d.ref)return Qa(l,d,k)}return d.flags|=1,l=Vi(C,g),l.ref=d.ref,l.return=d,d.child=l}function nv(l,d,p,g,k){if(l!==null){var C=l.memoizedProps;if(Jc(C,g)&&l.ref===d.ref)if(Bs=!1,d.pendingProps=g=C,(l.lanes&k)!==0)(l.flags&131072)!==0&&(Bs=!0);else return d.lanes=l.lanes,Qa(l,d,k)}return km(l,d,p,g,k)}function sv(l,d,p){var g=d.pendingProps,k=g.children,C=l!==null?l.memoizedState:null;if(g.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},tn(Gl,sr),sr|=p;else{if((p&1073741824)===0)return l=C!==null?C.baseLanes|p:p,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:l,cachePool:null,transitions:null},d.updateQueue=null,tn(Gl,sr),sr|=l,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=C!==null?C.baseLanes:p,tn(Gl,sr),sr|=g}else C!==null?(g=C.baseLanes|p,d.memoizedState=null):g=p,tn(Gl,sr),sr|=g;return Es(l,d,k,p),d.child}function rv(l,d){var p=d.ref;(l===null&&p!==null||l!==null&&l.ref!==p)&&(d.flags|=512,d.flags|=2097152)}function km(l,d,p,g,k){var C=Fs(p)?Do:ms.current;return C=zl(d,C),Ul(d,k),p=pm(l,d,p,g,C,k),g=mm(),l!==null&&!Bs?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~k,Qa(l,d,k)):(hn&&g&&Yp(d),d.flags|=1,Es(l,d,p,k),d.child)}function av(l,d,p,g,k){if(Fs(p)){var C=!0;ju(d)}else C=!1;if(Ul(d,k),d.stateNode===null)Bu(l,d),qb(d,p,g),Nm(d,p,g,k),g=!0;else if(l===null){var M=d.stateNode,W=d.memoizedProps;M.props=W;var Z=M.context,pe=p.contextType;typeof pe=="object"&&pe!==null?pe=yr(pe):(pe=Fs(p)?Do:ms.current,pe=zl(d,pe));var Te=p.getDerivedStateFromProps,Ae=typeof Te=="function"||typeof M.getSnapshotBeforeUpdate=="function";Ae||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==g||Z!==pe)&&Gb(d,M,g,pe),Li=!1;var Ce=d.memoizedState;M.state=Ce,Ru(d,g,M,k),Z=d.memoizedState,W!==g||Ce!==Z||$s.current||Li?(typeof Te=="function"&&(vm(d,p,Te,g),Z=d.memoizedState),(W=Li||Kb(d,p,W,g,Ce,Z,pe))?(Ae||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(d.flags|=4194308)):(typeof M.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=g,d.memoizedState=Z),M.props=g,M.state=Z,M.context=pe,g=W):(typeof M.componentDidMount=="function"&&(d.flags|=4194308),g=!1)}else{M=d.stateNode,Nb(l,d),W=d.memoizedProps,pe=d.type===d.elementType?W:Vr(d.type,W),M.props=pe,Ae=d.pendingProps,Ce=M.context,Z=p.contextType,typeof Z=="object"&&Z!==null?Z=yr(Z):(Z=Fs(p)?Do:ms.current,Z=zl(d,Z));var Be=p.getDerivedStateFromProps;(Te=typeof Be=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==Ae||Ce!==Z)&&Gb(d,M,g,Z),Li=!1,Ce=d.memoizedState,M.state=Ce,Ru(d,g,M,k);var We=d.memoizedState;W!==Ae||Ce!==We||$s.current||Li?(typeof Be=="function"&&(vm(d,p,Be,g),We=d.memoizedState),(pe=Li||Kb(d,p,pe,g,Ce,We,Z)||!1)?(Te||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(g,We,Z),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(g,We,Z)),typeof M.componentDidUpdate=="function"&&(d.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof M.componentDidUpdate!="function"||W===l.memoizedProps&&Ce===l.memoizedState||(d.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||W===l.memoizedProps&&Ce===l.memoizedState||(d.flags|=1024),d.memoizedProps=g,d.memoizedState=We),M.props=g,M.state=We,M.context=Z,g=pe):(typeof M.componentDidUpdate!="function"||W===l.memoizedProps&&Ce===l.memoizedState||(d.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||W===l.memoizedProps&&Ce===l.memoizedState||(d.flags|=1024),g=!1)}return Sm(l,d,p,g,C,k)}function Sm(l,d,p,g,k,C){rv(l,d);var M=(d.flags&128)!==0;if(!g&&!M)return k&&db(d,p,!1),Qa(l,d,C);g=d.stateNode,oT.current=d;var W=M&&typeof p.getDerivedStateFromError!="function"?null:g.render();return d.flags|=1,l!==null&&M?(d.child=Vl(d,l.child,null,C),d.child=Vl(d,null,W,C)):Es(l,d,W,C),d.memoizedState=g.state,k&&db(d,p,!0),d.child}function iv(l){var d=l.stateNode;d.pendingContext?lb(l,d.pendingContext,d.pendingContext!==d.context):d.context&&lb(l,d.context,!1),lm(l,d.containerInfo)}function ov(l,d,p,g,k){return Bl(),tm(k),d.flags|=256,Es(l,d,p,g),d.child}var Cm={dehydrated:null,treeContext:null,retryLane:0};function Tm(l){return{baseLanes:l,cachePool:null,transitions:null}}function lv(l,d,p){var g=d.pendingProps,k=gn.current,C=!1,M=(d.flags&128)!==0,W;if((W=M)||(W=l!==null&&l.memoizedState===null?!1:(k&2)!==0),W?(C=!0,d.flags&=-129):(l===null||l.memoizedState!==null)&&(k|=1),tn(gn,k&1),l===null)return em(d),l=d.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((d.mode&1)===0?d.lanes=1:l.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(M=g.children,l=g.fallback,C?(g=d.mode,C=d.child,M={mode:"hidden",children:M},(g&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=M):C=Zu(M,g,0,null),l=Ko(l,g,p,null),C.return=d,l.return=d,C.sibling=l,d.child=C,d.child.memoizedState=Tm(p),d.memoizedState=Cm,l):Em(d,M));if(k=l.memoizedState,k!==null&&(W=k.dehydrated,W!==null))return lT(l,d,M,g,W,k,p);if(C){C=g.fallback,M=d.mode,k=l.child,W=k.sibling;var Z={mode:"hidden",children:g.children};return(M&1)===0&&d.child!==k?(g=d.child,g.childLanes=0,g.pendingProps=Z,d.deletions=null):(g=Vi(k,Z),g.subtreeFlags=k.subtreeFlags&14680064),W!==null?C=Vi(W,C):(C=Ko(C,M,p,null),C.flags|=2),C.return=d,g.return=d,g.sibling=C,d.child=g,g=C,C=d.child,M=l.child.memoizedState,M=M===null?Tm(p):{baseLanes:M.baseLanes|p,cachePool:null,transitions:M.transitions},C.memoizedState=M,C.childLanes=l.childLanes&~p,d.memoizedState=Cm,g}return C=l.child,l=C.sibling,g=Vi(C,{mode:"visible",children:g.children}),(d.mode&1)===0&&(g.lanes=p),g.return=d,g.sibling=null,l!==null&&(p=d.deletions,p===null?(d.deletions=[l],d.flags|=16):p.push(l)),d.child=g,d.memoizedState=null,g}function Em(l,d){return d=Zu({mode:"visible",children:d},l.mode,0,null),d.return=l,l.child=d}function Fu(l,d,p,g){return g!==null&&tm(g),Vl(d,l.child,null,p),l=Em(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function lT(l,d,p,g,k,C,M){if(p)return d.flags&256?(d.flags&=-257,g=wm(Error(n(422))),Fu(l,d,M,g)):d.memoizedState!==null?(d.child=l.child,d.flags|=128,null):(C=g.fallback,k=d.mode,g=Zu({mode:"visible",children:g.children},k,0,null),C=Ko(C,k,M,null),C.flags|=2,g.return=d,C.return=d,g.sibling=C,d.child=g,(d.mode&1)!==0&&Vl(d,l.child,null,M),d.child.memoizedState=Tm(M),d.memoizedState=Cm,C);if((d.mode&1)===0)return Fu(l,d,M,null);if(k.data==="$!"){if(g=k.nextSibling&&k.nextSibling.dataset,g)var W=g.dgst;return g=W,C=Error(n(419)),g=wm(C,g,void 0),Fu(l,d,M,g)}if(W=(M&l.childLanes)!==0,Bs||W){if(g=Jn,g!==null){switch(M&-M){case 4:k=2;break;case 16:k=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:k=32;break;case 536870912:k=268435456;break;default:k=0}k=(k&(g.suspendedLanes|M))!==0?0:k,k!==0&&k!==C.retryLane&&(C.retryLane=k,Ga(l,k),Wr(g,l,k,-1))}return Um(),g=wm(Error(n(421))),Fu(l,d,M,g)}return k.data==="$?"?(d.flags|=128,d.child=l.child,d=NT.bind(null,l),k._reactRetry=d,null):(l=C.treeContext,nr=Ii(k.nextSibling),tr=d,hn=!0,Br=null,l!==null&&(xr[gr++]=Ka,xr[gr++]=qa,xr[gr++]=_o,Ka=l.id,qa=l.overflow,_o=d),d=Em(d,g.children),d.flags|=4096,d)}function cv(l,d,p){l.lanes|=d;var g=l.alternate;g!==null&&(g.lanes|=d),am(l.return,d,p)}function Mm(l,d,p,g,k){var C=l.memoizedState;C===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:g,tail:p,tailMode:k}:(C.isBackwards=d,C.rendering=null,C.renderingStartTime=0,C.last=g,C.tail=p,C.tailMode=k)}function dv(l,d,p){var g=d.pendingProps,k=g.revealOrder,C=g.tail;if(Es(l,d,g.children,p),g=gn.current,(g&2)!==0)g=g&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&cv(l,p,d);else if(l.tag===19)cv(l,p,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}g&=1}if(tn(gn,g),(d.mode&1)===0)d.memoizedState=null;else switch(k){case"forwards":for(p=d.child,k=null;p!==null;)l=p.alternate,l!==null&&Pu(l)===null&&(k=p),p=p.sibling;p=k,p===null?(k=d.child,d.child=null):(k=p.sibling,p.sibling=null),Mm(d,!1,k,p,C);break;case"backwards":for(p=null,k=d.child,d.child=null;k!==null;){if(l=k.alternate,l!==null&&Pu(l)===null){d.child=k;break}l=k.sibling,k.sibling=p,p=k,k=l}Mm(d,!0,p,null,C);break;case"together":Mm(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function Bu(l,d){(d.mode&1)===0&&l!==null&&(l.alternate=null,d.alternate=null,d.flags|=2)}function Qa(l,d,p){if(l!==null&&(d.dependencies=l.dependencies),Vo|=d.lanes,(p&d.childLanes)===0)return null;if(l!==null&&d.child!==l.child)throw Error(n(153));if(d.child!==null){for(l=d.child,p=Vi(l,l.pendingProps),d.child=p,p.return=d;l.sibling!==null;)l=l.sibling,p=p.sibling=Vi(l,l.pendingProps),p.return=d;p.sibling=null}return d.child}function cT(l,d,p){switch(d.tag){case 3:iv(d),Bl();break;case 5:kb(d);break;case 1:Fs(d.type)&&ju(d);break;case 4:lm(d,d.stateNode.containerInfo);break;case 10:var g=d.type._context,k=d.memoizedProps.value;tn(Mu,g._currentValue),g._currentValue=k;break;case 13:if(g=d.memoizedState,g!==null)return g.dehydrated!==null?(tn(gn,gn.current&1),d.flags|=128,null):(p&d.child.childLanes)!==0?lv(l,d,p):(tn(gn,gn.current&1),l=Qa(l,d,p),l!==null?l.sibling:null);tn(gn,gn.current&1);break;case 19:if(g=(p&d.childLanes)!==0,(l.flags&128)!==0){if(g)return dv(l,d,p);d.flags|=128}if(k=d.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),tn(gn,gn.current),g)break;return null;case 22:case 23:return d.lanes=0,sv(l,d,p)}return Qa(l,d,p)}var uv,Am,hv,fv;uv=function(l,d){for(var p=d.child;p!==null;){if(p.tag===5||p.tag===6)l.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},Am=function(){},hv=function(l,d,p,g){var k=l.memoizedProps;if(k!==g){l=d.stateNode,Fo(ha.current);var C=null;switch(p){case"input":k=wt(l,k),g=wt(l,g),C=[];break;case"select":k=G({},k,{value:void 0}),g=G({},g,{value:void 0}),C=[];break;case"textarea":k=vn(l,k),g=vn(l,g),C=[];break;default:typeof k.onClick!="function"&&typeof g.onClick=="function"&&(l.onclick=vu)}pt(p,g);var M;p=null;for(pe in k)if(!g.hasOwnProperty(pe)&&k.hasOwnProperty(pe)&&k[pe]!=null)if(pe==="style"){var W=k[pe];for(M in W)W.hasOwnProperty(M)&&(p||(p={}),p[M]="")}else pe!=="dangerouslySetInnerHTML"&&pe!=="children"&&pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&pe!=="autoFocus"&&(a.hasOwnProperty(pe)?C||(C=[]):(C=C||[]).push(pe,null));for(pe in g){var Z=g[pe];if(W=k!=null?k[pe]:void 0,g.hasOwnProperty(pe)&&Z!==W&&(Z!=null||W!=null))if(pe==="style")if(W){for(M in W)!W.hasOwnProperty(M)||Z&&Z.hasOwnProperty(M)||(p||(p={}),p[M]="");for(M in Z)Z.hasOwnProperty(M)&&W[M]!==Z[M]&&(p||(p={}),p[M]=Z[M])}else p||(C||(C=[]),C.push(pe,p)),p=Z;else pe==="dangerouslySetInnerHTML"?(Z=Z?Z.__html:void 0,W=W?W.__html:void 0,Z!=null&&W!==Z&&(C=C||[]).push(pe,Z)):pe==="children"?typeof Z!="string"&&typeof Z!="number"||(C=C||[]).push(pe,""+Z):pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&(a.hasOwnProperty(pe)?(Z!=null&&pe==="onScroll"&&an("scroll",l),C||W===Z||(C=[])):(C=C||[]).push(pe,Z))}p&&(C=C||[]).push("style",p);var pe=C;(d.updateQueue=pe)&&(d.flags|=4)}},fv=function(l,d,p,g){p!==g&&(d.flags|=4)};function dd(l,d){if(!hn)switch(l.tailMode){case"hidden":d=l.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?l.tail=null:p.sibling=null;break;case"collapsed":p=l.tail;for(var g=null;p!==null;)p.alternate!==null&&(g=p),p=p.sibling;g===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:g.sibling=null}}function gs(l){var d=l.alternate!==null&&l.alternate.child===l.child,p=0,g=0;if(d)for(var k=l.child;k!==null;)p|=k.lanes|k.childLanes,g|=k.subtreeFlags&14680064,g|=k.flags&14680064,k.return=l,k=k.sibling;else for(k=l.child;k!==null;)p|=k.lanes|k.childLanes,g|=k.subtreeFlags,g|=k.flags,k.return=l,k=k.sibling;return l.subtreeFlags|=g,l.childLanes=p,d}function dT(l,d,p){var g=d.pendingProps;switch(Xp(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gs(d),null;case 1:return Fs(d.type)&&wu(),gs(d),null;case 3:return g=d.stateNode,Wl(),on($s),on(ms),um(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(l===null||l.child===null)&&(Tu(d)?d.flags|=4:l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Br!==null&&(Bm(Br),Br=null))),Am(l,d),gs(d),null;case 5:cm(d);var k=Fo(ad.current);if(p=d.type,l!==null&&d.stateNode!=null)hv(l,d,p,g,k),l.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!g){if(d.stateNode===null)throw Error(n(166));return gs(d),null}if(l=Fo(ha.current),Tu(d)){g=d.stateNode,p=d.type;var C=d.memoizedProps;switch(g[ua]=d,g[ed]=C,l=(d.mode&1)!==0,p){case"dialog":an("cancel",g),an("close",g);break;case"iframe":case"object":case"embed":an("load",g);break;case"video":case"audio":for(k=0;k<\/script>",l=l.removeChild(l.firstChild)):typeof g.is=="string"?l=M.createElement(p,{is:g.is}):(l=M.createElement(p),p==="select"&&(M=l,g.multiple?M.multiple=!0:g.size&&(M.size=g.size))):l=M.createElementNS(l,p),l[ua]=d,l[ed]=g,uv(l,d,!1,!1),d.stateNode=l;e:{switch(M=Et(p,g),p){case"dialog":an("cancel",l),an("close",l),k=g;break;case"iframe":case"object":case"embed":an("load",l),k=g;break;case"video":case"audio":for(k=0;kJl&&(d.flags|=128,g=!0,dd(C,!1),d.lanes=4194304)}else{if(!g)if(l=Pu(M),l!==null){if(d.flags|=128,g=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),dd(C,!0),C.tail===null&&C.tailMode==="hidden"&&!M.alternate&&!hn)return gs(d),null}else 2*Mt()-C.renderingStartTime>Jl&&p!==1073741824&&(d.flags|=128,g=!0,dd(C,!1),d.lanes=4194304);C.isBackwards?(M.sibling=d.child,d.child=M):(p=C.last,p!==null?p.sibling=M:d.child=M,C.last=M)}return C.tail!==null?(d=C.tail,C.rendering=d,C.tail=d.sibling,C.renderingStartTime=Mt(),d.sibling=null,p=gn.current,tn(gn,g?p&1|2:p&1),d):(gs(d),null);case 22:case 23:return Hm(),g=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(d.flags|=8192),g&&(d.mode&1)!==0?(sr&1073741824)!==0&&(gs(d),d.subtreeFlags&6&&(d.flags|=8192)):gs(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function uT(l,d){switch(Xp(d),d.tag){case 1:return Fs(d.type)&&wu(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Wl(),on($s),on(ms),um(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return cm(d),null;case 13:if(on(gn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Bl()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return on(gn),null;case 4:return Wl(),null;case 10:return rm(d.type._context),null;case 22:case 23:return Hm(),null;case 24:return null;default:return null}}var Vu=!1,ys=!1,hT=typeof WeakSet=="function"?WeakSet:Set,He=null;function ql(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(g){Nn(l,d,g)}else p.current=null}function Im(l,d,p){try{p()}catch(g){Nn(l,d,g)}}var pv=!1;function fT(l,d){if(Hp=$a,l=Ky(),Lp(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var g=p.getSelection&&p.getSelection();if(g&&g.rangeCount!==0){p=g.anchorNode;var k=g.anchorOffset,C=g.focusNode;g=g.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var M=0,W=-1,Z=-1,pe=0,Te=0,Ae=l,Ce=null;t:for(;;){for(var Be;Ae!==p||k!==0&&Ae.nodeType!==3||(W=M+k),Ae!==C||g!==0&&Ae.nodeType!==3||(Z=M+g),Ae.nodeType===3&&(M+=Ae.nodeValue.length),(Be=Ae.firstChild)!==null;)Ce=Ae,Ae=Be;for(;;){if(Ae===l)break t;if(Ce===p&&++pe===k&&(W=M),Ce===C&&++Te===g&&(Z=M),(Be=Ae.nextSibling)!==null)break;Ae=Ce,Ce=Ae.parentNode}Ae=Be}p=W===-1||Z===-1?null:{start:W,end:Z}}else p=null}p=p||{start:0,end:0}}else p=null;for(Up={focusedElem:l,selectionRange:p},$a=!1,He=d;He!==null;)if(d=He,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,He=l;else for(;He!==null;){d=He;try{var We=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(We!==null){var Ge=We.memoizedProps,Mn=We.memoizedState,he=d.stateNode,ne=he.getSnapshotBeforeUpdate(d.elementType===d.type?Ge:Vr(d.type,Ge),Mn);he.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var fe=d.stateNode.containerInfo;fe.nodeType===1?fe.textContent="":fe.nodeType===9&&fe.documentElement&&fe.removeChild(fe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Re){Nn(d,d.return,Re)}if(l=d.sibling,l!==null){l.return=d.return,He=l;break}He=d.return}return We=pv,pv=!1,We}function ud(l,d,p){var g=d.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var k=g=g.next;do{if((k.tag&l)===l){var C=k.destroy;k.destroy=void 0,C!==void 0&&Im(d,p,C)}k=k.next}while(k!==g)}}function Hu(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var g=p.create;p.destroy=g()}p=p.next}while(p!==d)}}function Rm(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function mv(l){var d=l.alternate;d!==null&&(l.alternate=null,mv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[ua],delete d[ed],delete d[Gp],delete d[J4],delete d[Q4])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function xv(l){return l.tag===5||l.tag===3||l.tag===4}function gv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||xv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Pm(l,d,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=vu));else if(g!==4&&(l=l.child,l!==null))for(Pm(l,d,p),l=l.sibling;l!==null;)Pm(l,d,p),l=l.sibling}function Om(l,d,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(g!==4&&(l=l.child,l!==null))for(Om(l,d,p),l=l.sibling;l!==null;)Om(l,d,p),l=l.sibling}var rs=null,Hr=!1;function _i(l,d,p){for(p=p.child;p!==null;)yv(l,d,p),p=p.sibling}function yv(l,d,p){if(ns&&typeof ns.onCommitFiberUnmount=="function")try{ns.onCommitFiberUnmount(na,p)}catch{}switch(p.tag){case 5:ys||ql(p,d);case 6:var g=rs,k=Hr;rs=null,_i(l,d,p),rs=g,Hr=k,rs!==null&&(Hr?(l=rs,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):rs.removeChild(p.stateNode));break;case 18:rs!==null&&(Hr?(l=rs,p=p.stateNode,l.nodeType===8?qp(l.parentNode,p):l.nodeType===1&&qp(l,p),Dr(l)):qp(rs,p.stateNode));break;case 4:g=rs,k=Hr,rs=p.stateNode.containerInfo,Hr=!0,_i(l,d,p),rs=g,Hr=k;break;case 0:case 11:case 14:case 15:if(!ys&&(g=p.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){k=g=g.next;do{var C=k,M=C.destroy;C=C.tag,M!==void 0&&((C&2)!==0||(C&4)!==0)&&Im(p,d,M),k=k.next}while(k!==g)}_i(l,d,p);break;case 1:if(!ys&&(ql(p,d),g=p.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=p.memoizedProps,g.state=p.memoizedState,g.componentWillUnmount()}catch(W){Nn(p,d,W)}_i(l,d,p);break;case 21:_i(l,d,p);break;case 22:p.mode&1?(ys=(g=ys)||p.memoizedState!==null,_i(l,d,p),ys=g):_i(l,d,p);break;default:_i(l,d,p)}}function bv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new hT),d.forEach(function(g){var k=wT.bind(null,l,g);p.has(g)||(p.add(g),g.then(k,k))})}}function Ur(l,d){var p=d.deletions;if(p!==null)for(var g=0;gk&&(k=M),g&=~C}if(g=k,g=Mt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*mT(g/1960))-g,10l?16:l,$i===null)var g=!1;else{if(l=$i,$i=null,Gu=0,(It&6)!==0)throw Error(n(331));var k=It;for(It|=4,He=l.current;He!==null;){var C=He,M=C.child;if((He.flags&16)!==0){var W=C.deletions;if(W!==null){for(var Z=0;ZMt()-_m?Uo(l,0):Dm|=p),Hs(l,d)}function Rv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ra,Ra<<=1,(Ra&130023424)===0&&(Ra=4194304)));var p=Ms();l=Ga(l,d),l!==null&&(En(l,d,p),Hs(l,p))}function NT(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),Rv(l,p)}function wT(l,d){var p=0;switch(l.tag){case 13:var g=l.stateNode,k=l.memoizedState;k!==null&&(p=k.retryLane);break;case 19:g=l.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(d),Rv(l,p)}var Pv;Pv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||$s.current)Bs=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return Bs=!1,cT(l,d,p);Bs=(l.flags&131072)!==0}else Bs=!1,hn&&(d.flags&1048576)!==0&&hb(d,Cu,d.index);switch(d.lanes=0,d.tag){case 2:var g=d.type;Bu(l,d),l=d.pendingProps;var k=zl(d,ms.current);Ul(d,p),k=pm(null,d,g,l,k,p);var C=mm();return d.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Fs(g)?(C=!0,ju(d)):C=!1,d.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,om(d),k.updater=$u,d.stateNode=k,k._reactInternals=d,Nm(d,g,l,p),d=Sm(null,d,g,!0,C,p)):(d.tag=0,hn&&C&&Yp(d),Es(null,d,k,p),d=d.child),d;case 16:g=d.elementType;e:{switch(Bu(l,d),l=d.pendingProps,k=g._init,g=k(g._payload),d.type=g,k=d.tag=kT(g),l=Vr(g,l),k){case 0:d=km(null,d,g,l,p);break e;case 1:d=av(null,d,g,l,p);break e;case 11:d=ev(null,d,g,l,p);break e;case 14:d=tv(null,d,g,Vr(g.type,l),p);break e}throw Error(n(306,g,""))}return d;case 0:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),km(l,d,g,k,p);case 1:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),av(l,d,g,k,p);case 3:e:{if(iv(d),l===null)throw Error(n(387));g=d.pendingProps,C=d.memoizedState,k=C.element,Nb(l,d),Ru(d,g,null,p);var M=d.memoizedState;if(g=M.element,C.isDehydrated)if(C={element:g,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},d.updateQueue.baseState=C,d.memoizedState=C,d.flags&256){k=Kl(Error(n(423)),d),d=ov(l,d,g,p,k);break e}else if(g!==k){k=Kl(Error(n(424)),d),d=ov(l,d,g,p,k);break e}else for(nr=Ii(d.stateNode.containerInfo.firstChild),tr=d,hn=!0,Br=null,p=bb(d,null,g,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Bl(),g===k){d=Qa(l,d,p);break e}Es(l,d,g,p)}d=d.child}return d;case 5:return kb(d),l===null&&em(d),g=d.type,k=d.pendingProps,C=l!==null?l.memoizedProps:null,M=k.children,Wp(g,k)?M=null:C!==null&&Wp(g,C)&&(d.flags|=32),rv(l,d),Es(l,d,M,p),d.child;case 6:return l===null&&em(d),null;case 13:return lv(l,d,p);case 4:return lm(d,d.stateNode.containerInfo),g=d.pendingProps,l===null?d.child=Vl(d,null,g,p):Es(l,d,g,p),d.child;case 11:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),ev(l,d,g,k,p);case 7:return Es(l,d,d.pendingProps,p),d.child;case 8:return Es(l,d,d.pendingProps.children,p),d.child;case 12:return Es(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(g=d.type._context,k=d.pendingProps,C=d.memoizedProps,M=k.value,tn(Mu,g._currentValue),g._currentValue=M,C!==null)if(Fr(C.value,M)){if(C.children===k.children&&!$s.current){d=Qa(l,d,p);break e}}else for(C=d.child,C!==null&&(C.return=d);C!==null;){var W=C.dependencies;if(W!==null){M=C.child;for(var Z=W.firstContext;Z!==null;){if(Z.context===g){if(C.tag===1){Z=Ja(-1,p&-p),Z.tag=2;var pe=C.updateQueue;if(pe!==null){pe=pe.shared;var Te=pe.pending;Te===null?Z.next=Z:(Z.next=Te.next,Te.next=Z),pe.pending=Z}}C.lanes|=p,Z=C.alternate,Z!==null&&(Z.lanes|=p),am(C.return,p,d),W.lanes|=p;break}Z=Z.next}}else if(C.tag===10)M=C.type===d.type?null:C.child;else if(C.tag===18){if(M=C.return,M===null)throw Error(n(341));M.lanes|=p,W=M.alternate,W!==null&&(W.lanes|=p),am(M,p,d),M=C.sibling}else M=C.child;if(M!==null)M.return=C;else for(M=C;M!==null;){if(M===d){M=null;break}if(C=M.sibling,C!==null){C.return=M.return,M=C;break}M=M.return}C=M}Es(l,d,k.children,p),d=d.child}return d;case 9:return k=d.type,g=d.pendingProps.children,Ul(d,p),k=yr(k),g=g(k),d.flags|=1,Es(l,d,g,p),d.child;case 14:return g=d.type,k=Vr(g,d.pendingProps),k=Vr(g.type,k),tv(l,d,g,k,p);case 15:return nv(l,d,d.type,d.pendingProps,p);case 17:return g=d.type,k=d.pendingProps,k=d.elementType===g?k:Vr(g,k),Bu(l,d),d.tag=1,Fs(g)?(l=!0,ju(d)):l=!1,Ul(d,p),qb(d,g,k),Nm(d,g,k,p),Sm(null,d,g,!0,l,p);case 19:return dv(l,d,p);case 22:return sv(l,d,p)}throw Error(n(156,d.tag))};function Ov(l,d){return To(l,d)}function jT(l,d,p,g){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nr(l,d,p,g){return new jT(l,d,p,g)}function Wm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function kT(l){if(typeof l=="function")return Wm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===F)return 11;if(l===J)return 14}return 2}function Vi(l,d){var p=l.alternate;return p===null?(p=Nr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function Xu(l,d,p,g,k,C){var M=2;if(g=l,typeof l=="function")Wm(l)&&(M=1);else if(typeof l=="string")M=5;else e:switch(l){case z:return Ko(p.children,k,C,d);case V:M=8,k|=8;break;case I:return l=Nr(12,p,d,k|2),l.elementType=I,l.lanes=C,l;case re:return l=Nr(13,p,d,k),l.elementType=re,l.lanes=C,l;case ie:return l=Nr(19,p,d,k),l.elementType=ie,l.lanes=C,l;case D:return Zu(p,k,C,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case te:M=10;break e;case Q:M=9;break e;case F:M=11;break e;case J:M=14;break e;case $:M=16,g=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Nr(M,p,d,k),d.elementType=l,d.type=g,d.lanes=C,d}function Ko(l,d,p,g){return l=Nr(7,l,g,d),l.lanes=p,l}function Zu(l,d,p,g){return l=Nr(22,l,g,d),l.elementType=D,l.lanes=p,l.stateNode={isHidden:!1},l}function Km(l,d,p){return l=Nr(6,l,null,d),l.lanes=p,l}function qm(l,d,p){return d=Nr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function ST(l,d,p,g,k){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Os(0),this.expirationTimes=Os(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Os(0),this.identifierPrefix=g,this.onRecoverableError=k,this.mutableSourceEagerHydrationData=null}function Gm(l,d,p,g,k,C,M,W,Z){return l=new ST(l,d,p,W,Z),d===1?(d=1,C===!0&&(d|=8)):d=0,C=Nr(3,null,null,d),l.current=C,C.stateNode=l,C.memoizedState={element:g,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},om(C),l}function CT(l,d,p){var g=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ex.exports=zT(),ex.exports}var Gv;function $T(){if(Gv)return ih;Gv=1;var t=dj();return ih.createRoot=t.createRoot,ih.hydrateRoot=t.hydrateRoot,ih}var FT=$T(),au=dj();const uj=cj(au);/**
* @remix-run/router v1.23.2
*
* Copyright (c) Remix Software Inc.
@@ -46,7 +46,7 @@ Error generating stack: `+C.message+`
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
- */function Vd(){return Vd=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function u0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function BT(){return Math.random().toString(36).substr(2,8)}function Qv(t,e){return{usr:t.state,key:t.key,idx:e}}function eg(t,e,n,r){return n===void 0&&(n=null),Vd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Rc(e):e,{state:n,key:e&&e.key||r||BT()})}function Wh(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Rc(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function VT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=to.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Vd({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=to.Pop;let j=f(),S=j==null?null:j-h;h=j,u&&u({action:c,location:w.location,delta:S})}function x(j,S){c=to.Push;let E=eg(w.location,j,S);h=f()+1;let T=Qv(E,h),P=w.createHref(E);try{o.pushState(T,"",P)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(P)}i&&u&&u({action:c,location:w.location,delta:1})}function y(j,S){c=to.Replace;let E=eg(w.location,j,S);h=f();let T=Qv(E,h),P=w.createHref(E);o.replaceState(T,"",P),i&&u&&u({action:c,location:w.location,delta:0})}function N(j){let S=a.location.origin!=="null"?a.location.origin:a.location.href,E=typeof j=="string"?j:Wh(j);return E=E.replace(/ $/,"%20"),Rn(S,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,S)}let w={get action(){return c},get location(){return t(a,o)},listen(j){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Jv,m),u=j,()=>{a.removeEventListener(Jv,m),u=null}},createHref(j){return e(a,j)},createURL:N,encodeLocation(j){let S=N(j);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:x,replace:y,go(j){return o.go(j)}};return w}var Yv;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Yv||(Yv={}));function HT(t,e,n){return n===void 0&&(n="/"),UT(t,e,n)}function UT(t,e,n,r){let a=typeof e=="string"?Rc(e):e,i=h0(a.pathname||"/",n);if(i==null)return null;let o=hj(t);WT(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};u.relativePath.startsWith("/")&&(Rn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=io([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(Rn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),hj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:XT(h,i.index),routesMeta:f})};return t.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let u of fj(i.path))a(i,o,u)}),e}function fj(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=fj(r.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function WT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:ZT(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const KT=/^:[\w-]+$/,qT=3,GT=2,JT=1,QT=10,YT=-2,Xv=t=>t==="*";function XT(t,e){let n=t.split("/"),r=n.length;return n.some(Xv)&&(r+=YT),e&&(r+=GT),n.filter(a=>!Xv(a)).reduce((a,i)=>a+(KT.test(i)?qT:i===""?JT:QT),r)}function ZT(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function eE(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:x,isOptional:y}=f;if(x==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const N=c[m];return y&&!N?h[x]=void 0:h[x]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function nE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),u0(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 r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function sE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return u0(!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 ("+e+").")),t}}function h0(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const rE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,aE=t=>rE.test(t);function iE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Rc(t):t,i;if(n)if(aE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),u0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Zv(n.substring(1),"/"):i=Zv(n,e)}else i=e;return{pathname:i,search:cE(r),hash:dE(a)}}function Zv(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function sx(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function oE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function f0(t,e){let n=oE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function p0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Rc(t):(a=Vd({},t),Rn(!a.pathname||!a.pathname.includes("?"),sx("?","pathname","search",a)),Rn(!a.pathname||!a.pathname.includes("#"),sx("#","pathname","hash",a)),Rn(!a.search||!a.search.includes("#"),sx("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let x=o.split("/");for(;x[0]==="..";)x.shift(),m-=1;a.pathname=x.join("/")}c=m>=0?e[m]:"/"}let u=iE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const io=t=>t.join("/").replace(/\/\/+/g,"/"),lE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),cE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,dE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function uE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const pj=["post","put","patch","delete"];new Set(pj);const hE=["get",...pj];new Set(hE);/**
+ */function Vd(){return Vd=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function u0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function VT(){return Math.random().toString(36).substr(2,8)}function Qv(t,e){return{usr:t.state,key:t.key,idx:e}}function eg(t,e,n,r){return n===void 0&&(n=null),Vd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Rc(e):e,{state:n,key:e&&e.key||r||VT()})}function Wh(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Rc(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function HT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=to.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Vd({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=to.Pop;let j=f(),S=j==null?null:j-h;h=j,u&&u({action:c,location:w.location,delta:S})}function x(j,S){c=to.Push;let E=eg(w.location,j,S);h=f()+1;let T=Qv(E,h),P=w.createHref(E);try{o.pushState(T,"",P)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(P)}i&&u&&u({action:c,location:w.location,delta:1})}function y(j,S){c=to.Replace;let E=eg(w.location,j,S);h=f();let T=Qv(E,h),P=w.createHref(E);o.replaceState(T,"",P),i&&u&&u({action:c,location:w.location,delta:0})}function N(j){let S=a.location.origin!=="null"?a.location.origin:a.location.href,E=typeof j=="string"?j:Wh(j);return E=E.replace(/ $/,"%20"),Rn(S,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,S)}let w={get action(){return c},get location(){return t(a,o)},listen(j){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Jv,m),u=j,()=>{a.removeEventListener(Jv,m),u=null}},createHref(j){return e(a,j)},createURL:N,encodeLocation(j){let S=N(j);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:x,replace:y,go(j){return o.go(j)}};return w}var Yv;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Yv||(Yv={}));function UT(t,e,n){return n===void 0&&(n="/"),WT(t,e,n)}function WT(t,e,n,r){let a=typeof e=="string"?Rc(e):e,i=h0(a.pathname||"/",n);if(i==null)return null;let o=hj(t);KT(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};u.relativePath.startsWith("/")&&(Rn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=io([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(Rn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),hj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:ZT(h,i.index),routesMeta:f})};return t.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let u of fj(i.path))a(i,o,u)}),e}function fj(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=fj(r.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function KT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:eE(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const qT=/^:[\w-]+$/,GT=3,JT=2,QT=1,YT=10,XT=-2,Xv=t=>t==="*";function ZT(t,e){let n=t.split("/"),r=n.length;return n.some(Xv)&&(r+=XT),e&&(r+=JT),n.filter(a=>!Xv(a)).reduce((a,i)=>a+(qT.test(i)?GT:i===""?QT:YT),r)}function eE(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function tE(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:x,isOptional:y}=f;if(x==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const N=c[m];return y&&!N?h[x]=void 0:h[x]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function sE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),u0(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 r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function rE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return u0(!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 ("+e+").")),t}}function h0(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const aE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,iE=t=>aE.test(t);function oE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Rc(t):t,i;if(n)if(iE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),u0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Zv(n.substring(1),"/"):i=Zv(n,e)}else i=e;return{pathname:i,search:dE(r),hash:uE(a)}}function Zv(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function sx(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function lE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function f0(t,e){let n=lE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function p0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Rc(t):(a=Vd({},t),Rn(!a.pathname||!a.pathname.includes("?"),sx("?","pathname","search",a)),Rn(!a.pathname||!a.pathname.includes("#"),sx("#","pathname","hash",a)),Rn(!a.search||!a.search.includes("#"),sx("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let x=o.split("/");for(;x[0]==="..";)x.shift(),m-=1;a.pathname=x.join("/")}c=m>=0?e[m]:"/"}let u=oE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const io=t=>t.join("/").replace(/\/\/+/g,"/"),cE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),dE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,uE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function hE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const pj=["post","put","patch","delete"];new Set(pj);const fE=["get",...pj];new Set(fE);/**
* React Router v6.30.3
*
* Copyright (c) Remix Software Inc.
@@ -55,7 +55,7 @@ Error generating stack: `+C.message+`
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
- */function Hd(){return Hd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=p0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:io([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const xE=b.createContext(null);function gE(t){let e=b.useContext(gi).outlet;return e&&b.createElement(xE.Provider,{value:t},e)}function gj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(bo),{matches:a}=b.useContext(gi),{pathname:i}=vo(),o=JSON.stringify(f0(a,r.v7_relativeSplatPath));return b.useMemo(()=>p0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function yE(t,e){return bE(t,e)}function bE(t,e,n,r){Pc()||Rn(!1);let{navigator:a}=b.useContext(bo),{matches:i}=b.useContext(gi),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=vo(),f;if(e){var m;let j=typeof e=="string"?Rc(e):e;u==="/"||(m=j.pathname)!=null&&m.startsWith(u)||Rn(!1),f=j}else f=h;let x=f.pathname||"/",y=x;if(u!=="/"){let j=u.replace(/^\//,"").split("/");y="/"+x.replace(/^\//,"").split("/").slice(j.length).join("/")}let N=HT(t,{pathname:y}),w=kE(N&&N.map(j=>Object.assign({},j,{params:Object.assign({},c,j.params),pathname:io([u,a.encodeLocation?a.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?u:io([u,a.encodeLocation?a.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),i,n,r);return e&&w?b.createElement(Xf.Provider,{value:{location:Hd({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:to.Pop}},w):w}function vE(){let t=EE(),e=uE(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:a},n):null,null)}const NE=b.createElement(vE,null);class wE extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(gi.Provider,{value:this.props.routeContext},b.createElement(mj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function jE(t){let{routeContext:e,match:n,children:r}=t,a=b.useContext(m0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(gi.Provider,{value:e},r)}function kE(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||Rn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,x)=>{let y,N=!1,w=null,j=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,w=m.route.errorElement||NE,u&&(h<0&&x===0?(AE("route-fallback"),N=!0,j=null):h===x&&(N=!0,j=m.route.hydrateFallbackElement||null)));let S=e.concat(o.slice(0,x+1)),E=()=>{let T;return y?T=w:N?T=j:m.route.Component?T=b.createElement(m.route.Component,null):m.route.element?T=m.route.element:T=f,b.createElement(jE,{match:m,routeContext:{outlet:f,matches:S,isDataRoute:n!=null},children:T})};return n&&(m.route.ErrorBoundary||m.route.errorElement||x===0)?b.createElement(wE,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):E()},null)}var yj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(yj||{}),bj=(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})(bj||{});function SE(t){let e=b.useContext(m0);return e||Rn(!1),e}function CE(t){let e=b.useContext(fE);return e||Rn(!1),e}function TE(t){let e=b.useContext(gi);return e||Rn(!1),e}function vj(t){let e=TE(),n=e.matches[e.matches.length-1];return n.route.id||Rn(!1),n.route.id}function EE(){var t;let e=b.useContext(mj),n=CE(),r=vj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function ME(){let{router:t}=SE(yj.UseNavigateStable),e=vj(bj.UseNavigateStable),n=b.useRef(!1);return xj(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Hd({fromRouteId:e},i)))},[t,e])}const e1={};function AE(t,e,n){e1[t]||(e1[t]=!0)}function IE(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function oh(t){let{to:e,replace:n,state:r,relative:a}=t;Pc()||Rn(!1);let{future:i,static:o}=b.useContext(bo),{matches:c}=b.useContext(gi),{pathname:u}=vo(),h=Sa(),f=p0(e,f0(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function RE(t){return gE(t.context)}function nn(t){Rn(!1)}function PE(t){let{basename:e="/",children:n=null,location:r,navigationType:a=to.Pop,navigator:i,static:o=!1,future:c}=t;Pc()&&Rn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:Hd({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Rc(r));let{pathname:f="/",search:m="",hash:x="",state:y=null,key:N="default"}=r,w=b.useMemo(()=>{let j=h0(f,u);return j==null?null:{location:{pathname:j,search:m,hash:x,state:y,key:N},navigationType:a}},[u,f,m,x,y,N,a]);return w==null?null:b.createElement(bo.Provider,{value:h},b.createElement(Xf.Provider,{children:n,value:w}))}function OE(t){let{children:e,location:n}=t;return yE(tg(e),n)}new Promise(()=>{});function tg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,a)=>{if(!b.isValidElement(r))return;let i=[...e,a];if(r.type===b.Fragment){n.push.apply(n,tg(r.props.children,i));return}r.type!==nn&&Rn(!1),!r.props.index||!r.props.children||Rn(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=tg(r.props.children,i)),n.push(o)}),n}/**
+ */function Hd(){return Hd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=p0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:io([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const gE=b.createContext(null);function yE(t){let e=b.useContext(gi).outlet;return e&&b.createElement(gE.Provider,{value:t},e)}function gj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(bo),{matches:a}=b.useContext(gi),{pathname:i}=vo(),o=JSON.stringify(f0(a,r.v7_relativeSplatPath));return b.useMemo(()=>p0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function bE(t,e){return vE(t,e)}function vE(t,e,n,r){Pc()||Rn(!1);let{navigator:a}=b.useContext(bo),{matches:i}=b.useContext(gi),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=vo(),f;if(e){var m;let j=typeof e=="string"?Rc(e):e;u==="/"||(m=j.pathname)!=null&&m.startsWith(u)||Rn(!1),f=j}else f=h;let x=f.pathname||"/",y=x;if(u!=="/"){let j=u.replace(/^\//,"").split("/");y="/"+x.replace(/^\//,"").split("/").slice(j.length).join("/")}let N=UT(t,{pathname:y}),w=SE(N&&N.map(j=>Object.assign({},j,{params:Object.assign({},c,j.params),pathname:io([u,a.encodeLocation?a.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?u:io([u,a.encodeLocation?a.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),i,n,r);return e&&w?b.createElement(Xf.Provider,{value:{location:Hd({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:to.Pop}},w):w}function NE(){let t=ME(),e=hE(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:a},n):null,null)}const wE=b.createElement(NE,null);class jE extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(gi.Provider,{value:this.props.routeContext},b.createElement(mj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function kE(t){let{routeContext:e,match:n,children:r}=t,a=b.useContext(m0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(gi.Provider,{value:e},r)}function SE(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||Rn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,x)=>{let y,N=!1,w=null,j=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,w=m.route.errorElement||wE,u&&(h<0&&x===0?(IE("route-fallback"),N=!0,j=null):h===x&&(N=!0,j=m.route.hydrateFallbackElement||null)));let S=e.concat(o.slice(0,x+1)),E=()=>{let T;return y?T=w:N?T=j:m.route.Component?T=b.createElement(m.route.Component,null):m.route.element?T=m.route.element:T=f,b.createElement(kE,{match:m,routeContext:{outlet:f,matches:S,isDataRoute:n!=null},children:T})};return n&&(m.route.ErrorBoundary||m.route.errorElement||x===0)?b.createElement(jE,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):E()},null)}var yj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(yj||{}),bj=(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})(bj||{});function CE(t){let e=b.useContext(m0);return e||Rn(!1),e}function TE(t){let e=b.useContext(pE);return e||Rn(!1),e}function EE(t){let e=b.useContext(gi);return e||Rn(!1),e}function vj(t){let e=EE(),n=e.matches[e.matches.length-1];return n.route.id||Rn(!1),n.route.id}function ME(){var t;let e=b.useContext(mj),n=TE(),r=vj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function AE(){let{router:t}=CE(yj.UseNavigateStable),e=vj(bj.UseNavigateStable),n=b.useRef(!1);return xj(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Hd({fromRouteId:e},i)))},[t,e])}const e1={};function IE(t,e,n){e1[t]||(e1[t]=!0)}function RE(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function oh(t){let{to:e,replace:n,state:r,relative:a}=t;Pc()||Rn(!1);let{future:i,static:o}=b.useContext(bo),{matches:c}=b.useContext(gi),{pathname:u}=vo(),h=Sa(),f=p0(e,f0(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function PE(t){return yE(t.context)}function nn(t){Rn(!1)}function OE(t){let{basename:e="/",children:n=null,location:r,navigationType:a=to.Pop,navigator:i,static:o=!1,future:c}=t;Pc()&&Rn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:Hd({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Rc(r));let{pathname:f="/",search:m="",hash:x="",state:y=null,key:N="default"}=r,w=b.useMemo(()=>{let j=h0(f,u);return j==null?null:{location:{pathname:j,search:m,hash:x,state:y,key:N},navigationType:a}},[u,f,m,x,y,N,a]);return w==null?null:b.createElement(bo.Provider,{value:h},b.createElement(Xf.Provider,{children:n,value:w}))}function LE(t){let{children:e,location:n}=t;return bE(tg(e),n)}new Promise(()=>{});function tg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,a)=>{if(!b.isValidElement(r))return;let i=[...e,a];if(r.type===b.Fragment){n.push.apply(n,tg(r.props.children,i));return}r.type!==nn&&Rn(!1),!r.props.index||!r.props.children||Rn(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=tg(r.props.children,i)),n.push(o)}),n}/**
* React Router DOM v6.30.3
*
* Copyright (c) Remix Software Inc.
@@ -64,528 +64,528 @@ Error generating stack: `+C.message+`
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
- */function ng(){return ng=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function DE(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _E(t,e){return t.button===0&&(!e||e==="_self")&&!DE(t)}function sg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function zE(t,e){let n=sg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const $E=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],FE="6";try{window.__reactRouterVersion=FE}catch{}const BE="startTransition",t1=Yf[BE];function VE(t){let{basename:e,children:n,future:r,window:a}=t,i=b.useRef();i.current==null&&(i.current=FT({window:a,v5Compat:!0}));let o=i.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&t1?t1(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>IE(r),[r]),b.createElement(PE,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const HE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",UE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bc=b.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,x=LE(e,$E),{basename:y}=b.useContext(bo),N,w=!1;if(typeof h=="string"&&UE.test(h)&&(N=h,HE))try{let T=new URL(window.location.href),P=h.startsWith("//")?new URL(T.protocol+h):new URL(h),O=h0(P.pathname,y);P.origin===T.origin&&O!=null?h=O+P.search+P.hash:w=!0}catch{}let j=pE(h,{relative:a}),S=WE(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function E(T){r&&r(T),T.defaultPrevented||S(T)}return b.createElement("a",ng({},x,{href:N||j,onClick:w||i?r:E,ref:n,target:u}))});var n1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(n1||(n1={}));var s1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(s1||(s1={}));function WE(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Sa(),h=vo(),f=gj(t,{relative:o});return b.useCallback(m=>{if(_E(m,n)){m.preventDefault();let x=r!==void 0?r:Wh(h)===Wh(f);u(t,{replace:x,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function x0(t){let e=b.useRef(sg(t)),n=b.useRef(!1),r=vo(),a=b.useMemo(()=>zE(r.search,n.current?null:e.current),[r.search]),i=Sa(),o=b.useCallback((c,u)=>{const h=sg(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,o]}/**
+ */function ng(){return ng=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function _E(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function zE(t,e){return t.button===0&&(!e||e==="_self")&&!_E(t)}function sg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function $E(t,e){let n=sg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const FE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],BE="6";try{window.__reactRouterVersion=BE}catch{}const VE="startTransition",t1=Yf[VE];function HE(t){let{basename:e,children:n,future:r,window:a}=t,i=b.useRef();i.current==null&&(i.current=BT({window:a,v5Compat:!0}));let o=i.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&t1?t1(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>RE(r),[r]),b.createElement(OE,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const UE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",WE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bc=b.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,x=DE(e,FE),{basename:y}=b.useContext(bo),N,w=!1;if(typeof h=="string"&&WE.test(h)&&(N=h,UE))try{let T=new URL(window.location.href),P=h.startsWith("//")?new URL(T.protocol+h):new URL(h),O=h0(P.pathname,y);P.origin===T.origin&&O!=null?h=O+P.search+P.hash:w=!0}catch{}let j=mE(h,{relative:a}),S=KE(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function E(T){r&&r(T),T.defaultPrevented||S(T)}return b.createElement("a",ng({},x,{href:N||j,onClick:w||i?r:E,ref:n,target:u}))});var n1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(n1||(n1={}));var s1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(s1||(s1={}));function KE(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Sa(),h=vo(),f=gj(t,{relative:o});return b.useCallback(m=>{if(zE(m,n)){m.preventDefault();let x=r!==void 0?r:Wh(h)===Wh(f);u(t,{replace:x,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function x0(t){let e=b.useRef(sg(t)),n=b.useRef(!1),r=vo(),a=b.useMemo(()=>$E(r.search,n.current?null:e.current),[r.search]),i=Sa(),o=b.useCallback((c,u)=>{const h=sg(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,o]}/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const KE=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qE=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),r1=t=>{const e=qE(t);return e.charAt(0).toUpperCase()+e.slice(1)},Nj=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),GE=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
+ */const qE=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),GE=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),r1=t=>{const e=GE(t);return e.charAt(0).toUpperCase()+e.slice(1)},Nj=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),JE=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */var JE={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"};/**
+ */var QE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const QE=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...JE,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Nj("lucide",a),...!i&&!GE(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(i)?i:[i]]));/**
+ */const YE=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...QE,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Nj("lucide",a),...!i&&!JE(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(i)?i:[i]]));/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const Ee=(t,e)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(QE,{ref:i,iconNode:e,className:Nj(`lucide-${KE(r1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=r1(t),n};/**
+ */const Ee=(t,e)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(YE,{ref:i,iconNode:e,className:Nj(`lucide-${qE(r1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=r1(t),n};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const YE=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],rx=Ee("arrow-up-down",YE);/**
+ */const XE=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],rx=Ee("arrow-up-down",XE);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const XE=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],ZE=Ee("at-sign",XE);/**
+ */const ZE=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],e5=Ee("at-sign",ZE);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const e5=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],a1=Ee("bitcoin",e5);/**
+ */const t5=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],a1=Ee("bitcoin",t5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const t5=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],n5=Ee("bold",t5);/**
+ */const n5=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],s5=Ee("bold",n5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const s5=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Gs=Ee("book-open",s5);/**
+ */const r5=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Gs=Ee("book-open",r5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const r5=[["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"}]],rg=Ee("calendar",r5);/**
+ */const a5=[["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"}]],rg=Ee("calendar",a5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const a5=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],rc=Ee("chart-column",a5);/**
+ */const i5=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],rc=Ee("chart-column",i5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const i5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Zf=Ee("check",i5);/**
+ */const o5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Zf=Ee("check",o5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const o5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vc=Ee("chevron-down",o5);/**
+ */const l5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vc=Ee("chevron-down",l5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const l5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],c5=Ee("chevron-left",l5);/**
+ */const c5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],d5=Ee("chevron-left",c5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const d5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xo=Ee("chevron-right",d5);/**
+ */const u5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xo=Ee("chevron-right",u5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const u5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ag=Ee("chevron-up",u5);/**
+ */const h5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ag=Ee("chevron-up",h5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const h5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],wj=Ee("circle-alert",h5);/**
+ */const f5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],wj=Ee("circle-alert",f5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const f5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ax=Ee("circle-check-big",f5);/**
+ */const p5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ax=Ee("circle-check-big",p5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const p5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],jj=Ee("circle-check",p5);/**
+ */const m5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],jj=Ee("circle-check",m5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const m5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],kj=Ee("circle-question-mark",m5);/**
+ */const x5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],kj=Ee("circle-question-mark",x5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const x5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],lh=Ee("circle-user",x5);/**
+ */const g5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],lh=Ee("circle-user",g5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const g5=[["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"}]],Sj=Ee("circle-x",g5);/**
+ */const y5=[["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"}]],Sj=Ee("circle-x",y5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const y5=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ig=Ee("clock",y5);/**
+ */const b5=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ig=Ee("clock",b5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const b5=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],i1=Ee("cloud",b5);/**
+ */const v5=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],i1=Ee("cloud",v5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const v5=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],N5=Ee("code",v5);/**
+ */const N5=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],w5=Ee("code",N5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const w5=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Cj=Ee("copy",w5);/**
+ */const j5=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Cj=Ee("copy",j5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const j5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],o1=Ee("credit-card",j5);/**
+ */const k5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],o1=Ee("credit-card",k5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const k5=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],pc=Ee("crown",k5);/**
+ */const S5=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],pc=Ee("crown",S5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const S5=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Kh=Ee("dollar-sign",S5);/**
+ */const C5=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Kh=Ee("dollar-sign",C5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const C5=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],T5=Ee("download",C5);/**
+ */const T5=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],E5=Ee("download",T5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const E5=[["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"}]],fi=Ee("external-link",E5);/**
+ */const M5=[["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"}]],fi=Ee("external-link",M5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const M5=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],A5=Ee("eye-off",M5);/**
+ */const A5=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],I5=Ee("eye-off",A5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const I5=[["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"}]],qh=Ee("eye",I5);/**
+ */const R5=[["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"}]],qh=Ee("eye",R5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const R5=[["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"}]],Tj=Ee("file-text",R5);/**
+ */const P5=[["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"}]],Tj=Ee("file-text",P5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const P5=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ej=Ee("funnel",P5);/**
+ */const O5=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Ej=Ee("funnel",O5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const O5=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],og=Ee("gift",O5);/**
+ */const L5=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],og=Ee("gift",L5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const L5=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],D5=Ee("git-merge",L5);/**
+ */const D5=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],_5=Ee("git-merge",D5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const _5=[["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"}]],lg=Ee("globe",_5);/**
+ */const z5=[["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"}]],lg=Ee("globe",z5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const z5=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],$5=Ee("graduation-cap",z5);/**
+ */const $5=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],F5=Ee("graduation-cap",$5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const F5=[["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"}]],Xa=Ee("grip-vertical",F5);/**
+ */const B5=[["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"}]],Xa=Ee("grip-vertical",B5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const B5=[["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"}]],V5=Ee("handshake",B5);/**
+ */const V5=[["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"}]],H5=Ee("handshake",V5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const H5=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],l1=Ee("hash",H5);/**
+ */const U5=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],l1=Ee("hash",U5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const U5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],W5=Ee("heading-1",U5);/**
+ */const W5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],K5=Ee("heading-1",W5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const K5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],q5=Ee("heading-2",K5);/**
+ */const q5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],G5=Ee("heading-2",q5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const G5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],J5=Ee("heading-3",G5);/**
+ */const J5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Q5=Ee("heading-3",J5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const Q5=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Y5=Ee("house",Q5);/**
+ */const Y5=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],X5=Ee("house",Y5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const X5=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Mj=Ee("image",X5);/**
+ */const Z5=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Mj=Ee("image",Z5);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const Z5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ch=Ee("info",Z5);/**
+ */const eM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ch=Ee("info",eM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const eM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],tM=Ee("italic",eM);/**
+ */const tM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],nM=Ee("italic",tM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const nM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],cg=Ee("key",nM);/**
+ */const sM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],cg=Ee("key",sM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const sM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],rM=Ee("layout-dashboard",sM);/**
+ */const rM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],aM=Ee("layout-dashboard",rM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const aM=[["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"}]],iM=Ee("layout-grid",aM);/**
+ */const iM=[["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"}]],oM=Ee("layout-grid",iM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const oM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ya=Ee("link-2",oM);/**
+ */const lM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ya=Ee("link-2",lM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const lM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],dg=Ee("link",lM);/**
+ */const cM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],dg=Ee("link",cM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const cM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],dM=Ee("list-ordered",cM);/**
+ */const dM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],uM=Ee("list-ordered",dM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const uM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],hM=Ee("list",uM);/**
+ */const hM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],fM=Ee("list",hM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const fM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],pM=Ee("lock",fM);/**
+ */const pM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],mM=Ee("lock",pM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const mM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],xM=Ee("log-out",mM);/**
+ */const xM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],gM=Ee("log-out",xM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const gM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Aj=Ee("map-pin",gM);/**
+ */const yM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Aj=Ee("map-pin",yM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const yM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],bM=Ee("menu",yM);/**
+ */const bM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],vM=Ee("menu",bM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const vM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],NM=Ee("message-circle",vM);/**
+ */const NM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],wM=Ee("message-circle",NM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const wM=[["path",{d:"M5 12h14",key:"1ays0h"}]],jM=Ee("minus",wM);/**
+ */const jM=[["path",{d:"M5 12h14",key:"1ays0h"}]],kM=Ee("minus",jM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const kM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],qr=Ee("navigation",kM);/**
+ */const SM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],qr=Ee("navigation",SM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const SM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],CM=Ee("palette",SM);/**
+ */const CM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],TM=Ee("palette",CM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const TM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],EM=Ee("paperclip",TM);/**
+ */const EM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],MM=Ee("paperclip",EM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const MM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],Jt=Ee("pen-line",MM);/**
+ */const AM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],Jt=Ee("pen-line",AM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const AM=[["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"}]],c1=Ee("pencil",AM);/**
+ */const IM=[["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"}]],c1=Ee("pencil",IM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const IM=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],RM=Ee("percent",IM);/**
+ */const RM=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],PM=Ee("percent",RM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const PM=[["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"}]],d1=Ee("phone",PM);/**
+ */const OM=[["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"}]],d1=Ee("phone",OM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const OM=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],LM=Ee("pin",OM);/**
+ */const LM=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],DM=Ee("pin",LM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const DM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],An=Ee("plus",DM);/**
+ */const _M=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],An=Ee("plus",_M);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const _M=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],u1=Ee("qr-code",_M);/**
+ */const zM=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],u1=Ee("qr-code",zM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const zM=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],$M=Ee("quote",zM);/**
+ */const $M=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],FM=Ee("quote",$M);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const FM=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],BM=Ee("redo",FM);/**
+ */const BM=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],VM=Ee("redo",BM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const VM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fe=Ee("refresh-cw",VM);/**
+ */const HM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fe=Ee("refresh-cw",HM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const HM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],bn=Ee("save",HM);/**
+ */const UM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],bn=Ee("save",UM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const UM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],va=Ee("search",UM);/**
+ */const WM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],va=Ee("search",WM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const WM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],KM=Ee("send",WM);/**
+ */const KM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],qM=Ee("send",KM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const qM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],no=Ee("settings",qM);/**
+ */const GM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],no=Ee("settings",GM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const GM=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],dh=Ee("settings-2",GM);/**
+ */const JM=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],dh=Ee("settings-2",JM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const JM=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],QM=Ee("share-2",JM);/**
+ */const QM=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],YM=Ee("share-2",QM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const YM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],dc=Ee("shield-check",YM);/**
+ */const XM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],dc=Ee("shield-check",XM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const XM=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],Md=Ee("shopping-bag",XM);/**
+ */const ZM=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],Md=Ee("shopping-bag",ZM);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const ZM=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ll=Ee("smartphone",ZM);/**
+ */const eA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ll=Ee("smartphone",eA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const eA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],tA=Ee("smile",eA);/**
+ */const tA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],nA=Ee("smile",tA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const nA=[["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"}]],sA=Ee("sparkles",nA);/**
+ */const sA=[["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"}]],rA=Ee("sparkles",sA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const rA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],uc=Ee("star",rA);/**
+ */const aA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],uc=Ee("star",aA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const aA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],iA=Ee("strikethrough",aA);/**
+ */const iA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],oA=Ee("strikethrough",iA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const oA=[["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"}]],lA=Ee("table",oA);/**
+ */const lA=[["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"}]],cA=Ee("table",lA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const cA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Ad=Ee("tag",cA);/**
+ */const dA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Ad=Ee("tag",dA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const dA=[["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"}]],bs=Ee("trash-2",dA);/**
+ */const uA=[["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"}]],bs=Ee("trash-2",uA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const uA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Gh=Ee("trending-up",uA);/**
+ */const hA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Gh=Ee("trending-up",hA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const hA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],ug=Ee("trophy",hA);/**
+ */const fA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],ug=Ee("trophy",fA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const fA=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Ij=Ee("undo-2",fA);/**
+ */const pA=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Ij=Ee("undo-2",pA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const pA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],mA=Ee("undo",pA);/**
+ */const mA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],xA=Ee("undo",mA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const xA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Jh=Ee("upload",xA);/**
+ */const gA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Jh=Ee("upload",gA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const gA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],hc=Ee("user-plus",gA);/**
+ */const yA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],hc=Ee("user-plus",yA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const yA=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],oi=Ee("user",yA);/**
+ */const bA=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],oi=Ee("user",bA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const bA=[["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"}]],In=Ee("users",bA);/**
+ */const vA=[["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"}]],In=Ee("users",vA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const vA=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],NA=Ee("video",vA);/**
+ */const NA=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],wA=Ee("video",NA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const wA=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Nc=Ee("wallet",wA);/**
+ */const jA=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Nc=Ee("wallet",jA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const jA=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],kA=Ee("wand-sparkles",jA);/**
+ */const kA=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],SA=Ee("wand-sparkles",kA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const SA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Yn=Ee("x",SA);/**
+ */const CA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Yn=Ee("x",CA);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const CA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],pi=Ee("zap",CA),g0="admin_token";function iu(){try{return localStorage.getItem(g0)}catch{return null}}function TA(t){try{localStorage.setItem(g0,t)}catch{}}function ix(){try{localStorage.removeItem(g0)}catch{}}const EA="https://soulapi.quwanzhi.com",MA=15e3,h1=6e4,AA=()=>{const t="https://soulapi.quwanzhi.com";{const e=t.trim();if(e.length>0)return e.replace(/\/$/,"")}return EA};function wc(t){const e=AA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function ep(t,e={}){const{data:n,...r}=e,a=wc(t),i=new Headers(r.headers),o=iu();o&&i.set("Authorization",`Bearer ${o}`),n!=null&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=r.timeout??MA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),x=m.headers.get("Content-Type")||"";let y;if(x.includes("application/json"))try{y=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const w=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${w.slice(0,100)}`)}const N=w=>{const j=w,S=((j==null?void 0:j.message)||(j==null?void 0:j.error)||"").toString();(S.includes("可提现金额不足")||S.includes("可提现不足")||S.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:S}))};if(!m.ok){N(y);const w=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw w.status=m.status,w.data=y,w}return N(y),y}function Pe(t,e){return ep(t,{...e,method:"GET"})}function Ct(t,e,n){return ep(t,{...n,method:"POST",data:e})}function Gt(t,e,n){return ep(t,{...n,method:"PUT",data:e})}function li(t,e){return ep(t,{...e,method:"DELETE"})}function IA(){const[t,e]=b.useState(!1),[n,r]=b.useState("");return b.useEffect(()=>{const a=i=>{const o=i.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",a),()=>window.removeEventListener("recharge-alert",a)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(wj,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(Yn,{className:"w-4 h-4"})})]}):null}const RA=[{icon:rM,label:"数据概览",href:"/dashboard"},{icon:Gs,label:"内容管理",href:"/content"},{icon:In,label:"用户管理",href:"/users"},{icon:D5,label:"找伙伴",href:"/find-partner"},{icon:Nc,label:"推广中心",href:"/distribution"}];function PA(){const t=vo(),e=Sa(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;if(!iu()){e("/login",{replace:!0});return}return Pe("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(ix(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(ix(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{ix();try{await Ct("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[RA.map(c=>{const u=t.pathname===c.href;return s.jsxs(bc,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(bc,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(no,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.jsxs("button",{type:"button",onClick:o,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[s.jsx(xM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(IA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(RE,{})})]})]})}function f1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function y0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=f1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;Rj(i)&&typeof Qh=="function"&&(i=Qh(i._payload));const c=b.Children.toArray(i),u=c.find(zA);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var Oj=Pj("Slot");function DA(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(Rj(a)&&typeof Qh=="function"&&(a=Qh(a._payload)),b.isValidElement(a)){const o=FA(a),c=$A(i,a.props);return a.type!==b.Fragment&&(c.ref=r?y0(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var _A=Symbol("radix.slottable");function zA(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===_A}function $A(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function FA(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function Lj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,m1=Dj,_j=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return m1(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const x=p1(f)||p1(m);return a[h][x]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,x]=f;return x===void 0||(h[m]=x),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:x,...y}=f;return Object.entries(y).every(N=>{let[w,j]=N;return Array.isArray(j)?j.includes({...i,...c}[w]):{...i,...c}[w]===j})?[...h,m,x]:h},[]);return m1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},BA=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),zj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Yh="-",x1=[],HA="arbitrary..",UA=t=>{const e=KA(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WA(o);const c=o.split(Yh),u=c[0]===""&&c.length>1?1:0;return $j(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?BA(h,u):u:h||x1}return n[o]||x1}}},$j=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=$j(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(Yh):t.slice(e).join(Yh),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?HA+r:void 0})(),KA=t=>{const{theme:e,classGroups:n}=t;return qA(n,e)},qA=(t,e)=>{const n=zj();for(const r in t){const a=t[r];b0(a,n,r,e)}return n},b0=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){JA(t,e,n);return}if(typeof t=="function"){QA(t,e,n,r);return}YA(t,e,n,r)},JA=(t,e,n)=>{const r=t===""?e:Fj(e,t);r.classGroupId=n},QA=(t,e,n,r)=>{if(XA(t)){b0(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(VA(n,t))},YA=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(Yh),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,ZA=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},hg="!",g1=":",eI=[],y1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),tI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let w=0;wu?h-u:void 0;return y1(i,y,x,N)};if(e){const a=e+g1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):y1(eI,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},nI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},sI=t=>({cache:ZA(t.cacheSize),parseClassName:tI(t),sortModifiers:nI(t),...UA(t)}),rI=/\s+/,aI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(rI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:x,hasImportantModifier:y,baseClassName:N,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let j=!!w,S=r(j?N.substring(0,w):N);if(!S){if(!j){u=f+(u.length>0?" "+u:u);continue}if(S=r(N),!S){u=f+(u.length>0?" "+u:u);continue}j=!1}const E=x.length===0?"":x.length===1?x[0]:i(x).join(":"),T=y?E+hg:E,P=T+S;if(o.indexOf(P)>-1)continue;o.push(P);const O=a(S,j);for(let q=0;q0?" "+u:u)}return u},iI=(...t)=>{let e=0,n,r,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=sI(h),r=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=aI(u,n);return a(u,f),f};return i=o,(...u)=>i(iI(...u))},lI=[],Wn=t=>{const e=n=>n[t]||lI;return e.isThemeGetter=!0,e},Vj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cI=/^\d+\/\d+$/,dI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uI=/\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$/,hI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yl=t=>cI.test(t),yt=t=>!!t&&!Number.isNaN(Number(t)),Ui=t=>!!t&&Number.isInteger(Number(t)),ox=t=>t.endsWith("%")&&yt(t.slice(0,-1)),Za=t=>dI.test(t),mI=()=>!0,xI=t=>uI.test(t)&&!hI.test(t),Uj=()=>!1,gI=t=>fI.test(t),yI=t=>pI.test(t),bI=t=>!Ke(t)&&!qe(t),vI=t=>Oc(t,qj,Uj),Ke=t=>Vj.test(t),qo=t=>Oc(t,Gj,xI),lx=t=>Oc(t,SI,yt),b1=t=>Oc(t,Wj,Uj),NI=t=>Oc(t,Kj,yI),uh=t=>Oc(t,Jj,gI),qe=t=>Hj.test(t),gd=t=>Lc(t,Gj),wI=t=>Lc(t,CI),v1=t=>Lc(t,Wj),jI=t=>Lc(t,qj),kI=t=>Lc(t,Kj),hh=t=>Lc(t,Jj,!0),Oc=(t,e,n)=>{const r=Vj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Lc=(t,e,n=!1)=>{const r=Hj.exec(t);return r?r[1]?e(r[1]):n:!1},Wj=t=>t==="position"||t==="percentage",Kj=t=>t==="image"||t==="url",qj=t=>t==="length"||t==="size"||t==="bg-size",Gj=t=>t==="length",SI=t=>t==="number",CI=t=>t==="family-name",Jj=t=>t==="shadow",TI=()=>{const t=Wn("color"),e=Wn("font"),n=Wn("text"),r=Wn("font-weight"),a=Wn("tracking"),i=Wn("leading"),o=Wn("breakpoint"),c=Wn("container"),u=Wn("spacing"),h=Wn("radius"),f=Wn("shadow"),m=Wn("inset-shadow"),x=Wn("text-shadow"),y=Wn("drop-shadow"),N=Wn("blur"),w=Wn("perspective"),j=Wn("aspect"),S=Wn("ease"),E=Wn("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...P(),qe,Ke],q=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],V=()=>[qe,Ke,u],I=()=>[Yl,"full","auto",...V()],te=()=>[Ui,"none","subgrid",qe,Ke],Q=()=>["auto",{span:["full",Ui,qe,Ke]},Ui,qe,Ke],F=()=>[Ui,"auto",qe,Ke],re=()=>["auto","min","max","fr",qe,Ke],ie=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...V()],D=()=>[Yl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],R=()=>[t,qe,Ke],oe=()=>[...P(),v1,b1,{position:[qe,Ke]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",jI,vI,{size:[qe,Ke]}],U=()=>[ox,gd,qo],H=()=>["","none","full",h,qe,Ke],K=()=>["",yt,gd,qo],me=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[yt,ox,v1,b1],de=()=>["","none",N,qe,Ke],ve=()=>["none",yt,qe,Ke],ye=()=>["none",yt,qe,Ke],ke=()=>[yt,qe,Ke],ze=()=>[Yl,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Za],breakpoint:[Za],color:[mI],container:[Za],"drop-shadow":[Za],ease:["in","out","in-out"],font:[bI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Za],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Za],shadow:[Za],spacing:["px",yt],text:[Za],"text-shadow":[Za],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Yl,Ke,qe,j]}],container:["container"],columns:[{columns:[yt,Ke,qe,c]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:O()}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Ui,"auto",qe,Ke]}],basis:[{basis:[Yl,"full","auto",c,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[yt,Yl,"auto","initial","none",Ke]}],grow:[{grow:["",yt,qe,Ke]}],shrink:[{shrink:["",yt,qe,Ke]}],order:[{order:[Ui,"first","last","none",qe,Ke]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...ie(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...ie()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],w:[{w:[c,"screen",...D()]}],"min-w":[{"min-w":[c,"screen","none",...D()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,gd,qo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,qe,lx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ox,Ke]}],"font-family":[{font:[wI,Ke,e]}],"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:[a,qe,Ke]}],"line-clamp":[{"line-clamp":[yt,"none",qe,lx]}],leading:[{leading:[i,...V()]}],"list-image":[{"list-image":["none",qe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[yt,"from-font","auto",qe,qo]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[yt,"auto",qe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,Ke]}],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",qe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ui,qe,Ke],radial:["",qe,Ke],conic:[Ui,qe,Ke]},kI,NI]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[yt,qe,Ke]}],"outline-w":[{outline:["",yt,gd,qo]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",f,hh,uh]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",m,hh,uh]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[yt,qo]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",x,hh,uh]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[yt,qe,Ke]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"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":[yt]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[qe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[yt]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,Ke]}],filter:[{filter:["","none",qe,Ke]}],blur:[{blur:de()}],brightness:[{brightness:[yt,qe,Ke]}],contrast:[{contrast:[yt,qe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",y,hh,uh]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",yt,qe,Ke]}],"hue-rotate":[{"hue-rotate":[yt,qe,Ke]}],invert:[{invert:["",yt,qe,Ke]}],saturate:[{saturate:[yt,qe,Ke]}],sepia:[{sepia:["",yt,qe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,Ke]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[yt,qe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[yt,qe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",yt,qe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[yt,qe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",yt,qe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[yt,qe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[yt,qe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",yt,qe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[yt,"initial",qe,Ke]}],ease:[{ease:["linear","initial",S,qe,Ke]}],delay:[{delay:[yt,qe,Ke]}],animate:[{animate:["none",E,qe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,qe,Ke]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[qe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ze()}],"translate-x":[{"translate-x":ze()}],"translate-y":[{"translate-y":ze()}],"translate-z":[{"translate-z":ze()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"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",qe,Ke]}],"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":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",qe,Ke]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[yt,gd,qo,lx]}],stroke:[{stroke:["none",...R()]}],"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"]}},EI=oI(TI);function Ut(...t){return EI(Dj(t))}function fo(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const MI=_j("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function X({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?Oj:"button";return s.jsx(i,{"data-slot":"button",className:Ut(MI({variant:e,size:n,className:t})),...a})}function ce({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Ut("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",t),...n})}function AI(){const t=Sa(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1);b.useEffect(()=>{iu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await Ct("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){TA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:s.jsx(dc,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(oi,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"text",value:e,onChange:f=>{n(f.target.value),i&&o("")},placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(pM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(X,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Oe=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Oe.displayName="Card";const rt=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("flex flex-col space-y-1.5 p-6",t),...e}));rt.displayName="CardHeader";const at=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ut("font-semibold leading-none tracking-tight",t),...e}));at.displayName="CardTitle";const Kt=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ut("text-sm text-muted-foreground",t),...e}));Kt.displayName="CardDescription";const Le=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("p-6 pt-0",t),...e}));Le.displayName="CardContent";const II=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("flex items-center p-6 pt-0",t),...e}));II.displayName="CardFooter";const RI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function cx(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=RI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var x;return(x=m.parentNode)==null?void 0:x.removeChild(m)},250))}}const se={success:(t,e)=>cx(t,"success",e),error:(t,e)=>cx(t,"error",e),info:(t,e)=>cx(t,"info",e)};function mt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function PI(t,e){const n=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function No(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var S;const{scope:x,children:y,...N}=m,w=((S=x==null?void 0:x[t])==null?void 0:S[u])||c,j=b.useMemo(()=>N,Object.values(N));return s.jsx(w.Provider,{value:j,children:y})};h.displayName=i+"Provider";function f(m,x){var w;const y=((w=x==null?void 0:x[t])==null?void 0:w[u])||c,N=b.useContext(y);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,OI(a,...e)]}function OI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Ns=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},LI=Yf[" useId ".trim().toString()]||(()=>{}),DI=0;function oo(t){const[e,n]=b.useState(LI());return Ns(()=>{n(r=>r??String(DI++))},[t]),e?`radix-${e}`:""}var _I=Yf[" useInsertionEffect ".trim().toString()]||Ns;function cl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=zI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const x=$I(f)?f(t):f;x!==t&&((m=o.current)==null||m.call(o,x))}else i(f)},[c,t,i,o]);return[u,h]}function zI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return _I(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function $I(t){return typeof t=="function"}function Ud(t){const e=FI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(VI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function FI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=UI(a),c=HI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?y0(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var BI=Symbol("radix.slottable");function VI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===BI}function HI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function UI(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var WI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bt=WI.reduce((t,e)=>{const n=Ud(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function KI(t,e){t&&au.flushSync(()=>t.dispatchEvent(e))}function po(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function qI(t,e=globalThis==null?void 0:globalThis.document){const n=po(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var GI="DismissableLayer",fg="dismissableLayer.update",JI="dismissableLayer.pointerDownOutside",QI="dismissableLayer.focusOutside",N1,Qj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),v0=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(Qj),[f,m]=b.useState(null),x=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),N=Ht(e,z=>m(z)),w=Array.from(h.layers),[j]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),S=w.indexOf(j),E=f?w.indexOf(f):-1,T=h.layersWithOutsidePointerEventsDisabled.size>0,P=E>=S,O=ZI(z=>{const V=z.target,I=[...h.branches].some(te=>te.contains(V));!P||I||(a==null||a(z),o==null||o(z),z.defaultPrevented||c==null||c())},x),q=eR(z=>{const V=z.target;[...h.branches].some(te=>te.contains(V))||(i==null||i(z),o==null||o(z),z.defaultPrevented||c==null||c())},x);return qI(z=>{E===h.layers.size-1&&(r==null||r(z),!z.defaultPrevented&&c&&(z.preventDefault(),c()))},x),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(N1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),w1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=N1)}},[f,x,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),w1())},[f,h]),b.useEffect(()=>{const z=()=>y({});return document.addEventListener(fg,z),()=>document.removeEventListener(fg,z)},[]),s.jsx(bt.div,{...u,ref:N,style:{pointerEvents:T?P?"auto":"none":void 0,...t.style},onFocusCapture:mt(t.onFocusCapture,q.onFocusCapture),onBlurCapture:mt(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:mt(t.onPointerDownCapture,O.onPointerDownCapture)})});v0.displayName=GI;var YI="DismissableLayerBranch",XI=b.forwardRef((t,e)=>{const n=b.useContext(Qj),r=b.useRef(null),a=Ht(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(bt.div,{...t,ref:a})});XI.displayName=YI;function ZI(t,e=globalThis==null?void 0:globalThis.document){const n=po(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){Yj(JI,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}else e.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function eR(t,e=globalThis==null?void 0:globalThis.document){const n=po(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&Yj(QI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function w1(){const t=new CustomEvent(fg);document.dispatchEvent(t)}function Yj(t,e,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),r?KI(a,i):a.dispatchEvent(i)}var dx="focusScope.autoFocusOnMount",ux="focusScope.autoFocusOnUnmount",j1={bubbles:!1,cancelable:!0},tR="FocusScope",N0=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=po(a),f=po(i),m=b.useRef(null),x=Ht(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let w=function(T){if(y.paused||!c)return;const P=T.target;c.contains(P)?m.current=P:qi(m.current,{select:!0})},j=function(T){if(y.paused||!c)return;const P=T.relatedTarget;P!==null&&(c.contains(P)||qi(m.current,{select:!0}))},S=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&qi(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",j);const E=new MutationObserver(S);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",j),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){S1.add(y);const w=document.activeElement;if(!c.contains(w)){const S=new CustomEvent(dx,j1);c.addEventListener(dx,h),c.dispatchEvent(S),S.defaultPrevented||(nR(oR(Xj(c)),{select:!0}),document.activeElement===w&&qi(c))}return()=>{c.removeEventListener(dx,h),setTimeout(()=>{const S=new CustomEvent(ux,j1);c.addEventListener(ux,f),c.dispatchEvent(S),S.defaultPrevented||qi(w??document.body,{select:!0}),c.removeEventListener(ux,f),S1.remove(y)},0)}}},[c,h,f,y]);const N=b.useCallback(w=>{if(!n&&!r||y.paused)return;const j=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,S=document.activeElement;if(j&&S){const E=w.currentTarget,[T,P]=sR(E);T&&P?!w.shiftKey&&S===P?(w.preventDefault(),n&&qi(T,{select:!0})):w.shiftKey&&S===T&&(w.preventDefault(),n&&qi(P,{select:!0})):S===E&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(bt.div,{tabIndex:-1,...o,ref:x,onKeyDown:N})});N0.displayName=tR;function nR(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(qi(r,{select:e}),document.activeElement!==n)return}function sR(t){const e=Xj(t),n=k1(e,t),r=k1(e.reverse(),t);return[n,r]}function Xj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function k1(t,e){for(const n of t)if(!rR(n,{upTo:e}))return n}function rR(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function aR(t){return t instanceof HTMLInputElement&&"select"in t}function qi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&aR(t)&&e&&t.select()}}var S1=iR();function iR(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=C1(t,e),t.unshift(e)},remove(e){var n;t=C1(t,e),(n=t[0])==null||n.resume()}}}function C1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function oR(t){return t.filter(e=>e.tagName!=="A")}var lR="Portal",w0=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);Ns(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?uj.createPortal(s.jsx(bt.div,{...r,ref:e}),o):null});w0.displayName=lR;function cR(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var ou=t=>{const{present:e,children:n}=t,r=dR(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=Ht(r.ref,uR(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};ou.displayName="Presence";function dR(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=cR(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=fh(r.current);i.current=c==="mounted"?h:"none"},[c]),Ns(()=>{const h=r.current,f=a.current;if(f!==t){const x=i.current,y=fh(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&x!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),Ns(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=fh(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const j=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=j)})}},x=y=>{y.target===e&&(i.current=fh(r.current))};return e.addEventListener("animationstart",x),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",x),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function fh(t){return(t==null?void 0:t.animationName)||"none"}function uR(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var hx=0;function Zj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??T1()),document.body.insertAdjacentElement("beforeend",t[1]??T1()),hx++,()=>{hx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hx--}},[])}function T1(){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 ga=function(){return ga=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return ER;var e=MR(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},IR=sk(),mc="data-scroll-locked",RR=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),`
- .`.concat(fR,` {
+ */const TA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],pi=Ee("zap",TA),g0="admin_token";function iu(){try{return localStorage.getItem(g0)}catch{return null}}function EA(t){try{localStorage.setItem(g0,t)}catch{}}function ix(){try{localStorage.removeItem(g0)}catch{}}const MA="https://soulapi.quwanzhi.com",AA=15e3,h1=6e4,IA=()=>{const t="https://soulapi.quwanzhi.com";{const e=t.trim();if(e.length>0)return e.replace(/\/$/,"")}return MA};function wc(t){const e=IA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function ep(t,e={}){const{data:n,...r}=e,a=wc(t),i=new Headers(r.headers),o=iu();o&&i.set("Authorization",`Bearer ${o}`),n!=null&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=r.timeout??AA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),x=m.headers.get("Content-Type")||"";let y;if(x.includes("application/json"))try{y=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const w=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${w.slice(0,100)}`)}const N=w=>{const j=w,S=((j==null?void 0:j.message)||(j==null?void 0:j.error)||"").toString();(S.includes("可提现金额不足")||S.includes("可提现不足")||S.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:S}))};if(!m.ok){N(y);const w=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw w.status=m.status,w.data=y,w}return N(y),y}function Pe(t,e){return ep(t,{...e,method:"GET"})}function Ct(t,e,n){return ep(t,{...n,method:"POST",data:e})}function Gt(t,e,n){return ep(t,{...n,method:"PUT",data:e})}function li(t,e){return ep(t,{...e,method:"DELETE"})}function RA(){const[t,e]=b.useState(!1),[n,r]=b.useState("");return b.useEffect(()=>{const a=i=>{const o=i.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",a),()=>window.removeEventListener("recharge-alert",a)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(wj,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(Yn,{className:"w-4 h-4"})})]}):null}const PA=[{icon:aM,label:"数据概览",href:"/dashboard"},{icon:Gs,label:"内容管理",href:"/content"},{icon:In,label:"用户管理",href:"/users"},{icon:_5,label:"找伙伴",href:"/find-partner"},{icon:Nc,label:"推广中心",href:"/distribution"}];function OA(){const t=vo(),e=Sa(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;if(!iu()){e("/login",{replace:!0});return}return Pe("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(ix(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(ix(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{ix();try{await Ct("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[PA.map(c=>{const u=t.pathname===c.href;return s.jsxs(bc,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(bc,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(no,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.jsxs("button",{type:"button",onClick:o,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[s.jsx(gM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(RA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(PE,{})})]})]})}function f1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function y0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=f1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;Rj(i)&&typeof Qh=="function"&&(i=Qh(i._payload));const c=b.Children.toArray(i),u=c.find($A);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var Oj=Pj("Slot");function _A(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(Rj(a)&&typeof Qh=="function"&&(a=Qh(a._payload)),b.isValidElement(a)){const o=BA(a),c=FA(i,a.props);return a.type!==b.Fragment&&(c.ref=r?y0(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var zA=Symbol("radix.slottable");function $A(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===zA}function FA(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function BA(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function Lj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,m1=Dj,_j=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return m1(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const x=p1(f)||p1(m);return a[h][x]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,x]=f;return x===void 0||(h[m]=x),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:x,...y}=f;return Object.entries(y).every(N=>{let[w,j]=N;return Array.isArray(j)?j.includes({...i,...c}[w]):{...i,...c}[w]===j})?[...h,m,x]:h},[]);return m1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},VA=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),zj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Yh="-",x1=[],UA="arbitrary..",WA=t=>{const e=qA(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return KA(o);const c=o.split(Yh),u=c[0]===""&&c.length>1?1:0;return $j(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?VA(h,u):u:h||x1}return n[o]||x1}}},$j=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=$j(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(Yh):t.slice(e).join(Yh),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?UA+r:void 0})(),qA=t=>{const{theme:e,classGroups:n}=t;return GA(n,e)},GA=(t,e)=>{const n=zj();for(const r in t){const a=t[r];b0(a,n,r,e)}return n},b0=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){QA(t,e,n);return}if(typeof t=="function"){YA(t,e,n,r);return}XA(t,e,n,r)},QA=(t,e,n)=>{const r=t===""?e:Fj(e,t);r.classGroupId=n},YA=(t,e,n,r)=>{if(ZA(t)){b0(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(HA(n,t))},XA=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(Yh),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,eI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},hg="!",g1=":",tI=[],y1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),nI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let w=0;wu?h-u:void 0;return y1(i,y,x,N)};if(e){const a=e+g1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):y1(tI,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},sI=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},rI=t=>({cache:eI(t.cacheSize),parseClassName:nI(t),sortModifiers:sI(t),...WA(t)}),aI=/\s+/,iI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(aI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:x,hasImportantModifier:y,baseClassName:N,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let j=!!w,S=r(j?N.substring(0,w):N);if(!S){if(!j){u=f+(u.length>0?" "+u:u);continue}if(S=r(N),!S){u=f+(u.length>0?" "+u:u);continue}j=!1}const E=x.length===0?"":x.length===1?x[0]:i(x).join(":"),T=y?E+hg:E,P=T+S;if(o.indexOf(P)>-1)continue;o.push(P);const O=a(S,j);for(let q=0;q0?" "+u:u)}return u},oI=(...t)=>{let e=0,n,r,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=rI(h),r=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=iI(u,n);return a(u,f),f};return i=o,(...u)=>i(oI(...u))},cI=[],Wn=t=>{const e=n=>n[t]||cI;return e.isThemeGetter=!0,e},Vj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dI=/^\d+\/\d+$/,uI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hI=/\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$/,fI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yl=t=>dI.test(t),yt=t=>!!t&&!Number.isNaN(Number(t)),Ui=t=>!!t&&Number.isInteger(Number(t)),ox=t=>t.endsWith("%")&&yt(t.slice(0,-1)),Za=t=>uI.test(t),xI=()=>!0,gI=t=>hI.test(t)&&!fI.test(t),Uj=()=>!1,yI=t=>pI.test(t),bI=t=>mI.test(t),vI=t=>!Ke(t)&&!qe(t),NI=t=>Oc(t,qj,Uj),Ke=t=>Vj.test(t),qo=t=>Oc(t,Gj,gI),lx=t=>Oc(t,CI,yt),b1=t=>Oc(t,Wj,Uj),wI=t=>Oc(t,Kj,bI),uh=t=>Oc(t,Jj,yI),qe=t=>Hj.test(t),gd=t=>Lc(t,Gj),jI=t=>Lc(t,TI),v1=t=>Lc(t,Wj),kI=t=>Lc(t,qj),SI=t=>Lc(t,Kj),hh=t=>Lc(t,Jj,!0),Oc=(t,e,n)=>{const r=Vj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Lc=(t,e,n=!1)=>{const r=Hj.exec(t);return r?r[1]?e(r[1]):n:!1},Wj=t=>t==="position"||t==="percentage",Kj=t=>t==="image"||t==="url",qj=t=>t==="length"||t==="size"||t==="bg-size",Gj=t=>t==="length",CI=t=>t==="number",TI=t=>t==="family-name",Jj=t=>t==="shadow",EI=()=>{const t=Wn("color"),e=Wn("font"),n=Wn("text"),r=Wn("font-weight"),a=Wn("tracking"),i=Wn("leading"),o=Wn("breakpoint"),c=Wn("container"),u=Wn("spacing"),h=Wn("radius"),f=Wn("shadow"),m=Wn("inset-shadow"),x=Wn("text-shadow"),y=Wn("drop-shadow"),N=Wn("blur"),w=Wn("perspective"),j=Wn("aspect"),S=Wn("ease"),E=Wn("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...P(),qe,Ke],q=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],V=()=>[qe,Ke,u],I=()=>[Yl,"full","auto",...V()],te=()=>[Ui,"none","subgrid",qe,Ke],Q=()=>["auto",{span:["full",Ui,qe,Ke]},Ui,qe,Ke],F=()=>[Ui,"auto",qe,Ke],re=()=>["auto","min","max","fr",qe,Ke],ie=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...V()],D=()=>[Yl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],R=()=>[t,qe,Ke],oe=()=>[...P(),v1,b1,{position:[qe,Ke]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",kI,NI,{size:[qe,Ke]}],U=()=>[ox,gd,qo],H=()=>["","none","full",h,qe,Ke],K=()=>["",yt,gd,qo],me=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[yt,ox,v1,b1],de=()=>["","none",N,qe,Ke],ve=()=>["none",yt,qe,Ke],ye=()=>["none",yt,qe,Ke],ke=()=>[yt,qe,Ke],ze=()=>[Yl,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Za],breakpoint:[Za],color:[xI],container:[Za],"drop-shadow":[Za],ease:["in","out","in-out"],font:[vI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Za],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Za],shadow:[Za],spacing:["px",yt],text:[Za],"text-shadow":[Za],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Yl,Ke,qe,j]}],container:["container"],columns:[{columns:[yt,Ke,qe,c]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:O()}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Ui,"auto",qe,Ke]}],basis:[{basis:[Yl,"full","auto",c,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[yt,Yl,"auto","initial","none",Ke]}],grow:[{grow:["",yt,qe,Ke]}],shrink:[{shrink:["",yt,qe,Ke]}],order:[{order:[Ui,"first","last","none",qe,Ke]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...ie(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...ie()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],w:[{w:[c,"screen",...D()]}],"min-w":[{"min-w":[c,"screen","none",...D()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,gd,qo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,qe,lx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ox,Ke]}],"font-family":[{font:[jI,Ke,e]}],"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:[a,qe,Ke]}],"line-clamp":[{"line-clamp":[yt,"none",qe,lx]}],leading:[{leading:[i,...V()]}],"list-image":[{"list-image":["none",qe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",qe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[yt,"from-font","auto",qe,qo]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[yt,"auto",qe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe,Ke]}],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",qe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ui,qe,Ke],radial:["",qe,Ke],conic:[Ui,qe,Ke]},SI,wI]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[yt,qe,Ke]}],"outline-w":[{outline:["",yt,gd,qo]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",f,hh,uh]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",m,hh,uh]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[yt,qo]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",x,hh,uh]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[yt,qe,Ke]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"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":[yt]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[qe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[yt]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",qe,Ke]}],filter:[{filter:["","none",qe,Ke]}],blur:[{blur:de()}],brightness:[{brightness:[yt,qe,Ke]}],contrast:[{contrast:[yt,qe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",y,hh,uh]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",yt,qe,Ke]}],"hue-rotate":[{"hue-rotate":[yt,qe,Ke]}],invert:[{invert:["",yt,qe,Ke]}],saturate:[{saturate:[yt,qe,Ke]}],sepia:[{sepia:["",yt,qe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",qe,Ke]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[yt,qe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[yt,qe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",yt,qe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[yt,qe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",yt,qe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[yt,qe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[yt,qe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",yt,qe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",qe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[yt,"initial",qe,Ke]}],ease:[{ease:["linear","initial",S,qe,Ke]}],delay:[{delay:[yt,qe,Ke]}],animate:[{animate:["none",E,qe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,qe,Ke]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[qe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ze()}],"translate-x":[{"translate-x":ze()}],"translate-y":[{"translate-y":ze()}],"translate-z":[{"translate-z":ze()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"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",qe,Ke]}],"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":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",qe,Ke]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[yt,gd,qo,lx]}],stroke:[{stroke:["none",...R()]}],"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"]}},MI=lI(EI);function Ut(...t){return MI(Dj(t))}function fo(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const AI=_j("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function X({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?Oj:"button";return s.jsx(i,{"data-slot":"button",className:Ut(AI({variant:e,size:n,className:t})),...a})}function ce({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Ut("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",t),...n})}function II(){const t=Sa(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1);b.useEffect(()=>{iu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await Ct("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){EA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:s.jsx(dc,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(oi,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"text",value:e,onChange:f=>{n(f.target.value),i&&o("")},placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(mM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(X,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Oe=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Oe.displayName="Card";const rt=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("flex flex-col space-y-1.5 p-6",t),...e}));rt.displayName="CardHeader";const at=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ut("font-semibold leading-none tracking-tight",t),...e}));at.displayName="CardTitle";const Kt=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ut("text-sm text-muted-foreground",t),...e}));Kt.displayName="CardDescription";const Le=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("p-6 pt-0",t),...e}));Le.displayName="CardContent";const RI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ut("flex items-center p-6 pt-0",t),...e}));RI.displayName="CardFooter";const PI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function cx(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=PI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var x;return(x=m.parentNode)==null?void 0:x.removeChild(m)},250))}}const se={success:(t,e)=>cx(t,"success",e),error:(t,e)=>cx(t,"error",e),info:(t,e)=>cx(t,"info",e)};function mt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function OI(t,e){const n=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function No(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var S;const{scope:x,children:y,...N}=m,w=((S=x==null?void 0:x[t])==null?void 0:S[u])||c,j=b.useMemo(()=>N,Object.values(N));return s.jsx(w.Provider,{value:j,children:y})};h.displayName=i+"Provider";function f(m,x){var w;const y=((w=x==null?void 0:x[t])==null?void 0:w[u])||c,N=b.useContext(y);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,LI(a,...e)]}function LI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Ns=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},DI=Yf[" useId ".trim().toString()]||(()=>{}),_I=0;function oo(t){const[e,n]=b.useState(DI());return Ns(()=>{n(r=>r??String(_I++))},[t]),e?`radix-${e}`:""}var zI=Yf[" useInsertionEffect ".trim().toString()]||Ns;function cl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=$I({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const x=FI(f)?f(t):f;x!==t&&((m=o.current)==null||m.call(o,x))}else i(f)},[c,t,i,o]);return[u,h]}function $I({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return zI(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function FI(t){return typeof t=="function"}function Ud(t){const e=BI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(HI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function BI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=WI(a),c=UI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?y0(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var VI=Symbol("radix.slottable");function HI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===VI}function UI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function WI(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var KI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bt=KI.reduce((t,e)=>{const n=Ud(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function qI(t,e){t&&au.flushSync(()=>t.dispatchEvent(e))}function po(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function GI(t,e=globalThis==null?void 0:globalThis.document){const n=po(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var JI="DismissableLayer",fg="dismissableLayer.update",QI="dismissableLayer.pointerDownOutside",YI="dismissableLayer.focusOutside",N1,Qj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),v0=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(Qj),[f,m]=b.useState(null),x=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),N=Ht(e,z=>m(z)),w=Array.from(h.layers),[j]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),S=w.indexOf(j),E=f?w.indexOf(f):-1,T=h.layersWithOutsidePointerEventsDisabled.size>0,P=E>=S,O=eR(z=>{const V=z.target,I=[...h.branches].some(te=>te.contains(V));!P||I||(a==null||a(z),o==null||o(z),z.defaultPrevented||c==null||c())},x),q=tR(z=>{const V=z.target;[...h.branches].some(te=>te.contains(V))||(i==null||i(z),o==null||o(z),z.defaultPrevented||c==null||c())},x);return GI(z=>{E===h.layers.size-1&&(r==null||r(z),!z.defaultPrevented&&c&&(z.preventDefault(),c()))},x),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(N1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),w1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=N1)}},[f,x,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),w1())},[f,h]),b.useEffect(()=>{const z=()=>y({});return document.addEventListener(fg,z),()=>document.removeEventListener(fg,z)},[]),s.jsx(bt.div,{...u,ref:N,style:{pointerEvents:T?P?"auto":"none":void 0,...t.style},onFocusCapture:mt(t.onFocusCapture,q.onFocusCapture),onBlurCapture:mt(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:mt(t.onPointerDownCapture,O.onPointerDownCapture)})});v0.displayName=JI;var XI="DismissableLayerBranch",ZI=b.forwardRef((t,e)=>{const n=b.useContext(Qj),r=b.useRef(null),a=Ht(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(bt.div,{...t,ref:a})});ZI.displayName=XI;function eR(t,e=globalThis==null?void 0:globalThis.document){const n=po(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){Yj(QI,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}else e.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function tR(t,e=globalThis==null?void 0:globalThis.document){const n=po(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&Yj(YI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function w1(){const t=new CustomEvent(fg);document.dispatchEvent(t)}function Yj(t,e,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),r?qI(a,i):a.dispatchEvent(i)}var dx="focusScope.autoFocusOnMount",ux="focusScope.autoFocusOnUnmount",j1={bubbles:!1,cancelable:!0},nR="FocusScope",N0=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=po(a),f=po(i),m=b.useRef(null),x=Ht(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let w=function(T){if(y.paused||!c)return;const P=T.target;c.contains(P)?m.current=P:qi(m.current,{select:!0})},j=function(T){if(y.paused||!c)return;const P=T.relatedTarget;P!==null&&(c.contains(P)||qi(m.current,{select:!0}))},S=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&qi(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",j);const E=new MutationObserver(S);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",j),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){S1.add(y);const w=document.activeElement;if(!c.contains(w)){const S=new CustomEvent(dx,j1);c.addEventListener(dx,h),c.dispatchEvent(S),S.defaultPrevented||(sR(lR(Xj(c)),{select:!0}),document.activeElement===w&&qi(c))}return()=>{c.removeEventListener(dx,h),setTimeout(()=>{const S=new CustomEvent(ux,j1);c.addEventListener(ux,f),c.dispatchEvent(S),S.defaultPrevented||qi(w??document.body,{select:!0}),c.removeEventListener(ux,f),S1.remove(y)},0)}}},[c,h,f,y]);const N=b.useCallback(w=>{if(!n&&!r||y.paused)return;const j=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,S=document.activeElement;if(j&&S){const E=w.currentTarget,[T,P]=rR(E);T&&P?!w.shiftKey&&S===P?(w.preventDefault(),n&&qi(T,{select:!0})):w.shiftKey&&S===T&&(w.preventDefault(),n&&qi(P,{select:!0})):S===E&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(bt.div,{tabIndex:-1,...o,ref:x,onKeyDown:N})});N0.displayName=nR;function sR(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(qi(r,{select:e}),document.activeElement!==n)return}function rR(t){const e=Xj(t),n=k1(e,t),r=k1(e.reverse(),t);return[n,r]}function Xj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function k1(t,e){for(const n of t)if(!aR(n,{upTo:e}))return n}function aR(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function iR(t){return t instanceof HTMLInputElement&&"select"in t}function qi(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&iR(t)&&e&&t.select()}}var S1=oR();function oR(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=C1(t,e),t.unshift(e)},remove(e){var n;t=C1(t,e),(n=t[0])==null||n.resume()}}}function C1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function lR(t){return t.filter(e=>e.tagName!=="A")}var cR="Portal",w0=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);Ns(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?uj.createPortal(s.jsx(bt.div,{...r,ref:e}),o):null});w0.displayName=cR;function dR(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var ou=t=>{const{present:e,children:n}=t,r=uR(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=Ht(r.ref,hR(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};ou.displayName="Presence";function uR(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=dR(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=fh(r.current);i.current=c==="mounted"?h:"none"},[c]),Ns(()=>{const h=r.current,f=a.current;if(f!==t){const x=i.current,y=fh(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&x!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),Ns(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=fh(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const j=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=j)})}},x=y=>{y.target===e&&(i.current=fh(r.current))};return e.addEventListener("animationstart",x),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",x),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function fh(t){return(t==null?void 0:t.animationName)||"none"}function hR(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var hx=0;function Zj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??T1()),document.body.insertAdjacentElement("beforeend",t[1]??T1()),hx++,()=>{hx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hx--}},[])}function T1(){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 ga=function(){return ga=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return MR;var e=AR(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},RR=sk(),mc="data-scroll-locked",PR=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),`
+ .`.concat(pR,` {
overflow: hidden `).concat(r,`;
padding-right: `).concat(c,"px ").concat(r,`;
}
@@ -619,17 +619,17 @@ Error generating stack: `+C.message+`
}
body[`).concat(mc,`] {
- `).concat(pR,": ").concat(c,`px;
+ `).concat(mR,": ").concat(c,`px;
}
-`)},M1=function(){var t=parseInt(document.body.getAttribute(mc)||"0",10);return isFinite(t)?t:0},PR=function(){b.useEffect(function(){return document.body.setAttribute(mc,(M1()+1).toString()),function(){var t=M1()-1;t<=0?document.body.removeAttribute(mc):document.body.setAttribute(mc,t.toString())}},[])},OR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;PR();var i=b.useMemo(function(){return AR(a)},[a]);return b.createElement(IR,{styles:RR(i,!e,a,n?"":"!important")})},pg=!1;if(typeof window<"u")try{var ph=Object.defineProperty({},"passive",{get:function(){return pg=!0,!0}});window.addEventListener("test",ph,ph),window.removeEventListener("test",ph,ph)}catch{pg=!1}var Xl=pg?{passive:!1}:!1,LR=function(t){return t.tagName==="TEXTAREA"},rk=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!LR(t)&&n[e]==="visible")},DR=function(t){return rk(t,"overflowY")},_R=function(t){return rk(t,"overflowX")},A1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=ak(t,r);if(a){var i=ik(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},$R=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},ak=function(t,e){return t==="v"?DR(e):_R(e)},ik=function(t,e){return t==="v"?zR(e):$R(e)},FR=function(t,e){return t==="h"&&e==="rtl"?-1:1},BR=function(t,e,n,r,a){var i=FR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,x=0;do{if(!c)break;var y=ik(t,c),N=y[0],w=y[1],j=y[2],S=w-j-i*N;(N||S)&&ak(t,c)&&(m+=S,x+=N);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(x)<1)&&(h=!0),h},mh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},I1=function(t){return[t.deltaX,t.deltaY]},R1=function(t){return t&&"current"in t?t.current:t},VR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},HR=function(t){return`
+`)},M1=function(){var t=parseInt(document.body.getAttribute(mc)||"0",10);return isFinite(t)?t:0},OR=function(){b.useEffect(function(){return document.body.setAttribute(mc,(M1()+1).toString()),function(){var t=M1()-1;t<=0?document.body.removeAttribute(mc):document.body.setAttribute(mc,t.toString())}},[])},LR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;OR();var i=b.useMemo(function(){return IR(a)},[a]);return b.createElement(RR,{styles:PR(i,!e,a,n?"":"!important")})},pg=!1;if(typeof window<"u")try{var ph=Object.defineProperty({},"passive",{get:function(){return pg=!0,!0}});window.addEventListener("test",ph,ph),window.removeEventListener("test",ph,ph)}catch{pg=!1}var Xl=pg?{passive:!1}:!1,DR=function(t){return t.tagName==="TEXTAREA"},rk=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!DR(t)&&n[e]==="visible")},_R=function(t){return rk(t,"overflowY")},zR=function(t){return rk(t,"overflowX")},A1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=ak(t,r);if(a){var i=ik(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$R=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},FR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},ak=function(t,e){return t==="v"?_R(e):zR(e)},ik=function(t,e){return t==="v"?$R(e):FR(e)},BR=function(t,e){return t==="h"&&e==="rtl"?-1:1},VR=function(t,e,n,r,a){var i=BR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,x=0;do{if(!c)break;var y=ik(t,c),N=y[0],w=y[1],j=y[2],S=w-j-i*N;(N||S)&&ak(t,c)&&(m+=S,x+=N);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(x)<1)&&(h=!0),h},mh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},I1=function(t){return[t.deltaX,t.deltaY]},R1=function(t){return t&&"current"in t?t.current:t},HR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},UR=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
-`)},UR=0,Zl=[];function WR(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(UR++)[0],i=b.useState(sk)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var w=hR([t.lockRef.current],(t.shards||[]).map(R1),!0).filter(Boolean);return w.forEach(function(j){return j.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),w.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(w,j){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var S=mh(w),E=n.current,T="deltaX"in w?w.deltaX:E[0]-S[0],P="deltaY"in w?w.deltaY:E[1]-S[1],O,q=w.target,z=Math.abs(T)>Math.abs(P)?"h":"v";if("touches"in w&&z==="h"&&q.type==="range")return!1;var V=window.getSelection(),I=V&&V.anchorNode,te=I?I===q||I.contains(q):!1;if(te)return!1;var Q=A1(z,q);if(!Q)return!0;if(Q?O=z:(O=z==="v"?"h":"v",Q=A1(z,q)),!Q)return!1;if(!r.current&&"changedTouches"in w&&(T||P)&&(r.current=O),!O)return!0;var F=r.current||O;return BR(F,j,w,F==="h"?T:P)},[]),u=b.useCallback(function(w){var j=w;if(!(!Zl.length||Zl[Zl.length-1]!==i)){var S="deltaY"in j?I1(j):mh(j),E=e.current.filter(function(O){return O.name===j.type&&(O.target===j.target||j.target===O.shadowParent)&&VR(O.delta,S)})[0];if(E&&E.should){j.cancelable&&j.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(R1).filter(Boolean).filter(function(O){return O.contains(j.target)}),P=T.length>0?c(j,T[0]):!o.current.noIsolation;P&&j.cancelable&&j.preventDefault()}}},[]),h=b.useCallback(function(w,j,S,E){var T={name:w,delta:j,target:S,should:E,shadowParent:KR(S)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(P){return P!==T})},1)},[]),f=b.useCallback(function(w){n.current=mh(w),r.current=void 0},[]),m=b.useCallback(function(w){h(w.type,I1(w),w.target,c(w,t.lockRef.current))},[]),x=b.useCallback(function(w){h(w.type,mh(w),w.target,c(w,t.lockRef.current))},[]);b.useEffect(function(){return Zl.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",u,Xl),document.addEventListener("touchmove",u,Xl),document.addEventListener("touchstart",f,Xl),function(){Zl=Zl.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,Xl),document.removeEventListener("touchmove",u,Xl),document.removeEventListener("touchstart",f,Xl)}},[]);var y=t.removeScrollBar,N=t.inert;return b.createElement(b.Fragment,null,N?b.createElement(i,{styles:HR(a)}):null,y?b.createElement(OR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function KR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const qR=NR(nk,WR);var j0=b.forwardRef(function(t,e){return b.createElement(tp,ga({},t,{ref:e,sideCar:qR}))});j0.classNames=tp.classNames;var GR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ec=new WeakMap,xh=new WeakMap,gh={},xx=0,ok=function(t){return t&&(t.host||ok(t.parentNode))},JR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=ok(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},QR=function(t,e,n,r){var a=JR(e,Array.isArray(t)?t:[t]);gh[n]||(gh[n]=new WeakMap);var i=gh[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(x){if(c.has(x))f(x);else try{var y=x.getAttribute(r),N=y!==null&&y!=="false",w=(ec.get(x)||0)+1,j=(i.get(x)||0)+1;ec.set(x,w),i.set(x,j),o.push(x),w===1&&N&&xh.set(x,!0),j===1&&x.setAttribute(n,"true"),N||x.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return f(e),c.clear(),xx++,function(){o.forEach(function(m){var x=ec.get(m)-1,y=i.get(m)-1;ec.set(m,x),i.set(m,y),x||(xh.has(m)||m.removeAttribute(r),xh.delete(m)),y||m.removeAttribute(n)}),xx--,xx||(ec=new WeakMap,ec=new WeakMap,xh=new WeakMap,gh={})}},lk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=GR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),QR(r,a,n,"aria-hidden")):function(){return null}},np="Dialog",[ck]=No(np),[YR,Xr]=ck(np),dk=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=cl({prop:r,defaultProp:a??!1,onChange:i,caller:np});return s.jsx(YR,{scope:e,triggerRef:c,contentRef:u,contentId:oo(),titleId:oo(),descriptionId:oo(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};dk.displayName=np;var uk="DialogTrigger",XR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(uk,n),i=Ht(e,a.triggerRef);return s.jsx(bt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":C0(a.open),...r,ref:i,onClick:mt(t.onClick,a.onOpenToggle)})});XR.displayName=uk;var k0="DialogPortal",[ZR,hk]=ck(k0,{forceMount:void 0}),fk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=Xr(k0,e);return s.jsx(ZR,{scope:e,forceMount:n,children:b.Children.map(r,o=>s.jsx(ou,{present:n||i.open,children:s.jsx(w0,{asChild:!0,container:a,children:o})}))})};fk.displayName=k0;var Xh="DialogOverlay",pk=b.forwardRef((t,e)=>{const n=hk(Xh,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Xr(Xh,t.__scopeDialog);return i.modal?s.jsx(ou,{present:r||i.open,children:s.jsx(tP,{...a,ref:e})}):null});pk.displayName=Xh;var eP=Ud("DialogOverlay.RemoveScroll"),tP=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(Xh,n);return s.jsx(j0,{as:eP,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(bt.div,{"data-state":C0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),dl="DialogContent",mk=b.forwardRef((t,e)=>{const n=hk(dl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Xr(dl,t.__scopeDialog);return s.jsx(ou,{present:r||i.open,children:i.modal?s.jsx(nP,{...a,ref:e}):s.jsx(sP,{...a,ref:e})})});mk.displayName=dl;var nP=b.forwardRef((t,e)=>{const n=Xr(dl,t.__scopeDialog),r=b.useRef(null),a=Ht(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return lk(i)},[]),s.jsx(xk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:mt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:mt(t.onFocusOutside,i=>i.preventDefault())})}),sP=b.forwardRef((t,e)=>{const n=Xr(dl,t.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return s.jsx(xk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),xk=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Xr(dl,n),u=b.useRef(null),h=Ht(e,u);return Zj(),s.jsxs(s.Fragment,{children:[s.jsx(N0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(v0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":C0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(rP,{titleId:c.titleId}),s.jsx(iP,{contentRef:u,descriptionId:c.descriptionId})]})]})}),S0="DialogTitle",gk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(S0,n);return s.jsx(bt.h2,{id:a.titleId,...r,ref:e})});gk.displayName=S0;var yk="DialogDescription",bk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(yk,n);return s.jsx(bt.p,{id:a.descriptionId,...r,ref:e})});bk.displayName=yk;var vk="DialogClose",Nk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(vk,n);return s.jsx(bt.button,{type:"button",...r,ref:e,onClick:mt(t.onClick,()=>a.onOpenChange(!1))})});Nk.displayName=vk;function C0(t){return t?"open":"closed"}var wk="DialogTitleWarning",[PV,jk]=PI(wk,{contentName:dl,titleName:S0,docsSlug:"dialog"}),rP=({titleId:t})=>{const e=jk(wk),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
+`)},WR=0,Zl=[];function KR(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(WR++)[0],i=b.useState(sk)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var w=fR([t.lockRef.current],(t.shards||[]).map(R1),!0).filter(Boolean);return w.forEach(function(j){return j.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),w.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(w,j){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var S=mh(w),E=n.current,T="deltaX"in w?w.deltaX:E[0]-S[0],P="deltaY"in w?w.deltaY:E[1]-S[1],O,q=w.target,z=Math.abs(T)>Math.abs(P)?"h":"v";if("touches"in w&&z==="h"&&q.type==="range")return!1;var V=window.getSelection(),I=V&&V.anchorNode,te=I?I===q||I.contains(q):!1;if(te)return!1;var Q=A1(z,q);if(!Q)return!0;if(Q?O=z:(O=z==="v"?"h":"v",Q=A1(z,q)),!Q)return!1;if(!r.current&&"changedTouches"in w&&(T||P)&&(r.current=O),!O)return!0;var F=r.current||O;return VR(F,j,w,F==="h"?T:P)},[]),u=b.useCallback(function(w){var j=w;if(!(!Zl.length||Zl[Zl.length-1]!==i)){var S="deltaY"in j?I1(j):mh(j),E=e.current.filter(function(O){return O.name===j.type&&(O.target===j.target||j.target===O.shadowParent)&&HR(O.delta,S)})[0];if(E&&E.should){j.cancelable&&j.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(R1).filter(Boolean).filter(function(O){return O.contains(j.target)}),P=T.length>0?c(j,T[0]):!o.current.noIsolation;P&&j.cancelable&&j.preventDefault()}}},[]),h=b.useCallback(function(w,j,S,E){var T={name:w,delta:j,target:S,should:E,shadowParent:qR(S)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(P){return P!==T})},1)},[]),f=b.useCallback(function(w){n.current=mh(w),r.current=void 0},[]),m=b.useCallback(function(w){h(w.type,I1(w),w.target,c(w,t.lockRef.current))},[]),x=b.useCallback(function(w){h(w.type,mh(w),w.target,c(w,t.lockRef.current))},[]);b.useEffect(function(){return Zl.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",u,Xl),document.addEventListener("touchmove",u,Xl),document.addEventListener("touchstart",f,Xl),function(){Zl=Zl.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,Xl),document.removeEventListener("touchmove",u,Xl),document.removeEventListener("touchstart",f,Xl)}},[]);var y=t.removeScrollBar,N=t.inert;return b.createElement(b.Fragment,null,N?b.createElement(i,{styles:UR(a)}):null,y?b.createElement(LR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function qR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const GR=wR(nk,KR);var j0=b.forwardRef(function(t,e){return b.createElement(tp,ga({},t,{ref:e,sideCar:GR}))});j0.classNames=tp.classNames;var JR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},ec=new WeakMap,xh=new WeakMap,gh={},xx=0,ok=function(t){return t&&(t.host||ok(t.parentNode))},QR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=ok(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},YR=function(t,e,n,r){var a=QR(e,Array.isArray(t)?t:[t]);gh[n]||(gh[n]=new WeakMap);var i=gh[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(x){if(c.has(x))f(x);else try{var y=x.getAttribute(r),N=y!==null&&y!=="false",w=(ec.get(x)||0)+1,j=(i.get(x)||0)+1;ec.set(x,w),i.set(x,j),o.push(x),w===1&&N&&xh.set(x,!0),j===1&&x.setAttribute(n,"true"),N||x.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return f(e),c.clear(),xx++,function(){o.forEach(function(m){var x=ec.get(m)-1,y=i.get(m)-1;ec.set(m,x),i.set(m,y),x||(xh.has(m)||m.removeAttribute(r),xh.delete(m)),y||m.removeAttribute(n)}),xx--,xx||(ec=new WeakMap,ec=new WeakMap,xh=new WeakMap,gh={})}},lk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=JR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),YR(r,a,n,"aria-hidden")):function(){return null}},np="Dialog",[ck]=No(np),[XR,Xr]=ck(np),dk=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=cl({prop:r,defaultProp:a??!1,onChange:i,caller:np});return s.jsx(XR,{scope:e,triggerRef:c,contentRef:u,contentId:oo(),titleId:oo(),descriptionId:oo(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};dk.displayName=np;var uk="DialogTrigger",ZR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(uk,n),i=Ht(e,a.triggerRef);return s.jsx(bt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":C0(a.open),...r,ref:i,onClick:mt(t.onClick,a.onOpenToggle)})});ZR.displayName=uk;var k0="DialogPortal",[eP,hk]=ck(k0,{forceMount:void 0}),fk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=Xr(k0,e);return s.jsx(eP,{scope:e,forceMount:n,children:b.Children.map(r,o=>s.jsx(ou,{present:n||i.open,children:s.jsx(w0,{asChild:!0,container:a,children:o})}))})};fk.displayName=k0;var Xh="DialogOverlay",pk=b.forwardRef((t,e)=>{const n=hk(Xh,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Xr(Xh,t.__scopeDialog);return i.modal?s.jsx(ou,{present:r||i.open,children:s.jsx(nP,{...a,ref:e})}):null});pk.displayName=Xh;var tP=Ud("DialogOverlay.RemoveScroll"),nP=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(Xh,n);return s.jsx(j0,{as:tP,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(bt.div,{"data-state":C0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),dl="DialogContent",mk=b.forwardRef((t,e)=>{const n=hk(dl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Xr(dl,t.__scopeDialog);return s.jsx(ou,{present:r||i.open,children:i.modal?s.jsx(sP,{...a,ref:e}):s.jsx(rP,{...a,ref:e})})});mk.displayName=dl;var sP=b.forwardRef((t,e)=>{const n=Xr(dl,t.__scopeDialog),r=b.useRef(null),a=Ht(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return lk(i)},[]),s.jsx(xk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:mt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:mt(t.onFocusOutside,i=>i.preventDefault())})}),rP=b.forwardRef((t,e)=>{const n=Xr(dl,t.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return s.jsx(xk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),xk=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Xr(dl,n),u=b.useRef(null),h=Ht(e,u);return Zj(),s.jsxs(s.Fragment,{children:[s.jsx(N0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(v0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":C0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(aP,{titleId:c.titleId}),s.jsx(oP,{contentRef:u,descriptionId:c.descriptionId})]})]})}),S0="DialogTitle",gk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(S0,n);return s.jsx(bt.h2,{id:a.titleId,...r,ref:e})});gk.displayName=S0;var yk="DialogDescription",bk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(yk,n);return s.jsx(bt.p,{id:a.descriptionId,...r,ref:e})});bk.displayName=yk;var vk="DialogClose",Nk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Xr(vk,n);return s.jsx(bt.button,{type:"button",...r,ref:e,onClick:mt(t.onClick,()=>a.onOpenChange(!1))})});Nk.displayName=vk;function C0(t){return t?"open":"closed"}var wk="DialogTitleWarning",[LV,jk]=OI(wk,{contentName:dl,titleName:S0,docsSlug:"dialog"}),aP=({titleId:t})=>{const e=jk(wk),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
-For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},aP="DialogDescriptionWarning",iP=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jk(aP).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},oP=dk,lP=fk,cP=pk,dP=mk,uP=gk,hP=bk,fP=Nk;function Dt(t){return s.jsx(oP,{"data-slot":"dialog",...t})}function pP(t){return s.jsx(lP,{...t})}const kk=b.forwardRef(({className:t,...e},n)=>s.jsx(cP,{ref:n,className:Ut("fixed inset-0 z-50 bg-black/50",t),...e}));kk.displayName="DialogOverlay";const Lt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(pP,{children:[s.jsx(kk,{}),s.jsxs(dP,{ref:a,"aria-describedby":void 0,className:Ut("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg",t),...r,children:[e,n&&s.jsxs(fP,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Yn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Lt.displayName="DialogContent";function _t({className:t,...e}){return s.jsx("div",{className:Ut("flex flex-col gap-2 text-center sm:text-left",t),...e})}function fn({className:t,...e}){return s.jsx("div",{className:Ut("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function zt(t){return s.jsx(uP,{className:"text-lg font-semibold leading-none",...t})}function Zh(t){return s.jsx(hP,{className:"text-sm text-muted-foreground",...t})}const mP=_j("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ve({className:t,variant:e,asChild:n=!1,...r}){const a=n?Oj:"span";return s.jsx(a,{className:Ut(mP({variant:e}),t),...r})}var xP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gP=xP.reduce((t,e)=>{const n=Pj(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),yP="Label",Sk=b.forwardRef((t,e)=>s.jsx(gP.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Sk.displayName=yP;var Ck=Sk;const ee=b.forwardRef(({className:t,...e},n)=>s.jsx(Ck,{ref:n,className:Ut("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ee.displayName=Ck.displayName;function T0(t){const e=t+"CollectionProvider",[n,r]=No(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:j,children:S}=w,E=As.useRef(null),T=As.useRef(new Map).current;return s.jsx(a,{scope:j,itemMap:T,collectionRef:E,children:S})};o.displayName=e;const c=t+"CollectionSlot",u=Ud(c),h=As.forwardRef((w,j)=>{const{scope:S,children:E}=w,T=i(c,S),P=Ht(j,T.collectionRef);return s.jsx(u,{ref:P,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",x=Ud(f),y=As.forwardRef((w,j)=>{const{scope:S,children:E,...T}=w,P=As.useRef(null),O=Ht(j,P),q=i(f,S);return As.useEffect(()=>(q.itemMap.set(P,{ref:P,...T}),()=>void q.itemMap.delete(P))),s.jsx(x,{[m]:"",ref:O,children:E})});y.displayName=f;function N(w){const j=i(t+"CollectionConsumer",w);return As.useCallback(()=>{const E=j.collectionRef.current;if(!E)return[];const T=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(j.itemMap.values()).sort((q,z)=>T.indexOf(q.ref.current)-T.indexOf(z.ref.current))},[j.collectionRef,j.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},N,r]}var bP=b.createContext(void 0);function sp(t){const e=b.useContext(bP);return t||e||"ltr"}var gx="rovingFocusGroup.onEntryFocus",vP={bubbles:!1,cancelable:!0},lu="RovingFocusGroup",[mg,Tk,NP]=T0(lu),[wP,Ek]=No(lu,[NP]),[jP,kP]=wP(lu),Mk=b.forwardRef((t,e)=>s.jsx(mg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(mg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(SP,{...t,ref:e})})}));Mk.displayName=lu;var SP=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,x=b.useRef(null),y=Ht(e,x),N=sp(i),[w,j]=cl({prop:o,defaultProp:c??null,onChange:u,caller:lu}),[S,E]=b.useState(!1),T=po(h),P=Tk(n),O=b.useRef(!1),[q,z]=b.useState(0);return b.useEffect(()=>{const V=x.current;if(V)return V.addEventListener(gx,T),()=>V.removeEventListener(gx,T)},[T]),s.jsx(jP,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(V=>j(V),[j]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>z(V=>V+1),[]),onFocusableItemRemove:b.useCallback(()=>z(V=>V-1),[]),children:s.jsx(bt.div,{tabIndex:S||q===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:mt(t.onMouseDown,()=>{O.current=!0}),onFocus:mt(t.onFocus,V=>{const I=!O.current;if(V.target===V.currentTarget&&I&&!S){const te=new CustomEvent(gx,vP);if(V.currentTarget.dispatchEvent(te),!te.defaultPrevented){const Q=P().filter($=>$.focusable),F=Q.find($=>$.active),re=Q.find($=>$.id===w),J=[F,re,...Q].filter(Boolean).map($=>$.ref.current);Rk(J,f)}}O.current=!1}),onBlur:mt(t.onBlur,()=>E(!1))})})}),Ak="RovingFocusGroupItem",Ik=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=oo(),h=i||u,f=kP(Ak,n),m=f.currentTabStopId===h,x=Tk(n),{onFocusableItemAdd:y,onFocusableItemRemove:N,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return y(),()=>N()},[r,y,N]),s.jsx(mg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(bt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:mt(t.onMouseDown,j=>{r?f.onItemFocus(h):j.preventDefault()}),onFocus:mt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:mt(t.onKeyDown,j=>{if(j.key==="Tab"&&j.shiftKey){f.onItemShiftTab();return}if(j.target!==j.currentTarget)return;const S=EP(j,f.orientation,f.dir);if(S!==void 0){if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)return;j.preventDefault();let T=x().filter(P=>P.focusable).map(P=>P.ref.current);if(S==="last")T.reverse();else if(S==="prev"||S==="next"){S==="prev"&&T.reverse();const P=T.indexOf(j.currentTarget);T=f.loop?MP(T,P+1):T.slice(P+1)}setTimeout(()=>Rk(T))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});Ik.displayName=Ak;var CP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function TP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function EP(t,e,n){const r=TP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return CP[r]}function Rk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function MP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var AP=Mk,IP=Ik,rp="Tabs",[RP]=No(rp,[Ek]),Pk=Ek(),[PP,E0]=RP(rp),Ok=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=sp(c),[m,x]=cl({prop:r,onChange:a,defaultProp:i??"",caller:rp});return s.jsx(PP,{scope:n,baseId:oo(),value:m,onValueChange:x,orientation:o,dir:f,activationMode:u,children:s.jsx(bt.div,{dir:f,"data-orientation":o,...h,ref:e})})});Ok.displayName=rp;var Lk="TabsList",Dk=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=E0(Lk,n),o=Pk(n);return s.jsx(AP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(bt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});Dk.displayName=Lk;var _k="TabsTrigger",zk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=E0(_k,n),c=Pk(n),u=Bk(o.baseId,r),h=Vk(o.baseId,r),f=r===o.value;return s.jsx(IP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(bt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:mt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:mt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:mt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});zk.displayName=_k;var $k="TabsContent",Fk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=E0($k,n),u=Bk(c.baseId,r),h=Vk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const x=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(x)},[]),s.jsx(ou,{present:a||f,children:({present:x})=>s.jsx(bt.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!x,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:x&&i})})});Fk.displayName=$k;function Bk(t,e){return`${t}-trigger-${e}`}function Vk(t,e){return`${t}-content-${e}`}var OP=Ok,Hk=Dk,Uk=zk,Wk=Fk;const jc=OP,ul=b.forwardRef(({className:t,...e},n)=>s.jsx(Hk,{ref:n,className:Ut("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ul.displayName=Hk.displayName;const Qt=b.forwardRef(({className:t,...e},n)=>s.jsx(Uk,{ref:n,className:Ut("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 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",t),...e}));Qt.displayName=Uk.displayName;const Yt=b.forwardRef(({className:t,...e},n)=>s.jsx(Wk,{ref:n,className:Ut("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Yt.displayName=Wk.displayName;function M0(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function A0(t){const[e,n]=b.useState(void 0);return Ns(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var ap="Switch",[LP]=No(ap),[DP,_P]=LP(ap),Kk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[x,y]=b.useState(null),N=Ht(e,T=>y(T)),w=b.useRef(!1),j=x?f||!!x.closest("form"):!0,[S,E]=cl({prop:a,defaultProp:i??!1,onChange:h,caller:ap});return s.jsxs(DP,{scope:n,checked:S,disabled:c,children:[s.jsx(bt.button,{type:"button",role:"switch","aria-checked":S,"aria-required":o,"data-state":Qk(S),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:mt(t.onClick,T=>{E(P=>!P),j&&(w.current=T.isPropagationStopped(),w.current||T.stopPropagation())})}),j&&s.jsx(Jk,{control:x,bubbles:!w.current,name:r,value:u,checked:S,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});Kk.displayName=ap;var qk="SwitchThumb",Gk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=_P(qk,n);return s.jsx(bt.span,{"data-state":Qk(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});Gk.displayName=qk;var zP="SwitchBubbleInput",Jk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=Ht(o,i),u=M0(n),h=A0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const N=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(N)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Jk.displayName=zP;function Qk(t){return t?"checked":"unchecked"}var Yk=Kk,$P=Gk;const $t=b.forwardRef(({className:t,...e},n)=>s.jsx(Yk,{className:Ut("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",t),...e,ref:n,children:s.jsx($P,{className:Ut("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));$t.displayName=Yk.displayName;const FP={view_chapter:"浏览章节",purchase:"购买",match:"派对匹配",login:"登录",register:"注册",share:"分享",bind_phone:"绑定手机",bind_wechat:"绑定微信",fill_profile:"完善资料",fill_avatar:"设置头像",visit_page:"访问页面",first_pay:"首次付款",vip_activate:"开通会员",click_super:"点击超级个体",lead_submit:"提交留资",withdraw:"申请提现",referral_bind:"绑定推荐人",card_click:"点击名片",btn_click:"按钮点击",tab_click:"切换标签",nav_click:"导航点击",page_view:"页面浏览",search:"搜索"};function BP(t){return FP[t]||t||"行为"}function VP(t,e){const n=new Set,r=a=>(t[a]??0)>0;return(r("purchase")||r("first_pay")||r("vip_activate"))&&n.add("已付费"),(r("lead_submit")||r("click_super"))&&n.add("高意向"),r("view_chapter")&&n.add("想学习"),r("match")&&n.add("找合伙人"),r("withdraw")&&n.add("有提现行为"),r("referral_bind")&&n.add("推广参与"),(r("fill_profile")||r("fill_avatar")||r("bind_phone"))&&n.add("资料完善中"),e!=null&&e.hasFullBook&&n.add("全书读者"),e!=null&&e.isVip&&n.add("VIP会员"),e!=null&&e.mbti&&/^[EI][NS][FT][JP]$/i.test(e.mbti)&&n.add(String(e.mbti).toUpperCase()),Array.from(n)}function I0({open:t,onClose:e,userId:n,onUserUpdated:r}){var Ea,Ys,Ss,Xs,ur,Cs;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState({}),[f,m]=b.useState([]),[x,y]=b.useState(null),[N,w]=b.useState(null),[j,S]=b.useState(!1),[E,T]=b.useState(!1),[P,O]=b.useState(!1),[q,z]=b.useState("info"),[V,I]=b.useState(""),[te,Q]=b.useState(""),[F,re]=b.useState(""),[ie,J]=b.useState([]),[$,D]=b.useState(""),[R,oe]=b.useState(""),[G,_]=b.useState(""),[U,H]=b.useState(!1),[K,me]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[Y,le]=b.useState([]),[de,ve]=b.useState(!1),[ye,ke]=b.useState(""),[ze,ft]=b.useState(""),[wt,dt]=b.useState(!1),[Rt,Tt]=b.useState(!1),[Tn,mn]=b.useState(null),[Ft,qt]=b.useState(null),[vn,On]=b.useState(""),[$n,St]=b.useState(""),[cn,xn]=b.useState(""),[ge,Se]=b.useState(!1),[$e,Xe]=b.useState(null),[jt,gt]=b.useState(!1),[L,Me]=b.useState({}),[pt,Et]=b.useState([]);b.useEffect(()=>{t&&n&&(gt(!1),z("info"),mn(null),qt(null),Xe(null),oe(""),_(""),tt(),Pe("/api/db/vip-roles").then(ae=>{ae!=null&&ae.success&&ae.data&&le(ae.data)}).catch(()=>{}))},[t,n]),b.useEffect(()=>{t&&Pe("/api/admin/mbti-avatars").then(ae=>{ae!=null&&ae.avatars&&typeof ae.avatars=="object"?Me(ae.avatars):Me({})}).catch(()=>Me({}))},[t]);const ht=(ae,xe)=>{const Ue=(ae||"").trim();if(Ue)return fo(Ue);const ut=(xe||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(ut)?(L[ut]||"").trim():""};async function tt(){if(n){S(!0);try{const ae=await Pe(`/api/db/users?id=${encodeURIComponent(n)}`);if(ae!=null&&ae.success&&ae.user){const xe=ae.user;i(xe),I(xe.phone||""),Q(xe.wechatId||""),re(xe.nickname||""),On(xe.phone||""),St(xe.wechatId||""),xn(xe.openId||"");try{J(typeof xe.tags=="string"?JSON.parse(xe.tags||"[]"):[])}catch{J([])}me({isVip:!!(xe.isVip??!1),vipExpireDate:xe.vipExpireDate?String(xe.vipExpireDate).slice(0,10):"",vipRole:String(xe.vipRole??""),vipName:String(xe.vipName??""),vipProject:String(xe.vipProject??""),vipContact:String(xe.vipContact??""),vipBio:String(xe.vipBio??"")})}try{const xe=await Pe(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=100`);if(xe!=null&&xe.success){h(xe.stats&&typeof xe.stats=="object"?xe.stats:{});const Ue=xe.tracks||[];c(Ue.map(ut=>({...ut,actionLabel:ut.actionLabel||ut.action,timeAgo:ut.timeAgo||""})))}else h({}),c([])}catch{h({}),c([])}try{const xe=await Pe(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);xe!=null&&xe.success?(m(xe.referrals||[]),y(xe.inboundSource||null)):(m([]),y(null))}catch{m([]),y(null)}try{const xe=await Pe(`/api/admin/users/${encodeURIComponent(n)}/balance`);xe!=null&&xe.success&&xe.data?w(xe.data):w(null)}catch{w(null)}try{const xe=await Pe(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);xe!=null&&xe.success&&xe.orders?Et(xe.orders):Et([])}catch{Et([])}}catch(ae){console.error("Load user detail error:",ae)}finally{S(!1)}}}async function Pt(){if(!(a!=null&&a.phone)){se.info("用户未绑定手机号,无法同步");return}T(!0);try{const ae=await Ct("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});ae!=null&&ae.success?(se.success("同步成功"),tt()):se.error("同步失败: "+(ae==null?void 0:ae.error))}catch(ae){console.error("Sync CKB error:",ae),se.error("同步失败")}finally{T(!1)}}async function Wt(){if(a){if(K.isVip&&!K.vipExpireDate.trim()){se.error("开启 VIP 请填写有效到期日");return}O(!0);try{const ae={id:a.id,phone:V.trim()||void 0,wechatId:te.trim(),nickname:F||void 0,tags:JSON.stringify(ie),isVip:K.isVip,vipExpireDate:K.isVip?K.vipExpireDate:void 0,vipRole:K.vipRole||void 0,vipName:K.vipName||void 0,vipProject:K.vipProject||void 0,vipContact:K.vipContact||void 0,vipBio:K.vipBio||void 0},xe=await Gt("/api/db/users",ae);xe!=null&&xe.success?(se.success("保存成功"),tt(),r==null||r()):se.error("保存失败: "+(xe==null?void 0:xe.error))}catch(ae){console.error("Save user error:",ae),se.error("保存失败")}finally{O(!1)}}}const en=()=>{$&&!ie.includes($)&&(J([...ie,$]),D(""))},ts=ae=>J(ie.filter(xe=>xe!==ae));async function Qs(){if(a){if(!R){se.error("请输入新密码");return}if(R!==G){se.error("两次密码不一致");return}if(R.length<6){se.error("密码至少 6 位");return}H(!0);try{const ae=await Gt("/api/db/users",{id:a.id,password:R});ae!=null&&ae.success?(se.success("修改成功"),oe(""),_("")):se.error("修改失败: "+((ae==null?void 0:ae.error)||""))}catch{se.error("修改失败")}finally{H(!1)}}}async function bi(){if(!a)return;const ae=parseFloat(ye);if(Number.isNaN(ae)||ae===0){se.error("请输入有效金额(正数增加、负数扣减)");return}dt(!0);try{const xe=await Ct(`/api/admin/users/${a.id}/balance/adjust`,{amount:ae,remark:ze||void 0});xe!=null&&xe.success?(se.success("余额已调整"),ve(!1),ke(""),ft(""),tt(),r==null||r()):se.error("调整失败: "+((xe==null?void 0:xe.error)||""))}catch{se.error("调整失败")}finally{dt(!1)}}async function ea(){if(!vn&&!cn&&!$n){qt("请至少输入手机号、微信号或 OpenID 中的一项");return}Tt(!0),qt(null),mn(null);try{const ae=new URLSearchParams;vn&&ae.set("phone",vn),cn&&ae.set("openId",cn),$n&&ae.set("wechatId",$n);const xe=await Pe(`/api/admin/shensheshou/query?${ae}`);xe!=null&&xe.success&&xe.data?(mn(xe.data),a&&await ta(xe.data)):qt((xe==null?void 0:xe.error)||"未查询到数据,该用户可能未在神射手收录")}catch(ae){console.error("SSS query error:",ae),qt("请求失败,请检查神射手接口配置")}finally{Tt(!1)}}async function ta(ae){if(a)try{await Ct("/api/admin/shensheshou/enrich",{userId:a.id,phone:vn||a.phone||"",openId:cn||a.openId||"",wechatId:$n||a.wechatId||""}),tt()}catch(xe){console.error("SSS enrich error:",xe)}}async function Er(){if(a){Se(!0),Xe(null);try{const ae=Array.from(new Set(o.filter(Ps=>Ps.action==="view_chapter"||Ps.action==="purchase"||Ps.action==="first_pay").map(Ps=>(Ps.chapterTitle||Ps.target||"").trim()).filter(Boolean))).slice(0,12),xe={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Ue=ae.length>0?`意向章节:${ae.join("、")}`:"",ut={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:ie,purchaseIntent:xe,purchaseIntentChapters:ae,remark:Ue}]},Fn=await Ct("/api/admin/shensheshou/ingest",ut);Fn!=null&&Fn.success&&Fn.data?Xe(Fn.data):Xe({error:(Fn==null?void 0:Fn.error)||"推送失败"})}catch(ae){console.error("SSS ingest error:",ae),Xe({error:"请求失败"})}finally{Se(!1)}}}const Mr=ae=>{const Ue={view_chapter:Gs,purchase:Md,match:In,login:oi,register:oi,share:ya,bind_phone:d1,bind_wechat:NM,fill_profile:Ad,fill_avatar:oi,visit_page:qr,first_pay:Md,vip_activate:pc,click_super:In,lead_submit:d1,withdraw:cg,referral_bind:ya,card_click:oi,btn_click:pi,tab_click:qr,nav_click:qr,page_view:qr,search:qr}[ae]||ig;return s.jsx(Ue,{className:"w-4 h-4"})};function Ar(ae){const xe=String(ae||"").trim();return xe.length>22&&/^[a-zA-Z0-9_-]+$/.test(xe)}const cr=b.useMemo(()=>VP(u,a),[u,a]);function dr(){const ae=[...ie];for(const xe of cr)ae.includes(xe)||ae.push(xe);J(ae),se.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Dt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[92vh] overflow-hidden flex flex-col p-4 sm:p-5",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(oi,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),j?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2.5 p-2.5 bg-[#0a1628] rounded-lg mb-2 shrink-0",children:[s.jsxs("div",{className:"flex gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:"w-11 h-11 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-lg text-[#38bdac] shrink-0",children:ht(a.avatar,a.mbti)&&!jt?s.jsx("img",{src:ht(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>gt(!0)}):((Ea=a.nickname)==null?void 0:Ea.charAt(0))||"?"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h3",{className:"text-base font-bold text-white leading-tight",children:a.nickname}),a.isAdmin&&s.jsx(Ve,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0",children:a.vipRole})]}),a.referralCode&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:["推荐码 ",s.jsx("code",{className:"text-[#38bdac]",children:a.referralCode})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"昵称"}),s.jsx("p",{className:"text-white truncate",children:F||a.nickname||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"手机号"}),s.jsx("p",{className:"text-white truncate",children:V||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"微信标识"}),s.jsx("p",{className:"text-white truncate",children:te||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"画像"}),s.jsx("p",{className:"text-[#38bdac] truncate",children:[a.region,a.industry,a.position,a.mbti?`MBTI ${a.mbti}`:""].filter(Boolean).join(" · ")||"未完善"})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 gap-1.5 shrink-0 sm:w-[220px]",children:[s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500 uppercase tracking-wide",children:"累计佣金"}),s.jsxs("p",{className:"text-sm font-bold text-[#38bdac] leading-tight",children:["¥",(a.earnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"推广/分佣入账"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"待提现"}),s.jsxs("p",{className:"text-sm font-bold text-yellow-400 leading-tight",children:["¥",(a.pendingEarnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"未打款部分"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsxs("div",{className:"flex items-center justify-between gap-1",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"账户余额"}),s.jsx(X,{type:"button",size:"sm",variant:"ghost",className:"h-5 px-1 text-[9px] text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>{ke(""),ft(""),ve(!0)},children:"调整"})]}),s.jsxs("p",{className:"text-sm font-bold text-white leading-tight",children:["¥",((N==null?void 0:N.balance)??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"可消费/抵扣"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"推荐人数"}),s.jsx("p",{className:"text-sm font-bold text-white leading-tight",children:a.referralCount??0}),s.jsx("p",{className:"text-[9px] text-gray-600",children:a.createdAt?`注册 ${new Date(a.createdAt).toLocaleDateString()}`:"—"})]})]})]}),s.jsxs(jc,{value:q,onValueChange:z,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(ul,{className:"bg-[#0a1628] border border-gray-700/50 p-0.5 mb-2 flex-wrap h-auto gap-0.5 shrink-0",children:[s.jsx(Qt,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"用户信息"}),s.jsxs(Qt,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:[s.jsx(qr,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(Qt,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"关系链路"}),s.jsx(Qt,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"标签体系"})]}),s.jsxs(Yt,{value:"info",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[s.jsxs("details",{className:"rounded-lg bg-[#0a1628] border border-gray-700/40 p-2 text-[11px] group",children:[s.jsxs("summary",{className:"cursor-pointer text-gray-400 select-none list-none flex items-center gap-1",children:[s.jsx("span",{className:"group-open:text-[#38bdac]",children:"技术标识"}),s.jsx("span",{className:"text-gray-600",children:"(用户ID / OpenID,默认折叠)"})]}),s.jsxs("div",{className:"mt-2 space-y-1.5 text-gray-300 font-mono text-[10px] break-all border-t border-gray-700/30 pt-2",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"用户ID"})," ",a.id]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"OpenID"})," ",a.openId||"—"]}),s.jsx("p",{className:"text-gray-500 not-italic font-sans leading-snug",children:"OpenID 为微信用户标识;下方「微信标识」为微信号/wxid,供存客宝归属,与 OpenID 不同。"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:F,onChange:ae=>re(ae.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-[11px]",children:"手机号(可改,点底部保存生效)"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"11 位手机号",value:V,onChange:ae=>I(ae.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-[11px]",children:"微信标识(微信号/wxid,非 OpenID)"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"如 wxid_xxx 或自定义微信号",value:te,onChange:ae=>Q(ae.target.value)})]})]}),(a.region||a.industry||a.position||a.mbti)&&s.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px]",children:[a.region&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:[s.jsx(Aj,{className:"w-3 h-3 inline mr-0.5"}),a.region]}),a.industry&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["行业 ",a.industry]}),a.position&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["职位 ",a.position]}),a.mbti&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#38bdac]/15 text-[#38bdac]",children:["MBTI ",a.mbti]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-amber-500/25",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(pc,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"超级个体"}),a.isVip&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx($t,{className:"scale-90",checked:K.isVip,onCheckedChange:ae=>me(xe=>({...xe,isVip:ae}))})]}),K.isVip&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-1.5 mt-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"到期日"}),s.jsx(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",value:K.vipExpireDate,onChange:ae=>me(xe=>({...xe,vipExpireDate:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-1.5 h-7 text-xs",value:K.vipRole,onChange:ae=>me(xe=>({...xe,vipRole:ae.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),Y.map(ae=>s.jsx("option",{value:ae.name,children:ae.name},ae.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"展示名"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"展示名",value:K.vipName,onChange:ae=>me(xe=>({...xe,vipName:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"项目"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"项目",value:K.vipProject,onChange:ae=>me(xe=>({...xe,vipProject:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"联系方式"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"微信/手机",value:K.vipContact,onChange:ae=>me(xe=>({...xe,vipContact:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"简介"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"简短介绍",value:K.vipBio,onChange:ae=>me(xe=>({...xe,vipBio:ae.target.value}))})]})]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-[#38bdac]/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(pi,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"外部资料 · 神射手 / 存客宝(与上方基础信息联动)"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-1.5 mb-1.5",children:[s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:手机",value:vn,onChange:ae=>On(ae.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:$n,onChange:ae=>St(ae.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:cn,onChange:ae=>xn(ae.target.value)})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsxs(X,{size:"sm",className:"h-7 text-[11px] px-2 bg-[#38bdac] hover:bg-[#2da396]",onClick:ea,disabled:Rt,children:[Rt?s.jsx(Fe,{className:"w-3 h-3 animate-spin"}):s.jsx(va,{className:"w-3 h-3 mr-0.5"}),"查询回填"]}),s.jsx(X,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2 border-purple-500/40 text-purple-300",onClick:Er,disabled:ge||!a.phone,children:ge?"推送…":"推神射手"}),s.jsx(X,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:Pt,disabled:E||!a.phone,children:E?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),Ft&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:Ft}),Tn&&s.jsxs("div",{className:"mt-1.5 grid grid-cols-2 gap-1.5",children:[s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"RFM"})," ",s.jsx("span",{className:"text-[#38bdac] font-semibold",children:Tn.rfm_score??"—"})]}),s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"等级"})," ",s.jsx("span",{className:"text-white font-semibold",children:Tn.user_level??"—"})]})]}),$e&&s.jsx("p",{className:"mt-1 text-[11px]",children:$e.error?s.jsx("span",{className:"text-red-400",children:String($e.error)}):s.jsx("span",{className:"text-green-400",children:"推送成功"})})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(cg,{className:"w-3.5 h-3.5 text-yellow-400"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-1.5 sm:items-center",children:[s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"新密码 ≥6 位",value:R,onChange:ae=>oe(ae.target.value)}),s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:G,onChange:ae=>_(ae.target.value)}),s.jsx(X,{size:"sm",className:"h-7 text-[11px] shrink-0 bg-yellow-500/20 text-yellow-300 border border-yellow-500/35 hover:bg-yellow-500/30",onClick:Qs,disabled:U||!R||!G,children:U?"保存中":"确认修改"})]})]})]}),s.jsxs(Yt,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[pt.length>0&&s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Md,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",pt.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:pt.map((ae,xe)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-amber-300",children:ae.productType==="fullbook"||ae.productType==="vip"?"全书/VIP":`章节 ${ae.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(ae.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ae.createdAt?new Date(ae.createdAt).toLocaleString("zh-CN"):""})]},ae.orderSn||xe))})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg flex flex-col gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",children:[s.jsx(qr,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsxs("span",{children:["全站埋点共 ",o.length," 条;用于 RFM 与「标签体系」旅程推断"]})]}),Object.keys(u).length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 pt-1 border-t border-gray-700/40",children:Object.entries(u).sort((ae,xe)=>xe[1]-ae[1]).map(([ae,xe])=>s.jsxs(Ve,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[BP(ae)," ×",xe]},ae))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((ae,xe)=>s.jsxs("div",{className:"flex items-start gap-2 p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Mr(ae.action)}),xe0?((x==null?void 0:x.visits)||[]).map((ae,xe)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"text-white truncate",children:["第 ",ae.seq||xe+1," 次 · ",ae.referrerNickname||"微信用户",ae.referrerId?`(${ae.referrerId})`:""]}),ae.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:ae.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ae.visitedAt?new Date(ae.visitedAt).toLocaleString():""})]},`${ae.referrerId||"unknown"}_${xe}`)):s.jsx("p",{className:"text-gray-500 text-sm text-center py-2",children:"暂无来源点击记录"})})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ya,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"推荐的用户"})]}),s.jsxs(Ve,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 text-[10px]",children:["共 ",f.length," 人"]})]}),s.jsx("div",{className:"space-y-1 max-h-[min(280px,40vh)] overflow-y-auto",children:f.length>0?f.map((ae,xe)=>{var ut;const Ue=ae;return s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[10px] text-[#38bdac] shrink-0",children:((ut=Ue.nickname)==null?void 0:ut.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Ue.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Ue.status==="vip"&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-[10px]",children:Ue.createdAt?new Date(Ue.createdAt).toLocaleDateString():""})]})]},Ue.id||xe)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(Yt,{value:"tags",className:"flex-1 min-h-0 overflow-y-auto space-y-3 pr-0.5",children:[s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[s.jsx(Ad,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-[11px]",children:"《一场 Soul 的创业实验》维度"})]}),s.jsxs("div",{className:"mb-2 p-2 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-start gap-2 text-[11px] text-gray-400",children:[s.jsx(jj,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0 mt-0.5"}),"预设可点选;下方「旅程推断」由轨迹+资料自动算出,可一键并入已选后点弹窗底部保存。"]}),s.jsxs("div",{className:"mb-3 p-2 rounded-lg bg-[#162840]/80 border border-cyan-500/20",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-1.5",children:[s.jsx("span",{className:"text-cyan-300/90 text-xs font-medium",children:"旅程推断标签"}),s.jsx(X,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-cyan-500/40 text-cyan-200 hover:bg-cyan-500/10",disabled:cr.length===0,onClick:dr,children:"合并到已选"})]}),cr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:cr.map(ae=>s.jsxs(Ve,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${ie.includes(ae)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[ie.includes(ae)?"✓ ":"",ae]},ae))}):s.jsx("p",{className:"text-[11px] text-gray-500",children:"暂无推断(无轨迹或行为未命中规则)"})]}),s.jsx("div",{className:"mb-3 space-y-2",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(ae=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:ae.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ae.tags.map(xe=>s.jsxs("button",{type:"button",onClick:()=>{ie.includes(xe)?ts(xe):J([...ie,xe])},className:`px-1.5 py-0.5 rounded text-[11px] border transition-all ${ie.includes(xe)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[ie.includes(xe)?"✓ ":"",xe]},xe))})]},ae.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-2",children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1.5",children:"已选标签(需保存修改写入库)"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:[ie.map((ae,xe)=>s.jsxs(Ve,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[ae,s.jsx("button",{type:"button",onClick:()=>ts(ae),className:"ml-1 hover:text-red-400",children:s.jsx(Yn,{className:"w-3 h-3"})})]},xe)),ie.length===0&&s.jsx("span",{className:"text-gray-600 text-xs",children:"暂未选择"})]}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1 h-8 text-xs",placeholder:"自定义标签,回车添加",value:$,onChange:ae=>D(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&en()}),s.jsx(X,{onClick:en,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const ae=a.tags||a.ckbTags||"";let xe=[];try{const ut=typeof ae=="string"?JSON.parse(ae||"[]"):[];xe=Array.isArray(ut)?ut:typeof ae=="string"?ae.split(","):[]}catch{xe=typeof ae=="string"?ae.split(","):[]}const Ue=xe.map(ut=>String(ut).trim()).filter(Boolean);return Ue.length===0?null:s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx(Ad,{className:"w-3.5 h-3.5 text-purple-400"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:Ue.map((ut,Fn)=>s.jsx(Ve,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:ut},Fn))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(X,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(X,{onClick:Wt,disabled:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),P?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Dt,{open:de,onOpenChange:ve,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx(zt,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:ye,onChange:ae=>ke(ae.target.value)})]}),s.jsxs("div",{children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:ze,onChange:ae=>ft(ae.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(X,{variant:"outline",onClick:()=>ve(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(X,{onClick:bi,disabled:wt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:wt?"提交中...":"确认调整"})]})]})})]}):null}function HP(){const t=Sa(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,x]=b.useState(0),[y,N]=b.useState(0),[w,j]=b.useState(0),[S,E]=b.useState(0),[T,P]=b.useState(null),[O,q]=b.useState(null),[z,V]=b.useState(!1),[I,te]=b.useState(0),[Q,F]=b.useState(!1),[re,ie]=b.useState(null),[J,$]=b.useState("overview"),[D,R]=b.useState([]),[oe,G]=b.useState(!1),[_,U]=b.useState("today"),[H,K]=b.useState(null),[me,Y]=b.useState(!1),[le,de]=b.useState(!0),[ve,ye]=b.useState(null),[ke,ze]=b.useState(null),[ft,wt]=b.useState([]),dt=ge=>{const Se=ge;if((Se==null?void 0:Se.status)===401)P("登录已过期,请重新登录");else{if((Se==null?void 0:Se.name)==="AbortError")return;P("加载失败,请检查网络或联系管理员")}};async function Rt(ge){var jt,gt;const Se=ge?{signal:ge}:void 0;n(!0),P(null);try{const L=await Pe("/api/admin/dashboard/stats",Se);L!=null&&L.success&&(x(L.totalUsers??0),N(L.paidOrderCount??0),j(L.totalRevenue??0),E(L.conversionRate??0))}catch(L){if((L==null?void 0:L.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",L);try{const Me=await Pe("/api/admin/dashboard/overview",Se);Me!=null&&Me.success&&(x(Me.totalUsers??0),N(Me.paidOrderCount??0),j(Me.totalRevenue??0),E(Me.conversionRate??0))}catch(Me){dt(Me)}}}finally{n(!1)}try{const L=await Pe("/api/admin/balance/summary",Se);L!=null&&L.success&&L.data&&te(L.data.totalGifted??0)}catch{}try{const L=await Pe("/api/db/ckb-plan-stats",Se);L!=null&&L.success&&L.data?ie({ckbTotal:L.data.ckbTotal??0,withContact:L.data.withContact??0}):ie(null)}catch{ie(null)}de(!0);try{const[L,Me]=await Promise.allSettled([Pe("/api/db/match-records?stats=true",Se),Pe("/api/admin/distribution/overview",Se)]);L.status==="fulfilled"&&((jt=L.value)!=null&&jt.success)&&L.value.data?ye({totalMatches:L.value.data.totalMatches??0,todayMatches:L.value.data.todayMatches??0,uniqueUsers:L.value.data.uniqueUsers??0,paidMatchCount:L.value.data.paidMatchCount??0}):ye(null),Me.status==="fulfilled"&&((gt=Me.value)!=null&>.success)&&Me.value.overview?ze({todayClicks:Me.value.overview.todayClicks??0,todayBindings:Me.value.overview.todayBindings??0,todayConversions:Me.value.overview.todayConversions??0,monthClicks:Me.value.overview.monthClicks??0,monthBindings:Me.value.overview.monthBindings??0,monthConversions:Me.value.overview.monthConversions??0,totalClicks:Me.value.overview.totalClicks??0,totalBindings:Me.value.overview.totalBindings??0,totalConversions:Me.value.overview.totalConversions??0,conversionRate:Me.value.overview.conversionRate}):ze(null)}catch{ye(null),ze(null)}finally{de(!1)}try{const L=await Pe("/api/db/vip-members?limit=500",Se);L!=null&&L.success&&Array.isArray(L.data)?wt(L.data):wt([])}catch{wt([])}a(!0),o(!0);const $e=async()=>{try{const L=await Pe("/api/admin/dashboard/recent-orders?limit=10",Se);if(L!=null&&L.success&&L.recentOrders)f(L.recentOrders);else throw new Error("no data")}catch(L){if((L==null?void 0:L.name)!=="AbortError")try{const Me=await Pe("/api/admin/orders?page=1&pageSize=20&status=paid",Se),Et=((Me==null?void 0:Me.orders)??[]).filter(ht=>["paid","completed","success"].includes(ht.status||""));f(Et.slice(0,5))}catch{f([])}}finally{a(!1)}},Xe=async()=>{try{const L=await Pe("/api/admin/dashboard/new-users",Se);if(L!=null&&L.success&&L.newUsers)u(L.newUsers);else throw new Error("no data")}catch(L){if((L==null?void 0:L.name)!=="AbortError")try{const Me=await Pe("/api/db/users?page=1&pageSize=10",Se);u((Me==null?void 0:Me.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([$e(),Xe()])}async function Tt(ge){const Se=ge||_;Y(!0);try{const $e=await Pe(`/api/admin/track/stats?period=${Se}`);$e!=null&&$e.success&&K({total:$e.total??0,byModule:$e.byModule??{}})}catch{K(null)}finally{Y(!1)}}const Tn={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},mn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},Ft=ge=>ge?ge.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",qt=ge=>{if(!ge)return"";const Se=ge.trim().toLowerCase();if(!Se)return"";const $e=ft.find(jt=>{const gt=String(jt.id||"").toLowerCase();return gt===Se||gt.includes(Se)||Se.includes(gt)});if($e)return $e.name||$e.nickname||"";const Xe=ft.find(jt=>{const gt=String(jt.token||"").toLowerCase();return gt&&(gt===Se||gt.includes(Se)||Se.includes(gt))});return Xe&&(Xe.name||Xe.nickname)||""},vn=ge=>{if(!ge)return"未命名点击";const Se=ge.trim(),$e=Se.toLowerCase();if(/^链接头像[_-]/.test(Se)){const jt=Ft(Se.replace(/^链接头像[_-]/,""));return jt?`头像:${jt}`:"头像点击"}if(/^member[_-]?detail$/i.test($e)||$e.includes("member detail"))return"成员详情";if(/^giftpay$/i.test($e)||$e.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test($e))return`章节:${Ft(Se)}`;if($e.includes("soulvip")||$e.includes("super")){const jt=Se.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),gt=qt(jt)||qt(Ft(jt));return gt?`超级个体:${gt}`:`超级个体:${Ft(jt)}`}if($e.includes("qgdtw")||$e.includes("token")||$e.includes("0000"))return`对象:${Ft(Se)}`;const Xe={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return Xe[Se]?Xe[Se]:/^[a-z0-9_-]+$/i.test(Se)&&Ft(Se)||Se},On=ge=>{const Se=Tn[ge.module]||Tn[ge.page]||ge.module||ge.page||"其他",$e=mn[ge.action]||ge.action||"点击",Xe=vn(ge.target);return`${Se} · ${$e} · ${Xe}`};async function $n(){G(!0);try{const ge=await Pe("/api/admin/super-individual/stats");ge!=null&&ge.success&&Array.isArray(ge.data)&&R(ge.data)}catch{}finally{G(!1)}}b.useEffect(()=>{const ge=new AbortController;return Rt(ge.signal),Tt(),$n(),()=>{ge.abort()}},[]);const St=m,cn=ge=>{const Se=ge.productType||"",$e=ge.description||"";if(Se==="balance_recharge")return{title:`余额充值 ¥${typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Se==="gift_pay")return{title:`代付 ¥${typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Se==="gift_pay_batch"){const Xe=typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2);return{title:$e||`代付分享 ¥${Xe}`,subtitle:"代付分享"}}if(Se==="section"&&$e.includes("代付领取"))return{title:$e.replace("代付领取 - ",""),subtitle:"代付领取"};if($e){if(Se==="section"&&$e.includes("章节")){if($e.includes("-")){const Xe=$e.split("-");if(Xe.length>=3)return{title:`第${Xe[1]}章 第${Xe[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:$e,subtitle:"章节购买"}}return Se==="fullbook"||$e.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Se==="vip"||$e.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Se==="match"||$e.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:$e,subtitle:Se==="section"?"单章":Se==="fullbook"?"全书":"其他"}}return Se==="section"?{title:`章节 ${ge.productId||""}`,subtitle:"单章购买"}:Se==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Se==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Se==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Se||"其他"}},xn=[{title:"总用户数",value:e?null:St,sub:null,icon:In,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:I>0?`含代付 ¥${I.toFixed(2)}`:null,icon:Gh,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:Md,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof S=="number"?S.toFixed(1):0}%`,sub:null,icon:Gs,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:re?re.ckbTotal??0:null,sub:(re==null?void 0:re.withContact)!=null?`含联系方式 ${re.withContact} 人`:null,icon:hc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:le?null:((ve==null?void 0:ve.totalMatches)??0)+((ke==null?void 0:ke.totalClicks)??0),sub:le?null:`找伙伴 ${(ve==null?void 0:ve.totalMatches)??0} / 推广 ${(ke==null?void 0:ke.totalClicks)??0}`,icon:rc,color:"text-emerald-400",bg:"bg-emerald-500/20",link:"/find-partner"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),T&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:T}),s.jsx("button",{type:"button",onClick:()=>Rt(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"flex flex-nowrap gap-6 mb-8 overflow-x-auto pb-1",children:xn.map((ge,Se)=>s.jsxs(Oe,{className:"min-w-[220px] flex-1 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>ge.link&&t(ge.link),children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(at,{className:"text-sm font-medium text-gray-400",children:ge.title}),s.jsx("div",{className:`p-2 rounded-lg ${ge.bg}`,children:s.jsx(ge.icon,{className:`w-4 h-4 ${ge.color}`})})]}),s.jsx(Le,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-8 flex items-center",children:ge.value!=null?ge.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Fe,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),ge.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:ge.sub})]}),s.jsx(Xo,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Se))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>$("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="overview"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"数据概览"}),s.jsx("button",{type:"button",onClick:()=>$("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="tags"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"用户标签点击统计"}),s.jsx("button",{type:"button",onClick:()=>$("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),J==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(at,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>Rt(),disabled:le,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 ${le?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(Le,{children:[le&&!ve&&!ke?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4",children:[s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.totalMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴今日"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.todayMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴用户数"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.uniqueUsers)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ke==null?void 0:ke.totalClicks)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ke==null?void 0:ke.totalBindings)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ke==null?void 0:ke.totalConversions)??0})]})]}),(ke==null?void 0:ke.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",ke.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(at,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>Rt(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(Fe,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Fe,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(Le,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,Q?10:4).map(ge=>{var gt;const Se=ge.referrerId?c.find(L=>L.id===ge.referrerId):void 0,$e=ge.referralCode||(Se==null?void 0:Se.referralCode)||(Se==null?void 0:Se.nickname)||(ge.referrerId?String(ge.referrerId).slice(0,8):""),Xe=cn(ge),jt=ge.userNickname||((gt=c.find(L=>L.id===ge.userId))==null?void 0:gt.nickname)||"匿名用户";return s.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[ge.userAvatar?s.jsx("img",{src:ge.userAvatar,alt:jt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:L=>{L.currentTarget.style.display="none";const Me=L.currentTarget.nextElementSibling;Me&&Me.classList.remove("hidden")}}):null,s.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] shrink-0 mt-0.5 ${ge.userAvatar?"hidden":""}`,children:jt.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{ge.userId&&(q(ge.userId),V(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:jt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:Xe.title,children:Xe.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[Xe.subtitle&&Xe.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:Xe.subtitle}),s.jsx("span",{children:new Date(ge.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),$e&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",$e]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(ge.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:ge.paymentMethod||"微信"})]})]},ge.id)}),h.length>4&&!Q&&s.jsx("button",{type:"button",onClick:()=>F(!0),className:"w-full py-2 text-sm text-[#38bdac] hover:text-[#2da396] border border-dashed border-gray-600 rounded-lg hover:border-[#38bdac]/50 transition-colors",children:"展开更多"}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Md,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(at,{className:"text-white",children:"新注册用户"})}),s.jsx(Le,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(ge=>{var Se;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((Se=ge.nickname)==null?void 0:Se.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{q(ge.id),V(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ge.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:ge.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:ge.createdAt?new Date(ge.createdAt).toLocaleDateString():"-"})]},ge.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),J==="tags"&&s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(at,{className:"text-white flex items-center gap-2",children:[s.jsx(rc,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(ge=>s.jsx("button",{type:"button",onClick:()=>{U(ge),Tt(ge)},className:`px-3 py-1 text-xs rounded-full transition-colors ${_===ge?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[ge]},ge))})]}),s.jsx(Le,{children:me&&!H?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):H&&Object.keys(H.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:H.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(H.byModule).sort((ge,Se)=>Se[1].reduce(($e,Xe)=>$e+Xe.count,0)-ge[1].reduce(($e,Xe)=>$e+Xe.count,0)).slice(0,5).map(([ge,Se])=>{const $e=Se.reduce((Xe,jt)=>Xe+jt.count,0);return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:Tn[ge]||ge}),s.jsxs("span",{className:"text-xs text-gray-500",children:[$e," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Se.sort((Xe,jt)=>jt.count-Xe.count).slice(0,8).map((Xe,jt)=>{const gt=On(Xe);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:gt,children:gt}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${$e>0?Xe.count/$e*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:Xe.count})]})]},jt)})})]},ge)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(rc,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),J==="super"&&s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(at,{className:"text-white flex items-center gap-2",children:[s.jsx(rc,{className:"w-5 h-5 text-amber-400"}),"超级个体点击统计"]}),s.jsxs(X,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300 h-8",onClick:$n,disabled:oe,children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1 ${oe?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Le,{children:oe&&D.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):D.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-400 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"排名"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"超级个体"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"总点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"独立访客"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"人均点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",title:"该用户绑定 @人物 后,指向其 person 的留资独立人数",children:"获客(去重)"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"手机号"})]})}),s.jsx("tbody",{children:D.map((ge,Se)=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-500 text-xs",children:Se+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[ge.avatar?s.jsx("img",{src:ge.avatar,alt:"",className:"w-7 h-7 rounded-full object-cover"}):s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-700 flex items-center justify-center text-xs text-gray-400",children:"?"}),s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left text-sm truncate max-w-[160px]",onClick:()=>t(`/users?search=${encodeURIComponent(ge.nickname||ge.userId)}`),title:"点击跳转用户管理",children:ge.nickname||ge.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:ge.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:ge.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:ge.uniqueClicks>0?(ge.clicks/ge.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof ge.leadCount=="number"?ge.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:ge.phone||"-"})]},ge.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(rc,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无超级个体点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序首页的超级个体被用户点击后,数据将展示在此"})]})})]}),s.jsx(I0,{open:z,onClose:()=>{V(!1),q(null)},userId:O,onUserUpdated:()=>Rt()})]})}const ds=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Ut("w-full caption-bottom text-sm",t),...e})}));ds.displayName="Table";const us=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ut("[&_tr]:border-b",t),...e}));us.displayName="TableHeader";const hs=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ut("[&_tr:last-child]:border-0",t),...e}));hs.displayName="TableBody";const ct=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Ut("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ct.displayName="TableRow";const je=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Ut("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableHead";const be=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ut("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));be.displayName="TableCell";function ef(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function qs({page:t,totalPages:e,total:n,pageSize:r,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),i&&s.jsx("select",{value:r,onChange:c=>i(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>a(1),disabled:t<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),s.jsx("button",{type:"button",onClick:()=>a(t-1),disabled:t<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>a(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),s.jsx("button",{type:"button",onClick:()=>a(e),disabled:t>=e,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function UP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[x,y]=b.useState(10),[N,w]=b.useState(""),j=ef(N,300),[S,E]=b.useState("all"),[T,P]=b.useState(!0),[O,q]=b.useState(null),[z,V]=b.useState(null),[I,te]=b.useState(""),[Q,F]=b.useState(!1);async function re(){P(!0),q(null);try{const G=S==="all"?"":S==="completed"?"completed":S,_=new URLSearchParams({page:String(f),pageSize:String(x),...G&&{status:G},...j&&{search:j}}),[U,H]=await Promise.all([Pe(`/api/admin/orders?${_}`),Pe("/api/db/users?page=1&pageSize=500")]);U!=null&&U.success&&(e(U.orders||[]),i(U.total??0),c(U.totalRevenue??0),h(U.todayRevenue??0)),H!=null&&H.success&&H.users&&r(H.users)}catch(G){console.error("加载订单失败",G),q("加载订单失败,请检查网络后重试")}finally{P(!1)}}b.useEffect(()=>{m(1)},[j,S]),b.useEffect(()=>{re()},[f,x,j,S]);const ie=G=>{var _;return G.userNickname||((_=n.find(U=>U.id===G.userId))==null?void 0:_.nickname)||"匿名用户"},J=G=>{var _;return((_=n.find(U=>U.id===G))==null?void 0:_.phone)||"-"},$=G=>{const _=G.productType||G.type||"",U=G.description||"";if(_==="balance_recharge")return{name:`余额充值 ¥${Number(G.amount||0).toFixed(2)}`,type:"余额充值"};if(U){if(_==="section"&&(U.includes("章节")||U.includes("代付领取"))){if(U.includes("代付领取"))return{name:U.replace("代付领取 - ",""),type:"代付领取"};if(U.includes("-")){const H=U.split("-");if(H.length>=3)return{name:`第${H[1]}章 第${H[2]}节`,type:"《一场Soul的创业实验》"}}return{name:U,type:"章节购买"}}return _==="fullbook"||U.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:_==="vip"||U.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:_==="match"||U.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:U,type:"其他"}}return _==="section"?{name:`章节 ${G.productId||G.sectionId||""}`,type:"单章"}:_==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:_==="vip"?{name:"超级个体开通费用",type:"超级个体"}:_==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:_||"其他"}},D=Math.ceil(a/x)||1;async function R(){var G;if(!(!(z!=null&&z.orderSn)&&!(z!=null&&z.id))){F(!0),q(null);try{const _=await Gt("/api/admin/orders/refund",{orderSn:z.orderSn||z.id,reason:I||void 0});_!=null&&_.success?(V(null),te(""),re()):q((_==null?void 0:_.error)||"退款失败")}catch(_){const U=_;q(((G=U==null?void 0:U.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{F(!1)}}}function oe(){if(t.length===0){se.info("暂无数据可导出");return}const G=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],_=t.map(Y=>{const le=$(Y);return[Y.orderSn||Y.id||"",ie(Y),J(Y.userId),le.name,Number(Y.amount||0).toFixed(2),Y.paymentMethod==="wechat"?"微信支付":Y.paymentMethod==="balance"?"余额支付":Y.paymentMethod==="alipay"?"支付宝":Y.paymentMethod||"微信支付",Y.status==="refunded"?"已退款":Y.status==="paid"||Y.status==="completed"?"已完成":Y.status==="pending"||Y.status==="created"?"待支付":"已失败",Y.status==="refunded"&&Y.refundReason?Y.refundReason:"-",Y.referrerEarnings?Number(Y.referrerEarnings).toFixed(2):"-",Y.createdAt?new Date(Y.createdAt).toLocaleString("zh-CN"):""].join(",")}),U="\uFEFF"+[G.join(","),..._].join(`
-`),H=new Blob([U],{type:"text/csv;charset=utf-8"}),K=URL.createObjectURL(H),me=document.createElement("a");me.href=K,me.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,me.click(),URL.revokeObjectURL(K)}return s.jsxs("div",{className:"p-8 w-full",children:[O&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:O}),s.jsx("button",{type:"button",onClick:()=>q(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(X,{variant:"outline",onClick:re,disabled:T,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${T?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:N,onChange:G=>w(G.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ej,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:S,onChange:G=>E(G.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(X,{variant:"outline",onClick:oe,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(T5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:T?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"订单号"}),s.jsx(je,{className:"text-gray-400",children:"用户"}),s.jsx(je,{className:"text-gray-400",children:"商品"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"支付方式"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"退款原因"}),s.jsx(je,{className:"text-gray-400",children:"分销佣金"}),s.jsx(je,{className:"text-gray-400",children:"下单时间"}),s.jsx(je,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(hs,{children:[t.map(G=>{const _=$(G);return s.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(be,{className:"font-mono text-xs text-gray-400",children:[(G.orderSn||G.id||"").slice(0,12),"..."]}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[ie(G),G.paymentMethod==="gift_pay"&&s.jsx(Ve,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),G.payerUserId&&G.paymentMethod!=="gift_pay"&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:J(G.userId)}),G.payerUserId&&G.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[G.paymentMethod==="gift_pay"?"赠送人:":"代付人:",G.payerNickname]})]})}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[_.name,(G.productType||G.type)==="vip"&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:_.type})]})}),s.jsxs(be,{className:"text-[#38bdac] font-bold",children:["¥",Number(G.amount||0).toFixed(2)]}),s.jsx(be,{className:"text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="balance"?"余额支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[G.status==="refunded"?s.jsx(Ve,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):G.status==="paid"||G.status==="completed"?s.jsx(Ve,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ve,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ve,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(G.status==="paid"||G.status==="completed")&&(G.webhookPushStatus==="sent"?s.jsx(Ve,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(Ve,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(be,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx(be,{className:"text-[#FFD700]",children:G.referrerEarnings?`¥${Number(G.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(be,{className:"text-gray-400 text-sm",children:new Date(G.createdAt).toLocaleString("zh-CN")}),s.jsx(be,{children:(G.status==="paid"||G.status==="completed")&&G.paymentMethod!=="balance"&&s.jsxs(X,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{V(G),te("")},children:[s.jsx(Ij,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)}),t.length===0&&s.jsx(ct,{children:s.jsx(be,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(qs,{page:f,totalPages:D,total:a,pageSize:x,onPageChange:m,onPageSizeChange:G=>{y(G),m(1)}})]})})}),s.jsx(Dt,{open:!!z,onOpenChange:G=>!G&&V(null),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"订单退款"})}),z&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",z.orderSn||z.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(z.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:I,onChange:G=>te(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(X,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>V(null),disabled:Q,children:"取消"}),s.jsx(X,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:R,disabled:Q,children:Q?"退款中...":"确认退款"})]})]})})]})}const hl=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Ut("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));hl.displayName="Textarea";const P1=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],Xk={INTJ:{title:"战略家",group:"NT",mood:"sharp"},INTP:{title:"逻辑学家",group:"NT",mood:"calm"},ENTJ:{title:"指挥官",group:"NT",mood:"sharp"},ENTP:{title:"辩论家",group:"NT",mood:"playful"},INFJ:{title:"提倡者",group:"NF",mood:"warm"},INFP:{title:"调停者",group:"NF",mood:"warm"},ENFJ:{title:"主人公",group:"NF",mood:"warm"},ENFP:{title:"竞选者",group:"NF",mood:"playful"},ISTJ:{title:"物流师",group:"SJ",mood:"calm"},ISFJ:{title:"守卫者",group:"SJ",mood:"warm"},ESTJ:{title:"总经理",group:"SJ",mood:"sharp"},ESFJ:{title:"执政官",group:"SJ",mood:"warm"},ISTP:{title:"鉴赏家",group:"SP",mood:"sharp"},ISFP:{title:"探险家",group:"SP",mood:"playful"},ESTP:{title:"企业家",group:"SP",mood:"playful"},ESFP:{title:"表演者",group:"SP",mood:"playful"}};function WP(t){switch(t){case"NT":return{bg:"#0d1424",body:"#c89a2c",accent:"#ffd66b",hair:"#6d540f",line:"#111827"};case"NF":return{bg:"#0a1721",body:"#2e9f7c",accent:"#84e9c9",hair:"#2d6a4f",line:"#11212a"};case"SJ":return{bg:"#101828",body:"#4f8cb8",accent:"#9bd4ff",hair:"#2e4a66",line:"#111f2d"};case"SP":return{bg:"#161225",body:"#8b6bc0",accent:"#ccb3ff",hair:"#574183",line:"#211832"};default:return{bg:"#0e1422",body:"#38bdac",accent:"#7ee7db",hair:"#1f6f66",line:"#10202d"}}}function KP(t){switch(t){case"sharp":return{eye:"M222 222 L242 220 M270 220 L290 222",brow:"M218 210 L244 202 M268 202 L294 210",mouth:"M234 256 Q256 246 278 256",tilt:-5};case"warm":return{eye:"M222 224 Q232 230 242 224 M270 224 Q280 230 290 224",brow:"M220 210 Q232 206 244 210 M268 210 Q280 206 292 210",mouth:"M232 254 Q256 272 280 254",tilt:2};case"playful":return{eye:"M222 224 Q232 236 242 224 M270 224 Q280 236 290 224",brow:"M220 210 Q234 200 246 208 M266 208 Q278 200 292 210",mouth:"M232 256 Q256 266 280 250",tilt:8};default:return{eye:"M222 224 Q232 220 242 224 M270 224 Q280 220 290 224",brow:"M220 210 Q232 208 244 210 M268 210 Q280 208 292 210",mouth:"M236 256 Q256 260 276 256",tilt:0}}}function qP(t){switch(t){case"sharp":return"M168 370 L206 300 L256 332 L306 300 L344 370 L306 392 L256 374 L206 392 Z";case"warm":return"M166 368 Q188 318 226 314 L256 340 L286 314 Q324 318 346 368 L314 392 Q286 404 256 396 Q226 404 198 392 Z";case"playful":return"M164 370 L198 304 L252 332 L318 300 L350 374 L316 394 L258 378 L196 396 Z";default:return"M166 370 L202 306 L256 336 L310 306 L346 370 L310 392 L256 380 L202 392 Z"}}function O1(t){const e=Xk[t],n=WP(e.group),r=KP(e.mood),a=qP(e.mood),i=`
+For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},iP="DialogDescriptionWarning",oP=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jk(iP).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},lP=dk,cP=fk,dP=pk,uP=mk,hP=gk,fP=bk,pP=Nk;function Dt(t){return s.jsx(lP,{"data-slot":"dialog",...t})}function mP(t){return s.jsx(cP,{...t})}const kk=b.forwardRef(({className:t,...e},n)=>s.jsx(dP,{ref:n,className:Ut("fixed inset-0 z-50 bg-black/50",t),...e}));kk.displayName="DialogOverlay";const Lt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(mP,{children:[s.jsx(kk,{}),s.jsxs(uP,{ref:a,"aria-describedby":void 0,className:Ut("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg",t),...r,children:[e,n&&s.jsxs(pP,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Yn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Lt.displayName="DialogContent";function _t({className:t,...e}){return s.jsx("div",{className:Ut("flex flex-col gap-2 text-center sm:text-left",t),...e})}function fn({className:t,...e}){return s.jsx("div",{className:Ut("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function zt(t){return s.jsx(hP,{className:"text-lg font-semibold leading-none",...t})}function Zh(t){return s.jsx(fP,{className:"text-sm text-muted-foreground",...t})}const xP=_j("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ve({className:t,variant:e,asChild:n=!1,...r}){const a=n?Oj:"span";return s.jsx(a,{className:Ut(xP({variant:e}),t),...r})}var gP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yP=gP.reduce((t,e)=>{const n=Pj(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),bP="Label",Sk=b.forwardRef((t,e)=>s.jsx(yP.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Sk.displayName=bP;var Ck=Sk;const ee=b.forwardRef(({className:t,...e},n)=>s.jsx(Ck,{ref:n,className:Ut("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ee.displayName=Ck.displayName;function T0(t){const e=t+"CollectionProvider",[n,r]=No(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:j,children:S}=w,E=As.useRef(null),T=As.useRef(new Map).current;return s.jsx(a,{scope:j,itemMap:T,collectionRef:E,children:S})};o.displayName=e;const c=t+"CollectionSlot",u=Ud(c),h=As.forwardRef((w,j)=>{const{scope:S,children:E}=w,T=i(c,S),P=Ht(j,T.collectionRef);return s.jsx(u,{ref:P,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",x=Ud(f),y=As.forwardRef((w,j)=>{const{scope:S,children:E,...T}=w,P=As.useRef(null),O=Ht(j,P),q=i(f,S);return As.useEffect(()=>(q.itemMap.set(P,{ref:P,...T}),()=>void q.itemMap.delete(P))),s.jsx(x,{[m]:"",ref:O,children:E})});y.displayName=f;function N(w){const j=i(t+"CollectionConsumer",w);return As.useCallback(()=>{const E=j.collectionRef.current;if(!E)return[];const T=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(j.itemMap.values()).sort((q,z)=>T.indexOf(q.ref.current)-T.indexOf(z.ref.current))},[j.collectionRef,j.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},N,r]}var vP=b.createContext(void 0);function sp(t){const e=b.useContext(vP);return t||e||"ltr"}var gx="rovingFocusGroup.onEntryFocus",NP={bubbles:!1,cancelable:!0},lu="RovingFocusGroup",[mg,Tk,wP]=T0(lu),[jP,Ek]=No(lu,[wP]),[kP,SP]=jP(lu),Mk=b.forwardRef((t,e)=>s.jsx(mg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(mg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(CP,{...t,ref:e})})}));Mk.displayName=lu;var CP=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,x=b.useRef(null),y=Ht(e,x),N=sp(i),[w,j]=cl({prop:o,defaultProp:c??null,onChange:u,caller:lu}),[S,E]=b.useState(!1),T=po(h),P=Tk(n),O=b.useRef(!1),[q,z]=b.useState(0);return b.useEffect(()=>{const V=x.current;if(V)return V.addEventListener(gx,T),()=>V.removeEventListener(gx,T)},[T]),s.jsx(kP,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(V=>j(V),[j]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>z(V=>V+1),[]),onFocusableItemRemove:b.useCallback(()=>z(V=>V-1),[]),children:s.jsx(bt.div,{tabIndex:S||q===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:mt(t.onMouseDown,()=>{O.current=!0}),onFocus:mt(t.onFocus,V=>{const I=!O.current;if(V.target===V.currentTarget&&I&&!S){const te=new CustomEvent(gx,NP);if(V.currentTarget.dispatchEvent(te),!te.defaultPrevented){const Q=P().filter($=>$.focusable),F=Q.find($=>$.active),re=Q.find($=>$.id===w),J=[F,re,...Q].filter(Boolean).map($=>$.ref.current);Rk(J,f)}}O.current=!1}),onBlur:mt(t.onBlur,()=>E(!1))})})}),Ak="RovingFocusGroupItem",Ik=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=oo(),h=i||u,f=SP(Ak,n),m=f.currentTabStopId===h,x=Tk(n),{onFocusableItemAdd:y,onFocusableItemRemove:N,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return y(),()=>N()},[r,y,N]),s.jsx(mg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(bt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:mt(t.onMouseDown,j=>{r?f.onItemFocus(h):j.preventDefault()}),onFocus:mt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:mt(t.onKeyDown,j=>{if(j.key==="Tab"&&j.shiftKey){f.onItemShiftTab();return}if(j.target!==j.currentTarget)return;const S=MP(j,f.orientation,f.dir);if(S!==void 0){if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)return;j.preventDefault();let T=x().filter(P=>P.focusable).map(P=>P.ref.current);if(S==="last")T.reverse();else if(S==="prev"||S==="next"){S==="prev"&&T.reverse();const P=T.indexOf(j.currentTarget);T=f.loop?AP(T,P+1):T.slice(P+1)}setTimeout(()=>Rk(T))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});Ik.displayName=Ak;var TP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function EP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function MP(t,e,n){const r=EP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return TP[r]}function Rk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function AP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var IP=Mk,RP=Ik,rp="Tabs",[PP]=No(rp,[Ek]),Pk=Ek(),[OP,E0]=PP(rp),Ok=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=sp(c),[m,x]=cl({prop:r,onChange:a,defaultProp:i??"",caller:rp});return s.jsx(OP,{scope:n,baseId:oo(),value:m,onValueChange:x,orientation:o,dir:f,activationMode:u,children:s.jsx(bt.div,{dir:f,"data-orientation":o,...h,ref:e})})});Ok.displayName=rp;var Lk="TabsList",Dk=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=E0(Lk,n),o=Pk(n);return s.jsx(IP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(bt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});Dk.displayName=Lk;var _k="TabsTrigger",zk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=E0(_k,n),c=Pk(n),u=Bk(o.baseId,r),h=Vk(o.baseId,r),f=r===o.value;return s.jsx(RP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(bt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:mt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:mt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:mt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});zk.displayName=_k;var $k="TabsContent",Fk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=E0($k,n),u=Bk(c.baseId,r),h=Vk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const x=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(x)},[]),s.jsx(ou,{present:a||f,children:({present:x})=>s.jsx(bt.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!x,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:x&&i})})});Fk.displayName=$k;function Bk(t,e){return`${t}-trigger-${e}`}function Vk(t,e){return`${t}-content-${e}`}var LP=Ok,Hk=Dk,Uk=zk,Wk=Fk;const jc=LP,ul=b.forwardRef(({className:t,...e},n)=>s.jsx(Hk,{ref:n,className:Ut("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ul.displayName=Hk.displayName;const Qt=b.forwardRef(({className:t,...e},n)=>s.jsx(Uk,{ref:n,className:Ut("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 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",t),...e}));Qt.displayName=Uk.displayName;const Yt=b.forwardRef(({className:t,...e},n)=>s.jsx(Wk,{ref:n,className:Ut("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Yt.displayName=Wk.displayName;function M0(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function A0(t){const[e,n]=b.useState(void 0);return Ns(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var ap="Switch",[DP]=No(ap),[_P,zP]=DP(ap),Kk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[x,y]=b.useState(null),N=Ht(e,T=>y(T)),w=b.useRef(!1),j=x?f||!!x.closest("form"):!0,[S,E]=cl({prop:a,defaultProp:i??!1,onChange:h,caller:ap});return s.jsxs(_P,{scope:n,checked:S,disabled:c,children:[s.jsx(bt.button,{type:"button",role:"switch","aria-checked":S,"aria-required":o,"data-state":Qk(S),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:mt(t.onClick,T=>{E(P=>!P),j&&(w.current=T.isPropagationStopped(),w.current||T.stopPropagation())})}),j&&s.jsx(Jk,{control:x,bubbles:!w.current,name:r,value:u,checked:S,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});Kk.displayName=ap;var qk="SwitchThumb",Gk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=zP(qk,n);return s.jsx(bt.span,{"data-state":Qk(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});Gk.displayName=qk;var $P="SwitchBubbleInput",Jk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=Ht(o,i),u=M0(n),h=A0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const N=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(N)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Jk.displayName=$P;function Qk(t){return t?"checked":"unchecked"}var Yk=Kk,FP=Gk;const $t=b.forwardRef(({className:t,...e},n)=>s.jsx(Yk,{className:Ut("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",t),...e,ref:n,children:s.jsx(FP,{className:Ut("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));$t.displayName=Yk.displayName;const BP={view_chapter:"浏览章节",purchase:"购买",match:"派对匹配",login:"登录",register:"注册",share:"分享",bind_phone:"绑定手机",bind_wechat:"绑定微信",fill_profile:"完善资料",fill_avatar:"设置头像",visit_page:"访问页面",first_pay:"首次付款",vip_activate:"开通会员",click_super:"点击超级个体",lead_submit:"提交留资",withdraw:"申请提现",referral_bind:"绑定推荐人",card_click:"点击名片",btn_click:"按钮点击",tab_click:"切换标签",nav_click:"导航点击",page_view:"页面浏览",search:"搜索"};function VP(t){return BP[t]||t||"行为"}function HP(t,e){const n=new Set,r=a=>(t[a]??0)>0;return(r("purchase")||r("first_pay")||r("vip_activate"))&&n.add("已付费"),(r("lead_submit")||r("click_super"))&&n.add("高意向"),r("view_chapter")&&n.add("想学习"),r("match")&&n.add("找合伙人"),r("withdraw")&&n.add("有提现行为"),r("referral_bind")&&n.add("推广参与"),(r("fill_profile")||r("fill_avatar")||r("bind_phone"))&&n.add("资料完善中"),e!=null&&e.hasFullBook&&n.add("全书读者"),e!=null&&e.isVip&&n.add("VIP会员"),e!=null&&e.mbti&&/^[EI][NS][FT][JP]$/i.test(e.mbti)&&n.add(String(e.mbti).toUpperCase()),Array.from(n)}function I0({open:t,onClose:e,userId:n,onUserUpdated:r}){var Ea,Ys,Ss,Xs,ur,Cs;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState({}),[f,m]=b.useState([]),[x,y]=b.useState(null),[N,w]=b.useState(null),[j,S]=b.useState(!1),[E,T]=b.useState(!1),[P,O]=b.useState(!1),[q,z]=b.useState("info"),[V,I]=b.useState(""),[te,Q]=b.useState(""),[F,re]=b.useState(""),[ie,J]=b.useState([]),[$,D]=b.useState(""),[R,oe]=b.useState(""),[G,_]=b.useState(""),[U,H]=b.useState(!1),[K,me]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[Y,le]=b.useState([]),[de,ve]=b.useState(!1),[ye,ke]=b.useState(""),[ze,ft]=b.useState(""),[wt,dt]=b.useState(!1),[Rt,Tt]=b.useState(!1),[Tn,mn]=b.useState(null),[Ft,qt]=b.useState(null),[vn,On]=b.useState(""),[$n,St]=b.useState(""),[cn,xn]=b.useState(""),[ge,Se]=b.useState(!1),[$e,Xe]=b.useState(null),[jt,gt]=b.useState(!1),[L,Me]=b.useState({}),[pt,Et]=b.useState([]);b.useEffect(()=>{t&&n&&(gt(!1),z("info"),mn(null),qt(null),Xe(null),oe(""),_(""),tt(),Pe("/api/db/vip-roles").then(ae=>{ae!=null&&ae.success&&ae.data&&le(ae.data)}).catch(()=>{}))},[t,n]),b.useEffect(()=>{t&&Pe("/api/admin/mbti-avatars").then(ae=>{ae!=null&&ae.avatars&&typeof ae.avatars=="object"?Me(ae.avatars):Me({})}).catch(()=>Me({}))},[t]);const ht=(ae,xe)=>{const Ue=(ae||"").trim();if(Ue)return fo(Ue);const ut=(xe||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(ut)?(L[ut]||"").trim():""};async function tt(){if(n){S(!0);try{const ae=await Pe(`/api/db/users?id=${encodeURIComponent(n)}`);if(ae!=null&&ae.success&&ae.user){const xe=ae.user;i(xe),I(xe.phone||""),Q(xe.wechatId||""),re(xe.nickname||""),On(xe.phone||""),St(xe.wechatId||""),xn(xe.openId||"");try{J(typeof xe.tags=="string"?JSON.parse(xe.tags||"[]"):[])}catch{J([])}me({isVip:!!(xe.isVip??!1),vipExpireDate:xe.vipExpireDate?String(xe.vipExpireDate).slice(0,10):"",vipRole:String(xe.vipRole??""),vipName:String(xe.vipName??""),vipProject:String(xe.vipProject??""),vipContact:String(xe.vipContact??""),vipBio:String(xe.vipBio??"")})}try{const xe=await Pe(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=100`);if(xe!=null&&xe.success){h(xe.stats&&typeof xe.stats=="object"?xe.stats:{});const Ue=xe.tracks||[];c(Ue.map(ut=>({...ut,actionLabel:ut.actionLabel||ut.action,timeAgo:ut.timeAgo||""})))}else h({}),c([])}catch{h({}),c([])}try{const xe=await Pe(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);xe!=null&&xe.success?(m(xe.referrals||[]),y(xe.inboundSource||null)):(m([]),y(null))}catch{m([]),y(null)}try{const xe=await Pe(`/api/admin/users/${encodeURIComponent(n)}/balance`);xe!=null&&xe.success&&xe.data?w(xe.data):w(null)}catch{w(null)}try{const xe=await Pe(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);xe!=null&&xe.success&&xe.orders?Et(xe.orders):Et([])}catch{Et([])}}catch(ae){console.error("Load user detail error:",ae)}finally{S(!1)}}}async function Pt(){if(!(a!=null&&a.phone)){se.info("用户未绑定手机号,无法同步");return}T(!0);try{const ae=await Ct("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});ae!=null&&ae.success?(se.success("同步成功"),tt()):se.error("同步失败: "+(ae==null?void 0:ae.error))}catch(ae){console.error("Sync CKB error:",ae),se.error("同步失败")}finally{T(!1)}}async function Wt(){if(a){if(K.isVip&&!K.vipExpireDate.trim()){se.error("开启 VIP 请填写有效到期日");return}O(!0);try{const ae={id:a.id,phone:V.trim()||void 0,wechatId:te.trim(),nickname:F||void 0,tags:JSON.stringify(ie),isVip:K.isVip,vipExpireDate:K.isVip?K.vipExpireDate:void 0,vipRole:K.vipRole||void 0,vipName:K.vipName||void 0,vipProject:K.vipProject||void 0,vipContact:K.vipContact||void 0,vipBio:K.vipBio||void 0},xe=await Gt("/api/db/users",ae);xe!=null&&xe.success?(se.success("保存成功"),tt(),r==null||r()):se.error("保存失败: "+(xe==null?void 0:xe.error))}catch(ae){console.error("Save user error:",ae),se.error("保存失败")}finally{O(!1)}}}const en=()=>{$&&!ie.includes($)&&(J([...ie,$]),D(""))},ts=ae=>J(ie.filter(xe=>xe!==ae));async function Qs(){if(a){if(!R){se.error("请输入新密码");return}if(R!==G){se.error("两次密码不一致");return}if(R.length<6){se.error("密码至少 6 位");return}H(!0);try{const ae=await Gt("/api/db/users",{id:a.id,password:R});ae!=null&&ae.success?(se.success("修改成功"),oe(""),_("")):se.error("修改失败: "+((ae==null?void 0:ae.error)||""))}catch{se.error("修改失败")}finally{H(!1)}}}async function bi(){if(!a)return;const ae=parseFloat(ye);if(Number.isNaN(ae)||ae===0){se.error("请输入有效金额(正数增加、负数扣减)");return}dt(!0);try{const xe=await Ct(`/api/admin/users/${a.id}/balance/adjust`,{amount:ae,remark:ze||void 0});xe!=null&&xe.success?(se.success("余额已调整"),ve(!1),ke(""),ft(""),tt(),r==null||r()):se.error("调整失败: "+((xe==null?void 0:xe.error)||""))}catch{se.error("调整失败")}finally{dt(!1)}}async function ea(){if(!vn&&!cn&&!$n){qt("请至少输入手机号、微信号或 OpenID 中的一项");return}Tt(!0),qt(null),mn(null);try{const ae=new URLSearchParams;vn&&ae.set("phone",vn),cn&&ae.set("openId",cn),$n&&ae.set("wechatId",$n);const xe=await Pe(`/api/admin/shensheshou/query?${ae}`);xe!=null&&xe.success&&xe.data?(mn(xe.data),a&&await ta(xe.data)):qt((xe==null?void 0:xe.error)||"未查询到数据,该用户可能未在神射手收录")}catch(ae){console.error("SSS query error:",ae),qt("请求失败,请检查神射手接口配置")}finally{Tt(!1)}}async function ta(ae){if(a)try{await Ct("/api/admin/shensheshou/enrich",{userId:a.id,phone:vn||a.phone||"",openId:cn||a.openId||"",wechatId:$n||a.wechatId||""}),tt()}catch(xe){console.error("SSS enrich error:",xe)}}async function Er(){if(a){Se(!0),Xe(null);try{const ae=Array.from(new Set(o.filter(Ps=>Ps.action==="view_chapter"||Ps.action==="purchase"||Ps.action==="first_pay").map(Ps=>(Ps.chapterTitle||Ps.target||"").trim()).filter(Boolean))).slice(0,12),xe={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Ue=ae.length>0?`意向章节:${ae.join("、")}`:"",ut={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:ie,purchaseIntent:xe,purchaseIntentChapters:ae,remark:Ue}]},Fn=await Ct("/api/admin/shensheshou/ingest",ut);Fn!=null&&Fn.success&&Fn.data?Xe(Fn.data):Xe({error:(Fn==null?void 0:Fn.error)||"推送失败"})}catch(ae){console.error("SSS ingest error:",ae),Xe({error:"请求失败"})}finally{Se(!1)}}}const Mr=ae=>{const Ue={view_chapter:Gs,purchase:Md,match:In,login:oi,register:oi,share:ya,bind_phone:d1,bind_wechat:wM,fill_profile:Ad,fill_avatar:oi,visit_page:qr,first_pay:Md,vip_activate:pc,click_super:In,lead_submit:d1,withdraw:cg,referral_bind:ya,card_click:oi,btn_click:pi,tab_click:qr,nav_click:qr,page_view:qr,search:qr}[ae]||ig;return s.jsx(Ue,{className:"w-4 h-4"})};function Ar(ae){const xe=String(ae||"").trim();return xe.length>22&&/^[a-zA-Z0-9_-]+$/.test(xe)}const cr=b.useMemo(()=>HP(u,a),[u,a]);function dr(){const ae=[...ie];for(const xe of cr)ae.includes(xe)||ae.push(xe);J(ae),se.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Dt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[92vh] overflow-hidden flex flex-col p-4 sm:p-5",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(oi,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),j?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2.5 p-2.5 bg-[#0a1628] rounded-lg mb-2 shrink-0",children:[s.jsxs("div",{className:"flex gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:"w-11 h-11 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-lg text-[#38bdac] shrink-0",children:ht(a.avatar,a.mbti)&&!jt?s.jsx("img",{src:ht(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>gt(!0)}):((Ea=a.nickname)==null?void 0:Ea.charAt(0))||"?"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h3",{className:"text-base font-bold text-white leading-tight",children:a.nickname}),a.isAdmin&&s.jsx(Ve,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0",children:a.vipRole})]}),a.referralCode&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:["推荐码 ",s.jsx("code",{className:"text-[#38bdac]",children:a.referralCode})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"昵称"}),s.jsx("p",{className:"text-white truncate",children:F||a.nickname||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"手机号"}),s.jsx("p",{className:"text-white truncate",children:V||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"微信标识"}),s.jsx("p",{className:"text-white truncate",children:te||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"画像"}),s.jsx("p",{className:"text-[#38bdac] truncate",children:[a.region,a.industry,a.position,a.mbti?`MBTI ${a.mbti}`:""].filter(Boolean).join(" · ")||"未完善"})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 gap-1.5 shrink-0 sm:w-[220px]",children:[s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500 uppercase tracking-wide",children:"累计佣金"}),s.jsxs("p",{className:"text-sm font-bold text-[#38bdac] leading-tight",children:["¥",(a.earnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"推广/分佣入账"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"待提现"}),s.jsxs("p",{className:"text-sm font-bold text-yellow-400 leading-tight",children:["¥",(a.pendingEarnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"未打款部分"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsxs("div",{className:"flex items-center justify-between gap-1",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"账户余额"}),s.jsx(X,{type:"button",size:"sm",variant:"ghost",className:"h-5 px-1 text-[9px] text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>{ke(""),ft(""),ve(!0)},children:"调整"})]}),s.jsxs("p",{className:"text-sm font-bold text-white leading-tight",children:["¥",((N==null?void 0:N.balance)??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"可消费/抵扣"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"推荐人数"}),s.jsx("p",{className:"text-sm font-bold text-white leading-tight",children:a.referralCount??0}),s.jsx("p",{className:"text-[9px] text-gray-600",children:a.createdAt?`注册 ${new Date(a.createdAt).toLocaleDateString()}`:"—"})]})]})]}),s.jsxs(jc,{value:q,onValueChange:z,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(ul,{className:"bg-[#0a1628] border border-gray-700/50 p-0.5 mb-2 flex-wrap h-auto gap-0.5 shrink-0",children:[s.jsx(Qt,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"用户信息"}),s.jsxs(Qt,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:[s.jsx(qr,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(Qt,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"关系链路"}),s.jsx(Qt,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"标签体系"})]}),s.jsxs(Yt,{value:"info",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[s.jsxs("details",{className:"rounded-lg bg-[#0a1628] border border-gray-700/40 p-2 text-[11px] group",children:[s.jsxs("summary",{className:"cursor-pointer text-gray-400 select-none list-none flex items-center gap-1",children:[s.jsx("span",{className:"group-open:text-[#38bdac]",children:"技术标识"}),s.jsx("span",{className:"text-gray-600",children:"(用户ID / OpenID,默认折叠)"})]}),s.jsxs("div",{className:"mt-2 space-y-1.5 text-gray-300 font-mono text-[10px] break-all border-t border-gray-700/30 pt-2",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"用户ID"})," ",a.id]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"OpenID"})," ",a.openId||"—"]}),s.jsx("p",{className:"text-gray-500 not-italic font-sans leading-snug",children:"OpenID 为微信用户标识;下方「微信标识」为微信号/wxid,供存客宝归属,与 OpenID 不同。"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:F,onChange:ae=>re(ae.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-[11px]",children:"手机号(可改,点底部保存生效)"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"11 位手机号",value:V,onChange:ae=>I(ae.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-[11px]",children:"微信标识(微信号/wxid,非 OpenID)"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"如 wxid_xxx 或自定义微信号",value:te,onChange:ae=>Q(ae.target.value)})]})]}),(a.region||a.industry||a.position||a.mbti)&&s.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px]",children:[a.region&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:[s.jsx(Aj,{className:"w-3 h-3 inline mr-0.5"}),a.region]}),a.industry&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["行业 ",a.industry]}),a.position&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["职位 ",a.position]}),a.mbti&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#38bdac]/15 text-[#38bdac]",children:["MBTI ",a.mbti]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-amber-500/25",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(pc,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"超级个体"}),a.isVip&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx($t,{className:"scale-90",checked:K.isVip,onCheckedChange:ae=>me(xe=>({...xe,isVip:ae}))})]}),K.isVip&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-1.5 mt-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"到期日"}),s.jsx(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",value:K.vipExpireDate,onChange:ae=>me(xe=>({...xe,vipExpireDate:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-1.5 h-7 text-xs",value:K.vipRole,onChange:ae=>me(xe=>({...xe,vipRole:ae.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),Y.map(ae=>s.jsx("option",{value:ae.name,children:ae.name},ae.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"展示名"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"展示名",value:K.vipName,onChange:ae=>me(xe=>({...xe,vipName:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"项目"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"项目",value:K.vipProject,onChange:ae=>me(xe=>({...xe,vipProject:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"联系方式"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"微信/手机",value:K.vipContact,onChange:ae=>me(xe=>({...xe,vipContact:ae.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"简介"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"简短介绍",value:K.vipBio,onChange:ae=>me(xe=>({...xe,vipBio:ae.target.value}))})]})]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-[#38bdac]/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(pi,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"外部资料 · 神射手 / 存客宝(与上方基础信息联动)"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-1.5 mb-1.5",children:[s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:手机",value:vn,onChange:ae=>On(ae.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:$n,onChange:ae=>St(ae.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:cn,onChange:ae=>xn(ae.target.value)})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsxs(X,{size:"sm",className:"h-7 text-[11px] px-2 bg-[#38bdac] hover:bg-[#2da396]",onClick:ea,disabled:Rt,children:[Rt?s.jsx(Fe,{className:"w-3 h-3 animate-spin"}):s.jsx(va,{className:"w-3 h-3 mr-0.5"}),"查询回填"]}),s.jsx(X,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2 border-purple-500/40 text-purple-300",onClick:Er,disabled:ge||!a.phone,children:ge?"推送…":"推神射手"}),s.jsx(X,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:Pt,disabled:E||!a.phone,children:E?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),Ft&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:Ft}),Tn&&s.jsxs("div",{className:"mt-1.5 grid grid-cols-2 gap-1.5",children:[s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"RFM"})," ",s.jsx("span",{className:"text-[#38bdac] font-semibold",children:Tn.rfm_score??"—"})]}),s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"等级"})," ",s.jsx("span",{className:"text-white font-semibold",children:Tn.user_level??"—"})]})]}),$e&&s.jsx("p",{className:"mt-1 text-[11px]",children:$e.error?s.jsx("span",{className:"text-red-400",children:String($e.error)}):s.jsx("span",{className:"text-green-400",children:"推送成功"})})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(cg,{className:"w-3.5 h-3.5 text-yellow-400"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-1.5 sm:items-center",children:[s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"新密码 ≥6 位",value:R,onChange:ae=>oe(ae.target.value)}),s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:G,onChange:ae=>_(ae.target.value)}),s.jsx(X,{size:"sm",className:"h-7 text-[11px] shrink-0 bg-yellow-500/20 text-yellow-300 border border-yellow-500/35 hover:bg-yellow-500/30",onClick:Qs,disabled:U||!R||!G,children:U?"保存中":"确认修改"})]})]})]}),s.jsxs(Yt,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[pt.length>0&&s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Md,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",pt.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:pt.map((ae,xe)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-amber-300",children:ae.productType==="fullbook"||ae.productType==="vip"?"全书/VIP":`章节 ${ae.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(ae.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ae.createdAt?new Date(ae.createdAt).toLocaleString("zh-CN"):""})]},ae.orderSn||xe))})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg flex flex-col gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",children:[s.jsx(qr,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsxs("span",{children:["全站埋点共 ",o.length," 条;用于 RFM 与「标签体系」旅程推断"]})]}),Object.keys(u).length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 pt-1 border-t border-gray-700/40",children:Object.entries(u).sort((ae,xe)=>xe[1]-ae[1]).map(([ae,xe])=>s.jsxs(Ve,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[VP(ae)," ×",xe]},ae))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((ae,xe)=>s.jsxs("div",{className:"flex items-start gap-2 p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Mr(ae.action)}),xe0?((x==null?void 0:x.visits)||[]).map((ae,xe)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"text-white truncate",children:["第 ",ae.seq||xe+1," 次 · ",ae.referrerNickname||"微信用户",ae.referrerId?`(${ae.referrerId})`:""]}),ae.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:ae.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ae.visitedAt?new Date(ae.visitedAt).toLocaleString():""})]},`${ae.referrerId||"unknown"}_${xe}`)):s.jsx("p",{className:"text-gray-500 text-sm text-center py-2",children:"暂无来源点击记录"})})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ya,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"推荐的用户"})]}),s.jsxs(Ve,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 text-[10px]",children:["共 ",f.length," 人"]})]}),s.jsx("div",{className:"space-y-1 max-h-[min(280px,40vh)] overflow-y-auto",children:f.length>0?f.map((ae,xe)=>{var ut;const Ue=ae;return s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[10px] text-[#38bdac] shrink-0",children:((ut=Ue.nickname)==null?void 0:ut.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Ue.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Ue.status==="vip"&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-[10px]",children:Ue.createdAt?new Date(Ue.createdAt).toLocaleDateString():""})]})]},Ue.id||xe)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(Yt,{value:"tags",className:"flex-1 min-h-0 overflow-y-auto space-y-3 pr-0.5",children:[s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[s.jsx(Ad,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-[11px]",children:"《一场 Soul 的创业实验》维度"})]}),s.jsxs("div",{className:"mb-2 p-2 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-start gap-2 text-[11px] text-gray-400",children:[s.jsx(jj,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0 mt-0.5"}),"预设可点选;下方「旅程推断」由轨迹+资料自动算出,可一键并入已选后点弹窗底部保存。"]}),s.jsxs("div",{className:"mb-3 p-2 rounded-lg bg-[#162840]/80 border border-cyan-500/20",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-1.5",children:[s.jsx("span",{className:"text-cyan-300/90 text-xs font-medium",children:"旅程推断标签"}),s.jsx(X,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-cyan-500/40 text-cyan-200 hover:bg-cyan-500/10",disabled:cr.length===0,onClick:dr,children:"合并到已选"})]}),cr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:cr.map(ae=>s.jsxs(Ve,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${ie.includes(ae)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[ie.includes(ae)?"✓ ":"",ae]},ae))}):s.jsx("p",{className:"text-[11px] text-gray-500",children:"暂无推断(无轨迹或行为未命中规则)"})]}),s.jsx("div",{className:"mb-3 space-y-2",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(ae=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:ae.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ae.tags.map(xe=>s.jsxs("button",{type:"button",onClick:()=>{ie.includes(xe)?ts(xe):J([...ie,xe])},className:`px-1.5 py-0.5 rounded text-[11px] border transition-all ${ie.includes(xe)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[ie.includes(xe)?"✓ ":"",xe]},xe))})]},ae.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-2",children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1.5",children:"已选标签(需保存修改写入库)"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:[ie.map((ae,xe)=>s.jsxs(Ve,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[ae,s.jsx("button",{type:"button",onClick:()=>ts(ae),className:"ml-1 hover:text-red-400",children:s.jsx(Yn,{className:"w-3 h-3"})})]},xe)),ie.length===0&&s.jsx("span",{className:"text-gray-600 text-xs",children:"暂未选择"})]}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1 h-8 text-xs",placeholder:"自定义标签,回车添加",value:$,onChange:ae=>D(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&en()}),s.jsx(X,{onClick:en,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const ae=a.tags||a.ckbTags||"";let xe=[];try{const ut=typeof ae=="string"?JSON.parse(ae||"[]"):[];xe=Array.isArray(ut)?ut:typeof ae=="string"?ae.split(","):[]}catch{xe=typeof ae=="string"?ae.split(","):[]}const Ue=xe.map(ut=>String(ut).trim()).filter(Boolean);return Ue.length===0?null:s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx(Ad,{className:"w-3.5 h-3.5 text-purple-400"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:Ue.map((ut,Fn)=>s.jsx(Ve,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:ut},Fn))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(X,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(X,{onClick:Wt,disabled:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),P?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Dt,{open:de,onOpenChange:ve,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx(zt,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:ye,onChange:ae=>ke(ae.target.value)})]}),s.jsxs("div",{children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:ze,onChange:ae=>ft(ae.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(X,{variant:"outline",onClick:()=>ve(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(X,{onClick:bi,disabled:wt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:wt?"提交中...":"确认调整"})]})]})})]}):null}function UP(){const t=Sa(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,x]=b.useState(0),[y,N]=b.useState(0),[w,j]=b.useState(0),[S,E]=b.useState(0),[T,P]=b.useState(null),[O,q]=b.useState(null),[z,V]=b.useState(!1),[I,te]=b.useState(0),[Q,F]=b.useState(!1),[re,ie]=b.useState(null),[J,$]=b.useState("overview"),[D,R]=b.useState([]),[oe,G]=b.useState(!1),[_,U]=b.useState("today"),[H,K]=b.useState(null),[me,Y]=b.useState(!1),[le,de]=b.useState(!0),[ve,ye]=b.useState(null),[ke,ze]=b.useState(null),[ft,wt]=b.useState([]),dt=ge=>{const Se=ge;if((Se==null?void 0:Se.status)===401)P("登录已过期,请重新登录");else{if((Se==null?void 0:Se.name)==="AbortError")return;P("加载失败,请检查网络或联系管理员")}};async function Rt(ge){var jt,gt;const Se=ge?{signal:ge}:void 0;n(!0),P(null);try{const L=await Pe("/api/admin/dashboard/stats",Se);L!=null&&L.success&&(x(L.totalUsers??0),N(L.paidOrderCount??0),j(L.totalRevenue??0),E(L.conversionRate??0))}catch(L){if((L==null?void 0:L.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",L);try{const Me=await Pe("/api/admin/dashboard/overview",Se);Me!=null&&Me.success&&(x(Me.totalUsers??0),N(Me.paidOrderCount??0),j(Me.totalRevenue??0),E(Me.conversionRate??0))}catch(Me){dt(Me)}}}finally{n(!1)}try{const L=await Pe("/api/admin/balance/summary",Se);L!=null&&L.success&&L.data&&te(L.data.totalGifted??0)}catch{}try{const L=await Pe("/api/db/ckb-plan-stats",Se);L!=null&&L.success&&L.data?ie({ckbTotal:L.data.ckbTotal??0,withContact:L.data.withContact??0}):ie(null)}catch{ie(null)}de(!0);try{const[L,Me]=await Promise.allSettled([Pe("/api/db/match-records?stats=true",Se),Pe("/api/admin/distribution/overview",Se)]);L.status==="fulfilled"&&((jt=L.value)!=null&&jt.success)&&L.value.data?ye({totalMatches:L.value.data.totalMatches??0,todayMatches:L.value.data.todayMatches??0,uniqueUsers:L.value.data.uniqueUsers??0,paidMatchCount:L.value.data.paidMatchCount??0}):ye(null),Me.status==="fulfilled"&&((gt=Me.value)!=null&>.success)&&Me.value.overview?ze({todayClicks:Me.value.overview.todayClicks??0,todayBindings:Me.value.overview.todayBindings??0,todayConversions:Me.value.overview.todayConversions??0,monthClicks:Me.value.overview.monthClicks??0,monthBindings:Me.value.overview.monthBindings??0,monthConversions:Me.value.overview.monthConversions??0,totalClicks:Me.value.overview.totalClicks??0,totalBindings:Me.value.overview.totalBindings??0,totalConversions:Me.value.overview.totalConversions??0,conversionRate:Me.value.overview.conversionRate}):ze(null)}catch{ye(null),ze(null)}finally{de(!1)}try{const L=await Pe("/api/db/vip-members?limit=500",Se);L!=null&&L.success&&Array.isArray(L.data)?wt(L.data):wt([])}catch{wt([])}a(!0),o(!0);const $e=async()=>{try{const L=await Pe("/api/admin/dashboard/recent-orders?limit=10",Se);if(L!=null&&L.success&&L.recentOrders)f(L.recentOrders);else throw new Error("no data")}catch(L){if((L==null?void 0:L.name)!=="AbortError")try{const Me=await Pe("/api/admin/orders?page=1&pageSize=20&status=paid",Se),Et=((Me==null?void 0:Me.orders)??[]).filter(ht=>["paid","completed","success"].includes(ht.status||""));f(Et.slice(0,5))}catch{f([])}}finally{a(!1)}},Xe=async()=>{try{const L=await Pe("/api/admin/dashboard/new-users",Se);if(L!=null&&L.success&&L.newUsers)u(L.newUsers);else throw new Error("no data")}catch(L){if((L==null?void 0:L.name)!=="AbortError")try{const Me=await Pe("/api/db/users?page=1&pageSize=10",Se);u((Me==null?void 0:Me.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([$e(),Xe()])}async function Tt(ge){const Se=ge||_;Y(!0);try{const $e=await Pe(`/api/admin/track/stats?period=${Se}`);$e!=null&&$e.success&&K({total:$e.total??0,byModule:$e.byModule??{}})}catch{K(null)}finally{Y(!1)}}const Tn={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},mn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},Ft=ge=>ge?ge.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",qt=ge=>{if(!ge)return"";const Se=ge.trim().toLowerCase();if(!Se)return"";const $e=ft.find(jt=>{const gt=String(jt.id||"").toLowerCase();return gt===Se||gt.includes(Se)||Se.includes(gt)});if($e)return $e.name||$e.nickname||"";const Xe=ft.find(jt=>{const gt=String(jt.token||"").toLowerCase();return gt&&(gt===Se||gt.includes(Se)||Se.includes(gt))});return Xe&&(Xe.name||Xe.nickname)||""},vn=ge=>{if(!ge)return"未命名点击";const Se=ge.trim(),$e=Se.toLowerCase();if(/^链接头像[_-]/.test(Se)){const jt=Ft(Se.replace(/^链接头像[_-]/,""));return jt?`头像:${jt}`:"头像点击"}if(/^member[_-]?detail$/i.test($e)||$e.includes("member detail"))return"成员详情";if(/^giftpay$/i.test($e)||$e.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test($e))return`章节:${Ft(Se)}`;if($e.includes("soulvip")||$e.includes("super")){const jt=Se.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),gt=qt(jt)||qt(Ft(jt));return gt?`超级个体:${gt}`:`超级个体:${Ft(jt)}`}if($e.includes("qgdtw")||$e.includes("token")||$e.includes("0000"))return`对象:${Ft(Se)}`;const Xe={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return Xe[Se]?Xe[Se]:/^[a-z0-9_-]+$/i.test(Se)&&Ft(Se)||Se},On=ge=>{const Se=Tn[ge.module]||Tn[ge.page]||ge.module||ge.page||"其他",$e=mn[ge.action]||ge.action||"点击",Xe=vn(ge.target);return`${Se} · ${$e} · ${Xe}`};async function $n(){G(!0);try{const ge=await Pe("/api/admin/super-individual/stats");ge!=null&&ge.success&&Array.isArray(ge.data)&&R(ge.data)}catch{}finally{G(!1)}}b.useEffect(()=>{const ge=new AbortController;return Rt(ge.signal),Tt(),$n(),()=>{ge.abort()}},[]);const St=m,cn=ge=>{const Se=ge.productType||"",$e=ge.description||"";if(Se==="balance_recharge")return{title:`余额充值 ¥${typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Se==="gift_pay")return{title:`代付 ¥${typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Se==="gift_pay_batch"){const Xe=typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2);return{title:$e||`代付分享 ¥${Xe}`,subtitle:"代付分享"}}if(Se==="section"&&$e.includes("代付领取"))return{title:$e.replace("代付领取 - ",""),subtitle:"代付领取"};if($e){if(Se==="section"&&$e.includes("章节")){if($e.includes("-")){const Xe=$e.split("-");if(Xe.length>=3)return{title:`第${Xe[1]}章 第${Xe[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:$e,subtitle:"章节购买"}}return Se==="fullbook"||$e.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Se==="vip"||$e.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Se==="match"||$e.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:$e,subtitle:Se==="section"?"单章":Se==="fullbook"?"全书":"其他"}}return Se==="section"?{title:`章节 ${ge.productId||""}`,subtitle:"单章购买"}:Se==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Se==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Se==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Se||"其他"}},xn=[{title:"总用户数",value:e?null:St,sub:null,icon:In,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:I>0?`含代付 ¥${I.toFixed(2)}`:null,icon:Gh,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:Md,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof S=="number"?S.toFixed(1):0}%`,sub:null,icon:Gs,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:re?re.ckbTotal??0:null,sub:(re==null?void 0:re.withContact)!=null?`含联系方式 ${re.withContact} 人`:null,icon:hc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:le?null:((ve==null?void 0:ve.totalMatches)??0)+((ke==null?void 0:ke.totalClicks)??0),sub:le?null:`找伙伴 ${(ve==null?void 0:ve.totalMatches)??0} / 推广 ${(ke==null?void 0:ke.totalClicks)??0}`,icon:rc,color:"text-emerald-400",bg:"bg-emerald-500/20",link:"/find-partner"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),T&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:T}),s.jsx("button",{type:"button",onClick:()=>Rt(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"flex flex-nowrap gap-6 mb-8 overflow-x-auto pb-1",children:xn.map((ge,Se)=>s.jsxs(Oe,{className:"min-w-[220px] flex-1 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>ge.link&&t(ge.link),children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(at,{className:"text-sm font-medium text-gray-400",children:ge.title}),s.jsx("div",{className:`p-2 rounded-lg ${ge.bg}`,children:s.jsx(ge.icon,{className:`w-4 h-4 ${ge.color}`})})]}),s.jsx(Le,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-8 flex items-center",children:ge.value!=null?ge.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Fe,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),ge.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:ge.sub})]}),s.jsx(Xo,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Se))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>$("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="overview"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"数据概览"}),s.jsx("button",{type:"button",onClick:()=>$("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="tags"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"用户标签点击统计"}),s.jsx("button",{type:"button",onClick:()=>$("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),J==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(at,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>Rt(),disabled:le,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 ${le?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(Le,{children:[le&&!ve&&!ke?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4",children:[s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.totalMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴今日"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.todayMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴用户数"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.uniqueUsers)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ke==null?void 0:ke.totalClicks)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ke==null?void 0:ke.totalBindings)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ke==null?void 0:ke.totalConversions)??0})]})]}),(ke==null?void 0:ke.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",ke.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsx(at,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>Rt(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(Fe,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Fe,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(Le,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,Q?10:4).map(ge=>{var gt;const Se=ge.referrerId?c.find(L=>L.id===ge.referrerId):void 0,$e=ge.referralCode||(Se==null?void 0:Se.referralCode)||(Se==null?void 0:Se.nickname)||(ge.referrerId?String(ge.referrerId).slice(0,8):""),Xe=cn(ge),jt=ge.userNickname||((gt=c.find(L=>L.id===ge.userId))==null?void 0:gt.nickname)||"匿名用户";return s.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[ge.userAvatar?s.jsx("img",{src:ge.userAvatar,alt:jt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:L=>{L.currentTarget.style.display="none";const Me=L.currentTarget.nextElementSibling;Me&&Me.classList.remove("hidden")}}):null,s.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] shrink-0 mt-0.5 ${ge.userAvatar?"hidden":""}`,children:jt.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{ge.userId&&(q(ge.userId),V(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:jt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:Xe.title,children:Xe.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[Xe.subtitle&&Xe.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:Xe.subtitle}),s.jsx("span",{children:new Date(ge.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),$e&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",$e]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(ge.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:ge.paymentMethod||"微信"})]})]},ge.id)}),h.length>4&&!Q&&s.jsx("button",{type:"button",onClick:()=>F(!0),className:"w-full py-2 text-sm text-[#38bdac] hover:text-[#2da396] border border-dashed border-gray-600 rounded-lg hover:border-[#38bdac]/50 transition-colors",children:"展开更多"}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Md,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(rt,{children:s.jsx(at,{className:"text-white",children:"新注册用户"})}),s.jsx(Le,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(ge=>{var Se;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((Se=ge.nickname)==null?void 0:Se.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{q(ge.id),V(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ge.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:ge.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:ge.createdAt?new Date(ge.createdAt).toLocaleDateString():"-"})]},ge.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),J==="tags"&&s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(at,{className:"text-white flex items-center gap-2",children:[s.jsx(rc,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(ge=>s.jsx("button",{type:"button",onClick:()=>{U(ge),Tt(ge)},className:`px-3 py-1 text-xs rounded-full transition-colors ${_===ge?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[ge]},ge))})]}),s.jsx(Le,{children:me&&!H?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):H&&Object.keys(H.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:H.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(H.byModule).sort((ge,Se)=>Se[1].reduce(($e,Xe)=>$e+Xe.count,0)-ge[1].reduce(($e,Xe)=>$e+Xe.count,0)).slice(0,5).map(([ge,Se])=>{const $e=Se.reduce((Xe,jt)=>Xe+jt.count,0);return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:Tn[ge]||ge}),s.jsxs("span",{className:"text-xs text-gray-500",children:[$e," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Se.sort((Xe,jt)=>jt.count-Xe.count).slice(0,8).map((Xe,jt)=>{const gt=On(Xe);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:gt,children:gt}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${$e>0?Xe.count/$e*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:Xe.count})]})]},jt)})})]},ge)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(rc,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),J==="super"&&s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(at,{className:"text-white flex items-center gap-2",children:[s.jsx(rc,{className:"w-5 h-5 text-amber-400"}),"超级个体点击统计"]}),s.jsxs(X,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300 h-8",onClick:$n,disabled:oe,children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1 ${oe?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Le,{children:oe&&D.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):D.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-400 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"排名"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"超级个体"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"总点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"独立访客"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"人均点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",title:"该用户绑定 @人物 后,指向其 person 的留资独立人数",children:"获客(去重)"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"手机号"})]})}),s.jsx("tbody",{children:D.map((ge,Se)=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-500 text-xs",children:Se+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[ge.avatar?s.jsx("img",{src:ge.avatar,alt:"",className:"w-7 h-7 rounded-full object-cover"}):s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-700 flex items-center justify-center text-xs text-gray-400",children:"?"}),s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left text-sm truncate max-w-[160px]",onClick:()=>t(`/users?search=${encodeURIComponent(ge.nickname||ge.userId)}`),title:"点击跳转用户管理",children:ge.nickname||ge.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:ge.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:ge.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:ge.uniqueClicks>0?(ge.clicks/ge.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof ge.leadCount=="number"?ge.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:ge.phone||"-"})]},ge.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(rc,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无超级个体点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序首页的超级个体被用户点击后,数据将展示在此"})]})})]}),s.jsx(I0,{open:z,onClose:()=>{V(!1),q(null)},userId:O,onUserUpdated:()=>Rt()})]})}const ds=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Ut("w-full caption-bottom text-sm",t),...e})}));ds.displayName="Table";const us=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ut("[&_tr]:border-b",t),...e}));us.displayName="TableHeader";const hs=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ut("[&_tr:last-child]:border-0",t),...e}));hs.displayName="TableBody";const ct=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Ut("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ct.displayName="TableRow";const je=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Ut("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableHead";const be=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ut("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));be.displayName="TableCell";function ef(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function qs({page:t,totalPages:e,total:n,pageSize:r,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),i&&s.jsx("select",{value:r,onChange:c=>i(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>a(1),disabled:t<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),s.jsx("button",{type:"button",onClick:()=>a(t-1),disabled:t<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>a(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),s.jsx("button",{type:"button",onClick:()=>a(e),disabled:t>=e,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function WP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[x,y]=b.useState(10),[N,w]=b.useState(""),j=ef(N,300),[S,E]=b.useState("all"),[T,P]=b.useState(!0),[O,q]=b.useState(null),[z,V]=b.useState(null),[I,te]=b.useState(""),[Q,F]=b.useState(!1);async function re(){P(!0),q(null);try{const G=S==="all"?"":S==="completed"?"completed":S,_=new URLSearchParams({page:String(f),pageSize:String(x),...G&&{status:G},...j&&{search:j}}),[U,H]=await Promise.all([Pe(`/api/admin/orders?${_}`),Pe("/api/db/users?page=1&pageSize=500")]);U!=null&&U.success&&(e(U.orders||[]),i(U.total??0),c(U.totalRevenue??0),h(U.todayRevenue??0)),H!=null&&H.success&&H.users&&r(H.users)}catch(G){console.error("加载订单失败",G),q("加载订单失败,请检查网络后重试")}finally{P(!1)}}b.useEffect(()=>{m(1)},[j,S]),b.useEffect(()=>{re()},[f,x,j,S]);const ie=G=>{var _;return G.userNickname||((_=n.find(U=>U.id===G.userId))==null?void 0:_.nickname)||"匿名用户"},J=G=>{var _;return((_=n.find(U=>U.id===G))==null?void 0:_.phone)||"-"},$=G=>{const _=G.productType||G.type||"",U=G.description||"";if(_==="balance_recharge")return{name:`余额充值 ¥${Number(G.amount||0).toFixed(2)}`,type:"余额充值"};if(U){if(_==="section"&&(U.includes("章节")||U.includes("代付领取"))){if(U.includes("代付领取"))return{name:U.replace("代付领取 - ",""),type:"代付领取"};if(U.includes("-")){const H=U.split("-");if(H.length>=3)return{name:`第${H[1]}章 第${H[2]}节`,type:"《一场Soul的创业实验》"}}return{name:U,type:"章节购买"}}return _==="fullbook"||U.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:_==="vip"||U.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:_==="match"||U.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:U,type:"其他"}}return _==="section"?{name:`章节 ${G.productId||G.sectionId||""}`,type:"单章"}:_==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:_==="vip"?{name:"超级个体开通费用",type:"超级个体"}:_==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:_||"其他"}},D=Math.ceil(a/x)||1;async function R(){var G;if(!(!(z!=null&&z.orderSn)&&!(z!=null&&z.id))){F(!0),q(null);try{const _=await Gt("/api/admin/orders/refund",{orderSn:z.orderSn||z.id,reason:I||void 0});_!=null&&_.success?(V(null),te(""),re()):q((_==null?void 0:_.error)||"退款失败")}catch(_){const U=_;q(((G=U==null?void 0:U.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{F(!1)}}}function oe(){if(t.length===0){se.info("暂无数据可导出");return}const G=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],_=t.map(Y=>{const le=$(Y);return[Y.orderSn||Y.id||"",ie(Y),J(Y.userId),le.name,Number(Y.amount||0).toFixed(2),Y.paymentMethod==="wechat"?"微信支付":Y.paymentMethod==="balance"?"余额支付":Y.paymentMethod==="alipay"?"支付宝":Y.paymentMethod||"微信支付",Y.status==="refunded"?"已退款":Y.status==="paid"||Y.status==="completed"?"已完成":Y.status==="pending"||Y.status==="created"?"待支付":"已失败",Y.status==="refunded"&&Y.refundReason?Y.refundReason:"-",Y.referrerEarnings?Number(Y.referrerEarnings).toFixed(2):"-",Y.createdAt?new Date(Y.createdAt).toLocaleString("zh-CN"):""].join(",")}),U="\uFEFF"+[G.join(","),..._].join(`
+`),H=new Blob([U],{type:"text/csv;charset=utf-8"}),K=URL.createObjectURL(H),me=document.createElement("a");me.href=K,me.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,me.click(),URL.revokeObjectURL(K)}return s.jsxs("div",{className:"p-8 w-full",children:[O&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:O}),s.jsx("button",{type:"button",onClick:()=>q(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(X,{variant:"outline",onClick:re,disabled:T,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${T?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:N,onChange:G=>w(G.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ej,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:S,onChange:G=>E(G.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(X,{variant:"outline",onClick:oe,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(E5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:T?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"订单号"}),s.jsx(je,{className:"text-gray-400",children:"用户"}),s.jsx(je,{className:"text-gray-400",children:"商品"}),s.jsx(je,{className:"text-gray-400",children:"金额"}),s.jsx(je,{className:"text-gray-400",children:"支付方式"}),s.jsx(je,{className:"text-gray-400",children:"状态"}),s.jsx(je,{className:"text-gray-400",children:"退款原因"}),s.jsx(je,{className:"text-gray-400",children:"分销佣金"}),s.jsx(je,{className:"text-gray-400",children:"下单时间"}),s.jsx(je,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(hs,{children:[t.map(G=>{const _=$(G);return s.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(be,{className:"font-mono text-xs text-gray-400",children:[(G.orderSn||G.id||"").slice(0,12),"..."]}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[ie(G),G.paymentMethod==="gift_pay"&&s.jsx(Ve,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),G.payerUserId&&G.paymentMethod!=="gift_pay"&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:J(G.userId)}),G.payerUserId&&G.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[G.paymentMethod==="gift_pay"?"赠送人:":"代付人:",G.payerNickname]})]})}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[_.name,(G.productType||G.type)==="vip"&&s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:_.type})]})}),s.jsxs(be,{className:"text-[#38bdac] font-bold",children:["¥",Number(G.amount||0).toFixed(2)]}),s.jsx(be,{className:"text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="balance"?"余额支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[G.status==="refunded"?s.jsx(Ve,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):G.status==="paid"||G.status==="completed"?s.jsx(Ve,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ve,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ve,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(G.status==="paid"||G.status==="completed")&&(G.webhookPushStatus==="sent"?s.jsx(Ve,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(Ve,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(be,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx(be,{className:"text-[#FFD700]",children:G.referrerEarnings?`¥${Number(G.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(be,{className:"text-gray-400 text-sm",children:new Date(G.createdAt).toLocaleString("zh-CN")}),s.jsx(be,{children:(G.status==="paid"||G.status==="completed")&&G.paymentMethod!=="balance"&&s.jsxs(X,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{V(G),te("")},children:[s.jsx(Ij,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)}),t.length===0&&s.jsx(ct,{children:s.jsx(be,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(qs,{page:f,totalPages:D,total:a,pageSize:x,onPageChange:m,onPageSizeChange:G=>{y(G),m(1)}})]})})}),s.jsx(Dt,{open:!!z,onOpenChange:G=>!G&&V(null),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"订单退款"})}),z&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",z.orderSn||z.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(z.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:I,onChange:G=>te(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(X,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>V(null),disabled:Q,children:"取消"}),s.jsx(X,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:R,disabled:Q,children:Q?"退款中...":"确认退款"})]})]})})]})}const hl=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Ut("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));hl.displayName="Textarea";const P1=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],Xk={INTJ:{title:"战略家",group:"NT",mood:"sharp"},INTP:{title:"逻辑学家",group:"NT",mood:"calm"},ENTJ:{title:"指挥官",group:"NT",mood:"sharp"},ENTP:{title:"辩论家",group:"NT",mood:"playful"},INFJ:{title:"提倡者",group:"NF",mood:"warm"},INFP:{title:"调停者",group:"NF",mood:"warm"},ENFJ:{title:"主人公",group:"NF",mood:"warm"},ENFP:{title:"竞选者",group:"NF",mood:"playful"},ISTJ:{title:"物流师",group:"SJ",mood:"calm"},ISFJ:{title:"守卫者",group:"SJ",mood:"warm"},ESTJ:{title:"总经理",group:"SJ",mood:"sharp"},ESFJ:{title:"执政官",group:"SJ",mood:"warm"},ISTP:{title:"鉴赏家",group:"SP",mood:"sharp"},ISFP:{title:"探险家",group:"SP",mood:"playful"},ESTP:{title:"企业家",group:"SP",mood:"playful"},ESFP:{title:"表演者",group:"SP",mood:"playful"}};function KP(t){switch(t){case"NT":return{bg:"#0d1424",body:"#c89a2c",accent:"#ffd66b",hair:"#6d540f",line:"#111827"};case"NF":return{bg:"#0a1721",body:"#2e9f7c",accent:"#84e9c9",hair:"#2d6a4f",line:"#11212a"};case"SJ":return{bg:"#101828",body:"#4f8cb8",accent:"#9bd4ff",hair:"#2e4a66",line:"#111f2d"};case"SP":return{bg:"#161225",body:"#8b6bc0",accent:"#ccb3ff",hair:"#574183",line:"#211832"};default:return{bg:"#0e1422",body:"#38bdac",accent:"#7ee7db",hair:"#1f6f66",line:"#10202d"}}}function qP(t){switch(t){case"sharp":return{eye:"M222 222 L242 220 M270 220 L290 222",brow:"M218 210 L244 202 M268 202 L294 210",mouth:"M234 256 Q256 246 278 256",tilt:-5};case"warm":return{eye:"M222 224 Q232 230 242 224 M270 224 Q280 230 290 224",brow:"M220 210 Q232 206 244 210 M268 210 Q280 206 292 210",mouth:"M232 254 Q256 272 280 254",tilt:2};case"playful":return{eye:"M222 224 Q232 236 242 224 M270 224 Q280 236 290 224",brow:"M220 210 Q234 200 246 208 M266 208 Q278 200 292 210",mouth:"M232 256 Q256 266 280 250",tilt:8};default:return{eye:"M222 224 Q232 220 242 224 M270 224 Q280 220 290 224",brow:"M220 210 Q232 208 244 210 M268 210 Q280 208 292 210",mouth:"M236 256 Q256 260 276 256",tilt:0}}}function GP(t){switch(t){case"sharp":return"M168 370 L206 300 L256 332 L306 300 L344 370 L306 392 L256 374 L206 392 Z";case"warm":return"M166 368 Q188 318 226 314 L256 340 L286 314 Q324 318 346 368 L314 392 Q286 404 256 396 Q226 404 198 392 Z";case"playful":return"M164 370 L198 304 L252 332 L318 300 L350 374 L316 394 L258 378 L196 396 Z";default:return"M166 370 L202 306 L256 336 L310 306 L346 370 L310 392 L256 380 L202 392 Z"}}function O1(t){const e=Xk[t],n=KP(e.group),r=qP(e.mood),a=GP(e.mood),i=`
-`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function GP(){const[t,e]=b.useState({}),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useCallback(async()=>{r(!0);try{const x=await Pe("/api/admin/mbti-avatars");x!=null&&x.avatars?e(x.avatars):e({})}catch{se.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);b.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const x=await Ct("/api/admin/mbti-avatars",{avatars:t});if(!x||x.success===!1){se.error((x==null?void 0:x.error)||"保存失败");return}se.success("已保存,后台与小程序默认头像同步生效"),u()}catch{se.error("保存失败")}finally{i(!1)}},f=x=>{const y=O1(x);e(N=>({...N,[x]:y})),se.success(`${x} 已生成`)},m=()=>{c(!0);try{const x={...t};P1.forEach(y=>{x[y]=O1(y)}),e(x),se.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(Fe,{className:"w-5 h-5 mr-2 animate-spin text-[#38bdac]"}),"加载配置…"]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(rt,{className:"pb-2",children:[s.jsxs(at,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(tA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(Kt,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(Le,{className:"flex flex-wrap gap-2",children:[s.jsxs(X,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396]",onClick:m,disabled:o,children:[s.jsx(kA,{className:"w-3.5 h-3.5 mr-1"}),o?"生成中…":"一键生成16头像"]}),s.jsxs(X,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-300",onClick:u,children:[s.jsx(Fe,{className:"w-3.5 h-3.5 mr-1"}),"重新加载"]}),s.jsxs(X,{type:"button",size:"sm",className:"bg-emerald-600 hover:bg-emerald-500",onClick:h,disabled:a,children:[s.jsx(bn,{className:"w-3.5 h-3.5 mr-1"}),a?"保存中…":"保存映射"]})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:P1.map(x=>{const y=t[x]??"",N=Xk[x];return s.jsxs("div",{className:"rounded-xl border border-gray-700/60 bg-[#0a1628] p-3 flex flex-col gap-2 hover:border-[#38bdac]/35 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ve,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 font-mono text-xs",children:x}),s.jsx("span",{className:"text-xs text-gray-400 truncate",title:N.title,children:N.title})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full shrink-0 overflow-hidden flex items-center justify-center bg-[#081322] ring-2 ring-[#38bdac]/40 ring-offset-2 ring-offset-[#0a1628]",children:y?s.jsx("img",{src:y,alt:x,className:"w-full h-full object-cover scale-110"}):s.jsx("span",{className:"text-gray-600 text-[10px]",children:"未配"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:y,onChange:w=>e(j=>({...j,[x]:w.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(X,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(x),children:"生成这张"}),s.jsx(X,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(w=>({...w,[x]:""})),children:"清空"})]})]},x)})})]})}const L1=[{value:"after_login",label:"注册/登录成功",group:"用户状态"},{value:"bind_phone",label:"绑定手机号",group:"用户状态"},{value:"fill_profile",label:"完善资料(头像/MBTI/行业)",group:"用户状态"},{value:"view_chapter",label:"浏览章节",group:"阅读行为"},{value:"browse_5_chapters",label:"累计浏览5个章节",group:"阅读行为"},{value:"purchase_section",label:"购买单章",group:"付费行为"},{value:"purchase_fullbook",label:"购买全书/VIP",group:"付费行为"},{value:"after_pay",label:"任意付款成功",group:"付费行为"},{value:"after_match",label:"完成派对匹配",group:"社交行为"},{value:"click_super_individual",label:"点击超级个体头像",group:"社交行为"},{value:"lead_submit",label:"提交留资/链接",group:"社交行为"},{value:"referral_bind",label:"被推荐人绑定",group:"分销行为"},{value:"share_action",label:"分享给好友/朋友圈",group:"分销行为"},{value:"withdraw_request",label:"申请提现",group:"分销行为"},{value:"add_wechat",label:"添加微信联系方式",group:"用户状态"}],D1=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}],JP=[{level:"S",range:"≥85",label:"高价值"},{level:"A",range:"70–84",label:"优质"},{level:"B",range:"50–69",label:"中等"},{level:"C",range:"30–49",label:"潜力"},{level:"D",range:"<30",label:"待激活"}],tc=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function _1(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function QP(){var Ei,zr,Mi,Va,Ha,$r,da;const[t,e]=x0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",[i,o]=b.useState([]),[c,u]=b.useState(0),[h,f]=b.useState(1),[m,x]=b.useState(10),[y,N]=b.useState(""),w=ef(y,300),j=n==="vip"?"vip":n==="complete"?"complete":"all",[S,E]=b.useState(j),[T,P]=b.useState(!0),[O,q]=b.useState(!1),[z,V]=b.useState(null),[I,te]=b.useState(!1),[Q,F]=b.useState(!1),[re,ie]=b.useState("desc");b.useEffect(()=>{n==="vip"?E("vip"):n==="complete"?E("complete"):n==="all"&&E("all")},[n]);const[J,$]=b.useState(!1),[D,R]=b.useState(null),[oe,G]=b.useState(!1),[_,U]=b.useState(!1),[H,K]=b.useState({referrals:[],stats:{}}),[me,Y]=b.useState(!1),[le,de]=b.useState(null),[ve,ye]=b.useState(!1),[ke,ze]=b.useState(null),[ft,wt]=b.useState(!1),[dt,Rt]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Tt,Tn]=b.useState([]),[mn,Ft]=b.useState(!1),[qt,vn]=b.useState(!1),[On,$n]=b.useState(null),[St,cn]=b.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[xn,ge]=b.useState([]),[Se,$e]=b.useState(!1),[Xe,jt]=b.useState(null),[gt,L]=b.useState(null),[Me,pt]=b.useState({}),[Et,ht]=b.useState(!1),[tt,Pt]=b.useState(null),[Wt,en]=b.useState([]),[ts,Qs]=b.useState(!1),[bi,ea]=b.useState(null),[ta,Er]=b.useState(""),[Mr,Ar]=b.useState([]),[cr,dr]=b.useState(!1),[Ea,Ys]=b.useState({}),[Ss,Xs]=b.useState([]),[ur,Cs]=b.useState(0),[ae,xe]=b.useState(1),[Ue]=b.useState(20),[ut,Fn]=b.useState(!1),[Ps,Ma]=b.useState(null),[Aa,To]=b.useState(""),Zs=ef(Aa,300),[Ts,vi]=b.useState(""),[Mt,Bc]=b.useState({}),Ir=b.useCallback(async(v,A)=>{Fn(!0),Ma(null);try{const B=new URLSearchParams({mode:"contact",page:String(ae),pageSize:String(Ue)}),ue=v??Zs;ue&&B.set("search",ue);const we=A??Ts;we&&B.set("source",we);const De=await Pe(`/api/db/ckb-leads?${B}`);if(De!=null&&De.success)Xs(De.records||[]),Cs(De.total??0),De.stats&&Bc(De.stats);else{const it=(De==null?void 0:De.error)||"加载获客列表失败";Ma(it),se.error(it),Xs([]),Cs(0)}}catch(B){const ue=B instanceof Error?B.message:"网络错误";Ma(ue),se.error("加载获客列表失败: "+ue),Xs([]),Cs(0)}finally{Fn(!1)}},[ae,Ue,Zs,Ts]),Ni=b.useCallback(async()=>{try{const v=await Pe("/api/admin/mbti-avatars"),A=v!=null&&v.avatars&&typeof v.avatars=="object"?v.avatars:{};Ys(A)}catch{Ys({})}},[]);b.useEffect(()=>{t.get("tab")==="leads"&&Ir()},[t.get("tab"),ae,Ir]),b.useEffect(()=>{Ni()},[Ni]);const Rr=b.useCallback((v,A)=>{const B=(v||"").trim();if(B)return B;const ue=(A||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(ue)?(Ea[ue]||"").trim():""},[Ea]),Vc=b.useCallback(v=>{const A=!!v.hasFullBook,B=Number(v.purchasedSectionCount||0);return A?{tone:"vip",main:"已购全书",sub:B>0?`另购单章 ${B} 章`:"购买项:VIP / 全书"}:B>0?{tone:"paid",main:`已购 ${B} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[Ia,na]=b.useState(null),ns=b.useCallback(async()=>{try{const v=await Pe("/api/admin/users/online-stats");v!=null&&v.success&&typeof v.onlineCount=="number"?na(v.onlineCount):na(0)}catch{na(null)}},[]);b.useEffect(()=>{ns();const v=setInterval(ns,1e4);return()=>clearInterval(v)},[ns]);async function sa(v=!1){var A;P(!0),v&&q(!0),V(null);try{if(I){const B=new URLSearchParams({search:w,limit:String(m*5)}),ue=await Pe(`/api/db/users/rfm?${B}`);if(ue!=null&&ue.success){let we=ue.users||[];re==="asc"&&(we=[...we].reverse());const De=(h-1)*m;o(we.slice(De,De+m)),u(((A=ue.users)==null?void 0:A.length)??0),we.length===0&&(te(!1),V("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else te(!1),V((ue==null?void 0:ue.error)||"RFM 加载失败,已切回普通模式")}else{const B=new URLSearchParams({page:String(h),pageSize:String(m),search:w,...S==="vip"&&{vip:"true"},...S==="complete"&&{pool:"complete"}}),ue=await Pe(`/api/db/users?${B}`);ue!=null&&ue.success?(o(ue.users||[]),u(ue.total??0)):V((ue==null?void 0:ue.error)||"加载失败")}}catch(B){console.error("Load users error:",B),V("网络错误")}finally{P(!1),v&&q(!1)}}b.useEffect(()=>{f(1)},[w,S,I]),b.useEffect(()=>{sa()},[h,m,w,S,I,re]);const qn=Math.ceil(c/m)||1,Cl=()=>{I?re==="desc"?ie("asc"):(te(!1),ie("desc")):(te(!0),ie("desc"))},Pr=v=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[v||""]||"bg-gray-500/20 text-gray-400";async function Hc(v){var A;if(!_1("用户")){se.info("已取消删除");return}try{const B=await li(`/api/db/users?id=${encodeURIComponent(v)}`);B!=null&&B.success?(se.success("已删除"),sa()):se.error("删除失败: "+((B==null?void 0:B.error)||"未知错误"))}catch(B){const ue=B,we=((A=ue==null?void 0:ue.data)==null?void 0:A.error)||(ue==null?void 0:ue.message)||"网络错误";se.error("删除失败: "+we)}}const wi=v=>{R(v),Rt({phone:v.phone||"",nickname:v.nickname||"",password:"",isAdmin:!!(v.isAdmin??!1),hasFullBook:!!(v.hasFullBook??!1)}),$(!0)},Ra=()=>{R(null),Rt({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),$(!0)};async function ra(){if(!dt.phone||!dt.nickname){se.error("请填写手机号和昵称");return}G(!0);try{if(D){const v=await Gt("/api/db/users",{id:D.id,phone:dt.phone||void 0,nickname:dt.nickname,isAdmin:dt.isAdmin,hasFullBook:dt.hasFullBook,...dt.password&&{password:dt.password}});if(!(v!=null&&v.success)){se.error("更新失败: "+((v==null?void 0:v.error)||""));return}}else{const v=await Ct("/api/db/users",{phone:dt.phone,nickname:dt.nickname,password:dt.password,isAdmin:dt.isAdmin});if(!(v!=null&&v.success)){se.error("创建失败: "+((v==null?void 0:v.error)||""));return}}$(!1),sa()}catch{se.error("保存失败")}finally{G(!1)}}async function aa(v){de(v),U(!0),Y(!0);try{const A=await Pe(`/api/db/users/referrals?userId=${encodeURIComponent(v.id)}`);A!=null&&A.success?K({referrals:A.referrals||[],stats:A.stats||{}}):K({referrals:[],stats:{}})}catch{K({referrals:[],stats:{}})}finally{Y(!1)}}const ia=b.useCallback(async()=>{Ft(!0);try{const v=await Pe("/api/db/user-rules");v!=null&&v.success&&Tn(v.rules||[])}catch{}finally{Ft(!1)}},[]);async function ji(){if(!St.title){se.error("请填写规则标题");return}G(!0);try{if(On){const v=await Gt("/api/db/user-rules",{id:On.id,...St});if(!(v!=null&&v.success)){se.error("更新失败: "+((v==null?void 0:v.error)||""));return}}else{const v=await Ct("/api/db/user-rules",St);if(!(v!=null&&v.success)){se.error("创建失败: "+((v==null?void 0:v.error)||""));return}}vn(!1),ia()}catch{se.error("保存失败")}finally{G(!1)}}async function ki(v){if(!_1("规则")){se.info("已取消删除");return}try{const A=await li(`/api/db/user-rules?id=${v}`);A!=null&&A.success&&ia()}catch{}}async function Eo(v){try{await Gt("/api/db/user-rules",{id:v.id,enabled:!v.enabled}),ia()}catch{}}const Os=b.useCallback(async()=>{$e(!0);try{const v=await Pe("/api/db/vip-members?limit=500");if(v!=null&&v.success&&v.data){const A=[...v.data].map((B,ue)=>({...B,vipSort:typeof B.vipSort=="number"?B.vipSort:ue+1}));A.sort((B,ue)=>(B.vipSort??999999)-(ue.vipSort??999999)),ge(A)}else v&&v.error&&se.error(v.error)}catch{se.error("加载超级个体列表失败")}finally{$e(!1)}},[]),[En,Pa]=b.useState(!1),[Ls,kt]=b.useState(null),[oa,Ln]=b.useState(""),[hr,Mo]=b.useState(!1),[Tl,Oa]=b.useState(!1),[fr,la]=b.useState(null),[Ds,Bn]=b.useState(""),[Vn,Or]=b.useState(!1),ca=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],ps=v=>{kt(v),Ln(v.vipRole||""),Pa(!0)},La=v=>{la(v),Bn((v.webhookUrl||"").trim()),Oa(!0)},Da=async v=>{const A=v.trim();if(Ls){if(!A){se.error("请选择或输入标签");return}Mo(!0);try{const B=await Gt("/api/db/users",{id:Ls.id,vipRole:A});if(!(B!=null&&B.success)){se.error((B==null?void 0:B.error)||"更新超级个体标签失败");return}se.success("已更新超级个体标签"),Pa(!1),kt(null),await Os()}catch{se.error("更新超级个体标签失败")}finally{Mo(!1)}}},_a=async()=>{if(!fr)return;const v=Ds.trim();if(v&&!/^https?:\/\//i.test(v)){se.error("Webhook 地址需以 http/https 开头");return}Or(!0);try{const A=await Gt("/api/db/vip-members/webhook",{userId:fr.id,webhookUrl:v});if(!(A!=null&&A.success)){se.error((A==null?void 0:A.error)||"保存飞书群 Webhook 失败");return}se.success(v?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),Oa(!1),la(null),await Os()}catch{se.error("保存飞书群 Webhook 失败")}finally{Or(!1)}},[za,_s]=b.useState(!1),[er,zs]=b.useState(null),[El,Lr]=b.useState(""),[Dr,pr]=b.useState(!1),$a=v=>{zs(v),Lr(v.vipSort!=null?String(v.vipSort):""),_s(!0)},Uc=async()=>{if(!er)return;const v=Number(El);if(!Number.isFinite(v)){se.error("请输入有效的数字序号");return}pr(!0);try{const A=await Gt("/api/db/users",{id:er.id,vipSort:v});if(!(A!=null&&A.success)){se.error((A==null?void 0:A.error)||"更新排序序号失败");return}se.success("已更新排序序号"),_s(!1),zs(null),await Os()}catch{se.error("更新排序序号失败")}finally{pr(!1)}},Ml=(v,A)=>{v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("text/plain",A),jt(A)},Fa=(v,A)=>{v.preventDefault(),gt!==A&&L(A)},Si=()=>{jt(null),L(null)},Ao=async(v,A)=>{v.preventDefault();const B=v.dataTransfer.getData("text/plain")||Xe;if(jt(null),L(null),!B||B===A)return;const ue=xn.find(Je=>Je.id===B),we=xn.find(Je=>Je.id===A);if(!ue||!we)return;const De=ue.vipSort??xn.findIndex(Je=>Je.id===B)+1,it=we.vipSort??xn.findIndex(Je=>Je.id===A)+1;ge(Je=>{const vt=[...Je],At=vt.findIndex(Wc=>Wc.id===B),dn=vt.findIndex(Wc=>Wc.id===A);if(At===-1||dn===-1)return Je;const un=[...vt],[Al,Ap]=[un[At],un[dn]];return un[At]={...Ap,vipSort:De},un[dn]={...Al,vipSort:it},un});try{const[Je,vt]=await Promise.all([Gt("/api/db/users",{id:B,vipSort:it}),Gt("/api/db/users",{id:A,vipSort:De})]);if(!(Je!=null&&Je.success)||!(vt!=null&&vt.success)){se.error((Je==null?void 0:Je.error)||(vt==null?void 0:vt.error)||"更新排序失败"),await Os();return}se.success("已更新排序"),await Os()}catch{se.error("更新排序失败"),await Os()}},Io=b.useCallback(async()=>{ht(!0);try{const v=await Pe("/api/db/users/journey-stats");v!=null&&v.success&&v.stats&&pt(v.stats)}catch{}finally{ht(!1)}},[]),mr=b.useCallback(async v=>{Pt(v),Qs(!0);try{const A=await Pe(`/api/db/users/journey-users?stage=${v}&limit=50`);A!=null&&A.success&&A.users&&en(A.users)}catch{}finally{Qs(!1)}},[]),Ro=b.useCallback(async(v,A)=>{ea(v),Er(A),dr(!0);try{const B=await Pe(`/api/db/users/tracks?userId=${v}&limit=50`);B!=null&&B.success&&B.tracks&&Ar(B.tracks)}catch{}finally{dr(!1)}},[]),[Ba,Po]=b.useState(!1),Ci=async()=>{Po(!0);try{const v=await Ct("/api/admin/shensheshou/batch-enrich",{limit:20});v!=null&&v.success?(se.success(`批量补全完成:${v.enriched} 人已补全,${v.skipped} 人跳过`),sa()):se.error((v==null?void 0:v.error)||"批量补全失败")}catch{se.error("批量补全请求失败")}finally{Po(!1)}},Ti=v=>{const A=[v.phone,v.nickname,v.avatar,v.wechatId,v.mbti,v.industry,v.region,v.position],B=A.filter(ue=>ue!=null&&ue!=="").length;return Math.round(B/A.length*100)},{leadsRows:Oo,leadsRawCount:ss,leadsDeduped:_r}=b.useMemo(()=>{const v=Je=>(Je||"").replace(/\D/g,"")||"",A=Je=>{const vt=v(Je.phone);if(vt)return`phone:${vt}`;const At=(Je.userId||"").trim();if(At)return`user:${At}`;const dn=(Je.wechatId||"").trim();return dn?`wechat:${dn}`:`row:${Je.id}`},B=Zs.trim().toLowerCase();let ue=Ss;B&&(ue=Ss.filter(Je=>[Je.userNickname,Je.name,Je.phone,Je.wechatId,Je.personName,Je.source,String(Je.ckbPlanId??"")].filter(Boolean).join(" ").toLowerCase().includes(B)));const we=[...ue].sort((Je,vt)=>{const At=Je.createdAt?new Date(Je.createdAt).getTime():0;return(vt.createdAt?new Date(vt.createdAt).getTime():0)-At}),De=new Set,it=[];for(const Je of we){const vt=A(Je);De.has(vt)||(De.add(vt),it.push(Je))}return{leadsRows:it,leadsRawCount:ue.length,leadsDeduped:ue.length-it.length}},[Ss,Zs]);return s.jsxs("div",{className:"p-8 w-full",children:[z&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:z}),s.jsx("button",{type:"button",onClick:()=>V(null),children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",c," 位注册用户",Ia!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",Ia," 人"]}),I&&" · RFM 排序中"]})]}),s.jsx(Oe,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(Le,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>F(v=>!v),className:"flex items-center gap-2 min-w-0 flex-1 text-left rounded-lg px-1 py-0.5 hover:bg-white/5 transition-colors","aria-expanded":Q,children:[s.jsx(Gh,{className:"w-5 h-5 text-[#38bdac] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-semibold text-white",children:"算法配置"}),s.jsx("div",{className:"text-xs text-gray-500 truncate",children:Q?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),Q?s.jsx(ag,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(vc,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(X,{type:"button",variant:"outline",size:"sm",onClick:Cl,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:I?re==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),Q&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["综合分 0–100(六维度):最近消费 R(25%)+ 订单频次 F(20%)+ 累计金额 M(20%)+ 推荐人数(15%)+ 行为轨迹(10%)+ 资料完善(10%)。各维度在全量用户中归一化,与后端"," ",s.jsx("code",{className:"text-gray-500",children:"/api/db/users/rfm"})," 一致。"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:JP.map(({level:v,range:A,label:B})=>s.jsxs(Ve,{variant:"outline",className:`text-[10px] border-0 ${Pr(v)}`,children:[v," ",A," · ",B]},v))})]})]})})]}),s.jsxs(jc,{value:a,onValueChange:v=>{const A=new URLSearchParams(t);v==="users"?A.delete("tab"):A.set("tab",v),e(A)},className:"w-full",children:[s.jsxs(ul,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(Qt,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(In,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(Qt,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>Ir(),children:[s.jsx(hc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(Qt,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Io,children:[s.jsx(qr,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(Qt,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ia,children:[s.jsx(no,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(Qt,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Os,children:[s.jsx(pc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(Yt,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(X,{variant:"outline",onClick:Ci,disabled:Ba,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[Ba?s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(pi,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(X,{variant:"outline",onClick:()=>sa(!0),disabled:O,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${O?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:S,onChange:v=>{const A=v.target.value;E(A),f(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:I,children:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:y,onChange:v=>N(v.target.value)})]}),s.jsxs(X,{onClick:Ra,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hc,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:T?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"用户信息"}),s.jsx(je,{className:"text-gray-400",children:"绑定信息"}),s.jsx(je,{className:"text-gray-400",children:"购买状态"}),s.jsx(je,{className:"text-gray-400",children:"分销收益"}),s.jsxs(je,{className:"text-gray-400 cursor-pointer select-none",onClick:Cl,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Gh,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),I?re==="desc"?s.jsx(vc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(ag,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(rx,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),I&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(je,{className:"text-gray-400",children:"资料完善"}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(hs,{children:[i.map(v=>{var A,B,ue;return s.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var it;const we=Rr(v.avatar,v.mbti),De=((it=v.nickname)==null?void 0:it.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>wt(!0),className:"w-10 h-10 shrink-0 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] overflow-hidden ring-1 ring-transparent hover:ring-[#38bdac]/60 transition",children:we?s.jsx("img",{src:we,className:"w-full h-full rounded-full object-cover",alt:"",onError:Je=>{var dn;const vt=Je.target;if(vt.style.display="none",vt.nextElementSibling)return;const At=document.createElement("span");At.textContent=De,(dn=vt.parentElement)==null||dn.appendChild(At)}}):De})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{ze(v.id),ye(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:v.nickname}),v.isAdmin&&s.jsx(Ve,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),v.openId&&!((A=v.id)!=null&&A.startsWith("user_"))&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate max-w-[140px]",title:v.id,children:[(B=v.id)==null?void 0:B.slice(0,16),(((ue=v.id)==null?void 0:ue.length)??0)>16?"…":""]})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[v.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:v.phone})]}),v.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:v.wechatId})]}),!v.phone&&!v.wechatId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(be,{children:(()=>{const we=Vc(v);return we.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:we.main}),we.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:we.sub})]}):we.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Ve,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:we.main}),we.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:we.sub})]}):s.jsx(Ve,{variant:"outline",className:"text-gray-500 border-gray-600",children:we.main})})()}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(v.earnings||0)).toFixed(2)]}),parseFloat(String(v.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(v.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>aa(v),role:"button",tabIndex:0,onKeyDown:we=>we.key==="Enter"&&aa(v),children:[s.jsx(In,{className:"w-3 h-3"})," 绑定",v.referralCount||0,"人"]})]})}),s.jsx(be,{children:v.rfmScore!=null&&v.rfmScore!==void 0?s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:v.rfmScore}),s.jsx(Ve,{className:`border-0 text-xs ${Pr(v.rfmLevel)}`,children:v.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(be,{children:(()=>{const we=Ti(v),De=we>=75?"text-green-400":we>=50?"text-yellow-400":"text-gray-500";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-12 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full ${we>=75?"bg-green-500":we>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${we}%`}})}),s.jsxs("span",{className:`text-xs ${De}`,children:[we,"%"]})]})})()}),s.jsx(be,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleDateString():"-"}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>{ze(v.id),ye(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(qh,{className:"w-4 h-4"})}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>wi(v),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(Jt,{className:"w-4 h-4"})}),s.jsx(X,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Hc(v.id),title:"删除",children:s.jsx(bs,{className:"w-4 h-4"})})]})})]},v.id)}),i.length===0&&s.jsx(ct,{children:s.jsx(be,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(qs,{page:h,totalPages:qn,total:c,pageSize:m,onPageChange:f,onPageSizeChange:v=>{x(v),f(1)}})]})})})]}),s.jsxs(Yt,{value:"leads",children:[Ps&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:Ps}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Ma(null),"aria-label":"关闭",children:"×"})]}),!ut&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"总留资条数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:ur})]}),s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"去重用户数(按 userId)"}),s.jsx("p",{className:"text-xl font-bold text-[#38bdac]",title:"后端 COUNT(DISTINCT user_id)",children:Mt.uniqueUsers??0})]}),(Mt.sourceStats&&Mt.sourceStats.length>0?Mt.sourceStats.slice(0,2):[]).map(v=>s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsxs("p",{className:"text-gray-500 text-xs",children:["来源:",v.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:v.cnt})]},v.source))]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 min-w-[200px]",children:[s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{placeholder:"搜索昵称/手机/微信/@人/来源…",value:Aa,onChange:v=>To(v.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),Mt.sourceStats&&Mt.sourceStats.length>0&&s.jsxs("select",{value:Ts,onChange:v=>{vi(v.target.value),xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),Mt.sourceStats.map(v=>s.jsxs("option",{value:v.source,children:[v.source,"(",v.cnt,")"]},v.source))]}),s.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap max-w-[min(100%,20rem)]",title:"同一页内:相同手机号或相同用户 ID(含微信侧标识)只保留最近一条",children:["本页 ",ss," 条",_r>0?` · 已合并 ${_r} 条重复`:""]})]}),s.jsxs(X,{variant:"outline",onClick:()=>Ir(),disabled:ut,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${ut?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:ut?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"昵称"}),s.jsx(je,{className:"text-gray-400",children:"手机号"}),s.jsx(je,{className:"text-gray-400",children:"微信号"}),s.jsx(je,{className:"text-gray-400",children:"对应 @人"}),s.jsx(je,{className:"text-gray-400",children:"获客计划"}),s.jsx(je,{className:"text-gray-400",children:"来源"}),s.jsx(je,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(hs,{children:[Oo.map(v=>s.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:v.userNickname||v.name||"-"}),s.jsx(be,{className:"text-gray-300",children:v.phone||"-"}),s.jsx(be,{className:"text-gray-300",children:v.wechatId||"-"}),s.jsx(be,{className:"text-[#38bdac]",children:v.personName||"-"}),s.jsx(be,{className:"text-gray-400",children:v.ckbPlanId?`#${v.ckbPlanId}`:"-"}),s.jsx(be,{children:s.jsx(Ve,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:v.source||"未知"})}),s.jsx(be,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),Oo.length===0&&s.jsx(ct,{children:s.jsx(be,{colSpan:7,className:"p-0 align-top",children:s.jsxs("div",{className:"py-16 px-6 text-center border-t border-gray-700/40 bg-[#0a1628]/30",children:[s.jsx(hc,{className:"w-14 h-14 text-[#38bdac]/20 mx-auto mb-4","aria-hidden":!0}),s.jsx("p",{className:"text-gray-200 font-medium mb-1",children:"暂无获客线索"}),s.jsx("p",{className:"text-gray-500 text-sm mb-6 max-w-md mx-auto leading-relaxed",children:Zs.trim()||Ts?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>Ir(),disabled:ut,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${ut?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(qs,{page:ae,totalPages:Math.ceil(ur/Ue)||1,total:ur,pageSize:Ue,onPageChange:xe,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(Yt,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(X,{variant:"outline",onClick:Io,disabled:Et,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${Et?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:tc.map((v,A)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${v.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${tt===v.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>mr(v.id),title:`点击查看「${v.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:v.icon}),s.jsx("div",{className:`text-xs font-medium ${v.color.split(" ").find(B=>B.startsWith("text-"))}`,children:v.label}),Me[v.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Me[v.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:A+1})]}),As.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:v.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:v.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",v.next]})]})]},v.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Gs,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),Et?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Me).length>0?s.jsx("div",{className:"space-y-2",children:tc.map(v=>{const A=Me[v.id]||0,B=Math.max(...tc.map(we=>Me[we.id]||0),1),ue=Math.round(A/B*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[v.icon," ",v.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${ue}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:A})]},v.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),tt&&s.jsxs("div",{className:"mt-6 bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(In,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(Ei=tc.find(v=>v.id===tt))==null?void 0:Ei.icon," ",(zr=tc.find(v=>v.id===tt))==null?void 0:zr.label," 阶段用户"]}),s.jsxs(Ve,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Wt.length," 人"]})]}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>Pt(null),className:"text-gray-400 hover:text-white",children:s.jsx(Yn,{className:"w-4 h-4"})})]}),ts?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Wt.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"昵称"}),s.jsx(je,{className:"text-gray-400",children:"手机号"}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsx(hs,{children:Wt.map(v=>s.jsxs(ct,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(be,{className:"text-white",children:v.nickname||"微信用户"}),s.jsx(be,{className:"text-gray-300",children:v.phone||"-"}),s.jsx(be,{className:"text-gray-400 text-xs",children:v.createdAt?new Date(v.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(be,{className:"text-right",children:s.jsxs(X,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>Ro(v.id,v.nickname||"微信用户"),children:[s.jsx(qh,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},v.id))})]})]}),s.jsx(Dt,{open:!!bi,onOpenChange:v=>{v||ea(null)},children:s.jsxs(Lt,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(qr,{className:"w-5 h-5 text-[#38bdac]"}),ta," 的行为轨迹"]})}),cr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Mr.length===0?s.jsx("p",{className:"text-gray-500 text-center py-8",children:"该用户暂无行为记录"}):s.jsxs("div",{className:"relative pl-6 space-y-0",children:[s.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-0.5 bg-gray-700"}),Mr.map((v,A)=>s.jsxs("div",{className:"relative flex items-start gap-3 py-2",children:[s.jsx("div",{className:"absolute left-[-13px] top-3 w-2.5 h-2.5 rounded-full bg-[#38bdac] border-2 border-[#0f2137] z-10"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-white text-sm font-medium",children:v.actionLabel}),v.module&&s.jsx(Ve,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:v.module})]}),(v.chapterTitle||v.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:v.chapterTitle||v.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[v.timeAgo," · ",v.createdAt?new Date(v.createdAt).toLocaleString("zh-CN"):""]})]})]},v.id||A))]})]})})]}),s.jsxs(Yt,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程触达规则:各行为节点的触发条件与展示文案(偏利他说明,少用命令式)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(X,{variant:"outline",onClick:ia,disabled:mn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${mn?"animate-spin":""}`})," 刷新"]}),s.jsxs(X,{onClick:()=>{$n(null),cn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),vn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(An,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),mn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Tt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Gs,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(X,{onClick:ia,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fe,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Tt.map(v=>{var A;return s.jsxs("div",{className:`p-3 rounded-lg border transition-all ${v.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[s.jsxs("span",{className:"text-gray-600 text-xs font-mono w-5 shrink-0 text-right",children:["#",v.sort]}),s.jsx(Jt,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:v.title}),v.trigger&&s.jsx(Ve,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:v.trigger}),(v.triggerConditions||[]).length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[(v.triggerConditions||[]).slice(0,3).map(B=>{const ue=L1.find(we=>we.value===B);return s.jsx(Ve,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(ue==null?void 0:ue.label)||B},B)}),(v.triggerConditions||[]).length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",(v.triggerConditions||[]).length-3]})]}),v.actionType&&v.actionType!=="popup"&&s.jsx(Ve,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((A=D1.find(B=>B.value===v.actionType))==null?void 0:A.label)||v.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx($t,{checked:v.enabled,onCheckedChange:()=>Eo(v)}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>{$n(v),cn({title:v.title,description:v.description,trigger:v.trigger,triggerConditions:v.triggerConditions||[],actionType:v.actionType||"popup",sort:v.sort,enabled:v.enabled}),vn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(Jt,{className:"w-3.5 h-3.5"})}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>ki(v.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(bs,{className:"w-3.5 h-3.5"})})]})]}),v.description&&s.jsxs("details",{className:"ml-[52px] mt-1",children:[s.jsxs("summary",{className:"text-gray-500 text-xs cursor-pointer hover:text-gray-400 select-none",children:["查看完整描述",s.jsxs("span",{className:"text-gray-600 ml-1",children:["(",v.description.length," 字,默认折叠)"]})]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1 pl-1 border-l-2 border-gray-700 whitespace-pre-wrap",children:v.description})]})]},v.id)})})]}),s.jsxs(Yt,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(X,{variant:"outline",onClick:Os,disabled:Se,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${Se?"animate-spin":""}`})," ","刷新"]})})]}),Se?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):xn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(pc,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-12",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 min-w-40",children:"超级个体标签"}),s.jsx(je,{className:"text-gray-400 w-16 text-center",children:"头像点击"}),s.jsx(je,{className:"text-gray-400 w-16 text-center",children:"获客数"}),s.jsx(je,{className:"text-gray-400 w-20",children:"排序值"}),s.jsx(je,{className:"text-gray-400 w-36",children:"飞书群"}),s.jsx(je,{className:"text-gray-400 w-36 text-right",children:"操作"})]})}),s.jsx(hs,{children:xn.map((v,A)=>{var we;const B=Xe===v.id,ue=gt===v.id;return s.jsxs(ct,{draggable:!0,onDragStart:De=>Ml(De,v.id),onDragOver:De=>Fa(De,v.id),onDrop:De=>Ao(De,v.id),onDragEnd:Si,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${B?"opacity-60":""} ${ue?"bg-[#38bdac]/10":""}`,children:[s.jsx(be,{className:"text-gray-300",children:A+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[Rr(v.avatar,v.mbti)?s.jsx("img",{src:Rr(v.avatar,v.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:De=>{var Je,vt;De.target.style.display="none";const it=document.createElement("div");it.className="w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",it.textContent=((Je=v.name)==null?void 0:Je[0])||"创",(vt=De.target.parentElement)==null||vt.appendChild(it)}}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((we=v.name)==null?void 0:we[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:v.name})})]})}),s.jsx(be,{className:"text-gray-300 whitespace-nowrap",children:v.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(be,{className:"text-center text-blue-400 text-xs font-mono",children:v.clickCount!=null?String(v.clickCount):"-"}),s.jsx(be,{className:"text-center text-green-400 text-xs font-mono",children:v.leadCount!=null?String(v.leadCount):"-"}),s.jsx(be,{className:"text-gray-300",children:v.vipSort??A+1}),s.jsx(be,{className:"text-xs",children:v.webhookUrl?s.jsx("span",{className:"text-[#38bdac] truncate block max-w-[180px]",title:v.webhookUrl,children:"已配置"}):s.jsx("span",{className:"text-gray-500",children:"未配置"})}),s.jsx(be,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>ps(v),title:"设置超级个体标签",children:s.jsx(Ad,{className:"w-3.5 h-3.5"})}),s.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>La(v),title:"编辑飞书群Webhook",children:s.jsx(Jt,{className:"w-3.5 h-3.5"})}),s.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>$a(v),title:"设置排序序号",children:s.jsx(rx,{className:"w-3.5 h-3.5"})})]})})]},v.id)})})]})})})]})]}),s.jsx(Dt,{open:ft,onOpenChange:wt,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(GP,{})]})}),s.jsx(Dt,{open:za,onOpenChange:v=>{_s(v),v||zs(null)},children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(rx,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",er==null?void 0:er.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:El,onChange:v=>Lr(v.target.value)})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>_s(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:Uc,disabled:Dr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),Dr?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:En,onOpenChange:v=>{Pa(v),v||kt(null)},children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(pc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ls==null?void 0:Ls.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:ca.map(v=>s.jsx(X,{variant:oa===v?"default":"outline",size:"sm",className:oa===v?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ln(v),children:v},v))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:oa,onChange:v=>Ln(v.target.value)})]})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>Pa(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:()=>Da(oa),disabled:hr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),hr?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:Tl,onOpenChange:v=>{Oa(v),v||la(null)},children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(Jt,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",fr==null?void 0:fr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"VOX Webhook 地址(留空即清空)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",value:Ds,onChange:v=>Bn(v.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>Oa(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:_a,disabled:Vn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),Vn?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:J,onOpenChange:$,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[D?s.jsx(Jt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(hc,{className:"w-5 h-5 text-[#38bdac]"}),D?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:dt.phone,onChange:v=>Rt({...dt,phone:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:dt.nickname,onChange:v=>Rt({...dt,nickname:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:D?"新密码 (留空则不修改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:D?"留空则不修改":"请输入密码",value:dt.password,onChange:v=>Rt({...dt,password:v.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"管理员权限"}),s.jsx($t,{checked:dt.isAdmin,onCheckedChange:v=>Rt({...dt,isAdmin:v})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"已购全书"}),s.jsx($t,{checked:dt.hasFullBook,onCheckedChange:v=>Rt({...dt,hasFullBook:v})})]})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:ra,disabled:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),oe?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:qt,onOpenChange:vn,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(Jt,{className:"w-5 h-5 text-[#38bdac]"}),On?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:St.title,onChange:v=>cn({...St,title:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则描述"}),s.jsx(hl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:St.description,onChange:v=>cn({...St,description:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(v=>{const A=L1.filter(B=>B.group===v);return A.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:v}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:A.map(B=>{const ue=(St.triggerConditions||[]).includes(B.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${ue?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const we=St.triggerConditions||[],De=ue?we.filter(it=>it!==B.value):[...we,B.value];cn({...St,triggerConditions:De})},children:B.label},B.value)})})]},v)})}),(St.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(St.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"兼容触发标识(旧版)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white text-xs h-8",placeholder:"例:after_login、after_pay(兼容现有小程序 ruleEngine)",value:St.trigger,onChange:v=>cn({...St,trigger:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:D1.map(v=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${St.actionType===v.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>cn({...St,actionType:v.value}),children:[s.jsx("span",{className:`text-xs font-medium ${St.actionType===v.value?"text-[#38bdac]":"text-gray-300"}`,children:v.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:v.desc})]},v.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(ee,{className:"text-gray-300",children:"启用状态"})}),s.jsx($t,{checked:St.enabled,onCheckedChange:v=>cn({...St,enabled:v})})]})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>vn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:ji,disabled:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),oe?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:_,onOpenChange:U,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(In,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",le==null?void 0:le.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Mi=H.stats)==null?void 0:Mi.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Va=H.stats)==null?void 0:Va.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((Ha=H.stats)==null?void 0:Ha.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",((($r=H.stats)==null?void 0:$r.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),me?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((da=H.referrals)==null?void 0:da.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(H.referrals??[]).map((v,A)=>{var ue;const B=v;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((ue=B.nickname)==null?void 0:ue.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:B.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:B.phone||(B.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[B.status==="vip"&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),B.status==="paid"&&s.jsxs(Ve,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",B.purchasedSections,"章"]}),B.status==="free"&&s.jsx(Ve,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:B.createdAt?new Date(B.createdAt).toLocaleDateString():""})]})]},B.id||A)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(fn,{children:s.jsx(X,{variant:"outline",onClick:()=>U(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(I0,{open:ve,onClose:()=>ye(!1),userId:ke,onUserUpdated:sa})]})}function tf(t,[e,n]){return Math.min(n,Math.max(e,t))}var Zk=["PageUp","PageDown"],e2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],t2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Dc="Slider",[xg,YP,XP]=T0(Dc),[n2]=No(Dc,[XP]),[ZP,ip]=n2(Dc),s2=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:x=()=>{},inverted:y=!1,form:N,...w}=t,j=b.useRef(new Set),S=b.useRef(0),T=o==="horizontal"?e8:t8,[P=[],O]=cl({prop:f,defaultProp:h,onChange:Q=>{var re;(re=[...j.current][S.current])==null||re.focus(),m(Q)}}),q=b.useRef(P);function z(Q){const F=i8(P,Q);te(Q,F)}function V(Q){te(Q,S.current)}function I(){const Q=q.current[S.current];P[S.current]!==Q&&x(P)}function te(Q,F,{commit:re}={commit:!1}){const ie=d8(i),J=u8(Math.round((Q-r)/i)*i+r,ie),$=tf(J,[r,a]);O((D=[])=>{const R=r8(D,$,F);if(c8(R,u*i)){S.current=R.indexOf($);const oe=String(R)!==String(D);return oe&&re&&x(R),oe?R:D}else return D})}return s.jsx(ZP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:S,thumbs:j.current,values:P,orientation:o,form:N,children:s.jsx(xg.Provider,{scope:t.__scopeSlider,children:s.jsx(xg.Slot,{scope:t.__scopeSlider,children:s.jsx(T,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:mt(w.onPointerDown,()=>{c||(q.current=P)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:z,onSlideMove:c?void 0:V,onSlideEnd:c?void 0:I,onHomeKeyDown:()=>!c&&te(r,0,{commit:!0}),onEndKeyDown:()=>!c&&te(a,P.length-1,{commit:!0}),onStepKeyDown:({event:Q,direction:F})=>{if(!c){const J=Zk.includes(Q.key)||Q.shiftKey&&e2.includes(Q.key)?10:1,$=S.current,D=P[$],R=i*J*F;te(D+R,$,{commit:!0})}}})})})})});s2.displayName=Dc;var[r2,a2]=n2(Dc,{startEdge:"left",endEdge:"right",size:"width",direction:1}),e8=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,x]=b.useState(null),y=Ht(e,T=>x(T)),N=b.useRef(void 0),w=sp(a),j=w==="ltr",S=j&&!i||!j&&i;function E(T){const P=N.current||m.getBoundingClientRect(),O=[0,P.width],z=R0(O,S?[n,r]:[r,n]);return N.current=P,z(T-P.left)}return s.jsx(r2,{scope:t.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:s.jsx(i2,{dir:w,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:T=>{const P=E(T.clientX);o==null||o(P)},onSlideMove:T=>{const P=E(T.clientX);c==null||c(P)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:T=>{const O=t2[S?"from-left":"from-right"].includes(T.key);h==null||h({event:T,direction:O?-1:1})}})})}),t8=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=Ht(e,f),x=b.useRef(void 0),y=!a;function N(w){const j=x.current||f.current.getBoundingClientRect(),S=[0,j.height],T=R0(S,y?[r,n]:[n,r]);return x.current=j,T(w-j.top)}return s.jsx(r2,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(i2,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const j=N(w.clientY);i==null||i(j)},onSlideMove:w=>{const j=N(w.clientY);o==null||o(j)},onSlideEnd:()=>{x.current=void 0,c==null||c()},onStepKeyDown:w=>{const S=t2[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:S?-1:1})}})})}),i2=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=ip(Dc,n);return s.jsx(bt.span,{...h,ref:e,onKeyDown:mt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):Zk.concat(e2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:mt(t.onPointerDown,m=>{const x=m.target;x.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(x)?x.focus():r(m)}),onPointerMove:mt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:mt(t.onPointerUp,m=>{const x=m.target;x.hasPointerCapture(m.pointerId)&&(x.releasePointerCapture(m.pointerId),i(m))})})}),o2="SliderTrack",l2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=ip(o2,n);return s.jsx(bt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});l2.displayName=o2;var gg="SliderRange",c2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=ip(gg,n),i=a2(gg,n),o=b.useRef(null),c=Ht(e,o),u=a.values.length,h=a.values.map(x=>h2(x,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(bt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});c2.displayName=gg;var yg="SliderThumb",d2=b.forwardRef((t,e)=>{const n=YP(t.__scopeSlider),[r,a]=b.useState(null),i=Ht(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(n8,{...t,ref:i,index:o})}),n8=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=ip(yg,n),c=a2(yg,n),[u,h]=b.useState(null),f=Ht(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,x=A0(u),y=o.values[r],N=y===void 0?0:h2(y,o.min,o.max),w=a8(r,o.values.length),j=x==null?void 0:x[c.size],S=j?o8(j,N,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${N}% + ${S}px)`},children:[s.jsx(xg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(bt.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:mt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(u2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});d2.displayName=yg;var s8="RadioBubbleInput",u2=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=Ht(a,r),o=M0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(bt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});u2.displayName=s8;function r8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function h2(t,e,n){const i=100/(n-e)*(t-e);return tf(i,[0,100])}function a8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function i8(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),r=Math.min(...n);return n.indexOf(r)}function o8(t,e,n){const r=t/2,i=R0([0,50],[0,r]);return(r-i(e)*n)*n}function l8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function c8(t,e){if(e>0){const n=l8(t);return Math.min(...n)>=e}return!0}function R0(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function d8(t){return(String(t).split(".")[1]||"").length}function u8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var h8=s2,f8=l2,p8=c2,m8=d2;function x8({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(h8,{defaultValue:e,value:n,min:r,max:a,className:Ut("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(f8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(p8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(m8,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},u))]})}const g8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function f2(t){const e=!!(t!=null&&t.embedded),[n,r]=b.useState(g8),[a,i]=b.useState(!0),[o,c]=b.useState(!1);b.useEffect(()=>{Pe("/api/admin/referral-settings").then(f=>{const m=f==null?void 0:f.data;m&&typeof m=="object"&&r({distributorShare:m.distributorShare??90,minWithdrawAmount:m.minWithdrawAmount??10,bindingDays:m.bindingDays??30,userDiscount:m.userDiscount??5,withdrawFee:m.withdrawFee??5,enableAutoWithdraw:m.enableAutoWithdraw??!1,vipOrderShareVip:m.vipOrderShareVip??20,vipOrderShareNonVip:m.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const u=async()=>{c(!0);try{const f={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,withdrawFee:Number(n.withdrawFee)??5,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},m=await Ct("/api/admin/referral-settings",f);if(!m||m.success===!1){se.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}se.success(`✅ 分销配置已保存成功!
+`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function JP(){const[t,e]=b.useState({}),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useCallback(async()=>{r(!0);try{const x=await Pe("/api/admin/mbti-avatars");x!=null&&x.avatars?e(x.avatars):e({})}catch{se.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);b.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const x=await Ct("/api/admin/mbti-avatars",{avatars:t});if(!x||x.success===!1){se.error((x==null?void 0:x.error)||"保存失败");return}se.success("已保存,后台与小程序默认头像同步生效"),u()}catch{se.error("保存失败")}finally{i(!1)}},f=x=>{const y=O1(x);e(N=>({...N,[x]:y})),se.success(`${x} 已生成`)},m=()=>{c(!0);try{const x={...t};P1.forEach(y=>{x[y]=O1(y)}),e(x),se.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(Fe,{className:"w-5 h-5 mr-2 animate-spin text-[#38bdac]"}),"加载配置…"]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(rt,{className:"pb-2",children:[s.jsxs(at,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(nA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(Kt,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(Le,{className:"flex flex-wrap gap-2",children:[s.jsxs(X,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396]",onClick:m,disabled:o,children:[s.jsx(SA,{className:"w-3.5 h-3.5 mr-1"}),o?"生成中…":"一键生成16头像"]}),s.jsxs(X,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-300",onClick:u,children:[s.jsx(Fe,{className:"w-3.5 h-3.5 mr-1"}),"重新加载"]}),s.jsxs(X,{type:"button",size:"sm",className:"bg-emerald-600 hover:bg-emerald-500",onClick:h,disabled:a,children:[s.jsx(bn,{className:"w-3.5 h-3.5 mr-1"}),a?"保存中…":"保存映射"]})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:P1.map(x=>{const y=t[x]??"",N=Xk[x];return s.jsxs("div",{className:"rounded-xl border border-gray-700/60 bg-[#0a1628] p-3 flex flex-col gap-2 hover:border-[#38bdac]/35 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ve,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 font-mono text-xs",children:x}),s.jsx("span",{className:"text-xs text-gray-400 truncate",title:N.title,children:N.title})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full shrink-0 overflow-hidden flex items-center justify-center bg-[#081322] ring-2 ring-[#38bdac]/40 ring-offset-2 ring-offset-[#0a1628]",children:y?s.jsx("img",{src:y,alt:x,className:"w-full h-full object-cover scale-110"}):s.jsx("span",{className:"text-gray-600 text-[10px]",children:"未配"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:y,onChange:w=>e(j=>({...j,[x]:w.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(X,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(x),children:"生成这张"}),s.jsx(X,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(w=>({...w,[x]:""})),children:"清空"})]})]},x)})})]})}const L1=[{value:"after_login",label:"注册/登录成功",group:"用户状态"},{value:"bind_phone",label:"绑定手机号",group:"用户状态"},{value:"update_avatar",label:"完善头像(非默认图,与昵称分开配置)",group:"用户状态"},{value:"update_nickname",label:"修改昵称(非默认微信昵称,与头像分开)",group:"用户状态"},{value:"fill_profile",label:"完善资料(MBTI/行业/职位,不含头像昵称)",group:"用户状态"},{value:"view_chapter",label:"浏览章节",group:"阅读行为"},{value:"browse_5_chapters",label:"累计浏览5个章节",group:"阅读行为"},{value:"purchase_section",label:"购买单章",group:"付费行为"},{value:"purchase_fullbook",label:"购买全书/VIP",group:"付费行为"},{value:"after_pay",label:"任意付款成功",group:"付费行为"},{value:"after_match",label:"完成派对匹配",group:"社交行为"},{value:"click_super_individual",label:"点击超级个体头像",group:"社交行为"},{value:"lead_submit",label:"提交留资/链接",group:"社交行为"},{value:"referral_bind",label:"被推荐人绑定",group:"分销行为"},{value:"share_action",label:"分享给好友/朋友圈",group:"分销行为"},{value:"withdraw_request",label:"申请提现",group:"分销行为"},{value:"add_wechat",label:"添加微信联系方式",group:"用户状态"}],D1=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function Zk(t){if(Array.isArray(t))return t.filter(e=>typeof e=="string");if(typeof t=="string")try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter(n=>typeof n=="string")}catch{try{const e=typeof atob=="function"?atob(t):"",n=JSON.parse(e);if(Array.isArray(n))return n.filter(r=>typeof r=="string")}catch{}}return[]}function QP(t){return{...t,triggerConditions:Zk(t.triggerConditions)}}const YP=[{level:"S",range:"≥85",label:"高价值"},{level:"A",range:"70–84",label:"优质"},{level:"B",range:"50–69",label:"中等"},{level:"C",range:"30–49",label:"潜力"},{level:"D",range:"<30",label:"待激活"}],tc=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function _1(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function XP(){var Ei,zr,Mi,Va,Ha,$r,da;const[t,e]=x0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",[i,o]=b.useState([]),[c,u]=b.useState(0),[h,f]=b.useState(1),[m,x]=b.useState(10),[y,N]=b.useState(""),w=ef(y,300),j=n==="vip"?"vip":n==="complete"?"complete":"all",[S,E]=b.useState(j),[T,P]=b.useState(!0),[O,q]=b.useState(!1),[z,V]=b.useState(null),[I,te]=b.useState(!1),[Q,F]=b.useState(!1),[re,ie]=b.useState("desc");b.useEffect(()=>{n==="vip"?E("vip"):n==="complete"?E("complete"):n==="all"&&E("all")},[n]);const[J,$]=b.useState(!1),[D,R]=b.useState(null),[oe,G]=b.useState(!1),[_,U]=b.useState(!1),[H,K]=b.useState({referrals:[],stats:{}}),[me,Y]=b.useState(!1),[le,de]=b.useState(null),[ve,ye]=b.useState(!1),[ke,ze]=b.useState(null),[ft,wt]=b.useState(!1),[dt,Rt]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Tt,Tn]=b.useState([]),[mn,Ft]=b.useState(!1),[qt,vn]=b.useState(!1),[On,$n]=b.useState(null),[St,cn]=b.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[xn,ge]=b.useState([]),[Se,$e]=b.useState(!1),[Xe,jt]=b.useState(null),[gt,L]=b.useState(null),[Me,pt]=b.useState({}),[Et,ht]=b.useState(!1),[tt,Pt]=b.useState(null),[Wt,en]=b.useState([]),[ts,Qs]=b.useState(!1),[bi,ea]=b.useState(null),[ta,Er]=b.useState(""),[Mr,Ar]=b.useState([]),[cr,dr]=b.useState(!1),[Ea,Ys]=b.useState({}),[Ss,Xs]=b.useState([]),[ur,Cs]=b.useState(0),[ae,xe]=b.useState(1),[Ue]=b.useState(20),[ut,Fn]=b.useState(!1),[Ps,Ma]=b.useState(null),[Aa,To]=b.useState(""),Zs=ef(Aa,300),[Ts,vi]=b.useState(""),[Mt,Bc]=b.useState({}),Ir=b.useCallback(async(v,A)=>{Fn(!0),Ma(null);try{const B=new URLSearchParams({mode:"contact",page:String(ae),pageSize:String(Ue)}),ue=v??Zs;ue&&B.set("search",ue);const Ne=A??Ts;Ne&&B.set("source",Ne);const De=await Pe(`/api/db/ckb-leads?${B}`);if(De!=null&&De.success)Xs(De.records||[]),Cs(De.total??0),De.stats&&Bc(De.stats);else{const it=(De==null?void 0:De.error)||"加载获客列表失败";Ma(it),se.error(it),Xs([]),Cs(0)}}catch(B){const ue=B instanceof Error?B.message:"网络错误";Ma(ue),se.error("加载获客列表失败: "+ue),Xs([]),Cs(0)}finally{Fn(!1)}},[ae,Ue,Zs,Ts]),Ni=b.useCallback(async()=>{try{const v=await Pe("/api/admin/mbti-avatars"),A=v!=null&&v.avatars&&typeof v.avatars=="object"?v.avatars:{};Ys(A)}catch{Ys({})}},[]);b.useEffect(()=>{t.get("tab")==="leads"&&Ir()},[t.get("tab"),ae,Ir]),b.useEffect(()=>{Ni()},[Ni]);const Rr=b.useCallback((v,A)=>{const B=(v||"").trim();if(B)return B;const ue=(A||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(ue)?(Ea[ue]||"").trim():""},[Ea]),Vc=b.useCallback(v=>{const A=!!v.hasFullBook,B=Number(v.purchasedSectionCount||0);return A?{tone:"vip",main:"已购全书",sub:B>0?`另购单章 ${B} 章`:"购买项:VIP / 全书"}:B>0?{tone:"paid",main:`已购 ${B} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[Ia,na]=b.useState(null),ns=b.useCallback(async()=>{try{const v=await Pe("/api/admin/users/online-stats");v!=null&&v.success&&typeof v.onlineCount=="number"?na(v.onlineCount):na(0)}catch{na(null)}},[]);b.useEffect(()=>{ns();const v=setInterval(ns,1e4);return()=>clearInterval(v)},[ns]);async function sa(v=!1){var A;P(!0),v&&q(!0),V(null);try{if(I){const B=new URLSearchParams({search:w,limit:String(m*5)}),ue=await Pe(`/api/db/users/rfm?${B}`);if(ue!=null&&ue.success){let Ne=ue.users||[];re==="asc"&&(Ne=[...Ne].reverse());const De=(h-1)*m;o(Ne.slice(De,De+m)),u(((A=ue.users)==null?void 0:A.length)??0),Ne.length===0&&(te(!1),V("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else te(!1),V((ue==null?void 0:ue.error)||"RFM 加载失败,已切回普通模式")}else{const B=new URLSearchParams({page:String(h),pageSize:String(m),search:w,...S==="vip"&&{vip:"true"},...S==="complete"&&{pool:"complete"}}),ue=await Pe(`/api/db/users?${B}`);ue!=null&&ue.success?(o(ue.users||[]),u(ue.total??0)):V((ue==null?void 0:ue.error)||"加载失败")}}catch(B){console.error("Load users error:",B),V("网络错误")}finally{P(!1),v&&q(!1)}}b.useEffect(()=>{f(1)},[w,S,I]),b.useEffect(()=>{sa()},[h,m,w,S,I,re]);const qn=Math.ceil(c/m)||1,Cl=()=>{I?re==="desc"?ie("asc"):(te(!1),ie("desc")):(te(!0),ie("desc"))},Pr=v=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[v||""]||"bg-gray-500/20 text-gray-400";async function Hc(v){var A;if(!_1("用户")){se.info("已取消删除");return}try{const B=await li(`/api/db/users?id=${encodeURIComponent(v)}`);B!=null&&B.success?(se.success("已删除"),sa()):se.error("删除失败: "+((B==null?void 0:B.error)||"未知错误"))}catch(B){const ue=B,Ne=((A=ue==null?void 0:ue.data)==null?void 0:A.error)||(ue==null?void 0:ue.message)||"网络错误";se.error("删除失败: "+Ne)}}const wi=v=>{R(v),Rt({phone:v.phone||"",nickname:v.nickname||"",password:"",isAdmin:!!(v.isAdmin??!1),hasFullBook:!!(v.hasFullBook??!1)}),$(!0)},Ra=()=>{R(null),Rt({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),$(!0)};async function ra(){if(!dt.phone||!dt.nickname){se.error("请填写手机号和昵称");return}G(!0);try{if(D){const v=await Gt("/api/db/users",{id:D.id,phone:dt.phone||void 0,nickname:dt.nickname,isAdmin:dt.isAdmin,hasFullBook:dt.hasFullBook,...dt.password&&{password:dt.password}});if(!(v!=null&&v.success)){se.error("更新失败: "+((v==null?void 0:v.error)||""));return}}else{const v=await Ct("/api/db/users",{phone:dt.phone,nickname:dt.nickname,password:dt.password,isAdmin:dt.isAdmin});if(!(v!=null&&v.success)){se.error("创建失败: "+((v==null?void 0:v.error)||""));return}}$(!1),sa()}catch{se.error("保存失败")}finally{G(!1)}}async function aa(v){de(v),U(!0),Y(!0);try{const A=await Pe(`/api/db/users/referrals?userId=${encodeURIComponent(v.id)}`);A!=null&&A.success?K({referrals:A.referrals||[],stats:A.stats||{}}):K({referrals:[],stats:{}})}catch{K({referrals:[],stats:{}})}finally{Y(!1)}}const ia=b.useCallback(async()=>{Ft(!0);try{const v=await Pe("/api/db/user-rules");v!=null&&v.success&&Tn((v.rules||[]).map(A=>QP(A)))}catch{}finally{Ft(!1)}},[]);async function ji(){if(!St.title){se.error("请填写规则标题");return}G(!0);try{if(On){const v=await Gt("/api/db/user-rules",{id:On.id,...St});if(!(v!=null&&v.success)){se.error("更新失败: "+((v==null?void 0:v.error)||""));return}}else{const v=await Ct("/api/db/user-rules",St);if(!(v!=null&&v.success)){se.error("创建失败: "+((v==null?void 0:v.error)||""));return}}vn(!1),ia()}catch{se.error("保存失败")}finally{G(!1)}}async function ki(v){if(!_1("规则")){se.info("已取消删除");return}try{const A=await li(`/api/db/user-rules?id=${v}`);A!=null&&A.success&&ia()}catch{}}async function Eo(v){try{await Gt("/api/db/user-rules",{id:v.id,enabled:!v.enabled}),ia()}catch{}}const Os=b.useCallback(async()=>{$e(!0);try{const v=await Pe("/api/db/vip-members?limit=500");if(v!=null&&v.success&&v.data){const A=[...v.data].map((B,ue)=>({...B,vipSort:typeof B.vipSort=="number"?B.vipSort:ue+1}));A.sort((B,ue)=>(B.vipSort??999999)-(ue.vipSort??999999)),ge(A)}else v&&v.error&&se.error(v.error)}catch{se.error("加载超级个体列表失败")}finally{$e(!1)}},[]),[En,Pa]=b.useState(!1),[Ls,kt]=b.useState(null),[oa,Ln]=b.useState(""),[hr,Mo]=b.useState(!1),[Tl,Oa]=b.useState(!1),[fr,la]=b.useState(null),[Ds,Bn]=b.useState(""),[Vn,Or]=b.useState(!1),ca=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],ps=v=>{kt(v),Ln(v.vipRole||""),Pa(!0)},La=v=>{la(v),Bn((v.webhookUrl||"").trim()),Oa(!0)},Da=async v=>{const A=v.trim();if(Ls){if(!A){se.error("请选择或输入标签");return}Mo(!0);try{const B=await Gt("/api/db/users",{id:Ls.id,vipRole:A});if(!(B!=null&&B.success)){se.error((B==null?void 0:B.error)||"更新超级个体标签失败");return}se.success("已更新超级个体标签"),Pa(!1),kt(null),await Os()}catch{se.error("更新超级个体标签失败")}finally{Mo(!1)}}},_a=async()=>{if(!fr)return;const v=Ds.trim();if(v&&!/^https?:\/\//i.test(v)){se.error("Webhook 地址需以 http/https 开头");return}Or(!0);try{const A=await Gt("/api/db/vip-members/webhook",{userId:fr.id,webhookUrl:v});if(!(A!=null&&A.success)){se.error((A==null?void 0:A.error)||"保存飞书群 Webhook 失败");return}se.success(v?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),Oa(!1),la(null),await Os()}catch{se.error("保存飞书群 Webhook 失败")}finally{Or(!1)}},[za,_s]=b.useState(!1),[er,zs]=b.useState(null),[El,Lr]=b.useState(""),[Dr,pr]=b.useState(!1),$a=v=>{zs(v),Lr(v.vipSort!=null?String(v.vipSort):""),_s(!0)},Uc=async()=>{if(!er)return;const v=Number(El);if(!Number.isFinite(v)){se.error("请输入有效的数字序号");return}pr(!0);try{const A=await Gt("/api/db/users",{id:er.id,vipSort:v});if(!(A!=null&&A.success)){se.error((A==null?void 0:A.error)||"更新排序序号失败");return}se.success("已更新排序序号"),_s(!1),zs(null),await Os()}catch{se.error("更新排序序号失败")}finally{pr(!1)}},Ml=(v,A)=>{v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("text/plain",A),jt(A)},Fa=(v,A)=>{v.preventDefault(),gt!==A&&L(A)},Si=()=>{jt(null),L(null)},Ao=async(v,A)=>{v.preventDefault();const B=v.dataTransfer.getData("text/plain")||Xe;if(jt(null),L(null),!B||B===A)return;const ue=xn.find(Je=>Je.id===B),Ne=xn.find(Je=>Je.id===A);if(!ue||!Ne)return;const De=ue.vipSort??xn.findIndex(Je=>Je.id===B)+1,it=Ne.vipSort??xn.findIndex(Je=>Je.id===A)+1;ge(Je=>{const vt=[...Je],At=vt.findIndex(Wc=>Wc.id===B),dn=vt.findIndex(Wc=>Wc.id===A);if(At===-1||dn===-1)return Je;const un=[...vt],[Al,Ap]=[un[At],un[dn]];return un[At]={...Ap,vipSort:De},un[dn]={...Al,vipSort:it},un});try{const[Je,vt]=await Promise.all([Gt("/api/db/users",{id:B,vipSort:it}),Gt("/api/db/users",{id:A,vipSort:De})]);if(!(Je!=null&&Je.success)||!(vt!=null&&vt.success)){se.error((Je==null?void 0:Je.error)||(vt==null?void 0:vt.error)||"更新排序失败"),await Os();return}se.success("已更新排序"),await Os()}catch{se.error("更新排序失败"),await Os()}},Io=b.useCallback(async()=>{ht(!0);try{const v=await Pe("/api/db/users/journey-stats");v!=null&&v.success&&v.stats&&pt(v.stats)}catch{}finally{ht(!1)}},[]),mr=b.useCallback(async v=>{Pt(v),Qs(!0);try{const A=await Pe(`/api/db/users/journey-users?stage=${v}&limit=50`);A!=null&&A.success&&A.users&&en(A.users)}catch{}finally{Qs(!1)}},[]),Ro=b.useCallback(async(v,A)=>{ea(v),Er(A),dr(!0);try{const B=await Pe(`/api/db/users/tracks?userId=${v}&limit=50`);B!=null&&B.success&&B.tracks&&Ar(B.tracks)}catch{}finally{dr(!1)}},[]),[Ba,Po]=b.useState(!1),Ci=async()=>{Po(!0);try{const v=await Ct("/api/admin/shensheshou/batch-enrich",{limit:20});v!=null&&v.success?(se.success(`批量补全完成:${v.enriched} 人已补全,${v.skipped} 人跳过`),sa()):se.error((v==null?void 0:v.error)||"批量补全失败")}catch{se.error("批量补全请求失败")}finally{Po(!1)}},Ti=v=>{const A=[v.phone,v.nickname,v.avatar,v.wechatId,v.mbti,v.industry,v.region,v.position],B=A.filter(ue=>ue!=null&&ue!=="").length;return Math.round(B/A.length*100)},{leadsRows:Oo,leadsRawCount:ss,leadsDeduped:_r}=b.useMemo(()=>{const v=Je=>(Je||"").replace(/\D/g,"")||"",A=Je=>{const vt=v(Je.phone);if(vt)return`phone:${vt}`;const At=(Je.userId||"").trim();if(At)return`user:${At}`;const dn=(Je.wechatId||"").trim();return dn?`wechat:${dn}`:`row:${Je.id}`},B=Zs.trim().toLowerCase();let ue=Ss;B&&(ue=Ss.filter(Je=>[Je.userNickname,Je.name,Je.phone,Je.wechatId,Je.personName,Je.source,String(Je.ckbPlanId??"")].filter(Boolean).join(" ").toLowerCase().includes(B)));const Ne=[...ue].sort((Je,vt)=>{const At=Je.createdAt?new Date(Je.createdAt).getTime():0;return(vt.createdAt?new Date(vt.createdAt).getTime():0)-At}),De=new Set,it=[];for(const Je of Ne){const vt=A(Je);De.has(vt)||(De.add(vt),it.push(Je))}return{leadsRows:it,leadsRawCount:ue.length,leadsDeduped:ue.length-it.length}},[Ss,Zs]);return s.jsxs("div",{className:"p-8 w-full",children:[z&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:z}),s.jsx("button",{type:"button",onClick:()=>V(null),children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",c," 位注册用户",Ia!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",Ia," 人"]}),I&&" · RFM 排序中"]})]}),s.jsx(Oe,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(Le,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>F(v=>!v),className:"flex items-center gap-2 min-w-0 flex-1 text-left rounded-lg px-1 py-0.5 hover:bg-white/5 transition-colors","aria-expanded":Q,children:[s.jsx(Gh,{className:"w-5 h-5 text-[#38bdac] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-semibold text-white",children:"算法配置"}),s.jsx("div",{className:"text-xs text-gray-500 truncate",children:Q?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),Q?s.jsx(ag,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(vc,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(X,{type:"button",variant:"outline",size:"sm",onClick:Cl,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:I?re==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),Q&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["综合分 0–100(六维度):最近消费 R(25%)+ 订单频次 F(20%)+ 累计金额 M(20%)+ 推荐人数(15%)+ 行为轨迹(10%)+ 资料完善(10%)。各维度在全量用户中归一化,与后端"," ",s.jsx("code",{className:"text-gray-500",children:"/api/db/users/rfm"})," 一致。"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:YP.map(({level:v,range:A,label:B})=>s.jsxs(Ve,{variant:"outline",className:`text-[10px] border-0 ${Pr(v)}`,children:[v," ",A," · ",B]},v))})]})]})})]}),s.jsxs(jc,{value:a,onValueChange:v=>{const A=new URLSearchParams(t);v==="users"?A.delete("tab"):A.set("tab",v),e(A)},className:"w-full",children:[s.jsxs(ul,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(Qt,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(In,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(Qt,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>Ir(),children:[s.jsx(hc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(Qt,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Io,children:[s.jsx(qr,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(Qt,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ia,children:[s.jsx(no,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(Qt,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Os,children:[s.jsx(pc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(Yt,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(X,{variant:"outline",onClick:Ci,disabled:Ba,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[Ba?s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(pi,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(X,{variant:"outline",onClick:()=>sa(!0),disabled:O,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${O?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:S,onChange:v=>{const A=v.target.value;E(A),f(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:I,children:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:y,onChange:v=>N(v.target.value)})]}),s.jsxs(X,{onClick:Ra,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(hc,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:T?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"用户信息"}),s.jsx(je,{className:"text-gray-400",children:"绑定信息"}),s.jsx(je,{className:"text-gray-400",children:"购买状态"}),s.jsx(je,{className:"text-gray-400",children:"分销收益"}),s.jsxs(je,{className:"text-gray-400 cursor-pointer select-none",onClick:Cl,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Gh,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),I?re==="desc"?s.jsx(vc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(ag,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(rx,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),I&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(je,{className:"text-gray-400",children:"资料完善"}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(hs,{children:[i.map(v=>{var A,B,ue;return s.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var it;const Ne=Rr(v.avatar,v.mbti),De=((it=v.nickname)==null?void 0:it.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>wt(!0),className:"w-10 h-10 shrink-0 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] overflow-hidden ring-1 ring-transparent hover:ring-[#38bdac]/60 transition",children:Ne?s.jsx("img",{src:Ne,className:"w-full h-full rounded-full object-cover",alt:"",onError:Je=>{var dn;const vt=Je.target;if(vt.style.display="none",vt.nextElementSibling)return;const At=document.createElement("span");At.textContent=De,(dn=vt.parentElement)==null||dn.appendChild(At)}}):De})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{ze(v.id),ye(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:v.nickname}),v.isAdmin&&s.jsx(Ve,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),v.openId&&!((A=v.id)!=null&&A.startsWith("user_"))&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate max-w-[140px]",title:v.id,children:[(B=v.id)==null?void 0:B.slice(0,16),(((ue=v.id)==null?void 0:ue.length)??0)>16?"…":""]})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[v.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:v.phone})]}),v.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:v.wechatId})]}),!v.phone&&!v.wechatId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(be,{children:(()=>{const Ne=Vc(v);return Ne.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Ve,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:Ne.main}),Ne.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:Ne.sub})]}):Ne.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Ve,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:Ne.main}),Ne.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:Ne.sub})]}):s.jsx(Ve,{variant:"outline",className:"text-gray-500 border-gray-600",children:Ne.main})})()}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(v.earnings||0)).toFixed(2)]}),parseFloat(String(v.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(v.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>aa(v),role:"button",tabIndex:0,onKeyDown:Ne=>Ne.key==="Enter"&&aa(v),children:[s.jsx(In,{className:"w-3 h-3"})," 绑定",v.referralCount||0,"人"]})]})}),s.jsx(be,{children:v.rfmScore!=null&&v.rfmScore!==void 0?s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:v.rfmScore}),s.jsx(Ve,{className:`border-0 text-xs ${Pr(v.rfmLevel)}`,children:v.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(be,{children:(()=>{const Ne=Ti(v),De=Ne>=75?"text-green-400":Ne>=50?"text-yellow-400":"text-gray-500";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-12 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full ${Ne>=75?"bg-green-500":Ne>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${Ne}%`}})}),s.jsxs("span",{className:`text-xs ${De}`,children:[Ne,"%"]})]})})()}),s.jsx(be,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleDateString():"-"}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>{ze(v.id),ye(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(qh,{className:"w-4 h-4"})}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>wi(v),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(Jt,{className:"w-4 h-4"})}),s.jsx(X,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Hc(v.id),title:"删除",children:s.jsx(bs,{className:"w-4 h-4"})})]})})]},v.id)}),i.length===0&&s.jsx(ct,{children:s.jsx(be,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(qs,{page:h,totalPages:qn,total:c,pageSize:m,onPageChange:f,onPageSizeChange:v=>{x(v),f(1)}})]})})})]}),s.jsxs(Yt,{value:"leads",children:[Ps&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:Ps}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Ma(null),"aria-label":"关闭",children:"×"})]}),!ut&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"总留资条数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:ur})]}),s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"去重用户数(按 userId)"}),s.jsx("p",{className:"text-xl font-bold text-[#38bdac]",title:"后端 COUNT(DISTINCT user_id)",children:Mt.uniqueUsers??0})]}),(Mt.sourceStats&&Mt.sourceStats.length>0?Mt.sourceStats.slice(0,2):[]).map(v=>s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsxs("p",{className:"text-gray-500 text-xs",children:["来源:",v.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:v.cnt})]},v.source))]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 min-w-[200px]",children:[s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{placeholder:"搜索昵称/手机/微信/@人/来源…",value:Aa,onChange:v=>To(v.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),Mt.sourceStats&&Mt.sourceStats.length>0&&s.jsxs("select",{value:Ts,onChange:v=>{vi(v.target.value),xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),Mt.sourceStats.map(v=>s.jsxs("option",{value:v.source,children:[v.source,"(",v.cnt,")"]},v.source))]}),s.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap max-w-[min(100%,20rem)]",title:"同一页内:相同手机号或相同用户 ID(含微信侧标识)只保留最近一条",children:["本页 ",ss," 条",_r>0?` · 已合并 ${_r} 条重复`:""]})]}),s.jsxs(X,{variant:"outline",onClick:()=>Ir(),disabled:ut,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${ut?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:ut?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"昵称"}),s.jsx(je,{className:"text-gray-400",children:"手机号"}),s.jsx(je,{className:"text-gray-400",children:"微信号"}),s.jsx(je,{className:"text-gray-400",children:"对应 @人"}),s.jsx(je,{className:"text-gray-400",children:"获客计划"}),s.jsx(je,{className:"text-gray-400",children:"来源"}),s.jsx(je,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(hs,{children:[Oo.map(v=>s.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:v.userNickname||v.name||"-"}),s.jsx(be,{className:"text-gray-300",children:v.phone||"-"}),s.jsx(be,{className:"text-gray-300",children:v.wechatId||"-"}),s.jsx(be,{className:"text-[#38bdac]",children:v.personName||"-"}),s.jsx(be,{className:"text-gray-400",children:v.ckbPlanId?`#${v.ckbPlanId}`:"-"}),s.jsx(be,{children:s.jsx(Ve,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:v.source||"未知"})}),s.jsx(be,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),Oo.length===0&&s.jsx(ct,{children:s.jsx(be,{colSpan:7,className:"p-0 align-top",children:s.jsxs("div",{className:"py-16 px-6 text-center border-t border-gray-700/40 bg-[#0a1628]/30",children:[s.jsx(hc,{className:"w-14 h-14 text-[#38bdac]/20 mx-auto mb-4","aria-hidden":!0}),s.jsx("p",{className:"text-gray-200 font-medium mb-1",children:"暂无获客线索"}),s.jsx("p",{className:"text-gray-500 text-sm mb-6 max-w-md mx-auto leading-relaxed",children:Zs.trim()||Ts?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>Ir(),disabled:ut,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${ut?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(qs,{page:ae,totalPages:Math.ceil(ur/Ue)||1,total:ur,pageSize:Ue,onPageChange:xe,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(Yt,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(X,{variant:"outline",onClick:Io,disabled:Et,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${Et?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:tc.map((v,A)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${v.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${tt===v.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>mr(v.id),title:`点击查看「${v.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:v.icon}),s.jsx("div",{className:`text-xs font-medium ${v.color.split(" ").find(B=>B.startsWith("text-"))}`,children:v.label}),Me[v.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Me[v.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:A+1})]}),As.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:v.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:v.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",v.next]})]})]},v.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Gs,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),Et?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Me).length>0?s.jsx("div",{className:"space-y-2",children:tc.map(v=>{const A=Me[v.id]||0,B=Math.max(...tc.map(Ne=>Me[Ne.id]||0),1),ue=Math.round(A/B*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[v.icon," ",v.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${ue}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:A})]},v.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),tt&&s.jsxs("div",{className:"mt-6 bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(In,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(Ei=tc.find(v=>v.id===tt))==null?void 0:Ei.icon," ",(zr=tc.find(v=>v.id===tt))==null?void 0:zr.label," 阶段用户"]}),s.jsxs(Ve,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Wt.length," 人"]})]}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>Pt(null),className:"text-gray-400 hover:text-white",children:s.jsx(Yn,{className:"w-4 h-4"})})]}),ts?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Wt.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"border-gray-700",children:[s.jsx(je,{className:"text-gray-400",children:"昵称"}),s.jsx(je,{className:"text-gray-400",children:"手机号"}),s.jsx(je,{className:"text-gray-400",children:"注册时间"}),s.jsx(je,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsx(hs,{children:Wt.map(v=>s.jsxs(ct,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(be,{className:"text-white",children:v.nickname||"微信用户"}),s.jsx(be,{className:"text-gray-300",children:v.phone||"-"}),s.jsx(be,{className:"text-gray-400 text-xs",children:v.createdAt?new Date(v.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(be,{className:"text-right",children:s.jsxs(X,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>Ro(v.id,v.nickname||"微信用户"),children:[s.jsx(qh,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},v.id))})]})]}),s.jsx(Dt,{open:!!bi,onOpenChange:v=>{v||ea(null)},children:s.jsxs(Lt,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(qr,{className:"w-5 h-5 text-[#38bdac]"}),ta," 的行为轨迹"]})}),cr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Mr.length===0?s.jsx("p",{className:"text-gray-500 text-center py-8",children:"该用户暂无行为记录"}):s.jsxs("div",{className:"relative pl-6 space-y-0",children:[s.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-0.5 bg-gray-700"}),Mr.map((v,A)=>s.jsxs("div",{className:"relative flex items-start gap-3 py-2",children:[s.jsx("div",{className:"absolute left-[-13px] top-3 w-2.5 h-2.5 rounded-full bg-[#38bdac] border-2 border-[#0f2137] z-10"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-white text-sm font-medium",children:v.actionLabel}),v.module&&s.jsx(Ve,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:v.module})]}),(v.chapterTitle||v.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:v.chapterTitle||v.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[v.timeAgo," · ",v.createdAt?new Date(v.createdAt).toLocaleString("zh-CN"):""]})]})]},v.id||A))]})]})})]}),s.jsxs(Yt,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程触达规则:各行为节点的触发条件与展示文案(偏利他说明,少用命令式)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(X,{variant:"outline",onClick:ia,disabled:mn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${mn?"animate-spin":""}`})," 刷新"]}),s.jsxs(X,{onClick:()=>{$n(null),cn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),vn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(An,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),mn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Tt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Gs,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(X,{onClick:ia,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fe,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Tt.map(v=>{var B;const A=Zk(v.triggerConditions);return s.jsxs("div",{className:`p-3 rounded-lg border transition-all ${v.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[s.jsxs("span",{className:"text-gray-600 text-xs font-mono w-5 shrink-0 text-right",children:["#",v.sort]}),s.jsx(Jt,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:v.title}),v.trigger&&s.jsx(Ve,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:v.trigger}),A.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[A.slice(0,3).map(ue=>{const Ne=L1.find(De=>De.value===ue);return s.jsx(Ve,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(Ne==null?void 0:Ne.label)||ue},ue)}),A.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",A.length-3]})]}),v.actionType&&v.actionType!=="popup"&&s.jsx(Ve,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((B=D1.find(ue=>ue.value===v.actionType))==null?void 0:B.label)||v.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx($t,{checked:v.enabled,onCheckedChange:()=>Eo(v)}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>{$n(v),cn({title:v.title,description:v.description,trigger:v.trigger,triggerConditions:A,actionType:v.actionType||"popup",sort:v.sort,enabled:v.enabled}),vn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(Jt,{className:"w-3.5 h-3.5"})}),s.jsx(X,{variant:"ghost",size:"sm",onClick:()=>ki(v.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(bs,{className:"w-3.5 h-3.5"})})]})]}),v.description&&s.jsxs("details",{className:"ml-[52px] mt-1",children:[s.jsxs("summary",{className:"text-gray-500 text-xs cursor-pointer hover:text-gray-400 select-none",children:["查看完整描述",s.jsxs("span",{className:"text-gray-600 ml-1",children:["(",v.description.length," 字,默认折叠)"]})]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1 pl-1 border-l-2 border-gray-700 whitespace-pre-wrap",children:v.description})]})]},v.id)})})]}),s.jsxs(Yt,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(X,{variant:"outline",onClick:Os,disabled:Se,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${Se?"animate-spin":""}`})," ","刷新"]})})]}),Se?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):xn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(pc,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:s.jsxs(ds,{children:[s.jsx(us,{children:s.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(je,{className:"text-gray-400 w-12",children:"序号"}),s.jsx(je,{className:"text-gray-400",children:"成员"}),s.jsx(je,{className:"text-gray-400 min-w-40",children:"超级个体标签"}),s.jsx(je,{className:"text-gray-400 w-16 text-center",children:"头像点击"}),s.jsx(je,{className:"text-gray-400 w-16 text-center",children:"获客数"}),s.jsx(je,{className:"text-gray-400 w-20",children:"排序值"}),s.jsx(je,{className:"text-gray-400 w-36",children:"飞书群"}),s.jsx(je,{className:"text-gray-400 w-36 text-right",children:"操作"})]})}),s.jsx(hs,{children:xn.map((v,A)=>{var Ne;const B=Xe===v.id,ue=gt===v.id;return s.jsxs(ct,{draggable:!0,onDragStart:De=>Ml(De,v.id),onDragOver:De=>Fa(De,v.id),onDrop:De=>Ao(De,v.id),onDragEnd:Si,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${B?"opacity-60":""} ${ue?"bg-[#38bdac]/10":""}`,children:[s.jsx(be,{className:"text-gray-300",children:A+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[Rr(v.avatar,v.mbti)?s.jsx("img",{src:Rr(v.avatar,v.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:De=>{var Je,vt;De.target.style.display="none";const it=document.createElement("div");it.className="w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",it.textContent=((Je=v.name)==null?void 0:Je[0])||"创",(vt=De.target.parentElement)==null||vt.appendChild(it)}}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((Ne=v.name)==null?void 0:Ne[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:v.name})})]})}),s.jsx(be,{className:"text-gray-300 whitespace-nowrap",children:v.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(be,{className:"text-center text-blue-400 text-xs font-mono",children:v.clickCount!=null?String(v.clickCount):"-"}),s.jsx(be,{className:"text-center text-green-400 text-xs font-mono",children:v.leadCount!=null?String(v.leadCount):"-"}),s.jsx(be,{className:"text-gray-300",children:v.vipSort??A+1}),s.jsx(be,{className:"text-xs",children:v.webhookUrl?s.jsx("span",{className:"text-[#38bdac] truncate block max-w-[180px]",title:v.webhookUrl,children:"已配置"}):s.jsx("span",{className:"text-gray-500",children:"未配置"})}),s.jsx(be,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>ps(v),title:"设置超级个体标签",children:s.jsx(Ad,{className:"w-3.5 h-3.5"})}),s.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>La(v),title:"编辑飞书群Webhook",children:s.jsx(Jt,{className:"w-3.5 h-3.5"})}),s.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>$a(v),title:"设置排序序号",children:s.jsx(rx,{className:"w-3.5 h-3.5"})})]})})]},v.id)})})]})})})]})]}),s.jsx(Dt,{open:ft,onOpenChange:wt,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(JP,{})]})}),s.jsx(Dt,{open:za,onOpenChange:v=>{_s(v),v||zs(null)},children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(rx,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",er==null?void 0:er.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:El,onChange:v=>Lr(v.target.value)})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>_s(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:Uc,disabled:Dr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),Dr?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:En,onOpenChange:v=>{Pa(v),v||kt(null)},children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(pc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ls==null?void 0:Ls.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:ca.map(v=>s.jsx(X,{variant:oa===v?"default":"outline",size:"sm",className:oa===v?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ln(v),children:v},v))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:oa,onChange:v=>Ln(v.target.value)})]})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>Pa(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:()=>Da(oa),disabled:hr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),hr?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:Tl,onOpenChange:v=>{Oa(v),v||la(null)},children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(Jt,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",fr==null?void 0:fr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"VOX Webhook 地址(留空即清空)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",value:Ds,onChange:v=>Bn(v.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>Oa(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:_a,disabled:Vn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),Vn?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:J,onOpenChange:$,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[D?s.jsx(Jt,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(hc,{className:"w-5 h-5 text-[#38bdac]"}),D?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:dt.phone,onChange:v=>Rt({...dt,phone:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:dt.nickname,onChange:v=>Rt({...dt,nickname:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:D?"新密码 (留空则不修改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:D?"留空则不修改":"请输入密码",value:dt.password,onChange:v=>Rt({...dt,password:v.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"管理员权限"}),s.jsx($t,{checked:dt.isAdmin,onCheckedChange:v=>Rt({...dt,isAdmin:v})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"已购全书"}),s.jsx($t,{checked:dt.hasFullBook,onCheckedChange:v=>Rt({...dt,hasFullBook:v})})]})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:ra,disabled:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),oe?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:qt,onOpenChange:vn,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(Jt,{className:"w-5 h-5 text-[#38bdac]"}),On?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:St.title,onChange:v=>cn({...St,title:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则描述"}),s.jsx(hl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:St.description,onChange:v=>cn({...St,description:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(v=>{const A=L1.filter(B=>B.group===v);return A.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:v}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:A.map(B=>{const ue=(St.triggerConditions||[]).includes(B.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${ue?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const Ne=St.triggerConditions||[],De=ue?Ne.filter(it=>it!==B.value):[...Ne,B.value];cn({...St,triggerConditions:De})},children:B.label},B.value)})})]},v)})}),(St.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(St.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"兼容触发标识(旧版)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white text-xs h-8",placeholder:"与小程序一致:注册、完成付款、update_avatar、update_nickname 等",value:St.trigger,onChange:v=>cn({...St,trigger:v.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:D1.map(v=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${St.actionType===v.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>cn({...St,actionType:v.value}),children:[s.jsx("span",{className:`text-xs font-medium ${St.actionType===v.value?"text-[#38bdac]":"text-gray-300"}`,children:v.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:v.desc})]},v.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(ee,{className:"text-gray-300",children:"启用状态"})}),s.jsx($t,{checked:St.enabled,onCheckedChange:v=>cn({...St,enabled:v})})]})]}),s.jsxs(fn,{children:[s.jsxs(X,{variant:"outline",onClick:()=>vn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(X,{onClick:ji,disabled:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),oe?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:_,onOpenChange:U,children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(_t,{children:s.jsxs(zt,{className:"text-white flex items-center gap-2",children:[s.jsx(In,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",le==null?void 0:le.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((Mi=H.stats)==null?void 0:Mi.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Va=H.stats)==null?void 0:Va.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((Ha=H.stats)==null?void 0:Ha.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",((($r=H.stats)==null?void 0:$r.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),me?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((da=H.referrals)==null?void 0:da.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(H.referrals??[]).map((v,A)=>{var ue;const B=v;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((ue=B.nickname)==null?void 0:ue.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:B.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:B.phone||(B.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[B.status==="vip"&&s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),B.status==="paid"&&s.jsxs(Ve,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",B.purchasedSections,"章"]}),B.status==="free"&&s.jsx(Ve,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:B.createdAt?new Date(B.createdAt).toLocaleDateString():""})]})]},B.id||A)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(fn,{children:s.jsx(X,{variant:"outline",onClick:()=>U(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(I0,{open:ve,onClose:()=>ye(!1),userId:ke,onUserUpdated:sa})]})}function tf(t,[e,n]){return Math.min(n,Math.max(e,t))}var e2=["PageUp","PageDown"],t2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],n2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Dc="Slider",[xg,ZP,e8]=T0(Dc),[s2]=No(Dc,[e8]),[t8,ip]=s2(Dc),r2=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:x=()=>{},inverted:y=!1,form:N,...w}=t,j=b.useRef(new Set),S=b.useRef(0),T=o==="horizontal"?n8:s8,[P=[],O]=cl({prop:f,defaultProp:h,onChange:Q=>{var re;(re=[...j.current][S.current])==null||re.focus(),m(Q)}}),q=b.useRef(P);function z(Q){const F=l8(P,Q);te(Q,F)}function V(Q){te(Q,S.current)}function I(){const Q=q.current[S.current];P[S.current]!==Q&&x(P)}function te(Q,F,{commit:re}={commit:!1}){const ie=h8(i),J=f8(Math.round((Q-r)/i)*i+r,ie),$=tf(J,[r,a]);O((D=[])=>{const R=i8(D,$,F);if(u8(R,u*i)){S.current=R.indexOf($);const oe=String(R)!==String(D);return oe&&re&&x(R),oe?R:D}else return D})}return s.jsx(t8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:S,thumbs:j.current,values:P,orientation:o,form:N,children:s.jsx(xg.Provider,{scope:t.__scopeSlider,children:s.jsx(xg.Slot,{scope:t.__scopeSlider,children:s.jsx(T,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:mt(w.onPointerDown,()=>{c||(q.current=P)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:z,onSlideMove:c?void 0:V,onSlideEnd:c?void 0:I,onHomeKeyDown:()=>!c&&te(r,0,{commit:!0}),onEndKeyDown:()=>!c&&te(a,P.length-1,{commit:!0}),onStepKeyDown:({event:Q,direction:F})=>{if(!c){const J=e2.includes(Q.key)||Q.shiftKey&&t2.includes(Q.key)?10:1,$=S.current,D=P[$],R=i*J*F;te(D+R,$,{commit:!0})}}})})})})});r2.displayName=Dc;var[a2,i2]=s2(Dc,{startEdge:"left",endEdge:"right",size:"width",direction:1}),n8=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,x]=b.useState(null),y=Ht(e,T=>x(T)),N=b.useRef(void 0),w=sp(a),j=w==="ltr",S=j&&!i||!j&&i;function E(T){const P=N.current||m.getBoundingClientRect(),O=[0,P.width],z=R0(O,S?[n,r]:[r,n]);return N.current=P,z(T-P.left)}return s.jsx(a2,{scope:t.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:s.jsx(o2,{dir:w,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:T=>{const P=E(T.clientX);o==null||o(P)},onSlideMove:T=>{const P=E(T.clientX);c==null||c(P)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:T=>{const O=n2[S?"from-left":"from-right"].includes(T.key);h==null||h({event:T,direction:O?-1:1})}})})}),s8=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=Ht(e,f),x=b.useRef(void 0),y=!a;function N(w){const j=x.current||f.current.getBoundingClientRect(),S=[0,j.height],T=R0(S,y?[r,n]:[n,r]);return x.current=j,T(w-j.top)}return s.jsx(a2,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(o2,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const j=N(w.clientY);i==null||i(j)},onSlideMove:w=>{const j=N(w.clientY);o==null||o(j)},onSlideEnd:()=>{x.current=void 0,c==null||c()},onStepKeyDown:w=>{const S=n2[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:S?-1:1})}})})}),o2=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=ip(Dc,n);return s.jsx(bt.span,{...h,ref:e,onKeyDown:mt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):e2.concat(t2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:mt(t.onPointerDown,m=>{const x=m.target;x.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(x)?x.focus():r(m)}),onPointerMove:mt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:mt(t.onPointerUp,m=>{const x=m.target;x.hasPointerCapture(m.pointerId)&&(x.releasePointerCapture(m.pointerId),i(m))})})}),l2="SliderTrack",c2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=ip(l2,n);return s.jsx(bt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});c2.displayName=l2;var gg="SliderRange",d2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=ip(gg,n),i=i2(gg,n),o=b.useRef(null),c=Ht(e,o),u=a.values.length,h=a.values.map(x=>f2(x,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(bt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});d2.displayName=gg;var yg="SliderThumb",u2=b.forwardRef((t,e)=>{const n=ZP(t.__scopeSlider),[r,a]=b.useState(null),i=Ht(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(r8,{...t,ref:i,index:o})}),r8=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=ip(yg,n),c=i2(yg,n),[u,h]=b.useState(null),f=Ht(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,x=A0(u),y=o.values[r],N=y===void 0?0:f2(y,o.min,o.max),w=o8(r,o.values.length),j=x==null?void 0:x[c.size],S=j?c8(j,N,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${N}% + ${S}px)`},children:[s.jsx(xg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(bt.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:mt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(h2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});u2.displayName=yg;var a8="RadioBubbleInput",h2=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=Ht(a,r),o=M0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(bt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});h2.displayName=a8;function i8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function f2(t,e,n){const i=100/(n-e)*(t-e);return tf(i,[0,100])}function o8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function l8(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),r=Math.min(...n);return n.indexOf(r)}function c8(t,e,n){const r=t/2,i=R0([0,50],[0,r]);return(r-i(e)*n)*n}function d8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function u8(t,e){if(e>0){const n=d8(t);return Math.min(...n)>=e}return!0}function R0(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function h8(t){return(String(t).split(".")[1]||"").length}function f8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var p8=r2,m8=c2,x8=d2,g8=u2;function y8({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(p8,{defaultValue:e,value:n,min:r,max:a,className:Ut("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(m8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(x8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(g8,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},u))]})}const b8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function p2(t){const e=!!(t!=null&&t.embedded),[n,r]=b.useState(b8),[a,i]=b.useState(!0),[o,c]=b.useState(!1);b.useEffect(()=>{Pe("/api/admin/referral-settings").then(f=>{const m=f==null?void 0:f.data;m&&typeof m=="object"&&r({distributorShare:m.distributorShare??90,minWithdrawAmount:m.minWithdrawAmount??10,bindingDays:m.bindingDays??30,userDiscount:m.userDiscount??5,withdrawFee:m.withdrawFee??5,enableAutoWithdraw:m.enableAutoWithdraw??!1,vipOrderShareVip:m.vipOrderShareVip??20,vipOrderShareNonVip:m.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const u=async()=>{c(!0);try{const f={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,withdrawFee:Number(n.withdrawFee)??5,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},m=await Ct("/api/admin/referral-settings",f);if(!m||m.success===!1){se.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}se.success(`✅ 分销配置已保存成功!
• 小程序与网站的推广规则会一起生效
• 绑定关系会使用新的天数配置
• 佣金比例会立即应用到新订单
-如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),se.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const x=parseFloat(m.target.value||"0");r(y=>({...y,[f]:isNaN(x)?0:x}))};return a?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:e?"p-4 w-full":"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Nc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(bc,{to:"/settings",className:"text-[#38bdac] underline hover:text-[#5ee0d1]",children:"系统设置 → 功能开关"}),")。"]})]}),s.jsxs(X,{onClick:u,disabled:o||a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(at,{className:"flex items-center gap-2 text-white",children:[s.jsx(RM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Kt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Le,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ch,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.userDiscount,onChange:h("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(In,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(x8,{className:"flex-1",min:10,max:100,step:1,value:[n.distributorShare],onValueChange:([f])=>r(m=>({...m,distributorShare:f}))}),s.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:n.distributorShare,onChange:h("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[n.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ch,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareVip,onChange:h("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ch,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareNonVip,onChange:h("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(In,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:n.bindingDays,onChange:h("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(at,{className:"flex items-center gap-2 text-white",children:[s.jsx(Nc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Kt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Le,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(ce,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:n.minWithdrawAmount,onChange:h("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"提现手续费(%)"}),s.jsx(ce,{type:"number",min:0,max:100,step:.5,className:"bg-[#0a1628] border-gray-700 text-white",value:n.withdrawFee,onChange:h("withdrawFee")}),s.jsx("p",{className:"text-xs text-gray-500",children:"批准提现时按此比例扣除后打款,如 5 表示申请 100 元实际到账 95 元。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ve,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx($t,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(at,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(ch,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Le,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function y8(){const[t]=x0(),[e,n]=b.useState("overview"),[r,a]=b.useState("orders"),[i,o]=b.useState([]),[c,u]=b.useState(null),[h,f]=b.useState([]),[m,x]=b.useState([]),[y,N]=b.useState([]),[w,j]=b.useState(!0),[S,E]=b.useState(null),[T,P]=b.useState(""),[O,q]=b.useState("all"),[z,V]=b.useState(1),[I,te]=b.useState(10),[Q,F]=b.useState(0),[re,ie]=b.useState(new Set),[J,$]=b.useState(null),[D,R]=b.useState(""),[oe,G]=b.useState(!1),[_,U]=b.useState(null),[H,K]=b.useState(""),[me,Y]=b.useState(!1),[le,de]=b.useState(!1),[ve,ye]=b.useState(!1),[ke,ze]=b.useState([]),[ft,wt]=b.useState(1),[dt,Rt]=b.useState(0),[Tt,Tn]=b.useState("");b.useEffect(()=>{mn()},[]),b.useEffect(()=>{const L=t.get("tab");(L==="overview"||L==="orders"||L==="bindings"||L==="withdrawals"||L==="settings")&&n(L)},[t]),b.useEffect(()=>{V(1)},[e,O]),b.useEffect(()=>{Ft(e)},[e]),b.useEffect(()=>{if(e==="orders"&&r==="giftpay"){Ft("giftPay",!0);return}["orders","bindings","withdrawals"].includes(e)&&Ft(e,!0)},[z,I,O,T,e,r,ft,Tt]),b.useEffect(()=>{e==="withdrawals"&&St()},[e]);async function mn(){E(null);try{const L=await Pe("/api/admin/distribution/overview");L!=null&&L.success&&L.overview&&u(L.overview)}catch(L){console.error("[Admin] 概览接口异常:",L),E("加载概览失败")}try{const L=await Pe("/api/db/users");N((L==null?void 0:L.users)||[])}catch(L){console.error("[Admin] 用户数据加载失败:",L)}}async function Ft(L,Me=!1){var pt;if(!(!Me&&re.has(L))){j(!0);try{const Et=y;switch(L){case"overview":break;case"orders":{try{const ht=new URLSearchParams({page:String(z),pageSize:String(I),...O!=="all"&&{status:O},...T&&{search:T}}),tt=await Pe(`/api/admin/orders?${ht}`);if(tt!=null&&tt.success&&tt.orders){const Pt=tt.orders.map(Wt=>{const en=Et.find(Qs=>Qs.id===Wt.userId),ts=Wt.referrerId?Et.find(Qs=>Qs.id===Wt.referrerId):null;return{...Wt,amount:parseFloat(String(Wt.amount))||0,userNickname:(en==null?void 0:en.nickname)||Wt.userNickname||"未知用户",userPhone:(en==null?void 0:en.phone)||Wt.userPhone||"-",referrerNickname:(ts==null?void 0:ts.nickname)||null,referrerCode:(ts==null?void 0:ts.referralCode)??null,type:Wt.productType||Wt.type}});o(Pt),F(tt.total??Pt.length)}else o([]),F(0)}catch(ht){console.error(ht),E("加载订单失败"),o([])}break}case"bindings":{try{const ht=new URLSearchParams({page:String(z),pageSize:String(I),...O!=="all"&&{status:O}}),tt=await Pe(`/api/db/distribution?${ht}`);f((tt==null?void 0:tt.bindings)||[]),F((tt==null?void 0:tt.total)??((pt=tt==null?void 0:tt.bindings)==null?void 0:pt.length)??0)}catch(ht){console.error(ht),E("加载绑定数据失败"),f([])}break}case"withdrawals":{try{const ht=O==="completed"?"success":O==="rejected"?"failed":O,tt=new URLSearchParams({...ht&&ht!=="all"&&{status:ht},page:String(z),pageSize:String(I)}),Pt=await Pe(`/api/admin/withdrawals?${tt}`);if(Pt!=null&&Pt.success&&Pt.withdrawals){const Wt=Pt.withdrawals.map(en=>({...en,account:en.account??"未绑定微信号",status:en.status==="success"?"completed":en.status==="failed"?"rejected":en.status}));x(Wt),F((Pt==null?void 0:Pt.total)??Wt.length)}else Pt!=null&&Pt.success||E(`获取提现记录失败: ${(Pt==null?void 0:Pt.error)||"未知错误"}`),x([])}catch(ht){console.error(ht),E("加载提现数据失败"),x([])}break}case"giftPay":{try{const ht=new URLSearchParams({page:String(ft),pageSize:"20",...Tt&&{status:Tt}}),tt=await Pe(`/api/admin/gift-pay-requests?${ht}`);tt!=null&&tt.success&&tt.data?(ze(tt.data),Rt(tt.total??tt.data.length)):(ze([]),Rt(0))}catch(ht){console.error(ht),E("加载代付请求失败"),ze([])}break}}ie(ht=>new Set(ht).add(L))}catch(Et){console.error(Et)}finally{j(!1)}}}async function qt(){E(null),ie(L=>{const Me=new Set(L);return Me.delete(e),e==="orders"&&r==="giftpay"&&Me.delete("giftPay"),Me}),e==="overview"&&mn(),e==="orders"&&r==="giftpay"?await Ft("giftPay",!0):await Ft(e,!0)}async function vn(L){if(confirm("确认审核通过并打款?"))try{const Me=await Gt("/api/admin/withdrawals",{id:L,action:"approve"});if(!(Me!=null&&Me.success)){const pt=(Me==null?void 0:Me.message)||(Me==null?void 0:Me.error)||"操作失败";se.error(pt);return}await qt()}catch(Me){console.error(Me),se.error("操作失败")}}function On(L){U(L),K("")}async function $n(){const L=_;if(!L)return;const Me=H.trim();if(!Me){se.error("请填写拒绝原因");return}Y(!0);try{const pt=await Gt("/api/admin/withdrawals",{id:L,action:"reject",errorMessage:Me});if(!(pt!=null&&pt.success)){se.error((pt==null?void 0:pt.error)||"操作失败");return}se.success("已拒绝该提现申请"),U(null),K(""),await qt()}catch(pt){console.error(pt),se.error("操作失败")}finally{Y(!1)}}async function St(){try{const L=await Pe("/api/admin/withdrawals/auto-approve");L!=null&&L.success&&typeof L.enableAutoApprove=="boolean"&&de(L.enableAutoApprove)}catch{}}async function cn(L){ye(!0);try{const Me=await Gt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:L});Me!=null&&Me.success?(de(L),se.success(L?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):se.error("更新失败: "+((Me==null?void 0:Me.error)??""))}catch{se.error("更新失败")}finally{ye(!1)}}function xn(){_&&se.info("已取消操作"),U(null),K("")}async function ge(){var L;if(!(!(J!=null&&J.orderSn)&&!(J!=null&&J.id))){G(!0),E(null);try{const Me=await Gt("/api/admin/orders/refund",{orderSn:J.orderSn||J.id,reason:D||void 0});Me!=null&&Me.success?($(null),R(""),await Ft("orders",!0)):E((Me==null?void 0:Me.error)||"退款失败")}catch(Me){const pt=Me;E(((L=pt==null?void 0:pt.data)==null?void 0:L.error)||"退款失败,请检查网络后重试")}finally{G(!1)}}}function Se(L){const Me={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},pt={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ve,{className:`${Me[L]||"bg-gray-500/20 text-gray-400"} border-0`,children:pt[L]||L})}const $e=Math.ceil(Q/I)||1,Xe=i,jt=h.filter(L=>{var pt,Et,ht,tt;if(!T)return!0;const Me=T.toLowerCase();return((pt=L.refereeNickname)==null?void 0:pt.toLowerCase().includes(Me))||((Et=L.refereePhone)==null?void 0:Et.includes(Me))||((ht=L.referrerName)==null?void 0:ht.toLowerCase().includes(Me))||((tt=L.referrerCode)==null?void 0:tt.toLowerCase().includes(Me))}),gt=m.filter(L=>{var pt;if(!T)return!0;const Me=T.toLowerCase();return((pt=L.userName)==null?void 0:pt.toLowerCase().includes(Me))||L.account&&L.account.toLowerCase().includes(Me)});return s.jsxs("div",{className:"p-8 w-full",children:[S&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:S}),s.jsx("button",{type:"button",onClick:()=>E(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"分销绑定、提现审核、推广设置"})]}),s.jsxs(X,{onClick:qt,disabled:w,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1.5 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:[{key:"overview",label:"数据概览",icon:Gh},{key:"orders",label:"订单与代付",icon:Kh},{key:"bindings",label:"绑定管理",icon:ya},{key:"withdrawals",label:"提现审核",icon:Nc},{key:"settings",label:"推广设置",icon:no}].map(L=>s.jsxs("button",{type:"button",onClick:()=>{n(L.key),q("all"),P(""),L.key!=="orders"&&a("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${e===L.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(L.icon,{className:"w-3.5 h-3.5"}),L.label]},L.key))}),w?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Fe,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[e==="overview"&&c&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx(pi,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>void qt(),disabled:w,className:"text-gray-400 h-7",children:s.jsx(Fe,{className:`w-3.5 h-3.5 ${w?"animate-spin":""}`})})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-gray-500 text-xs border-b border-gray-700/50",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"今日"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(qh,{className:"w-4 h-4 text-blue-400"}),"点击数"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayClicks}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthClicks}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalClicks})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(ya,{className:"w-4 h-4 text-green-400"}),"绑定关系"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayBindings}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthBindings}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalBindings})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(ax,{className:"w-4 h-4 text-purple-400"}),"付款转化"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayConversions}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthConversions}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalConversions})]}),s.jsxs("tr",{children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Kh,{className:"w-4 h-4 text-[#38bdac]"}),"佣金收入"]}),s.jsxs("td",{className:"py-2.5 text-right font-bold text-[#38bdac]",children:["¥",(c.todayEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(c.monthEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(c.totalEarnings??0).toFixed(0)]})]})]})]})}),c.conversionRate&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3 text-right",children:["综合转化率 ",c.conversionRate]})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Oe,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Le,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ig,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-orange-300 font-medium text-sm",children:"即将过期绑定"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[c.expiringBindings," ",s.jsx("span",{className:"text-sm font-normal text-orange-300/60",children:"个 · 7天内"})]})]})]})})}),s.jsx(Oe,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Le,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Nc,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-blue-300 font-medium text-sm",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[c.pendingWithdrawals," ",s.jsxs("span",{className:"text-sm font-normal text-blue-300/60",children:["笔 · ¥",(c.pendingWithdrawAmount??0).toFixed(0)]})]})]}),s.jsx(X,{onClick:()=>n("withdrawals"),variant:"outline",size:"sm",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20 shrink-0",children:"去审核"})]})})})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Le,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(In,{className:"w-5 h-5 text-gray-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-white",children:c.totalDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"推广用户"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(ax,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-green-400",children:c.activeDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"有收益用户"})]})]})]})})})]}),e==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r==="orders"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>a("orders"),children:"普通订单"}),s.jsxs("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r==="giftpay"?"bg-amber-500/20 text-amber-400 border border-amber-500/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>{a("giftpay"),Ft("giftPay",!0)},children:[s.jsx(og,{className:"w-3 h-3 inline mr-1"}),"代付请求"]})]}),r==="orders"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:T,onChange:L=>P(L.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>void qt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-0",children:[i.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Xe.map(L=>{var Me,pt;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Me=L.id)==null?void 0:Me.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:L.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Et=L.productType||L.type,ht=L.description||"",tt=String(L.productId||L.sectionId||""),Pt=Et==="vip"||ht.includes("VIP")||ht.toLowerCase().includes("vip")||tt.toLowerCase().includes("vip");return Et==="balance_recharge"?`余额充值 ¥${typeof L.amount=="number"?L.amount.toFixed(2):parseFloat(String(L.amount||"0")).toFixed(2)}`:Pt?"超级个体开通费用":Et==="fullbook"?`${L.bookName||"《底层逻辑》"} - 全本`:Et==="match"?"匹配次数购买":`${L.bookName||"《底层逻辑》"} - ${L.sectionTitle||L.chapterTitle||`章节${L.productId||L.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Et=L.productType||L.type,ht=L.description||"",tt=String(L.productId||L.sectionId||""),Pt=Et==="vip"||ht.includes("VIP")||ht.toLowerCase().includes("vip")||tt.toLowerCase().includes("vip");return Et==="balance_recharge"?"余额充值":Pt?"超级个体":Et==="fullbook"?"全书解锁":Et==="match"?"功能权益":L.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof L.amount=="number"?L.amount.toFixed(2):parseFloat(String(L.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:L.paymentMethod==="wechat"?"微信支付":L.paymentMethod==="balance"?"余额支付":L.paymentMethod==="alipay"?"支付宝":L.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:L.status==="refunded"?s.jsx(Ve,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):L.status==="completed"||L.status==="paid"?s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):L.status==="pending"||L.status==="created"?s.jsx(Ve,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ve,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:L.refundReason,children:L.status==="refunded"&&L.refundReason?L.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:L.referrerId||L.referralCode?s.jsxs("span",{title:L.referralCode||L.referrerCode||L.referrerId||"",children:[L.referrerNickname||L.referralCode||L.referrerCode||((pt=L.referrerId)==null?void 0:pt.slice(0,8)),(L.referralCode||L.referrerCode)&&` (${L.referralCode||L.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:L.referrerEarnings?`¥${(typeof L.referrerEarnings=="number"?L.referrerEarnings:parseFloat(String(L.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(L.status==="paid"||L.status==="completed")&&s.jsxs(X,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{$(L),R("")},children:[s.jsx(Ij,{className:"w-3 h-3 mr-1"}),"退款"]})})]},L.id)})})]})}),e==="orders"&&s.jsx(qs,{page:z,totalPages:$e,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]}),r==="giftpay"&&s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(at,{className:"text-white text-base",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:Tt,onChange:L=>{Tn(L.target.value),wt(1)},children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待支付(旧)"}),s.jsx("option",{value:"pending_pay",children:"待发起人支付"}),s.jsx("option",{value:"paid",children:"已支付"}),s.jsx("option",{value:"refunded",children:"已退款"}),s.jsx("option",{value:"cancelled",children:"已取消"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(X,{size:"sm",variant:"outline",onClick:()=>void Ft("giftPay",!0),disabled:w,className:"border-gray-600 text-gray-300",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1 ${w?"animate-spin":""}`}),"刷新"]})]})]})}),s.jsxs(Le,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"请求号"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"发起人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"商品/金额"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"份数/已领"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"付款人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"状态"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ke.map(L=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:L.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:L.initiatorNick||L.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[L.productType," · ¥",L.amount.toFixed(2)]}),L.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:L.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(L.quantity??1)>1?`${L.quantity}份 / 已领${L.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:L.payerNick||(L.payerUserId?L.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Ve,{className:L.status==="paid"?"bg-green-500/20 text-green-400 border-0":L.status==="pending"||L.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":L.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:L.status==="paid"?"已支付":L.status==="pending"||L.status==="pending_pay"?"待支付":L.status==="refunded"?"已退款":L.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"})]},L.id))})]})}),ke.length===0&&!w&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),dt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(qs,{page:ft,totalPages:Math.ceil(dt/20),total:dt,pageSize:20,onPageChange:wt,onPageSizeChange:()=>{}})})]})]})]}),e==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:T,onChange:L=>P(L.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>void qt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-0",children:[jt.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:jt.map(L=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:L.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:L.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:L.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:L.boundAt?new Date(L.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:L.expiresAt?new Date(L.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Se(L.status)}),s.jsx("td",{className:"p-4",children:L.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",L.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},L.id))})]})}),e==="bindings"&&s.jsx(qs,{page:z,totalPages:$e,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]}),e==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:T,onChange:L=>P(L.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]}),s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-[#0f2137] border border-gray-700/50 shrink-0",children:[s.jsx(pi,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx($t,{checked:le,onCheckedChange:cn,disabled:ve,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>void qt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-0",children:[gt.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"备注"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:gt.map(L=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[L.userAvatar?s.jsx("img",{src:L.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(L.userName||L.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:L.userName||L.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",L.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ve,{className:L.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:L.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:L.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Se(L.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${L.status==="rejected"||L.status==="failed"?"text-red-400":"text-gray-400"}`,title:L.remark,children:L.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:L.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(X,{size:"sm",onClick:()=>vn(L.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(ax,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(X,{size:"sm",variant:"outline",onClick:()=>On(L.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Sj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},L.id))})]})}),e==="withdrawals"&&s.jsx(qs,{page:z,totalPages:$e,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]})]}),s.jsx(Dt,{open:!!J,onOpenChange:L=>!L&&$(null),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"订单退款"})}),J&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",J.orderSn||J.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof J.amount=="number"?J.amount.toFixed(2):parseFloat(String(J.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:D,onChange:L=>R(L.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(X,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>$(null),disabled:oe,children:"取消"}),s.jsx(X,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ge,disabled:oe,children:oe?"退款中...":"确认退款"})]})]})}),s.jsx(Dt,{open:!!_,onOpenChange:L=>!L&&xn(),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:H,onChange:L=>K(L.target.value)})})]})]}),s.jsxs(fn,{children:[s.jsx(X,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:xn,disabled:me,children:"取消"}),s.jsx(X,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:$n,disabled:me||!H.trim(),children:me?"提交中...":"确认拒绝"})]})]})}),e==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(f2,{embedded:!0})})]})}function b8(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[x,y]=b.useState(10),[N,w]=b.useState(0),[j,S]=b.useState(null),[E,T]=b.useState(null),[P,O]=b.useState(""),[q,z]=b.useState(!1);async function V(){var J,$,D,R,oe,G,_;i(!0),c(null);try{const U=new URLSearchParams({status:u,page:String(f),pageSize:String(x)}),H=await Pe(`/api/admin/withdrawals?${U}`);if(H!=null&&H.success){const K=H.withdrawals||[];e(K),w(H.total??((J=H.stats)==null?void 0:J.total)??K.length),r({total:(($=H.stats)==null?void 0:$.total)??H.total??K.length,pendingCount:((D=H.stats)==null?void 0:D.pendingCount)??0,pendingAmount:((R=H.stats)==null?void 0:R.pendingAmount)??0,successCount:((oe=H.stats)==null?void 0:oe.successCount)??0,successAmount:((G=H.stats)==null?void 0:G.successAmount)??0,failedCount:((_=H.stats)==null?void 0:_.failedCount)??0})}else c("加载提现记录失败")}catch(U){console.error("Load withdrawals error:",U),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{V()},[u,f,x]);const I=Math.ceil(N/x)||1;async function te(J){const $=t.find(D=>D.id===J);if($!=null&&$.userCommissionInfo&&$.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${$.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。
+如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),se.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const x=parseFloat(m.target.value||"0");r(y=>({...y,[f]:isNaN(x)?0:x}))};return a?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:e?"p-4 w-full":"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Nc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(bc,{to:"/settings",className:"text-[#38bdac] underline hover:text-[#5ee0d1]",children:"系统设置 → 功能开关"}),")。"]})]}),s.jsxs(X,{onClick:u,disabled:o||a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bn,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(at,{className:"flex items-center gap-2 text-white",children:[s.jsx(PM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Kt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Le,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ch,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.userDiscount,onChange:h("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(In,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(y8,{className:"flex-1",min:10,max:100,step:1,value:[n.distributorShare],onValueChange:([f])=>r(m=>({...m,distributorShare:f}))}),s.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:n.distributorShare,onChange:h("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[n.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ch,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareVip,onChange:h("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(ch,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareNonVip,onChange:h("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(In,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:n.bindingDays,onChange:h("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(rt,{children:[s.jsxs(at,{className:"flex items-center gap-2 text-white",children:[s.jsx(Nc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Kt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Le,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(ce,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:n.minWithdrawAmount,onChange:h("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"提现手续费(%)"}),s.jsx(ce,{type:"number",min:0,max:100,step:.5,className:"bg-[#0a1628] border-gray-700 text-white",value:n.withdrawFee,onChange:h("withdrawFee")}),s.jsx("p",{className:"text-xs text-gray-500",children:"批准提现时按此比例扣除后打款,如 5 表示申请 100 元实际到账 95 元。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ve,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx($t,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs(at,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(ch,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Le,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function v8(){const[t]=x0(),[e,n]=b.useState("overview"),[r,a]=b.useState("orders"),[i,o]=b.useState([]),[c,u]=b.useState(null),[h,f]=b.useState([]),[m,x]=b.useState([]),[y,N]=b.useState([]),[w,j]=b.useState(!0),[S,E]=b.useState(null),[T,P]=b.useState(""),[O,q]=b.useState("all"),[z,V]=b.useState(1),[I,te]=b.useState(10),[Q,F]=b.useState(0),[re,ie]=b.useState(new Set),[J,$]=b.useState(null),[D,R]=b.useState(""),[oe,G]=b.useState(!1),[_,U]=b.useState(null),[H,K]=b.useState(""),[me,Y]=b.useState(!1),[le,de]=b.useState(!1),[ve,ye]=b.useState(!1),[ke,ze]=b.useState([]),[ft,wt]=b.useState(1),[dt,Rt]=b.useState(0),[Tt,Tn]=b.useState("");b.useEffect(()=>{mn()},[]),b.useEffect(()=>{const L=t.get("tab");(L==="overview"||L==="orders"||L==="bindings"||L==="withdrawals"||L==="settings")&&n(L)},[t]),b.useEffect(()=>{V(1)},[e,O]),b.useEffect(()=>{Ft(e)},[e]),b.useEffect(()=>{if(e==="orders"&&r==="giftpay"){Ft("giftPay",!0);return}["orders","bindings","withdrawals"].includes(e)&&Ft(e,!0)},[z,I,O,T,e,r,ft,Tt]),b.useEffect(()=>{e==="withdrawals"&&St()},[e]);async function mn(){E(null);try{const L=await Pe("/api/admin/distribution/overview");L!=null&&L.success&&L.overview&&u(L.overview)}catch(L){console.error("[Admin] 概览接口异常:",L),E("加载概览失败")}try{const L=await Pe("/api/db/users");N((L==null?void 0:L.users)||[])}catch(L){console.error("[Admin] 用户数据加载失败:",L)}}async function Ft(L,Me=!1){var pt;if(!(!Me&&re.has(L))){j(!0);try{const Et=y;switch(L){case"overview":break;case"orders":{try{const ht=new URLSearchParams({page:String(z),pageSize:String(I),...O!=="all"&&{status:O},...T&&{search:T}}),tt=await Pe(`/api/admin/orders?${ht}`);if(tt!=null&&tt.success&&tt.orders){const Pt=tt.orders.map(Wt=>{const en=Et.find(Qs=>Qs.id===Wt.userId),ts=Wt.referrerId?Et.find(Qs=>Qs.id===Wt.referrerId):null;return{...Wt,amount:parseFloat(String(Wt.amount))||0,userNickname:(en==null?void 0:en.nickname)||Wt.userNickname||"未知用户",userPhone:(en==null?void 0:en.phone)||Wt.userPhone||"-",referrerNickname:(ts==null?void 0:ts.nickname)||null,referrerCode:(ts==null?void 0:ts.referralCode)??null,type:Wt.productType||Wt.type}});o(Pt),F(tt.total??Pt.length)}else o([]),F(0)}catch(ht){console.error(ht),E("加载订单失败"),o([])}break}case"bindings":{try{const ht=new URLSearchParams({page:String(z),pageSize:String(I),...O!=="all"&&{status:O}}),tt=await Pe(`/api/db/distribution?${ht}`);f((tt==null?void 0:tt.bindings)||[]),F((tt==null?void 0:tt.total)??((pt=tt==null?void 0:tt.bindings)==null?void 0:pt.length)??0)}catch(ht){console.error(ht),E("加载绑定数据失败"),f([])}break}case"withdrawals":{try{const ht=O==="completed"?"success":O==="rejected"?"failed":O,tt=new URLSearchParams({...ht&&ht!=="all"&&{status:ht},page:String(z),pageSize:String(I)}),Pt=await Pe(`/api/admin/withdrawals?${tt}`);if(Pt!=null&&Pt.success&&Pt.withdrawals){const Wt=Pt.withdrawals.map(en=>({...en,account:en.account??"未绑定微信号",status:en.status==="success"?"completed":en.status==="failed"?"rejected":en.status}));x(Wt),F((Pt==null?void 0:Pt.total)??Wt.length)}else Pt!=null&&Pt.success||E(`获取提现记录失败: ${(Pt==null?void 0:Pt.error)||"未知错误"}`),x([])}catch(ht){console.error(ht),E("加载提现数据失败"),x([])}break}case"giftPay":{try{const ht=new URLSearchParams({page:String(ft),pageSize:"20",...Tt&&{status:Tt}}),tt=await Pe(`/api/admin/gift-pay-requests?${ht}`);tt!=null&&tt.success&&tt.data?(ze(tt.data),Rt(tt.total??tt.data.length)):(ze([]),Rt(0))}catch(ht){console.error(ht),E("加载代付请求失败"),ze([])}break}}ie(ht=>new Set(ht).add(L))}catch(Et){console.error(Et)}finally{j(!1)}}}async function qt(){E(null),ie(L=>{const Me=new Set(L);return Me.delete(e),e==="orders"&&r==="giftpay"&&Me.delete("giftPay"),Me}),e==="overview"&&mn(),e==="orders"&&r==="giftpay"?await Ft("giftPay",!0):await Ft(e,!0)}async function vn(L){if(confirm("确认审核通过并打款?"))try{const Me=await Gt("/api/admin/withdrawals",{id:L,action:"approve"});if(!(Me!=null&&Me.success)){const pt=(Me==null?void 0:Me.message)||(Me==null?void 0:Me.error)||"操作失败";se.error(pt);return}await qt()}catch(Me){console.error(Me),se.error("操作失败")}}function On(L){U(L),K("")}async function $n(){const L=_;if(!L)return;const Me=H.trim();if(!Me){se.error("请填写拒绝原因");return}Y(!0);try{const pt=await Gt("/api/admin/withdrawals",{id:L,action:"reject",errorMessage:Me});if(!(pt!=null&&pt.success)){se.error((pt==null?void 0:pt.error)||"操作失败");return}se.success("已拒绝该提现申请"),U(null),K(""),await qt()}catch(pt){console.error(pt),se.error("操作失败")}finally{Y(!1)}}async function St(){try{const L=await Pe("/api/admin/withdrawals/auto-approve");L!=null&&L.success&&typeof L.enableAutoApprove=="boolean"&&de(L.enableAutoApprove)}catch{}}async function cn(L){ye(!0);try{const Me=await Gt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:L});Me!=null&&Me.success?(de(L),se.success(L?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):se.error("更新失败: "+((Me==null?void 0:Me.error)??""))}catch{se.error("更新失败")}finally{ye(!1)}}function xn(){_&&se.info("已取消操作"),U(null),K("")}async function ge(){var L;if(!(!(J!=null&&J.orderSn)&&!(J!=null&&J.id))){G(!0),E(null);try{const Me=await Gt("/api/admin/orders/refund",{orderSn:J.orderSn||J.id,reason:D||void 0});Me!=null&&Me.success?($(null),R(""),await Ft("orders",!0)):E((Me==null?void 0:Me.error)||"退款失败")}catch(Me){const pt=Me;E(((L=pt==null?void 0:pt.data)==null?void 0:L.error)||"退款失败,请检查网络后重试")}finally{G(!1)}}}function Se(L){const Me={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},pt={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ve,{className:`${Me[L]||"bg-gray-500/20 text-gray-400"} border-0`,children:pt[L]||L})}const $e=Math.ceil(Q/I)||1,Xe=i,jt=h.filter(L=>{var pt,Et,ht,tt;if(!T)return!0;const Me=T.toLowerCase();return((pt=L.refereeNickname)==null?void 0:pt.toLowerCase().includes(Me))||((Et=L.refereePhone)==null?void 0:Et.includes(Me))||((ht=L.referrerName)==null?void 0:ht.toLowerCase().includes(Me))||((tt=L.referrerCode)==null?void 0:tt.toLowerCase().includes(Me))}),gt=m.filter(L=>{var pt;if(!T)return!0;const Me=T.toLowerCase();return((pt=L.userName)==null?void 0:pt.toLowerCase().includes(Me))||L.account&&L.account.toLowerCase().includes(Me)});return s.jsxs("div",{className:"p-8 w-full",children:[S&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:S}),s.jsx("button",{type:"button",onClick:()=>E(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"分销绑定、提现审核、推广设置"})]}),s.jsxs(X,{onClick:qt,disabled:w,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1.5 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:[{key:"overview",label:"数据概览",icon:Gh},{key:"orders",label:"订单与代付",icon:Kh},{key:"bindings",label:"绑定管理",icon:ya},{key:"withdrawals",label:"提现审核",icon:Nc},{key:"settings",label:"推广设置",icon:no}].map(L=>s.jsxs("button",{type:"button",onClick:()=>{n(L.key),q("all"),P(""),L.key!=="orders"&&a("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${e===L.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(L.icon,{className:"w-3.5 h-3.5"}),L.label]},L.key))}),w?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Fe,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[e==="overview"&&c&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx(pi,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(X,{type:"button",size:"sm",variant:"ghost",onClick:()=>void qt(),disabled:w,className:"text-gray-400 h-7",children:s.jsx(Fe,{className:`w-3.5 h-3.5 ${w?"animate-spin":""}`})})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-gray-500 text-xs border-b border-gray-700/50",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"今日"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(qh,{className:"w-4 h-4 text-blue-400"}),"点击数"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayClicks}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthClicks}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalClicks})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(ya,{className:"w-4 h-4 text-green-400"}),"绑定关系"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayBindings}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthBindings}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalBindings})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(ax,{className:"w-4 h-4 text-purple-400"}),"付款转化"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayConversions}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthConversions}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalConversions})]}),s.jsxs("tr",{children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Kh,{className:"w-4 h-4 text-[#38bdac]"}),"佣金收入"]}),s.jsxs("td",{className:"py-2.5 text-right font-bold text-[#38bdac]",children:["¥",(c.todayEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(c.monthEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(c.totalEarnings??0).toFixed(0)]})]})]})]})}),c.conversionRate&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3 text-right",children:["综合转化率 ",c.conversionRate]})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Oe,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Le,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ig,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-orange-300 font-medium text-sm",children:"即将过期绑定"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[c.expiringBindings," ",s.jsx("span",{className:"text-sm font-normal text-orange-300/60",children:"个 · 7天内"})]})]})]})})}),s.jsx(Oe,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Le,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Nc,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-blue-300 font-medium text-sm",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[c.pendingWithdrawals," ",s.jsxs("span",{className:"text-sm font-normal text-blue-300/60",children:["笔 · ¥",(c.pendingWithdrawAmount??0).toFixed(0)]})]})]}),s.jsx(X,{onClick:()=>n("withdrawals"),variant:"outline",size:"sm",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20 shrink-0",children:"去审核"})]})})})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Le,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(In,{className:"w-5 h-5 text-gray-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-white",children:c.totalDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"推广用户"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(ax,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-green-400",children:c.activeDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"有收益用户"})]})]})]})})})]}),e==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r==="orders"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>a("orders"),children:"普通订单"}),s.jsxs("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r==="giftpay"?"bg-amber-500/20 text-amber-400 border border-amber-500/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>{a("giftpay"),Ft("giftPay",!0)},children:[s.jsx(og,{className:"w-3 h-3 inline mr-1"}),"代付请求"]})]}),r==="orders"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:T,onChange:L=>P(L.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>void qt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-0",children:[i.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Xe.map(L=>{var Me,pt;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Me=L.id)==null?void 0:Me.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:L.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Et=L.productType||L.type,ht=L.description||"",tt=String(L.productId||L.sectionId||""),Pt=Et==="vip"||ht.includes("VIP")||ht.toLowerCase().includes("vip")||tt.toLowerCase().includes("vip");return Et==="balance_recharge"?`余额充值 ¥${typeof L.amount=="number"?L.amount.toFixed(2):parseFloat(String(L.amount||"0")).toFixed(2)}`:Pt?"超级个体开通费用":Et==="fullbook"?`${L.bookName||"《底层逻辑》"} - 全本`:Et==="match"?"匹配次数购买":`${L.bookName||"《底层逻辑》"} - ${L.sectionTitle||L.chapterTitle||`章节${L.productId||L.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Et=L.productType||L.type,ht=L.description||"",tt=String(L.productId||L.sectionId||""),Pt=Et==="vip"||ht.includes("VIP")||ht.toLowerCase().includes("vip")||tt.toLowerCase().includes("vip");return Et==="balance_recharge"?"余额充值":Pt?"超级个体":Et==="fullbook"?"全书解锁":Et==="match"?"功能权益":L.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof L.amount=="number"?L.amount.toFixed(2):parseFloat(String(L.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:L.paymentMethod==="wechat"?"微信支付":L.paymentMethod==="balance"?"余额支付":L.paymentMethod==="alipay"?"支付宝":L.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:L.status==="refunded"?s.jsx(Ve,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):L.status==="completed"||L.status==="paid"?s.jsx(Ve,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):L.status==="pending"||L.status==="created"?s.jsx(Ve,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ve,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:L.refundReason,children:L.status==="refunded"&&L.refundReason?L.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:L.referrerId||L.referralCode?s.jsxs("span",{title:L.referralCode||L.referrerCode||L.referrerId||"",children:[L.referrerNickname||L.referralCode||L.referrerCode||((pt=L.referrerId)==null?void 0:pt.slice(0,8)),(L.referralCode||L.referrerCode)&&` (${L.referralCode||L.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:L.referrerEarnings?`¥${(typeof L.referrerEarnings=="number"?L.referrerEarnings:parseFloat(String(L.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(L.status==="paid"||L.status==="completed")&&s.jsxs(X,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{$(L),R("")},children:[s.jsx(Ij,{className:"w-3 h-3 mr-1"}),"退款"]})})]},L.id)})})]})}),e==="orders"&&s.jsx(qs,{page:z,totalPages:$e,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]}),r==="giftpay"&&s.jsxs(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(rt,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(at,{className:"text-white text-base",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:Tt,onChange:L=>{Tn(L.target.value),wt(1)},children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待支付(旧)"}),s.jsx("option",{value:"pending_pay",children:"待发起人支付"}),s.jsx("option",{value:"paid",children:"已支付"}),s.jsx("option",{value:"refunded",children:"已退款"}),s.jsx("option",{value:"cancelled",children:"已取消"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(X,{size:"sm",variant:"outline",onClick:()=>void Ft("giftPay",!0),disabled:w,className:"border-gray-600 text-gray-300",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1 ${w?"animate-spin":""}`}),"刷新"]})]})]})}),s.jsxs(Le,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"请求号"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"发起人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"商品/金额"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"份数/已领"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"付款人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"状态"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ke.map(L=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:L.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:L.initiatorNick||L.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[L.productType," · ¥",L.amount.toFixed(2)]}),L.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:L.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(L.quantity??1)>1?`${L.quantity}份 / 已领${L.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:L.payerNick||(L.payerUserId?L.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Ve,{className:L.status==="paid"?"bg-green-500/20 text-green-400 border-0":L.status==="pending"||L.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":L.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:L.status==="paid"?"已支付":L.status==="pending"||L.status==="pending_pay"?"待支付":L.status==="refunded"?"已退款":L.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"})]},L.id))})]})}),ke.length===0&&!w&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),dt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(qs,{page:ft,totalPages:Math.ceil(dt/20),total:dt,pageSize:20,onPageChange:wt,onPageSizeChange:()=>{}})})]})]})]}),e==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:T,onChange:L=>P(L.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>void qt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-0",children:[jt.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:jt.map(L=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:L.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:L.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:L.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:L.boundAt?new Date(L.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:L.expiresAt?new Date(L.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Se(L.status)}),s.jsx("td",{className:"p-4",children:L.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",L.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},L.id))})]})}),e==="bindings"&&s.jsx(qs,{page:z,totalPages:$e,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]}),e==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:T,onChange:L=>P(L.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]}),s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-[#0f2137] border border-gray-700/50 shrink-0",children:[s.jsx(pi,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx($t,{checked:le,onCheckedChange:cn,disabled:ve,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(X,{type:"button",variant:"outline",onClick:()=>void qt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-0",children:[gt.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"备注"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:gt.map(L=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[L.userAvatar?s.jsx("img",{src:L.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(L.userName||L.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:L.userName||L.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",L.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ve,{className:L.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:L.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:L.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Se(L.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${L.status==="rejected"||L.status==="failed"?"text-red-400":"text-gray-400"}`,title:L.remark,children:L.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:L.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(X,{size:"sm",onClick:()=>vn(L.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(ax,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(X,{size:"sm",variant:"outline",onClick:()=>On(L.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Sj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},L.id))})]})}),e==="withdrawals"&&s.jsx(qs,{page:z,totalPages:$e,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]})]}),s.jsx(Dt,{open:!!J,onOpenChange:L=>!L&&$(null),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"订单退款"})}),J&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",J.orderSn||J.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof J.amount=="number"?J.amount.toFixed(2):parseFloat(String(J.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:D,onChange:L=>R(L.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(fn,{children:[s.jsx(X,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>$(null),disabled:oe,children:"取消"}),s.jsx(X,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ge,disabled:oe,children:oe?"退款中...":"确认退款"})]})]})}),s.jsx(Dt,{open:!!_,onOpenChange:L=>!L&&xn(),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:H,onChange:L=>K(L.target.value)})})]})]}),s.jsxs(fn,{children:[s.jsx(X,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:xn,disabled:me,children:"取消"}),s.jsx(X,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:$n,disabled:me||!H.trim(),children:me?"提交中...":"确认拒绝"})]})]})}),e==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(p2,{embedded:!0})})]})}function N8(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[x,y]=b.useState(10),[N,w]=b.useState(0),[j,S]=b.useState(null),[E,T]=b.useState(null),[P,O]=b.useState(""),[q,z]=b.useState(!1);async function V(){var J,$,D,R,oe,G,_;i(!0),c(null);try{const U=new URLSearchParams({status:u,page:String(f),pageSize:String(x)}),H=await Pe(`/api/admin/withdrawals?${U}`);if(H!=null&&H.success){const K=H.withdrawals||[];e(K),w(H.total??((J=H.stats)==null?void 0:J.total)??K.length),r({total:(($=H.stats)==null?void 0:$.total)??H.total??K.length,pendingCount:((D=H.stats)==null?void 0:D.pendingCount)??0,pendingAmount:((R=H.stats)==null?void 0:R.pendingAmount)??0,successCount:((oe=H.stats)==null?void 0:oe.successCount)??0,successAmount:((G=H.stats)==null?void 0:G.successAmount)??0,failedCount:((_=H.stats)==null?void 0:_.failedCount)??0})}else c("加载提现记录失败")}catch(U){console.error("Load withdrawals error:",U),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{V()},[u,f,x]);const I=Math.ceil(N/x)||1;async function te(J){const $=t.find(D=>D.id===J);if($!=null&&$.userCommissionInfo&&$.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${$.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。
确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;S(J);try{const D=await Gt("/api/admin/withdrawals",{id:J,action:"approve"});D!=null&&D.success?V():se.error("操作失败: "+((D==null?void 0:D.error)??""))}catch{se.error("操作失败")}finally{S(null)}}function Q(J){T(J),O("")}async function F(){const J=E;if(!J)return;const $=P.trim();if(!$){se.error("请填写拒绝原因");return}z(!0);try{const D=await Gt("/api/admin/withdrawals",{id:J,action:"reject",errorMessage:$});D!=null&&D.success?(se.success("已拒绝该提现申请"),T(null),O(""),V()):se.error("操作失败: "+((D==null?void 0:D.error)??""))}catch{se.error("操作失败")}finally{z(!1)}}function re(){E&&se.info("已取消操作"),T(null),O("")}function ie(J){switch(J){case"pending":return s.jsx(Ve,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ve,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ve,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ve,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ve,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ve,{className:"bg-gray-500/20 text-gray-400 border-0",children:J})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(X,{variant:"outline",onClick:V,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Oe,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Le,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Kh,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准(自动审批开关在推广中心-提现审核)"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Le,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(J=>s.jsx(X,{variant:u===J?"default":"outline",size:"sm",onClick:()=>h(J),className:u===J?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:J==="all"?"全部":J==="pending"?"待处理":J==="success"?"已完成":"已拒绝"},J))}),s.jsx(Oe,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Le,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Nc,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"备注"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(J=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(J.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[J.userAvatar?s.jsx("img",{src:fo(J.userAvatar),alt:J.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(J.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:J.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:J.userPhone??J.referralCode??(J.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(J.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:J.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",J.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",J.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",J.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:J.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",J.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsx("td",{className:"p-4",children:ie(J.status)}),s.jsx("td",{className:"p-4 max-w-[180px]",children:s.jsx("span",{className:`text-xs ${J.status==="rejected"||J.status==="failed"?"text-red-400":"text-gray-400"}`,title:J.remark,children:J.remark||"-"})}),s.jsx("td",{className:"p-4 text-gray-400",children:J.processedAt?new Date(J.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:J.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:J.userConfirmedAt,children:["已确认 ",new Date(J.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(J.status==="pending"||J.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(X,{size:"sm",onClick:()=>te(J.id),disabled:j===J.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(Zf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(X,{size:"sm",variant:"outline",onClick:()=>Q(J.id),disabled:j===J.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(J.status==="success"||J.status==="completed")&&J.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:J.transactionId})]})]},J.id))})]})}),s.jsx(qs,{page:f,totalPages:I,total:N,pageSize:x,onPageChange:m,onPageSizeChange:J=>{y(J),m(1)}})]})})}),s.jsx(Dt,{open:!!E,onOpenChange:J=>!J&&re(),children:s.jsxs(Lt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx(zt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:P,onChange:J=>O(J.target.value)})})]})]}),s.jsxs(fn,{children:[s.jsx(X,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:re,disabled:q,children:"取消"}),s.jsx(X,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:F,disabled:q||!P.trim(),children:q?"提交中...":"确认拒绝"})]})]})})]})}var yx={exports:{}},bx={};/**
* @license React
@@ -671,19 +671,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var z1;function v8(){if(z1)return bx;z1=1;var t=ru();function e(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,x){var y=x(),N=r({inst:{value:y,getSnapshot:x}}),w=N[0].inst,j=N[1];return i(function(){w.value=y,w.getSnapshot=x,u(w)&&j({inst:w})},[m,y,x]),a(function(){return u(w)&&j({inst:w}),m(function(){u(w)&&j({inst:w})})},[m]),o(y),y}function u(m){var x=m.getSnapshot;m=m.value;try{var y=x();return!n(m,y)}catch{return!0}}function h(m,x){return x()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return bx.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,bx}var $1;function p2(){return $1||($1=1,yx.exports=v8()),yx.exports}var m2=p2();function is(t){this.content=t}is.prototype={constructor:is,find:function(t){for(var e=0;e>1}};is.from=function(t){if(t instanceof is)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new is(e)};function x2(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let o=0;a.text[o]==i.text[o];o++)n++;return n}if(a.content.size||i.content.size){let o=x2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function g2(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,a+c,i||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),a+=c.nodeSize),o=u}return new Ne(r,a)}cutByIndex(e,n){return e==n?Ne.empty:e==0&&n==this.content.length?this:new Ne(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new Ne(a,i)}addToStart(e){return new Ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?yh(n+1,i):yh(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ne(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ne.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};Zt.none=[];class sf extends Error{}class _e{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=b2(this.content,e+this.openStart,n);return r&&new _e(r,this.openStart,this.openEnd)}removeBetween(e,n){return new _e(y2(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return _e.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _e(Ne.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new _e(e,r,a)}}_e.empty=new _e(Ne.empty,0,0);function y2(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(a==e||i.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(y2(i.content,e-a-1,n-a-1)))}function b2(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=b2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function N8(t,e,n){if(n.openStart>t.depth)throw new sf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sf("Inconsistent open depths");return v2(t,e,n,0)}function v2(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Id(t,e,n,r){let a=(e||t).node(n),i=0,o=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(sl(t.nodeAfter,r),i++));for(let c=i;ca&&vg(t,e,a+1),o=r.depth>a&&vg(n,r,a+1),c=[];return Id(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(N2(i,o),sl(rl(i,w2(t,e,n,r,a+1)),c)):(i&&sl(rl(i,rf(t,e,a+1)),c),Id(e,n,a,c),o&&sl(rl(o,rf(n,r,a+1)),c)),Id(r,null,a,c),new Ne(c)}function rf(t,e,n){let r=[];if(Id(null,t,n,r),t.depth>n){let a=vg(t,e,n+1);sl(rl(a,rf(t,e,n+1)),r)}return Id(e,null,n,r),new Ne(r)}function w8(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(Ne.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class Wd{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],a=e.child(n);return r?e.child(n).cut(r):a}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new af(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(r.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new Wd(n,r,i)}static resolveCached(e,n){let r=F1.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),j2(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ne.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=Ne.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};di.prototype.text=void 0;class of extends di{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):j2(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new of(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new of(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function j2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class fl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new C8(e,n);if(r.next==null)return fl.empty;let a=k2(r);r.next&&r.err("Unexpected trailing text");let i=P8(R8(a));return O8(i,r),i}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let a=0;a{let i=a+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(`
-`)}}fl.empty=new fl(!0);class C8{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function k2(t){let e=[];do e.push(T8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function T8(t){let e=[];do e.push(E8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function E8(t){let e=I8(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=M8(t,e);else break;return e}function B1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function M8(t,e){let n=B1(t),r=n;return t.eat(",")&&(t.next!="}"?r=B1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function A8(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let o=n[i];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function I8(t){if(t.eat("(")){let e=k2(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=A8(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function R8(t){let e=[[]];return a(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function a(o,c){o.forEach(u=>u.to=c)}function i(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(i(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=i(o.exprs[u],c);if(u==o.exprs.length-1)return h;a(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),a(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(i(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||a.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let i=e[r.join(",")]=new fl(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:T2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new di(this,this.computeAttrs(e),Ne.from(n),Zt.setFrom(r))}createChecked(e=null,n,r){return n=Ne.from(n),this.checkContent(n),new di(this,this.computeAttrs(e),n,Zt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ne.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(Ne.empty,!0);return i?new di(this,e,n.append(i),Zt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new A2(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function L8(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class D8{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?L8(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class op{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=M2(e,a.attrs),this.excluded=null;let i=C2(this.attrs);this.instance=i?new Zt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Zt(this,T2(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new op(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class I2{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=is.from(e.nodes),n.marks=is.from(e.marks||{}),this.nodes=H1.compile(this.spec.nodes,this),this.marks=op.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],o=i.spec.content||"",c=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=fl.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=c=="_"?null:c?U1(this,c.split(" ")):c==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:U1(this,o.split(" "))}this.nodeFromJSON=a=>di.fromJSON(this,a),this.markFromJSON=a=>Zt.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof H1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,a)}text(e,n){let r=this.nodes.text;return new of(r,r.defaultAttrs,e,Zt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function U1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function _8(t){return t.tag!=null}function z8(t){return t.style!=null}class lo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(_8(a))this.tags.push(a);else if(z8(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new K1(this,n,!1);return r.addAll(e,Zt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new K1(this,n,!0);return r.addAll(e,Zt.none,n.from,n.to),_e.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;ae.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(a){let i=a.priority==null?50:a.priority,o=0;for(;o{r(o=q1(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(o=>{r(o=q1(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lo(e,lo.schemaRules(e)))}}const R2={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},$8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},P2={ol:!0,ul:!0},Kd=1,wg=2,Rd=4;function W1(t,e,n){return e!=null?(e?Kd:0)|(e==="full"?wg:0):t&&t.whitespace=="pre"?Kd|wg:n&~Rd}class bh{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=Zt.none,this.match=i||(o&Rd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ne.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Kd)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=Ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ne.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!R2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class K1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=W1(null,n.preserveWhitespace,0)|(r?Rd:0);a?i=new bh(a.type,a.attrs,Zt.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new bh(null,null,Zt.none,!0,null,o):i=new bh(e.schema.topNodeType,null,Zt.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,a=this.top,i=a.options&wg?"full":this.localPreserveWS||(a.options&Kd)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
-`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,a){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(i=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(a)this.addElement(e,r,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}i&&this.sync(c)&&this.open--}addAll(e,n,r,a){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=a==null?null:e.childNodes[a];o!=c;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let a,i;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!a||a.length>h.length+c)&&(a=h,i=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!a)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):G1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new bh(e,n,u,a,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Kd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(a?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=i;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&a?this.nodes[u].type:r&&u>=i?r.node(u-i).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function F8(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&P2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function B8(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function q1(t){let e={};for(let n in t)e[n]=t[n];return e}function G1(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let i=[],o=c=>{i.push(c);for(let u=0;u{if(i.length||o.marks.length){let c=0,u=0;for(;c=0;a--){let i=this.serializeMark(e.marks[a],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&_h(Nx(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return _h(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new jl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=J1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return J1(e.marks)}}function J1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Nx(t){return t.document||window.document}const Q1=new WeakMap;function V8(t){let e=Q1.get(t);return e===void 0&&Q1.set(t,e=H8(t)),e}function H8(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let x=m.indexOf(" ");x>0?u.setAttributeNS(m.slice(0,x),m.slice(x+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:N}=_h(t,x,n,r);if(u.appendChild(y),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const O2=65535,L2=Math.pow(2,16);function U8(t,e){return t+e*L2}function Y1(t){return t&O2}function W8(t){return(t-(t&O2))/L2}const D2=1,_2=2,zh=4,z2=8;class jg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&z2)>0}get deletedBefore(){return(this.delInfo&(D2|zh))>0}get deletedAfter(){return(this.delInfo&(_2|zh))>0}get deletedAcross(){return(this.delInfo&zh)>0}}class ar{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ar.empty)return ar.empty}recover(e){let n=0,r=Y1(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let x=h?e==u?-1:e==m?1:n:n,y=u+a+(x<0?0:f);if(r)return y;let N=e==(n<0?u:m)?null:U8(c/3,e-u),w=e==u?_2:e==m?D2:zh;return(n<0?e!=u:e!=m)&&(w|=z2),new jg(y,w,N)}a+=f-h}return r?e+a:new jg(e+a,0,null)}touches(e,n){let r=0,a=Y1(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+i],f=u+h;if(e<=f&&c==a*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let a=0,i=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new qd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return _n.fromReplace(e,this.from,this.to,i)}invert(){return new Jr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new so(n.pos,r.pos,this.mark)}merge(e){return e instanceof so&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new so(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new so(n.from,n.to,e.markFromJSON(n.mark))}}ks.jsonID("addMark",so);class Jr extends ks{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new _e(P0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return _n.fromReplace(e,this.from,this.to,r)}invert(){return new so(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Jr(n.from,n.to,e.markFromJSON(n.mark))}}ks.jsonID("removeMark",Jr);class ro extends ks{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return _n.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return _n.fromReplace(e,this.pos,this.pos+1,new _e(Ne.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;ar.pos?null:new Zn(n.pos,r.pos,a,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Zn(n.from,n.to,n.gapFrom,n.gapTo,_e.fromJSON(e,n.slice),n.insert,!!n.structure)}}ks.jsonID("replaceAround",Zn);function kg(t,e,n){let r=t.resolve(e),a=n-e,i=r.depth;for(;a>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,a--;if(a>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function K8(t,e,n,r){let a=[],i=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let x=Math.max(h,e),y=Math.min(h+u.nodeSize,n),N=r.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function q8(t,e,n,r){let a=[],i=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;i++;let u=null;if(r instanceof op){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new Jr(o.from,o.to,o.style)))}function O0(t,e,n,r=n.contentMatch,a=!0){let i=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function G8(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function _c(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;N--)w||r.index(N)>0?(w=!0,f=Ne.from(r.node(N).copy(f)),m++):u--;let x=Ne.empty,y=0;for(let N=i,w=!1;N>n;N--)w||a.after(N+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ne.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new Zn(a,i,a,i,new _e(r,0,0),n.length,!0))}function Z8(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof a=="function"?a(o):a;if(o.isTextblock&&!o.hasMarkup(r,u)&&eO(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!N?h=!1:!y&&N&&(h=!0)}h===!1&&F2(t,o,c,i),O0(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),x=f.map(c+o.nodeSize,1);return t.step(new Zn(m,x,m+1,x-1,new _e(Ne.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&$2(t,o,c,i),!1}})}function $2(t,e,n,r){e.forEach((a,i)=>{if(a.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(a.text);){let u=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function F2(t,e,n,r){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
-`))}})}function eO(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function tO(t,e,n,r,a){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,a||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Zn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new _e(Ne.from(o),0,0),1,!0))}function ui(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),x=a.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(x,m.childCount),N=r&&r[f+1];N&&(y=y.replaceChild(0,N.type.create(N.attrs)));let w=r&&r[f]||m;if(!m.canReplace(x+1,m.childCount)||!w.type.validContent(y))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function nO(t,e,n=1,r){let a=t.doc.resolve(e),i=Ne.empty,o=Ne.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Ne.from(a.node(c).copy(i));let f=r&&r[h];o=Ne.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new Xn(e,e,new _e(i.append(o),n,n),!0))}function wo(t,e){let n=t.resolve(e),r=n.index();return B2(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function sO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let a=0;a0?(i=r.node(a+1),c++,o=r.node(a).maybeChild(c)):(i=r.node(a).maybeChild(c-1),o=r.node(a+1)),i&&!i.isTextblock&&B2(i,o)&&r.node(a).canReplace(c,c+1))return e;if(a==0)break;e=n<0?r.before(a):r.after(a)}}function rO(t,e,n){let r=null,{linebreakReplacement:a}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(a&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(a);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);F2(t,f.node(),f.before(),c)}o.inlineContent&&O0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new Xn(h,u.map(e+n,-1),_e.empty,!0)),r===!0){let f=t.doc.resolve(h);$2(t,f.node(),f.before(),t.steps.length)}return t}function aO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let a=r.depth-1;a>=0;a--){let i=r.index(a);if(r.node(a).canReplaceWith(i,i,n))return r.before(a+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let a=r.depth-1;a>=0;a--){let i=r.indexAfter(a);if(r.node(a).canReplaceWith(i,i,n))return r.after(a+1);if(i=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(i==1)f=h.canReplace(u,u,a);else{let m=h.contentMatchAt(u).findWrapping(a.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function cp(t,e,n=e,r=_e.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return H2(a,i,r)?new Xn(e,n,r):new iO(a,i,r).fit()}function H2(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class iO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ne.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=Ne.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new _e(i,o,c);return e>-1?new Zn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Xn(r.pos,a.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,a=this.unplaced.openEnd;r1&&(a=0),i.type.spec.isolating&&a<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let a,i=null;r?(i=jx(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(Ne.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=jx(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new _e(e,n+1,Math.max(r,a.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=jx(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new _e(wd(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new _e(wd(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let w=0;w1||u==0||w.content.size)&&(m=j,f.push(U2(w.mark(x.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?y:-1)))}let N=h==c.childCount;N||(y=-1),this.placed=jd(this.placed,n,Ne.from(f)),this.frontier[n].match=m,N&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,j=c;w1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=kx(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=jd(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let a=e.node(r),i=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,i)}return e}openFrontierNode(e,n=null,r){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=jd(this.placed,this.depth,Ne.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ne.empty,!0);n.childCount&&(this.placed=jd(this.placed,this.frontier.length,n))}}function wd(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(wd(t.firstChild.content,e-1,n)))}function jd(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(jd(t.lastChild.content,e-1,n)))}function jx(t,e){for(let n=0;n1&&(r=r.replaceChild(0,U2(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ne.empty,!0)))),t.copy(r)}function kx(t,e,n,r,a){let i=t.node(e),o=a?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let c=r.fillBefore(i.content,!0,o);return c&&!oO(n,i.content,o)?c:null}function oO(t,e,n){for(let r=n;r0;x--,y--){let N=a.node(x).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(x)>-1?c=x:a.before(x)==y&&o.splice(1,0,-x)}let u=o.indexOf(c),h=[],f=r.openStart;for(let x=r.content,y=0;;y++){let N=x.firstChild;if(h.push(N),y==r.openStart)break;x=N.content}for(let x=f-1;x>=0;x--){let y=h[x],N=lO(y.type);if(N&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=x;else if(N||!y.type.isTextblock)break}for(let x=r.openStart;x>=0;x--){let y=(x+f+1)%(r.openStart+1),N=h[y];if(N)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>m));x--){let y=o[x];y<0||(e=a.before(y),n=i.after(y))}}function W2(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(Ne.empty,!0))}return t}function dO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=aO(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new _e(Ne.from(r),0,0))}function uO(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=K2(r,a);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),a.indexAfter(c-1))))return t.delete(r.before(c),a.after(c))}for(let o=1;o<=r.depth&&o<=a.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&a.end(o)-n!=a.depth-o&&r.start(o-1)==a.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),a.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function K2(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let a=r;a>=0;a--){let i=t.start(a);if(ie.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(i==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==i-1)&&n.push(a)}return n}class xc extends ks{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return _n.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return _n.fromReplace(e,this.pos,this.pos+1,new _e(Ne.from(a),0,n.isLeaf?0:1))}getMap(){return ar.empty}invert(e){return new xc(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new xc(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new xc(n.pos,n.attr,n.value)}}ks.jsonID("attr",xc);class Gd extends ks{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return _n.ok(r)}getMap(){return ar.empty}invert(e){return new Gd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Gd(n.attr,n.value)}}ks.jsonID("docAttr",Gd);let kc=class extends Error{};kc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};kc.prototype=Object.create(Error.prototype);kc.prototype.constructor=kc;kc.prototype.name="TransformError";class D0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new qd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new kc(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=_e.empty){let a=cp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new _e(Ne.from(r),0,0))}delete(e,n){return this.replace(e,n,_e.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return cO(this,e,n,r),this}replaceRangeWith(e,n,r){return dO(this,e,n,r),this}deleteRange(e,n){return uO(this,e,n),this}lift(e,n){return J8(this,e,n),this}join(e,n=1){return rO(this,e,n),this}wrap(e,n){return X8(this,e,n),this}setBlockType(e,n=e,r,a=null){return Z8(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return tO(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new xc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Gd(e,n)),this}addNodeMark(e,n){return this.step(new ro(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Zt)n.isInSet(r.marks)&&this.step(new pl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new pl(e,i)),a=i.removeFromSet(a);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return nO(this,e,n,r),this}addMark(e,n,r){return K8(this,e,n,r),this}removeMark(e,n,r){return q8(this,e,n,r),this}clearIncompatible(e,n,r){return O0(this,e,n,r),this}}const Sx=Object.create(null);class ot{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new q2(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;i--){let o=n<0?ac(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):ac(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new or(e.node(0))}static atStart(e){return ac(e,e,0,0,1)||new or(e)}static atEnd(e){return ac(e,e,e.content.size,e.childCount,-1)||new or(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Sx[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Sx)throw new RangeError("Duplicate use of selection JSON ID "+e);return Sx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return et.between(this.$anchor,this.$head).getBookmark()}}ot.prototype.visible=!0;class q2{constructor(e,n){this.$from=e,this.$to=n}}let Z1=!1;function eN(t){!Z1&&!t.parent.inlineContent&&(Z1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class et extends ot{constructor(e,n=e){eN(e),eN(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ot.near(r);let a=e.resolve(n.map(this.anchor));return new et(a.parent.inlineContent?a:r,r)}replace(e,n=_e.empty){if(super.replace(e,n),n==_e.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof et&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new dp(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new et(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=ot.findFrom(n,r,!0)||ot.findFrom(n,-r,!0);if(i)n=i.$head;else return ot.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(ot.findFrom(e,-r,!0)||ot.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&Ze.isSelectable(c))return Ze.create(t,n-(a<0?c.nodeSize:0))}else{let u=ac(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function tN(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(ot.near(t.doc.resolve(o),n))}const nN=1,vh=2,sN=4;class fO extends D0{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=vh,this}ensureMarks(e){return Zt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&vh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~vh,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Zt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ot.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=sN,this}get scrolledIntoView(){return(this.updated&sN)>0}}function rN(t,e){return!e||!t?t:t.bind(e)}class kd{constructor(e,n,r){this.name=e,this.init=rN(n.init,r),this.apply=rN(n.apply,r)}}const pO=[new kd("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new kd("selection",{init(t,e){return t.selection||ot.atStart(e.doc)},apply(t){return t.selection}}),new kd("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new kd("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Cx{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=pO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new kd(r.key,r.spec.state,r))})}}class fc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=e[r],i=a.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(a,this[a.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let a=new Cx(e.schema,e.plugins),i=new fc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=di.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=ot.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){i[o.name]=h.fromJSON.call(u,e,n[c],i);return}}i[o.name]=o.init(e,i)}}),i}}function G2(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=G2(a,e,{})),n[r]=a}return n}class rn{constructor(e){this.spec=e,this.props={},e.props&&G2(e.props,this,this.props),this.key=e.key?e.key.key:J2("plugin")}getState(e){return e[this.key]}}const Tx=Object.create(null);function J2(t){return t in Tx?t+"$"+ ++Tx[t]:(Tx[t]=0,t+"$")}class pn{constructor(e="key"){this.key=J2(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const z0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Q2(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Y2=(t,e,n)=>{let r=Q2(t,n);if(!r)return!1;let a=$0(r);if(!a){let o=r.blockRange(),c=o&&_c(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(iS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Sc(i,"end")||Ze.isSelectable(i)))for(let o=r.depth;;o--){let c=cp(t.doc,r.before(o),r.after(o),_e.empty);if(c&&c.slice.size1)break}return i.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos-i.nodeSize,a.pos).scrollIntoView()),!0):!1},mO=(t,e,n)=>{let r=Q2(t,n);if(!r)return!1;let a=$0(r);return a?X2(t,a,e):!1},xO=(t,e,n)=>{let r=eS(t,n);if(!r)return!1;let a=F0(r);return a?X2(t,a,e):!1};function X2(t,e,n){let r=e.nodeBefore,a=r,i=e.pos-1;for(;!a.isTextblock;i--){if(a.type.spec.isolating)return!1;let f=a.lastChild;if(!f)return!1;a=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=cp(t.doc,i,u,_e.empty);if(!h||h.from!=i||h instanceof Xn&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(et.create(f.doc,i)),n(f.scrollIntoView())}return!0}function Sc(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Z2=(t,e,n)=>{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=$0(r)}let o=i&&i.nodeBefore;return!o||!Ze.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ze.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function $0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function eS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=eS(t,n);if(!r)return!1;let a=F0(r);if(!a)return!1;let i=a.nodeAfter;if(iS(t,a,e,1))return!0;if(r.parent.content.size==0&&(Sc(i,"start")||Ze.isSelectable(i))){let o=cp(t.doc,r.before(),r.after(),_e.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Ze,a;if(r){if(n.node.isTextblock||!wo(t.doc,n.from))return!1;a=n.from}else if(a=lp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(Ze.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},yO=(t,e)=>{let n=t.selection,r;if(n instanceof Ze){if(n.node.isTextblock||!wo(t.doc,n.to))return!1;r=n.to}else if(r=lp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},bO=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&_c(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},sS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
-`).scrollIntoView()),!0)};function B0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let a=n.node(-1),i=n.indexAfter(-1),o=B0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(ot.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},rS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof or||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=B0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ui(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&_c(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function NO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof Ze&&e.selection.node.isBlock)return!r.parentOffset||!ui(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=B0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof et||e.selection instanceof or)&&f.deleteSelection();let m=f.mapping.map(r.pos),x=ui(f.doc,m,i.length,i);if(x||(i[0]=c?{type:c}:null,x=ui(f.doc,m,i.length,i)),!x)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),N=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const wO=NO(),jO=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(Ze.create(t.doc,a))),!0)};function kO(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,i=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||wo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function iS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&kO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,N=Ne.empty;for(let S=o.length-1;S>=0;S--)N=Ne.from(o[S].create(null,N));N=Ne.from(a.copy(N));let w=t.tr.step(new Zn(e.pos-1,y,e.pos,y,new _e(N,1,0),o.length,!0)),j=w.doc.resolve(y+2*o.length);j.nodeAfter&&j.nodeAfter.type==a.type&&wo(w.doc,j.pos)&&w.join(j.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ot.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),x=m&&_c(m);if(x!=null&&x>=e.depth)return n&&n(t.tr.lift(m,x).scrollIntoView()),!0;if(h&&Sc(i,"start",!0)&&Sc(a,"end")){let y=a,N=[];for(;N.push(y),!y.isTextblock;)y=y.lastChild;let w=i,j=1;for(;!w.isTextblock;w=w.firstChild)j++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let S=Ne.empty;for(let T=N.length-1;T>=0;T--)S=Ne.from(N[T].copy(S));let E=t.tr.step(new Zn(e.pos-N.length,e.pos+i.nodeSize,e.pos+j,e.pos+i.nodeSize-j,new _e(S,N.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function oS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(et.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const SO=oS(-1),CO=oS(1);function TO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&L0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function aN(t,e=null){return function(n,r){let a=!1;for(let i=0;i{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)a=!0;else{let f=n.doc.resolve(h),m=f.index();a=f.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let i=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);i=new af(u,u,e.depth),e.endIndex=0;f--)i=Ne.from(n[f].type.create(n[f].attrs,i));t.step(new Zn(e.start-(r?2:0),e.end,e.start,e.end,new _e(i,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?RO(e,n,t,i):PO(e,n,i):!0:!1}}function RO(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iw;N--)y-=a.child(N).nodeSize,r.delete(y-1,y+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?Ne.empty:Ne.from(a))))return!1;let m=i.pos,x=m+o.nodeSize;return r.step(new Zn(m-(c?1:0),x+(u?1:0),m+1,x-1,new _e((c?Ne.empty:Ne.from(a.copy(Ne.empty))).append(u?Ne.empty:Ne.from(a.copy(Ne.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function OO(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=Ne.from(h?t.create():null),m=new _e(Ne.from(t.create(null,Ne.from(c.type.create(null,f)))),h?3:1,0),x=i.start,y=i.end;n(e.tr.step(new Zn(x-(h?3:1),y,x,y,m,1,!0)).scrollIntoView())}return!0}}const ls=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Cc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Sg=null;const ai=function(t,e,n){let r=Sg||(Sg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},LO=function(){Sg=null},ml=function(t,e,n,r){return n&&(iN(t,e,n,r,-1)||iN(t,e,n,r,1))},DO=/^(img|br|input|textarea|hr)$/i;function iN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Sr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||cu(t)||DO.test(t.nodeName)||t.contentEditable=="false")return!1;e=ls(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?Sr(t):0}else return!1}}function Sr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function _O(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Sr(t)}else if(t.parentNode&&!cu(t))e=ls(t),t=t.parentNode;else return null}}function zO(t,e){for(;;){if(t.nodeType==3&&e2),kr=Tc||(wa?/Mac/.test(wa.platform):!1),dS=wa?/Win/.test(wa.platform):!1,ci=/Android \d/.test(jo),du=!!oN&&"webkitFontSmoothing"in oN.documentElement.style,VO=du?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function HO(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ei(t,e){return typeof t=="number"?t:t[e]}function UO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function lN(t,e,n){let r=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Cc(o);continue}let c=o,u=c==i.body,h=u?HO(i):UO(c),f=0,m=0;if(e.toph.bottom-ei(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ei(a,"top")-h.top:e.bottom-h.bottom+ei(a,"bottom")),e.lefth.right-ei(r,"right")&&(f=e.right-h.right+ei(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,N=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let w=c.scrollLeft-y,j=c.scrollTop-N;e={left:e.left-w,top:e.top-j,right:e.right-w,bottom:e.bottom-j}}let x=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(x))break;o=x=="absolute"?o.offsetParent:Cc(o)}}function WO(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,a;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){r=c,a=u.top;break}}return{refDOM:r,refTop:a,stack:uS(t.dom)}}function uS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Cc(r));return e}function KO({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;hS(n,r==0?0:r-e)}function hS(t,e){for(let n=0;n=c){o=Math.max(N.bottom,o),c=Math.min(N.top,c);let w=N.left>e.left?N.left-e.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>e.top&&!u&&N.left<=e.left&&N.right>=e.left&&(u=f,h={left:Math.max(N.left,Math.min(N.right,e.left)),top:N.top});!n&&(e.left>=N.right&&e.top>=N.top||e.left>=N.left&&e.top>=N.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?GO(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:fS(n,a)}function GO(t,e){let n=t.nodeValue.length,r=document.createRange(),a;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return r.detach(),a||{node:t,offset:0}}function H0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function JO(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,a,i)}function YO(t,e,n,r){let a=-1;for(let i=e,o=!1;i!=t.dom;){let c=t.docView.nearestDesc(i,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?a=c.posBefore:(!o&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function pS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;du&&a&&r.nodeType==1&&(h=r.childNodes[a-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&a--,r==t.dom&&a==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(a==0||r.nodeType!=1||r.childNodes[a-1].nodeName!="BR")&&(c=YO(t,r,a,e))}c==null&&(c=QO(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function cN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,yd(Gi(ai(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Sr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return Ex(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Sr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?ai(u,Sr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return yd(Gi(h,1),!1)}if(i==null&&a=0)}function yd(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ex(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function xS(t,e,n){let r=t.state,a=t.root.activeElement;r!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),a!=t.dom&&a&&a.focus()}}function eL(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return xS(t,e,()=>{let{node:i}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(i,!0);if(!c)break;if(c.node.isBlock){i=c.contentDOM||c.dom;break}i=c.dom.parentNode}let o=mS(t,a.pos,1);for(let c=i.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=ai(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const tL=/[\u0590-\u08ac]/;function nL(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let a=r.parentOffset,i=!a,o=a==r.parent.content.size,c=t.domSelection();return c?!tL.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:xS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),x=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:N,focusOffset:w}=t.domSelectionRange(),j=N&&!y.contains(N.nodeType==1?N:N.parentNode)||u==N&&h==w;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return x!=null&&(c.caretBidiLevel=x),j}):r.pos==r.start()||r.pos==r.end()}let dN=null,uN=null,hN=!1;function sL(t,e,n){return dN==e&&uN==n?hN:(dN=e,uN=n,hN=n=="up"||n=="down"?eL(t,e,n):nL(t,e,n))}const Tr=0,fN=1,Zo=2,ja=3;class uu{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=Tr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nls(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!1;break}if(i.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!0;break}if(i.nextSibling)break}}return a??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,a=e;a;a=a.parentNode){let i=this.getDesc(a),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let a=e;a;a=a.parentNode){let i=this.getDesc(a);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof yS){a=e-i;break}i=c}if(a)return this.children[r].domFromPos(a-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof gS&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ls(i.dom)+1:0}}else{let i,o=!0;for(;i=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let x=this.children[m-1];if(x.size&&x.dom.parentNode==this.contentDOM&&!x.emptyChildAt(1)){a=ls(x.dom)+1;break}e-=x.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fN&&on){let N=c;c=u,u=N}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?Zo:fN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=ja:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Zo:ja}r=o}this.dirty=Zo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Zo:fN;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Tr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class rL extends uu{constructor(e,n,r,a){super(e,[],n,null),this.textDOM=r,this.text=a}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class xl extends uu{constructor(e,n,r,a,i){super(e,[],r,a),this.mark=n,this.spec=i}static create(e,n,r,a){let i=a.nodeViews[n.type.name],o=i&&i(n,a,r);return(!o||!o.dom)&&(o=jl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new xl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ja||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ja&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Tr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=Ag(i,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,a),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=jl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let x=f;return f=NS(f,r,n),h?u=new aL(e,n,r,a,f,m||null,x,h,i,o+1):n.isText?new hp(e,n,r,a,f,x,i):new uo(e,n,r,a,f,m||null,x,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ne.empty)}return e}matchesNode(e,n,r){return this.dirty==Tr&&e.eq(this.node)&&lf(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,a=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,c=i&&i.pos<0,u=new oL(this,o&&o.node,e);dL(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?Zt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,x)=>{u.syncToMarks(h.marks,r,e,x);let y;u.findNodeMatch(h,f,m,x)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,x,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Zo)&&(o&&this.protectLocalComposition(e,o),bS(this.contentDOM,this.children,e),Tc&&uL(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof et)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=hL(this.node.content,o,r-n,a-n);return c<0?null:{node:i,pos:c,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:a}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new rL(this,i,n,a);e.input.compositionNodes.push(o),this.children=Ag(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==ja||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=Tr}updateOuterDeco(e){if(lf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=vS(this.dom,this.nodeDOM,Mg(this.outerDeco,this.node,n),Mg(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function pN(t,e,n,r,a){NS(r,e,t);let i=new uo(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class hp extends uo{constructor(e,n,r,a,i,o,c){super(e,n,r,a,i,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,a){return this.dirty==ja||this.dirty!=Tr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Tr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=Tr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let a=this.node.cut(e,n),i=document.createTextNode(a.text);return new hp(this.parent,a,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ja)}get domAtom(){return!1}isText(e){return this.node.text==e}}class yS extends uu{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Tr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class aL extends uo{constructor(e,n,r,a,i,o,c,u,h,f){super(e,n,r,a,i,o,c,h,f),this.spec=u}update(e,n,r,a){if(this.dirty==ja)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,a),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,a){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function bS(t,e,n){let r=t.firstChild,a=!1;for(let i=0;i>1,c=Math.min(o,e.length);for(;i-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=xl.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,a){let i=-1,o;if(a>=this.preMatch.index&&(o=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof xl)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(a-1))break;--a,i.set(c,a),o.push(c)}}return{index:a,matched:i,matches:o.reverse()}}function cL(t,e){return t.type.side-e.type.side}function dL(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let N=i+x.nodeSize;if(x.isText){let j=N;o!j.inline):c.slice();r(x,w,e.forChild(i,x),y),i=N}}function uL(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function hL(t,e,n,r){for(let a=0,i=0;a=n){if(i>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Ag(t,e,n,r,a){let i=[];for(let o=0,c=0;o=n||f<=e?i.push(u):(hn&&i.push(u.slice(n-h,u.size,r)))}return i}function U0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),i=a&&a.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(up(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&Ze.isSelectable(m)&&a.parent&&!(m.isInline&&$O(n.focusNode,n.focusOffset,a.dom))){let x=a.posBefore;h=new Ze(o==x?c:r.resolve(x))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,x=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!wS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function pL(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ls(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Js&&co<=11&&(n.disabled=!0,n.disabled=!1)}function jS(t,e){if(e instanceof Ze){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(bN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else bN(t)}function bN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function W0(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||et.between(e,n,r)}function vN(t){return t.editable&&!t.hasFocus()?!1:kS(t)}function kS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function mL(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ml(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ig(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&&ot.findFrom(i,e)}function Ji(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function NN(t,e,n){let r=t.state.selection;if(r instanceof et)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return Ji(t,new et(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=Ig(t.state,e);return a&&a instanceof Ze?Ji(t,a):!1}else if(!(kr&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ze.isSelectable(i)?Ji(t,new Ze(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):du?Ji(t,new et(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ze&&r.node.isInline)return Ji(t,new et(e>0?r.$to:r.$from));{let a=Ig(t.state,e);return a?Ji(t,a):!1}}}function cf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Od(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function sc(t,e){return e<0?xL(t):gL(t)}function xL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Cr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Od(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(SS(n))break;{let c=n.previousSibling;for(;c&&Od(c,-1);)a=n.parentNode,i=ls(c),c=c.previousSibling;if(c)n=c,r=cf(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Rg(t,n,r):a&&Rg(t,a,i)}function gL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=cf(n),i,o;for(;;)if(r{t.state==a&&hi(t)},50)}function wN(t,e){let n=t.state.doc.resolve(e);if(!(fs||dS)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>a.top&&o1)return i.lefta.top&&o1)return i.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function jN(t,e,n){let r=t.state.selection;if(r instanceof et&&!r.empty||n.indexOf("s")>-1||kr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Ig(t.state,e);if(o&&o instanceof Ze)return Ji(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof or?ot.near(o,e):ot.findFrom(o,e);return c?Ji(t,c):!1}return!1}function kN(t,e){if(!(t.state.selection instanceof et))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function SN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function vL(t){if(!ws||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;SN(t,r,"true"),setTimeout(()=>SN(t,r,"false"),20)}return!1}function NL(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function wL(t,e){let n=e.keyCode,r=NL(e);if(n==8||kr&&n==72&&r=="c")return kN(t,-1)||sc(t,-1);if(n==46&&!e.shiftKey||kr&&n==68&&r=="c")return kN(t,1)||sc(t,1);if(n==13||n==27)return!0;if(n==37||kr&&n==66&&r=="c"){let a=n==37?wN(t,t.state.selection.from)=="ltr"?-1:1:-1;return NN(t,a,r)||sc(t,a)}else if(n==39||kr&&n==70&&r=="c"){let a=n==39?wN(t,t.state.selection.from)=="ltr"?1:-1:1;return NN(t,a,r)||sc(t,a)}else{if(n==38||kr&&n==80&&r=="c")return jN(t,-1,r)||sc(t,-1);if(n==40||kr&&n==78&&r=="c")return vL(t)||jN(t,1,r)||sc(t,1);if(r==(kr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function K0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,i--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||jl.fromSchema(t.state.schema),c=IS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=AS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let N=c.createElement(f[y]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let x=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
+ */var z1;function w8(){if(z1)return bx;z1=1;var t=ru();function e(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,x){var y=x(),N=r({inst:{value:y,getSnapshot:x}}),w=N[0].inst,j=N[1];return i(function(){w.value=y,w.getSnapshot=x,u(w)&&j({inst:w})},[m,y,x]),a(function(){return u(w)&&j({inst:w}),m(function(){u(w)&&j({inst:w})})},[m]),o(y),y}function u(m){var x=m.getSnapshot;m=m.value;try{var y=x();return!n(m,y)}catch{return!0}}function h(m,x){return x()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return bx.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,bx}var $1;function m2(){return $1||($1=1,yx.exports=w8()),yx.exports}var x2=m2();function is(t){this.content=t}is.prototype={constructor:is,find:function(t){for(var e=0;e>1}};is.from=function(t){if(t instanceof is)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new is(e)};function g2(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let o=0;a.text[o]==i.text[o];o++)n++;return n}if(a.content.size||i.content.size){let o=g2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function y2(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,a+c,i||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),a+=c.nodeSize),o=u}return new we(r,a)}cutByIndex(e,n){return e==n?we.empty:e==0&&n==this.content.length?this:new we(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new we(a,i)}addToStart(e){return new we([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new we(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?yh(n+1,i):yh(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return we.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new we(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return we.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};Zt.none=[];class sf extends Error{}class _e{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=v2(this.content,e+this.openStart,n);return r&&new _e(r,this.openStart,this.openEnd)}removeBetween(e,n){return new _e(b2(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return _e.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _e(we.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new _e(e,r,a)}}_e.empty=new _e(we.empty,0,0);function b2(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(a==e||i.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(b2(i.content,e-a-1,n-a-1)))}function v2(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=v2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function j8(t,e,n){if(n.openStart>t.depth)throw new sf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sf("Inconsistent open depths");return N2(t,e,n,0)}function N2(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Id(t,e,n,r){let a=(e||t).node(n),i=0,o=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(sl(t.nodeAfter,r),i++));for(let c=i;ca&&vg(t,e,a+1),o=r.depth>a&&vg(n,r,a+1),c=[];return Id(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(w2(i,o),sl(rl(i,j2(t,e,n,r,a+1)),c)):(i&&sl(rl(i,rf(t,e,a+1)),c),Id(e,n,a,c),o&&sl(rl(o,rf(n,r,a+1)),c)),Id(r,null,a,c),new we(c)}function rf(t,e,n){let r=[];if(Id(null,t,n,r),t.depth>n){let a=vg(t,e,n+1);sl(rl(a,rf(t,e,n+1)),r)}return Id(e,null,n,r),new we(r)}function k8(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(we.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class Wd{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],a=e.child(n);return r?e.child(n).cut(r):a}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new af(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(r.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new Wd(n,r,i)}static resolveCached(e,n){let r=F1.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),k2(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=we.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=we.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};di.prototype.text=void 0;class of extends di{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):k2(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new of(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new of(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function k2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class fl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new E8(e,n);if(r.next==null)return fl.empty;let a=S2(r);r.next&&r.err("Unexpected trailing text");let i=L8(O8(a));return D8(i,r),i}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let a=0;a{let i=a+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(`
+`)}}fl.empty=new fl(!0);class E8{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function S2(t){let e=[];do e.push(M8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function M8(t){let e=[];do e.push(A8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function A8(t){let e=P8(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=I8(t,e);else break;return e}function B1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function I8(t,e){let n=B1(t),r=n;return t.eat(",")&&(t.next!="}"?r=B1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function R8(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let o=n[i];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function P8(t){if(t.eat("(")){let e=S2(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=R8(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function O8(t){let e=[[]];return a(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function a(o,c){o.forEach(u=>u.to=c)}function i(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(i(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=i(o.exprs[u],c);if(u==o.exprs.length-1)return h;a(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),a(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(i(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||a.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let i=e[r.join(",")]=new fl(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:E2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new di(this,this.computeAttrs(e),we.from(n),Zt.setFrom(r))}createChecked(e=null,n,r){return n=we.from(n),this.checkContent(n),new di(this,this.computeAttrs(e),n,Zt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=we.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(we.empty,!0);return i?new di(this,e,n.append(i),Zt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new I2(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function _8(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class z8{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?_8(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class op{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=A2(e,a.attrs),this.excluded=null;let i=T2(this.attrs);this.instance=i?new Zt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Zt(this,E2(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new op(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class R2{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=is.from(e.nodes),n.marks=is.from(e.marks||{}),this.nodes=H1.compile(this.spec.nodes,this),this.marks=op.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],o=i.spec.content||"",c=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=fl.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=c=="_"?null:c?U1(this,c.split(" ")):c==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:U1(this,o.split(" "))}this.nodeFromJSON=a=>di.fromJSON(this,a),this.markFromJSON=a=>Zt.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof H1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,a)}text(e,n){let r=this.nodes.text;return new of(r,r.defaultAttrs,e,Zt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function U1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function $8(t){return t.tag!=null}function F8(t){return t.style!=null}class lo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if($8(a))this.tags.push(a);else if(F8(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new K1(this,n,!1);return r.addAll(e,Zt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new K1(this,n,!0);return r.addAll(e,Zt.none,n.from,n.to),_e.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;ae.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(a){let i=a.priority==null?50:a.priority,o=0;for(;o{r(o=q1(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(o=>{r(o=q1(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new lo(e,lo.schemaRules(e)))}}const P2={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},B8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},O2={ol:!0,ul:!0},Kd=1,wg=2,Rd=4;function W1(t,e,n){return e!=null?(e?Kd:0)|(e==="full"?wg:0):t&&t.whitespace=="pre"?Kd|wg:n&~Rd}class bh{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=Zt.none,this.match=i||(o&Rd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(we.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Kd)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=we.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(we.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!P2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class K1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=W1(null,n.preserveWhitespace,0)|(r?Rd:0);a?i=new bh(a.type,a.attrs,Zt.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new bh(null,null,Zt.none,!0,null,o):i=new bh(e.schema.topNodeType,null,Zt.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,a=this.top,i=a.options&wg?"full":this.localPreserveWS||(a.options&Kd)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
+`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,a){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(i=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(a)this.addElement(e,r,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}i&&this.sync(c)&&this.open--}addAll(e,n,r,a){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=a==null?null:e.childNodes[a];o!=c;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let a,i;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!a||a.length>h.length+c)&&(a=h,i=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!a)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):G1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new bh(e,n,u,a,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Kd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(a?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=i;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&a?this.nodes[u].type:r&&u>=i?r.node(u-i).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function V8(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&O2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function H8(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function q1(t){let e={};for(let n in t)e[n]=t[n];return e}function G1(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let i=[],o=c=>{i.push(c);for(let u=0;u{if(i.length||o.marks.length){let c=0,u=0;for(;c=0;a--){let i=this.serializeMark(e.marks[a],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&_h(Nx(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return _h(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new jl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=J1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return J1(e.marks)}}function J1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Nx(t){return t.document||window.document}const Q1=new WeakMap;function U8(t){let e=Q1.get(t);return e===void 0&&Q1.set(t,e=W8(t)),e}function W8(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let x=m.indexOf(" ");x>0?u.setAttributeNS(m.slice(0,x),m.slice(x+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:N}=_h(t,x,n,r);if(u.appendChild(y),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const L2=65535,D2=Math.pow(2,16);function K8(t,e){return t+e*D2}function Y1(t){return t&L2}function q8(t){return(t-(t&L2))/D2}const _2=1,z2=2,zh=4,$2=8;class jg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&$2)>0}get deletedBefore(){return(this.delInfo&(_2|zh))>0}get deletedAfter(){return(this.delInfo&(z2|zh))>0}get deletedAcross(){return(this.delInfo&zh)>0}}class ar{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ar.empty)return ar.empty}recover(e){let n=0,r=Y1(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let x=h?e==u?-1:e==m?1:n:n,y=u+a+(x<0?0:f);if(r)return y;let N=e==(n<0?u:m)?null:K8(c/3,e-u),w=e==u?z2:e==m?_2:zh;return(n<0?e!=u:e!=m)&&(w|=$2),new jg(y,w,N)}a+=f-h}return r?e+a:new jg(e+a,0,null)}touches(e,n){let r=0,a=Y1(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+i],f=u+h;if(e<=f&&c==a*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let a=0,i=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new qd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return _n.fromReplace(e,this.from,this.to,i)}invert(){return new Jr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new so(n.pos,r.pos,this.mark)}merge(e){return e instanceof so&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new so(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new so(n.from,n.to,e.markFromJSON(n.mark))}}ks.jsonID("addMark",so);class Jr extends ks{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new _e(P0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return _n.fromReplace(e,this.from,this.to,r)}invert(){return new so(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Jr(n.from,n.to,e.markFromJSON(n.mark))}}ks.jsonID("removeMark",Jr);class ro extends ks{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return _n.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return _n.fromReplace(e,this.pos,this.pos+1,new _e(we.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;ar.pos?null:new Zn(n.pos,r.pos,a,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Zn(n.from,n.to,n.gapFrom,n.gapTo,_e.fromJSON(e,n.slice),n.insert,!!n.structure)}}ks.jsonID("replaceAround",Zn);function kg(t,e,n){let r=t.resolve(e),a=n-e,i=r.depth;for(;a>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,a--;if(a>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function G8(t,e,n,r){let a=[],i=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let x=Math.max(h,e),y=Math.min(h+u.nodeSize,n),N=r.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function J8(t,e,n,r){let a=[],i=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;i++;let u=null;if(r instanceof op){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new Jr(o.from,o.to,o.style)))}function O0(t,e,n,r=n.contentMatch,a=!0){let i=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function Q8(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function _c(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;N--)w||r.index(N)>0?(w=!0,f=we.from(r.node(N).copy(f)),m++):u--;let x=we.empty,y=0;for(let N=i,w=!1;N>n;N--)w||a.after(N+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=we.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new Zn(a,i,a,i,new _e(r,0,0),n.length,!0))}function tO(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof a=="function"?a(o):a;if(o.isTextblock&&!o.hasMarkup(r,u)&&nO(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!N?h=!1:!y&&N&&(h=!0)}h===!1&&B2(t,o,c,i),O0(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),x=f.map(c+o.nodeSize,1);return t.step(new Zn(m,x,m+1,x-1,new _e(we.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&F2(t,o,c,i),!1}})}function F2(t,e,n,r){e.forEach((a,i)=>{if(a.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(a.text);){let u=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function B2(t,e,n,r){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
+`))}})}function nO(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function sO(t,e,n,r,a){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,a||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Zn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new _e(we.from(o),0,0),1,!0))}function ui(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),x=a.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(x,m.childCount),N=r&&r[f+1];N&&(y=y.replaceChild(0,N.type.create(N.attrs)));let w=r&&r[f]||m;if(!m.canReplace(x+1,m.childCount)||!w.type.validContent(y))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function rO(t,e,n=1,r){let a=t.doc.resolve(e),i=we.empty,o=we.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=we.from(a.node(c).copy(i));let f=r&&r[h];o=we.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new Xn(e,e,new _e(i.append(o),n,n),!0))}function wo(t,e){let n=t.resolve(e),r=n.index();return V2(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function aO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let a=0;a0?(i=r.node(a+1),c++,o=r.node(a).maybeChild(c)):(i=r.node(a).maybeChild(c-1),o=r.node(a+1)),i&&!i.isTextblock&&V2(i,o)&&r.node(a).canReplace(c,c+1))return e;if(a==0)break;e=n<0?r.before(a):r.after(a)}}function iO(t,e,n){let r=null,{linebreakReplacement:a}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(a&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(a);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);B2(t,f.node(),f.before(),c)}o.inlineContent&&O0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new Xn(h,u.map(e+n,-1),_e.empty,!0)),r===!0){let f=t.doc.resolve(h);F2(t,f.node(),f.before(),t.steps.length)}return t}function oO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let a=r.depth-1;a>=0;a--){let i=r.index(a);if(r.node(a).canReplaceWith(i,i,n))return r.before(a+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let a=r.depth-1;a>=0;a--){let i=r.indexAfter(a);if(r.node(a).canReplaceWith(i,i,n))return r.after(a+1);if(i=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(i==1)f=h.canReplace(u,u,a);else{let m=h.contentMatchAt(u).findWrapping(a.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function cp(t,e,n=e,r=_e.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return U2(a,i,r)?new Xn(e,n,r):new lO(a,i,r).fit()}function U2(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class lO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=we.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=we.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new _e(i,o,c);return e>-1?new Zn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Xn(r.pos,a.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,a=this.unplaced.openEnd;r1&&(a=0),i.type.spec.isolating&&a<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let a,i=null;r?(i=jx(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(we.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=jx(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new _e(e,n+1,Math.max(r,a.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=jx(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new _e(wd(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new _e(wd(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let w=0;w1||u==0||w.content.size)&&(m=j,f.push(W2(w.mark(x.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?y:-1)))}let N=h==c.childCount;N||(y=-1),this.placed=jd(this.placed,n,we.from(f)),this.frontier[n].match=m,N&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,j=c;w1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=kx(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=jd(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let a=e.node(r),i=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,i)}return e}openFrontierNode(e,n=null,r){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=jd(this.placed,this.depth,we.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(we.empty,!0);n.childCount&&(this.placed=jd(this.placed,this.frontier.length,n))}}function wd(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(wd(t.firstChild.content,e-1,n)))}function jd(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(jd(t.lastChild.content,e-1,n)))}function jx(t,e){for(let n=0;n1&&(r=r.replaceChild(0,W2(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(we.empty,!0)))),t.copy(r)}function kx(t,e,n,r,a){let i=t.node(e),o=a?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let c=r.fillBefore(i.content,!0,o);return c&&!cO(n,i.content,o)?c:null}function cO(t,e,n){for(let r=n;r0;x--,y--){let N=a.node(x).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(x)>-1?c=x:a.before(x)==y&&o.splice(1,0,-x)}let u=o.indexOf(c),h=[],f=r.openStart;for(let x=r.content,y=0;;y++){let N=x.firstChild;if(h.push(N),y==r.openStart)break;x=N.content}for(let x=f-1;x>=0;x--){let y=h[x],N=dO(y.type);if(N&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=x;else if(N||!y.type.isTextblock)break}for(let x=r.openStart;x>=0;x--){let y=(x+f+1)%(r.openStart+1),N=h[y];if(N)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>m));x--){let y=o[x];y<0||(e=a.before(y),n=i.after(y))}}function K2(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(we.empty,!0))}return t}function hO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=oO(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new _e(we.from(r),0,0))}function fO(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=q2(r,a);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),a.indexAfter(c-1))))return t.delete(r.before(c),a.after(c))}for(let o=1;o<=r.depth&&o<=a.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&a.end(o)-n!=a.depth-o&&r.start(o-1)==a.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),a.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function q2(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let a=r;a>=0;a--){let i=t.start(a);if(ie.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(i==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==i-1)&&n.push(a)}return n}class xc extends ks{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return _n.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return _n.fromReplace(e,this.pos,this.pos+1,new _e(we.from(a),0,n.isLeaf?0:1))}getMap(){return ar.empty}invert(e){return new xc(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new xc(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new xc(n.pos,n.attr,n.value)}}ks.jsonID("attr",xc);class Gd extends ks{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return _n.ok(r)}getMap(){return ar.empty}invert(e){return new Gd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Gd(n.attr,n.value)}}ks.jsonID("docAttr",Gd);let kc=class extends Error{};kc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};kc.prototype=Object.create(Error.prototype);kc.prototype.constructor=kc;kc.prototype.name="TransformError";class D0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new qd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new kc(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=_e.empty){let a=cp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new _e(we.from(r),0,0))}delete(e,n){return this.replace(e,n,_e.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return uO(this,e,n,r),this}replaceRangeWith(e,n,r){return hO(this,e,n,r),this}deleteRange(e,n){return fO(this,e,n),this}lift(e,n){return Y8(this,e,n),this}join(e,n=1){return iO(this,e,n),this}wrap(e,n){return eO(this,e,n),this}setBlockType(e,n=e,r,a=null){return tO(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return sO(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new xc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Gd(e,n)),this}addNodeMark(e,n){return this.step(new ro(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Zt)n.isInSet(r.marks)&&this.step(new pl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new pl(e,i)),a=i.removeFromSet(a);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return rO(this,e,n,r),this}addMark(e,n,r){return G8(this,e,n,r),this}removeMark(e,n,r){return J8(this,e,n,r),this}clearIncompatible(e,n,r){return O0(this,e,n,r),this}}const Sx=Object.create(null);class ot{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new G2(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;i--){let o=n<0?ac(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):ac(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new or(e.node(0))}static atStart(e){return ac(e,e,0,0,1)||new or(e)}static atEnd(e){return ac(e,e,e.content.size,e.childCount,-1)||new or(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Sx[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Sx)throw new RangeError("Duplicate use of selection JSON ID "+e);return Sx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return et.between(this.$anchor,this.$head).getBookmark()}}ot.prototype.visible=!0;class G2{constructor(e,n){this.$from=e,this.$to=n}}let Z1=!1;function eN(t){!Z1&&!t.parent.inlineContent&&(Z1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class et extends ot{constructor(e,n=e){eN(e),eN(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ot.near(r);let a=e.resolve(n.map(this.anchor));return new et(a.parent.inlineContent?a:r,r)}replace(e,n=_e.empty){if(super.replace(e,n),n==_e.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof et&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new dp(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new et(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=ot.findFrom(n,r,!0)||ot.findFrom(n,-r,!0);if(i)n=i.$head;else return ot.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(ot.findFrom(e,-r,!0)||ot.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&Ze.isSelectable(c))return Ze.create(t,n-(a<0?c.nodeSize:0))}else{let u=ac(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function tN(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(ot.near(t.doc.resolve(o),n))}const nN=1,vh=2,sN=4;class mO extends D0{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=vh,this}ensureMarks(e){return Zt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&vh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~vh,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Zt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ot.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=sN,this}get scrolledIntoView(){return(this.updated&sN)>0}}function rN(t,e){return!e||!t?t:t.bind(e)}class kd{constructor(e,n,r){this.name=e,this.init=rN(n.init,r),this.apply=rN(n.apply,r)}}const xO=[new kd("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new kd("selection",{init(t,e){return t.selection||ot.atStart(e.doc)},apply(t){return t.selection}}),new kd("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new kd("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Cx{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=xO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new kd(r.key,r.spec.state,r))})}}class fc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=e[r],i=a.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(a,this[a.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let a=new Cx(e.schema,e.plugins),i=new fc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=di.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=ot.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){i[o.name]=h.fromJSON.call(u,e,n[c],i);return}}i[o.name]=o.init(e,i)}}),i}}function J2(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=J2(a,e,{})),n[r]=a}return n}class rn{constructor(e){this.spec=e,this.props={},e.props&&J2(e.props,this,this.props),this.key=e.key?e.key.key:Q2("plugin")}getState(e){return e[this.key]}}const Tx=Object.create(null);function Q2(t){return t in Tx?t+"$"+ ++Tx[t]:(Tx[t]=0,t+"$")}class pn{constructor(e="key"){this.key=Q2(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const z0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Y2(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const X2=(t,e,n)=>{let r=Y2(t,n);if(!r)return!1;let a=$0(r);if(!a){let o=r.blockRange(),c=o&&_c(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(oS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Sc(i,"end")||Ze.isSelectable(i)))for(let o=r.depth;;o--){let c=cp(t.doc,r.before(o),r.after(o),_e.empty);if(c&&c.slice.size1)break}return i.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos-i.nodeSize,a.pos).scrollIntoView()),!0):!1},gO=(t,e,n)=>{let r=Y2(t,n);if(!r)return!1;let a=$0(r);return a?Z2(t,a,e):!1},yO=(t,e,n)=>{let r=tS(t,n);if(!r)return!1;let a=F0(r);return a?Z2(t,a,e):!1};function Z2(t,e,n){let r=e.nodeBefore,a=r,i=e.pos-1;for(;!a.isTextblock;i--){if(a.type.spec.isolating)return!1;let f=a.lastChild;if(!f)return!1;a=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=cp(t.doc,i,u,_e.empty);if(!h||h.from!=i||h instanceof Xn&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(et.create(f.doc,i)),n(f.scrollIntoView())}return!0}function Sc(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const eS=(t,e,n)=>{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=$0(r)}let o=i&&i.nodeBefore;return!o||!Ze.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ze.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function $0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function tS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=tS(t,n);if(!r)return!1;let a=F0(r);if(!a)return!1;let i=a.nodeAfter;if(oS(t,a,e,1))return!0;if(r.parent.content.size==0&&(Sc(i,"start")||Ze.isSelectable(i))){let o=cp(t.doc,r.before(),r.after(),_e.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Ze,a;if(r){if(n.node.isTextblock||!wo(t.doc,n.from))return!1;a=n.from}else if(a=lp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(Ze.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},vO=(t,e)=>{let n=t.selection,r;if(n instanceof Ze){if(n.node.isTextblock||!wo(t.doc,n.to))return!1;r=n.to}else if(r=lp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},NO=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&_c(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},rS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
+`).scrollIntoView()),!0)};function B0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let a=n.node(-1),i=n.indexAfter(-1),o=B0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(ot.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},aS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof or||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=B0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ui(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&_c(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function jO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof Ze&&e.selection.node.isBlock)return!r.parentOffset||!ui(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=B0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof et||e.selection instanceof or)&&f.deleteSelection();let m=f.mapping.map(r.pos),x=ui(f.doc,m,i.length,i);if(x||(i[0]=c?{type:c}:null,x=ui(f.doc,m,i.length,i)),!x)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),N=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const kO=jO(),SO=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(Ze.create(t.doc,a))),!0)};function CO(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,i=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||wo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function oS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&CO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,N=we.empty;for(let S=o.length-1;S>=0;S--)N=we.from(o[S].create(null,N));N=we.from(a.copy(N));let w=t.tr.step(new Zn(e.pos-1,y,e.pos,y,new _e(N,1,0),o.length,!0)),j=w.doc.resolve(y+2*o.length);j.nodeAfter&&j.nodeAfter.type==a.type&&wo(w.doc,j.pos)&&w.join(j.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ot.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),x=m&&_c(m);if(x!=null&&x>=e.depth)return n&&n(t.tr.lift(m,x).scrollIntoView()),!0;if(h&&Sc(i,"start",!0)&&Sc(a,"end")){let y=a,N=[];for(;N.push(y),!y.isTextblock;)y=y.lastChild;let w=i,j=1;for(;!w.isTextblock;w=w.firstChild)j++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let S=we.empty;for(let T=N.length-1;T>=0;T--)S=we.from(N[T].copy(S));let E=t.tr.step(new Zn(e.pos-N.length,e.pos+i.nodeSize,e.pos+j,e.pos+i.nodeSize-j,new _e(S,N.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function lS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(et.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const TO=lS(-1),EO=lS(1);function MO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&L0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function aN(t,e=null){return function(n,r){let a=!1;for(let i=0;i{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)a=!0;else{let f=n.doc.resolve(h),m=f.index();a=f.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let i=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);i=new af(u,u,e.depth),e.endIndex