at?(Fn=nt,nt=null):Fn=nt.sibling;var ai=we(le,nt,Nt.value,Ae);if(ai===null){nt===null&&(nt=Fn);break}l&&nt&&ai.alternate===null&&d(le,nt),te=S(ai,te,at),tt===null?He=ai:tt.sibling=ai,tt=ai,nt=Fn}if(Nt.done)return p(le,nt),Xt&&ao(le,at),He;if(nt===null){for(;!Nt.done;at++,Nt=de.next())Nt=Se(le,Nt.value,Ae),Nt!==null&&(te=S(Nt,te,at),tt===null?He=Nt:tt.sibling=Nt,tt=Nt);return Xt&&ao(le,at),He}for(nt=x(le,nt);!Nt.done;at++,Nt=de.next())Nt=De(nt,le,at,Nt.value,Ae),Nt!==null&&(l&&Nt.alternate!==null&&nt.delete(Nt.key===null?at:Nt.key),te=S(Nt,te,at),tt===null?He=Nt:tt.sibling=Nt,tt=Nt);return l&&nt.forEach(function(yE){return d(le,yE)}),Xt&&ao(le,at),He}function bn(le,te,de,Ae){if(typeof de=="object"&&de!==null&&de.type===D&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case P:e:{for(var He=de.key,tt=te;tt!==null;){if(tt.key===He){if(He=de.type,He===D){if(tt.tag===7){p(le,tt.sibling),te=j(tt,de.props.children),te.return=le,le=te;break e}}else if(tt.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===K&&ab(He)===tt.type){p(le,tt.sibling),te=j(tt,de.props),te.ref=Mc(le,tt,de),te.return=le,le=te;break e}p(le,tt);break}else d(le,tt);tt=tt.sibling}de.type===D?(te=po(de.props.children,le.mode,Ae,de.key),te.return=le,le=te):(Ae=Ou(de.type,de.key,de.props,null,le.mode,Ae),Ae.ref=Mc(le,te,de),Ae.return=le,le=Ae)}return A(le);case $:e:{for(tt=de.key;te!==null;){if(te.key===tt)if(te.tag===4&&te.stateNode.containerInfo===de.containerInfo&&te.stateNode.implementation===de.implementation){p(le,te.sibling),te=j(te,de.children||[]),te.return=le,le=te;break e}else{p(le,te);break}else d(le,te);te=te.sibling}te=Mm(de,le.mode,Ae),te.return=le,le=te}return A(le);case K:return tt=de._init,bn(le,te,tt(de._payload),Ae)}if(Qt(de))return ze(le,te,de,Ae);if(q(de))return Ve(le,te,de,Ae);du(le,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,te!==null&&te.tag===6?(p(le,te.sibling),te=j(te,de),te.return=le,le=te):(p(le,te),te=Tm(de,le.mode,Ae),te.return=le,le=te),A(le)):p(le,te)}return bn}var pl=ib(!0),ob=ib(!1),uu=Ga(null),hu=null,ml=null,zp=null;function $p(){zp=ml=hu=null}function Fp(l){var d=uu.current;Jt(uu),l._currentValue=d}function Bp(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function gl(l,d){hu=l,zp=ml=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Ms=!0),l.firstContext=null)}function Zs(l){var d=l._currentValue;if(zp!==l)if(l={context:l,memoizedValue:d,next:null},ml===null){if(hu===null)throw Error(n(308));ml=l,hu.dependencies={lanes:0,firstContext:l}}else ml=ml.next=l;return d}var io=null;function Vp(l){io===null?io=[l]:io.push(l)}function lb(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,Vp(d)):(p.next=j.next,j.next=p),d.interleaved=p,da(l,x)}function da(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 Qa=!1;function Hp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cb(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 ua(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Xa(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(xt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,da(l,p)}return j=x.interleaved,j===null?(d.next=d,Vp(x)):(d.next=j.next,j.next=d),x.interleaved=d,da(l,p)}function fu(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,dc(l,p)}}function db(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:x.baseState,firstBaseUpdate:j,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function pu(l,d,p,x){var j=l.updateQueue;Qa=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,B=j.shared.pending;if(B!==null){j.shared.pending=null;var Y=B,fe=Y.next;Y.next=null,A===null?S=fe:A.next=fe,A=Y;var je=l.alternate;je!==null&&(je=je.updateQueue,B=je.lastBaseUpdate,B!==A&&(B===null?je.firstBaseUpdate=fe:B.next=fe,je.lastBaseUpdate=Y))}if(S!==null){var Se=j.baseState;A=0,je=fe=Y=null,B=S;do{var we=B.lane,De=B.eventTime;if((x&we)===we){je!==null&&(je=je.next={eventTime:De,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var ze=l,Ve=B;switch(we=d,De=p,Ve.tag){case 1:if(ze=Ve.payload,typeof ze=="function"){Se=ze.call(De,Se,we);break e}Se=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Ve.payload,we=typeof ze=="function"?ze.call(De,Se,we):ze,we==null)break e;Se=F({},Se,we);break e;case 2:Qa=!0}}B.callback!==null&&B.lane!==0&&(l.flags|=64,we=j.effects,we===null?j.effects=[B]:we.push(B))}else De={eventTime:De,lane:we,tag:B.tag,payload:B.payload,callback:B.callback,next:null},je===null?(fe=je=De,Y=Se):je=je.next=De,A|=we;if(B=B.next,B===null){if(B=j.shared.pending,B===null)break;we=B,B=we.next,we.next=null,j.lastBaseUpdate=we,j.shared.pending=null}}while(!0);if(je===null&&(Y=Se),j.baseState=Y,j.firstBaseUpdate=fe,j.lastBaseUpdate=je,d=j.shared.interleaved,d!==null){j=d;do A|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);co|=A,l.lanes=A,l.memoizedState=Se}}function ub(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Gp.transition;Gp.transition={};try{l(!1),d()}finally{vt=p,Gp.transition=x}}function Ab(){return er().memoizedState}function V3(l,d,p){var x=ni(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},Ib(l))Rb(d,p);else if(p=lb(l,d,p,x),p!==null){var j=bs();vr(p,l,x,j),Pb(p,d,x)}}function H3(l,d,p){var x=ni(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(Ib(l))Rb(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,B=S(A,p);if(j.hasEagerState=!0,j.eagerState=B,mr(B,A)){var Y=d.interleaved;Y===null?(j.next=j,Vp(d)):(j.next=Y.next,Y.next=j),d.interleaved=j;return}}catch{}finally{}p=lb(l,d,j,x),p!==null&&(j=bs(),vr(p,l,x,j),Pb(p,d,x))}}function Ib(l){var d=l.alternate;return l===cn||d!==null&&d===cn}function Rb(l,d){Pc=xu=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Pb(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,dc(l,p)}}var vu={readContext:Zs,useCallback:ns,useContext:ns,useEffect:ns,useImperativeHandle:ns,useInsertionEffect:ns,useLayoutEffect:ns,useMemo:ns,useReducer:ns,useRef:ns,useState:ns,useDebugValue:ns,useDeferredValue:ns,useTransition:ns,useMutableSource:ns,useSyncExternalStore:ns,useId:ns,unstable_isNewReconciler:!1},W3={readContext:Zs,useCallback:function(l,d){return $r().memoizedState=[l,d===void 0?null:d],l},useContext:Zs,useEffect:wb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,yu(4194308,4,Sb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return yu(4194308,4,l,d)},useInsertionEffect:function(l,d){return yu(4,2,l,d)},useMemo:function(l,d){var p=$r();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=$r();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=V3.bind(null,cn,l),[x.memoizedState,l]},useRef:function(l){var d=$r();return l={current:l},d.memoizedState=l},useState:vb,useDebugValue:tm,useDeferredValue:function(l){return $r().memoizedState=l},useTransition:function(){var l=vb(!1),d=l[0];return l=B3.bind(null,l[1]),$r().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=cn,j=$r();if(Xt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),$n===null)throw Error(n(349));(lo&30)!==0||mb(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,wb(xb.bind(null,x,S,l),[l]),x.flags|=2048,Lc(9,gb.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=$r(),d=$n.identifierPrefix;if(Xt){var p=ca,x=la;p=(x&~(1<<32-Qe(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=Oc++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[_r]=d,l[Ec]=x,Zb(l,d,!1,!1),d.stateNode=l;e:{switch(A=Mr(p,x),p){case"dialog":Gt("cancel",l),Gt("close",l),j=x;break;case"iframe":case"object":case"embed":Gt("load",l),j=x;break;case"video":case"audio":for(j=0;jNl&&(d.flags|=128,x=!0,_c(S,!1),d.lanes=4194304)}else{if(!x)if(l=mu(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),_c(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Xt)return ss(d),null}else 2*Ut()-S.renderingStartTime>Nl&&p!==1073741824&&(d.flags|=128,x=!0,_c(S,!1),d.lanes=4194304);S.isBackwards?(A.sibling=d.child,d.child=A):(p=S.last,p!==null?p.sibling=A:d.child=A,S.last=A)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=Ut(),d.sibling=null,p=ln.current,Ft(ln,x?p&1|2:p&1),d):(ss(d),null);case 22:case 23:return Sm(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(_s&1073741824)!==0&&(ss(d),d.subtreeFlags&6&&(d.flags|=8192)):ss(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function X3(l,d){switch(Op(d),d.tag){case 1:return Ts(d.type)&&ru(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return xl(),Jt(Es),Jt(ts),qp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Up(d),null;case 13:if(Jt(ln),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));fl()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Jt(ln),null;case 4:return xl(),null;case 10:return Fp(d.type._context),null;case 22:case 23:return Sm(),null;case 24:return null;default:return null}}var ku=!1,rs=!1,Z3=typeof WeakSet=="function"?WeakSet:Set,_e=null;function bl(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){hn(l,d,x)}else p.current=null}function fm(l,d,p){try{p()}catch(x){hn(l,d,x)}}var nv=!1;function eE(l,d){if(Sp=Zo,l=Oy(),xp(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var j=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,B=-1,Y=-1,fe=0,je=0,Se=l,we=null;t:for(;;){for(var De;Se!==p||j!==0&&Se.nodeType!==3||(B=A+j),Se!==S||x!==0&&Se.nodeType!==3||(Y=A+x),Se.nodeType===3&&(A+=Se.nodeValue.length),(De=Se.firstChild)!==null;)we=Se,Se=De;for(;;){if(Se===l)break t;if(we===p&&++fe===j&&(B=A),we===S&&++je===x&&(Y=A),(De=Se.nextSibling)!==null)break;Se=we,we=Se.parentNode}Se=De}p=B===-1||Y===-1?null:{start:B,end:Y}}else p=null}p=p||{start:0,end:0}}else p=null;for(Cp={focusedElem:l,selectionRange:p},Zo=!1,_e=d;_e!==null;)if(d=_e,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,_e=l;else for(;_e!==null;){d=_e;try{var ze=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(ze!==null){var Ve=ze.memoizedProps,bn=ze.memoizedState,le=d.stateNode,te=le.getSnapshotBeforeUpdate(d.elementType===d.type?Ve:xr(d.type,Ve),bn);le.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var de=d.stateNode.containerInfo;de.nodeType===1?de.textContent="":de.nodeType===9&&de.documentElement&&de.removeChild(de.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ae){hn(d,d.return,Ae)}if(l=d.sibling,l!==null){l.return=d.return,_e=l;break}_e=d.return}return ze=nv,nv=!1,ze}function zc(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&fm(d,p,S)}j=j.next}while(j!==x)}}function Su(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 x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function pm(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 sv(l){var d=l.alternate;d!==null&&(l.alternate=null,sv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[_r],delete d[Ec],delete d[Ap],delete d[L3],delete d[_3])),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 rv(l){return l.tag===5||l.tag===3||l.tag===4}function av(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||rv(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 mm(l,d,p){var x=l.tag;if(x===5||x===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=nu));else if(x!==4&&(l=l.child,l!==null))for(mm(l,d,p),l=l.sibling;l!==null;)mm(l,d,p),l=l.sibling}function gm(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(gm(l,d,p),l=l.sibling;l!==null;)gm(l,d,p),l=l.sibling}var Kn=null,yr=!1;function Za(l,d,p){for(p=p.child;p!==null;)iv(l,d,p),p=p.sibling}function iv(l,d,p){if(Oe&&typeof Oe.onCommitFiberUnmount=="function")try{Oe.onCommitFiberUnmount(G,p)}catch{}switch(p.tag){case 5:rs||bl(p,d);case 6:var x=Kn,j=yr;Kn=null,Za(l,d,p),Kn=x,yr=j,Kn!==null&&(yr?(l=Kn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Kn.removeChild(p.stateNode));break;case 18:Kn!==null&&(yr?(l=Kn,p=p.stateNode,l.nodeType===8?Mp(l.parentNode,p):l.nodeType===1&&Mp(l,p),Qi(l)):Mp(Kn,p.stateNode));break;case 4:x=Kn,j=yr,Kn=p.stateNode.containerInfo,yr=!0,Za(l,d,p),Kn=x,yr=j;break;case 0:case 11:case 14:case 15:if(!rs&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var S=j,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&fm(p,d,A),j=j.next}while(j!==x)}Za(l,d,p);break;case 1:if(!rs&&(bl(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(B){hn(p,d,B)}Za(l,d,p);break;case 21:Za(l,d,p);break;case 22:p.mode&1?(rs=(x=rs)||p.memoizedState!==null,Za(l,d,p),rs=x):Za(l,d,p);break;default:Za(l,d,p)}}function ov(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new Z3),d.forEach(function(x){var j=cE.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function br(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=A),x&=~S}if(x=j,x=Ut()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*nE(x/1960))-x,10l?16:l,ti===null)var x=!1;else{if(l=ti,ti=null,Au=0,(xt&6)!==0)throw Error(n(331));var j=xt;for(xt|=4,_e=l.current;_e!==null;){var S=_e,A=S.child;if((_e.flags&16)!==0){var B=S.deletions;if(B!==null){for(var Y=0;YUt()-bm?ho(l,0):ym|=p),Is(l,d)}function vv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Un,Un<<=1,(Un&130023424)===0&&(Un=4194304)));var p=bs();l=da(l,d),l!==null&&(Gi(l,d,p),Is(l,p))}function lE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),vv(l,p)}function cE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),vv(l,p)}var Nv;Nv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||Es.current)Ms=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return Ms=!1,Y3(l,d,p);Ms=(l.flags&131072)!==0}else Ms=!1,Xt&&(d.flags&1048576)!==0&&eb(d,lu,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;ju(l,d),l=d.pendingProps;var j=dl(d,ts.current);gl(d,p),j=Yp(null,d,x,l,j,p);var S=Qp();return d.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,Ts(x)?(S=!0,au(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Hp(d),j.updater=Nu,d.stateNode=j,j._reactInternals=d,sm(d,x,l,p),d=om(null,d,x,!0,S,p)):(d.tag=0,Xt&&S&&Pp(d),ys(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(ju(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=uE(x),l=xr(x,l),j){case 0:d=im(null,d,x,l,p);break e;case 1:d=qb(null,d,x,l,p);break e;case 11:d=Vb(null,d,x,l,p);break e;case 14:d=Hb(null,d,x,xr(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:xr(x,j),im(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:xr(x,j),qb(l,d,x,j,p);case 3:e:{if(Gb(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,cb(l,d),pu(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=yl(Error(n(423)),d),d=Jb(l,d,x,p,j);break e}else if(x!==j){j=yl(Error(n(424)),d),d=Jb(l,d,x,p,j);break e}else for(Ls=qa(d.stateNode.containerInfo.firstChild),Ds=d,Xt=!0,gr=null,p=ob(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(fl(),x===j){d=ha(l,d,p);break e}ys(l,d,x,p)}d=d.child}return d;case 5:return hb(d),l===null&&Lp(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,Ep(x,j)?A=null:S!==null&&Ep(x,S)&&(d.flags|=32),Kb(l,d),ys(l,d,A,p),d.child;case 6:return l===null&&Lp(d),null;case 13:return Yb(l,d,p);case 4:return Wp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=pl(d,null,x,p):ys(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:xr(x,j),Vb(l,d,x,j,p);case 7:return ys(l,d,d.pendingProps,p),d.child;case 8:return ys(l,d,d.pendingProps.children,p),d.child;case 12:return ys(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,j=d.pendingProps,S=d.memoizedProps,A=j.value,Ft(uu,x._currentValue),x._currentValue=A,S!==null)if(mr(S.value,A)){if(S.children===j.children&&!Es.current){d=ha(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var B=S.dependencies;if(B!==null){A=S.child;for(var Y=B.firstContext;Y!==null;){if(Y.context===x){if(S.tag===1){Y=ua(-1,p&-p),Y.tag=2;var fe=S.updateQueue;if(fe!==null){fe=fe.shared;var je=fe.pending;je===null?Y.next=Y:(Y.next=je.next,je.next=Y),fe.pending=Y}}S.lanes|=p,Y=S.alternate,Y!==null&&(Y.lanes|=p),Bp(S.return,p,d),B.lanes|=p;break}Y=Y.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,B=A.alternate,B!==null&&(B.lanes|=p),Bp(A,p,d),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===d){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}ys(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,gl(d,p),j=Zs(j),x=x(j),d.flags|=1,ys(l,d,x,p),d.child;case 14:return x=d.type,j=xr(x,d.pendingProps),j=xr(x.type,j),Hb(l,d,x,j,p);case 15:return Wb(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:xr(x,j),ju(l,d),d.tag=1,Ts(x)?(l=!0,au(d)):l=!1,gl(d,p),Db(d,x,j),sm(d,x,j,p),om(null,d,x,!0,l,p);case 19:return Xb(l,d,p);case 22:return Ub(l,d,p)}throw Error(n(156,d.tag))};function wv(l,d){return ta(l,d)}function dE(l,d,p,x){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=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nr(l,d,p,x){return new dE(l,d,p,x)}function Em(l){return l=l.prototype,!(!l||!l.isReactComponent)}function uE(l){if(typeof l=="function")return Em(l)?1:0;if(l!=null){if(l=l.$$typeof,l===ne)return 11;if(l===z)return 14}return 2}function ri(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 Ou(l,d,p,x,j,S){var A=2;if(x=l,typeof l=="function")Em(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case D:return po(p.children,j,S,d);case R:A=8,j|=8;break;case O:return l=nr(12,p,d,j|2),l.elementType=O,l.lanes=S,l;case pe:return l=nr(13,p,d,j),l.elementType=pe,l.lanes=S,l;case ge:return l=nr(19,p,d,j),l.elementType=ge,l.lanes=S,l;case U:return Du(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:A=10;break e;case se:A=9;break e;case ne:A=11;break e;case z:A=14;break e;case K:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=nr(A,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function po(l,d,p,x){return l=nr(7,l,x,d),l.lanes=p,l}function Du(l,d,p,x){return l=nr(22,l,x,d),l.elementType=U,l.lanes=p,l.stateNode={isHidden:!1},l}function Tm(l,d,p){return l=nr(6,l,null,d),l.lanes=p,l}function Mm(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 hE(l,d,p,x,j){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=ra(0),this.expirationTimes=ra(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ra(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function Am(l,d,p,x,j,S,A,B,Y){return l=new hE(l,d,p,B,Y),d===1?(d=1,S===!0&&(d|=8)):d=0,S=nr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hp(S),l}function fE(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Lm.exports=SE(),Lm.exports}var Lv;function CE(){if(Lv)return Vu;Lv=1;var t=Vw();return Vu.createRoot=t.createRoot,Vu.hydrateRoot=t.hydrateRoot,Vu}var EE=CE(),Dd=Vw();const Hw=Bw(Dd);/**
- * @remix-run/router v1.23.2
- *
- * Copyright (c) Remix Software Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.md file in the root directory of this source tree.
- *
- * @license MIT
- */function gd(){return gd=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Qx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function ME(){return Math.random().toString(36).substr(2,8)}function zv(t,e){return{usr:t.state,key:t.key,idx:e}}function _g(t,e,n,s){return n===void 0&&(n=null),gd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Xl(e):e,{state:n,key:e&&e.key||s||ME()})}function Ch(t){let{pathname:e="/",search:n="",hash:s=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function Xl(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let s=t.indexOf("?");s>=0&&(e.search=t.substr(s),t=t.substr(0,s)),t&&(e.pathname=t)}return e}function AE(t,e,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:i=!1}=s,o=a.history,c=xi.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(gd({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=xi.Pop;let v=f(),k=v==null?null:v-h;h=v,u&&u({action:c,location:w.location,delta:k})}function g(v,k){c=xi.Push;let C=_g(w.location,v,k);h=f()+1;let E=zv(C,h),M=w.createHref(C);try{o.pushState(E,"",M)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;a.location.assign(M)}i&&u&&u({action:c,location:w.location,delta:1})}function y(v,k){c=xi.Replace;let C=_g(w.location,v,k);h=f();let E=zv(C,h),M=w.createHref(C);o.replaceState(E,"",M),i&&u&&u({action:c,location:w.location,delta:0})}function N(v){let k=a.location.origin!=="null"?a.location.origin:a.location.href,C=typeof v=="string"?v:Ch(v);return C=C.replace(/ $/,"%20"),Nn(k,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,k)}let w={get action(){return c},get location(){return t(a,o)},listen(v){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(_v,m),u=v,()=>{a.removeEventListener(_v,m),u=null}},createHref(v){return e(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(v){return o.go(v)}};return w}var $v;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})($v||($v={}));function IE(t,e,n){return n===void 0&&(n="/"),RE(t,e,n)}function RE(t,e,n,s){let a=typeof e=="string"?Xl(e):e,i=Xx(a.pathname||"/",n);if(i==null)return null;let o=Ww(t);PE(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("/")&&(Nn(u.relativePath.startsWith(s),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(s.length));let h=wi([s,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(Nn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),Ww(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:FE(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 Uw(i.path))a(i,o,u)}),e}function Uw(t){let e=t.split("/");if(e.length===0)return[];let[n,...s]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return a?[i,""]:[i];let o=Uw(s.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 PE(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:BE(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const OE=/^:[\w-]+$/,DE=3,LE=2,_E=1,zE=10,$E=-2,Fv=t=>t==="*";function FE(t,e){let n=t.split("/"),s=n.length;return n.some(Fv)&&(s+=$E),e&&(s+=LE),n.filter(a=>!Fv(a)).reduce((a,i)=>a+(OE.test(i)?DE:i===""?_E:zE),s)}function BE(t,e){return t.length===e.length&&t.slice(0,-1).every((s,a)=>s===e[a])?t[t.length-1]-e[e.length-1]:0}function VE(t,e,n){let{routesMeta:s}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const N=c[m];return y&&!N?h[g]=void 0:h[g]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function WE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Qx(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 s=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(s.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),s]}function UE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Qx(!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 Xx(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,s=t.charAt(n);return s&&s!=="/"?null:t.slice(n)||"/"}const KE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qE=t=>KE.test(t);function GE(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:a=""}=typeof t=="string"?Xl(t):t,i;if(n)if(qE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Qx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Bv(n.substring(1),"/"):i=Bv(n,e)}else i=e;return{pathname:i,search:QE(s),hash:XE(a)}}function Bv(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 $m(t,e,n,s){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(s)+"]. 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 JE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Zx(t,e){let n=JE(t);return e?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function e0(t,e,n,s){s===void 0&&(s=!1);let a;typeof t=="string"?a=Xl(t):(a=gd({},t),Nn(!a.pathname||!a.pathname.includes("?"),$m("?","pathname","search",a)),Nn(!a.pathname||!a.pathname.includes("#"),$m("#","pathname","hash",a)),Nn(!a.search||!a.search.includes("#"),$m("#","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(!s&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=GE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const wi=t=>t.join("/").replace(/\/\/+/g,"/"),YE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),QE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,XE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function ZE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Kw=["post","put","patch","delete"];new Set(Kw);const eT=["get",...Kw];new Set(eT);/**
- * React Router v6.30.3
- *
- * Copyright (c) Remix Software Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.md file in the root directory of this source tree.
- *
- * @license MIT
- */function xd(){return xd=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"){s.go(h);return}let m=e0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:wi([e,m.pathname])),(f.replace?s.replace:s.push)(m,f.state,f)},[e,s,o,i,t])}const rT=b.createContext(null);function aT(t){let e=b.useContext(Aa).outlet;return e&&b.createElement(rT.Provider,{value:t},e)}function Jw(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=b.useContext(Oi),{matches:a}=b.useContext(Aa),{pathname:i}=Di(),o=JSON.stringify(Zx(a,s.v7_relativeSplatPath));return b.useMemo(()=>e0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function iT(t,e){return oT(t,e)}function oT(t,e,n,s){Zl()||Nn(!1);let{navigator:a}=b.useContext(Oi),{matches:i}=b.useContext(Aa),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Di(),f;if(e){var m;let v=typeof e=="string"?Xl(e):e;u==="/"||(m=v.pathname)!=null&&m.startsWith(u)||Nn(!1),f=v}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let v=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let N=IE(t,{pathname:y}),w=hT(N&&N.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:wi([u,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?u:wi([u,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,s);return e&&w?b.createElement(Af.Provider,{value:{location:xd({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:xi.Pop}},w):w}function lT(){let t=gT(),e=ZE(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 cT=b.createElement(lT,null);class dT 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(Aa.Provider,{value:this.props.routeContext},b.createElement(qw.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function uT(t){let{routeContext:e,match:n,children:s}=t,a=b.useContext(t0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Aa.Provider,{value:e},s)}function hT(t,e,n,s){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),s===void 0&&(s=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=s)!=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||Nn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&s&&s.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let y,N=!1,w=null,v=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,w=m.route.errorElement||cT,u&&(h<0&&g===0?(yT("route-fallback"),N=!0,v=null):h===g&&(N=!0,v=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),C=()=>{let E;return y?E=w:N?E=v:m.route.Component?E=b.createElement(m.route.Component,null):m.route.element?E=m.route.element:E=f,b.createElement(uT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:E})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(dT,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):C()},null)}var Yw=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Yw||{}),Qw=(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})(Qw||{});function fT(t){let e=b.useContext(t0);return e||Nn(!1),e}function pT(t){let e=b.useContext(tT);return e||Nn(!1),e}function mT(t){let e=b.useContext(Aa);return e||Nn(!1),e}function Xw(t){let e=mT(),n=e.matches[e.matches.length-1];return n.route.id||Nn(!1),n.route.id}function gT(){var t;let e=b.useContext(qw),n=pT(),s=Xw();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function xT(){let{router:t}=fT(Yw.UseNavigateStable),e=Xw(Qw.UseNavigateStable),n=b.useRef(!1);return Gw(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,xd({fromRouteId:e},i)))},[t,e])}const Vv={};function yT(t,e,n){Vv[t]||(Vv[t]=!0)}function bT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Fm(t){let{to:e,replace:n,state:s,relative:a}=t;Zl()||Nn(!1);let{future:i,static:o}=b.useContext(Oi),{matches:c}=b.useContext(Aa),{pathname:u}=Di(),h=Li(),f=e0(e,Zx(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:s,relative:a}),[h,m,a,n,s]),null}function vT(t){return aT(t.context)}function Bt(t){Nn(!1)}function NT(t){let{basename:e="/",children:n=null,location:s,navigationType:a=xi.Pop,navigator:i,static:o=!1,future:c}=t;Zl()&&Nn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:xd({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof s=="string"&&(s=Xl(s));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:N="default"}=s,w=b.useMemo(()=>{let v=Xx(f,u);return v==null?null:{location:{pathname:v,search:m,hash:g,state:y,key:N},navigationType:a}},[u,f,m,g,y,N,a]);return w==null?null:b.createElement(Oi.Provider,{value:h},b.createElement(Af.Provider,{children:n,value:w}))}function wT(t){let{children:e,location:n}=t;return iT(zg(e),n)}new Promise(()=>{});function zg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(s,a)=>{if(!b.isValidElement(s))return;let i=[...e,a];if(s.type===b.Fragment){n.push.apply(n,zg(s.props.children,i));return}s.type!==Bt&&Nn(!1),!s.props.index||!s.props.children||Nn(!1);let o={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(o.children=zg(s.props.children,i)),n.push(o)}),n}/**
- * React Router DOM v6.30.3
- *
- * Copyright (c) Remix Software Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.md file in the root directory of this source tree.
- *
- * @license MIT
- */function $g(){return $g=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function kT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ST(t,e){return t.button===0&&(!e||e==="_self")&&!kT(t)}function Fg(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 s=t[n];return e.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function CT(t,e){let n=Fg(t);return e&&e.forEach((s,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const ET=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],TT="6";try{window.__reactRouterVersion=TT}catch{}const MT="startTransition",Hv=Mf[MT];function AT(t){let{basename:e,children:n,future:s,window:a}=t,i=b.useRef();i.current==null&&(i.current=TE({window:a,v5Compat:!0}));let o=i.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=s||{},f=b.useCallback(m=>{h&&Hv?Hv(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>bT(s),[s]),b.createElement(NT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:s})}const IT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",RT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Bg=b.forwardRef(function(e,n){let{onClick:s,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=jT(e,ET),{basename:y}=b.useContext(Oi),N,w=!1;if(typeof h=="string"&&RT.test(h)&&(N=h,IT))try{let E=new URL(window.location.href),M=h.startsWith("//")?new URL(E.protocol+h):new URL(h),P=Xx(M.pathname,y);M.origin===E.origin&&P!=null?h=P+M.search+M.hash:w=!0}catch{}let v=nT(h,{relative:a}),k=PT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function C(E){s&&s(E),E.defaultPrevented||k(E)}return b.createElement("a",$g({},g,{href:N||v,onClick:w||i?s:C,ref:n,target:u}))});var Wv;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Wv||(Wv={}));var Uv;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Uv||(Uv={}));function PT(t,e){let{target:n,replace:s,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Li(),h=Di(),f=Jw(t,{relative:o});return b.useCallback(m=>{if(ST(m,n)){m.preventDefault();let g=s!==void 0?s:Ch(h)===Ch(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,s,a,n,t,i,o,c])}function Zw(t){let e=b.useRef(Fg(t)),n=b.useRef(!1),s=Di(),a=b.useMemo(()=>CT(s.search,n.current?null:e.current),[s.search]),i=Li(),o=b.useCallback((c,u)=>{const h=Fg(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 OT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),DT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,s)=>s?s.toUpperCase():n.toLowerCase()),Kv=t=>{const e=DT(t);return e.charAt(0).toUpperCase()+e.slice(1)},ej=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim(),LT=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 _T={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 zT=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,..._T,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:ej("lucide",a),...!i&&!LT(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 Me=(t,e)=>{const n=b.forwardRef(({className:s,...a},i)=>b.createElement(zT,{ref:i,iconNode:e,className:ej(`lucide-${OT(Kv(t))}`,`lucide-${t}`,s),...a}));return n.displayName=Kv(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 $T=[["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"}]],Bm=Me("arrow-up-down",$T);/**
- * @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 FT=[["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"}]],qv=Me("bitcoin",FT);/**
- * @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 BT=[["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"}]],VT=Me("bold",BT);/**
- * @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 HT=[["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"}]],Hs=Me("book-open",HT);/**
- * @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 WT=[["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"}]],Eh=Me("calendar",WT);/**
- * @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 UT=[["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"}]],Vg=Me("chart-column",UT);/**
- * @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 KT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],If=Me("check",KT);/**
- * @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 qT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],yd=Me("chevron-down",qT);/**
- * @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 GT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],JT=Me("chevron-left",GT);/**
- * @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 YT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ol=Me("chevron-right",YT);/**
- * @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 QT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],tj=Me("chevron-up",QT);/**
- * @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 XT=[["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"}]],nj=Me("circle-alert",XT);/**
- * @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 ZT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Gv=Me("circle-check-big",ZT);/**
- * @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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Hg=Me("circle-check",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 tM=[["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"}]],sj=Me("circle-question-mark",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=[["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"}]],Vm=Me("circle-user",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 sM=[["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"}]],rj=Me("circle-x",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 rM=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Wg=Me("clock",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=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],iM=Me("cloud",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 oM=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],lM=Me("code",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 cM=[["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"}]],n0=Me("copy",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 dM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Jv=Me("credit-card",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:"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"}]],zl=Me("crown",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 hM=[["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"}]],Th=Me("dollar-sign",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=[["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"}]],pM=Me("download",fM);/**
- * @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:"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"}]],qr=Me("external-link",mM);/**
- * @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:"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"}]],Ug=Me("eye",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 xM=[["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"}]],aj=Me("file-text",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 yM=[["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"}]],ij=Me("funnel",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 bM=[["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"}]],oj=Me("gift",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=[["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"}]],NM=Me("git-merge",vM);/**
- * @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=[["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"}]],Kg=Me("globe",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 jM=[["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"}]],kM=Me("graduation-cap",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 SM=[["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"}]],pa=Me("grip-vertical",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 CM=[["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"}]],EM=Me("handshake",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=[["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"}]],Yv=Me("hash",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 MM=[["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"}]],AM=Me("heading-1",MM);/**
- * @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=[["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"}]],RM=Me("heading-2",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 PM=[["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"}]],OM=Me("heading-3",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 DM=[["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"}]],LM=Me("house",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 _M=[["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"}]],lj=Me("image",_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 zM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Hu=Me("info",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 $M=[["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"}]],FM=Me("italic",$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 BM=[["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"}]],cj=Me("key",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=[["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"}]],HM=Me("layout-dashboard",VM);/**
- * @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:"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"}]],kr=Me("link-2",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 UM=[["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"}]],qg=Me("link",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 KM=[["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"}]],qM=Me("list-ordered",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 GM=[["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"}]],JM=Me("list",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 YM=[["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"}]],QM=Me("lock",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 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"}]],ZM=Me("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 eA=[["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"}]],dj=Me("map-pin",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 tA=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],nA=Me("menu",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 sA=[["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"}]],rA=Me("message-circle",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 aA=[["path",{d:"M5 12h14",key:"1ays0h"}]],iA=Me("minus",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 oA=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],Dl=Me("navigation",oA);/**
- * @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 lA=[["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"}]],cA=Me("palette",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 dA=[["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"}]],Vt=Me("pen-line",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 uA=[["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"}]],Gg=Me("pencil",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 hA=[["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"}]],fA=Me("percent",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 pA=[["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"}]],mA=Me("phone",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 gA=[["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"}]],xA=Me("pin",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 yA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],pn=Me("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 bA=[["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"}]],Qv=Me("qr-code",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 vA=[["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"}]],NA=Me("quote",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 wA=[["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"}]],jA=Me("redo",wA);/**
- * @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 kA=[["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"}]],We=Me("refresh-cw",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:"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"}]],vn=Me("save",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 CA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ka=Me("search",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 EA=[["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"}]],TA=Me("send",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 MA=[["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"}]],ko=Me("settings",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 AA=[["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"}]],Wu=Me("settings-2",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 IA=[["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"}]],nd=Me("shield-check",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 RA=[["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"}]],Jg=Me("shopping-bag",RA);/**
- * @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=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Ti=Me("smartphone",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 OA=[["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"}]],Ll=Me("star",OA);/**
- * @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:"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"}]],LA=Me("strikethrough",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 _A=[["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"}]],zA=Me("table",_A);/**
- * @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 $A=[["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"}]],sd=Me("tag",$A);/**
- * @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:"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"}]],Jn=Me("trash-2",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 BA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],rd=Me("trending-up",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 VA=[["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"}]],Yg=Me("trophy",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 HA=[["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"}]],uj=Me("undo-2",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 WA=[["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"}]],UA=Me("undo",WA);/**
- * @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 KA=[["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"}]],Mh=Me("upload",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 qA=[["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"}]],Qg=Me("user-plus",qA);/**
- * @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:"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"}]],So=Me("user",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 JA=[["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"}]],Rn=Me("users",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 YA=[["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"}]],Hl=Me("wallet",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 QA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],is=Me("x",QA);/**
- * @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:"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"}]],yi=Me("zap",XA),s0="admin_token";function Rf(){try{return localStorage.getItem(s0)}catch{return null}}function ZA(t){try{localStorage.setItem(s0,t)}catch{}}function Hm(){try{localStorage.removeItem(s0)}catch{}}const e5="https://soulapi.quwanzhi.com",t5=15e3,Xv=6e4,n5=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):e5};function Io(t){const e=n5(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Pf(t,e={}){const{data:n,...s}=e,a=Io(t),i=new Headers(s.headers),o=Rf();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):s.body,u=s.timeout??t5,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...s,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),y=(m.headers.get("Content-Type")||"").includes("application/json")?await m.json():m,N=w=>{const v=w,k=((v==null?void 0:v.message)||(v==null?void 0:v.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};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 Re(t,e){return Pf(t,{...e,method:"GET"})}function yt(t,e,n){return Pf(t,{...n,method:"POST",data:e})}function _t(t,e,n){return Pf(t,{...n,method:"PUT",data:e})}function Hr(t,e){return Pf(t,{...e,method:"DELETE"})}function s5(){const[t,e]=b.useState(!1),[n,s]=b.useState("");return b.useEffect(()=>{const a=i=>{const o=i.detail;s(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",a),()=>window.removeEventListener("recharge-alert",a)},[]),t?r.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:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[r.jsx(nj,{className:"w-5 h-5 shrink-0 text-red-400"}),r.jsxs("span",{className:"text-sm font-medium",children:[n,r.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),r.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:r.jsx(is,{className:"w-4 h-4"})})]}):null}const r5=[{icon:HM,label:"数据概览",href:"/dashboard"},{icon:Hs,label:"内容管理",href:"/content"},{icon:Rn,label:"用户管理",href:"/users"},{icon:NM,label:"找伙伴",href:"/find-partner"},{icon:Hl,label:"推广中心",href:"/distribution"}];function a5(){const t=Di(),e=Li(),[n,s]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{s(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;if(!Rf()){e("/login",{replace:!0});return}return Re("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(Hm(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(Hm(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{Hm();try{await yt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?r.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[r.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):r.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[r.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[r.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[r.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),r.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[r5.map(c=>{const u=t.pathname===c.href;return r.jsxs(Bg,{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:[r.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),r.jsx("span",{className:"text-sm",children:c.label})]},c.href)}),r.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:r.jsxs(Bg,{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:[r.jsx(ko,{className:"w-5 h-5 shrink-0"}),r.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),r.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:r.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:[r.jsx(ZM,{className:"w-5 h-5"}),r.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),r.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[r.jsx(s5,{}),r.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:r.jsx(vT,{})})]})]})}function Zv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function r0(...t){return e=>{let n=!1;const s=t.map(a=>{const i=Zv(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=s;hj(i)&&typeof Ah=="function"&&(i=Ah(i._payload));const c=b.Children.toArray(i),u=c.find(d5);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 r.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return r.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var pj=fj("Slot");function l5(t){const e=b.forwardRef((n,s)=>{let{children:a,...i}=n;if(hj(a)&&typeof Ah=="function"&&(a=Ah(a._payload)),b.isValidElement(a)){const o=h5(a),c=u5(i,a.props);return a.type!==b.Fragment&&(c.ref=s?r0(s,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var c5=Symbol("radix.slottable");function d5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===c5}function u5(t,e){const n={...e};for(const s in e){const a=t[s],i=e[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function h5(t){var s,a;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.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 mj(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=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,t1=gj,xj=(t,e)=>n=>{var s;if((e==null?void 0:e.variants)==null)return t1(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 g=e1(f)||e1(m);return a[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(N=>{let[w,v]=N;return Array.isArray(v)?v.includes({...i,...c}[w]):{...i,...c}[w]===v})?[...h,m,g]:h},[]);return t1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},f5=(t,e)=>{const n=new Array(t.length+e.length);for(let s=0;s({classGroupId:t,validator:e}),yj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Ih="-",n1=[],m5="arbitrary..",g5=t=>{const e=y5(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return x5(o);const c=o.split(Ih),u=c[0]===""&&c.length>1?1:0;return bj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=s[o],h=n[o];return u?h?f5(h,u):u:h||n1}return n[o]||n1}}},bj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=bj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(Ih):t.slice(e).join(Ih),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),s=e.slice(0,n);return s?m5+s:void 0})(),y5=t=>{const{theme:e,classGroups:n}=t;return b5(n,e)},b5=(t,e)=>{const n=yj();for(const s in t){const a=t[s];a0(a,n,s,e)}return n},a0=(t,e,n,s)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){N5(t,e,n);return}if(typeof t=="function"){w5(t,e,n,s);return}j5(t,e,n,s)},N5=(t,e,n)=>{const s=t===""?e:vj(e,t);s.classGroupId=n},w5=(t,e,n,s)=>{if(k5(t)){a0(t(s),e,n,s);return}e.validators===null&&(e.validators=[]),e.validators.push(p5(n,t))},j5=(t,e,n,s)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const s=e.split(Ih),a=s.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,S5=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),s=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,s=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=s[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},Xg="!",s1=":",C5=[],r1=(t,e,n,s,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:s,isExternal:a}),E5=t=>{const{prefix:e,experimentalParseClassName:n}=t;let s=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 r1(i,y,g,N)};if(e){const a=e+s1,i=s;s=o=>o.startsWith(a)?i(o.slice(a.length)):r1(C5,!1,o,void 0,!0)}if(n){const a=s;s=i=>n({className:i,parseClassName:a})}return s},T5=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,s)=>{e.set(n,1e6+s)}),n=>{const s=[];let a=[];for(let i=0;i0&&(a.sort(),s.push(...a),a=[]),s.push(o)):a.push(o)}return a.length>0&&(a.sort(),s.push(...a)),s}},M5=t=>({cache:S5(t.cacheSize),parseClassName:E5(t),sortModifiers:T5(t),...g5(t)}),A5=/\s+/,I5=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(A5);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:N,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let v=!!w,k=s(v?N.substring(0,w):N);if(!k){if(!v){u=f+(u.length>0?" "+u:u);continue}if(k=s(N),!k){u=f+(u.length>0?" "+u:u);continue}v=!1}const C=g.length===0?"":g.length===1?g[0]:i(g).join(":"),E=y?C+Xg:C,M=E+k;if(o.indexOf(M)>-1)continue;o.push(M);const P=a(k,v);for(let $=0;$0?" "+u:u)}return u},R5=(...t)=>{let e=0,n,s,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let s=0;s{let n,s,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=M5(h),s=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=s(u);if(h)return h;const f=I5(u,n);return a(u,f),f};return i=o,(...u)=>i(R5(...u))},O5=[],An=t=>{const e=n=>n[t]||O5;return e.isThemeGetter=!0,e},wj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,jj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,D5=/^\d+\/\d+$/,L5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_5=/\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$/,z5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,F5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jl=t=>D5.test(t),ut=t=>!!t&&!Number.isNaN(Number(t)),ii=t=>!!t&&Number.isInteger(Number(t)),Wm=t=>t.endsWith("%")&&ut(t.slice(0,-1)),ma=t=>L5.test(t),B5=()=>!0,V5=t=>_5.test(t)&&!z5.test(t),kj=()=>!1,H5=t=>$5.test(t),W5=t=>F5.test(t),U5=t=>!$e(t)&&!Fe(t),K5=t=>ec(t,Ej,kj),$e=t=>wj.test(t),mo=t=>ec(t,Tj,V5),Um=t=>ec(t,Q5,ut),a1=t=>ec(t,Sj,kj),q5=t=>ec(t,Cj,W5),Uu=t=>ec(t,Mj,H5),Fe=t=>jj.test(t),Wc=t=>tc(t,Tj),G5=t=>tc(t,X5),i1=t=>tc(t,Sj),J5=t=>tc(t,Ej),Y5=t=>tc(t,Cj),Ku=t=>tc(t,Mj,!0),ec=(t,e,n)=>{const s=wj.exec(t);return s?s[1]?e(s[1]):n(s[2]):!1},tc=(t,e,n=!1)=>{const s=jj.exec(t);return s?s[1]?e(s[1]):n:!1},Sj=t=>t==="position"||t==="percentage",Cj=t=>t==="image"||t==="url",Ej=t=>t==="length"||t==="size"||t==="bg-size",Tj=t=>t==="length",Q5=t=>t==="number",X5=t=>t==="family-name",Mj=t=>t==="shadow",Z5=()=>{const t=An("color"),e=An("font"),n=An("text"),s=An("font-weight"),a=An("tracking"),i=An("leading"),o=An("breakpoint"),c=An("container"),u=An("spacing"),h=An("radius"),f=An("shadow"),m=An("inset-shadow"),g=An("text-shadow"),y=An("drop-shadow"),N=An("blur"),w=An("perspective"),v=An("aspect"),k=An("ease"),C=An("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...M(),Fe,$e],$=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],R=()=>[Fe,$e,u],O=()=>[jl,"full","auto",...R()],_=()=>[ii,"none","subgrid",Fe,$e],se=()=>["auto",{span:["full",ii,Fe,$e]},ii,Fe,$e],ne=()=>[ii,"auto",Fe,$e],pe=()=>["auto","min","max","fr",Fe,$e],ge=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...R()],U=()=>[jl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],I=()=>[t,Fe,$e],q=()=>[...M(),i1,a1,{position:[Fe,$e]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",J5,K5,{size:[Fe,$e]}],W=()=>[Wm,Wc,mo],oe=()=>["","none","full",h,Fe,$e],Q=()=>["",ut,Wc,mo],X=()=>["solid","dashed","dotted","double"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[ut,Wm,i1,a1],ue=()=>["","none",N,Fe,$e],ce=()=>["none",ut,Fe,$e],be=()=>["none",ut,Fe,$e],Pe=()=>[ut,Fe,$e],Le=()=>[jl,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ma],breakpoint:[ma],color:[B5],container:[ma],"drop-shadow":[ma],ease:["in","out","in-out"],font:[U5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ma],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ma],shadow:[ma],spacing:["px",ut],text:[ma],"text-shadow":[ma],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",jl,$e,Fe,v]}],container:["container"],columns:[{columns:[ut,$e,Fe,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:P()}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[ii,"auto",Fe,$e]}],basis:[{basis:[jl,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,jl,"auto","initial","none",$e]}],grow:[{grow:["",ut,Fe,$e]}],shrink:[{shrink:["",ut,Fe,$e]}],order:[{order:[ii,"first","last","none",Fe,$e]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:se()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:se()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":pe()}],"auto-rows":[{"auto-rows":pe()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ge(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...ge()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":ge()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[c,"screen",...U()]}],"min-w":[{"min-w":[c,"screen","none",...U()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,Wc,mo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Fe,Um]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wm,$e]}],"font-family":[{font:[G5,$e,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,Fe,$e]}],"line-clamp":[{"line-clamp":[ut,"none",Fe,Um]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Fe,$e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Fe,$e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",Fe,mo]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[ut,"auto",Fe,$e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe,$e]}],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",Fe,$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ii,Fe,$e],radial:["",Fe,$e],conic:[ii,Fe,$e]},Y5,q5]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,Fe,$e]}],"outline-w":[{outline:["",ut,Wc,mo]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,Ku,Uu]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",m,Ku,Uu]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[ut,mo]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",g,Ku,Uu]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[ut,Fe,$e]}],"mix-blend":[{"mix-blend":[...H(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":H()}],"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":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Fe,$e]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":M()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Fe,$e]}],filter:[{filter:["","none",Fe,$e]}],blur:[{blur:ue()}],brightness:[{brightness:[ut,Fe,$e]}],contrast:[{contrast:[ut,Fe,$e]}],"drop-shadow":[{"drop-shadow":["","none",y,Ku,Uu]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",ut,Fe,$e]}],"hue-rotate":[{"hue-rotate":[ut,Fe,$e]}],invert:[{invert:["",ut,Fe,$e]}],saturate:[{saturate:[ut,Fe,$e]}],sepia:[{sepia:["",ut,Fe,$e]}],"backdrop-filter":[{"backdrop-filter":["","none",Fe,$e]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[ut,Fe,$e]}],"backdrop-contrast":[{"backdrop-contrast":[ut,Fe,$e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,Fe,$e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,Fe,$e]}],"backdrop-invert":[{"backdrop-invert":["",ut,Fe,$e]}],"backdrop-opacity":[{"backdrop-opacity":[ut,Fe,$e]}],"backdrop-saturate":[{"backdrop-saturate":[ut,Fe,$e]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,Fe,$e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Fe,$e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",Fe,$e]}],ease:[{ease:["linear","initial",k,Fe,$e]}],delay:[{delay:[ut,Fe,$e]}],animate:[{animate:["none",C,Fe,$e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Fe,$e]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Pe()}],"skew-x":[{"skew-x":Pe()}],"skew-y":[{"skew-y":Pe()}],transform:[{transform:[Fe,$e,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Le()}],"translate-x":[{"translate-x":Le()}],"translate-y":[{"translate-y":Le()}],"translate-z":[{"translate-z":Le()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",Fe,$e]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",Fe,$e]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[ut,Wc,mo,Um]}],stroke:[{stroke:["none",...I()]}],"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=P5(Z5);function Tt(...t){return eI(gj(t))}const tI=xj("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 Z({className:t,variant:e,size:n,asChild:s=!1,...a}){const i=s?pj:"button";return r.jsx(i,{"data-slot":"button",className:Tt(tI({variant:e,size:n,className:t})),...a})}function ie({className:t,type:e,...n}){return r.jsx("input",{type:e,"data-slot":"input",className:Tt("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 nI(){const t=Li(),[e,n]=b.useState(""),[s,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1),h=async()=>{o(""),u(!0);try{const f=await yt("/api/admin",{username:e.trim(),password:s});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){ZA(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 r.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[r.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),r.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),r.jsxs("div",{className:"w-full max-w-md relative z-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.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:r.jsx(nd,{className:"w-8 h-8 text-[#38bdac]"})}),r.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),r.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),r.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[r.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),r.jsxs("div",{className:"relative",children:[r.jsx(So,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),r.jsx(ie,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),r.jsxs("div",{className:"relative",children:[r.jsx(QM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),r.jsx(ie,{type:"password",value:s,onChange:f=>a(f.target.value),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&&r.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),r.jsx(Z,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),r.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ce=b.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:Tt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ce.displayName="Card";const Je=b.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:Tt("flex flex-col space-y-1.5 p-6",t),...e}));Je.displayName="CardHeader";const Ye=b.forwardRef(({className:t,...e},n)=>r.jsx("h3",{ref:n,className:Tt("font-semibold leading-none tracking-tight",t),...e}));Ye.displayName="CardTitle";const Dt=b.forwardRef(({className:t,...e},n)=>r.jsx("p",{ref:n,className:Tt("text-sm text-muted-foreground",t),...e}));Dt.displayName="CardDescription";const Ee=b.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:Tt("p-6 pt-0",t),...e}));Ee.displayName="CardContent";const sI=b.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:Tt("flex items-center p-6 pt-0",t),...e}));sI.displayName="CardFooter";const rI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Km(t,e="info",n=3e3){const s=`toast-${Date.now()}`,a=rI[e],i=document.createElement("div");i.id=s,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(s),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const ae={success:(t,e)=>Km(t,"success",e),error:(t,e)=>Km(t,"error",e),info:(t,e)=>Km(t,"info",e)};function ot(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 aI(t,e){const n=b.createContext(e),s=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return r.jsx(n.Provider,{value:u,children:o})};s.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[s,a]}function _i(t,e=[]){let n=[];function s(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...N}=m,w=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,v=b.useMemo(()=>N,Object.values(N));return r.jsx(w.Provider,{value:v,children:y})};h.displayName=i+"Provider";function f(m,g){var w;const y=((w=g==null?void 0:g[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,[s,iI(a,...e)]}function iI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=s.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 ls=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},oI=Mf[" useId ".trim().toString()]||(()=>{}),lI=0;function ji(t){const[e,n]=b.useState(oI());return ls(()=>{n(s=>s??String(lI++))},[t]),e?`radix-${e}`:""}var cI=Mf[" useInsertionEffect ".trim().toString()]||ls;function Ro({prop:t,defaultProp:e,onChange:n=()=>{},caller:s}){const[a,i,o]=dI({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(`${s} 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,s])}const h=b.useCallback(f=>{var m;if(c){const g=uI(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function dI({defaultProp:t,onChange:e}){const[n,s]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return cI(()=>{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,s,i]}function uI(t){return typeof t=="function"}function bd(t){const e=hI(t),n=b.forwardRef((s,a)=>{const{children:i,...o}=s,c=b.Children.toArray(i),u=c.find(pI);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 r.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return r.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function hI(t){const e=b.forwardRef((n,s)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=gI(a),c=mI(i,a.props);return a.type!==b.Fragment&&(c.ref=s?r0(s,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var fI=Symbol("radix.slottable");function pI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===fI}function mI(t,e){const n={...e};for(const s in e){const a=t[s],i=e[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function gI(t){var s,a;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.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 xI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=xI.reduce((t,e)=>{const n=bd(`Primitive.${e}`),s=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...c,ref:i})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function yI(t,e){t&&Dd.flushSync(()=>t.dispatchEvent(e))}function Mi(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var s;return(s=e.current)==null?void 0:s.call(e,...n)},[])}function bI(t,e=globalThis==null?void 0:globalThis.document){const n=Mi(t);b.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[n,e])}var vI="DismissableLayer",Zg="dismissableLayer.update",NI="dismissableLayer.pointerDownOutside",wI="dismissableLayer.focusOutside",o1,Aj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),i0=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(Aj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),N=Et(e,D=>m(D)),w=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(v),C=f?w.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,M=C>=k,P=SI(D=>{const R=D.target,O=[...h.branches].some(_=>_.contains(R));!M||O||(a==null||a(D),o==null||o(D),D.defaultPrevented||c==null||c())},g),$=CI(D=>{const R=D.target;[...h.branches].some(_=>_.contains(R))||(i==null||i(D),o==null||o(D),D.defaultPrevented||c==null||c())},g);return bI(D=>{C===h.layers.size-1&&(s==null||s(D),!D.defaultPrevented&&c&&(D.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(o1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),l1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=o1)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),l1())},[f,h]),b.useEffect(()=>{const D=()=>y({});return document.addEventListener(Zg,D),()=>document.removeEventListener(Zg,D)},[]),r.jsx(ht.div,{...u,ref:N,style:{pointerEvents:E?M?"auto":"none":void 0,...t.style},onFocusCapture:ot(t.onFocusCapture,$.onFocusCapture),onBlurCapture:ot(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:ot(t.onPointerDownCapture,P.onPointerDownCapture)})});i0.displayName=vI;var jI="DismissableLayerBranch",kI=b.forwardRef((t,e)=>{const n=b.useContext(Aj),s=b.useRef(null),a=Et(e,s);return b.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(ht.div,{...t,ref:a})});kI.displayName=jI;function SI(t,e=globalThis==null?void 0:globalThis.document){const n=Mi(t),s=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!s.current){let u=function(){Ij(NI,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);s.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:()=>s.current=!0}}function CI(t,e=globalThis==null?void 0:globalThis.document){const n=Mi(t),s=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!s.current&&Ij(wI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function l1(){const t=new CustomEvent(Zg);document.dispatchEvent(t)}function Ij(t,e,n,{discrete:s}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),s?yI(a,i):a.dispatchEvent(i)}var qm="focusScope.autoFocusOnMount",Gm="focusScope.autoFocusOnUnmount",c1={bubbles:!1,cancelable:!0},EI="FocusScope",o0=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=Mi(a),f=Mi(i),m=b.useRef(null),g=Et(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(s){let w=function(E){if(y.paused||!c)return;const M=E.target;c.contains(M)?m.current=M:ci(m.current,{select:!0})},v=function(E){if(y.paused||!c)return;const M=E.relatedTarget;M!==null&&(c.contains(M)||ci(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const P of E)P.removedNodes.length>0&&ci(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",v);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",v),C.disconnect()}}},[s,c,y.paused]),b.useEffect(()=>{if(c){u1.add(y);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(qm,c1);c.addEventListener(qm,h),c.dispatchEvent(k),k.defaultPrevented||(TI(PI(Rj(c)),{select:!0}),document.activeElement===w&&ci(c))}return()=>{c.removeEventListener(qm,h),setTimeout(()=>{const k=new CustomEvent(Gm,c1);c.addEventListener(Gm,f),c.dispatchEvent(k),k.defaultPrevented||ci(w??document.body,{select:!0}),c.removeEventListener(Gm,f),u1.remove(y)},0)}}},[c,h,f,y]);const N=b.useCallback(w=>{if(!n&&!s||y.paused)return;const v=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(v&&k){const C=w.currentTarget,[E,M]=MI(C);E&&M?!w.shiftKey&&k===M?(w.preventDefault(),n&&ci(E,{select:!0})):w.shiftKey&&k===E&&(w.preventDefault(),n&&ci(M,{select:!0})):k===C&&w.preventDefault()}},[n,s,y.paused]);return r.jsx(ht.div,{tabIndex:-1,...o,ref:g,onKeyDown:N})});o0.displayName=EI;function TI(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(ci(s,{select:e}),document.activeElement!==n)return}function MI(t){const e=Rj(t),n=d1(e,t),s=d1(e.reverse(),t);return[n,s]}function Rj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function d1(t,e){for(const n of t)if(!AI(n,{upTo:e}))return n}function AI(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 II(t){return t instanceof HTMLInputElement&&"select"in t}function ci(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&II(t)&&e&&t.select()}}var u1=RI();function RI(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=h1(t,e),t.unshift(e)},remove(e){var n;t=h1(t,e),(n=t[0])==null||n.resume()}}}function h1(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}function PI(t){return t.filter(e=>e.tagName!=="A")}var OI="Portal",l0=b.forwardRef((t,e)=>{var c;const{container:n,...s}=t,[a,i]=b.useState(!1);ls(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Hw.createPortal(r.jsx(ht.div,{...s,ref:e}),o):null});l0.displayName=OI;function DI(t,e){return b.useReducer((n,s)=>e[n][s]??n,t)}var Ld=t=>{const{present:e,children:n}=t,s=LI(e),a=typeof n=="function"?n({present:s.isPresent}):b.Children.only(n),i=Et(s.ref,_I(a));return typeof n=="function"||s.isPresent?b.cloneElement(a,{ref:i}):null};Ld.displayName="Presence";function LI(t){const[e,n]=b.useState(),s=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=DI(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=qu(s.current);i.current=c==="mounted"?h:"none"},[c]),ls(()=>{const h=s.current,f=a.current;if(f!==t){const g=i.current,y=qu(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),ls(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=qu(s.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=y=>{y.target===e&&(i.current=qu(s.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{s.current=h?getComputedStyle(h):null,n(h)},[])}}function qu(t){return(t==null?void 0:t.animationName)||"none"}function _I(t){var s,a;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.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 Jm=0;function Pj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??f1()),document.body.insertAdjacentElement("beforeend",t[1]??f1()),Jm++,()=>{Jm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Jm--}},[])}function f1(){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 Wr=function(){return Wr=Object.assign||function(e){for(var n,s=1,a=arguments.length;s"u")return eR;var e=tR(t),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,s-n+e[2]-e[0])}},sR=_j(),$l="data-scroll-locked",rR=function(t,e,n,s){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),`
- .`.concat($I,` {
- overflow: hidden `).concat(s,`;
- padding-right: `).concat(c,"px ").concat(s,`;
- }
- body[`).concat($l,`] {
- overflow: hidden `).concat(s,`;
- overscroll-behavior: contain;
- `).concat([e&&"position: relative ".concat(s,";"),n==="margin"&&`
- padding-left: `.concat(a,`px;
- padding-top: `).concat(i,`px;
- padding-right: `).concat(o,`px;
- margin-left:0;
- margin-top:0;
- margin-right: `).concat(c,"px ").concat(s,`;
- `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
- }
-
- .`).concat(gh,` {
- right: `).concat(c,"px ").concat(s,`;
- }
-
- .`).concat(xh,` {
- margin-right: `).concat(c,"px ").concat(s,`;
- }
-
- .`).concat(gh," .").concat(gh,` {
- right: 0 `).concat(s,`;
- }
-
- .`).concat(xh," .").concat(xh,` {
- margin-right: 0 `).concat(s,`;
- }
-
- body[`).concat($l,`] {
- `).concat(FI,": ").concat(c,`px;
- }
-`)},m1=function(){var t=parseInt(document.body.getAttribute($l)||"0",10);return isFinite(t)?t:0},aR=function(){b.useEffect(function(){return document.body.setAttribute($l,(m1()+1).toString()),function(){var t=m1()-1;t<=0?document.body.removeAttribute($l):document.body.setAttribute($l,t.toString())}},[])},iR=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,a=s===void 0?"margin":s;aR();var i=b.useMemo(function(){return nR(a)},[a]);return b.createElement(sR,{styles:rR(i,!e,a,n?"":"!important")})},ex=!1;if(typeof window<"u")try{var Gu=Object.defineProperty({},"passive",{get:function(){return ex=!0,!0}});window.addEventListener("test",Gu,Gu),window.removeEventListener("test",Gu,Gu)}catch{ex=!1}var kl=ex?{passive:!1}:!1,oR=function(t){return t.tagName==="TEXTAREA"},zj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!oR(t)&&n[e]==="visible")},lR=function(t){return zj(t,"overflowY")},cR=function(t){return zj(t,"overflowX")},g1=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=$j(t,s);if(a){var i=Fj(t,s),o=i[1],c=i[2];if(o>c)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},dR=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},uR=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},$j=function(t,e){return t==="v"?lR(e):cR(e)},Fj=function(t,e){return t==="v"?dR(e):uR(e)},hR=function(t,e){return t==="h"&&e==="rtl"?-1:1},fR=function(t,e,n,s,a){var i=hR(t,window.getComputedStyle(e).direction),o=i*s,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=Fj(t,c),N=y[0],w=y[1],v=y[2],k=w-v-i*N;(N||k)&&$j(t,c)&&(m+=k,g+=N);var C=c.parentNode;c=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},Ju=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},x1=function(t){return[t.deltaX,t.deltaY]},y1=function(t){return t&&"current"in t?t.current:t},pR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},mR=function(t){return`
- .block-interactivity-`.concat(t,` {pointer-events: none;}
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
-`)},gR=0,Sl=[];function xR(t){var e=b.useRef([]),n=b.useRef([0,0]),s=b.useRef(),a=b.useState(gR++)[0],i=b.useState(_j)[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=zI([t.lockRef.current],(t.shards||[]).map(y1),!0).filter(Boolean);return w.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),w.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(w,v){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var k=Ju(w),C=n.current,E="deltaX"in w?w.deltaX:C[0]-k[0],M="deltaY"in w?w.deltaY:C[1]-k[1],P,$=w.target,D=Math.abs(E)>Math.abs(M)?"h":"v";if("touches"in w&&D==="h"&&$.type==="range")return!1;var R=window.getSelection(),O=R&&R.anchorNode,_=O?O===$||O.contains($):!1;if(_)return!1;var se=g1(D,$);if(!se)return!0;if(se?P=D:(P=D==="v"?"h":"v",se=g1(D,$)),!se)return!1;if(!s.current&&"changedTouches"in w&&(E||M)&&(s.current=P),!P)return!0;var ne=s.current||P;return fR(ne,v,w,ne==="h"?E:M)},[]),u=b.useCallback(function(w){var v=w;if(!(!Sl.length||Sl[Sl.length-1]!==i)){var k="deltaY"in v?x1(v):Ju(v),C=e.current.filter(function(P){return P.name===v.type&&(P.target===v.target||v.target===P.shadowParent)&&pR(P.delta,k)})[0];if(C&&C.should){v.cancelable&&v.preventDefault();return}if(!C){var E=(o.current.shards||[]).map(y1).filter(Boolean).filter(function(P){return P.contains(v.target)}),M=E.length>0?c(v,E[0]):!o.current.noIsolation;M&&v.cancelable&&v.preventDefault()}}},[]),h=b.useCallback(function(w,v,k,C){var E={name:w,delta:v,target:k,should:C,shadowParent:yR(k)};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(M){return M!==E})},1)},[]),f=b.useCallback(function(w){n.current=Ju(w),s.current=void 0},[]),m=b.useCallback(function(w){h(w.type,x1(w),w.target,c(w,t.lockRef.current))},[]),g=b.useCallback(function(w){h(w.type,Ju(w),w.target,c(w,t.lockRef.current))},[]);b.useEffect(function(){return Sl.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,kl),document.addEventListener("touchmove",u,kl),document.addEventListener("touchstart",f,kl),function(){Sl=Sl.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,kl),document.removeEventListener("touchmove",u,kl),document.removeEventListener("touchstart",f,kl)}},[]);var y=t.removeScrollBar,N=t.inert;return b.createElement(b.Fragment,null,N?b.createElement(i,{styles:mR(a)}):null,y?b.createElement(iR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function yR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const bR=qI(Lj,xR);var c0=b.forwardRef(function(t,e){return b.createElement(Of,Wr({},t,{ref:e,sideCar:bR}))});c0.classNames=Of.classNames;var vR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Cl=new WeakMap,Yu=new WeakMap,Qu={},Zm=0,Bj=function(t){return t&&(t.host||Bj(t.parentNode))},NR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=Bj(n);return s&&t.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},wR=function(t,e,n,s){var a=NR(e,Array.isArray(t)?t:[t]);Qu[n]||(Qu[n]=new WeakMap);var i=Qu[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(g){if(c.has(g))f(g);else try{var y=g.getAttribute(s),N=y!==null&&y!=="false",w=(Cl.get(g)||0)+1,v=(i.get(g)||0)+1;Cl.set(g,w),i.set(g,v),o.push(g),w===1&&N&&Yu.set(g,!0),v===1&&g.setAttribute(n,"true"),N||g.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Zm++,function(){o.forEach(function(m){var g=Cl.get(m)-1,y=i.get(m)-1;Cl.set(m,g),i.set(m,y),g||(Yu.has(m)||m.removeAttribute(s),Yu.delete(m)),y||m.removeAttribute(n)}),Zm--,Zm||(Cl=new WeakMap,Cl=new WeakMap,Yu=new WeakMap,Qu={})}},Vj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),a=vR(t);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),wR(s,a,n,"aria-hidden")):function(){return null}},Df="Dialog",[Hj]=_i(Df),[jR,Er]=Hj(Df),Wj=t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=Ro({prop:s,defaultProp:a??!1,onChange:i,caller:Df});return r.jsx(jR,{scope:e,triggerRef:c,contentRef:u,contentId:ji(),titleId:ji(),descriptionId:ji(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Wj.displayName=Df;var Uj="DialogTrigger",kR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Er(Uj,n),i=Et(e,a.triggerRef);return r.jsx(ht.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":h0(a.open),...s,ref:i,onClick:ot(t.onClick,a.onOpenToggle)})});kR.displayName=Uj;var d0="DialogPortal",[SR,Kj]=Hj(d0,{forceMount:void 0}),qj=t=>{const{__scopeDialog:e,forceMount:n,children:s,container:a}=t,i=Er(d0,e);return r.jsx(SR,{scope:e,forceMount:n,children:b.Children.map(s,o=>r.jsx(Ld,{present:n||i.open,children:r.jsx(l0,{asChild:!0,container:a,children:o})}))})};qj.displayName=d0;var Rh="DialogOverlay",Gj=b.forwardRef((t,e)=>{const n=Kj(Rh,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,i=Er(Rh,t.__scopeDialog);return i.modal?r.jsx(Ld,{present:s||i.open,children:r.jsx(ER,{...a,ref:e})}):null});Gj.displayName=Rh;var CR=bd("DialogOverlay.RemoveScroll"),ER=b.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Er(Rh,n);return r.jsx(c0,{as:CR,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(ht.div,{"data-state":h0(a.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),Po="DialogContent",Jj=b.forwardRef((t,e)=>{const n=Kj(Po,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,i=Er(Po,t.__scopeDialog);return r.jsx(Ld,{present:s||i.open,children:i.modal?r.jsx(TR,{...a,ref:e}):r.jsx(MR,{...a,ref:e})})});Jj.displayName=Po;var TR=b.forwardRef((t,e)=>{const n=Er(Po,t.__scopeDialog),s=b.useRef(null),a=Et(e,n.contentRef,s);return b.useEffect(()=>{const i=s.current;if(i)return Vj(i)},[]),r.jsx(Yj,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ot(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ot(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:ot(t.onFocusOutside,i=>i.preventDefault())})}),MR=b.forwardRef((t,e)=>{const n=Er(Po,t.__scopeDialog),s=b.useRef(!1),a=b.useRef(!1);return r.jsx(Yj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(s.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(s.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()}})}),Yj=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Er(Po,n),u=b.useRef(null),h=Et(e,u);return Pj(),r.jsxs(r.Fragment,{children:[r.jsx(o0,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:i,children:r.jsx(i0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":h0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(AR,{titleId:c.titleId}),r.jsx(RR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),u0="DialogTitle",Qj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Er(u0,n);return r.jsx(ht.h2,{id:a.titleId,...s,ref:e})});Qj.displayName=u0;var Xj="DialogDescription",Zj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Er(Xj,n);return r.jsx(ht.p,{id:a.descriptionId,...s,ref:e})});Zj.displayName=Xj;var ek="DialogClose",tk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Er(ek,n);return r.jsx(ht.button,{type:"button",...s,ref:e,onClick:ot(t.onClick,()=>a.onOpenChange(!1))})});tk.displayName=ek;function h0(t){return t?"open":"closed"}var nk="DialogTitleWarning",[GV,sk]=aI(nk,{contentName:Po,titleName:u0,docsSlug:"dialog"}),AR=({titleId:t})=>{const e=sk(nk),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},IR="DialogDescriptionWarning",RR=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sk(IR).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(s))},[s,t,e]),null},PR=Wj,OR=qj,DR=Gj,LR=Jj,_R=Qj,zR=Zj,$R=tk;function Mt(t){return r.jsx(PR,{"data-slot":"dialog",...t})}function FR(t){return r.jsx(OR,{...t})}const rk=b.forwardRef(({className:t,...e},n)=>r.jsx(DR,{ref:n,className:Tt("fixed inset-0 z-50 bg-black/50",t),...e}));rk.displayName="DialogOverlay";const kt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...s},a)=>r.jsxs(FR,{children:[r.jsx(rk,{}),r.jsxs(LR,{ref:a,"aria-describedby":void 0,className:Tt("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),...s,children:[e,n&&r.jsxs($R,{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:[r.jsx(is,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));kt.displayName="DialogContent";function At({className:t,...e}){return r.jsx("div",{className:Tt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Zt({className:t,...e}){return r.jsx("div",{className:Tt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function It(t){return r.jsx(_R,{className:"text-lg font-semibold leading-none",...t})}function vd(t){return r.jsx(zR,{className:"text-sm text-muted-foreground",...t})}const BR=xj("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 Ue({className:t,variant:e,asChild:n=!1,...s}){const a=n?pj:"span";return r.jsx(a,{className:Tt(BR({variant:e}),t),...s})}var VR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],HR=VR.reduce((t,e)=>{const n=fj(`Primitive.${e}`),s=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...c,ref:i})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{}),WR="Label",ak=b.forwardRef((t,e)=>r.jsx(HR.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())}}));ak.displayName=WR;var ik=ak;const ee=b.forwardRef(({className:t,...e},n)=>r.jsx(ik,{ref:n,className:Tt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ee.displayName=ik.displayName;function f0(t){const e=t+"CollectionProvider",[n,s]=_i(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:v,children:k}=w,C=vs.useRef(null),E=vs.useRef(new Map).current;return r.jsx(a,{scope:v,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=bd(c),h=vs.forwardRef((w,v)=>{const{scope:k,children:C}=w,E=i(c,k),M=Et(v,E.collectionRef);return r.jsx(u,{ref:M,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=bd(f),y=vs.forwardRef((w,v)=>{const{scope:k,children:C,...E}=w,M=vs.useRef(null),P=Et(v,M),$=i(f,k);return vs.useEffect(()=>($.itemMap.set(M,{ref:M,...E}),()=>void $.itemMap.delete(M))),r.jsx(g,{[m]:"",ref:P,children:C})});y.displayName=f;function N(w){const v=i(t+"CollectionConsumer",w);return vs.useCallback(()=>{const C=v.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort(($,D)=>E.indexOf($.ref.current)-E.indexOf(D.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},N,s]}var UR=b.createContext(void 0);function Lf(t){const e=b.useContext(UR);return t||e||"ltr"}var eg="rovingFocusGroup.onEntryFocus",KR={bubbles:!1,cancelable:!0},_d="RovingFocusGroup",[tx,ok,qR]=f0(_d),[GR,lk]=_i(_d,[qR]),[JR,YR]=GR(_d),ck=b.forwardRef((t,e)=>r.jsx(tx.Provider,{scope:t.__scopeRovingFocusGroup,children:r.jsx(tx.Slot,{scope:t.__scopeRovingFocusGroup,children:r.jsx(QR,{...t,ref:e})})}));ck.displayName=_d;var QR=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=Et(e,g),N=Lf(i),[w,v]=Ro({prop:o,defaultProp:c??null,onChange:u,caller:_d}),[k,C]=b.useState(!1),E=Mi(h),M=ok(n),P=b.useRef(!1),[$,D]=b.useState(0);return b.useEffect(()=>{const R=g.current;if(R)return R.addEventListener(eg,E),()=>R.removeEventListener(eg,E)},[E]),r.jsx(JR,{scope:n,orientation:s,dir:N,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(R=>v(R),[v]),onItemShiftTab:b.useCallback(()=>C(!0),[]),onFocusableItemAdd:b.useCallback(()=>D(R=>R+1),[]),onFocusableItemRemove:b.useCallback(()=>D(R=>R-1),[]),children:r.jsx(ht.div,{tabIndex:k||$===0?-1:0,"data-orientation":s,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:ot(t.onMouseDown,()=>{P.current=!0}),onFocus:ot(t.onFocus,R=>{const O=!P.current;if(R.target===R.currentTarget&&O&&!k){const _=new CustomEvent(eg,KR);if(R.currentTarget.dispatchEvent(_),!_.defaultPrevented){const se=M().filter(K=>K.focusable),ne=se.find(K=>K.active),pe=se.find(K=>K.id===w),z=[ne,pe,...se].filter(Boolean).map(K=>K.ref.current);hk(z,f)}}P.current=!1}),onBlur:ot(t.onBlur,()=>C(!1))})})}),dk="RovingFocusGroupItem",uk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=ji(),h=i||u,f=YR(dk,n),m=f.currentTabStopId===h,g=ok(n),{onFocusableItemAdd:y,onFocusableItemRemove:N,currentTabStopId:w}=f;return b.useEffect(()=>{if(s)return y(),()=>N()},[s,y,N]),r.jsx(tx.ItemSlot,{scope:n,id:h,focusable:s,active:a,children:r.jsx(ht.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:ot(t.onMouseDown,v=>{s?f.onItemFocus(h):v.preventDefault()}),onFocus:ot(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:ot(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=eP(v,f.orientation,f.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let E=g().filter(M=>M.focusable).map(M=>M.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const M=E.indexOf(v.currentTarget);E=f.loop?tP(E,M+1):E.slice(M+1)}setTimeout(()=>hk(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});uk.displayName=dk;var XR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function eP(t,e,n){const s=ZR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return XR[s]}function hk(t,e=!1){const n=document.activeElement;for(const s of t)if(s===n||(s.focus({preventScroll:e}),document.activeElement!==n))return}function tP(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var nP=ck,sP=uk,_f="Tabs",[rP]=_i(_f,[lk]),fk=lk(),[aP,p0]=rP(_f),pk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Lf(c),[m,g]=Ro({prop:s,onChange:a,defaultProp:i??"",caller:_f});return r.jsx(aP,{scope:n,baseId:ji(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:r.jsx(ht.div,{dir:f,"data-orientation":o,...h,ref:e})})});pk.displayName=_f;var mk="TabsList",gk=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:s=!0,...a}=t,i=p0(mk,n),o=fk(n);return r.jsx(nP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(ht.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});gk.displayName=mk;var xk="TabsTrigger",yk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...i}=t,o=p0(xk,n),c=fk(n),u=Nk(o.baseId,s),h=wk(o.baseId,s),f=s===o.value;return r.jsx(sP,{asChild:!0,...c,focusable:!a,active:f,children:r.jsx(ht.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:ot(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(s):m.preventDefault()}),onKeyDown:ot(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(s)}),onFocus:ot(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(s)})})})});yk.displayName=xk;var bk="TabsContent",vk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,forceMount:a,children:i,...o}=t,c=p0(bk,n),u=Nk(c.baseId,s),h=wk(c.baseId,s),f=s===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),r.jsx(Ld,{present:a||f,children:({present:g})=>r.jsx(ht.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});vk.displayName=bk;function Nk(t,e){return`${t}-trigger-${e}`}function wk(t,e){return`${t}-content-${e}`}var iP=pk,jk=gk,kk=yk,Sk=vk;const zd=iP,nc=b.forwardRef(({className:t,...e},n)=>r.jsx(jk,{ref:n,className:Tt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));nc.displayName=jk.displayName;const en=b.forwardRef(({className:t,...e},n)=>r.jsx(kk,{ref:n,className:Tt("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}));en.displayName=kk.displayName;const tn=b.forwardRef(({className:t,...e},n)=>r.jsx(Sk,{ref:n,className:Tt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));tn.displayName=Sk.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 g0(t){const[e,n]=b.useState(void 0);return ls(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const s=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 s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else n(void 0)},[t]),e}var zf="Switch",[oP]=_i(zf),[lP,cP]=oP(zf),Ck=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),N=Et(e,E=>y(E)),w=b.useRef(!1),v=g?f||!!g.closest("form"):!0,[k,C]=Ro({prop:a,defaultProp:i??!1,onChange:h,caller:zf});return r.jsxs(lP,{scope:n,checked:k,disabled:c,children:[r.jsx(ht.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":Ak(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:ot(t.onClick,E=>{C(M=>!M),v&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})}),v&&r.jsx(Mk,{control:g,bubbles:!w.current,name:s,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});Ck.displayName=zf;var Ek="SwitchThumb",Tk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...s}=t,a=cP(Ek,n);return r.jsx(ht.span,{"data-state":Ak(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:e})});Tk.displayName=Ek;var dP="SwitchBubbleInput",Mk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:s=!0,...a},i)=>{const o=b.useRef(null),c=Et(o,i),u=m0(n),h=g0(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:s});y.call(f,n),f.dispatchEvent(N)}},[u,n,s]),r.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}})});Mk.displayName=dP;function Ak(t){return t?"checked":"unchecked"}var Ik=Ck,uP=Tk;const St=b.forwardRef(({className:t,...e},n)=>r.jsx(Ik,{className:Tt("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:r.jsx(uP,{className:Tt("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")})}));St.displayName=Ik.displayName;function x0({open:t,onClose:e,userId:n,onUserUpdated:s}){var Ar;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(null),[g,y]=b.useState(!1),[N,w]=b.useState(!1),[v,k]=b.useState(!1),[C,E]=b.useState("info"),[M,P]=b.useState(""),[$,D]=b.useState(""),[R,O]=b.useState([]),[_,se]=b.useState(""),[ne,pe]=b.useState(""),[ge,z]=b.useState(""),[K,U]=b.useState(!1),[I,q]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[F,L]=b.useState([]),[W,oe]=b.useState(!1),[Q,X]=b.useState(""),[H,re]=b.useState(""),[ue,ce]=b.useState(!1),[be,Pe]=b.useState(!1),[Le,lt]=b.useState(null),[Rt,dn]=b.useState(null),[gt,sn]=b.useState(""),[Pn,Pt]=b.useState(""),[Qt,rn]=b.useState(""),[On,ms]=b.useState(!1),[Dn,Wn]=b.useState(null),[J,Ke]=b.useState("");b.useEffect(()=>{t&&n&&(E("info"),lt(null),dn(null),Wn(null),Ke(""),pe(""),z(""),Ge(),Re("/api/db/vip-roles").then(me=>{me!=null&&me.success&&me.data&&L(me.data)}).catch(()=>{}))},[t,n]);async function Ge(){if(n){y(!0);try{const me=await Re(`/api/db/users?id=${encodeURIComponent(n)}`);if(me!=null&&me.success&&me.user){const ye=me.user;i(ye),P(ye.phone||""),D(ye.nickname||""),sn(ye.phone||""),Pt(ye.wechatId||""),rn(ye.openId||"");try{O(typeof ye.tags=="string"?JSON.parse(ye.tags||"[]"):[])}catch{O([])}q({isVip:!!(ye.isVip??!1),vipExpireDate:ye.vipExpireDate?String(ye.vipExpireDate).slice(0,10):"",vipRole:String(ye.vipRole??""),vipName:String(ye.vipName??""),vipProject:String(ye.vipProject??""),vipContact:String(ye.vipContact??""),vipBio:String(ye.vipBio??"")})}try{const ye=await Re(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=50`);ye!=null&&ye.success&&ye.tracks&&c(ye.tracks)}catch{c([])}try{const ye=await Re(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ye!=null&&ye.success&&ye.referrals&&h(ye.referrals)}catch{h([])}try{const ye=await Re(`/api/admin/users/${encodeURIComponent(n)}/balance`);ye!=null&&ye.success&&ye.data?m(ye.data):m(null)}catch{m(null)}}catch(me){console.error("Load user detail error:",me)}finally{y(!1)}}}async function mt(){if(!(a!=null&&a.phone)){ae.info("用户未绑定手机号,无法同步");return}w(!0);try{const me=await yt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});me!=null&&me.success?(ae.success("同步成功"),Ge()):ae.error("同步失败: "+(me==null?void 0:me.error))}catch(me){console.error("Sync CKB error:",me),ae.error("同步失败")}finally{w(!1)}}async function ct(){if(a){if(I.isVip&&!I.vipExpireDate.trim()){ae.error("开启 VIP 请填写有效到期日");return}k(!0);try{const me={id:a.id,phone:M||void 0,nickname:$||void 0,tags:JSON.stringify(R),isVip:I.isVip,vipExpireDate:I.isVip?I.vipExpireDate:void 0,vipRole:I.vipRole||void 0,vipName:I.vipName||void 0,vipProject:I.vipProject||void 0,vipContact:I.vipContact||void 0,vipBio:I.vipBio||void 0},ye=await _t("/api/db/users",me);ye!=null&&ye.success?(ae.success("保存成功"),Ge(),s==null||s()):ae.error("保存失败: "+(ye==null?void 0:ye.error))}catch(me){console.error("Save user error:",me),ae.error("保存失败")}finally{k(!1)}}}const st=()=>{_&&!R.includes(_)&&(O([...R,_]),se(""))},pt=me=>O(R.filter(ye=>ye!==me));async function Lt(){if(a){if(!ne){ae.error("请输入新密码");return}if(ne!==ge){ae.error("两次密码不一致");return}if(ne.length<6){ae.error("密码至少 6 位");return}U(!0);try{const me=await _t("/api/db/users",{id:a.id,password:ne});me!=null&&me.success?(ae.success("修改成功"),pe(""),z("")):ae.error("修改失败: "+((me==null?void 0:me.error)||""))}catch{ae.error("修改失败")}finally{U(!1)}}}async function yn(){if(!a)return;const me=parseFloat(Q);if(Number.isNaN(me)||me===0){ae.error("请输入有效金额(正数增加、负数扣减)");return}ce(!0);try{const ye=await yt(`/api/admin/users/${a.id}/balance/adjust`,{amount:me,remark:H||void 0});ye!=null&&ye.success?(ae.success("余额已调整"),oe(!1),X(""),re(""),Ge(),s==null||s()):ae.error("调整失败: "+((ye==null?void 0:ye.error)||""))}catch{ae.error("调整失败")}finally{ce(!1)}}async function gs(){if(!gt&&!Qt&&!Pn){dn("请至少输入手机号、微信号或 OpenID 中的一项");return}Pe(!0),dn(null),lt(null);try{const me=new URLSearchParams;gt&&me.set("phone",gt),Qt&&me.set("openId",Qt),Pn&&me.set("wechatId",Pn);const ye=await Re(`/api/admin/shensheshou/query?${me}`);ye!=null&&ye.success&&ye.data?(lt(ye.data),a&&await js(ye.data)):dn((ye==null?void 0:ye.error)||"未查询到数据,该用户可能未在神射手收录")}catch(me){console.error("SSS query error:",me),dn("请求失败,请检查神射手接口配置")}finally{Pe(!1)}}async function js(me){if(a)try{await yt("/api/admin/shensheshou/enrich",{userId:a.id,phone:gt||a.phone||"",openId:Qt||a.openId||"",wechatId:Pn||a.wechatId||""}),Ge()}catch(ye){console.error("SSS enrich error:",ye)}}async function Mr(){if(a){ms(!0),Wn(null);try{const me={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:R}]},ye=await yt("/api/admin/shensheshou/ingest",me);ye!=null&&ye.success&&ye.data?Wn(ye.data):Wn({error:(ye==null?void 0:ye.error)||"推送失败"})}catch(me){console.error("SSS ingest error:",me),Wn({error:"请求失败"})}finally{ms(!1)}}}const Ks=me=>{const Ot={view_chapter:Hs,purchase:Jg,match:Rn,login:So,register:So,share:kr,bind_phone:mA,bind_wechat:rA,fill_profile:sd,visit_page:Dl}[me]||Wg;return r.jsx(Ot,{className:"w-4 h-4"})};return t?r.jsxs(r.Fragment,{children:[r.jsx(Mt,{open:t,onOpenChange:()=>e(),children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[r.jsx(At,{children:r.jsxs(It,{className:"text-white flex items-center gap-2",children:[r.jsx(So,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&r.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&r.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),g?r.jsxs("div",{className:"flex items-center justify-center py-20",children:[r.jsx(We,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),r.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?r.jsxs("div",{className:"flex flex-col h-[75vh]",children:[r.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[r.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:a.avatar?r.jsx("img",{src:a.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Ar=a.nickname)==null?void 0:Ar.charAt(0))||"?"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("h3",{className:"text-lg font-bold text-white",children:a.nickname}),a.isAdmin&&r.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),a.hasFullBook&&r.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),a.vipRole&&r.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:a.vipRole})]}),r.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[a.phone?`📱 ${a.phone}`:"未绑定手机",a.wechatId&&` · 💬 ${a.wechatId}`,a.mbti&&` · ${a.mbti}`]}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",a.id.slice(0,16),"…"]}),a.referralCode&&r.jsxs("p",{className:"text-xs",children:[r.jsx("span",{className:"text-gray-500",children:"推广码:"}),r.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:a.referralCode})]})]})]}),r.jsxs("div",{className:"text-right shrink-0",children:[r.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(a.earnings||0).toFixed(2)]}),r.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),r.jsxs(zd,{value:C,onValueChange:E,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(nc,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[r.jsx(en,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),r.jsx(en,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),r.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[r.jsx(Dl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),r.jsx(en,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),r.jsxs(en,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[r.jsx(yi,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),r.jsxs(tn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"手机号"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:M,onChange:me=>P(me.target.value),disabled:!!(a!=null&&a.phone)}),(a==null?void 0:a.phone)&&r.jsx("p",{className:"text-xs text-gray-500",children:"编辑时手机号不可修改"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"昵称"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:$,onChange:me=>D(me.target.value)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.openId&&r.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[r.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),r.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:a.openId})]}),a.region&&r.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[r.jsx(dj,{className:"w-4 h-4 text-gray-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),r.jsx("p",{className:"text-white",children:a.region})]})]}),a.industry&&r.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[r.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),r.jsx("p",{className:"text-white",children:a.industry})]}),a.position&&r.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[r.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),r.jsx("p",{className:"text-white",children:a.position})]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),r.jsx("p",{className:"text-2xl font-bold text-white",children:a.referralCount??0})]}),r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),r.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(a.pendingEarnings??0).toFixed(2)]})]}),r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg flex flex-col justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"当前余额"}),r.jsxs("p",{className:"text-2xl font-bold text-[#38bdac]",children:["¥",((f==null?void 0:f.balance)??0).toFixed(2)]})]}),r.jsx(Z,{size:"sm",variant:"outline",className:"mt-2 border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 text-xs",onClick:()=>{X(""),re(""),oe(!0)},children:"调整余额"})]}),r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),r.jsx("p",{className:"text-sm text-white",children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"-"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(cj,{className:"w-4 h-4 text-yellow-400"}),r.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:ne,onChange:me=>pe(me.target.value)}),r.jsx(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:ge,onChange:me=>z(me.target.value)}),r.jsx(Z,{size:"sm",onClick:Lt,disabled:K||!ne||!ge,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:K?"保存中...":"确认修改"})]})]}),r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(zl,{className:"w-4 h-4 text-amber-400"}),r.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ee,{className:"text-gray-400 text-sm",children:"VIP 会员"}),r.jsx(St,{checked:I.isVip,onCheckedChange:me=>q(ye=>({...ye,isVip:me}))})]}),I.isVip&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-400 text-xs",children:"到期日"}),r.jsx(ie,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:I.vipExpireDate,onChange:me=>q(ye=>({...ye,vipExpireDate:me.target.value}))})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(ee,{className:"text-gray-400 text-xs",children:"角色"}),r.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:I.vipRole,onChange:me=>q(ye=>({...ye,vipRole:me.target.value})),children:[r.jsx("option",{value:"",children:"请选择"}),F.map(me=>r.jsx("option",{value:me.name,children:me.name},me.id))]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(ee,{className:"text-gray-400 text-xs",children:"展示名"}),r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:I.vipName,onChange:me=>q(ye=>({...ye,vipName:me.target.value}))})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(ee,{className:"text-gray-400 text-xs",children:"项目"}),r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"如:某某科技",value:I.vipProject,onChange:me=>q(ye=>({...ye,vipProject:me.target.value}))})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(ee,{className:"text-gray-400 text-xs",children:"联系方式"}),r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"微信/手机等",value:I.vipContact,onChange:me=>q(ye=>({...ye,vipContact:me.target.value}))})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(ee,{className:"text-gray-400 text-xs",children:"简介"}),r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"简短介绍",value:I.vipBio,onChange:me=>q(ye=>({...ye,vipBio:me.target.value}))})]})]})]})]}),a.isVip&&r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(zl,{className:"w-4 h-4 text-amber-400"}),r.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),r.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:a.vipRole||"VIP"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.vipName&&r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"展示名:"}),r.jsx("span",{className:"text-white",children:a.vipName})]}),a.vipProject&&r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"项目:"}),r.jsx("span",{className:"text-white",children:a.vipProject})]}),a.vipContact&&r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"联系方式:"}),r.jsx("span",{className:"text-white",children:a.vipContact})]}),a.vipExpireDate&&r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"到期时间:"}),r.jsx("span",{className:"text-white",children:new Date(a.vipExpireDate).toLocaleDateString()})]})]}),a.vipBio&&r.jsx("p",{className:"text-gray-400 text-sm mt-2",children:a.vipBio})]}),r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Ti,{className:"w-4 h-4 text-purple-400"}),r.jsx("span",{className:"text-white font-medium",children:"微信归属"}),r.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:J,onChange:me=>Ke(me.target.value)}),r.jsxs(Z,{size:"sm",onClick:async()=>{if(!(!J||!a))try{await _t("/api/db/users",{id:a.id,wechatId:J}),ae.success("已保存微信归属"),Ge()}catch{ae.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[r.jsx(vn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),a.wechatId&&r.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",r.jsx("span",{className:"text-purple-400",children:a.wechatId})]})]}),r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(kr,{className:"w-4 h-4 text-[#38bdac]"}),r.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),r.jsx(Z,{size:"sm",onClick:mt,disabled:N||!a.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:N?r.jsxs(r.Fragment,{children:[r.jsx(We,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):r.jsxs(r.Fragment,{children:[r.jsx(We,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"同步状态:"}),a.ckbSyncedAt?r.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):r.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-500",children:"最后同步:"}),r.jsx("span",{className:"text-gray-300 ml-1",children:a.ckbSyncedAt?new Date(a.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),r.jsxs(tn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(sd,{className:"w-4 h-4 text-[#38bdac]"}),r.jsx("span",{className:"text-white font-medium",children:"用户标签"}),r.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),r.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[r.jsx(Hg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),r.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(me=>r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:me.category}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:me.tags.map(ye=>r.jsxs("button",{type:"button",onClick:()=>{R.includes(ye)?pt(ye):O([...R,ye])},className:`px-2 py-0.5 rounded text-xs border transition-all ${R.includes(ye)?"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:[R.includes(ye)?"✓ ":"",ye]},ye))})]},me.category))}),r.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[r.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[R.map((me,ye)=>r.jsxs(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[me,r.jsx("button",{type:"button",onClick:()=>pt(me),className:"ml-1 hover:text-red-400",children:r.jsx(is,{className:"w-3 h-3"})})]},ye)),R.length===0&&r.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:_,onChange:me=>se(me.target.value),onKeyDown:me=>me.key==="Enter"&&st()}),r.jsx(Z,{onClick:st,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),(()=>{const me=a.tags||a.ckbTags||"";let ye=[];try{const Zn=typeof me=="string"?JSON.parse(me||"[]"):[];ye=Array.isArray(Zn)?Zn:typeof me=="string"?me.split(","):[]}catch{ye=typeof me=="string"?me.split(","):[]}const Ot=ye.map(Zn=>String(Zn).trim()).filter(Boolean);return Ot.length===0?null:r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(sd,{className:"w-4 h-4 text-purple-400"}),r.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Ot.map((Zn,Ra)=>r.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0",children:Zn},Ra))})]})})()]}),r.jsxs(tn,{value:"journey",className:"flex-1 overflow-auto",children:[r.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[r.jsx(Dl,{className:"w-4 h-4 text-[#38bdac]"}),r.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),r.jsx("div",{className:"space-y-2",children:o.length>0?o.map((me,ye)=>r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Ks(me.action)}),ye0?u.map((me,ye)=>{var Zn;const Ot=me;return r.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Zn=Ot.nickname)==null?void 0:Zn.charAt(0))||"?"}),r.jsx("span",{className:"text-white text-sm",children:Ot.nickname})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[Ot.status==="vip"&&r.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),r.jsx("span",{className:"text-gray-500 text-xs",children:Ot.createdAt?new Date(Ot.createdAt).toLocaleDateString():""})]})]},Ot.id||ye)}):r.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),r.jsxs(tn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),r.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),r.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[r.jsxs("div",{children:[r.jsx(ee,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:gt,onChange:me=>sn(me.target.value)})]}),r.jsxs("div",{children:[r.jsx(ee,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:Pn,onChange:me=>Pt(me.target.value)})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx(ee,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),r.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Qt,onChange:me=>rn(me.target.value)})]})]}),r.jsx(Z,{onClick:gs,disabled:be,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:be?r.jsxs(r.Fragment,{children:[r.jsx(We,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ka,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),r.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),Rt&&r.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:Rt}),Le&&r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[r.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),r.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:Le.rfm_score??"-"})]}),r.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[r.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),r.jsx("p",{className:"text-2xl font-bold text-white",children:Le.user_level??"-"})]})]}),Le.tags&&Le.tags.length>0&&r.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[r.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Le.tags.map((me,ye)=>r.jsx(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:me},ye))})]}),Le.last_active&&r.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",Le.last_active]})]})]}),r.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(yi,{className:"w-4 h-4 text-purple-400"}),r.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),r.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),r.jsx(Z,{onClick:Mr,disabled:On||!a.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:On?r.jsxs(r.Fragment,{children:[r.jsx(We,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):r.jsxs(r.Fragment,{children:[r.jsx(yi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!a.phone&&r.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),Dn&&r.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:Dn.error?r.jsx("p",{className:"text-red-400",children:String(Dn.error)}):r.jsxs("div",{className:"space-y-1",children:[r.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[r.jsx(Hg,{className:"w-4 h-4"})," 推送成功"]}),Dn.enriched!==void 0&&r.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(Dn.new_tags_added??0)]})]})})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[r.jsxs(Z,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(is,{className:"w-4 h-4 mr-2"}),"关闭"]}),r.jsxs(Z,{onClick:ct,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):r.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),r.jsx(Mt,{open:W,onOpenChange:oe,children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[r.jsx(At,{children:r.jsx(It,{children:"调整余额"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx(ee,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),r.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:Q,onChange:me=>X(me.target.value)})]}),r.jsxs("div",{children:[r.jsx(ee,{className:"text-gray-300 text-sm",children:"备注(可选)"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:H,onChange:me=>re(me.target.value)})]})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Z,{variant:"outline",onClick:()=>oe(!1),className:"border-gray-600 text-gray-300",children:"取消"}),r.jsx(Z,{onClick:yn,disabled:ue,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ue?"提交中...":"确认调整"})]})]})})]}):null}function hP(){const t=Li(),[e,n]=b.useState(!0),[s,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,g]=b.useState(0),[y,N]=b.useState(0),[w,v]=b.useState(0),[k,C]=b.useState(0),[E,M]=b.useState(null),[P,$]=b.useState(null),[D,R]=b.useState(!1),[O,_]=b.useState(0),[se,ne]=b.useState(!1),[pe,ge]=b.useState("week"),[z,K]=b.useState(null),[U,I]=b.useState(!1),q=X=>{const H=X;if((H==null?void 0:H.status)===401)M("登录已过期,请重新登录");else{if((H==null?void 0:H.name)==="AbortError")return;M("加载失败,请检查网络或联系管理员")}};async function F(X){const H=X?{signal:X}:void 0;n(!0),M(null);try{const ce=await Re("/api/admin/dashboard/stats",H);ce!=null&&ce.success&&(g(ce.totalUsers??0),N(ce.paidOrderCount??0),v(ce.totalRevenue??0),C(ce.conversionRate??0))}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",ce);try{const be=await Re("/api/admin/dashboard/overview",H);be!=null&&be.success&&(g(be.totalUsers??0),N(be.paidOrderCount??0),v(be.totalRevenue??0),C(be.conversionRate??0))}catch(be){q(be)}}}finally{n(!1)}try{const ce=await Re("/api/admin/balance/summary",H);ce!=null&&ce.success&&ce.data&&_(ce.data.totalGifted??0)}catch{}a(!0),o(!0);const re=async()=>{try{const ce=await Re("/api/admin/dashboard/recent-orders?limit=10",H);if(ce!=null&&ce.success&&ce.recentOrders)f(ce.recentOrders);else throw new Error("no data")}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError")try{const be=await Re("/api/admin/orders?page=1&pageSize=20&status=paid",H),Le=((be==null?void 0:be.orders)??[]).filter(lt=>["paid","completed","success"].includes(lt.status||""));f(Le.slice(0,5))}catch{f([])}}finally{a(!1)}},ue=async()=>{try{const ce=await Re("/api/admin/dashboard/new-users",H);if(ce!=null&&ce.success&&ce.newUsers)u(ce.newUsers);else throw new Error("no data")}catch(ce){if((ce==null?void 0:ce.name)!=="AbortError")try{const be=await Re("/api/db/users?page=1&pageSize=10",H);u((be==null?void 0:be.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([re(),ue()])}async function L(X){const H=X||pe;I(!0);try{const re=await Re(`/api/admin/track/stats?period=${H}`);re!=null&&re.success&&K({total:re.total??0,byModule:re.byModule??{}})}catch{K(null)}finally{I(!1)}}b.useEffect(()=>{const X=new AbortController;F(X.signal),L();const H=setInterval(()=>{F(),L()},3e4);return()=>{X.abort(),clearInterval(H)}},[]);const W=m,oe=X=>{const H=X.productType||"",re=X.description||"";if(H==="balance_recharge")return{title:`余额充值 ¥${typeof X.amount=="number"?X.amount.toFixed(2):parseFloat(String(X.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(H==="gift_pay")return{title:`代付 ¥${typeof X.amount=="number"?X.amount.toFixed(2):parseFloat(String(X.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(H==="gift_pay_batch"){const ue=typeof X.amount=="number"?X.amount.toFixed(2):parseFloat(String(X.amount||"0")).toFixed(2);return{title:re||`代付分享 ¥${ue}`,subtitle:"代付分享"}}if(H==="section"&&re.includes("代付领取"))return{title:re.replace("代付领取 - ",""),subtitle:"代付领取"};if(re){if(H==="section"&&re.includes("章节")){if(re.includes("-")){const ue=re.split("-");if(ue.length>=3)return{title:`第${ue[1]}章 第${ue[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:re,subtitle:"章节购买"}}return H==="fullbook"||re.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:H==="vip"||re.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:H==="match"||re.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:re,subtitle:H==="section"?"单章":H==="fullbook"?"全书":"其他"}}return H==="section"?{title:`章节 ${X.productId||""}`,subtitle:"单章购买"}:H==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:H==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:H==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:H||"其他"}},Q=[{title:"总用户数",value:e?null:W,sub:null,icon:Rn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:O>0?`含代付 ¥${O.toFixed(2)}`:null,icon:rd,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:Jg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,sub:null,icon:Hs,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return r.jsxs("div",{className:"p-8 w-full",children:[r.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),E&&r.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:[r.jsx("span",{children:E}),r.jsx("button",{type:"button",onClick:()=>F(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:Q.map((X,H)=>r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>X.link&&t(X.link),children:[r.jsxs(Je,{className:"flex flex-row items-center justify-between pb-2",children:[r.jsx(Ye,{className:"text-sm font-medium text-gray-400",children:X.title}),r.jsx("div",{className:`p-2 rounded-lg ${X.bg}`,children:r.jsx(X.icon,{className:`w-4 h-4 ${X.color}`})})]}),r.jsx(Ee,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-2xl font-bold text-white min-h-8 flex items-center",children:X.value!=null?X.value:r.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[r.jsx(We,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),X.sub&&r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:X.sub})]}),r.jsx(Ol,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},H))}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[r.jsxs(Je,{className:"flex flex-row items-center justify-between",children:[r.jsx(Ye,{className:"text-white",children:"最近订单"}),r.jsxs("button",{type:"button",onClick:()=>F(),disabled:s||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[s||i?r.jsx(We,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(We,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),r.jsx(Ee,{children:r.jsx("div",{className:"space-y-3",children:s&&h.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[r.jsx(We,{className:"w-8 h-8 animate-spin mb-2"}),r.jsx("span",{className:"text-sm",children:"加载中..."})]}):r.jsxs(r.Fragment,{children:[h.slice(0,se?10:4).map(X=>{var be;const H=X.referrerId?c.find(Pe=>Pe.id===X.referrerId):void 0,re=X.referralCode||(H==null?void 0:H.referralCode)||(H==null?void 0:H.nickname)||(X.referrerId?String(X.referrerId).slice(0,8):""),ue=oe(X),ce=X.userNickname||((be=c.find(Pe=>Pe.id===X.userId))==null?void 0:be.nickname)||"匿名用户";return r.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:[r.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[X.userAvatar?r.jsx("img",{src:X.userAvatar,alt:ce,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:Pe=>{Pe.currentTarget.style.display="none";const Le=Pe.currentTarget.nextElementSibling;Le&&Le.classList.remove("hidden")}}):null,r.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 mt-0.5 ${X.userAvatar?"hidden":""}`,children:ce.charAt(0)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("button",{type:"button",onClick:()=>{X.userId&&($(X.userId),R(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ce}),r.jsx("span",{className:"text-gray-600",children:"·"}),r.jsx("span",{className:"text-sm font-medium text-white truncate",children:ue.title})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[ue.subtitle&&ue.subtitle!=="章节购买"&&r.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:ue.subtitle}),r.jsx("span",{children:new Date(X.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),re&&r.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",re]})]})]}),r.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[r.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(X.amount).toFixed(2)]}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:X.paymentMethod||"微信"})]})]},X.id)}),h.length>4&&!se&&r.jsx("button",{type:"button",onClick:()=>ne(!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&&!s&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Jg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),r.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[r.jsx(Je,{children:r.jsx(Ye,{className:"text-white",children:"新注册用户"})}),r.jsx(Ee,{children:r.jsx("div",{className:"space-y-3",children:i&&c.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[r.jsx(We,{className:"w-8 h-8 animate-spin mb-2"}),r.jsx("span",{className:"text-sm",children:"加载中..."})]}):r.jsxs(r.Fragment,{children:[c.slice(0,5).map(X=>{var H;return r.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((H=X.nickname)==null?void 0:H.charAt(0))||"?"}),r.jsxs("div",{children:[r.jsx("button",{type:"button",onClick:()=>{$(X.id),R(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:X.nickname||"匿名用户"}),r.jsx("p",{className:"text-xs text-gray-500",children:X.phone||"-"})]})]}),r.jsx("p",{className:"text-xs text-gray-400",children:X.createdAt?new Date(X.createdAt).toLocaleDateString():"-"})]},X.id)}),c.length===0&&!i&&r.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),r.jsxs(Ce,{className:"mt-8 bg-[#0f2137] border-gray-700/50 shadow-xl",children:[r.jsxs(Je,{className:"flex flex-row items-center justify-between",children:[r.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[r.jsx(Vg,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),r.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(X=>r.jsx("button",{type:"button",onClick:()=>{ge(X),L(X)},className:`px-3 py-1 text-xs rounded-full transition-colors ${pe===X?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[X]},X))})]}),r.jsx(Ee,{children:U&&!z?r.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[r.jsx(We,{className:"w-6 h-6 animate-spin mr-2"}),r.jsx("span",{children:"加载中..."})]}):z&&Object.keys(z.byModule).length>0?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",r.jsx("span",{className:"text-white font-bold text-lg",children:z.total})," 次"]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(z.byModule).sort((X,H)=>H[1].reduce((re,ue)=>re+ue.count,0)-X[1].reduce((re,ue)=>re+ue.count,0)).map(([X,H])=>{const re=H.reduce((ce,be)=>ce+be.count,0),ue={home:"首页",chapters:"目录",read:"阅读",my:"我的",vip:"VIP",wallet:"钱包",match:"找伙伴",referral:"推广",search:"搜索",settings:"设置",about:"关于",other:"其他"};return r.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:ue[X]||X}),r.jsxs("span",{className:"text-xs text-gray-500",children:[re," 次"]})]}),r.jsx("div",{className:"space-y-2",children:H.sort((ce,be)=>be.count-ce.count).slice(0,8).map((ce,be)=>{const Pe={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",rule_trigger:"规则触发",view_chapter:"浏览章节",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元"},Le={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节"},lt=Pe[ce.target]||ce.target||Le[ce.action]||ce.action;return r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-gray-300 truncate mr-2",title:`${ce.action}: ${ce.target}`,children:lt}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${re>0?ce.count/re*100:0}%`}})}),r.jsx("span",{className:"text-gray-400 w-8 text-right",children:ce.count})]})]},be)})})]},X)})})]}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Vg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),r.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),r.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),r.jsx(x0,{open:D,onClose:()=>{R(!1),$(null)},userId:P,onUserUpdated:()=>F()})]})}const cs=b.forwardRef(({className:t,...e},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:Tt("w-full caption-bottom text-sm",t),...e})}));cs.displayName="Table";const ds=b.forwardRef(({className:t,...e},n)=>r.jsx("thead",{ref:n,className:Tt("[&_tr]:border-b",t),...e}));ds.displayName="TableHeader";const us=b.forwardRef(({className:t,...e},n)=>r.jsx("tbody",{ref:n,className:Tt("[&_tr:last-child]:border-0",t),...e}));us.displayName="TableBody";const it=b.forwardRef(({className:t,...e},n)=>r.jsx("tr",{ref:n,className:Tt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));it.displayName="TableRow";const ke=b.forwardRef(({className:t,...e},n)=>r.jsx("th",{ref:n,className:Tt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableHead";const Ne=b.forwardRef(({className:t,...e},n)=>r.jsx("td",{ref:n,className:Tt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));Ne.displayName="TableCell";function y0(t,e){const[n,s]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>s(t),e);return()=>clearTimeout(a)},[t,e]),n}function Vs({page:t,totalPages:e,total:n,pageSize:s,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?null:r.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[r.jsxs("span",{children:["共 ",n," 条"]}),i&&r.jsx("select",{value:s,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=>r.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.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:"首页"}),r.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:"上一页"}),r.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),r.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:"下一页"}),r.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 fP(){const[t,e]=b.useState([]),[n,s]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[N,w]=b.useState(""),v=y0(N,300),[k,C]=b.useState("all"),[E,M]=b.useState(!0),[P,$]=b.useState(null),[D,R]=b.useState(null),[O,_]=b.useState(""),[se,ne]=b.useState(!1);async function pe(){M(!0),$(null);try{const F=k==="all"?"":k==="completed"?"completed":k,L=new URLSearchParams({page:String(f),pageSize:String(g),...F&&{status:F},...v&&{search:v}}),[W,oe]=await Promise.all([Re(`/api/admin/orders?${L}`),Re("/api/db/users?page=1&pageSize=500")]);W!=null&&W.success&&(e(W.orders||[]),i(W.total??0),c(W.totalRevenue??0),h(W.todayRevenue??0)),oe!=null&&oe.success&&oe.users&&s(oe.users)}catch(F){console.error("加载订单失败",F),$("加载订单失败,请检查网络后重试")}finally{M(!1)}}b.useEffect(()=>{m(1)},[v,k]),b.useEffect(()=>{pe()},[f,g,v,k]);const ge=F=>{var L;return F.userNickname||((L=n.find(W=>W.id===F.userId))==null?void 0:L.nickname)||"匿名用户"},z=F=>{var L;return((L=n.find(W=>W.id===F))==null?void 0:L.phone)||"-"},K=F=>{const L=F.productType||F.type||"",W=F.description||"";if(L==="balance_recharge")return{name:`余额充值 ¥${Number(F.amount||0).toFixed(2)}`,type:"余额充值"};if(W){if(L==="section"&&(W.includes("章节")||W.includes("代付领取"))){if(W.includes("代付领取"))return{name:W.replace("代付领取 - ",""),type:"代付领取"};if(W.includes("-")){const oe=W.split("-");if(oe.length>=3)return{name:`第${oe[1]}章 第${oe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return L==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:L==="vip"||W.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:L==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return L==="section"?{name:`章节 ${F.productId||F.sectionId||""}`,type:"单章"}:L==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:L==="vip"?{name:"超级个体开通费用",type:"超级个体"}:L==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:L||"其他"}},U=Math.ceil(a/g)||1;async function I(){var F;if(!(!(D!=null&&D.orderSn)&&!(D!=null&&D.id))){ne(!0),$(null);try{const L=await _t("/api/admin/orders/refund",{orderSn:D.orderSn||D.id,reason:O||void 0});L!=null&&L.success?(R(null),_(""),pe()):$((L==null?void 0:L.error)||"退款失败")}catch(L){const W=L;$(((F=W==null?void 0:W.data)==null?void 0:F.error)||"退款失败,请检查网络后重试")}finally{ne(!1)}}}function q(){if(t.length===0){ae.info("暂无数据可导出");return}const F=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],L=t.map(H=>{const re=K(H);return[H.orderSn||H.id||"",ge(H),z(H.userId),re.name,Number(H.amount||0).toFixed(2),H.paymentMethod==="wechat"?"微信支付":H.paymentMethod==="balance"?"余额支付":H.paymentMethod==="alipay"?"支付宝":H.paymentMethod||"微信支付",H.status==="refunded"?"已退款":H.status==="paid"||H.status==="completed"?"已完成":H.status==="pending"||H.status==="created"?"待支付":"已失败",H.status==="refunded"&&H.refundReason?H.refundReason:"-",H.referrerEarnings?Number(H.referrerEarnings).toFixed(2):"-",H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[F.join(","),...L].join(`
-`),oe=new Blob([W],{type:"text/csv;charset=utf-8"}),Q=URL.createObjectURL(oe),X=document.createElement("a");X.href=Q,X.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,X.click(),URL.revokeObjectURL(Q)}return r.jsxs("div",{className:"p-8 w-full",children:[P&&r.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:[r.jsx("span",{children:P}),r.jsx("button",{type:"button",onClick:()=>$(null),className:"hover:text-red-300",children:"×"})]}),r.jsxs("div",{className:"flex justify-between items-center mb-8",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),r.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(Z,{variant:"outline",onClick:pe,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(We,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新"]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-gray-400",children:"总收入:"}),r.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),r.jsx("span",{className:"text-gray-600",children:"|"}),r.jsx("span",{className:"text-gray-400",children:"今日:"}),r.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1 max-w-md",children:[r.jsx(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),r.jsx(ie,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:N,onChange:F=>w(F.target.value)})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ij,{className:"w-4 h-4 text-gray-400"}),r.jsxs("select",{value:k,onChange:F=>C(F.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[r.jsx("option",{value:"all",children:"全部状态"}),r.jsx("option",{value:"completed",children:"已完成"}),r.jsx("option",{value:"pending",children:"待支付"}),r.jsx("option",{value:"created",children:"已创建"}),r.jsx("option",{value:"failed",children:"已失败"}),r.jsx("option",{value:"refunded",children:"已退款"})]})]}),r.jsxs(Z,{variant:"outline",onClick:q,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(pM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:r.jsx(Ee,{className:"p-0",children:E?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(We,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),r.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):r.jsxs("div",{children:[r.jsxs(cs,{children:[r.jsx(ds,{children:r.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[r.jsx(ke,{className:"text-gray-400",children:"订单号"}),r.jsx(ke,{className:"text-gray-400",children:"用户"}),r.jsx(ke,{className:"text-gray-400",children:"商品"}),r.jsx(ke,{className:"text-gray-400",children:"金额"}),r.jsx(ke,{className:"text-gray-400",children:"支付方式"}),r.jsx(ke,{className:"text-gray-400",children:"状态"}),r.jsx(ke,{className:"text-gray-400",children:"退款原因"}),r.jsx(ke,{className:"text-gray-400",children:"分销佣金"}),r.jsx(ke,{className:"text-gray-400",children:"下单时间"}),r.jsx(ke,{className:"text-gray-400",children:"操作"})]})}),r.jsxs(us,{children:[t.map(F=>{const L=K(F);return r.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[r.jsxs(Ne,{className:"font-mono text-xs text-gray-400",children:[(F.orderSn||F.id||"").slice(0,12),"..."]}),r.jsx(Ne,{children:r.jsxs("div",{children:[r.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[ge(F),F.paymentMethod==="gift_pay"&&r.jsx(Ue,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),F.payerUserId&&F.paymentMethod!=="gift_pay"&&r.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),r.jsx("p",{className:"text-gray-500 text-xs",children:z(F.userId)}),F.payerUserId&&F.payerNickname&&r.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[F.paymentMethod==="gift_pay"?"赠送人:":"代付人:",F.payerNickname]})]})}),r.jsx(Ne,{children:r.jsxs("div",{children:[r.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[L.name,(F.productType||F.type)==="vip"&&r.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),r.jsx("p",{className:"text-gray-500 text-xs",children:L.type})]})}),r.jsxs(Ne,{className:"text-[#38bdac] font-bold",children:["¥",Number(F.amount||0).toFixed(2)]}),r.jsx(Ne,{className:"text-gray-300",children:F.paymentMethod==="wechat"?"微信支付":F.paymentMethod==="balance"?"余额支付":F.paymentMethod==="alipay"?"支付宝":F.paymentMethod||"微信支付"}),r.jsx(Ne,{children:F.status==="refunded"?r.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):F.status==="paid"||F.status==="completed"?r.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):F.status==="pending"||F.status==="created"?r.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):r.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),r.jsx(Ne,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:F.refundReason,children:F.status==="refunded"&&F.refundReason?F.refundReason:"-"}),r.jsx(Ne,{className:"text-[#FFD700]",children:F.referrerEarnings?`¥${Number(F.referrerEarnings).toFixed(2)}`:"-"}),r.jsx(Ne,{className:"text-gray-400 text-sm",children:new Date(F.createdAt).toLocaleString("zh-CN")}),r.jsx(Ne,{children:(F.status==="paid"||F.status==="completed")&&F.paymentMethod!=="balance"&&r.jsxs(Z,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{R(F),_("")},children:[r.jsx(uj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},F.id)}),t.length===0&&r.jsx(it,{children:r.jsx(Ne,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),r.jsx(Vs,{page:f,totalPages:U,total:a,pageSize:g,onPageChange:m,onPageSizeChange:F=>{y(F),m(1)}})]})})}),r.jsx(Mt,{open:!!D,onOpenChange:F=>!F&&R(null),children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[r.jsx(At,{children:r.jsx(It,{className:"text-white",children:"订单退款"})}),D&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",D.orderSn||D.id]}),r.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(D.amount||0).toFixed(2)]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),r.jsx("div",{className:"form-input",children:r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:O,onChange:F=>_(F.target.value)})})]}),r.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),r.jsxs(Zt,{children:[r.jsx(Z,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>R(null),disabled:se,children:"取消"}),r.jsx(Z,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:I,disabled:se,children:se?"退款中...":"确认退款"})]})]})})]})}const sc=b.forwardRef(({className:t,...e},n)=>r.jsx("textarea",{className:Tt("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}));sc.displayName="Textarea";const Xu=[{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 pP(){var na,$a,sa,Fa,Ki;const[t,e]=Zw(),n=t.get("pool"),[s,a]=b.useState([]),[i,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=y0(m,300),N=n==="vip"?"vip":n==="complete"?"complete":"all",[w,v]=b.useState(N),[k,C]=b.useState(!0),[E,M]=b.useState(!1),[P,$]=b.useState(null),[D,R]=b.useState(!1),[O,_]=b.useState("desc");b.useEffect(()=>{n==="vip"?v("vip"):n==="complete"?v("complete"):n==="all"&&v("all")},[n]);const[se,ne]=b.useState(!1),[pe,ge]=b.useState(null),[z,K]=b.useState(!1),[U,I]=b.useState(!1),[q,F]=b.useState({referrals:[],stats:{}}),[L,W]=b.useState(!1),[oe,Q]=b.useState(null),[X,H]=b.useState(!1),[re,ue]=b.useState(null),[ce,be]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Pe,Le]=b.useState([]),[lt,Rt]=b.useState(!1),[dn,gt]=b.useState(!1),[sn,Pn]=b.useState(null),[Pt,Qt]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[rn,On]=b.useState([]),[ms,Dn]=b.useState(!1),[Wn,J]=b.useState(null),[Ke,Ge]=b.useState(null),[mt,ct]=b.useState({}),[st,pt]=b.useState(!1);async function Lt(G=!1){var Oe;C(!0),G&&M(!0),$(null);try{if(D){const Be=new URLSearchParams({search:y,limit:String(h*5)}),Qe=await Re(`/api/db/users/rfm?${Be}`);if(Qe!=null&&Qe.success){let Kt=Qe.users||[];O==="asc"&&(Kt=[...Kt].reverse());const xs=(c-1)*h;a(Kt.slice(xs,xs+h)),o(((Oe=Qe.users)==null?void 0:Oe.length)??0),Kt.length===0&&(R(!1),$("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else R(!1),$((Qe==null?void 0:Qe.error)||"RFM 加载失败,已切回普通模式")}else{const Be=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...w==="vip"&&{vip:"true"},...w==="complete"&&{pool:"complete"}}),Qe=await Re(`/api/db/users?${Be}`);Qe!=null&&Qe.success?(a(Qe.users||[]),o(Qe.total??0)):$((Qe==null?void 0:Qe.error)||"加载失败")}}catch(Be){console.error("Load users error:",Be),$("网络错误")}finally{C(!1),G&&M(!1)}}b.useEffect(()=>{u(1)},[y,w,D]),b.useEffect(()=>{Lt()},[c,h,y,w,D,O]);const yn=Math.ceil(i/h)||1,gs=()=>{D?O==="desc"?_("asc"):(R(!1),_("desc")):(R(!0),_("desc"))},js=G=>({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"})[G||""]||"bg-gray-500/20 text-gray-400";async function Mr(G){var Oe;if(confirm("确定要删除这个用户吗?"))try{const Be=await Hr(`/api/db/users?id=${encodeURIComponent(G)}`);Be!=null&&Be.success?(ae.success("已删除"),Lt()):ae.error("删除失败: "+((Be==null?void 0:Be.error)||"未知错误"))}catch(Be){const Qe=Be,Kt=((Oe=Qe==null?void 0:Qe.data)==null?void 0:Oe.error)||(Qe==null?void 0:Qe.message)||"网络错误";ae.error("删除失败: "+Kt)}}const Ks=G=>{ge(G),be({phone:G.phone||"",nickname:G.nickname||"",password:"",isAdmin:!!(G.isAdmin??!1),hasFullBook:!!(G.hasFullBook??!1)}),ne(!0)},Ar=()=>{ge(null),be({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),ne(!0)};async function me(){if(!ce.phone||!ce.nickname){ae.error("请填写手机号和昵称");return}K(!0);try{if(pe){const G=await _t("/api/db/users",{id:pe.id,phone:ce.phone||void 0,nickname:ce.nickname,isAdmin:ce.isAdmin,hasFullBook:ce.hasFullBook,...ce.password&&{password:ce.password}});if(!(G!=null&&G.success)){ae.error("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await yt("/api/db/users",{phone:ce.phone,nickname:ce.nickname,password:ce.password,isAdmin:ce.isAdmin});if(!(G!=null&&G.success)){ae.error("创建失败: "+((G==null?void 0:G.error)||""));return}}ne(!1),Lt()}catch{ae.error("保存失败")}finally{K(!1)}}async function ye(G){Q(G),I(!0),W(!0);try{const Oe=await Re(`/api/db/users/referrals?userId=${encodeURIComponent(G.id)}`);Oe!=null&&Oe.success?F({referrals:Oe.referrals||[],stats:Oe.stats||{}}):F({referrals:[],stats:{}})}catch{F({referrals:[],stats:{}})}finally{W(!1)}}const Ot=b.useCallback(async()=>{Rt(!0);try{const G=await Re("/api/db/user-rules");G!=null&&G.success&&Le(G.rules||[])}catch{}finally{Rt(!1)}},[]);async function Zn(){if(!Pt.title){ae.error("请填写规则标题");return}K(!0);try{if(sn){const G=await _t("/api/db/user-rules",{id:sn.id,...Pt});if(!(G!=null&&G.success)){ae.error("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await yt("/api/db/user-rules",Pt);if(!(G!=null&&G.success)){ae.error("创建失败: "+((G==null?void 0:G.error)||""));return}}gt(!1),Ot()}catch{ae.error("保存失败")}finally{K(!1)}}async function Ra(G){if(confirm("确定删除?"))try{const Oe=await Hr(`/api/db/user-rules?id=${G}`);Oe!=null&&Oe.success&&Ot()}catch{}}async function Hi(G){try{await _t("/api/db/user-rules",{id:G.id,enabled:!G.enabled}),Ot()}catch{}}const ks=b.useCallback(async()=>{Dn(!0);try{const G=await Re("/api/db/vip-members?limit=500");if(G!=null&&G.success&&G.data){const Oe=[...G.data].map((Be,Qe)=>({...Be,vipSort:typeof Be.vipSort=="number"?Be.vipSort:Qe+1}));Oe.sort((Be,Qe)=>(Be.vipSort??999999)-(Qe.vipSort??999999)),On(Oe)}else G&&G.error&&ae.error(G.error)}catch{ae.error("加载超级个体列表失败")}finally{Dn(!1)}},[]),[Pa,qs]=b.useState(!1),[Ir,cr]=b.useState(null),[Rr,dr]=b.useState(""),[qo,Gs]=b.useState(!1),Oa=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],Da=G=>{cr(G),dr(G.vipRole||""),qs(!0)},ur=async G=>{const Oe=G.trim();if(Ir){if(!Oe){ae.error("请选择或输入标签");return}Gs(!0);try{const Be=await _t("/api/db/users",{id:Ir.id,vipRole:Oe});if(!(Be!=null&&Be.success)){ae.error((Be==null?void 0:Be.error)||"更新超级个体标签失败");return}ae.success("已更新超级个体标签"),qs(!1),cr(null),await ks()}catch{ae.error("更新超级个体标签失败")}finally{Gs(!1)}}},[Wi,Zr]=b.useState(!1),[bt,un]=b.useState(null),[La,_a]=b.useState(""),[Go,ea]=b.useState(!1),Ui=G=>{un(G),_a(G.vipSort!=null?String(G.vipSort):""),Zr(!0)},ta=async()=>{if(!bt)return;const G=Number(La);if(!Number.isFinite(G)){ae.error("请输入有效的数字序号");return}ea(!0);try{const Oe=await _t("/api/db/users",{id:bt.id,vipSort:G});if(!(Oe!=null&&Oe.success)){ae.error((Oe==null?void 0:Oe.error)||"更新排序序号失败");return}ae.success("已更新排序序号"),Zr(!1),un(null),await ks()}catch{ae.error("更新排序序号失败")}finally{ea(!1)}},hr=(G,Oe)=>{G.dataTransfer.effectAllowed="move",G.dataTransfer.setData("text/plain",Oe),J(Oe)},za=(G,Oe)=>{G.preventDefault(),Ke!==Oe&&Ge(Oe)},cc=()=>{J(null),Ge(null)},Ut=async(G,Oe)=>{G.preventDefault();const Be=G.dataTransfer.getData("text/plain")||Wn;if(J(null),Ge(null),!Be||Be===Oe)return;const Qe=rn.find(qt=>qt.id===Be),Kt=rn.find(qt=>qt.id===Oe);if(!Qe||!Kt)return;const xs=Qe.vipSort??rn.findIndex(qt=>qt.id===Be)+1,Yo=Kt.vipSort??rn.findIndex(qt=>qt.id===Oe)+1;On(qt=>{const Un=[...qt],an=Un.findIndex(En=>En.id===Be),fr=Un.findIndex(En=>En.id===Oe);if(an===-1||fr===-1)return qt;const Js=[...Un],[qi,Ba]=[Js[an],Js[fr]];return Js[an]={...Ba,vipSort:xs},Js[fr]={...qi,vipSort:Yo},Js});try{const[qt,Un]=await Promise.all([_t("/api/db/users",{id:Be,vipSort:Yo}),_t("/api/db/users",{id:Oe,vipSort:xs})]);if(!(qt!=null&&qt.success)||!(Un!=null&&Un.success)){ae.error((qt==null?void 0:qt.error)||(Un==null?void 0:Un.error)||"更新排序失败"),await ks();return}ae.success("已更新排序"),await ks()}catch{ae.error("更新排序失败"),await ks()}},Jo=b.useCallback(async()=>{pt(!0);try{const G=await Re("/api/db/users/journey-stats");G!=null&&G.success&&G.stats&&ct(G.stats)}catch{}finally{pt(!1)}},[]);return r.jsxs("div",{className:"p-8 w-full",children:[P&&r.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:[r.jsx("span",{children:P}),r.jsx("button",{type:"button",onClick:()=>$(null),children:"×"})]}),r.jsx("div",{className:"flex justify-between items-center mb-6",children:r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),r.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",i," 位注册用户",D&&" · RFM 排序中"]})]})}),r.jsxs(zd,{defaultValue:"users",className:"w-full",children:[r.jsxs(nc,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[r.jsxs(en,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[r.jsx(Rn,{className:"w-4 h-4"})," 用户列表"]}),r.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Jo,children:[r.jsx(Dl,{className:"w-4 h-4"})," 用户旅程总览"]}),r.jsxs(en,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Ot,children:[r.jsx(ko,{className:"w-4 h-4"})," 规则配置"]}),r.jsxs(en,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ks,children:[r.jsx(zl,{className:"w-4 h-4"})," 超级个体列表"]})]}),r.jsxs(tn,{value:"users",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[r.jsxs(Z,{variant:"outline",onClick:()=>Lt(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(We,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),r.jsxs("select",{value:w,onChange:G=>{const Oe=G.target.value;v(Oe),u(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:D,children:[r.jsx("option",{value:"all",children:"全部用户"}),r.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),r.jsx("option",{value:"complete",children:"完善资料用户"})]}),r.jsxs("div",{className:"relative",children:[r.jsx(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),r.jsx(ie,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:G=>g(G.target.value)})]}),r.jsxs(Z,{onClick:Ar,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(Qg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:r.jsx(Ee,{className:"p-0",children:k?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(We,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),r.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):r.jsxs("div",{children:[r.jsxs(cs,{children:[r.jsx(ds,{children:r.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[r.jsx(ke,{className:"text-gray-400",children:"用户信息"}),r.jsx(ke,{className:"text-gray-400",children:"绑定信息"}),r.jsx(ke,{className:"text-gray-400",children:"购买状态"}),r.jsx(ke,{className:"text-gray-400",children:"分销收益"}),r.jsxs(ke,{className:"text-gray-400 cursor-pointer select-none",onClick:gs,children:[r.jsxs("div",{className:"flex items-center gap-1 group",children:[r.jsx(rd,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:"RFM分值"}),D?O==="desc"?r.jsx(yd,{className:"w-3.5 h-3.5 text-[#38bdac]"}):r.jsx(tj,{className:"w-3.5 h-3.5 text-[#38bdac]"}):r.jsx(Bm,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&r.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),r.jsx(ke,{className:"text-gray-400",children:"注册时间"}),r.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),r.jsxs(us,{children:[s.map(G=>{var Oe,Be,Qe;return r.jsxs(it,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[r.jsx(Ne,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:G.avatar?r.jsx("img",{src:G.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Oe=G.nickname)==null?void 0:Oe.charAt(0))||"?"}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",onClick:()=>{ue(G.id),H(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:G.nickname}),G.isAdmin&&r.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),G.openId&&!((Be=G.id)!=null&&Be.startsWith("user_"))&&r.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),r.jsx("p",{className:"text-xs text-gray-500 font-mono",children:G.openId?G.openId.slice(0,12)+"...":(Qe=G.id)==null?void 0:Qe.slice(0,12)})]})]})}),r.jsx(Ne,{children:r.jsxs("div",{className:"space-y-1",children:[G.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("span",{className:"text-gray-500",children:"📱"}),r.jsx("span",{className:"text-gray-300",children:G.phone})]}),G.wechatId&&r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("span",{className:"text-gray-500",children:"💬"}),r.jsx("span",{className:"text-gray-300",children:G.wechatId})]}),G.openId&&r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("span",{className:"text-gray-500",children:"🔗"}),r.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:G.openId,children:[G.openId.slice(0,12),"..."]})]}),!G.phone&&!G.wechatId&&!G.openId&&r.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),r.jsx(Ne,{children:G.hasFullBook?r.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):r.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),r.jsx(Ne,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(G.earnings||0)).toFixed(2)]}),parseFloat(String(G.pendingEarnings||0))>0&&r.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(G.pendingEarnings||0)).toFixed(2)]}),r.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>ye(G),role:"button",tabIndex:0,onKeyDown:Kt=>Kt.key==="Enter"&&ye(G),children:[r.jsx(Rn,{className:"w-3 h-3"})," 绑定",G.referralCount||0,"人"]})]})}),r.jsx(Ne,{children:G.rfmScore!==void 0?r.jsx("div",{className:"flex flex-col gap-1",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-white font-bold text-base",children:G.rfmScore}),r.jsx(Ue,{className:`border-0 text-xs ${js(G.rfmLevel)}`,children:G.rfmLevel})]})}):r.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",r.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),r.jsx(Ne,{className:"text-gray-400",children:G.createdAt?new Date(G.createdAt).toLocaleDateString():"-"}),r.jsx(Ne,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{ue(G.id),H(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:r.jsx(Ug,{className:"w-4 h-4"})}),r.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>Ks(G),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:r.jsx(Vt,{className:"w-4 h-4"})}),r.jsx(Z,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Mr(G.id),title:"删除",children:r.jsx(Jn,{className:"w-4 h-4"})})]})})]},G.id)}),s.length===0&&r.jsx(it,{children:r.jsx(Ne,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),r.jsx(Vs,{page:c,totalPages:yn,total:i,pageSize:h,onPageChange:u,onPageSizeChange:G=>{f(G),u(1)}})]})})})]}),r.jsxs(tn,{value:"journey",children:[r.jsxs("div",{className:"flex items-center justify-between mb-5",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),r.jsxs(Z,{variant:"outline",onClick:Jo,disabled:st,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(We,{className:`w-4 h-4 mr-2 ${st?"animate-spin":""}`})," 刷新数据"]})]}),r.jsxs("div",{className:"relative mb-8",children:[r.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"}),r.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:Xu.map((G,Oe)=>r.jsxs("div",{className:"relative flex flex-col items-center",children:[r.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${G.color} text-center cursor-default`,children:[r.jsx("div",{className:"text-2xl mb-1",children:G.icon}),r.jsx("div",{className:`text-xs font-medium ${G.color.split(" ").find(Be=>Be.startsWith("text-"))}`,children:G.label}),mt[G.id]!==void 0&&r.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[r.jsx("span",{className:"font-bold text-white",children:mt[G.id]})," 人"]}),r.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:Oe+1})]}),Oer.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[r.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:G.step}),r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-300",children:G.action}),r.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",G.next]})]})]},G.step))})]}),r.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Hs,{className:"w-4 h-4 text-purple-400"}),r.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),r.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),st?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(We,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(mt).length>0?r.jsx("div",{className:"space-y-2",children:Xu.map(G=>{const Oe=mt[G.id]||0,Be=Math.max(...Xu.map(Kt=>mt[Kt.id]||0),1),Qe=Math.round(Oe/Be*100);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[G.icon," ",G.label]}),r.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${Qe}%`}})}),r.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Oe})]},G.id)})}):r.jsx("div",{className:"text-center py-8",children:r.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),r.jsxs(tn,{value:"rules",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Z,{variant:"outline",onClick:Ot,disabled:lt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(We,{className:`w-4 h-4 mr-2 ${lt?"animate-spin":""}`})," 刷新"]}),r.jsxs(Z,{onClick:()=>{Pn(null),Qt({title:"",description:"",trigger:"",sort:0,enabled:!0}),gt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(pn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),lt?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(We,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Pe.length===0?r.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[r.jsx(Hs,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),r.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),r.jsxs(Z,{onClick:Ot,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(We,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):r.jsx("div",{className:"space-y-2",children:Pe.map(G=>r.jsx("div",{className:`p-4 rounded-lg border transition-all ${G.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[r.jsx(Vt,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),r.jsx("span",{className:"text-white font-medium",children:G.title}),G.trigger&&r.jsxs(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",G.trigger]}),r.jsx(Ue,{className:`text-xs border-0 ${G.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:G.enabled?"启用":"禁用"})]}),G.description&&r.jsx("p",{className:"text-gray-400 text-sm ml-6",children:G.description})]}),r.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[r.jsx(St,{checked:G.enabled,onCheckedChange:()=>Hi(G)}),r.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>{Pn(G),Qt({title:G.title,description:G.description,trigger:G.trigger,sort:G.sort,enabled:G.enabled}),gt(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:r.jsx(Vt,{className:"w-4 h-4"})}),r.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>Ra(G.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:r.jsx(Jn,{className:"w-4 h-4"})})]})]})},G.id))})]}),r.jsxs(tn,{value:"vip-roles",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),r.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs(Z,{variant:"outline",onClick:ks,disabled:ms,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(We,{className:`w-4 h-4 mr-2 ${ms?"animate-spin":""}`})," ","刷新"]})})]}),ms?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(We,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),r.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):rn.length===0?r.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[r.jsx(zl,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),r.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:r.jsx(Ee,{className:"p-0",children:r.jsxs(cs,{children:[r.jsx(ds,{children:r.jsxs(it,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[r.jsx(ke,{className:"text-gray-400 w-16",children:"序号"}),r.jsx(ke,{className:"text-gray-400",children:"成员"}),r.jsx(ke,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),r.jsx(ke,{className:"text-gray-400 w-24",children:"排序值"}),r.jsx(ke,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),r.jsx(us,{children:rn.map((G,Oe)=>{var Kt;const Be=Wn===G.id,Qe=Ke===G.id;return r.jsxs(it,{draggable:!0,onDragStart:xs=>hr(xs,G.id),onDragOver:xs=>za(xs,G.id),onDrop:xs=>Ut(xs,G.id),onDragEnd:cc,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Be?"opacity-60":""} ${Qe?"bg-[#38bdac]/10":""}`,children:[r.jsx(Ne,{className:"text-gray-300",children:Oe+1}),r.jsx(Ne,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[G.avatar?r.jsx("img",{src:G.avatar,className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):r.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:((Kt=G.name)==null?void 0:Kt[0])||"创"}),r.jsx("div",{className:"min-w-0",children:r.jsx("div",{className:"text-white text-sm truncate",children:G.name})})]})}),r.jsx(Ne,{className:"text-gray-300 whitespace-nowrap",children:G.vipRole||r.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),r.jsx(Ne,{className:"text-gray-300",children:G.vipSort??Oe+1}),r.jsx(Ne,{className:"text-right text-xs text-gray-300",children:r.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[r.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>Da(G),title:"设置超级个体标签",children:r.jsx(sd,{className:"w-3.5 h-3.5"})}),r.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{ue(G.id),H(!0)},title:"编辑资料",children:r.jsx(Vt,{className:"w-3.5 h-3.5"})}),r.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Ui(G),title:"设置排序序号",children:r.jsx(Bm,{className:"w-3.5 h-3.5"})})]})})]},G.id)})})]})})})]})]}),r.jsx(Mt,{open:Wi,onOpenChange:G=>{Zr(G),G||un(null)},children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[r.jsx(At,{children:r.jsxs(It,{className:"text-white flex items-center gap-2",children:[r.jsx(Bm,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",bt==null?void 0:bt.name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx(ee,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),r.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:La,onChange:G=>_a(G.target.value)})]}),r.jsxs(Zt,{children:[r.jsxs(Z,{variant:"outline",onClick:()=>Zr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(is,{className:"w-4 h-4 mr-2"}),"取消"]}),r.jsxs(Z,{onClick:ta,disabled:Go,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),Go?"保存中...":"保存"]})]})]})}),r.jsx(Mt,{open:Pa,onOpenChange:G=>{qs(G),G||cr(null)},children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[r.jsx(At,{children:r.jsxs(It,{className:"text-white flex items-center gap-2",children:[r.jsx(zl,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ir==null?void 0:Ir.name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx(ee,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Oa.map(G=>r.jsx(Z,{variant:Rr===G?"default":"outline",size:"sm",className:Rr===G?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>dr(G),children:G},G))}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-400 text-xs",children:"或手动输入"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Rr,onChange:G=>dr(G.target.value)})]})]}),r.jsxs(Zt,{children:[r.jsxs(Z,{variant:"outline",onClick:()=>qs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(is,{className:"w-4 h-4 mr-2"}),"取消"]}),r.jsxs(Z,{onClick:()=>ur(Rr),disabled:qo,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),qo?"保存中...":"保存"]})]})]})}),r.jsx(Mt,{open:se,onOpenChange:ne,children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[r.jsx(At,{children:r.jsxs(It,{className:"text-white flex items-center gap-2",children:[pe?r.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}):r.jsx(Qg,{className:"w-5 h-5 text-[#38bdac]"}),pe?"编辑用户":"添加用户"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"手机号"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ce.phone,onChange:G=>be({...ce,phone:G.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"昵称"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ce.nickname,onChange:G=>be({...ce,nickname:G.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:pe?"新密码 (留空则不修改)":"密码"}),r.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:pe?"留空则不修改":"请输入密码",value:ce.password,onChange:G=>be({...ce,password:G.target.value})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ee,{className:"text-gray-300",children:"管理员权限"}),r.jsx(St,{checked:ce.isAdmin,onCheckedChange:G=>be({...ce,isAdmin:G})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ee,{className:"text-gray-300",children:"已购全书"}),r.jsx(St,{checked:ce.hasFullBook,onCheckedChange:G=>be({...ce,hasFullBook:G})})]})]}),r.jsxs(Zt,{children:[r.jsxs(Z,{variant:"outline",onClick:()=>ne(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(is,{className:"w-4 h-4 mr-2"}),"取消"]}),r.jsxs(Z,{onClick:me,disabled:z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),z?"保存中...":"保存"]})]})]})}),r.jsx(Mt,{open:dn,onOpenChange:gt,children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[r.jsx(At,{children:r.jsxs(It,{className:"text-white flex items-center gap-2",children:[r.jsx(Vt,{className:"w-5 h-5 text-[#38bdac]"}),sn?"编辑规则":"添加规则"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"规则标题 *"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pt.title,onChange:G=>Qt({...Pt,title:G.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"规则描述"}),r.jsx(sc,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pt.description,onChange:G=>Qt({...Pt,description:G.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"触发条件"}),r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pt.trigger,onChange:G=>Qt({...Pt,trigger:G.target.value})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:r.jsx(ee,{className:"text-gray-300",children:"启用状态"})}),r.jsx(St,{checked:Pt.enabled,onCheckedChange:G=>Qt({...Pt,enabled:G})})]})]}),r.jsxs(Zt,{children:[r.jsxs(Z,{variant:"outline",onClick:()=>gt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(is,{className:"w-4 h-4 mr-2"}),"取消"]}),r.jsxs(Z,{onClick:Zn,disabled:z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),z?"保存中...":"保存"]})]})]})}),r.jsx(Mt,{open:U,onOpenChange:I,children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[r.jsx(At,{children:r.jsxs(It,{className:"text-white flex items-center gap-2",children:[r.jsx(Rn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",oe==null?void 0:oe.nickname]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[r.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((na=q.stats)==null?void 0:na.total)||0}),r.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),r.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-green-400",children:(($a=q.stats)==null?void 0:$a.purchased)||0}),r.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),r.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((sa=q.stats)==null?void 0:sa.earnings)||0).toFixed(2)]}),r.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),r.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Fa=q.stats)==null?void 0:Fa.pendingEarnings)||0).toFixed(2)]}),r.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),L?r.jsxs("div",{className:"flex items-center justify-center py-8",children:[r.jsx(We,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),r.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Ki=q.referrals)==null?void 0:Ki.length)??0)>0?r.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(q.referrals??[]).map((G,Oe)=>{var Qe;const Be=G;return r.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((Qe=Be.nickname)==null?void 0:Qe.charAt(0))||"?"}),r.jsxs("div",{children:[r.jsx("div",{className:"text-white text-sm",children:Be.nickname}),r.jsx("div",{className:"text-xs text-gray-500",children:Be.phone||(Be.hasOpenId?"微信用户":"未绑定")})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[Be.status==="vip"&&r.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Be.status==="paid"&&r.jsxs(Ue,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Be.purchasedSections,"章"]}),Be.status==="free"&&r.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),r.jsx("span",{className:"text-xs text-gray-500",children:Be.createdAt?new Date(Be.createdAt).toLocaleDateString():""})]})]},Be.id||Oe)})}):r.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),r.jsx(Zt,{children:r.jsx(Z,{variant:"outline",onClick:()=>I(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),r.jsx(x0,{open:X,onClose:()=>H(!1),userId:re,onUserUpdated:Lt})]})}function Ph(t,[e,n]){return Math.min(n,Math.max(e,t))}var Rk=["PageUp","PageDown"],Pk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ok={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},rc="Slider",[nx,mP,gP]=f0(rc),[Dk]=_i(rc,[gP]),[xP,$f]=Dk(rc),Lk=b.forwardRef((t,e)=>{const{name:n,min:s=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[s],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:N,...w}=t,v=b.useRef(new Set),k=b.useRef(0),E=o==="horizontal"?yP:bP,[M=[],P]=Ro({prop:f,defaultProp:h,onChange:se=>{var pe;(pe=[...v.current][k.current])==null||pe.focus(),m(se)}}),$=b.useRef(M);function D(se){const ne=kP(M,se);_(se,ne)}function R(se){_(se,k.current)}function O(){const se=$.current[k.current];M[k.current]!==se&&g(M)}function _(se,ne,{commit:pe}={commit:!1}){const ge=TP(i),z=MP(Math.round((se-s)/i)*i+s,ge),K=Ph(z,[s,a]);P((U=[])=>{const I=wP(U,K,ne);if(EP(I,u*i)){k.current=I.indexOf(K);const q=String(I)!==String(U);return q&&pe&&g(I),q?I:U}else return U})}return r.jsx(xP,{scope:t.__scopeSlider,name:n,disabled:c,min:s,max:a,valueIndexToChangeRef:k,thumbs:v.current,values:M,orientation:o,form:N,children:r.jsx(nx.Provider,{scope:t.__scopeSlider,children:r.jsx(nx.Slot,{scope:t.__scopeSlider,children:r.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:ot(w.onPointerDown,()=>{c||($.current=M)}),min:s,max:a,inverted:y,onSlideStart:c?void 0:D,onSlideMove:c?void 0:R,onSlideEnd:c?void 0:O,onHomeKeyDown:()=>!c&&_(s,0,{commit:!0}),onEndKeyDown:()=>!c&&_(a,M.length-1,{commit:!0}),onStepKeyDown:({event:se,direction:ne})=>{if(!c){const z=Rk.includes(se.key)||se.shiftKey&&Pk.includes(se.key)?10:1,K=k.current,U=M[K],I=i*z*ne;_(U+I,K,{commit:!0})}}})})})})});Lk.displayName=rc;var[_k,zk]=Dk(rc,{startEdge:"left",endEdge:"right",size:"width",direction:1}),yP=b.forwardRef((t,e)=>{const{min:n,max:s,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=Et(e,E=>g(E)),N=b.useRef(void 0),w=Lf(a),v=w==="ltr",k=v&&!i||!v&&i;function C(E){const M=N.current||m.getBoundingClientRect(),P=[0,M.width],D=b0(P,k?[n,s]:[s,n]);return N.current=M,D(E-M.left)}return r.jsx(_k,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:r.jsx($k,{dir:w,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const M=C(E.clientX);o==null||o(M)},onSlideMove:E=>{const M=C(E.clientX);c==null||c(M)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:E=>{const P=Ok[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:P?-1:1})}})})}),bP=b.forwardRef((t,e)=>{const{min:n,max:s,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=Et(e,f),g=b.useRef(void 0),y=!a;function N(w){const v=g.current||f.current.getBoundingClientRect(),k=[0,v.height],E=b0(k,y?[s,n]:[n,s]);return g.current=v,E(w-v.top)}return r.jsx(_k,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:r.jsx($k,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const v=N(w.clientY);i==null||i(v)},onSlideMove:w=>{const v=N(w.clientY);o==null||o(v)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const k=Ok[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),$k=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=$f(rc,n);return r.jsx(ht.span,{...h,ref:e,onKeyDown:ot(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):Rk.concat(Pk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:ot(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():s(m)}),onPointerMove:ot(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:ot(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),Fk="SliderTrack",Bk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=$f(Fk,n);return r.jsx(ht.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:e})});Bk.displayName=Fk;var sx="SliderRange",Vk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=$f(sx,n),i=zk(sx,n),o=b.useRef(null),c=Et(e,o),u=a.values.length,h=a.values.map(g=>Uk(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return r.jsx(ht.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});Vk.displayName=sx;var rx="SliderThumb",Hk=b.forwardRef((t,e)=>{const n=mP(t.__scopeSlider),[s,a]=b.useState(null),i=Et(e,c=>a(c)),o=b.useMemo(()=>s?n().findIndex(c=>c.ref.current===s):-1,[n,s]);return r.jsx(vP,{...t,ref:i,index:o})}),vP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:s,name:a,...i}=t,o=$f(rx,n),c=zk(rx,n),[u,h]=b.useState(null),f=Et(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=g0(u),y=o.values[s],N=y===void 0?0:Uk(y,o.min,o.max),w=jP(s,o.values.length),v=g==null?void 0:g[c.size],k=v?SP(v,N,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${N}% + ${k}px)`},children:[r.jsx(nx.ItemSlot,{scope:t.__scopeSlider,children:r.jsx(ht.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:ot(t.onFocus,()=>{o.valueIndexToChangeRef.current=s})})}),m&&r.jsx(Wk,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},s)]})});Hk.displayName=rx;var NP="RadioBubbleInput",Wk=b.forwardRef(({__scopeSlider:t,value:e,...n},s)=>{const a=b.useRef(null),i=Et(a,s),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]),r.jsx(ht.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});Wk.displayName=NP;function wP(t=[],e,n){const s=[...t];return s[n]=e,s.sort((a,i)=>a-i)}function Uk(t,e,n){const i=100/(n-e)*(t-e);return Ph(i,[0,100])}function jP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function kP(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),s=Math.min(...n);return n.indexOf(s)}function SP(t,e,n){const s=t/2,i=b0([0,50],[0,s]);return(s-i(e)*n)*n}function CP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function EP(t,e){if(e>0){const n=CP(t);return Math.min(...n)>=e}return!0}function b0(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function TP(t){return(String(t).split(".")[1]||"").length}function MP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var AP=Lk,IP=Bk,RP=Vk,PP=Hk;function OP({className:t,defaultValue:e,value:n,min:s=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[s,a],[n,e,s,a]);return r.jsxs(AP,{defaultValue:e,value:n,min:s,max:a,className:Tt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[r.jsx(IP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:r.jsx(RP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>r.jsx(PP,{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 DP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function Kk(t){const[e,n]=b.useState(DP),[s,a]=b.useState(!0),[i,o]=b.useState(!1);b.useEffect(()=>{Re("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>a(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await yt("/api/admin/referral-settings",h);if(!f||f.success===!1){ae.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}ae.success(`✅ 分销配置已保存成功!
-
-• 小程序与网站的推广规则会一起生效
-• 绑定关系会使用新的天数配置
-• 佣金比例会立即应用到新订单
-
-如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),ae.error("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return s?r.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):r.jsxs("div",{className:"p-8 w-full",children:[r.jsxs("div",{className:"flex justify-between items-center mb-8",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[r.jsx(Hl,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),r.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),r.jsxs(Z,{onClick:c,disabled:i||s,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(vn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[r.jsxs(Je,{children:[r.jsxs(Ye,{className:"flex items-center gap-2 text-white",children:[r.jsx(fA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),r.jsx(Dt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),r.jsx(Ee,{className:"space-y-6",children:r.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[r.jsx(Hu,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),r.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),r.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[r.jsx(Rn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(OP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),r.jsx(ie,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),r.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",r.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[r.jsx(Hu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),r.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),r.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[r.jsx(Hu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),r.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),r.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[r.jsx(Rn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),r.jsx(ie,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),r.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[r.jsxs(Je,{children:[r.jsxs(Ye,{className:"flex items-center gap-2 text-white",children:[r.jsx(Hl,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),r.jsx(Dt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),r.jsx(Ee,{className:"space-y-6",children:r.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ee,{className:"text-gray-300",children:"最低提现金额(元)"}),r.jsx(ie,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),r.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",r.jsx(Ue,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[r.jsx(St,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),r.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[r.jsx(Je,{children:r.jsxs(Ye,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[r.jsx(Hu,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),r.jsxs(Ee,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[r.jsxs("p",{children:["1. 以上配置会写入"," ",r.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),r.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),r.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function LP(){var Wn;const[t,e]=b.useState("overview"),[n,s]=b.useState([]),[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[N,w]=b.useState(null),[v,k]=b.useState(""),[C,E]=b.useState("all"),[M,P]=b.useState(1),[$,D]=b.useState(10),[R,O]=b.useState(0),[_,se]=b.useState(new Set),[ne,pe]=b.useState(null),[ge,z]=b.useState(""),[K,U]=b.useState(!1),[I,q]=b.useState(null),[F,L]=b.useState(""),[W,oe]=b.useState(!1),[Q,X]=b.useState([]),[H,re]=b.useState(1),[ue,ce]=b.useState(0),[be,Pe]=b.useState("");b.useEffect(()=>{Le()},[]),b.useEffect(()=>{P(1)},[t,C]),b.useEffect(()=>{lt(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&<(t,!0),t==="giftPay"&<("giftPay",!0)},[M,$,C,v,H,be]);async function Le(){w(null);try{const J=await Re("/api/admin/distribution/overview");J!=null&&J.success&&J.overview&&i(J.overview)}catch(J){console.error("[Admin] 概览接口异常:",J),w("加载概览失败")}try{const J=await Re("/api/db/users");m((J==null?void 0:J.users)||[])}catch(J){console.error("[Admin] 用户数据加载失败:",J)}}async function lt(J,Ke=!1){var Ge;if(!(!Ke&&_.has(J))){y(!0);try{const mt=f;switch(J){case"overview":break;case"orders":{try{const ct=new URLSearchParams({page:String(M),pageSize:String($),...C!=="all"&&{status:C},...v&&{search:v}}),st=await Re(`/api/admin/orders?${ct}`);if(st!=null&&st.success&&st.orders){const pt=st.orders.map(Lt=>{const yn=mt.find(js=>js.id===Lt.userId),gs=Lt.referrerId?mt.find(js=>js.id===Lt.referrerId):null;return{...Lt,amount:parseFloat(String(Lt.amount))||0,userNickname:(yn==null?void 0:yn.nickname)||Lt.userNickname||"未知用户",userPhone:(yn==null?void 0:yn.phone)||Lt.userPhone||"-",referrerNickname:(gs==null?void 0:gs.nickname)||null,referrerCode:(gs==null?void 0:gs.referralCode)??null,type:Lt.productType||Lt.type}});s(pt),O(st.total??pt.length)}else s([]),O(0)}catch(ct){console.error(ct),w("加载订单失败"),s([])}break}case"bindings":{try{const ct=new URLSearchParams({page:String(M),pageSize:String($),...C!=="all"&&{status:C}}),st=await Re(`/api/db/distribution?${ct}`);c((st==null?void 0:st.bindings)||[]),O((st==null?void 0:st.total)??((Ge=st==null?void 0:st.bindings)==null?void 0:Ge.length)??0)}catch(ct){console.error(ct),w("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const ct=C==="completed"?"success":C==="rejected"?"failed":C,st=new URLSearchParams({...ct&&ct!=="all"&&{status:ct},page:String(M),pageSize:String($)}),pt=await Re(`/api/admin/withdrawals?${st}`);if(pt!=null&&pt.success&&pt.withdrawals){const Lt=pt.withdrawals.map(yn=>({...yn,account:yn.account??"未绑定微信号",status:yn.status==="success"?"completed":yn.status==="failed"?"rejected":yn.status}));h(Lt),O((pt==null?void 0:pt.total)??Lt.length)}else pt!=null&&pt.success||w(`获取提现记录失败: ${(pt==null?void 0:pt.error)||"未知错误"}`),h([])}catch(ct){console.error(ct),w("加载提现数据失败"),h([])}break}case"giftPay":{try{const ct=new URLSearchParams({page:String(H),pageSize:"20",...be&&{status:be}}),st=await Re(`/api/admin/gift-pay-requests?${ct}`);st!=null&&st.success&&st.data?(X(st.data),ce(st.total??st.data.length)):(X([]),ce(0))}catch(ct){console.error(ct),w("加载代付请求失败"),X([])}break}}se(ct=>new Set(ct).add(J))}catch(mt){console.error(mt)}finally{y(!1)}}}async function Rt(){w(null),se(J=>{const Ke=new Set(J);return Ke.delete(t),Ke}),t==="overview"&&Le(),await lt(t,!0)}async function dn(J){if(confirm("确认审核通过并打款?"))try{const Ke=await _t("/api/admin/withdrawals",{id:J,action:"approve"});if(!(Ke!=null&&Ke.success)){const Ge=(Ke==null?void 0:Ke.message)||(Ke==null?void 0:Ke.error)||"操作失败";ae.error(Ge);return}await Rt()}catch(Ke){console.error(Ke),ae.error("操作失败")}}function gt(J){q(J),L("")}async function sn(){const J=I;if(!J)return;const Ke=F.trim();if(!Ke){ae.error("请填写拒绝原因");return}oe(!0);try{const Ge=await _t("/api/admin/withdrawals",{id:J,action:"reject",errorMessage:Ke});if(!(Ge!=null&&Ge.success)){ae.error((Ge==null?void 0:Ge.error)||"操作失败");return}ae.success("已拒绝该提现申请"),q(null),L(""),await Rt()}catch(Ge){console.error(Ge),ae.error("操作失败")}finally{oe(!1)}}function Pn(){I&&ae.info("已取消操作"),q(null),L("")}async function Pt(){var J;if(!(!(ne!=null&&ne.orderSn)&&!(ne!=null&&ne.id))){U(!0),w(null);try{const Ke=await _t("/api/admin/orders/refund",{orderSn:ne.orderSn||ne.id,reason:ge||void 0});Ke!=null&&Ke.success?(pe(null),z(""),await lt("orders",!0)):w((Ke==null?void 0:Ke.error)||"退款失败")}catch(Ke){const Ge=Ke;w(((J=Ge==null?void 0:Ge.data)==null?void 0:J.error)||"退款失败,请检查网络后重试")}finally{U(!1)}}}function Qt(J){const Ke={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"},Ge={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return r.jsx(Ue,{className:`${Ke[J]||"bg-gray-500/20 text-gray-400"} border-0`,children:Ge[J]||J})}const rn=Math.ceil(R/$)||1,On=n,ms=o.filter(J=>{var Ge,mt,ct,st;if(!v)return!0;const Ke=v.toLowerCase();return((Ge=J.refereeNickname)==null?void 0:Ge.toLowerCase().includes(Ke))||((mt=J.refereePhone)==null?void 0:mt.includes(Ke))||((ct=J.referrerName)==null?void 0:ct.toLowerCase().includes(Ke))||((st=J.referrerCode)==null?void 0:st.toLowerCase().includes(Ke))}),Dn=u.filter(J=>{var Ge;if(!v)return!0;const Ke=v.toLowerCase();return((Ge=J.userName)==null?void 0:Ge.toLowerCase().includes(Ke))||J.account&&J.account.toLowerCase().includes(Ke)});return r.jsxs("div",{className:"p-8 w-full",children:[N&&r.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:[r.jsx("span",{children:N}),r.jsx("button",{type:"button",onClick:()=>w(null),className:"hover:text-red-300",children:"×"})]}),r.jsxs("div",{className:"flex items-center justify-between mb-8",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),r.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),r.jsxs(Z,{onClick:Rt,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[r.jsx(We,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),r.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:rd},{key:"orders",label:"订单管理",icon:Th},{key:"bindings",label:"绑定管理",icon:kr},{key:"withdrawals",label:"提现审核",icon:Hl},{key:"giftPay",label:"代付请求",icon:oj},{key:"settings",label:"推广设置",icon:ko}].map(J=>r.jsxs("button",{type:"button",onClick:()=>{e(J.key),E("all"),k(""),J.key==="giftPay"&&(Pe(""),re(1))},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===J.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[r.jsx(J.icon,{className:"w-4 h-4"}),J.label]},J.key))}),g?r.jsxs("div",{className:"flex items-center justify-center py-20",children:[r.jsx(We,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),r.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):r.jsxs(r.Fragment,{children:[t==="overview"&&a&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),r.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayClicks}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),r.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:r.jsx(Ug,{className:"w-6 h-6 text-blue-400"})})]})})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),r.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayUniqueVisitors??0}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),r.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:r.jsx(Rn,{className:"w-6 h-6 text-cyan-400"})})]})})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),r.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(a.todayClickRate??0).toFixed(2)}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),r.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:r.jsx(rd,{className:"w-6 h-6 text-amber-400"})})]})})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),r.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayBindings})]}),r.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:r.jsx(kr,{className:"w-6 h-6 text-green-400"})})]})})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),r.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayConversions})]}),r.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:r.jsx(Gv,{className:"w-6 h-6 text-purple-400"})})]})})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),r.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",a.todayEarnings.toFixed(2)]})]}),r.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:r.jsx(Th,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Wn=a.todayClicksByPage)==null?void 0:Wn.length)??0)>0&&r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[r.jsxs(Je,{children:[r.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[r.jsx(Ug,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),r.jsx(Ee,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[r.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),r.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),r.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),r.jsx("tbody",{children:[...a.todayClicksByPage??[]].sort((J,Ke)=>Ke.clicks-J.clicks).map((J,Ke)=>r.jsxs("tr",{className:"border-b border-gray-700/50",children:[r.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:J.page||"(未区分)"}),r.jsx("td",{className:"py-2 pr-4 text-right text-white",children:J.clicks}),r.jsxs("td",{className:"py-2 text-right text-gray-400",children:[a.todayClicks>0?(J.clicks/a.todayClicks*100).toFixed(1):0,"%"]})]},Ke))})]})})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Ce,{className:"bg-orange-500/10 border-orange-500/30",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:r.jsx(Wg,{className:"w-6 h-6 text-orange-400"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),r.jsxs("p",{className:"text-2xl font-bold text-white",children:[a.expiringBindings," 个"]}),r.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),r.jsx(Ce,{className:"bg-blue-500/10 border-blue-500/30",children:r.jsx(Ee,{className:"p-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:r.jsx(Hl,{className:"w-6 h-6 text-blue-400"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),r.jsxs("p",{className:"text-2xl font-bold text-white",children:[a.pendingWithdrawals," 笔"]}),r.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",a.pendingWithdrawAmount.toFixed(2)]})]}),r.jsx(Z,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[r.jsx(Je,{children:r.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[r.jsx(Eh,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),r.jsx(Ee,{children:r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),r.jsx("p",{className:"text-xl font-bold text-white",children:a.monthClicks})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),r.jsx("p",{className:"text-xl font-bold text-white",children:a.monthBindings})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),r.jsx("p",{className:"text-xl font-bold text-white",children:a.monthConversions})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),r.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",a.monthEarnings.toFixed(2)]})]})]})})]}),r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[r.jsx(Je,{children:r.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[r.jsx(rd,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),r.jsxs(Ee,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),r.jsx("p",{className:"text-xl font-bold text-white",children:a.totalClicks.toLocaleString()})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),r.jsx("p",{className:"text-xl font-bold text-white",children:a.totalBindings.toLocaleString()})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),r.jsx("p",{className:"text-xl font-bold text-white",children:a.totalConversions})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),r.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",a.totalEarnings.toFixed(2)]})]})]}),r.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[r.jsx("span",{className:"text-gray-300",children:"点击转化率"}),r.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[a.conversionRate,"%"]})]})]})]})]}),r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[r.jsx(Je,{children:r.jsxs(Ye,{className:"text-white flex items-center gap-2",children:[r.jsx(Rn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),r.jsx(Ee,{children:r.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[r.jsx("p",{className:"text-3xl font-bold text-white",children:a.totalDistributors}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[r.jsx("p",{className:"text-3xl font-bold text-green-400",children:a.activeDistributors}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[r.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),r.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[r.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),r.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),r.jsx(ie,{value:v,onChange:J=>k(J.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),r.jsxs("select",{value:C,onChange:J=>E(J.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[r.jsx("option",{value:"all",children:"全部状态"}),r.jsx("option",{value:"completed",children:"已完成"}),r.jsx("option",{value:"pending",children:"待支付"}),r.jsx("option",{value:"failed",children:"已失败"}),r.jsx("option",{value:"refunded",children:"已退款"})]})]}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsxs(Ee,{className:"p-0",children:[n.length===0?r.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[r.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-700/50",children:On.map(J=>{var Ke,Ge;return r.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[r.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Ke=J.id)==null?void 0:Ke.slice(0,12),"..."]}),r.jsx("td",{className:"p-4",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-white text-sm",children:J.userNickname}),r.jsx("p",{className:"text-gray-500 text-xs",children:J.userPhone})]})}),r.jsx("td",{className:"p-4",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-white text-sm",children:(()=>{const mt=J.productType||J.type,ct=J.description||"",st=String(J.productId||J.sectionId||""),pt=mt==="vip"||ct.includes("VIP")||ct.toLowerCase().includes("vip")||st.toLowerCase().includes("vip");return mt==="balance_recharge"?`余额充值 ¥${typeof J.amount=="number"?J.amount.toFixed(2):parseFloat(String(J.amount||"0")).toFixed(2)}`:pt?"超级个体开通费用":mt==="fullbook"?`${J.bookName||"《底层逻辑》"} - 全本`:mt==="match"?"匹配次数购买":`${J.bookName||"《底层逻辑》"} - ${J.sectionTitle||J.chapterTitle||`章节${J.productId||J.sectionId||""}`}`})()}),r.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const mt=J.productType||J.type,ct=J.description||"",st=String(J.productId||J.sectionId||""),pt=mt==="vip"||ct.includes("VIP")||ct.toLowerCase().includes("vip")||st.toLowerCase().includes("vip");return mt==="balance_recharge"?"余额充值":pt?"超级个体":mt==="fullbook"?"全书解锁":mt==="match"?"功能权益":J.chapterTitle||"单章购买"})()})]})}),r.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof J.amount=="number"?J.amount.toFixed(2):parseFloat(String(J.amount||"0")).toFixed(2)]}),r.jsx("td",{className:"p-4 text-gray-300",children:J.paymentMethod==="wechat"?"微信支付":J.paymentMethod==="balance"?"余额支付":J.paymentMethod==="alipay"?"支付宝":J.paymentMethod||"微信支付"}),r.jsx("td",{className:"p-4",children:J.status==="refunded"?r.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):J.status==="completed"||J.status==="paid"?r.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):J.status==="pending"||J.status==="created"?r.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):r.jsx(Ue,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),r.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:J.refundReason,children:J.status==="refunded"&&J.refundReason?J.refundReason:"-"}),r.jsx("td",{className:"p-4 text-gray-300 text-sm",children:J.referrerId||J.referralCode?r.jsxs("span",{title:J.referralCode||J.referrerCode||J.referrerId||"",children:[J.referrerNickname||J.referralCode||J.referrerCode||((Ge=J.referrerId)==null?void 0:Ge.slice(0,8)),(J.referralCode||J.referrerCode)&&` (${J.referralCode||J.referrerCode})`]}):"-"}),r.jsx("td",{className:"p-4 text-[#FFD700]",children:J.referrerEarnings?`¥${(typeof J.referrerEarnings=="number"?J.referrerEarnings:parseFloat(String(J.referrerEarnings))).toFixed(2)}`:"-"}),r.jsx("td",{className:"p-4 text-gray-400 text-sm",children:J.createdAt?new Date(J.createdAt).toLocaleString("zh-CN"):"-"}),r.jsx("td",{className:"p-4",children:(J.status==="paid"||J.status==="completed")&&r.jsxs(Z,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{pe(J),z("")},children:[r.jsx(uj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},J.id)})})]})}),t==="orders"&&r.jsx(Vs,{page:M,totalPages:rn,total:R,pageSize:$,onPageChange:P,onPageSizeChange:J=>{D(J),P(1)}})]})})]}),t==="bindings"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),r.jsx(ie,{value:v,onChange:J=>k(J.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),r.jsxs("select",{value:C,onChange:J=>E(J.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[r.jsx("option",{value:"all",children:"全部状态"}),r.jsx("option",{value:"active",children:"有效"}),r.jsx("option",{value:"converted",children:"已转化"}),r.jsx("option",{value:"expired",children:"已过期"})]})]}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsxs(Ee,{className:"p-0",children:[ms.length===0?r.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[r.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ms.map(J=>r.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[r.jsx("td",{className:"p-4",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-white font-medium",children:J.refereeNickname||"匿名用户"}),r.jsx("p",{className:"text-gray-500 text-xs",children:J.refereePhone})]})}),r.jsx("td",{className:"p-4",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-white",children:J.referrerName||"-"}),r.jsx("p",{className:"text-gray-500 text-xs font-mono",children:J.referrerCode})]})}),r.jsx("td",{className:"p-4 text-gray-400",children:J.boundAt?new Date(J.boundAt).toLocaleDateString("zh-CN"):"-"}),r.jsx("td",{className:"p-4 text-gray-400",children:J.expiresAt?new Date(J.expiresAt).toLocaleDateString("zh-CN"):"-"}),r.jsx("td",{className:"p-4",children:Qt(J.status)}),r.jsx("td",{className:"p-4",children:J.commission?r.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",J.commission.toFixed(2)]}):r.jsx("span",{className:"text-gray-500",children:"-"})})]},J.id))})]})}),t==="bindings"&&r.jsx(Vs,{page:M,totalPages:rn,total:R,pageSize:$,onPageChange:P,onPageSizeChange:J=>{D(J),P(1)}})]})})]}),t==="withdrawals"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ka,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),r.jsx(ie,{value:v,onChange:J=>k(J.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),r.jsxs("select",{value:C,onChange:J=>E(J.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[r.jsx("option",{value:"all",children:"全部状态"}),r.jsx("option",{value:"pending",children:"待审核"}),r.jsx("option",{value:"completed",children:"已完成"}),r.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsxs(Ee,{className:"p-0",children:[Dn.length===0?r.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[r.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),r.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Dn.map(J=>r.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[r.jsx("td",{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-2",children:[J.userAvatar?r.jsx("img",{src:J.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):r.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(J.userName||J.name||"?").slice(0,1)}),r.jsx("p",{className:"text-white font-medium",children:J.userName||J.name})]})}),r.jsx("td",{className:"p-4",children:r.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",J.amount.toFixed(2)]})}),r.jsx("td",{className:"p-4",children:r.jsx(Ue,{className:J.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:J.method==="wechat"?"微信":"支付宝"})}),r.jsx("td",{className:"p-4",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-white font-mono text-xs",children:J.account}),r.jsx("p",{className:"text-gray-500 text-xs",children:J.name})]})}),r.jsx("td",{className:"p-4 text-gray-400",children:J.createdAt?new Date(J.createdAt).toLocaleString("zh-CN"):"-"}),r.jsx("td",{className:"p-4",children:Qt(J.status)}),r.jsx("td",{className:"p-4 text-right",children:J.status==="pending"&&r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsxs(Z,{size:"sm",onClick:()=>dn(J.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[r.jsx(Gv,{className:"w-4 h-4 mr-1"}),"通过"]}),r.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>gt(J.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[r.jsx(rj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},J.id))})]})}),t==="withdrawals"&&r.jsx(Vs,{page:M,totalPages:rn,total:R,pageSize:$,onPageChange:P,onPageSizeChange:J=>{D(J),P(1)}})]})})]}),t==="giftPay"&&r.jsx("div",{className:"space-y-4",children:r.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[r.jsx(Je,{children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsx(Ye,{className:"text-white",children:"代付请求列表"}),r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:be,onChange:J=>{Pe(J.target.value),re(1)},children:[r.jsx("option",{value:"",children:"全部状态"}),r.jsx("option",{value:"pending",children:"待支付(旧)"}),r.jsx("option",{value:"pending_pay",children:"待发起人支付"}),r.jsx("option",{value:"paid",children:"已支付"}),r.jsx("option",{value:"refunded",children:"已退款"}),r.jsx("option",{value:"cancelled",children:"已取消"}),r.jsx("option",{value:"expired",children:"已过期"})]}),r.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>lt("giftPay",!0),className:"border-gray-600 text-gray-300",children:[r.jsx(We,{className:"w-4 h-4 mr-1"}),"刷新"]})]})]})}),r.jsxs(Ee,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-gray-700/50",children:[r.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"请求号"}),r.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"发起人"}),r.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"商品/金额"}),r.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"份数/已领"}),r.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"付款人"}),r.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"状态"}),r.jsx("th",{className:"p-4 text-left font-medium text-gray-400",children:"创建时间"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Q.map(J=>r.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[r.jsx("td",{className:"p-4 font-mono text-xs text-gray-400",children:J.requestSn}),r.jsx("td",{className:"p-4",children:r.jsx("p",{className:"text-white text-sm",children:J.initiatorNick||J.initiatorUserId})}),r.jsxs("td",{className:"p-4",children:[r.jsxs("p",{className:"text-white",children:[J.productType," · ¥",J.amount.toFixed(2)]}),J.description&&r.jsx("p",{className:"text-gray-500 text-xs",children:J.description})]}),r.jsx("td",{className:"p-4 text-gray-400",children:(J.quantity??1)>1?`${J.quantity}份 / 已领${J.redeemedCount??0}`:"-"}),r.jsx("td",{className:"p-4 text-gray-400",children:J.payerNick||(J.payerUserId?J.payerUserId:"-")}),r.jsx("td",{className:"p-4",children:r.jsx(Ue,{className:J.status==="paid"?"bg-green-500/20 text-green-400 border-0":J.status==="pending"||J.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":J.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:J.status==="paid"?"已支付":J.status==="pending"||J.status==="pending_pay"?"待支付":J.status==="refunded"?"已退款":J.status==="cancelled"?"已取消":"已过期"})}),r.jsx("td",{className:"p-4 text-gray-400 text-sm",children:J.createdAt?new Date(J.createdAt).toLocaleString("zh-CN"):"-"})]},J.id))})]})}),Q.length===0&&!g&&r.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),ue>20&&r.jsx("div",{className:"mt-4 flex justify-center",children:r.jsx(Vs,{page:H,totalPages:Math.ceil(ue/20),total:ue,pageSize:20,onPageChange:re,onPageSizeChange:()=>{}})})]})]})})]}),r.jsx(Mt,{open:!!ne,onOpenChange:J=>!J&&pe(null),children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[r.jsx(At,{children:r.jsx(It,{className:"text-white",children:"订单退款"})}),ne&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ne.orderSn||ne.id]}),r.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ne.amount=="number"?ne.amount.toFixed(2):parseFloat(String(ne.amount||"0")).toFixed(2)]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),r.jsx("div",{className:"form-input",children:r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:ge,onChange:J=>z(J.target.value)})})]}),r.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),r.jsxs(Zt,{children:[r.jsx(Z,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>pe(null),disabled:K,children:"取消"}),r.jsx(Z,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Pt,disabled:K,children:K?"退款中...":"确认退款"})]})]})}),r.jsx(Mt,{open:!!I,onOpenChange:J=>!J&&Pn(),children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[r.jsx(At,{children:r.jsx(It,{className:"text-white",children:"拒绝提现"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),r.jsx("div",{className:"form-input",children:r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:F,onChange:J=>L(J.target.value)})})]})]}),r.jsxs(Zt,{children:[r.jsx(Z,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Pn,disabled:W,children:"取消"}),r.jsx(Z,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:sn,disabled:W||!F.trim(),children:W?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&r.jsx("div",{className:"-mx-8 -mt-6",children:r.jsx(Kk,{embedded:!0})})]})}function _P(){const[t,e]=b.useState([]),[n,s]=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),[g,y]=b.useState(10),[N,w]=b.useState(0),[v,k]=b.useState(null),[C,E]=b.useState(null),[M,P]=b.useState(""),[$,D]=b.useState(!1);async function R(){var z,K,U,I,q,F,L;i(!0),c(null);try{const W=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),oe=await Re(`/api/admin/withdrawals?${W}`);if(oe!=null&&oe.success){const Q=oe.withdrawals||[];e(Q),w(oe.total??((z=oe.stats)==null?void 0:z.total)??Q.length),s({total:((K=oe.stats)==null?void 0:K.total)??oe.total??Q.length,pendingCount:((U=oe.stats)==null?void 0:U.pendingCount)??0,pendingAmount:((I=oe.stats)==null?void 0:I.pendingAmount)??0,successCount:((q=oe.stats)==null?void 0:q.successCount)??0,successAmount:((F=oe.stats)==null?void 0:F.successAmount)??0,failedCount:((L=oe.stats)==null?void 0:L.failedCount)??0})}else c("加载提现记录失败")}catch(W){console.error("Load withdrawals error:",W),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{R()},[u,f,g]);const O=Math.ceil(N/g)||1;async function _(z){const K=t.find(U=>U.id===z);if(K!=null&&K.userCommissionInfo&&K.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${K.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。
-
-确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(z);try{const U=await _t("/api/admin/withdrawals",{id:z,action:"approve"});U!=null&&U.success?R():ae.error("操作失败: "+((U==null?void 0:U.error)??""))}catch{ae.error("操作失败")}finally{k(null)}}function se(z){E(z),P("")}async function ne(){const z=C;if(!z)return;const K=M.trim();if(!K){ae.error("请填写拒绝原因");return}D(!0);try{const U=await _t("/api/admin/withdrawals",{id:z,action:"reject",errorMessage:K});U!=null&&U.success?(ae.success("已拒绝该提现申请"),E(null),P(""),R()):ae.error("操作失败: "+((U==null?void 0:U.error)??""))}catch{ae.error("操作失败")}finally{D(!1)}}function pe(){C&&ae.info("已取消操作"),E(null),P("")}function ge(z){switch(z){case"pending":return r.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return r.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return r.jsx(Ue,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return r.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return r.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return r.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:z})}}return r.jsxs("div",{className:"p-8 w-full",children:[o&&r.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:[r.jsx("span",{children:o}),r.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),r.jsxs("div",{className:"flex justify-between items-start mb-8",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),r.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),r.jsxs(Z,{variant:"outline",onClick:R,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[r.jsx(We,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),r.jsx(Ce,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:r.jsx(Ee,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Th,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),r.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[r.jsxs("p",{children:["• ",r.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",r.jsx("span",{className:"text-white font-medium",children:"90%"})]}),r.jsxs("p",{children:["• ",r.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),r.jsxs("p",{children:["• ",r.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),r.jsxs("p",{children:["• ",r.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),r.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsxs(Ee,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),r.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsxs(Ee,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),r.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),r.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsxs(Ee,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),r.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),r.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:r.jsxs(Ee,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),r.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),r.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(z=>r.jsx(Z,{variant:u===z?"default":"outline",size:"sm",onClick:()=>h(z),className:u===z?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:z==="all"?"全部":z==="pending"?"待处理":z==="success"?"已完成":"已拒绝"},z))}),r.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:r.jsx(Ee,{className:"p-0",children:a?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsx(We,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),r.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Hl,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),r.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[r.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),r.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),r.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),r.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(z=>r.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[r.jsx("td",{className:"p-4 text-gray-400",children:new Date(z.createdAt??"").toLocaleString()}),r.jsx("td",{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-2",children:[z.userAvatar?r.jsx("img",{src:z.userAvatar,alt:z.userName??"",className:"w-8 h-8 rounded-full object-cover"}):r.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(z.userName??"?").charAt(0)}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-white",children:z.userName??"未知"}),r.jsx("p",{className:"text-xs text-gray-500",children:z.userPhone??z.referralCode??(z.userId??"").slice(0,10)})]})]})}),r.jsx("td",{className:"p-4",children:r.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(z.amount).toFixed(2)]})}),r.jsx("td",{className:"p-4",children:z.userCommissionInfo?r.jsxs("div",{className:"text-xs space-y-1",children:[r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),r.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",z.userCommissionInfo.totalCommission.toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{className:"text-gray-500",children:"已提现:"}),r.jsxs("span",{className:"text-gray-400",children:["¥",z.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between gap-4",children:[r.jsx("span",{className:"text-gray-500",children:"待审核:"}),r.jsxs("span",{className:"text-orange-400",children:["¥",z.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[r.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),r.jsxs("span",{className:z.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",z.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):r.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),r.jsxs("td",{className:"p-4",children:[ge(z.status),z.errorMessage&&r.jsx("p",{className:"text-xs text-red-400 mt-1",children:z.errorMessage})]}),r.jsx("td",{className:"p-4 text-gray-400",children:z.processedAt?new Date(z.processedAt).toLocaleString():"-"}),r.jsx("td",{className:"p-4 text-gray-400",children:z.userConfirmedAt?r.jsxs("span",{className:"text-green-400",title:z.userConfirmedAt,children:["已确认 ",new Date(z.userConfirmedAt).toLocaleString()]}):"-"}),r.jsxs("td",{className:"p-4 text-right",children:[(z.status==="pending"||z.status==="pending_confirm")&&r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsxs(Z,{size:"sm",onClick:()=>_(z.id),disabled:v===z.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[r.jsx(If,{className:"w-4 h-4 mr-1"}),"批准"]}),r.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>se(z.id),disabled:v===z.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[r.jsx(is,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(z.status==="success"||z.status==="completed")&&z.transactionId&&r.jsx("span",{className:"text-xs text-gray-500 font-mono",children:z.transactionId})]})]},z.id))})]})}),r.jsx(Vs,{page:f,totalPages:O,total:N,pageSize:g,onPageChange:m,onPageSizeChange:z=>{y(z),m(1)}})]})})}),r.jsx(Mt,{open:!!C,onOpenChange:z=>!z&&pe(),children:r.jsxs(kt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[r.jsx(At,{children:r.jsx(It,{className:"text-white",children:"拒绝提现"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),r.jsx("div",{className:"form-input",children:r.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:M,onChange:z=>P(z.target.value)})})]})]}),r.jsxs(Zt,{children:[r.jsx(Z,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:pe,disabled:$,children:"取消"}),r.jsx(Z,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ne,disabled:$||!M.trim(),children:$?"提交中...":"确认拒绝"})]})]})})]})}var tg={exports:{}},ng={};/**
- * @license React
- * use-sync-external-store-shim.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var b1;function zP(){if(b1)return ng;b1=1;var t=Od();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),N=s({inst:{value:y,getSnapshot:g}}),w=N[0].inst,v=N[1];return i(function(){w.value=y,w.getSnapshot=g,u(w)&&v({inst:w})},[m,y,g]),a(function(){return u(w)&&v({inst:w}),m(function(){u(w)&&v({inst:w})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return ng.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,ng}var v1;function qk(){return v1||(v1=1,tg.exports=zP()),tg.exports}var Gk=qk();function Gn(t){this.content=t}Gn.prototype={constructor:Gn,find:function(t){for(var e=0;e>1}};Gn.from=function(t){if(t instanceof Gn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Gn(e)};function Jk(t,e,n){for(let s=0;;s++){if(s==t.childCount||s==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(s),i=e.child(s);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=Jk(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function Yk(t,e,n,s){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:s};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,s-=u;continue}if(!o.sameMarkup(c))return{a:n,b:s};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&s(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),s,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,s,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)&&s&&(o?o=!1:i+=s),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,s=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(s)&&(a[a.length-1]=n.withText(n.text+s.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))),s.push(c),a+=c.nodeSize),o=u}return new ve(s,a)}cutByIndex(e,n){return e==n?ve.empty:e==0&&n==this.content.length?this:new ve(this.content.slice(e,n))}replaceChild(e,n){let s=this.content[e];if(s==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-s.nodeSize;return a[e]=n,new ve(a,i)}addToStart(e){return new ve([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ve(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,s=0;;n++){let a=this.child(n),i=s+a.nodeSize;if(i>=e)return i==e?Zu(n+1,i):Zu(n,s);s=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 ve.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ve(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ve.empty;let n,s=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),s=!0),n&&n.push(i)}}return n||(n=e.slice()),s||n.push(this),n}removeFromSet(e){for(let n=0;ns.type.rank-a.type.rank),n}};$t.none=[];class Dh extends Error{}class Ie{constructor(e,n,s){this.content=e,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let s=Xk(this.content,e+this.openStart,n);return s&&new Ie(s,this.openStart,this.openEnd)}removeBetween(e,n){return new Ie(Qk(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 Ie.empty;let s=n.openStart||0,a=n.openEnd||0;if(typeof s!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ie(ve.fromJSON(e,n.content),s,a)}static maxOpen(e,n=!0){let s=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)s++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Ie(e,s,a)}}Ie.empty=new Ie(ve.empty,0,0);function Qk(t,e,n){let{index:s,offset:a}=t.findIndex(e),i=t.maybeChild(s),{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(s!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(s,i.copy(Qk(i.content,e-a-1,n-a-1)))}function Xk(t,e,n,s){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return s&&!s.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Xk(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function $P(t,e,n){if(n.openStart>t.depth)throw new Dh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Dh("Inconsistent open depths");return Zk(t,e,n,0)}function Zk(t,e,n,s){let a=t.index(s),i=t.node(s);if(a==e.index(s)&&s=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ad(t,e,n,s){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&&(Co(t.nodeAfter,s),i++));for(let c=i;ca&&ix(t,e,a+1),o=s.depth>a&&ix(n,s,a+1),c=[];return ad(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(eS(i,o),Co(Eo(i,tS(t,e,n,s,a+1)),c)):(i&&Co(Eo(i,Lh(t,e,a+1)),c),ad(e,n,a,c),o&&Co(Eo(o,Lh(n,s,a+1)),c)),ad(s,null,a,c),new ve(c)}function Lh(t,e,n){let s=[];if(ad(null,t,n,s),t.depth>n){let a=ix(t,e,n+1);Co(Eo(a,Lh(t,e,n+1)),s)}return ad(e,null,n,s),new ve(s)}function FP(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(ve.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class Nd{constructor(e,n,s){this.pos=e,this.path=n,this.parentOffset=s,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 s=this.pos-this.path[this.path.length-1],a=e.child(n);return s?e.child(n).cut(s):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 s=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;s--)if(e.pos<=this.end(s)&&(!n||n(this.node(s))))return new _h(this,e,s);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 s=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(s.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new Nd(n,s,i)}static resolveCached(e,n){let s=N1.get(e);if(s)for(let i=0;ie&&this.nodesBetween(e,n,i=>(s.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()+")"),nS(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,s=ve.empty,a=0,i=s.childCount){let o=this.contentMatchAt(e).matchFragment(s,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 s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=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,s)}let a=ve.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,s);return i.type.checkAttrs(i.attrs),i}};Sa.prototype.text=void 0;class zh extends Sa{constructor(e,n,s,a){if(super(e,n,null,a),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nS(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 zh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new zh(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 nS(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Oo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let s=new WP(e,n);if(s.next==null)return Oo.empty;let a=sS(s);s.next&&s.err("Unexpected trailing text");let i=QP(YP(a));return XP(i,s),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(s){e.push(s);for(let a=0;a{let i=a+(s.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(s.next[o].next);return i}).join(`
-`)}}Oo.empty=new Oo(!0);class WP{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 sS(t){let e=[];do e.push(UP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function UP(t){let e=[];do e.push(KP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function KP(t){let e=JP(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=qP(t,e);else break;return e}function w1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function qP(t,e){let n=w1(t),s=n;return t.eat(",")&&(t.next!="}"?s=w1(t):s=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:e}}function GP(t,e){let n=t.nodeTypes,s=n[e];if(s)return[s];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 JP(t){if(t.eat("(")){let e=sS(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=GP(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 YP(t){let e=[[]];return a(i(t,0),n()),e;function n(){return e.push([])-1}function s(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 s(c,u),a(i(o.expr,u),u),[s(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[s(u)]}else{if(o.type=="opt")return[s(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[s.join(",")]=new Oo(s.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:iS(this.attrs,e)}create(e=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Sa(this,this.computeAttrs(e),ve.from(n),$t.setFrom(s))}createChecked(e=null,n,s){return n=ve.from(n),this.checkContent(n),new Sa(this,this.computeAttrs(e),n,$t.setFrom(s))}createAndFill(e=null,n,s){if(e=this.computeAttrs(e),n=ve.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(ve.empty,!0);return i?new Sa(this,e,n.append(i),$t.setFrom(s)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let s=0;s-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;ns[i]=new cS(i,n,o));let a=n.spec.topNode||"doc";if(!s[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let i in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function ZP(t,e,n){let s=n.split("|");return a=>{let i=a===null?"null":typeof a;if(s.indexOf(i)<0)throw new RangeError(`Expected value of type ${s} for attribute ${e} on type ${t}, got ${i}`)}}class eO{constructor(e,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?ZP(e,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class Ff{constructor(e,n,s,a){this.name=e,this.rank=n,this.schema=s,this.spec=a,this.attrs=lS(e,a.attrs),this.excluded=null;let i=aS(this.attrs);this.instance=i?new $t(this,i):null}create(e=null){return!e&&this.instance?this.instance:new $t(this,iS(this.attrs,e))}static compile(e,n){let s=Object.create(null),a=0;return e.forEach((i,o)=>s[i]=new Ff(i,a++,n,o)),s}removeFromSet(e){for(var n=0;n-1}}class dS{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=Gn.from(e.nodes),n.marks=Gn.from(e.marks||{}),this.nodes=k1.compile(this.spec.nodes,this),this.marks=Ff.compile(this.spec.marks,this);let s=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=s[o]||(s[o]=Oo.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?S1(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==""?[]:S1(this,o.split(" "))}this.nodeFromJSON=a=>Sa.fromJSON(this,a),this.markFromJSON=a=>$t.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,s,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof k1){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,s,a)}text(e,n){let s=this.nodes.text;return new zh(s,s.defaultAttrs,e,$t.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 S1(t,e){let n=[];for(let s=0;s-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return n}function tO(t){return t.tag!=null}function nO(t){return t.style!=null}class ki{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(tO(a))this.tags.push(a);else if(nO(a)){let i=/[^=]*/.exec(a.style)[0];s.indexOf(i)<0&&s.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 s=new E1(this,n,!1);return s.addAll(e,$t.none,n.from,n.to),s.finish()}parseSlice(e,n={}){let s=new E1(this,n,!0);return s.addAll(e,$t.none,n.from,n.to),Ie.maxOpen(s.finish())}matchTag(e,n,s){for(let a=s?this.tags.indexOf(s)+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 s(a){let i=a.priority==null?50:a.priority,o=0;for(;o{s(o=T1(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=>{s(o=T1(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ki(e,ki.schemaRules(e)))}}const uS={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},sO={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hS={ol:!0,ul:!0},wd=1,lx=2,id=4;function C1(t,e,n){return e!=null?(e?wd:0)|(e==="full"?lx:0):t&&t.whitespace=="pre"?wd|lx:n&~id}class eh{constructor(e,n,s,a,i,o){this.type=e,this.attrs=n,this.marks=s,this.solid=a,this.options=o,this.content=[],this.activeMarks=$t.none,this.match=i||(o&id?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ve.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,a;return(a=s.findWrapping(e.type))?(this.match=s,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wd)){let s=this.content[this.content.length-1],a;if(s&&s.isText&&(a=/[ \t\r\n\u000c]+$/.exec(s.text))){let i=s;s.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=ve.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ve.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&&!uS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class E1{constructor(e,n,s){this.parser=e,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=C1(null,n.preserveWhitespace,0)|(s?id:0);a?i=new eh(a.type,a.attrs,$t.none,!0,n.topMatch||a.type.contentMatch,o):s?i=new eh(null,null,$t.none,!0,null,o):i=new eh(e.schema.topNodeType,null,$t.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 s=e.nodeValue,a=this.top,i=a.options&lx?"full":this.localPreserveWS||(a.options&wd)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(i)if(i==="full")s=s.replace(/\r\n?/g,`
-`);else if(o.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=s.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,s,a){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),s,e.nodeName=="BR")||this.leafFallback(e,s);else{let u=this.enter(o,n.attrs||null,s,n.preserveWhitespace);u&&(i=!0,s=u)}else{let u=this.parser.schema.marks[n.mark];s=s.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(a)this.addElement(e,s,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,s,!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,s),this.findAround(e,u,!1)}i&&this.sync(c)&&this.open--}addAll(e,n,s,a){let i=s||0;for(let o=s?e.childNodes[s]: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,s){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(s)break;c+=2}}if(!a)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):M1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new eh(e,n,u,a,null,c)),this.open++,s}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|=wd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let a=s.length-1;a>=0;a--)e+=s[a].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let s=0;s-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),s=this.options.context,a=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),i=-(s?s.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:s&&u>=i?s.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 s=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}}function rO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&hS.hasOwnProperty(s)&&n?(n.appendChild(e),e=n):s=="li"?n=e:s&&(n=null)}}function aO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function T1(t){let e={};for(let n in t)e[n]=t[n];return e}function M1(t,e){let n=e.schema.nodes;for(let s in n){let a=n[s];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(s),s=i.dom)}return s}serializeMark(e,n,s={}){let a=this.marks[e.type.name];return a&&yh(rg(s),a(e,n),null,e.attrs)}static renderSpec(e,n,s=null,a){return yh(e,n,s,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=A1(e.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(e){return A1(e.marks)}}function A1(t){let e={};for(let n in t){let s=t[n].spec.toDOM;s&&(e[n]=s)}return e}function rg(t){return t.document||window.document}const I1=new WeakMap;function iO(t){let e=I1.get(t);return e===void 0&&I1.set(t,e=oO(t)),e}function oO(t){let e=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")e||(e=[]),e.push(s);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 g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+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}=yh(t,g,n,s);if(u.appendChild(y),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const fS=65535,pS=Math.pow(2,16);function lO(t,e){return t+e*pS}function R1(t){return t&fS}function cO(t){return(t-(t&fS))/pS}const mS=1,gS=2,bh=4,xS=8;class cx{constructor(e,n,s){this.pos=e,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&xS)>0}get deletedBefore(){return(this.delInfo&(mS|bh))>0}get deletedAfter(){return(this.delInfo&(gS|bh))>0}get deletedAcross(){return(this.delInfo&bh)>0}}class Fs{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fs.empty)return Fs.empty}recover(e){let n=0,s=R1(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 g=h?e==u?-1:e==m?1:n:n,y=u+a+(g<0?0:f);if(s)return y;let N=e==(n<0?u:m)?null:lO(c/3,e-u),w=e==u?gS:e==m?mS:bh;return(n<0?e!=u:e!=m)&&(w|=xS),new cx(y,w,N)}a+=f-h}return s?e+a:new cx(e+a,0,null)}touches(e,n){let s=0,a=R1(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;s+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,s=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?s-a-1:void 0)}}invert(){let e=new jd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let s=this.from;si&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return kn.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),s=e.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new bi(n.pos,s.pos,this.mark)}merge(e){return e instanceof bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bi(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 bi(n.from,n.to,e.markFromJSON(n.mark))}}ps.jsonID("addMark",bi);class jr extends ps{constructor(e,n,s){super(),this.from=e,this.to=n,this.mark=s}apply(e){let n=e.slice(this.from,this.to),s=new Ie(v0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return kn.fromReplace(e,this.from,this.to,s)}invert(){return new bi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),s=e.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new jr(n.pos,s.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))}}ps.jsonID("removeMark",jr);class vi extends ps{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kn.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return kn.fromReplace(e,this.pos,this.pos+1,new Ie(ve.from(s),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let a=0;as.pos?null:new Vn(n.pos,s.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 Vn(n.from,n.to,n.gapFrom,n.gapTo,Ie.fromJSON(e,n.slice),n.insert,!!n.structure)}}ps.jsonID("replaceAround",Vn);function dx(t,e,n){let s=t.resolve(e),a=n-e,i=s.depth;for(;a>0&&i>0&&s.indexAfter(i)==s.node(i).childCount;)i--,a--;if(a>0){let o=s.node(i).maybeChild(s.indexAfter(i));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function dO(t,e,n,s){let a=[],i=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!s.isInSet(m)&&f.type.allowsMarkType(s.type)){let g=Math.max(h,e),y=Math.min(h+u.nodeSize,n),N=s.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function uO(t,e,n,s){let a=[],i=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;i++;let u=null;if(s instanceof Ff){let h=o.marks,f;for(;f=s.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else s?s.isInSet(o.marks)&&(u=[s]):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 N0(t,e,n,s=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 hO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ac(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let s=t.depth,a=0,i=0;;--s){let o=t.$from.node(s),c=t.$from.index(s)+a,u=t.$to.indexAfter(s)-i;if(sn;N--)w||s.index(N)>0?(w=!0,f=ve.from(s.node(N).copy(f)),m++):u--;let g=ve.empty,y=0;for(let N=i,w=!1;N>n;N--)w||a.after(N+1)=0;o--){if(s.size){let c=n[o].type.contentMatch.matchFragment(s);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=ve.from(n[o].type.create(n[o].attrs,s))}let a=e.start,i=e.end;t.step(new Vn(a,i,a,i,new Ie(s,0,0),n.length,!0))}function xO(t,e,n,s,a){if(!s.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(s,u)&&yO(t.doc,t.mapping.slice(i).map(c),s)){let h=null;if(s.schema.linebreakReplacement){let y=s.whitespace=="pre",N=!!s.contentMatch.matchType(s.schema.linebreakReplacement);y&&!N?h=!1:!y&&N&&(h=!0)}h===!1&&bS(t,o,c,i),N0(t,t.mapping.slice(i).map(c,1),s,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new Vn(m,g,m+1,g-1,new Ie(ve.from(s.create(u,null,o.marks)),0,0),1,!0)),h===!0&&yS(t,o,c,i),!1}})}function yS(t,e,n,s){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(s).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function bS(t,e,n,s){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(s).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
-`))}})}function yO(t,e,n){let s=t.resolve(e),a=s.index();return s.parent.canReplaceWith(a,a+1,n)}function bO(t,e,n,s,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(s,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 Vn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Ie(ve.from(o),0,0),1,!0))}function Ca(t,e,n=1,s){let a=t.resolve(e),i=a.depth-n,o=s&&s[s.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),g=a.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),N=s&&s[f+1];N&&(y=y.replaceChild(0,N.type.create(N.attrs)));let w=s&&s[f]||m;if(!m.canReplace(g+1,m.childCount)||!w.type.validContent(y))return!1}let c=a.indexAfter(i),u=s&&s[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function vO(t,e,n=1,s){let a=t.doc.resolve(e),i=ve.empty,o=ve.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=ve.from(a.node(c).copy(i));let f=s&&s[h];o=ve.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new Bn(e,e,new Ie(i.append(o),n,n),!0))}function zi(t,e){let n=t.resolve(e),s=n.index();return vS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function NO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:s}=t.type.schema;for(let a=0;a0?(i=s.node(a+1),c++,o=s.node(a).maybeChild(c)):(i=s.node(a).maybeChild(c-1),o=s.node(a+1)),i&&!i.isTextblock&&vS(i,o)&&s.node(a).canReplace(c,c+1))return e;if(a==0)break;e=n<0?s.before(a):s.after(a)}}function wO(t,e,n){let s=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?s=!1:!f&&m&&(s=!0)}let c=t.steps.length;if(s===!1){let f=t.doc.resolve(e+n);bS(t,f.node(),f.before(),c)}o.inlineContent&&N0(t,e+n-1,o,i.node().contentMatchAt(i.index()),s==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new Bn(h,u.map(e+n,-1),Ie.empty,!0)),s===!0){let f=t.doc.resolve(h);yS(t,f.node(),f.before(),t.steps.length)}return t}function jO(t,e,n){let s=t.resolve(e);if(s.parent.canReplaceWith(s.index(),s.index(),n))return e;if(s.parentOffset==0)for(let a=s.depth-1;a>=0;a--){let i=s.index(a);if(s.node(a).canReplaceWith(i,i,n))return s.before(a+1);if(i>0)return null}if(s.parentOffset==s.parent.content.size)for(let a=s.depth-1;a>=0;a--){let i=s.indexAfter(a);if(s.node(a).canReplaceWith(i,i,n))return s.after(a+1);if(i=0;o--){let c=o==s.depth?0:s.pos<=(s.start(o+1)+s.end(o+1))/2?-1:1,u=s.index(o)+(c>0?1:0),h=s.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?s.pos:c<0?s.before(o+1):s.after(o+1)}return null}function Vf(t,e,n=e,s=Ie.empty){if(e==n&&!s.size)return null;let a=t.resolve(e),i=t.resolve(n);return wS(a,i,s)?new Bn(e,n,s):new kO(a,i,s).fit()}function wS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class kO{constructor(e,n,s){this.$from=e,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=ve.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=ve.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,s=this.$from,a=this.close(e<0?this.$to:s.doc.resolve(e));if(!a)return null;let i=this.placed,o=s.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new Ie(i,o,c);return e>-1?new Vn(s.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||s.pos!=this.$to.pos?new Bn(s.pos,a.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,a=this.unplaced.openEnd;s1&&(a=0),i.type.spec.isolating&&a<=s){e=s;break}n=i.content}for(let n=1;n<=2;n++)for(let s=n==1?e:this.unplaced.openStart;s>=0;s--){let a,i=null;s?(i=ig(this.unplaced.content,s-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(ve.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:s,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:s,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:s}=this.unplaced,a=ig(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Ie(e,n+1,Math.max(s,a.size+n>=e.size-s?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:s}=this.unplaced,a=ig(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Ie(Jc(e,n-1,1),n-1,i?n-1:s)}else this.unplaced=new Ie(Jc(e,n,1),n,s)}placeNodes({sliceDepth:e,frontierDepth:n,parent:s,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let w=0;w1||u==0||w.content.size)&&(m=v,f.push(jS(w.mark(g.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?y:-1)))}let N=h==c.childCount;N||(y=-1),this.placed=Yc(this.placed,n,ve.from(f)),this.frontier[n].match=m,N&&y<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,v=c;w1&&a==this.$to.end(--s);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:s,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=og(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=Yc(this.placed,n.depth,n.fit)),e=n.move;for(let s=n.depth+1;s<=e.depth;s++){let a=e.node(s),i=a.type.contentMatch.fillBefore(a.content,!0,e.index(s));this.openFrontierNode(a.type,a.attrs,i)}return e}openFrontierNode(e,n=null,s){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=Yc(this.placed,this.depth,ve.from(e.create(n,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ve.empty,!0);n.childCount&&(this.placed=Yc(this.placed,this.frontier.length,n))}}function Jc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Jc(t.firstChild.content,e-1,n)))}function Yc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Yc(t.lastChild.content,e-1,n)))}function ig(t,e){for(let n=0;n1&&(s=s.replaceChild(0,jS(s.firstChild,e-1,s.childCount==1?n-1:0))),e>0&&(s=t.type.contentMatch.fillBefore(s).append(s),n<=0&&(s=s.append(t.type.contentMatch.matchFragment(s).fillBefore(ve.empty,!0)))),t.copy(s)}function og(t,e,n,s,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=s.fillBefore(i.content,!0,o);return c&&!SO(n,i.content,o)?c:null}function SO(t,e,n){for(let s=n;s0;g--,y--){let N=a.node(g).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(g)>-1?c=g:a.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=s.openStart;for(let g=s.content,y=0;;y++){let N=g.firstChild;if(h.push(N),y==s.openStart)break;g=N.content}for(let g=f-1;g>=0;g--){let y=h[g],N=CO(y.type);if(N&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(N||!y.type.isTextblock)break}for(let g=s.openStart;g>=0;g--){let y=(g+f+1)%(s.openStart+1),N=h[y];if(N)for(let w=0;w=0&&(t.replace(e,n,s),!(t.steps.length>m));g--){let y=o[g];y<0||(e=a.before(y),n=i.after(y))}}function kS(t,e,n,s,a){if(es){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(ve.empty,!0))}return t}function TO(t,e,n,s){if(!s.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=jO(t.doc,e,s.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Ie(ve.from(s),0,0))}function MO(t,e,n){let s=t.doc.resolve(e),a=t.doc.resolve(n),i=SS(s,a);for(let o=0;o0&&(u||s.node(c-1).canReplace(s.index(c-1),a.indexAfter(c-1))))return t.delete(s.before(c),a.after(c))}for(let o=1;o<=s.depth&&o<=a.depth;o++)if(e-s.start(o)==s.depth-o&&n>s.end(o)&&a.end(o)-n!=a.depth-o&&s.start(o-1)==a.start(o-1)&&s.node(o-1).canReplace(s.index(o-1),a.index(o-1)))return t.delete(s.before(o),n);t.delete(e,n)}function SS(t,e){let n=[],s=Math.min(t.depth,e.depth);for(let a=s;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 Fl extends ps{constructor(e,n,s){super(),this.pos=e,this.attr=n,this.value=s}apply(e){let n=e.nodeAt(this.pos);if(!n)return kn.fail("No node at attribute step's position");let s=Object.create(null);for(let i in n.attrs)s[i]=n.attrs[i];s[this.attr]=this.value;let a=n.type.create(s,null,n.marks);return kn.fromReplace(e,this.pos,this.pos+1,new Ie(ve.from(a),0,n.isLeaf?0:1))}getMap(){return Fs.empty}invert(e){return new Fl(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 Fl(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 Fl(n.pos,n.attr,n.value)}}ps.jsonID("attr",Fl);class kd extends ps{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 s=e.type.create(n,e.content,e.marks);return kn.ok(s)}getMap(){return Fs.empty}invert(e){return new kd(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 kd(n.attr,n.value)}}ps.jsonID("docAttr",kd);let Wl=class extends Error{};Wl=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Wl.prototype=Object.create(Error.prototype);Wl.prototype.constructor=Wl;Wl.prototype.name="TransformError";class j0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new jd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Wl(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 s=0;s{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,s=Ie.empty){let a=Vf(this.doc,e,n,s);return a&&this.step(a),this}replaceWith(e,n,s){return this.replace(e,n,new Ie(ve.from(s),0,0))}delete(e,n){return this.replace(e,n,Ie.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,s){return EO(this,e,n,s),this}replaceRangeWith(e,n,s){return TO(this,e,n,s),this}deleteRange(e,n){return MO(this,e,n),this}lift(e,n){return fO(this,e,n),this}join(e,n=1){return wO(this,e,n),this}wrap(e,n){return gO(this,e,n),this}setBlockType(e,n=e,s,a=null){return xO(this,e,n,s,a),this}setNodeMarkup(e,n,s=null,a){return bO(this,e,n,s,a),this}setNodeAttribute(e,n,s){return this.step(new Fl(e,n,s)),this}setDocAttribute(e,n){return this.step(new kd(e,n)),this}addNodeMark(e,n){return this.step(new vi(e,n)),this}removeNodeMark(e,n){let s=this.doc.nodeAt(e);if(!s)throw new RangeError("No node at position "+e);if(n instanceof $t)n.isInSet(s.marks)&&this.step(new Do(e,n));else{let a=s.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Do(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,s){return vO(this,e,n,s),this}addMark(e,n,s){return dO(this,e,n,s),this}removeMark(e,n,s){return uO(this,e,n,s),this}clearIncompatible(e,n,s){return N0(this,e,n,s),this}}const lg=Object.create(null);class rt{constructor(e,n,s){this.$anchor=e,this.$head=n,this.ranges=s||[new CS(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?Ml(e.node(0),e.node(i),e.before(i+1),e.index(i),n,s):Ml(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,s);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ws(e.node(0))}static atStart(e){return Ml(e,e,0,0,1)||new Ws(e)}static atEnd(e){return Ml(e,e,e.content.size,e.childCount,-1)||new Ws(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=lg[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(e,n)}static jsonID(e,n){if(e in lg)throw new RangeError("Duplicate use of selection JSON ID "+e);return lg[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Ze.between(this.$anchor,this.$head).getBookmark()}}rt.prototype.visible=!0;class CS{constructor(e,n){this.$from=e,this.$to=n}}let O1=!1;function D1(t){!O1&&!t.parent.inlineContent&&(O1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Ze extends rt{constructor(e,n=e){D1(e),D1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let s=e.resolve(n.map(this.head));if(!s.parent.inlineContent)return rt.near(s);let a=e.resolve(n.map(this.anchor));return new Ze(a.parent.inlineContent?a:s,s)}replace(e,n=Ie.empty){if(super.replace(e,n),n==Ie.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof Ze&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Hf(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 Ze(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,s=n){let a=e.resolve(n);return new this(a,s==n?a:e.resolve(s))}static between(e,n,s){let a=e.pos-n.pos;if((!s||a)&&(s=a>=0?1:-1),!n.parent.inlineContent){let i=rt.findFrom(n,s,!0)||rt.findFrom(n,-s,!0);if(i)n=i.$head;else return rt.near(n,s)}return e.parent.inlineContent||(a==0?e=n:(e=(rt.findFrom(e,-s,!0)||rt.findFrom(e,s,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&Xe.isSelectable(c))return Xe.create(t,n-(a<0?c.nodeSize:0))}else{let u=Ml(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function L1(t,e,n){let s=t.steps.length-1;if(s{o==null&&(o=f)}),t.setSelection(rt.near(t.doc.resolve(o),n))}const _1=1,th=2,z1=4;class IO extends j0{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|=th,this}ensureMarks(e){return $t.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&th)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~th,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let s=this.selection;return n&&(e=e.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||$t.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,s){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(s==null&&(s=n),!e)return this.deleteRange(n,s);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=s==n?o.marks():o.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(n,s,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(rt.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|=z1,this}get scrolledIntoView(){return(this.updated&z1)>0}}function $1(t,e){return!e||!t?t:t.bind(e)}class Qc{constructor(e,n,s){this.name=e,this.init=$1(n.init,s),this.apply=$1(n.apply,s)}}const RO=[new Qc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Qc("selection",{init(t,e){return t.selection||rt.atStart(e.doc)},apply(t){return t.selection}}),new Qc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,s){return s.selection.$cursor?t.storedMarks:null}}),new Qc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class cg{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=RO.slice(),n&&n.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new Qc(s.key,s.spec.state,s))})}}class _l{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 s=0;ss.toJSON())),e&&typeof e=="object")for(let s in e){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=e[s],i=a.spec.state;i&&i.toJSON&&(n[s]=i.toJSON.call(a,this[a.key]))}return n}static fromJSON(e,n,s){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let a=new cg(e.schema,e.plugins),i=new _l(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Sa.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=rt.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let c in s){let u=s[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 ES(t,e,n){for(let s in t){let a=t[s];a instanceof Function?a=a.bind(e):s=="handleDOMEvents"&&(a=ES(a,e,{})),n[s]=a}return n}class Wt{constructor(e){this.spec=e,this.props={},e.props&&ES(e.props,this,this.props),this.key=e.key?e.key.key:TS("plugin")}getState(e){return e[this.key]}}const dg=Object.create(null);function TS(t){return t in dg?t+"$"+ ++dg[t]:(dg[t]=0,t+"$")}class nn{constructor(e="key"){this.key=TS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const S0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function MS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const AS=(t,e,n)=>{let s=MS(t,n);if(!s)return!1;let a=C0(s);if(!a){let o=s.blockRange(),c=o&&ac(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if($S(t,a,e,-1))return!0;if(s.parent.content.size==0&&(Ul(i,"end")||Xe.isSelectable(i)))for(let o=s.depth;;o--){let c=Vf(t.doc,s.before(o),s.after(o),Ie.empty);if(c&&c.slice.size1)break}return i.isAtom&&a.depth==s.depth-1?(e&&e(t.tr.delete(a.pos-i.nodeSize,a.pos).scrollIntoView()),!0):!1},PO=(t,e,n)=>{let s=MS(t,n);if(!s)return!1;let a=C0(s);return a?IS(t,a,e):!1},OO=(t,e,n)=>{let s=PS(t,n);if(!s)return!1;let a=E0(s);return a?IS(t,a,e):!1};function IS(t,e,n){let s=e.nodeBefore,a=s,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=Vf(t.doc,i,u,Ie.empty);if(!h||h.from!=i||h instanceof Bn&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(Ze.create(f.doc,i)),n(f.scrollIntoView())}return!0}function Ul(t,e,n=!1){for(let s=t;s;s=e=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(n&&s.childCount!=1)return!1}return!1}const RS=(t,e,n)=>{let{$head:s,empty:a}=t.selection,i=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):s.parentOffset>0)return!1;i=C0(s)}let o=i&&i.nodeBefore;return!o||!Xe.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Xe.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function C0(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 PS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let s=PS(t,n);if(!s)return!1;let a=E0(s);if(!a)return!1;let i=a.nodeAfter;if($S(t,a,e,1))return!0;if(s.parent.content.size==0&&(Ul(i,"start")||Xe.isSelectable(i))){let o=Vf(t.doc,s.before(),s.after(),Ie.empty);if(o&&o.slice.size{let{$head:s,empty:a}=t.selection,i=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):s.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,s=n instanceof Xe,a;if(s){if(n.node.isTextblock||!zi(t.doc,n.from))return!1;a=n.from}else if(a=Bf(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);s&&i.setSelection(Xe.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},LO=(t,e)=>{let n=t.selection,s;if(n instanceof Xe){if(n.node.isTextblock||!zi(t.doc,n.to))return!1;s=n.to}else if(s=Bf(t.doc,n.to,1),s==null)return!1;return e&&e(t.tr.join(s).scrollIntoView()),!0},_O=(t,e)=>{let{$from:n,$to:s}=t.selection,a=n.blockRange(s),i=a&&ac(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},LS=(t,e)=>{let{$head:n,$anchor:s}=t.selection;return!n.parent.type.spec.code||!n.sameParent(s)?!1:(e&&e(t.tr.insertText(`
-`).scrollIntoView()),!0)};function T0(t){for(let e=0;e{let{$head:n,$anchor:s}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(s))return!1;let a=n.node(-1),i=n.indexAfter(-1),o=T0(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(rt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},_S=(t,e)=>{let n=t.selection,{$from:s,$to:a}=n;if(n instanceof Ws||s.parent.inlineContent||a.parent.inlineContent)return!1;let i=T0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!s.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(Ca(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let s=n.blockRange(),a=s&&ac(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)};function $O(t){return(e,n)=>{let{$from:s,$to:a}=e.selection;if(e.selection instanceof Xe&&e.selection.node.isBlock)return!s.parentOffset||!Ca(e.doc,s.pos)?!1:(n&&n(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let i=[],o,c,u=!1,h=!1;for(let y=s.depth;;y--)if(s.node(y).isBlock){u=s.end(y)==s.pos+(s.depth-y),h=s.start(y)==s.pos-(s.depth-y),c=T0(s.node(y-1).contentMatchAt(s.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 Ze||e.selection instanceof Ws)&&f.deleteSelection();let m=f.mapping.map(s.pos),g=Ca(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Ca(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&s.node(o).type!=c){let y=f.mapping.map(s.before(o)),N=f.doc.resolve(y);c&&s.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(s.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const FO=$O(),BO=(t,e)=>{let{$from:n,to:s}=t.selection,a,i=n.sharedDepth(s);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(Xe.create(t.doc,a))),!0)};function VO(t,e,n){let s=e.nodeBefore,a=e.nodeAfter,i=e.index();return!s||!a||!s.type.compatibleContent(a.type)?!1:!s.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-s.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||zi(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function $S(t,e,n,s){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&VO(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=ve.empty;for(let k=o.length-1;k>=0;k--)N=ve.from(o[k].create(null,N));N=ve.from(a.copy(N));let w=t.tr.step(new Vn(e.pos-1,y,e.pos,y,new Ie(N,1,0),o.length,!0)),v=w.doc.resolve(y+2*o.length);v.nodeAfter&&v.nodeAfter.type==a.type&&zi(w.doc,v.pos)&&w.join(v.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||s>0&&u?null:rt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&ac(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Ul(i,"start",!0)&&Ul(a,"end")){let y=a,N=[];for(;N.push(y),!y.isTextblock;)y=y.lastChild;let w=i,v=1;for(;!w.isTextblock;w=w.firstChild)v++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=ve.empty;for(let E=N.length-1;E>=0;E--)k=ve.from(N[E].copy(k));let C=t.tr.step(new Vn(e.pos-N.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new Ie(k,N.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function FS(t){return function(e,n){let s=e.selection,a=t<0?s.$from:s.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(Ze.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const HO=FS(-1),WO=FS(1);function UO(t,e=null){return function(n,s){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&w0(o,t,e);return c?(s&&s(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function F1(t,e=null){return function(n,s){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(s){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 _h(u,u,e.depth),e.endIndex=0;f--)i=ve.from(n[f].type.create(n[f].attrs,i));t.step(new Vn(e.start-(s?2:0),e.end,e.start,e.end,new Ie(i,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return i?n?s.node(i.depth-1).type==t?YO(e,n,t,i):QO(e,n,i):!0:!1}}function YO(t,e,n,s){let a=t.tr,i=s.end,o=s.$to.end(s.depth);iw;N--)y-=a.child(N).nodeSize,s.delete(y-1,y+1);let i=s.doc.resolve(n.start),o=i.nodeAfter;if(s.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?ve.empty:ve.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return s.step(new Vn(m-(c?1:0),g+(u?1:0),m+1,g-1,new Ie((c?ve.empty:ve.from(a.copy(ve.empty))).append(u?ve.empty:ve.from(a.copy(ve.empty))),c?0:1,u?0:1),c?0:1)),e(s.scrollIntoView()),!0}function XO(t){return function(e,n){let{$from:s,$to:a}=e.selection,i=s.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=ve.from(h?t.create():null),m=new Ie(ve.from(t.create(null,ve.from(c.type.create(null,f)))),h?3:1,0),g=i.start,y=i.end;n(e.tr.step(new Vn(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Yn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Kl=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ux=null;const Na=function(t,e,n){let s=ux||(ux=document.createRange());return s.setEnd(t,n??t.nodeValue.length),s.setStart(t,e||0),s},ZO=function(){ux=null},Lo=function(t,e,n,s){return n&&(B1(t,e,n,s,-1)||B1(t,e,n,s,1))},eD=/^(img|br|input|textarea|hr)$/i;function B1(t,e,n,s,a){for(var i;;){if(t==n&&e==s)return!0;if(e==(a<0?0:ir(t))){let o=t.parentNode;if(!o||o.nodeType!=1||$d(t)||eD.test(t.nodeName)||t.contentEditable=="false")return!1;e=Yn(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?ir(t):0}else return!1}}function ir(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function tD(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=ir(t)}else if(t.parentNode&&!$d(t))e=Yn(t),t=t.parentNode;else return null}}function nD(t,e){for(;;){if(t.nodeType==3&&e2),ar=ql||(Gr?/Mac/.test(Gr.platform):!1),HS=Gr?/Win/.test(Gr.platform):!1,ja=/Android \d/.test($i),Fd=!!V1&&"webkitFontSmoothing"in V1.documentElement.style,iD=Fd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oD(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 ga(t,e){return typeof t=="number"?t:t[e]}function lD(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,s=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*s}}function H1(t,e,n){let s=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=Kl(o);continue}let c=o,u=c==i.body,h=u?oD(i):lD(c),f=0,m=0;if(e.toph.bottom-ga(s,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ga(a,"top")-h.top:e.bottom-h.bottom+ga(a,"bottom")),e.lefth.right-ga(s,"right")&&(f=e.right-h.right+ga(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,v=c.scrollTop-N;e={left:e.left-w,top:e.top-v,right:e.right-w,bottom:e.bottom-v}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Kl(o)}}function cD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),s,a;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){s=c,a=u.top;break}}return{refDOM:s,refTop:a,stack:WS(t.dom)}}function WS(t){let e=[],n=t.ownerDocument;for(let s=t;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),t!=n);s=Kl(s));return e}function dD({refDOM:t,refTop:e,stack:n}){let s=t?t.getBoundingClientRect().top:0;US(n,s==0?0:s-e)}function US(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,s=0),n&&n.nodeType==3?hD(n,a):!n||s&&n.nodeType==1?{node:t,offset:i}:KS(n,a)}function hD(t,e){let n=t.nodeValue.length,s=document.createRange(),a;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return s.detach(),a||{node:t,offset:0}}function A0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function fD(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(s,a,i)}function mD(t,e,n,s){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>s.left||u.top>s.top?a=c.posBefore:(!o&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function qS(t,e,n){let s=t.childNodes.length;if(s&&n.tope.top&&a++}let h;Fd&&a&&s.nodeType==1&&(h=s.childNodes[a-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&a--,s==t.dom&&a==s.childNodes.length-1&&s.lastChild.nodeType==1&&e.top>s.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(a==0||s.nodeType!=1||s.childNodes[a-1].nodeName!="BR")&&(c=mD(t,s,a,e))}c==null&&(c=pD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function W1(t){return t.top=0&&a==s.nodeValue.length?(u--,f=1):n<0?u--:h++,Uc(di(Na(s,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==ir(s))){let u=s.childNodes[a-1];if(u.nodeType==1)return ug(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==ir(s))){let u=s.childNodes[a-1],h=u.nodeType==3?Na(u,ir(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Uc(di(h,1),!1)}if(i==null&&a=0)}function Uc(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 ug(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 JS(t,e,n){let s=t.state,a=t.root.activeElement;s!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{s!=e&&t.updateState(s),a!=t.dom&&a&&a.focus()}}function yD(t,e,n){let s=e.selection,a=n=="up"?s.$from:s.$to;return JS(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=GS(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=Na(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 bD=/[\u0590-\u08ac]/;function vD(t,e,n){let{$head:s}=e.selection;if(!s.parent.isTextblock)return!1;let a=s.parentOffset,i=!a,o=a==s.parent.content.size,c=t.domSelection();return c?!bD.test(s.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:JS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=s.depth?t.docView.domAfterPos(s.before()):t.dom,{focusNode:N,focusOffset:w}=t.domSelectionRange(),v=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 g!=null&&(c.caretBidiLevel=g),v}):s.pos==s.start()||s.pos==s.end()}let U1=null,K1=null,q1=!1;function ND(t,e,n){return U1==e&&K1==n?q1:(U1=e,K1=n,q1=n=="up"||n=="down"?yD(t,e,n):vD(t,e,n))}const lr=0,G1=1,vo=2,Jr=3;class Bd{constructor(e,n,s,a){this.parent=e,this.children=n,this.dom=s,this.contentDOM=a,this.dirty=lr,s.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,s){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nYn(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??s>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let s=!0,a=e;a;a=a.parentNode){let i=this.getDesc(a),o;if(i&&(!n||i.node))if(s&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))s=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let s=n;s;s=s.parent)if(s==this)return n}posFromDOM(e,n,s){for(let a=e;a;a=a.parentNode){let i=this.getDesc(a);if(i)return i.localPosFromDOM(e,n,s)}return-1}descAt(e){for(let n=0,s=0;ne||o instanceof QS){a=e-i;break}i=c}if(a)return this.children[s].domFromPos(a-this.children[s].border,n);for(let i;s&&!(i=this.children[s-1]).size&&i instanceof YS&&i.side>=0;s--);if(n<=0){let i,o=!0;for(;i=s?this.children[s-1]:null,!(!i||i.dom.parentNode==this.contentDOM);s--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Yn(i.dom)+1:0}}else{let i,o=!0;for(;i=s=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 g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){a=Yn(g.dom)+1;break}e-=g.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 s=0,a=0;a=s:es){let c=s+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==s||n==o?vo:G1,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Jr:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?vo:Jr}s=o}this.dirty=vo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let s=e==1?vo:G1;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==lr&&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 wD extends Bd{constructor(e,n,s,a){super(e,[],n,null),this.textDOM=s,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 _o extends Bd{constructor(e,n,s,a,i){super(e,[],s,a),this.mark=n,this.spec=i}static create(e,n,s,a){let i=a.nodeViews[n.type.name],o=i&&i(n,a,s);return(!o||!o.dom)&&(o=Wo.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new _o(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Jr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Jr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=lr){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(i=gx(i,0,e,s));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},s,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}=Wo.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 g=f;return f=e2(f,s,n),h?u=new jD(e,n,s,a,f,m||null,g,h,i,o+1):n.isText?new Uf(e,n,s,a,f,g,i):new Ci(e,n,s,a,f,m||null,g,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 s=this.children[n];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ve.empty)}return e}matchesNode(e,n,s){return this.dirty==lr&&e.eq(this.node)&&$h(n,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let s=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 SD(this,o&&o.node,e);TD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,s,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?$t.none:this.node.child(f).marks,s,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,s,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],s,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==vo)&&(o&&this.protectLocalComposition(e,o),XS(this.contentDOM,this.children,e),ql&&MD(this.dom))}localCompositionInfo(e,n){let{from:s,to:a}=e.state.selection;if(!(e.state.selection instanceof Ze)||sn+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=AD(this.node.content,o,s-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:s,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 wD(this,i,n,a);e.input.compositionNodes.push(o),this.children=gx(this.children,s,s+a.length,e,o)}update(e,n,s,a){return this.dirty==Jr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,s,a),!0)}updateInner(e,n,s,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=s,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=lr}updateOuterDeco(e){if($h(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=ZS(this.dom,this.nodeDOM,mx(this.outerDeco,this.node,n),mx(e,this.node,n)),this.dom!=s&&(s.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 J1(t,e,n,s,a){e2(s,e,t);let i=new Ci(void 0,t,e,n,s,s,s,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Uf extends Ci{constructor(e,n,s,a,i,o,c){super(e,n,s,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,s,a){return this.dirty==Jr||this.dirty!=lr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=lr||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=lr,!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,s){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,s)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,s){let a=this.node.cut(e,n),i=document.createTextNode(a.text);return new Uf(this.parent,a,this.outerDeco,this.innerDeco,i,i,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Jr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class QS extends Bd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==lr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class jD extends Ci{constructor(e,n,s,a,i,o,c,u,h,f){super(e,n,s,a,i,o,c,h,f),this.spec=u}update(e,n,s,a){if(this.dirty==Jr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,s);return i&&this.updateInner(e,n,s,a),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,s,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,s,a){this.spec.setSelection?this.spec.setSelection(e,n,s.root):super.setSelection(e,n,s,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 XS(t,e,n){let s=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=_o.create(this.top,e[o],n,s);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,s,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,s))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(s){let h=n.children[s-1];if(h instanceof _o)n=h,s=h.children.length;else{c=h,s--;break}}else{if(n==e)break e;s=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 ED(t,e){return t.type.side-e.type.side}function TD(t,e,n,s){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let N=i+g.nodeSize;if(g.isText){let v=N;o!v.inline):c.slice();s(g,w,e.forChild(i,g),y),i=N}}function MD(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 AD(t,e,n,s){for(let a=0,i=0;a=n){if(i>=s&&u.slice(s-e.length-c,s-c)==e)return s-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==s&&u.length>=s+e.length-c&&u.slice(s-c,s-c+e.length)==e)return s}}return-1}function gx(t,e,n,s,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,s)))}return i}function I0(t,e=null){let n=t.domSelectionRange(),s=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=s.resolve(o),u,h;if(Wf(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&Xe.isSelectable(m)&&a.parent&&!(m.isInline&&sD(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new Xe(o==g?c:s.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=s||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!t2(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function RD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,s=n.nodeName=="IMG";s?e.collapse(n.parentNode,Yn(n)+1):e.collapse(n,0),!s&&!t.state.selection.visible&&Os&&Si<=11&&(n.disabled=!0,n.disabled=!1)}function n2(t,e){if(e instanceof Xe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(eN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else eN(t)}function eN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function R0(t,e,n,s){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Ze.between(e,n,s)}function tN(t){return t.editable&&!t.hasFocus()?!1:s2(t)}function s2(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 PD(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Lo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function xx(t,e){let{$anchor:n,$head:s}=t.selection,a=e>0?n.max(s):n.min(s),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&&rt.findFrom(i,e)}function ui(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function nN(t,e,n){let s=t.state.selection;if(s instanceof Ze)if(n.indexOf("s")>-1){let{$head:a}=s,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 ui(t,new Ze(s.$anchor,o))}else if(s.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=xx(t.state,e);return a&&a instanceof Xe?ui(t,a):!1}else if(!(ar&&n.indexOf("m")>-1)){let a=s.$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?Xe.isSelectable(i)?ui(t,new Xe(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Fd?ui(t,new Ze(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(s instanceof Xe&&s.node.isInline)return ui(t,new Ze(e>0?s.$to:s.$from));{let a=xx(t.state,e);return a?ui(t,a):!1}}}function Fh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ld(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Tl(t,e){return e<0?OD(t):DD(t)}function OD(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a,i,o=!1;for(or&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let c=n.childNodes[s-1];if(ld(c,-1))a=n,i=--s;else if(c.nodeType==3)n=c,s=n.nodeValue.length;else break}}else{if(r2(n))break;{let c=n.previousSibling;for(;c&&ld(c,-1);)a=n.parentNode,i=Yn(c),c=c.previousSibling;if(c)n=c,s=Fh(n);else{if(n=n.parentNode,n==t.dom)break;s=0}}}o?yx(t,n,s):a&&yx(t,a,i)}function DD(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a=Fh(n),i,o;for(;;)if(s{t.state==a&&Ea(t)},50)}function sN(t,e){let n=t.state.doc.resolve(e);if(!(Xn||HS)&&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 rN(t,e,n){let s=t.state.selection;if(s instanceof Ze&&!s.empty||n.indexOf("s")>-1||ar&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=s;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=xx(t.state,e);if(o&&o instanceof Xe)return ui(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=s instanceof Ws?rt.near(o,e):rt.findFrom(o,e);return c?ui(t,c):!1}return!1}function aN(t,e){if(!(t.state.selection instanceof Ze))return!0;let{$head:n,$anchor:s,empty:a}=t.state.selection;if(!n.sameParent(s))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 iN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function zD(t){if(!hs||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 s=e.firstChild;iN(t,s,"true"),setTimeout(()=>iN(t,s,"false"),20)}return!1}function $D(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function FD(t,e){let n=e.keyCode,s=$D(e);if(n==8||ar&&n==72&&s=="c")return aN(t,-1)||Tl(t,-1);if(n==46&&!e.shiftKey||ar&&n==68&&s=="c")return aN(t,1)||Tl(t,1);if(n==13||n==27)return!0;if(n==37||ar&&n==66&&s=="c"){let a=n==37?sN(t,t.state.selection.from)=="ltr"?-1:1:-1;return nN(t,a,s)||Tl(t,a)}else if(n==39||ar&&n==70&&s=="c"){let a=n==39?sN(t,t.state.selection.from)=="ltr"?1:-1:1;return nN(t,a,s)||Tl(t,a)}else{if(n==38||ar&&n==80&&s=="c")return rN(t,-1,s)||Tl(t,-1);if(n==40||ar&&n==78&&s=="c")return zD(t)||rN(t,1,s)||Tl(t,1);if(s==(ar?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function P0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:s,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&s.childCount==1&&s.firstChild.childCount==1;){a--,i--;let y=s.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),s=y.content}let o=t.someProp("clipboardSerializer")||Wo.fromSchema(t.state.schema),c=d2(),u=c.createElement("div");u.appendChild(o.serializeFragment(s,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=c2[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 g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
-
-`);return{dom:u,text:g,slice:e}}function a2(t,e,n,s,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(s||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||s,t)}),i)return c=new Ie(ve.from(t.state.schema.text(e.replace(/\r\n?/g,`
-`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,s,t));if(m)c=m;else{let g=a.marks(),{schema:y}=t.state,N=Wo.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let v=o.appendChild(document.createElement("p"));w&&v.appendChild(N.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=WD(n),Fd&&UD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||ki.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!BD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=KD(oN(c,+f[1],+f[2]),f[4]);else if(c=Ie.maxOpen(VD(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const BD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function VD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(c=>{if(!o)return;let u=a.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&i.length&&o2(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=l2(o[o.length-1],i.length));let f=i2(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return ve.from(o)}return t}function i2(t,e,n=0){for(let s=e.length-1;s>=n;s--)t=e[s].create(null,ve.from(t));return t}function o2(t,e,n,s,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(ve.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function oN(t,e,n){return en})),fg.createHTML(t)):t}function WD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=d2().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(t),a;if((a=s&&c2[s[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>""+i+">").reverse().join("")),n.innerHTML=HD(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[s[c]];if(!u||u.hasRequiredAttrs())break;a=ve.from(u.create(s[c+1],a)),i++,o++}return new Ie(a,i,o)}const Ns={},ws={},qD={touchstart:!0,touchmove:!0};class GD{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function JD(t){for(let e in Ns){let n=Ns[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=s=>{QD(t,s)&&!O0(t,s)&&(t.editable||!(s.type in ws))&&n(t,s)},qD[e]?{passive:!0}:void 0)}hs&&t.dom.addEventListener("input",()=>null),vx(t)}function Ni(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function YD(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function vx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=s=>O0(t,s))})}function O0(t,e){return t.someProp("handleDOMEvents",n=>{let s=n[e.type];return s?s(t,e)||e.defaultPrevented:!1})}function QD(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function XD(t,e){!O0(t,e)&&Ns[e.type]&&(t.editable||!(e.type in ws))&&Ns[e.type](t,e)}ws.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!h2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ja&&Xn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ql&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let s=Date.now();t.input.lastIOSEnter=s,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==s&&(t.someProp("handleKeyDown",a=>a(t,xo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",s=>s(t,n))||FD(t,n)?n.preventDefault():Ni(t,"key")};ws.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ws.keypress=(t,e)=>{let n=e;if(h2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ar&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let s=t.state.selection;if(!(s instanceof Ze)||!s.$from.sameParent(s.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,s.$from.pos,s.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Kf(t){return{left:t.clientX,top:t.clientY}}function ZD(t,e){let n=e.x-t.clientX,s=e.y-t.clientY;return n*n+s*s<100}function D0(t,e,n,s,a){if(s==-1)return!1;let i=t.state.doc.resolve(s);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,c=>o>i.depth?c(t,n,i.nodeAfter,i.before(o),a,!0):c(t,n,i.node(o),i.before(o),a,!1)))return!0;return!1}function Bl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let s=t.state.tr.setSelection(e);s.setMeta("pointer",!0),t.dispatch(s)}function eL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),s=n.nodeAfter;return s&&s.isAtom&&Xe.isSelectable(s)?(Bl(t,new Xe(n)),!0):!1}function tL(t,e){if(e==-1)return!1;let n=t.state.selection,s,a;n instanceof Xe&&(s=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(Xe.isSelectable(c)){s&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(Bl(t,Xe.create(t.state.doc,a)),!0):!1}function nL(t,e,n,s,a){return D0(t,"handleClickOn",e,n,s)||t.someProp("handleClick",i=>i(t,e,s))||(a?tL(t,n):eL(t,n))}function sL(t,e,n,s){return D0(t,"handleDoubleClickOn",e,n,s)||t.someProp("handleDoubleClick",a=>a(t,e,s))}function rL(t,e,n,s){return D0(t,"handleTripleClickOn",e,n,s)||t.someProp("handleTripleClick",a=>a(t,e,s))||aL(t,n,s)}function aL(t,e,n){if(n.button!=0)return!1;let s=t.state.doc;if(e==-1)return s.inlineContent?(Bl(t,Ze.create(s,0,s.content.size)),!0):!1;let a=s.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)Bl(t,Ze.create(s,c+1,c+1+o.content.size));else if(Xe.isSelectable(o))Bl(t,Xe.create(s,c));else continue;return!0}}function L0(t){return Bh(t)}const u2=ar?"metaKey":"ctrlKey";Ns.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let s=L0(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&ZD(n,t.input.lastClick)&&!n[u2]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Kf(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new iL(t,o,n,!!s)):(i=="doubleClick"?sL:rL)(t,o.pos,o.inside,n)?n.preventDefault():Ni(t,"pointer"))};class iL{constructor(e,n,s,a){this.view=e,this.pos=n,this.event=s,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!s[u2],this.allowDefault=s.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:s.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(s.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof Xe&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&or&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ni(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ea(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Kf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ni(this.view,"pointer"):nL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||hs&&this.mightDrag&&!this.mightDrag.node.isAtom||Xn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Bl(this.view,rt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ni(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ni(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ns.touchstart=t=>{t.input.lastTouch=Date.now(),L0(t),Ni(t,"pointer")};Ns.touchmove=t=>{t.input.lastTouch=Date.now(),Ni(t,"pointer")};Ns.contextmenu=t=>L0(t);function h2(t,e){return t.composing?!0:hs&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const oL=ja?5e3:-1;ws.compositionstart=ws.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ze&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||Xn&&HS&&lL(t)))t.markCursor=t.state.storedMarks||n.marks(),Bh(t,!0),t.markCursor=null;else if(Bh(t,!e.selection.empty),or&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=t.domSelectionRange();for(let a=s.focusNode,i=s.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}f2(t,oL)};function lL(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let s=e.childNodes[n];return s.nodeType==1&&s.contentEditable=="false"}ws.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,f2(t,20))};function f2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Bh(t),e))}function p2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=dL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function cL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=tD(e.focusNode,e.focusOffset),s=nD(e.focusNode,e.focusOffset);if(n&&s&&n!=s){let a=s.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||s==i)return i;if(!a||!a.isText(s.nodeValue))return s;if(t.input.compositionNode==s){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return s}}return n||s}function dL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Bh(t,e=!1){if(!(ja&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),p2(t),e||t.docView&&t.docView.dirty){let n=I0(t),s=t.state.selection;return n&&!n.eq(s)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function uL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),s.removeAllRanges(),s.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Sd=Os&&Si<15||ql&&iD<604;Ns.copy=ws.cut=(t,e)=>{let n=e,s=t.state.selection,a=n.type=="cut";if(s.empty)return;let i=Sd?null:n.clipboardData,o=s.content(),{dom:c,text:u}=P0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):uL(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function fL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,s=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),s.parentNode&&s.parentNode.removeChild(s),n?Cd(t,s.value,null,a,e):Cd(t,s.textContent,s.innerHTML,a,e)},50)}function Cd(t,e,n,s,a){let i=a2(t,e,n,s,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Ie.empty)))return!0;if(!i)return!1;let o=hL(i),c=o?t.state.tr.replaceSelectionWith(o,s):t.state.tr.replaceSelection(i);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function m2(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ws.paste=(t,e)=>{let n=e;if(t.composing&&!ja)return;let s=Sd?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;s&&Cd(t,m2(s),s.getData("text/html"),a,n)?n.preventDefault():fL(t,n)};class g2{constructor(e,n,s){this.slice=e,this.move=n,this.node=s}}const pL=ar?"altKey":"ctrlKey";function x2(t,e){let n=t.someProp("dragCopies",s=>!s(e));return n??!e[pL]}Ns.dragstart=(t,e)=>{let n=e,s=t.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let a=t.state.selection,i=a.empty?null:t.posAtCoords(Kf(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof Xe?a.to-1:a.to))){if(s&&s.mightDrag)o=Xe.create(t.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Xe.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=P0(t,c);(!n.dataTransfer.files.length||!Xn||VS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Sd?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Sd||n.dataTransfer.setData("text/plain",h),t.dragging=new g2(f,x2(t,n),o)};Ns.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ws.dragover=ws.dragenter=(t,e)=>e.preventDefault();ws.drop=(t,e)=>{try{mL(t,e,t.dragging)}finally{t.dragging=null}};function mL(t,e,n){if(!e.dataTransfer)return;let s=t.posAtCoords(Kf(e));if(!s)return;let a=t.state.doc.resolve(s.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=a2(t,m2(e.dataTransfer),Sd?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&x2(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||Ie.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?NS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Xe.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new Xe(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((N,w,v,k)=>y=k),u.setSelection(R0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Ns.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ea(t)},20))};Ns.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ns.beforeinput=(t,e)=>{if(Xn&&ja&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:s}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=s||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,xo(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in ws)Ns[t]=ws[t];function Ed(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Vh{constructor(e,n){this.toDOM=e,this.spec=n||To,this.side=this.spec.side||0}map(e,n,s,a){let{pos:i,deleted:o}=e.mapResult(n.from+a,this.side<0?-1:1);return o?null:new In(i-s,i-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Vh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ed(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ei{constructor(e,n){this.attrs=e,this.spec=n||To}map(e,n,s,a){let i=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-s,o=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-s;return i>=o?null:new In(i,o,this)}valid(e,n){return n.from=e&&(!i||i(c.spec))&&s.push(c.copy(c.from+a,c.to+a))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,s,a+c,i)}}map(e,n,s){return this==as||e.maps.length==0?this:this.mapInner(e,n,0,0,s||To)}mapInner(e,n,s,a,i){let o;for(let c=0;c{let h=u+s,f;if(f=b2(n,c,h)){for(a||(a=this.children.slice());ic&&m.to=e){this.children[c]==e&&(s=this.children[c+2]);break}let i=e+1,o=i+n.content.size;for(let c=0;ci&&u.type instanceof Ei){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,To));return pi.from(s)}forChild(e,n){if(n.isLeaf)return zt.empty;let s=[];for(let a=0;an instanceof zt)?e:e.reduce((n,s)=>n.concat(s instanceof zt?s:s.members),[]))}}forEachSet(e){for(let n=0;n{let v=w-N-(y-g);for(let k=0;kC+f-m)continue;let E=c[k]+f-m;y>=E?c[k+1]=g<=E?-2:-1:g>=f&&v&&(c[k]+=v,c[k+1]+=v)}m+=v}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=s.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),y=g-a,{index:N,offset:w}=s.content.findIndex(m),v=s.maybeChild(N);if(v&&w==m&&w+v.nodeSize==y){let k=c[h+2].mapInner(n,v,f+1,t[h]+i+1,o);k!=as?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=xL(c,t,e,n,a,i,o),f=Hh(h,s,0,o);e=f.local;for(let m=0;mn&&o.to{let h=b2(t,c,u+n);if(h){i=!0;let f=Hh(h,c,n+u+1,s);f!=as&&a.push(u,u+c.nodeSize,f)}});let o=y2(i?v2(t):t,-n).sort(Mo);for(let c=0;c0;)e++;t.splice(e,0,n)}function pg(t){let e=[];return t.someProp("decorations",n=>{let s=n(t.state);s&&s!=as&&e.push(s)}),t.cursorWrapper&&e.push(zt.create(t.state.doc,[t.cursorWrapper.deco])),pi.from(e)}const yL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bL=Os&&Si<=11;class vL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class NL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():hs&&e.composing&&s.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bL&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,yL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(tN(this.view)){if(this.suppressingSelectionUpdates)return Ea(this.view);if(Os&&Si<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Lo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,s;for(let i=e.focusNode;i;i=Kl(i))n.add(i);for(let i=e.anchorNode;i;i=Kl(i))if(n.has(i)){s=i;break}let a=s&&this.view.docView.nearestDesc(s);if(a&&a.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let s=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&tN(e)&&!this.ignoreSelectionChange(s),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(or&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||kL(e,m)!=y)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),wL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,SL(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||Ea(e),this.currentSelection.set(s))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;v--){let k=s.childNodes[v-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){i=v;break}if(!C||C.size)break}let m=t.state.doc,g=t.someProp("domParser")||ki.fromSchema(t.state.schema),y=m.resolve(o),N=null,w=g.parse(s,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:a,to:i,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:EL,context:y});if(h&&h[0].pos!=null){let v=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=v),N={anchor:v+o,head:k+o}}return{doc:w,sel:N,from:o,to:c}}function EL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(hs&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||hs&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const TL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function ML(t,e,n,s,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let D=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,R=I0(t,D);if(R&&!t.state.selection.eq(R)){if(Xn&&ja&&t.input.lastKeyCode===13&&Date.now()-100_(t,xo(13,"Enter"))))return;let O=t.state.tr.setSelection(R);D=="pointer"?O.setMeta("pointer",!0):D=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),t.dispatch(O)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=CL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ja)&&a.some(D=>D.nodeType==1&&!TL.test(D.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",D=>D(t,xo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(s&&u instanceof Ze&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let D=fN(t,t.state.doc,h.sel);if(D&&!D.eq(t.state.selection)){let R=t.state.tr.setSelection(D);i&&R.setMeta("composition",i),t.dispatch(R)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),Os&&Si<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>h.from&&h.doc.textBetween(N.start-h.from-1,N.start-h.from+1)==" "&&(N.start--,N.endA--,N.endB--);let w=h.doc.resolveNoCache(N.start-h.from),v=h.doc.resolveNoCache(N.endB-h.from),k=f.resolve(N.start),C=w.sameParent(v)&&w.parent.inlineContent&&k.end()>=N.endA;if((ql&&t.input.lastIOSEnter>Date.now()-225&&(!C||a.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!C&&w.posD(t,xo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&IL(f,N.start,N.endA,w,v)&&t.someProp("handleKeyDown",D=>D(t,xo(8,"Backspace")))){ja&&Xn&&t.domObserver.suppressSelectionUpdates();return}Xn&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),ja&&!C&&w.start()!=v.start()&&v.parentOffset==0&&w.depth==v.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==N.endA&&(N.endB-=2,v=h.doc.resolveNoCache(N.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(D){return D(t,xo(13,"Enter"))})},20));let E=N.start,M=N.endA,P=D=>{let R=D||t.state.tr.replace(E,M,h.doc.slice(N.start-h.from,N.endB-h.from));if(h.sel){let O=fN(t,R.doc,h.sel);O&&!(Xn&&t.composing&&O.empty&&(N.start!=N.endB||t.input.lastChromeDeleteEa(t),20));let D=P(t.state.tr.delete(E,M)),R=f.resolve(N.start).marksAcross(f.resolve(N.endA));R&&D.ensureMarks(R),t.dispatch(D)}else if(N.endA==N.endB&&($=AL(w.parent.content.cut(w.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,N.endA-k.start())))){let D=P(t.state.tr);$.type=="add"?D.addMark(E,M,$.mark):D.removeMark(E,M,$.mark),t.dispatch(D)}else if(w.parent.child(w.index()).isText&&w.index()==v.index()-(v.textOffset?0:1)){let D=w.parent.textBetween(w.parentOffset,v.parentOffset),R=()=>P(t.state.tr.insertText(D,E,M));t.someProp("handleTextInput",O=>O(t,E,M,D,R))||t.dispatch(R())}else t.dispatch(P());else t.dispatch(P())}function fN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:R0(t,e.resolve(n.anchor),e.resolve(n.head))}function AL(t,e){let n=t.firstChild.marks,s=e.firstChild.marks,a=n,i=s,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(a.length==0&&i.length==1)c=i[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||mg(o,!0,!1)0&&(e||t.indexAfter(s)==t.node(s).childCount);)s--,a++,e=!1;if(n){let i=t.node(s).maybeChild(t.indexAfter(s));for(;i&&!i.isLeaf;)i=i.firstChild,a++}return a}function RL(t,e,n,s,a){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let u=Math.max(0,i-Math.min(o,c));s-=o+u-i}if(o=o?i-s:0;i-=u,i&&i=c?i-s:0;i-=u,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}class N2{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new GD,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(bN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=xN(this),gN(this),this.nodeViews=yN(this),this.docView=J1(this.state.doc,mN(this),pg(this),this.dom,this),this.domObserver=new NL(this,(s,a,i,o)=>ML(this,s,a,i,o)),this.domObserver.start(),JD(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&vx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(bN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let s in this._props)n[s]=this._props[s];n.state=this.state;for(let s in e)n[s]=e[s];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var s;let a=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(p2(this),o=!0),this.state=e;let c=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=yN(this);OL(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&vx(this),this.editable=xN(this),gN(this);let u=pg(this),h=mN(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&cD(this);if(o){this.domObserver.stop();let y=m&&(Os||Xn)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&PL(a.selection,e.selection);if(m){let N=Xn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=cL(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=J1(e.doc,h,u,this.dom,this)),N&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&PD(this))?Ea(this,y):(n2(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((s=this.dragging)===null||s===void 0)&&s.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&dD(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Xe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&H1(this,n.getBoundingClientRect(),e)}else H1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==s.node&&(a=i)}this.dragging=new g2(e.slice,e.move,a<0?void 0:Xe.create(this.state.doc,a))}someProp(e,n){let s=this._props&&this._props[e],a;if(s!=null&&(a=n?n(s):s))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return gD(this,e)}coordsAtPos(e,n=1){return GS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,s=-1){let a=this.docView.posFromDOM(e,n,s);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return ND(this,n||this.state,e)}pasteHTML(e,n){return Cd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Cd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return P0(this,e)}destroy(){this.docView&&(YD(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],pg(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ZO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return XD(this,e)}domSelectionRange(){let e=this.domSelection();return e?hs&&this.root.nodeType===11&&rD(this.dom.ownerDocument)==this.dom&&jL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}N2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function mN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let s in n)s=="class"?e.class+=" "+n[s]:s=="style"?e.style=(e.style?e.style+";":"")+n[s]:!e[s]&&s!="contenteditable"&&s!="nodeName"&&(e[s]=String(n[s]))}),e.translate||(e.translate="no"),[In.node(0,t.state.doc.content.size,e)]}function gN(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:In.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function PL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function yN(t){let e=Object.create(null);function n(s){for(let a in s)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=s[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function OL(t,e){let n=0,s=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)s++;return n!=s}function bN(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ai={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Wh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},DL=typeof navigator<"u"&&/Mac/.test(navigator.platform),LL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Qn=0;Qn<10;Qn++)Ai[48+Qn]=Ai[96+Qn]=String(Qn);for(var Qn=1;Qn<=24;Qn++)Ai[Qn+111]="F"+Qn;for(var Qn=65;Qn<=90;Qn++)Ai[Qn]=String.fromCharCode(Qn+32),Wh[Qn]=String.fromCharCode(Qn);for(var gg in Ai)Wh.hasOwnProperty(gg)||(Wh[gg]=Ai[gg]);function _L(t){var e=DL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||LL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wh:Ai)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const zL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),$L=typeof navigator<"u"&&/Win/.test(navigator.platform);function FL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let s,a,i,o;for(let c=0;c{for(var n in e)HL(t,n,{get:e[n],enumerable:!0})};function qf(t){const{state:e,transaction:n}=t;let{selection:s}=n,{doc:a}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return s},get doc(){return a},get tr(){return s=n.selection,a=n.doc,i=n.storedMarks,n}}}var Gf=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:s}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:s,state:a}=this,{view:i}=s,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...N)=>{const w=this.buildProps(u,e),v=g(...N)(w);return o.push(v),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,s=!1,a=t||n.tr,i=this.buildProps(a,s);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,s)}}buildProps(t,e=!0){const{rawCommands:n,editor:s,state:a}=this,{view:i}=s,o={tr:t,editor:s,view:i,state:qf({state:a,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},w2={};F0(w2,{blur:()=>WL,clearContent:()=>UL,clearNodes:()=>KL,command:()=>qL,createParagraphNear:()=>GL,cut:()=>JL,deleteCurrentNode:()=>YL,deleteNode:()=>QL,deleteRange:()=>XL,deleteSelection:()=>ZL,enter:()=>e8,exitCode:()=>t8,extendMarkRange:()=>n8,first:()=>s8,focus:()=>a8,forEach:()=>i8,insertContent:()=>o8,insertContentAt:()=>d8,joinBackward:()=>f8,joinDown:()=>h8,joinForward:()=>p8,joinItemBackward:()=>m8,joinItemForward:()=>g8,joinTextblockBackward:()=>x8,joinTextblockForward:()=>y8,joinUp:()=>u8,keyboardShortcut:()=>v8,lift:()=>N8,liftEmptyBlock:()=>w8,liftListItem:()=>j8,newlineInCode:()=>k8,resetAttributes:()=>S8,scrollIntoView:()=>C8,selectAll:()=>E8,selectNodeBackward:()=>T8,selectNodeForward:()=>M8,selectParentNode:()=>A8,selectTextblockEnd:()=>I8,selectTextblockStart:()=>R8,setContent:()=>P8,setMark:()=>Z8,setMeta:()=>e6,setNode:()=>t6,setNodeSelection:()=>n6,setTextDirection:()=>s6,setTextSelection:()=>r6,sinkListItem:()=>a6,splitBlock:()=>i6,splitListItem:()=>o6,toggleList:()=>l6,toggleMark:()=>c6,toggleNode:()=>d6,toggleWrap:()=>u6,undoInputRule:()=>h6,unsetAllMarks:()=>f6,unsetMark:()=>p6,unsetTextDirection:()=>m6,updateAttributes:()=>g6,wrapIn:()=>x6,wrapInList:()=>y6});var WL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),UL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),KL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:s}=e,{ranges:a}=s;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const N=ac(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(N||N===0)&&e.lift(y,N)})}),!0},qL=t=>e=>t(e),GL=()=>({state:t,dispatch:e})=>_S(t,e),JL=(t,e)=>({editor:n,tr:s})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);s.deleteRange(t.from,t.to);const o=s.mapping.map(e);return s.insert(o,i.content),s.setSelection(new Ze(s.doc.resolve(Math.max(o-1,0)))),!0},YL=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,s=n.$anchor.node();if(s.content.size>0)return!1;const a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===s.type){if(e){const c=a.before(i),u=a.after(i);t.delete(c,u).scrollIntoView()}return!0}return!1};function Sn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var QL=t=>({tr:e,state:n,dispatch:s})=>{const a=Sn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(s){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},XL=t=>({tr:e,dispatch:n})=>{const{from:s,to:a}=t;return n&&e.delete(s,a),!0},ZL=()=>({state:t,dispatch:e})=>S0(t,e),e8=()=>({commands:t})=>t.keyboardShortcut("Enter"),t8=()=>({state:t,dispatch:e})=>zO(t,e);function B0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Uh(t,e,n={strict:!0}){const s=Object.keys(e);return s.length?s.every(a=>n.strict?e[a]===t[a]:B0(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function j2(t,e,n={}){return t.find(s=>s.type===e&&Uh(Object.fromEntries(Object.keys(n).map(a=>[a,s.attrs[a]])),n))}function vN(t,e,n={}){return!!j2(t,e,n)}function V0(t,e,n){var s;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(f=>f.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(f=>f.type===e)||(n=n||((s=a.node.marks[0])==null?void 0:s.attrs),!j2([...a.node.marks],e,n)))return;let o=a.index,c=t.start()+a.offset,u=o+1,h=c+a.node.nodeSize;for(;o>0&&vN([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:s,dispatch:a})=>{const i=Ia(t,s.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=V0(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=Ze.create(o,m.from,m.to);n.setSelection(g)}}return!0},s8=t=>e=>{const n=typeof t=="function"?t(e):t;for(let s=0;s({editor:n,view:s,tr:a,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Kh()||NN())&&s.dom.focus(),r8()&&!Kh()&&!NN()&&s.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(s.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(s.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!k2(n.state.selection))return o(),!0;const c=S2(a.doc,t)||n.state.selection,u=n.state.selection.eq(c);return i&&(u||a.setSelection(c),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),o()),!0},i8=(t,e)=>n=>t.every((s,a)=>e(s,{...n,index:a})),o8=(t,e)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),C2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const s=e[n];s.nodeType===3&&s.nodeValue&&/^(\n\s\s|\n)$/.test(s.nodeValue)?t.removeChild(s):s.nodeType===1&&C2(s)}return t};function nh(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return C2(n)}function Td(t,e,n){if(t instanceof Sa||t instanceof ve)return t;n={slice:!0,parseOptions:{},...n};const s=typeof t=="object"&&t!==null,a=typeof t=="string";if(s)try{if(Array.isArray(t)&&t.length>0)return ve.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Td("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new dS({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?ki.fromSchema(u).parseSlice(nh(t),n.parseOptions):ki.fromSchema(u).parse(nh(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=ki.fromSchema(e);return n.slice?i.parseSlice(nh(t),n.parseOptions).content:i.parse(nh(t),n.parseOptions)}return Td("",e,n)}function l8(t,e,n){const s=t.steps.length-1;if(s{o===0&&(o=f)}),t.setSelection(rt.near(t.doc.resolve(o),n))}var c8=t=>!("type"in t),d8=(t,e,n)=>({tr:s,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Td(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(v){u(v)}try{c=Td(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((c8(c)?c:[c]).forEach(v=>{v.check(),g=g?v.isText&&v.marks.length===0:!1,y=y?v.isBlock:!1}),f===m&&y){const{parent:v}=s.doc.resolve(f);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(f-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(v=>v.text||"").join("");else if(e instanceof ve){let v="";e.forEach(k=>{k.text&&(v+=k.text)}),w=v}else typeof e=="object"&&e&&e.text?w=e.text:w=e;s.insertText(w,f,m)}else{w=c;const v=s.doc.resolve(f),k=v.node(),C=v.parentOffset===0,E=k.isText||k.isTextblock,M=k.content.size>0;C&&E&&M&&(f=Math.max(0,f-1)),s.replaceWith(f,m,w)}n.updateSelection&&l8(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:f,text:w}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:f,text:w})}return!0},u8=()=>({state:t,dispatch:e})=>DO(t,e),h8=()=>({state:t,dispatch:e})=>LO(t,e),f8=()=>({state:t,dispatch:e})=>AS(t,e),p8=()=>({state:t,dispatch:e})=>OS(t,e),m8=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Bf(t.doc,t.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},g8=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Bf(t.doc,t.selection.$from.pos,1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},x8=()=>({state:t,dispatch:e})=>PO(t,e),y8=()=>({state:t,dispatch:e})=>OO(t,e);function E2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function b8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let s,a,i,o;for(let c=0;c({editor:e,view:n,tr:s,dispatch:a})=>{const i=b8(t).split(/-(?!$)/),o=i.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(s.mapping);f&&a&&s.maybeStep(f)}),!0};function Ii(t,e,n={}){const{from:s,to:a,empty:i}=t.selection,o=e?Sn(e,t.schema):null,c=[];t.doc.nodesBetween(s,a,(m,g)=>{if(m.isText)return;const y=Math.max(s,g),N=Math.min(a,g+m.nodeSize);c.push({node:m,from:y,to:N})});const u=a-s,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Uh(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var N8=(t,e={})=>({state:n,dispatch:s})=>{const a=Sn(t,n.schema);return Ii(n,a,e)?_O(n,s):!1},w8=()=>({state:t,dispatch:e})=>zS(t,e),j8=t=>({state:e,dispatch:n})=>{const s=Sn(t,e.schema);return JO(s)(e,n)},k8=()=>({state:t,dispatch:e})=>LS(t,e);function Jf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function wN(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((s,a)=>(n.includes(a)||(s[a]=t[a]),s),{})}var S8=(t,e)=>({tr:n,state:s,dispatch:a})=>{let i=null,o=null;const c=Jf(typeof t=="string"?t:t.name,s.schema);if(!c)return!1;c==="node"&&(i=Sn(t,s.schema)),c==="mark"&&(o=Ia(t,s.schema));let u=!1;return n.selection.ranges.forEach(h=>{s.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,wN(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(wN(g.attrs,e))))})})}),u},C8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),E8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ws(t.doc);t.setSelection(n)}return!0},T8=()=>({state:t,dispatch:e})=>RS(t,e),M8=()=>({state:t,dispatch:e})=>DS(t,e),A8=()=>({state:t,dispatch:e})=>BO(t,e),I8=()=>({state:t,dispatch:e})=>WO(t,e),R8=()=>({state:t,dispatch:e})=>HO(t,e);function Nx(t,e,n={},s={}){return Td(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}var P8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:s={}}={})=>({editor:a,tr:i,dispatch:o,commands:c})=>{const{doc:u}=i;if(s.preserveWhitespace!=="full"){const h=Nx(t,a.schema,s,{errorOnInvalidContent:e??a.options.enableContentCheck});return o&&i.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:s,errorOnInvalidContent:e??a.options.enableContentCheck})};function T2(t,e){const n=Ia(e,t.schema),{from:s,to:a,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(s,a,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function M2(t,e){const n=new j0(t);return e.forEach(s=>{s.steps.forEach(a=>{n.step(a)})}),n}function O8(t){for(let e=0;e{n(a)&&s.push({node:a,pos:i})}),s}function A2(t,e){for(let n=t.depth;n>0;n-=1){const s=t.node(n);if(e(s))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:s}}}function Yf(t){return e=>A2(e.$from,t)}function qe(t,e,n){return t.config[e]===void 0&&t.parent?qe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?qe(t.parent,e,n):null}):t.config[e]}function H0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},s=qe(e,"addExtensions",n);return s?[e,...H0(s())]:e}).flat(10)}function W0(t,e){const n=Wo.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function I2(t){return typeof t=="function"}function jt(t,e=void 0,...n){return I2(t)?e?t.bind(e)(...n):t(...n):t}function L8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Gl(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),s=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:s}}function R2(t){const e=[],{nodeExtensions:n,markExtensions:s}=Gl(t),a=[...n,...s],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=s.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=qe(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let N;Array.isArray(y.types)?N=y.types:y.types==="*"?N=u:y.types==="nodes"?N=o:y.types==="marks"?N=c:N=[],N.forEach(w=>{Object.entries(y.attributes).forEach(([v,k])=>{e.push({type:w,name:v,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=qe(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,N])=>{const w={...i,...N};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:h.name,name:y,attribute:w})})}),e}function _8(t){const e=[];let n="",s=!1,a=!1,i=0;const o=t.length;for(let c=0;c0){i-=1,n+=u;continue}if(u===";"&&i===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function jN(t){const e=[],n=_8(t||""),s=n.length;for(let a=0;a!!e).reduce((e,n)=>{const s={...e};return Object.entries(n).forEach(([a,i])=>{if(!s[a]){s[a]=i;return}if(a==="class"){const c=i?String(i).split(" "):[],u=s[a]?s[a].split(" "):[],h=c.filter(f=>!u.includes(f));s[a]=[...u,...h].join(" ")}else if(a==="style"){const c=new Map([...jN(s[a]),...jN(i)]);s[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else s[a]=i}),s},{})}function Md(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,s)=>Ct(n,s),{})}function z8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function kN(t,e){return"style"in t?t:{...t,getAttrs:n=>{const s=t.getAttrs?t.getAttrs(n):t.attrs;if(s===!1)return!1;const a=e.reduce((i,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):z8(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...s,...a}}}}function SN(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&L8(n)?!1:n!=null))}function CN(t){var e,n;const s={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(s.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(s.validate=t.attribute.validate),[t.name,s]}function $8(t,e){var n;const s=R2(t),{nodeExtensions:a,markExtensions:i}=Gl(t),o=(n=a.find(h=>qe(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=s.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,C)=>{const E=qe(C,"extendNodeSchema",m);return{...k,...E?E(h):{}}},{}),y=SN({...g,content:jt(qe(h,"content",m)),marks:jt(qe(h,"marks",m)),group:jt(qe(h,"group",m)),inline:jt(qe(h,"inline",m)),atom:jt(qe(h,"atom",m)),selectable:jt(qe(h,"selectable",m)),draggable:jt(qe(h,"draggable",m)),code:jt(qe(h,"code",m)),whitespace:jt(qe(h,"whitespace",m)),linebreakReplacement:jt(qe(h,"linebreakReplacement",m)),defining:jt(qe(h,"defining",m)),isolating:jt(qe(h,"isolating",m)),attrs:Object.fromEntries(f.map(CN))}),N=jt(qe(h,"parseHTML",m));N&&(y.parseDOM=N.map(k=>kN(k,f)));const w=qe(h,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:Md(k,f)}));const v=qe(h,"renderText",m);return v&&(y.toText=v),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=s.filter(v=>v.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((v,k)=>{const C=qe(k,"extendMarkSchema",m);return{...v,...C?C(h):{}}},{}),y=SN({...g,inclusive:jt(qe(h,"inclusive",m)),excludes:jt(qe(h,"excludes",m)),group:jt(qe(h,"group",m)),spanning:jt(qe(h,"spanning",m)),code:jt(qe(h,"code",m)),attrs:Object.fromEntries(f.map(CN))}),N=jt(qe(h,"parseHTML",m));N&&(y.parseDOM=N.map(v=>kN(v,f)));const w=qe(h,"renderHTML",m);return w&&(y.toDOM=v=>w({mark:v,HTMLAttributes:Md(v,f)})),[h.name,y]}));return new dS({topNode:o,nodes:c,marks:u})}function F8(t){const e=t.filter((n,s)=>t.indexOf(n)!==s);return Array.from(new Set(e))}function cd(t){return t.sort((n,s)=>{const a=qe(n,"priority")||100,i=qe(s,"priority")||100;return a>i?-1:as.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(s=>`'${s}'`).join(", ")}]. This can lead to issues.`),e}function O2(t,e,n){const{from:s,to:a}=e,{blockSeparator:i=`
-
-`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(s,a,(u,h,f,m)=>{var g;u.isBlock&&h>s&&(c+=i);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(s,h)-h,a-h))}),c}function B8(t,e){const n={from:0,to:t.content.size};return O2(t,n,e)}function D2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function V8(t,e){const n=Sn(e,t.schema),{from:s,to:a}=t.selection,i=[];t.doc.nodesBetween(s,a,c=>{i.push(c)});const o=i.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function L2(t,e){const n=Jf(typeof e=="string"?e:e.name,t.schema);return n==="node"?V8(t,e):n==="mark"?T2(t,e):{}}function H8(t,e=JSON.stringify){const n={};return t.filter(s=>{const a=e(s);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function W8(t){const e=H8(t);return e.length===1?e:e.filter((n,s)=>!e.filter((i,o)=>o!==s).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function _2(t){const{mapping:e,steps:n}=t,s=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);s.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),W8(s)}function U0(t,e,n){const s=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=V0(i,a.type);o&&s.push({mark:a,...o})}):n.nodesBetween(t,e,(a,i)=>{!a||(a==null?void 0:a.nodeSize)===void 0||s.push(...a.marks.map(o=>({from:i,to:i+a.nodeSize,mark:o})))}),s}var U8=(t,e,n,s=20)=>{const a=t.doc.resolve(n);let i=s,o=null;for(;i>0&&o===null;){const c=a.node(i);(c==null?void 0:c.type.name)===e?o=c:i-=1}return[o,i]};function Kc(t,e){return e.nodes[t]||e.marks[t]||null}function vh(t,e,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const a=t.find(i=>i.type===e&&i.name===s);return a?a.attribute.keepOnSplit:!1}))}var K8=(t,e=500)=>{let n="";const s=t.parentOffset;return t.parent.nodesBetween(Math.max(0,s-e),s,(a,i,o,c)=>{var u,h;const f=((h=(u=a.type.spec).toText)==null?void 0:h.call(u,{node:a,pos:i,parent:o,index:c}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?f:f.slice(0,Math.max(0,s-i))}),n};function wx(t,e,n={}){const{empty:s,ranges:a}=t.selection,i=e?Ia(e,t.schema):null;if(s)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Uh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const y=m.pos,N=g.pos;t.doc.nodesBetween(y,N,(w,v)=>{if(i&&w.inlineContent&&!w.type.allowsMarkType(i))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(y,v),C=Math.min(N,v+w.nodeSize),E=C-k;o+=E,c.push(...w.marks.map(M=>({mark:M,from:k,to:C})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Uh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function q8(t,e,n={}){if(!e)return Ii(t,null,n)||wx(t,null,n);const s=Jf(e,t.schema);return s==="node"?Ii(t,e,n):s==="mark"?wx(t,e,n):!1}var G8=(t,e)=>{const{$from:n,$to:s,$anchor:a}=t.selection;if(e){const i=Yf(c=>c.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return a.pos+1===o.end()}return!(s.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function EN(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function TN(t,e){const{nodeExtensions:n}=Gl(e),s=n.find(o=>o.name===t);if(!s)return!1;const a={name:s.name,options:s.options,storage:s.storage},i=jt(qe(s,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Qf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var s;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((s=t.text)!=null?s:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let a=!0;return t.content.forEach(i=>{a!==!1&&(Qf(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function z2(t){return t instanceof Xe}var $2=class F2{constructor(e){this.position=e}static fromJSON(e){return new F2(e.position)}toJSON(){return{position:this.position}}};function Y8(t,e){const n=e.mapping.mapResult(t.position);return{position:new $2(n.pos),mapResult:n}}function Q8(t){return new $2(t)}function X8(t,e,n){var s;const{selection:a}=e;let i=null;if(k2(a)&&(i=a.$cursor),i){const c=(s=t.storedMarks)!=null?s:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),N=!!n.isInSet(f.marks)||!f.marks.some(w=>w.type.excludes(n));h=y&&N}return!h}),h})}var Z8=(t,e={})=>({tr:n,state:s,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=Ia(t,s.schema);if(a)if(o){const h=T2(s,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;s.doc.nodesBetween(f,m,(g,y)=>{const N=Math.max(y,f),w=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(N,w,u.create({...k.attrs,...e}))}):n.addMark(N,w,u.create(e))})});return X8(s,n,u)},e6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),t6=(t,e={})=>({state:n,dispatch:s,chain:a})=>{const i=Sn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?a().command(({commands:c})=>F1(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>F1(i,{...o,...e})(c,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},n6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,a=wo(t,0,s.content.size),i=Xe.create(s,a);e.setSelection(i)}return!0},s6=(t,e)=>({tr:n,state:s,dispatch:a})=>{const{selection:i}=s;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=i.from,c=i.to),a&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},r6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Ze.atStart(s).from,c=Ze.atEnd(s).to,u=wo(a,o,c),h=wo(i,o,c),f=Ze.create(s,u,h);e.setSelection(f)}return!0},a6=t=>({state:e,dispatch:n})=>{const s=Sn(t,e.schema);return XO(s)(e,n)};function MN(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const s=n.filter(a=>e==null?void 0:e.includes(a.type.name));t.tr.ensureMarks(s)}}var i6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:s,editor:a})=>{const{selection:i,doc:o}=e,{$from:c,$to:u}=i,h=a.extensionManager.attributes,f=vh(h,c.node().type.name,c.node().attrs);if(i instanceof Xe&&i.node.isBlock)return!c.parentOffset||!Ca(o,c.pos)?!1:(s&&(t&&MN(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:O8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,N=Ca(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!N&&Ca(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(N=!0,y=g?[{type:g,attrs:f}]:void 0),s){if(N&&(i instanceof Ze&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),v=e.doc.resolve(w);c.node(-1).canReplaceWith(v.index(),v.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&MN(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return N},o6=(t,e={})=>({tr:n,state:s,dispatch:a,editor:i})=>{var o;const c=Sn(t,s.schema),{$from:u,$to:h}=s.selection,f=s.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=ve.empty;const C=u.index(-1)?1:u.index(-2)?2:3;for(let R=u.depth-C;R>=u.depth-3;R-=1)k=ve.from(u.node(R).copy(k));const E=u.indexAfter(-1){if(D>-1)return!1;R.isTextblock&&R.content.size===0&&(D=O+1)}),D>-1&&n.setSelection(Ze.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,N={...vh(g,m.type.name,m.attrs),...e},w={...vh(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const v=y?[{type:c,attrs:N},{type:y,attrs:w}]:[{type:c,attrs:N}];if(!Ca(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:C}=s,{splittableMarks:E}=i.extensionManager,M=C||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!M||!a)return!0;const P=M.filter($=>E.includes($.type.name));n.ensureMarks(P)}return!0},yg=(t,e)=>{const n=Yf(o=>o.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(s===void 0)return!0;const a=t.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&zi(t.doc,n.pos)&&t.join(n.pos),!0},bg=(t,e)=>{const n=Yf(o=>o.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(n.start).after(n.depth);if(s===void 0)return!0;const a=t.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&zi(t.doc,s)&&t.join(s),!0},l6=(t,e,n,s={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,y=Sn(t,o.schema),N=Sn(e,o.schema),{selection:w,storedMarks:v}=o,{$from:k,$to:C}=w,E=k.blockRange(C),M=v||w.$to.parentOffset&&w.$from.marks();if(!E)return!1;const P=Yf($=>TN($.type.name,m))(w);if(E.depth>=1&&P&&E.depth-P.depth<=1){if(P.node.type===y)return h.liftListItem(N);if(TN(P.node.type.name,m)&&y.validContent(P.node.content)&&c)return u().command(()=>(i.setNodeMarkup(P.pos,y),!0)).command(()=>yg(i,y)).command(()=>bg(i,y)).run()}return!n||!M||!c?u().command(()=>f().wrapInList(y,s)?!0:h.clearNodes()).wrapInList(y,s).command(()=>yg(i,y)).command(()=>bg(i,y)).run():u().command(()=>{const $=f().wrapInList(y,s),D=M.filter(R=>g.includes(R.type.name));return i.ensureMarks(D),$?!0:h.clearNodes()}).wrapInList(y,s).command(()=>yg(i,y)).command(()=>bg(i,y)).run()},c6=(t,e={},n={})=>({state:s,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ia(t,s.schema);return wx(s,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},d6=(t,e,n={})=>({state:s,commands:a})=>{const i=Sn(t,s.schema),o=Sn(e,s.schema),c=Ii(s,i,n);let u;return s.selection.$anchor.sameParent(s.selection.$head)&&(u=s.selection.$anchor.parent.attrs),c?a.setNode(o,u):a.setNode(i,{...u,...n})},u6=(t,e={})=>({state:n,commands:s})=>{const a=Sn(t,n.schema);return Ii(n,a,e)?s.lift(a):s.wrapIn(a,e)},h6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let s=0;s=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(i.text){const u=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else o.delete(i.from,i.to)}return!0}}return!1},f6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:s,ranges:a}=n;return s||e&&a.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},p6=(t,e={})=>({tr:n,state:s,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=Ia(t,s.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:y}=c;const N=(i=h.marks().find(v=>v.type===u))==null?void 0:i.attrs,w=V0(h,u,N);w&&(g=w.from,y=w.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},m6=t=>({tr:e,state:n,dispatch:s})=>{const{selection:a}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=a.from,o=a.to),s&&e.doc.nodesBetween(i,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},g6=(t,e={})=>({tr:n,state:s,dispatch:a})=>{let i=null,o=null;const c=Jf(typeof t=="string"?t:t.name,s.schema);if(!c)return!1;c==="node"&&(i=Sn(t,s.schema)),c==="mark"&&(o=Ia(t,s.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,N,w;n.selection.empty?s.doc.nodesBetween(f,m,(v,k)=>{i&&i===v.type&&(u=!0,N=Math.max(k,f),w=Math.min(k+v.nodeSize,m),g=k,y=v)}):s.doc.nodesBetween(f,m,(v,k)=>{k=f&&k<=m&&(i&&i===v.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(C=>{if(o===C.type&&(u=!0,a)){const E=Math.max(k,f),M=Math.min(k+v.nodeSize,m);n.addMark(E,M,o.create({...C.attrs,...e}))}}))}),y&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(v=>{o===v.type&&a&&n.addMark(N,w,o.create({...v.attrs,...e}))}))}),u},x6=(t,e={})=>({state:n,dispatch:s})=>{const a=Sn(t,n.schema);return UO(a,e)(n,s)},y6=(t,e={})=>({state:n,dispatch:s})=>{const a=Sn(t,n.schema);return KO(a,e)(n,s)},b6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(s=>s.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(s=>s!==e):delete this.callbacks[t]),this}once(t,e){const n=(...s)=>{this.off(t,n),e.apply(this,s)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Xf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},v6=(t,e)=>{if(B0(e))return e.exec(t);const n=e(t);if(!n)return null;const s=[n.text];return s.index=n.index,s.input=t,s.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),s.push(n.replaceWith)),s};function sh(t){var e;const{editor:n,from:s,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(s);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=K8(h)+i;return o.forEach(g=>{if(f)return;const y=v6(m,g.find);if(!y)return;const N=u.state.tr,w=qf({state:u.state,transaction:N}),v={from:s-(y[0].length-i.length),to:a},{commands:k,chain:C,can:E}=new Gf({editor:n,state:w});g.handler({state:w,range:v,match:y,commands:k,chain:C,can:E})===null||!N.steps.length||(g.undoable&&N.setMeta(c,{transform:N,from:s,to:a,text:i}),u.dispatch(N),f=!0)}),f}function N6(t){const{editor:e,rules:n}=t,s=new Wt({state:{init(){return null},apply(a,i,o){const c=a.getMeta(s);if(c)return c;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=W0(ve.from(f),o.schema);const{from:m}=u,g=m+f.length;sh({editor:e,from:m,to:g,text:f,rules:n,plugin:s})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return sh({editor:e,from:i,to:o,text:c,rules:n,plugin:s})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&sh({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:s})}),!1)},handleKeyDown(a,i){if(i.key!=="Enter")return!1;const{$cursor:o}=a.state.selection;return o?sh({editor:e,from:o.pos,to:o.pos,text:`
-`,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function w6(t){return Object.prototype.toString.call(t).slice(8,-1)}function rh(t){return w6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function B2(t,e){const n={...t};return rh(t)&&rh(e)&&Object.keys(e).forEach(s=>{rh(e[s])&&rh(t[s])?n[s]=B2(t[s],e[s]):n[s]=e[s]}),n}var K0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...jt(qe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...jt(qe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>B2(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Uo=class V2 extends K0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new V2(n)}static handleExit({editor:e,mark:n}){const{tr:s}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const o=a.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&s.removeStoredMark(u),s.insertText(" ",a.pos),e.view.dispatch(s),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function j6(t){return typeof t=="number"}var k6=class{constructor(t){this.find=t.find,this.handler=t.handler}},S6=(t,e,n)=>{if(B0(e))return[...t.matchAll(e)];const s=e(t,n);return s?s.map(a=>{const i=[a.text];return i.index=a.index,i.input=t,i.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(a.replaceWith)),i}):[]};function C6(t){const{editor:e,state:n,from:s,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Gf({editor:e,state:n}),m=[];return n.doc.nodesBetween(s,a,(y,N)=>{var w,v,k,C,E;if((v=(w=y.type)==null?void 0:w.spec)!=null&&v.code||!(y.isText||y.isTextblock||y.isInline))return;const M=(E=(C=(k=y.content)==null?void 0:k.size)!=null?C:y.nodeSize)!=null?E:0,P=Math.max(s,N),$=Math.min(a,N+M);if(P>=$)return;const D=y.isText?y.text||"":y.textBetween(P-N,$-N,void 0,"");S6(D,i.find,o).forEach(O=>{if(O.index===void 0)return;const _=P+O.index+1,se=_+O[0].length,ne={from:n.tr.mapping.map(_),to:n.tr.mapping.map(se)},pe=i.handler({state:n,range:ne,match:O,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(pe)})}),m.every(y=>y!==null)}var ah=null,E6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function T6(t){const{editor:e,rules:n}=t;let s=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:N})=>{const w=f.tr,v=qf({state:f,transaction:w});if(!(!C6({editor:e,state:v,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:N,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(f=>new Wt({view(m){const g=N=>{var w;s=(w=m.dom.parentElement)!=null&&w.contains(N.target)?m.dom.parentElement:null,s&&(ah=e)},y=()=>{ah&&(ah=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=s===m.dom.parentElement,c=g,!i){const y=ah;y!=null&&y.isEditable&&setTimeout(()=>{const N=y.state.selection;N&&y.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(m,g)=>{var y;const N=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const N=m[0],w=N.getMeta("uiEvent")==="paste"&&!a,v=N.getMeta("uiEvent")==="drop"&&!i,k=N.getMeta("applyPasteRules"),C=!!k;if(!w&&!v&&!C)return;if(C){let{text:P}=k;typeof P=="string"?P=P:P=W0(ve.from(P),y.schema);const{from:$}=k,D=$+P.length,R=E6(P);return u({rule:f,state:y,from:$,to:{b:D},pasteEvt:R})}const E=g.doc.content.findDiffStart(y.doc.content),M=g.doc.content.findDiffEnd(y.doc.content);if(!(!j6(E)||!M||E===M.b))return u({rule:f,state:y,from:E,to:M,pasteEvt:o})}}))}var Zf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=P2(t),this.schema=$8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Kc(e.name,this.schema)},s=qe(e,"addCommands",n);return s?{...t,...s()}:t},{})}get plugins(){const{editor:t}=this;return cd([...this.extensions].reverse()).flatMap(s=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:t,type:Kc(s.name,this.schema)},i=[],o=qe(s,"addKeyboardShortcuts",a);let c={};if(s.type==="mark"&&qe(s,"exitable",a)&&(c.ArrowRight=()=>Uo.handleExit({editor:t,mark:s})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,N])=>[y,()=>N({editor:t})]));c={...c,...g}}const u=VL(c);i.push(u);const h=qe(s,"addInputRules",a);if(EN(s,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=N6({editor:t,rules:g}),N=Array.isArray(y)?y:[y];i.push(...N)}}const f=qe(s,"addPasteRules",a);if(EN(s,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=T6({editor:t,rules:g});i.push(...y)}}const m=qe(s,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return R2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Gl(this.extensions);return Object.fromEntries(e.filter(n=>!!qe(n,"addNodeView")).map(n=>{const s=this.attributes.filter(u=>u.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Sn(n.name,this.schema)},i=qe(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const y=Md(u,s);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return cd([...this.extensions].reverse()).reduceRight((s,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Kc(a.name,this.schema)},o=qe(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:s})}:s},t)}transformPastedHTML(t){const{editor:e}=this;return cd([...this.extensions]).reduce((s,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Kc(a.name,this.schema)},o=qe(a,"transformPastedHTML",i);return o?(c,u)=>{const h=s(c,u);return o.call(i,h)}:s},t||(s=>s))}get markViews(){const{editor:t}=this,{markExtensions:e}=Gl(this.extensions);return Object.fromEntries(e.filter(n=>!!qe(n,"addMarkView")).map(n=>{const s=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ia(n.name,this.schema)},i=qe(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=Md(c,s);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{H6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Kc(e.name,this.schema)};e.type==="mark"&&((n=jt(qe(e,"keepOnSplit",s)))==null||n)&&this.splittableMarks.push(e.name);const a=qe(e,"onBeforeCreate",s),i=qe(e,"onCreate",s),o=qe(e,"onUpdate",s),c=qe(e,"onSelectionUpdate",s),u=qe(e,"onTransaction",s),h=qe(e,"onFocus",s),f=qe(e,"onBlur",s),m=qe(e,"onDestroy",s);a&&this.editor.on("beforeCreate",a),i&&this.editor.on("create",i),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};Zf.resolve=P2;Zf.sort=cd;Zf.flatten=H0;var M6={};F0(M6,{ClipboardTextSerializer:()=>W2,Commands:()=>U2,Delete:()=>K2,Drop:()=>q2,Editable:()=>G2,FocusEvents:()=>Y2,Keymap:()=>Q2,Paste:()=>X2,Tabindex:()=>Z2,TextDirection:()=>eC,focusEventsPluginKey:()=>J2});var xn=class H2 extends K0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new H2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},W2=xn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Wt({key:new nn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:s,selection:a}=e,{ranges:i}=a,o=Math.min(...i.map(f=>f.$from.pos)),c=Math.max(...i.map(f=>f.$to.pos)),u=D2(n);return O2(s,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),U2=xn.create({name:"commands",addCommands(){return{...w2}}}),K2=xn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,s,a;const i=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=M2(t.before,[t,...e]);_2(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(N,w)=>{const v=w+N.nodeSize-2,k=y.oldRange.from<=w&&v<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:N,from:w,to:v,newFrom:f.mapping.map(w),newTo:f.mapping.map(v),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,N)=>{var w,v;if(y instanceof jr){const k=g.slice(N).map(y.from,-1),C=g.slice(N).map(y.to),E=g.invert().map(k,-1),M=g.invert().map(C),P=(w=f.doc.nodeAt(k-1))==null?void 0:w.marks.some(D=>D.eq(y.mark)),$=(v=f.doc.nodeAt(C))==null?void 0:v.marks.some(D=>D.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:E,to:M},newRange:{from:k,to:C},partial:!!($||P),editor:this.editor,transaction:t,combinedTransform:f})}})};(a=(s=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:s.async)==null||a?setTimeout(i,0):i()}}),q2=xn.create({name:"drop",addProseMirrorPlugins(){return[new Wt({key:new nn("tiptapDrop"),props:{handleDrop:(t,e,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:s})}}})]}}),G2=xn.create({name:"editable",addProseMirrorPlugins(){return[new Wt({key:new nn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),J2=new nn("focusEvents"),Y2=xn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Wt({key:J2,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const s=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(s),!1},blur:(e,n)=>{t.isFocused=!1;const s=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(s),!1}}}})]}}),Q2=xn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,N=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,w=N.parent.type.spec.isolating,v=m.pos-m.parentOffset,k=w&&N.parent.childCount===1?v===m.pos:rt.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...s},i={...s,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Kh()||E2()?i:a},addProseMirrorPlugins(){return[new Wt({key:new nn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const s=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),a=t.some(w=>w.getMeta("preventClearDocument"));if(!s||a)return;const{empty:i,from:o,to:c}=e.selection,u=rt.atStart(e.doc).from,h=rt.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Qf(n.doc))return;const g=n.tr,y=qf({state:n,transaction:g}),{commands:N}=new Gf({editor:this.editor,state:y});if(N.clearNodes(),!!g.steps.length)return g}})]}}),X2=xn.create({name:"paste",addProseMirrorPlugins(){return[new Wt({key:new nn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Z2=xn.create({name:"tabindex",addProseMirrorPlugins(){return[new Wt({key:new nn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),eC=xn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Gl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Wt({key:new nn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),A6=class Xc{constructor(e,n,s=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=e,this.editor=n,this.currentNode=a}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,s=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,s=this.to-1}this.editor.commands.insertContentAt({from:n,to:s},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Xc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Xc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Xc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,s)=>{const a=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+s+(i?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!a&&!o&&u.depth<=this.depth)return;const h=new Xc(u,this.editor,a,a||o?n:null);a&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let s=null,a=this.parent;for(;a&&!s;){if(a.node.type.name===e)if(Object.keys(n).length>0){const i=a.node.attrs,o=Object.keys(n);for(let c=0;c{s&&a.length>0||(o.node.type.name===e&&i.every(u=>n[u]===o.node.attrs[u])&&a.push(o),!(s&&a.length>0)&&(a=a.concat(o.querySelectorAll(e,n,s))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},I6=`.ProseMirror {
- position: relative;
-}
-
-.ProseMirror {
- word-wrap: break-word;
- white-space: pre-wrap;
- white-space: break-spaces;
- -webkit-font-variant-ligatures: none;
- font-variant-ligatures: none;
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
-}
-
-.ProseMirror [contenteditable="false"] {
- white-space: normal;
-}
-
-.ProseMirror [contenteditable="false"] [contenteditable="true"] {
- white-space: pre-wrap;
-}
-
-.ProseMirror pre {
- white-space: pre-wrap;
-}
-
-img.ProseMirror-separator {
- display: inline !important;
- border: none !important;
- margin: 0 !important;
- width: 0 !important;
- height: 0 !important;
-}
-
-.ProseMirror-gapcursor {
- display: none;
- pointer-events: none;
- position: absolute;
- margin: 0;
-}
-
-.ProseMirror-gapcursor:after {
- content: "";
- display: block;
- position: absolute;
- top: -2px;
- width: 20px;
- border-top: 1px solid black;
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
-}
-
-@keyframes ProseMirror-cursor-blink {
- to {
- visibility: hidden;
- }
-}
-
-.ProseMirror-hideselection *::selection {
- background: transparent;
-}
-
-.ProseMirror-hideselection *::-moz-selection {
- background: transparent;
-}
-
-.ProseMirror-hideselection * {
- caret-color: transparent;
-}
-
-.ProseMirror-focused .ProseMirror-gapcursor {
- display: block;
-}`;function R6(t,e,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}var P6=class extends b6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:s})=>{throw s},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Y8,createMappablePosition:Q8},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:s,slice:a,moved:i})=>this.options.onDrop(s,a,i)),this.on("paste",({event:s,slice:a})=>this.options.onPaste(s,a)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=S2(e,this.options.autofocus);this.editorState=_l.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=R6(I6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=I2(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],s=this.state.reconfigure({plugins:n});return this.view.updateState(s),s}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(a=>{const i=typeof a=="string"?`${a}$`:a.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const s=this.state.reconfigure({plugins:n});return this.view.updateState(s),s}createExtensionManager(){var t,e;const s=[...this.options.enableCoreExtensions?[G2,W2.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),U2,Y2,Q2,Z2,q2,X2,K2,eC.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new Zf(s,this)}createCommandManager(){this.commandManager=new Gf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Nx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Nx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,s=e.dispatchTransaction||this.dispatchTransaction.bind(this),a=n?this.extensionManager.dispatchTransaction(s):s,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new N2(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:a,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),s=!this.state.selection.eq(e.selection),a=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!a)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),s&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return L2(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,s=typeof t=="string"?e:t;return q8(this.state,n,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return W0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
-
-`,textSerializers:n={}}=t||{};return B8(this.state.doc,{blockSeparator:e,textSerializers:{...D2(this.schema),...n}})}get isEmpty(){return Qf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new A6(e,this)}get $doc(){return this.$pos(0)}};function Jl(t){return new Xf({find:t.find,handler:({state:e,range:n,match:s})=>{const a=jt(t.getAttributes,void 0,s);if(a===!1||a===null)return null;const{tr:i}=e,o=s[s.length-1],c=s[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(U0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function tC(t){return new Xf({find:t.find,handler:({state:e,range:n,match:s})=>{const a=jt(t.getAttributes,void 0,s)||{},{tr:i}=e,o=n.from;let c=n.to;const u=t.type.create(a);if(s[1]){const h=s[0].lastIndexOf(s[1]);let f=o+h;f>c?f=c:c=f+s[1].length;const m=s[0][s[0].length-1];i.insertText(m,o+s[0].length-1),i.replaceWith(f,c,u)}else if(s[0]){const h=t.type.isInline?o:o-1;i.insert(h,t.type.create(a)).delete(i.mapping.map(o),i.mapping.map(c))}i.scrollIntoView()},undoable:t.undoable})}function jx(t){return new Xf({find:t.find,handler:({state:e,range:n,match:s})=>{const a=e.doc.resolve(n.from),i=jt(t.getAttributes,void 0,s)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Yl(t){return new Xf({find:t.find,handler:({state:e,range:n,match:s,chain:a})=>{const i=jt(t.getAttributes,void 0,s)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&w0(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,N=g||m.$to.parentOffset&&m.$from.marks();if(N){const w=N.filter(v=>y.includes(v.type.name));o.ensureMarks(w)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&zi(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(s,f))&&o.join(n.from-1)},undoable:t.undoable})}var O6=t=>"touches"in t,D6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,s,a,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(s=t==null?void 0:t.options)!=null&&s.directions&&(this.directions=t.options.directions),(a=t.options)!=null&&a.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),s=e.includes("bottom"),a=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),s&&(t.style.bottom="0"),a&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,O6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:s,height:a}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(s,a,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let s=this.startWidth,a=this.startHeight;const i=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return i?s=this.startWidth+e:o&&(s=this.startWidth-e),c?a=this.startHeight+n:u&&(a=this.startHeight-n),(t==="right"||t==="left")&&(s=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(a=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(s,a,t):{width:s,height:a}}applyConstraints(t,e,n){var s,a,i,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(s=this.maxSize)!=null&&s.width&&(h=Math.min(this.maxSize.width,h)),(a=this.maxSize)!=null&&a.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const s=n==="left"||n==="right",a=n==="top"||n==="bottom";return s?{width:t,height:t/this.aspectRatio}:a?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function L6(t,e){const{selection:n}=t,{$from:s}=n;if(n instanceof Xe){const i=s.index();return s.parent.canReplaceWith(i,i+1,e)}let a=s.depth;for(;a>=0;){const i=s.index(a);if(s.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function _6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var z6={};F0(z6,{createAtomBlockMarkdownSpec:()=>$6,createBlockMarkdownSpec:()=>F6,createInlineMarkdownSpec:()=>nC,parseAttributes:()=>q0,parseIndentedBlocks:()=>kx,renderNestedMarkdownContent:()=>J0,serializeAttributes:()=>G0});function q0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],s=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=s.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=s.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(s.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=s.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function G0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(s=>e.push(`.${s}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,s])=>{n==="class"||n==="id"||(s===!0?e.push(n):s!==!1&&s!=null&&e.push(`${n}="${String(s)}"`))}),e.join(" ")}function $6(t){const{nodeName:e,name:n,parseAttributes:s=q0,serializeAttributes:a=G0,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),N=f.match(y);if(!N)return;const w=N[1]||"",v=s(w);if(!o.find(C=>!(C in v)))return{type:e,raw:N[0],attributes:v}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function F6(t){const{nodeName:e,name:n,getContent:s,parseAttributes:a=q0,serializeAttributes:i=G0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(s){const w=s(m);y=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const N={...o,...m.attributes};return g.createNode(e,N,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),N=(g=m.match(y))==null?void 0:g.index;return N!==void 0?N:-1},tokenize(m,g,y){var N;const w=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=m.match(w);if(!v)return;const[k,C=""]=v,E=a(C);let M=1;const P=k.length;let $="";const D=/^:::([\w-]*)(\s.*)?/gm,R=m.slice(P);for(D.lastIndex=0;;){const O=D.exec(R);if(O===null)break;const _=O.index,se=O[1];if(!((N=O[2])!=null&&N.endsWith(":::"))){if(se)M+=1;else if(M-=1,M===0){const ne=R.slice(0,_);$=ne.trim();const pe=m.slice(0,P+_+O[0].length);let ge=[];if($)if(c==="block")for(ge=y.blockTokens(ne),ge.forEach(z=>{z.text&&(!z.tokens||z.tokens.length===0)&&(z.tokens=y.inlineTokens(z.text))});ge.length>0;){const z=ge[ge.length-1];if(z.type==="paragraph"&&(!z.text||z.text.trim()===""))ge.pop();else break}else ge=y.inlineTokens($);return{type:e,raw:pe,attributes:E,content:$,tokens:ge}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),N=i(y),w=N?` {${N}}`:"",v=g.renderChildren(m.content||[],`
-
-`);return`:::${h}${w}
-
-${v}
-
-:::`}}}function B6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let s=n.exec(t);for(;s!==null;){const[,a,i,o]=s;e[a]=i||o,s=n.exec(t)}return e}function V6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function nC(t){const{nodeName:e,name:n,getContent:s,parseAttributes:a=B6,serializeAttributes:i=V6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(N=>{const w=typeof N=="string"?N:N.name,v=typeof N=="string"?void 0:N.skipIfDefault;if(w in g){const k=g[w];if(v!==void 0&&k===v)return;y[w]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const N={...o,...g.attributes};if(c)return y.createNode(e,N);const w=s?s(g):g.content||"";return w?y.createNode(e,N,[y.createTextNode(w)]):y.createNode(e,N,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),N=g.match(y),w=N==null?void 0:N.index;return w!==void 0?w:-1},tokenize(g,y,N){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),v=g.match(w);if(!v)return;let k="",C="";if(c){const[,M]=v;C=M}else{const[,M,P]=v;C=M,k=P||""}const E=a(C.trim());return{type:e,raw:v[0],content:k.trim(),attributes:E}}},renderMarkdown:g=>{let y="";s?y=s(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const N=f(g.attrs||{}),w=i(N),v=w?` ${w}`:"";return c?`[${h}${v}]`:`[${h}${v}]${y}[/${h}]`}}}function kx(t,e,n){var s,a,i,o;const c=t.split(`
-`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g}
-`;continue}else return}const N=e.extractItemData(y),{indentLevel:w,mainContent:v}=N;h=`${h}${g}
-`;const k=[v];for(f+=1;f_.trim()!=="");if(D===-1)break;if((((a=(s=c[f+1+D].match(/^(\s*)/))==null?void 0:s[1])==null?void 0:a.length)||0)>w){k.push(P),h=`${h}${P}
-`,f+=1;continue}else break}if((((o=(i=P.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>w)k.push(P),h=`${h}${P}
-`,f+=1;else break}let C;const E=k.slice(1);if(E.length>0){const P=E.map($=>$.slice(w+m)).join(`
-`);P.trim()&&(e.customNestedParser?C=e.customNestedParser(P):C=n.blockTokens(P))}const M=e.createToken(N,C);u.push(M)}if(u.length!==0)return{items:u,raw:h}}function J0(t,e,n,s){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(s):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(`
-`).map(g=>g?e.indent(g):"").join(`
-`);u.push(m)}}),u.join(`
-`)}function H6(t,e,n={}){const{state:s}=e,{doc:a,tr:i}=s,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,y)}}),i.docChanged&&e.view.dispatch(i)}var Cn=class sC extends K0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new sC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function zo(t){return new k6({find:t.find,handler:({state:e,range:n,match:s,pasteEvent:a})=>{const i=jt(t.getAttributes,void 0,s,a);if(i===!1||i===null)return null;const{tr:o}=e,c=s[s.length-1],u=s[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(U0(n.from,n.to,e.doc).filter(N=>N.mark.type.excluded.find(v=>v===t.type&&v!==N.mark.type)).filter(N=>N.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:W6,getOwnPropertySymbols:U6}=Object,{hasOwnProperty:K6}=Object.prototype;function vg(t,e){return function(s,a,i){return t(s,a,i)&&e(s,a,i)}}function ih(t){return function(n,s,a){if(!n||!s||typeof n!="object"||typeof s!="object")return t(n,s,a);const{cache:i}=a,o=i.get(n),c=i.get(s);if(o&&c)return o===s&&c===n;i.set(n,s),i.set(s,n);const u=t(n,s,a);return i.delete(n),i.delete(s),u}}function q6(t){return t!=null?t[Symbol.toStringTag]:void 0}function AN(t){return W6(t).concat(U6(t))}const G6=Object.hasOwn||((t,e)=>K6.call(t,e));function Ko(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const J6="__v",Y6="__o",Q6="_owner",{getOwnPropertyDescriptor:IN,keys:RN}=Object;function X6(t,e){return t.byteLength===e.byteLength&&qh(new Uint8Array(t),new Uint8Array(e))}function Z6(t,e,n){let s=t.length;if(e.length!==s)return!1;for(;s-- >0;)if(!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function e_(t,e){return t.byteLength===e.byteLength&&qh(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function t_(t,e){return Ko(t.getTime(),e.getTime())}function n_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function s_(t,e){return t===e}function PN(t,e,n){const s=t.size;if(s!==e.size)return!1;if(!s)return!0;const a=new Array(s),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const r_=Ko;function a_(t,e,n){const s=RN(t);let a=s.length;if(RN(e).length!==a)return!1;for(;a-- >0;)if(!rC(t,e,n,s[a]))return!1;return!0}function qc(t,e,n){const s=AN(t);let a=s.length;if(AN(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=s[a],!rC(t,e,n,i)||(o=IN(t,i),c=IN(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function i_(t,e){return Ko(t.valueOf(),e.valueOf())}function o_(t,e){return t.source===e.source&&t.flags===e.flags}function ON(t,e,n){const s=t.size;if(s!==e.size)return!1;if(!s)return!0;const a=new Array(s),i=t.values();let o,c;for(;(o=i.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!a[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=a[f]=!0;break}f++}if(!h)return!1}return!0}function qh(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function l_(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function rC(t,e,n,s){return(s===Q6||s===Y6||s===J6)&&(t.$$typeof||e.$$typeof)?!0:G6(e,s)&&n.equals(t[s],e[s],s,s,t,e,n)}const c_="[object ArrayBuffer]",d_="[object Arguments]",u_="[object Boolean]",h_="[object DataView]",f_="[object Date]",p_="[object Error]",m_="[object Map]",g_="[object Number]",x_="[object Object]",y_="[object RegExp]",b_="[object Set]",v_="[object String]",N_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},w_="[object URL]",j_=Object.prototype.toString;function k_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:s,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:N}){return function(v,k,C){if(v===k)return!0;if(v==null||k==null)return!1;const E=typeof v;if(E!==typeof k)return!1;if(E!=="object")return E==="number"?c(v,k,C):E==="function"?i(v,k,C):!1;const M=v.constructor;if(M!==k.constructor)return!1;if(M===Object)return u(v,k,C);if(Array.isArray(v))return e(v,k,C);if(M===Date)return s(v,k,C);if(M===RegExp)return f(v,k,C);if(M===Map)return o(v,k,C);if(M===Set)return m(v,k,C);const P=j_.call(v);if(P===f_)return s(v,k,C);if(P===y_)return f(v,k,C);if(P===m_)return o(v,k,C);if(P===b_)return m(v,k,C);if(P===x_)return typeof v.then!="function"&&typeof k.then!="function"&&u(v,k,C);if(P===w_)return y(v,k,C);if(P===p_)return a(v,k,C);if(P===d_)return u(v,k,C);if(N_[P])return g(v,k,C);if(P===c_)return t(v,k,C);if(P===h_)return n(v,k,C);if(P===u_||P===g_||P===v_)return h(v,k,C);if(N){let $=N[P];if(!$){const D=q6(v);D&&($=N[D])}if($)return $(v,k,C)}return!1}}function S_({circular:t,createCustomConfig:e,strict:n}){let s={areArrayBuffersEqual:X6,areArraysEqual:n?qc:Z6,areDataViewsEqual:e_,areDatesEqual:t_,areErrorsEqual:n_,areFunctionsEqual:s_,areMapsEqual:n?vg(PN,qc):PN,areNumbersEqual:r_,areObjectsEqual:n?qc:a_,arePrimitiveWrappersEqual:i_,areRegExpsEqual:o_,areSetsEqual:n?vg(ON,qc):ON,areTypedArraysEqual:n?vg(qh,qc):qh,areUrlsEqual:l_,unknownTagComparators:void 0};if(e&&(s=Object.assign({},s,e(s))),t){const a=ih(s.areArraysEqual),i=ih(s.areMapsEqual),o=ih(s.areObjectsEqual),c=ih(s.areSetsEqual);s=Object.assign({},s,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return s}function C_(t){return function(e,n,s,a,i,o,c){return t(e,n,c)}}function E_({circular:t,comparator:e,createState:n,equals:s,strict:a}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:s,meta:f,strict:a})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:s,meta:void 0,strict:a})};const i={cache:void 0,equals:s,meta:void 0,strict:a};return function(c,u){return e(c,u,i)}}const T_=Fi();Fi({strict:!0});Fi({circular:!0});Fi({circular:!0,strict:!0});Fi({createInternalComparator:()=>Ko});Fi({strict:!0,createInternalComparator:()=>Ko});Fi({circular:!0,createInternalComparator:()=>Ko});Fi({circular:!0,createInternalComparator:()=>Ko,strict:!0});function Fi(t={}){const{circular:e=!1,createInternalComparator:n,createState:s,strict:a=!1}=t,i=S_(t),o=k_(i),c=n?n(o):C_(o);return E_({circular:e,comparator:o,createState:s,equals:c,strict:a})}var Ng={exports:{}},wg={};/**
- * @license React
- * use-sync-external-store-shim/with-selector.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var DN;function M_(){if(DN)return wg;DN=1;var t=Od(),e=qk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var s=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return wg.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var N=i(null);if(N.current===null){var w={hasValue:!1,value:null};N.current=w}else w=N.current;N=c(function(){function k($){if(!C){if(C=!0,E=$,$=g($),y!==void 0&&w.hasValue){var D=w.value;if(y(D,$))return M=D}return M=$}if(D=M,s(E,$))return D;var R=g($);return y!==void 0&&y(D,R)?(E=$,D):(E=$,M=R)}var C=!1,E,M,P=m===void 0?null:m;return[function(){return k(f())},P===null?void 0:function(){return k(P())}]},[f,m,g,y]);var v=a(h,N[0],N[1]);return o(function(){w.hasValue=!0,w.value=v},[v]),u(v),v},wg}var LN;function A_(){return LN||(LN=1,Ng.exports=M_()),Ng.exports}var I_=A_(),R_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},P_=({contentComponent:t})=>{const e=Gk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return r.jsx(r.Fragment,{children:Object.values(e)})};function O_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,s){e={...e,[n]:Hw.createPortal(s.reactElement,s.element,n)},t.forEach(a=>a())},removeRenderer(n){const s={...e};delete s[n],e=s,t.forEach(a=>a())}}}var D_=class extends vs.Component{constructor(t){var e;super(t),this.editorContentRef=vs.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=O_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:R_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&r.jsx(P_,{contentComponent:t.contentComponent})]})}},L_=b.forwardRef((t,e)=>{const n=vs.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return vs.createElement(D_,{key:n,innerRef:e,...t})}),aC=vs.memo(L_),__=typeof window<"u"?b.useLayoutEffect:b.useEffect,z_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function $_(t){var e;const[n]=b.useState(()=>new z_(t.editor)),s=I_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:T_);return __(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(s),s}var F_=!1,Sx=typeof window>"u",B_=Sx||!!(typeof window<"u"&&window.next),V_=class iC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Sx||B_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...s)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...s)},onBlur:(...s)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...s)},onCreate:(...s)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...s)},onDestroy:(...s)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...s)},onFocus:(...s)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...s)},onSelectionUpdate:(...s)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...s)},onTransaction:(...s)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...s)},onUpdate:(...s)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...s)},onContentError:(...s)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...s)},onDrop:(...s)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...s)},onPaste:(...s)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...s)},onDelete:(...s)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...s)}};return new P6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var o;return a===((o=n.extensions)==null?void 0:o[i])}):e[s]===n[s])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?iC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((s,a)=>s===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function H_(t={},e=[]){const n=b.useRef(t);n.current=t;const[s]=b.useState(()=>new V_(n)),a=Gk.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return b.useDebugValue(a),b.useEffect(s.onRender(e)),$_({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var oC=b.createContext({editor:null});oC.Consumer;var W_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),U_=()=>b.useContext(W_);vs.forwardRef((t,e)=>{const{onDragStart:n}=U_(),s=t.as||"div";return r.jsx(s,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});vs.createContext({markViewContentRef:()=>{}});var Y0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});Y0.displayName="TiptapContext";var K_=()=>b.useContext(Y0);function lC({editor:t,instance:e,children:n}){const s=t??e;if(!s)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=b.useMemo(()=>({editor:s}),[s]),i=b.useMemo(()=>({editor:s}),[s]);return r.jsx(oC.Provider,{value:i,children:r.jsx(Y0.Provider,{value:a,children:n})})}lC.displayName="Tiptap";function cC({...t}){const{editor:e}=K_();return r.jsx(aC,{editor:e,...t})}cC.displayName="Tiptap.Content";Object.assign(lC,{Content:cC});var Gh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...s}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,s,n]},q_=/^\s*>\s$/,G_=Cn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Gh("blockquote",{...Ct(this.options.HTMLAttributes,t),children:Gh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",s=[];return t.content.forEach(a=>{const c=e.renderChildren([a]).split(`
-`).map(u=>u.trim()===""?n:`${n} ${u}`);s.push(c.join(`
-`))}),s.join(`
-${n}
-`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Yl({find:q_,type:this.type})]}}),J_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Y_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Q_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,X_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Z_=Uo.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Gh("strong",{...Ct(this.options.HTMLAttributes,t),children:Gh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Jl({find:J_,type:this.type}),Jl({find:Q_,type:this.type})]},addPasteRules(){return[zo({find:Y_,type:this.type}),zo({find:X_,type:this.type})]}}),e7=/(^|[^`])`([^`]+)`(?!`)$/,t7=/(^|[^`])`([^`]+)`(?!`)/g,n7=Uo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ct(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Jl({find:e7,type:this.type})]},addPasteRules(){return[zo({find:t7,type:this.type})]}}),jg=4,s7=/^```([a-z]+)?[\s\n]$/,r7=/^~~~([a-z]+)?[\s\n]$/,a7=Cn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:jg,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ct(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,s;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((s=t.raw)==null?void 0:s.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let s="";const a=((n=t.attrs)==null?void 0:n.language)||"";return t.content?s=[`\`\`\`${a}`,e.renderChildren(t.content),"```"].join(`
-`):s=`\`\`\`${a}
-
-\`\`\``,s},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:jg,{state:s}=t,{selection:a}=s,{$from:i,empty:o}=a;if(i.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=a,y=s.doc.textBetween(h,f,`
-`,`
-`).split(`
-`).map(N=>c+N).join(`
-`);return u.replaceWith(h,f,s.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:jg,{state:s}=t,{selection:a}=s,{$from:i,empty:o}=a;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=i,f=i.start(),m=i.end(),y=s.doc.textBetween(f,m,`
-`,`
-`).split(`
-`);let N=0,w=0;const v=h-f;for(let $=0;$=v){N=$;break}w+=y[$].length+1}const C=((u=y[N].match(/^ */))==null?void 0:u[0])||"",E=Math.min(C.length,n);if(E===0)return!0;let M=f;for(let $=0;${const{from:u,to:h}=a,g=s.doc.textBetween(u,h,`
-`,`
-`).split(`
-`).map(y=>{var N;const w=((N=y.match(/^ */))==null?void 0:N[0])||"",v=Math.min(w.length,n);return y.slice(v)}).join(`
-`);return c.replaceWith(u,h,s.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:s,empty:a}=n;if(!a||s.parent.type!==this.type)return!1;const i=s.parentOffset===s.parent.nodeSize-2,o=s.parent.textContent.endsWith(`
-
-`);return!i||!o?!1:t.chain().command(({tr:c})=>(c.delete(s.pos-2,s.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:s}=e,{$from:a,empty:i}=n;if(!i||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const c=a.after();return c===void 0?!1:s.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(rt.near(s.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[jx({find:s7,type:this.type,getAttributes:t=>({language:t[1]})}),jx({find:r7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Wt({key:new nn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),s=e.clipboardData.getData("vscode-editor-data"),a=s?JSON.parse(s):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,`
-`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(Ze.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),i7=Cn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
-
-`):""}),o7=Cn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ct(this.options.HTMLAttributes,t)]},renderText(){return`
-`},renderMarkdown:()=>`
-`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:s})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=s.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),l7=Cn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ct(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const s=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(s);return t.content?`${a} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>jx({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),c7=Cn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ct(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!L6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:s}=n,a=t();return z2(n)?a.insertContentAt(s.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Ze.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Xe.create(o.doc,u.pos)):o.setSelection(Ze.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(Ze.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[tC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),d7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,u7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,h7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,f7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,p7=Uo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ct(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Jl({find:d7,type:this.type}),Jl({find:h7,type:this.type})]},addPasteRules(){return[zo({find:u7,type:this.type}),zo({find:f7,type:this.type})]}});const m7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",g7="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Cx="numeric",Ex="ascii",Tx="alpha",dd="asciinumeric",Zc="alphanumeric",Mx="domain",dC="emoji",x7="scheme",y7="slashscheme",kg="whitespace";function b7(t,e){return t in e||(e[t]=[]),e[t]}function jo(t,e,n){e[Cx]&&(e[dd]=!0,e[Zc]=!0),e[Ex]&&(e[dd]=!0,e[Tx]=!0),e[dd]&&(e[Zc]=!0),e[Tx]&&(e[Zc]=!0),e[Zc]&&(e[Mx]=!0),e[dC]&&(e[Mx]=!0);for(const s in e){const a=b7(s,n);a.indexOf(t)<0&&a.push(t)}}function v7(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function Ps(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ps.groups={};Ps.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let s=0;st.ta(e,n,s,a),fn=(t,e,n,s,a)=>t.tr(e,n,s,a),_N=(t,e,n,s,a)=>t.ts(e,n,s,a),Te=(t,e,n,s,a)=>t.tt(e,n,s,a),ba="WORD",Ax="UWORD",uC="ASCIINUMERICAL",hC="ALPHANUMERICAL",Ad="LOCALHOST",Ix="TLD",Rx="UTLD",Nh="SCHEME",Il="SLASH_SCHEME",Q0="NUM",Px="WS",X0="NL",ud="OPENBRACE",hd="CLOSEBRACE",Jh="OPENBRACKET",Yh="CLOSEBRACKET",Qh="OPENPAREN",Xh="CLOSEPAREN",Zh="OPENANGLEBRACKET",ef="CLOSEANGLEBRACKET",tf="FULLWIDTHLEFTPAREN",nf="FULLWIDTHRIGHTPAREN",sf="LEFTCORNERBRACKET",rf="RIGHTCORNERBRACKET",af="LEFTWHITECORNERBRACKET",of="RIGHTWHITECORNERBRACKET",lf="FULLWIDTHLESSTHAN",cf="FULLWIDTHGREATERTHAN",df="AMPERSAND",uf="APOSTROPHE",hf="ASTERISK",hi="AT",ff="BACKSLASH",pf="BACKTICK",mf="CARET",mi="COLON",Z0="COMMA",gf="DOLLAR",Br="DOT",xf="EQUALS",ey="EXCLAMATION",rr="HYPHEN",fd="PERCENT",yf="PIPE",bf="PLUS",vf="POUND",pd="QUERY",ty="QUOTE",fC="FULLWIDTHMIDDLEDOT",ny="SEMI",Vr="SLASH",md="TILDE",Nf="UNDERSCORE",pC="EMOJI",wf="SYM";var mC=Object.freeze({__proto__:null,ALPHANUMERICAL:hC,AMPERSAND:df,APOSTROPHE:uf,ASCIINUMERICAL:uC,ASTERISK:hf,AT:hi,BACKSLASH:ff,BACKTICK:pf,CARET:mf,CLOSEANGLEBRACKET:ef,CLOSEBRACE:hd,CLOSEBRACKET:Yh,CLOSEPAREN:Xh,COLON:mi,COMMA:Z0,DOLLAR:gf,DOT:Br,EMOJI:pC,EQUALS:xf,EXCLAMATION:ey,FULLWIDTHGREATERTHAN:cf,FULLWIDTHLEFTPAREN:tf,FULLWIDTHLESSTHAN:lf,FULLWIDTHMIDDLEDOT:fC,FULLWIDTHRIGHTPAREN:nf,HYPHEN:rr,LEFTCORNERBRACKET:sf,LEFTWHITECORNERBRACKET:af,LOCALHOST:Ad,NL:X0,NUM:Q0,OPENANGLEBRACKET:Zh,OPENBRACE:ud,OPENBRACKET:Jh,OPENPAREN:Qh,PERCENT:fd,PIPE:yf,PLUS:bf,POUND:vf,QUERY:pd,QUOTE:ty,RIGHTCORNERBRACKET:rf,RIGHTWHITECORNERBRACKET:of,SCHEME:Nh,SEMI:ny,SLASH:Vr,SLASH_SCHEME:Il,SYM:wf,TILDE:md,TLD:Ix,UNDERSCORE:Nf,UTLD:Rx,UWORD:Ax,WORD:ba,WS:Px});const xa=/[a-z]/,Gc=new RegExp("\\p{L}","u"),Sg=new RegExp("\\p{Emoji}","u"),ya=/\d/,Cg=/\s/,zN="\r",Eg=`
-`,N7="️",w7="",Tg="";let oh=null,lh=null;function j7(t=[]){const e={};Ps.groups=e;const n=new Ps;oh==null&&(oh=$N(m7)),lh==null&&(lh=$N(g7)),Te(n,"'",uf),Te(n,"{",ud),Te(n,"}",hd),Te(n,"[",Jh),Te(n,"]",Yh),Te(n,"(",Qh),Te(n,")",Xh),Te(n,"<",Zh),Te(n,">",ef),Te(n,"(",tf),Te(n,")",nf),Te(n,"「",sf),Te(n,"」",rf),Te(n,"『",af),Te(n,"』",of),Te(n,"<",lf),Te(n,">",cf),Te(n,"&",df),Te(n,"*",hf),Te(n,"@",hi),Te(n,"`",pf),Te(n,"^",mf),Te(n,":",mi),Te(n,",",Z0),Te(n,"$",gf),Te(n,".",Br),Te(n,"=",xf),Te(n,"!",ey),Te(n,"-",rr),Te(n,"%",fd),Te(n,"|",yf),Te(n,"+",bf),Te(n,"#",vf),Te(n,"?",pd),Te(n,'"',ty),Te(n,"/",Vr),Te(n,";",ny),Te(n,"~",md),Te(n,"_",Nf),Te(n,"\\",ff),Te(n,"・",fC);const s=fn(n,ya,Q0,{[Cx]:!0});fn(s,ya,s);const a=fn(s,xa,uC,{[dd]:!0}),i=fn(s,Gc,hC,{[Zc]:!0}),o=fn(n,xa,ba,{[Ex]:!0});fn(o,ya,a),fn(o,xa,o),fn(a,ya,a),fn(a,xa,a);const c=fn(n,Gc,Ax,{[Tx]:!0});fn(c,xa),fn(c,ya,i),fn(c,Gc,c),fn(i,ya,i),fn(i,xa),fn(i,Gc,i);const u=Te(n,Eg,X0,{[kg]:!0}),h=Te(n,zN,Px,{[kg]:!0}),f=fn(n,Cg,Px,{[kg]:!0});Te(n,Tg,f),Te(h,Eg,u),Te(h,Tg,f),fn(h,Cg,f),Te(f,zN),Te(f,Eg),fn(f,Cg,f),Te(f,Tg,f);const m=fn(n,Sg,pC,{[dC]:!0});Te(m,"#"),fn(m,Sg,m),Te(m,N7,m);const g=Te(m,w7);Te(g,"#"),fn(g,Sg,m);const y=[[xa,o],[ya,a]],N=[[xa,null],[Gc,c],[ya,i]];for(let w=0;ww[0]>v[0]?1:-1);for(let w=0;w=0?C[Mx]=!0:xa.test(v)?ya.test(v)?C[dd]=!0:C[Ex]=!0:C[Cx]=!0,_N(n,v,v,C)}return _N(n,"localhost",Ad,{ascii:!0}),n.jd=new Ps(wf),{start:n,tokens:Object.assign({groups:e},mC)}}function gC(t,e){const n=k7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),s=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function k7(t){const e=[],n=t.length;let s=0;for(;s56319||s+1===n||(i=t.charCodeAt(s+1))<56320||i>57343?t[s]:t.slice(s,s+2);e.push(o),s+=o.length}return e}function oi(t,e,n,s,a){let i;const o=e.length;for(let c=0;c=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(s,s+i),10);o>0;o--)n.pop();s+=i}else n.push(t[s]),s++}return e}const Id={defaultProtocol:"http",events:null,format:FN,formatHref:FN,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sy(t,e=null){let n=Object.assign({},Id);t&&(n=Object.assign(n,t instanceof sy?t.o:t));const s=n.ignoreTags,a=[];for(let i=0;in?s.substring(0,n)+"…":s},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Id.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),s=t.get("formatHref",n,this),a=t.get("tagName",n,e),i=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=s,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:a,attributes:o,content:i,eventListeners:m}}};function ep(t,e){class n extends xC{constructor(a,i){super(a,i),this.t=t}}for(const s in e)n.prototype[s]=e[s];return n.t=t,n}const BN=ep("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),VN=ep("text"),S7=ep("nl"),ch=ep("url",{isLink:!0,toHref(t=Id.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Ad&&t[1].t===mi}}),sr=t=>new Ps(t);function C7({groups:t}){const e=t.domain.concat([df,hf,hi,ff,pf,mf,gf,xf,rr,Q0,fd,yf,bf,vf,Vr,wf,md,Nf]),n=[uf,mi,Z0,Br,ey,fd,pd,ty,ny,Zh,ef,ud,hd,Yh,Jh,Qh,Xh,tf,nf,sf,rf,af,of,lf,cf],s=[df,uf,hf,ff,pf,mf,gf,xf,rr,ud,hd,fd,yf,bf,vf,pd,Vr,wf,md,Nf],a=sr(),i=Te(a,md);dt(i,s,i),dt(i,t.domain,i);const o=sr(),c=sr(),u=sr();dt(a,t.domain,o),dt(a,t.scheme,c),dt(a,t.slashscheme,u),dt(o,s,i),dt(o,t.domain,o);const h=Te(o,hi);Te(i,hi,h),Te(c,hi,h),Te(u,hi,h);const f=Te(i,Br);dt(f,s,i),dt(f,t.domain,i);const m=sr();dt(h,t.domain,m),dt(m,t.domain,m);const g=Te(m,Br);dt(g,t.domain,m);const y=sr(BN);dt(g,t.tld,y),dt(g,t.utld,y),Te(h,Ad,y);const N=Te(m,rr);Te(N,rr,N),dt(N,t.domain,m),dt(y,t.domain,m),Te(y,Br,g),Te(y,rr,N);const w=Te(y,mi);dt(w,t.numeric,BN);const v=Te(o,rr),k=Te(o,Br);Te(v,rr,v),dt(v,t.domain,o),dt(k,s,i),dt(k,t.domain,o);const C=sr(ch);dt(k,t.tld,C),dt(k,t.utld,C),dt(C,t.domain,o),dt(C,s,i),Te(C,Br,k),Te(C,rr,v),Te(C,hi,h);const E=Te(C,mi),M=sr(ch);dt(E,t.numeric,M);const P=sr(ch),$=sr();dt(P,e,P),dt(P,n,$),dt($,e,P),dt($,n,$),Te(C,Vr,P),Te(M,Vr,P);const D=Te(c,mi),R=Te(u,mi),O=Te(R,Vr),_=Te(O,Vr);dt(c,t.domain,o),Te(c,Br,k),Te(c,rr,v),dt(u,t.domain,o),Te(u,Br,k),Te(u,rr,v),dt(D,t.domain,P),Te(D,Vr,P),Te(D,pd,P),dt(_,t.domain,P),dt(_,e,P),Te(_,Vr,P);const se=[[ud,hd],[Jh,Yh],[Qh,Xh],[Zh,ef],[tf,nf],[sf,rf],[af,of],[lf,cf]];for(let ne=0;ne=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(Mg(VN,e,o)),o=[]),a-=g,f-=g;const y=m.t,N=n.slice(a-f,a);i.push(Mg(y,e,N))}}return o.length>0&&i.push(Mg(VN,e,o)),i}function Mg(t,e,n){const s=n[0].s,a=n[n.length-1].e,i=e.slice(s,a);return new t(i,n)}const T7=typeof console<"u"&&console&&console.warn||(()=>{}),M7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Yt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function A7(){return Ps.groups={},Yt.scanner=null,Yt.parser=null,Yt.tokenQueue=[],Yt.pluginQueue=[],Yt.customSchemes=[],Yt.initialized=!1,Yt}function HN(t,e=!1){if(Yt.initialized&&T7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${M7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
-1. Must only contain digits, lowercase ASCII letters or "-"
-2. Cannot start or end with "-"
-3. "-" cannot repeat`);Yt.customSchemes.push([t,e])}function I7(){Yt.scanner=j7(Yt.customSchemes);for(let t=0;t{const a=e.some(h=>h.docChanged)&&!n.doc.eq(s.doc),i=e.some(h=>h.getMeta("preventAutolink"));if(!a||i)return;const{tr:o}=s,c=M2(n.doc,[...e]);if(_2(c).forEach(({newRange:h})=>{const f=D8(s.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=s.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=s.doc.textBetween(h.from,h.to," "," ");if(!P7.test(y))return;m=f[0],g=s.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(R7).filter(Boolean);if(y.length<=0)return!1;const N=y[y.length-1],w=m.pos+g.lastIndexOf(N);if(!N)return!1;const v=ry(N).map(k=>k.toObject(t.defaultProtocol));if(!D7(v))return!1;v.filter(k=>k.isLink).map(k=>({...k,from:w+k.start+1,to:w+k.end+1})).filter(k=>s.schema.marks.code?!s.doc.rangeHasMark(k.from,k.to,s.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{U0(k.from,k.to,s.doc).some(C=>C.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function _7(t){return new Wt({key:new nn("handleClickLink"),props:{handleClick:(e,n,s)=>{var a,i;if(s.button!==0||!e.editable)return!1;let o=null;if(s.target instanceof HTMLAnchorElement)o=s.target;else{const u=s.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=L2(e.state,t.type.name),h=(a=o.href)!=null?a:u.href,f=(i=o.target)!=null?i:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function z7(t){return new Wt({key:new nn("handlePasteLink"),props:{handlePaste:(e,n,s)=>{const{shouldAutoLink:a}=t,{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let u="";s.content.forEach(f=>{u+=f.textContent});const h=yC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||a!==void 0&&!a(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function go(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(s=>{const a=typeof s=="string"?s:s.scheme;a&&n.push(a)}),!t||t.replace(O7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var $7=Uo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){HN(t);return}HN(t.scheme,t.optionalSlashes)})},onDestroy(){A7()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!go(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const a=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(a)||!/\./.test(a))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!go(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!go(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ct(this.options.HTMLAttributes,t),0]:["a",Ct(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,s,a,i;const o=(s=(n=t.attrs)==null?void 0:n.href)!=null?s:"",c=(i=(a=t.attrs)==null?void 0:a.title)!=null?i:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!go(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:s=>!!go(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[zo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:s}=this.options,a=yC(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!go(o,n),protocols:n,defaultProtocol:s}));a.length&&a.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(L7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:a=>!!go(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(_7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(z7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),F7=Object.defineProperty,B7=(t,e)=>{for(var n in e)F7(t,n,{get:e[n],enumerable:!0})},V7="listItem",WN="textStyle",UN=/^\s*([-+*])\s$/,bC=Cn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ct(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
-`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(V7,this.editor.getAttributes(WN)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Yl({find:UN,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Yl({find:UN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(WN),editor:this.editor})),[t]}}),vC=Cn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ct(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(a=>a.type==="paragraph"))n=e.parseChildren(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>J0(t,e,s=>{var a,i;return s.parentType==="bulletList"?"- ":s.parentType==="orderedList"?`${(((i=(a=s.meta)==null?void 0:a.parentAttrs)==null?void 0:i.start)||1)+s.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),H7={};B7(H7,{findListItemPos:()=>Vd,getNextListDepth:()=>iy,handleBackspace:()=>Ox,handleDelete:()=>Dx,hasListBefore:()=>NC,hasListItemAfter:()=>W7,hasListItemBefore:()=>wC,listItemHasSubList:()=>jC,nextListIsDeeper:()=>kC,nextListIsHigher:()=>SC});var Vd=(t,e)=>{const{$from:n}=e.selection,s=Sn(t,e.schema);let a=null,i=n.depth,o=n.pos,c=null;for(;i>0&&c===null;)a=n.node(i),a.type===s?c=i:(i-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},iy=(t,e)=>{const n=Vd(t,e);if(!n)return!1;const[,s]=U8(e,t,n.$pos.pos+4);return s},NC=(t,e,n)=>{const{$anchor:s}=t.selection,a=Math.max(0,s.pos-2),i=t.doc.resolve(a).node();return!(!i||!n.includes(i.type.name))},wC=(t,e)=>{var n;const{$anchor:s}=e.selection,a=e.doc.resolve(s.pos-2);return!(a.index()===0||((n=a.nodeBefore)==null?void 0:n.type.name)!==t)},jC=(t,e,n)=>{if(!n)return!1;const s=Sn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===s&&(a=!0)}),a},Ox=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Ii(t.state,e)&&NC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Ii(t.state,e)||!J8(t.state))return!1;const s=Vd(e,t.state);if(!s)return!1;const i=t.state.doc.resolve(s.$pos.pos-2).node(s.depth),o=jC(e,t.state,i);return wC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},kC=(t,e)=>{const n=iy(t,e),s=Vd(t,e);return!s||!n?!1:n>s.depth},SC=(t,e)=>{const n=iy(t,e),s=Vd(t,e);return!s||!n?!1:n{if(!Ii(t.state,e)||!G8(t.state,e))return!1;const{selection:n}=t.state,{$from:s,$to:a}=n;return!n.empty&&s.sameParent(a)?!1:kC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():SC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},W7=(t,e)=>{var n;const{$anchor:s}=e.selection,a=e.doc.resolve(s.pos-s.parentOffset-2);return!(a.index()===a.parent.childCount-1||((n=a.nodeAfter)==null?void 0:n.type.name)!==t)},CC=xn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Dx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Dx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:s})=>{t.state.schema.nodes[n]!==void 0&&Ox(t,n,s)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:s})=>{t.state.schema.nodes[n]!==void 0&&Ox(t,n,s)&&(e=!0)}),e}}}}),KN=/^(\s*)(\d+)\.\s+(.*)$/,U7=/^\s/;function K7(t){const e=[];let n=0,s=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(w=>w.indent)),N=EC(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:N,raw:g.map(w=>w.raw).join(`
-`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function q7(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const s=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(a=>{if(a.type==="paragraph"||a.type==="list"||a.type==="blockquote"||a.type==="code")s.push(...e.parseChildren([a]));else if(a.type==="text"&&a.tokens){const i=e.parseChildren([a]);s.push({type:"paragraph",content:i})}else{const i=e.parseChildren([a]);i.length>0&&s.push(...i)}}),{type:"listItem",content:s}})}var G7="listItem",qN="textStyle",GN=/^(\d+)\.\s$/,TC=Cn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ct(this.options.HTMLAttributes,n),0]:["ol",Ct(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,s=t.items?q7(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:s}:{type:"orderedList",content:s}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
-`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var s;const a=t.split(`
-`),[i,o]=K7(a);if(i.length===0)return;const c=EC(i,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((s=i[0])==null?void 0:s.number)||1,items:c,raw:a.slice(0,o).join(`
-`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(G7,this.editor.getAttributes(qN)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Yl({find:GN,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Yl({find:GN,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(qN)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),J7=/^\s*(\[([( |x])?\])\s$/,Y7=Cn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ct(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const s=e.parseChildren(t.nestedTokens);n.push(...s)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return J0(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:s})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!s.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;s.isEditable&&typeof n=="function"&&s.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const N=n();if(typeof N!="number")return!1;const w=y.doc.nodeAt(N);return y.setNodeMarkup(N,void 0,{...w==null?void 0:w.attrs,checked:g}),!0}).run(),!s.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=s.extensionManager.attributes,y=Md(m,g),N=new Set(Object.keys(y)),w=this.options.HTMLAttributes;return f.forEach(v=>{N.has(v)||(v in w?a.setAttribute(v,w[v]):a.removeAttribute(v))}),Object.entries(y).forEach(([v,k])=>{k==null?v in w?a.setAttribute(v,w[v]):a.removeAttribute(v):a.setAttribute(v,k)}),f=N,!0}}}},addInputRules(){return[Yl({find:J7,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Q7=Cn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ct(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
-`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const s=i=>{const o=kx(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:s},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},a=kx(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:s},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});xn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(bC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(vC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(CC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(TC.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Y7.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Q7.configure(this.options.taskList)),t}});var JN=" ",X7=" ",Z7=Cn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ct(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const s=e.parseInline(n);return s.length===1&&s[0].type==="text"&&(s[0].text===JN||s[0].text===X7)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,s)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?JN:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ez=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nz=Uo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ct(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Jl({find:ez,type:this.type})]},addPasteRules(){return[zo({find:tz,type:this.type})]}}),sz=Cn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),rz=Uo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Ct(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function az(t={}){return new Wt({view(e){return new iz(e,t)}})}class iz{constructor(e,n){var s;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,s,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let N=y.getBoundingClientRect(),w=m?N.bottom:N.top;m&&g&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*c;s={left:N.left,right:N.right,top:w-v,bottom:w+v}}}}if(!s){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;s={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(s.left-h)/o+"px",this.element.style.top=(s.top-f)/c+"px",this.element.style.width=(s.right-s.left)/o+"px",this.element.style.height=(s.bottom-s.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=s&&s.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=NS(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class mn extends rt{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return mn.valid(s)?new mn(s):rt.near(s)}content(){return Ie.empty}eq(e){return e instanceof mn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new mn(e.resolve(n.pos))}getBookmark(){return new oy(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!oz(e)||!lz(e))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,s=!1){e:for(;;){if(!s&&mn.valid(e))return e;let a=e.pos,i=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){i=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let u=e.doc.resolve(a);if(mn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Xe.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),s=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(mn.valid(c))return c}return null}}}mn.prototype.visible=!1;mn.findFrom=mn.findGapCursorFrom;rt.jsonID("gapcursor",mn);class oy{constructor(e){this.pos=e}map(e){return new oy(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return mn.valid(n)?new mn(n):rt.near(n)}}function MC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function oz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),s=t.node(e);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let a=s.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||MC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function lz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),s=t.node(e);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let a=s.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||MC(a.type))return!0;if(a.inlineContent)return!1}}return!0}function cz(){return new Wt({props:{decorations:fz,createSelectionBetween(t,e,n){return e.pos==n.pos&&mn.valid(n)?new mn(n):null},handleClick:uz,handleKeyDown:dz,handleDOMEvents:{beforeinput:hz}}})}const dz=$0({ArrowLeft:dh("horiz",-1),ArrowRight:dh("horiz",1),ArrowUp:dh("vert",-1),ArrowDown:dh("vert",1)});function dh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(s,a,i){let o=s.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof Ze){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=s.doc.resolve(e>0?c.after():c.before())}let h=mn.findGapCursorFrom(c,e,u);return h?(a&&a(s.tr.setSelection(new mn(h))),!0):!1}}function uz(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!mn.valid(s))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&Xe.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new mn(s))),!0)}function hz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof mn))return!1;let{$from:n}=t.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!s)return!1;let a=ve.empty;for(let o=s.length-1;o>=0;o--)a=ve.from(s[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Ie(a,0,0));return i.setSelection(Ze.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function fz(t){if(!(t.selection instanceof mn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",zt.create(t.doc,[In.widget(t.selection.head,e,{key:"gapcursor"})])}var jf=200,Hn=function(){};Hn.prototype.append=function(e){return e.length?(e=Hn.from(e),!this.length&&e||e.length=n?Hn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Hn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Hn.prototype.forEach=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(e,n,s,0):this.forEachInvertedInner(e,n,s,0)};Hn.prototype.map=function(e,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var a=[];return this.forEach(function(i,o){return a.push(e(i,o))},n,s),a};Hn.from=function(e){return e instanceof Hn?e:e&&e.length?new AC(e):Hn.empty};var AC=(function(t){function e(s){t.call(this),this.values=s}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,o,c){for(var u=i;u=o;u--)if(a(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=jf)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=jf)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Hn);Hn.empty=new AC([]);var pz=(function(t){function e(n,s){t.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(s){return sc&&this.right.forEachInner(s,Math.max(a-c,0),Math.min(this.length,i)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(s,a,i,o){var c=this.left.length;if(a>c&&this.right.forEachInvertedInner(s,a-c,Math.max(i,c)-c,o+c)===!1||i