>=_,p-=_,vi=1<<32-mr(a)+p|s<ze?(Yt=Me,Me=null):Yt=Me.sibling;var tt=V(q,Me,X[ze],re);if(tt===null){Me===null&&(Me=Yt);break}i&&Me&&tt.alternate===null&&a(q,Me),H=y(tt,H,ze),Ze===null?we=tt:Ze.sibling=tt,Ze=tt,Me=Yt}if(ze===X.length)return s(q,Me),Ve&&Ji(q,ze),we;if(Me===null){for(;zeze?(Yt=Me,Me=null):Yt=Me.sibling;var hl=V(q,Me,tt.value,re);if(hl===null){Me===null&&(Me=Yt);break}i&&Me&&hl.alternate===null&&a(q,Me),H=y(hl,H,ze),Ze===null?we=hl:Ze.sibling=hl,Ze=hl,Me=Yt}if(tt.done)return s(q,Me),Ve&&Ji(q,ze),we;if(Me===null){for(;!tt.done;ze++,tt=X.next())tt=ae(q,tt.value,re),tt!==null&&(H=y(tt,H,ze),Ze===null?we=tt:Ze.sibling=tt,Ze=tt);return Ve&&Ji(q,ze),we}for(Me=d(Me);!tt.done;ze++,tt=X.next())tt=Q(Me,q,ze,tt.value,re),tt!==null&&(i&&(Yt=tt.alternate,Yt!==null&&Me.delete(Yt.key===null?ze:Yt.key)),H=y(tt,H,ze),Ze===null?we=tt:Ze.sibling=tt,Ze=tt);return i&&Me.forEach(function(p$){return a(q,p$)}),Ve&&Ji(q,ze),we}function Fe(q,H,X,re){if(typeof X=="object"&&X!==null&&X.type===B&&X.key===null&&X.props.ref===void 0&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case I:e:{for(var we=X.key;H!==null;){if(H.key===we){if(we=X.type,we===B){if(H.tag===7){s(q,H.sibling),re=p(H,X.props.children),Ya(re,X),re.return=q,q=re;break e}}else if(H.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===U&&no(we)===H.type){s(q,H.sibling),re=p(H,X.props),Ya(re,X),re.return=q,q=re;break e}s(q,H);break}else a(q,H);H=H.sibling}X.type===B?(re=Xl(X.props.children,q.mode,re,X.key),Ya(re,X),re.return=q,q=re):(re=Bd(X.type,X.key,X.props,null,q.mode,re),Ya(re,X),re.return=q,q=re)}return _(q);case P:e:{for(we=X.key;H!==null;){if(H.key===we)if(H.tag===4&&H.stateNode.containerInfo===X.containerInfo&&H.stateNode.implementation===X.implementation){s(q,H.sibling),re=p(H,X.children||[]),re.return=q,q=re;break e}else{s(q,H);break}else a(q,H);H=H.sibling}re=fp(X,q.mode,re),re.return=q,q=re}return _(q);case U:return X=no(X),Fe(q,H,X,re)}if(ge(X))return pe(q,H,X,re);if(fe(X)){if(we=fe(X),typeof we!="function")throw Error(r(150));return X=we.call(X),Ee(q,H,X,re)}if(typeof X.then=="function")return Fe(q,H,Zd(X),re);if(X.$$typeof===de)return Fe(q,H,Kd(q,X),re);Wd(q,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,H!==null&&H.tag===6?(s(q,H.sibling),re=p(H,X),re.return=q,q=re):(s(q,H),re=cp(X,q.mode,re),re.return=q,q=re),_(q)):s(q,H)}return function(q,H,X,re){try{Ec=0;var we=Fe(q,H,X,re);return Cs=null,we}catch(Me){if(Me===js||Me===Xd)throw Me;var Ze=nr(29,Me,null,q.mode);return Ze.lanes=re,Ze.return=q,Ze}finally{}}}var io=Kj(!0),Yj=Kj(!1),Xa=!1;function Sp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wp(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Qa(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Za(i,a,s){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(ot&2)!==0){var p=d.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),d.pending=a,a=$d(i),Rj(i,null,s),a}return Ud(i,d,a,s),$d(i)}function Ac(i,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var d=a.lanes;d&=i.pendingLanes,s|=d,a.lanes=s,kw(i,s)}}function jp(i,a){var s=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,s===d)){var p=null,y=null;if(s=s.firstBaseUpdate,s!==null){do{var _={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};y===null?p=y=_:y=y.next=_,s=s.next}while(s!==null);y===null?p=y=a:y=y.next=a}else p=y=a;s={baseState:d.baseState,firstBaseUpdate:p,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},i.updateQueue=s;return}i=s.lastBaseUpdate,i===null?s.firstBaseUpdate=a:i.next=a,s.lastBaseUpdate=a}var Cp=!1;function Oc(){if(Cp){var i=ws;if(i!==null)throw i}}function Nc(i,a,s,d){Cp=!1;var p=i.updateQueue;Xa=!1;var y=p.firstBaseUpdate,_=p.lastBaseUpdate,M=p.shared.pending;if(M!==null){p.shared.pending=null;var L=M,K=L.next;L.next=null,_===null?y=K:_.next=K,_=L;var Z=i.alternate;Z!==null&&(Z=Z.updateQueue,M=Z.lastBaseUpdate,M!==_&&(M===null?Z.firstBaseUpdate=K:M.next=K,Z.lastBaseUpdate=L))}if(y!==null){var ae=p.baseState;_=0,Z=K=L=null,M=y;do{var V=M.lane&-536870913,Q=V!==M.lane;if(Q?(Qe&V)===V:(d&V)===V){V!==0&&V===eo&&(Cp=!0),Z!==null&&(Z=Z.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var pe=i,Ee=M;V=a;var Fe=s;switch(Ee.tag){case 1:if(pe=Ee.payload,typeof pe=="function"){ae=pe.call(Fe,ae,V);break e}ae=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=Ee.payload,V=typeof pe=="function"?pe.call(Fe,ae,V):pe,V==null)break e;ae=D({},ae,V);break e;case 2:Xa=!0}}V=M.callback,V!==null&&(i.flags|=64,Q&&(i.flags|=8192),Q=p.callbacks,Q===null?p.callbacks=[V]:Q.push(V))}else Q={lane:V,tag:M.tag,payload:M.payload,callback:M.callback,next:null},Z===null?(K=Z=Q,L=ae):Z=Z.next=Q,_|=V;if(M=M.next,M===null){if(M=p.shared.pending,M===null)break;Q=M,M=Q.next,Q.next=null,p.lastBaseUpdate=Q,p.shared.pending=null}}while(!0);Z===null&&(L=ae),p.baseState=L,p.firstBaseUpdate=K,p.lastBaseUpdate=Z,y===null&&(p.shared.lanes=0),il|=_,i.lanes=_,i.memoizedState=ae}}function Xj(i,a){if(typeof i!="function")throw Error(r(191,i));i.call(a)}function Qj(i,a){var s=i.callbacks;if(s!==null)for(i.callbacks=null,i=0;iy?y:8;var _=oe.T,M={};M.types=_!==null?_.types:null,oe.T=M,Vp(i,!1,a,s);try{var L=p(),K=oe.S;if(K!==null&&K(M,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var Z=z4(L,d);Dc(i,a,Z,Sr(i))}else Dc(i,a,d,Sr(i))}catch(ae){Dc(i,a,{then:function(){},status:"rejected",reason:ae},Sr())}finally{J.p=y,_!==null&&M.types!==null&&(_.types=M.types),oe.T=_}}function F4(){}function Hp(i,a,s,d){if(i.tag!==5)throw Error(r(476));var p=OC(i).queue;AC(i,p,a,ct,s===null?F4:function(){return NC(i),s(d)})}function OC(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:ct,baseState:ct,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ra,lastRenderedState:ct},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ra,lastRenderedState:s},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function NC(i){var a=OC(i);a.next===null&&(a=i.alternate.memoizedState),Dc(i,a.next.queue,{},Sr())}function Fp(){return jn(qs)}function TC(){return Ht().memoizedState}function RC(){return Ht().memoizedState}function V4(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var s=Sr();i=Qa(s);var d=Za(a,i,s);d!==null&&(lr(d,a,s),Ac(d,a,s)),a={cache:pp()},i.payload=a;return}a=a.return}}function G4(i,a,s){var d=Sr();s={lane:d,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},sh(i)?DC(a,s):(s=sp(i,a,s,d),s!==null&&(lr(s,i,d),PC(s,a,d)))}function MC(i,a,s){var d=Sr();Dc(i,a,s,d)}function Dc(i,a,s,d){var p={lane:d,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(sh(i))DC(a,p);else{var y=i.alternate;if(i.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var _=a.lastRenderedState,M=y(_,s);if(p.hasEagerState=!0,p.eagerState=M,gr(M,_))return Ud(i,a,p,0),St===null&&Ld(),!1}catch{}finally{}if(s=sp(i,a,p,d),s!==null)return lr(s,i,d),PC(s,a,d),!0}return!1}function Vp(i,a,s,d){if(d={lane:2,revertLane:Py(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},sh(i)){if(a)throw Error(r(479))}else a=sp(i,s,d,2),a!==null&&lr(a,i,2)}function sh(i){var a=i.alternate;return i===He||a!==null&&a===He}function DC(i,a){_s=th=!0;var s=i.pending;s===null?a.next=a:(a.next=s.next,s.next=a),i.pending=a}function PC(i,a,s){if((s&4194048)!==0){var d=a.lanes;d&=i.pendingLanes,s|=d,a.lanes=s,kw(i,s)}}var uh={readContext:jn,use:ih,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useLayoutEffect:zt,useInsertionEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useSyncExternalStore:zt,useId:zt,useHostTransitionStatus:zt,useFormState:zt,useActionState:zt,useOptimistic:zt,useMemoCache:zt,useCacheRefresh:zt,useEffectEvent:zt},kC={readContext:jn,use:ih,useCallback:function(i,a){return Gn().memoizedState=[i,a===void 0?null:a],i},useContext:jn,useEffect:yC,useImperativeHandle:function(i,a,s){s=s!=null?s.concat([i]):null,lh(4194308,4,wC.bind(null,a,i),s)},useLayoutEffect:function(i,a){return lh(4194308,4,i,a)},useInsertionEffect:function(i,a){lh(4,2,i,a)},useMemo:function(i,a){var s=Gn();a=a===void 0?null:a;var d=i();if(ao){Ba(!0);try{i()}finally{Ba(!1)}}return s.memoizedState=[d,a],d},useReducer:function(i,a,s){var d=Gn();if(s!==void 0){var p=s(a);if(ao){Ba(!0);try{s(a)}finally{Ba(!1)}}}else p=a;return d.memoizedState=d.baseState=p,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:p},d.queue=i,i=i.dispatch=G4.bind(null,He,i),[d.memoizedState,i]},useRef:function(i){var a=Gn();return i={current:i},a.memoizedState=i},useState:function(i){i=zp(i);var a=i.queue,s=MC.bind(null,He,a);return a.dispatch=s,[i.memoizedState,s]},useDebugValue:$p,useDeferredValue:function(i,a){var s=Gn();return Bp(s,i,a)},useTransition:function(){var i=zp(!1);return i=AC.bind(null,He,i.queue,!0,!1),Gn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,s){var d=He,p=Gn();if(Ve){if(s===void 0)throw Error(r(407));s=s()}else{if(s=a(),St===null)throw Error(r(349));(Qe&127)!==0||nC(d,a,s)}p.memoizedState=s;var y={value:s,getSnapshot:a};return p.queue=y,yC(iC.bind(null,d,y,i),[i]),d.flags|=2048,As(9,{destroy:void 0},rC.bind(null,d,y,s,a),null),s},useId:function(){var i=Gn(),a=St.identifierPrefix;if(Ve){var s=gi,d=vi;s=(d&~(1<<32-mr(d)-1)).toString(32)+s,a="_"+a+"R_"+s,s=nh++,0<\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?_.createElement("select",{is:d.is}):_.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?_.createElement(p,{is:d.is}):_.createElement(p)}}y[wn]=a,y[tr]=d;e:for(_=a.child;_!==null;){if(_.tag===5||_.tag===6)y.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)break e;for(;_.sibling===null;){if(_.return===null||_.return===a)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}a.stateNode=y;e:switch(An(y,p,d),p){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&aa(a)}}return Et(a),a.subtreeFlags&=-33554433,ry(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,s),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==d&&aa(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(r(166));if(i=Ua.current,Ss(a)){if(i=a.stateNode,s=a.memoizedProps,d=null,p=cn,p!==null)switch(p.tag){case 27:case 5:d=p.memoizedProps}i[wn]=a,i=!!(i.nodeValue===s||d!==null&&d.suppressHydrationWarning===!0||iE(i.nodeValue,s)),i||qa(a,!0)}else i=qc(i).createTextNode(d),i[wn]=a,a.stateNode=i}return Et(a),null;case 31:if(s=a.memoizedState,i===null||i.memoizedState!==null){if(d=Ss(a),s!==null){if(i===null){if(!d)throw Error(r(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[wn]=a}else Ql(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Et(a),i=!1}else s=mp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=s),i=!0;if(!i)return a.flags&256?(pr(a),a):(pr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Et(a),null;case 13:if(d=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(p=Ss(a),d!==null&&d.dehydrated!==null){if(i===null){if(!p)throw Error(r(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[wn]=a}else Ql(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Et(a),p=!1}else p=mp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(pr(a),a):(pr(a),null)}return pr(a),(a.flags&128)!==0?(a.lanes=s,a):(s=d!==null,i=i!==null&&i.memoizedState!==null,s&&(d=a.child,p=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(p=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==p&&(d.flags|=2048)),s!==i&&s&&(a.child.flags|=8192),vh(a,a.updateQueue),Et(a),null);case 4:return as(),i===null&&Ly(a.stateNode.containerInfo),a.flags|=67108864,Et(a),null;case 10:return ta(a.type),Et(a),null;case 19:if(Op(a),d=a.memoizedState,d===null)return Et(a),null;if(p=(a.flags&128)!==0,y=d.rendering,y===null)if(p)kc(d,!1);else{if(Lt!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(y=eh(i),y!==null){for(a.flags|=128,kc(d,!1),i=y.updateQueue,a.updateQueue=i,vh(a,i),a.subtreeFlags=0,i=s,s=a.child;s!==null;)Mj(s,i),s=s.sibling;return Tc(a,_n.current&1|2),Ve&&Ji(a,d.treeForkCount),a.child}i=i.sibling}d.tail!==null&&dr()>Ah&&(a.flags|=128,p=!0,kc(d,!1),a.lanes=4194304)}else{if(!p)if(i=eh(y),i!==null){if(a.flags|=128,p=!0,i=i.updateQueue,a.updateQueue=i,vh(a,i),kc(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!y.alternate&&!Ve)return Et(a),null}else 2*dr()-d.renderingStartTime>Ah&&s!==536870912&&(a.flags|=128,p=!0,kc(d,!1),a.lanes=4194304);d.isBackwards?(y.sibling=a.child,a.child=y):(i=d.last,i!==null?i.sibling=y:a.child=y,d.last=y)}if(d.tail!==null){i=d.tail;e:{for(s=i;s!==null;){if(s.alternate!==null){s=!1;break e}s=s.sibling}s=!0}return d.rendering=i,d.tail=i.sibling,d.renderingStartTime=dr(),i.sibling=null,y=_n.current,y=p?y&1|2:y&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!s||Ve?Tc(a,y):(s=y,mt(Cn,a),mt(_n,s),kn===null&&(kn=a)),Ve&&Ji(a,d.treeForkCount),i}return Et(a),null;case 22:case 23:return pr(a),Ep(),d=a.memoizedState!==null,i!==null?i.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(s&536870912)!==0&&(a.flags&128)===0&&(Et(a),a.subtreeFlags&6&&(a.flags|=8192)):Et(a),s=a.updateQueue,s!==null&&vh(a,s.retryQueue),s=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==s&&(a.flags|=2048),i!==null&&At(to),null;case 24:return s=null,i!==null&&(s=i.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),ta(Gt),Et(a),null;case 25:return null;case 30:return a.flags|=33554432,Et(a),null}throw Error(r(156,a.tag))}function W4(i,a){switch(dp(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return ta(Gt),as(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return bd(a),null;case 31:if(a.memoizedState!==null){if(pr(a),a.alternate===null)throw Error(r(340));Ql()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(pr(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Ql()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Op(a),i=a.flags,i&65536?(a.flags=i&-65537|128,i=a.memoizedState,i!==null&&(i.rendering=null,i.tail=null),a.flags|=4,a):null;case 4:return as(),null;case 10:return ta(a.type),null;case 22:case 23:return pr(a),Ep(),i!==null&&At(to),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return ta(Gt),null;case 25:return null;default:return null}}function l_(i,a){switch(dp(a),a.tag){case 3:ta(Gt),as();break;case 26:case 27:case 5:bd(a);break;case 4:as();break;case 31:a.memoizedState!==null&&pr(a);break;case 13:pr(a);break;case 19:Op(a);break;case 10:ta(a.type);break;case 22:case 23:pr(a),Ep(),i!==null&&At(to);break;case 24:ta(Gt)}}function Ic(i,a){try{var s=a.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var p=d.next;s=p;do{if((s.tag&i)===i){d=void 0;var y=s.create,_=s.inst;d=y(),_.destroy=d}s=s.next}while(s!==p)}}catch(M){gt(a,a.return,M)}}function tl(i,a,s){try{var d=a.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var y=p.next;d=y;do{if((d.tag&i)===i){var _=d.inst,M=_.destroy;if(M!==void 0){_.destroy=void 0,p=a;var L=s,K=M;try{K()}catch(Z){gt(p,L,Z)}}}d=d.next}while(d!==y)}}catch(Z){gt(a,a.return,Z)}}function o_(i){var a=i.updateQueue;if(a!==null){var s=i.stateNode;try{Qj(a,s)}catch(d){gt(i,i.return,d)}}}function s_(i,a,s){s.props=lo(i.type,i.memoizedProps),s.state=i.memoizedState;try{s.componentWillUnmount()}catch(d){gt(i,a,d)}}function pi(i,a){try{var s=i.ref;if(s!==null){switch(i.tag){case 26:case 27:case 5:var d=i.stateNode;break;case 30:var p=i.stateNode,y=Qi(i.memoizedProps,p);(p.ref===null||p.ref.name!==y)&&(p.ref=vE(y)),d=p.ref;break;case 7:if(i.stateNode===null){var _=new wr(i);g(i.child,!1,HU,_,void 0,void 0),i.stateNode=_}d=i.stateNode;break;default:d=i.stateNode}typeof s=="function"?i.refCleanup=s(d):s.current=d}}catch(M){gt(i,a,M)}}function En(i,a){var s=i.ref,d=i.refCleanup;if(s!==null)if(typeof d=="function")try{d()}catch(p){gt(i,a,p)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(p){gt(i,a,p)}else s.current=null}function gh(i,a){if((i.tag===5||i.tag===27||i.tag===6)&&i.alternate===null&&a!==null)for(var s=0;s title"))),An(d,a,s),d[wn]=i,un(d),a=d;break e;case"link":if(y=ME("link","href",p).get(a+(s.href||""))){for(_=0;_Fe&&(_=Fe,Fe=Ee,Ee=_);var q=bj(M,Ee),H=bj(M,Fe);if(q&&H&&(Q.rangeCount!==1||Q.anchorNode!==q.node||Q.anchorOffset!==q.offset||Q.focusNode!==H.node||Q.focusOffset!==H.offset)){var X=ae.createRange();X.setStart(q.node,q.offset),Q.removeAllRanges(),Ee>Fe?(Q.addRange(X),Q.extend(H.node,H.offset)):(X.setEnd(H.node,H.offset),Q.addRange(X))}}}}for(ae=[],Q=M;Q=Q.parentNode;)Q.nodeType===1&&ae.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;Ms?32:s,oe.T=null,s=Cy,Cy=null;var y=ii,_=ji;if(Pt=0,co=ii=null,ji=0,(ot&6)!==0)throw Error(r(331));var M=ot;if(ot|=4,R_(y.current),O_(y,y.current,_,s),ot=M,Fc(0,!1),hr&&typeof hr.onPostCommitFiberRoot=="function")try{hr.onPostCommitFiberRoot(oc,y)}catch{}return!0}finally{J.p=p,oe.T=d,q_(i,a)}}function K_(i,a,s){a=Dr(s,a),a=Kp(i.stateNode,a,2),i=Za(i,a,2),i!==null&&(uc(i,2),Ci(i))}function gt(i,a,s){if(i.tag===3)K_(i,i,s);else for(;a!==null;){if(a.tag===3){K_(a,i,s);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(al===null||!al.has(d))){i=Dr(s,i),s=FC(2),d=Za(a,s,2),d!==null&&(VC(s,d,a,i),uc(d,2),Ci(d));break}}a=a.return}}function Ry(i,a,s){var d=i.pingCache;if(d===null){d=i.pingCache=new nU;var p=new Set;d.set(a,p)}else p=d.get(a),p===void 0&&(p=new Set,d.set(a,p));p.has(s)||(Sy=!0,p.add(s),i=cU.bind(null,i,a,s),a.then(i,i))}function cU(i,a,s){var d=i.pingCache;d!==null&&d.delete(a),i.pingedLanes|=i.suspendedLanes&s,i.warmLanes&=~s,St===i&&(Qe&s)===s&&((Lt===4||Lt===3&&(Qe&62914560)===Qe&&300>dr()-Eh)&&(ot&2)===0?Ls(i,0):_h|=s,Ds===Qe&&(Ds=0)),Ci(i)}function Y_(i,a){a===0&&(a=Dw()),i=Yl(i,a),i!==null&&(uc(i,a),Ci(i))}function fU(i){var a=i.memoizedState,s=0;a!==null&&(s=a.retryLane),Y_(i,s)}function dU(i,a){var s=0;switch(i.tag){case 31:case 13:var d=i.stateNode,p=i.memoizedState;p!==null&&(s=p.retryLane);break;case 19:d=i.stateNode;break;case 22:d=i.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(a),Y_(i,s)}function hU(i,a){return Pg(i,a)}var $s=null,Bs=null,My=!1,Ph=!1,Dy=!1,ol=0;function Ci(i){i!==Bs&&i.next===null&&(Bs===null?$s=Bs=i:Bs=Bs.next=i),Ph=!0,My||(My=!0,vU())}function Fc(i,a){if(!Dy&&Ph){Dy=!0;do for(var s=!1,d=$s;d!==null;){if(i!==0){var p=d.pendingLanes;if(p===0)var y=0;else{var _=d.suspendedLanes,M=d.pingedLanes;y=(1<<31-mr(42|i)+1)-1,y&=p&~(_&~M),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(s=!0,W_(d,y))}else y=Qe,y=_d(d,d===St?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||sc(d,y)||(s=!0,W_(d,y));d=d.next}while(s);Dy=!1}}function mU(){X_()}function X_(){Ph=My=!1;var i=0;ol!==0&&EU()&&(i=ol);for(var a=dr(),s=null,d=$s;d!==null;){var p=d.next,y=Q_(d,a);y===0?(d.next=null,s===null?$s=p:s.next=p,p===null&&(Bs=s)):(s=d,(i!==0||(y&3)!==0)&&(Ph=!0)),d=p}Pt!==0&&Pt!==5||Fc(i),ol!==0&&(ol=0)}function Q_(i,a){for(var s=i.suspendedLanes,d=i.pingedLanes,p=i.expirationTimes,y=i.pendingLanes&-62914561;0M)break;var Z=L.transferSize,ae=L.initiatorType;Z&&aE(ae)&&(L=L.responseEnd,_+=Z*(LUh){Ee.length=pe;break}X=new Promise(MU.bind(X)),Ee.push(X)}}}if(0"u"?null:document;function OE(i,a,s){var d=Fs;if(d&&typeof a=="string"&&a){var p=Rr(a);p='link[rel="'+i+'"][href="'+p+'"]',typeof s=="string"&&(p+='[crossorigin="'+s+'"]'),AE.has(p)||(AE.add(p),i={rel:i,crossOrigin:s,href:a},d.querySelector(p)===null&&(a=d.createElement("link"),An(a,"link",i),un(a),d.head.appendChild(a)))}}function ZU(i){oa.D(i),OE("dns-prefetch",i,null)}function WU(i,a){oa.C(i,a),OE("preconnect",i,a)}function JU(i,a,s){oa.L(i,a,s);var d=Fs;if(d&&i&&a){var p='link[rel="preload"][as="'+Rr(a)+'"]';a==="image"&&s&&s.imageSrcSet?(p+='[imagesrcset="'+Rr(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(p+='[imagesizes="'+Rr(s.imageSizes)+'"]')):p+='[href="'+Rr(i)+'"]';var y=p;switch(a){case"style":y=Vs(i);break;case"script":y=Gs(i)}if(!(Ur.has(y)||(i=D({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:i,as:a},s),Ur.set(y,i),d.querySelector(p)!==null||a==="style"&&d.querySelector(Yc(y))||a==="script"&&d.querySelector(Xc(y))))){var _=d.createElement("link");An(_,"link",i),a==="style"&&(_[Ed]=!0,_.onload=_.onerror=function(){Bw(_)}),un(_),d.head.appendChild(_)}}}function e$(i,a){oa.m(i,a);var s=Fs;if(s&&i){var d=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+Rr(d)+'"][href="'+Rr(i)+'"]',y=p;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Gs(i)}if(!Ur.has(y)&&(i=D({rel:"modulepreload",href:i},a),Ur.set(y,i),s.querySelector(p)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Xc(y)))return}d=s.createElement("link"),An(d,"link",i),un(d),s.head.appendChild(d)}}}function t$(i,a,s){oa.S(i,a,s);var d=Fs;if(d&&i){var p=ss(d).hoistableStyles,y=Vs(i);a=a||"default";var _=p.get(y);if(!_){var M={loading:0,preload:null};if(_=d.querySelector(Yc(y)))M.loading=5;else{i=D({rel:"stylesheet",href:i,"data-precedence":a},s),(s=Ur.get(y))&&ex(i,s);var L=_=d.createElement("link");un(L),An(L,"link",i),L._p=new Promise(function(K,Z){L.onload=K,L.onerror=Z}),L.addEventListener("load",function(){M.loading|=1}),L.addEventListener("error",function(){M.loading|=2}),M.loading|=4,zh(_,a,d)}_={type:"stylesheet",instance:_,count:1,state:M},p.set(y,_)}}}function n$(i,a){oa.X(i,a);var s=Fs;if(s&&i){var d=ss(s).hoistableScripts,p=Gs(i),y=d.get(p);y||(y=s.querySelector(Xc(p)),y||(i=D({src:i,async:!0},a),(a=Ur.get(p))&&tx(i,a),y=s.createElement("script"),un(y),An(y,"link",i),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(p,y))}}function r$(i,a){oa.M(i,a);var s=Fs;if(s&&i){var d=ss(s).hoistableScripts,p=Gs(i),y=d.get(p);y||(y=s.querySelector(Xc(p)),y||(i=D({src:i,async:!0,type:"module"},a),(a=Ur.get(p))&&tx(i,a),y=s.createElement("script"),un(y),An(y,"link",i),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(p,y))}}function NE(i,a,s,d){var p=(p=Ua.current)?Kc(p):null;if(!p)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(s=Vs(s.href),a=ss(p).hoistableStyles,d=a.get(s),d||(d={type:"style",instance:null,count:0,state:null},a.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){i=Vs(s.href);var y=ss(p).hoistableStyles,_=y.get(i);if(_||(p=p.ownerDocument||p,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(i,_),(y=p.querySelector(Yc(i)))?y._p||(_.instance=y,_.state.loading=5):(y=Ur.get(i),y||(y={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Ur.set(i,y)),i$(p,i,y,_.state))),a&&d===null)throw Error(r(528,""));return _}if(a&&d!==null)throw Error(r(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(s=Gs(s),a=ss(p).hoistableScripts,d=a.get(s),d||(d={type:"script",instance:null,count:0,state:null},a.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Vs(i){return'href="'+Rr(i)+'"'}function Yc(i){return'link[rel="stylesheet"]['+i+"]"}function TE(i){return D({},i,{"data-precedence":i.precedence,precedence:null})}function i$(i,a,s,d){if(a=i.querySelector('link[rel="preload"][as="style"]['+a+"]")){if(a[Ed]!==!0){d.loading=1;return}}else a=i.createElement("link"),a[Ed]=!0,a.onload=a.onerror=Bw.bind(null,a),An(a,"link",s),un(a),i.head.appendChild(a);d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2})}function Gs(i){return'[src="'+Rr(i)+'"]'}function Xc(i){return"script[async]"+i}function RE(i,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var d=i.querySelector('style[data-href~="'+Rr(s.href)+'"]');if(d)return a.instance=d,un(d),d;var p=D({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return d=(i.ownerDocument||i).createElement("style"),un(d),An(d,"style",p),zh(d,s.precedence,i),a.instance=d;case"stylesheet":p=Vs(s.href);var y=i.querySelector(Yc(p));if(y)return a.state.loading|=4,a.instance=y,un(y),y;d=TE(s),(p=Ur.get(p))&&ex(d,p),y=(i.ownerDocument||i).createElement("link"),un(y);var _=y;return _._p=new Promise(function(M,L){_.onload=M,_.onerror=L}),An(y,"link",d),a.state.loading|=4,zh(y,s.precedence,i),a.instance=y;case"script":return y=Gs(s.src),(p=i.querySelector(Xc(y)))?(a.instance=p,un(p),p):(d=s,(p=Ur.get(y))&&(d=D({},s),tx(d,p)),i=i.ownerDocument||i,p=i.createElement("script"),un(p),An(p,"link",d),i.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,zh(d,s.precedence,i));return a.instance}function zh(i,a,s){for(var d=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=d.length?d[d.length-1]:null,y=p,_=0;_ title"):null)}function a$(i,a,s){if(s===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return i=a.disabled,typeof a.precedence=="string"&&i==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function DE(i,a){return i==="img"&&a.src!=null&&a.src!==""&&a.onLoad==null&&a.loading!=="lazy"}function PE(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function kE(i){return(i.width||100)*(i.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function IE(i,a){typeof a.decode=="function"&&(i.imgCount++,a.complete||(i.imgBytes+=kE(a),i.suspenseyImages.push(a)),i=s$.bind(i),a.decode().then(i,i))}function l$(i,a,s,d){if(s.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var p=Vs(d.href),y=a.querySelector(Yc(p));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=Qc.bind(i),a.then(i,i)),s.state.loading|=4,s.instance=y,un(y);return}y=a.ownerDocument||a,d=TE(d),(p=Ur.get(p))&&ex(d,p),y=y.createElement("link"),un(y);var _=y;_._p=new Promise(function(M,L){_.onload=M,_.onerror=L}),An(y,"link",d),s.instance=y}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(i.count++,s=Qc.bind(i),a.addEventListener("load",s),a.addEventListener("error",s))}}var Uh=0;function o$(i,a){return i.stylesheets&&i.count===0&&Bh(i,i.stylesheets),0Uh?50:800)+a);return i.unsuspend=s,function(){i.unsuspend=null,clearTimeout(d),clearTimeout(p)}}:null}function zE(i){if(i.count===0&&(i.imgCount===0||!i.waitingForImages)){if(i.stylesheets)Bh(i,i.stylesheets);else if(i.unsuspend){var a=i.unsuspend;i.unsuspend=null,a()}}}function Qc(){this.count--,zE(this)}function s$(){this.imgCount--,zE(this)}var $h=null;function Bh(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,$h=new Map,a.forEach(u$,i),$h=null,Qc.call(i))}function u$(i,a){if(!(a.state.loading&4)){var s=$h.get(i);if(s)var d=s.get(null);else{s=new Map,$h.set(i,s);for(var p=i.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),hx.exports=f5(),hx.exports}var h5=d5();function DR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,yA=Ct,lS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return yA(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:o}=t,u=Object.keys(l).map(m=>{const v=n==null?void 0:n[m],g=o==null?void 0:o[m];if(v===null)return null;const x=pA(v)||pA(g);return l[m][x]}),c=n&&Object.entries(n).reduce((m,v)=>{let[g,x]=v;return x===void 0||(m[g]=x),m},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((m,v)=>{let{class:g,className:x,...S}=v;return Object.entries(S).every(w=>{let[j,C]=w;return Array.isArray(C)?C.includes({...o,...c}[j]):{...o,...c}[j]===C})?[...m,g,x]:m},[]);return yA(e,u,h,n==null?void 0:n.class,n==null?void 0:n.className)},m5=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r({classGroupId:e,validator:t}),PR=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),zm="-",xA=[],g5="arbitrary..",p5=e=>{const t=x5(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return y5(u);const c=u.split(zm),h=c[0]===""&&c.length>1?1:0;return kR(c,h,t)},getConflictingClassGroupIds:(u,c)=>{if(c){const h=r[u],m=n[u];return h?m?m5(m,h):h:m||xA}return n[u]||xA}}},kR=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const l=e[t],o=n.nextPart.get(l);if(o){const m=kR(e,t+1,o);if(m)return m}const u=n.validators;if(u===null)return;const c=t===0?e.join(zm):e.slice(t).join(zm),h=u.length;for(let m=0;me.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?g5+r:void 0})(),x5=e=>{const{theme:t,classGroups:n}=e;return b5(n,t)},b5=(e,t)=>{const n=PR();for(const r in e){const l=e[r];oS(l,n,r,t)}return n},oS=(e,t,n,r)=>{const l=e.length;for(let o=0;o{if(typeof e=="string"){w5(e,t,n);return}if(typeof e=="function"){j5(e,t,n,r);return}C5(e,t,n,r)},w5=(e,t,n)=>{const r=e===""?t:IR(t,e);r.classGroupId=n},j5=(e,t,n,r)=>{if(_5(e)){oS(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(v5(n,e))},C5=(e,t,n,r)=>{const l=Object.entries(e),o=l.length;for(let u=0;u{let n=e;const r=t.split(zm),l=r.length;for(let o=0;o"isThemeGetter"in e&&e.isThemeGetter===!0,E5=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const l=(o,u)=>{n[o]=u,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let u=n[o];if(u!==void 0)return u;if((u=r[o])!==void 0)return l(o,u),u},set(o,u){o in n?n[o]=u:l(o,u)}}},z0="!",bA=":",A5=[],SA=(e,t,n,r,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:l}),O5=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=l=>{const o=[];let u=0,c=0,h=0,m;const v=l.length;for(let j=0;jh?m-h:void 0;return SA(o,S,x,w)};if(t){const l=t+bA,o=r;r=u=>u.startsWith(l)?o(u.slice(l.length)):SA(A5,!1,u,void 0,!0)}if(n){const l=r;r=o=>n({className:o,parseClassName:l})}return r},N5=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let l=[];for(let o=0;o0&&(l.sort(),r.push(...l),l=[]),r.push(u)):l.push(u)}return l.length>0&&(l.sort(),r.push(...l)),r}},T5=e=>({cache:E5(e.cacheSize),parseClassName:O5(e),sortModifiers:N5(e),postfixLookupClassGroupIds:R5(e),...p5(e)}),R5=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:l,sortModifiers:o,postfixLookupClassGroupIds:u}=t,c=[],h=e.trim().split(M5);let m="";for(let v=h.length-1;v>=0;v-=1){const g=h[v],{isExternal:x,modifiers:S,hasImportantModifier:w,baseClassName:j,maybePostfixModifierPosition:C}=n(g);if(x){m=g+(m.length>0?" "+m:m);continue}let E=!!C,N;if(E){const D=j.substring(0,C);N=r(D);const k=N&&u[N]?r(j):void 0;k&&k!==N&&(N=k,E=!1)}else N=r(j);if(!N){if(!E){m=g+(m.length>0?" "+m:m);continue}if(N=r(j),!N){m=g+(m.length>0?" "+m:m);continue}E=!1}const O=S.length===0?"":S.length===1?S[0]:o(S).join(":"),T=w?O+z0:O,R=T+N;if(c.indexOf(R)>-1)continue;c.push(R);const A=l(N,E);for(let D=0;D0?" "+m:m)}return m},P5=(...e)=>{let t=0,n,r,l="";for(;t{if(typeof e=="string")return e;let t,n="";for(let r=0;r{let n,r,l,o;const u=h=>{const m=t.reduce((v,g)=>g(v),e());return n=T5(m),r=n.cache.get,l=n.cache.set,o=c,c(h)},c=h=>{const m=r(h);if(m)return m;const v=D5(h,n);return l(h,v),v};return o=u,(...h)=>o(P5(...h))},I5=[],Jt=e=>{const t=n=>n[e]||I5;return t.isThemeGetter=!0,t.themeKey=e,t},LR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,UR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z5=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,L5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,U5=/\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$/,$5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,B5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,H5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ml=e=>z5.test(e),Ge=e=>!!e&&!Number.isNaN(Number(e)),_i=e=>!!e&&Number.isInteger(Number(e)),px=e=>e.endsWith("%")&&Ge(e.slice(0,-1)),sa=e=>L5.test(e),$R=()=>!0,F5=e=>U5.test(e)&&!$5.test(e),sS=()=>!1,V5=e=>B5.test(e),G5=e=>H5.test(e),q5=e=>!je(e)&&!Ce(e),K5=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Y5=e=>Ul(e,FR,sS),je=e=>LR.test(e),ho=e=>Ul(e,VR,F5),wA=e=>Ul(e,nB,Ge),X5=e=>Ul(e,qR,$R),Q5=e=>Ul(e,GR,sS),jA=e=>Ul(e,BR,sS),Z5=e=>Ul(e,HR,G5),Zh=e=>Ul(e,KR,V5),Ce=e=>UR.test(e),nf=e=>Wo(e,VR),W5=e=>Wo(e,GR),CA=e=>Wo(e,BR),J5=e=>Wo(e,FR),eB=e=>Wo(e,HR),Wh=e=>Wo(e,KR,!0),tB=e=>Wo(e,qR,!0),Ul=(e,t,n)=>{const r=LR.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Wo=(e,t,n=!1)=>{const r=UR.exec(e);return r?r[1]?t(r[1]):n:!1},BR=e=>e==="position"||e==="percentage",HR=e=>e==="image"||e==="url",FR=e=>e==="length"||e==="size"||e==="bg-size",VR=e=>e==="length",nB=e=>e==="number",GR=e=>e==="family-name",qR=e=>e==="number"||e==="weight",KR=e=>e==="shadow",rB=()=>{const e=Jt("color"),t=Jt("font"),n=Jt("text"),r=Jt("font-weight"),l=Jt("tracking"),o=Jt("leading"),u=Jt("breakpoint"),c=Jt("container"),h=Jt("spacing"),m=Jt("radius"),v=Jt("shadow"),g=Jt("inset-shadow"),x=Jt("text-shadow"),S=Jt("drop-shadow"),w=Jt("blur"),j=Jt("perspective"),C=Jt("aspect"),E=Jt("ease"),N=Jt("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...T(),Ce,je],A=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],k=()=>[Ce,je,h],I=()=>[ml,"full","auto",...k()],P=()=>[_i,"none","subgrid",Ce,je],B=()=>["auto",{span:["full",_i,Ce,je]},_i,Ce,je],F=()=>[_i,"auto",Ce,je],se=()=>["auto","min","max","fr",Ce,je],ue=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...k()],ne=()=>[ml,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],ie=()=>[c,ml,"screen","full","dvw","lvw","svw","min","max","fit",...k()],ce=()=>[ml,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],U=()=>[e,Ce,je],Ae=()=>[...T(),CA,jA,{position:[Ce,je]}],ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ve=()=>["auto","cover","contain",J5,Y5,{size:[Ce,je]}],z=()=>[px,nf,ho],Y=()=>["","none","full",m,Ce,je],le=()=>["",Ge,nf,ho],fe=()=>["solid","dashed","dotted","double"],De=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Ge,px,CA,jA],ge=()=>["","none",w,Ce,je],oe=()=>["none",Ge,Ce,je],J=()=>["none",Ge,Ce,je],ct=()=>[Ge,Ce,je],Ke=()=>[ml,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sa],breakpoint:[sa],color:[$R],container:[sa],"drop-shadow":[sa],ease:["in","out","in-out"],font:[q5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sa],shadow:[sa],spacing:["px",Ge],text:[sa],"text-shadow":[sa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ml,je,Ce,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,je]}],"container-named":[K5],columns:[{columns:[Ge,"auto",je,Ce,c]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:R()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[_i,"auto",Ce,je]}],basis:[{basis:[ml,"full","auto",c,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,ml,"auto","initial","none",je]}],grow:[{grow:["",Ge,Ce,je]}],shrink:[{shrink:["",Ge,Ce,je]}],order:[{order:[_i,"first","last","none",Ce,je]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":se()}],"auto-rows":[{"auto-rows":se()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...ue(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...ue()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":ue()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],"inline-size":[{inline:["auto",...ie()]}],"min-inline-size":[{"min-inline":["auto",...ie()]}],"max-inline-size":[{"max-inline":["none",...ie()]}],"block-size":[{block:["auto",...ce()]}],"min-block-size":[{"min-block":["auto",...ce()]}],"max-block-size":[{"max-block":["none",...ce()]}],w:[{w:[c,"screen",...ne()]}],"min-w":[{"min-w":[c,"screen","none",...ne()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[u]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh","none",...ne()]}],"font-size":[{text:["base",n,nf,ho]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tB,X5]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",px,je]}],"font-family":[{font:[W5,Q5,t]}],"font-features":[{"font-features":[je]}],"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:[l,Ce,je]}],"line-clamp":[{"line-clamp":[Ge,"none",Ce,wA]}],leading:[{leading:["none",o,...k()]}],"list-image":[{"list-image":["none",Ce,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",Ce,ho]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Ge,"auto",Ce,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"tab-size":[{tab:[_i,Ce,je]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,je]}],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",Ce,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ae()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:ve()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},_i,Ce,je],radial:["",Ce,je],conic:["",_i,Ce,je]},eB,Z5]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-bs":[{"border-bs":le()}],"border-w-be":[{"border-be":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":le()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,Ce,je]}],"outline-w":[{outline:["",Ge,nf,ho]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","inner","none",v,Wh,Zh]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",g,Wh,Zh]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Ge,ho]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",x,Wh,Zh]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Ge,Ce,je]}],"mix-blend":[{"mix-blend":[...De(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":De()}],"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":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ce,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ae()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:ve()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,je]}],filter:[{filter:["","none",Ce,je]}],blur:[{blur:ge()}],brightness:[{brightness:[Ge,Ce,je]}],contrast:[{contrast:[Ge,Ce,je]}],"drop-shadow":[{"drop-shadow":["","none",S,Wh,Zh]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Ge,Ce,je]}],"hue-rotate":[{"hue-rotate":[Ge,Ce,je]}],invert:[{invert:["",Ge,Ce,je]}],saturate:[{saturate:[Ge,Ce,je]}],sepia:[{sepia:["",Ge,Ce,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,je]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,Ce,je]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,Ce,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,Ce,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,Ce,je]}],"backdrop-invert":[{"backdrop-invert":["",Ge,Ce,je]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,Ce,je]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,Ce,je]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,Ce,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",Ce,je]}],ease:[{ease:["linear","initial",E,Ce,je]}],delay:[{delay:[Ge,Ce,je]}],animate:[{animate:["none",N,Ce,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ce,je]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:J()}],"scale-x":[{"scale-x":J()}],"scale-y":[{"scale-y":J()}],"scale-z":[{"scale-z":J()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ce,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ke()}],"translate-x":[{"translate-x":Ke()}],"translate-y":[{"translate-y":Ke()}],"translate-z":[{"translate-z":Ke()}],"translate-none":["translate-none"],zoom:[{zoom:[_i,Ce,je]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Ce,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",Ce,je]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Ge,nf,ho,wA]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","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-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","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-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},iB=k5(rB);function Zt(...e){return iB(Ct(e))}const aB=lS("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium",{variants:{variant:{default:"bg-zinc-800 text-zinc-100 ring-1 ring-zinc-600",secondary:"bg-zinc-800 text-zinc-100 ring-1 ring-zinc-600",count:"bg-zinc-950 text-zinc-50 ring-1 ring-zinc-500",ok:"bg-emerald-950 text-emerald-300 ring-1 ring-emerald-800",bad:"bg-red-950 text-red-200 ring-1 ring-red-800",warn:"bg-amber-950 text-amber-200 ring-1 ring-amber-700"}},defaultVariants:{variant:"default"}});function Oe({className:e,variant:t,...n}){return f.jsx("div",{className:Zt(aB({variant:t}),e),...n})}var lB=Object.defineProperty,uS=(e,t)=>lB(e,"name",{value:t,configurable:!0});function L0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}uS(L0,"setRef");function Bo(...e){return t=>{let n=!1;const r=e.map(l=>{const o=L0(l,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let l=0;loB(e,"name",{value:t,configurable:!0});function Ml(e){const t=b.forwardRef((n,r)=>{let{children:l,...o}=n,u=null,c=!1;const h=[];l=JR(l),b.Children.forEach(l,x=>{var S;if(ZR(x)){c=!0;const w=x;let j="child"in w.props?w.props.child:w.props.children;for(;cS(j)&&typeof Lm=="function";)j=Lm(j._payload);u=cB(w,j),h.push((S=u==null?void 0:u.props)==null?void 0:S.children)}else h.push(x)}),u?u=b.cloneElement(u,void 0,h):!c&&b.Children.count(l)===1&&b.isValidElement(l)&&(u=l);const m=u?QR(u):void 0,v=Kr(r,m);if(!u){if(l||l===0)throw new Error(c?hB(e):dB(e));return l}const g=XR(o,u.props??{});return u.type!==b.Fragment&&(g.ref=r?v:m),b.cloneElement(u,g)});return t.displayName=`${e}.Slot`,t}Nr(Ml,"createSlot");var sB=Ml("Slot"),YR=Symbol.for("radix.slottable");function uB(e){const t=Nr(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=YR,t}Nr(uB,"createSlottable");var cB=Nr((e,t)=>"child"in e.props?b.isValidElement(t)?b.cloneElement(t,void 0,e.props.children(t.props.children)):null:b.isValidElement(t)?t:null,"getSlottableElementFromSlottable");function XR(e,t){const n={...t};for(const r in t){const l=e[r],o=t[r];/^on[A-Z]/.test(r)?l&&o?n[r]=(...c)=>{const h=o(...c);return l(...c),h}:l&&(n[r]=l):r==="style"?n[r]={...l,...o}:r==="className"?n[r]=[l,o].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=eM(o,l))}return{...e,...n}}Nr(XR,"mergeProps");function QR(e){var r,l;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Nr(QR,"getElementRef");function ZR(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===YR}Nr(ZR,"isSlottable");var fB=Symbol.for("react.lazy");function cS(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===fB&&"_payload"in e&&WR(e._payload)}Nr(cS,"isLazyComponent");function WR(e){return typeof e=="object"&&e!==null&&"then"in e}Nr(WR,"isPromiseLike");function JR(e){let t=e;for(;cS(t)&&typeof Lm=="function";)t=Lm(t._payload);return t}Nr(JR,"useUnwrappedLazy");function eM(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&t.add(r);return t.size>0?Array.from(t).join(" "):void 0}Nr(eM,"concatAriaDescribedby");var dB=Nr(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),hB=Nr(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Lm=Ll[" use ".trim().toString()];const mB=lS("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",outline:"border border-border bg-transparent hover:bg-secondary",ghost:"hover:bg-secondary",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-6",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),he=b.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...l},o)=>{const u=r?sB:"button";return f.jsx(u,{className:Zt(mB({variant:t,size:n,className:e})),ref:o,...l})});he.displayName="Button";function ye({className:e,...t}){return f.jsx("div",{className:Zt("rounded-lg border border-border bg-card text-card-foreground shadow-sm",e),...t})}function Ne({className:e,...t}){return f.jsx("div",{className:Zt("flex flex-col gap-1.5 p-4",e),...t})}function Te({className:e,...t}){return f.jsx("h3",{className:Zt("text-base font-semibold leading-none",e),...t})}function ht({className:e,...t}){return f.jsx("p",{className:Zt("text-sm text-muted-foreground",e),...t})}function xe({className:e,...t}){return f.jsx("div",{className:Zt("p-4 pt-0",e),...t})}const $e=b.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:Zt("flex h-10 w-full rounded-md border border-input bg-secondary px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));$e.displayName="Input";var vB=Object.defineProperty,Fu=(e,t)=>vB(e,"name",{value:t,configurable:!0}),tM=!!(typeof window<"u"&&window.document&&window.document.createElement);function $n(e,t,{checkForDefaultPrevented:n=!0}={}){return Fu(function(l){if(e==null||e(l),n===!1||!l||!l.defaultPrevented)return t==null?void 0:t(l)},"handleEvent")}Fu($n,"composeEventHandlers");function gB(e){var t;if(!tM)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Fu(gB,"getOwnerWindow");function U0(e){if(!tM)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Fu(U0,"getOwnerDocument");function nM(e,t=!1){const{activeElement:n}=U0(e);if(!(n!=null&&n.nodeName))return null;if(rM(n)&&n.contentDocument)return nM(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const l=U0(n).getElementById(r);if(l)return l}}return n}Fu(nM,"getActiveElement");function rM(e){return e.tagName==="IFRAME"}Fu(rM,"isFrame");var pB=Object.defineProperty,Fr=(e,t)=>pB(e,"name",{value:t,configurable:!0});function yB(e,t){const n=b.createContext(t);n.displayName=e+"Context";const r=Fr(o=>{const{children:u,...c}=o,h=b.useMemo(()=>c,Object.values(c));return f.jsx(n.Provider,{value:h,children:u})},"Provider");r.displayName=e+"Provider";function l(o,u={}){const{optional:c=!1}=u,h=b.useContext(n);if(h)return h;if(t!==void 0)return t;if(!c)throw new Error(`\`${o}\` must be used within \`${e}\``)}return Fr(l,"useContext"),[r,l]}Fr(yB,"createContext");function Vu(e,t=[]){let n=[];function r(o,u){const c=b.createContext(u);c.displayName=o+"Context";const h=n.length;n=[...n,u];const m=Fr(g=>{var E;const{scope:x,children:S,...w}=g,j=((E=x==null?void 0:x[e])==null?void 0:E[h])||c,C=b.useMemo(()=>w,Object.values(w));return f.jsx(j.Provider,{value:C,children:S})},"Provider");m.displayName=o+"Provider";function v(g,x,S={}){var E;const{optional:w=!1}=S,j=((E=x==null?void 0:x[e])==null?void 0:E[h])||c,C=b.useContext(j);if(C)return C;if(u!==void 0)return u;if(!w)throw new Error(`\`${g}\` must be used within \`${o}\``)}return Fr(v,"useContext"),[m,v]}Fr(r,"createContext");const l=Fr(()=>{const o=n.map(u=>b.createContext(u));return Fr(function(c){const h=(c==null?void 0:c[e])||o;return b.useMemo(()=>({[`__scope${e}`]:{...c,[e]:h}}),[c,h])},"useScope")},"createScope");return l.scopeName=e,[r,iM(l,...t)]}Fr(Vu,"createContextScope");function iM(...e){const t=e[0];if(e.length===1)return t;const n=Fr(()=>{const r=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return Fr(function(o){const u=r.reduce((c,{useScope:h,scopeName:m})=>{const g=h(o)[`__scope${m}`];return{...c,...g}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Fr(iM,"composeContextScopes");var ja=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},xB=Object.defineProperty,nn=(e,t)=>xB(e,"name",{value:t,configurable:!0});function aM(e){const t=e+"CollectionProvider",[n,r]=Vu(t),[l,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=nn(j=>{const{scope:C,children:E}=j,N=b.useRef(null),O=b.useRef(new Map).current;return f.jsx(l,{scope:C,itemMap:O,collectionRef:N,children:E})},"CollectionProvider");u.displayName=t;const c=e+"CollectionSlot",h=Ml(c),m=b.forwardRef((j,C)=>{const{scope:E,children:N}=j,O=o(c,E),T=Kr(C,O.collectionRef);return f.jsx(h,{ref:T,children:N})});m.displayName=c;const v=e+"CollectionItemSlot",g="data-radix-collection-item",x=Ml(v),S=b.forwardRef((j,C)=>{const{scope:E,children:N,...O}=j,T=b.useRef(null),R=Kr(C,T),A=o(v,E);return b.useEffect(()=>(A.itemMap.set(T,{ref:T,...O}),()=>void A.itemMap.delete(T))),f.jsx(x,{[g]:"",ref:R,children:N})});S.displayName=v;function w(j){const C=o(e+"CollectionConsumer",j);return b.useCallback(()=>{const N=C.collectionRef.current;if(!N)return[];const O=Array.from(N.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((A,D)=>O.indexOf(A.ref.current)-O.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return nn(w,"useCollection"),[{Provider:u,Slot:m,ItemSlot:S},w,r]}nn(aM,"createCollection");var _A=new WeakMap,Ft,jr,Jh=(jr=class extends Map{constructor(n){super(n);Ie(this,Ft);be(this,Ft,[...super.keys()]),_A.set(this,!0)}set(n,r){return _A.get(this)&&!this.has(n)&&$(this,Ft).push(n),super.set(n,r),this}insert(n,r,l){const o=this.has(r),u=o?this.size:this.size+1,c=fS(n),h=c>=0?Math.min(c,u-1):Math.max(u+c,0);if(o?$(this,Ft).indexOf(r)===h:h===this.size)return this.set(r,l),this;const m=$(this,Ft).filter(g=>g!==r);m.splice(h,0,r);const v=m.map(g=>[g,g===r?l:this.get(g)]);this.clear();for(const[g,x]of v)this.set(g,x);return this}with(n,r,l){const o=new jr(this);return o.insert(n,r,l),o}before(n){const r=$(this,Ft).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,l){const o=$(this,Ft).indexOf(n);if(o===-1)return this;const u=$(this,Ft).indexOf(r),c=u!==-1&&u=this.size&&(o=this.size-1),this.at(o)}keyFrom(n,r){const l=this.indexOf(n);if(l===-1)return;let o=l+r;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(n,r){let l=0;for(const o of this){if(Reflect.apply(n,r,[o,l,this]))return o;l++}}findIndex(n,r){let l=0;for(const o of this){if(Reflect.apply(n,r,[o,l,this]))return l;l++}return-1}filter(n,r){const l=[];let o=0;for(const u of this)Reflect.apply(n,r,[u,o,this])&&l.push(u),o++;return new jr(l)}map(n,r){const l=[];let o=0;for(const u of this)l.push([u[0],Reflect.apply(n,r,[u,o,this])]),o++;return new jr(l)}reduce(...n){const[r,l]=n,o=n.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let u=0,c=l;for(const h of this)u===0&&!o?c=h:c=Reflect.apply(r,this,[c,h,u,this]),u++;return c}reduceRight(...n){const[r,l]=n,o=n.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let u=l;for(let c=this.size-1;c>=0;c--){const h=this.entryAt(c);c===this.size-1&&!o?u=h:u=Reflect.apply(r,this,[u,h,c,this])}return u}sort(n){if(typeof n!="function")throw new TypeError("OrderedDict.sort requires a compare function");const r=[...this.entries()].sort(n);this.clear();for(const[l,o]of r)this.set(l,o);return this}toSorted(n){if(typeof n!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");const r=[...this.entries()].sort(n);return new jr(r)}toReversed(){const n=new jr;for(let r=this.size-1;r>=0;r--){const l=this.keyAt(r),o=this.get(l);n.set(l,o)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new jr(r)}slice(n,r){const l=new jr;for(const o of $(this,Ft).slice(n,r))l.set(o,this.get(o));return l}every(n,r){let l=0;for(const o of this){if(!Reflect.apply(n,r,[o,l,this]))return!1;l++}return!0}some(n,r){let l=0;for(const o of this){if(Reflect.apply(n,r,[o,l,this]))return!0;l++}return!1}},Ft=new WeakMap,nn(jr,"OrderedDict"),jr);function Am(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=lM(e,t);return n===-1?void 0:e[n]}nn(Am,"at");function lM(e,t){const n=e.length,r=fS(t),l=r>=0?r:n+r;return l<0||l>=n?-1:l}nn(lM,"toSafeIndex");function fS(e){return e!==e||e===0?0:Math.trunc(e)}nn(fS,"toSafeInteger");function bB(e){const t=e+"CollectionProvider",[n,r]=Vu(t),[l,o]=n(t);l.displayName=e+"CollectionStableContextProvider";const[u,c]=n(t);u.displayName=e+"CollectionStatefulContextProvider";const h=nn(({state:A,...D})=>A?f.jsx(v,{...D,state:A}):f.jsx(m,{...D}),"CollectionProvider");h.displayName=t;const m=nn(A=>{const D=N();return f.jsx(v,{...A,state:D})},"CollectionInit");m.displayName=e+"CollectionInit";const v=nn(A=>{const{scope:D,children:k,state:I}=A,P=b.useRef(null),[B,F]=b.useState(null),se=Kr(P,F),[ue,de]=I,G=b.useRef(new Jh),ne=b.useCallback(()=>{const ie=G.current;return uM(ie)||ie.sort(Om),ie},[]);return b.useEffect(()=>{if(!B)return;const ie=cM(()=>{de(ce=>{const U=ce.toSorted(Om);return U.some(([ee],ve)=>ce.keyAt(ve)!==ee)?U:ce})});return ie.observe(B,{childList:!0,subtree:!0}),()=>{ie.disconnect()}},[B,de]),f.jsx(l,{scope:D,collectionElementRef:se,collectionElementRefObject:P,getCollection:ne,setCollection:de,registryRef:G,children:f.jsx(u,{scope:D,collectionElement:B,collection:ue,children:k})})},"CollectionProviderImpl");v.displayName=e+"CollectionProviderImpl";const g=e+"CollectionSlot",x=Ml(g),S=b.forwardRef((A,D)=>{const{scope:k,children:I}=A,P=o(g,k),B=Kr(D,P.collectionElementRef);return f.jsx(x,{ref:B,children:I})});S.displayName=g;const w=e+"CollectionItemSlot",j="data-radix-collection-item",C=Ml(w),E=b.forwardRef((A,D)=>{const{scope:k,children:I,...P}=A,B=b.useRef(null),F=o(w,k),{setCollection:se,registryRef:ue}=F,de=b.useRef(P);oM(de.current,P)||(de.current=P);const G=de.current,ne=b.useCallback(U=>{const Ae=ue.current;U?Ae.set(U,{...de.current,element:U}):B.current&&Ae.delete(B.current)},[ue]),ie=Kr(D,ne,B);ja(()=>{const U=B.current,Ae=ue.current;U&&Ae.has(U)&&Ae.set(U,{...G,element:U})},[G,ue]);const ce=b.useRef(null);return b.useEffect(()=>{const U=B.current,Ae=ce.current;((Ae==null?void 0:Ae.element)??null)===U&&(!U||(Ae==null?void 0:Ae.itemData)===G)||(ce.current=U?{element:U,itemData:G}:null,se(ee=>{const ve=new Jh(ee);return Ae&&Ae.element!==U&&ve.delete(Ae.element),U&&ve.set(U,{...G,element:U}),ve.sort(Om)}))}),b.useEffect(()=>()=>{const U=ce.current;ce.current=null,U&&se(Ae=>{if(!Ae.has(U.element))return Ae;const ee=new Jh(Ae);return ee.delete(U.element),ee})},[se]),f.jsx(C,{[j]:"",ref:ie,children:I})});E.displayName=w;function N(){return b.useState(new Jh)}nn(N,"useInitCollection");function O(A){const{collection:D}=c(e+"CollectionConsumer",A);return D}nn(O,"useCollection");function T(A){const{getCollection:D}=o(e+"CollectionConsumer",A);return D}return nn(T,"useGetCollection"),[{Provider:h,Slot:S,ItemSlot:E},{createCollectionScope:r,useCollection:O,useGetCollection:T,useInitCollection:N}]}nn(bB,"createCollection");function oM(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const l of n)if(!Object.prototype.hasOwnProperty.call(t,l)||e[l]!==t[l])return!1;return!0}nn(oM,"shallowEqual");function sM(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}nn(sM,"isElementPreceding");function uM(e){let t;for(const n of e.keys()){if(t){const r=t.compareDocumentPosition(n);if(!(r&Node.DOCUMENT_POSITION_DISCONNECTED)&&r&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}nn(uM,"isInDocumentOrder");function Om(e,t){return!e[1].element||!t[1].element?0:sM(e[1].element,t[1].element)?-1:1}nn(Om,"sortByDocumentPosition");function cM(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}nn(cM,"getChildListObserver");var SB=Object.defineProperty,wB=(e,t)=>SB(e,"name",{value:t,configurable:!0}),jB=Ll[" useId ".trim().toString()]||(()=>{}),CB=0;function Yr(e){const[t,n]=b.useState(jB());return ja(()=>{e||n(r=>r??String(CB++))},[e]),e||(t?`radix-${t}`:"")}wB(Yr,"useId");var Mv=MR(),_B=Object.defineProperty,EB=(e,t)=>_B(e,"name",{value:t,configurable:!0}),AB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ln=AB.reduce((e,t)=>{const n=Ml(`Primitive.${t}`),r=b.forwardRef((l,o)=>{const{asChild:u,...c}=l,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function fM(e,t){e&&Mv.flushSync(()=>e.dispatchEvent(t))}EB(fM,"dispatchDiscreteCustomEvent");var OB=Object.defineProperty,NB=(e,t)=>OB(e,"name",{value:t,configurable:!0}),EA=Ll[" useInsertionEffect ".trim().toString()];function Ho(e){const t=b.useRef(e);return typeof EA=="function"?EA(()=>{t.current=e}):ja(()=>{t.current=e}),b.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}NB(Ho,"useCallbackRef");var TB=Object.defineProperty,RB=(e,t)=>TB(e,"name",{value:t,configurable:!0}),AA=Ll[" useEffectEvent ".trim().toString()],OA=Ll[" useInsertionEffect ".trim().toString()];function dM(e){if(typeof AA=="function")return AA(e);const t=b.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof OA=="function"?OA(()=>{t.current=e}):ja(()=>{t.current=e}),b.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}RB(dM,"useEffectEvent");var MB=Object.defineProperty,Qf=(e,t)=>MB(e,"name",{value:t,configurable:!0}),DB=Ll[" useInsertionEffect ".trim().toString()]||ja;function Dv({prop:e,defaultProp:t,onChange:n=Qf(()=>{},"onChange"),caller:r}){const[l,o,u]=hM({defaultProp:t,onChange:n}),c=e!==void 0,h=c?e:l,m=b.useCallback(v=>{var g;if(c){const x=mM(v)?v(e):v;x!==e&&((g=u.current)==null||g.call(u,x))}else o(v)},[c,e,o,u]);return[h,m]}Qf(Dv,"useControllableState");function hM({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),l=b.useRef(n),o=b.useRef(t);return DB(()=>{o.current=t},[t]),b.useEffect(()=>{var u;l.current!==n&&((u=o.current)==null||u.call(o,n),l.current=n)},[n,l]),[n,r,o]}Qf(hM,"useUncontrolledState");function mM(e){return typeof e=="function"}Qf(mM,"isFunction");var NA=Symbol("RADIX:SYNC_STATE");function PB(e,t,n,r){const{prop:l,defaultProp:o,onChange:u,caller:c}=t,h=l!==void 0,m=dM(u),v=[{...n,state:o}];r&&v.push(r);const[g,x]=b.useReducer((C,E)=>{if(E.type===NA)return{...C,state:E.state};const N=e(C,E);return h&&!Object.is(N.state,C.state)&&m(N.state),N},...v),S=g.state,w=b.useRef(S);b.useEffect(()=>{w.current!==S&&(w.current=S,h||m(S))},[S,w,h]);const j=b.useMemo(()=>l!==void 0?{...g,state:l}:g,[g,l]);return b.useEffect(()=>{h&&!Object.is(l,g.state)&&x({type:NA,state:l})},[l,g.state,h]),[j,x]}Qf(PB,"useControllableStateReducer");var kB=Object.defineProperty,IB=(e,t)=>kB(e,"name",{value:t,configurable:!0}),zB={LTR:"ltr"},LB=b.createContext(void 0);function dS(e){const t=b.useContext(LB);return e||t||zB.LTR}IB(dS,"useDirection");var UB=Object.defineProperty,hS=(e,t)=>UB(e,"name",{value:t,configurable:!0}),yx=!1;function vM(){const[e,t]=b.useState(yx);return b.useEffect(()=>{yx||(yx=!0,t(!0))},[]),e}hS(vM,"useIsHydrated");var gM=Ll[" useSyncExternalStore ".trim().toString()];function pM(){return()=>{}}hS(pM,"subscribe");function yM(){return gM(pM,()=>!0,()=>!1)}hS(yM,"useIsHydratedModern");var $B=typeof gM=="function"?yM:vM,BB=Object.defineProperty,Jo=(e,t)=>BB(e,"name",{value:t,configurable:!0}),xx="rovingFocusGroup.onEntryFocus",HB={bubbles:!1,cancelable:!0},Pv="RovingFocusGroup",[$0,xM,FB]=aM(Pv),[VB,bM]=Vu(Pv,[FB]),TA={Vertical:"vertical",Horizontal:"horizontal"},GB={RTL:"rtl"},[qB,KB]=VB(Pv),YB=b.forwardRef(Jo(function(t,n){return f.jsx($0.Provider,{scope:t.__scopeRovingFocusGroup,children:f.jsx($0.Slot,{scope:t.__scopeRovingFocusGroup,children:f.jsx(XB,{...t,ref:n})})})},"RovingFocusGroup")),XB=b.forwardRef(Jo(function(t,n){const{__scopeRovingFocusGroup:r,orientation:l,loop:o=!1,dir:u,currentTabStopId:c,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:m,onEntryFocus:v,preventScrollOnEntryFocus:g=!1,...x}=t,S=b.useRef(null),w=Kr(n,S),j=dS(u),[C,E]=Dv({prop:c,defaultProp:h??null,onChange:m,caller:Pv}),[N,O]=b.useState(!1),T=Ho(v),R=xM(r),A=b.useRef(!1),[D,k]=b.useState(0);return b.useEffect(()=>{const I=S.current;if(I)return I.addEventListener(xx,T),()=>I.removeEventListener(xx,T)},[T]),f.jsx(qB,{scope:r,orientation:l,dir:j,loop:o,currentTabStopId:C,onItemFocus:b.useCallback(I=>E(I),[E]),onItemShiftTab:b.useCallback(()=>O(!0),[]),onFocusableItemAdd:b.useCallback(()=>k(I=>I+1),[]),onFocusableItemRemove:b.useCallback(()=>k(I=>I-1),[]),children:f.jsx(ln.div,{tabIndex:N||D===0?-1:0,"data-orientation":l,...x,ref:w,style:{outline:"none",...t.style},onMouseDown:$n(t.onMouseDown,()=>{A.current=!0}),onFocus:$n(t.onFocus,I=>{const P=!A.current;if(I.target===I.currentTarget&&P&&!N){const B=new CustomEvent(xx,HB);if(I.currentTarget.dispatchEvent(B),!B.defaultPrevented){const F=R().filter(ne=>ne.focusable),se=F.find(ne=>ne.active),ue=F.find(ne=>ne.id===C),G=[se,ue,...F].filter(Boolean).map(ne=>ne.ref.current);mS(G,g)}}A.current=!1}),onBlur:$n(t.onBlur,()=>O(!1))})})},"RovingFocusGroupImpl")),QB="RovingFocusGroupItem",ZB=b.forwardRef(Jo(function(t,n){const{__scopeRovingFocusGroup:r,focusable:l=!0,active:o=!1,tabStopId:u,children:c,...h}=t,m=Yr(),v=u||m,g=KB(QB,r),x=g.currentTabStopId===v,S=xM(r),{onFocusableItemAdd:w,onFocusableItemRemove:j,currentTabStopId:C}=g,E=$B();return ja(()=>{if(!(!E||!l))return w(),()=>j()},[E,l,w,j]),b.useEffect(()=>{if(!(E||!l))return w(),()=>j()},[E,l,w,j]),f.jsx($0.ItemSlot,{scope:r,id:v,focusable:l,active:o,children:f.jsx(ln.span,{tabIndex:x?0:-1,"data-orientation":g.orientation,...h,ref:n,onMouseDown:$n(t.onMouseDown,N=>{l?g.onItemFocus(v):N.preventDefault()}),onFocus:$n(t.onFocus,()=>g.onItemFocus(v)),onKeyDown:$n(t.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){g.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const O=wM(N,g.orientation,g.dir);if(O!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let R=S().filter(A=>A.focusable).map(A=>A.ref.current);if(O==="last")R.reverse();else if(O==="prev"||O==="next"){O==="prev"&&R.reverse();const A=R.indexOf(N.currentTarget);R=g.loop?jM(R,A+1):R.slice(A+1)}setTimeout(()=>mS(R))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:C!=null}):c})})},"RovingFocusGroupItem")),WB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function SM(e,t){return t!==GB.RTL?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Jo(SM,"getDirectionAwareKey");function wM(e,t,n){const r=SM(e.key,n);if(!(t===TA.Vertical&&["ArrowLeft","ArrowRight"].includes(r))&&!(t===TA.Horizontal&&["ArrowUp","ArrowDown"].includes(r)))return WB[r]}Jo(wM,"getFocusIntent");function mS(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Jo(mS,"focusFirst");function jM(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Jo(jM,"wrapArray");var JB=Object.defineProperty,Ca=(e,t)=>JB(e,"name",{value:t,configurable:!0});function CM(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}Ca(CM,"useStateMachine");var kv=Ca(e=>{const{present:t,children:n}=e,r=_M(t),l=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),o=EM(r.ref,AM(l));return typeof n=="function"||r.isPresent?b.cloneElement(l,{ref:o}):null},"Presence");function _M(e){const[t,n]=b.useState(),r=b.useRef(null),l=b.useRef(e),o=b.useRef("none"),u=b.useRef(void 0),c=e?"mounted":"unmounted",[h,m]=CM(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{h==="mounted"?(o.current=u.current??ou(r.current),u.current=void 0):o.current="none"},[h]),ja(()=>{const v=r.current,g=l.current;if(g!==e){const S=o.current,w=ou(v);e?(u.current=w,m("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?m("UNMOUNT"):m(g&&S!==w?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,m]),ja(()=>{if(t){let v;const g=t.ownerDocument.defaultView??window,x=Ca(w=>{const C=ou(r.current).includes(CSS.escape(w.animationName));if(w.target===t&&C&&(m("ANIMATION_END"),!l.current)){const E=t.style.animationFillMode;t.style.animationFillMode="forwards",v=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=E)})}},"handleAnimationEnd"),S=Ca(w=>{w.target===t&&(o.current=ou(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",S),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{g.clearTimeout(v),t.removeEventListener("animationstart",S),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:b.useCallback(v=>{if(v){const g=getComputedStyle(v);r.current=g,u.current=ou(g)}else r.current=null;n(v)},[])}}Ca(_M,"usePresence");function B0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ca(B0,"setRef");function EM(...e){const t=b.useRef(e);return t.current=e,b.useCallback(n=>{const r=t.current;let l=!1;const o=r.map(u=>{const c=B0(u,n);return!l&&typeof c=="function"&&(l=!0),c});if(l)return()=>{for(let u=0;ue6(e,"name",{value:t,configurable:!0}),OM={Automatic:"automatic",Manual:"manual"},vS="Tabs",[t6,Fse]=Vu(vS,[bM]),NM=bM(),[n6,gS]=t6(vS),r6=b.forwardRef(Gu(function(t,n){const{__scopeTabs:r,value:l,onValueChange:o,defaultValue:u,orientation:c="horizontal",dir:h,activationMode:m=OM.Automatic,...v}=t,g=dS(h),[x,S]=Dv({prop:l,onChange:o,defaultProp:u??"",caller:vS});return f.jsx(n6,{scope:r,baseId:Yr(),value:x,onValueChange:S,orientation:c,dir:g,activationMode:m,children:f.jsx(ln.div,{dir:g,"data-orientation":c,...v,ref:n})})},"Tabs")),i6="TabsList",TM=b.forwardRef(Gu(function(t,n){const{__scopeTabs:r,loop:l=!0,...o}=t,u=gS(i6,r),c=NM(r);return f.jsx(YB,{asChild:!0,...c,orientation:u.orientation,dir:u.dir,loop:l,children:f.jsx(ln.div,{role:"tablist","aria-orientation":u.orientation,...o,ref:n})})},"TabsList")),a6="TabsTrigger",RM=b.forwardRef(Gu(function(t,n){const{__scopeTabs:r,value:l,disabled:o=!1,...u}=t,c=gS(a6,r),h=NM(r),m=pS(c.baseId,l),v=yS(c.baseId,l),g=l===c.value;return f.jsx(ZB,{asChild:!0,...h,focusable:!o,active:g,children:f.jsx(ln.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":v,"data-state":g?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:m,...u,ref:n,onMouseDown:$n(t.onMouseDown,x=>{!o&&x.button===0&&x.ctrlKey===!1?(x.currentTarget.focus(),c.onValueChange(l)):x.preventDefault()}),onKeyDown:$n(t.onKeyDown,x=>{o||x.target!==x.currentTarget||[" ","Enter"].includes(x.key)&&c.onValueChange(l)}),onFocus:$n(t.onFocus,()=>{const x=c.activationMode!==OM.Manual;!g&&!o&&x&&c.onValueChange(l)})})})},"TabsTrigger")),l6="TabsContent",MM=b.forwardRef(Gu(function(t,n){const{__scopeTabs:r,value:l,forceMount:o,children:u,...c}=t,h=gS(l6,r),m=pS(h.baseId,l),v=yS(h.baseId,l),g=l===h.value,x=b.useRef(g);return b.useEffect(()=>{const S=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(S)},[]),f.jsx(kv,{present:o||g,children:({present:S})=>f.jsx(ln.div,{"data-state":g?"active":"inactive","data-orientation":h.orientation,role:"tabpanel","aria-labelledby":m,hidden:!S,id:v,tabIndex:0,...c,ref:n,style:{...t.style,animationDuration:x.current?"0s":void 0},children:S&&u})})},"TabsContent"));function pS(e,t){return`${e}-trigger-${t}`}Gu(pS,"makeTriggerId");function yS(e,t){return`${e}-content-${t}`}Gu(yS,"makeContentId");const o6=r6,DM=b.forwardRef(({className:e,...t},n)=>f.jsx(TM,{ref:n,className:Zt("inline-flex h-auto flex-wrap gap-1 rounded-lg bg-secondary p-1 text-muted-foreground",e),...t}));DM.displayName=TM.displayName;const wt=b.forwardRef(({className:e,...t},n)=>f.jsx(RM,{ref:n,className:Zt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-2 text-sm font-medium text-zinc-200 transition-all hover:bg-zinc-800/80 hover:text-zinc-50 data-[state=active]:bg-[#f5b700] data-[state=active]:text-[#1a1400] data-[state=active]:shadow data-[state=inactive]:bg-transparent data-[state=inactive]:text-zinc-200 data-[state=inactive]:shadow-none",e),...t}));wt.displayName=RM.displayName;const bt=b.forwardRef(({className:e,...t},n)=>f.jsx(MM,{ref:n,className:Zt("mt-4 focus-visible:outline-none",e),...t}));bt.displayName=MM.displayName;const s6=lS("relative w-full rounded-lg border px-3 py-2 text-sm",{variants:{variant:{default:"border-border bg-secondary text-foreground",destructive:"border-destructive/50 bg-red-950/40 text-red-200",warn:"border-primary/40 bg-amber-950/30 text-amber-100",success:"border-emerald-700/50 bg-emerald-950/30 text-emerald-100"}},defaultVariants:{variant:"default"}});function Bt({className:e,variant:t,...n}){return f.jsx("div",{role:"alert",className:Zt(s6({variant:t}),e),...n})}function rt(e){const t=document.getElementById("toast");t&&(t.textContent=e,t.style.display="block",window.clearTimeout(t._t),t._t=window.setTimeout(()=>{t.style.display="none"},2200))}function RA(){return f.jsx("div",{id:"toast",className:"fixed bottom-6 left-1/2 z-50 hidden max-w-md -translate-x-1/2 rounded-md bg-primary px-4 py-2 text-center font-bold text-zinc-950"})}function ko({value:e}){return e?f.jsx(he,{type:"button",size:"sm",variant:"secondary",className:"ml-1 h-7 px-2 text-xs",onClick:()=>void navigator.clipboard.writeText(e).then(()=>rt("Скопировано")),children:"Копировать"}):null}function u6({a:e}){return f.jsx(Bt,{variant:e.level==="bad"?"destructive":"warn",children:e.accountId?f.jsx("a",{className:"underline underline-offset-2 hover:opacity-90",href:"/admin/?id="+encodeURIComponent(e.accountId),children:e.text}):e.text})}function PM({flash:e}){return e?e.error?f.jsx(Bt,{variant:"destructive",children:e.error}):e.code?f.jsxs(Bt,{variant:"success",children:["Код: ",f.jsx("code",{className:"font-mono tracking-wider",children:e.code})," ",f.jsx(ko,{value:e.code})]}):e.promo?f.jsxs(Bt,{variant:"success",children:["Промо: ",f.jsx("code",{className:"font-mono",children:e.promo})," ",f.jsx(ko,{value:e.promo})]}):e.text?f.jsx(Bt,{children:e.text}):null:null}function rn({className:e}){return f.jsx("div",{className:"animate-pulse rounded-md bg-zinc-800 "+(e||"h-8 w-full")})}function c6(){return f.jsxs("main",{className:"mx-auto w-full max-w-5xl space-y-4 px-4 py-8",children:[f.jsx(rn,{className:"h-10 w-48"}),f.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-4",children:[f.jsx(rn,{className:"h-20"}),f.jsx(rn,{className:"h-20"}),f.jsx(rn,{className:"h-20"}),f.jsx(rn,{className:"h-20"})]}),f.jsx(rn,{className:"h-40"})]})}function f6({className:e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",className:e,"aria-hidden":"true",children:[f.jsx("rect",{x:"0",y:"0",width:"100",height:"100",rx:"20",fill:"#181B22"}),f.jsxs("g",{transform:"translate(9 9) scale(0.82)",children:[f.jsx("rect",{x:"14",y:"22",width:"72",height:"56",rx:"10",fill:"none",stroke:"#F5B700",strokeWidth:"7"}),f.jsx("path",{d:"M44 41 L59 50 L44 59 Z",fill:"#E8EAF0",stroke:"#E8EAF0",strokeWidth:"4",strokeLinejoin:"round"})]})]})}function kM(){return f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(f6,{className:"h-10 w-10 shrink-0"}),f.jsx("h1",{className:"text-2xl font-bold leading-none",children:"OMP Billing"})]})}function IM({status:e}){return e==="expired"?f.jsx(Oe,{variant:"bad",children:"истекла"}):e==="grace"?f.jsx(Oe,{variant:"warn",children:"льготный период"}):e==="expiring"?f.jsx(Oe,{variant:"warn",children:"истекает"}):e==="soon"?f.jsx(Oe,{variant:"warn",children:"до 7 дней"}):e==="unbound"?f.jsx(Oe,{variant:"secondary",children:"без устройства"}):f.jsx(Oe,{variant:"ok",children:"активна"})}function d6({bound:e,limit:t,over:n}){const r=n||e>t;return f.jsxs("span",{className:r?"font-medium text-amber-200":"",children:[e,"/",t,r?" · сверх лимита":""]})}function Iv({page:e,pages:t,total:n,onPage:r}){return n===0?null:f.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 text-sm text-muted-foreground",children:[f.jsxs("span",{children:[n," · стр. ",e," из ",t]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(he,{type:"button",size:"sm",variant:"secondary",disabled:e<=1,onClick:()=>r(e-1),children:"Назад"}),f.jsx(he,{type:"button",size:"sm",variant:"secondary",disabled:e>=t,onClick:()=>r(e+1),children:"Дальше"})]})]})}function MA({rows:e,field:t,label:n}){var l,o;const r=Math.max(1,...e.map(u=>u[t]));return f.jsxs("div",{children:[f.jsx("div",{className:"mb-2 text-sm text-muted-foreground",children:n}),f.jsx("div",{className:"flex h-36 items-end gap-px overflow-x-auto",children:e.map(u=>f.jsx("div",{title:u.day+": "+u[t],className:"flex h-full min-w-[6px] flex-1 flex-col justify-end",children:f.jsx("div",{className:"w-full rounded-sm bg-[#f5b700]",style:{height:Math.max(2,Math.round(u[t]/r*128))+"px"}})},u.day))}),f.jsxs("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[f.jsx("span",{children:((l=e[0])==null?void 0:l.day)||""}),f.jsx("span",{children:((o=e[e.length-1])==null?void 0:o.day)||""})]})]})}async function st(e,t){const n=await fetch(e,{credentials:"same-origin",headers:{Accept:"application/json",...(t==null?void 0:t.headers)||{}},...t}),l=(n.headers.get("content-type")||"").includes("json")?await n.json():{ok:n.ok,status:n.status};return n.status===401?{...l,auth:!1}:l}async function an(e,t,n){return st(e,{method:"POST",headers:{"content-type":"application/json",Accept:"application/json"},body:JSON.stringify({csrf:t,...n})})}function h6(){const[e,t]=b.useState(!1),[n,r]=b.useState(""),[l,o]=b.useState(null),[u,c]=b.useState("");b.useEffect(()=>{if(!(l!=null&&l.token))return;let m=!1;const v=async()=>{const x=await st("/admin/login/telegram/status?token="+encodeURIComponent(l.token));if(!m){if(x.status==="ok"||x.ok){location.href="/admin/";return}if(x.status==="denied"){r("Этот Telegram не входит в список администраторов"),o(null),c("");return}if(x.status==="expired"){r("Ссылка устарела - нажмите «Войти через Telegram» ещё раз"),o(null),c("");return}c("Ожидаю подтверждение в Telegram…")}};v();const g=window.setInterval(()=>void v(),2e3);return()=>{m=!0,window.clearInterval(g)}},[l==null?void 0:l.token]);async function h(){t(!0),r(""),c("");const m=await st("/admin/login/telegram",{method:"POST",headers:{"content-type":"application/json",Accept:"application/json"},body:"{}"});if(t(!1),m.status===403){r("Панель ещё не перезапущена - сервер не знает вход через Telegram.");return}if(!m.ok||!m.token||!m.deepLink){r(m.error||"Не удалось начать вход через Telegram");return}o({token:m.token,deepLink:m.deepLink}),window.open(m.deepLink,"_blank","noopener,noreferrer")}return f.jsx("main",{className:"flex min-h-screen items-center justify-center px-4 py-10",children:f.jsxs("div",{className:"w-full max-w-sm",children:[f.jsxs("div",{className:"mb-6 text-center",children:[f.jsx("div",{className:"flex justify-center",children:f.jsx(kM,{})}),f.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Вход только через Telegram"})]}),n?f.jsx(Bt,{variant:"destructive",className:"mb-4",children:n}):null,u?f.jsx(Bt,{className:"mb-4",children:u}):null,f.jsx(ye,{children:f.jsxs(xe,{className:"space-y-4 pt-6",children:[f.jsx(he,{className:"w-full",disabled:e,onClick:()=>void h(),children:e&&!l?"…":"Войти через Telegram"}),l!=null&&l.deepLink?f.jsxs("p",{className:"text-sm text-muted-foreground",children:["Если бот не открылся:"," ",f.jsx("a",{className:"underline",href:l.deepLink,target:"_blank",rel:"noreferrer",children:"открыть ссылку"})]}):null]})})]})})}const xS=b.forwardRef(({className:e,...t},n)=>f.jsx("textarea",{className:Zt("flex min-h-[80px] w-full rounded-md border border-input bg-secondary px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));xS.displayName="Textarea";function m6(e,t){return!t||t==="all"?!0:t==="week"?e.status==="soon"||e.status==="expiring":t==="active"?!!e.active:t==="unbound"?!!e.active&&!(Number(e.bound)>0):e.status===t}function v6(e,t,n=""){return e&&t.includes(e)||n&&e===n?e:t[0]||""}function g6(e){const t=new Map;for(const r of e||[]){const l=r&&r.accountId;if(!l)continue;const o=t.get(l);(!o||(r.paidUntil||0)>(o.paidUntil||0))&&t.set(l,r)}const n=[];for(const r of t.values())(r.status==="soon"||r.status==="expiring")&&r.telegramId&&n.push(r);return n}const p6="Europe/Moscow",y6="МСК",zM=["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"];function _r(e){return(e<10?"0":"")+e}function Zf(e){const t=new Intl.DateTimeFormat("en-US",{timeZone:p6,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),n={};for(const l of t.formatToParts(new Date(e)))l.type!=="literal"&&(n[l.type]=l.value);let r=Number(n.hour);return r===24&&(r=0),{year:Number(n.year),month:Number(n.month),day:Number(n.day),hour:r,minute:Number(n.minute),second:Number(n.second)}}function H0(e){const t=Zf(e);return t.year+"-"+_r(t.month)+"-"+_r(t.day)}function x6(e,t){const[n,r,l]=e.split("-").map(Number),o=new Date(Date.UTC(n,r-1,l+t));return o.getUTCFullYear()+"-"+_r(o.getUTCMonth()+1)+"-"+_r(o.getUTCDate())}function b6(e){const t=Zf(e);return _r(t.hour)+":"+_r(t.minute)}function Fo(e){const t=Zf(e);return _r(t.day)+"."+_r(t.month)+"."+t.year+" "+_r(t.hour)+":"+_r(t.minute)}function S6(e){const t=Zf(e);return t.day+" "+zM[t.month-1]+" "+t.year+", "+_r(t.hour)+":"+_r(t.minute)+":"+_r(t.second)+" "+y6}function w6(e,t=Date.now()){const n=H0(e),r=H0(t);if(n===r)return"Сегодня";if(n===x6(r,-1))return"Вчера";const l=Zf(e);return l.day+" "+zM[l.month-1]+" "+l.year}function j6(e,t=Date.now()){const n=[];for(const r of e){const l=r.at||0,o=l>0?H0(l):"none",u=l>0?w6(l,t):"Без даты",c=n[n.length-1];c&&c.key===o?c.items.push(r):n.push({key:o,title:u,items:[r]})}return n}function dt({ms:e,variant:t="datetime",toggle:n=!0}){const[r,l]=b.useState(!1);if(!e)return f.jsx("span",{className:"text-muted-foreground",children:"-"});const o=S6(e),u=t==="time"?b6(e):Fo(e)+" МСК",c=r&&n?o:u;return n?f.jsx("button",{type:"button",className:"inline whitespace-nowrap rounded-sm text-left underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:o,"aria-label":o,onClick:h=>{h.stopPropagation(),l(m=>!m)},children:f.jsx("time",{dateTime:new Date(e).toISOString(),children:c})}):f.jsx("time",{dateTime:new Date(e).toISOString(),title:o,className:"whitespace-nowrap",children:u})}function zi(e){return e?Fo(e)+" МСК":""}const C6={user:"пользователь",device:"устройство",admin:"админ",system:"система"};function bS(e,t){const n=(t==null?void 0:t.deviceId)||"",r=(t==null?void 0:t.fallback)||"система";if(!e||!e.kind)return n?"устройство · "+n.slice(0,8):r;const l=C6[e.kind]||e.kind,o=e.label?" · "+e.label:"";let u=l+o;const c=n.slice(0,8);return e.kind==="user"&&c&&u.indexOf(c)<0&&(u+=" · устройство "+c),u}function F0(e,t,n){const r=t?"@"+t.replace(/^@/,""):n||"";return r&&e?r+" · "+e:r||e}const _6={pay:"оплата",promo:"промо",activate:"активация",fail:"отказ",admin:"админ",device:"устройство"},E6={bad_code:"неверный код",expired:"подписка истекла",other_device:"чужое устройство",device_limit:"лимит устройств"},A6={grant:"выдача дней",promo_create:"создание промо",bulk_promo:"пакет промо",bulk_issue:"пакет кодов",issue:"выдача кода",login:"вход",login_fail:"неудачный вход",login_cli:"аварийная ссылка",login_telegram_start:"вход через Telegram",logout:"выход",message:"сообщение",support_reply:"ответ поддержки",support_close:"закрытие диалога",unbind:"сброс устройства",settings_save:"сохранение настроек",services_save:"сохранение сервисов",monitor_run:"проверка мониторинга",monitor_config:"интервал мониторинга",password_change:"смена пароля",session_revoke:"завершение сессии",code_reveal:"показ кода",device_revoke:"отзыв устройства",device_clone:"отключение клона",limit_set:"смена лимита устройств",bonus_grant:"выдача бонусных устройств",bonus_remove:"снятие бонусных устройств",days_subtract:"убавление дней",payment_confirm:"подтверждение платежа",payment_reject:"отклонение платежа",swaps_reset:"сброс счётчика смен",ads_config:"настройки рекламы",ads_banner_add:"новый баннер",ads_banner_save:"изменение баннера",ads_banner_remove:"удаление баннера"},O6={bad_label:"неверная метка",duplicate:"повтор уведомления",amount:"неверная сумма",bad_signature:"неверная подпись",ignored:"игнорирован",webhook:"уведомление",no_account:"нет аккаунта",no_subscription:"нет подписки",unaccepted:"ждёт подтверждения",rejected:"отклонён",refunded:"возврат звёзд"},N6={new:"новая подписка",sub:"продление",dev:"доп. устройство"};function T6(e,t){const n=e&&N6[e]||"метка не найдена";return t?n+" · "+t+" ₽":n}function R6(e){return _6[e]||e}function M6(e){return E6[e]||e||"неизвестно"}function D6(e){return A6[e]||e}function LM(e){return O6[e]||e||"проблема"}function UM(e){return e&&e.provider==="stars"?"Звёзды":e&&e.provider==="crypto"?"Крипта"+(e.asset?" "+e.asset:""):"ЮMoney"}function P6(e){return!e||e==="down"?"недоступен":e==="timeout"?"таймаут":e.indexOf("http_")===0?"ошибка HTTP "+e.slice(5):e}function $M(e,t){const n=u=>'"'+String(u??"").replace(/"/g,'""')+'"',r=t.map(u=>u.map(c=>n(c)).join(",")).join(`
`)+`
-`,l=new Blob([r],{type:"text/csv;charset=utf-8"}),o=document.createElement("a");o.href=URL.createObjectURL(l),o.download=e,o.click(),URL.revokeObjectURL(o.href)}const N6=[["","Все действия"],["login","Вход"],["grant","Выдача дней"],["issue","Выдача кода"],["promo_create","Промо"],["code_reveal","Показ кода"],["device_revoke","Отзыв устройства"],["device_clone","Отключение клона"],["limit_set","Лимит устройств"],["bonus_grant","Бонусные устройства"],["bonus_remove","Снятие бонуса"],["days_subtract","Убавление дней"],["payment_confirm","Подтверждение платежа"],["payment_reject","Отклонение платежа"],["swaps_reset","Сброс смен"],["message","Сообщение"],["settings_save","Настройки"],["ads_config","Реклама: настройки"],["ads_banner_add","Реклама: новый баннер"],["ads_banner_save","Реклама: изменение баннера"],["ads_banner_remove","Реклама: удаление баннера"]],T6=[["","Все причины"],["bad_code","Неверный код"],["expired","Подписка истекла"],["other_device","Чужое устройство"],["device_limit","Лимит устройств"],["extra_expired","Доп. устройство не продлено"]];function RE(e){const t=Number(e)||0;if(t<1024)return t+" Б";const n=["КБ","МБ","ГБ"];let r=t/1024,l=0;for(;r>=1024&&l{r&&o(r)},[r]),b.useEffect(()=>{const B=t.map(F=>F.telegramId);o(F=>u6(F,B,r||""))},[t,r]);function T(B){if(!O.current)return;const F=A.current,se=N.current;F&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{se?se.scrollIntoView({block:"end"}):F.scrollTop=F.scrollHeight})})}b.useEffect(()=>{if(O.current=!0,!u){h([]),v("");return}let B=!1;async function F(){const ue=await ot("/admin/api/support?telegramId="+encodeURIComponent(u));if(B)return;const de=ue.messages||[];h(G=>R6(G,de)?G:de),v(u)}F();const se=window.setInterval(()=>void F(),2500);return()=>{B=!0,window.clearInterval(se)}},[u]),b.useEffect(()=>{T()},[c,u]);async function R(B){var de,G;B.preventDefault();const F=p.trim();if(!u||!F||S)return;w(!0),C("");const se=await Qt("/admin/support",e,{telegramId:u,text:F});if(w(!1),!se.ok||(de=se.flash)!=null&&de.error){C(((G=se.flash)==null?void 0:G.error)||"Не отправилось");return}x(""),O.current=!0;const ue=await ot("/admin/api/support?telegramId="+encodeURIComponent(u));h(ue.messages||[]),v(u),n()}async function E(){var F,se;if(!u||S||!window.confirm("Завершить диалог? Пользователь получит уведомление в боте."))return;w(!0),C("");const B=await Qt("/admin/support-close",e,{telegramId:u});if(w(!1),!B.ok||(F=B.flash)!=null&&F.error){C(((se=B.flash)==null?void 0:se.error)||"Не завершилось");return}n()}const D=t.find(B=>B.telegramId===u),k=!!u&&m!==u,I=!!r&&u===r&&!t.some(B=>B.telegramId===u);return f.jsxs("div",{className:"grid gap-4 lg:grid-cols-[280px_1fr]",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Диалоги"}),f.jsx(ht,{children:"Сообщения из бота"})]}),f.jsxs(xe,{className:"space-y-1",children:[t.length===0&&!I?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Пока пусто"}):null,I?f.jsxs("button",{type:"button",className:"block w-full rounded-md bg-muted px-2 py-2 text-left text-sm",onClick:()=>o(r||""),children:[f.jsx("div",{className:"font-medium",children:r}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"диалог из карточки пользователя"})]}):null,t.map(B=>f.jsxs("button",{type:"button",className:"block w-full rounded-md px-2 py-2 text-left text-sm "+(B.telegramId===u?"bg-muted":"hover:bg-muted/60"),onClick:()=>o(B.telegramId),children:[f.jsx("div",{className:"font-medium",children:H0(B.telegramId,B.username,B.name)}),f.jsx("div",{className:"text-xs text-muted-foreground",children:f.jsx(dt,{ms:B.lastAt,toggle:!1})}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:B.lastText})]},B.telegramId))]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:u?H0(u,D==null?void 0:D.username,D==null?void 0:D.name):"Выберите диалог"}),f.jsx(ht,{children:"Ответ уходит этому пользователю в бота. Ответ на уведомление в Telegram делает то же самое."})]}),f.jsxs(xe,{className:"flex flex-col gap-3",children:[f.jsxs("div",{ref:A,className:"omp-scroll h-80 min-h-0 space-y-2 overflow-y-auto overscroll-contain rounded-md border border-border/60 bg-background/40 p-3",onScroll:()=>{const B=A.current;B&&(O.current=B.scrollHeight-B.scrollTop-B.clientHeight<64)},children:[k?f.jsxs("div",{className:"space-y-2",children:[f.jsx(an,{className:"h-12 w-2/3"}),f.jsx(an,{className:"ml-auto h-12 w-1/2"})]}):null,!k&&c.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:u?"Пока нет сообщений":"Выберите диалог слева"}):null,c.map(B=>f.jsxs("div",{className:B.direction==="out"?"text-right":"",children:[f.jsxs("div",{className:"text-xs text-muted-foreground",children:[B.direction==="out"?"Админ":"Пользователь"," · ",f.jsx(dt,{ms:B.at,toggle:!1}),B.via==="panel"?" · панель":""]}),f.jsx("div",{className:"inline-block max-w-[90%] whitespace-pre-wrap rounded-md bg-muted px-3 py-2 text-sm",children:B.text})]},B.id)),f.jsx("div",{ref:N,className:"h-px w-full shrink-0","aria-hidden":!0})]}),j?f.jsx(Bt,{variant:"destructive",children:j}):null,f.jsxs("form",{className:"shrink-0 space-y-2",onSubmit:B=>void R(B),children:[f.jsx(yS,{value:p,onChange:B=>x(B.target.value),placeholder:"Ответ пользователю",rows:3}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(he,{type:"submit",disabled:S||!u||!p.trim(),children:S?"Отправляю…":"Ответить"}),f.jsx(he,{type:"button",variant:"secondary",disabled:S||!u,onClick:()=>void E(),children:"Завершить диалог"})]})]})]})]})]})}function Wn({className:e,...t}){return f.jsx("div",{className:"relative w-full overflow-auto",children:f.jsx("table",{className:Wt("w-full caption-bottom text-sm",e),...t})})}function Jn({className:e,...t}){return f.jsx("thead",{className:Wt("[&_tr]:border-b",e),...t})}function er({className:e,...t}){return f.jsx("tbody",{className:Wt("[&_tr:last-child]:border-0",e),...t})}function qe({className:e,...t}){return f.jsx("tr",{className:Wt("border-b border-border transition-colors hover:bg-secondary/50",e),...t})}function Se({className:e,...t}){return f.jsx("th",{className:Wt("h-10 px-2 text-left align-middle font-medium text-muted-foreground",e),...t})}function me({className:e,...t}){return f.jsx("td",{className:Wt("p-2 align-middle",e),...t})}const D6=1440*60*1e3;function Dl({label:e,question:t,yes:n,onYes:r,variant:l="secondary",disabled:o}){const[u,c]=b.useState(!1);return u?f.jsxs("span",{className:"inline-flex flex-wrap items-center gap-2 rounded-md border border-amber-700/60 bg-amber-950/30 px-2 py-1 text-sm",children:[f.jsx("span",{children:t}),f.jsx(he,{size:"sm",variant:"destructive",onClick:()=>{c(!1),r()},children:n}),f.jsx(he,{size:"sm",variant:"ghost",onClick:()=>c(!1),children:"Отмена"})]}):f.jsx(he,{size:"sm",variant:l,disabled:o,onClick:()=>c(!0),children:e})}function P6({ms:e}){return e?f.jsx(dt,{ms:e}):f.jsx("span",{className:"text-muted-foreground",children:"не было"})}function k6({user:e}){const t=e.subscription;return!t||!t.overLimit?null:f.jsxs(Bt,{variant:"warn",children:["Устройств больше лимита: привязано ",t.bound," при лимите ",t.deviceLimit,". Устройства сверх лимита (привязанные последними) не работают. Отзовите лишнее или поднимите лимит."]})}function I6({user:e,run:t}){const n=e.subscription,r=e.devices||[],l=n==null?void 0:n.swaps;return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{children:["Устройства"," ",n?f.jsxs(Oe,{variant:n.overLimit?"warn":"count",className:"ml-2 align-middle",children:[r.length," из ",n.deviceLimit]}):null]}),f.jsx(ht,{children:"«Последний раз» - поиск, скачивание или проверка подписки с этого устройства (обновляется не чаще раза в 10 минут). IP хранится без последней части. «Отозвать» отвязывает устройство и сразу гасит его токен, для слота выпускается новый код, пользователю уходит сообщение в Telegram."})]}),f.jsxs(xe,{className:"space-y-3",children:[r.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Привязанных устройств нет"}):null,r.length>0?f.jsxs(Wn,{className:"min-w-[40rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Устройство"}),f.jsx(Se,{children:"Привязано, МСК"}),f.jsx(Se,{children:"Последний раз, МСК"}),f.jsx(Se,{children:"IP"}),f.jsx(Se,{})]})}),f.jsx(er,{children:r.map(o=>f.jsxs(qe,{children:[f.jsxs(me,{className:"font-mono",children:[o.name?f.jsxs("span",{className:"font-sans",children:[o.name," "]}):null,o.deviceId,"…"," ",o.overLimit?f.jsx(Oe,{variant:"warn",className:"ml-1",children:"сверх лимита, не работает"}):null,o.cloneAt?f.jsxs(Oe,{variant:"warn",className:"ml-1",title:"Использованный ключ этого устройства пришёл повторно. Если это не потеря сети - отзовите устройство.",children:["возможен клон",o.cloneCount&&o.cloneCount>1?" ×"+o.cloneCount:""]}):null,f.jsxs("div",{className:"font-sans text-xs text-muted-foreground",children:[o.auth==="refresh"?"новые токены":"старый токен",o.cloneAt?f.jsxs(f.Fragment,{children:[" · клон: ",f.jsx(dt,{ms:o.cloneAt})]}):null]})]}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:o.boundAt})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(P6,{ms:o.lastSeenAt})}),f.jsx(me,{className:"font-mono text-xs",children:o.lastIp||"-"}),f.jsx(me,{children:f.jsx(Dl,{label:"Отозвать",variant:"destructive",question:f.jsxs(f.Fragment,{children:["Отозвать ",o.deviceId,"…? Поиск на нём перестанет работать сразу, пользователь получит сообщение в Telegram."]}),yes:"Да, отозвать",onYes:()=>void t("/admin/device-revoke",{accountId:e.account.id,deviceRowId:o.id||"",codeId:o.codeId,confirm:"yes"})})})]},o.id||o.codeId))})]}):null,l?f.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[f.jsxs("span",{children:["Смены устройства в боте: ",l.used," из ",l.limit," за 30 дней",l.left<1&&l.nextAt?f.jsxs(f.Fragment,{children:[" · следующая с ",Fo(l.nextAt)," МСК"]}):null,l.resetAt?f.jsxs("span",{className:"text-muted-foreground",children:[" ","· сброшен ",f.jsx(dt,{ms:l.resetAt})]}):null]}),f.jsx(Dl,{label:"Сбросить счётчик",question:"Разрешить пользователю ещё 2 смены прямо сейчас?",yes:"Да, сбросить",disabled:l.used===0,onYes:()=>void t("/admin/swaps-reset",{accountId:e.account.id})})]}):null]})]})}function z6({user:e,run:t}){const n=e.subscription,[r,l]=b.useState(n!=null&&n.limitOverride?String(n.limitOverride):""),[o,u]=b.useState(String((n==null?void 0:n.extraSlots)??0)),[c,h]=b.useState("1"),[m,v]=b.useState(""),[p,x]=b.useState("");if(!n)return null;const S=n.globalBase??2,w=n.bonusSlots??0,j=(r.trim()?Number(r)||0:S)+w+(Number(o)||0),C=j<(n.bound||0),A=n.bonus||[];return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{children:["Лимит устройств"," ",f.jsx(Oe,{variant:"count",className:"ml-2 align-middle",children:n.deviceLimit}),n.limitOverride?f.jsx(Oe,{variant:"warn",className:"ml-2 align-middle",children:"индивидуальный лимит"}):null]}),f.jsxs(ht,{children:["Сейчас: ",n.limitText||n.deviceLimit,n.extraSlots?", купленные до "+Fo(n.extraUntil||0)+" МСК":"",". Лимит = база + бонусные + купленные. База - общая из настроек (",S,"), если не задан индивидуальный лимит: он заменяет базу и не меняется, когда меняют общую. Бонусные - бесплатно, навсегда или до даты, в цену продления не входят. Купленные (доп.) - помесячные: выданные здесь действуют до конца оплаченного периода и дальше продлеваются вместе с подпиской."]})]}),f.jsxs(xe,{className:"space-y-4",children:[f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Индивидуальный лимит"}),f.jsx($e,{className:"w-40",type:"number",min:1,max:20,placeholder:"пусто = общий ("+S+")",value:r,onChange:N=>l(N.target.value)})]}),f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Купленные (доп.)"}),f.jsx($e,{className:"w-24",type:"number",min:0,max:20,value:o,onChange:N=>u(N.target.value)})]}),f.jsx(Dl,{label:"Сохранить",variant:"default",question:f.jsxs(f.Fragment,{children:["Лимит станет ",j,r.trim()?" (индивидуальный "+r.trim()+")":" (общая база "+S+")",C?". Привязано "+n.bound+": последние сверх лимита перестанут работать":"",". Сохранить?"]}),yes:"Да, сохранить",onYes:()=>void t("/admin/limit",{accountId:e.account.id,limitOverride:r.trim(),extraSlots:o})})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"text-sm font-medium",children:"Бонусные устройства"}),A.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет"}):null,A.length>0?f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Кол-во"}),f.jsx(Se,{children:"Срок"}),f.jsx(Se,{children:"Причина"}),f.jsx(Se,{children:"Выдано, МСК"}),f.jsx(Se,{})]})}),f.jsx(er,{children:A.map(N=>f.jsxs(qe,{children:[f.jsxs(me,{children:["+",N.count]}),f.jsxs(me,{children:[N.until===null?"навсегда":"до "+Fo(N.until),N.active?null:f.jsx(Oe,{variant:"secondary",className:"ml-1",children:"истёк"})]}),f.jsxs(me,{children:[N.reason||f.jsx("span",{className:"text-muted-foreground",children:"-"}),N.source==="promo"?null:f.jsx("span",{className:"text-xs text-muted-foreground",children:" · вручную"})]}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:N.grantedAt})}),f.jsx(me,{children:f.jsx(Dl,{label:"Снять",question:f.jsxs(f.Fragment,{children:["Снять ",N.count," бонусн. устр.?"]}),yes:"Да, снять",onYes:()=>void t("/admin/bonus-remove",{accountId:e.account.id,bonusId:N.id,confirm:"yes"})})})]},N.id))})]}):null,f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Устройств"}),f.jsx($e,{className:"w-20",type:"number",min:1,max:20,value:c,onChange:N=>h(N.target.value)})]}),f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Дней"}),f.jsx($e,{className:"w-36",type:"number",min:1,max:3650,placeholder:"пусто = навсегда",value:m,onChange:N=>v(N.target.value)})]}),f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Причина"}),f.jsx($e,{className:"w-56",maxLength:80,value:p,onChange:N=>x(N.target.value)})]}),f.jsx(he,{size:"sm",onClick:()=>void t("/admin/bonus",{accountId:e.account.id,count:c,days:m.trim(),reason:p}),children:"Выдать бонус"})]})]})]})]})}function L6({user:e,run:t}){const n=e.subscription,[r,l]=b.useState("1");if(!n||!n.paidUntil)return null;const o=Math.floor(Number(r)),u=Number.isFinite(o)&&o>=1&&o<=3650&&String(o)===r.trim(),c=n.paidUntil-(u?o:0)*D6;return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Убавить дни"}),f.jsx(ht,{children:"Сдвигает окончание назад, например после возврата денег. Если дата уйдёт в прошлое, поиск выключится после льготного периода."})]}),f.jsxs(xe,{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Дней"}),f.jsx($e,{className:"w-24",type:"number",min:1,max:3650,value:r,onChange:h=>l(h.target.value)})]}),f.jsx(Dl,{label:"Убавить",variant:"destructive",disabled:!u,question:f.jsxs(f.Fragment,{children:["Убавить ",o," дн.? Подписка будет до ",Fo(c)," МСК",c<=Date.now()?" - это уже в прошлом":"","."]}),yes:"Да, убавить",onYes:()=>void t("/admin/subtract",{accountId:e.account.id,days:String(o),confirm:"yes"})})]})]})}function zM({rows:e,run:t,accountId:n,showWho:r}){return e.length?f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{children:["Ждут подтверждения в ЮMoney"," ",f.jsx(Oe,{variant:"warn",className:"ml-2 align-middle",children:e.length})]}),f.jsx(ht,{children:"ЮMoney держит эти переводы, пока их не примут в кошельке, и подписку они не продлили. Примите перевод в кошельке и нажмите «Подтвердить платёж» - он применится один раз. «Отклонить» - если перевод отклонён или возвращён."})]}),f.jsx(xe,{className:"space-y-3",children:e.map(l=>f.jsxs("div",{className:"space-y-2 rounded-md border border-amber-800/50 px-3 py-2 text-sm",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(dt,{ms:l.at}),f.jsxs("span",{className:"font-medium",children:[l.amount||"?"," ₽"]}),f.jsx(Oe,{variant:"count",children:C6(l.kind,l.price)}),r&&l.accountId?f.jsx("a",{className:"text-primary",href:"/admin/?id="+encodeURIComponent(l.accountId),children:l.who||"карточка"}):null,f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.operationId})]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(Dl,{label:"Подтвердить платёж",variant:"default",question:f.jsxs(f.Fragment,{children:["Перевод ",l.amount," ₽ принят в кошельке? Подписка продлится сразу, пользователь получит сообщение."]}),yes:"Да, подтвердить",onYes:()=>void t("/admin/payment-confirm",{operationId:l.operationId,accountId:n||"",confirm:"yes"})}),f.jsx(Dl,{label:"Отклонить",question:f.jsxs(f.Fragment,{children:["Убрать платёж ",l.amount," ₽ из ожидания, ничего не продлевая?"]}),yes:"Да, отклонить",onYes:()=>void t("/admin/payment-reject",{operationId:l.operationId,accountId:n||"",confirm:"yes"})})]})]},l.operationId))})]}):null}const xx="omp-grant-days";function U6({user:e,run:t}){var N,O,T,R,E,D,k;const n=e.account.telegramId||"",[r,l]=b.useState(""),[o,u]=b.useState(()=>sessionStorage.getItem(xx)||"30"),[c,h]=b.useState("100"),[m,v]=b.useState({});async function p(I){const P=await ot("/admin/api/reveal?codeId="+encodeURIComponent(I));if(P.auth!==!1){if(!P.formatted){ft("Код уже привязан или скрыт");return}v(B=>({...B,[I]:{formatted:P.formatted||"",openUrl:P.openUrl}}))}}const x=!!((N=e.subscription)!=null&&N.active),S=((O=e.subscription)==null?void 0:O.paidUntil)||0,w=x&&S>0&&S-Date.now()<=1440*60*1e3,j=!!((T=e.subscription)!=null&&T.inGrace),C=e.subscription?j?"grace":x?w?"expiring":"active":"expired":"",A=(e.codes||[]).filter(I=>!I.bound);return f.jsxs("main",{className:"mx-auto w-full max-w-4xl space-y-4 px-4 py-6",children:[f.jsx(he,{variant:"link",className:"px-0",asChild:!0,children:f.jsx("a",{href:"/admin/",children:"← Назад"})}),f.jsx("h1",{className:"text-2xl font-bold",children:"Пользователь"}),f.jsx(TM,{flash:e.flash}),f.jsx(ye,{children:f.jsxs(xe,{className:"space-y-2 pt-6 text-sm",children:[f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Идентификатор"})," ",e.account.id," ",f.jsx(ko,{value:e.account.id})]}),f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Telegram"})," ",n?f.jsxs(f.Fragment,{children:[f.jsx(Oe,{variant:"ok",children:H0(n,e.account.telegramUsername,e.account.telegramName)})," ",f.jsx(ko,{value:n})]}):"-"]}),f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Почта"})," ",e.account.email||"-"]}),f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Создан"})," ",f.jsx(dt,{ms:e.account.createdAt})]}),e.subscription?f.jsxs("p",{className:"flex flex-wrap items-center gap-2",children:["Подписка до ",f.jsx(dt,{ms:e.subscription.paidUntil}),f.jsxs("span",{className:"text-muted-foreground",children:["устройств ",e.subscription.bound??0," из ",e.subscription.deviceLimit,e.subscription.limitText?" ("+e.subscription.limitText+")":""]}),f.jsx(MM,{status:C}),(e.subscription.creditRub||0)>0?f.jsxs("span",{className:"text-muted-foreground",children:["зачёт ",e.subscription.creditRub," ₽"]}):null,f.jsx("input",{className:"h-8 w-20 rounded-md border border-input bg-secondary px-2 text-sm",value:c,onChange:I=>h(I.target.value),"aria-label":"Зачёт, рубли"}),f.jsx(he,{variant:"secondary",onClick:()=>{window.confirm("Начислить зачёт "+c+" ₽?")&&t("/admin/api/credit",{accountId:e.account.id,rub:c,confirm:"yes"})},children:"Зачёт"}),j&&e.subscription.accessUntil?f.jsxs("span",{className:"text-muted-foreground",children:["льготный период до ",f.jsx(dt,{ms:e.subscription.accessUntil})]}):null]}):f.jsx("p",{className:"text-muted-foreground",children:"Нет подписки"})]})}),f.jsx(k6,{user:e}),f.jsx(zM,{rows:e.pending||[],run:t,accountId:e.account.id}),e.subscription?f.jsx(I6,{user:e,run:t}):null,f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Написать пользователю"}),f.jsx(ht,{children:n?"Сообщение уйдёт в Telegram-бота и появится во вкладке «Поддержка».":"У аккаунта нет Telegram - сначала нужна привязка в боте."})]}),f.jsx(xe,{className:"space-y-2",children:n?f.jsxs(f.Fragment,{children:[f.jsx(yS,{value:r,onChange:I=>l(I.target.value),placeholder:"Текст сообщения…",rows:4}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(he,{disabled:!r.trim(),onClick:()=>{const I=r.trim();I&&t("/admin/message",{accountId:e.account.id,text:I}).then(()=>l(""))},children:"Отправить в Telegram"}),f.jsx(he,{variant:"secondary",asChild:!0,children:f.jsx("a",{href:"/admin/?tab=support&tg="+encodeURIComponent(n),children:"Открыть в поддержке"})})]})]}):f.jsx("p",{className:"text-sm text-muted-foreground",children:"Привяжите Telegram в боте или через приложение OMP."})})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Выдать дни"}),f.jsx(ht,{children:"Число дней сохраняется. Перед отправкой будет подтверждение."})]}),f.jsx(xe,{className:"space-y-3",children:f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("label",{className:"text-sm text-muted-foreground",htmlFor:"grant-days",children:"Дней"}),f.jsxs("select",{id:"grant-days",className:"h-10 rounded-md border border-input bg-secondary px-3 text-sm",value:o,onChange:I=>{u(I.target.value),sessionStorage.setItem(xx,I.target.value)},children:[f.jsx("option",{value:"1",children:"1"}),f.jsx("option",{value:"7",children:"7"}),f.jsx("option",{value:"30",children:"30"}),f.jsx("option",{value:"90",children:"90"})]}),f.jsx(he,{onClick:()=>{window.confirm("Выдать +"+o+" дн.?")&&(sessionStorage.setItem(xx,o),t("/admin/grant",{accountId:e.account.id,days:o}))},children:"Выдать"})]})})]}),f.jsx(L6,{user:e,run:t},"sub-"+(((R=e.subscription)==null?void 0:R.paidUntil)||0)),f.jsx(z6,{user:e,run:t},"lim-"+(((E=e.subscription)==null?void 0:E.limitOverride)??"")+"-"+(((D=e.subscription)==null?void 0:D.extraSlots)??"")+"-"+(((k=e.subscription)==null?void 0:k.limitText)??"")),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Свободные коды"}),f.jsx(ht,{children:"Коды ещё не привязанных слотов, открываются кнопкой «Показать». Привязанные - выше, в «Устройствах»."})]}),f.jsxs(xe,{className:"space-y-2",children:[A.length===0?f.jsx("p",{className:"text-muted-foreground",children:"Нет свободных кодов"}):null,A.map(I=>{const P=m[I.id];return f.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[f.jsx("span",{className:"font-mono",children:(P==null?void 0:P.formatted)||(I.bound?"привязан · "+(I.deviceId||""):"скрыт")}),f.jsxs("span",{className:"text-muted-foreground",children:["создан ",f.jsx(dt,{ms:I.createdAt}),I.boundAt?f.jsxs(f.Fragment,{children:[" ","· привязан ",f.jsx(dt,{ms:I.boundAt})]}):null]}),I.bound&&!I.hasPlain&&!P?f.jsx("span",{className:"text-muted-foreground",children:"код стёрт после привязки"}):null,P?f.jsx(ko,{value:P.formatted}):null,I.hasPlain&&!P?f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>void p(I.id),children:"Показать"}):null,P!=null&&P.openUrl?f.jsx(he,{size:"sm",variant:"link",asChild:!0,children:f.jsx("a",{href:P.openUrl,target:"_blank",rel:"noreferrer",children:"Открыть"})}):null]},I.id)})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Платежи"})}),f.jsxs(xe,{children:[(e.payments||[]).length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет платежей"}):null,(e.payments||[]).length>0?f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Когда, МСК"}),f.jsx(Se,{children:"Зачислено"}),f.jsx(Se,{children:"Способ"}),f.jsx(Se,{children:"Комиссия"}),f.jsx(Se,{children:"Метка"}),f.jsx(Se,{children:"Ошибка"})]})}),f.jsx(er,{children:(e.payments||[]).map((I,P)=>f.jsxs(qe,{children:[f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:I.at})}),f.jsx(me,{className:"font-mono",children:I.amount||"-"}),f.jsx(me,{children:kM(I)}),f.jsx(me,{className:"font-mono",children:I.fee==null?"-":I.fee}),f.jsx(me,{className:"font-mono text-xs",children:I.label||"-"}),f.jsxs(me,{children:[I.error?f.jsx(Oe,{variant:"bad",children:PM(I.error)}):null,I.provider==="stars"&&!I.error&&I.operationId?f.jsx(Dl,{label:"Вернуть звёзды",question:"Вернуть звёзды этому пользователю? Дни подписки останутся, их можно убавить отдельно.",yes:"Вернуть",variant:"destructive",onYes:()=>void t("/admin/payment-refund",{operationId:I.operationId,accountId:e.account.id,confirm:"yes"})}):null,!I.error&&I.provider!=="stars"?"-":null]})]},P))})]}):null]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"История просмотра"}),f.jsx(ht,{children:"Шаги, которые приложение прислало с этого аккаунта. Без диагностики список пуст."})]}),f.jsxs(xe,{children:[(e.watch||[]).length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет сигналов"}):null,(e.watch||[]).length>0?f.jsx("ul",{className:"space-y-1 text-sm",children:(e.watch||[]).map((I,P)=>f.jsxs("li",{className:"flex flex-wrap gap-2",children:[f.jsx(dt,{ms:I.at}),f.jsx("span",{children:I.name}),f.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[I.version||""," ",I.platform||""]})]},P))}):null]})]})]})}var $6=Object.defineProperty,B6=(e,t)=>$6(e,"name",{value:t,configurable:!0}),LM=b.forwardRef(B6(function(t,n){return f.jsx(ln.label,{...t,ref:n,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label"));const yt=b.forwardRef(({className:e,...t},n)=>f.jsx(LM,{ref:n,className:Wt("text-sm font-medium text-muted-foreground",e),...t}));yt.displayName=LM.displayName;const bS={mine:"«Мои» (сетка, список, компактно)",discoverGrid:"«Обзор»: сетка подборки",discoverRails:"«Обзор»: главная, между рельсами"},SS={phone:"Телефон",androidTv:"Android TV",webos:"webOS"};function UM(e){return e.impressions?(e.clicks/e.impressions*100).toFixed(1).replace(".",",")+"%":"-"}function Lm(e){return e?new Date(e+10800*1e3).toISOString().slice(0,10):""}function H6(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result||"").replace(/^data:[^,]*,/,"")),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}const wS="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground",$M=["mine","discoverGrid","discoverRails"],BM=["phone","androidTv","webos"],jS=e=>"/v1/ads/img/"+e;function HM(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}const F6=()=>({localId:HM(),enabled:!0,title:"",text:"",advertiser:"",erid:"",url:"",image:"",weight:"1",from:"",to:"",platforms:["phone","androidTv","webos"],sections:["mine","discoverGrid","discoverRails"],tvMode:"qr"});function V6(e){return{localId:HM(),id:e.id,enabled:e.enabled,title:e.title,text:e.text,advertiser:e.advertiser,erid:e.erid,url:e.url,image:e.image,weight:String(e.weight),from:Lm(e.from),to:Lm(e.to),platforms:e.platforms,sections:e.sections,tvMode:e.tvMode}}function ME(e,t,n){const r=e.filter(l=>l!==t);return n?r.concat([t]):r}function G6({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(null),[o,u]=b.useState(30),[c,h]=b.useState(null),[m,v]=b.useState(null),[p,x]=b.useState(!1),[S,w]=b.useState(!1),[j,C]=b.useState(""),A=b.useRef(0),N=b.useRef(!1);async function O(E=o,D=!1){const k=await ot("/admin/api/ads?days="+E);k.auth===!1||!k.config||(n(k.config),l(k.stats||null),D||h(k.config))}b.useEffect(()=>{const E=N.current;N.current=!0;let D=!0;return(async()=>{const k=await ot("/admin/api/ads?days="+o);!D||k.auth===!1||!k.config||(n(k.config),l(k.stats||null),h(I=>E&&I?I:k.config))})(),()=>{D=!1}},[o]);async function T(E,D){var k,I;x(!0);try{const P=await Qt(E,e,D);return(k=P.flash)!=null&&k.error?(C(P.flash.error),ft(P.flash.error)):(C(""),(I=P.flash)!=null&&I.text&&ft(P.flash.text)),P}finally{x(!1)}}if(!t||!c)return f.jsx(an,{className:"h-48"});const R=(E,D,k)=>f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"ads-"+E,children:D}),f.jsx($e,{id:"ads-"+E,inputMode:"numeric",value:String(c[E]),onChange:I=>h({...c,[E]:I.target.value})}),f.jsx("p",{className:"text-xs text-muted-foreground",children:k})]});return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{className:"flex flex-wrap items-center gap-2",children:["Реклама",t.enabled?f.jsx(Oe,{variant:"ok",children:"включена"}):f.jsx(Oe,{variant:"secondary",children:"выключена"}),f.jsxs(Oe,{variant:"secondary",children:["баннеров: ",t.banners.length]})]}),f.jsx(ht,{children:"Свои баннеры (прямые рекламодатели и партнёрки). Приложения читают настройки раз в 5 минут: выключатель доходит до всех за это время. Подписчикам и в «Истории», поиске, режиме выбора рекламы нет."})]}),f.jsxs(xe,{className:"space-y-4",children:[f.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium",children:[f.jsx("input",{type:"checkbox",checked:c.enabled,onChange:E=>h({...c,enabled:E.target.checked})}),"Показывать рекламу (общий выключатель)"]}),f.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"ads-provider",children:"Источник"}),f.jsxs("select",{id:"ads-provider",className:wS+" w-full",value:c.provider,onChange:E=>h({...c,provider:E.target.value}),children:[f.jsx("option",{value:"house",children:"Свои баннеры"}),f.jsx("option",{value:"yandex",disabled:!0,children:"Яндекс (позже)"})]})]}),R("everyN","Каждая N-я карточка","6-30, по умолчанию 10"),R("firstAfter","Первая не раньше карточки","1-60, по умолчанию 10"),R("afterInstallDays","Дней после установки","0-60: до этого рекламы нет"),R("maxPerScreen","На экране не больше","1-2 рекламы"),R("railsEvery","Главная «Обзора»: после каждых N рельс","2-10, первая после 2-й рельсы"),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"ads-minver",children:"Минимальная версия приложения"}),f.jsx($e,{id:"ads-minver",placeholder:"например 0.20.5",value:c.minAppVersion,onChange:E=>h({...c,minAppVersion:E.target.value})}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Пусто: все версии с рекламой"})]})]}),f.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Разделы"}),$M.map(E=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.sections[E],onChange:D=>h({...c,sections:{...c.sections,[E]:D.target.checked}})}),bS[E]]},E))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Платформы"}),BM.map(E=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.platforms[E],onChange:D=>h({...c,platforms:{...c.platforms,[E]:D.target.checked}})}),SS[E]]},E))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Кому не показывать"}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.hideForSubscribers,onChange:E=>h({...c,hideForSubscribers:E.target.checked})}),"Подписчикам OMP (и в льготный период)"]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.tvHideIfLinkedSubscriber,onChange:E=>h({...c,tvHideIfLinkedSubscriber:E.target.checked})}),"ТВ, к которому привязан телефон с подпиской"]})]})]}),c.enabled&&!t.banners.some(E=>E.enabled)?f.jsx(Bt,{variant:"warn",children:"Нет ни одного включённого баннера: приложения рекламу не покажут, пока его нет."}):null,f.jsx(he,{disabled:p,onClick:()=>{const{banners:E,...D}=c;T("/admin/ads/config",D).then(()=>O())},children:"Сохранить настройки рекламы"})]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Баннеры"}),f.jsx(ht,{children:"По закону о рекламе на баннере видны пометка «Реклама», рекламодатель и erid (токен ОРД). Без erid баннер не сохраняется. erid добавляется и в ссылку."})]}),f.jsxs(xe,{className:"space-y-3",children:[t.banners.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Баннеров пока нет"}):null,f.jsx("ul",{className:"space-y-2",children:t.banners.map(E=>f.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border p-2",children:[f.jsx("img",{src:jS(E.image),alt:"",className:"h-16 w-12 rounded object-cover"}),f.jsxs("div",{className:"min-w-0 flex-1 text-sm",children:[f.jsxs("div",{className:"font-medium",children:[E.title," ",E.enabled?null:f.jsx(Oe,{variant:"secondary",children:"выключен"})]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[E.advertiser," · erid ",E.erid," · вес ",E.weight,E.from||E.to?" · "+(Lm(E.from)||"...")+" - "+(Lm(E.to)||"..."):""]})]}),f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>v(V6(E)),children:"Изменить"}),f.jsx(he,{size:"sm",variant:"destructive",disabled:p,onClick:()=>{confirm("Удалить баннер «"+E.title+"»? Статистика по нему останется.")&&T("/admin/ads/banner-remove",{id:E.id,confirm:"yes"}).then(()=>O())},children:"Удалить"})]},E.id))}),m?f.jsx(q6,{draft:m,setDraft:v,busy:p,uploading:S,error:j,onUpload:async E=>{const D=m.localId,k=++A.current;w(!0);try{const I=await H6(E),B=(await T("/admin/ads/image",{mime:E.type,data:I})).extra,F=B&&B.imageId;if(!F||k!==A.current)return;v(se=>se&&se.localId===D?{...se,image:F}:se)}finally{k===A.current&&w(!1)}},onSave:async()=>{const{localId:E,...D}=m;(await T("/admin/ads/banner",{banner:D})).ok&&(v(null),await O())}}):f.jsx(he,{variant:"secondary",onClick:()=>v(F6()),children:"Добавить баннер"})]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Предпросмотр"}),f.jsx(ht,{children:"Так ячейка выглядит в каждом виде карточек на телефоне. Размер всегда как у соседних карточек."})]}),f.jsx(xe,{children:f.jsx(K6,{banner:m||t.banners[0]||null})})]}),f.jsx(Y6,{stats:r,days:o,setDays:u})]})}function q6({draft:e,setDraft:t,busy:n,uploading:r,error:l,onUpload:o,onSave:u}){const c=(m,v,p)=>f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"banner-"+m,children:v}),f.jsx($e,{id:"banner-"+m,type:(p==null?void 0:p.type)||"text",maxLength:p==null?void 0:p.max,placeholder:p==null?void 0:p.placeholder,value:e[m],onChange:x=>t({...e,[m]:x.target.value})}),p!=null&&p.hint?f.jsx("p",{className:"text-xs text-muted-foreground",children:p.hint}):null]}),h=!e.erid.trim();return f.jsxs("div",{className:"space-y-3 rounded-md border border-border p-3",children:[f.jsx("div",{className:"text-sm font-medium",children:e.id?"Изменить баннер":"Новый баннер"}),f.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[c("title","Заголовок",{max:56,hint:"До 56 знаков"}),c("advertiser","Рекламодатель",{placeholder:"ООО «Ромашка», ИНН ...",hint:"Видно на баннере рядом с пометкой «Реклама»"}),c("text","Текст",{max:140,hint:"До 140 знаков, в виде «список» и между рельсами"}),c("erid","erid (токен ОРД)",{placeholder:"2SDnjc...",hint:"Обязательно. Выдаёт ОРД или партнёрская сеть"}),c("url","Ссылка",{placeholder:"https://...",hint:"На ТВ вместо клика QR-код с этой ссылкой"}),c("weight","Вес",{hint:"1-100: чем больше, тем чаще среди баннеров"}),c("from","Показывать с",{type:"date"}),c("to","Показывать по",{type:"date"})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.image?f.jsx("img",{src:jS(e.image),alt:"",className:"h-24 w-16 rounded object-cover"}):f.jsx("div",{className:"flex h-24 w-16 items-center justify-center rounded bg-muted text-xs",children:"нет"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"banner-image",children:"Картинка 2:3 (JPEG, PNG, WebP, до 300 КБ)"}),f.jsx("input",{id:"banner-image",type:"file",accept:"image/jpeg,image/png,image/webp",className:"text-sm",disabled:r,onChange:m=>{const v=m.target.files&&m.target.files[0];v&&o(v)}})]})]}),f.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Разделы"}),$M.map(m=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:e.sections.indexOf(m)>=0,onChange:v=>t({...e,sections:ME(e.sections,m,v.target.checked)})}),bS[m]]},m))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Платформы"}),BM.map(m=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:e.platforms.indexOf(m)>=0,onChange:v=>t({...e,platforms:ME(e.platforms,m,v.target.checked)})}),SS[m]]},m))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"ТВ"}),f.jsxs("select",{className:wS,value:e.tvMode,"aria-label":"Клик на ТВ",onChange:m=>t({...e,tvMode:m.target.value}),children:[f.jsx("option",{value:"qr",children:"QR-код со ссылкой"}),f.jsx("option",{value:"noclick",children:"Только баннер"})]}),f.jsxs("label",{className:"mt-2 flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:e.enabled,onChange:m=>t({...e,enabled:m.target.checked})}),"Баннер включён"]})]})]}),h?f.jsx(Bt,{variant:"warn",children:"Без erid баннер не сохранится: это требование закона о маркировке рекламы."}):null,l?f.jsx(Bt,{variant:"warn",children:l}):null,f.jsxs("div",{className:"flex gap-2",children:[f.jsx(he,{disabled:n||h,onClick:()=>void u(),children:"Сохранить баннер"}),f.jsx(he,{variant:"ghost",onClick:()=>t(null),children:"Отмена"})]})]})}function K6({banner:e}){if(!e)return f.jsx("p",{className:"text-sm text-muted-foreground",children:"Добавьте баннер, чтобы увидеть предпросмотр"});const t=e.image?jS(e.image):"",n=o=>f.jsxs("div",{className:"relative overflow-hidden rounded-lg bg-zinc-800 "+o,style:{aspectRatio:"173 / 240"},children:[t?f.jsx("img",{src:t,alt:"",className:"h-full w-full object-cover"}):null,f.jsx("span",{className:"absolute left-1 top-1 rounded bg-black/70 px-1 text-[10px] font-bold text-amber-300",children:"Реклама"})]}),r=(o,u)=>Array.from({length:o},(c,h)=>f.jsxs("div",{className:"space-y-1",children:[f.jsx("div",{className:"rounded-lg bg-zinc-700/60 "+u,style:{aspectRatio:"173 / 240"}}),f.jsx("div",{className:"h-2 w-3/4 rounded bg-zinc-700/60"})]},h)),l=f.jsxs("div",{className:"min-w-0 space-y-1",children:[n(""),f.jsx("div",{className:"line-clamp-2 text-xs font-semibold",children:e.title||"Заголовок"}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Реклама · ",e.advertiser||"рекламодатель"]}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["erid: ",e.erid||"..."]})]});return f.jsxs("div",{className:"grid gap-4 md:grid-cols-5",children:[f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: крупно (2)"}),f.jsxs("div",{className:"grid grid-cols-2 gap-2 rounded-md bg-zinc-950 p-2",children:[r(1,""),l]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: мелко (3)"}),f.jsxs("div",{className:"grid grid-cols-3 gap-1 rounded-md bg-zinc-950 p-2",children:[r(2,""),l]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: список"}),f.jsxs("div",{className:"flex gap-2 rounded-md bg-zinc-950 p-2",children:[n("w-10 shrink-0"),f.jsxs("div",{className:"min-w-0 text-xs",children:[f.jsx("div",{className:"font-semibold",children:e.title||"Заголовок"}),f.jsx("div",{className:"text-muted-foreground",children:e.text}),f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Реклама · ",e.advertiser||"рекламодатель"," · erid: ",e.erid||"..."]})]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: компактно"}),f.jsxs("div",{className:"rounded-md bg-zinc-950 p-2 text-xs",children:[f.jsx("div",{className:"font-semibold",children:e.title||"Заголовок"}),f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[f.jsx("span",{className:"rounded bg-amber-300/20 px-1 font-bold text-amber-300",children:"Реклама"})," ",e.advertiser||"рекламодатель"," · erid: ",e.erid||"..."]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Обзор»: 4 в ряд"}),f.jsxs("div",{className:"grid grid-cols-4 gap-1 rounded-md bg-zinc-950 p-2",children:[r(3,""),l]})]})]})}function Jh({title:e,rows:t,label:n}){return f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-sm font-medium",children:e}),t.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет данных"}):f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Что"}),f.jsx(Se,{className:"text-right",children:"Показы"}),f.jsx(Se,{className:"text-right",children:"Клики"}),f.jsx(Se,{className:"text-right",children:"CTR"})]})}),f.jsx(er,{children:t.map(r=>f.jsxs(qe,{children:[f.jsx(me,{children:n?n(r.key,r):r.key}),f.jsx(me,{className:"text-right",children:r.impressions}),f.jsx(me,{className:"text-right",children:r.clicks}),f.jsx(me,{className:"text-right",children:UM(r)})]},r.key))})]})]})}function Y6({stats:e,days:t,setDays:n}){return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{className:"flex flex-wrap items-center gap-2",children:["Статистика",f.jsxs("select",{className:wS,value:t,"aria-label":"Период",onChange:r=>n(Number(r.target.value)),children:[f.jsx("option",{value:7,children:"7 дней"}),f.jsx("option",{value:30,children:"30 дней"}),f.jsx("option",{value:90,children:"90 дней"})]})]}),f.jsx(ht,{children:"Показы (ячейка видна наполовину 1 секунду) и клики по дням МСК. Без ID устройств, хранится 90 дней."})]}),f.jsx(xe,{className:"space-y-4",children:e?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"grid grid-cols-3 gap-3",children:[[e.total.impressions,"показов"],[e.total.clicks,"кликов"],[UM(e.total),"CTR"]].map(([r,l])=>f.jsxs("div",{className:"rounded-md border border-border p-3",children:[f.jsx("div",{className:"text-2xl font-bold",children:r}),f.jsx("div",{className:"text-xs text-muted-foreground",children:l})]},l))}),f.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[f.jsx(Jh,{title:"По баннерам",rows:e.byBanner,label:(r,l)=>l.title||l.key}),f.jsx(Jh,{title:"По разделам",rows:e.bySection,label:r=>bS[r]||r}),f.jsx(Jh,{title:"По платформам",rows:e.byPlatform,label:r=>SS[r]||r})]}),f.jsx(Jh,{title:"По дням",rows:e.byDay.filter(r=>r.impressions||r.clicks).reverse().map(r=>({key:r.day,impressions:r.impressions,clicks:r.clicks}))})]}):f.jsx(an,{className:"h-24"})})]})}function DE(e){const t=e||{};return{enabled:t.enabled===!0,yoomoney:t.yoomoney===!0,stars:t.stars===!0,crypto:t.crypto===!0,notifyAll:t.notifyAll===!0,showAmounts:t.showAmounts===!0,amounts:t.amounts||"100,300,500,1000",minRub:String(t.minRub??50),maxRub:String(t.maxRub??1e5),commentMax:String(t.commentMax??200),thanksText:t.thanksText||"Спасибо! Вы поддержали проект OMP.",rubPerStar:String(t.rubPerStar??0),notifyMin:String(t.notifyMin??0)}}function X6(e,t,n){return n?e:t}function Q6(e,t){const n=Object.keys(e);for(let r=0;rDE(e)),[c,h]=b.useState(null),[m,v]=b.useState("all"),[p,x]=b.useState("all"),S=b.useRef(0),w=b.useRef(o);w.current=o;const j=b.useRef({status:m,method:p});j.current={status:m,method:p};const C=c??(t==null?void 0:t.rows)??[],A=t==null?void 0:t.summary,N=(t==null?void 0:t.chart)||[],O=(t==null?void 0:t.top)||[];b.useEffect(()=>{u(P=>X6(P,DE(e),r))},[e,r]);async function T(P=m,B=p){const F=++S.current;if(P==="all"&&B==="all"){const G=PE(F,S.current,null);G!==void 0&&h(G);return}const se=new URLSearchParams;P!=="all"&&se.set("status",P),B!=="all"&&se.set("method",B);const ue=await ot("/admin/api/donations?"+se.toString());if(ue.auth===!1)return;const de=PE(F,S.current,ue.rows||[]);de!==void 0&&h(de)}b.useEffect(()=>{const P=j.current;P.status==="all"&&P.method==="all"||T(P.status,P.method)},[t]);function R(P){l(!0),u(B=>({...B,...P}))}const E=Math.max(1,...N.map(P=>P.rub)),D=[["День",A==null?void 0:A.day],["Неделя",A==null?void 0:A.week],["Месяц",A==null?void 0:A.month]];return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Донаты"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:o.enabled,onChange:P=>R({enabled:P.target.checked})}),"Принимать донаты"]}),f.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.yoomoney,onChange:P=>R({yoomoney:P.target.checked})})," ЮMoney"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.stars,onChange:P=>R({stars:P.target.checked})})," Telegram Stars"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.crypto,onChange:P=>R({crypto:P.target.checked})})," Crypto Pay"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.notifyAll,onChange:P=>R({notifyAll:P.target.checked})})," Уведомлять о каждом"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.showAmounts,onChange:P=>R({showAmounts:P.target.checked})})," Суммы в списке благодарностей"]})]}),f.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[f.jsx(Xs,{label:"Кнопки сумм",value:o.amounts,onChange:P=>R({amounts:P})}),f.jsx(Xs,{label:"Минимум, ₽",value:o.minRub,onChange:P=>R({minRub:P})}),f.jsx(Xs,{label:"Максимум, ₽",value:o.maxRub,onChange:P=>R({maxRub:P})}),f.jsx(Xs,{label:"Комментарий, символов",value:o.commentMax,onChange:P=>R({commentMax:P})}),f.jsx(Xs,{label:"₽ за 1 звезду",value:o.rubPerStar,onChange:P=>R({rubPerStar:P})}),f.jsx(Xs,{label:"Порог уведомления, ₽",value:o.notifyMin,onChange:P=>R({notifyMin:P})})]}),f.jsxs("div",{children:[f.jsx(yt,{children:"Текст благодарности"}),f.jsx($e,{value:o.thanksText,onChange:P=>R({thanksText:P.target.value})})]}),f.jsx(he,{type:"button",onClick:()=>{const P=o;n("/admin/donate",{enabled:P.enabled?"true":"false",yoomoney:P.yoomoney?"true":"false",stars:P.stars?"true":"false",crypto:P.crypto?"true":"false",notifyAll:P.notifyAll?"true":"false",showAmounts:P.showAmounts?"true":"false",amounts:P.amounts,minRub:P.minRub,maxRub:P.maxRub,commentMax:P.commentMax,thanksText:P.thanksText,rubPerStar:P.rubPerStar,notifyMin:P.notifyMin}).then(B=>{l(W6(w.current,P,Z6(B)))})},children:"Сохранить"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Пока флаг выключен, бот отвечает, что донат недоступен. Донат не продлевает подписку. Секреты ЮMoney, Stars и Crypto Pay берутся из тех же настроек оплаты."})]})]}),f.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:D.map(([P,B])=>f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:P})}),f.jsxs(xe,{className:"text-sm",children:[f.jsx("div",{children:em((B==null?void 0:B.sum)||0)}),f.jsxs("div",{className:"text-muted-foreground",children:[(B==null?void 0:B.count)||0," донатов, средний чек ",em((B==null?void 0:B.average)||0)]})]})]},P))}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"30 дней, МСК"})}),f.jsxs(xe,{children:[f.jsx("div",{className:"flex h-36 items-end gap-px overflow-x-auto",children:N.map(P=>f.jsx("div",{title:P.day+": "+P.rub,className:"flex h-full min-w-[6px] flex-1 flex-col justify-end",children:f.jsx("div",{className:"w-full rounded-sm bg-[#f5b700]",style:{height:Math.max(2,Math.round(P.rub/E*128))+"px"}})},P.day))}),f.jsxs("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[f.jsx("span",{children:((k=N[0])==null?void 0:k.day)||""}),f.jsx("span",{children:((I=N[N.length-1])==null?void 0:I.day)||""})]})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Топ"})}),f.jsx(xe,{className:"text-sm",children:O.length?O.map(P=>f.jsxs("div",{children:[P.who,": ",em(P.sum)," (",P.count,")"]},P.who+P.sum)):f.jsx("div",{className:"text-muted-foreground",children:"Пока нет оплаченных донатов"})})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Лента"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsxs("select",{className:"rounded-md border bg-background px-2 py-1 text-sm",value:m,onChange:P=>{v(P.target.value),T(P.target.value,p)},children:[f.jsx("option",{value:"all",children:"все статусы"}),f.jsx("option",{value:"paid",children:"оплачен"}),f.jsx("option",{value:"pending",children:"ждёт"}),f.jsx("option",{value:"refunded",children:"возврат"})]}),f.jsxs("select",{className:"rounded-md border bg-background px-2 py-1 text-sm",value:p,onChange:P=>{x(P.target.value),T(m,P.target.value)},children:[f.jsx("option",{value:"all",children:"все способы"}),f.jsx("option",{value:"yoomoney",children:"ЮMoney"}),f.jsx("option",{value:"stars",children:"Stars"}),f.jsx("option",{value:"crypto",children:"Crypto Pay"})]}),f.jsx("a",{className:"text-sm text-primary",href:"/admin/donations.csv"+(m!=="all"||p!=="all"?"?"+new URLSearchParams({...m!=="all"?{status:m}:{},...p!=="all"?{method:p}:{}}).toString():""),children:"CSV"})]}),f.jsxs("div",{className:"overflow-x-auto",children:[f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"text-muted-foreground",children:[f.jsx("th",{className:"py-1 pr-2",children:"Время"}),f.jsx("th",{className:"py-1 pr-2",children:"Кто"}),f.jsx("th",{className:"py-1 pr-2",children:"Сумма"}),f.jsx("th",{className:"py-1 pr-2",children:"Способ"}),f.jsx("th",{className:"py-1 pr-2",children:"Комментарий"}),f.jsx("th",{className:"py-1 pr-2",children:"Статус"}),f.jsx("th",{className:"py-1",children:"Действия"})]})}),f.jsx("tbody",{children:C.map(P=>f.jsxs("tr",{className:"border-t border-border",children:[f.jsx("td",{className:"py-1 pr-2 whitespace-nowrap",children:P.atText}),f.jsx("td",{className:"py-1 pr-2",children:P.nameHidden?"имя скрыто":P.who||P.telegramId}),f.jsx("td",{className:"py-1 pr-2",children:em(P.amountRub)}),f.jsx("td",{className:"py-1 pr-2",children:P.method}),f.jsx("td",{className:"py-1 pr-2",children:P.commentHidden?"скрыт":P.comment}),f.jsx("td",{className:"py-1 pr-2",children:P.held&&P.status==="pending"?"ждёт в ЮMoney":J6[P.status]||P.status}),f.jsxs("td",{className:"py-1 space-x-2 whitespace-nowrap",children:[P.held&&P.status==="pending"?f.jsx("button",{type:"button",className:"text-primary",onClick:()=>{window.confirm("Подтвердить удержанный донат? Подписка не продлится.")&&n("/admin/donate/confirm",{id:P.id,confirm:"yes"}).then(()=>T())},children:"Подтвердить"}):null,P.status==="paid"?f.jsx("button",{type:"button",className:"text-primary",onClick:()=>{window.confirm("Отметить возврат? Деньги этой кнопкой не уходят.")&&n("/admin/donate/refund",{id:P.id,confirm:"yes"}).then(()=>T())},children:"Возврат"}):null,f.jsx("button",{type:"button",className:"text-primary",onClick:()=>void n("/admin/donate/hide",{id:P.id,field:"comment"}).then(()=>T()),children:P.commentHidden?"Вернуть комментарий":"Скрыть комментарий"}),f.jsx("button",{type:"button",className:"text-primary",onClick:()=>void n("/admin/donate/hide",{id:P.id,field:"name"}).then(()=>T()),children:P.nameHidden?"Вернуть имя":"Скрыть имя"})]})]},P.id))})]}),C.length?null:f.jsx("div",{className:"py-3 text-sm text-muted-foreground",children:"Пусто"})]})]})]})]})}function Xs({label:e,value:t,onChange:n}){return f.jsxs("label",{className:"block text-sm",children:[f.jsx("span",{className:"mb-1 block text-muted-foreground",children:e}),f.jsx($e,{value:t,onChange:r=>n(r.target.value)})]})}function t8({csrf:e,settings:t,journal:n,run:r}){const[l,o]=b.useState(t||{}),[u,c]=b.useState(n||[]),[h,m]=b.useState(!1),[v,p]=b.useState("");b.useEffect(()=>{o(t||{})},[t]),b.useEffect(()=>{c(n||[])},[n]);const x=async(w,j)=>{var A;const C={...l,...w};m(!0),p("");try{const N={settings:C,...j?{cancelId:j}:{}},O=r?await r(N):await Qt("/admin/referral",e,N);if(!O||O.auth===!1||O.ok===!1||(A=O.flash)!=null&&A.error){p(O&&O.flash&&O.flash.error||"Не сохранилось");return}o(C),j&&c(T=>T.map(R=>R.id===j?{...R,status:"cancelled",reason:"manual"}:R))}catch{p("Не сохранилось")}finally{m(!1)}},S=w=>void x({[w]:!l[w]});return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Реферальная программа"})}),f.jsxs(xe,{className:"space-y-3",children:[v?f.jsx("p",{className:"text-sm text-destructive",children:v}):null,f.jsx(he,{type:"button",variant:l.enabled?"default":"secondary",disabled:h,onClick:()=>S("enabled"),children:l.enabled?"Программа включена":"Программа выключена"}),f.jsx(yt,{children:"Дни рефереру (макс. 14)"}),f.jsx($e,{defaultValue:String(l.referrerDays??0),onBlur:w=>void x({referrerDays:Number(w.target.value)})}),f.jsx(yt,{children:"Бонусные дни другу (макс. 14)"}),f.jsx($e,{defaultValue:String(l.friendDays??0),onBlur:w=>void x({friendDays:Number(w.target.value)})}),f.jsx(yt,{children:"Процент на баланс"}),f.jsx($e,{defaultValue:String(l.balancePercent??0),onBlur:w=>void x({balancePercent:Number(w.target.value)})}),f.jsx(he,{type:"button",variant:l.tiers?"default":"secondary",disabled:h,onClick:()=>S("tiers"),children:"Уровни 3/5/10"}),f.jsx(he,{type:"button",variant:l.friendDiscount?"default":"secondary",disabled:h,onClick:()=>S("friendDiscount"),children:"Скидка другу"}),f.jsx(he,{type:"button",variant:l.retention?"default":"secondary",disabled:h,onClick:()=>S("retention"),children:"Бонус удержания"}),f.jsxs("p",{className:"text-sm text-muted-foreground",children:["Начисление через ",l.delayDays??7," дн. после оплаты. Годовой лимит ",l.yearlyCap??12," мес. Только при активной подписке реферера и оплате друга."]}),f.jsx("h3",{className:"font-semibold",children:"Журнал"}),u.length===0?f.jsx("p",{className:"text-sm",children:"Начислений нет"}):u.map(w=>f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsxs("span",{children:[w.friendId||w.id," · ",w.status," · ",w.days," дн."]}),w.status!=="cancelled"?f.jsx(he,{type:"button",variant:"secondary",disabled:h,onClick:()=>void x({},w.id),children:"Отменить"}):null]},w.id))]})]})}const n8=[["all","Все пункты"],["tech","Только техническое"],["user","Только для пользователей"]],r8={phone:"Телефон",tv:"ТВ",lg:"LG",atv:"Android TV"};function i8(e,t,n){const r=[];return e.forEach(l=>{if(!n&&l.beta)return;const o=l.items.filter(u=>t==="all"?!0:t==="tech"?u.tech:!u.tech);o.length&&r.push({...l,items:o})}),r}function a8(e){return e.unreleased?"Не выпущено":e.version}const l8="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground",kE=12;function o8(){const[e,t]=b.useState(null),[n,r]=b.useState("ru"),[l,o]=b.useState("all"),[u,c]=b.useState(!1),[h,m]=b.useState(kE),[v,p]=b.useState("");b.useEffect(()=>{let j=!1;return ot("/admin/api/changelog").then(C=>{if(!j){if(C.auth===!1){p("Нужен вход");return}t(C)}}).catch(C=>{j||p(C instanceof Error?C.message:"Не удалось загрузить")}),()=>{j=!0}},[]);const x=e?n==="en"&&(e.en||[]).length?e.en||[]:e.ru||[]:[],S=i8(x,l,u),w=x.reduce((j,C)=>j+C.items.filter(A=>A.tech).length,0);return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Изменения"}),f.jsxs(ht,{children:["Полный CHANGELOG из main на GitHub. Пункты ",f.jsx("code",{children:"[tech]"})," видны только здесь: в приложении, релизе и Telegram их нет."]})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("select",{className:l8,value:l,"aria-label":"Какие пункты",onChange:j=>o(j.target.value),children:n8.map(([j,C])=>f.jsx("option",{value:j,children:C},j))}),f.jsxs("div",{className:"flex gap-1",role:"group","aria-label":"Язык",children:[f.jsx(he,{size:"sm",variant:n==="ru"?"default":"secondary",onClick:()=>r("ru"),children:"RU"}),f.jsx(he,{size:"sm",variant:n==="en"?"default":"secondary",onClick:()=>r("en"),disabled:!e||!(e.en||[]).length,children:"EN"})]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[f.jsx("input",{type:"checkbox",checked:u,onChange:j=>c(j.target.checked)}),"Бета-версии"]}),e!=null&&e.ok?f.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:[w," тех. пунктов · загружено ",f.jsx(dt,{ms:n==="en"?e.enFetchedAt:e.fetchedAt})]}):null]}),v?f.jsx(Bt,{variant:"destructive",children:v}):null,e&&!e.ok?f.jsxs(Bt,{variant:"destructive",children:["GitHub не ответил",e.error?": "+e.error:"",". Попробуйте позже."]}):null,e!=null&&e.ok&&e.stale?f.jsxs(Bt,{variant:"warn",children:["Показана сохранённая копия: GitHub не ответил",e.error?" ("+e.error+")":"","."]}):null,e!=null&&e.ok&&n==="en"&&e.enStale?f.jsxs(Bt,{variant:"warn",children:["Английский текст из сохранённой копии",e.enFetchedAt?"":" (не загружался)",": CHANGELOG.en.md не ответил",e.enError?" ("+e.enError+")":"","."]}):null,e===null&&!v?f.jsx(an,{className:"h-24"}):e!=null&&e.ok&&S.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Пунктов нет"}):f.jsxs("div",{className:"space-y-4",children:[S.slice(0,h).map(j=>f.jsxs("section",{className:"space-y-2",children:[f.jsxs("h3",{className:"flex flex-wrap items-center gap-2 text-base font-semibold",children:[a8(j),j.unreleased?f.jsx(Oe,{variant:"warn",children:"не в релизе"}):null,j.beta?f.jsx(Oe,{variant:"secondary",children:"бета"}):null]}),f.jsx("ul",{className:"space-y-1 text-sm",children:j.items.map((C,A)=>f.jsxs("li",{className:"flex items-start gap-2 rounded-md px-2 py-1 "+(C.tech?"border-l-2 border-amber-500 bg-amber-950/30":"border-l-2 border-transparent"),children:[C.tech?f.jsx(Oe,{variant:"warn",className:"shrink-0",children:"tech"}):null,C.platform?f.jsx(Oe,{variant:"secondary",className:"shrink-0",children:r8[C.platform]||C.platform}):null,f.jsx("span",{className:"min-w-0 flex-1 "+(C.tech?"text-amber-100":""),children:C.text})]},A))})]},j.version)),S.length>h?f.jsxs(he,{variant:"secondary",onClick:()=>m(j=>j+kE),children:["Показать ещё (",S.length-h,")"]}):null]})]})]})}const FM="omp-admin-monitor-view",IE={filter:"all",sort:"status",desc:!1,q:"",open:{}},F0={all:"Все",errors:"Только ошибки",noalert:"Без алерта",code:"Просит код"},V0={status:"Статус",name:"Название",ms:"Время ответа",time:"Время проверки"};function s8(e){try{const t=e?e.getItem(FM):null;if(!t)return{...IE,open:{}};const n=JSON.parse(t),r={};if(n.open&&typeof n.open=="object")for(const[l,o]of Object.entries(n.open))typeof o=="boolean"&&/^[a-z]{1,20}$/.test(l)&&(r[l]=o);return{filter:n.filter&&n.filter in F0?n.filter:"all",sort:n.sort&&n.sort in V0?n.sort:"status",desc:n.desc===!0,q:typeof n.q=="string"?n.q.slice(0,100):"",open:r}}catch{return{...IE,open:{}}}}function u8(e,t){try{e&&e.setItem(FM,JSON.stringify(t))}catch{}}function c8(e){const t=[],n=new Map;for(const r of e){const l=/^(.*):(direct|warp|site)$/.exec(r.id),o=l?l[1]:r.path==="jackett"?r.id:"";if(!o){t.push({key:r.id,kind:"check",name:r.name,target:r.target||"",checks:[r],check:r});continue}let u=n.get(o);u||(u={key:o,kind:"tracker",name:r.name,target:"",checks:[]},n.set(o,u),t.push(u)),u.checks.push(r),r.target&&!u.target&&r.path!=="jackett"&&(u.target=r.target),r.path==="jackett"?u.search=r:l&&l[2]==="direct"?u.direct=r:l&&l[2]==="warp"?u.warp=r:u.site=r}return t}function G0(e){return e.checks.some(t=>t.ok===!1)?!1:e.checks.some(t=>t.ok===!0)?!0:null}const CS=e=>e.ok===!0&&!!e.warn;function VM(e){const t=G0(e);return t===!1?"red":t===null?"none":e.checks.some(CS)?"yellow":"green"}function f8(e){const t=e%10,n=e%100,r=t===1&&n!==11?"жёлтая":t>=2&&t<=4&&(n<12||n>14)?"жёлтые":"жёлтых";return e+" "+r}const d8={red:0,yellow:1,none:2,green:3},zE=e=>d8[VM(e)],LE=e=>Math.max(0,...e.checks.map(t=>Number(t.ms)||0)),UE=e=>Math.max(0,...e.checks.map(t=>Number(t.at)||0));function h8(e,t){const n=e.checks.filter(r=>r.ok===!1);return t==="errors"?n.length>0:t==="code"?e.checks.some(CS):t==="noalert"?n.length>0&&n.every(r=>!r.alert):!0}function m8(e,t){const n=t.trim().toLowerCase();return n?[e.name,e.target,e.key,...e.checks.map(l=>l.detail)].join(" ").toLowerCase().includes(n):!0}function v8(e,t,n){const r=(o,u)=>o.name.localeCompare(u.name,"ru"),l=(o,u)=>t==="name"?r(o,u):t==="ms"?LE(o)-LE(u)||r(o,u):t==="time"?UE(o)-UE(u)||r(o,u):zE(o)-zE(u)||r(o,u);return e.map((o,u)=>({it:o,i:u})).sort((o,u)=>(n?-l(o.it,u.it):l(o.it,u.it))||o.i-u.i).map(o=>o.it)}function g8(e,t,n){const r=n.filter!=="all"||!!n.q.trim(),l=[];e.forEach(u=>{const c=t.filter(C=>C.group===u.id);if(!c.length)return;const h=c8(c),m=c.filter(C=>C.ok===!1).length,v=v8(h.filter(C=>h8(C,n.filter)&&m8(C,n.q)),n.sort,n.desc);if(r&&!v.length)return;const p=n.open[u.id],x=h.filter(C=>G0(C)===!0).length,S=h.filter(C=>G0(C)===null).length,w=h.filter(C=>VM(C)==="yellow").length,j=r?!1:p===void 0?x===h.length:!p;l.push({id:u.id,title:u.title,total:h.length,okCount:x,warned:w,skipped:S,failed:m,folded:j,items:v})});const o=new Map(e.map((u,c)=>[u.id,c]));return l.sort((u,c)=>(u.failed?0:1)-(c.failed?0:1)||(o.get(u.id)||0)-(o.get(c.id)||0))}const p8={queued:"в очереди",running:"проверяется",retry:"ждёт повтора",done:"готово"},GM=b.createContext({states:{},running:!1,pending:[],recheck:()=>{}});function q0({ids:e,red:t,recheckIds:n}){const r=n||e,l=b.useContext(GM),o=e.map(c=>l.states[c]).filter(Boolean),u=r.some(c=>l.pending.includes(c));if(l.running&&o.length){const c=o.includes("running")?"running":o.includes("retry")?"retry":o.includes("queued")?"queued":"done";return f.jsxs(Oe,{variant:c==="done"?"ok":c==="retry"?"warn":"secondary",className:"ml-2 align-middle","data-row-state":c,children:[c==="running"?f.jsx("span",{className:"mr-1 inline-block h-2 w-2 animate-spin rounded-full border border-current border-t-transparent"}):null,p8[c]]})}return!t||!r.length?null:f.jsxs(he,{type:"button",size:"sm",variant:"outline",className:"ml-2 h-7 px-2 text-xs",disabled:l.running||u,title:l.running?"Идёт проверка, дождитесь конца":"Проверить заново только эту строку",onClick:()=>l.recheck(r),"data-recheck":r.join(","),children:[u?f.jsx("span",{className:"mr-1 inline-block h-2 w-2 animate-spin rounded-full border border-current border-t-transparent"}):null,"Перепроверить"]})}const $E={direct:"напрямую",warp:"через WARP",jackett:"через Jackett",internal:"внутр. сеть"};function _S({ok:e,alerted:t,warn:n}){return e===!0&&n?f.jsx(Oe,{variant:"warn","data-status":"code",title:"Сайт отвечает страницей с капчей или проверкой на робота. Человек откроет, алерта нет.",children:"Просит код"}):e===!0?f.jsx(Oe,{variant:"ok",children:"ок"}):e===!1?f.jsx(Oe,{variant:"bad",children:t?"ошибка · в Telegram":"ошибка"}):f.jsx(Oe,{variant:"secondary",children:"-"})}function K0({strip:e,uptime:t}){return f.jsxs("div",{className:"flex items-center gap-2",title:"7 дней, по часам: зелёный - всё ок, красный - была ошибка, серый - нет данных",children:[f.jsx("div",{className:"flex h-3.5 items-stretch overflow-hidden rounded-sm","data-testid":"history-strip",children:e.split("").map((n,r)=>f.jsx("span",{className:"w-[2px] "+(n==="g"?"bg-emerald-600":n==="r"?"bg-red-600":"bg-zinc-800")},r))}),f.jsx("span",{className:"w-12 text-right text-xs text-muted-foreground",children:t==null?"-":t+"%"})]})}function qM({path:e}){return!e||!$E[e]?null:f.jsx(Oe,{variant:"secondary",className:"ml-2 align-middle",children:$E[e]})}function Um(e){return new Date(e).toLocaleTimeString("ru-RU",{timeZone:"Europe/Moscow",hour12:!1})}function KM({row:e}){return e?f.jsxs("span",{className:"text-xs",children:[e.detail||"-",e.ms?f.jsxs("span",{className:"text-muted-foreground",children:[" · ",e.ms," мс"]}):null,e.at?f.jsxs("span",{className:"text-muted-foreground",children:[" · ",Um(e.at)]}):null,e.retried&&e.ok===!1?f.jsx("span",{className:"text-muted-foreground",children:" · повтор через 30 с"}):null,!e.alert&&e.ok===!1?f.jsx("span",{className:"text-muted-foreground",children:" · без алерта"}):null]}):f.jsx("span",{className:"text-muted-foreground",children:"-"})}function BE(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function y8({rows:e}){return f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{className:"w-28",children:"Статус"}),f.jsx(Se,{children:"Проверка"}),f.jsx(Se,{children:"Результат"}),f.jsx(Se,{className:"w-[240px]",children:"7 дней"})]})}),f.jsx(er,{children:e.map(t=>f.jsxs(qe,{"data-check":t.id,children:[f.jsx(me,{children:f.jsx(_S,{ok:t.ok,alerted:t.alerted,warn:t.warn})}),f.jsxs(me,{className:"font-medium",children:[t.name,t.group==="containers"?null:f.jsx(qM,{path:t.path}),f.jsx(q0,{ids:[t.id],red:t.ok===!1})]}),f.jsxs(me,{children:[f.jsx(KM,{row:t}),t.context?f.jsx("div",{className:"text-xs text-muted-foreground",children:t.context}):null]}),f.jsx(me,{children:f.jsx(K0,{strip:t.history,uptime:t.uptime})})]},t.id))})]})}function bx({row:e}){return e?f.jsxs("div",{className:"space-y-1",children:[f.jsx(_S,{ok:e.ok,alerted:e.alerted,warn:e.warn}),f.jsxs("div",{className:"max-w-[260px] text-xs text-muted-foreground",children:[e.detail,e.ms?" · "+e.ms+" мс":"",e.at?" · "+Um(e.at):""]})]}):f.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function x8({rows:e,withSearch:t}){return f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Трекер"}),t?f.jsx(Se,{children:"Поиск через Jackett"}):null,f.jsx(Se,{children:"Сайт напрямую"}),f.jsx(Se,{children:"Сайт через WARP"}),f.jsx(Se,{className:"w-[240px]",children:"7 дней"})]})}),f.jsx(er,{children:e.map(n=>{if(n.kind==="check"&&n.check){const l=n.check;return f.jsxs(qe,{"data-check":l.id,children:[f.jsxs(me,{className:"font-medium",children:[l.name,f.jsx(qM,{path:l.path}),f.jsx(q0,{ids:[l.id],red:l.ok===!1})]}),f.jsxs(me,{colSpan:t?3:2,children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(_S,{ok:l.ok,alerted:l.alerted,warn:l.warn}),f.jsx(KM,{row:l})]}),l.context?f.jsx("div",{className:"text-xs text-muted-foreground",children:l.context}):null]}),f.jsx(me,{children:f.jsx(K0,{strip:l.history,uptime:l.uptime})})]},n.key)}const r=n.search||n.warp||n.direct||n.site;return f.jsxs(qe,{"data-check":n.key,children:[f.jsxs(me,{className:"font-medium",children:[n.name,f.jsx(q0,{ids:n.checks.map(l=>l.id),red:n.checks.some(l=>l.ok===!1),recheckIds:n.checks.filter(l=>l.ok===!1).map(l=>l.id)}),n.target?f.jsx("div",{className:"text-xs text-muted-foreground",children:n.target}):null]}),t?f.jsx(me,{children:f.jsx(bx,{row:n.search})}):null,f.jsx(me,{children:n.site?f.jsx("span",{className:"text-xs text-muted-foreground",children:n.site.detail}):f.jsx(bx,{row:n.direct})}),f.jsx(me,{children:n.site?null:f.jsx(bx,{row:n.warp})}),f.jsx(me,{children:r?f.jsx(K0,{strip:r.history,uptime:r.uptime}):null})]},n.key)})})]})}function b8({view:e,onToggle:t}){const{id:n,title:r,items:l,failed:o}=e,u=n==="jackett"||n==="jacred",c=r+" "+e.okCount+"/"+e.total+(e.warned?", "+f8(e.warned):"")+(e.skipped?", не проверено: "+e.skipped:""),h=o?f.jsxs(Oe,{variant:"bad",children:["ошибок: ",o]}):e.warned?f.jsxs(Oe,{variant:"warn",children:["просит код: ",e.warned]}):e.skipped?f.jsxs(Oe,{variant:"warn",children:["не проверено: ",e.skipped]}):f.jsx(Oe,{variant:"ok",children:"всё ок"});if(e.folded)return f.jsx(ye,{"data-group":n,"data-folded":"1",children:f.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 px-6 py-4 text-left",onClick:()=>t(n,!0),"aria-expanded":!1,children:[f.jsxs("span",{className:"font-semibold",children:[f.jsx("span",{className:"mr-2 text-muted-foreground",children:"▸"}),c]}),h]})});const m=l.some(p=>p.kind==="tracker"),v=l.map(p=>p.check);return f.jsxs(ye,{"data-group":n,children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[f.jsx("button",{type:"button",className:"text-left",onClick:()=>t(n,!1),"aria-expanded":!0,children:f.jsxs(Te,{children:[f.jsx("span",{className:"mr-2 text-muted-foreground",children:"▾"}),c]})}),h]}),f.jsxs(xe,{className:"space-y-3",children:[m?f.jsx(x8,{rows:l,withSearch:n==="jackett"}):l.length?f.jsx(y8,{rows:v}):null,u?f.jsx("p",{className:"text-xs text-muted-foreground",children:n==="jackett"?"Поиск через Jackett - тот путь, которым идут пользователи (Jackett сам ходит через WARP и FlareSolverr). Сайт напрямую и через WARP показывает, какой путь закрыт. Алерт: поиск не работает, или сайт не открывается ни напрямую, ни через WARP.":"JacRed берёт базу с sync.jacred.stream, сам на трекеры не ходит. Строки трекеров показывают, открывается ли сайт напрямую и через WARP; алерт - только если ни так, ни так."}):null]})]})}const S8="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground";function w8({prefs:e,setPrefs:t,shown:n}){return f.jsx(ye,{children:f.jsxs(xe,{className:"flex flex-wrap items-end gap-3 pt-6",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Показать"}),f.jsx("div",{className:"flex gap-1",role:"group","aria-label":"Фильтр",children:Object.keys(F0).map(r=>f.jsx(he,{type:"button",size:"sm",className:"h-10",variant:e.filter===r?"default":"outline","aria-pressed":e.filter===r,title:r==="noalert"?"Красные строки, по которым алерт не уходит (например, сайт закрыт только напрямую)":void 0,onClick:()=>t({...e,filter:r}),children:F0[r]},r))})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"monitorSearch",children:"Поиск"}),f.jsx($e,{id:"monitorSearch",className:"w-56",placeholder:"название, адрес, ошибка",value:e.q,onChange:r=>t({...e,q:r.target.value})})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"monitorSort",children:"Сортировка"}),f.jsxs("div",{className:"flex gap-1",children:[f.jsx("select",{id:"monitorSort",className:S8,value:e.sort,onChange:r=>t({...e,sort:r.target.value}),children:Object.keys(V0).map(r=>f.jsx("option",{value:r,children:V0[r]},r))}),f.jsx(he,{type:"button",variant:"outline",className:"w-10 px-0",title:e.desc?"По убыванию":"По возрастанию","aria-label":e.desc?"По убыванию":"По возрастанию",onClick:()=>t({...e,desc:!e.desc}),children:e.desc?"↓":"↑"})]})]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Строк: ",n]})]})})}function j8({data:e,busy:t,interval:n,setInterval:r,onRun:l,onRecheck:o,onSave:u,prefs:c,setPrefs:h,onRowRecheck:m,pending:v}){const p=!!(e!=null&&e.running),x=(e==null?void 0:e.checks)||[],S=x.filter(R=>R.ok===!1).length,w=new Set(x.filter(CS).map(R=>R.id.replace(/:(direct|warp|site)$/,""))).size,j=g8((e==null?void 0:e.groups)||[],x,c),C=j.reduce((R,E)=>R+(E.folded?0:E.items.length),0),A=p&&(e==null?void 0:e.progress)||null,N=p?null:(e==null?void 0:e.lastSummary)||null,O=R=>{var E;return((E=x.find(D=>D.id===R))==null?void 0:E.name)||R},T={states:(A==null?void 0:A.states)||{},running:p,pending:v||[],recheck:m||(()=>{})};return f.jsx(GM.Provider,{value:T,children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-start justify-between gap-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Te,{children:"Мониторинг"}),f.jsxs(ht,{children:[e!=null&&e.lastRun?"Последняя проверка: "+zi(e.lastRun.finishedAt)+(e.lastRun.trigger==="manual"?" (вручную)":e.lastRun.trigger==="recheck"?" (перепроверка)":"")+".":"Проверок ещё не было.",e!=null&&e.scheduled&&(e!=null&&e.nextRunAt)?" Следующая около "+zi(e.nextRunAt)+".":"",e&&!e.scheduled?" Расписание на этом экземпляре выключено, работает только ручная проверка.":""]}),f.jsx(ht,{children:"Перед алертом упавшая проверка повторяется через 30 с. Алерт приходит в Telegram один раз на проблему и ещё раз, когда починилось."})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.length?S?f.jsxs(Oe,{variant:"bad",children:["ошибок: ",S]}):f.jsx(Oe,{variant:"ok",children:"всё ок"}):null,w?f.jsxs(Oe,{variant:"warn",title:"Сайты, которые отвечают капчей или проверкой на робота (без алерта)",children:["просит код: ",w]}):null,f.jsx(he,{type:"button",disabled:t||p,onClick:l,children:p?"Проверка идёт…":"Проверить сейчас"}),S?f.jsx(he,{type:"button",variant:"secondary",disabled:t||p,onClick:o,title:"Запустить заново только красные проверки, остальные сохраняют последний результат",children:"Перепроверить все ошибки"}):null]})]}),f.jsxs(xe,{className:"space-y-3",children:[A?f.jsxs("div",{className:"space-y-1","data-testid":"monitor-progress",children:[f.jsxs("div",{className:"text-sm",children:["Проверка идёт: ",A.done," из ",A.total,", начата ",Um(A.startedAt)," МСК",A.trigger==="recheck"?" (перепроверка)":"",Object.values(A.states).includes("retry")?", ждёт повтора: "+Object.values(A.states).filter(R=>R==="retry").length:""]}),f.jsx("div",{className:"h-2 w-full max-w-md overflow-hidden rounded bg-zinc-800",children:f.jsx("div",{className:"h-full bg-amber-500 transition-all",style:{width:Math.round(100*A.done/Math.max(1,A.total))+"%"}})})]}):null,N?f.jsxs("div",{className:"text-sm text-muted-foreground","data-testid":"monitor-summary",children:["Готово в ",Um(N.finishedAt)," МСК",N.ids?" ("+N.ids.map(O).join(", ")+")":N.trigger==="recheck"?" (перепроверка ошибок)":"",": проверено ",N.checked,", ошибок ",N.failed,N.retried?", повторено через 30 с: "+N.retried:"",", заняло ",Math.max(1,Math.round((N.finishedAt-N.startedAt)/1e3))," с."]}):null,f.jsxs("form",{className:"flex flex-wrap items-end gap-2",onSubmit:R=>{R.preventDefault(),u()},children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"monitorInterval",children:"Интервал, минут (5-1440)"}),f.jsx($e,{id:"monitorInterval",className:"w-32",inputMode:"numeric",value:n,onChange:R=>r(R.target.value)})]}),f.jsx(he,{type:"submit",variant:"secondary",disabled:t,children:"Сохранить"})]})]})]}),e!=null&&e.error?f.jsx(Bt,{variant:"destructive",children:e.error==="read_only"?"Сервер в режиме только чтения: мониторинг не работает.":"Мониторинг недоступен на этом экземпляре."}):null,!e&&t?f.jsx(an,{className:"h-40"}):null,x.length?f.jsx(w8,{prefs:c,setPrefs:h,shown:C}):null,x.length&&!j.length?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Ничего не найдено."}):null,j.map(R=>f.jsx(b8,{view:R,onToggle:(E,D)=>h({...c,open:{...c.open,[E]:D}})},R.id))]})})}function C8({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(!1),[o,u]=b.useState(""),[c,h]=b.useState(""),m=b.useRef(!1),[v,p]=b.useState([]),[x,S]=b.useState(()=>s8(BE())),w=O=>{S(O),u8(BE(),O)};async function j(){let O;try{O=await ot("/admin/api/monitor")}catch{return h("Нет связи с сервером"),null}if(O.auth===!1)return h("Нужен вход"),null;if(!O.ok)return h(O.error==="read_only"?"Этот экземпляр только для чтения, мониторинг здесь не работает":"Мониторинг недоступен"),null;if(h(""),n(O),u(T=>T||String(O.intervalMin||"")),m.current&&!O.running){const T=O.lastSummary;ft(T?"Проверка завершена: проверено "+T.checked+", ошибок "+T.failed+(T.retried?", повторено через 30 с: "+T.retried:"")+", заняло "+Math.max(1,Math.round((T.finishedAt-T.startedAt)/1e3))+" с":"Проверка завершена")}return O.running||p([]),m.current=!!O.running,O}b.useEffect(()=>{l(!0),j().finally(()=>l(!1))},[]),b.useEffect(()=>{const O=window.setInterval(()=>void j(),t!=null&&t.running?3e3:6e4);return()=>window.clearInterval(O)},[t==null?void 0:t.running]);async function C(O=!1){l(!0);try{const T=await Qt("/admin/monitor/run",e,O?{only:"failed"}:{});if(T.auth===!1)return h("Нужен вход");if(!T.ok){ft(T.error||"Не запущено, обновите страницу");return}ft(O?"Перепроверяю красные проверки":"Проверка запущена, займёт до нескольких минут"),m.current=!0,await j()}catch{ft("Нет связи с сервером")}finally{l(!1)}}async function A(O){p(O);try{const T=await Qt("/admin/monitor/run",e,{ids:O});if(T.auth===!1)return h("Нужен вход");if(!T.ok){p([]),ft(T.error||"Не запущено, обновите страницу");return}m.current=!0,await j()}catch{p([]),ft("Нет связи с сервером")}}async function N(){l(!0);try{const O=await Qt("/admin/monitor/config",e,{intervalMin:o});if(O.auth===!1)return h("Нужен вход");O.ok?(ft("Интервал: "+O.intervalMin+" мин"),u(String(O.intervalMin)),await j()):ft(O.error||"Не сохранено")}catch{ft("Нет связи с сервером")}finally{l(!1)}}return f.jsxs(f.Fragment,{children:[c?f.jsx(Bt,{variant:"destructive",children:c}):null,f.jsx(j8,{data:t,busy:r,interval:o,setInterval:u,onRun:()=>void C(),onRecheck:()=>void C(!0),onSave:()=>void N(),prefs:x,setPrefs:w,onRowRecheck:O=>void A(O),pending:v})]})}function _8(){let e=0;return{next(){return e+=1,e},isCurrent(t){return t===e}}}function A8(e){if(e.auth===!1)return"Нужен вход";const t=e.ms||0;return e.reason==="probe_rate"?"лимит проверки - это лимит кнопки, не сбой DHT":e.reason==="sidecar_rate"?"sidecar занят (429) - это лимит sidecar, не лимит кнопки":e.ok||e.reason==="ok"?"ок, пиров "+(e.peers||0)+", "+t+" мс":e.reason==="not_ready"?"проверка: DHT еще не поднялся ("+t+" мс)":e.reason==="disabled"?"проверка: sidecar выключен ("+t+" мс)":e.reason==="down"?"проверка: sidecar не ответил ("+t+" мс)":e.error==="rate"||e.status===429?"лимит проверки - это лимит кнопки, не сбой DHT":e.status===503?"проверка: sidecar выключен ("+t+" мс)":"проверка не прошла ("+(e.status||0)+", "+t+" мс)"}const E8=2e4;function O8(e){return e==null||e<0?"":e>=1024*1024?Math.round(e/(1024*1024)*10)/10+" МБ":Math.max(1,Math.round(e/1024))+" КБ"}function N8(e){const t=e.sidecar;return!e.configured&&!(t&&t.configured)?f.jsx(Oe,{variant:"secondary",children:"не настроен"}):t&&t.ok?f.jsxs(Oe,{variant:"ok",children:["доступен · ",t.latencyMs||0," мс"]}):f.jsx(Oe,{variant:"bad",children:"не отвечает"})}function T8(e){return e==="up"?"сокет открыт":e==="idle"?"сокет закрыт":""}function R8(e){const t=e&&typeof e.perMinute=="number"?e.perMinute:30;return t<=0?"лимит выключен (0 в настройках)":t+" запросов в минуту на устройство"}function HE({rows:e,field:t,label:n,color:r}){const l=Math.max(1,...e.map(c=>c[t])),o=e[0]?zi(e[0].t):"",u=e.length?zi(e[e.length-1].t):"";return f.jsxs("div",{children:[f.jsx("div",{className:"mb-2 text-sm text-muted-foreground",children:n}),f.jsx("div",{className:"flex h-36 items-end gap-px overflow-x-auto",children:e.map(c=>f.jsx("div",{title:zi(c.t)+": "+c[t],className:"flex h-full min-w-[4px] flex-1 flex-col justify-end",children:f.jsx("div",{className:"w-full rounded-sm",style:{height:Math.max(2,Math.round(c[t]/l*128))+"px",background:r}})},t+":"+c.t))}),f.jsxs("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[f.jsx("span",{children:o}),f.jsx("span",{children:u})]})]})}function M8({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(""),[o,u]=b.useState(null),[c,h]=b.useState(!1),m=b.useRef(_8()),v=b.useCallback(()=>{const O=m.current.next();return ot("/admin/api/dht").then(T=>{if(m.current.isCurrent(O)){if(T.auth===!1){l("Нужен вход");return}l(""),n(T)}}).catch(T=>{m.current.isCurrent(O)&&l(T instanceof Error?T.message:"Не удалось загрузить DHT")})},[]);b.useEffect(()=>{v();const O=window.setInterval(()=>void v(),E8);return()=>{m.current.next(),window.clearInterval(O)}},[v]);async function p(){h(!0);try{const O=await ot("/admin/api/dht/probe",{method:"POST",headers:{"content-type":"application/json",Accept:"application/json"},body:JSON.stringify({csrf:e})});u(O),await v()}catch(O){u({ok:!1,error:O instanceof Error?O.message:"проверка"})}finally{h(!1)}}const x=t&&t.stats||{},S=x.requests24h||0,w=x.withPeers24h||0,j=x.errors||[],C=x.series||[],A=t&&t.sidecar?O8(t.sidecar.rss):"",N=t&&t.sidecar&&t.sidecar.ok?T8(t.sidecar.dht):"";return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[f.jsx(Te,{children:"DHT"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(he,{type:"button",size:"sm",variant:"secondary",onClick:()=>void v(),children:"Обновить"}),f.jsx(he,{type:"button",size:"sm",disabled:!e||c,onClick:()=>void p(),children:c?"Проверка...":"Проверить DHT"})]})]})}),f.jsxs(xe,{className:"space-y-3 text-sm",children:[r?f.jsx("p",{className:"text-destructive",children:r}):null,!t&&!r?f.jsx("p",{className:"text-muted-foreground",children:"Загрузка..."}):null,t?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("span",{children:"omp-dht-peers"}),N8(t),N?f.jsx("span",{className:"text-muted-foreground",children:N}):null,A?f.jsxs("span",{className:"text-muted-foreground",children:["память ",A]}):null]}),f.jsxs("p",{className:"text-muted-foreground",children:["Лимит: ",R8(t.limit),". Меняется в «Настройках». Обновление само, раз в 20 с."]}),o?f.jsx("p",{children:A8(o)}):null,f.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"Запросов за 24 ч"}),f.jsx("div",{className:"text-lg font-semibold",children:S})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"С пирами"}),f.jsx("div",{className:"text-lg font-semibold",children:S?x.peersSharePct+"% ("+w+" из "+S+")":"нет запросов"}),f.jsxs("div",{className:"text-muted-foreground",children:["Ошибок за 24 ч: ",x.errors24h||0," (4xx ",x.errors4xx24h||0,", 5xx ",x.errors5xx24h||0,")"]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"Среднее время"}),f.jsx("div",{className:"text-lg font-semibold",children:S?(x.avgMs||0)+" мс":"-"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"p50 / p95 за 24 ч"}),f.jsx("div",{className:"text-lg font-semibold",children:S?(x.p50Ms||0)+" / "+(x.p95Ms||0)+" мс":"-"})]})]}),f.jsx(HE,{rows:C,field:"requests",label:"Запросы за 24 ч, слот 10 мин",color:"#f5b700"}),f.jsx(HE,{rows:C,field:"errors",label:"Ошибки за 24 ч, слот 10 мин",color:"#e11d48"}),f.jsx("p",{className:"text-muted-foreground",children:"429 и причина «лимит» - это лимит биллинга на запросы с устройства, а не сбой сети DHT. Панель не показывает названия торрентов и infohash. Счетчики за 24 часа лежат в Postgres и остаются после перезапуска. Токен, id устройства и infohash по-прежнему не пишутся. «Проверить DHT» зовет sidecar с постоянным тестовым хешем из нулей (это не торрент пользователя) и тоже попадает в счетчики. В таблице ошибок у такой проверки причина «проверка», без самого хеша."})]}):null]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Последние ошибки"})}),j.length===0?f.jsx(xe,{className:"text-sm text-muted-foreground",children:"Ошибок нет"}):f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Время"}),f.jsx(Se,{children:"Код"}),f.jsx(Se,{children:"Причина"})]})}),f.jsx(er,{children:j.map((O,T)=>f.jsxs(qe,{children:[f.jsx(me,{children:zi(O.at)}),f.jsx(me,{children:O.status}),f.jsx(me,{children:O.reason})]},O.at+":"+T))})]})]})]})}const $r="space-y-1";function Sx(e){if(!e)return"0";const t=e/(1024*1024*1024);return(Math.round(t*10)/10).toString()}function D8(e){return e?Math.round(e/(1024*1024))+" МБ":"0 МБ"}function P8(e){return e.status==="disabled"?f.jsx(Oe,{variant:"secondary",children:"выключен"}):e.status==="online"?f.jsx(Oe,{variant:"ok",children:"онлайн"}):f.jsx(Oe,{variant:"bad",children:"нет ответа"})}async function k8(e,t,n){return ot(e,{method:"POST",headers:{"content-type":"application/json",Accept:"application/json"},body:JSON.stringify({csrf:t,...n})})}function I8({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(""),[o,u]=b.useState(""),[c,h]=b.useState(""),[m,v]=b.useState(""),[p,x]=b.useState(""),[S,w]=b.useState("500"),[j,C]=b.useState("0"),[A,N]=b.useState("0"),[O,T]=b.useState("512"),[R,E]=b.useState("0"),[D,k]=b.useState(""),[I,P]=b.useState(""),[B,F]=b.useState(""),[se,ue]=b.useState("");async function de(){const U=await ot("/admin/api/cache");U.auth!==!1&&(n(U),U.prefixMb!==void 0&&T(String(U.prefixMb)),U.prefixPercent!==void 0&&E(String(U.prefixPercent)))}b.useEffect(()=>{de()},[]);async function G(U,Ee){u("");const ee=await k8(U,(t==null?void 0:t.csrf)||e,Ee);ee.auth!==!1&&(ee.token&&l(ee.token),ee.error&&u(ee.error),await de())}const ne=(t==null?void 0:t.enabled)===!0,ie=(t==null?void 0:t.nodes)||[],ce=(t==null?void 0:t.assignments)||[];return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Кэш популярных раздач"}),f.jsx(ht,{children:"Узлы держат начало популярных раздач, чтобы воспроизведение начиналось сразу. Пока переключатель выключен, приложение и расчет ничего не меняют."})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ne?f.jsx(Oe,{variant:"ok",children:"включено"}):f.jsx(Oe,{variant:"secondary",children:"выключено"}),f.jsx(he,{variant:ne?"secondary":"default",onClick:()=>void G("/admin/cache/settings",{enabled:!ne,prefixMb:O,prefixPercent:R}),children:ne?"Выключить":"Включить"}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/recalc",{}),children:"Пересчитать"})]}),f.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Префикс, МБ (0 - брать проценты)"}),f.jsx($e,{value:O,onChange:U=>T(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Префикс, %"}),f.jsx($e,{value:R,onChange:U=>E(U.target.value)})]})]}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/settings",{enabled:ne,prefixMb:O,prefixPercent:R}),children:"Сохранить префикс"})]})]}),r?f.jsxs(Bt,{children:["Токен узла показывается один раз. Скопируйте его в конфиг сервера и закройте эту строку.",f.jsx("div",{className:"mt-2 break-all font-mono text-sm",children:r}),f.jsx(he,{className:"mt-2",variant:"secondary",onClick:()=>l(""),children:"Скрыть"})]}):null,o?f.jsx(Bt,{children:o}):null,f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Новый узел"})}),f.jsxs(xe,{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Имя"}),f.jsx($e,{value:c,onChange:U=>h(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Адрес TorrServer"}),f.jsx($e,{value:m,placeholder:"http://cache.example:8090",onChange:U=>v(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Регион"}),f.jsx($e,{value:p,onChange:U=>x(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Емкость, ГБ"}),f.jsx($e,{value:S,onChange:U=>w(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Свой префикс, МБ (0 - общий)"}),f.jsx($e,{value:j,onChange:U=>C(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Свой префикс, %"}),f.jsx($e,{value:A,onChange:U=>N(U.target.value)})]}),f.jsx(he,{onClick:()=>void G("/admin/cache/node",{name:c,url:m,region:p,capacityGb:S,prefixMb:j,prefixPercent:A}),children:"Добавить и выдать токен"})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Узлы"})}),f.jsx(xe,{className:"overflow-x-auto",children:f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Имя"}),f.jsx(Se,{children:"Статус"}),f.jsx(Se,{children:"Диск"}),f.jsx(Se,{children:"Heartbeat"}),f.jsx(Se,{children:"Токен"}),f.jsx(Se,{})]})}),f.jsx(er,{children:ie.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:6,children:"Узлов нет"})}):ie.map(U=>f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("div",{className:"font-medium",children:U.name}),f.jsx("div",{className:"text-xs text-muted-foreground",children:U.url}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[U.region||"регион не задан"," - ",Sx(U.capacityBytes)," ГБ"]})]}),f.jsxs(me,{children:[P8(U),f.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:U.torrserverOk?"TorrServer отвечает":"TorrServer молчит"})]}),f.jsxs(me,{children:[Sx(U.diskUsedBytes)," / ",Sx(U.diskTotalBytes)," ГБ"]}),f.jsx(me,{children:U.lastHeartbeat?zi(U.lastHeartbeat):"не было"}),f.jsx(me,{children:U.hasToken?"есть":"отозван"}),f.jsxs(me,{className:"space-x-2 space-y-2",children:[f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/token",{id:U.id}),children:"Новый токен"}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/token/revoke",{id:U.id}),children:"Отозвать"}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/node/disable",{id:U.id,disabled:!U.disabled}),children:U.disabled?"Включить узел":"Выключить узел"})]})]},U.id))})]})})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Закрепить раздачу"}),f.jsx(ht,{children:"Пустой магнит означает раздачу по DHT. Ссылку с ключом трекера панель не сохранит."})]}),f.jsxs(xe,{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"infohash"}),f.jsx($e,{value:D,onChange:U=>k(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Название"}),f.jsx($e,{value:I,onChange:U=>P(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Узел"}),f.jsxs("select",{className:"h-10 rounded-md border border-input bg-secondary px-3 text-sm",value:B,onChange:U=>F(U.target.value),children:[f.jsx("option",{value:"",children:"выберите"}),ie.map(U=>f.jsx("option",{value:U.id,children:U.name},U.id))]})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Магнит"}),f.jsx($e,{value:se,onChange:U=>ue(U.target.value)})]}),f.jsx(he,{onClick:()=>void G("/admin/cache/pin",{infohash:D,title:I,nodeId:B,magnet:se}),children:"Закрепить"})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Назначения"})}),f.jsx(xe,{className:"overflow-x-auto",children:f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Раздача"}),f.jsx(Se,{children:"Узел"}),f.jsx(Se,{children:"Статус"}),f.jsx(Se,{children:"Префикс"}),f.jsx(Se,{})]})}),f.jsx(er,{children:ce.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:5,children:"Назначений нет"})}):ce.map(U=>f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("div",{children:U.title||U.infohash}),f.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:U.infohash})]}),f.jsx(me,{children:U.nodeName}),f.jsxs(me,{children:[U.status,U.pinned?" - закреплено":"",U.source==="manual"?" - вручную":"",U.error?" - "+U.error:""]}),f.jsx(me,{children:D8(U.prefixBytes)}),f.jsx(me,{children:f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/unpin",{id:U.id}),children:"Снять"})})]},U.id))})]})})]})]})}function z8(e){return e==="community"?"зрители":e==="blend"?"смесь":e==="pinned"?"закреп":e==="banned"?"запрет":"сиды"}function L8({csrf:e}){const[t,n]=b.useState(""),[r,l]=b.useState(null),[o,u]=b.useState(!1),c=b.useCallback(async w=>{const j=await ot("/admin/api/watch-rank?q="+encodeURIComponent(w));l(j)},[]);b.useEffect(()=>{c("")},[c]);async function h(w){u(!0),await Qt("/admin/watch-rank",e,{enabled:w}),await c(t),u(!1)}async function m(w,j){u(!0),await Qt("/admin/watch-rank",e,{infohash:w.infohash,pinned:j.pinned!==void 0?j.pinned:w.pinned,banned:j.banned!==void 0?j.banned:w.banned,note:w.note}),await c(t),u(!1)}const v=r&&r.rows?r.rows:[],p=r&&r.voices?r.voices:[],x=r&&r.codecs?r.codecs:[],S=!!(r&&r.enabled);return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Подбор раздач"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[f.jsx(Oe,{variant:S?"ok":"secondary",children:S?"ранжирование включено":"ранжирование выключено"}),f.jsx(he,{type:"button",disabled:o,onClick:()=>void h(!S),children:S?"Выключить":"Включить"})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Пока нет оценок просмотра, поиск не меняет порядок. Закрепление и запрет действуют сразу. В общие таблицы попадают только хеши и счетчики."}),f.jsxs("form",{className:"flex gap-2",onSubmit:w=>{w.preventDefault(),c(t)},children:[f.jsx($e,{value:t,onChange:w=>n(w.target.value),placeholder:"Название или infohash"}),f.jsx(he,{type:"submit",children:"Найти"})]})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Раздачи"})}),f.jsx(xe,{children:f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Раздача"}),f.jsx(Se,{children:"Класс"}),f.jsx(Se,{children:"Оценка"}),f.jsx(Se,{children:"Сигналы"}),f.jsx(Se,{})]})}),f.jsxs(er,{children:[v.map(w=>f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("div",{children:w.title||w.titleKey||w.infohash}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[w.infohash.slice(0,12)," · s",w.season,"e",w.episode," · ",z8(w.reason)]})]}),f.jsx(me,{children:w.deviceClass==="tv"?"ТВ":"Телефон"}),f.jsx(me,{children:Math.round(w.score)}),f.jsxs(me,{children:[w.samples," просм., ",w.completed," до конца, ",w.switched," уходов, кадр ",w.ttffMs&&w.samples?Math.round(w.ttffMs/w.samples):0," мс, ребуфер ",w.rebufferN,", кодек ",w.codecOk,"/",w.codecOk+w.codecFail]}),f.jsxs(me,{className:"space-x-2",children:[f.jsx(he,{type:"button",disabled:o,onClick:()=>void m(w,{pinned:!w.pinned,banned:!1}),children:w.pinned?"Открепить":"Закрепить"}),f.jsx(he,{type:"button",disabled:o,onClick:()=>void m(w,{banned:!w.banned,pinned:!1}),children:w.banned?"Разрешить":"Запретить"})]})]},w.infohash+":"+w.fileIndex+":"+w.deviceClass)),v.length?null:f.jsx(qe,{children:f.jsx(me,{colSpan:5,children:"Пока нет сигналов"})})]})]})})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Озвучки и кодеки"})}),f.jsxs(xe,{className:"space-y-2 text-sm",children:[p.slice(0,12).map(w=>f.jsxs("div",{children:[w.titleKey,": ",w.voice," (",w.picks,")"]},w.titleKey+":"+w.voice)),x.map(w=>f.jsxs("div",{children:[w.deviceClass," ",w.codec,": ",w.reports]},w.deviceClass+":"+w.codec)),!p.length&&!x.length?f.jsx("div",{children:"Пока пусто"}):null]})]})]})}function wx(e){return e?Fo(e)+" МСК":""}function U8(e){if(!e)return"Опрос бота: нет данных";if(!e.enabled)return"Опрос бота выключен (BILLING_BOT_POLL=0).";const t=e.lastOkAt?wx(e.lastOkAt):"ещё не было";let n="Конфликт 409 не фиксировался.";if(e.conflictRecent){const r=wx(e.conflictAt);n="Конфликт 409 был недавно"+(r?" ("+r+")":"")+"."}else e.conflictAt&&(n="Последний конфликт 409: "+wx(e.conflictAt)+".");return"Опрос бота: последний успешный getUpdates "+t+". "+n}/**
+`,l=new Blob([r],{type:"text/csv;charset=utf-8"}),o=document.createElement("a");o.href=URL.createObjectURL(l),o.download=e,o.click(),URL.revokeObjectURL(o.href)}const k6=[["","Все действия"],["login","Вход"],["grant","Выдача дней"],["issue","Выдача кода"],["promo_create","Промо"],["code_reveal","Показ кода"],["device_revoke","Отзыв устройства"],["device_clone","Отключение клона"],["limit_set","Лимит устройств"],["bonus_grant","Бонусные устройства"],["bonus_remove","Снятие бонуса"],["days_subtract","Убавление дней"],["payment_confirm","Подтверждение платежа"],["payment_reject","Отклонение платежа"],["swaps_reset","Сброс смен"],["message","Сообщение"],["settings_save","Настройки"],["ads_config","Реклама: настройки"],["ads_banner_add","Реклама: новый баннер"],["ads_banner_save","Реклама: изменение баннера"],["ads_banner_remove","Реклама: удаление баннера"]],I6=[["","Все причины"],["bad_code","Неверный код"],["expired","Подписка истекла"],["other_device","Чужое устройство"],["device_limit","Лимит устройств"],["extra_expired","Доп. устройство не продлено"]];function DA(e){const t=Number(e)||0;if(t<1024)return t+" Б";const n=["КБ","МБ","ГБ"];let r=t/1024,l=0;for(;r>=1024&&l{r&&o(r)},[r]),b.useEffect(()=>{const B=t.map(F=>F.telegramId);o(F=>v6(F,B,r||""))},[t,r]);function T(B){if(!O.current)return;const F=E.current,se=N.current;F&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{se?se.scrollIntoView({block:"end"}):F.scrollTop=F.scrollHeight})})}b.useEffect(()=>{if(O.current=!0,!u){h([]),v("");return}let B=!1;async function F(){const ue=await st("/admin/api/support?telegramId="+encodeURIComponent(u));if(B)return;const de=ue.messages||[];h(G=>z6(G,de)?G:de),v(u)}F();const se=window.setInterval(()=>void F(),2500);return()=>{B=!0,window.clearInterval(se)}},[u]),b.useEffect(()=>{T()},[c,u]);async function R(B){var de,G;B.preventDefault();const F=g.trim();if(!u||!F||S)return;w(!0),C("");const se=await an("/admin/support",e,{telegramId:u,text:F});if(w(!1),!se.ok||(de=se.flash)!=null&&de.error){C(((G=se.flash)==null?void 0:G.error)||"Не отправилось");return}x(""),O.current=!0;const ue=await st("/admin/api/support?telegramId="+encodeURIComponent(u));h(ue.messages||[]),v(u),n()}async function A(){var F,se;if(!u||S||!window.confirm("Завершить диалог? Пользователь получит уведомление в боте."))return;w(!0),C("");const B=await an("/admin/support-close",e,{telegramId:u});if(w(!1),!B.ok||(F=B.flash)!=null&&F.error){C(((se=B.flash)==null?void 0:se.error)||"Не завершилось");return}n()}const D=t.find(B=>B.telegramId===u),k=!!u&&m!==u,I=!!r&&u===r&&!t.some(B=>B.telegramId===u);return f.jsxs("div",{className:"grid gap-4 lg:grid-cols-[280px_1fr]",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Диалоги"}),f.jsx(ht,{children:"Сообщения из бота"})]}),f.jsxs(xe,{className:"space-y-1",children:[t.length===0&&!I?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Пока пусто"}):null,I?f.jsxs("button",{type:"button",className:"block w-full rounded-md bg-muted px-2 py-2 text-left text-sm",onClick:()=>o(r||""),children:[f.jsx("div",{className:"font-medium",children:r}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"диалог из карточки пользователя"})]}):null,t.map(B=>f.jsxs("button",{type:"button",className:"block w-full rounded-md px-2 py-2 text-left text-sm "+(B.telegramId===u?"bg-muted":"hover:bg-muted/60"),onClick:()=>o(B.telegramId),children:[f.jsx("div",{className:"font-medium",children:F0(B.telegramId,B.username,B.name)}),f.jsx("div",{className:"text-xs text-muted-foreground",children:f.jsx(dt,{ms:B.lastAt,toggle:!1})}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:B.lastText})]},B.telegramId))]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:u?F0(u,D==null?void 0:D.username,D==null?void 0:D.name):"Выберите диалог"}),f.jsx(ht,{children:"Ответ уходит этому пользователю в бота. Ответ на уведомление в Telegram делает то же самое."})]}),f.jsxs(xe,{className:"flex flex-col gap-3",children:[f.jsxs("div",{ref:E,className:"omp-scroll h-80 min-h-0 space-y-2 overflow-y-auto overscroll-contain rounded-md border border-border/60 bg-background/40 p-3",onScroll:()=>{const B=E.current;B&&(O.current=B.scrollHeight-B.scrollTop-B.clientHeight<64)},children:[k?f.jsxs("div",{className:"space-y-2",children:[f.jsx(rn,{className:"h-12 w-2/3"}),f.jsx(rn,{className:"ml-auto h-12 w-1/2"})]}):null,!k&&c.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:u?"Пока нет сообщений":"Выберите диалог слева"}):null,c.map(B=>f.jsxs("div",{className:B.direction==="out"?"text-right":"",children:[f.jsxs("div",{className:"text-xs text-muted-foreground",children:[B.direction==="out"?"Админ":"Пользователь"," · ",f.jsx(dt,{ms:B.at,toggle:!1}),B.via==="panel"?" · панель":""]}),f.jsx("div",{className:"inline-block max-w-[90%] whitespace-pre-wrap rounded-md bg-muted px-3 py-2 text-sm",children:B.text})]},B.id)),f.jsx("div",{ref:N,className:"h-px w-full shrink-0","aria-hidden":!0})]}),j?f.jsx(Bt,{variant:"destructive",children:j}):null,f.jsxs("form",{className:"shrink-0 space-y-2",onSubmit:B=>void R(B),children:[f.jsx(xS,{value:g,onChange:B=>x(B.target.value),placeholder:"Ответ пользователю",rows:3}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(he,{type:"submit",disabled:S||!u||!g.trim(),children:S?"Отправляю…":"Ответить"}),f.jsx(he,{type:"button",variant:"secondary",disabled:S||!u,onClick:()=>void A(),children:"Завершить диалог"})]})]})]})]})]})}function Wn({className:e,...t}){return f.jsx("div",{className:"relative w-full overflow-auto",children:f.jsx("table",{className:Zt("w-full caption-bottom text-sm",e),...t})})}function Jn({className:e,...t}){return f.jsx("thead",{className:Zt("[&_tr]:border-b",e),...t})}function er({className:e,...t}){return f.jsx("tbody",{className:Zt("[&_tr:last-child]:border-0",e),...t})}function qe({className:e,...t}){return f.jsx("tr",{className:Zt("border-b border-border transition-colors hover:bg-secondary/50",e),...t})}function Se({className:e,...t}){return f.jsx("th",{className:Zt("h-10 px-2 text-left align-middle font-medium text-muted-foreground",e),...t})}function me({className:e,...t}){return f.jsx("td",{className:Zt("p-2 align-middle",e),...t})}const U6=1440*60*1e3;function Dl({label:e,question:t,yes:n,onYes:r,variant:l="secondary",disabled:o}){const[u,c]=b.useState(!1);return u?f.jsxs("span",{className:"inline-flex flex-wrap items-center gap-2 rounded-md border border-amber-700/60 bg-amber-950/30 px-2 py-1 text-sm",children:[f.jsx("span",{children:t}),f.jsx(he,{size:"sm",variant:"destructive",onClick:()=>{c(!1),r()},children:n}),f.jsx(he,{size:"sm",variant:"ghost",onClick:()=>c(!1),children:"Отмена"})]}):f.jsx(he,{size:"sm",variant:l,disabled:o,onClick:()=>c(!0),children:e})}function $6({ms:e}){return e?f.jsx(dt,{ms:e}):f.jsx("span",{className:"text-muted-foreground",children:"не было"})}function B6({user:e}){const t=e.subscription;return!t||!t.overLimit?null:f.jsxs(Bt,{variant:"warn",children:["Устройств больше лимита: привязано ",t.bound," при лимите ",t.deviceLimit,". Устройства сверх лимита (привязанные последними) не работают. Отзовите лишнее или поднимите лимит."]})}function H6({user:e,run:t}){const n=e.subscription,r=e.devices||[],l=n==null?void 0:n.swaps;return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{children:["Устройства"," ",n?f.jsxs(Oe,{variant:n.overLimit?"warn":"count",className:"ml-2 align-middle",children:[r.length," из ",n.deviceLimit]}):null]}),f.jsx(ht,{children:"«Последний раз» - поиск, скачивание или проверка подписки с этого устройства (обновляется не чаще раза в 10 минут). IP хранится без последней части. «Отозвать» отвязывает устройство и сразу гасит его токен, для слота выпускается новый код, пользователю уходит сообщение в Telegram."})]}),f.jsxs(xe,{className:"space-y-3",children:[r.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Привязанных устройств нет"}):null,r.length>0?f.jsxs(Wn,{className:"min-w-[40rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Устройство"}),f.jsx(Se,{children:"Привязано, МСК"}),f.jsx(Se,{children:"Последний раз, МСК"}),f.jsx(Se,{children:"IP"}),f.jsx(Se,{})]})}),f.jsx(er,{children:r.map(o=>f.jsxs(qe,{children:[f.jsxs(me,{className:"font-mono",children:[o.name?f.jsxs("span",{className:"font-sans",children:[o.name," "]}):null,o.deviceId,"…"," ",o.overLimit?f.jsx(Oe,{variant:"warn",className:"ml-1",children:"сверх лимита, не работает"}):null,o.cloneAt?f.jsxs(Oe,{variant:"warn",className:"ml-1",title:"Использованный ключ этого устройства пришёл повторно. Если это не потеря сети - отзовите устройство.",children:["возможен клон",o.cloneCount&&o.cloneCount>1?" ×"+o.cloneCount:""]}):null,f.jsxs("div",{className:"font-sans text-xs text-muted-foreground",children:[o.auth==="refresh"?"новые токены":"старый токен",o.cloneAt?f.jsxs(f.Fragment,{children:[" · клон: ",f.jsx(dt,{ms:o.cloneAt})]}):null]})]}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:o.boundAt})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx($6,{ms:o.lastSeenAt})}),f.jsx(me,{className:"font-mono text-xs",children:o.lastIp||"-"}),f.jsx(me,{children:f.jsx(Dl,{label:"Отозвать",variant:"destructive",question:f.jsxs(f.Fragment,{children:["Отозвать ",o.deviceId,"…? Поиск на нём перестанет работать сразу, пользователь получит сообщение в Telegram."]}),yes:"Да, отозвать",onYes:()=>void t("/admin/device-revoke",{accountId:e.account.id,deviceRowId:o.id||"",codeId:o.codeId,confirm:"yes"})})})]},o.id||o.codeId))})]}):null,l?f.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[f.jsxs("span",{children:["Смены устройства в боте: ",l.used," из ",l.limit," за 30 дней",l.left<1&&l.nextAt?f.jsxs(f.Fragment,{children:[" · следующая с ",Fo(l.nextAt)," МСК"]}):null,l.resetAt?f.jsxs("span",{className:"text-muted-foreground",children:[" ","· сброшен ",f.jsx(dt,{ms:l.resetAt})]}):null]}),f.jsx(Dl,{label:"Сбросить счётчик",question:"Разрешить пользователю ещё 2 смены прямо сейчас?",yes:"Да, сбросить",disabled:l.used===0,onYes:()=>void t("/admin/swaps-reset",{accountId:e.account.id})})]}):null]})]})}function F6({user:e,run:t}){const n=e.subscription,[r,l]=b.useState(n!=null&&n.limitOverride?String(n.limitOverride):""),[o,u]=b.useState(String((n==null?void 0:n.extraSlots)??0)),[c,h]=b.useState("1"),[m,v]=b.useState(""),[g,x]=b.useState("");if(!n)return null;const S=n.globalBase??2,w=n.bonusSlots??0,j=(r.trim()?Number(r)||0:S)+w+(Number(o)||0),C=j<(n.bound||0),E=n.bonus||[];return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{children:["Лимит устройств"," ",f.jsx(Oe,{variant:"count",className:"ml-2 align-middle",children:n.deviceLimit}),n.limitOverride?f.jsx(Oe,{variant:"warn",className:"ml-2 align-middle",children:"индивидуальный лимит"}):null]}),f.jsxs(ht,{children:["Сейчас: ",n.limitText||n.deviceLimit,n.extraSlots?", купленные до "+Fo(n.extraUntil||0)+" МСК":"",". Лимит = база + бонусные + купленные. База - общая из настроек (",S,"), если не задан индивидуальный лимит: он заменяет базу и не меняется, когда меняют общую. Бонусные - бесплатно, навсегда или до даты, в цену продления не входят. Купленные (доп.) - помесячные: выданные здесь действуют до конца оплаченного периода и дальше продлеваются вместе с подпиской."]})]}),f.jsxs(xe,{className:"space-y-4",children:[f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Индивидуальный лимит"}),f.jsx($e,{className:"w-40",type:"number",min:1,max:20,placeholder:"пусто = общий ("+S+")",value:r,onChange:N=>l(N.target.value)})]}),f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Купленные (доп.)"}),f.jsx($e,{className:"w-24",type:"number",min:0,max:20,value:o,onChange:N=>u(N.target.value)})]}),f.jsx(Dl,{label:"Сохранить",variant:"default",question:f.jsxs(f.Fragment,{children:["Лимит станет ",j,r.trim()?" (индивидуальный "+r.trim()+")":" (общая база "+S+")",C?". Привязано "+n.bound+": последние сверх лимита перестанут работать":"",". Сохранить?"]}),yes:"Да, сохранить",onYes:()=>void t("/admin/limit",{accountId:e.account.id,limitOverride:r.trim(),extraSlots:o})})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"text-sm font-medium",children:"Бонусные устройства"}),E.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет"}):null,E.length>0?f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Кол-во"}),f.jsx(Se,{children:"Срок"}),f.jsx(Se,{children:"Причина"}),f.jsx(Se,{children:"Выдано, МСК"}),f.jsx(Se,{})]})}),f.jsx(er,{children:E.map(N=>f.jsxs(qe,{children:[f.jsxs(me,{children:["+",N.count]}),f.jsxs(me,{children:[N.until===null?"навсегда":"до "+Fo(N.until),N.active?null:f.jsx(Oe,{variant:"secondary",className:"ml-1",children:"истёк"})]}),f.jsxs(me,{children:[N.reason||f.jsx("span",{className:"text-muted-foreground",children:"-"}),N.source==="promo"?null:f.jsx("span",{className:"text-xs text-muted-foreground",children:" · вручную"})]}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:N.grantedAt})}),f.jsx(me,{children:f.jsx(Dl,{label:"Снять",question:f.jsxs(f.Fragment,{children:["Снять ",N.count," бонусн. устр.?"]}),yes:"Да, снять",onYes:()=>void t("/admin/bonus-remove",{accountId:e.account.id,bonusId:N.id,confirm:"yes"})})})]},N.id))})]}):null,f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Устройств"}),f.jsx($e,{className:"w-20",type:"number",min:1,max:20,value:c,onChange:N=>h(N.target.value)})]}),f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Дней"}),f.jsx($e,{className:"w-36",type:"number",min:1,max:3650,placeholder:"пусто = навсегда",value:m,onChange:N=>v(N.target.value)})]}),f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Причина"}),f.jsx($e,{className:"w-56",maxLength:80,value:g,onChange:N=>x(N.target.value)})]}),f.jsx(he,{size:"sm",onClick:()=>void t("/admin/bonus",{accountId:e.account.id,count:c,days:m.trim(),reason:g}),children:"Выдать бонус"})]})]})]})]})}function V6({user:e,run:t}){const n=e.subscription,[r,l]=b.useState("1");if(!n||!n.paidUntil)return null;const o=Math.floor(Number(r)),u=Number.isFinite(o)&&o>=1&&o<=3650&&String(o)===r.trim(),c=n.paidUntil-(u?o:0)*U6;return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Убавить дни"}),f.jsx(ht,{children:"Сдвигает окончание назад, например после возврата денег. Если дата уйдёт в прошлое, поиск выключится после льготного периода."})]}),f.jsxs(xe,{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"grid gap-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Дней"}),f.jsx($e,{className:"w-24",type:"number",min:1,max:3650,value:r,onChange:h=>l(h.target.value)})]}),f.jsx(Dl,{label:"Убавить",variant:"destructive",disabled:!u,question:f.jsxs(f.Fragment,{children:["Убавить ",o," дн.? Подписка будет до ",Fo(c)," МСК",c<=Date.now()?" - это уже в прошлом":"","."]}),yes:"Да, убавить",onYes:()=>void t("/admin/subtract",{accountId:e.account.id,days:String(o),confirm:"yes"})})]})]})}function BM({rows:e,run:t,accountId:n,showWho:r}){return e.length?f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{children:["Ждут подтверждения в ЮMoney"," ",f.jsx(Oe,{variant:"warn",className:"ml-2 align-middle",children:e.length})]}),f.jsx(ht,{children:"ЮMoney держит эти переводы, пока их не примут в кошельке, и подписку они не продлили. Примите перевод в кошельке и нажмите «Подтвердить платёж» - он применится один раз. «Отклонить» - если перевод отклонён или возвращён."})]}),f.jsx(xe,{className:"space-y-3",children:e.map(l=>f.jsxs("div",{className:"space-y-2 rounded-md border border-amber-800/50 px-3 py-2 text-sm",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(dt,{ms:l.at}),f.jsxs("span",{className:"font-medium",children:[l.amount||"?"," ₽"]}),f.jsx(Oe,{variant:"count",children:T6(l.kind,l.price)}),r&&l.accountId?f.jsx("a",{className:"text-primary",href:"/admin/?id="+encodeURIComponent(l.accountId),children:l.who||"карточка"}):null,f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.operationId})]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(Dl,{label:"Подтвердить платёж",variant:"default",question:f.jsxs(f.Fragment,{children:["Перевод ",l.amount," ₽ принят в кошельке? Подписка продлится сразу, пользователь получит сообщение."]}),yes:"Да, подтвердить",onYes:()=>void t("/admin/payment-confirm",{operationId:l.operationId,accountId:n||"",confirm:"yes"})}),f.jsx(Dl,{label:"Отклонить",question:f.jsxs(f.Fragment,{children:["Убрать платёж ",l.amount," ₽ из ожидания, ничего не продлевая?"]}),yes:"Да, отклонить",onYes:()=>void t("/admin/payment-reject",{operationId:l.operationId,accountId:n||"",confirm:"yes"})})]})]},l.operationId))})]}):null}const bx="omp-grant-days";function G6({user:e,run:t}){var N,O,T,R,A,D,k;const n=e.account.telegramId||"",[r,l]=b.useState(""),[o,u]=b.useState(()=>sessionStorage.getItem(bx)||"30"),[c,h]=b.useState("100"),[m,v]=b.useState({});async function g(I){const P=await st("/admin/api/reveal?codeId="+encodeURIComponent(I));if(P.auth!==!1){if(!P.formatted){rt("Код уже привязан или скрыт");return}v(B=>({...B,[I]:{formatted:P.formatted||"",openUrl:P.openUrl}}))}}const x=!!((N=e.subscription)!=null&&N.active),S=((O=e.subscription)==null?void 0:O.paidUntil)||0,w=x&&S>0&&S-Date.now()<=1440*60*1e3,j=!!((T=e.subscription)!=null&&T.inGrace),C=e.subscription?j?"grace":x?w?"expiring":"active":"expired":"",E=(e.codes||[]).filter(I=>!I.bound);return f.jsxs("main",{className:"mx-auto w-full max-w-4xl space-y-4 px-4 py-6",children:[f.jsx(he,{variant:"link",className:"px-0",asChild:!0,children:f.jsx("a",{href:"/admin/",children:"← Назад"})}),f.jsx("h1",{className:"text-2xl font-bold",children:"Пользователь"}),f.jsx(PM,{flash:e.flash}),f.jsx(ye,{children:f.jsxs(xe,{className:"space-y-2 pt-6 text-sm",children:[f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Идентификатор"})," ",e.account.id," ",f.jsx(ko,{value:e.account.id})]}),f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Telegram"})," ",n?f.jsxs(f.Fragment,{children:[f.jsx(Oe,{variant:"ok",children:F0(n,e.account.telegramUsername,e.account.telegramName)})," ",f.jsx(ko,{value:n})]}):"-"]}),f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Почта"})," ",e.account.email||"-"]}),f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Создан"})," ",f.jsx(dt,{ms:e.account.createdAt})]}),e.subscription?f.jsxs("p",{className:"flex flex-wrap items-center gap-2",children:["Подписка до ",f.jsx(dt,{ms:e.subscription.paidUntil}),f.jsxs("span",{className:"text-muted-foreground",children:["устройств ",e.subscription.bound??0," из ",e.subscription.deviceLimit,e.subscription.limitText?" ("+e.subscription.limitText+")":""]}),f.jsx(IM,{status:C}),(e.subscription.creditRub||0)>0?f.jsxs("span",{className:"text-muted-foreground",children:["зачёт ",e.subscription.creditRub," ₽"]}):null,f.jsx("input",{className:"h-8 w-20 rounded-md border border-input bg-secondary px-2 text-sm",value:c,onChange:I=>h(I.target.value),"aria-label":"Зачёт, рубли"}),f.jsx(he,{variant:"secondary",onClick:()=>{window.confirm("Начислить зачёт "+c+" ₽?")&&t("/admin/api/credit",{accountId:e.account.id,rub:c,confirm:"yes"})},children:"Зачёт"}),j&&e.subscription.accessUntil?f.jsxs("span",{className:"text-muted-foreground",children:["льготный период до ",f.jsx(dt,{ms:e.subscription.accessUntil})]}):null]}):f.jsx("p",{className:"text-muted-foreground",children:"Нет подписки"})]})}),f.jsx(B6,{user:e}),f.jsx(BM,{rows:e.pending||[],run:t,accountId:e.account.id}),e.subscription?f.jsx(H6,{user:e,run:t}):null,f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Написать пользователю"}),f.jsx(ht,{children:n?"Сообщение уйдёт в Telegram-бота и появится во вкладке «Поддержка».":"У аккаунта нет Telegram - сначала нужна привязка в боте."})]}),f.jsx(xe,{className:"space-y-2",children:n?f.jsxs(f.Fragment,{children:[f.jsx(xS,{value:r,onChange:I=>l(I.target.value),placeholder:"Текст сообщения…",rows:4}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(he,{disabled:!r.trim(),onClick:()=>{const I=r.trim();I&&t("/admin/message",{accountId:e.account.id,text:I}).then(()=>l(""))},children:"Отправить в Telegram"}),f.jsx(he,{variant:"secondary",asChild:!0,children:f.jsx("a",{href:"/admin/?tab=support&tg="+encodeURIComponent(n),children:"Открыть в поддержке"})})]})]}):f.jsx("p",{className:"text-sm text-muted-foreground",children:"Привяжите Telegram в боте или через приложение OMP."})})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Выдать дни"}),f.jsx(ht,{children:"Число дней сохраняется. Перед отправкой будет подтверждение."})]}),f.jsx(xe,{className:"space-y-3",children:f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("label",{className:"text-sm text-muted-foreground",htmlFor:"grant-days",children:"Дней"}),f.jsxs("select",{id:"grant-days",className:"h-10 rounded-md border border-input bg-secondary px-3 text-sm",value:o,onChange:I=>{u(I.target.value),sessionStorage.setItem(bx,I.target.value)},children:[f.jsx("option",{value:"1",children:"1"}),f.jsx("option",{value:"7",children:"7"}),f.jsx("option",{value:"30",children:"30"}),f.jsx("option",{value:"90",children:"90"})]}),f.jsx(he,{onClick:()=>{window.confirm("Выдать +"+o+" дн.?")&&(sessionStorage.setItem(bx,o),t("/admin/grant",{accountId:e.account.id,days:o}))},children:"Выдать"})]})})]}),f.jsx(V6,{user:e,run:t},"sub-"+(((R=e.subscription)==null?void 0:R.paidUntil)||0)),f.jsx(F6,{user:e,run:t},"lim-"+(((A=e.subscription)==null?void 0:A.limitOverride)??"")+"-"+(((D=e.subscription)==null?void 0:D.extraSlots)??"")+"-"+(((k=e.subscription)==null?void 0:k.limitText)??"")),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Свободные коды"}),f.jsx(ht,{children:"Коды ещё не привязанных слотов, открываются кнопкой «Показать». Привязанные - выше, в «Устройствах»."})]}),f.jsxs(xe,{className:"space-y-2",children:[E.length===0?f.jsx("p",{className:"text-muted-foreground",children:"Нет свободных кодов"}):null,E.map(I=>{const P=m[I.id];return f.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[f.jsx("span",{className:"font-mono",children:(P==null?void 0:P.formatted)||(I.bound?"привязан · "+(I.deviceId||""):"скрыт")}),f.jsxs("span",{className:"text-muted-foreground",children:["создан ",f.jsx(dt,{ms:I.createdAt}),I.boundAt?f.jsxs(f.Fragment,{children:[" ","· привязан ",f.jsx(dt,{ms:I.boundAt})]}):null]}),I.bound&&!I.hasPlain&&!P?f.jsx("span",{className:"text-muted-foreground",children:"код стёрт после привязки"}):null,P?f.jsx(ko,{value:P.formatted}):null,I.hasPlain&&!P?f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>void g(I.id),children:"Показать"}):null,P!=null&&P.openUrl?f.jsx(he,{size:"sm",variant:"link",asChild:!0,children:f.jsx("a",{href:P.openUrl,target:"_blank",rel:"noreferrer",children:"Открыть"})}):null]},I.id)})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Платежи"})}),f.jsxs(xe,{children:[(e.payments||[]).length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет платежей"}):null,(e.payments||[]).length>0?f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Когда, МСК"}),f.jsx(Se,{children:"Зачислено"}),f.jsx(Se,{children:"Способ"}),f.jsx(Se,{children:"Комиссия"}),f.jsx(Se,{children:"Метка"}),f.jsx(Se,{children:"Ошибка"})]})}),f.jsx(er,{children:(e.payments||[]).map((I,P)=>f.jsxs(qe,{children:[f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:I.at})}),f.jsx(me,{className:"font-mono",children:I.amount||"-"}),f.jsx(me,{children:UM(I)}),f.jsx(me,{className:"font-mono",children:I.fee==null?"-":I.fee}),f.jsx(me,{className:"font-mono text-xs",children:I.label||"-"}),f.jsxs(me,{children:[I.error?f.jsx(Oe,{variant:"bad",children:LM(I.error)}):null,I.provider==="stars"&&!I.error&&I.operationId?f.jsx(Dl,{label:"Вернуть звёзды",question:"Вернуть звёзды этому пользователю? Дни подписки останутся, их можно убавить отдельно.",yes:"Вернуть",variant:"destructive",onYes:()=>void t("/admin/payment-refund",{operationId:I.operationId,accountId:e.account.id,confirm:"yes"})}):null,!I.error&&I.provider!=="stars"?"-":null]})]},P))})]}):null]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"История просмотра"}),f.jsx(ht,{children:"Шаги, которые приложение прислало с этого аккаунта. Без диагностики список пуст."})]}),f.jsxs(xe,{children:[(e.watch||[]).length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет сигналов"}):null,(e.watch||[]).length>0?f.jsx("ul",{className:"space-y-1 text-sm",children:(e.watch||[]).map((I,P)=>f.jsxs("li",{className:"flex flex-wrap gap-2",children:[f.jsx(dt,{ms:I.at}),f.jsx("span",{children:I.name}),f.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[I.version||""," ",I.platform||""]})]},P))}):null]})]})]})}var q6=Object.defineProperty,K6=(e,t)=>q6(e,"name",{value:t,configurable:!0}),HM=b.forwardRef(K6(function(t,n){return f.jsx(ln.label,{...t,ref:n,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}})},"Label"));const yt=b.forwardRef(({className:e,...t},n)=>f.jsx(HM,{ref:n,className:Zt("text-sm font-medium text-muted-foreground",e),...t}));yt.displayName=HM.displayName;const SS={mine:"«Мои» (сетка, список, компактно)",discoverGrid:"«Обзор»: сетка подборки",discoverRails:"«Обзор»: главная, между рельсами"},wS={phone:"Телефон",androidTv:"Android TV",webos:"webOS"};function FM(e){return e.impressions?(e.clicks/e.impressions*100).toFixed(1).replace(".",",")+"%":"-"}function Um(e){return e?new Date(e+10800*1e3).toISOString().slice(0,10):""}function Y6(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result||"").replace(/^data:[^,]*,/,"")),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}const jS="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground",VM=["mine","discoverGrid","discoverRails"],GM=["phone","androidTv","webos"],CS=e=>"/v1/ads/img/"+e;function qM(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}const X6=()=>({localId:qM(),enabled:!0,title:"",text:"",advertiser:"",erid:"",url:"",image:"",weight:"1",from:"",to:"",platforms:["phone","androidTv","webos"],sections:["mine","discoverGrid","discoverRails"],tvMode:"qr"});function Q6(e){return{localId:qM(),id:e.id,enabled:e.enabled,title:e.title,text:e.text,advertiser:e.advertiser,erid:e.erid,url:e.url,image:e.image,weight:String(e.weight),from:Um(e.from),to:Um(e.to),platforms:e.platforms,sections:e.sections,tvMode:e.tvMode}}function PA(e,t,n){const r=e.filter(l=>l!==t);return n?r.concat([t]):r}function Z6({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(null),[o,u]=b.useState(30),[c,h]=b.useState(null),[m,v]=b.useState(null),[g,x]=b.useState(!1),[S,w]=b.useState(!1),[j,C]=b.useState(""),E=b.useRef(0),N=b.useRef(!1);async function O(A=o,D=!1){const k=await st("/admin/api/ads?days="+A);k.auth===!1||!k.config||(n(k.config),l(k.stats||null),D||h(k.config))}b.useEffect(()=>{const A=N.current;N.current=!0;let D=!0;return(async()=>{const k=await st("/admin/api/ads?days="+o);!D||k.auth===!1||!k.config||(n(k.config),l(k.stats||null),h(I=>A&&I?I:k.config))})(),()=>{D=!1}},[o]);async function T(A,D){var k,I;x(!0);try{const P=await an(A,e,D);return(k=P.flash)!=null&&k.error?(C(P.flash.error),rt(P.flash.error)):(C(""),(I=P.flash)!=null&&I.text&&rt(P.flash.text)),P}finally{x(!1)}}if(!t||!c)return f.jsx(rn,{className:"h-48"});const R=(A,D,k)=>f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"ads-"+A,children:D}),f.jsx($e,{id:"ads-"+A,inputMode:"numeric",value:String(c[A]),onChange:I=>h({...c,[A]:I.target.value})}),f.jsx("p",{className:"text-xs text-muted-foreground",children:k})]});return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{className:"flex flex-wrap items-center gap-2",children:["Реклама",t.enabled?f.jsx(Oe,{variant:"ok",children:"включена"}):f.jsx(Oe,{variant:"secondary",children:"выключена"}),f.jsxs(Oe,{variant:"secondary",children:["баннеров: ",t.banners.length]})]}),f.jsx(ht,{children:"Свои баннеры (прямые рекламодатели и партнёрки). Приложения читают настройки раз в 5 минут: выключатель доходит до всех за это время. Подписчикам и в «Истории», поиске, режиме выбора рекламы нет."})]}),f.jsxs(xe,{className:"space-y-4",children:[f.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium",children:[f.jsx("input",{type:"checkbox",checked:c.enabled,onChange:A=>h({...c,enabled:A.target.checked})}),"Показывать рекламу (общий выключатель)"]}),f.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"ads-provider",children:"Источник"}),f.jsxs("select",{id:"ads-provider",className:jS+" w-full",value:c.provider,onChange:A=>h({...c,provider:A.target.value}),children:[f.jsx("option",{value:"house",children:"Свои баннеры"}),f.jsx("option",{value:"yandex",disabled:!0,children:"Яндекс (позже)"})]})]}),R("everyN","Каждая N-я карточка","6-30, по умолчанию 10"),R("firstAfter","Первая не раньше карточки","1-60, по умолчанию 10"),R("afterInstallDays","Дней после установки","0-60: до этого рекламы нет"),R("maxPerScreen","На экране не больше","1-2 рекламы"),R("railsEvery","Главная «Обзора»: после каждых N рельс","2-10, первая после 2-й рельсы"),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"ads-minver",children:"Минимальная версия приложения"}),f.jsx($e,{id:"ads-minver",placeholder:"например 0.20.5",value:c.minAppVersion,onChange:A=>h({...c,minAppVersion:A.target.value})}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Пусто: все версии с рекламой"})]})]}),f.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Разделы"}),VM.map(A=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.sections[A],onChange:D=>h({...c,sections:{...c.sections,[A]:D.target.checked}})}),SS[A]]},A))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Платформы"}),GM.map(A=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.platforms[A],onChange:D=>h({...c,platforms:{...c.platforms,[A]:D.target.checked}})}),wS[A]]},A))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Кому не показывать"}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.hideForSubscribers,onChange:A=>h({...c,hideForSubscribers:A.target.checked})}),"Подписчикам OMP (и в льготный период)"]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:c.tvHideIfLinkedSubscriber,onChange:A=>h({...c,tvHideIfLinkedSubscriber:A.target.checked})}),"ТВ, к которому привязан телефон с подпиской"]})]})]}),c.enabled&&!t.banners.some(A=>A.enabled)?f.jsx(Bt,{variant:"warn",children:"Нет ни одного включённого баннера: приложения рекламу не покажут, пока его нет."}):null,f.jsx(he,{disabled:g,onClick:()=>{const{banners:A,...D}=c;T("/admin/ads/config",D).then(()=>O())},children:"Сохранить настройки рекламы"})]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Баннеры"}),f.jsx(ht,{children:"По закону о рекламе на баннере видны пометка «Реклама», рекламодатель и erid (токен ОРД). Без erid баннер не сохраняется. erid добавляется и в ссылку."})]}),f.jsxs(xe,{className:"space-y-3",children:[t.banners.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Баннеров пока нет"}):null,f.jsx("ul",{className:"space-y-2",children:t.banners.map(A=>f.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border p-2",children:[f.jsx("img",{src:CS(A.image),alt:"",className:"h-16 w-12 rounded object-cover"}),f.jsxs("div",{className:"min-w-0 flex-1 text-sm",children:[f.jsxs("div",{className:"font-medium",children:[A.title," ",A.enabled?null:f.jsx(Oe,{variant:"secondary",children:"выключен"})]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[A.advertiser," · erid ",A.erid," · вес ",A.weight,A.from||A.to?" · "+(Um(A.from)||"...")+" - "+(Um(A.to)||"..."):""]})]}),f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>v(Q6(A)),children:"Изменить"}),f.jsx(he,{size:"sm",variant:"destructive",disabled:g,onClick:()=>{confirm("Удалить баннер «"+A.title+"»? Статистика по нему останется.")&&T("/admin/ads/banner-remove",{id:A.id,confirm:"yes"}).then(()=>O())},children:"Удалить"})]},A.id))}),m?f.jsx(W6,{draft:m,setDraft:v,busy:g,uploading:S,error:j,onUpload:async A=>{const D=m.localId,k=++E.current;w(!0);try{const I=await Y6(A),B=(await T("/admin/ads/image",{mime:A.type,data:I})).extra,F=B&&B.imageId;if(!F||k!==E.current)return;v(se=>se&&se.localId===D?{...se,image:F}:se)}finally{k===E.current&&w(!1)}},onSave:async()=>{const{localId:A,...D}=m;(await T("/admin/ads/banner",{banner:D})).ok&&(v(null),await O())}}):f.jsx(he,{variant:"secondary",onClick:()=>v(X6()),children:"Добавить баннер"})]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Предпросмотр"}),f.jsx(ht,{children:"Так ячейка выглядит в каждом виде карточек на телефоне. Размер всегда как у соседних карточек."})]}),f.jsx(xe,{children:f.jsx(J6,{banner:m||t.banners[0]||null})})]}),f.jsx(e8,{stats:r,days:o,setDays:u})]})}function W6({draft:e,setDraft:t,busy:n,uploading:r,error:l,onUpload:o,onSave:u}){const c=(m,v,g)=>f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"banner-"+m,children:v}),f.jsx($e,{id:"banner-"+m,type:(g==null?void 0:g.type)||"text",maxLength:g==null?void 0:g.max,placeholder:g==null?void 0:g.placeholder,value:e[m],onChange:x=>t({...e,[m]:x.target.value})}),g!=null&&g.hint?f.jsx("p",{className:"text-xs text-muted-foreground",children:g.hint}):null]}),h=!e.erid.trim();return f.jsxs("div",{className:"space-y-3 rounded-md border border-border p-3",children:[f.jsx("div",{className:"text-sm font-medium",children:e.id?"Изменить баннер":"Новый баннер"}),f.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[c("title","Заголовок",{max:56,hint:"До 56 знаков"}),c("advertiser","Рекламодатель",{placeholder:"ООО «Ромашка», ИНН ...",hint:"Видно на баннере рядом с пометкой «Реклама»"}),c("text","Текст",{max:140,hint:"До 140 знаков, в виде «список» и между рельсами"}),c("erid","erid (токен ОРД)",{placeholder:"2SDnjc...",hint:"Обязательно. Выдаёт ОРД или партнёрская сеть"}),c("url","Ссылка",{placeholder:"https://...",hint:"На ТВ вместо клика QR-код с этой ссылкой"}),c("weight","Вес",{hint:"1-100: чем больше, тем чаще среди баннеров"}),c("from","Показывать с",{type:"date"}),c("to","Показывать по",{type:"date"})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.image?f.jsx("img",{src:CS(e.image),alt:"",className:"h-24 w-16 rounded object-cover"}):f.jsx("div",{className:"flex h-24 w-16 items-center justify-center rounded bg-muted text-xs",children:"нет"}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"banner-image",children:"Картинка 2:3 (JPEG, PNG, WebP, до 300 КБ)"}),f.jsx("input",{id:"banner-image",type:"file",accept:"image/jpeg,image/png,image/webp",className:"text-sm",disabled:r,onChange:m=>{const v=m.target.files&&m.target.files[0];v&&o(v)}})]})]}),f.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Разделы"}),VM.map(m=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:e.sections.indexOf(m)>=0,onChange:v=>t({...e,sections:PA(e.sections,m,v.target.checked)})}),SS[m]]},m))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"Платформы"}),GM.map(m=>f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:e.platforms.indexOf(m)>=0,onChange:v=>t({...e,platforms:PA(e.platforms,m,v.target.checked)})}),wS[m]]},m))]}),f.jsxs("fieldset",{className:"space-y-1",children:[f.jsx("legend",{className:"mb-1 text-sm font-medium",children:"ТВ"}),f.jsxs("select",{className:jS,value:e.tvMode,"aria-label":"Клик на ТВ",onChange:m=>t({...e,tvMode:m.target.value}),children:[f.jsx("option",{value:"qr",children:"QR-код со ссылкой"}),f.jsx("option",{value:"noclick",children:"Только баннер"})]}),f.jsxs("label",{className:"mt-2 flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:e.enabled,onChange:m=>t({...e,enabled:m.target.checked})}),"Баннер включён"]})]})]}),h?f.jsx(Bt,{variant:"warn",children:"Без erid баннер не сохранится: это требование закона о маркировке рекламы."}):null,l?f.jsx(Bt,{variant:"warn",children:l}):null,f.jsxs("div",{className:"flex gap-2",children:[f.jsx(he,{disabled:n||h,onClick:()=>void u(),children:"Сохранить баннер"}),f.jsx(he,{variant:"ghost",onClick:()=>t(null),children:"Отмена"})]})]})}function J6({banner:e}){if(!e)return f.jsx("p",{className:"text-sm text-muted-foreground",children:"Добавьте баннер, чтобы увидеть предпросмотр"});const t=e.image?CS(e.image):"",n=o=>f.jsxs("div",{className:"relative overflow-hidden rounded-lg bg-zinc-800 "+o,style:{aspectRatio:"173 / 240"},children:[t?f.jsx("img",{src:t,alt:"",className:"h-full w-full object-cover"}):null,f.jsx("span",{className:"absolute left-1 top-1 rounded bg-black/70 px-1 text-[10px] font-bold text-amber-300",children:"Реклама"})]}),r=(o,u)=>Array.from({length:o},(c,h)=>f.jsxs("div",{className:"space-y-1",children:[f.jsx("div",{className:"rounded-lg bg-zinc-700/60 "+u,style:{aspectRatio:"173 / 240"}}),f.jsx("div",{className:"h-2 w-3/4 rounded bg-zinc-700/60"})]},h)),l=f.jsxs("div",{className:"min-w-0 space-y-1",children:[n(""),f.jsx("div",{className:"line-clamp-2 text-xs font-semibold",children:e.title||"Заголовок"}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["Реклама · ",e.advertiser||"рекламодатель"]}),f.jsxs("div",{className:"truncate text-[10px] text-muted-foreground",children:["erid: ",e.erid||"..."]})]});return f.jsxs("div",{className:"grid gap-4 md:grid-cols-5",children:[f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: крупно (2)"}),f.jsxs("div",{className:"grid grid-cols-2 gap-2 rounded-md bg-zinc-950 p-2",children:[r(1,""),l]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: мелко (3)"}),f.jsxs("div",{className:"grid grid-cols-3 gap-1 rounded-md bg-zinc-950 p-2",children:[r(2,""),l]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: список"}),f.jsxs("div",{className:"flex gap-2 rounded-md bg-zinc-950 p-2",children:[n("w-10 shrink-0"),f.jsxs("div",{className:"min-w-0 text-xs",children:[f.jsx("div",{className:"font-semibold",children:e.title||"Заголовок"}),f.jsx("div",{className:"text-muted-foreground",children:e.text}),f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Реклама · ",e.advertiser||"рекламодатель"," · erid: ",e.erid||"..."]})]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Мои»: компактно"}),f.jsxs("div",{className:"rounded-md bg-zinc-950 p-2 text-xs",children:[f.jsx("div",{className:"font-semibold",children:e.title||"Заголовок"}),f.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[f.jsx("span",{className:"rounded bg-amber-300/20 px-1 font-bold text-amber-300",children:"Реклама"})," ",e.advertiser||"рекламодатель"," · erid: ",e.erid||"..."]})]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"«Обзор»: 4 в ряд"}),f.jsxs("div",{className:"grid grid-cols-4 gap-1 rounded-md bg-zinc-950 p-2",children:[r(3,""),l]})]})]})}function em({title:e,rows:t,label:n}){return f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 text-sm font-medium",children:e}),t.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Нет данных"}):f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Что"}),f.jsx(Se,{className:"text-right",children:"Показы"}),f.jsx(Se,{className:"text-right",children:"Клики"}),f.jsx(Se,{className:"text-right",children:"CTR"})]})}),f.jsx(er,{children:t.map(r=>f.jsxs(qe,{children:[f.jsx(me,{children:n?n(r.key,r):r.key}),f.jsx(me,{className:"text-right",children:r.impressions}),f.jsx(me,{className:"text-right",children:r.clicks}),f.jsx(me,{className:"text-right",children:FM(r)})]},r.key))})]})]})}function e8({stats:e,days:t,setDays:n}){return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsxs(Te,{className:"flex flex-wrap items-center gap-2",children:["Статистика",f.jsxs("select",{className:jS,value:t,"aria-label":"Период",onChange:r=>n(Number(r.target.value)),children:[f.jsx("option",{value:7,children:"7 дней"}),f.jsx("option",{value:30,children:"30 дней"}),f.jsx("option",{value:90,children:"90 дней"})]})]}),f.jsx(ht,{children:"Показы (ячейка видна наполовину 1 секунду) и клики по дням МСК. Без ID устройств, хранится 90 дней."})]}),f.jsx(xe,{className:"space-y-4",children:e?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"grid grid-cols-3 gap-3",children:[[e.total.impressions,"показов"],[e.total.clicks,"кликов"],[FM(e.total),"CTR"]].map(([r,l])=>f.jsxs("div",{className:"rounded-md border border-border p-3",children:[f.jsx("div",{className:"text-2xl font-bold",children:r}),f.jsx("div",{className:"text-xs text-muted-foreground",children:l})]},l))}),f.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[f.jsx(em,{title:"По баннерам",rows:e.byBanner,label:(r,l)=>l.title||l.key}),f.jsx(em,{title:"По разделам",rows:e.bySection,label:r=>SS[r]||r}),f.jsx(em,{title:"По платформам",rows:e.byPlatform,label:r=>wS[r]||r})]}),f.jsx(em,{title:"По дням",rows:e.byDay.filter(r=>r.impressions||r.clicks).reverse().map(r=>({key:r.day,impressions:r.impressions,clicks:r.clicks}))})]}):f.jsx(rn,{className:"h-24"})})]})}function kA(e){const t=e||{};return{enabled:t.enabled===!0,yoomoney:t.yoomoney===!0,stars:t.stars===!0,crypto:t.crypto===!0,notifyAll:t.notifyAll===!0,showAmounts:t.showAmounts===!0,amounts:t.amounts||"100,300,500,1000",minRub:String(t.minRub??50),maxRub:String(t.maxRub??1e5),commentMax:String(t.commentMax??200),thanksText:t.thanksText||"Спасибо! Вы поддержали проект OMP.",rubPerStar:String(t.rubPerStar??0),notifyMin:String(t.notifyMin??0)}}function t8(e,t,n){return n?e:t}function n8(e,t){const n=Object.keys(e);for(let r=0;rkA(e)),[c,h]=b.useState(null),[m,v]=b.useState("all"),[g,x]=b.useState("all"),S=b.useRef(0),w=b.useRef(o);w.current=o;const j=b.useRef({status:m,method:g});j.current={status:m,method:g};const C=c??(t==null?void 0:t.rows)??[],E=t==null?void 0:t.summary,N=(t==null?void 0:t.chart)||[],O=(t==null?void 0:t.top)||[];b.useEffect(()=>{u(P=>t8(P,kA(e),r))},[e,r]);async function T(P=m,B=g){const F=++S.current;if(P==="all"&&B==="all"){const G=IA(F,S.current,null);G!==void 0&&h(G);return}const se=new URLSearchParams;P!=="all"&&se.set("status",P),B!=="all"&&se.set("method",B);const ue=await st("/admin/api/donations?"+se.toString());if(ue.auth===!1)return;const de=IA(F,S.current,ue.rows||[]);de!==void 0&&h(de)}b.useEffect(()=>{const P=j.current;P.status==="all"&&P.method==="all"||T(P.status,P.method)},[t]);function R(P){l(!0),u(B=>({...B,...P}))}const A=Math.max(1,...N.map(P=>P.rub)),D=[["День",E==null?void 0:E.day],["Неделя",E==null?void 0:E.week],["Месяц",E==null?void 0:E.month]];return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Донаты"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:o.enabled,onChange:P=>R({enabled:P.target.checked})}),"Принимать донаты"]}),f.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.yoomoney,onChange:P=>R({yoomoney:P.target.checked})})," ЮMoney"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.stars,onChange:P=>R({stars:P.target.checked})})," Telegram Stars"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.crypto,onChange:P=>R({crypto:P.target.checked})})," Crypto Pay"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.notifyAll,onChange:P=>R({notifyAll:P.target.checked})})," Уведомлять о каждом"]}),f.jsxs("label",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:o.showAmounts,onChange:P=>R({showAmounts:P.target.checked})})," Суммы в списке благодарностей"]})]}),f.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[f.jsx(Xs,{label:"Кнопки сумм",value:o.amounts,onChange:P=>R({amounts:P})}),f.jsx(Xs,{label:"Минимум, ₽",value:o.minRub,onChange:P=>R({minRub:P})}),f.jsx(Xs,{label:"Максимум, ₽",value:o.maxRub,onChange:P=>R({maxRub:P})}),f.jsx(Xs,{label:"Комментарий, символов",value:o.commentMax,onChange:P=>R({commentMax:P})}),f.jsx(Xs,{label:"₽ за 1 звезду",value:o.rubPerStar,onChange:P=>R({rubPerStar:P})}),f.jsx(Xs,{label:"Порог уведомления, ₽",value:o.notifyMin,onChange:P=>R({notifyMin:P})})]}),f.jsxs("div",{children:[f.jsx(yt,{children:"Текст благодарности"}),f.jsx($e,{value:o.thanksText,onChange:P=>R({thanksText:P.target.value})})]}),f.jsx(he,{type:"button",onClick:()=>{const P=o;n("/admin/donate",{enabled:P.enabled?"true":"false",yoomoney:P.yoomoney?"true":"false",stars:P.stars?"true":"false",crypto:P.crypto?"true":"false",notifyAll:P.notifyAll?"true":"false",showAmounts:P.showAmounts?"true":"false",amounts:P.amounts,minRub:P.minRub,maxRub:P.maxRub,commentMax:P.commentMax,thanksText:P.thanksText,rubPerStar:P.rubPerStar,notifyMin:P.notifyMin}).then(B=>{l(i8(w.current,P,r8(B)))})},children:"Сохранить"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Пока флаг выключен, бот отвечает, что донат недоступен. Донат не продлевает подписку. Секреты ЮMoney, Stars и Crypto Pay берутся из тех же настроек оплаты."})]})]}),f.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:D.map(([P,B])=>f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:P})}),f.jsxs(xe,{className:"text-sm",children:[f.jsx("div",{children:tm((B==null?void 0:B.sum)||0)}),f.jsxs("div",{className:"text-muted-foreground",children:[(B==null?void 0:B.count)||0," донатов, средний чек ",tm((B==null?void 0:B.average)||0)]})]})]},P))}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"30 дней, МСК"})}),f.jsxs(xe,{children:[f.jsx("div",{className:"flex h-36 items-end gap-px overflow-x-auto",children:N.map(P=>f.jsx("div",{title:P.day+": "+P.rub,className:"flex h-full min-w-[6px] flex-1 flex-col justify-end",children:f.jsx("div",{className:"w-full rounded-sm bg-[#f5b700]",style:{height:Math.max(2,Math.round(P.rub/A*128))+"px"}})},P.day))}),f.jsxs("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[f.jsx("span",{children:((k=N[0])==null?void 0:k.day)||""}),f.jsx("span",{children:((I=N[N.length-1])==null?void 0:I.day)||""})]})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Топ"})}),f.jsx(xe,{className:"text-sm",children:O.length?O.map(P=>f.jsxs("div",{children:[P.who,": ",tm(P.sum)," (",P.count,")"]},P.who+P.sum)):f.jsx("div",{className:"text-muted-foreground",children:"Пока нет оплаченных донатов"})})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Лента"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsxs("select",{className:"rounded-md border bg-background px-2 py-1 text-sm",value:m,onChange:P=>{v(P.target.value),T(P.target.value,g)},children:[f.jsx("option",{value:"all",children:"все статусы"}),f.jsx("option",{value:"paid",children:"оплачен"}),f.jsx("option",{value:"pending",children:"ждёт"}),f.jsx("option",{value:"refunded",children:"возврат"})]}),f.jsxs("select",{className:"rounded-md border bg-background px-2 py-1 text-sm",value:g,onChange:P=>{x(P.target.value),T(m,P.target.value)},children:[f.jsx("option",{value:"all",children:"все способы"}),f.jsx("option",{value:"yoomoney",children:"ЮMoney"}),f.jsx("option",{value:"stars",children:"Stars"}),f.jsx("option",{value:"crypto",children:"Crypto Pay"})]}),f.jsx("a",{className:"text-sm text-primary",href:"/admin/donations.csv"+(m!=="all"||g!=="all"?"?"+new URLSearchParams({...m!=="all"?{status:m}:{},...g!=="all"?{method:g}:{}}).toString():""),children:"CSV"})]}),f.jsxs("div",{className:"overflow-x-auto",children:[f.jsxs("table",{className:"w-full text-left text-sm",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"text-muted-foreground",children:[f.jsx("th",{className:"py-1 pr-2",children:"Время"}),f.jsx("th",{className:"py-1 pr-2",children:"Кто"}),f.jsx("th",{className:"py-1 pr-2",children:"Сумма"}),f.jsx("th",{className:"py-1 pr-2",children:"Способ"}),f.jsx("th",{className:"py-1 pr-2",children:"Комментарий"}),f.jsx("th",{className:"py-1 pr-2",children:"Статус"}),f.jsx("th",{className:"py-1",children:"Действия"})]})}),f.jsx("tbody",{children:C.map(P=>f.jsxs("tr",{className:"border-t border-border",children:[f.jsx("td",{className:"py-1 pr-2 whitespace-nowrap",children:P.atText}),f.jsx("td",{className:"py-1 pr-2",children:P.nameHidden?"имя скрыто":P.who||P.telegramId}),f.jsx("td",{className:"py-1 pr-2",children:tm(P.amountRub)}),f.jsx("td",{className:"py-1 pr-2",children:P.method}),f.jsx("td",{className:"py-1 pr-2",children:P.commentHidden?"скрыт":P.comment}),f.jsx("td",{className:"py-1 pr-2",children:P.held&&P.status==="pending"?"ждёт в ЮMoney":a8[P.status]||P.status}),f.jsxs("td",{className:"py-1 space-x-2 whitespace-nowrap",children:[P.held&&P.status==="pending"?f.jsx("button",{type:"button",className:"text-primary",onClick:()=>{window.confirm("Подтвердить удержанный донат? Подписка не продлится.")&&n("/admin/donate/confirm",{id:P.id,confirm:"yes"}).then(()=>T())},children:"Подтвердить"}):null,P.status==="paid"?f.jsx("button",{type:"button",className:"text-primary",onClick:()=>{window.confirm("Отметить возврат? Деньги этой кнопкой не уходят.")&&n("/admin/donate/refund",{id:P.id,confirm:"yes"}).then(()=>T())},children:"Возврат"}):null,f.jsx("button",{type:"button",className:"text-primary",onClick:()=>void n("/admin/donate/hide",{id:P.id,field:"comment"}).then(()=>T()),children:P.commentHidden?"Вернуть комментарий":"Скрыть комментарий"}),f.jsx("button",{type:"button",className:"text-primary",onClick:()=>void n("/admin/donate/hide",{id:P.id,field:"name"}).then(()=>T()),children:P.nameHidden?"Вернуть имя":"Скрыть имя"})]})]},P.id))})]}),C.length?null:f.jsx("div",{className:"py-3 text-sm text-muted-foreground",children:"Пусто"})]})]})]})]})}function Xs({label:e,value:t,onChange:n}){return f.jsxs("label",{className:"block text-sm",children:[f.jsx("span",{className:"mb-1 block text-muted-foreground",children:e}),f.jsx($e,{value:t,onChange:r=>n(r.target.value)})]})}function o8({csrf:e,settings:t,journal:n,run:r}){const[l,o]=b.useState(t||{}),[u,c]=b.useState(n||[]),[h,m]=b.useState(!1),[v,g]=b.useState("");b.useEffect(()=>{o(t||{})},[t]),b.useEffect(()=>{c(n||[])},[n]);const x=async(w,j)=>{var E;const C={...l,...w};m(!0),g("");try{const N={settings:C,...j?{cancelId:j}:{}},O=r?await r(N):await an("/admin/referral",e,N);if(!O||O.auth===!1||O.ok===!1||(E=O.flash)!=null&&E.error){g(O&&O.flash&&O.flash.error||"Не сохранилось");return}o(C),j&&c(T=>T.map(R=>R.id===j?{...R,status:"cancelled",reason:"manual"}:R))}catch{g("Не сохранилось")}finally{m(!1)}},S=w=>void x({[w]:!l[w]});return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Реферальная программа"})}),f.jsxs(xe,{className:"space-y-3",children:[v?f.jsx("p",{className:"text-sm text-destructive",children:v}):null,f.jsx(he,{type:"button",variant:l.enabled?"default":"secondary",disabled:h,onClick:()=>S("enabled"),children:l.enabled?"Программа включена":"Программа выключена"}),f.jsx(yt,{children:"Дни рефереру (макс. 14)"}),f.jsx($e,{defaultValue:String(l.referrerDays??0),onBlur:w=>void x({referrerDays:Number(w.target.value)})}),f.jsx(yt,{children:"Бонусные дни другу (макс. 14)"}),f.jsx($e,{defaultValue:String(l.friendDays??0),onBlur:w=>void x({friendDays:Number(w.target.value)})}),f.jsx(yt,{children:"Процент на баланс"}),f.jsx($e,{defaultValue:String(l.balancePercent??0),onBlur:w=>void x({balancePercent:Number(w.target.value)})}),f.jsx(he,{type:"button",variant:l.tiers?"default":"secondary",disabled:h,onClick:()=>S("tiers"),children:"Уровни 3/5/10"}),f.jsx(he,{type:"button",variant:l.friendDiscount?"default":"secondary",disabled:h,onClick:()=>S("friendDiscount"),children:"Скидка другу"}),f.jsx(he,{type:"button",variant:l.retention?"default":"secondary",disabled:h,onClick:()=>S("retention"),children:"Бонус удержания"}),f.jsxs("p",{className:"text-sm text-muted-foreground",children:["Начисление через ",l.delayDays??7," дн. после оплаты. Годовой лимит ",l.yearlyCap??12," мес. Только при активной подписке реферера и оплате друга."]}),f.jsx("h3",{className:"font-semibold",children:"Журнал"}),u.length===0?f.jsx("p",{className:"text-sm",children:"Начислений нет"}):u.map(w=>f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsxs("span",{children:[w.friendId||w.id," · ",w.status," · ",w.days," дн."]}),w.status!=="cancelled"?f.jsx(he,{type:"button",variant:"secondary",disabled:h,onClick:()=>void x({},w.id),children:"Отменить"}):null]},w.id))]})]})}const s8=[["all","Все пункты"],["tech","Только техническое"],["user","Только для пользователей"]],u8={phone:"Телефон",tv:"ТВ",lg:"LG",atv:"Android TV"};function c8(e,t,n){const r=[];return e.forEach(l=>{if(!n&&l.beta)return;const o=l.items.filter(u=>t==="all"?!0:t==="tech"?u.tech:!u.tech);o.length&&r.push({...l,items:o})}),r}function f8(e){return e.unreleased?"Не выпущено":e.version}const d8="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground",zA=12;function h8(){const[e,t]=b.useState(null),[n,r]=b.useState("ru"),[l,o]=b.useState("all"),[u,c]=b.useState(!1),[h,m]=b.useState(zA),[v,g]=b.useState("");b.useEffect(()=>{let j=!1;return st("/admin/api/changelog").then(C=>{if(!j){if(C.auth===!1){g("Нужен вход");return}t(C)}}).catch(C=>{j||g(C instanceof Error?C.message:"Не удалось загрузить")}),()=>{j=!0}},[]);const x=e?n==="en"&&(e.en||[]).length?e.en||[]:e.ru||[]:[],S=c8(x,l,u),w=x.reduce((j,C)=>j+C.items.filter(E=>E.tech).length,0);return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Изменения"}),f.jsxs(ht,{children:["Полный CHANGELOG из main на GitHub. Пункты ",f.jsx("code",{children:"[tech]"})," видны только здесь: в приложении, релизе и Telegram их нет."]})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("select",{className:d8,value:l,"aria-label":"Какие пункты",onChange:j=>o(j.target.value),children:s8.map(([j,C])=>f.jsx("option",{value:j,children:C},j))}),f.jsxs("div",{className:"flex gap-1",role:"group","aria-label":"Язык",children:[f.jsx(he,{size:"sm",variant:n==="ru"?"default":"secondary",onClick:()=>r("ru"),children:"RU"}),f.jsx(he,{size:"sm",variant:n==="en"?"default":"secondary",onClick:()=>r("en"),disabled:!e||!(e.en||[]).length,children:"EN"})]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[f.jsx("input",{type:"checkbox",checked:u,onChange:j=>c(j.target.checked)}),"Бета-версии"]}),e!=null&&e.ok?f.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:[w," тех. пунктов · загружено ",f.jsx(dt,{ms:n==="en"?e.enFetchedAt:e.fetchedAt})]}):null]}),v?f.jsx(Bt,{variant:"destructive",children:v}):null,e&&!e.ok?f.jsxs(Bt,{variant:"destructive",children:["GitHub не ответил",e.error?": "+e.error:"",". Попробуйте позже."]}):null,e!=null&&e.ok&&e.stale?f.jsxs(Bt,{variant:"warn",children:["Показана сохранённая копия: GitHub не ответил",e.error?" ("+e.error+")":"","."]}):null,e!=null&&e.ok&&n==="en"&&e.enStale?f.jsxs(Bt,{variant:"warn",children:["Английский текст из сохранённой копии",e.enFetchedAt?"":" (не загружался)",": CHANGELOG.en.md не ответил",e.enError?" ("+e.enError+")":"","."]}):null,e===null&&!v?f.jsx(rn,{className:"h-24"}):e!=null&&e.ok&&S.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Пунктов нет"}):f.jsxs("div",{className:"space-y-4",children:[S.slice(0,h).map(j=>f.jsxs("section",{className:"space-y-2",children:[f.jsxs("h3",{className:"flex flex-wrap items-center gap-2 text-base font-semibold",children:[f8(j),j.unreleased?f.jsx(Oe,{variant:"warn",children:"не в релизе"}):null,j.beta?f.jsx(Oe,{variant:"secondary",children:"бета"}):null]}),f.jsx("ul",{className:"space-y-1 text-sm",children:j.items.map((C,E)=>f.jsxs("li",{className:"flex items-start gap-2 rounded-md px-2 py-1 "+(C.tech?"border-l-2 border-amber-500 bg-amber-950/30":"border-l-2 border-transparent"),children:[C.tech?f.jsx(Oe,{variant:"warn",className:"shrink-0",children:"tech"}):null,C.platform?f.jsx(Oe,{variant:"secondary",className:"shrink-0",children:u8[C.platform]||C.platform}):null,f.jsx("span",{className:"min-w-0 flex-1 "+(C.tech?"text-amber-100":""),children:C.text})]},E))})]},j.version)),S.length>h?f.jsxs(he,{variant:"secondary",onClick:()=>m(j=>j+zA),children:["Показать ещё (",S.length-h,")"]}):null]})]})]})}const m8='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function v8({title:e,onClose:t,children:n}){const r=b.useId(),l=b.useRef(null),o=b.useRef(t);return o.current=t,b.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null,c=l.current;c==null||c.focus();const h=v=>{if(v.key==="Escape"){v.preventDefault(),o.current();return}if(v.key!=="Tab"||!c)return;const g=Array.from(c.querySelectorAll(m8));if(!g.length){v.preventDefault();return}const x=g[0],S=g[g.length-1],w=document.activeElement;v.shiftKey&&(w===x||!c.contains(w))?(v.preventDefault(),S.focus()):!v.shiftKey&&w===S&&(v.preventDefault(),x.focus())};document.addEventListener("keydown",h);const m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",h),document.body.style.overflow=m,u==null||u.focus()}},[]),f.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/60 sm:items-center sm:p-4",onClick:()=>o.current(),children:f.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-labelledby":r,tabIndex:-1,className:"flex max-h-[100dvh] w-full flex-col overflow-hidden rounded-t-lg border border-border bg-card shadow-lg outline-none sm:max-h-[85vh] sm:max-w-3xl sm:rounded-lg",onClick:u=>u.stopPropagation(),children:[f.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[f.jsx("h2",{id:r,className:"min-w-0 truncate text-lg font-semibold",children:e}),f.jsx("button",{type:"button",className:"h-10 shrink-0 rounded-md bg-secondary px-3 text-sm font-semibold text-secondary-foreground",onClick:()=>o.current(),children:"Закрыть"})]}),f.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:n})]})})}function g8(e,t){const n=t.trim().toLowerCase();return n?e.split(`
+`).filter(r=>r.toLowerCase().indexOf(n)>=0).join(`
+`):e}function p8(e){return e.map(n=>{const r=n.ok===!0?"ок":n.ok===!1?"нет":"-",l=n.lastError?" · "+n.lastError:"";return n.name+": "+r+", "+n.latencyMs+" мс"+l}).join(`
+`)+`
+
+`+JSON.stringify(e,null,2)}const y8="h-10 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm text-foreground",LA="h-10 shrink-0 rounded-md bg-secondary px-3 text-sm font-semibold text-secondary-foreground disabled:opacity-50";function Wf({title:e,text:t,onClose:n,onRefresh:r,refreshing:l}){const[o,u]=b.useState(""),c=g8(t,o);return f.jsxs(v8,{title:e,onClose:n,children:[f.jsxs("div",{className:"flex flex-wrap gap-2 border-b border-border px-4 py-3",children:[f.jsx("input",{className:y8,value:o,"aria-label":"Фильтр",placeholder:"Фильтр строк",autoComplete:"off",onChange:h=>u(h.target.value)}),r?f.jsx("button",{type:"button",className:LA,disabled:l,onClick:r,children:l?"Обновление…":"Обновить"}):null,f.jsx("button",{type:"button",className:LA,onClick:()=>{if(!c){rt("Пусто");return}navigator.clipboard.writeText(c).then(()=>rt("Скопировано"),()=>rt("Не скопировалось"))},children:"Копировать"})]}),f.jsx("pre",{className:"min-h-40 flex-1 overflow-auto whitespace-pre-wrap break-words bg-background p-4 font-mono text-xs","aria-busy":l?!0:void 0,children:c||(o.trim()?"Нет строк":"")})]})}const KM="omp-admin-monitor-view",UA={filter:"all",sort:"status",desc:!1,q:"",open:{}},V0={all:"Все",errors:"Только ошибки",noalert:"Без алерта",code:"Просит код"},G0={status:"Статус",name:"Название",ms:"Время ответа",time:"Время проверки"};function x8(e){try{const t=e?e.getItem(KM):null;if(!t)return{...UA,open:{}};const n=JSON.parse(t),r={};if(n.open&&typeof n.open=="object")for(const[l,o]of Object.entries(n.open))typeof o=="boolean"&&/^[a-z]{1,20}$/.test(l)&&(r[l]=o);return{filter:n.filter&&n.filter in V0?n.filter:"all",sort:n.sort&&n.sort in G0?n.sort:"status",desc:n.desc===!0,q:typeof n.q=="string"?n.q.slice(0,100):"",open:r}}catch{return{...UA,open:{}}}}function b8(e,t){try{e&&e.setItem(KM,JSON.stringify(t))}catch{}}function S8(e){const t=[],n=new Map;for(const r of e){const l=/^(.*):(direct|warp|site)$/.exec(r.id),o=l?l[1]:r.path==="jackett"?r.id:"";if(!o){t.push({key:r.id,kind:"check",name:r.name,target:r.target||"",checks:[r],check:r});continue}let u=n.get(o);u||(u={key:o,kind:"tracker",name:r.name,target:"",checks:[]},n.set(o,u),t.push(u)),u.checks.push(r),r.target&&!u.target&&r.path!=="jackett"&&(u.target=r.target),r.path==="jackett"?u.search=r:l&&l[2]==="direct"?u.direct=r:l&&l[2]==="warp"?u.warp=r:u.site=r}return t}function q0(e){return e.checks.some(t=>t.ok===!1)?!1:e.checks.some(t=>t.ok===!0)?!0:null}const _S=e=>e.ok===!0&&!!e.warn;function YM(e){const t=q0(e);return t===!1?"red":t===null?"none":e.checks.some(_S)?"yellow":"green"}function w8(e){const t=e%10,n=e%100,r=t===1&&n!==11?"жёлтая":t>=2&&t<=4&&(n<12||n>14)?"жёлтые":"жёлтых";return e+" "+r}const j8={red:0,yellow:1,none:2,green:3},$A=e=>j8[YM(e)],BA=e=>Math.max(0,...e.checks.map(t=>Number(t.ms)||0)),HA=e=>Math.max(0,...e.checks.map(t=>Number(t.at)||0));function C8(e,t){const n=e.checks.filter(r=>r.ok===!1);return t==="errors"?n.length>0:t==="code"?e.checks.some(_S):t==="noalert"?n.length>0&&n.every(r=>!r.alert):!0}function _8(e,t){const n=t.trim().toLowerCase();return n?[e.name,e.target,e.key,...e.checks.map(l=>l.detail)].join(" ").toLowerCase().includes(n):!0}function E8(e,t,n){const r=(o,u)=>o.name.localeCompare(u.name,"ru"),l=(o,u)=>t==="name"?r(o,u):t==="ms"?BA(o)-BA(u)||r(o,u):t==="time"?HA(o)-HA(u)||r(o,u):$A(o)-$A(u)||r(o,u);return e.map((o,u)=>({it:o,i:u})).sort((o,u)=>(n?-l(o.it,u.it):l(o.it,u.it))||o.i-u.i).map(o=>o.it)}function A8(e,t,n){const r=n.filter!=="all"||!!n.q.trim(),l=[];e.forEach(u=>{const c=t.filter(C=>C.group===u.id);if(!c.length)return;const h=S8(c),m=c.filter(C=>C.ok===!1).length,v=E8(h.filter(C=>C8(C,n.filter)&&_8(C,n.q)),n.sort,n.desc);if(r&&!v.length)return;const g=n.open[u.id],x=h.filter(C=>q0(C)===!0).length,S=h.filter(C=>q0(C)===null).length,w=h.filter(C=>YM(C)==="yellow").length,j=r?!1:g===void 0?x===h.length:!g;l.push({id:u.id,title:u.title,total:h.length,okCount:x,warned:w,skipped:S,failed:m,folded:j,items:v})});const o=new Map(e.map((u,c)=>[u.id,c]));return l.sort((u,c)=>(u.failed?0:1)-(c.failed?0:1)||(o.get(u.id)||0)-(o.get(c.id)||0))}function O8(e){return e===!0?"ок":e===!1?"ошибка":"нет данных"}function N8(e){const t=[e.name,"id: "+e.id,"статус: "+O8(e.ok),"результат: "+(e.detail||"-")];return e.context&&t.push("контекст: "+e.context),t.push("время ответа: "+(e.ms||0)+" мс"),e.path&&t.push("путь: "+e.path),e.target&&t.push("адрес: "+e.target),t.join(`
+`)+`
+
+`+JSON.stringify(e,null,2)}const T8={queued:"в очереди",running:"проверяется",retry:"ждёт повтора",done:"готово"},XM=b.createContext({states:{},running:!1,pending:[],recheck:()=>{}}),QM=b.createContext(()=>{});function ES({row:e}){const t=b.useContext(QM);return f.jsx("button",{type:"button",className:"ml-2 text-xs text-primary underline",onClick:()=>t(e),children:"Подробнее"})}function K0({ids:e,red:t,recheckIds:n}){const r=n||e,l=b.useContext(XM),o=e.map(c=>l.states[c]).filter(Boolean),u=r.some(c=>l.pending.includes(c));if(l.running&&o.length){const c=o.includes("running")?"running":o.includes("retry")?"retry":o.includes("queued")?"queued":"done";return f.jsxs(Oe,{variant:c==="done"?"ok":c==="retry"?"warn":"secondary",className:"ml-2 align-middle","data-row-state":c,children:[c==="running"?f.jsx("span",{className:"mr-1 inline-block h-2 w-2 animate-spin rounded-full border border-current border-t-transparent"}):null,T8[c]]})}return!t||!r.length?null:f.jsxs(he,{type:"button",size:"sm",variant:"outline",className:"ml-2 h-7 px-2 text-xs",disabled:l.running||u,title:l.running?"Идёт проверка, дождитесь конца":"Проверить заново только эту строку",onClick:()=>l.recheck(r),"data-recheck":r.join(","),children:[u?f.jsx("span",{className:"mr-1 inline-block h-2 w-2 animate-spin rounded-full border border-current border-t-transparent"}):null,"Перепроверить"]})}const FA={direct:"напрямую",warp:"через WARP",jackett:"через Jackett",internal:"внутр. сеть"};function AS({ok:e,alerted:t,warn:n}){return e===!0&&n?f.jsx(Oe,{variant:"warn","data-status":"code",title:"Сайт отвечает страницей с капчей или проверкой на робота. Человек откроет, алерта нет.",children:"Просит код"}):e===!0?f.jsx(Oe,{variant:"ok",children:"ок"}):e===!1?f.jsx(Oe,{variant:"bad",children:t?"ошибка · в Telegram":"ошибка"}):f.jsx(Oe,{variant:"secondary",children:"-"})}function Y0({strip:e,uptime:t}){return f.jsxs("div",{className:"flex items-center gap-2",title:"7 дней, по часам: зелёный - всё ок, красный - была ошибка, серый - нет данных",children:[f.jsx("div",{className:"flex h-3.5 items-stretch overflow-hidden rounded-sm","data-testid":"history-strip",children:e.split("").map((n,r)=>f.jsx("span",{className:"w-[2px] "+(n==="g"?"bg-emerald-600":n==="r"?"bg-red-600":"bg-zinc-800")},r))}),f.jsx("span",{className:"w-12 text-right text-xs text-muted-foreground",children:t==null?"-":t+"%"})]})}function ZM({path:e}){return!e||!FA[e]?null:f.jsx(Oe,{variant:"secondary",className:"ml-2 align-middle",children:FA[e]})}function $m(e){return new Date(e).toLocaleTimeString("ru-RU",{timeZone:"Europe/Moscow",hour12:!1})}function WM({row:e}){return e?f.jsxs("span",{className:"text-xs",children:[e.detail||"-",e.ms?f.jsxs("span",{className:"text-muted-foreground",children:[" · ",e.ms," мс"]}):null,e.at?f.jsxs("span",{className:"text-muted-foreground",children:[" · ",$m(e.at)]}):null,e.retried&&e.ok===!1?f.jsx("span",{className:"text-muted-foreground",children:" · повтор через 30 с"}):null,!e.alert&&e.ok===!1?f.jsx("span",{className:"text-muted-foreground",children:" · без алерта"}):null,f.jsx(ES,{row:e})]}):f.jsx("span",{className:"text-muted-foreground",children:"-"})}function VA(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function R8({rows:e}){return f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{className:"w-28",children:"Статус"}),f.jsx(Se,{children:"Проверка"}),f.jsx(Se,{children:"Результат"}),f.jsx(Se,{className:"w-[240px]",children:"7 дней"})]})}),f.jsx(er,{children:e.map(t=>f.jsxs(qe,{"data-check":t.id,children:[f.jsx(me,{children:f.jsx(AS,{ok:t.ok,alerted:t.alerted,warn:t.warn})}),f.jsxs(me,{className:"font-medium",children:[t.name,t.group==="containers"?null:f.jsx(ZM,{path:t.path}),f.jsx(K0,{ids:[t.id],red:t.ok===!1})]}),f.jsxs(me,{children:[f.jsx(WM,{row:t}),t.context?f.jsx("div",{className:"text-xs text-muted-foreground",children:t.context}):null]}),f.jsx(me,{children:f.jsx(Y0,{strip:t.history,uptime:t.uptime})})]},t.id))})]})}function Sx({row:e}){return e?f.jsxs("div",{className:"space-y-1",children:[f.jsx(AS,{ok:e.ok,alerted:e.alerted,warn:e.warn}),f.jsxs("div",{className:"max-w-[260px] text-xs text-muted-foreground",children:[e.detail,f.jsx(ES,{row:e}),e.ms?" · "+e.ms+" мс":"",e.at?" · "+$m(e.at):""]})]}):f.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function M8({rows:e,withSearch:t}){return f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Трекер"}),t?f.jsx(Se,{children:"Поиск через Jackett"}):null,f.jsx(Se,{children:"Сайт напрямую"}),f.jsx(Se,{children:"Сайт через WARP"}),f.jsx(Se,{className:"w-[240px]",children:"7 дней"})]})}),f.jsx(er,{children:e.map(n=>{if(n.kind==="check"&&n.check){const l=n.check;return f.jsxs(qe,{"data-check":l.id,children:[f.jsxs(me,{className:"font-medium",children:[l.name,f.jsx(ZM,{path:l.path}),f.jsx(K0,{ids:[l.id],red:l.ok===!1})]}),f.jsxs(me,{colSpan:t?3:2,children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(AS,{ok:l.ok,alerted:l.alerted,warn:l.warn}),f.jsx(WM,{row:l})]}),l.context?f.jsx("div",{className:"text-xs text-muted-foreground",children:l.context}):null]}),f.jsx(me,{children:f.jsx(Y0,{strip:l.history,uptime:l.uptime})})]},n.key)}const r=n.search||n.warp||n.direct||n.site;return f.jsxs(qe,{"data-check":n.key,children:[f.jsxs(me,{className:"font-medium",children:[n.name,f.jsx(K0,{ids:n.checks.map(l=>l.id),red:n.checks.some(l=>l.ok===!1),recheckIds:n.checks.filter(l=>l.ok===!1).map(l=>l.id)}),n.target?f.jsx("div",{className:"text-xs text-muted-foreground",children:n.target}):null]}),t?f.jsx(me,{children:f.jsx(Sx,{row:n.search})}):null,f.jsx(me,{children:n.site?f.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.site.detail,f.jsx(ES,{row:n.site})]}):f.jsx(Sx,{row:n.direct})}),f.jsx(me,{children:n.site?null:f.jsx(Sx,{row:n.warp})}),f.jsx(me,{children:r?f.jsx(Y0,{strip:r.history,uptime:r.uptime}):null})]},n.key)})})]})}function D8({view:e,onToggle:t}){const{id:n,title:r,items:l,failed:o}=e,u=n==="jackett"||n==="jacred",c=r+" "+e.okCount+"/"+e.total+(e.warned?", "+w8(e.warned):"")+(e.skipped?", не проверено: "+e.skipped:""),h=o?f.jsxs(Oe,{variant:"bad",children:["ошибок: ",o]}):e.warned?f.jsxs(Oe,{variant:"warn",children:["просит код: ",e.warned]}):e.skipped?f.jsxs(Oe,{variant:"warn",children:["не проверено: ",e.skipped]}):f.jsx(Oe,{variant:"ok",children:"всё ок"});if(e.folded)return f.jsx(ye,{"data-group":n,"data-folded":"1",children:f.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-2 px-6 py-4 text-left",onClick:()=>t(n,!0),"aria-expanded":!1,children:[f.jsxs("span",{className:"font-semibold",children:[f.jsx("span",{className:"mr-2 text-muted-foreground",children:"▸"}),c]}),h]})});const m=l.some(g=>g.kind==="tracker"),v=l.map(g=>g.check);return f.jsxs(ye,{"data-group":n,children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[f.jsx("button",{type:"button",className:"text-left",onClick:()=>t(n,!1),"aria-expanded":!0,children:f.jsxs(Te,{children:[f.jsx("span",{className:"mr-2 text-muted-foreground",children:"▾"}),c]})}),h]}),f.jsxs(xe,{className:"space-y-3",children:[m?f.jsx(M8,{rows:l,withSearch:n==="jackett"}):l.length?f.jsx(R8,{rows:v}):null,u?f.jsx("p",{className:"text-xs text-muted-foreground",children:n==="jackett"?"Поиск через Jackett - тот путь, которым идут пользователи (Jackett сам ходит через WARP и FlareSolverr). Сайт напрямую и через WARP показывает, какой путь закрыт. Алерт: поиск не работает, или сайт не открывается ни напрямую, ни через WARP.":"JacRed берёт базу с sync.jacred.stream, сам на трекеры не ходит. Строки трекеров показывают, открывается ли сайт напрямую и через WARP; алерт - только если ни так, ни так."}):null]})]})}const P8="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground";function k8({prefs:e,setPrefs:t,shown:n}){return f.jsx(ye,{children:f.jsxs(xe,{className:"flex flex-wrap items-end gap-3 pt-6",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{children:"Показать"}),f.jsx("div",{className:"flex gap-1",role:"group","aria-label":"Фильтр",children:Object.keys(V0).map(r=>f.jsx(he,{type:"button",size:"sm",className:"h-10",variant:e.filter===r?"default":"outline","aria-pressed":e.filter===r,title:r==="noalert"?"Красные строки, по которым алерт не уходит (например, сайт закрыт только напрямую)":void 0,onClick:()=>t({...e,filter:r}),children:V0[r]},r))})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"monitorSearch",children:"Поиск"}),f.jsx($e,{id:"monitorSearch",className:"w-56",placeholder:"название, адрес, ошибка",value:e.q,onChange:r=>t({...e,q:r.target.value})})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"monitorSort",children:"Сортировка"}),f.jsxs("div",{className:"flex gap-1",children:[f.jsx("select",{id:"monitorSort",className:P8,value:e.sort,onChange:r=>t({...e,sort:r.target.value}),children:Object.keys(G0).map(r=>f.jsx("option",{value:r,children:G0[r]},r))}),f.jsx(he,{type:"button",variant:"outline",className:"w-10 px-0",title:e.desc?"По убыванию":"По возрастанию","aria-label":e.desc?"По убыванию":"По возрастанию",onClick:()=>t({...e,desc:!e.desc}),children:e.desc?"↓":"↑"})]})]}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["Строк: ",n]})]})})}function I8({data:e,busy:t,interval:n,setInterval:r,onRun:l,onRecheck:o,onSave:u,prefs:c,setPrefs:h,onRowRecheck:m,pending:v}){const g=!!(e!=null&&e.running),x=(e==null?void 0:e.checks)||[],S=x.filter(D=>D.ok===!1).length,w=new Set(x.filter(_S).map(D=>D.id.replace(/:(direct|warp|site)$/,""))).size,j=A8((e==null?void 0:e.groups)||[],x,c),C=j.reduce((D,k)=>D+(k.folded?0:k.items.length),0),E=g&&(e==null?void 0:e.progress)||null,N=g?null:(e==null?void 0:e.lastSummary)||null,O=D=>{var k;return((k=x.find(I=>I.id===D))==null?void 0:k.name)||D},T={states:(E==null?void 0:E.states)||{},running:g,pending:v||[],recheck:m||(()=>{})},[R,A]=b.useState(null);return f.jsx(QM.Provider,{value:A,children:f.jsx(XM.Provider,{value:T,children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-start justify-between gap-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Te,{children:"Мониторинг"}),f.jsxs(ht,{children:[e!=null&&e.lastRun?"Последняя проверка: "+zi(e.lastRun.finishedAt)+(e.lastRun.trigger==="manual"?" (вручную)":e.lastRun.trigger==="recheck"?" (перепроверка)":"")+".":"Проверок ещё не было.",e!=null&&e.scheduled&&(e!=null&&e.nextRunAt)?" Следующая около "+zi(e.nextRunAt)+".":"",e&&!e.scheduled?" Расписание на этом экземпляре выключено, работает только ручная проверка.":""]}),f.jsx(ht,{children:"Перед алертом упавшая проверка повторяется через 30 с. Алерт приходит в Telegram один раз на проблему и ещё раз, когда починилось."})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.length?S?f.jsxs(Oe,{variant:"bad",children:["ошибок: ",S]}):f.jsx(Oe,{variant:"ok",children:"всё ок"}):null,w?f.jsxs(Oe,{variant:"warn",title:"Сайты, которые отвечают капчей или проверкой на робота (без алерта)",children:["просит код: ",w]}):null,f.jsx(he,{type:"button",disabled:t||g,onClick:l,children:g?"Проверка идёт…":"Проверить сейчас"}),S?f.jsx(he,{type:"button",variant:"secondary",disabled:t||g,onClick:o,title:"Запустить заново только красные проверки, остальные сохраняют последний результат",children:"Перепроверить все ошибки"}):null]})]}),f.jsxs(xe,{className:"space-y-3",children:[E?f.jsxs("div",{className:"space-y-1","data-testid":"monitor-progress",children:[f.jsxs("div",{className:"text-sm",children:["Проверка идёт: ",E.done," из ",E.total,", начата ",$m(E.startedAt)," МСК",E.trigger==="recheck"?" (перепроверка)":"",Object.values(E.states).includes("retry")?", ждёт повтора: "+Object.values(E.states).filter(D=>D==="retry").length:""]}),f.jsx("div",{className:"h-2 w-full max-w-md overflow-hidden rounded bg-zinc-800",children:f.jsx("div",{className:"h-full bg-amber-500 transition-all",style:{width:Math.round(100*E.done/Math.max(1,E.total))+"%"}})})]}):null,N?f.jsxs("div",{className:"text-sm text-muted-foreground","data-testid":"monitor-summary",children:["Готово в ",$m(N.finishedAt)," МСК",N.ids?" ("+N.ids.map(O).join(", ")+")":N.trigger==="recheck"?" (перепроверка ошибок)":"",": проверено ",N.checked,", ошибок ",N.failed,N.retried?", повторено через 30 с: "+N.retried:"",", заняло ",Math.max(1,Math.round((N.finishedAt-N.startedAt)/1e3))," с."]}):null,f.jsxs("form",{className:"flex flex-wrap items-end gap-2",onSubmit:D=>{D.preventDefault(),u()},children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:"monitorInterval",children:"Интервал, минут (5-1440)"}),f.jsx($e,{id:"monitorInterval",className:"w-32",inputMode:"numeric",value:n,onChange:D=>r(D.target.value)})]}),f.jsx(he,{type:"submit",variant:"secondary",disabled:t,children:"Сохранить"})]})]})]}),e!=null&&e.error?f.jsx(Bt,{variant:"destructive",children:e.error==="read_only"?"Сервер в режиме только чтения: мониторинг не работает.":"Мониторинг недоступен на этом экземпляре."}):null,!e&&t?f.jsx(rn,{className:"h-40"}):null,x.length?f.jsx(k8,{prefs:c,setPrefs:h,shown:C}):null,x.length&&!j.length?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Ничего не найдено."}):null,j.map(D=>f.jsx(D8,{view:D,onToggle:(k,I)=>h({...c,open:{...c.open,[k]:I}})},D.id)),R?f.jsx(Wf,{title:"Проверка "+R.name,text:N8(R),onClose:()=>A(null)}):null]})})})}function z8({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(!1),[o,u]=b.useState(""),[c,h]=b.useState(""),m=b.useRef(!1),[v,g]=b.useState([]),[x,S]=b.useState(()=>x8(VA())),w=O=>{S(O),b8(VA(),O)};async function j(){let O;try{O=await st("/admin/api/monitor")}catch{return h("Нет связи с сервером"),null}if(O.auth===!1)return h("Нужен вход"),null;if(!O.ok)return h(O.error==="read_only"?"Этот экземпляр только для чтения, мониторинг здесь не работает":"Мониторинг недоступен"),null;if(h(""),n(O),u(T=>T||String(O.intervalMin||"")),m.current&&!O.running){const T=O.lastSummary;rt(T?"Проверка завершена: проверено "+T.checked+", ошибок "+T.failed+(T.retried?", повторено через 30 с: "+T.retried:"")+", заняло "+Math.max(1,Math.round((T.finishedAt-T.startedAt)/1e3))+" с":"Проверка завершена")}return O.running||g([]),m.current=!!O.running,O}b.useEffect(()=>{l(!0),j().finally(()=>l(!1))},[]),b.useEffect(()=>{const O=window.setInterval(()=>void j(),t!=null&&t.running?3e3:6e4);return()=>window.clearInterval(O)},[t==null?void 0:t.running]);async function C(O=!1){l(!0);try{const T=await an("/admin/monitor/run",e,O?{only:"failed"}:{});if(T.auth===!1)return h("Нужен вход");if(!T.ok){rt(T.error||"Не запущено, обновите страницу");return}rt(O?"Перепроверяю красные проверки":"Проверка запущена, займёт до нескольких минут"),m.current=!0,await j()}catch{rt("Нет связи с сервером")}finally{l(!1)}}async function E(O){g(O);try{const T=await an("/admin/monitor/run",e,{ids:O});if(T.auth===!1)return h("Нужен вход");if(!T.ok){g([]),rt(T.error||"Не запущено, обновите страницу");return}m.current=!0,await j()}catch{g([]),rt("Нет связи с сервером")}}async function N(){l(!0);try{const O=await an("/admin/monitor/config",e,{intervalMin:o});if(O.auth===!1)return h("Нужен вход");O.ok?(rt("Интервал: "+O.intervalMin+" мин"),u(String(O.intervalMin)),await j()):rt(O.error||"Не сохранено")}catch{rt("Нет связи с сервером")}finally{l(!1)}}return f.jsxs(f.Fragment,{children:[c?f.jsx(Bt,{variant:"destructive",children:c}):null,f.jsx(I8,{data:t,busy:r,interval:o,setInterval:u,onRun:()=>void C(),onRecheck:()=>void C(!0),onSave:()=>void N(),prefs:x,setPrefs:w,onRowRecheck:O=>void E(O),pending:v})]})}function L8(){let e=0;return{next(){return e+=1,e},isCurrent(t){return t===e}}}function GA(e){if(e.auth===!1)return"Нужен вход";const t=e.ms||0;return e.reason==="probe_rate"?"лимит проверки - это лимит кнопки, не сбой DHT":e.reason==="sidecar_rate"?"sidecar занят (429) - это лимит sidecar, не лимит кнопки":e.ok||e.reason==="ok"?"ок, пиров "+(e.peers||0)+", "+t+" мс":e.reason==="not_ready"?"проверка: DHT еще не поднялся ("+t+" мс)":e.reason==="disabled"?"проверка: sidecar выключен ("+t+" мс)":e.reason==="down"?"проверка: sidecar не ответил ("+t+" мс)":e.error==="rate"||e.status===429?"лимит проверки - это лимит кнопки, не сбой DHT":e.status===503?"проверка: sidecar выключен ("+t+" мс)":"проверка не прошла ("+(e.status||0)+", "+t+" мс)"}const U8=2e4;function $8(e){return e==null||e<0?"":e>=1024*1024?Math.round(e/(1024*1024)*10)/10+" МБ":Math.max(1,Math.round(e/1024))+" КБ"}function B8(e){const t=e.sidecar;return!e.configured&&!(t&&t.configured)?f.jsx(Oe,{variant:"secondary",children:"не настроен"}):t&&t.ok?f.jsxs(Oe,{variant:"ok",children:["доступен · ",t.latencyMs||0," мс"]}):f.jsx(Oe,{variant:"bad",children:"не отвечает"})}function H8(e){return e==="up"?"сокет открыт":e==="idle"?"сокет закрыт":""}function F8(e){const t=e&&typeof e.perMinute=="number"?e.perMinute:30;return t<=0?"лимит выключен (0 в настройках)":t+" запросов в минуту на устройство"}function qA({rows:e,field:t,label:n,color:r}){const l=Math.max(1,...e.map(c=>c[t])),o=e[0]?zi(e[0].t):"",u=e.length?zi(e[e.length-1].t):"";return f.jsxs("div",{children:[f.jsx("div",{className:"mb-2 text-sm text-muted-foreground",children:n}),f.jsx("div",{className:"flex h-36 items-end gap-px overflow-x-auto",children:e.map(c=>f.jsx("div",{title:zi(c.t)+": "+c[t],className:"flex h-full min-w-[4px] flex-1 flex-col justify-end",children:f.jsx("div",{className:"w-full rounded-sm",style:{height:Math.max(2,Math.round(c[t]/l*128))+"px",background:r}})},t+":"+c.t))}),f.jsxs("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[f.jsx("span",{children:o}),f.jsx("span",{children:u})]})]})}function V8({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(""),[o,u]=b.useState(null),[c,h]=b.useState(!1),m=b.useRef(L8()),v=b.useCallback(()=>{const O=m.current.next();return st("/admin/api/dht").then(T=>{if(m.current.isCurrent(O)){if(T.auth===!1){l("Нужен вход");return}l(""),n(T)}}).catch(T=>{m.current.isCurrent(O)&&l(T instanceof Error?T.message:"Не удалось загрузить DHT")})},[]);b.useEffect(()=>{v();const O=window.setInterval(()=>void v(),U8);return()=>{m.current.next(),window.clearInterval(O)}},[v]);async function g(){h(!0);try{const O=await st("/admin/api/dht/probe",{method:"POST",headers:{"content-type":"application/json",Accept:"application/json"},body:JSON.stringify({csrf:e})});u(GA(O)+`
+
+`+JSON.stringify(O,null,2)),await v()}catch(O){const T={ok:!1,error:O instanceof Error?O.message:"проверка"};u(GA(T)+`
+
+`+JSON.stringify(T,null,2))}finally{h(!1)}}const x=t&&t.stats||{},S=x.requests24h||0,w=x.withPeers24h||0,j=x.errors||[],C=x.series||[],E=t&&t.sidecar?$8(t.sidecar.rss):"",N=t&&t.sidecar&&t.sidecar.ok?H8(t.sidecar.dht):"";return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[f.jsx(Te,{children:"DHT"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(he,{type:"button",size:"sm",variant:"secondary",onClick:()=>void v(),children:"Обновить"}),f.jsx(he,{type:"button",size:"sm",disabled:!e||c,onClick:()=>void g(),children:c?"Проверка...":"Проверить DHT"})]})]})}),f.jsxs(xe,{className:"space-y-3 text-sm",children:[r?f.jsx("p",{className:"text-destructive",children:r}):null,!t&&!r?f.jsx("p",{className:"text-muted-foreground",children:"Загрузка..."}):null,t?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("span",{children:"omp-dht-peers"}),B8(t),N?f.jsx("span",{className:"text-muted-foreground",children:N}):null,E?f.jsxs("span",{className:"text-muted-foreground",children:["память ",E]}):null]}),f.jsxs("p",{className:"text-muted-foreground",children:["Лимит: ",F8(t.limit),". Меняется в «Настройках». Обновление само, раз в 20 с."]}),o!=null?f.jsx(Wf,{title:"Проверка DHT",text:o,onClose:()=>u(null)}):null,f.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"Запросов за 24 ч"}),f.jsx("div",{className:"text-lg font-semibold",children:S})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"С пирами"}),f.jsx("div",{className:"text-lg font-semibold",children:S?x.peersSharePct+"% ("+w+" из "+S+")":"нет запросов"}),f.jsxs("div",{className:"text-muted-foreground",children:["Ошибок за 24 ч: ",x.errors24h||0," (4xx ",x.errors4xx24h||0,", 5xx ",x.errors5xx24h||0,")"]})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"Среднее время"}),f.jsx("div",{className:"text-lg font-semibold",children:S?(x.avgMs||0)+" мс":"-"})]}),f.jsxs("div",{children:[f.jsx("div",{className:"text-muted-foreground",children:"p50 / p95 за 24 ч"}),f.jsx("div",{className:"text-lg font-semibold",children:S?(x.p50Ms||0)+" / "+(x.p95Ms||0)+" мс":"-"})]})]}),f.jsx(qA,{rows:C,field:"requests",label:"Запросы за 24 ч, слот 10 мин",color:"#f5b700"}),f.jsx(qA,{rows:C,field:"errors",label:"Ошибки за 24 ч, слот 10 мин",color:"#e11d48"}),f.jsx("p",{className:"text-muted-foreground",children:"429 и причина «лимит» - это лимит биллинга на запросы с устройства, а не сбой сети DHT. Панель не показывает названия торрентов и infohash. Счетчики за 24 часа лежат в Postgres и остаются после перезапуска. Токен, id устройства и infohash по-прежнему не пишутся. «Проверить DHT» зовет sidecar с постоянным тестовым хешем из нулей (это не торрент пользователя) и тоже попадает в счетчики. В таблице ошибок у такой проверки причина «проверка», без самого хеша."})]}):null]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Последние ошибки"})}),j.length===0?f.jsx(xe,{className:"text-sm text-muted-foreground",children:"Ошибок нет"}):f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Время"}),f.jsx(Se,{children:"Код"}),f.jsx(Se,{children:"Причина"})]})}),f.jsx(er,{children:j.map((O,T)=>f.jsxs(qe,{children:[f.jsx(me,{children:zi(O.at)}),f.jsx(me,{children:O.status}),f.jsx(me,{children:O.reason})]},O.at+":"+T))})]})]})]})}const $r="space-y-1";function wx(e){if(!e)return"0";const t=e/(1024*1024*1024);return(Math.round(t*10)/10).toString()}function G8(e){return e?Math.round(e/(1024*1024))+" МБ":"0 МБ"}function q8(e){return e.status==="disabled"?f.jsx(Oe,{variant:"secondary",children:"выключен"}):e.status==="online"?f.jsx(Oe,{variant:"ok",children:"онлайн"}):f.jsx(Oe,{variant:"bad",children:"нет ответа"})}async function K8(e,t,n){return st(e,{method:"POST",headers:{"content-type":"application/json",Accept:"application/json"},body:JSON.stringify({csrf:t,...n})})}function Y8({csrf:e}){const[t,n]=b.useState(null),[r,l]=b.useState(""),[o,u]=b.useState(""),[c,h]=b.useState(""),[m,v]=b.useState(""),[g,x]=b.useState(""),[S,w]=b.useState("500"),[j,C]=b.useState("0"),[E,N]=b.useState("0"),[O,T]=b.useState("512"),[R,A]=b.useState("0"),[D,k]=b.useState(""),[I,P]=b.useState(""),[B,F]=b.useState(""),[se,ue]=b.useState("");async function de(){const U=await st("/admin/api/cache");U.auth!==!1&&(n(U),U.prefixMb!==void 0&&T(String(U.prefixMb)),U.prefixPercent!==void 0&&A(String(U.prefixPercent)))}b.useEffect(()=>{de()},[]);async function G(U,Ae){u("");const ee=await K8(U,(t==null?void 0:t.csrf)||e,Ae);ee.auth!==!1&&(ee.token&&l(ee.token),ee.error&&u(ee.error),await de())}const ne=(t==null?void 0:t.enabled)===!0,ie=(t==null?void 0:t.nodes)||[],ce=(t==null?void 0:t.assignments)||[];return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Кэш популярных раздач"}),f.jsx(ht,{children:"Узлы держат начало популярных раздач, чтобы воспроизведение начиналось сразу. Пока переключатель выключен, приложение и расчет ничего не меняют."})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ne?f.jsx(Oe,{variant:"ok",children:"включено"}):f.jsx(Oe,{variant:"secondary",children:"выключено"}),f.jsx(he,{variant:ne?"secondary":"default",onClick:()=>void G("/admin/cache/settings",{enabled:!ne,prefixMb:O,prefixPercent:R}),children:ne?"Выключить":"Включить"}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/recalc",{}),children:"Пересчитать"})]}),f.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Префикс, МБ (0 - брать проценты)"}),f.jsx($e,{value:O,onChange:U=>T(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Префикс, %"}),f.jsx($e,{value:R,onChange:U=>A(U.target.value)})]})]}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/settings",{enabled:ne,prefixMb:O,prefixPercent:R}),children:"Сохранить префикс"})]})]}),r?f.jsxs(Bt,{children:["Токен узла показывается один раз. Скопируйте его в конфиг сервера и закройте эту строку.",f.jsx("div",{className:"mt-2 break-all font-mono text-sm",children:r}),f.jsx(he,{className:"mt-2",variant:"secondary",onClick:()=>l(""),children:"Скрыть"})]}):null,o?f.jsx(Bt,{children:o}):null,f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Новый узел"})}),f.jsxs(xe,{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Имя"}),f.jsx($e,{value:c,onChange:U=>h(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Адрес TorrServer"}),f.jsx($e,{value:m,placeholder:"http://cache.example:8090",onChange:U=>v(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Регион"}),f.jsx($e,{value:g,onChange:U=>x(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Емкость, ГБ"}),f.jsx($e,{value:S,onChange:U=>w(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Свой префикс, МБ (0 - общий)"}),f.jsx($e,{value:j,onChange:U=>C(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Свой префикс, %"}),f.jsx($e,{value:E,onChange:U=>N(U.target.value)})]}),f.jsx(he,{onClick:()=>void G("/admin/cache/node",{name:c,url:m,region:g,capacityGb:S,prefixMb:j,prefixPercent:E}),children:"Добавить и выдать токен"})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Узлы"})}),f.jsx(xe,{className:"overflow-x-auto",children:f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Имя"}),f.jsx(Se,{children:"Статус"}),f.jsx(Se,{children:"Диск"}),f.jsx(Se,{children:"Heartbeat"}),f.jsx(Se,{children:"Токен"}),f.jsx(Se,{})]})}),f.jsx(er,{children:ie.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:6,children:"Узлов нет"})}):ie.map(U=>f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("div",{className:"font-medium",children:U.name}),f.jsx("div",{className:"text-xs text-muted-foreground",children:U.url}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[U.region||"регион не задан"," - ",wx(U.capacityBytes)," ГБ"]})]}),f.jsxs(me,{children:[q8(U),f.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:U.torrserverOk?"TorrServer отвечает":"TorrServer молчит"})]}),f.jsxs(me,{children:[wx(U.diskUsedBytes)," / ",wx(U.diskTotalBytes)," ГБ"]}),f.jsx(me,{children:U.lastHeartbeat?zi(U.lastHeartbeat):"не было"}),f.jsx(me,{children:U.hasToken?"есть":"отозван"}),f.jsxs(me,{className:"space-x-2 space-y-2",children:[f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/token",{id:U.id}),children:"Новый токен"}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/token/revoke",{id:U.id}),children:"Отозвать"}),f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/node/disable",{id:U.id,disabled:!U.disabled}),children:U.disabled?"Включить узел":"Выключить узел"})]})]},U.id))})]})})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Закрепить раздачу"}),f.jsx(ht,{children:"Пустой магнит означает раздачу по DHT. Ссылку с ключом трекера панель не сохранит."})]}),f.jsxs(xe,{className:"grid gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"infohash"}),f.jsx($e,{value:D,onChange:U=>k(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Название"}),f.jsx($e,{value:I,onChange:U=>P(U.target.value)})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Узел"}),f.jsxs("select",{className:"h-10 rounded-md border border-input bg-secondary px-3 text-sm",value:B,onChange:U=>F(U.target.value),children:[f.jsx("option",{value:"",children:"выберите"}),ie.map(U=>f.jsx("option",{value:U.id,children:U.name},U.id))]})]}),f.jsxs("div",{className:$r,children:[f.jsx(yt,{children:"Магнит"}),f.jsx($e,{value:se,onChange:U=>ue(U.target.value)})]}),f.jsx(he,{onClick:()=>void G("/admin/cache/pin",{infohash:D,title:I,nodeId:B,magnet:se}),children:"Закрепить"})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Назначения"})}),f.jsx(xe,{className:"overflow-x-auto",children:f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Раздача"}),f.jsx(Se,{children:"Узел"}),f.jsx(Se,{children:"Статус"}),f.jsx(Se,{children:"Префикс"}),f.jsx(Se,{})]})}),f.jsx(er,{children:ce.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:5,children:"Назначений нет"})}):ce.map(U=>f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("div",{children:U.title||U.infohash}),f.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:U.infohash})]}),f.jsx(me,{children:U.nodeName}),f.jsxs(me,{children:[U.status,U.pinned?" - закреплено":"",U.source==="manual"?" - вручную":"",U.error?" - "+U.error:""]}),f.jsx(me,{children:G8(U.prefixBytes)}),f.jsx(me,{children:f.jsx(he,{variant:"secondary",onClick:()=>void G("/admin/cache/unpin",{id:U.id}),children:"Снять"})})]},U.id))})]})})]})]})}function X8(e){return e==="community"?"зрители":e==="blend"?"смесь":e==="pinned"?"закреп":e==="banned"?"запрет":"сиды"}function Q8({csrf:e}){const[t,n]=b.useState(""),[r,l]=b.useState(null),[o,u]=b.useState(!1),c=b.useCallback(async w=>{const j=await st("/admin/api/watch-rank?q="+encodeURIComponent(w));l(j)},[]);b.useEffect(()=>{c("")},[c]);async function h(w){u(!0),await an("/admin/watch-rank",e,{enabled:w}),await c(t),u(!1)}async function m(w,j){u(!0),await an("/admin/watch-rank",e,{infohash:w.infohash,pinned:j.pinned!==void 0?j.pinned:w.pinned,banned:j.banned!==void 0?j.banned:w.banned,note:w.note}),await c(t),u(!1)}const v=r&&r.rows?r.rows:[],g=r&&r.voices?r.voices:[],x=r&&r.codecs?r.codecs:[],S=!!(r&&r.enabled);return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Подбор раздач"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[f.jsx(Oe,{variant:S?"ok":"secondary",children:S?"ранжирование включено":"ранжирование выключено"}),f.jsx(he,{type:"button",disabled:o,onClick:()=>void h(!S),children:S?"Выключить":"Включить"})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Пока нет оценок просмотра, поиск не меняет порядок. Закрепление и запрет действуют сразу. В общие таблицы попадают только хеши и счетчики."}),f.jsxs("form",{className:"flex gap-2",onSubmit:w=>{w.preventDefault(),c(t)},children:[f.jsx($e,{value:t,onChange:w=>n(w.target.value),placeholder:"Название или infohash"}),f.jsx(he,{type:"submit",children:"Найти"})]})]})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Раздачи"})}),f.jsx(xe,{children:f.jsxs(Wn,{children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Раздача"}),f.jsx(Se,{children:"Класс"}),f.jsx(Se,{children:"Оценка"}),f.jsx(Se,{children:"Сигналы"}),f.jsx(Se,{})]})}),f.jsxs(er,{children:[v.map(w=>f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("div",{children:w.title||w.titleKey||w.infohash}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[w.infohash.slice(0,12)," · s",w.season,"e",w.episode," · ",X8(w.reason)]})]}),f.jsx(me,{children:w.deviceClass==="tv"?"ТВ":"Телефон"}),f.jsx(me,{children:Math.round(w.score)}),f.jsxs(me,{children:[w.samples," просм., ",w.completed," до конца, ",w.switched," уходов, кадр ",w.ttffMs&&w.samples?Math.round(w.ttffMs/w.samples):0," мс, ребуфер ",w.rebufferN,", кодек ",w.codecOk,"/",w.codecOk+w.codecFail]}),f.jsxs(me,{className:"space-x-2",children:[f.jsx(he,{type:"button",disabled:o,onClick:()=>void m(w,{pinned:!w.pinned,banned:!1}),children:w.pinned?"Открепить":"Закрепить"}),f.jsx(he,{type:"button",disabled:o,onClick:()=>void m(w,{banned:!w.banned,pinned:!1}),children:w.banned?"Разрешить":"Запретить"})]})]},w.infohash+":"+w.fileIndex+":"+w.deviceClass)),v.length?null:f.jsx(qe,{children:f.jsx(me,{colSpan:5,children:"Пока нет сигналов"})})]})]})})]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Озвучки и кодеки"})}),f.jsxs(xe,{className:"space-y-2 text-sm",children:[g.slice(0,12).map(w=>f.jsxs("div",{children:[w.titleKey,": ",w.voice," (",w.picks,")"]},w.titleKey+":"+w.voice)),x.map(w=>f.jsxs("div",{children:[w.deviceClass," ",w.codec,": ",w.reports]},w.deviceClass+":"+w.codec)),!g.length&&!x.length?f.jsx("div",{children:"Пока пусто"}):null]})]})]})}function jx(e){return e?Fo(e)+" МСК":""}function Z8(e){if(!e)return"Опрос бота: нет данных";if(!e.enabled)return"Опрос бота выключен (BILLING_BOT_POLL=0).";const t=e.lastOkAt?jx(e.lastOkAt):"ещё не было";let n="Конфликт 409 не фиксировался.";if(e.conflictRecent){const r=jx(e.conflictAt);n="Конфликт 409 был недавно"+(r?" ("+r+")":"")+"."}else e.conflictAt&&(n="Последний конфликт 409: "+jx(e.conflictAt)+".");return"Опрос бота: последний успешный getUpdates "+t+". "+n}/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const $8=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B8=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),FE=e=>{const t=B8(e);return t.charAt(0).toUpperCase()+t.slice(1)},YM=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
+ */const W8=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),J8=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),KA=e=>{const t=J8(e);return t.charAt(0).toUpperCase()+t.slice(1)},JM=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */var H8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
+ */var eH={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.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const F8=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:l="",children:o,iconNode:u,...c},h)=>b.createElement("svg",{ref:h,...H8,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:YM("lucide",l),...c},[...u.map(([m,v])=>b.createElement(m,v)),...Array.isArray(o)?o:[o]]));/**
+ */const tH=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:l="",children:o,iconNode:u,...c},h)=>b.createElement("svg",{ref:h,...eH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:JM("lucide",l),...c},[...u.map(([m,v])=>b.createElement(m,v)),...Array.isArray(o)?o:[o]]));/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const qu=(e,t)=>{const n=b.forwardRef(({className:r,...l},o)=>b.createElement(F8,{ref:o,iconNode:t,className:YM(`lucide-${$8(FE(e))}`,`lucide-${e}`,r),...l}));return n.displayName=FE(e),n};/**
+ */const qu=(e,t)=>{const n=b.forwardRef(({className:r,...l},o)=>b.createElement(tH,{ref:o,iconNode:t,className:JM(`lucide-${W8(KA(e))}`,`lucide-${e}`,r),...l}));return n.displayName=KA(e),n};/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const V8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],G8=qu("ban",V8);/**
+ */const nH=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],rH=qu("ban",nH);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const q8=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],K8=qu("credit-card",q8);/**
+ */const iH=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],aH=qu("credit-card",iH);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const Y8=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],X8=qu("repeat",Y8);/**
+ */const lH=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],oH=qu("repeat",lH);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const Q8=[["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"}]],XM=qu("shield",Q8);/**
+ */const sH=[["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"}]],eD=qu("shield",sH);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const Z8=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],W8=qu("smartphone",Z8);/**
+ */const uH=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],cH=qu("smartphone",uH);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const J8=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],eH=qu("ticket",J8),tH="h-10 w-full rounded-md border border-input bg-secondary px-3 text-sm text-foreground sm:w-auto",nH={pay:K8,promo:eH,activate:W8,fail:G8,admin:XM,device:X8};function rH({kind:e}){const t=nH[e]||XM,n=e==="fail"?"bad":e==="pay"?"ok":"count";return f.jsxs(Oe,{variant:n,className:"gap-1",children:[f.jsx(t,{className:"h-3.5 w-3.5","aria-hidden":!0}),_6(e)]})}function iH({events:e}){const[t,n]=b.useState(""),[r,l]=b.useState(1),o=15,u=e.filter(v=>!t||v.kind===t),c=Math.max(1,Math.ceil(u.length/o)),h=u.slice((r-1)*o,r*o),m=p6(h);return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Лента событий"}),f.jsxs(ht,{className:"space-y-2",children:[f.jsx("p",{children:"Время - МСК. Нажмите на часы, чтобы увидеть секунды."}),f.jsxs("select",{className:tH,value:t,"aria-label":"Тип события",onChange:v=>{l(1),n(v.target.value)},children:[f.jsx("option",{value:"",children:"Все события"}),f.jsx("option",{value:"pay",children:"Оплата"}),f.jsx("option",{value:"promo",children:"Промо"}),f.jsx("option",{value:"activate",children:"Активация"}),f.jsx("option",{value:"fail",children:"Отказ"}),f.jsx("option",{value:"admin",children:"Админ"}),f.jsx("option",{value:"device",children:"Смена устройства"})]})]})]}),f.jsxs(xe,{children:[h.length===0?f.jsx("p",{className:"text-muted-foreground",children:"Пока пусто"}):null,f.jsx("div",{className:"space-y-4",children:m.map(v=>f.jsxs("section",{children:[f.jsx("h3",{className:"sticky top-0 z-10 bg-card py-1 text-sm font-semibold",children:v.title}),f.jsx("ol",{className:"ml-2 border-l border-border",children:v.items.map((p,x)=>f.jsxs("li",{className:"relative pb-4 pl-4",children:[f.jsx("span",{className:"absolute -left-[7px] top-1.5 h-3 w-3 rounded-full border-2 border-primary bg-card","aria-hidden":!0}),f.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[f.jsx(dt,{ms:p.at,variant:"time"}),f.jsx(rH,{kind:p.kind}),f.jsx("span",{className:"text-sm font-medium",children:xS(p.actor,{deviceId:p.deviceId,fallback:"система"})})]}),f.jsx("p",{className:"mt-1 text-sm",children:p.text}),p.accountId?f.jsx("a",{className:"text-sm text-primary",href:"/admin/?id="+encodeURIComponent(p.accountId),children:"карточка"}):null]},v.key+"-"+x))})]},v.key))}),f.jsx(kv,{page:r,pages:c,total:u.length,onPage:l})]})]})}const Nf="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground";function aH({run:e}){const[t,n]=b.useState(""),[r,l]=b.useState(""),[o,u]=b.useState("telegram"),[c,h]=b.useState("30"),[m,v]=b.useState("1");return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Выдать код"}),f.jsx(ht,{children:"Дней - срок новой подписки. Если подписка уже есть, код добавляется к ней, дата окончания не меняется."})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"grid gap-2 md:grid-cols-5",children:[f.jsx($e,{placeholder:"Telegram id",value:t,onChange:p=>n(p.target.value)}),f.jsx($e,{placeholder:"Почта",value:r,onChange:p=>l(p.target.value)}),f.jsxs("select",{className:Nf,value:o,onChange:p=>u(p.target.value),"aria-label":"Куда отправить",children:[f.jsx("option",{value:"telegram",children:"Telegram"}),f.jsx("option",{value:"email",children:"Почта"}),f.jsx("option",{value:"none",children:"Только показать"})]}),f.jsxs("select",{className:Nf,value:c,onChange:p=>h(p.target.value),"aria-label":"Дней",children:[f.jsx("option",{value:"1",children:"1 день"}),f.jsx("option",{value:"7",children:"7 дней"}),f.jsx("option",{value:"30",children:"30 дней"}),f.jsx("option",{value:"90",children:"90 дней"}),f.jsx("option",{value:"365",children:"365 дней"})]}),f.jsx(he,{onClick:()=>void e("/admin/issue",{telegramId:t,email:r,channel:o,days:c}),children:"Выдать"})]}),f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Сколько кодов"}),f.jsx($e,{type:"number",min:1,max:100,value:m,onChange:p=>v(p.target.value)})]}),f.jsx(he,{variant:"secondary",onClick:()=>{const p=Number(m)||1;window.confirm("Создать "+p+" новых кодов на "+c+" дн.?")&&e("/admin/issue-bulk",{count:p,days:c}).then(x=>{var w;const S=((w=x==null?void 0:x.extra)==null?void 0:w.codes)||[];S.length&&(IM("omp-codes.csv",[["код","аккаунт","до"]].concat(S.map(j=>[j.code,j.accountId||"",j.paidUntil?new Date(j.paidUntil).toISOString().slice(0,10):""]))),ft("CSV со кодами скачан"))})},children:"Создать пакетом"})]})]})]})}function lH({run:e,promos:t}){const[n,r]=b.useState(""),[l,o]=b.useState("1"),[u,c]=b.useState("1"),[h,m]=b.useState("1"),[v,p]=b.useState("0"),[x,S]=b.useState(""),[w,j]=b.useState(""),[C,A]=b.useState("0");return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Промокоды"})}),f.jsxs(xe,{className:"space-y-4",children:[f.jsxs("div",{className:"grid gap-2 md:grid-cols-7",children:[f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Код"}),f.jsx($e,{placeholder:"пусто = сгенерировать",value:n,onChange:N=>r(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Дней"}),f.jsx($e,{type:"number",value:l,onChange:N=>o(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Бонусных устройств"}),f.jsx($e,{type:"number",min:0,max:20,value:v,onChange:N=>p(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Бонус на дней"}),f.jsx($e,{type:"number",min:0,placeholder:"пусто = навсегда",value:x,onChange:N=>S(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Активаций"}),f.jsx($e,{type:"number",value:u,onChange:N=>c(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Истекает, дней"}),f.jsx($e,{type:"number",min:0,placeholder:"пусто = без срока",value:w,onChange:N=>j(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Скидка, %"}),f.jsx($e,{type:"number",min:0,max:100,value:C,onChange:N=>A(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Количество"}),f.jsx($e,{type:"number",min:1,max:100,value:h,onChange:N=>m(N.target.value)})]}),f.jsx("div",{className:"flex items-end",children:f.jsx(he,{onClick:()=>{const N=Number(h)||1;e("/admin/promo",{code:n,days:l,maxUses:u,count:N,bonusSlots:v,bonusDays:x,expiresDays:w,discountPercent:C}).then(O=>{var R;const T=((R=O==null?void 0:O.extra)==null?void 0:R.promos)||[];T.length>1&&IM("omp-promos-new.csv",[["код","дней","активаций","бонусных устройств","бонус на дней"]].concat(T.map(E=>[E.code,String(E.days),String(E.maxUses),String(E.bonusSlots||0),E.bonusSlots?String(E.bonusDays||0):""])))})},children:"Создать"})})]}),f.jsx("div",{className:"flex flex-wrap gap-3 text-sm",children:f.jsx("a",{className:"text-primary",href:"/admin/promos.csv",children:"Скачать все промокоды (CSV)"})}),f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Код"}),f.jsx(Se,{children:"Дни"}),f.jsx(Se,{children:"Бонус"}),f.jsx(Se,{children:"Создан"}),f.jsx(Se,{children:"Использования"}),f.jsx(Se,{})]})}),f.jsxs(er,{children:[t.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:6,className:"text-muted-foreground",children:"Нет промокодов"})}):null,t.map(N=>{const O=N.uses>=N.maxUses;return f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("span",{className:N.revoked?"text-muted-foreground":"font-mono",children:N.code})," ",f.jsx(ko,{value:N.code})]}),f.jsx(me,{children:N.days}),f.jsx(me,{children:N.bonusSlots?"+"+N.bonusSlots+" устр. "+(N.bonusDays?"на "+N.bonusDays+" дн.":"навсегда"):f.jsx("span",{className:"text-muted-foreground",children:"-"})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:N.createdAt})}),f.jsxs(me,{children:[N.uses,"/",N.maxUses]}),f.jsx(me,{children:N.revoked?f.jsx("span",{className:"text-muted-foreground",children:"отозван"}):O?f.jsx("span",{className:"text-muted-foreground",children:"использован"}):f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>{window.confirm("Отозвать промокод "+N.code+"?")&&e("/admin/promo-revoke",{promoId:N.id})},children:"Отозвать"})})]},N.id)})]})]})]})]})}function oH({subs:e,filter:t,setFilter:n,csrf:r}){const l=e.filter(u=>s6(u,t)),o=c6(e);return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Подписки"}),f.jsx(ht,{children:f.jsx("span",{className:"flex flex-wrap gap-1",children:[["all","Все"],["active","Активные"],["week","Истекают за 7 дней"],["unbound","Без устройства"],["grace","Льготный период"],["expired","Истекшие"]].map(([u,c])=>f.jsx(he,{size:"sm",variant:t===u?"default":"secondary",onClick:()=>n(u),children:c},u))})})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-3 text-sm",children:[f.jsx("a",{className:"text-primary",href:"/admin/subscriptions.csv",children:"Скачать подписки (CSV)"}),f.jsx("a",{className:"text-primary",href:"/admin/users.csv",children:"Скачать пользователей (CSV)"}),f.jsxs(he,{size:"sm",variant:"secondary",disabled:o.length===0,onClick:()=>{o.length&&window.confirm("Отправить напоминание "+o.length+" пользователям в Telegram?")&&(async()=>{let u=0;for(let c=0;cf.jsxs(qe,{children:[f.jsxs(me,{children:[u.who,f.jsx(ko,{value:u.telegramId})]}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:u.createdAt})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:u.paidUntil})}),f.jsx(me,{children:f.jsx(MM,{status:u.status})}),f.jsxs(me,{children:[f.jsx(l6,{bound:u.bound,limit:u.deviceLimit,over:u.overLimit}),(u.creditRub||0)>0?f.jsxs("span",{className:"text-xs text-muted-foreground",children:["зачёт ",u.creditRub," ₽"]}):null,u.limitOverride?f.jsx("span",{className:"ml-1 text-xs text-amber-300",title:u.limitText,children:"индивид."}):null]}),f.jsx(me,{children:f.jsx("a",{className:"text-primary",href:"/admin/?id="+encodeURIComponent(u.accountId),children:"карточка"})})]},u.id))]})]})]})]})}function sH({rows:e}){return e.length?f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Проблемы"})}),f.jsx(xe,{children:f.jsx("ul",{className:"space-y-3 text-sm",children:e.map((t,n)=>{const r=[t.amount?t.amount+" ₽":"",t.label||"",t.operationId||""].filter(Boolean);return f.jsxs("li",{className:"rounded-md border border-red-900/50 bg-red-950/30 px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Oe,{variant:"bad",children:PM(t.kind)}),f.jsx(dt,{ms:t.at})]}),f.jsx("div",{className:"mt-1 break-all text-zinc-100",children:r.length?r.join(" · "):t.text||"Нет подробностей"})]},n)})})})]}):null}function jx(e){if(!e)return"";const t=Math.round(e*1e8)/1e8;return String(t)}function uH({row:e}){const t=e&&e.yoomoney,n=e&&e.stars,r=e&&e.crypto,l=(o,u)=>f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:o}),f.jsx("div",{className:"text-xs text-muted-foreground",children:u.filter(Boolean).join(" · ")})]});return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Выручка за 30 дней по способам"}),f.jsx(ht,{children:"Рубли звёзд и крипты - цена заказа на момент оплаты. Возврат звёзд в сумму не входит."})]}),f.jsxs(xe,{className:"grid gap-3 sm:grid-cols-3",children:[l("ЮMoney",[Math.round((t==null?void 0:t.rub)||0)+" ₽",((t==null?void 0:t.count)||0)+" оплат"]),l("Звёзды",[Math.round((n==null?void 0:n.stars)||0)+" звёзд",Math.round((n==null?void 0:n.rub)||0)+" ₽",((n==null?void 0:n.count)||0)+" оплат"]),l("Крипта",[r!=null&&r.usdt?jx(r.usdt)+" USDT":"",r!=null&&r.ton?jx(r.ton)+" TON":"",r!=null&&r.btc?jx(r.btc)+" BTC":"",Math.round((r==null?void 0:r.rub)||0)+" ₽",((r==null?void 0:r.count)||0)+" оплат"])]})]})}function cH({home:e}){var C,A,N,O,T,R,E,D,k,I;const[t,n]=b.useState(null),[r,l]=b.useState(0),[o,u]=b.useState(1),[c,h]=b.useState(""),[m,v]=b.useState("30"),[p,x]=b.useState(30),S=20;b.useEffect(()=>{let P=!1;const B=Date.now(),F=m==="all"?0:B-Number(m)*24*60*60*1e3,se=new URLSearchParams({q:c,offset:String((o-1)*S),limit:String(S)});return F&&se.set("from",String(F)),ot("/admin/api/payments?"+se.toString()).then(ue=>{P||ue.auth===!1||(n(ue.payments||[]),l(ue.total||0))}),()=>{P=!0}},[o,c,m]);const w=(e.series||[]).slice(p===30?-30:-90),j=Math.max(1,Math.ceil(r/S));return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[[(A=(C=e.finance)==null?void 0:C.summary)==null?void 0:A.day,"сегодня"],[(O=(N=e.finance)==null?void 0:N.summary)==null?void 0:O.week,"неделя"],[(R=(T=e.finance)==null?void 0:T.summary)==null?void 0:R.month,"месяц"]].map(([P,B])=>f.jsx(ye,{children:f.jsxs(xe,{className:"pt-4",children:[f.jsx("div",{className:"text-2xl font-bold",children:Math.round((P==null?void 0:P.sum)||0)}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["₽ ",B," · ",(P==null?void 0:P.count)||0]})]})},B))}),f.jsxs(ye,{children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[f.jsx(Te,{children:"Графики"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(he,{size:"sm",variant:p===30?"default":"secondary",onClick:()=>x(30),children:"30 дней"}),f.jsx(he,{size:"sm",variant:p===90?"default":"secondary",onClick:()=>x(90),children:"90 дней"})]})]}),f.jsxs(xe,{className:"grid gap-6 lg:grid-cols-2",children:[f.jsx(TE,{rows:w,field:"revenue",label:"Выручка по дням, ₽"}),f.jsx(TE,{rows:w,field:"subs",label:"Новые подписки по дням"})]})]}),f.jsx(uH,{row:(k=(D=(E=e.finance)==null?void 0:E.summary)==null?void 0:D.month)==null?void 0:k.byMethod}),f.jsx("p",{children:f.jsx("a",{className:"text-primary",href:"/admin/finance.csv",children:"Скачать CSV за 30 дней"})}),f.jsx(sH,{rows:((I=e.finance)==null?void 0:I.problems)||[]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Платежи"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx($e,{className:"max-w-xs",placeholder:"Поиск: кто, метка, сумма",value:c,onChange:P=>{u(1),h(P.target.value)}}),f.jsxs("select",{className:Nf,value:m,"aria-label":"Период",onChange:P=>{u(1),v(P.target.value)},children:[f.jsx("option",{value:"7",children:"7 дней"}),f.jsx("option",{value:"30",children:"30 дней"}),f.jsx("option",{value:"90",children:"90 дней"}),f.jsx("option",{value:"all",children:"Все"})]})]}),t===null?f.jsxs("div",{className:"space-y-2",children:[f.jsx(an,{className:"h-8"}),f.jsx(an,{className:"h-8"})]}):f.jsxs(Wn,{className:"min-w-[40rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Когда, МСК"}),f.jsx(Se,{children:"Сумма"}),f.jsx(Se,{children:"Способ"}),f.jsx(Se,{children:"Кто"}),f.jsx(Se,{children:"Метка"})]})}),f.jsxs(er,{children:[t.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"Нет платежей"})}):null,t.map((P,B)=>f.jsxs(qe,{children:[f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:P.at})}),f.jsx(me,{children:P.amount||"-"}),f.jsx(me,{children:kM(P)}),f.jsx(me,{children:P.accountId?f.jsx("a",{className:"text-primary",href:"/admin/?id="+encodeURIComponent(P.accountId),children:P.who||P.accountId.slice(0,8)}):P.who||"-"}),f.jsx(me,{className:"break-all font-mono text-xs text-muted-foreground",children:P.label||"-"})]},(P.operationId||"")+B))]})]}),f.jsx(kv,{page:o,pages:j,total:r,onPage:u})]})]})]})}const VE=[{title:"Бот",fields:[["botToken","Токен бота"],["botUsername","Имя бота"],["publicOrigin","Публичный адрес"],["adminTelegramIds","Telegram id администраторов"],["adminReaders","Telegram id только для просмотра"],["betaPercent","Процент беты (0-100)"]]},{title:"Платежи",fields:[["yoomoneyWallet","Кошелёк ЮMoney"],["yoomoneySecret","Секрет ЮMoney"],["cryptoPayToken","Токен Crypto Pay"],["cryptoPayTestnetToken","Токен Crypto Pay (testnet)"]]},{title:"Звёзды",fields:[["starsPrice","Подписка, звёзд"],["starsExtra","Доп. устройство, звёзд"]]},{title:"Крипта",fields:[["cryptoUsdt","Подписка, USDT"],["cryptoExtraUsdt","Доп. устройство, USDT"],["cryptoRateUsdt","Курс USDT, ₽ за 1"],["cryptoTon","Подписка, TON"],["cryptoExtraTon","Доп. устройство, TON"],["cryptoRateTon","Курс TON, ₽ за 1"],["cryptoBtc","Подписка, BTC"],["cryptoExtraBtc","Доп. устройство, BTC"],["cryptoRateBtc","Курс BTC, ₽ за 1"]]},{title:"SMTP",fields:[["smtpHost","SMTP-сервер"],["smtpUser","SMTP-логин"],["smtpPass","SMTP-пароль"],["smtpFrom","SMTP-отправитель"]]},{title:"Цены",fields:[["priceRub","Цена, ₽"],["periodDays","Период, дней"],["baseDevices","Базовых устройств в подписке (1-20; кроме индивидуальных лимитов)"],["extraDeviceRub","Доп. устройство, ₽ в месяц"],["graceDays","Льготный период, дней"],["publicPromo","Промокод на пробный день (бот покажет, пока он действует)"]]},{title:"Бэкапы Postgres",fields:[["backupEveryHours","Делать дамп каждые, часов (1-168)"],["backupKeepDays","Хранить дампы, дней (1-365; последний не удаляется)"]]},{title:"DHT",fields:[["dhtPerMinute","Запросов в минуту на устройство (0-1000, 0 выключает, по умолчанию 30)"]]}],GE=new Set(["botToken","yoomoneySecret","cryptoPayToken","cryptoPayTestnetToken","smtpPass","jackettApiKey","jacredApiKey","indexerPass"]);function yf({name:e,label:t,view:n,fallback:r}){const l=n?n.text:r||"не задан";return f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:e,children:t}),f.jsx($e,{id:e,value:l,readOnly:!0,disabled:!0}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["Меняется на сервере: ",n?n.env:"переменная"," в .env, затем перезапуск billing.",n&&n.source==="db"?f.jsx("span",{className:"text-destructive",children:" Сейчас ещё в базе - перенесите в .env."}):null]})]})}function fH({backup:e}){if(!e||!e.enabled)return f.jsx(ht,{children:"Бэкапы Postgres на этом сервере не настроены (нет BILLING_PG_BACKUP_DIR)."});const t=e.last;return f.jsxs(ht,{children:[t?"Последний дамп: "+zi(t.at)+" · "+RE(t.size):"Дампов ещё нет"," · всего "+e.count+" ("+RE(e.totalBytes)+")",e.stale?f.jsx("span",{className:"text-destructive",children:" · бэкап устарел"}):null,e.lastError?f.jsxs("span",{className:"text-destructive",children:[" · ошибка: ",e.lastError]}):null,e.verify?f.jsx("span",{className:e.verify.ok?"":"text-destructive",children:" · проверка архива: "+(e.verify.ok?"список читается":e.verify.error||"ошибка")}):null]})}function dH({run:e,settings:t,storage:n,backup:r,secrets:l}){const[o,u]=b.useState({}),[c,h]=b.useState(!0),[m,v]=b.useState(!1),[p,x]=b.useState(!1),[S,w]=b.useState(!1),[j,C]=b.useState(!1),A=b.useRef(!1),[N,O]=b.useState(null),T=R=>e("/admin/settings",{...o,adminNotify:c?"true":"false",starsEnabled:m?"true":"false",cryptoEnabled:p?"true":"false",cryptoTestnet:S?"true":"false",cryptoNonRu:j?"true":"false",...R?{confirm:"yes"}:{}}).then(E=>{var D;return(D=E==null?void 0:E.flash)!=null&&D.error||(A.current=!1),E});return b.useEffect(()=>{if(A.current)return;const R={};for(const E of VE)for(const[D]of E.fields)GE.has(D)||(R[D]=String(t[D]??""));u(R),h(t.adminNotify!==!1),v(t.starsEnabled===!0),x(t.cryptoEnabled===!0),w(t.cryptoTestnet===!0),C(t.cryptoNonRu===!0)},[t]),f.jsxs("form",{className:"space-y-4",onSubmit:R=>{R.preventDefault();const E=Number(o.baseDevices),D=Number(t.baseDevices);if(Number.isInteger(E)&&E>=1&&Number.isFinite(D)&&EO(k&&k.lowering?k:null),()=>ft("Не удалось посчитать, кого затронет снижение"));return}O(null),T(!1)},children:[f.jsxs("p",{className:"text-sm text-muted-foreground",children:["Хранилище: ",(n==null?void 0:n.engine)||"-",n!=null&&n.path?" · "+n.path:""]}),VE.map(R=>f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:R.title}),R.title==="Платежи"?f.jsx(ht,{children:"Кошелёк показывается частично. Чтобы сменить, введите новый номер целиком."}):null,R.title==="Бэкапы Postgres"?f.jsx(fH,{backup:r}):null,R.title==="DHT"?f.jsx(ht,{children:"Лимит кнопки «Проверить сиды»: сколько запросов /v1/dht-peers устройство может сделать за минуту. После сохранения действует это число. Пока поле ни разу не сохраняли, запасной предел берется из BILLING_DHT_DEVICE_MAX."}):null]}),f.jsxs(xe,{className:"grid gap-3 md:grid-cols-2",children:[R.fields.map(([E,D])=>GE.has(E)?f.jsx(yf,{name:E,label:D,view:(l||[]).find(k=>k.key===E),fallback:String(t[E]??"")},E):f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:E,children:D}),f.jsx($e,{id:E,value:o[E]||"",onChange:k=>{A.current=!0,u({...o,[E]:k.target.value})}})]},E)),R.title==="Бот"?f.jsxs("label",{className:"flex items-center gap-2 text-sm md:col-span-2",children:[f.jsx("input",{type:"checkbox",checked:c,onChange:E=>{A.current=!0,h(E.target.checked)}}),"Уведомлять администраторов в Telegram (оплата, ошибка оплаты, падение сервиса, новое сообщение поддержки)"]}):null,R.title==="Звёзды"?f.jsxs("label",{className:"flex items-center gap-2 text-sm md:col-span-2",children:[f.jsx("input",{type:"checkbox",checked:m,onChange:E=>{A.current=!0,v(E.target.checked)}}),"Принимать Telegram Stars. По умолчанию выключено. Комиссия сверху не добавляется."]}):null,R.title==="Крипта"?f.jsxs("div",{className:"space-y-2 md:col-span-2",children:[f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:p,onChange:E=>{A.current=!0,x(E.target.checked)}}),"Принимать Crypto Pay (USDT, TON, BTC). По умолчанию выключено."]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:S,onChange:E=>{A.current=!0,w(E.target.checked)}}),"Тестовая сеть Crypto Pay (testnet-pay.crypt.bot). Токен этого режима:"," ",String(S?t.cryptoPayTestnetToken||"не задан":t.cryptoPayToken||"не задан"),"."]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:j,onChange:E=>{A.current=!0,C(E.target.checked)}}),"Только пользователям не из РФ. Без кода страны или с кодом RU ссылка не выдаётся."]})]}):null]})]},R.title)),N?f.jsxs(Bt,{variant:"warn",children:[f.jsxs("p",{children:["Базовых устройств станет ",N.to," (сейчас ",N.from,"). Затронет подписок без индивидуального лимита: ",N.subscriptions,", перестанут работать устройств: ",N.devices," - последние привязанные сверх нового лимита. Ничего не отвязывается, при возврате базы они заработают снова."]}),f.jsxs("div",{className:"mt-2 flex gap-2",children:[f.jsxs(he,{type:"button",size:"sm",variant:"destructive",onClick:()=>{O(null),T(!0)},children:["Да, снизить до ",N.to]}),f.jsx(he,{type:"button",size:"sm",variant:"ghost",onClick:()=>O(null),children:"Отмена"})]})]}):null,f.jsx(he,{type:"submit",children:"Сохранить"})]})}function hH({row:e,checking:t}){return t&&!e?f.jsx(Oe,{variant:"secondary",children:"проверка…"}):e?e.configured?e.ok?f.jsxs(Oe,{variant:"ok",children:["работает · ",e.latencyMs," мс"]}):f.jsx(Oe,{variant:"bad",children:O6(e.error)}):f.jsx(Oe,{variant:"secondary",children:"не настроено"}):f.jsx(Oe,{variant:"secondary",children:"нет данных"})}function qE({csrf:e,settings:t,secrets:n,onSaved:r}){const l=O=>(n||[]).find(T=>T.key===O),[o,u]=b.useState({jackettUrl:String(t.jackettUrl??""),jackettEnabled:t.jackettEnabled!==!1,jacredUrl:String(t.jacredUrl??""),jacredEnabled:t.jacredEnabled!==!1,bitmagnetUrl:String(t.bitmagnetUrl??""),bitmagnetEnabled:t.bitmagnetEnabled===!0,torrserverUrl:String(t.torrserverUrl??""),indexerUser:String(t.indexerUser??"")}),[c,h]=b.useState(null),[m,v]=b.useState(null),[p,x]=b.useState(!1),[S,w]=b.useState(0),[j,C]=b.useState("");b.useEffect(()=>{u({jackettUrl:String(t.jackettUrl??""),jackettEnabled:t.jackettEnabled!==!1,jacredUrl:String(t.jacredUrl??""),jacredEnabled:t.jacredEnabled!==!1,bitmagnetUrl:String(t.bitmagnetUrl??""),bitmagnetEnabled:t.bitmagnetEnabled===!0,torrserverUrl:String(t.torrserverUrl??""),indexerUser:String(t.indexerUser??"")})},[t]);async function A(O){x(!0),C("");try{const T=await ot("/admin/api/services");if(T.auth===!1){C("Нужен вход");return}h(T.services||null),v(T.botPoll||null);const R=Date.now();w(R),O||ft("Сервисы проверены · "+zi(R))}catch(T){C(T instanceof Error?T.message:"Не удалось проверить сервисы")}finally{x(!1)}}b.useEffect(()=>{A(!1)},[]);async function N(O){O.preventDefault(),x(!0),C("");try{if((await Qt("/admin/services",e,{...o,jackettEnabled:o.jackettEnabled?"true":"false",jacredEnabled:o.jacredEnabled?"true":"false",bitmagnetEnabled:o.bitmagnetEnabled?"true":"false"})).auth===!1){C("Нужен вход");return}ft("Сервисы сохранены"),r(),await A(!0)}catch(T){C(T instanceof Error?T.message:"Не удалось сохранить")}finally{x(!1)}}return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx(Te,{children:"Сервисы VPS"}),f.jsxs(ht,{children:["Ключи только на сервере. Телефон ходит через billing при активной подписке. TorrServer на VPS - для мониторинга, не для пользователей.",S?" Проверено "+zi(S)+".":""]})]}),f.jsx(he,{type:"button",variant:"secondary",disabled:p,onClick:()=>void A(!1),children:p?"Проверка…":"Проверить сейчас"})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsx(mH,{poll:m}),f.jsx("div",{className:"grid gap-3 lg:grid-cols-3",children:p&&!c?f.jsxs(f.Fragment,{children:[f.jsx(an,{className:"h-24"}),f.jsx(an,{className:"h-24"}),f.jsx(an,{className:"h-24"})]}):f.jsxs(f.Fragment,{children:[f.jsx(tm,{title:"Jackett",row:c==null?void 0:c.jackett,fallback:o.jackettUrl,note:"подписчикам: "+(o.jackettEnabled?"вкл":"выкл"),checking:p}),f.jsx(tm,{title:"JacRed",row:c==null?void 0:c.jacred,fallback:o.jacredUrl,note:"подписчикам: "+(o.jacredEnabled?"вкл":"выкл"),checking:p}),f.jsx(tm,{title:"bitmagnet",row:c==null?void 0:c.bitmagnet,fallback:o.bitmagnetUrl,note:"подписчикам: "+(o.bitmagnetEnabled?"вкл":"выкл"),checking:p}),f.jsx(tm,{title:"TorrServer",row:c==null?void 0:c.torrserver,fallback:o.torrserverUrl,note:"только мониторинг",checking:p})]})})]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Настройки сервисов"}),f.jsx(ht,{children:"Ключи и пароль - только для чтения: они в .env на сервере."})]}),f.jsx(xe,{children:f.jsxs("form",{className:"space-y-4",onSubmit:O=>void N(O),children:[f.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[f.jsx(rf,{id:"jackettUrl",label:"Адрес Jackett",value:o.jackettUrl,onChange:O=>u({...o,jackettUrl:O}),placeholder:"http://jackett:9117"}),f.jsx(yf,{name:"jackettApiKey",label:"Ключ API Jackett",view:l("jackettApiKey"),fallback:String(t.jackettApiKey??"")}),f.jsx(Cx,{label:"Jackett доступен подписчикам",checked:o.jackettEnabled,onChange:O=>u({...o,jackettEnabled:O})}),f.jsx(rf,{id:"jacredUrl",label:"Адрес JacRed",value:o.jacredUrl,onChange:O=>u({...o,jacredUrl:O}),placeholder:"http://jacred:9117"}),f.jsx(yf,{name:"jacredApiKey",label:"Ключ API JacRed",view:l("jacredApiKey"),fallback:String(t.jacredApiKey??"")}),f.jsx(Cx,{label:"JacRed доступен подписчикам",checked:o.jacredEnabled,onChange:O=>u({...o,jacredEnabled:O})}),f.jsx(rf,{id:"bitmagnetUrl",label:"Адрес bitmagnet",value:o.bitmagnetUrl,onChange:O=>u({...o,bitmagnetUrl:O}),placeholder:"http://127.0.0.1:3333"}),f.jsx(yf,{name:"bitmagnetApiKey",label:"Ключ API bitmagnet",view:l("bitmagnetApiKey"),fallback:String(t.bitmagnetApiKey??"")}),f.jsx(Cx,{label:"bitmagnet доступен подписчикам",checked:o.bitmagnetEnabled,onChange:O=>u({...o,bitmagnetEnabled:O})}),f.jsx(rf,{id:"torrserverUrl",label:"Адрес TorrServer (только мониторинг)",value:o.torrserverUrl,onChange:O=>u({...o,torrserverUrl:O}),placeholder:"http://torrserver:8090",wide:!0}),f.jsx(rf,{id:"indexerUser",label:"Логин basic-авторизации",value:o.indexerUser,onChange:O=>u({...o,indexerUser:O}),placeholder:"omp"}),f.jsx(yf,{name:"indexerPass",label:"Пароль basic-авторизации",view:l("indexerPass"),fallback:String(t.indexerPass??"")})]}),j?f.jsx(Bt,{variant:"destructive",children:j}):null,f.jsx(he,{type:"submit",disabled:p,children:"Сохранить"})]})})]})]})}function mH({poll:e}){const t=!!(e&&e.enabled&&e.conflictRecent);return f.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-sm",children:[f.jsx("span",{children:U8(e)}),e&&e.enabled?t?f.jsx(Oe,{variant:"bad",children:"конфликт 409"}):f.jsx(Oe,{variant:"ok",children:"без конфликта"}):null]})}function tm({title:e,row:t,fallback:n,note:r,checking:l}){return f.jsxs("div",{className:"rounded-md border border-border p-3",children:[f.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[f.jsx("span",{className:"font-medium",children:e}),f.jsx(hH,{row:t,checking:l})]}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:(t==null?void 0:t.url)||n||"-"}),f.jsx("div",{className:"text-xs text-muted-foreground",children:r})]})}function rf({id:e,label:t,value:n,onChange:r,placeholder:l,wide:o}){return f.jsxs("div",{className:"space-y-1 "+(o?"md:col-span-2":""),children:[f.jsx(yt,{htmlFor:e,children:t}),f.jsx($e,{id:e,value:n,placeholder:l,onChange:u=>r(u.target.value)})]})}function Cx({label:e,checked:t,onChange:n}){return f.jsxs("label",{className:"flex items-center gap-2 text-sm md:col-span-2",children:[f.jsx("input",{type:"checkbox",checked:t,onChange:r=>n(r.target.checked)}),e]})}function vH(){const[e,t]=b.useState(""),[n,r]=b.useState(""),[l,o]=b.useState(1),[u,c]=b.useState(null),[h,m]=b.useState(0),v=30;b.useEffect(()=>{let x=!1;const S=new URLSearchParams({q:e,action:n,offset:String((l-1)*v),limit:String(v)});return ot("/admin/api/audit?"+S).then(w=>{x||w.auth===!1||(c(w.audit||[]),m(w.total||0))}),()=>{x=!0}},[e,n,l]);const p=Math.max(1,Math.ceil(h/v));return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Журнал"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx($e,{className:"max-w-xs",placeholder:"Поиск",value:e,onChange:x=>{o(1),t(x.target.value)}}),f.jsx("select",{className:Nf,value:n,"aria-label":"Действие",onChange:x=>{o(1),r(x.target.value)},children:N6.map(([x,S])=>f.jsx("option",{value:x,children:S},x||"all"))})]}),u===null?f.jsx(an,{className:"h-24"}):u.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Записей нет"}):f.jsx("ul",{className:"space-y-1 text-sm",children:u.map((x,S)=>f.jsxs("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[f.jsx(dt,{ms:x.at}),f.jsx("span",{children:xS(x.actor,{fallback:"админ"})}),f.jsx("span",{children:E6(x.action)}),f.jsx("span",{className:"text-muted-foreground",children:x.detail})]},S))}),f.jsx(kv,{page:l,pages:p,total:h,onPage:o})]})]})}function gH(){const[e,t]=b.useState(""),[n,r]=b.useState(""),[l,o]=b.useState(1),[u,c]=b.useState(null),[h,m]=b.useState(0),v=30;b.useEffect(()=>{let x=!1;const S=new URLSearchParams({reason:e,q:n,offset:String((l-1)*v),limit:String(v)});return ot("/admin/api/fails?"+S).then(w=>{x||w.auth===!1||(c(w.fails||[]),m(w.total||0))}),()=>{x=!0}},[e,n,l]);const p=Math.max(1,Math.ceil(h/v));return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Неудачные активации"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx($e,{className:"max-w-xs",placeholder:"Устройство",value:n,onChange:x=>{o(1),r(x.target.value)}}),f.jsx("select",{className:Nf,value:e,"aria-label":"Причина",onChange:x=>{o(1),t(x.target.value)},children:T6.map(([x,S])=>f.jsx("option",{value:x,children:S},x||"all"))})]}),u===null?f.jsx(an,{className:"h-24"}):f.jsxs(Wn,{className:"min-w-[32rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Когда, МСК"}),f.jsx(Se,{children:"Причина"}),f.jsx(Se,{children:"Устройство"})]})}),f.jsxs(er,{children:[u.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:3,className:"text-muted-foreground",children:"Отказов нет"})}):null,u.map((x,S)=>f.jsxs(qe,{children:[f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:x.at})}),f.jsx(me,{children:A6(x.reason)}),f.jsx(me,{className:"font-mono text-xs",children:x.deviceId?x.deviceId.slice(0,8):"-"})]},S))]})]}),f.jsx(kv,{page:l,pages:p,total:h,onPage:o})]})]})}function pH({run:e,sessions:t,sessionId:n}){return f.jsx("div",{className:"space-y-4",children:f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Сессии"}),f.jsx(ht,{children:"Вход только через Telegram. Время - МСК."})]}),f.jsx(xe,{children:f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Сессия"}),f.jsx(Se,{children:"Кто"}),f.jsx(Se,{children:"Создана"}),f.jsx(Se,{children:"Активность"}),f.jsx(Se,{})]})}),f.jsx(er,{children:t.map(r=>f.jsxs(qe,{children:[f.jsxs(me,{children:[r.id.slice(0,8),"…",r.id===n?" (эта)":""]}),f.jsx(me,{children:xS(r.actor,{fallback:"админ"})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:r.createdAt})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:r.lastSeen})}),f.jsx(me,{children:r.id!==n?f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>void e("/admin/session-revoke",{sessionId:r.id}),children:"Завершить"}):null})]},r.id))})]})})]})})}const QM=b.createContext({paused:!1,setPaused:()=>{},mode:"poll",at:0});function Iv(){return b.useContext(QM)}function yH({children:e}){const t=Wb(),[n,r]=b.useState(!1),[l,o]=b.useState("poll"),[u,c]=b.useState(0),h=b.useRef(l);return h.current=l,b.useEffect(()=>{if(n){o("pause");return}let m=!1,v=null,p=0,x=1e3;const S=()=>{c(Date.now()),t.invalidateQueries(),window.dispatchEvent(new Event("omp-admin-live"))},w=()=>{m||(v=new EventSource("/admin/api/events"),v.onopen=()=>{x=1e3,o("live"),c(Date.now())},v.onmessage=()=>{o("live"),S()},v.onerror=()=>{v&&v.close(),o("poll"),!m&&(p=window.setTimeout(w,x),x=Math.min(15e3,x*2))})};return w(),()=>{m=!0,v&&v.close(),window.clearTimeout(p)}},[n,t]),b.useEffect(()=>{if(n)return;const m=window.setInterval(()=>{h.current!=="live"&&window.dispatchEvent(new Event("omp-admin-live"))},12e3);return()=>window.clearInterval(m)},[n]),f.jsx(QM.Provider,{value:{paused:n,setPaused:r,mode:l,at:u},children:e})}function KE(){const{paused:e,setPaused:t,mode:n,at:r}=Iv(),l=n==="pause"?"пауза":n==="live"?"в эфире":"опрос",o=r?new Date(r).toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-";return f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("span",{className:n==="live"?"text-primary":"",children:l}),f.jsx("span",{className:"font-mono",children:o}),f.jsx("button",{type:"button",className:"rounded-md border border-border px-2 py-1 text-foreground",onClick:()=>t(!e),children:e?"Продолжить":"Пауза"})]})}var xH=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function AS(e){if(typeof e!="string")return!1;var t=xH;return t.includes(e)}var bH=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],SH=new Set(bH);function ZM(e){return typeof e!="string"?!1:SH.has(e)}function WM(e){return typeof e=="string"&&e.startsWith("data-")}function Bi(e){if(typeof e!="object"||e===null)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(ZM(n)||WM(n))&&(t[n]=e[n]);return t}function zv(e){if(e==null)return null;if(b.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Bi(t)}return typeof e=="object"&&!Array.isArray(e)?Bi(e):null}function Xr(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(ZM(n)||WM(n)||AS(n))&&(t[n]=e[n]);return t}function wH(e){return e==null?null:b.isValidElement(e)?Xr(e.props):typeof e=="object"&&!Array.isArray(e)?Xr(e):null}var jH=["children","width","height","viewBox","className","style","title","desc"];function Y0(){return Y0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,l=e.height,o=e.viewBox,u=e.className,c=e.style,h=e.title,m=e.desc,v=CH(e,jH),p=o||{width:r,height:l,x:0,y:0},x=Ct("recharts-surface",u);return b.createElement("svg",Y0({},Xr(v),{className:x,width:r,height:l,style:c,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height),ref:t}),b.createElement("title",null,h),b.createElement("desc",null,m),n)}),AH=["children","className"];function X0(){return X0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,l=EH(e,AH),o=Ct("recharts-layer",r);return b.createElement("g",X0({className:o},Xr(l),{ref:t}),n)});function Q0(e){return e==="__proto__"}const NH=Object.prototype.hasOwnProperty;function Pu(e,t){return NH.call(e,t)}const TH=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function eD(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e===""||e.startsWith(".")||e.endsWith(".")?!1:TH.test(e);default:return!1}}function Lv(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is(e==null||(t=e.valueOf)===null||t===void 0?void 0:t.call(e),-0)?"-0":String(e)}function ES(e){return typeof e=="symbol"||e instanceof Symbol}function tD(e){if(typeof e=="string")return e;if(Array.isArray(e)){let n="";for(let r=0;r0&&(n+=","),n+=tD(e[r]);return n}if(ES(e))return e.toString();const t=e+"";return t==="0"&&Object.is(Number(e),-0)?"-0":t}function RH(e){return e==null?"":tD(e)}function OS(e){if(Array.isArray(e))return e.map(Lv);if(typeof e=="symbol")return[e];e=RH(e);const t=[],n=e.length;if(n===0)return t;let r=0,l="",o="",u=!1,c=!1;const h=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push("");r1&&arguments[1]!==void 0?arguments[1]:DH,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Tn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var c=n[u-1];return typeof c=="string"?l+c+o:c!==void 0?l+ga(c)+o:l+o},"")}var Vr=e=>e===0?0:e>0?1:-1,Aa=e=>typeof e=="number"&&e!=+e,Vo=e=>typeof e=="string"&&e.length>1&&e.indexOf("%")===e.length-1,Re=e=>(typeof e=="number"||e instanceof Number)&&!Aa(e),Hi=e=>Re(e)||typeof e=="string",PH=0,Tf=e=>{var t=++PH;return"".concat(e||"").concat(t)},Pl=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Re(t)&&typeof t!="string")return r;var o;if(Vo(t)){if(n==null)return r;var u=t.indexOf("%");o=n*parseFloat(t.slice(0,u))/100}else o=+t;return Aa(o)&&(o=r),l&&n!=null&&o>n&&(o=n),o},nD=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):es(r,t))===n)}var yn=e=>e===null||typeof e>"u",NS=e=>yn(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function ur(e){return e!=null}function Ku(){}function TS(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function YE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Ai(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,l=r===void 0?0:r,o=e.parentViewBox,u=TS(t),c=u.x,h=u.y,m=u.height,v=u.upperWidth,p=u.lowerWidth,x=c,S=c+(v-p)/2,w=(x+S)/2,j=(v+p)/2,C=x+v/2,A=m>=0?1:-1,N=A*l,O=A>0?"end":"start",T=A>0?"start":"end",R=v>=0?1:-1,E=R*l,D=R>0?"end":"start",k=R>0?"start":"end",I=o;if(n==="top"){var P={x:x+v/2,y:h-N,horizontalAnchor:"middle",verticalAnchor:O};return I&&(P.height=Math.max(h-I.y,0),P.width=v),P}if(n==="bottom"){var B={x:S+p/2,y:h+m+N,horizontalAnchor:"middle",verticalAnchor:T};return I&&(B.height=Math.max(I.y+I.height-(h+m),0),B.width=p),B}if(n==="left"){var F={x:w-E,y:h+m/2,horizontalAnchor:D,verticalAnchor:"middle"};return I&&(F.width=Math.max(F.x-I.x,0),F.height=m),F}if(n==="right"){var se={x:w+j+E,y:h+m/2,horizontalAnchor:k,verticalAnchor:"middle"};return I&&(se.width=Math.max(I.x+I.width-se.x,0),se.height=m),se}var ue=I?{width:j,height:m}:{};return n==="insideLeft"?Ai({x:w+E,y:h+m/2,horizontalAnchor:k,verticalAnchor:"middle"},ue):n==="insideRight"?Ai({x:w+j-E,y:h+m/2,horizontalAnchor:D,verticalAnchor:"middle"},ue):n==="insideTop"?Ai({x:x+v/2,y:h+N,horizontalAnchor:"middle",verticalAnchor:T},ue):n==="insideBottom"?Ai({x:S+p/2,y:h+m-N,horizontalAnchor:"middle",verticalAnchor:O},ue):n==="insideTopLeft"?Ai({x:x+E,y:h+N,horizontalAnchor:k,verticalAnchor:T},ue):n==="insideTopRight"?Ai({x:x+v-E,y:h+N,horizontalAnchor:D,verticalAnchor:T},ue):n==="insideBottomLeft"?Ai({x:S+E,y:h+m-N,horizontalAnchor:k,verticalAnchor:O},ue):n==="insideBottomRight"?Ai({x:S+p-E,y:h+m-N,horizontalAnchor:D,verticalAnchor:O},ue):n&&typeof n=="object"&&(Re(n.x)||Vo(n.x))&&(Re(n.y)||Vo(n.y))?Ai({x:c+Pl(n.x,j),y:h+Pl(n.y,m),horizontalAnchor:"end",verticalAnchor:"end"},ue):Ai({x:C,y:h+m/2,horizontalAnchor:"middle",verticalAnchor:"middle"},ue)},UH=["top","left","right","bottom"];function $H(e){return e==null?!1:typeof e=="object"?!0:UH.includes(e)}var BH=b.createContext(null);const xf=Math.PI,Z0=2*xf,yo=1e-6,HH=Z0-yo;function iD(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return iD;const n=10**t;return function(r){this._+=r[0];for(let l=1,o=r.length;lyo)if(!(Math.abs(p*h-m*v)>yo)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let S=r-u,w=l-c,j=h*h+m*m,C=S*S+w*w,A=Math.sqrt(j),N=Math.sqrt(x),O=o*Math.tan((xf-Math.acos((j+x-C)/(2*A*N)))/2),T=O/N,R=O/A;Math.abs(T-1)>yo&&this._append`L${t+T*v},${n+T*p}`,this._append`A${o},${o},0,0,${+(p*S>v*w)},${this._x1=t+R*h},${this._y1=n+R*m}`}}arc(t,n,r,l,o,u){if(t=+t,n=+n,r=+r,u=!!u,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(l),h=r*Math.sin(l),m=t+c,v=n+h,p=1^u,x=u?l-o:o-l;if(this._x1===null?this._append`M${m},${v}`:(Math.abs(this._x1-m)>yo||Math.abs(this._y1-v)>yo)&&this._append`L${m},${v}`,!!r){if(x<0&&(x=x%Z0+Z0),x>HH)this._append`A${r},${r},0,1,${p},${t-c},${n-h}A${r},${r},0,1,${p},${this._x1=m},${this._y1=v}`;else if(x>yo){const S=t+r*Math.cos(o),w=n+r*Math.sin(o);if(x>=xf&&this._equal(m,v,S,w)){x/=2;let j=l+x;this._append`A${r},${r},0,${+(x>=xf)},${p},${t+r*Math.cos(j)},${n+r*Math.sin(j)}`}this._append`A${r},${r},0,${+(x>=xf)},${p},${this._x1=S},${this._y1=w}`}}}rect(t,n,r,l){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+l}h${-r}Z`}toString(){return this._}}function Ut(e){return function(){return e}}const XE=1e-12;function lD(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new GH(t)}function RS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function oD(e){this._context=e}oD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Uv(e){return new oD(e)}function sD(e){return e[0]}function uD(e){return e[1]}function cD(e,t){var n=Ut(!0),r=null,l=Uv,o=null,u=lD(c);e=typeof e=="function"?e:e===void 0?sD:Ut(e),t=typeof t=="function"?t:t===void 0?uD:Ut(t);function c(h){var m,v=(h=RS(h)).length,p,x=!1,S;for(r==null&&(o=l(S=u())),m=0;m<=v;++m)!(m=S;--w)c.point(O[w],T[w]);c.lineEnd(),c.areaEnd()}A&&(O[x]=+e(C,x,p),T[x]=+t(C,x,p),c.point(r?+r(C,x,p):O[x],n?+n(C,x,p):T[x]))}if(N)return c=null,N+""||null}function v(){return cD().defined(l).curve(u).context(o)}return m.x=function(p){return arguments.length?(e=typeof p=="function"?p:Ut(+p),r=null,m):e},m.x0=function(p){return arguments.length?(e=typeof p=="function"?p:Ut(+p),m):e},m.x1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:Ut(+p),m):r},m.y=function(p){return arguments.length?(t=typeof p=="function"?p:Ut(+p),n=null,m):t},m.y0=function(p){return arguments.length?(t=typeof p=="function"?p:Ut(+p),m):t},m.y1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:Ut(+p),m):n},m.lineX0=m.lineY0=function(){return v().x(e).y(t)},m.lineY1=function(){return v().x(e).y(n)},m.lineX1=function(){return v().x(r).y(t)},m.defined=function(p){return arguments.length?(l=typeof p=="function"?p:Ut(!!p),m):l},m.curve=function(p){return arguments.length?(u=p,o!=null&&(c=u(o)),m):u},m.context=function(p){return arguments.length?(p==null?o=c=null:c=u(o=p),m):o},m}class fD{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function qH(e){return new fD(e,!0)}function KH(e){return new fD(e,!1)}function kl(){}function $m(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function $v(e){this._context=e}$v.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:$m(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:$m(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function YH(e){return new $v(e)}function dD(e){this._context=e}dD.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:$m(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XH(e){return new dD(e)}function hD(e){this._context=e}hD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:$m(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function QH(e){return new hD(e)}function mD(e,t){this._basis=new $v(e),this._beta=t}mD.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],l=t[0],o=e[n]-r,u=t[n]-l,c=-1,h;++c<=n;)h=c/n,this._basis.point(this._beta*e[c]+(1-this._beta)*(r+h*o),this._beta*t[c]+(1-this._beta)*(l+h*u));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};(function e(t){function n(r){return t===1?new $v(r):new mD(r,t)}return n.beta=function(r){return e(+r)},n})(.85);function Bm(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function MS(e,t){this._context=e,this._k=(1-t)/6}MS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Bm(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Bm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return new MS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function DS(e,t){this._context=e,this._k=(1-t)/6}DS.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Bm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return new DS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function PS(e,t){this._context=e,this._k=(1-t)/6}PS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Bm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return new PS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function kS(e,t,n){var r=e._x1,l=e._y1,o=e._x2,u=e._y2;if(e._l01_a>XE){var c=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,h=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*c-e._x0*e._l12_2a+e._x2*e._l01_2a)/h,l=(l*c-e._y0*e._l12_2a+e._y2*e._l01_2a)/h}if(e._l23_a>XE){var m=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,v=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*m+e._x1*e._l23_2a-t*e._l12_2a)/v,u=(u*m+e._y1*e._l23_2a-n*e._l12_2a)/v}e._context.bezierCurveTo(r,l,o,u,e._x2,e._y2)}function vD(e,t){this._context=e,this._alpha=t}vD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:kS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return t?new vD(r,t):new MS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function gD(e,t){this._context=e,this._alpha=t}gD.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:kS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return t?new gD(r,t):new DS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function pD(e,t){this._context=e,this._alpha=t}pD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:kS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return t?new pD(r,t):new PS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function yD(e){this._context=e}yD.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ZH(e){return new yD(e)}function QE(e){return e<0?-1:1}function ZE(e,t,n){var r=e._x1-e._x0,l=t-e._x1,o=(e._y1-e._y0)/(r||l<0&&-0),u=(n-e._y1)/(l||r<0&&-0),c=(o*l+u*r)/(r+l);return(QE(o)+QE(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(c))||0}function WE(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function _x(e,t,n){var r=e._x0,l=e._y0,o=e._x1,u=e._y1,c=(o-r)/3;e._context.bezierCurveTo(r+c,l+c*t,o-c,u-c*n,o,u)}function Hm(e){this._context=e}Hm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:_x(this,this._t0,WE(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,_x(this,WE(this,n=ZE(this,e,t)),n);break;default:_x(this,this._t0,n=ZE(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function xD(e){this._context=new bD(e)}(xD.prototype=Object.create(Hm.prototype)).point=function(e,t){Hm.prototype.point.call(this,t,e)};function bD(e){this._context=e}bD.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,l,o){this._context.bezierCurveTo(t,e,r,n,o,l)}};function WH(e){return new Hm(e)}function JH(e){return new xD(e)}function SD(e){this._context=e}SD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=JE(e),l=JE(t),o=0,u=1;u=0;--t)l[t]=(u[t]-l[t+1])/o[t];for(o[n-1]=(e[n]+l[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function tF(e){return new Bv(e,.5)}function nF(e){return new Bv(e,0)}function rF(e){return new Bv(e,1)}function Go(e,t){if((u=e.length)>1)for(var n=1,r,l,o=e[t[0]],u,c=o.length;n=0;)n[t]=t;return n}function iF(e,t){return e[t]}function aF(e){const t=[];return t.key=e,t}function lF(){var e=Ut([]),t=W0,n=Go,r=iF;function l(o){var u=Array.from(e.apply(this,arguments),aF),c,h=u.length,m=-1,v;for(const p of o)for(c=0,++m;c0){for(var n,r,l=0,o=e[0].length,u;l0){for(var n=0,r=e[t[0]],l,o=r.length;n0)||!((o=(l=e[t[0]]).length)>0))){for(var n=0,r=1,l,o,u;r"radius"in e&&"startAngle"in e&&"endAngle"in e,IS=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(b.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(l=>{AS(l)&&typeof n[l]=="function"&&(r[l]=(o=>n[l](n,o)))}),r},cF=(e,t,n)=>r=>(e(t,n,r),null),fF=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(l=>{var o=e[l];AS(l)&&typeof o=="function"&&(r||(r={}),r[l]=cF(o,t,n))}),r};function eO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function dF(e){for(var t=1;t(u[c]===void 0&&r[c]!==void 0&&(u[c]=r[c]),u),n);return o}function gF(e,t){const n=new Map;for(let r=0;r=0}function zS(e){return e!=null&&typeof e!="function"&&yF(e.length)}function xF(e){return function(t){return es(t,e)}}function CD(e){return e==null||typeof e!="object"&&typeof e!="function"}function Io(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const _D="[object RegExp]",LS="[object String]",US="[object Number]",$S="[object Boolean]",AD="[object Arguments]",ED="[object Symbol]",OD="[object Date]",ND="[object Map]",TD="[object Set]",RD="[object Array]",bF="[object Function]",MD="[object ArrayBuffer]",Om="[object Object]",SF="[object Error]",DD="[object DataView]",PD="[object Uint8Array]",kD="[object Uint8ClampedArray]",ID="[object Uint16Array]",zD="[object Uint32Array]",wF="[object BigUint64Array]",LD="[object Int8Array]",UD="[object Int16Array]",$D="[object Int32Array]",jF="[object BigInt64Array]",BD="[object Float32Array]",HD="[object Float64Array]";function jf(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function FD(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function VD(e,t,n){return typeof n!="function"?VD(e,t,()=>{}):J0(e,t,function r(l,o,u,c,h,m){const v=n(l,o,u,c,h,m);return v!==void 0?!!v:J0(l,o,r,m,!1)},new Map,!0)}function J0(e,t,n,r,l=!1){if(t===e)return!0;switch(typeof t){case"object":return CF(e,t,n,r,l);case"function":return Object.keys(t).length>0?J0(e,Object.assign({},t),n,r,l):jf(e,t);default:return FD(e)&&l?typeof t=="string"?t==="":!0:jf(e,t)}}function CF(e,t,n,r,l=!1){if(t==null)return!0;if(Array.isArray(t))return GD(e,t,n,r);if(t instanceof Map)return _F(e,t,n,r);if(t instanceof Set)return AF(e,t,n,r);const o=Object.keys(t);if(e==null)return l&&o.length===0;if(l)CD(e)&&(e=Object(e));else{if(Io(t)==="[object Error]")return Io(e)==="[object Error]"&&e.name===t.name&&e.message===t.message;const u=Io(e);if(u!=="[object Object]"&&u!=="[object Arguments]")return!1}if(o.length===0)return!0;if(r!=null&&r.has(t))return r.get(t)===e;r==null||r.set(t,e);try{for(let u=0;u{})}function eb(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}const tO=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function tb(e){return typeof tO.Buffer<"u"&&tO.Buffer.isBuffer(e)}function EF(e){return tb(e)}function OF(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function NF(e){return OF(e)}function TF(e,t){return du(e,void 0,e,new Map)}function du(e,t,n,r,l){if(CD(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const u=new Array(e.length);r.set(e,u);for(let c=0;c{u.set(h,du(c,h,n,r))}),u}if(e instanceof Set){const u=new Set;return r.set(e,u),e.forEach(c=>{u.add(du(c,void 0,n,r))}),u}if(EF(e))return e.subarray();if(NF(e)){const u=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,u);for(let c=0;cqD(t,e)}const DF=/^(?:0|[1-9]\d*)$/;function YD(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e!t||v.kind===t),c=Math.max(1,Math.ceil(u.length/o)),h=u.slice((r-1)*o,r*o),m=j6(h);return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Лента событий"}),f.jsxs(ht,{className:"space-y-2",children:[f.jsx("p",{children:"Время - МСК. Нажмите на часы, чтобы увидеть секунды."}),f.jsxs("select",{className:hH,value:t,"aria-label":"Тип события",onChange:v=>{l(1),n(v.target.value)},children:[f.jsx("option",{value:"",children:"Все события"}),f.jsx("option",{value:"pay",children:"Оплата"}),f.jsx("option",{value:"promo",children:"Промо"}),f.jsx("option",{value:"activate",children:"Активация"}),f.jsx("option",{value:"fail",children:"Отказ"}),f.jsx("option",{value:"admin",children:"Админ"}),f.jsx("option",{value:"device",children:"Смена устройства"})]})]})]}),f.jsxs(xe,{children:[h.length===0?f.jsx("p",{className:"text-muted-foreground",children:"Пока пусто"}):null,f.jsx("div",{className:"space-y-4",children:m.map(v=>f.jsxs("section",{children:[f.jsx("h3",{className:"sticky top-0 z-10 bg-card py-1 text-sm font-semibold",children:v.title}),f.jsx("ol",{className:"ml-2 border-l border-border",children:v.items.map((g,x)=>f.jsxs("li",{className:"relative pb-4 pl-4",children:[f.jsx("span",{className:"absolute -left-[7px] top-1.5 h-3 w-3 rounded-full border-2 border-primary bg-card","aria-hidden":!0}),f.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[f.jsx(dt,{ms:g.at,variant:"time"}),f.jsx(vH,{kind:g.kind}),f.jsx("span",{className:"text-sm font-medium",children:bS(g.actor,{deviceId:g.deviceId,fallback:"система"})})]}),f.jsx("p",{className:"mt-1 text-sm",children:g.text}),g.accountId?f.jsx("a",{className:"text-sm text-primary",href:"/admin/?id="+encodeURIComponent(g.accountId),children:"карточка"}):null]},v.key+"-"+x))})]},v.key))}),f.jsx(Iv,{page:r,pages:c,total:u.length,onPage:l})]})]})}const Nf="h-10 rounded-md border border-input bg-secondary px-3 text-sm text-foreground";function pH({run:e}){const[t,n]=b.useState(""),[r,l]=b.useState(""),[o,u]=b.useState("telegram"),[c,h]=b.useState("30"),[m,v]=b.useState("1");return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Выдать код"}),f.jsx(ht,{children:"Дней - срок новой подписки. Если подписка уже есть, код добавляется к ней, дата окончания не меняется."})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"grid gap-2 md:grid-cols-5",children:[f.jsx($e,{placeholder:"Telegram id",value:t,onChange:g=>n(g.target.value)}),f.jsx($e,{placeholder:"Почта",value:r,onChange:g=>l(g.target.value)}),f.jsxs("select",{className:Nf,value:o,onChange:g=>u(g.target.value),"aria-label":"Куда отправить",children:[f.jsx("option",{value:"telegram",children:"Telegram"}),f.jsx("option",{value:"email",children:"Почта"}),f.jsx("option",{value:"none",children:"Только показать"})]}),f.jsxs("select",{className:Nf,value:c,onChange:g=>h(g.target.value),"aria-label":"Дней",children:[f.jsx("option",{value:"1",children:"1 день"}),f.jsx("option",{value:"7",children:"7 дней"}),f.jsx("option",{value:"30",children:"30 дней"}),f.jsx("option",{value:"90",children:"90 дней"}),f.jsx("option",{value:"365",children:"365 дней"})]}),f.jsx(he,{onClick:()=>void e("/admin/issue",{telegramId:t,email:r,channel:o,days:c}),children:"Выдать"})]}),f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Сколько кодов"}),f.jsx($e,{type:"number",min:1,max:100,value:m,onChange:g=>v(g.target.value)})]}),f.jsx(he,{variant:"secondary",onClick:()=>{const g=Number(m)||1;window.confirm("Создать "+g+" новых кодов на "+c+" дн.?")&&e("/admin/issue-bulk",{count:g,days:c}).then(x=>{var w;const S=((w=x==null?void 0:x.extra)==null?void 0:w.codes)||[];S.length&&($M("omp-codes.csv",[["код","аккаунт","до"]].concat(S.map(j=>[j.code,j.accountId||"",j.paidUntil?new Date(j.paidUntil).toISOString().slice(0,10):""]))),rt("CSV со кодами скачан"))})},children:"Создать пакетом"})]})]})]})}function yH({run:e,promos:t}){const[n,r]=b.useState(""),[l,o]=b.useState("1"),[u,c]=b.useState("1"),[h,m]=b.useState("1"),[v,g]=b.useState("0"),[x,S]=b.useState(""),[w,j]=b.useState(""),[C,E]=b.useState("0");return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Промокоды"})}),f.jsxs(xe,{className:"space-y-4",children:[f.jsxs("div",{className:"grid gap-2 md:grid-cols-7",children:[f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Код"}),f.jsx($e,{placeholder:"пусто = сгенерировать",value:n,onChange:N=>r(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Дней"}),f.jsx($e,{type:"number",value:l,onChange:N=>o(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Бонусных устройств"}),f.jsx($e,{type:"number",min:0,max:20,value:v,onChange:N=>g(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Бонус на дней"}),f.jsx($e,{type:"number",min:0,placeholder:"пусто = навсегда",value:x,onChange:N=>S(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Активаций"}),f.jsx($e,{type:"number",value:u,onChange:N=>c(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Истекает, дней"}),f.jsx($e,{type:"number",min:0,placeholder:"пусто = без срока",value:w,onChange:N=>j(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Скидка, %"}),f.jsx($e,{type:"number",min:0,max:100,value:C,onChange:N=>E(N.target.value)})]}),f.jsxs("label",{className:"space-y-1 text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Количество"}),f.jsx($e,{type:"number",min:1,max:100,value:h,onChange:N=>m(N.target.value)})]}),f.jsx("div",{className:"flex items-end",children:f.jsx(he,{onClick:()=>{const N=Number(h)||1;e("/admin/promo",{code:n,days:l,maxUses:u,count:N,bonusSlots:v,bonusDays:x,expiresDays:w,discountPercent:C}).then(O=>{var R;const T=((R=O==null?void 0:O.extra)==null?void 0:R.promos)||[];T.length>1&&$M("omp-promos-new.csv",[["код","дней","активаций","бонусных устройств","бонус на дней"]].concat(T.map(A=>[A.code,String(A.days),String(A.maxUses),String(A.bonusSlots||0),A.bonusSlots?String(A.bonusDays||0):""])))})},children:"Создать"})})]}),f.jsx("div",{className:"flex flex-wrap gap-3 text-sm",children:f.jsx("a",{className:"text-primary",href:"/admin/promos.csv",children:"Скачать все промокоды (CSV)"})}),f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Код"}),f.jsx(Se,{children:"Дни"}),f.jsx(Se,{children:"Бонус"}),f.jsx(Se,{children:"Создан"}),f.jsx(Se,{children:"Использования"}),f.jsx(Se,{})]})}),f.jsxs(er,{children:[t.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:6,className:"text-muted-foreground",children:"Нет промокодов"})}):null,t.map(N=>{const O=N.uses>=N.maxUses;return f.jsxs(qe,{children:[f.jsxs(me,{children:[f.jsx("span",{className:N.revoked?"text-muted-foreground":"font-mono",children:N.code})," ",f.jsx(ko,{value:N.code})]}),f.jsx(me,{children:N.days}),f.jsx(me,{children:N.bonusSlots?"+"+N.bonusSlots+" устр. "+(N.bonusDays?"на "+N.bonusDays+" дн.":"навсегда"):f.jsx("span",{className:"text-muted-foreground",children:"-"})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:N.createdAt})}),f.jsxs(me,{children:[N.uses,"/",N.maxUses]}),f.jsx(me,{children:N.revoked?f.jsx("span",{className:"text-muted-foreground",children:"отозван"}):O?f.jsx("span",{className:"text-muted-foreground",children:"использован"}):f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>{window.confirm("Отозвать промокод "+N.code+"?")&&e("/admin/promo-revoke",{promoId:N.id})},children:"Отозвать"})})]},N.id)})]})]})]})]})}function xH({subs:e,filter:t,setFilter:n,csrf:r}){const l=e.filter(u=>m6(u,t)),o=g6(e);return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Подписки"}),f.jsx(ht,{children:f.jsx("span",{className:"flex flex-wrap gap-1",children:[["all","Все"],["active","Активные"],["week","Истекают за 7 дней"],["unbound","Без устройства"],["grace","Льготный период"],["expired","Истекшие"]].map(([u,c])=>f.jsx(he,{size:"sm",variant:t===u?"default":"secondary",onClick:()=>n(u),children:c},u))})})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-3 text-sm",children:[f.jsx("a",{className:"text-primary",href:"/admin/subscriptions.csv",children:"Скачать подписки (CSV)"}),f.jsx("a",{className:"text-primary",href:"/admin/users.csv",children:"Скачать пользователей (CSV)"}),f.jsxs(he,{size:"sm",variant:"secondary",disabled:o.length===0,onClick:()=>{o.length&&window.confirm("Отправить напоминание "+o.length+" пользователям в Telegram?")&&(async()=>{let u=0;for(let c=0;cf.jsxs(qe,{children:[f.jsxs(me,{children:[u.who,f.jsx(ko,{value:u.telegramId})]}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:u.createdAt})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:u.paidUntil})}),f.jsx(me,{children:f.jsx(IM,{status:u.status})}),f.jsxs(me,{children:[f.jsx(d6,{bound:u.bound,limit:u.deviceLimit,over:u.overLimit}),(u.creditRub||0)>0?f.jsxs("span",{className:"text-xs text-muted-foreground",children:["зачёт ",u.creditRub," ₽"]}):null,u.limitOverride?f.jsx("span",{className:"ml-1 text-xs text-amber-300",title:u.limitText,children:"индивид."}):null]}),f.jsx(me,{children:f.jsx("a",{className:"text-primary",href:"/admin/?id="+encodeURIComponent(u.accountId),children:"карточка"})})]},u.id))]})]})]})]})}function bH({rows:e}){return e.length?f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Проблемы"})}),f.jsx(xe,{children:f.jsx("ul",{className:"space-y-3 text-sm",children:e.map((t,n)=>{const r=[t.amount?t.amount+" ₽":"",t.label||"",t.operationId||""].filter(Boolean);return f.jsxs("li",{className:"rounded-md border border-red-900/50 bg-red-950/30 px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Oe,{variant:"bad",children:LM(t.kind)}),f.jsx(dt,{ms:t.at})]}),f.jsx("div",{className:"mt-1 break-all text-zinc-100",children:r.length?r.join(" · "):t.text||"Нет подробностей"})]},n)})})})]}):null}function Cx(e){if(!e)return"";const t=Math.round(e*1e8)/1e8;return String(t)}function SH({row:e}){const t=e&&e.yoomoney,n=e&&e.stars,r=e&&e.crypto,l=(o,u)=>f.jsxs("div",{children:[f.jsx("div",{className:"text-sm font-medium",children:o}),f.jsx("div",{className:"text-xs text-muted-foreground",children:u.filter(Boolean).join(" · ")})]});return f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Выручка за 30 дней по способам"}),f.jsx(ht,{children:"Рубли звёзд и крипты - цена заказа на момент оплаты. Возврат звёзд в сумму не входит."})]}),f.jsxs(xe,{className:"grid gap-3 sm:grid-cols-3",children:[l("ЮMoney",[Math.round((t==null?void 0:t.rub)||0)+" ₽",((t==null?void 0:t.count)||0)+" оплат"]),l("Звёзды",[Math.round((n==null?void 0:n.stars)||0)+" звёзд",Math.round((n==null?void 0:n.rub)||0)+" ₽",((n==null?void 0:n.count)||0)+" оплат"]),l("Крипта",[r!=null&&r.usdt?Cx(r.usdt)+" USDT":"",r!=null&&r.ton?Cx(r.ton)+" TON":"",r!=null&&r.btc?Cx(r.btc)+" BTC":"",Math.round((r==null?void 0:r.rub)||0)+" ₽",((r==null?void 0:r.count)||0)+" оплат"])]})]})}function wH({home:e}){var C,E,N,O,T,R,A,D,k,I;const[t,n]=b.useState(null),[r,l]=b.useState(0),[o,u]=b.useState(1),[c,h]=b.useState(""),[m,v]=b.useState("30"),[g,x]=b.useState(30),S=20;b.useEffect(()=>{let P=!1;const B=Date.now(),F=m==="all"?0:B-Number(m)*24*60*60*1e3,se=new URLSearchParams({q:c,offset:String((o-1)*S),limit:String(S)});return F&&se.set("from",String(F)),st("/admin/api/payments?"+se.toString()).then(ue=>{P||ue.auth===!1||(n(ue.payments||[]),l(ue.total||0))}),()=>{P=!0}},[o,c,m]);const w=(e.series||[]).slice(g===30?-30:-90),j=Math.max(1,Math.ceil(r/S));return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[[(E=(C=e.finance)==null?void 0:C.summary)==null?void 0:E.day,"сегодня"],[(O=(N=e.finance)==null?void 0:N.summary)==null?void 0:O.week,"неделя"],[(R=(T=e.finance)==null?void 0:T.summary)==null?void 0:R.month,"месяц"]].map(([P,B])=>f.jsx(ye,{children:f.jsxs(xe,{className:"pt-4",children:[f.jsx("div",{className:"text-2xl font-bold",children:Math.round((P==null?void 0:P.sum)||0)}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:["₽ ",B," · ",(P==null?void 0:P.count)||0]})]})},B))}),f.jsxs(ye,{children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[f.jsx(Te,{children:"Графики"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(he,{size:"sm",variant:g===30?"default":"secondary",onClick:()=>x(30),children:"30 дней"}),f.jsx(he,{size:"sm",variant:g===90?"default":"secondary",onClick:()=>x(90),children:"90 дней"})]})]}),f.jsxs(xe,{className:"grid gap-6 lg:grid-cols-2",children:[f.jsx(MA,{rows:w,field:"revenue",label:"Выручка по дням, ₽"}),f.jsx(MA,{rows:w,field:"subs",label:"Новые подписки по дням"})]})]}),f.jsx(SH,{row:(k=(D=(A=e.finance)==null?void 0:A.summary)==null?void 0:D.month)==null?void 0:k.byMethod}),f.jsx("p",{children:f.jsx("a",{className:"text-primary",href:"/admin/finance.csv",children:"Скачать CSV за 30 дней"})}),f.jsx(bH,{rows:((I=e.finance)==null?void 0:I.problems)||[]}),f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Платежи"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx($e,{className:"max-w-xs",placeholder:"Поиск: кто, метка, сумма",value:c,onChange:P=>{u(1),h(P.target.value)}}),f.jsxs("select",{className:Nf,value:m,"aria-label":"Период",onChange:P=>{u(1),v(P.target.value)},children:[f.jsx("option",{value:"7",children:"7 дней"}),f.jsx("option",{value:"30",children:"30 дней"}),f.jsx("option",{value:"90",children:"90 дней"}),f.jsx("option",{value:"all",children:"Все"})]})]}),t===null?f.jsxs("div",{className:"space-y-2",children:[f.jsx(rn,{className:"h-8"}),f.jsx(rn,{className:"h-8"})]}):f.jsxs(Wn,{className:"min-w-[40rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Когда, МСК"}),f.jsx(Se,{children:"Сумма"}),f.jsx(Se,{children:"Способ"}),f.jsx(Se,{children:"Кто"}),f.jsx(Se,{children:"Метка"})]})}),f.jsxs(er,{children:[t.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"Нет платежей"})}):null,t.map((P,B)=>f.jsxs(qe,{children:[f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:P.at})}),f.jsx(me,{children:P.amount||"-"}),f.jsx(me,{children:UM(P)}),f.jsx(me,{children:P.accountId?f.jsx("a",{className:"text-primary",href:"/admin/?id="+encodeURIComponent(P.accountId),children:P.who||P.accountId.slice(0,8)}):P.who||"-"}),f.jsx(me,{className:"break-all font-mono text-xs text-muted-foreground",children:P.label||"-"})]},(P.operationId||"")+B))]})]}),f.jsx(Iv,{page:o,pages:j,total:r,onPage:u})]})]})]})}const YA=[{title:"Бот",fields:[["botToken","Токен бота"],["botUsername","Имя бота"],["publicOrigin","Публичный адрес"],["adminTelegramIds","Telegram id администраторов"],["adminReaders","Telegram id только для просмотра"],["betaPercent","Процент беты (0-100)"]]},{title:"Платежи",fields:[["yoomoneyWallet","Кошелёк ЮMoney"],["yoomoneySecret","Секрет ЮMoney"],["cryptoPayToken","Токен Crypto Pay"],["cryptoPayTestnetToken","Токен Crypto Pay (testnet)"]]},{title:"Звёзды",fields:[["starsPrice","Подписка, звёзд"],["starsExtra","Доп. устройство, звёзд"]]},{title:"Крипта",fields:[["cryptoUsdt","Подписка, USDT"],["cryptoExtraUsdt","Доп. устройство, USDT"],["cryptoRateUsdt","Курс USDT, ₽ за 1"],["cryptoTon","Подписка, TON"],["cryptoExtraTon","Доп. устройство, TON"],["cryptoRateTon","Курс TON, ₽ за 1"],["cryptoBtc","Подписка, BTC"],["cryptoExtraBtc","Доп. устройство, BTC"],["cryptoRateBtc","Курс BTC, ₽ за 1"]]},{title:"SMTP",fields:[["smtpHost","SMTP-сервер"],["smtpUser","SMTP-логин"],["smtpPass","SMTP-пароль"],["smtpFrom","SMTP-отправитель"]]},{title:"Цены",fields:[["priceRub","Цена, ₽"],["periodDays","Период, дней"],["baseDevices","Базовых устройств в подписке (1-20; кроме индивидуальных лимитов)"],["extraDeviceRub","Доп. устройство, ₽ в месяц"],["graceDays","Льготный период, дней"],["publicPromo","Промокод на пробный день (бот покажет, пока он действует)"]]},{title:"Бэкапы Postgres",fields:[["backupEveryHours","Делать дамп каждые, часов (1-168)"],["backupKeepDays","Хранить дампы, дней (1-365; последний не удаляется)"]]},{title:"DHT",fields:[["dhtPerMinute","Запросов в минуту на устройство (0-1000, 0 выключает, по умолчанию 30)"]]}],XA=new Set(["botToken","yoomoneySecret","cryptoPayToken","cryptoPayTestnetToken","smtpPass","jackettApiKey","jacredApiKey","indexerPass"]);function yf({name:e,label:t,view:n,fallback:r}){const l=n?n.text:r||"не задан";return f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:e,children:t}),f.jsx($e,{id:e,value:l,readOnly:!0,disabled:!0}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["Меняется на сервере: ",n?n.env:"переменная"," в .env, затем перезапуск billing.",n&&n.source==="db"?f.jsx("span",{className:"text-destructive",children:" Сейчас ещё в базе - перенесите в .env."}):null]})]})}function jH({backup:e}){if(!e||!e.enabled)return f.jsx(ht,{children:"Бэкапы Postgres на этом сервере не настроены (нет BILLING_PG_BACKUP_DIR)."});const t=e.last;return f.jsxs(ht,{children:[t?"Последний дамп: "+zi(t.at)+" · "+DA(t.size):"Дампов ещё нет"," · всего "+e.count+" ("+DA(e.totalBytes)+")",e.stale?f.jsx("span",{className:"text-destructive",children:" · бэкап устарел"}):null,e.lastError?f.jsxs("span",{className:"text-destructive",children:[" · ошибка: ",e.lastError]}):null,e.verify?f.jsx("span",{className:e.verify.ok?"":"text-destructive",children:" · проверка архива: "+(e.verify.ok?"список читается":e.verify.error||"ошибка")}):null]})}function CH({run:e,settings:t,storage:n,backup:r,secrets:l}){const[o,u]=b.useState({}),[c,h]=b.useState(!0),[m,v]=b.useState(!1),[g,x]=b.useState(!1),[S,w]=b.useState(!1),[j,C]=b.useState(!1),E=b.useRef(!1),[N,O]=b.useState(null),T=R=>e("/admin/settings",{...o,adminNotify:c?"true":"false",starsEnabled:m?"true":"false",cryptoEnabled:g?"true":"false",cryptoTestnet:S?"true":"false",cryptoNonRu:j?"true":"false",...R?{confirm:"yes"}:{}}).then(A=>{var D;return(D=A==null?void 0:A.flash)!=null&&D.error||(E.current=!1),A});return b.useEffect(()=>{if(E.current)return;const R={};for(const A of YA)for(const[D]of A.fields)XA.has(D)||(R[D]=String(t[D]??""));u(R),h(t.adminNotify!==!1),v(t.starsEnabled===!0),x(t.cryptoEnabled===!0),w(t.cryptoTestnet===!0),C(t.cryptoNonRu===!0)},[t]),f.jsxs("form",{className:"space-y-4",onSubmit:R=>{R.preventDefault();const A=Number(o.baseDevices),D=Number(t.baseDevices);if(Number.isInteger(A)&&A>=1&&Number.isFinite(D)&&AO(k&&k.lowering?k:null),()=>rt("Не удалось посчитать, кого затронет снижение"));return}O(null),T(!1)},children:[f.jsxs("p",{className:"text-sm text-muted-foreground",children:["Хранилище: ",(n==null?void 0:n.engine)||"-",n!=null&&n.path?" · "+n.path:""]}),YA.map(R=>f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:R.title}),R.title==="Платежи"?f.jsx(ht,{children:"Кошелёк показывается частично. Чтобы сменить, введите новый номер целиком."}):null,R.title==="Бэкапы Postgres"?f.jsx(jH,{backup:r}):null,R.title==="DHT"?f.jsx(ht,{children:"Лимит кнопки «Проверить сиды»: сколько запросов /v1/dht-peers устройство может сделать за минуту. После сохранения действует это число. Пока поле ни разу не сохраняли, запасной предел берется из BILLING_DHT_DEVICE_MAX."}):null]}),f.jsxs(xe,{className:"grid gap-3 md:grid-cols-2",children:[R.fields.map(([A,D])=>XA.has(A)?f.jsx(yf,{name:A,label:D,view:(l||[]).find(k=>k.key===A),fallback:String(t[A]??"")},A):f.jsxs("div",{className:"space-y-1",children:[f.jsx(yt,{htmlFor:A,children:D}),f.jsx($e,{id:A,value:o[A]||"",onChange:k=>{E.current=!0,u({...o,[A]:k.target.value})}})]},A)),R.title==="Бот"?f.jsxs("label",{className:"flex items-center gap-2 text-sm md:col-span-2",children:[f.jsx("input",{type:"checkbox",checked:c,onChange:A=>{E.current=!0,h(A.target.checked)}}),"Уведомлять администраторов в Telegram (оплата, ошибка оплаты, падение сервиса, новое сообщение поддержки)"]}):null,R.title==="Звёзды"?f.jsxs("label",{className:"flex items-center gap-2 text-sm md:col-span-2",children:[f.jsx("input",{type:"checkbox",checked:m,onChange:A=>{E.current=!0,v(A.target.checked)}}),"Принимать Telegram Stars. По умолчанию выключено. Комиссия сверху не добавляется."]}):null,R.title==="Крипта"?f.jsxs("div",{className:"space-y-2 md:col-span-2",children:[f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:g,onChange:A=>{E.current=!0,x(A.target.checked)}}),"Принимать Crypto Pay (USDT, TON, BTC). По умолчанию выключено."]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:S,onChange:A=>{E.current=!0,w(A.target.checked)}}),"Тестовая сеть Crypto Pay (testnet-pay.crypt.bot). Токен этого режима:"," ",String(S?t.cryptoPayTestnetToken||"не задан":t.cryptoPayToken||"не задан"),"."]}),f.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[f.jsx("input",{type:"checkbox",checked:j,onChange:A=>{E.current=!0,C(A.target.checked)}}),"Только пользователям не из РФ. Без кода страны или с кодом RU ссылка не выдаётся."]})]}):null]})]},R.title)),N?f.jsxs(Bt,{variant:"warn",children:[f.jsxs("p",{children:["Базовых устройств станет ",N.to," (сейчас ",N.from,"). Затронет подписок без индивидуального лимита: ",N.subscriptions,", перестанут работать устройств: ",N.devices," - последние привязанные сверх нового лимита. Ничего не отвязывается, при возврате базы они заработают снова."]}),f.jsxs("div",{className:"mt-2 flex gap-2",children:[f.jsxs(he,{type:"button",size:"sm",variant:"destructive",onClick:()=>{O(null),T(!0)},children:["Да, снизить до ",N.to]}),f.jsx(he,{type:"button",size:"sm",variant:"ghost",onClick:()=>O(null),children:"Отмена"})]})]}):null,f.jsx(he,{type:"submit",children:"Сохранить"})]})}function _H({row:e,checking:t}){return t&&!e?f.jsx(Oe,{variant:"secondary",children:"проверка…"}):e?e.configured?e.ok?f.jsxs(Oe,{variant:"ok",children:["работает · ",e.latencyMs," мс"]}):f.jsx(Oe,{variant:"bad",children:P6(e.error)}):f.jsx(Oe,{variant:"secondary",children:"не настроено"}):f.jsx(Oe,{variant:"secondary",children:"нет данных"})}function QA({csrf:e,settings:t,secrets:n,onSaved:r}){const l=O=>(n||[]).find(T=>T.key===O),[o,u]=b.useState({jackettUrl:String(t.jackettUrl??""),jackettEnabled:t.jackettEnabled!==!1,jacredUrl:String(t.jacredUrl??""),jacredEnabled:t.jacredEnabled!==!1,bitmagnetUrl:String(t.bitmagnetUrl??""),bitmagnetEnabled:t.bitmagnetEnabled===!0,torrserverUrl:String(t.torrserverUrl??""),indexerUser:String(t.indexerUser??"")}),[c,h]=b.useState(null),[m,v]=b.useState(null),[g,x]=b.useState(!1),[S,w]=b.useState(0),[j,C]=b.useState("");b.useEffect(()=>{u({jackettUrl:String(t.jackettUrl??""),jackettEnabled:t.jackettEnabled!==!1,jacredUrl:String(t.jacredUrl??""),jacredEnabled:t.jacredEnabled!==!1,bitmagnetUrl:String(t.bitmagnetUrl??""),bitmagnetEnabled:t.bitmagnetEnabled===!0,torrserverUrl:String(t.torrserverUrl??""),indexerUser:String(t.indexerUser??"")})},[t]);async function E(O){x(!0),C("");try{const T=await st("/admin/api/services");if(T.auth===!1){C("Нужен вход");return}h(T.services||null),v(T.botPoll||null);const R=Date.now();w(R),O||rt("Сервисы проверены · "+zi(R))}catch(T){C(T instanceof Error?T.message:"Не удалось проверить сервисы")}finally{x(!1)}}b.useEffect(()=>{E(!1)},[]);async function N(O){O.preventDefault(),x(!0),C("");try{if((await an("/admin/services",e,{...o,jackettEnabled:o.jackettEnabled?"true":"false",jacredEnabled:o.jacredEnabled?"true":"false",bitmagnetEnabled:o.bitmagnetEnabled?"true":"false"})).auth===!1){C("Нужен вход");return}rt("Сервисы сохранены"),r(),await E(!0)}catch(T){C(T instanceof Error?T.message:"Не удалось сохранить")}finally{x(!1)}}return f.jsxs("div",{className:"space-y-4",children:[f.jsxs(ye,{children:[f.jsxs(Ne,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx(Te,{children:"Сервисы VPS"}),f.jsxs(ht,{children:["Ключи только на сервере. Телефон ходит через billing при активной подписке. TorrServer на VPS - для мониторинга, не для пользователей.",S?" Проверено "+zi(S)+".":""]})]}),f.jsx(he,{type:"button",variant:"secondary",disabled:g,onClick:()=>void E(!1),children:g?"Проверка…":"Проверить сейчас"})]}),f.jsxs(xe,{className:"space-y-3",children:[f.jsx(EH,{poll:m}),f.jsx("div",{className:"grid gap-3 lg:grid-cols-3",children:g&&!c?f.jsxs(f.Fragment,{children:[f.jsx(rn,{className:"h-24"}),f.jsx(rn,{className:"h-24"}),f.jsx(rn,{className:"h-24"})]}):f.jsxs(f.Fragment,{children:[f.jsx(nm,{title:"Jackett",row:c==null?void 0:c.jackett,fallback:o.jackettUrl,note:"подписчикам: "+(o.jackettEnabled?"вкл":"выкл"),checking:g}),f.jsx(nm,{title:"JacRed",row:c==null?void 0:c.jacred,fallback:o.jacredUrl,note:"подписчикам: "+(o.jacredEnabled?"вкл":"выкл"),checking:g}),f.jsx(nm,{title:"bitmagnet",row:c==null?void 0:c.bitmagnet,fallback:o.bitmagnetUrl,note:"подписчикам: "+(o.bitmagnetEnabled?"вкл":"выкл"),checking:g}),f.jsx(nm,{title:"TorrServer",row:c==null?void 0:c.torrserver,fallback:o.torrserverUrl,note:"только мониторинг",checking:g})]})})]})]}),f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Настройки сервисов"}),f.jsx(ht,{children:"Ключи и пароль - только для чтения: они в .env на сервере."})]}),f.jsx(xe,{children:f.jsxs("form",{className:"space-y-4",onSubmit:O=>void N(O),children:[f.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[f.jsx(rf,{id:"jackettUrl",label:"Адрес Jackett",value:o.jackettUrl,onChange:O=>u({...o,jackettUrl:O}),placeholder:"http://jackett:9117"}),f.jsx(yf,{name:"jackettApiKey",label:"Ключ API Jackett",view:l("jackettApiKey"),fallback:String(t.jackettApiKey??"")}),f.jsx(_x,{label:"Jackett доступен подписчикам",checked:o.jackettEnabled,onChange:O=>u({...o,jackettEnabled:O})}),f.jsx(rf,{id:"jacredUrl",label:"Адрес JacRed",value:o.jacredUrl,onChange:O=>u({...o,jacredUrl:O}),placeholder:"http://jacred:9117"}),f.jsx(yf,{name:"jacredApiKey",label:"Ключ API JacRed",view:l("jacredApiKey"),fallback:String(t.jacredApiKey??"")}),f.jsx(_x,{label:"JacRed доступен подписчикам",checked:o.jacredEnabled,onChange:O=>u({...o,jacredEnabled:O})}),f.jsx(rf,{id:"bitmagnetUrl",label:"Адрес bitmagnet",value:o.bitmagnetUrl,onChange:O=>u({...o,bitmagnetUrl:O}),placeholder:"http://127.0.0.1:3333"}),f.jsx(yf,{name:"bitmagnetApiKey",label:"Ключ API bitmagnet",view:l("bitmagnetApiKey"),fallback:String(t.bitmagnetApiKey??"")}),f.jsx(_x,{label:"bitmagnet доступен подписчикам",checked:o.bitmagnetEnabled,onChange:O=>u({...o,bitmagnetEnabled:O})}),f.jsx(rf,{id:"torrserverUrl",label:"Адрес TorrServer (только мониторинг)",value:o.torrserverUrl,onChange:O=>u({...o,torrserverUrl:O}),placeholder:"http://torrserver:8090",wide:!0}),f.jsx(rf,{id:"indexerUser",label:"Логин basic-авторизации",value:o.indexerUser,onChange:O=>u({...o,indexerUser:O}),placeholder:"omp"}),f.jsx(yf,{name:"indexerPass",label:"Пароль basic-авторизации",view:l("indexerPass"),fallback:String(t.indexerPass??"")})]}),j?f.jsx(Bt,{variant:"destructive",children:j}):null,f.jsx(he,{type:"submit",disabled:g,children:"Сохранить"})]})})]})]})}function EH({poll:e}){const t=!!(e&&e.enabled&&e.conflictRecent);return f.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-sm",children:[f.jsx("span",{children:Z8(e)}),e&&e.enabled?t?f.jsx(Oe,{variant:"bad",children:"конфликт 409"}):f.jsx(Oe,{variant:"ok",children:"без конфликта"}):null]})}function nm({title:e,row:t,fallback:n,note:r,checking:l}){return f.jsxs("div",{className:"rounded-md border border-border p-3",children:[f.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[f.jsx("span",{className:"font-medium",children:e}),f.jsx(_H,{row:t,checking:l})]}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:(t==null?void 0:t.url)||n||"-"}),f.jsx("div",{className:"text-xs text-muted-foreground",children:r})]})}function rf({id:e,label:t,value:n,onChange:r,placeholder:l,wide:o}){return f.jsxs("div",{className:"space-y-1 "+(o?"md:col-span-2":""),children:[f.jsx(yt,{htmlFor:e,children:t}),f.jsx($e,{id:e,value:n,placeholder:l,onChange:u=>r(u.target.value)})]})}function _x({label:e,checked:t,onChange:n}){return f.jsxs("label",{className:"flex items-center gap-2 text-sm md:col-span-2",children:[f.jsx("input",{type:"checkbox",checked:t,onChange:r=>n(r.target.checked)}),e]})}function AH(){const[e,t]=b.useState(""),[n,r]=b.useState(""),[l,o]=b.useState(1),[u,c]=b.useState(null),[h,m]=b.useState(0),v=30;b.useEffect(()=>{let x=!1;const S=new URLSearchParams({q:e,action:n,offset:String((l-1)*v),limit:String(v)});return st("/admin/api/audit?"+S).then(w=>{x||w.auth===!1||(c(w.audit||[]),m(w.total||0))}),()=>{x=!0}},[e,n,l]);const g=Math.max(1,Math.ceil(h/v));return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Журнал"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx($e,{className:"max-w-xs",placeholder:"Поиск",value:e,onChange:x=>{o(1),t(x.target.value)}}),f.jsx("select",{className:Nf,value:n,"aria-label":"Действие",onChange:x=>{o(1),r(x.target.value)},children:k6.map(([x,S])=>f.jsx("option",{value:x,children:S},x||"all"))})]}),u===null?f.jsx(rn,{className:"h-24"}):u.length===0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Записей нет"}):f.jsx("ul",{className:"space-y-1 text-sm",children:u.map((x,S)=>f.jsxs("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[f.jsx(dt,{ms:x.at}),f.jsx("span",{children:bS(x.actor,{fallback:"админ"})}),f.jsx("span",{children:D6(x.action)}),f.jsx("span",{className:"text-muted-foreground",children:x.detail})]},S))}),f.jsx(Iv,{page:l,pages:g,total:h,onPage:o})]})]})}function OH(){const[e,t]=b.useState(""),[n,r]=b.useState(""),[l,o]=b.useState(1),[u,c]=b.useState(null),[h,m]=b.useState(0),v=30;b.useEffect(()=>{let x=!1;const S=new URLSearchParams({reason:e,q:n,offset:String((l-1)*v),limit:String(v)});return st("/admin/api/fails?"+S).then(w=>{x||w.auth===!1||(c(w.fails||[]),m(w.total||0))}),()=>{x=!0}},[e,n,l]);const g=Math.max(1,Math.ceil(h/v));return f.jsxs(ye,{children:[f.jsx(Ne,{children:f.jsx(Te,{children:"Неудачные активации"})}),f.jsxs(xe,{className:"space-y-3",children:[f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx($e,{className:"max-w-xs",placeholder:"Устройство",value:n,onChange:x=>{o(1),r(x.target.value)}}),f.jsx("select",{className:Nf,value:e,"aria-label":"Причина",onChange:x=>{o(1),t(x.target.value)},children:I6.map(([x,S])=>f.jsx("option",{value:x,children:S},x||"all"))})]}),u===null?f.jsx(rn,{className:"h-24"}):f.jsxs(Wn,{className:"min-w-[32rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Когда, МСК"}),f.jsx(Se,{children:"Причина"}),f.jsx(Se,{children:"Устройство"})]})}),f.jsxs(er,{children:[u.length===0?f.jsx(qe,{children:f.jsx(me,{colSpan:3,className:"text-muted-foreground",children:"Отказов нет"})}):null,u.map((x,S)=>f.jsxs(qe,{children:[f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:x.at})}),f.jsx(me,{children:M6(x.reason)}),f.jsx(me,{className:"font-mono text-xs",children:x.deviceId?x.deviceId.slice(0,8):"-"})]},S))]})]}),f.jsx(Iv,{page:l,pages:g,total:h,onPage:o})]})]})}function NH({run:e,sessions:t,sessionId:n}){return f.jsx("div",{className:"space-y-4",children:f.jsxs(ye,{children:[f.jsxs(Ne,{children:[f.jsx(Te,{children:"Сессии"}),f.jsx(ht,{children:"Вход только через Telegram. Время - МСК."})]}),f.jsx(xe,{children:f.jsxs(Wn,{className:"min-w-[36rem]",children:[f.jsx(Jn,{children:f.jsxs(qe,{children:[f.jsx(Se,{children:"Сессия"}),f.jsx(Se,{children:"Кто"}),f.jsx(Se,{children:"Создана"}),f.jsx(Se,{children:"Активность"}),f.jsx(Se,{})]})}),f.jsx(er,{children:t.map(r=>f.jsxs(qe,{children:[f.jsxs(me,{children:[r.id.slice(0,8),"…",r.id===n?" (эта)":""]}),f.jsx(me,{children:bS(r.actor,{fallback:"админ"})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:r.createdAt})}),f.jsx(me,{className:"whitespace-nowrap",children:f.jsx(dt,{ms:r.lastSeen})}),f.jsx(me,{children:r.id!==n?f.jsx(he,{size:"sm",variant:"secondary",onClick:()=>void e("/admin/session-revoke",{sessionId:r.id}),children:"Завершить"}):null})]},r.id))})]})})]})})}const tD=b.createContext({paused:!1,setPaused:()=>{},mode:"poll",at:0});function zv(){return b.useContext(tD)}function TH({children:e}){const t=Jb(),[n,r]=b.useState(!1),[l,o]=b.useState("poll"),[u,c]=b.useState(0),h=b.useRef(l);return h.current=l,b.useEffect(()=>{if(n){o("pause");return}let m=!1,v=null,g=0,x=1e3;const S=()=>{c(Date.now()),t.invalidateQueries(),window.dispatchEvent(new Event("omp-admin-live"))},w=()=>{m||(v=new EventSource("/admin/api/events"),v.onopen=()=>{x=1e3,o("live"),c(Date.now())},v.onmessage=()=>{o("live"),S()},v.onerror=()=>{v&&v.close(),o("poll"),!m&&(g=window.setTimeout(w,x),x=Math.min(15e3,x*2))})};return w(),()=>{m=!0,v&&v.close(),window.clearTimeout(g)}},[n,t]),b.useEffect(()=>{if(n)return;const m=window.setInterval(()=>{h.current!=="live"&&window.dispatchEvent(new Event("omp-admin-live"))},12e3);return()=>window.clearInterval(m)},[n]),f.jsx(tD.Provider,{value:{paused:n,setPaused:r,mode:l,at:u},children:e})}function ZA(){const{paused:e,setPaused:t,mode:n,at:r}=zv(),l=n==="pause"?"пауза":n==="live"?"в эфире":"опрос",o=r?new Date(r).toLocaleTimeString("ru-RU",{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-";return f.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("span",{className:n==="live"?"text-primary":"",children:l}),f.jsx("span",{className:"font-mono",children:o}),f.jsx("button",{type:"button",className:"rounded-md border border-border px-2 py-1 text-foreground",onClick:()=>t(!e),children:e?"Продолжить":"Пауза"})]})}var RH=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function OS(e){if(typeof e!="string")return!1;var t=RH;return t.includes(e)}var MH=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],DH=new Set(MH);function nD(e){return typeof e!="string"?!1:DH.has(e)}function rD(e){return typeof e=="string"&&e.startsWith("data-")}function Bi(e){if(typeof e!="object"||e===null)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(nD(n)||rD(n))&&(t[n]=e[n]);return t}function Lv(e){if(e==null)return null;if(b.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Bi(t)}return typeof e=="object"&&!Array.isArray(e)?Bi(e):null}function Xr(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(nD(n)||rD(n)||OS(n))&&(t[n]=e[n]);return t}function PH(e){return e==null?null:b.isValidElement(e)?Xr(e.props):typeof e=="object"&&!Array.isArray(e)?Xr(e):null}var kH=["children","width","height","viewBox","className","style","title","desc"];function X0(){return X0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,l=e.height,o=e.viewBox,u=e.className,c=e.style,h=e.title,m=e.desc,v=IH(e,kH),g=o||{width:r,height:l,x:0,y:0},x=Ct("recharts-surface",u);return b.createElement("svg",X0({},Xr(v),{className:x,width:r,height:l,style:c,viewBox:"".concat(g.x," ").concat(g.y," ").concat(g.width," ").concat(g.height),ref:t}),b.createElement("title",null,h),b.createElement("desc",null,m),n)}),LH=["children","className"];function Q0(){return Q0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,l=UH(e,LH),o=Ct("recharts-layer",r);return b.createElement("g",Q0({className:o},Xr(l),{ref:t}),n)});function Z0(e){return e==="__proto__"}const BH=Object.prototype.hasOwnProperty;function Pu(e,t){return BH.call(e,t)}const HH=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function aD(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e===""||e.startsWith(".")||e.endsWith(".")?!1:HH.test(e);default:return!1}}function Uv(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is(e==null||(t=e.valueOf)===null||t===void 0?void 0:t.call(e),-0)?"-0":String(e)}function NS(e){return typeof e=="symbol"||e instanceof Symbol}function lD(e){if(typeof e=="string")return e;if(Array.isArray(e)){let n="";for(let r=0;r0&&(n+=","),n+=lD(e[r]);return n}if(NS(e))return e.toString();const t=e+"";return t==="0"&&Object.is(Number(e),-0)?"-0":t}function FH(e){return e==null?"":lD(e)}function TS(e){if(Array.isArray(e))return e.map(Uv);if(typeof e=="symbol")return[e];e=FH(e);const t=[],n=e.length;if(n===0)return t;let r=0,l="",o="",u=!1,c=!1;const h=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push("");r1&&arguments[1]!==void 0?arguments[1]:GH,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Tn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var c=n[u-1];return typeof c=="string"?l+c+o:c!==void 0?l+ga(c)+o:l+o},"")}var Vr=e=>e===0?0:e>0?1:-1,Ea=e=>typeof e=="number"&&e!=+e,Vo=e=>typeof e=="string"&&e.length>1&&e.indexOf("%")===e.length-1,Re=e=>(typeof e=="number"||e instanceof Number)&&!Ea(e),Hi=e=>Re(e)||typeof e=="string",qH=0,Tf=e=>{var t=++qH;return"".concat(e||"").concat(t)},Pl=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Re(t)&&typeof t!="string")return r;var o;if(Vo(t)){if(n==null)return r;var u=t.indexOf("%");o=n*parseFloat(t.slice(0,u))/100}else o=+t;return Ea(o)&&(o=r),l&&n!=null&&o>n&&(o=n),o},oD=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):es(r,t))===n)}var yn=e=>e===null||typeof e>"u",RS=e=>yn(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function ur(e){return e!=null}function Ku(){}function MS(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function WA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Ei(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,l=r===void 0?0:r,o=e.parentViewBox,u=MS(t),c=u.x,h=u.y,m=u.height,v=u.upperWidth,g=u.lowerWidth,x=c,S=c+(v-g)/2,w=(x+S)/2,j=(v+g)/2,C=x+v/2,E=m>=0?1:-1,N=E*l,O=E>0?"end":"start",T=E>0?"start":"end",R=v>=0?1:-1,A=R*l,D=R>0?"end":"start",k=R>0?"start":"end",I=o;if(n==="top"){var P={x:x+v/2,y:h-N,horizontalAnchor:"middle",verticalAnchor:O};return I&&(P.height=Math.max(h-I.y,0),P.width=v),P}if(n==="bottom"){var B={x:S+g/2,y:h+m+N,horizontalAnchor:"middle",verticalAnchor:T};return I&&(B.height=Math.max(I.y+I.height-(h+m),0),B.width=g),B}if(n==="left"){var F={x:w-A,y:h+m/2,horizontalAnchor:D,verticalAnchor:"middle"};return I&&(F.width=Math.max(F.x-I.x,0),F.height=m),F}if(n==="right"){var se={x:w+j+A,y:h+m/2,horizontalAnchor:k,verticalAnchor:"middle"};return I&&(se.width=Math.max(I.x+I.width-se.x,0),se.height=m),se}var ue=I?{width:j,height:m}:{};return n==="insideLeft"?Ei({x:w+A,y:h+m/2,horizontalAnchor:k,verticalAnchor:"middle"},ue):n==="insideRight"?Ei({x:w+j-A,y:h+m/2,horizontalAnchor:D,verticalAnchor:"middle"},ue):n==="insideTop"?Ei({x:x+v/2,y:h+N,horizontalAnchor:"middle",verticalAnchor:T},ue):n==="insideBottom"?Ei({x:S+g/2,y:h+m-N,horizontalAnchor:"middle",verticalAnchor:O},ue):n==="insideTopLeft"?Ei({x:x+A,y:h+N,horizontalAnchor:k,verticalAnchor:T},ue):n==="insideTopRight"?Ei({x:x+v-A,y:h+N,horizontalAnchor:D,verticalAnchor:T},ue):n==="insideBottomLeft"?Ei({x:S+A,y:h+m-N,horizontalAnchor:k,verticalAnchor:O},ue):n==="insideBottomRight"?Ei({x:S+g-A,y:h+m-N,horizontalAnchor:D,verticalAnchor:O},ue):n&&typeof n=="object"&&(Re(n.x)||Vo(n.x))&&(Re(n.y)||Vo(n.y))?Ei({x:c+Pl(n.x,j),y:h+Pl(n.y,m),horizontalAnchor:"end",verticalAnchor:"end"},ue):Ei({x:C,y:h+m/2,horizontalAnchor:"middle",verticalAnchor:"middle"},ue)},ZH=["top","left","right","bottom"];function WH(e){return e==null?!1:typeof e=="object"?!0:ZH.includes(e)}var JH=b.createContext(null);const xf=Math.PI,W0=2*xf,yo=1e-6,eF=W0-yo;function uD(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return uD;const n=10**t;return function(r){this._+=r[0];for(let l=1,o=r.length;lyo)if(!(Math.abs(g*h-m*v)>yo)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let S=r-u,w=l-c,j=h*h+m*m,C=S*S+w*w,E=Math.sqrt(j),N=Math.sqrt(x),O=o*Math.tan((xf-Math.acos((j+x-C)/(2*E*N)))/2),T=O/N,R=O/E;Math.abs(T-1)>yo&&this._append`L${t+T*v},${n+T*g}`,this._append`A${o},${o},0,0,${+(g*S>v*w)},${this._x1=t+R*h},${this._y1=n+R*m}`}}arc(t,n,r,l,o,u){if(t=+t,n=+n,r=+r,u=!!u,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(l),h=r*Math.sin(l),m=t+c,v=n+h,g=1^u,x=u?l-o:o-l;if(this._x1===null?this._append`M${m},${v}`:(Math.abs(this._x1-m)>yo||Math.abs(this._y1-v)>yo)&&this._append`L${m},${v}`,!!r){if(x<0&&(x=x%W0+W0),x>eF)this._append`A${r},${r},0,1,${g},${t-c},${n-h}A${r},${r},0,1,${g},${this._x1=m},${this._y1=v}`;else if(x>yo){const S=t+r*Math.cos(o),w=n+r*Math.sin(o);if(x>=xf&&this._equal(m,v,S,w)){x/=2;let j=l+x;this._append`A${r},${r},0,${+(x>=xf)},${g},${t+r*Math.cos(j)},${n+r*Math.sin(j)}`}this._append`A${r},${r},0,${+(x>=xf)},${g},${this._x1=S},${this._y1=w}`}}}rect(t,n,r,l){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+l}h${-r}Z`}toString(){return this._}}function Ut(e){return function(){return e}}const JA=1e-12;function fD(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new rF(t)}function DS(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function dD(e){this._context=e}dD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function $v(e){return new dD(e)}function hD(e){return e[0]}function mD(e){return e[1]}function vD(e,t){var n=Ut(!0),r=null,l=$v,o=null,u=fD(c);e=typeof e=="function"?e:e===void 0?hD:Ut(e),t=typeof t=="function"?t:t===void 0?mD:Ut(t);function c(h){var m,v=(h=DS(h)).length,g,x=!1,S;for(r==null&&(o=l(S=u())),m=0;m<=v;++m)!(m=S;--w)c.point(O[w],T[w]);c.lineEnd(),c.areaEnd()}E&&(O[x]=+e(C,x,g),T[x]=+t(C,x,g),c.point(r?+r(C,x,g):O[x],n?+n(C,x,g):T[x]))}if(N)return c=null,N+""||null}function v(){return vD().defined(l).curve(u).context(o)}return m.x=function(g){return arguments.length?(e=typeof g=="function"?g:Ut(+g),r=null,m):e},m.x0=function(g){return arguments.length?(e=typeof g=="function"?g:Ut(+g),m):e},m.x1=function(g){return arguments.length?(r=g==null?null:typeof g=="function"?g:Ut(+g),m):r},m.y=function(g){return arguments.length?(t=typeof g=="function"?g:Ut(+g),n=null,m):t},m.y0=function(g){return arguments.length?(t=typeof g=="function"?g:Ut(+g),m):t},m.y1=function(g){return arguments.length?(n=g==null?null:typeof g=="function"?g:Ut(+g),m):n},m.lineX0=m.lineY0=function(){return v().x(e).y(t)},m.lineY1=function(){return v().x(e).y(n)},m.lineX1=function(){return v().x(r).y(t)},m.defined=function(g){return arguments.length?(l=typeof g=="function"?g:Ut(!!g),m):l},m.curve=function(g){return arguments.length?(u=g,o!=null&&(c=u(o)),m):u},m.context=function(g){return arguments.length?(g==null?o=c=null:c=u(o=g),m):o},m}class gD{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function iF(e){return new gD(e,!0)}function aF(e){return new gD(e,!1)}function kl(){}function Bm(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Bv(e){this._context=e}Bv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Bm(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Bm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function lF(e){return new Bv(e)}function pD(e){this._context=e}pD.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Bm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oF(e){return new pD(e)}function yD(e){this._context=e}yD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Bm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function sF(e){return new yD(e)}function xD(e,t){this._basis=new Bv(e),this._beta=t}xD.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],l=t[0],o=e[n]-r,u=t[n]-l,c=-1,h;++c<=n;)h=c/n,this._basis.point(this._beta*e[c]+(1-this._beta)*(r+h*o),this._beta*t[c]+(1-this._beta)*(l+h*u));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};(function e(t){function n(r){return t===1?new Bv(r):new xD(r,t)}return n.beta=function(r){return e(+r)},n})(.85);function Hm(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function PS(e,t){this._context=e,this._k=(1-t)/6}PS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Hm(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Hm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return new PS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function kS(e,t){this._context=e,this._k=(1-t)/6}kS.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Hm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return new kS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function IS(e,t){this._context=e,this._k=(1-t)/6}IS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Hm(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return new IS(r,t)}return n.tension=function(r){return e(+r)},n})(0);function zS(e,t,n){var r=e._x1,l=e._y1,o=e._x2,u=e._y2;if(e._l01_a>JA){var c=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,h=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*c-e._x0*e._l12_2a+e._x2*e._l01_2a)/h,l=(l*c-e._y0*e._l12_2a+e._y2*e._l01_2a)/h}if(e._l23_a>JA){var m=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,v=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*m+e._x1*e._l23_2a-t*e._l12_2a)/v,u=(u*m+e._y1*e._l23_2a-n*e._l12_2a)/v}e._context.bezierCurveTo(r,l,o,u,e._x2,e._y2)}function bD(e,t){this._context=e,this._alpha=t}bD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:zS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return t?new bD(r,t):new PS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function SD(e,t){this._context=e,this._alpha=t}SD.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:zS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return t?new SD(r,t):new kS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function wD(e,t){this._context=e,this._alpha=t}wD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:zS(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};(function e(t){function n(r){return t?new wD(r,t):new IS(r,0)}return n.alpha=function(r){return e(+r)},n})(.5);function jD(e){this._context=e}jD.prototype={areaStart:kl,areaEnd:kl,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function uF(e){return new jD(e)}function eO(e){return e<0?-1:1}function tO(e,t,n){var r=e._x1-e._x0,l=t-e._x1,o=(e._y1-e._y0)/(r||l<0&&-0),u=(n-e._y1)/(l||r<0&&-0),c=(o*l+u*r)/(r+l);return(eO(o)+eO(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(c))||0}function nO(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Ex(e,t,n){var r=e._x0,l=e._y0,o=e._x1,u=e._y1,c=(o-r)/3;e._context.bezierCurveTo(r+c,l+c*t,o-c,u-c*n,o,u)}function Fm(e){this._context=e}Fm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ex(this,this._t0,nO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Ex(this,nO(this,n=tO(this,e,t)),n);break;default:Ex(this,this._t0,n=tO(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function CD(e){this._context=new _D(e)}(CD.prototype=Object.create(Fm.prototype)).point=function(e,t){Fm.prototype.point.call(this,t,e)};function _D(e){this._context=e}_D.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,l,o){this._context.bezierCurveTo(t,e,r,n,o,l)}};function cF(e){return new Fm(e)}function fF(e){return new CD(e)}function ED(e){this._context=e}ED.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=rO(e),l=rO(t),o=0,u=1;u=0;--t)l[t]=(u[t]-l[t+1])/o[t];for(o[n-1]=(e[n]+l[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function hF(e){return new Hv(e,.5)}function mF(e){return new Hv(e,0)}function vF(e){return new Hv(e,1)}function Go(e,t){if((u=e.length)>1)for(var n=1,r,l,o=e[t[0]],u,c=o.length;n=0;)n[t]=t;return n}function gF(e,t){return e[t]}function pF(e){const t=[];return t.key=e,t}function yF(){var e=Ut([]),t=J0,n=Go,r=gF;function l(o){var u=Array.from(e.apply(this,arguments),pF),c,h=u.length,m=-1,v;for(const g of o)for(c=0,++m;c0){for(var n,r,l=0,o=e[0].length,u;l0){for(var n=0,r=e[t[0]],l,o=r.length;n0)||!((o=(l=e[t[0]]).length)>0))){for(var n=0,r=1,l,o,u;r"radius"in e&&"startAngle"in e&&"endAngle"in e,LS=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(b.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(l=>{OS(l)&&typeof n[l]=="function"&&(r[l]=(o=>n[l](n,o)))}),r},wF=(e,t,n)=>r=>(e(t,n,r),null),jF=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(l=>{var o=e[l];OS(l)&&typeof o=="function"&&(r||(r={}),r[l]=wF(o,t,n))}),r};function iO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function CF(e){for(var t=1;t(u[c]===void 0&&r[c]!==void 0&&(u[c]=r[c]),u),n);return o}function OF(e,t){const n=new Map;for(let r=0;r=0}function US(e){return e!=null&&typeof e!="function"&&TF(e.length)}function RF(e){return function(t){return es(t,e)}}function ND(e){return e==null||typeof e!="object"&&typeof e!="function"}function Io(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const TD="[object RegExp]",$S="[object String]",BS="[object Number]",HS="[object Boolean]",RD="[object Arguments]",MD="[object Symbol]",DD="[object Date]",PD="[object Map]",kD="[object Set]",ID="[object Array]",MF="[object Function]",zD="[object ArrayBuffer]",Nm="[object Object]",DF="[object Error]",LD="[object DataView]",UD="[object Uint8Array]",$D="[object Uint8ClampedArray]",BD="[object Uint16Array]",HD="[object Uint32Array]",PF="[object BigUint64Array]",FD="[object Int8Array]",VD="[object Int16Array]",GD="[object Int32Array]",kF="[object BigInt64Array]",qD="[object Float32Array]",KD="[object Float64Array]";function jf(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function YD(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function XD(e,t,n){return typeof n!="function"?XD(e,t,()=>{}):eb(e,t,function r(l,o,u,c,h,m){const v=n(l,o,u,c,h,m);return v!==void 0?!!v:eb(l,o,r,m,!1)},new Map,!0)}function eb(e,t,n,r,l=!1){if(t===e)return!0;switch(typeof t){case"object":return IF(e,t,n,r,l);case"function":return Object.keys(t).length>0?eb(e,Object.assign({},t),n,r,l):jf(e,t);default:return YD(e)&&l?typeof t=="string"?t==="":!0:jf(e,t)}}function IF(e,t,n,r,l=!1){if(t==null)return!0;if(Array.isArray(t))return QD(e,t,n,r);if(t instanceof Map)return zF(e,t,n,r);if(t instanceof Set)return LF(e,t,n,r);const o=Object.keys(t);if(e==null)return l&&o.length===0;if(l)ND(e)&&(e=Object(e));else{if(Io(t)==="[object Error]")return Io(e)==="[object Error]"&&e.name===t.name&&e.message===t.message;const u=Io(e);if(u!=="[object Object]"&&u!=="[object Arguments]")return!1}if(o.length===0)return!0;if(r!=null&&r.has(t))return r.get(t)===e;r==null||r.set(t,e);try{for(let u=0;u{})}function tb(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}const aO=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function nb(e){return typeof aO.Buffer<"u"&&aO.Buffer.isBuffer(e)}function UF(e){return nb(e)}function $F(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function BF(e){return $F(e)}function HF(e,t){return du(e,void 0,e,new Map)}function du(e,t,n,r,l){if(ND(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const u=new Array(e.length);r.set(e,u);for(let c=0;c{u.set(h,du(c,h,n,r))}),u}if(e instanceof Set){const u=new Set;return r.set(e,u),e.forEach(c=>{u.add(du(c,void 0,n,r))}),u}if(UF(e))return e.subarray();if(BF(e)){const u=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,u);for(let c=0;cZD(t,e)}const GF=/^(?:0|[1-9]\d*)$/;function JD(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:c;return Nx.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,Nx}var iO;function BF(){return iO||(iO=1,Ox.exports=$F()),Ox.exports}/**
+ */var oO;function WF(){if(oO)return Tx;oO=1;var e=Hu();function t(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,l=e.useEffect,o=e.useLayoutEffect,u=e.useDebugValue;function c(g,x){var S=x(),w=r({inst:{value:S,getSnapshot:x}}),j=w[0].inst,C=w[1];return o(function(){j.value=S,j.getSnapshot=x,h(j)&&C({inst:j})},[g,S,x]),l(function(){return h(j)&&C({inst:j}),g(function(){h(j)&&C({inst:j})})},[g]),u(S),S}function h(g){var x=g.getSnapshot;g=g.value;try{var S=x();return!n(g,S)}catch{return!0}}function m(g,x){return x()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:c;return Tx.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,Tx}var sO;function JF(){return sO||(sO=1,Nx.exports=WF()),Nx.exports}/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
@@ -114,12 +126,12 @@ Error generating stack: `+d.message+`
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var aO;function HF(){if(aO)return Ex;aO=1;var e=Hu(),t=BF();function n(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var r=typeof Object.is=="function"?Object.is:n,l=t.useSyncExternalStore,o=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return Ex.useSyncExternalStoreWithSelector=function(m,v,p,x,S){var w=o(null);if(w.current===null){var j={hasValue:!1,value:null};w.current=j}else j=w.current;w=c(function(){function A(E){if(!N){if(N=!0,O=E,E=x(E),S!==void 0&&j.hasValue){var D=j.value;if(S(D,E))return T=D}return T=E}if(D=T,r(O,E))return D;var k=x(E);return S!==void 0&&S(D,k)?(O=E,D):(O=E,T=k)}var N=!1,O,T,R=p===void 0?null:p;return[function(){return A(v())},R===null?void 0:function(){return A(R())}]},[v,p,x,S]);var C=l(m,w[0],w[1]);return u(function(){j.hasValue=!0,j.value=C},[C]),h(C),C},Ex}var lO;function FF(){return lO||(lO=1,Ax.exports=HF()),Ax.exports}var VF=FF(),BS=b.createContext(null),GF=e=>e,Vt=()=>{var e=b.useContext(BS);return e?e.store.dispatch:GF},Nm=()=>{},qF=()=>Nm,KF=(e,t)=>e===t;function ke(e){var t=b.useContext(BS),n=b.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Nm,[t,e]);return VF.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:qF,t?t.store.getState:Nm,t?t.store.getState:Nm,n,KF)}function YF(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function XF(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var oO=e=>Array.isArray(e)?e:[e];function QF(e){const t=Array.isArray(e[0])?e[0]:e;return XF(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ZF(e,t){const n=[],{length:r}=e;for(let l=0;ltypeof WeakRef>"u"?WF:WeakRef,XD=JF(),eV=0,sO=1;function rm(){return{s:eV,v:void 0,o:null,p:null}}function tV(e){return e instanceof XD?e.deref():e}function QD(e,t={}){let n=rm();const{resultEqualityCheck:r}=t;let l,o=0;function u(){let c=n;const{length:h}=arguments;for(let p=0,x=h;p{n=rm(),u.resetResultsCount()},u.resultsCount=()=>o,u.resetResultsCount=()=>{o=0},u}function nV(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...l)=>{let o=0,u=0,c,h={},m=l.pop();typeof m=="object"&&(h=m,m=l.pop()),YF(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);const v={...n,...h},{memoize:p,memoizeOptions:x=[],argsMemoize:S=QD,argsMemoizeOptions:w=[]}=v,j=oO(x),C=oO(w),A=QF(l),N=p(function(){return o++,m.apply(null,arguments)},...j),O=S(function(){u++;const R=ZF(A,arguments);return c=N.apply(null,R),c},...C);return Object.assign(O,{resultFunc:m,memoizedResultFunc:N,dependencies:A,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>c,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:p,argsMemoize:S})};return Object.assign(r,{withTypes:()=>r}),r}var W=nV(QD);function rV(e,t=1){const n=[],r=Math.floor(t),l=(o,u)=>{for(let c=0;c{if(e!==t){const r=uO(e),l=uO(t);if(r===l&&r===0){if(et)return n==="desc"?-1:1}return n==="desc"?l-r:r-l}return 0},lV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,oV=/^\w*$/;function sV(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||ES(e)?!0:typeof e=="string"&&(oV.test(e)||!lV.test(e))||t!=null}function uV(e,t,n,r){if(e==null)return[];n=n,Array.isArray(e)||(e=zS(e)?Array.from(e):iV(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(c=>String(c));const l=(c,h)=>{let m=c,v=0;for(;v0&&v===h.length?m:void 0},o=(c,h)=>{if(c==null)return h;if(h!=null)return typeof c=="object"&&"key"in c?Pu(h,c.key)?h[c.key]:l(h,c.path):typeof c=="function"?c(h):Array.isArray(c)?l(h,c):h[c]},u=t.map(c=>(Array.isArray(c)&&c.length===1&&(c=c[0]),c==null||typeof c=="function"||Array.isArray(c)||sV(c)?c:{key:c,path:OS(c)}));return e.map(c=>({original:c,criteria:u.map(h=>o(h,c))})).slice().sort((c,h)=>{for(let m=0;mc.original)}function Hv(e,...t){const n=t.length;return n>1&&nb(e,t[0],t[1])?t=[]:n>2&&nb(t[0],t[1],t[2])&&(t=[t[0]]),uV(e,rV(t),["asc"])}var ZD=e=>e.legend.settings,cV=e=>e.legend.size,fV=e=>e.legend.payload;W([fV,ZD],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Hv(r,n):r});function dV(e,t){return gV(e)||vV(e,t)||mV(e,t)||hV()}function hV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mV(e,t){if(e){if(typeof e=="string")return cO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cO(e,t):void 0}}function cO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nim||Math.abs(e.left-t.left)>im||Math.abs(e.top-t.top)>im||Math.abs(e.width-t.width)>im}function dO(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function pV(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=b.useState({height:0,left:0,top:0,width:0}),n=dV(t,2),r=n[0],l=n[1],o=b.useRef(null),u=b.useRef(r);u.current=r;var c=b.useCallback(h=>{if(o.current!=null&&(o.current.disconnect(),o.current=null),h!=null){var m=dO(h);if(fO(m,u.current)&&l(m),typeof ResizeObserver<"u"){var v=new ResizeObserver(()=>{var p=dO(h);fO(p,u.current)&&l(p)});v.observe(h),o.current=v}}},[...e]);return b.useEffect(()=>()=>{var h;(h=o.current)===null||h===void 0||h.disconnect()},[]),[r,c]}function Nn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var yV=typeof Symbol=="function"&&Symbol.observable||"@@observable",hO=yV,Tx=()=>Math.random().toString(36).substring(7).split("").join("."),xV={INIT:`@@redux/INIT${Tx()}`,REPLACE:`@@redux/REPLACE${Tx()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Tx()}`},Fm=xV;function HS(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function WD(e,t,n){if(typeof e!="function")throw new Error(Nn(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Nn(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Nn(1));return n(WD)(e,t)}let r=e,l=t,o=new Map,u=o,c=0,h=!1;function m(){u===o&&(u=new Map,o.forEach((C,A)=>{u.set(A,C)}))}function v(){if(h)throw new Error(Nn(3));return l}function p(C){if(typeof C!="function")throw new Error(Nn(4));if(h)throw new Error(Nn(5));let A=!0;m();const N=c++;return u.set(N,C),function(){if(A){if(h)throw new Error(Nn(6));A=!1,m(),u.delete(N),o=null}}}function x(C){if(!HS(C))throw new Error(Nn(7));if(typeof C.type>"u")throw new Error(Nn(8));if(typeof C.type!="string")throw new Error(Nn(17));if(h)throw new Error(Nn(9));try{h=!0,l=r(l,C)}finally{h=!1}return(o=u).forEach(N=>{N()}),C}function S(C){if(typeof C!="function")throw new Error(Nn(10));r=C,x({type:Fm.REPLACE})}function w(){const C=p;return{subscribe(A){if(typeof A!="object"||A===null)throw new Error(Nn(11));function N(){const T=A;T.next&&T.next(v())}return N(),{unsubscribe:C(N)}},[hO](){return this}}}return x({type:Fm.INIT}),{dispatch:x,subscribe:p,getState:v,replaceReducer:S,[hO]:w}}function bV(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Fm.INIT})>"u")throw new Error(Nn(12));if(typeof n(void 0,{type:Fm.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Nn(13))})}function JD(e){const t=Object.keys(e),n={};for(let o=0;o"u")throw c&&c.type,new Error(Nn(14));m[p]=w,h=h||w!==S}return h=h||r.length!==Object.keys(u).length,h?m:u}}function Vm(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function SV(...e){return t=>(n,r)=>{const l=t(n,r);let o=()=>{throw new Error(Nn(15))};const u={getState:l.getState,dispatch:(h,...m)=>o(h,...m)},c=e.map(h=>h(u));return o=Vm(...c)(l.dispatch),{...l,dispatch:o}}}function eP(e){return HS(e)&&"type"in e&&typeof e.type=="string"}var tP=Symbol.for("immer-nothing"),mO=Symbol.for("immer-draftable"),Bn=Symbol.for("immer-state");function si(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ar=Object,ku=Ar.getPrototypeOf,Gm="constructor",Fv="prototype",rb="configurable",qm="enumerable",Tm="writable",Rf="value",Ea=e=>!!e&&!!e[Bn];function Qr(e){var t;return e?nP(e)||Gv(e)||!!e[mO]||!!((t=e[Gm])!=null&&t[mO])||qv(e)||Jf(e):!1}var wV=Ar[Fv][Gm].toString(),vO=new WeakMap;function nP(e){if(!e||!FS(e))return!1;const t=ku(e);if(t===null||t===Ar[Fv])return!0;const n=Ar.hasOwnProperty.call(t,Gm)&&t[Gm];if(n===Object)return!0;if(!su(n))return!1;let r=vO.get(n);return r===void 0&&(r=Function.toString.call(n),vO.set(n,r)),r===wV}function Vv(e,t,n=!0){Wf(e)===0?(n?Reflect.ownKeys(e):Ar.keys(e)).forEach(l=>{t(l,e[l],e)}):e.forEach((r,l)=>t(l,r,e))}function Wf(e){const t=e[Bn];return t?t.type_:Gv(e)?1:qv(e)?2:Jf(e)?3:0}var Rx=(e,t,n=Wf(e))=>n===2?e.has(t):Ar[Fv].hasOwnProperty.call(e,t),ib=(e,t,n=Wf(e))=>n===2?e.get(t):e[t],Km=(e,t,n,r=Wf(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function jV(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Gv=Array.isArray,qv=e=>e instanceof Map,Jf=e=>e instanceof Set,FS=e=>typeof e=="object",su=e=>typeof e=="function",Mx=e=>typeof e=="boolean";function CV(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var da=e=>e.copy_||e.base_,VS=e=>e.modified_?e.copy_:e.base_;function ab(e,t){if(qv(e))return new Map(e);if(Jf(e))return new Set(e);if(Gv(e))return Array[Fv].slice.call(e);const n=nP(e);if(t===!0||t==="class_only"&&!n){const r=Ar.getOwnPropertyDescriptors(e);delete r[Bn];let l=Reflect.ownKeys(r);for(let o=0;o1&&Ar.defineProperties(e,{set:am,add:am,clear:am,delete:am}),Ar.freeze(e),t&&Vv(e,(n,r)=>{GS(r,!0)},!1)),e}function _V(){si(2)}var am={[Rf]:_V};function Kv(e){return e===null||!FS(e)?!0:Ar.isFrozen(e)}var Ym="MapSet",lb="Patches",gO="ArrayMethods",rP={};function qo(e){const t=rP[e];return t||si(0,e),t}var pO=e=>!!rP[e],Mf,iP=()=>Mf,AV=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:pO(Ym)?qo(Ym):void 0,arrayMethodsPlugin_:pO(gO)?qo(gO):void 0});function yO(e,t){t&&(e.patchPlugin_=qo(lb),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ob(e){sb(e),e.drafts_.forEach(EV),e.drafts_=null}function sb(e){e===Mf&&(Mf=e.parent_)}var xO=e=>Mf=AV(Mf,e);function EV(e){const t=e[Bn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function bO(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Bn].modified_&&(ob(t),si(4)),Qr(e)&&(e=SO(t,e));const{patchPlugin_:l}=t;l&&l.generateReplacementPatches_(n[Bn].base_,e,t)}else e=SO(t,n);return OV(t,e,!0),ob(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==tP?e:void 0}function SO(e,t){if(Kv(t))return t;const n=t[Bn];if(!n)return Xm(t,e.handledSet_,e);if(!Yv(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);oP(n,e)}return n.copy_}function OV(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&GS(t,n)}function aP(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Yv=(e,t)=>e.scope_===t,NV=[];function lP(e,t,n,r){const l=da(e),o=e.type_;if(r!==void 0&&ib(l,r,o)===t){Km(l,r,n,o);return}if(!e.draftLocations_){const c=e.draftLocations_=new Map;Vv(l,(h,m)=>{if(Ea(m)){const v=c.get(m)||[];v.push(h),c.set(m,v)}})}const u=e.draftLocations_.get(t)??NV;for(const c of u)Km(l,c,n,o)}function TV(e,t,n){e.callbacks_.push(function(l){var c;const o=t;if(!o||!Yv(o,l))return;(c=l.mapSetPlugin_)==null||c.fixSetContents(o);const u=VS(o);lP(e,o.draft_??o,u,n),oP(o,l)})}function oP(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:l}=t;if(l){const o=l.getPath(e);o&&l.generatePatches_(e,o,t)}aP(e)}}function RV(e,t,n){const{scope_:r}=e;if(Ea(n)){const l=n[Bn];Yv(l,r)&&l.callbacks_.push(function(){Rm(e);const u=VS(l);lP(e,n,u,t)})}else Qr(n)&&e.callbacks_.push(function(){const o=da(e);e.type_===3?o.has(n)&&Xm(n,r.handledSet_,r):ib(o,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Xm(ib(e.copy_,t,e.type_),r.handledSet_,r)})}function Xm(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ea(e)||t.has(e)||!Qr(e)||Kv(e)||(t.add(e),Vv(e,(r,l)=>{if(Ea(l)){const o=l[Bn];if(Yv(o,n)){const u=VS(o);Km(e,r,u,e.type_),aP(o)}}else Qr(l)&&Xm(l,t,n)})),e}function MV(e,t){const n=Gv(e),r={type_:n?1:0,scope_:t?t.scope_:iP(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let l=r,o=Qm;n&&(l=[r],o=Df);const{revoke:u,proxy:c}=Proxy.revocable(l,o);return r.draft_=c,r.revoke_=u,[c,r]}var Qm={get(e,t){if(t===Bn)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const l=da(e);if(!Rx(l,t,e.type_))return PV(e,l,t);const o=l[t];if(e.finalized_||!Qr(o)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&CV(t))return o;if(o===Dx(e.base_,t)||DV(e,t,o)){Rm(e);const u=e.type_===1?+t:t,c=cb(e.scope_,o,e,u);return e.copy_[u]=c}return o},has(e,t){return t in da(e)},ownKeys(e){return Reflect.ownKeys(da(e))},set(e,t,n){const r=sP(da(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const l=Dx(da(e),t),o=l==null?void 0:l[Bn];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(jV(n,l)&&(n!==void 0||Rx(e.base_,t,e.type_)))return!0;Rm(e),ub(e)}return e.copy_[t]===n&&(n!==void 0||Rx(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),RV(e,t,n)),!0},deleteProperty(e,t){return Rm(e),Dx(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),ub(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=da(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Tm]:!0,[rb]:e.type_!==1||t!=="length",[qm]:r[qm],[Rf]:n[t]}},defineProperty(){si(11)},getPrototypeOf(e){return ku(e.base_)},setPrototypeOf(){si(12)}},Df={};for(let e in Qm){let t=Qm[e];Df[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Df.deleteProperty=function(e,t){return Df.set.call(this,e,t,void 0)};Df.set=function(e,t,n){return Qm.set.call(this,e[0],t,n,e[0])};function Dx(e,t){const n=e[Bn];return(n?da(n):e)[t]}function DV(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!Qr(n)||n[Bn]?!1:e.baseRefs_.has(n)}function PV(e,t,n){var l;const r=sP(t,n);return r?Rf in r?r[Rf]:(l=r.get)==null?void 0:l.call(e.draft_):void 0}function sP(e,t){if(!(t in e))return;let n=ku(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ku(n)}}function ub(e){e.modified_||(e.modified_=!0,e.parent_&&ub(e.parent_))}function Rm(e){e.copy_||(e.assigned_=new Map,e.copy_=ab(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kV=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,l)=>{if(su(n)&&!su(r)){const u=r;r=n;const c=this;return function(m=u,...v){return c.produce(m,p=>r.call(this,p,...v))}}su(r)||si(6),l!==void 0&&!su(l)&&si(7);let o;if(Qr(n)){const u=xO(this),c=cb(u,n,void 0);let h=!0;try{o=r(c),h=!1}finally{h?ob(u):sb(u)}return yO(u,l),bO(o,u)}else if(!n||!FS(n)){if(o=r(n),o===void 0&&(o=n),o===tP&&(o=void 0),this.autoFreeze_&&GS(o,!0),l){const u=[],c=[];qo(lb).generateReplacementPatches_(n,o,{patches_:u,inversePatches_:c}),l(u,c)}return o}else si(1,n)},this.produceWithPatches=(n,r)=>{if(su(n))return(c,...h)=>this.produceWithPatches(c,m=>n(m,...h));let l,o;return[this.produce(n,r,(c,h)=>{l=c,o=h}),l,o]},Mx(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze);const t=e==null?void 0:e.useStrictShallowCopy;(Mx(t)||t==="class_only")&&this.setUseStrictShallowCopy(t),Mx(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Qr(e)||si(8),Ea(e)&&(e=Gr(e));const t=xO(this),n=cb(t,e,void 0);return n[Bn].isManual_=!0,sb(t),n}finishDraft(e,t){const n=e&&e[Bn];(!n||!n.isManual_)&&si(9);const{scope_:r}=n;return yO(r,t),bO(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const l=t[n];if(l.path.length===0&&l.op==="replace"){e=l.value;break}}n>-1&&(t=t.slice(n+1));const r=qo(lb).applyPatches_;return Ea(e)?r(e,t):this.produce(e,l=>r(l,t))}};function cb(e,t,n,r){const[l,o]=qv(t)?qo(Ym).proxyMap_(t,n):Jf(t)?qo(Ym).proxySet_(t,n):MV(t,n);return((n==null?void 0:n.scope_)??iP()).drafts_.push(l),o.callbacks_=(n==null?void 0:n.callbacks_)??[],o.key_=r,n&&r!==void 0?TV(n,o,r):o.callbacks_.push(function(h){var v;(v=h.mapSetPlugin_)==null||v.fixSetContents(o);const{patchPlugin_:m}=h;o.modified_&&m&&m.generatePatches_(o,[],h)}),l}function Gr(e){return Ea(e)||si(10,e),uP(e)}function uP(e){if(!Qr(e)||Kv(e))return e;const t=e[Bn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ab(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ab(e,!0);const l=n;return Jf(n)&&(n=new Set),Vv(l,(o,u)=>{Km(n,o,uP(u))},r),t&&(t.finalized_=!1),n}var Px=globalThis.Iterator;Px==null||Px.from;var IV=new kV,cP=IV.produce,rt=e=>e;function fP(e){return({dispatch:n,getState:r})=>l=>o=>typeof o=="function"?o(n,r,e):l(o)}var zV=fP(),LV=fP;const UV=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Vm:Vm.apply(null,arguments)};function Er(e,t){function n(...r){if(t){let l=t(...r);if(!l)throw new Error(cr(0));return{type:e,payload:l.payload,..."meta"in l&&{meta:l.meta},..."error"in l&&{error:l.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>r!=null&&r.type===e&&eP(r),n}var dP=class bf extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,bf.prototype)}static get[Symbol.species](){return bf}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new bf(...t[0].concat(this)):new bf(...t.concat(this))}};function wO(e){return Qr(e)?cP(e,()=>{}):e}function lm(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function $V(e){return typeof e=="boolean"}const BV=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:l=!0,actionCreatorCheck:o=!0}=t??{};let u=new dP;return n&&($V(n)?u.push(zV):u.push(LV(n.extraArgument))),u},hP="RTK_autoBatch",Ot=()=>e=>({payload:e,meta:{[hP]:!0}}),jO=e=>t=>{setTimeout(t,e)},HV=(e,t,n)=>r=>{let l=!1,o,u;const c=()=>{l||(l=!0,t==null||t(o),clearTimeout(u),r())};o=e(c),u=setTimeout(c,n)},mP=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let l=!0,o=!1,u=!1;const c=new Set,h=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?HV(window.requestAnimationFrame,window.cancelAnimationFrame,100):jO(10):e.type==="callback"?e.queueNotification:jO(e.timeout),m=()=>{u=!1,o&&(o=!1,c.forEach(v=>v()))};return Object.assign({},r,{subscribe(v){const p=()=>l&&v(),x=r.subscribe(p);return c.add(v),()=>{x(),c.delete(v)}},dispatch(v){var p;try{return l=!((p=v==null?void 0:v.meta)!=null&&p[hP]),o=!l,o&&(u||(u=!0,h(m))),r.dispatch(v)}finally{l=!0}}})},FV=e=>function(n){const{autoBatch:r=!0}=n??{};let l=new dP(e);return r&&l.push(mP(typeof r=="object"?r:void 0)),l};function VV(e){const t=BV(),{reducer:n=void 0,middleware:r,devTools:l=!0,preloadedState:o=void 0,enhancers:u=void 0}=e||{};let c;if(typeof n=="function")c=n;else if(HS(n))c=JD(n);else throw new Error(cr(1));let h;typeof r=="function"?h=r(t):h=t();let m=Vm;l&&(m=UV({trace:!1,...typeof l=="object"&&l}));const v=SV(...h),p=FV(v);let x=typeof u=="function"?u(p):p();const S=m(...x);return WD(c,o,S)}function vP(e){const t={},n=[];let r;const l={addCase(o,u){const c=typeof o=="string"?o:o.type;if(!c)throw new Error(cr(28));if(c in t)throw new Error(cr(29));return t[c]=u,l},addAsyncThunk(o,u){return u.pending&&(t[o.pending.type]=u.pending),u.rejected&&(t[o.rejected.type]=u.rejected),u.fulfilled&&(t[o.fulfilled.type]=u.fulfilled),u.settled&&n.push({matcher:o.settled,reducer:u.settled}),l},addMatcher(o,u){return n.push({matcher:o,reducer:u}),l},addDefaultCase(o){return r=o,l}};return e(l),[t,n,r]}function GV(e){return typeof e=="function"}function qV(e,t){let[n,r,l]=vP(t),o;if(GV(e))o=()=>wO(e());else{const h=wO(e);o=()=>h}function u(h,m,v){if(Ea(h)){const p=m(h,v);return p===void 0?h:p}else{if(Qr(h))return cP(h,p=>m(p,v));{const p=m(h,v);if(p===void 0){if(h===null)return h;throw new Error(cr(9))}return p}}}function c(h=o(),m){const v=n[m.type];let p;for(const{matcher:x,reducer:S}of r)x(m)&&S&&(p??(p=[])).push(S);if(!v&&!p)return l?u(h,l,m):h;if(v&&(h=u(h,v,m)),p)for(const x of p)h=u(h,x,m);return h}return c.getInitialState=o,c}let KV="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",YV=(e=21)=>{let t="",n=e;for(;n--;)t+=KV[Math.random()*64|0];return t};const XV=Symbol.for("rtk-slice-createasyncthunk");function QV(e,t){return`${e}/${t}`}function ZV({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[XV];return function(l){const{name:o,reducerPath:u=o}=l;if(!o)throw new Error(cr(11));const c=(typeof l.reducers=="function"?l.reducers(JV()):l.reducers)||{},h=Object.keys(c),m={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},v={addCase(T,R){const E=typeof T=="string"?T:T.type;if(!E)throw new Error(cr(12));if(E in m.sliceCaseReducersByType)throw new Error(cr(13));return m.sliceCaseReducersByType[E]=R,v},addMatcher(T,R){return m.sliceMatchers.push({matcher:T,reducer:R}),v},exposeAction(T,R){return m.actionCreators[T]=R,v},exposeCaseReducer(T,R){return m.sliceCaseReducersByName[T]=R,v}};h.forEach(T=>{const R=c[T],E={reducerName:T,type:QV(o,T),createNotation:typeof l.reducers=="function"};t9(R)?r9(E,R,v,t):e9(E,R,v)});function p(){const[T={},R=[],E=void 0]=typeof l.extraReducers=="function"?vP(l.extraReducers):[l.extraReducers],D={...T,...m.sliceCaseReducersByType};return qV(l.initialState,k=>{for(let I in D)k.addCase(I,D[I]);for(let I of m.sliceMatchers)k.addMatcher(I.matcher,I.reducer);for(let I of R)k.addMatcher(I.matcher,I.reducer);E&&k.addDefaultCase(E)})}const x=T=>T,S=new Map,w=new WeakMap;let j;function C(T,R){return j||(j=p()),j(T,R)}function A(){return j||(j=p()),j.getInitialState()}function N(T,R=!1){function E(k){let I=k[T];return typeof I>"u"&&R&&(I=lm(w,E,A)),I}function D(k=x){return lm(lm(S,R,()=>new WeakMap),k,()=>{const I={};for(const[P,B]of Object.entries(l.selectors??{}))I[P]=WV(B,k,()=>lm(w,k,A),R);return I})}return{reducerPath:T,getSelectors:D,get selectors(){return D(E)},selectSlice:E}}const O={name:o,reducer:C,actions:m.actionCreators,caseReducers:m.sliceCaseReducersByName,getInitialState:A,...N(u),injectInto(T,{reducerPath:R,...E}={}){const D=R??u;return T.inject({reducerPath:D,reducer:C},E),{...O,...N(D,!0)}}};return O}}function WV(e,t,n,r){function l(o,...u){let c=t(o);return typeof c>"u"&&r&&(c=n()),e(c,...u)}return l.unwrapped=e,l}const Hn=ZV();function JV(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function e9({type:e,reducerName:t,createNotation:n},r,l){let o,u;if("reducer"in r){if(n&&!n9(r))throw new Error(cr(17));o=r.reducer,u=r.prepare}else o=r;l.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,u?Er(e,u):Er(e))}function t9(e){return e._reducerDefinitionType==="asyncThunk"}function n9(e){return e._reducerDefinitionType==="reducerWithPrepare"}function r9({type:e,reducerName:t},n,r,l){if(!l)throw new Error(cr(18));const{payloadCreator:o,fulfilled:u,pending:c,rejected:h,settled:m,options:v}=n,p=l(e,o,v);r.exposeAction(t,p),u&&r.addCase(p.fulfilled,u),c&&r.addCase(p.pending,c),h&&r.addCase(p.rejected,h),m&&r.addMatcher(p.settled,m),r.exposeCaseReducer(t,{fulfilled:u||om,pending:c||om,rejected:h||om,settled:m||om})}function om(){}const i9="task",gP="listener",pP="completed",qS="cancelled",a9=`task-${qS}`,l9=`task-${pP}`,fb=`${gP}-${qS}`,o9=`${gP}-${pP}`;var Xv=class{constructor(e){Kh(this,"code");Kh(this,"name","TaskAbortError");Kh(this,"message");this.code=e,this.message=`${i9} ${qS} (reason: ${e})`}};const KS=(e,t)=>{if(typeof e!="function")throw new TypeError(cr(32))},Zm=()=>{},YS=(e,t=Zm)=>(e.catch(t),e),yP=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zo=e=>{if(e.aborted)throw new Xv(e.reason)};function xP(e,t){let n=Zm;return new Promise((r,l)=>{const o=()=>l(new Xv(e.reason));if(e.aborted){o();return}n=yP(e,o),t.finally(()=>n()).then(r,l)}).finally(()=>{n=Zm})}const s9=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Xv?"cancelled":"rejected",error:n}}finally{t==null||t()}},Wm=e=>t=>YS(xP(e,t).then(n=>(zo(e),n))),bP=e=>{const t=Wm(e);return n=>{let r;return YS(t(new Promise(l=>{r=setTimeout(l,n)})).finally(()=>clearTimeout(r)))}},{assign:mu}=Object,CO={},Qv="listenerMiddleware",u9=(e,t)=>{const n=r=>yP(e,()=>r.abort(e.reason));return(r,l)=>{KS(r);const o=new AbortController;n(o);const u=s9(async()=>{zo(e),zo(o.signal);const c=await r({pause:Wm(o.signal),delay:bP(o.signal),signal:o.signal});return zo(o.signal),c},()=>o.abort(l9));return l!=null&&l.autoJoin&&t.push(u.catch(Zm)),{result:Wm(e)(u),cancel(){o.abort(a9)}}}},c9=(e,t)=>{const n=async(r,l)=>{zo(t);let o=()=>{};const u=[new Promise((h,m)=>{let v=e({predicate:r,effect:(p,x)=>{x.unsubscribe(),h([p,x.getState(),x.getOriginalState()])}});o=()=>{v(),m()}})];let c;l!=null&&u.push(new Promise(h=>{c=setTimeout(h,l,null)}));try{const h=await xP(t,Promise.race(u));return zo(t),h}finally{clearTimeout(c),o()}};return((r,l)=>YS(n(r,l)))},SP=e=>{let{type:t,actionCreator:n,matcher:r,predicate:l,effect:o}=e;if(t)l=Er(t).match;else if(n)t=n.type,l=n.match;else if(r)l=r;else if(!l)throw new Error(cr(21));return KS(o),{predicate:l,type:t,effect:o}},wP=mu(e=>{const{type:t,predicate:n,effect:r}=SP(e);return{id:YV(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(cr(22))}}},{withTypes:()=>wP}),_O=(e,t)=>{const{type:n,effect:r,predicate:l}=SP(t);return Array.from(e.values()).find(o=>(typeof n=="string"?o.type===n:o.predicate===l)&&o.effect===r)},db=e=>{e.pending.forEach(t=>{t.abort(fb)})},f9=(e,t)=>()=>{for(const n of t.keys())db(n);e.clear()},AO=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},jP=mu(Er(`${Qv}/add`),{withTypes:()=>jP}),d9=Er(`${Qv}/removeAll`),CP=mu(Er(`${Qv}/remove`),{withTypes:()=>CP}),h9=(...e)=>{console.error(`${Qv}/error`,...e)},ed=(e={})=>{const t=new Map,n=new Map,r=A=>{const N=n.get(A)??0;n.set(A,N+1)},l=A=>{const N=n.get(A)??1;N===1?n.delete(A):n.set(A,N-1)},{extra:o,onError:u=h9}=e;KS(u);let c;const h=()=>{if(!c){const A=Array.from(t.values()),N=new Set;let O=!1;for(const T of A)typeof T.type=="string"?N.add(T.type):O=!0;c={entries:A,types:N,anyType:O}}return c},m=A=>{t.has(A.id)||(t.set(A.id,A),c=void 0)},v=A=>(A.unsubscribe=()=>{t.delete(A.id)&&(c=void 0)},m(A),N=>{A.unsubscribe(),N!=null&&N.cancelActive&&db(A)}),p=(A=>{const N=_O(t,A)??wP(A);return v(N)});mu(p,{withTypes:()=>p});const x=A=>{const N=_O(t,A);return N&&(N.unsubscribe(),A.cancelActive&&db(N)),!!N};mu(x,{withTypes:()=>x});const S=async(A,N,O,T)=>{const R=new AbortController,E=c9(p,R.signal),D=[];try{A.pending.add(R),r(A),await Promise.resolve(A.effect(N,mu({},O,{getOriginalState:T,condition:(k,I)=>E(k,I).then(Boolean),take:E,delay:bP(R.signal),pause:Wm(R.signal),extra:o,signal:R.signal,fork:u9(R.signal,D),unsubscribe:A.unsubscribe,subscribe:()=>{m(A)},cancelActiveListeners:()=>{A.pending.forEach((k,I,P)=>{k!==R&&(k.abort(fb),P.delete(k))})},cancel:()=>{R.abort(fb),A.pending.delete(R)},throwIfCancelled:()=>{zo(R.signal)}})))}catch(k){k instanceof Xv||AO(u,k,{raisedBy:"effect"})}finally{await Promise.all(D),R.abort(o9),l(A),A.pending.delete(R)}},w=f9(t,n),j=()=>{w(),c=void 0};return{middleware:A=>N=>O=>{if(!eP(O))return N(O);if(jP.match(O))return p(O.payload);if(d9.match(O)){j();return}if(CP.match(O))return x(O.payload);let T=A.getState();const R=()=>{if(T===CO)throw new Error(cr(23));return T};let E;try{E=N(O);const{entries:D,types:k,anyType:I}=h();if(I||k.has(O.type)){const P=A.getState();for(const B of D){if(typeof B.type=="string"&&B.type!==O.type)continue;let F=!1;try{F=B.predicate(O,P,T)}catch(se){F=!1,AO(u,se,{raisedBy:"predicate"})}F&&S(B,O,A,R)}}}finally{T=CO}return E},startListening:p,stopListening:x,clearListeners:j}};function cr(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var m9={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},_P=Hn({name:"chartLayout",initialState:m9,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,l,o;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(l=t.payload.bottom)!==null&&l!==void 0?l:0,e.margin.left=(o=t.payload.left)!==null&&o!==void 0?o:0},setScale(e,t){e.scale=t.payload}}}),Zv=_P.actions,v9=Zv.setMargin,g9=Zv.setLayout,p9=Zv.setChartSize,y9=Zv.setScale,x9=_P.reducer;function AP(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function it(e){return Number.isFinite(e)}function Fi(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function EO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function or(e){for(var t=1;t{if(t&&n){var r=n.width,l=n.height,o=t.align,u=t.verticalAlign,c=t.layout,h=t.position,m=t.offset,v=m===void 0?0:m;if(h!=null){if($H(h)){if(h==="top"&&Re(e.top))return or(or({},e),{},{top:e.top+(l||0)+v});if(h==="bottom"&&Re(e.bottom))return or(or({},e),{},{bottom:e.bottom+(l||0)+v});if(h==="left"&&Re(e.left))return or(or({},e),{},{left:e.left+(r||0)+v});if(h==="right"&&Re(e.right))return or(or({},e),{},{right:e.right+(r||0)+v})}return e}if((c==="vertical"||c==="horizontal"&&u==="middle")&&o!=="center"&&Re(e[o]))return or(or({},e),{},{[o]:e[o]+(r||0)});if((c==="horizontal"||c==="vertical"&&o==="center")&&u!=="middle"&&Re(e[u]))return or(or({},e),{},{[u]:e[u]+(l||0)})}return e},Ra=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",EP=(e,t,n,r)=>{if(r)return e.map(c=>c.coordinate);var l,o,u=e.map(c=>(c.coordinate===t&&(l=!0),c.coordinate===n&&(o=!0),c.coordinate));return l||u.push(t),o||u.push(n),u},OP=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,l=e.type,o=e.range,u=e.scale,c=e.realScaleType,h=e.isCategorical,m=e.categoricalDomain,v=e.tickCount,p=e.ticks,x=e.niceTicks,S=e.axisType;if(!u)return null;var w=c==="scaleBand"&&u.bandwidth?u.bandwidth()/2:2,j=l==="category"&&u.bandwidth?u.bandwidth()/w:0;if(j=S==="angleAxis"&&o&&o.length>=2?Vr(o[0]-o[1])*2*j:j,p||x){var C=(p||x||[]).map((A,N)=>{var O=r?r.indexOf(A):A,T=u.map(O);return it(T)?{coordinate:T+j,value:A,offset:j,index:N}:null}).filter(ur);return C}return h&&m?m.map((A,N)=>{var O=u.map(A);return it(O)?{coordinate:O+j,value:A,index:N,offset:j}:null}).filter(ur):u.ticks&&v!=null?u.ticks(v).map((A,N)=>{var O=u.map(A);return it(O)?{coordinate:O+j,value:A,index:N,offset:j}:null}).filter(ur):u.domain().map((A,N)=>{var O=u.map(A);return it(O)?{coordinate:O+j,value:r?r[A]:A,index:N,offset:j}:null}).filter(ur)},C9=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var l=0;l=0?(m[0]=o,o+=x,m[1]=o):(m[0]=u,u+=x,m[1]=u)}}}},_9=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var l=0;l=0?(h[0]=o,o+=m,h[1]=o):(h[0]=0,h[1]=0)}}}},A9={sign:C9,expand:oF,none:Go,silhouette:sF,wiggle:uF,positive:_9},E9=(e,t,n)=>{var r,l=(r=A9[n])!==null&&r!==void 0?r:Go,o=lF().keys(t).value((c,h)=>Number(pn(c,h,0))).order(W0).offset(l),u=o(e);return u.forEach((c,h)=>{c.forEach((m,v)=>{var p=pn(e[v],t[h],0);Array.isArray(p)&&p.length===2&&Re(p[0])&&Re(p[1])&&(m[0]=p[0],m[1]=p[1])})}),u};function OO(e){var t=e.axis,n=e.ticks,r=e.bandSize,l=e.entry,o=e.index,u=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!yn(l[t.dataKey])){var c=rD(n,"value",l[t.dataKey]);if(c)return c.coordinate+r/2}return n!=null&&n[o]?n[o].coordinate+r/2:null}var h=pn(l,yn(u)?t.dataKey:u),m=t.scale.map(h);return Re(m)?m:null}var O9=e=>{var t=e.flat(2).filter(Re);return[Math.min(...t),Math.max(...t)]},N9=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],T9=(e,t,n)=>{if(!(e==null||Object.keys(e).length===0))return N9(Object.keys(e).reduce((r,l)=>{var o=e[l];if(!o)return r;var u=o.stackedData,c=u.reduce((h,m)=>{var v=AP(m,t,n),p=O9(v);return!it(p[0])||!it(p[1])?h:[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);return[Math.min(c[0],r[0]),Math.max(c[1],r[1])]},[1/0,-1/0]))},NO=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,TO=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Jm=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var l=Hv(t,j=>j.coordinate),o=[],u=0,c=1,h=l.length;cx&&(S=Math.min(w,S));return S===1/0?0:S}return n?void 0:0};function RO(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,l=e.value,o=e.name;return or(or({},t),{},{dataKey:n,payload:r,value:l,name:o})}function NP(e,t){if(e!=null)return String(e);if(typeof t=="string")return t}var R9=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},M9=(e,t)=>t==="centric"?e.angle:e.radius,Ma=e=>e.layout.width,Da=e=>e.layout.height,D9=e=>e.layout.scale,TP=e=>e.layout.margin,Wv=W(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Jv=W(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),P9="data-recharts-item-index",k9="data-recharts-item-id",td=60,XS=30;function MO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function sm(e){for(var t=1;te.brush.height;function $9(e){var t=Jv(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var l=typeof r.width=="number"?r.width:td;return n+l}return n},0)}function B9(e){var t=Jv(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var l=typeof r.width=="number"?r.width:td;return n+l}return n},0)}function H9(e){var t=Wv(e);return t.reduce((n,r)=>{if(r.orientation==="top"&&!r.mirror&&!r.hide){var l=typeof r.height=="number"?r.height:XS;return n+l}return n},0)}function F9(e){var t=Wv(e);return t.reduce((n,r)=>{if(r.orientation==="bottom"&&!r.mirror&&!r.hide){var l=typeof r.height=="number"?r.height:XS;return n+l}return n},0)}var Pn=W([Ma,Da,TP,U9,$9,B9,H9,F9,ZD,cV],(e,t,n,r,l,o,u,c,h,m)=>{var v={left:(n.left||0)+l,right:(n.right||0)+o},p={top:(n.top||0)+u,bottom:(n.bottom||0)+c},x=sm(sm({},p),v),S=x.bottom;x.bottom+=r,x=j9(x,h,m);var w=e-x.left-x.right,j=t-x.top-x.bottom;return sm(sm({brushBottom:S},x),{},{width:Math.max(w,0),height:Math.max(j,0)})}),V9=W(Pn,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),RP=W(Ma,Da,(e,t)=>({x:0,y:0,width:e,height:t})),G9=b.createContext(null),fr=()=>b.useContext(G9)!=null,eg=e=>e.brush,tg=W([eg,Pn,TP],(e,t,n)=>({height:e.height,x:Re(e.x)?e.x:t.left,y:Re(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:Re(e.width)?e.width:t.width}));function q9(e,t,{signal:n,edges:r}={}){let l,o=null;const u=r!=null&&r.includes("leading"),c=r==null||r.includes("trailing"),h=()=>{o!==null&&(e.apply(l,o),l=void 0,o=null)},m=()=>{c&&h(),S()};let v=null;const p=()=>{v!=null&&clearTimeout(v),v=setTimeout(()=>{v=null,m()},t)},x=()=>{v!==null&&(clearTimeout(v),v=null)},S=()=>{x(),l=void 0,o=null},w=()=>{h()},j=function(...C){if(n!=null&&n.aborted)return;l=this,o=C;const A=v==null;p(),u&&A&&h()};return j.schedule=p,j.cancel=S,j.flush=w,n==null||n.addEventListener("abort",S,{once:!0}),j}function K9(e,t=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:l=!0,maxWait:o}=n,u=Array(2);r&&(u[0]="leading"),l&&(u[1]="trailing");let c,h=null;const m=q9(function(...x){c=e.apply(this,x),h=null},t,{edges:u}),v=function(...x){return o!=null&&(h===null&&(h=Date.now()),Date.now()-h>=o)?((r||l)&&(c=e.apply(this,x)),h=Date.now(),m.cancel(),m.schedule(),c):(m.apply(this,x),c)},p=()=>(m.flush(),c);return v.cancel=m.cancel,v.flush=p,v}function Y9(e,t=0,n={}){const{leading:r=!0,trailing:l=!0}=n;return K9(e,t,{leading:r,maxWait:t,trailing:l})}var ev=function(t,n){for(var r=arguments.length,l=new Array(r>2?r-2:0),o=2;ol[u++]))}},ki={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},MP=(e,t,n)=>{var r=n.width,l=r===void 0?ki.width:r,o=n.height,u=o===void 0?ki.height:o,c=n.aspect,h=n.maxHeight,m=Vo(l)?e:Number(l),v=Vo(u)?t:Number(u);return c&&c>0&&(m?v=m/c:v&&(m=v*c),h&&v!=null&&v>h&&(v=h)),{calculatedWidth:m,calculatedHeight:v}},X9={width:0,height:0,overflow:"visible"},Q9={width:0,overflowX:"visible"},Z9={height:0,overflowY:"visible"},W9={},J9=e=>{var t=e.width,n=e.height,r=Vo(t),l=Vo(n);return r&&l?X9:r?Q9:l?Z9:W9};function eG(e){var t=e.width,n=e.height,r=e.aspect,l=t,o=n;return l===void 0&&o===void 0?(l=ki.width,o=ki.height):l===void 0?l=r&&r>0?void 0:ki.width:o===void 0&&(o=r&&r>0?void 0:ki.height),{width:l,height:o}}var tG=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function tv(){return tv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return dG(l)?b.createElement(DP.Provider,{value:l},t):null}var QS=()=>b.useContext(DP),hG=b.forwardRef((e,t)=>{var n=e.aspect,r=e.initialDimension,l=r===void 0?ki.initialDimension:r,o=e.width,u=e.height,c=e.minWidth,h=c===void 0?ki.minWidth:c,m=e.minHeight,v=e.maxHeight,p=e.children,x=e.debounce,S=x===void 0?ki.debounce:x,w=e.id,j=e.className,C=e.onResize,A=e.style,N=A===void 0?{}:A,O=cG(e,tG),T=b.useRef(null),R=b.useRef();R.current=C,b.useImperativeHandle(t,()=>T.current);var E=b.useState({containerWidth:l.width,containerHeight:l.height}),D=aG(E,2),k=D[0],I=D[1],P=b.useCallback((G,ne)=>{I(ie=>{var ce=Math.round(G),U=Math.round(ne);return ie.containerWidth===ce&&ie.containerHeight===U?ie:{containerWidth:ce,containerHeight:U}})},[]);b.useEffect(()=>{if(T.current==null||typeof ResizeObserver>"u")return Ku;var G=Ee=>{var ee,ve=Ee[0];if(ve!=null){var z=ve.contentRect,Y=z.width,le=z.height;P(Y,le),(ee=R.current)===null||ee===void 0||ee.call(R,Y,le)}};S>0&&(G=Y9(G,S,{trailing:!0,leading:!1}));var ne=new ResizeObserver(G),ie=T.current.getBoundingClientRect(),ce=ie.width,U=ie.height;return P(ce,U),ne.observe(T.current),()=>{ne.disconnect()}},[P,S]);var B=k.containerWidth,F=k.containerHeight;ev(!n||n>0,"The aspect(%s) must be greater than zero.",n);var se=MP(B,F,{width:o,height:u,aspect:n,maxHeight:v}),ue=se.calculatedWidth,de=se.calculatedHeight;return ev(B<0||F<0||ue!=null&&ue>0||de!=null&&de>0,`The width(%s) and height(%s) of chart should be greater than 0,
+ */var uO;function eV(){if(uO)return Ox;uO=1;var e=Hu(),t=JF();function n(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var r=typeof Object.is=="function"?Object.is:n,l=t.useSyncExternalStore,o=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return Ox.useSyncExternalStoreWithSelector=function(m,v,g,x,S){var w=o(null);if(w.current===null){var j={hasValue:!1,value:null};w.current=j}else j=w.current;w=c(function(){function E(A){if(!N){if(N=!0,O=A,A=x(A),S!==void 0&&j.hasValue){var D=j.value;if(S(D,A))return T=D}return T=A}if(D=T,r(O,A))return D;var k=x(A);return S!==void 0&&S(D,k)?(O=A,D):(O=A,T=k)}var N=!1,O,T,R=g===void 0?null:g;return[function(){return E(v())},R===null?void 0:function(){return E(R())}]},[v,g,x,S]);var C=l(m,w[0],w[1]);return u(function(){j.hasValue=!0,j.value=C},[C]),h(C),C},Ox}var cO;function tV(){return cO||(cO=1,Ax.exports=eV()),Ax.exports}var nV=tV(),FS=b.createContext(null),rV=e=>e,Vt=()=>{var e=b.useContext(FS);return e?e.store.dispatch:rV},Tm=()=>{},iV=()=>Tm,aV=(e,t)=>e===t;function ke(e){var t=b.useContext(FS),n=b.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Tm,[t,e]);return nV.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:iV,t?t.store.getState:Tm,t?t.store.getState:Tm,n,aV)}function lV(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function oV(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var fO=e=>Array.isArray(e)?e:[e];function sV(e){const t=Array.isArray(e[0])?e[0]:e;return oV(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function uV(e,t){const n=[],{length:r}=e;for(let l=0;ltypeof WeakRef>"u"?cV:WeakRef,eP=fV(),dV=0,dO=1;function im(){return{s:dV,v:void 0,o:null,p:null}}function hV(e){return e instanceof eP?e.deref():e}function tP(e,t={}){let n=im();const{resultEqualityCheck:r}=t;let l,o=0;function u(){let c=n;const{length:h}=arguments;for(let g=0,x=h;g{n=im(),u.resetResultsCount()},u.resultsCount=()=>o,u.resetResultsCount=()=>{o=0},u}function mV(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...l)=>{let o=0,u=0,c,h={},m=l.pop();typeof m=="object"&&(h=m,m=l.pop()),lV(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);const v={...n,...h},{memoize:g,memoizeOptions:x=[],argsMemoize:S=tP,argsMemoizeOptions:w=[]}=v,j=fO(x),C=fO(w),E=sV(l),N=g(function(){return o++,m.apply(null,arguments)},...j),O=S(function(){u++;const R=uV(E,arguments);return c=N.apply(null,R),c},...C);return Object.assign(O,{resultFunc:m,memoizedResultFunc:N,dependencies:E,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>c,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:g,argsMemoize:S})};return Object.assign(r,{withTypes:()=>r}),r}var W=mV(tP);function vV(e,t=1){const n=[],r=Math.floor(t),l=(o,u)=>{for(let c=0;c{if(e!==t){const r=hO(e),l=hO(t);if(r===l&&r===0){if(et)return n==="desc"?-1:1}return n==="desc"?l-r:r-l}return 0},yV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xV=/^\w*$/;function bV(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||NS(e)?!0:typeof e=="string"&&(xV.test(e)||!yV.test(e))||t!=null}function SV(e,t,n,r){if(e==null)return[];n=n,Array.isArray(e)||(e=US(e)?Array.from(e):gV(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(c=>String(c));const l=(c,h)=>{let m=c,v=0;for(;v0&&v===h.length?m:void 0},o=(c,h)=>{if(c==null)return h;if(h!=null)return typeof c=="object"&&"key"in c?Pu(h,c.key)?h[c.key]:l(h,c.path):typeof c=="function"?c(h):Array.isArray(c)?l(h,c):h[c]},u=t.map(c=>(Array.isArray(c)&&c.length===1&&(c=c[0]),c==null||typeof c=="function"||Array.isArray(c)||bV(c)?c:{key:c,path:TS(c)}));return e.map(c=>({original:c,criteria:u.map(h=>o(h,c))})).slice().sort((c,h)=>{for(let m=0;mc.original)}function Fv(e,...t){const n=t.length;return n>1&&rb(e,t[0],t[1])?t=[]:n>2&&rb(t[0],t[1],t[2])&&(t=[t[0]]),SV(e,vV(t),["asc"])}var nP=e=>e.legend.settings,wV=e=>e.legend.size,jV=e=>e.legend.payload;W([jV,nP],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Fv(r,n):r});function CV(e,t){return OV(e)||AV(e,t)||EV(e,t)||_V()}function _V(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EV(e,t){if(e){if(typeof e=="string")return mO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mO(e,t):void 0}}function mO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nam||Math.abs(e.left-t.left)>am||Math.abs(e.top-t.top)>am||Math.abs(e.width-t.width)>am}function gO(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function NV(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=b.useState({height:0,left:0,top:0,width:0}),n=CV(t,2),r=n[0],l=n[1],o=b.useRef(null),u=b.useRef(r);u.current=r;var c=b.useCallback(h=>{if(o.current!=null&&(o.current.disconnect(),o.current=null),h!=null){var m=gO(h);if(vO(m,u.current)&&l(m),typeof ResizeObserver<"u"){var v=new ResizeObserver(()=>{var g=gO(h);vO(g,u.current)&&l(g)});v.observe(h),o.current=v}}},[...e]);return b.useEffect(()=>()=>{var h;(h=o.current)===null||h===void 0||h.disconnect()},[]),[r,c]}function Nn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var TV=typeof Symbol=="function"&&Symbol.observable||"@@observable",pO=TV,Rx=()=>Math.random().toString(36).substring(7).split("").join("."),RV={INIT:`@@redux/INIT${Rx()}`,REPLACE:`@@redux/REPLACE${Rx()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Rx()}`},Vm=RV;function VS(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function rP(e,t,n){if(typeof e!="function")throw new Error(Nn(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Nn(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Nn(1));return n(rP)(e,t)}let r=e,l=t,o=new Map,u=o,c=0,h=!1;function m(){u===o&&(u=new Map,o.forEach((C,E)=>{u.set(E,C)}))}function v(){if(h)throw new Error(Nn(3));return l}function g(C){if(typeof C!="function")throw new Error(Nn(4));if(h)throw new Error(Nn(5));let E=!0;m();const N=c++;return u.set(N,C),function(){if(E){if(h)throw new Error(Nn(6));E=!1,m(),u.delete(N),o=null}}}function x(C){if(!VS(C))throw new Error(Nn(7));if(typeof C.type>"u")throw new Error(Nn(8));if(typeof C.type!="string")throw new Error(Nn(17));if(h)throw new Error(Nn(9));try{h=!0,l=r(l,C)}finally{h=!1}return(o=u).forEach(N=>{N()}),C}function S(C){if(typeof C!="function")throw new Error(Nn(10));r=C,x({type:Vm.REPLACE})}function w(){const C=g;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(Nn(11));function N(){const T=E;T.next&&T.next(v())}return N(),{unsubscribe:C(N)}},[pO](){return this}}}return x({type:Vm.INIT}),{dispatch:x,subscribe:g,getState:v,replaceReducer:S,[pO]:w}}function MV(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Vm.INIT})>"u")throw new Error(Nn(12));if(typeof n(void 0,{type:Vm.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Nn(13))})}function iP(e){const t=Object.keys(e),n={};for(let o=0;o"u")throw c&&c.type,new Error(Nn(14));m[g]=w,h=h||w!==S}return h=h||r.length!==Object.keys(u).length,h?m:u}}function Gm(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function DV(...e){return t=>(n,r)=>{const l=t(n,r);let o=()=>{throw new Error(Nn(15))};const u={getState:l.getState,dispatch:(h,...m)=>o(h,...m)},c=e.map(h=>h(u));return o=Gm(...c)(l.dispatch),{...l,dispatch:o}}}function aP(e){return VS(e)&&"type"in e&&typeof e.type=="string"}var lP=Symbol.for("immer-nothing"),yO=Symbol.for("immer-draftable"),Bn=Symbol.for("immer-state");function si(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Er=Object,ku=Er.getPrototypeOf,qm="constructor",Vv="prototype",ib="configurable",Km="enumerable",Rm="writable",Rf="value",Aa=e=>!!e&&!!e[Bn];function Qr(e){var t;return e?oP(e)||qv(e)||!!e[yO]||!!((t=e[qm])!=null&&t[yO])||Kv(e)||ed(e):!1}var PV=Er[Vv][qm].toString(),xO=new WeakMap;function oP(e){if(!e||!GS(e))return!1;const t=ku(e);if(t===null||t===Er[Vv])return!0;const n=Er.hasOwnProperty.call(t,qm)&&t[qm];if(n===Object)return!0;if(!su(n))return!1;let r=xO.get(n);return r===void 0&&(r=Function.toString.call(n),xO.set(n,r)),r===PV}function Gv(e,t,n=!0){Jf(e)===0?(n?Reflect.ownKeys(e):Er.keys(e)).forEach(l=>{t(l,e[l],e)}):e.forEach((r,l)=>t(l,r,e))}function Jf(e){const t=e[Bn];return t?t.type_:qv(e)?1:Kv(e)?2:ed(e)?3:0}var Mx=(e,t,n=Jf(e))=>n===2?e.has(t):Er[Vv].hasOwnProperty.call(e,t),ab=(e,t,n=Jf(e))=>n===2?e.get(t):e[t],Ym=(e,t,n,r=Jf(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function kV(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var qv=Array.isArray,Kv=e=>e instanceof Map,ed=e=>e instanceof Set,GS=e=>typeof e=="object",su=e=>typeof e=="function",Dx=e=>typeof e=="boolean";function IV(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var da=e=>e.copy_||e.base_,qS=e=>e.modified_?e.copy_:e.base_;function lb(e,t){if(Kv(e))return new Map(e);if(ed(e))return new Set(e);if(qv(e))return Array[Vv].slice.call(e);const n=oP(e);if(t===!0||t==="class_only"&&!n){const r=Er.getOwnPropertyDescriptors(e);delete r[Bn];let l=Reflect.ownKeys(r);for(let o=0;o1&&Er.defineProperties(e,{set:lm,add:lm,clear:lm,delete:lm}),Er.freeze(e),t&&Gv(e,(n,r)=>{KS(r,!0)},!1)),e}function zV(){si(2)}var lm={[Rf]:zV};function Yv(e){return e===null||!GS(e)?!0:Er.isFrozen(e)}var Xm="MapSet",ob="Patches",bO="ArrayMethods",sP={};function qo(e){const t=sP[e];return t||si(0,e),t}var SO=e=>!!sP[e],Mf,uP=()=>Mf,LV=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:SO(Xm)?qo(Xm):void 0,arrayMethodsPlugin_:SO(bO)?qo(bO):void 0});function wO(e,t){t&&(e.patchPlugin_=qo(ob),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function sb(e){ub(e),e.drafts_.forEach(UV),e.drafts_=null}function ub(e){e===Mf&&(Mf=e.parent_)}var jO=e=>Mf=LV(Mf,e);function UV(e){const t=e[Bn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function CO(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Bn].modified_&&(sb(t),si(4)),Qr(e)&&(e=_O(t,e));const{patchPlugin_:l}=t;l&&l.generateReplacementPatches_(n[Bn].base_,e,t)}else e=_O(t,n);return $V(t,e,!0),sb(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==lP?e:void 0}function _O(e,t){if(Yv(t))return t;const n=t[Bn];if(!n)return Qm(t,e.handledSet_,e);if(!Xv(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);dP(n,e)}return n.copy_}function $V(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&KS(t,n)}function cP(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Xv=(e,t)=>e.scope_===t,BV=[];function fP(e,t,n,r){const l=da(e),o=e.type_;if(r!==void 0&&ab(l,r,o)===t){Ym(l,r,n,o);return}if(!e.draftLocations_){const c=e.draftLocations_=new Map;Gv(l,(h,m)=>{if(Aa(m)){const v=c.get(m)||[];v.push(h),c.set(m,v)}})}const u=e.draftLocations_.get(t)??BV;for(const c of u)Ym(l,c,n,o)}function HV(e,t,n){e.callbacks_.push(function(l){var c;const o=t;if(!o||!Xv(o,l))return;(c=l.mapSetPlugin_)==null||c.fixSetContents(o);const u=qS(o);fP(e,o.draft_??o,u,n),dP(o,l)})}function dP(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:l}=t;if(l){const o=l.getPath(e);o&&l.generatePatches_(e,o,t)}cP(e)}}function FV(e,t,n){const{scope_:r}=e;if(Aa(n)){const l=n[Bn];Xv(l,r)&&l.callbacks_.push(function(){Mm(e);const u=qS(l);fP(e,n,u,t)})}else Qr(n)&&e.callbacks_.push(function(){const o=da(e);e.type_===3?o.has(n)&&Qm(n,r.handledSet_,r):ab(o,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Qm(ab(e.copy_,t,e.type_),r.handledSet_,r)})}function Qm(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Aa(e)||t.has(e)||!Qr(e)||Yv(e)||(t.add(e),Gv(e,(r,l)=>{if(Aa(l)){const o=l[Bn];if(Xv(o,n)){const u=qS(o);Ym(e,r,u,e.type_),cP(o)}}else Qr(l)&&Qm(l,t,n)})),e}function VV(e,t){const n=qv(e),r={type_:n?1:0,scope_:t?t.scope_:uP(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let l=r,o=Zm;n&&(l=[r],o=Df);const{revoke:u,proxy:c}=Proxy.revocable(l,o);return r.draft_=c,r.revoke_=u,[c,r]}var Zm={get(e,t){if(t===Bn)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const l=da(e);if(!Mx(l,t,e.type_))return qV(e,l,t);const o=l[t];if(e.finalized_||!Qr(o)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&IV(t))return o;if(o===Px(e.base_,t)||GV(e,t,o)){Mm(e);const u=e.type_===1?+t:t,c=fb(e.scope_,o,e,u);return e.copy_[u]=c}return o},has(e,t){return t in da(e)},ownKeys(e){return Reflect.ownKeys(da(e))},set(e,t,n){const r=hP(da(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const l=Px(da(e),t),o=l==null?void 0:l[Bn];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(kV(n,l)&&(n!==void 0||Mx(e.base_,t,e.type_)))return!0;Mm(e),cb(e)}return e.copy_[t]===n&&(n!==void 0||Mx(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),FV(e,t,n)),!0},deleteProperty(e,t){return Mm(e),Px(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),cb(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=da(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Rm]:!0,[ib]:e.type_!==1||t!=="length",[Km]:r[Km],[Rf]:n[t]}},defineProperty(){si(11)},getPrototypeOf(e){return ku(e.base_)},setPrototypeOf(){si(12)}},Df={};for(let e in Zm){let t=Zm[e];Df[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}Df.deleteProperty=function(e,t){return Df.set.call(this,e,t,void 0)};Df.set=function(e,t,n){return Zm.set.call(this,e[0],t,n,e[0])};function Px(e,t){const n=e[Bn];return(n?da(n):e)[t]}function GV(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!Qr(n)||n[Bn]?!1:e.baseRefs_.has(n)}function qV(e,t,n){var l;const r=hP(t,n);return r?Rf in r?r[Rf]:(l=r.get)==null?void 0:l.call(e.draft_):void 0}function hP(e,t){if(!(t in e))return;let n=ku(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ku(n)}}function cb(e){e.modified_||(e.modified_=!0,e.parent_&&cb(e.parent_))}function Mm(e){e.copy_||(e.assigned_=new Map,e.copy_=lb(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var KV=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,l)=>{if(su(n)&&!su(r)){const u=r;r=n;const c=this;return function(m=u,...v){return c.produce(m,g=>r.call(this,g,...v))}}su(r)||si(6),l!==void 0&&!su(l)&&si(7);let o;if(Qr(n)){const u=jO(this),c=fb(u,n,void 0);let h=!0;try{o=r(c),h=!1}finally{h?sb(u):ub(u)}return wO(u,l),CO(o,u)}else if(!n||!GS(n)){if(o=r(n),o===void 0&&(o=n),o===lP&&(o=void 0),this.autoFreeze_&&KS(o,!0),l){const u=[],c=[];qo(ob).generateReplacementPatches_(n,o,{patches_:u,inversePatches_:c}),l(u,c)}return o}else si(1,n)},this.produceWithPatches=(n,r)=>{if(su(n))return(c,...h)=>this.produceWithPatches(c,m=>n(m,...h));let l,o;return[this.produce(n,r,(c,h)=>{l=c,o=h}),l,o]},Dx(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze);const t=e==null?void 0:e.useStrictShallowCopy;(Dx(t)||t==="class_only")&&this.setUseStrictShallowCopy(t),Dx(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Qr(e)||si(8),Aa(e)&&(e=Gr(e));const t=jO(this),n=fb(t,e,void 0);return n[Bn].isManual_=!0,ub(t),n}finishDraft(e,t){const n=e&&e[Bn];(!n||!n.isManual_)&&si(9);const{scope_:r}=n;return wO(r,t),CO(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const l=t[n];if(l.path.length===0&&l.op==="replace"){e=l.value;break}}n>-1&&(t=t.slice(n+1));const r=qo(ob).applyPatches_;return Aa(e)?r(e,t):this.produce(e,l=>r(l,t))}};function fb(e,t,n,r){const[l,o]=Kv(t)?qo(Xm).proxyMap_(t,n):ed(t)?qo(Xm).proxySet_(t,n):VV(t,n);return((n==null?void 0:n.scope_)??uP()).drafts_.push(l),o.callbacks_=(n==null?void 0:n.callbacks_)??[],o.key_=r,n&&r!==void 0?HV(n,o,r):o.callbacks_.push(function(h){var v;(v=h.mapSetPlugin_)==null||v.fixSetContents(o);const{patchPlugin_:m}=h;o.modified_&&m&&m.generatePatches_(o,[],h)}),l}function Gr(e){return Aa(e)||si(10,e),mP(e)}function mP(e){if(!Qr(e)||Yv(e))return e;const t=e[Bn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=lb(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=lb(e,!0);const l=n;return ed(n)&&(n=new Set),Gv(l,(o,u)=>{Ym(n,o,mP(u))},r),t&&(t.finalized_=!1),n}var kx=globalThis.Iterator;kx==null||kx.from;var YV=new KV,vP=YV.produce,it=e=>e;function gP(e){return({dispatch:n,getState:r})=>l=>o=>typeof o=="function"?o(n,r,e):l(o)}var XV=gP(),QV=gP;const ZV=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Gm:Gm.apply(null,arguments)};function Ar(e,t){function n(...r){if(t){let l=t(...r);if(!l)throw new Error(cr(0));return{type:e,payload:l.payload,..."meta"in l&&{meta:l.meta},..."error"in l&&{error:l.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>r!=null&&r.type===e&&aP(r),n}var pP=class bf extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,bf.prototype)}static get[Symbol.species](){return bf}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new bf(...t[0].concat(this)):new bf(...t.concat(this))}};function EO(e){return Qr(e)?vP(e,()=>{}):e}function om(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function WV(e){return typeof e=="boolean"}const JV=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:l=!0,actionCreatorCheck:o=!0}=t??{};let u=new pP;return n&&(WV(n)?u.push(XV):u.push(QV(n.extraArgument))),u},yP="RTK_autoBatch",Ot=()=>e=>({payload:e,meta:{[yP]:!0}}),AO=e=>t=>{setTimeout(t,e)},e9=(e,t,n)=>r=>{let l=!1,o,u;const c=()=>{l||(l=!0,t==null||t(o),clearTimeout(u),r())};o=e(c),u=setTimeout(c,n)},xP=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let l=!0,o=!1,u=!1;const c=new Set,h=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?e9(window.requestAnimationFrame,window.cancelAnimationFrame,100):AO(10):e.type==="callback"?e.queueNotification:AO(e.timeout),m=()=>{u=!1,o&&(o=!1,c.forEach(v=>v()))};return Object.assign({},r,{subscribe(v){const g=()=>l&&v(),x=r.subscribe(g);return c.add(v),()=>{x(),c.delete(v)}},dispatch(v){var g;try{return l=!((g=v==null?void 0:v.meta)!=null&&g[yP]),o=!l,o&&(u||(u=!0,h(m))),r.dispatch(v)}finally{l=!0}}})},t9=e=>function(n){const{autoBatch:r=!0}=n??{};let l=new pP(e);return r&&l.push(xP(typeof r=="object"?r:void 0)),l};function n9(e){const t=JV(),{reducer:n=void 0,middleware:r,devTools:l=!0,preloadedState:o=void 0,enhancers:u=void 0}=e||{};let c;if(typeof n=="function")c=n;else if(VS(n))c=iP(n);else throw new Error(cr(1));let h;typeof r=="function"?h=r(t):h=t();let m=Gm;l&&(m=ZV({trace:!1,...typeof l=="object"&&l}));const v=DV(...h),g=t9(v);let x=typeof u=="function"?u(g):g();const S=m(...x);return rP(c,o,S)}function bP(e){const t={},n=[];let r;const l={addCase(o,u){const c=typeof o=="string"?o:o.type;if(!c)throw new Error(cr(28));if(c in t)throw new Error(cr(29));return t[c]=u,l},addAsyncThunk(o,u){return u.pending&&(t[o.pending.type]=u.pending),u.rejected&&(t[o.rejected.type]=u.rejected),u.fulfilled&&(t[o.fulfilled.type]=u.fulfilled),u.settled&&n.push({matcher:o.settled,reducer:u.settled}),l},addMatcher(o,u){return n.push({matcher:o,reducer:u}),l},addDefaultCase(o){return r=o,l}};return e(l),[t,n,r]}function r9(e){return typeof e=="function"}function i9(e,t){let[n,r,l]=bP(t),o;if(r9(e))o=()=>EO(e());else{const h=EO(e);o=()=>h}function u(h,m,v){if(Aa(h)){const g=m(h,v);return g===void 0?h:g}else{if(Qr(h))return vP(h,g=>m(g,v));{const g=m(h,v);if(g===void 0){if(h===null)return h;throw new Error(cr(9))}return g}}}function c(h=o(),m){const v=n[m.type];let g;for(const{matcher:x,reducer:S}of r)x(m)&&S&&(g??(g=[])).push(S);if(!v&&!g)return l?u(h,l,m):h;if(v&&(h=u(h,v,m)),g)for(const x of g)h=u(h,x,m);return h}return c.getInitialState=o,c}let a9="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",l9=(e=21)=>{let t="",n=e;for(;n--;)t+=a9[Math.random()*64|0];return t};const o9=Symbol.for("rtk-slice-createasyncthunk");function s9(e,t){return`${e}/${t}`}function u9({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[o9];return function(l){const{name:o,reducerPath:u=o}=l;if(!o)throw new Error(cr(11));const c=(typeof l.reducers=="function"?l.reducers(f9()):l.reducers)||{},h=Object.keys(c),m={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},v={addCase(T,R){const A=typeof T=="string"?T:T.type;if(!A)throw new Error(cr(12));if(A in m.sliceCaseReducersByType)throw new Error(cr(13));return m.sliceCaseReducersByType[A]=R,v},addMatcher(T,R){return m.sliceMatchers.push({matcher:T,reducer:R}),v},exposeAction(T,R){return m.actionCreators[T]=R,v},exposeCaseReducer(T,R){return m.sliceCaseReducersByName[T]=R,v}};h.forEach(T=>{const R=c[T],A={reducerName:T,type:s9(o,T),createNotation:typeof l.reducers=="function"};h9(R)?v9(A,R,v,t):d9(A,R,v)});function g(){const[T={},R=[],A=void 0]=typeof l.extraReducers=="function"?bP(l.extraReducers):[l.extraReducers],D={...T,...m.sliceCaseReducersByType};return i9(l.initialState,k=>{for(let I in D)k.addCase(I,D[I]);for(let I of m.sliceMatchers)k.addMatcher(I.matcher,I.reducer);for(let I of R)k.addMatcher(I.matcher,I.reducer);A&&k.addDefaultCase(A)})}const x=T=>T,S=new Map,w=new WeakMap;let j;function C(T,R){return j||(j=g()),j(T,R)}function E(){return j||(j=g()),j.getInitialState()}function N(T,R=!1){function A(k){let I=k[T];return typeof I>"u"&&R&&(I=om(w,A,E)),I}function D(k=x){return om(om(S,R,()=>new WeakMap),k,()=>{const I={};for(const[P,B]of Object.entries(l.selectors??{}))I[P]=c9(B,k,()=>om(w,k,E),R);return I})}return{reducerPath:T,getSelectors:D,get selectors(){return D(A)},selectSlice:A}}const O={name:o,reducer:C,actions:m.actionCreators,caseReducers:m.sliceCaseReducersByName,getInitialState:E,...N(u),injectInto(T,{reducerPath:R,...A}={}){const D=R??u;return T.inject({reducerPath:D,reducer:C},A),{...O,...N(D,!0)}}};return O}}function c9(e,t,n,r){function l(o,...u){let c=t(o);return typeof c>"u"&&r&&(c=n()),e(c,...u)}return l.unwrapped=e,l}const Hn=u9();function f9(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function d9({type:e,reducerName:t,createNotation:n},r,l){let o,u;if("reducer"in r){if(n&&!m9(r))throw new Error(cr(17));o=r.reducer,u=r.prepare}else o=r;l.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,u?Ar(e,u):Ar(e))}function h9(e){return e._reducerDefinitionType==="asyncThunk"}function m9(e){return e._reducerDefinitionType==="reducerWithPrepare"}function v9({type:e,reducerName:t},n,r,l){if(!l)throw new Error(cr(18));const{payloadCreator:o,fulfilled:u,pending:c,rejected:h,settled:m,options:v}=n,g=l(e,o,v);r.exposeAction(t,g),u&&r.addCase(g.fulfilled,u),c&&r.addCase(g.pending,c),h&&r.addCase(g.rejected,h),m&&r.addMatcher(g.settled,m),r.exposeCaseReducer(t,{fulfilled:u||sm,pending:c||sm,rejected:h||sm,settled:m||sm})}function sm(){}const g9="task",SP="listener",wP="completed",YS="cancelled",p9=`task-${YS}`,y9=`task-${wP}`,db=`${SP}-${YS}`,x9=`${SP}-${wP}`;var Qv=class{constructor(e){Yh(this,"code");Yh(this,"name","TaskAbortError");Yh(this,"message");this.code=e,this.message=`${g9} ${YS} (reason: ${e})`}};const XS=(e,t)=>{if(typeof e!="function")throw new TypeError(cr(32))},Wm=()=>{},QS=(e,t=Wm)=>(e.catch(t),e),jP=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),zo=e=>{if(e.aborted)throw new Qv(e.reason)};function CP(e,t){let n=Wm;return new Promise((r,l)=>{const o=()=>l(new Qv(e.reason));if(e.aborted){o();return}n=jP(e,o),t.finally(()=>n()).then(r,l)}).finally(()=>{n=Wm})}const b9=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Qv?"cancelled":"rejected",error:n}}finally{t==null||t()}},Jm=e=>t=>QS(CP(e,t).then(n=>(zo(e),n))),_P=e=>{const t=Jm(e);return n=>{let r;return QS(t(new Promise(l=>{r=setTimeout(l,n)})).finally(()=>clearTimeout(r)))}},{assign:mu}=Object,OO={},Zv="listenerMiddleware",S9=(e,t)=>{const n=r=>jP(e,()=>r.abort(e.reason));return(r,l)=>{XS(r);const o=new AbortController;n(o);const u=b9(async()=>{zo(e),zo(o.signal);const c=await r({pause:Jm(o.signal),delay:_P(o.signal),signal:o.signal});return zo(o.signal),c},()=>o.abort(y9));return l!=null&&l.autoJoin&&t.push(u.catch(Wm)),{result:Jm(e)(u),cancel(){o.abort(p9)}}}},w9=(e,t)=>{const n=async(r,l)=>{zo(t);let o=()=>{};const u=[new Promise((h,m)=>{let v=e({predicate:r,effect:(g,x)=>{x.unsubscribe(),h([g,x.getState(),x.getOriginalState()])}});o=()=>{v(),m()}})];let c;l!=null&&u.push(new Promise(h=>{c=setTimeout(h,l,null)}));try{const h=await CP(t,Promise.race(u));return zo(t),h}finally{clearTimeout(c),o()}};return((r,l)=>QS(n(r,l)))},EP=e=>{let{type:t,actionCreator:n,matcher:r,predicate:l,effect:o}=e;if(t)l=Ar(t).match;else if(n)t=n.type,l=n.match;else if(r)l=r;else if(!l)throw new Error(cr(21));return XS(o),{predicate:l,type:t,effect:o}},AP=mu(e=>{const{type:t,predicate:n,effect:r}=EP(e);return{id:l9(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(cr(22))}}},{withTypes:()=>AP}),NO=(e,t)=>{const{type:n,effect:r,predicate:l}=EP(t);return Array.from(e.values()).find(o=>(typeof n=="string"?o.type===n:o.predicate===l)&&o.effect===r)},hb=e=>{e.pending.forEach(t=>{t.abort(db)})},j9=(e,t)=>()=>{for(const n of t.keys())hb(n);e.clear()},TO=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},OP=mu(Ar(`${Zv}/add`),{withTypes:()=>OP}),C9=Ar(`${Zv}/removeAll`),NP=mu(Ar(`${Zv}/remove`),{withTypes:()=>NP}),_9=(...e)=>{console.error(`${Zv}/error`,...e)},td=(e={})=>{const t=new Map,n=new Map,r=E=>{const N=n.get(E)??0;n.set(E,N+1)},l=E=>{const N=n.get(E)??1;N===1?n.delete(E):n.set(E,N-1)},{extra:o,onError:u=_9}=e;XS(u);let c;const h=()=>{if(!c){const E=Array.from(t.values()),N=new Set;let O=!1;for(const T of E)typeof T.type=="string"?N.add(T.type):O=!0;c={entries:E,types:N,anyType:O}}return c},m=E=>{t.has(E.id)||(t.set(E.id,E),c=void 0)},v=E=>(E.unsubscribe=()=>{t.delete(E.id)&&(c=void 0)},m(E),N=>{E.unsubscribe(),N!=null&&N.cancelActive&&hb(E)}),g=(E=>{const N=NO(t,E)??AP(E);return v(N)});mu(g,{withTypes:()=>g});const x=E=>{const N=NO(t,E);return N&&(N.unsubscribe(),E.cancelActive&&hb(N)),!!N};mu(x,{withTypes:()=>x});const S=async(E,N,O,T)=>{const R=new AbortController,A=w9(g,R.signal),D=[];try{E.pending.add(R),r(E),await Promise.resolve(E.effect(N,mu({},O,{getOriginalState:T,condition:(k,I)=>A(k,I).then(Boolean),take:A,delay:_P(R.signal),pause:Jm(R.signal),extra:o,signal:R.signal,fork:S9(R.signal,D),unsubscribe:E.unsubscribe,subscribe:()=>{m(E)},cancelActiveListeners:()=>{E.pending.forEach((k,I,P)=>{k!==R&&(k.abort(db),P.delete(k))})},cancel:()=>{R.abort(db),E.pending.delete(R)},throwIfCancelled:()=>{zo(R.signal)}})))}catch(k){k instanceof Qv||TO(u,k,{raisedBy:"effect"})}finally{await Promise.all(D),R.abort(x9),l(E),E.pending.delete(R)}},w=j9(t,n),j=()=>{w(),c=void 0};return{middleware:E=>N=>O=>{if(!aP(O))return N(O);if(OP.match(O))return g(O.payload);if(C9.match(O)){j();return}if(NP.match(O))return x(O.payload);let T=E.getState();const R=()=>{if(T===OO)throw new Error(cr(23));return T};let A;try{A=N(O);const{entries:D,types:k,anyType:I}=h();if(I||k.has(O.type)){const P=E.getState();for(const B of D){if(typeof B.type=="string"&&B.type!==O.type)continue;let F=!1;try{F=B.predicate(O,P,T)}catch(se){F=!1,TO(u,se,{raisedBy:"predicate"})}F&&S(B,O,E,R)}}}finally{T=OO}return A},startListening:g,stopListening:x,clearListeners:j}};function cr(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var E9={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},TP=Hn({name:"chartLayout",initialState:E9,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,l,o;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(l=t.payload.bottom)!==null&&l!==void 0?l:0,e.margin.left=(o=t.payload.left)!==null&&o!==void 0?o:0},setScale(e,t){e.scale=t.payload}}}),Wv=TP.actions,A9=Wv.setMargin,O9=Wv.setLayout,N9=Wv.setChartSize,T9=Wv.setScale,R9=TP.reducer;function RP(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function at(e){return Number.isFinite(e)}function Fi(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function RO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function or(e){for(var t=1;t{if(t&&n){var r=n.width,l=n.height,o=t.align,u=t.verticalAlign,c=t.layout,h=t.position,m=t.offset,v=m===void 0?0:m;if(h!=null){if(WH(h)){if(h==="top"&&Re(e.top))return or(or({},e),{},{top:e.top+(l||0)+v});if(h==="bottom"&&Re(e.bottom))return or(or({},e),{},{bottom:e.bottom+(l||0)+v});if(h==="left"&&Re(e.left))return or(or({},e),{},{left:e.left+(r||0)+v});if(h==="right"&&Re(e.right))return or(or({},e),{},{right:e.right+(r||0)+v})}return e}if((c==="vertical"||c==="horizontal"&&u==="middle")&&o!=="center"&&Re(e[o]))return or(or({},e),{},{[o]:e[o]+(r||0)});if((c==="horizontal"||c==="vertical"&&o==="center")&&u!=="middle"&&Re(e[u]))return or(or({},e),{},{[u]:e[u]+(l||0)})}return e},Ra=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",MP=(e,t,n,r)=>{if(r)return e.map(c=>c.coordinate);var l,o,u=e.map(c=>(c.coordinate===t&&(l=!0),c.coordinate===n&&(o=!0),c.coordinate));return l||u.push(t),o||u.push(n),u},DP=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,l=e.type,o=e.range,u=e.scale,c=e.realScaleType,h=e.isCategorical,m=e.categoricalDomain,v=e.tickCount,g=e.ticks,x=e.niceTicks,S=e.axisType;if(!u)return null;var w=c==="scaleBand"&&u.bandwidth?u.bandwidth()/2:2,j=l==="category"&&u.bandwidth?u.bandwidth()/w:0;if(j=S==="angleAxis"&&o&&o.length>=2?Vr(o[0]-o[1])*2*j:j,g||x){var C=(g||x||[]).map((E,N)=>{var O=r?r.indexOf(E):E,T=u.map(O);return at(T)?{coordinate:T+j,value:E,offset:j,index:N}:null}).filter(ur);return C}return h&&m?m.map((E,N)=>{var O=u.map(E);return at(O)?{coordinate:O+j,value:E,index:N,offset:j}:null}).filter(ur):u.ticks&&v!=null?u.ticks(v).map((E,N)=>{var O=u.map(E);return at(O)?{coordinate:O+j,value:E,index:N,offset:j}:null}).filter(ur):u.domain().map((E,N)=>{var O=u.map(E);return at(O)?{coordinate:O+j,value:r?r[E]:E,index:N,offset:j}:null}).filter(ur)},I9=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var l=0;l=0?(m[0]=o,o+=x,m[1]=o):(m[0]=u,u+=x,m[1]=u)}}}},z9=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var l=0;l=0?(h[0]=o,o+=m,h[1]=o):(h[0]=0,h[1]=0)}}}},L9={sign:I9,expand:xF,none:Go,silhouette:bF,wiggle:SF,positive:z9},U9=(e,t,n)=>{var r,l=(r=L9[n])!==null&&r!==void 0?r:Go,o=yF().keys(t).value((c,h)=>Number(pn(c,h,0))).order(J0).offset(l),u=o(e);return u.forEach((c,h)=>{c.forEach((m,v)=>{var g=pn(e[v],t[h],0);Array.isArray(g)&&g.length===2&&Re(g[0])&&Re(g[1])&&(m[0]=g[0],m[1]=g[1])})}),u};function MO(e){var t=e.axis,n=e.ticks,r=e.bandSize,l=e.entry,o=e.index,u=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!yn(l[t.dataKey])){var c=sD(n,"value",l[t.dataKey]);if(c)return c.coordinate+r/2}return n!=null&&n[o]?n[o].coordinate+r/2:null}var h=pn(l,yn(u)?t.dataKey:u),m=t.scale.map(h);return Re(m)?m:null}var $9=e=>{var t=e.flat(2).filter(Re);return[Math.min(...t),Math.max(...t)]},B9=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],H9=(e,t,n)=>{if(!(e==null||Object.keys(e).length===0))return B9(Object.keys(e).reduce((r,l)=>{var o=e[l];if(!o)return r;var u=o.stackedData,c=u.reduce((h,m)=>{var v=RP(m,t,n),g=$9(v);return!at(g[0])||!at(g[1])?h:[Math.min(h[0],g[0]),Math.max(h[1],g[1])]},[1/0,-1/0]);return[Math.min(c[0],r[0]),Math.max(c[1],r[1])]},[1/0,-1/0]))},DO=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,PO=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ev=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var l=Fv(t,j=>j.coordinate),o=[],u=0,c=1,h=l.length;cx&&(S=Math.min(w,S));return S===1/0?0:S}return n?void 0:0};function kO(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,l=e.value,o=e.name;return or(or({},t),{},{dataKey:n,payload:r,value:l,name:o})}function PP(e,t){if(e!=null)return String(e);if(typeof t=="string")return t}var F9=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},V9=(e,t)=>t==="centric"?e.angle:e.radius,Ma=e=>e.layout.width,Da=e=>e.layout.height,G9=e=>e.layout.scale,kP=e=>e.layout.margin,Jv=W(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),eg=W(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),q9="data-recharts-item-index",K9="data-recharts-item-id",nd=60,ZS=30;function IO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function um(e){for(var t=1;te.brush.height;function W9(e){var t=eg(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var l=typeof r.width=="number"?r.width:nd;return n+l}return n},0)}function J9(e){var t=eg(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var l=typeof r.width=="number"?r.width:nd;return n+l}return n},0)}function eG(e){var t=Jv(e);return t.reduce((n,r)=>{if(r.orientation==="top"&&!r.mirror&&!r.hide){var l=typeof r.height=="number"?r.height:ZS;return n+l}return n},0)}function tG(e){var t=Jv(e);return t.reduce((n,r)=>{if(r.orientation==="bottom"&&!r.mirror&&!r.hide){var l=typeof r.height=="number"?r.height:ZS;return n+l}return n},0)}var Pn=W([Ma,Da,kP,Z9,W9,J9,eG,tG,nP,wV],(e,t,n,r,l,o,u,c,h,m)=>{var v={left:(n.left||0)+l,right:(n.right||0)+o},g={top:(n.top||0)+u,bottom:(n.bottom||0)+c},x=um(um({},g),v),S=x.bottom;x.bottom+=r,x=k9(x,h,m);var w=e-x.left-x.right,j=t-x.top-x.bottom;return um(um({brushBottom:S},x),{},{width:Math.max(w,0),height:Math.max(j,0)})}),nG=W(Pn,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),IP=W(Ma,Da,(e,t)=>({x:0,y:0,width:e,height:t})),rG=b.createContext(null),fr=()=>b.useContext(rG)!=null,tg=e=>e.brush,ng=W([tg,Pn,kP],(e,t,n)=>({height:e.height,x:Re(e.x)?e.x:t.left,y:Re(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:Re(e.width)?e.width:t.width}));function iG(e,t,{signal:n,edges:r}={}){let l,o=null;const u=r!=null&&r.includes("leading"),c=r==null||r.includes("trailing"),h=()=>{o!==null&&(e.apply(l,o),l=void 0,o=null)},m=()=>{c&&h(),S()};let v=null;const g=()=>{v!=null&&clearTimeout(v),v=setTimeout(()=>{v=null,m()},t)},x=()=>{v!==null&&(clearTimeout(v),v=null)},S=()=>{x(),l=void 0,o=null},w=()=>{h()},j=function(...C){if(n!=null&&n.aborted)return;l=this,o=C;const E=v==null;g(),u&&E&&h()};return j.schedule=g,j.cancel=S,j.flush=w,n==null||n.addEventListener("abort",S,{once:!0}),j}function aG(e,t=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:l=!0,maxWait:o}=n,u=Array(2);r&&(u[0]="leading"),l&&(u[1]="trailing");let c,h=null;const m=iG(function(...x){c=e.apply(this,x),h=null},t,{edges:u}),v=function(...x){return o!=null&&(h===null&&(h=Date.now()),Date.now()-h>=o)?((r||l)&&(c=e.apply(this,x)),h=Date.now(),m.cancel(),m.schedule(),c):(m.apply(this,x),c)},g=()=>(m.flush(),c);return v.cancel=m.cancel,v.flush=g,v}function lG(e,t=0,n={}){const{leading:r=!0,trailing:l=!0}=n;return aG(e,t,{leading:r,maxWait:t,trailing:l})}var tv=function(t,n){for(var r=arguments.length,l=new Array(r>2?r-2:0),o=2;ol[u++]))}},ki={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},zP=(e,t,n)=>{var r=n.width,l=r===void 0?ki.width:r,o=n.height,u=o===void 0?ki.height:o,c=n.aspect,h=n.maxHeight,m=Vo(l)?e:Number(l),v=Vo(u)?t:Number(u);return c&&c>0&&(m?v=m/c:v&&(m=v*c),h&&v!=null&&v>h&&(v=h)),{calculatedWidth:m,calculatedHeight:v}},oG={width:0,height:0,overflow:"visible"},sG={width:0,overflowX:"visible"},uG={height:0,overflowY:"visible"},cG={},fG=e=>{var t=e.width,n=e.height,r=Vo(t),l=Vo(n);return r&&l?oG:r?sG:l?uG:cG};function dG(e){var t=e.width,n=e.height,r=e.aspect,l=t,o=n;return l===void 0&&o===void 0?(l=ki.width,o=ki.height):l===void 0?l=r&&r>0?void 0:ki.width:o===void 0&&(o=r&&r>0?void 0:ki.height),{width:l,height:o}}var hG=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function nv(){return nv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return CG(l)?b.createElement(LP.Provider,{value:l},t):null}var WS=()=>b.useContext(LP),_G=b.forwardRef((e,t)=>{var n=e.aspect,r=e.initialDimension,l=r===void 0?ki.initialDimension:r,o=e.width,u=e.height,c=e.minWidth,h=c===void 0?ki.minWidth:c,m=e.minHeight,v=e.maxHeight,g=e.children,x=e.debounce,S=x===void 0?ki.debounce:x,w=e.id,j=e.className,C=e.onResize,E=e.style,N=E===void 0?{}:E,O=wG(e,hG),T=b.useRef(null),R=b.useRef();R.current=C,b.useImperativeHandle(t,()=>T.current);var A=b.useState({containerWidth:l.width,containerHeight:l.height}),D=pG(A,2),k=D[0],I=D[1],P=b.useCallback((G,ne)=>{I(ie=>{var ce=Math.round(G),U=Math.round(ne);return ie.containerWidth===ce&&ie.containerHeight===U?ie:{containerWidth:ce,containerHeight:U}})},[]);b.useEffect(()=>{if(T.current==null||typeof ResizeObserver>"u")return Ku;var G=Ae=>{var ee,ve=Ae[0];if(ve!=null){var z=ve.contentRect,Y=z.width,le=z.height;P(Y,le),(ee=R.current)===null||ee===void 0||ee.call(R,Y,le)}};S>0&&(G=lG(G,S,{trailing:!0,leading:!1}));var ne=new ResizeObserver(G),ie=T.current.getBoundingClientRect(),ce=ie.width,U=ie.height;return P(ce,U),ne.observe(T.current),()=>{ne.disconnect()}},[P,S]);var B=k.containerWidth,F=k.containerHeight;tv(!n||n>0,"The aspect(%s) must be greater than zero.",n);var se=zP(B,F,{width:o,height:u,aspect:n,maxHeight:v}),ue=se.calculatedWidth,de=se.calculatedHeight;return tv(B<0||F<0||ue!=null&&ue>0||de!=null&&de>0,`The width(%s) and height(%s) of chart should be greater than 0,
please check the style of container, or the props width(%s) and height(%s),
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
- height and width.`,ue,de,o,u,h,m,n),b.createElement("div",tv({id:w?"".concat(w):void 0,className:Ct("recharts-responsive-container",j),style:PO(PO({},N),{},{width:o,height:u,minWidth:h,minHeight:m,maxHeight:v}),ref:T},O),b.createElement("div",{style:J9({width:o,height:u})},b.createElement(PP,{width:ue,height:de},p)))}),kP=b.forwardRef((e,t)=>{var n=QS();if(Fi(n.width)&&Fi(n.height))return e.children;var r=eG({width:e.width,height:e.height,aspect:e.aspect}),l=r.width,o=r.height,u=MP(void 0,void 0,{width:l,height:o,aspect:e.aspect,maxHeight:e.maxHeight}),c=u.calculatedWidth,h=u.calculatedHeight;return Re(c)&&Re(h)?b.createElement(PP,{width:c,height:h},e.children):b.createElement(hG,tv({},e,{width:l,height:o,ref:t}))}),ng=()=>{var e,t=fr(),n=ke(V9),r=ke(tg),l=(e=ke(eg))===null||e===void 0?void 0:e.padding;return!t||!r||!l?n:{width:r.width-l.left-l.right,height:r.height-l.top-l.bottom,x:l.left,y:l.top}},mG={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},IP=()=>{var e;return(e=ke(Pn))!==null&&e!==void 0?e:mG},zP=()=>ke(Ma),LP=()=>ke(Da),It=e=>e.layout.layoutType,Yu=()=>ke(It),UP=()=>{var e=Yu();if(e==="horizontal"||e==="vertical")return e},$P=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},vG=()=>{var e=Yu();return e!==void 0},nd=e=>{var t=Vt(),n=fr(),r=e.width,l=e.height,o=QS(),u=r,c=l;return o&&(u=o.width>0?o.width:r,c=o.height>0?o.height:l),b.useEffect(()=>{!n&&Fi(u)&&Fi(c)&&t(p9({width:u,height:c}))},[t,n,u,c]),null},gG={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value",position:void 0,offset:0},size:{width:0,height:0},payload:[]},BP=Hn({name:"legend",initialState:gG,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter,e.settings.position=t.payload.position,e.settings.offset=t.payload.offset},addLegendPayload:{reducer(e,t){e.payload.push(rt(t.payload))},prepare:Ot()},replaceLegendPayload:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,o=Gr(e).payload.indexOf(rt(r));o>-1&&(e.payload[o]=rt(l))},prepare:Ot()},removeLegendPayload:{reducer(e,t){var n=Gr(e).payload.indexOf(rt(t.payload));n>-1&&e.payload.splice(n,1)},prepare:Ot()}}}),rd=BP.actions;rd.setLegendSize;rd.setLegendSettings;var pG=rd.addLegendPayload,yG=rd.replaceLegendPayload,xG=rd.removeLegendPayload,bG=BP.reducer,kx={exports:{}},Ix={};/**
+ height and width.`,ue,de,o,u,h,m,n),b.createElement("div",nv({id:w?"".concat(w):void 0,className:Ct("recharts-responsive-container",j),style:LO(LO({},N),{},{width:o,height:u,minWidth:h,minHeight:m,maxHeight:v}),ref:T},O),b.createElement("div",{style:fG({width:o,height:u})},b.createElement(UP,{width:ue,height:de},g)))}),$P=b.forwardRef((e,t)=>{var n=WS();if(Fi(n.width)&&Fi(n.height))return e.children;var r=dG({width:e.width,height:e.height,aspect:e.aspect}),l=r.width,o=r.height,u=zP(void 0,void 0,{width:l,height:o,aspect:e.aspect,maxHeight:e.maxHeight}),c=u.calculatedWidth,h=u.calculatedHeight;return Re(c)&&Re(h)?b.createElement(UP,{width:c,height:h},e.children):b.createElement(_G,nv({},e,{width:l,height:o,ref:t}))}),rg=()=>{var e,t=fr(),n=ke(nG),r=ke(ng),l=(e=ke(tg))===null||e===void 0?void 0:e.padding;return!t||!r||!l?n:{width:r.width-l.left-l.right,height:r.height-l.top-l.bottom,x:l.left,y:l.top}},EG={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},BP=()=>{var e;return(e=ke(Pn))!==null&&e!==void 0?e:EG},HP=()=>ke(Ma),FP=()=>ke(Da),It=e=>e.layout.layoutType,Yu=()=>ke(It),VP=()=>{var e=Yu();if(e==="horizontal"||e==="vertical")return e},GP=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},AG=()=>{var e=Yu();return e!==void 0},rd=e=>{var t=Vt(),n=fr(),r=e.width,l=e.height,o=WS(),u=r,c=l;return o&&(u=o.width>0?o.width:r,c=o.height>0?o.height:l),b.useEffect(()=>{!n&&Fi(u)&&Fi(c)&&t(N9({width:u,height:c}))},[t,n,u,c]),null},OG={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value",position:void 0,offset:0},size:{width:0,height:0},payload:[]},qP=Hn({name:"legend",initialState:OG,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter,e.settings.position=t.payload.position,e.settings.offset=t.payload.offset},addLegendPayload:{reducer(e,t){e.payload.push(it(t.payload))},prepare:Ot()},replaceLegendPayload:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,o=Gr(e).payload.indexOf(it(r));o>-1&&(e.payload[o]=it(l))},prepare:Ot()},removeLegendPayload:{reducer(e,t){var n=Gr(e).payload.indexOf(it(t.payload));n>-1&&e.payload.splice(n,1)},prepare:Ot()}}}),id=qP.actions;id.setLegendSize;id.setLegendSettings;var NG=id.addLegendPayload,TG=id.replaceLegendPayload,RG=id.removeLegendPayload,MG=qP.reducer,Ix={exports:{}},zx={};/**
* @license React
* use-sync-external-store-with-selector.production.js
*
@@ -127,54 +139,54 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var IO;function SG(){if(IO)return Ix;IO=1;var e=Hu();function t(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,l=e.useRef,o=e.useEffect,u=e.useMemo,c=e.useDebugValue;return Ix.useSyncExternalStoreWithSelector=function(h,m,v,p,x){var S=l(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=u(function(){function C(R){if(!A){if(A=!0,N=R,R=p(R),x!==void 0&&w.hasValue){var E=w.value;if(x(E,R))return O=E}return O=R}if(E=O,n(N,R))return E;var D=p(R);return x!==void 0&&x(E,D)?(N=R,E):(N=R,O=D)}var A=!1,N,O,T=v===void 0?null:v;return[function(){return C(m())},T===null?void 0:function(){return C(T())}]},[m,v,p,x]);var j=r(h,S[0],S[1]);return o(function(){w.hasValue=!0,w.value=j},[j]),c(j),j},Ix}var zO;function wG(){return zO||(zO=1,kx.exports=SG()),kx.exports}wG();function jG(e){e()}function CG(){let e=null,t=null;return{clear(){e=null,t=null},notify(){jG(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const l=t={callback:n,next:null,prev:t};return l.prev?l.prev.next=l:e=l,function(){!r||e===null||(r=!1,l.next?l.next.prev=l.prev:t=l.prev,l.prev?l.prev.next=l.next:e=l.next)}}}}const LO={notify(){},get:()=>[]};function _G(e,t){let n,r=LO,l=0,o=!1;function u(j){v();const C=r.subscribe(j);let A=!1;return()=>{A||(A=!0,C(),p())}}function c(){r.notify()}function h(){w.onStateChange&&w.onStateChange()}function m(){return o}function v(){l++,n||(n=e.subscribe(h),r=CG())}function p(){l--,n&&l===0&&(n(),n=void 0,r.clear(),r=LO)}function x(){o||(o=!0,v())}function S(){o&&(o=!1,p())}const w={addNestedSub:u,notifyNestedSubs:c,handleChangeWrapper:h,isSubscribed:m,trySubscribe:x,tryUnsubscribe:S,getListeners:()=>r};return w}const AG=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",EG=AG(),OG=()=>typeof navigator<"u"&&navigator.product==="ReactNative",NG=OG(),TG=()=>EG||NG?b.useLayoutEffect:b.useEffect,RG=TG();function UO(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function MG(e,t){if(UO(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let l=0;l{const h=_G(l);return{store:l,subscription:h,getServerState:r!=null?()=>r:void 0}},[l,r]),u=b.useMemo(()=>l.getState(),[l]);RG(()=>{const{subscription:h}=o;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),u!==l.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[o,u]);const c=n||PG;return b.createElement(c.Provider,{value:o},t)}var IG=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function zG(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function rg(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(IG.has(r)){if(e[r]==null&&t[r]==null)continue;if(!MG(e[r],t[r]))return!1}else if(!zG(e[r],t[r]))return!1;return!0}function hb(){return hb=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.separator,n=t===void 0?Zs.separator:t,r=e.contentStyle,l=e.itemStyle,o=e.labelStyle,u=o===void 0?Zs.labelStyle:o,c=e.payload,h=e.formatter,m=e.itemSorter,v=e.wrapperClassName,p=e.labelClassName,x=e.label,S=e.labelFormatter,w=e.accessibilityLayer,j=w===void 0?Zs.accessibilityLayer:w,C=()=>{if(c&&c.length){var k={padding:0,margin:0},I=KG(c,m),P=I.map((B,F)=>{if(!B||B.type==="none")return null;var se=B.formatter||h||qG,ue=B.value,de=B.name,G=ue,ne=de;if(se){var ie=se(ue,de,B,F,c);if(Array.isArray(ie)){var ce=BG(ie,2);G=ce[0],ne=ce[1]}else if(ie!=null)G=ie;else return null}var U=af(af({},Zs.itemStyle),{},{color:B.color||Zs.itemStyle.color},l);return b.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:U},Hi(ne)?b.createElement("span",{className:"recharts-tooltip-item-name"},ne):null,Hi(ne)?b.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,b.createElement("span",{className:"recharts-tooltip-item-value"},G),b.createElement("span",{className:"recharts-tooltip-item-unit"},B.unit||""))});return b.createElement("ul",{className:"recharts-tooltip-item-list",style:k},P)}return null},A=af(af({},Zs.contentStyle),r),N=af({margin:0},u),O=!yn(x),T=O?x:"",R=Ct("recharts-default-tooltip",v),E=Ct("recharts-tooltip-label",p);O&&S&&c!==void 0&&c!==null&&(T=S(x,c));var D=j?{role:"status","aria-live":"assertive"}:{};return b.createElement("div",hb({className:R,style:A},D),b.createElement("p",{className:E,style:N},b.isValidElement(T)?T:"".concat(T)),C())},lf="recharts-tooltip-wrapper",XG={visibility:"hidden"};function QG(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return Ct(lf,{["".concat(lf,"-right")]:Re(n)&&t&&Re(t.x)&&n>=t.x,["".concat(lf,"-left")]:Re(n)&&t&&Re(t.x)&&n=t.y,["".concat(lf,"-top")]:Re(r)&&t&&Re(t.y)&&r0?l:0),p=n[r]+l;if(t[r])return u[r]?v:p;var x=h[r];if(x==null)return 0;if(u[r]){var S=v,w=x;return SC?Math.max(v,x):Math.max(p,x)}function ZG(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function WG(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,l=e.offsetLeft,o=e.position,u=e.reverseDirection,c=e.tooltipBox,h=e.useTranslate3d,m=e.viewBox,v,p,x;return c&&c.height>0&&c.width>0&&n?(p=HO({allowEscapeViewBox:t,coordinate:n,key:"x",offset:l,position:o,reverseDirection:u,tooltipDimension:c.width,viewBox:m,viewBoxDimension:m.width}),x=HO({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:o,reverseDirection:u,tooltipDimension:c.height,viewBox:m,viewBoxDimension:m.height}),v=ZG({translateX:p,translateY:x,useTranslate3d:h})):v=XG,{cssProperties:v,cssClasses:QG({translateX:p,translateY:x,coordinate:n})}}var JG=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),id={isSsr:JG()};function e7(e,t){return i7(e)||r7(e,t)||n7(e,t)||t7()}function t7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n7(e,t){if(e){if(typeof e=="string")return FO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?FO(e,t):void 0}}function FO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nid.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),t=e7(e,2),n=t[0],r=t[1];return b.useEffect(()=>{if(window.matchMedia){var l=window.matchMedia("(prefers-reduced-motion: reduce)"),o=()=>{r(l.matches)};return l.addEventListener("change",o),()=>{l.removeEventListener("change",o)}}},[]),n}function VO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Ws(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),m=s7(h,2),v=m[0],p=m[1];b.useEffect(()=>{var A=N=>{if(N.key==="Escape"){var O,T,R,E;p({dismissed:!0,dismissedAtCoordinate:{x:(O=(T=e.coordinate)===null||T===void 0?void 0:T.x)!==null&&O!==void 0?O:0,y:(R=(E=e.coordinate)===null||E===void 0?void 0:E.y)!==null&&R!==void 0?R:0}})}};return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(n=e.coordinate)===null||n===void 0?void 0:n.y]),v.dismissed&&(((r=(l=e.coordinate)===null||l===void 0?void 0:l.x)!==null&&r!==void 0?r:0)!==v.dismissedAtCoordinate.x||((o=(u=e.coordinate)===null||u===void 0?void 0:u.y)!==null&&o!==void 0?o:0)!==v.dismissedAtCoordinate.y)&&p(Ws(Ws({},v),{},{dismissed:!1}));var x=WG({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),S=x.cssClasses,w=x.cssProperties,j=e.hasPortalFromProps?{}:Ws(Ws({transition:h7({prefersReducedMotion:c,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},w),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),C=Ws(Ws({},j),{},{visibility:!v.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return b.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:S,style:C,ref:e.innerRef},e.children)}var v7=b.memo(m7),FP=()=>{var e;return(e=ke(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function mb(){return mb=Object.assign?Object.assign.bind():function(e){for(var t=1;tit(e.x)&&it(e.y),XO=e=>e.base!=null&&nv(e.base)&&nv(e),of=e=>e.x,sf=e=>e.y,x7=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(NS(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=YO["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return YO[n]||Uv},QO={connectNulls:!1,type:"linear"},b7=e=>{var t=e.type,n=t===void 0?QO.type:t,r=e.points,l=r===void 0?[]:r,o=e.baseLine,u=e.layout,c=e.connectNulls,h=c===void 0?QO.connectNulls:c,m=x7(n,u),v=h?l.filter(nv):l;if(Array.isArray(o)){var p,x=l.map((A,N)=>KO(KO({},A),{},{base:o[N]}));u==="vertical"?p=nm().y(sf).x1(of).x0(A=>A.base.x):p=nm().x(of).y1(sf).y0(A=>A.base.y);var S=p.defined(XO).curve(m),w=h?x.filter(XO):x;return S(w)}var j;u==="vertical"&&Re(o)?j=nm().y(sf).x1(of).x0(o):Re(o)?j=nm().x(of).y1(sf).y0(o):j=cD().x(of).y(sf);var C=j.defined(nv).curve(m);return C(v)},VP=e=>{var t=e.className,n=e.points,r=e.path,l=e.pathRef,o=Yu();if((!n||!n.length)&&!r)return null;var u={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||o,connectNulls:e.connectNulls},c=n&&n.length?b7(u):r;return b.createElement("path",mb({},Bi(e),IS(e),{className:Ct("recharts-curve",t),d:c===null?void 0:c,ref:l}))},S7=["x","y","top","left","width","height","className"];function vb(){return vb=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(l,"v").concat(r,"M").concat(o,",").concat(t,"h").concat(n),N7=e=>{var t=e.x,n=t===void 0?0:t,r=e.y,l=r===void 0?0:r,o=e.top,u=o===void 0?0:o,c=e.left,h=c===void 0?0:c,m=e.width,v=m===void 0?0:m,p=e.height,x=p===void 0?0:p,S=e.className,w=A7(e,S7),j=w7({x:n,y:l,top:u,left:h,width:v,height:x},w);return!Re(n)||!Re(l)||!Re(v)||!Re(x)||!Re(u)||!Re(h)?null:b.createElement("path",vb({},Xr(j),{className:Ct("recharts-cross",S),d:O7(n,l,v,x,u,h)}))};function T7(e,t,n,r){var l=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-l:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-l,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}var rv=1e-4,GP=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],qP=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),WO=(e,t)=>n=>{var r=GP(e,t);return qP(r,n)},R7=(e,t)=>n=>{var r=GP(e,t),l=[...r.map((o,u)=>o*u).slice(1),0];return qP(l,n)},M7=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var l=r.map(o=>parseFloat(o));return[l[0],l[1],l[2],l[3]]},D7=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var l=WO(e,n),o=WO(t,r),u=R7(e,n),c=m=>m>1?1:m<0?0:m,h=m=>{for(var v=m>1?1:m,p=v,x=0;x<8;++x){var S=l(p)-v,w=u(p);if(Math.abs(S-v)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,l=t.damping,o=l===void 0?8:l,u=t.dt,c=u===void 0?16.67:u,h=1,m=[0],v=0,p=0,x=1e4,S=0;S{var N,O,T;if(A<=0)return 0;if(A>=1)return h;var R=A*C,E=Math.floor(R),D=R-E;return((N=m[E])!==null&&N!==void 0?N:0)+(((O=m[E+1])!==null&&O!==void 0?O:0)-((T=m[E])!==null&&T!==void 0?T:0))*D}},I7=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return JO(e);case"spring":return k7();default:if(e.split("(")[0]==="cubic-bezier")return JO(e)}return typeof e=="function"?e:null},z7=(e,t,n)=>{var r,l=o=>{var u=t.tick(o);if(t.getState()==="active"){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),r=void 0;return}r=e.setTimeout(l,u);return}r=e.setTimeout(l,u)};return r=e.setTimeout(l,0),()=>{var o;return(o=r)===null||o===void 0?void 0:o()}},KP=b.createContext(z7);KP.Provider;function L7(e){var t=b.useContext(KP);return b.useMemo(()=>e??t,[e,t])}function U7(e,t,n){return(t=$7(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $7(e){var t=B7(e,"string");return typeof t=="symbol"?t:t+""}function B7(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var eN="init",tN="pending",nN="active",H7="completed";function Ux(e){return Math.max(0,e)}class F7{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(t){var n;U7(this,"state",eN),this.animationId=t.animationId,this.onAnimationEnd=t.onAnimationEnd,this.animationDuration=Ux(t.animationDuration),this.animationBegin=Ux(t.animationBegin),this.progress=0,this.from=t.from,this.to=t.to,this.easing=t.easing,(n=t.onAnimationStart)===null||n===void 0||n.call(t)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(t){if(this.getState()===eN)return this.state=tN,this.beginStartedTime=t,this.animationBegin;if(this.getState()===tN){if(this.beginStartedTime==null)throw new Error;var n=t-this.beginStartedTime;return n>=this.animationBegin?(this.state=nN,this.animationStartedTime=t,this.nextAnimationUpdate(0)):Ux(this.animationBegin-n)}if(this.getState()===nN){if(this.animationStartedTime==null)throw new Error;var r=t-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(t){this.progress=Math.min(1,Math.max(0,t))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var t;(t=this.onAnimationEnd)===null||t===void 0||t.call(this)}this.state=H7}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class V7 extends F7{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(pa(this.getFrom(),this.getTo(),this.getProgress()))}}class G7{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),l=null,o=u=>{u-r>=n?t(u):l=requestAnimationFrame(o)};return l=requestAnimationFrame(o),()=>{l!=null&&cancelAnimationFrame(l)}}}function q7(e,t){return Q7(e)||X7(e,t)||Y7(e,t)||K7()}function K7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y7(e,t){if(e){if(typeof e=="string")return rN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rN(e,t):void 0}}function rN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{},onAnimationStart:()=>{}},iN=0,$x=1;function YP(e){var t=Tr(e,Z7),n=t.animationId,r=t.isActive,l=t.canBegin,o=t.duration,u=t.easing,c=t.begin,h=t.onAnimationEnd,m=t.onAnimationStart,v=t.children,p=HP(),x=r==="auto"?!id.isSsr&&!p:r,S=L7(t.animationController),w=b.useState(x?iN:$x),j=q7(w,2),C=j[0],A=j[1];return b.useEffect(()=>{x||A($x)},[x]),b.useEffect(()=>{var N=I7(u);if(!x||!l||N==null)return Ku;var O=new G7,T=new V7({animationId:n,easing:N,animationDuration:o,animationBegin:c,onAnimationStart:m,onAnimationEnd:h,from:iN,to:$x});return S(O,T,A)},[S,n,x,l,o,u,c,m,h]),v(Number(C))}function XP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=b.useRef(Tf(t)),r=b.useRef(e);return r.current!==e&&(n.current=Tf(t),r.current=e),n.current}var W7=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),J7=(e,t,n)=>e.map(r=>"".concat(W7(r)," ").concat(t,"ms ").concat(n)).join(","),eq=["radius"],tq=["radius"],aN,lN,oN,sN,uN,cN,fN,dN,hN,mN;function vN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function gN(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var o=ga(n),u=ga(r),c=Math.min(Math.abs(o)/2,Math.abs(u)/2),h=u>=0?1:-1,m=o>=0?1:-1,v=u>=0&&o>=0||u<0&&o<0?1:0,p;if(c>0&&Array.isArray(l)){for(var x=[0,0,0,0],S=0,w=4;Sc?c:C}p=Tn(aN||(aN=Ei(["M",",",""])),e,t+h*x[0]),x[0]>0&&(p+=Tn(lN||(lN=Ei(["A ",",",",0,0,",",",",",""])),x[0],x[0],v,e+m*x[0],t)),p+=Tn(oN||(oN=Ei(["L ",",",""])),e+n-m*x[1],t),x[1]>0&&(p+=Tn(sN||(sN=Ei(["A ",",",",0,0,",`,
- `,",",""])),x[1],x[1],v,e+n,t+h*x[1])),p+=Tn(uN||(uN=Ei(["L ",",",""])),e+n,t+r-h*x[2]),x[2]>0&&(p+=Tn(cN||(cN=Ei(["A ",",",",0,0,",`,
- `,",",""])),x[2],x[2],v,e+n-m*x[2],t+r)),p+=Tn(fN||(fN=Ei(["L ",",",""])),e+m*x[3],t+r),x[3]>0&&(p+=Tn(dN||(dN=Ei(["A ",",",",0,0,",`,
- `,",",""])),x[3],x[3],v,e,t+r-h*x[3])),p+="Z"}else if(c>0&&l===+l&&l>0){var A=Math.min(c,l);p=Tn(hN||(hN=Ei(["M ",",",`
+ */var $O;function DG(){if($O)return zx;$O=1;var e=Hu();function t(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,l=e.useRef,o=e.useEffect,u=e.useMemo,c=e.useDebugValue;return zx.useSyncExternalStoreWithSelector=function(h,m,v,g,x){var S=l(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=u(function(){function C(R){if(!E){if(E=!0,N=R,R=g(R),x!==void 0&&w.hasValue){var A=w.value;if(x(A,R))return O=A}return O=R}if(A=O,n(N,R))return A;var D=g(R);return x!==void 0&&x(A,D)?(N=R,A):(N=R,O=D)}var E=!1,N,O,T=v===void 0?null:v;return[function(){return C(m())},T===null?void 0:function(){return C(T())}]},[m,v,g,x]);var j=r(h,S[0],S[1]);return o(function(){w.hasValue=!0,w.value=j},[j]),c(j),j},zx}var BO;function PG(){return BO||(BO=1,Ix.exports=DG()),Ix.exports}PG();function kG(e){e()}function IG(){let e=null,t=null;return{clear(){e=null,t=null},notify(){kG(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const l=t={callback:n,next:null,prev:t};return l.prev?l.prev.next=l:e=l,function(){!r||e===null||(r=!1,l.next?l.next.prev=l.prev:t=l.prev,l.prev?l.prev.next=l.next:e=l.next)}}}}const HO={notify(){},get:()=>[]};function zG(e,t){let n,r=HO,l=0,o=!1;function u(j){v();const C=r.subscribe(j);let E=!1;return()=>{E||(E=!0,C(),g())}}function c(){r.notify()}function h(){w.onStateChange&&w.onStateChange()}function m(){return o}function v(){l++,n||(n=e.subscribe(h),r=IG())}function g(){l--,n&&l===0&&(n(),n=void 0,r.clear(),r=HO)}function x(){o||(o=!0,v())}function S(){o&&(o=!1,g())}const w={addNestedSub:u,notifyNestedSubs:c,handleChangeWrapper:h,isSubscribed:m,trySubscribe:x,tryUnsubscribe:S,getListeners:()=>r};return w}const LG=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",UG=LG(),$G=()=>typeof navigator<"u"&&navigator.product==="ReactNative",BG=$G(),HG=()=>UG||BG?b.useLayoutEffect:b.useEffect,FG=HG();function FO(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function VG(e,t){if(FO(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let l=0;l{const h=zG(l);return{store:l,subscription:h,getServerState:r!=null?()=>r:void 0}},[l,r]),u=b.useMemo(()=>l.getState(),[l]);FG(()=>{const{subscription:h}=o;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),u!==l.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[o,u]);const c=n||qG;return b.createElement(c.Provider,{value:o},t)}var YG=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function XG(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function ig(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(YG.has(r)){if(e[r]==null&&t[r]==null)continue;if(!VG(e[r],t[r]))return!1}else if(!XG(e[r],t[r]))return!1;return!0}function mb(){return mb=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.separator,n=t===void 0?Zs.separator:t,r=e.contentStyle,l=e.itemStyle,o=e.labelStyle,u=o===void 0?Zs.labelStyle:o,c=e.payload,h=e.formatter,m=e.itemSorter,v=e.wrapperClassName,g=e.labelClassName,x=e.label,S=e.labelFormatter,w=e.accessibilityLayer,j=w===void 0?Zs.accessibilityLayer:w,C=()=>{if(c&&c.length){var k={padding:0,margin:0},I=a7(c,m),P=I.map((B,F)=>{if(!B||B.type==="none")return null;var se=B.formatter||h||i7,ue=B.value,de=B.name,G=ue,ne=de;if(se){var ie=se(ue,de,B,F,c);if(Array.isArray(ie)){var ce=JG(ie,2);G=ce[0],ne=ce[1]}else if(ie!=null)G=ie;else return null}var U=af(af({},Zs.itemStyle),{},{color:B.color||Zs.itemStyle.color},l);return b.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:U},Hi(ne)?b.createElement("span",{className:"recharts-tooltip-item-name"},ne):null,Hi(ne)?b.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,b.createElement("span",{className:"recharts-tooltip-item-value"},G),b.createElement("span",{className:"recharts-tooltip-item-unit"},B.unit||""))});return b.createElement("ul",{className:"recharts-tooltip-item-list",style:k},P)}return null},E=af(af({},Zs.contentStyle),r),N=af({margin:0},u),O=!yn(x),T=O?x:"",R=Ct("recharts-default-tooltip",v),A=Ct("recharts-tooltip-label",g);O&&S&&c!==void 0&&c!==null&&(T=S(x,c));var D=j?{role:"status","aria-live":"assertive"}:{};return b.createElement("div",mb({className:R,style:E},D),b.createElement("p",{className:A,style:N},b.isValidElement(T)?T:"".concat(T)),C())},lf="recharts-tooltip-wrapper",o7={visibility:"hidden"};function s7(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return Ct(lf,{["".concat(lf,"-right")]:Re(n)&&t&&Re(t.x)&&n>=t.x,["".concat(lf,"-left")]:Re(n)&&t&&Re(t.x)&&n=t.y,["".concat(lf,"-top")]:Re(r)&&t&&Re(t.y)&&r0?l:0),g=n[r]+l;if(t[r])return u[r]?v:g;var x=h[r];if(x==null)return 0;if(u[r]){var S=v,w=x;return SC?Math.max(v,x):Math.max(g,x)}function u7(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function c7(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,l=e.offsetLeft,o=e.position,u=e.reverseDirection,c=e.tooltipBox,h=e.useTranslate3d,m=e.viewBox,v,g,x;return c&&c.height>0&&c.width>0&&n?(g=qO({allowEscapeViewBox:t,coordinate:n,key:"x",offset:l,position:o,reverseDirection:u,tooltipDimension:c.width,viewBox:m,viewBoxDimension:m.width}),x=qO({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:o,reverseDirection:u,tooltipDimension:c.height,viewBox:m,viewBoxDimension:m.height}),v=u7({translateX:g,translateY:x,useTranslate3d:h})):v=o7,{cssProperties:v,cssClasses:s7({translateX:g,translateY:x,coordinate:n})}}var f7=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),ad={isSsr:f7()};function d7(e,t){return g7(e)||v7(e,t)||m7(e,t)||h7()}function h7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m7(e,t){if(e){if(typeof e=="string")return KO(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?KO(e,t):void 0}}function KO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nad.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),t=d7(e,2),n=t[0],r=t[1];return b.useEffect(()=>{if(window.matchMedia){var l=window.matchMedia("(prefers-reduced-motion: reduce)"),o=()=>{r(l.matches)};return l.addEventListener("change",o),()=>{l.removeEventListener("change",o)}}},[]),n}function YO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Ws(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),m=b7(h,2),v=m[0],g=m[1];b.useEffect(()=>{var E=N=>{if(N.key==="Escape"){var O,T,R,A;g({dismissed:!0,dismissedAtCoordinate:{x:(O=(T=e.coordinate)===null||T===void 0?void 0:T.x)!==null&&O!==void 0?O:0,y:(R=(A=e.coordinate)===null||A===void 0?void 0:A.y)!==null&&R!==void 0?R:0}})}};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(n=e.coordinate)===null||n===void 0?void 0:n.y]),v.dismissed&&(((r=(l=e.coordinate)===null||l===void 0?void 0:l.x)!==null&&r!==void 0?r:0)!==v.dismissedAtCoordinate.x||((o=(u=e.coordinate)===null||u===void 0?void 0:u.y)!==null&&o!==void 0?o:0)!==v.dismissedAtCoordinate.y)&&g(Ws(Ws({},v),{},{dismissed:!1}));var x=c7({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),S=x.cssClasses,w=x.cssProperties,j=e.hasPortalFromProps?{}:Ws(Ws({transition:_7({prefersReducedMotion:c,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},w),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),C=Ws(Ws({},j),{},{visibility:!v.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return b.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:S,style:C,ref:e.innerRef},e.children)}var A7=b.memo(E7),YP=()=>{var e;return(e=ke(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function vb(){return vb=Object.assign?Object.assign.bind():function(e){for(var t=1;tat(e.x)&&at(e.y),JO=e=>e.base!=null&&rv(e.base)&&rv(e),of=e=>e.x,sf=e=>e.y,R7=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(RS(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=WO["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return WO[n]||$v},eN={connectNulls:!1,type:"linear"},M7=e=>{var t=e.type,n=t===void 0?eN.type:t,r=e.points,l=r===void 0?[]:r,o=e.baseLine,u=e.layout,c=e.connectNulls,h=c===void 0?eN.connectNulls:c,m=R7(n,u),v=h?l.filter(rv):l;if(Array.isArray(o)){var g,x=l.map((E,N)=>ZO(ZO({},E),{},{base:o[N]}));u==="vertical"?g=rm().y(sf).x1(of).x0(E=>E.base.x):g=rm().x(of).y1(sf).y0(E=>E.base.y);var S=g.defined(JO).curve(m),w=h?x.filter(JO):x;return S(w)}var j;u==="vertical"&&Re(o)?j=rm().y(sf).x1(of).x0(o):Re(o)?j=rm().x(of).y1(sf).y0(o):j=vD().x(of).y(sf);var C=j.defined(rv).curve(m);return C(v)},XP=e=>{var t=e.className,n=e.points,r=e.path,l=e.pathRef,o=Yu();if((!n||!n.length)&&!r)return null;var u={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||o,connectNulls:e.connectNulls},c=n&&n.length?M7(u):r;return b.createElement("path",vb({},Bi(e),LS(e),{className:Ct("recharts-curve",t),d:c===null?void 0:c,ref:l}))},D7=["x","y","top","left","width","height","className"];function gb(){return gb=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(l,"v").concat(r,"M").concat(o,",").concat(t,"h").concat(n),B7=e=>{var t=e.x,n=t===void 0?0:t,r=e.y,l=r===void 0?0:r,o=e.top,u=o===void 0?0:o,c=e.left,h=c===void 0?0:c,m=e.width,v=m===void 0?0:m,g=e.height,x=g===void 0?0:g,S=e.className,w=L7(e,D7),j=P7({x:n,y:l,top:u,left:h,width:v,height:x},w);return!Re(n)||!Re(l)||!Re(v)||!Re(x)||!Re(u)||!Re(h)?null:b.createElement("path",gb({},Xr(j),{className:Ct("recharts-cross",S),d:$7(n,l,v,x,u,h)}))};function H7(e,t,n,r){var l=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-l:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-l,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}var iv=1e-4,QP=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],ZP=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),nN=(e,t)=>n=>{var r=QP(e,t);return ZP(r,n)},F7=(e,t)=>n=>{var r=QP(e,t),l=[...r.map((o,u)=>o*u).slice(1),0];return ZP(l,n)},V7=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var l=r.map(o=>parseFloat(o));return[l[0],l[1],l[2],l[3]]},G7=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var l=nN(e,n),o=nN(t,r),u=F7(e,n),c=m=>m>1?1:m<0?0:m,h=m=>{for(var v=m>1?1:m,g=v,x=0;x<8;++x){var S=l(g)-v,w=u(g);if(Math.abs(S-v)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,l=t.damping,o=l===void 0?8:l,u=t.dt,c=u===void 0?16.67:u,h=1,m=[0],v=0,g=0,x=1e4,S=0;S{var N,O,T;if(E<=0)return 0;if(E>=1)return h;var R=E*C,A=Math.floor(R),D=R-A;return((N=m[A])!==null&&N!==void 0?N:0)+(((O=m[A+1])!==null&&O!==void 0?O:0)-((T=m[A])!==null&&T!==void 0?T:0))*D}},Y7=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return rN(e);case"spring":return K7();default:if(e.split("(")[0]==="cubic-bezier")return rN(e)}return typeof e=="function"?e:null},X7=(e,t,n)=>{var r,l=o=>{var u=t.tick(o);if(t.getState()==="active"){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),r=void 0;return}r=e.setTimeout(l,u);return}r=e.setTimeout(l,u)};return r=e.setTimeout(l,0),()=>{var o;return(o=r)===null||o===void 0?void 0:o()}},WP=b.createContext(X7);WP.Provider;function Q7(e){var t=b.useContext(WP);return b.useMemo(()=>e??t,[e,t])}function Z7(e,t,n){return(t=W7(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W7(e){var t=J7(e,"string");return typeof t=="symbol"?t:t+""}function J7(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iN="init",aN="pending",lN="active",eq="completed";function $x(e){return Math.max(0,e)}class tq{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(t){var n;Z7(this,"state",iN),this.animationId=t.animationId,this.onAnimationEnd=t.onAnimationEnd,this.animationDuration=$x(t.animationDuration),this.animationBegin=$x(t.animationBegin),this.progress=0,this.from=t.from,this.to=t.to,this.easing=t.easing,(n=t.onAnimationStart)===null||n===void 0||n.call(t)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(t){if(this.getState()===iN)return this.state=aN,this.beginStartedTime=t,this.animationBegin;if(this.getState()===aN){if(this.beginStartedTime==null)throw new Error;var n=t-this.beginStartedTime;return n>=this.animationBegin?(this.state=lN,this.animationStartedTime=t,this.nextAnimationUpdate(0)):$x(this.animationBegin-n)}if(this.getState()===lN){if(this.animationStartedTime==null)throw new Error;var r=t-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(t){this.progress=Math.min(1,Math.max(0,t))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var t;(t=this.onAnimationEnd)===null||t===void 0||t.call(this)}this.state=eq}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class nq extends tq{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(pa(this.getFrom(),this.getTo(),this.getProgress()))}}class rq{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),l=null,o=u=>{u-r>=n?t(u):l=requestAnimationFrame(o)};return l=requestAnimationFrame(o),()=>{l!=null&&cancelAnimationFrame(l)}}}function iq(e,t){return sq(e)||oq(e,t)||lq(e,t)||aq()}function aq(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lq(e,t){if(e){if(typeof e=="string")return oN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oN(e,t):void 0}}function oN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{},onAnimationStart:()=>{}},sN=0,Bx=1;function JP(e){var t=Tr(e,uq),n=t.animationId,r=t.isActive,l=t.canBegin,o=t.duration,u=t.easing,c=t.begin,h=t.onAnimationEnd,m=t.onAnimationStart,v=t.children,g=KP(),x=r==="auto"?!ad.isSsr&&!g:r,S=Q7(t.animationController),w=b.useState(x?sN:Bx),j=iq(w,2),C=j[0],E=j[1];return b.useEffect(()=>{x||E(Bx)},[x]),b.useEffect(()=>{var N=Y7(u);if(!x||!l||N==null)return Ku;var O=new rq,T=new nq({animationId:n,easing:N,animationDuration:o,animationBegin:c,onAnimationStart:m,onAnimationEnd:h,from:sN,to:Bx});return S(O,T,E)},[S,n,x,l,o,u,c,m,h]),v(Number(C))}function ek(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=b.useRef(Tf(t)),r=b.useRef(e);return r.current!==e&&(n.current=Tf(t),r.current=e),n.current}var cq=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),fq=(e,t,n)=>e.map(r=>"".concat(cq(r)," ").concat(t,"ms ").concat(n)).join(","),dq=["radius"],hq=["radius"],uN,cN,fN,dN,hN,mN,vN,gN,pN,yN;function xN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function bN(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var o=ga(n),u=ga(r),c=Math.min(Math.abs(o)/2,Math.abs(u)/2),h=u>=0?1:-1,m=o>=0?1:-1,v=u>=0&&o>=0||u<0&&o<0?1:0,g;if(c>0&&Array.isArray(l)){for(var x=[0,0,0,0],S=0,w=4;Sc?c:C}g=Tn(uN||(uN=Ai(["M",",",""])),e,t+h*x[0]),x[0]>0&&(g+=Tn(cN||(cN=Ai(["A ",",",",0,0,",",",",",""])),x[0],x[0],v,e+m*x[0],t)),g+=Tn(fN||(fN=Ai(["L ",",",""])),e+n-m*x[1],t),x[1]>0&&(g+=Tn(dN||(dN=Ai(["A ",",",",0,0,",`,
+ `,",",""])),x[1],x[1],v,e+n,t+h*x[1])),g+=Tn(hN||(hN=Ai(["L ",",",""])),e+n,t+r-h*x[2]),x[2]>0&&(g+=Tn(mN||(mN=Ai(["A ",",",",0,0,",`,
+ `,",",""])),x[2],x[2],v,e+n-m*x[2],t+r)),g+=Tn(vN||(vN=Ai(["L ",",",""])),e+m*x[3],t+r),x[3]>0&&(g+=Tn(gN||(gN=Ai(["A ",",",",0,0,",`,
+ `,",",""])),x[3],x[3],v,e,t+r-h*x[3])),g+="Z"}else if(c>0&&l===+l&&l>0){var E=Math.min(c,l);g=Tn(pN||(pN=Ai(["M ",",",`
A `,",",",0,0,",",",",",`
L `,",",`
A `,",",",0,0,",",",",",`
L `,",",`
A `,",",",0,0,",",",",",`
L `,",",`
- A `,",",",0,0,",",",","," Z"])),e,t+h*A,A,A,v,e+m*A,t,e+n-m*A,t,A,A,v,e+n,t+h*A,e+n,t+r-h*A,A,A,v,e+n-m*A,t+r,e+m*A,t+r,A,A,v,e,t+r-h*A)}else p=Tn(mN||(mN=Ei(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return p},bN={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},fq=e=>{var t=Tr(e,bN),n=b.useRef(null),r=b.useState(-1),l=lq(r,2),o=l[0],u=l[1];b.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var ie=n.current.getTotalLength();ie&&u(ie)}catch{}},[]);var c=t.x,h=t.y,m=t.width,v=t.height,p=t.radius,x=t.className,S=t.animationEasing,w=t.animationDuration,j=t.animationBegin,C=t.isAnimationActive,A=t.isUpdateAnimationActive,N=b.useRef(m),O=b.useRef(v),T=b.useRef(c),R=b.useRef(h),E=b.useMemo(()=>({x:c,y:h,width:m,height:v,radius:p}),[c,h,m,v,p]),D=XP(E,"rectangle-");if(c!==+c||h!==+h||m!==+m||v!==+v||m===0||v===0)return null;var k=Ct("recharts-rectangle",x);if(!A){var I=Xr(t);I.radius;var P=pN(I,eq);return b.createElement("path",iv({},P,{x:ga(c),y:ga(h),width:ga(m),height:ga(v),radius:typeof p=="number"?p:void 0,className:k,d:xN(c,h,m,v,p)}))}var B=N.current,F=O.current,se=T.current,ue=R.current,de="0px ".concat(o===-1?1:o,"px"),G="".concat(o,"px ").concat(o,"px"),ne=J7(["strokeDasharray"],w,typeof S=="string"?S:bN.animationEasing);return b.createElement(YP,{animationId:D,key:D,canBegin:o>0,duration:w,easing:S,isActive:A,begin:j},ie=>{var ce=pa(B,m,ie),U=pa(F,v,ie),Ee=pa(se,c,ie),ee=pa(ue,h,ie);n.current&&(N.current=ce,O.current=U,T.current=Ee,R.current=ee);var ve;C?ie>0?ve={transition:ne,strokeDasharray:G}:ve={strokeDasharray:de}:ve={strokeDasharray:G};var z=Xr(t);z.radius;var Y=pN(z,tq);return b.createElement("path",iv({},Y,{radius:typeof p=="number"?p:void 0,className:k,d:xN(Ee,ee,ce,U,p),ref:n,style:gN(gN({},ve),t.style)}))})};function SN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function wN(e){for(var t=1;te*180/Math.PI,Dn=(e,t,n,r)=>({x:e+Math.cos(-av*r)*n,y:t+Math.sin(-av*r)*n}),gq=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},pq=(e,t)=>{var n=e.x,r=e.y,l=t.x,o=t.y;return Math.sqrt((n-l)**2+(r-o)**2)},yq=(e,t)=>{var n=e.x,r=e.y,l=t.cx,o=t.cy,u=pq({x:n,y:r},{x:l,y:o});if(u<=0)return{radius:u,angle:0};var c=(n-l)/u,h=Math.acos(c);return r>o&&(h=2*Math.PI-h),{radius:u,angle:vq(h),angleInRadian:h}},xq=e=>{var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),l=Math.floor(n/360),o=Math.min(r,l);return{startAngle:t-o*360,endAngle:n-o*360}},bq=(e,t)=>{var n=t.startAngle,r=t.endAngle,l=Math.floor(n/360),o=Math.floor(r/360),u=Math.min(l,o);return e+u*360},Sq=(e,t)=>{var n=e.relativeX,r=e.relativeY,l=yq({x:n,y:r},t),o=l.radius,u=l.angle,c=t.innerRadius,h=t.outerRadius;if(oh||o===0)return null;var m=xq(t),v=m.startAngle,p=m.endAngle,x=u,S;if(v<=p){for(;x>p;)x-=360;for(;x=v&&x<=p}else{for(;x>v;)x-=360;for(;x=p&&x<=v}return S?wN(wN({},t),{},{radius:o,angle:bq(x,t)}):null};function QP(e){var t=e.cx,n=e.cy,r=e.radius,l=e.startAngle,o=e.endAngle,u=Dn(t,n,r,l),c=Dn(t,n,r,o);return{points:[u,c],cx:t,cy:n,radius:r,startAngle:l,endAngle:o}}var jN,CN,_N,AN,EN,ON,NN;function gb(){return gb=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=Vr(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},um=e=>{var t=e.cx,n=e.cy,r=e.radius,l=e.angle,o=e.sign,u=e.isExternal,c=e.cornerRadius,h=e.cornerIsExternal,m=c*(u?1:-1)+r,v=Math.asin(c/m)/av,p=h?l:l+o*v,x=Dn(t,n,m,p),S=Dn(t,n,r,p),w=h?l-o*v:l,j=Dn(t,n,m*Math.cos(v*av),w);return{center:x,circleTangency:S,lineTangency:j,theta:v}},ZP=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,l=e.outerRadius,o=e.startAngle,u=e.endAngle,c=wq(o,u),h=o+c,m=Dn(t,n,l,o),v=Dn(t,n,l,h),p=Tn(jN||(jN=wo(["M ",",",`
+ A `,",",",0,0,",",",","," Z"])),e,t+h*E,E,E,v,e+m*E,t,e+n-m*E,t,E,E,v,e+n,t+h*E,e+n,t+r-h*E,E,E,v,e+n-m*E,t+r,e+m*E,t+r,E,E,v,e,t+r-h*E)}else g=Tn(yN||(yN=Ai(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return g},CN={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},jq=e=>{var t=Tr(e,CN),n=b.useRef(null),r=b.useState(-1),l=yq(r,2),o=l[0],u=l[1];b.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var ie=n.current.getTotalLength();ie&&u(ie)}catch{}},[]);var c=t.x,h=t.y,m=t.width,v=t.height,g=t.radius,x=t.className,S=t.animationEasing,w=t.animationDuration,j=t.animationBegin,C=t.isAnimationActive,E=t.isUpdateAnimationActive,N=b.useRef(m),O=b.useRef(v),T=b.useRef(c),R=b.useRef(h),A=b.useMemo(()=>({x:c,y:h,width:m,height:v,radius:g}),[c,h,m,v,g]),D=ek(A,"rectangle-");if(c!==+c||h!==+h||m!==+m||v!==+v||m===0||v===0)return null;var k=Ct("recharts-rectangle",x);if(!E){var I=Xr(t);I.radius;var P=SN(I,dq);return b.createElement("path",av({},P,{x:ga(c),y:ga(h),width:ga(m),height:ga(v),radius:typeof g=="number"?g:void 0,className:k,d:jN(c,h,m,v,g)}))}var B=N.current,F=O.current,se=T.current,ue=R.current,de="0px ".concat(o===-1?1:o,"px"),G="".concat(o,"px ").concat(o,"px"),ne=fq(["strokeDasharray"],w,typeof S=="string"?S:CN.animationEasing);return b.createElement(JP,{animationId:D,key:D,canBegin:o>0,duration:w,easing:S,isActive:E,begin:j},ie=>{var ce=pa(B,m,ie),U=pa(F,v,ie),Ae=pa(se,c,ie),ee=pa(ue,h,ie);n.current&&(N.current=ce,O.current=U,T.current=Ae,R.current=ee);var ve;C?ie>0?ve={transition:ne,strokeDasharray:G}:ve={strokeDasharray:de}:ve={strokeDasharray:G};var z=Xr(t);z.radius;var Y=SN(z,hq);return b.createElement("path",av({},Y,{radius:typeof g=="number"?g:void 0,className:k,d:jN(Ae,ee,ce,U,g),ref:n,style:bN(bN({},ve),t.style)}))})};function _N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function EN(e){for(var t=1;te*180/Math.PI,Dn=(e,t,n,r)=>({x:e+Math.cos(-lv*r)*n,y:t+Math.sin(-lv*r)*n}),Oq=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Nq=(e,t)=>{var n=e.x,r=e.y,l=t.x,o=t.y;return Math.sqrt((n-l)**2+(r-o)**2)},Tq=(e,t)=>{var n=e.x,r=e.y,l=t.cx,o=t.cy,u=Nq({x:n,y:r},{x:l,y:o});if(u<=0)return{radius:u,angle:0};var c=(n-l)/u,h=Math.acos(c);return r>o&&(h=2*Math.PI-h),{radius:u,angle:Aq(h),angleInRadian:h}},Rq=e=>{var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),l=Math.floor(n/360),o=Math.min(r,l);return{startAngle:t-o*360,endAngle:n-o*360}},Mq=(e,t)=>{var n=t.startAngle,r=t.endAngle,l=Math.floor(n/360),o=Math.floor(r/360),u=Math.min(l,o);return e+u*360},Dq=(e,t)=>{var n=e.relativeX,r=e.relativeY,l=Tq({x:n,y:r},t),o=l.radius,u=l.angle,c=t.innerRadius,h=t.outerRadius;if(oh||o===0)return null;var m=Rq(t),v=m.startAngle,g=m.endAngle,x=u,S;if(v<=g){for(;x>g;)x-=360;for(;x=v&&x<=g}else{for(;x>v;)x-=360;for(;x=g&&x<=v}return S?EN(EN({},t),{},{radius:o,angle:Mq(x,t)}):null};function tk(e){var t=e.cx,n=e.cy,r=e.radius,l=e.startAngle,o=e.endAngle,u=Dn(t,n,r,l),c=Dn(t,n,r,o);return{points:[u,c],cx:t,cy:n,radius:r,startAngle:l,endAngle:o}}var AN,ON,NN,TN,RN,MN,DN;function pb(){return pb=Object.assign?Object.assign.bind():function(e){for(var t=1;t