================================================================================ PROJECT: ClassNotify SNAPSHOT_ID: 20261002-032041-73dd8d7 BUNDLE: 3/8 GIT_HEAD: 73dd8d7c5feb1cc42c8a6f218815748bfbe88bf3 WORKTREE_DIRTY: true FILES_IN_BUNDLE: 48 ================================================================================ ================================================================================ FILE BEGIN: src/Server/ClassNotify.Server/wwwroot/assets/index-BG-C4jY1.js SHA256: e7edc6c529363a6470050e6870bf72c27889c65f9fb5f25bbb3309d2509a37cb SIZE: 817671 ================================================================================ var Cm=Object.defineProperty;var _m=(a,l,i)=>l in a?Cm(a,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[l]=i;var ws=(a,l,i)=>_m(a,typeof l!="symbol"?l+"":l,i);function Em(a,l){for(var i=0;ic[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))c(u);new MutationObserver(u=>{for(const m of u)if(m.type==="childList")for(const p of m.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&c(p)}).observe(document,{childList:!0,subtree:!0});function i(u){const m={};return u.integrity&&(m.integrity=u.integrity),u.referrerPolicy&&(m.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?m.credentials="include":u.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(u){if(u.ep)return;u.ep=!0;const m=i(u);fetch(u.href,m)}})();function T0(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var hc={exports:{}},ia={},pc={exports:{}},Ze={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var s0;function Tm(){if(s0)return Ze;s0=1;var a=Symbol.for("react.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),p=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),j=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),T=Symbol.iterator;function C(g){return g===null||typeof g!="object"?null:(g=T&&g[T]||g["@@iterator"],typeof g=="function"?g:null)}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},P=Object.assign,q={};function v(g,B,ue){this.props=g,this.context=B,this.refs=q,this.updater=ue||I}v.prototype.isReactComponent={},v.prototype.setState=function(g,B){if(typeof g!="object"&&typeof g!="function"&&g!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,g,B,"setState")},v.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};function w(){}w.prototype=v.prototype;function M(g,B,ue){this.props=g,this.context=B,this.refs=q,this.updater=ue||I}var Y=M.prototype=new w;Y.constructor=M,P(Y,v.prototype),Y.isPureReactComponent=!0;var z=Array.isArray,ae=Object.prototype.hasOwnProperty,le={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function pe(g,B,ue){var U,ge={},je=null,Ne=null;if(B!=null)for(U in B.ref!==void 0&&(Ne=B.ref),B.key!==void 0&&(je=""+B.key),B)ae.call(B,U)&&!O.hasOwnProperty(U)&&(ge[U]=B[U]);var ye=arguments.length-2;if(ye===1)ge.children=ue;else if(1>>1,B=G[g];if(0>>1;gu(ge,se))jeu(Ne,ge)?(G[g]=Ne,G[je]=se,g=je):(G[g]=ge,G[U]=se,g=U);else if(jeu(Ne,se))G[g]=Ne,G[je]=se,g=je;else break e}}return re}function u(G,re){var se=G.sortIndex-re.sortIndex;return se!==0?se:G.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var p=Date,b=p.now();a.unstable_now=function(){return p.now()-b}}var f=[],j=[],k=1,T=null,C=3,I=!1,P=!1,q=!1,v=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Y(G){for(var re=i(j);re!==null;){if(re.callback===null)c(j);else if(re.startTime<=G)c(j),re.sortIndex=re.expirationTime,l(f,re);else break;re=i(j)}}function z(G){if(q=!1,Y(G),!P)if(i(f)!==null)P=!0,K(ae);else{var re=i(j);re!==null&&Z(z,re.startTime-G)}}function ae(G,re){P=!1,q&&(q=!1,w(pe),pe=-1),I=!0;var se=C;try{for(Y(re),T=i(f);T!==null&&(!(T.expirationTime>re)||G&&!Q());){var g=T.callback;if(typeof g=="function"){T.callback=null,C=T.priorityLevel;var B=g(T.expirationTime<=re);re=a.unstable_now(),typeof B=="function"?T.callback=B:T===i(f)&&c(f),Y(re)}else c(f);T=i(f)}if(T!==null)var ue=!0;else{var U=i(j);U!==null&&Z(z,U.startTime-re),ue=!1}return ue}finally{T=null,C=se,I=!1}}var le=!1,O=null,pe=-1,ne=5,ve=-1;function Q(){return!(a.unstable_now()-veG||125g?(G.sortIndex=se,l(j,G),i(f)===null&&G===i(j)&&(q?(w(pe),pe=-1):q=!0,Z(z,se-g))):(G.sortIndex=B,l(f,G),P||I||(P=!0,K(ae))),G},a.unstable_shouldYield=Q,a.unstable_wrapCallback=function(G){var re=C;return function(){var se=C;C=re;try{return G.apply(this,arguments)}finally{C=se}}}})(bc)),bc}var i0;function $m(){return i0||(i0=1,gc.exports=Pm()),gc.exports}/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var o0;function Lm(){if(o0)return Ps;o0=1;var a=Ic(),l=$m();function i(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,j=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,k={},T={};function C(t){return f.call(T,t)?!0:f.call(k,t)?!1:j.test(t)?T[t]=!0:(k[t]=!0,!1)}function I(t,s,n,r){if(n!==null&&n.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function P(t,s,n,r){if(s===null||typeof s>"u"||I(t,s,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function q(t,s,n,r,o,d,h){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=t,this.type=s,this.sanitizeURL=d,this.removeEmptyString=h}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){v[t]=new q(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];v[s]=new q(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){v[t]=new q(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){v[t]=new q(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){v[t]=new q(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){v[t]=new q(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){v[t]=new q(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){v[t]=new q(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){v[t]=new q(t,5,!1,t.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function M(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var s=t.replace(w,M);v[s]=new q(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(w,M);v[s]=new q(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(w,M);v[s]=new q(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){v[t]=new q(t,1,!1,t.toLowerCase(),null,!1,!1)}),v.xlinkHref=new q("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){v[t]=new q(t,1,!1,t.toLowerCase(),null,!0,!0)});function Y(t,s,n,r){var o=v.hasOwnProperty(s)?v[s]:null;(o!==null?o.type!==0:r||!(2N||o[h]!==d[N]){var S=` `+o[h].replace(" at new "," at ");return t.displayName&&S.includes("")&&(S=S.replace("",t.displayName)),S}while(1<=h&&0<=N);break}}}finally{ue=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?B(t):""}function ge(t){switch(t.tag){case 5:return B(t.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return t=U(t.type,!1),t;case 11:return t=U(t.type.render,!1),t;case 1:return t=U(t.type,!0),t;default:return""}}function je(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case O:return"Fragment";case le:return"Portal";case ne:return"Profiler";case pe:return"StrictMode";case W:return"Suspense";case te:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Q:return(t.displayName||"Context")+".Consumer";case ve:return(t._context.displayName||"Context")+".Provider";case R:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Le:return s=t.displayName||null,s!==null?s:je(t.type)||"Memo";case K:s=t._payload,t=t._init;try{return je(t(s))}catch{}}return null}function Ne(t){var s=t.type;switch(t.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return je(s);case 8:return s===pe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function ye(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function de(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function De(t){var s=de(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),r=""+t[s];if(!t.hasOwnProperty(s)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,d=n.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return o.call(this)},set:function(h){r=""+h,d.call(this,h)}}),Object.defineProperty(t,s,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(h){r=""+h},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function et(t){t._valueTracker||(t._valueTracker=De(t))}function ct(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var n=s.getValue(),r="";return t&&(r=de(t)?t.checked?"true":"false":t.value),t=r,t!==n?(s.setValue(t),!0):!1}function Je(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function We(t,s){var n=s.checked;return se({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function tt(t,s){var n=s.defaultValue==null?"":s.defaultValue,r=s.checked!=null?s.checked:s.defaultChecked;n=ye(s.value!=null?s.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function At(t,s){s=s.checked,s!=null&&Y(t,"checked",s,!1)}function Et(t,s){At(t,s);var n=ye(s.value),r=s.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?pt(t,s.type,n):s.hasOwnProperty("defaultValue")&&pt(t,s.type,ye(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function Wt(t,s,n){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var r=s.type;if(!(r!=="submit"&&r!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+t._wrapperState.initialValue,n||s===t.value||(t.value=s),t.defaultValue=s}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function pt(t,s,n){(s!=="number"||Je(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Tt=Array.isArray;function nt(t,s,n,r){if(t=t.options,s){s={};for(var o=0;o"+s.valueOf().toString()+"",s=Xe.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function E(t,s){if(s){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=s;return}}t.textContent=s}var y={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},be=["Webkit","ms","Moz","O"];Object.keys(y).forEach(function(t){be.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),y[s]=y[t]})});function Oe(t,s,n){return s==null||typeof s=="boolean"||s===""?"":n||typeof s!="number"||s===0||y.hasOwnProperty(t)&&y[t]?(""+s).trim():s+"px"}function Ue(t,s){t=t.style;for(var n in s)if(s.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Oe(n,s[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var jt=se({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lt(t,s){if(s){if(jt[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(i(137,t));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(i(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(i(61))}if(s.style!=null&&typeof s.style!="object")throw Error(i(62))}}function zt(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ye=null;function Ss(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var He=null,It=null,Rt=null;function Js(t){if(t=Kr(t)){if(typeof He!="function")throw Error(i(280));var s=t.stateNode;s&&(s=Oa(s),He(t.stateNode,t.type,s))}}function Dn(t){It?Rt?Rt.push(t):Rt=[t]:It=t}function $(){if(It){var t=It,s=Rt;if(Rt=It=null,Js(t),s)for(t=0;t>>=0,t===0?32:31-(Vl(t)/_r|0)|0}var hl=64,pl=4194304;function yn(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Xs(t,s){var n=t.pendingLanes;if(n===0)return 0;var r=0,o=t.suspendedLanes,d=t.pingedLanes,h=n&268435455;if(h!==0){var N=h&~o;N!==0?r=yn(N):(d&=h,d!==0&&(r=yn(d)))}else h=n&~o,h!==0?r=yn(h):d!==0&&(r=yn(d));if(r===0)return 0;if(s!==0&&s!==r&&(s&o)===0&&(o=r&-r,d=s&-s,o>=d||o===16&&(d&4194240)!==0))return s;if((r&4)!==0&&(r|=n&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=r;0n;n++)s.push(t);return s}function fl(t,s,n){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-xs(s),t[s]=n}function Oi(t,s){var n=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Mr),Jc=" ",Gc=!1;function Xc(t,s){switch(t){case"keyup":return yx.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yc(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ql=!1;function wx(t,s){switch(t){case"compositionend":return Yc(s);case"keypress":return s.which!==32?null:(Gc=!0,Jc);case"textInput":return t=s.data,t===Jc&&Gc?null:t;default:return null}}function kx(t,s){if(ql)return t==="compositionend"||!qi&&Xc(t,s)?(t=Hc(),_a=zi=On=null,ql=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:n,offset:s-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rd(n)}}function id(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?id(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function od(){for(var t=window,s=Je();s instanceof t.HTMLIFrameElement;){try{var n=typeof s.contentWindow.location.href=="string"}catch{n=!1}if(n)t=s.contentWindow;else break;s=Je(t.document)}return s}function Gi(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Px(t){var s=od(),n=t.focusedElem,r=t.selectionRange;if(s!==n&&n&&n.ownerDocument&&id(n.ownerDocument.documentElement,n)){if(r!==null&&Gi(n)){if(s=r.start,t=r.end,t===void 0&&(t=s),"selectionStart"in n)n.selectionStart=s,n.selectionEnd=Math.min(t,n.value.length);else if(t=(s=n.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var o=n.textContent.length,d=Math.min(r.start,o);r=r.end===void 0?d:Math.min(r.end,o),!t.extend&&d>r&&(o=r,r=d,d=o),o=ad(n,d);var h=ad(n,r);o&&h&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==h.node||t.focusOffset!==h.offset)&&(s=s.createRange(),s.setStart(o.node,o.offset),t.removeAllRanges(),d>r?(t.addRange(s),t.extend(h.node,h.offset)):(s.setEnd(h.node,h.offset),t.addRange(s)))}}for(s=[],t=n;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ql=null,Xi=null,zr=null,Yi=!1;function cd(t,s,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Yi||Ql==null||Ql!==Je(r)||(r=Ql,"selectionStart"in r&&Gi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),zr&&Fr(zr,r)||(zr=r,r=La(Xi,"onSelect"),0Zl||(t.current=uo[Zl],uo[Zl]=null,Zl--)}function St(t,s){Zl++,uo[Zl]=t.current,t.current=s}var Bn={},hs=zn(Bn),Es=zn(!1),bl=Bn;function er(t,s){var n=t.type.contextTypes;if(!n)return Bn;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===s)return r.__reactInternalMemoizedMaskedChildContext;var o={},d;for(d in n)o[d]=s[d];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=o),o}function Ts(t){return t=t.childContextTypes,t!=null}function Ua(){Lt(Es),Lt(hs)}function kd(t,s,n){if(hs.current!==Bn)throw Error(i(168));St(hs,s),St(Es,n)}function Sd(t,s,n){var r=t.stateNode;if(s=s.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in s))throw Error(i(108,Ne(t)||"Unknown",o));return se({},n,r)}function Fa(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Bn,bl=hs.current,St(hs,t),St(Es,Es.current),!0}function Cd(t,s,n){var r=t.stateNode;if(!r)throw Error(i(169));n?(t=Sd(t,s,bl),r.__reactInternalMemoizedMergedChildContext=t,Lt(Es),Lt(hs),St(hs,t)):Lt(Es),St(Es,n)}var kn=null,za=!1,xo=!1;function _d(t){kn===null?kn=[t]:kn.push(t)}function Wx(t){za=!0,_d(t)}function Hn(){if(!xo&&kn!==null){xo=!0;var t=0,s=mt;try{var n=kn;for(mt=1;t>=h,o-=h,Sn=1<<32-xs(s)+o|n<Ve?(rs=ze,ze=null):rs=ze.sibling;var ut=ie(D,ze,L[Ve],fe);if(ut===null){ze===null&&(ze=rs);break}t&&ze&&ut.alternate===null&&s(D,ze),_=d(ut,_,Ve),Fe===null?Ae=ut:Fe.sibling=ut,Fe=ut,ze=rs}if(Ve===L.length)return n(D,ze),Mt&&jl(D,Ve),Ae;if(ze===null){for(;VeVe?(rs=ze,ze=null):rs=ze.sibling;var Yn=ie(D,ze,ut.value,fe);if(Yn===null){ze===null&&(ze=rs);break}t&&ze&&Yn.alternate===null&&s(D,ze),_=d(Yn,_,Ve),Fe===null?Ae=Yn:Fe.sibling=Yn,Fe=Yn,ze=rs}if(ut.done)return n(D,ze),Mt&&jl(D,Ve),Ae;if(ze===null){for(;!ut.done;Ve++,ut=L.next())ut=xe(D,ut.value,fe),ut!==null&&(_=d(ut,_,Ve),Fe===null?Ae=ut:Fe.sibling=ut,Fe=ut);return Mt&&jl(D,Ve),Ae}for(ze=r(D,ze);!ut.done;Ve++,ut=L.next())ut=Se(ze,D,Ve,ut.value,fe),ut!==null&&(t&&ut.alternate!==null&&ze.delete(ut.key===null?Ve:ut.key),_=d(ut,_,Ve),Fe===null?Ae=ut:Fe.sibling=ut,Fe=ut);return t&&ze.forEach(function(Sm){return s(D,Sm)}),Mt&&jl(D,Ve),Ae}function qt(D,_,L,fe){if(typeof L=="object"&&L!==null&&L.type===O&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case ae:e:{for(var Ae=L.key,Fe=_;Fe!==null;){if(Fe.key===Ae){if(Ae=L.type,Ae===O){if(Fe.tag===7){n(D,Fe.sibling),_=o(Fe,L.props.children),_.return=D,D=_;break e}}else if(Fe.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===K&&Pd(Ae)===Fe.type){n(D,Fe.sibling),_=o(Fe,L.props),_.ref=qr(D,Fe,L),_.return=D,D=_;break e}n(D,Fe);break}else s(D,Fe);Fe=Fe.sibling}L.type===O?(_=El(L.props.children,D.mode,fe,L.key),_.return=D,D=_):(fe=pi(L.type,L.key,L.props,null,D.mode,fe),fe.ref=qr(D,_,L),fe.return=D,D=fe)}return h(D);case le:e:{for(Fe=L.key;_!==null;){if(_.key===Fe)if(_.tag===4&&_.stateNode.containerInfo===L.containerInfo&&_.stateNode.implementation===L.implementation){n(D,_.sibling),_=o(_,L.children||[]),_.return=D,D=_;break e}else{n(D,_);break}else s(D,_);_=_.sibling}_=cc(L,D.mode,fe),_.return=D,D=_}return h(D);case K:return Fe=L._init,qt(D,_,Fe(L._payload),fe)}if(Tt(L))return Re(D,_,L,fe);if(re(L))return $e(D,_,L,fe);Wa(D,L)}return typeof L=="string"&&L!==""||typeof L=="number"?(L=""+L,_!==null&&_.tag===6?(n(D,_.sibling),_=o(_,L),_.return=D,D=_):(n(D,_),_=oc(L,D.mode,fe),_.return=D,D=_),h(D)):n(D,_)}return qt}var lr=$d(!0),Ld=$d(!1),Ka=zn(null),qa=null,rr=null,bo=null;function vo(){bo=rr=qa=null}function jo(t){var s=Ka.current;Lt(Ka),t._currentValue=s}function yo(t,s,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,r!==null&&(r.childLanes|=s)):r!==null&&(r.childLanes&s)!==s&&(r.childLanes|=s),t===n)break;t=t.return}}function ar(t,s){qa=t,bo=rr=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(Is=!0),t.firstContext=null)}function Ws(t){var s=t._currentValue;if(bo!==t)if(t={context:t,memoizedValue:s,next:null},rr===null){if(qa===null)throw Error(i(308));rr=t,qa.dependencies={lanes:0,firstContext:t}}else rr=rr.next=t;return s}var yl=null;function No(t){yl===null?yl=[t]:yl.push(t)}function Ad(t,s,n,r){var o=s.interleaved;return o===null?(n.next=n,No(s)):(n.next=o.next,o.next=n),s.interleaved=n,_n(t,r)}function _n(t,s){t.lanes|=s;var n=t.alternate;for(n!==null&&(n.lanes|=s),n=t,t=t.return;t!==null;)t.childLanes|=s,n=t.alternate,n!==null&&(n.childLanes|=s),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Vn=!1;function wo(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Md(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function En(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function Wn(t,s,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,(at&2)!==0){var o=r.pending;return o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s,_n(t,n)}return o=r.interleaved,o===null?(s.next=s,No(r)):(s.next=o.next,o.next=s),r.interleaved=s,_n(t,n)}function Qa(t,s,n){if(s=s.updateQueue,s!==null&&(s=s.shared,(n&4194240)!==0)){var r=s.lanes;r&=t.pendingLanes,n|=r,s.lanes=n,Ir(t,n)}}function Od(t,s){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var h={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};d===null?o=d=h:d=d.next=h,n=n.next}while(n!==null);d===null?o=d=s:d=d.next=s}else o=d=s;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:d,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=s:t.next=s,n.lastBaseUpdate=s}function Ja(t,s,n,r){var o=t.updateQueue;Vn=!1;var d=o.firstBaseUpdate,h=o.lastBaseUpdate,N=o.shared.pending;if(N!==null){o.shared.pending=null;var S=N,F=S.next;S.next=null,h===null?d=F:h.next=F,h=S;var oe=t.alternate;oe!==null&&(oe=oe.updateQueue,N=oe.lastBaseUpdate,N!==h&&(N===null?oe.firstBaseUpdate=F:N.next=F,oe.lastBaseUpdate=S))}if(d!==null){var xe=o.baseState;h=0,oe=F=S=null,N=d;do{var ie=N.lane,Se=N.eventTime;if((r&ie)===ie){oe!==null&&(oe=oe.next={eventTime:Se,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var Re=t,$e=N;switch(ie=s,Se=n,$e.tag){case 1:if(Re=$e.payload,typeof Re=="function"){xe=Re.call(Se,xe,ie);break e}xe=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=$e.payload,ie=typeof Re=="function"?Re.call(Se,xe,ie):Re,ie==null)break e;xe=se({},xe,ie);break e;case 2:Vn=!0}}N.callback!==null&&N.lane!==0&&(t.flags|=64,ie=o.effects,ie===null?o.effects=[N]:ie.push(N))}else Se={eventTime:Se,lane:ie,tag:N.tag,payload:N.payload,callback:N.callback,next:null},oe===null?(F=oe=Se,S=xe):oe=oe.next=Se,h|=ie;if(N=N.next,N===null){if(N=o.shared.pending,N===null)break;ie=N,N=ie.next,ie.next=null,o.lastBaseUpdate=ie,o.shared.pending=null}}while(!0);if(oe===null&&(S=xe),o.baseState=S,o.firstBaseUpdate=F,o.lastBaseUpdate=oe,s=o.shared.interleaved,s!==null){o=s;do h|=o.lane,o=o.next;while(o!==s)}else d===null&&(o.shared.lanes=0);kl|=h,t.lanes=h,t.memoizedState=xe}}function Ud(t,s,n){if(t=s.effects,s.effects=null,t!==null)for(s=0;sn?n:4,t(!0);var r=Eo.transition;Eo.transition={};try{t(!1),s()}finally{mt=n,Eo.transition=r}}function lu(){return Ks().memoizedState}function Jx(t,s,n){var r=Jn(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ru(t))au(s,n);else if(n=Ad(t,s,n,r),n!==null){var o=Ns();ln(n,t,r,o),iu(n,s,r)}}function Gx(t,s,n){var r=Jn(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ru(t))au(s,o);else{var d=t.alternate;if(t.lanes===0&&(d===null||d.lanes===0)&&(d=s.lastRenderedReducer,d!==null))try{var h=s.lastRenderedState,N=d(h,n);if(o.hasEagerState=!0,o.eagerState=N,Zs(N,h)){var S=s.interleaved;S===null?(o.next=o,No(s)):(o.next=S.next,S.next=o),s.interleaved=o;return}}catch{}finally{}n=Ad(t,s,o,r),n!==null&&(o=Ns(),ln(n,t,r,o),iu(n,s,r))}}function ru(t){var s=t.alternate;return t===Ut||s!==null&&s===Ut}function au(t,s){Xr=Ya=!0;var n=t.pending;n===null?s.next=s:(s.next=n.next,n.next=s),t.pending=s}function iu(t,s,n){if((n&4194240)!==0){var r=s.lanes;r&=t.pendingLanes,n|=r,s.lanes=n,Ir(t,n)}}var ti={readContext:Ws,useCallback:ps,useContext:ps,useEffect:ps,useImperativeHandle:ps,useInsertionEffect:ps,useLayoutEffect:ps,useMemo:ps,useReducer:ps,useRef:ps,useState:ps,useDebugValue:ps,useDeferredValue:ps,useTransition:ps,useMutableSource:ps,useSyncExternalStore:ps,useId:ps,unstable_isNewReconciler:!1},Xx={readContext:Ws,useCallback:function(t,s){return fn().memoizedState=[t,s===void 0?null:s],t},useContext:Ws,useEffect:Gd,useImperativeHandle:function(t,s,n){return n=n!=null?n.concat([t]):null,Za(4194308,4,Zd.bind(null,s,t),n)},useLayoutEffect:function(t,s){return Za(4194308,4,t,s)},useInsertionEffect:function(t,s){return Za(4,2,t,s)},useMemo:function(t,s){var n=fn();return s=s===void 0?null:s,t=t(),n.memoizedState=[t,s],t},useReducer:function(t,s,n){var r=fn();return s=n!==void 0?n(s):s,r.memoizedState=r.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},r.queue=t,t=t.dispatch=Jx.bind(null,Ut,t),[r.memoizedState,t]},useRef:function(t){var s=fn();return t={current:t},s.memoizedState=t},useState:Qd,useDebugValue:Lo,useDeferredValue:function(t){return fn().memoizedState=t},useTransition:function(){var t=Qd(!1),s=t[0];return t=Qx.bind(null,t[1]),fn().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,n){var r=Ut,o=fn();if(Mt){if(n===void 0)throw Error(i(407));n=n()}else{if(n=s(),ls===null)throw Error(i(349));(wl&30)!==0||Hd(r,s,n)}o.memoizedState=n;var d={value:n,getSnapshot:s};return o.queue=d,Gd(Wd.bind(null,r,d,t),[t]),r.flags|=2048,ea(9,Vd.bind(null,r,d,n,s),void 0,null),n},useId:function(){var t=fn(),s=ls.identifierPrefix;if(Mt){var n=Cn,r=Sn;n=(r&~(1<<32-xs(r)-1)).toString(32)+n,s=":"+s+"R"+n,n=Yr++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=h.createElement(n,{is:r.is}):(t=h.createElement(n),n==="select"&&(h=t,r.multiple?h.multiple=!0:r.size&&(h.size=r.size))):t=h.createElementNS(t,n),t[hn]=s,t[Wr]=r,_u(t,s,!1,!1),s.stateNode=t;e:{switch(h=zt(n,r),n){case"dialog":$t("cancel",t),$t("close",t),o=r;break;case"iframe":case"object":case"embed":$t("load",t),o=r;break;case"video":case"audio":for(o=0;our&&(s.flags|=128,r=!0,ta(d,!1),s.lanes=4194304)}else{if(!r)if(t=Ga(h),t!==null){if(s.flags|=128,r=!0,n=t.updateQueue,n!==null&&(s.updateQueue=n,s.flags|=4),ta(d,!0),d.tail===null&&d.tailMode==="hidden"&&!h.alternate&&!Mt)return fs(s),null}else 2*bt()-d.renderingStartTime>ur&&n!==1073741824&&(s.flags|=128,r=!0,ta(d,!1),s.lanes=4194304);d.isBackwards?(h.sibling=s.child,s.child=h):(n=d.last,n!==null?n.sibling=h:s.child=h,d.last=h)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=bt(),s.sibling=null,n=Ot.current,St(Ot,r?n&1|2:n&1),s):(fs(s),null);case 22:case 23:return rc(),r=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(s.flags|=8192),r&&(s.mode&1)!==0?(Us&1073741824)!==0&&(fs(s),s.subtreeFlags&6&&(s.flags|=8192)):fs(s),null;case 24:return null;case 25:return null}throw Error(i(156,s.tag))}function rm(t,s){switch(ho(s),s.tag){case 1:return Ts(s.type)&&Ua(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return ir(),Lt(Es),Lt(hs),_o(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return So(s),null;case 13:if(Lt(Ot),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(i(340));nr()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return Lt(Ot),null;case 4:return ir(),null;case 10:return jo(s.type._context),null;case 22:case 23:return rc(),null;case 24:return null;default:return null}}var ri=!1,gs=!1,am=typeof WeakSet=="function"?WeakSet:Set,Te=null;function cr(t,s){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Bt(t,s,r)}else n.current=null}function qo(t,s,n){try{n()}catch(r){Bt(t,s,r)}}var Iu=!1;function im(t,s){if(lo=Kt,t=od(),Gi(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var h=0,N=-1,S=-1,F=0,oe=0,xe=t,ie=null;t:for(;;){for(var Se;xe!==n||o!==0&&xe.nodeType!==3||(N=h+o),xe!==d||r!==0&&xe.nodeType!==3||(S=h+r),xe.nodeType===3&&(h+=xe.nodeValue.length),(Se=xe.firstChild)!==null;)ie=xe,xe=Se;for(;;){if(xe===t)break t;if(ie===n&&++F===o&&(N=h),ie===d&&++oe===r&&(S=h),(Se=xe.nextSibling)!==null)break;xe=ie,ie=xe.parentNode}xe=Se}n=N===-1||S===-1?null:{start:N,end:S}}else n=null}n=n||{start:0,end:0}}else n=null;for(ro={focusedElem:t,selectionRange:n},Kt=!1,Te=s;Te!==null;)if(s=Te,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Te=t;else for(;Te!==null;){s=Te;try{var Re=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Re!==null){var $e=Re.memoizedProps,qt=Re.memoizedState,D=s.stateNode,_=D.getSnapshotBeforeUpdate(s.elementType===s.type?$e:tn(s.type,$e),qt);D.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var L=s.stateNode.containerInfo;L.nodeType===1?L.textContent="":L.nodeType===9&&L.documentElement&&L.removeChild(L.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(fe){Bt(s,s.return,fe)}if(t=s.sibling,t!==null){t.return=s.return,Te=t;break}Te=s.return}return Re=Iu,Iu=!1,Re}function sa(t,s,n){var r=s.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var d=o.destroy;o.destroy=void 0,d!==void 0&&qo(s,n,d)}o=o.next}while(o!==r)}}function ai(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var n=s=s.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==s)}}function Qo(t){var s=t.ref;if(s!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof s=="function"?s(t):s.current=t}}function Ru(t){var s=t.alternate;s!==null&&(t.alternate=null,Ru(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[hn],delete s[Wr],delete s[co],delete s[Hx],delete s[Vx])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Du(t){return t.tag===5||t.tag===3||t.tag===4}function Pu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Du(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Jo(t,s,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,s?n.nodeType===8?n.parentNode.insertBefore(t,s):n.insertBefore(t,s):(n.nodeType===8?(s=n.parentNode,s.insertBefore(t,n)):(s=n,s.appendChild(t)),n=n._reactRootContainer,n!=null||s.onclick!==null||(s.onclick=Ma));else if(r!==4&&(t=t.child,t!==null))for(Jo(t,s,n),t=t.sibling;t!==null;)Jo(t,s,n),t=t.sibling}function Go(t,s,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,s?n.insertBefore(t,s):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Go(t,s,n),t=t.sibling;t!==null;)Go(t,s,n),t=t.sibling}var cs=null,sn=!1;function Kn(t,s,n){for(n=n.child;n!==null;)$u(t,s,n),n=n.sibling}function $u(t,s,n){if(Ls&&typeof Ls.onCommitFiberUnmount=="function")try{Ls.onCommitFiberUnmount(Hl,n)}catch{}switch(n.tag){case 5:gs||cr(n,s);case 6:var r=cs,o=sn;cs=null,Kn(t,s,n),cs=r,sn=o,cs!==null&&(sn?(t=cs,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):cs.removeChild(n.stateNode));break;case 18:cs!==null&&(sn?(t=cs,n=n.stateNode,t.nodeType===8?oo(t.parentNode,n):t.nodeType===1&&oo(t,n),js(t)):oo(cs,n.stateNode));break;case 4:r=cs,o=sn,cs=n.stateNode.containerInfo,sn=!0,Kn(t,s,n),cs=r,sn=o;break;case 0:case 11:case 14:case 15:if(!gs&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var d=o,h=d.destroy;d=d.tag,h!==void 0&&((d&2)!==0||(d&4)!==0)&&qo(n,s,h),o=o.next}while(o!==r)}Kn(t,s,n);break;case 1:if(!gs&&(cr(n,s),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(N){Bt(n,s,N)}Kn(t,s,n);break;case 21:Kn(t,s,n);break;case 22:n.mode&1?(gs=(r=gs)||n.memoizedState!==null,Kn(t,s,n),gs=r):Kn(t,s,n);break;default:Kn(t,s,n)}}function Lu(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new am),s.forEach(function(r){var o=fm.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function nn(t,s){var n=s.deletions;if(n!==null)for(var r=0;ro&&(o=h),r&=~d}if(r=o,r=bt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*cm(r/1960))-r,10t?16:t,Qn===null)var r=!1;else{if(t=Qn,Qn=null,ui=0,(at&6)!==0)throw Error(i(331));var o=at;for(at|=4,Te=t.current;Te!==null;){var d=Te,h=d.child;if((Te.flags&16)!==0){var N=d.deletions;if(N!==null){for(var S=0;Sbt()-Zo?Cl(t,0):Yo|=n),Ds(t,s)}function Qu(t,s){s===0&&((t.mode&1)===0?s=1:(s=pl,pl<<=1,(pl&130023424)===0&&(pl=4194304)));var n=Ns();t=_n(t,s),t!==null&&(fl(t,s,n),Ds(t,n))}function pm(t){var s=t.memoizedState,n=0;s!==null&&(n=s.retryLane),Qu(t,n)}function fm(t,s){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(s),Qu(t,n)}var Ju;Ju=function(t,s,n){if(t!==null)if(t.memoizedProps!==s.pendingProps||Es.current)Is=!0;else{if((t.lanes&n)===0&&(s.flags&128)===0)return Is=!1,nm(t,s,n);Is=(t.flags&131072)!==0}else Is=!1,Mt&&(s.flags&1048576)!==0&&Ed(s,Ha,s.index);switch(s.lanes=0,s.tag){case 2:var r=s.type;li(t,s),t=s.pendingProps;var o=er(s,hs.current);ar(s,n),o=Io(null,s,r,t,o,n);var d=Ro();return s.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Ts(r)?(d=!0,Fa(s)):d=!1,s.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,wo(s),o.updater=si,s.stateNode=o,o._reactInternals=s,Mo(s,r,t,n),s=zo(null,s,r,!0,d,n)):(s.tag=0,Mt&&d&&mo(s),ys(null,s,o,n),s=s.child),s;case 16:r=s.elementType;e:{switch(li(t,s),t=s.pendingProps,o=r._init,r=o(r._payload),s.type=r,o=s.tag=bm(r),t=tn(r,t),o){case 0:s=Fo(null,s,r,t,n);break e;case 1:s=yu(null,s,r,t,n);break e;case 11:s=fu(null,s,r,t,n);break e;case 14:s=gu(null,s,r,tn(r.type,t),n);break e}throw Error(i(306,r,""))}return s;case 0:return r=s.type,o=s.pendingProps,o=s.elementType===r?o:tn(r,o),Fo(t,s,r,o,n);case 1:return r=s.type,o=s.pendingProps,o=s.elementType===r?o:tn(r,o),yu(t,s,r,o,n);case 3:e:{if(Nu(s),t===null)throw Error(i(387));r=s.pendingProps,d=s.memoizedState,o=d.element,Md(t,s),Ja(s,r,null,n);var h=s.memoizedState;if(r=h.element,d.isDehydrated)if(d={element:r,isDehydrated:!1,cache:h.cache,pendingSuspenseBoundaries:h.pendingSuspenseBoundaries,transitions:h.transitions},s.updateQueue.baseState=d,s.memoizedState=d,s.flags&256){o=or(Error(i(423)),s),s=wu(t,s,r,n,o);break e}else if(r!==o){o=or(Error(i(424)),s),s=wu(t,s,r,n,o);break e}else for(Os=Fn(s.stateNode.containerInfo.firstChild),Ms=s,Mt=!0,en=null,n=Ld(s,null,r,n),s.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(nr(),r===o){s=Tn(t,s,n);break e}ys(t,s,r,n)}s=s.child}return s;case 5:return Fd(s),t===null&&fo(s),r=s.type,o=s.pendingProps,d=t!==null?t.memoizedProps:null,h=o.children,ao(r,o)?h=null:d!==null&&ao(r,d)&&(s.flags|=32),ju(t,s),ys(t,s,h,n),s.child;case 6:return t===null&&fo(s),null;case 13:return ku(t,s,n);case 4:return ko(s,s.stateNode.containerInfo),r=s.pendingProps,t===null?s.child=lr(s,null,r,n):ys(t,s,r,n),s.child;case 11:return r=s.type,o=s.pendingProps,o=s.elementType===r?o:tn(r,o),fu(t,s,r,o,n);case 7:return ys(t,s,s.pendingProps,n),s.child;case 8:return ys(t,s,s.pendingProps.children,n),s.child;case 12:return ys(t,s,s.pendingProps.children,n),s.child;case 10:e:{if(r=s.type._context,o=s.pendingProps,d=s.memoizedProps,h=o.value,St(Ka,r._currentValue),r._currentValue=h,d!==null)if(Zs(d.value,h)){if(d.children===o.children&&!Es.current){s=Tn(t,s,n);break e}}else for(d=s.child,d!==null&&(d.return=s);d!==null;){var N=d.dependencies;if(N!==null){h=d.child;for(var S=N.firstContext;S!==null;){if(S.context===r){if(d.tag===1){S=En(-1,n&-n),S.tag=2;var F=d.updateQueue;if(F!==null){F=F.shared;var oe=F.pending;oe===null?S.next=S:(S.next=oe.next,oe.next=S),F.pending=S}}d.lanes|=n,S=d.alternate,S!==null&&(S.lanes|=n),yo(d.return,n,s),N.lanes|=n;break}S=S.next}}else if(d.tag===10)h=d.type===s.type?null:d.child;else if(d.tag===18){if(h=d.return,h===null)throw Error(i(341));h.lanes|=n,N=h.alternate,N!==null&&(N.lanes|=n),yo(h,n,s),h=d.sibling}else h=d.child;if(h!==null)h.return=d;else for(h=d;h!==null;){if(h===s){h=null;break}if(d=h.sibling,d!==null){d.return=h.return,h=d;break}h=h.return}d=h}ys(t,s,o.children,n),s=s.child}return s;case 9:return o=s.type,r=s.pendingProps.children,ar(s,n),o=Ws(o),r=r(o),s.flags|=1,ys(t,s,r,n),s.child;case 14:return r=s.type,o=tn(r,s.pendingProps),o=tn(r.type,o),gu(t,s,r,o,n);case 15:return bu(t,s,s.type,s.pendingProps,n);case 17:return r=s.type,o=s.pendingProps,o=s.elementType===r?o:tn(r,o),li(t,s),s.tag=1,Ts(r)?(t=!0,Fa(s)):t=!1,ar(s,n),cu(s,r,o),Mo(s,r,o,n),zo(null,s,r,!0,t,n);case 19:return Cu(t,s,n);case 22:return vu(t,s,n)}throw Error(i(156,s.tag))};function Gu(t,s){return wr(t,s)}function gm(t,s,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qs(t,s,n,r){return new gm(t,s,n,r)}function ic(t){return t=t.prototype,!(!t||!t.isReactComponent)}function bm(t){if(typeof t=="function")return ic(t)?1:0;if(t!=null){if(t=t.$$typeof,t===R)return 11;if(t===Le)return 14}return 2}function Xn(t,s){var n=t.alternate;return n===null?(n=Qs(t.tag,s,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=s,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,s=t.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function pi(t,s,n,r,o,d){var h=2;if(r=t,typeof t=="function")ic(t)&&(h=1);else if(typeof t=="string")h=5;else e:switch(t){case O:return El(n.children,o,d,s);case pe:h=8,o|=8;break;case ne:return t=Qs(12,n,s,o|2),t.elementType=ne,t.lanes=d,t;case W:return t=Qs(13,n,s,o),t.elementType=W,t.lanes=d,t;case te:return t=Qs(19,n,s,o),t.elementType=te,t.lanes=d,t;case Z:return fi(n,o,d,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ve:h=10;break e;case Q:h=9;break e;case R:h=11;break e;case Le:h=14;break e;case K:h=16,r=null;break e}throw Error(i(130,t==null?t:typeof t,""))}return s=Qs(h,n,s,o),s.elementType=t,s.type=r,s.lanes=d,s}function El(t,s,n,r){return t=Qs(7,t,r,s),t.lanes=n,t}function fi(t,s,n,r){return t=Qs(22,t,r,s),t.elementType=Z,t.lanes=n,t.stateNode={isHidden:!1},t}function oc(t,s,n){return t=Qs(6,t,null,s),t.lanes=n,t}function cc(t,s,n){return s=Qs(4,t.children!==null?t.children:[],t.key,s),s.lanes=n,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function vm(t,s,n,r,o){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tr(0),this.expirationTimes=Tr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tr(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function dc(t,s,n,r,o,d,h,N,S){return t=new vm(t,s,n,N,S),s===1?(s=1,d===!0&&(s|=8)):s=0,d=Qs(3,null,null,s),t.current=d,d.stateNode=t,d.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},wo(d),t}function jm(t,s,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),fc.exports=Lm(),fc.exports}var d0;function Am(){if(d0)return wi;d0=1;var a=R0();return wi.createRoot=a.createRoot,wi.hydrateRoot=a.hydrateRoot,wi}var Mm=Am();const Om=T0(Mm);R0();/** * @remix-run/router v1.23.4 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function xa(){return xa=Object.assign?Object.assign.bind():function(a){for(var l=1;l"u")throw new Error(l)}function D0(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function Fm(){return Math.random().toString(36).substr(2,8)}function x0(a,l){return{usr:a.state,key:a.key,idx:l}}function Nc(a,l,i,c){return i===void 0&&(i=null),xa({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof l=="string"?br(l):l,{state:i,key:l&&l.key||c||Fm()})}function Ti(a){let{pathname:l="/",search:i="",hash:c=""}=a;return i&&i!=="?"&&(l+=i.charAt(0)==="?"?i:"?"+i),c&&c!=="#"&&(l+=c.charAt(0)==="#"?c:"#"+c),l}function br(a){let l={};if(a){let i=a.indexOf("#");i>=0&&(l.hash=a.substr(i),a=a.substr(0,i));let c=a.indexOf("?");c>=0&&(l.search=a.substr(c),a=a.substr(0,c)),a&&(l.pathname=a)}return l}function zm(a,l,i,c){c===void 0&&(c={});let{window:u=document.defaultView,v5Compat:m=!1}=c,p=u.history,b=el.Pop,f=null,j=k();j==null&&(j=0,p.replaceState(xa({},p.state,{idx:j}),""));function k(){return(p.state||{idx:null}).idx}function T(){b=el.Pop;let v=k(),w=v==null?null:v-j;j=v,f&&f({action:b,location:q.location,delta:w})}function C(v,w){b=el.Push;let M=Nc(q.location,v,w);j=k()+1;let Y=x0(M,j),z=q.createHref(M);try{p.pushState(Y,"",z)}catch(ae){if(ae instanceof DOMException&&ae.name==="DataCloneError")throw ae;u.location.assign(z)}m&&f&&f({action:b,location:q.location,delta:1})}function I(v,w){b=el.Replace;let M=Nc(q.location,v,w);j=k();let Y=x0(M,j),z=q.createHref(M);p.replaceState(Y,"",z),m&&f&&f({action:b,location:q.location,delta:0})}function P(v){let w=u.location.origin!=="null"?u.location.origin:u.location.href,M=typeof v=="string"?v:Ti(v);return M=M.replace(/ $/,"%20"),Jt(w,"No window.location.(origin|href) available to create URL for href: "+M),new URL(M,w)}let q={get action(){return b},get location(){return a(u,p)},listen(v){if(f)throw new Error("A history only accepts one active listener");return u.addEventListener(u0,T),f=v,()=>{u.removeEventListener(u0,T),f=null}},createHref(v){return l(u,v)},createURL:P,encodeLocation(v){let w=P(v);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:C,replace:I,go(v){return p.go(v)}};return q}var m0;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(m0||(m0={}));function Bm(a,l,i){return i===void 0&&(i="/"),Hm(a,l,i)}function Hm(a,l,i,c){let u=typeof l=="string"?br(l):l,m=Rc(u.pathname||"/",i);if(m==null)return null;let p=P0(a);Vm(p);let b=null,f=sh(m);for(let j=0;b==null&&j{let f={relativePath:b===void 0?m.path||"":b,caseSensitive:m.caseSensitive===!0,childrenIndex:p,route:m};f.relativePath.startsWith("/")&&(Jt(f.relativePath.startsWith(c),'Absolute route path "'+f.relativePath+'" nested under path '+('"'+c+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),f.relativePath=f.relativePath.slice(c.length));let j=nl([c,f.relativePath]),k=i.concat(f);m.children&&m.children.length>0&&(Jt(m.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+j+'".')),P0(m.children,l,k,j)),!(m.path==null&&!m.index)&&l.push({path:j,score:Xm(j,m.index),routesMeta:k})};return a.forEach((m,p)=>{var b;if(m.path===""||!((b=m.path)!=null&&b.includes("?")))u(m,p);else for(let f of $0(m.path))u(m,p,f)}),l}function $0(a){let l=a.split("/");if(l.length===0)return[];let[i,...c]=l,u=i.endsWith("?"),m=i.replace(/\?$/,"");if(c.length===0)return u?[m,""]:[m];let p=$0(c.join("/")),b=[];return b.push(...p.map(f=>f===""?m:[m,f].join("/"))),u&&b.push(...p),b.map(f=>a.startsWith("/")&&f===""?"/":f)}function Vm(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:Ym(l.routesMeta.map(c=>c.childrenIndex),i.routesMeta.map(c=>c.childrenIndex)))}const Wm=/^:[\w-]+$/,Km=3,qm=2,Qm=1,Jm=10,Gm=-2,h0=a=>a==="*";function Xm(a,l){let i=a.split("/"),c=i.length;return i.some(h0)&&(c+=Gm),l&&(c+=qm),i.filter(u=>!h0(u)).reduce((u,m)=>u+(Wm.test(m)?Km:m===""?Qm:Jm),c)}function Ym(a,l){return a.length===l.length&&a.slice(0,-1).every((c,u)=>c===l[u])?a[a.length-1]-l[l.length-1]:0}function Zm(a,l,i){let{routesMeta:c}=a,u={},m="/",p=[];for(let b=0;b{let{paramName:C,isOptional:I}=k;if(C==="*"){let q=b[T]||"";p=m.slice(0,m.length-q.length).replace(/(.)\/+$/,"$1")}const P=b[T];return I&&!P?j[C]=void 0:j[C]=(P||"").replace(/%2F/g,"/"),j},{}),pathname:m,pathnameBase:p,pattern:a}}function th(a,l,i){l===void 0&&(l=!1),i===void 0&&(i=!0),D0(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let c=[],u="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(p,b,f)=>(c.push({paramName:b,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)"));return a.endsWith("*")?(c.push({paramName:"*"}),u+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?u+="\\/*$":a!==""&&a!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,l?void 0:"i"),c]}function sh(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return D0(!1,'The URL path "'+a+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+l+").")),a}}function Rc(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let i=l.endsWith("/")?l.length-1:l.length,c=a.charAt(i);return c&&c!=="/"?null:a.slice(i)||"/"}function nh(a,l){l===void 0&&(l="/");let{pathname:i,search:c="",hash:u=""}=typeof a=="string"?br(a):a,m;return i?(i=L0(i),i.startsWith("/")?m=p0(i.substring(1),"/"):m=p0(i,l)):m=l,{pathname:m,search:ah(c),hash:ih(u)}}function p0(a,l){let i=l.replace(/\/+$/,"").split("/");return a.split("/").forEach(u=>{u===".."?i.length>1&&i.pop():u!=="."&&i.push(u)}),i.length>1?i.join("/"):"/"}function vc(a,l,i,c){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+l+"` field ["+JSON.stringify(c)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function lh(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function Dc(a,l){let i=lh(a);return l?i.map((c,u)=>u===i.length-1?c.pathname:c.pathnameBase):i.map(c=>c.pathnameBase)}function Pc(a,l,i,c){c===void 0&&(c=!1);let u;typeof a=="string"?u=br(a):(u=xa({},a),Jt(!u.pathname||!u.pathname.includes("?"),vc("?","pathname","search",u)),Jt(!u.pathname||!u.pathname.includes("#"),vc("#","pathname","hash",u)),Jt(!u.search||!u.search.includes("#"),vc("#","search","hash",u)));let m=a===""||u.pathname==="",p=m?"/":u.pathname,b;if(p==null)b=i;else{let T=l.length-1;if(!c&&p.startsWith("..")){let C=p.split("/");for(;C[0]==="..";)C.shift(),T-=1;u.pathname=C.join("/")}b=T>=0?l[T]:"/"}let f=nh(u,b),j=p&&p!=="/"&&p.endsWith("/"),k=(m||p===".")&&i.endsWith("/");return!f.pathname.endsWith("/")&&(j||k)&&(f.pathname+="/"),f}const L0=a=>a.replace(/\/\/+/g,"/"),nl=a=>L0(a.join("/")),rh=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),ah=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,ih=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function oh(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}const A0=["post","put","patch","delete"];new Set(A0);const ch=["get",...A0];new Set(ch);/** * React Router v6.30.6 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function ma(){return ma=Object.assign?Object.assign.bind():function(a){for(var l=1;l{b.current=!0}),x.useCallback(function(j,k){if(k===void 0&&(k={}),!b.current)return;if(typeof j=="number"){c.go(j);return}let T=Pc(j,JSON.parse(p),m,k.relative==="path");a==null&&l!=="/"&&(T.pathname=T.pathname==="/"?l:nl([l,T.pathname])),(k.replace?c.replace:c.push)(T,k.state,k)},[l,c,p,m,a])}const mh=x.createContext(null);function hh(a){let l=x.useContext(bn).outlet;return l&&x.createElement(mh.Provider,{value:a},l)}function ph(){let{matches:a}=x.useContext(bn),l=a[a.length-1];return l?l.params:{}}function U0(a,l){let{relative:i}=l===void 0?{}:l,{future:c}=x.useContext(dl),{matches:u}=x.useContext(bn),{pathname:m}=Ml(),p=JSON.stringify(Dc(u,c.v7_relativeSplatPath));return x.useMemo(()=>Pc(a,JSON.parse(p),m,i==="path"),[a,p,m,i])}function fh(a,l){return gh(a,l)}function gh(a,l,i,c){vr()||Jt(!1);let{navigator:u}=x.useContext(dl),{matches:m}=x.useContext(bn),p=m[m.length-1],b=p?p.params:{};p&&p.pathname;let f=p?p.pathnameBase:"/";p&&p.route;let j=Ml(),k;if(l){var T;let v=typeof l=="string"?br(l):l;f==="/"||(T=v.pathname)!=null&&T.startsWith(f)||Jt(!1),k=v}else k=j;let C=k.pathname||"/",I=C;if(f!=="/"){let v=f.replace(/^\//,"").split("/");I="/"+C.replace(/^\//,"").split("/").slice(v.length).join("/")}let P=Bm(a,{pathname:I}),q=Nh(P&&P.map(v=>Object.assign({},v,{params:Object.assign({},b,v.params),pathname:nl([f,u.encodeLocation?u.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?f:nl([f,u.encodeLocation?u.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),m,i,c);return l&&q?x.createElement(Pi.Provider,{value:{location:ma({pathname:"/",search:"",hash:"",state:null,key:"default"},k),navigationType:el.Pop}},q):q}function bh(){let a=Ch(),l=oh(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),i=a instanceof Error?a.stack:null,u={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},l),i?x.createElement("pre",{style:u},i):null,null)}const vh=x.createElement(bh,null);class jh extends x.Component{constructor(l){super(l),this.state={location:l.location,revalidation:l.revalidation,error:l.error}}static getDerivedStateFromError(l){return{error:l}}static getDerivedStateFromProps(l,i){return i.location!==l.location||i.revalidation!=="idle"&&l.revalidation==="idle"?{error:l.error,location:l.location,revalidation:l.revalidation}:{error:l.error!==void 0?l.error:i.error,location:i.location,revalidation:l.revalidation||i.revalidation}}componentDidCatch(l,i){console.error("React Router caught the following error during render",l,i)}render(){return this.state.error!==void 0?x.createElement(bn.Provider,{value:this.props.routeContext},x.createElement(M0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function yh(a){let{routeContext:l,match:i,children:c}=a,u=x.useContext($c);return u&&u.static&&u.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(u.staticContext._deepestRenderedBoundaryId=i.route.id),x.createElement(bn.Provider,{value:l},c)}function Nh(a,l,i,c){var u;if(l===void 0&&(l=[]),i===void 0&&(i=null),c===void 0&&(c=null),a==null){var m;if(!i)return null;if(i.errors)a=i.matches;else if((m=c)!=null&&m.v7_partialHydration&&l.length===0&&!i.initialized&&i.matches.length>0)a=i.matches;else return null}let p=a,b=(u=i)==null?void 0:u.errors;if(b!=null){let k=p.findIndex(T=>T.route.id&&(b==null?void 0:b[T.route.id])!==void 0);k>=0||Jt(!1),p=p.slice(0,Math.min(p.length,k+1))}let f=!1,j=-1;if(i&&c&&c.v7_partialHydration)for(let k=0;k=0?p=p.slice(0,j+1):p=[p[0]];break}}}return p.reduceRight((k,T,C)=>{let I,P=!1,q=null,v=null;i&&(I=b&&T.route.id?b[T.route.id]:void 0,q=T.route.errorElement||vh,f&&(j<0&&C===0?(Eh("route-fallback"),P=!0,v=null):j===C&&(P=!0,v=T.route.hydrateFallbackElement||null)));let w=l.concat(p.slice(0,C+1)),M=()=>{let Y;return I?Y=q:P?Y=v:T.route.Component?Y=x.createElement(T.route.Component,null):T.route.element?Y=T.route.element:Y=k,x.createElement(yh,{match:T,routeContext:{outlet:k,matches:w,isDataRoute:i!=null},children:Y})};return i&&(T.route.ErrorBoundary||T.route.errorElement||C===0)?x.createElement(jh,{location:i.location,revalidation:i.revalidation,component:q,error:I,children:M(),routeContext:{outlet:null,matches:w,isDataRoute:!0}}):M()},null)}var F0=(function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a})(F0||{}),z0=(function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a})(z0||{});function wh(a){let l=x.useContext($c);return l||Jt(!1),l}function kh(a){let l=x.useContext(dh);return l||Jt(!1),l}function Sh(a){let l=x.useContext(bn);return l||Jt(!1),l}function B0(a){let l=Sh(),i=l.matches[l.matches.length-1];return i.route.id||Jt(!1),i.route.id}function Ch(){var a;let l=x.useContext(M0),i=kh(),c=B0();return l!==void 0?l:(a=i.errors)==null?void 0:a[c]}function _h(){let{router:a}=wh(F0.UseNavigateStable),l=B0(z0.UseNavigateStable),i=x.useRef(!1);return O0(()=>{i.current=!0}),x.useCallback(function(u,m){m===void 0&&(m={}),i.current&&(typeof u=="number"?a.navigate(u):a.navigate(u,ma({fromRouteId:l},m)))},[a,l])}const f0={};function Eh(a,l,i){f0[a]||(f0[a]=!0)}function Th(a,l){a==null||a.v7_startTransition,a==null||a.v7_relativeSplatPath}function Tl(a){let{to:l,replace:i,state:c,relative:u}=a;vr()||Jt(!1);let{future:m,static:p}=x.useContext(dl),{matches:b}=x.useContext(bn),{pathname:f}=Ml(),j=Rn(),k=Pc(l,Dc(b,m.v7_relativeSplatPath),f,u==="path"),T=JSON.stringify(k);return x.useEffect(()=>j(JSON.parse(T),{replace:i,state:c,relative:u}),[j,T,u,i,c]),null}function H0(a){return hh(a.context)}function vt(a){Jt(!1)}function Ih(a){let{basename:l="/",children:i=null,location:c,navigationType:u=el.Pop,navigator:m,static:p=!1,future:b}=a;vr()&&Jt(!1);let f=l.replace(/^\/*/,"/"),j=x.useMemo(()=>({basename:f,navigator:m,static:p,future:ma({v7_relativeSplatPath:!1},b)}),[f,b,m,p]);typeof c=="string"&&(c=br(c));let{pathname:k="/",search:T="",hash:C="",state:I=null,key:P="default"}=c,q=x.useMemo(()=>{let v=Rc(k,f);return v==null?null:{location:{pathname:v,search:T,hash:C,state:I,key:P},navigationType:u}},[f,k,T,C,I,P,u]);return q==null?null:x.createElement(dl.Provider,{value:j},x.createElement(Pi.Provider,{children:i,value:q}))}function Rh(a){let{children:l,location:i}=a;return fh(wc(l),i)}new Promise(()=>{});function wc(a,l){l===void 0&&(l=[]);let i=[];return x.Children.forEach(a,(c,u)=>{if(!x.isValidElement(c))return;let m=[...l,u];if(c.type===x.Fragment){i.push.apply(i,wc(c.props.children,m));return}c.type!==vt&&Jt(!1),!c.props.index||!c.props.children||Jt(!1);let p={id:c.props.id||m.join("-"),caseSensitive:c.props.caseSensitive,element:c.props.element,Component:c.props.Component,index:c.props.index,path:c.props.path,loader:c.props.loader,action:c.props.action,errorElement:c.props.errorElement,ErrorBoundary:c.props.ErrorBoundary,hasErrorBoundary:c.props.ErrorBoundary!=null||c.props.errorElement!=null,shouldRevalidate:c.props.shouldRevalidate,handle:c.props.handle,lazy:c.props.lazy};c.props.children&&(p.children=wc(c.props.children,m)),i.push(p)}),i}/** * React Router DOM v6.30.6 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function kc(){return kc=Object.assign?Object.assign.bind():function(a){for(var l=1;l{let c=a[i];return l.concat(Array.isArray(c)?c.map(u=>[i,u]):[[i,c]])},[]))}function Lh(a,l){let i=Sc(a);return l&&l.forEach((c,u)=>{i.has(u)||l.getAll(u).forEach(m=>{i.append(u,m)})}),i}const Ah=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Mh="6";try{window.__reactRouterVersion=Mh}catch{}const Oh="startTransition",g0=Dm[Oh];function Uh(a){let{basename:l,children:i,future:c,window:u}=a,m=x.useRef();m.current==null&&(m.current=Um({window:u,v5Compat:!0}));let p=m.current,[b,f]=x.useState({action:p.action,location:p.location}),{v7_startTransition:j}=c||{},k=x.useCallback(T=>{j&&g0?g0(()=>f(T)):f(T)},[f,j]);return x.useLayoutEffect(()=>p.listen(k),[p,k]),x.useEffect(()=>Th(c),[c]),x.createElement(Ih,{basename:l,children:i,location:b.location,navigationType:b.action,navigator:p,future:c})}const Fh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ke=x.forwardRef(function(l,i){let{onClick:c,relative:u,reloadDocument:m,replace:p,state:b,target:f,to:j,preventScrollReset:k,viewTransition:T}=l,C=Dh(l,Ah),{basename:I}=x.useContext(dl),P,q=!1;if(typeof j=="string"&&zh.test(j)&&(P=j,Fh))try{let Y=new URL(window.location.href),z=j.startsWith("//")?new URL(Y.protocol+j):new URL(j),ae=Rc(z.pathname,I);z.origin===Y.origin&&ae!=null?j=ae+z.search+z.hash:q=!0}catch{}let v=uh(j,{relative:u}),w=Bh(j,{replace:p,state:b,target:f,preventScrollReset:k,relative:u,viewTransition:T});function M(Y){c&&c(Y),Y.defaultPrevented||w(Y)}return x.createElement("a",kc({},C,{href:P||v,onClick:q||m?c:M,ref:i,target:f}))});var b0;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(b0||(b0={}));var v0;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(v0||(v0={}));function Bh(a,l){let{target:i,replace:c,state:u,preventScrollReset:m,relative:p,viewTransition:b}=l===void 0?{}:l,f=Rn(),j=Ml(),k=U0(a,{relative:p});return x.useCallback(T=>{if($h(T,i)){T.preventDefault();let C=c!==void 0?c:Ti(j)===Ti(k);f(a,{replace:C,state:u,preventScrollReset:m,relative:p,viewTransition:b})}},[j,f,k,c,u,i,a,m,p,b])}function jr(a){let l=x.useRef(Sc(a)),i=x.useRef(!1),c=Ml(),u=x.useMemo(()=>Lh(c.search,i.current?null:l.current),[c.search]),m=Rn(),p=x.useCallback((b,f)=>{const j=Sc(typeof b=="function"?b(u):b);i.current=!0,m("?"+j,f)},[m,u]);return[u,p]}class Hh{constructor(){ws(this,"listeners",new Set);ws(this,"isTerminated",!1)}subscribe(l){return this.listeners.add(l),()=>this.listeners.delete(l)}notifySessionExpired(l="登录已过期,请重新登录"){this.isTerminated||(this.isTerminated=!0,this.listeners.forEach(i=>{try{i(l)}catch(c){console.error("Error in session expired listener",c)}}))}reset(){this.isTerminated=!1}}const Zn=new Hh,Cc="/api";function il(){return localStorage.getItem("classnotify_token")}function j0(a){localStorage.setItem("classnotify_token",a)}function ca(){localStorage.removeItem("classnotify_token"),localStorage.removeItem("classnotify_user")}function Vh(){const a=Date.now().toString(36),l=Math.random().toString(36).substring(2,8);return`web_${a}_${l}`}async function me(a,l={}){const i=il(),c={"Content-Type":"application/json","X-Correlation-Id":Vh(),...l.headers};i&&(c.Authorization=`Bearer ${i}`);const u=await fetch(`${Cc}${a}`,{...l,headers:c});if(!u.ok){let m=`请求失败 (${u.status})`,p,b=null;try{b=await u.json(),m=b.message||b.errorMessage||m,p=b.code}catch{}u.status===401&&(p==="SESSION_SUPERSEDED"?Zn.notifySessionExpired(m):(ca(),Zn.notifySessionExpired("未授权或登录已过期,请重新登录")));const f=new Error(m);throw f.status=u.status,f.code=p,f.response={status:u.status,data:b},f}return u.status===204?{}:u.json()}const J={get:a=>me(a,{method:"GET"}),post:(a,l)=>me(a,{method:"POST",body:l!==void 0?JSON.stringify(l):void 0}),put:(a,l)=>me(a,{method:"PUT",body:l!==void 0?JSON.stringify(l):void 0}),delete:a=>me(a,{method:"DELETE"}),login:(a,l)=>me("/auth/login",{method:"POST",body:JSON.stringify({username:a,password:l})}),resetPasswordByToken:(a,l)=>me("/auth/reset-password/token",{method:"POST",body:JSON.stringify({token:a,newPassword:l})}),resetPasswordByRecoveryKey:(a,l,i)=>me("/auth/reset-password/recovery-key",{method:"POST",body:JSON.stringify({usernameOrEmail:a,recoveryKey:l,newPassword:i})}),registerPersonal:a=>me("/auth/register-personal",{method:"POST",body:JSON.stringify(a)}),getMe:()=>me("/auth/me"),getAdminMetrics:()=>me("/admin/metrics"),getTenants:()=>me("/admin/tenants"),getAllDevices:()=>me("/admin/devices"),sendDeviceCommand:(a,l,i)=>me(`/admin/devices/${a}/command`,{method:"POST",body:JSON.stringify({command:l,parameters:i})}),triggerDeviceSelfCheck:a=>me(`/admin/devices/${a}/self-check`,{method:"POST"}),getDeviceSelfChecks:a=>me(`/admin/devices/${a}/self-checks`),getDeviceSelfCheckDetails:a=>me(`/admin/devices/self-checks/${a}`),getOperationalHealthDiagnostics:()=>me("/health/diagnostics"),getAdminActivationCodes:()=>me("/admin/activation-codes"),getAdminClasses:a=>me(`/admin/classes?tenantId=${encodeURIComponent(a)}`),generateAdminCode:(a,l,i=7,c="Trial",u,m=1)=>{let p=`/admin/activation-codes?tenantId=${encodeURIComponent(a)}&classId=${encodeURIComponent(l)}&tier=${encodeURIComponent(c)}`;return i!=null&&(p+=`&durationDays=${i}`),u&&(p+=`¬es=${encodeURIComponent(u)}`),m>1&&(p+=`&count=${m}`),me(p,{method:"POST"})},batchTagAdminCodes:(a,l)=>me("/admin/activation-codes/notes",{method:"PUT",body:JSON.stringify({codes:a,notes:l})}),renewAdminDeviceLicense:(a,l,i,c,u,m)=>me(`/admin/devices/${encodeURIComponent(a)}/license`,{method:"POST",body:JSON.stringify({extendDays:l,tier:i,activationCode:c,validThroughDate:u,reason:m})}),batchRenewAdminDevicesLicense:a=>me("/admin/devices/licenses/batch-renew",{method:"POST",body:JSON.stringify(a)}),getAdminNotifications:(a=50)=>me(`/admin/notifications?limit=${a}`),getLicenseRecords:(a=100)=>me(`/admin/licenses?limit=${a}`),createTenant:a=>me("/admin/tenants",{method:"POST",body:JSON.stringify(a)}),updateTenant:(a,l)=>me(`/admin/tenants/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),getUsers:(a,l,i)=>{const c=new URLSearchParams;a&&a!=="all"&&c.append("tenantId",a),l&&l!=="all"&&c.append("role",l),i&&c.append("q",i);const u=c.toString();return me(`/admin/users${u?`?${u}`:""}`)},createUser:a=>me("/admin/users",{method:"POST",body:JSON.stringify(a)}),updateUser:(a,l)=>me(`/admin/users/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),resetPassword:(a,l)=>me(`/admin/users/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),issueUserResetTicket:a=>me(`/admin/users/${encodeURIComponent(a)}/issue-reset-ticket`,{method:"POST"}),setUserLock:(a,l)=>me(`/admin/users/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),deleteUser:a=>me(`/admin/users/${encodeURIComponent(a)}`,{method:"DELETE"}),updateDevice:(a,l)=>me(`/admin/devices/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)}),updateAdminDeviceClassName:(a,l)=>me(`/admin/devices/${encodeURIComponent(a)}/class-name`,{method:"PUT",body:JSON.stringify({className:l})}),decommissionDevice:a=>me(`/admin/devices/${encodeURIComponent(a)}/decommission`,{method:"POST"}),deleteActivationCode:a=>me(`/admin/activation-codes/${encodeURIComponent(a)}`,{method:"DELETE"}),sendEmergencyBroadcast:a=>me("/admin/broadcasts",{method:"POST",body:JSON.stringify(a)}),getBroadcastReceiptSummary:a=>me(`/admin/broadcasts/${encodeURIComponent(a)}/receipt-summary`),getSystemHealth:()=>me("/admin/system/health"),getAuditLogs:(a=100)=>me(`/admin/audit-logs?limit=${a}`),getSchoolOverview:()=>me("/school-admin/overview"),getSchoolClasses:()=>me("/school-admin/classes"),createSchoolClass:a=>me("/school-admin/classes",{method:"POST",body:JSON.stringify(a)}),getSchoolTeachers:()=>me("/school-admin/teachers"),createSchoolTeacher:a=>me("/school-admin/teachers",{method:"POST",body:JSON.stringify(a)}),resetSchoolTeacherPassword:(a,l)=>me(`/school-admin/teachers/${encodeURIComponent(a)}/reset-password`,{method:"POST",body:JSON.stringify({newPassword:l})}),setSchoolTeacherLock:(a,l)=>me(`/school-admin/teachers/${encodeURIComponent(a)}/lock`,{method:"POST",body:JSON.stringify({isLocked:l})}),getSchoolDevices:()=>me("/school-admin/devices"),getSchoolCodes:()=>me("/school-admin/activation-codes"),generateSchoolCode:(a,l=7,i="Trial",c,u=1,m="External",p,b,f)=>me("/school-admin/activation-codes",{method:"POST",body:JSON.stringify({classId:a,durationDays:l,tier:i,notes:c,count:u,distributionMethod:m,assignedTeacherId:p,assignedTeacherName:b,targetClassName:f})}),assignSchoolCode:a=>me("/school-admin/activation-codes/assign",{method:"POST",body:JSON.stringify(a)}),batchTagSchoolCodes:(a,l)=>me("/school-admin/activation-codes/notes",{method:"PUT",body:JSON.stringify({codes:a,notes:l})}),renewSchoolDeviceLicense:(a,l,i,c,u,m)=>me(`/school-admin/devices/${encodeURIComponent(a)}/license`,{method:"POST",body:JSON.stringify({extendDays:l,tier:i,activationCode:c,validThroughDate:u,reason:m})}),updateSchoolDeviceClassName:(a,l)=>me(`/school-admin/devices/${encodeURIComponent(a)}/class-name`,{method:"PUT",body:JSON.stringify({className:l})}),batchRenewSchoolDevicesLicense:a=>me("/school-admin/devices/licenses/batch-renew",{method:"POST",body:JSON.stringify(a)}),getSchoolNotifications:(a=50)=>me(`/school-admin/notifications?limit=${a}`),getTeacherClasses:()=>me("/notification/classes"),getTeacherClassroomDevices:()=>me("/notification/classroom-devices"),sendNotification:a=>me("/notification/send",{method:"POST",body:JSON.stringify(a)}),cancelNotification:a=>me(`/notifications/${encodeURIComponent(a)}/cancel`,{method:"POST"}),deleteNotification:a=>me(`/notification/${encodeURIComponent(a)}/history`,{method:"DELETE"}),getTeacherHistory:(a,l=50)=>me(`/notification/history?${a?`classId=${encodeURIComponent(a)}&`:""}limit=${l}`),getTeacherActivationCodes:()=>me("/teacher/activation-codes"),revealTeacherActivationCode:a=>me(`/teacher/activation-codes/${encodeURIComponent(a)}/reveal`,{method:"POST"}),renewTeacherDeviceLicense:(a,l,i)=>me(`/teacher/devices/${encodeURIComponent(a)}/renew`,{method:"POST",body:JSON.stringify({activationCode:l,reason:i})}),rotateRecoveryKey:a=>me("/auth/rotate-recovery-key",{method:"POST",body:JSON.stringify({currentPassword:a})}),getVisualReceiptBlob:async(a,l)=>{const i=il(),c=await fetch(`${Cc}/notifications/${encodeURIComponent(a)}/receipts/${encodeURIComponent(l)}/visual-receipt`,{headers:i?{Authorization:`Bearer ${i}`}:{}});if(c.status===410)throw new Error("视觉回执已按24小时保存策略自动销毁");if(c.status===404)throw new Error("未找到该通知的视觉回执");if(!c.ok)throw new Error(`获取视觉回执失败 (${c.status})`);return c.blob()},getFleetVersionSummary:()=>me("/admin/fleet/version-summary"),getFleetDevices:a=>{const l=new URLSearchParams;a!=null&&a.status&&l.set("status",a.status),a!=null&&a.tenantId&&l.set("tenantId",a.tenantId),(a==null?void 0:a.online)!==void 0&&l.set("online",String(a.online)),a!=null&&a.q&&l.set("q",a.q);const i=l.toString();return me(`/admin/fleet/devices${i?`?${i}`:""}`)},createSelfCheckBatch:(a,l)=>me("/admin/self-check-batches",{method:"POST",body:JSON.stringify({clientRequestId:a,deviceIds:l})}),getSelfCheckBatches:(a,l=20)=>{const i=new URLSearchParams;a&&i.set("status",a),l&&i.set("take",String(l));const c=i.toString();return me(`/admin/self-check-batches${c?`?${c}`:""}`)},getSelfCheckBatch:a=>me(`/admin/self-check-batches/${encodeURIComponent(a)}`),getSelfCheckBatchDevices:(a,l)=>{const i=new URLSearchParams;l!=null&&l.health&&i.set("health",l.health),l!=null&&l.probe&&i.set("probe",l.probe),l!=null&&l.tenantId&&i.set("tenantId",l.tenantId),l!=null&&l.q&&i.set("q",l.q),l!=null&&l.page&&i.set("page",String(l.page)),l!=null&&l.pageSize&&i.set("pageSize",String(l.pageSize));const c=i.toString();return me(`/admin/self-check-batches/${encodeURIComponent(a)}/devices${c?`?${c}`:""}`)},getSelfCheckBatchDeviceRun:(a,l)=>me(`/admin/self-check-batches/${encodeURIComponent(a)}/runs/${encodeURIComponent(l)}`),createSupportBundle:(a,l)=>me(`/admin/devices/${encodeURIComponent(a)}/support-bundles`,{method:"POST",body:JSON.stringify({clientRequestId:l})}),getSupportBundle:a=>me(`/admin/support-bundles/${encodeURIComponent(a)}`),getDeviceSupportBundles:(a,l=5)=>me(`/admin/devices/${encodeURIComponent(a)}/support-bundles?take=${l}`),downloadSupportBundle:async(a,l)=>{const i=il(),c=await fetch(`${Cc}/admin/support-bundles/${encodeURIComponent(a)}/download`,{headers:i?{Authorization:`Bearer ${i}`}:{}});if(c.status===410)throw new Error("诊断包已过期并已自动清理");if(c.status===409)throw new Error("诊断包尚未就绪或生成失败");if(c.status===403)throw new Error("无权下载该学校终端的诊断包");if(!c.ok)throw new Error(`下载诊断包失败 (${c.status})`);const u=await c.blob(),m=window.URL.createObjectURL(u),p=document.createElement("a");p.href=m,p.download=l||`support-bundle-${a}.zip`,document.body.appendChild(p),p.click(),document.body.removeChild(p),window.URL.revokeObjectURL(m)},getTrialLedgers:a=>{const l=new URLSearchParams;a!=null&&a.tenantId&&a.tenantId!=="all"&&l.set("tenantId",a.tenantId),a!=null&&a.q&&l.set("q",a.q),a!=null&&a.onlyBlocked&&l.set("onlyBlocked","true"),a!=null&&a.overrideState&&a.overrideState!=="All"&&l.set("overrideState",a.overrideState),a!=null&&a.limit&&l.set("limit",String(a.limit));const i=l.toString();return me(`/admin/trial-ledgers${i?`?${i}`:""}`)},grantTrialOverride:(a,l)=>me(`/admin/trial-ledgers/${encodeURIComponent(a)}/override`,{method:"POST",body:JSON.stringify(l)}),revokeTrialOverride:(a,l)=>me(`/admin/trial-ledgers/${encodeURIComponent(a)}/revoke-override`,{method:"POST",body:JSON.stringify(l||{})}),getLicenseRecordsSummary:a=>{const l=a&&a!=="all"?`?tenantId=${encodeURIComponent(a)}`:"";return me(`/admin/licenses/summary${l}`)},updateDeviceDisplayLabel:(a,l)=>me(`/admin/devices/${encodeURIComponent(a)}/display-label`,{method:"PATCH",body:JSON.stringify({displayLabel:l})}),getTeacherProfile:()=>me("/teacher/me"),updateTeacherProfile:a=>me("/teacher/profile",{method:"PATCH",body:JSON.stringify(a)}),changeTeacherPassword:a=>me("/teacher/account/change-password",{method:"POST",body:JSON.stringify(a)}),rotateTeacherRecoveryKey:a=>me("/teacher/account/rotate-recovery-key",{method:"POST",body:JSON.stringify(a)}),getTeacherScreens:()=>me("/teacher/screens"),claimTeacherScreen:(a,l)=>me("/teacher/screens/claim",{method:"POST",body:JSON.stringify({pairingCode:a,classAlias:l})}),unbindTeacherScreen:a=>me(`/teacher/screens/${encodeURIComponent(a)}`,{method:"DELETE"}),activateScreenPairingMode:a=>me(`/teacher/screens/${encodeURIComponent(a)}/pairing-mode`,{method:"POST"}),createPayOrder:a=>me("/pay/orders",{method:"POST",body:JSON.stringify({channel:a})}),getOrderStatus:a=>me(`/pay/orders/${encodeURIComponent(a)}/status`),mockPayOrder:a=>me(`/pay/mock/pay/${encodeURIComponent(a)}`,{method:"POST"}),redeemVoucher:a=>me("/pay/voucher/redeem",{method:"POST",body:JSON.stringify({voucherCode:a})}),getDownloadManifest:async()=>{const a=await fetch("/download/manifest");if(!a.ok)throw new Error(`HTTP ${a.status}`);return await a.json()},getWindowsInstallerTicket:()=>me("/teacher/download/windows-ticket",{method:"POST"})};class Rl extends Error{constructor(l,i){const c=new.target.prototype;super(`${l}: Status code '${i}'`),this.statusCode=i,this.__proto__=c}}class Lc extends Error{constructor(l="A timeout occurred."){const i=new.target.prototype;super(l),this.__proto__=i}}class rn extends Error{constructor(l="An abort occurred."){const i=new.target.prototype;super(l),this.__proto__=i}}class Wh extends Error{constructor(l,i){const c=new.target.prototype;super(l),this.transport=i,this.errorType="UnsupportedTransportError",this.__proto__=c}}class Kh extends Error{constructor(l,i){const c=new.target.prototype;super(l),this.transport=i,this.errorType="DisabledTransportError",this.__proto__=c}}class qh extends Error{constructor(l,i){const c=new.target.prototype;super(l),this.transport=i,this.errorType="FailedToStartTransportError",this.__proto__=c}}class y0 extends Error{constructor(l){const i=new.target.prototype;super(l),this.errorType="FailedToNegotiateWithServerError",this.__proto__=i}}class Qh extends Error{constructor(l,i){const c=new.target.prototype;super(l),this.innerErrors=i,this.__proto__=c}}class V0{constructor(l,i,c){this.statusCode=l,this.statusText=i,this.content=c}}class $i{get(l,i){return this.send({...i,method:"GET",url:l})}post(l,i){return this.send({...i,method:"POST",url:l})}delete(l,i){return this.send({...i,method:"DELETE",url:l})}getCookieString(l){return""}}var X;(function(a){a[a.Trace=0]="Trace",a[a.Debug=1]="Debug",a[a.Information=2]="Information",a[a.Warning=3]="Warning",a[a.Error=4]="Error",a[a.Critical=5]="Critical",a[a.None=6]="None"})(X||(X={}));class ha{constructor(){}log(l,i){}}ha.instance=new ha;const Jh="8.0.29";class Yt{static isRequired(l,i){if(l==null)throw new Error(`The '${i}' argument is required.`)}static isNotEmpty(l,i){if(!l||l.match(/^\s*$/))throw new Error(`The '${i}' argument should not be empty.`)}static isIn(l,i,c){if(!(l in i))throw new Error(`Unknown ${c} value: ${l}.`)}}class Ft{static get isBrowser(){return!Ft.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Ft.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Ft.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function pa(a,l){let i="";return $l(a)?(i=`Binary data of length ${a.byteLength}`,l&&(i+=`. Content: '${Gh(a)}'`)):typeof a=="string"&&(i=`String data of length ${a.length}`,l&&(i+=`. Content: '${a}'`)),i}function Gh(a){const l=new Uint8Array(a);let i="";return l.forEach(c=>{const u=c<16?"0":"";i+=`0x${u}${c.toString(16)} `}),i.substr(0,i.length-1)}function $l(a){return a&&typeof ArrayBuffer<"u"&&(a instanceof ArrayBuffer||a.constructor&&a.constructor.name==="ArrayBuffer")}async function W0(a,l,i,c,u,m){const p={},[b,f]=hr();p[b]=f,a.log(X.Trace,`(${l} transport) sending data. ${pa(u,m.logMessageContent)}.`);const j=$l(u)?"arraybuffer":"text",k=await i.post(c,{content:u,headers:{...p,...m.headers},responseType:j,timeout:m.timeout,withCredentials:m.withCredentials});a.log(X.Trace,`(${l} transport) request complete. Response status: ${k.statusCode}.`)}function Xh(a){return a===void 0?new Ii(X.Information):a===null?ha.instance:a.log!==void 0?a:new Ii(a)}class Yh{constructor(l,i){this._subject=l,this._observer=i}dispose(){const l=this._subject.observers.indexOf(this._observer);l>-1&&this._subject.observers.splice(l,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(i=>{})}}class Ii{constructor(l){this._minLevel=l,this.out=console}log(l,i){if(l>=this._minLevel){const c=`[${new Date().toISOString()}] ${X[l]}: ${i}`;switch(l){case X.Critical:case X.Error:this.out.error(c);break;case X.Warning:this.out.warn(c);break;case X.Information:this.out.info(c);break;default:this.out.log(c);break}}}}function hr(){let a="X-SignalR-User-Agent";return Ft.isNode&&(a="User-Agent"),[a,Zh(Jh,ep(),sp(),tp())]}function Zh(a,l,i,c){let u="Microsoft SignalR/";const m=a.split(".");return u+=`${m[0]}.${m[1]}`,u+=` (${a}; `,l&&l!==""?u+=`${l}; `:u+="Unknown OS; ",u+=`${i}`,c?u+=`; ${c}`:u+="; Unknown Runtime Version",u+=")",u}function ep(){if(Ft.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function tp(){if(Ft.isNode)return process.versions.node}function sp(){return Ft.isNode?"NodeJS":"Browser"}function jc(a){return a.stack?a.stack:a.message?a.message:`${a}`}function np(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class lp extends $i{constructor(l){if(super(),this._logger=l,typeof fetch>"u"||Ft.isNode){const i=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(i("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=i("node-fetch"):this._fetchType=fetch,this._fetchType=i("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(np());if(typeof AbortController>"u"){const i=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=i("abort-controller")}else this._abortControllerType=AbortController}async send(l){if(l.abortSignal&&l.abortSignal.aborted)throw new rn;if(!l.method)throw new Error("No method defined.");if(!l.url)throw new Error("No url defined.");const i=new this._abortControllerType;let c;l.abortSignal&&(l.abortSignal.onabort=()=>{i.abort(),c=new rn});let u=null;if(l.timeout){const f=l.timeout;u=setTimeout(()=>{i.abort(),this._logger.log(X.Warning,"Timeout from HTTP request."),c=new Lc},f)}l.content===""&&(l.content=void 0),l.content&&(l.headers=l.headers||{},$l(l.content)?l.headers["Content-Type"]="application/octet-stream":l.headers["Content-Type"]="text/plain;charset=UTF-8");let m;try{m=await this._fetchType(l.url,{body:l.content,cache:"no-cache",credentials:l.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...l.headers},method:l.method,mode:"cors",redirect:"follow",signal:i.signal})}catch(f){throw c||(this._logger.log(X.Warning,`Error from HTTP request. ${f}.`),f)}finally{u&&clearTimeout(u),l.abortSignal&&(l.abortSignal.onabort=null)}if(!m.ok){const f=await N0(m,"text");throw new Rl(f||m.statusText,m.status)}const b=await N0(m,l.responseType);return new V0(m.status,m.statusText,b)}getCookieString(l){let i="";return Ft.isNode&&this._jar&&this._jar.getCookies(l,(c,u)=>i=u.join("; ")),i}}function N0(a,l){let i;switch(l){case"arraybuffer":i=a.arrayBuffer();break;case"text":i=a.text();break;case"blob":case"document":case"json":throw new Error(`${l} is not supported.`);default:i=a.text();break}return i}class rp extends $i{constructor(l){super(),this._logger=l}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new rn):l.method?l.url?new Promise((i,c)=>{const u=new XMLHttpRequest;u.open(l.method,l.url,!0),u.withCredentials=l.withCredentials===void 0?!0:l.withCredentials,u.setRequestHeader("X-Requested-With","XMLHttpRequest"),l.content===""&&(l.content=void 0),l.content&&($l(l.content)?u.setRequestHeader("Content-Type","application/octet-stream"):u.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const m=l.headers;m&&Object.keys(m).forEach(p=>{u.setRequestHeader(p,m[p])}),l.responseType&&(u.responseType=l.responseType),l.abortSignal&&(l.abortSignal.onabort=()=>{u.abort(),c(new rn)}),l.timeout&&(u.timeout=l.timeout),u.onload=()=>{l.abortSignal&&(l.abortSignal.onabort=null),u.status>=200&&u.status<300?i(new V0(u.status,u.statusText,u.response||u.responseText)):c(new Rl(u.response||u.responseText||u.statusText,u.status))},u.onerror=()=>{this._logger.log(X.Warning,`Error from HTTP request. ${u.status}: ${u.statusText}.`),c(new Rl(u.statusText,u.status))},u.ontimeout=()=>{this._logger.log(X.Warning,"Timeout from HTTP request."),c(new Lc)},u.send(l.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class ap extends $i{constructor(l){if(super(),typeof fetch<"u"||Ft.isNode)this._httpClient=new lp(l);else if(typeof XMLHttpRequest<"u")this._httpClient=new rp(l);else throw new Error("No usable HttpClient found.")}send(l){return l.abortSignal&&l.abortSignal.aborted?Promise.reject(new rn):l.method?l.url?this._httpClient.send(l):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(l){return this._httpClient.getCookieString(l)}}class zs{static write(l){return`${l}${zs.RecordSeparator}`}static parse(l){if(l[l.length-1]!==zs.RecordSeparator)throw new Error("Message is incomplete.");const i=l.split(zs.RecordSeparator);return i.pop(),i}}zs.RecordSeparatorCode=30;zs.RecordSeparator=String.fromCharCode(zs.RecordSeparatorCode);class ip{writeHandshakeRequest(l){return zs.write(JSON.stringify(l))}parseHandshakeResponse(l){let i,c;if($l(l)){const b=new Uint8Array(l),f=b.indexOf(zs.RecordSeparatorCode);if(f===-1)throw new Error("Message is incomplete.");const j=f+1;i=String.fromCharCode.apply(null,Array.prototype.slice.call(b.slice(0,j))),c=b.byteLength>j?b.slice(j).buffer:null}else{const b=l,f=b.indexOf(zs.RecordSeparator);if(f===-1)throw new Error("Message is incomplete.");const j=f+1;i=b.substring(0,j),c=b.length>j?b.substring(j):null}const u=zs.parse(i),m=JSON.parse(u[0]);if(m.type)throw new Error("Expected a handshake response from the server.");return[c,m]}}var Qe;(function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close",a[a.Ack=8]="Ack",a[a.Sequence=9]="Sequence"})(Qe||(Qe={}));class op{constructor(){this.observers=[]}next(l){for(const i of this.observers)i.next(l)}error(l){for(const i of this.observers)i.error&&i.error(l)}complete(){for(const l of this.observers)l.complete&&l.complete()}subscribe(l){return this.observers.push(l),new Yh(this,l)}}class cp{constructor(l,i,c){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=l,this._connection=i,this._bufferSize=c}async _send(l){const i=this._protocol.writeMessage(l);let c=Promise.resolve();if(this._isInvocationMessage(l)){this._totalMessageCount++;let u=()=>{},m=()=>{};$l(i)?this._bufferedByteCount+=i.byteLength:this._bufferedByteCount+=i.length,this._bufferedByteCount>=this._bufferSize&&(c=new Promise((p,b)=>{u=p,m=b})),this._messages.push(new dp(i,this._totalMessageCount,u,m))}try{this._reconnectInProgress||await this._connection.send(i)}catch{this._disconnected()}await c}_ack(l){let i=-1;for(let c=0;cthis._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=l.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const l=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:Qe.Sequence,sequenceId:l}));const i=this._messages;for(const c of i)await this._connection.send(c._message);this._reconnectInProgress=!1}_dispose(l){l??(l=new Error("Unable to reconnect to server."));for(const i of this._messages)i._rejector(l)}_isInvocationMessage(l){switch(l.type){case Qe.Invocation:case Qe.StreamItem:case Qe.Completion:case Qe.StreamInvocation:case Qe.CancelInvocation:return!0;case Qe.Close:case Qe.Sequence:case Qe.Ping:case Qe.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:Qe.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class dp{constructor(l,i,c,u){this._message=l,this._id=i,this._resolver=c,this._rejector=u}}const up=30*1e3,xp=15*1e3,mp=1e5;var yt;(function(a){a.Disconnected="Disconnected",a.Connecting="Connecting",a.Connected="Connected",a.Disconnecting="Disconnecting",a.Reconnecting="Reconnecting"})(yt||(yt={}));class Ac{static create(l,i,c,u,m,p,b){return new Ac(l,i,c,u,m,p,b)}constructor(l,i,c,u,m,p,b){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(X.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Yt.isRequired(l,"connection"),Yt.isRequired(i,"logger"),Yt.isRequired(c,"protocol"),this.serverTimeoutInMilliseconds=m??up,this.keepAliveIntervalInMilliseconds=p??xp,this._statefulReconnectBufferSize=b??mp,this._logger=i,this._protocol=c,this.connection=l,this._reconnectPolicy=u,this._handshakeProtocol=new ip,this.connection.onreceive=f=>this._processIncomingData(f),this.connection.onclose=f=>this._connectionClosed(f),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=yt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Qe.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(l){if(this._connectionState!==yt.Disconnected&&this._connectionState!==yt.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!l)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=l}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==yt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=yt.Connecting,this._logger.log(X.Debug,"Starting HubConnection.");try{await this._startInternal(),Ft.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=yt.Connected,this._connectionStarted=!0,this._logger.log(X.Debug,"HubConnection connected successfully.")}catch(l){return this._connectionState=yt.Disconnected,this._logger.log(X.Debug,`HubConnection failed to start successfully because of error '${l}'.`),Promise.reject(l)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const l=new Promise((i,c)=>{this._handshakeResolver=i,this._handshakeRejecter=c});await this.connection.start(this._protocol.transferFormat);try{let i=this._protocol.version;this.connection.features.reconnect||(i=1);const c={protocol:this._protocol.name,version:i};if(this._logger.log(X.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(c)),this._logger.log(X.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await l,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new cp(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(i){throw this._logger.log(X.Debug,`Hub handshake failed with error '${i}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(i),i}}async stop(){const l=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await l}catch{}}_stopInternal(l){if(this._connectionState===yt.Disconnected)return this._logger.log(X.Debug,`Call to HubConnection.stop(${l}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===yt.Disconnecting)return this._logger.log(X.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const i=this._connectionState;return this._connectionState=yt.Disconnecting,this._logger.log(X.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(X.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(i===yt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=l||new rn("The connection was stopped before the hub handshake could complete."),this.connection.stop(l))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(l,...i){const[c,u]=this._replaceStreamingParams(i),m=this._createStreamInvocation(l,i,u);let p;const b=new op;return b.cancelCallback=()=>{const f=this._createCancelInvocation(m.invocationId);return delete this._callbacks[m.invocationId],p.then(()=>this._sendWithProtocol(f))},this._callbacks[m.invocationId]=(f,j)=>{if(j){b.error(j);return}else f&&(f.type===Qe.Completion?f.error?b.error(new Error(f.error)):b.complete():b.next(f.item))},p=this._sendWithProtocol(m).catch(f=>{b.error(f),delete this._callbacks[m.invocationId]}),this._launchStreams(c,p),b}_sendMessage(l){return this._resetKeepAliveInterval(),this.connection.send(l)}_sendWithProtocol(l){return this._messageBuffer?this._messageBuffer._send(l):this._sendMessage(this._protocol.writeMessage(l))}send(l,...i){const[c,u]=this._replaceStreamingParams(i),m=this._sendWithProtocol(this._createInvocation(l,i,!0,u));return this._launchStreams(c,m),m}invoke(l,...i){const[c,u]=this._replaceStreamingParams(i),m=this._createInvocation(l,i,!1,u);return new Promise((b,f)=>{this._callbacks[m.invocationId]=(k,T)=>{if(T){f(T);return}else k&&(k.type===Qe.Completion?k.error?f(new Error(k.error)):b(k.result):f(new Error(`Unexpected message type: ${k.type}`)))};const j=this._sendWithProtocol(m).catch(k=>{f(k),delete this._callbacks[m.invocationId]});this._launchStreams(c,j)})}on(l,i){!l||!i||(l=l.toLowerCase(),this._methods[l]||(this._methods[l]=[]),this._methods[l].indexOf(i)===-1&&this._methods[l].push(i))}off(l,i){if(!l)return;l=l.toLowerCase();const c=this._methods[l];if(c)if(i){const u=c.indexOf(i);u!==-1&&(c.splice(u,1),c.length===0&&delete this._methods[l])}else delete this._methods[l]}onclose(l){l&&this._closedCallbacks.push(l)}onreconnecting(l){l&&this._reconnectingCallbacks.push(l)}onreconnected(l){l&&this._reconnectedCallbacks.push(l)}_processIncomingData(l){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(l=this._processHandshakeResponse(l),this._receivedHandshakeResponse=!0),l){const i=this._protocol.parseMessages(l,this._logger);for(const c of i)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(c)))switch(c.type){case Qe.Invocation:this._invokeClientMethod(c).catch(u=>{this._logger.log(X.Error,`Invoke client method threw error: ${jc(u)}`)});break;case Qe.StreamItem:case Qe.Completion:{const u=this._callbacks[c.invocationId];if(u){c.type===Qe.Completion&&delete this._callbacks[c.invocationId];try{u(c)}catch(m){this._logger.log(X.Error,`Stream callback threw error: ${jc(m)}`)}}break}case Qe.Ping:break;case Qe.Close:{this._logger.log(X.Information,"Close message received from server.");const u=c.error?new Error("Server returned an error on close: "+c.error):void 0;c.allowReconnect===!0?this.connection.stop(u):this._stopPromise=this._stopInternal(u);break}case Qe.Ack:this._messageBuffer&&this._messageBuffer._ack(c);break;case Qe.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(c);break;default:this._logger.log(X.Warning,`Invalid message type: ${c.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(l){let i,c;try{[c,i]=this._handshakeProtocol.parseHandshakeResponse(l)}catch(u){const m="Error parsing handshake response: "+u;this._logger.log(X.Error,m);const p=new Error(m);throw this._handshakeRejecter(p),p}if(i.error){const u="Server returned handshake error: "+i.error;this._logger.log(X.Error,u);const m=new Error(u);throw this._handshakeRejecter(m),m}else this._logger.log(X.Debug,"Server handshake complete.");return this._handshakeResolver(),c}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let l=this._nextKeepAlive-new Date().getTime();l<0&&(l=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===yt.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},l)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(l){const i=l.target.toLowerCase(),c=this._methods[i];if(!c){this._logger.log(X.Warning,`No client method with the name '${i}' found.`),l.invocationId&&(this._logger.log(X.Warning,`No result given for '${i}' method and invocation ID '${l.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)));return}const u=c.slice(),m=!!l.invocationId;let p,b,f;for(const j of u)try{const k=p;p=await j.apply(this,l.arguments),m&&p&&k&&(this._logger.log(X.Error,`Multiple results provided for '${i}'. Sending error to server.`),f=this._createCompletionMessage(l.invocationId,"Client provided multiple results.",null)),b=void 0}catch(k){b=k,this._logger.log(X.Error,`A callback for the method '${i}' threw error '${k}'.`)}f?await this._sendWithProtocol(f):m?(b?f=this._createCompletionMessage(l.invocationId,`${b}`,null):p!==void 0?f=this._createCompletionMessage(l.invocationId,null,p):(this._logger.log(X.Warning,`No result given for '${i}' method and invocation ID '${l.invocationId}'.`),f=this._createCompletionMessage(l.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(f)):p&&this._logger.log(X.Error,`Result given for '${i}' method but server is not expecting a result.`)}_connectionClosed(l){this._logger.log(X.Debug,`HubConnection.connectionClosed(${l}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||l||new rn("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(l||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===yt.Disconnecting?this._completeClose(l):this._connectionState===yt.Connected&&this._reconnectPolicy?this._reconnect(l):this._connectionState===yt.Connected&&this._completeClose(l)}_completeClose(l){if(this._connectionStarted){this._connectionState=yt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(l??new Error("Connection closed.")),this._messageBuffer=void 0),Ft.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(i=>i.apply(this,[l]))}catch(i){this._logger.log(X.Error,`An onclose callback called with error '${l}' threw error '${i}'.`)}}}async _reconnect(l){const i=Date.now();let c=0,u=l!==void 0?l:new Error("Attempting to reconnect due to a unknown error."),m=this._getNextRetryDelay(c++,0,u);if(m===null){this._logger.log(X.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(l);return}if(this._connectionState=yt.Reconnecting,l?this._logger.log(X.Information,`Connection reconnecting because of error '${l}'.`):this._logger.log(X.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(p=>p.apply(this,[l]))}catch(p){this._logger.log(X.Error,`An onreconnecting callback called with error '${l}' threw error '${p}'.`)}if(this._connectionState!==yt.Reconnecting){this._logger.log(X.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;m!==null;){if(this._logger.log(X.Information,`Reconnect attempt number ${c} will start in ${m} ms.`),await new Promise(p=>{this._reconnectDelayHandle=setTimeout(p,m)}),this._reconnectDelayHandle=void 0,this._connectionState!==yt.Reconnecting){this._logger.log(X.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=yt.Connected,this._logger.log(X.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(p=>p.apply(this,[this.connection.connectionId]))}catch(p){this._logger.log(X.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${p}'.`)}return}catch(p){if(this._logger.log(X.Information,`Reconnect attempt failed because of error '${p}'.`),this._connectionState!==yt.Reconnecting){this._logger.log(X.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===yt.Disconnecting&&this._completeClose();return}u=p instanceof Error?p:new Error(p.toString()),m=this._getNextRetryDelay(c++,Date.now()-i,u)}}this._logger.log(X.Information,`Reconnect retries have been exhausted after ${Date.now()-i} ms and ${c} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(l,i,c){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:i,previousRetryCount:l,retryReason:c})}catch(u){return this._logger.log(X.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${l}, ${i}) threw error '${u}'.`),null}}_cancelCallbacksWithError(l){const i=this._callbacks;this._callbacks={},Object.keys(i).forEach(c=>{const u=i[c];try{u(null,l)}catch(m){this._logger.log(X.Error,`Stream 'error' callback called with '${l}' threw error: ${jc(m)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(l,i,c,u){if(c)return u.length!==0?{arguments:i,streamIds:u,target:l,type:Qe.Invocation}:{arguments:i,target:l,type:Qe.Invocation};{const m=this._invocationId;return this._invocationId++,u.length!==0?{arguments:i,invocationId:m.toString(),streamIds:u,target:l,type:Qe.Invocation}:{arguments:i,invocationId:m.toString(),target:l,type:Qe.Invocation}}}_launchStreams(l,i){if(l.length!==0){i||(i=Promise.resolve());for(const c in l)l[c].subscribe({complete:()=>{i=i.then(()=>this._sendWithProtocol(this._createCompletionMessage(c)))},error:u=>{let m;u instanceof Error?m=u.message:u&&u.toString?m=u.toString():m="Unknown error",i=i.then(()=>this._sendWithProtocol(this._createCompletionMessage(c,m)))},next:u=>{i=i.then(()=>this._sendWithProtocol(this._createStreamItemMessage(c,u)))}})}}_replaceStreamingParams(l){const i=[],c=[];for(let u=0;u0)&&(i=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(l);const c=await this._innerClient.send(l);return i&&c.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(l),await this._innerClient.send(l)):c}_setAuthorizationHeader(l){l.headers||(l.headers={}),this._accessToken?l.headers[Dl.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&l.headers[Dl.Authorization]&&delete l.headers[Dl.Authorization]}getCookieString(l){return this._innerClient.getCookieString(l)}}var ss;(function(a){a[a.None=0]="None",a[a.WebSockets=1]="WebSockets",a[a.ServerSentEvents=2]="ServerSentEvents",a[a.LongPolling=4]="LongPolling"})(ss||(ss={}));var bs;(function(a){a[a.Text=1]="Text",a[a.Binary=2]="Binary"})(bs||(bs={}));let fp=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class k0{get pollAborted(){return this._pollAbort.aborted}constructor(l,i,c){this._httpClient=l,this._logger=i,this._pollAbort=new fp,this._options=c,this._running=!1,this.onreceive=null,this.onclose=null}async connect(l,i){if(Yt.isRequired(l,"url"),Yt.isRequired(i,"transferFormat"),Yt.isIn(i,bs,"transferFormat"),this._url=l,this._logger.log(X.Trace,"(LongPolling transport) Connecting."),i===bs.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[c,u]=hr(),m={[c]:u,...this._options.headers},p={abortSignal:this._pollAbort.signal,headers:m,timeout:1e5,withCredentials:this._options.withCredentials};i===bs.Binary&&(p.responseType="arraybuffer");const b=`${l}&_=${Date.now()}`;this._logger.log(X.Trace,`(LongPolling transport) polling: ${b}.`);const f=await this._httpClient.get(b,p);f.statusCode!==200?(this._logger.log(X.Error,`(LongPolling transport) Unexpected response code: ${f.statusCode}.`),this._closeError=new Rl(f.statusText||"",f.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,p)}async _poll(l,i){try{for(;this._running;)try{const c=`${l}&_=${Date.now()}`;this._logger.log(X.Trace,`(LongPolling transport) polling: ${c}.`);const u=await this._httpClient.get(c,i);u.statusCode===204?(this._logger.log(X.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):u.statusCode!==200?(this._logger.log(X.Error,`(LongPolling transport) Unexpected response code: ${u.statusCode}.`),this._closeError=new Rl(u.statusText||"",u.statusCode),this._running=!1):u.content?(this._logger.log(X.Trace,`(LongPolling transport) data received. ${pa(u.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(u.content)):this._logger.log(X.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(c){this._running?c instanceof Lc?this._logger.log(X.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=c,this._running=!1):this._logger.log(X.Trace,`(LongPolling transport) Poll errored after shutdown: ${c.message}`)}}finally{this._logger.log(X.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(l){return this._running?W0(this._logger,"LongPolling",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(X.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(X.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const l={},[i,c]=hr();l[i]=c;const u={headers:{...l,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let m;try{await this._httpClient.delete(this._url,u)}catch(p){m=p}m?m instanceof Rl&&(m.statusCode===404?this._logger.log(X.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(X.Trace,`(LongPolling transport) Error sending a DELETE request: ${m}`)):this._logger.log(X.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(X.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let l="(LongPolling transport) Firing onclose event.";this._closeError&&(l+=" Error: "+this._closeError),this._logger.log(X.Trace,l),this.onclose(this._closeError)}}}class gp{constructor(l,i,c,u){this._httpClient=l,this._accessToken=i,this._logger=c,this._options=u,this.onreceive=null,this.onclose=null}async connect(l,i){return Yt.isRequired(l,"url"),Yt.isRequired(i,"transferFormat"),Yt.isIn(i,bs,"transferFormat"),this._logger.log(X.Trace,"(SSE transport) Connecting."),this._url=l,this._accessToken&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((c,u)=>{let m=!1;if(i!==bs.Text){u(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let p;if(Ft.isBrowser||Ft.isWebWorker)p=new this._options.EventSource(l,{withCredentials:this._options.withCredentials});else{const b=this._httpClient.getCookieString(l),f={};f.Cookie=b;const[j,k]=hr();f[j]=k,p=new this._options.EventSource(l,{withCredentials:this._options.withCredentials,headers:{...f,...this._options.headers}})}try{p.onmessage=b=>{if(this.onreceive)try{this._logger.log(X.Trace,`(SSE transport) data received. ${pa(b.data,this._options.logMessageContent)}.`),this.onreceive(b.data)}catch(f){this._close(f);return}},p.onerror=b=>{m?this._close():u(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},p.onopen=()=>{this._logger.log(X.Information,`SSE connected to ${this._url}`),this._eventSource=p,m=!0,c()}}catch(b){u(b);return}})}async send(l){return this._eventSource?W0(this._logger,"SSE",this._httpClient,this._url,l,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(l){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(l))}}class bp{constructor(l,i,c,u,m,p){this._logger=c,this._accessTokenFactory=i,this._logMessageContent=u,this._webSocketConstructor=m,this._httpClient=l,this.onreceive=null,this.onclose=null,this._headers=p}async connect(l,i){Yt.isRequired(l,"url"),Yt.isRequired(i,"transferFormat"),Yt.isIn(i,bs,"transferFormat"),this._logger.log(X.Trace,"(WebSockets transport) Connecting.");let c;return this._accessTokenFactory&&(c=await this._accessTokenFactory()),new Promise((u,m)=>{l=l.replace(/^http/,"ws");let p;const b=this._httpClient.getCookieString(l);let f=!1;if(Ft.isNode||Ft.isReactNative){const j={},[k,T]=hr();j[k]=T,c&&(j[Dl.Authorization]=`Bearer ${c}`),b&&(j[Dl.Cookie]=b),p=new this._webSocketConstructor(l,void 0,{headers:{...j,...this._headers}})}else c&&(l+=(l.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(c)}`);p||(p=new this._webSocketConstructor(l)),i===bs.Binary&&(p.binaryType="arraybuffer"),p.onopen=j=>{this._logger.log(X.Information,`WebSocket connected to ${l}.`),this._webSocket=p,f=!0,u()},p.onerror=j=>{let k=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?k=j.error:k="There was an error with the transport",this._logger.log(X.Information,`(WebSockets transport) ${k}.`)},p.onmessage=j=>{if(this._logger.log(X.Trace,`(WebSockets transport) data received. ${pa(j.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(j.data)}catch(k){this._close(k);return}},p.onclose=j=>{if(f)this._close(j);else{let k=null;typeof ErrorEvent<"u"&&j instanceof ErrorEvent?k=j.error:k="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",m(new Error(k))}}})}send(l){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(X.Trace,`(WebSockets transport) sending data. ${pa(l,this._logMessageContent)}.`),this._webSocket.send(l),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(l){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(X.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(l)&&(l.wasClean===!1||l.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${l.code} (${l.reason||"no reason given"}).`)):l instanceof Error?this.onclose(l):this.onclose())}_isCloseEvent(l){return l&&typeof l.wasClean=="boolean"&&typeof l.code=="number"}}const S0=100;class vp{constructor(l,i={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Yt.isRequired(l,"url"),this._logger=Xh(i.logger),this.baseUrl=this._resolveUrl(l),i=i||{},i.logMessageContent=i.logMessageContent===void 0?!1:i.logMessageContent,typeof i.withCredentials=="boolean"||i.withCredentials===void 0)i.withCredentials=i.withCredentials===void 0?!0:i.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");i.timeout=i.timeout===void 0?100*1e3:i.timeout;let c=null,u=null;if(Ft.isNode&&typeof require<"u"){const m=typeof __webpack_require__=="function"?__non_webpack_require__:require;c=m("ws"),u=m("eventsource")}!Ft.isNode&&typeof WebSocket<"u"&&!i.WebSocket?i.WebSocket=WebSocket:Ft.isNode&&!i.WebSocket&&c&&(i.WebSocket=c),!Ft.isNode&&typeof EventSource<"u"&&!i.EventSource?i.EventSource=EventSource:Ft.isNode&&!i.EventSource&&typeof u<"u"&&(i.EventSource=u),this._httpClient=new pp(i.httpClient||new ap(this._logger),i.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=i,this.onreceive=null,this.onclose=null}async start(l){if(l=l||bs.Binary,Yt.isIn(l,bs,"transferFormat"),this._logger.log(X.Debug,`Starting connection with transfer format '${bs[l]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(l),await this._startInternalPromise,this._connectionState==="Disconnecting"){const i="Failed to start the HttpConnection before stop() was called.";return this._logger.log(X.Error,i),await this._stopPromise,Promise.reject(new rn(i))}else if(this._connectionState!=="Connected"){const i="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(X.Error,i),Promise.reject(new rn(i))}this._connectionStarted=!0}send(l){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Mc(this.transport)),this._sendQueue.send(l))}async stop(l){if(this._connectionState==="Disconnected")return this._logger.log(X.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(X.Debug,`Call to HttpConnection.stop(${l}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(i=>{this._stopPromiseResolver=i}),await this._stopInternal(l),await this._stopPromise}async _stopInternal(l){this._stopError=l;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(i){this._logger.log(X.Error,`HttpConnection.transport.stop() threw error '${i}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(X.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(l){let i=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===ss.WebSockets)this.transport=this._constructTransport(ss.WebSockets),await this._startTransport(i,l);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let c=null,u=0;do{if(c=await this._getNegotiationResponse(i),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new rn("The connection was stopped during negotiation.");if(c.error)throw new Error(c.error);if(c.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(c.url&&(i=c.url),c.accessToken){const m=c.accessToken;this._accessTokenFactory=()=>m,this._httpClient._accessToken=m,this._httpClient._accessTokenFactory=void 0}u++}while(c.url&&u0?Promise.reject(new Qh(`Unable to connect to the server with any of the available transports. ${p.join(" ")}`,p)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(l){switch(l){case ss.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new bp(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case ss.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new gp(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case ss.LongPolling:return new k0(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${l}.`)}}_startTransport(l,i){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async c=>{let u=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(l,i),await this.features.resend()}catch{u=!0}else{this._stopConnection(c);return}u&&this._stopConnection(c)}:this.transport.onclose=c=>this._stopConnection(c),this.transport.connect(l,i)}_resolveTransportOrError(l,i,c,u){const m=ss[l.transport];if(m==null)return this._logger.log(X.Debug,`Skipping transport '${l.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${l.transport}' because it is not supported by this client.`);if(jp(i,m))if(l.transferFormats.map(b=>bs[b]).indexOf(c)>=0){if(m===ss.WebSockets&&!this._options.WebSocket||m===ss.ServerSentEvents&&!this._options.EventSource)return this._logger.log(X.Debug,`Skipping transport '${ss[m]}' because it is not supported in your environment.'`),new Wh(`'${ss[m]}' is not supported in your environment.`,m);this._logger.log(X.Debug,`Selecting transport '${ss[m]}'.`);try{return this.features.reconnect=m===ss.WebSockets?u:void 0,this._constructTransport(m)}catch(b){return b}}else return this._logger.log(X.Debug,`Skipping transport '${ss[m]}' because it does not support the requested transfer format '${bs[c]}'.`),new Error(`'${ss[m]}' does not support ${bs[c]}.`);else return this._logger.log(X.Debug,`Skipping transport '${ss[m]}' because it was disabled by the client.`),new Kh(`'${ss[m]}' is disabled by the client.`,m)}_isITransport(l){return l&&typeof l=="object"&&"connect"in l}_stopConnection(l){if(this._logger.log(X.Debug,`HttpConnection.stopConnection(${l}) called while in state ${this._connectionState}.`),this.transport=void 0,l=this._stopError||l,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(X.Debug,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(X.Warning,`Call to HttpConnection.stopConnection(${l}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${l}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),l?this._logger.log(X.Error,`Connection disconnected with error '${l}'.`):this._logger.log(X.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(i=>{this._logger.log(X.Error,`TransportSendQueue.stop() threw error '${i}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(l)}catch(i){this._logger.log(X.Error,`HttpConnection.onclose(${l}) threw error '${i}'.`)}}}_resolveUrl(l){if(l.lastIndexOf("https://",0)===0||l.lastIndexOf("http://",0)===0)return l;if(!Ft.isBrowser)throw new Error(`Cannot resolve '${l}'.`);const i=window.document.createElement("a");return i.href=l,this._logger.log(X.Information,`Normalizing '${l}' to '${i.href}'.`),i.href}_resolveNegotiateUrl(l){const i=new URL(l);i.pathname.endsWith("/")?i.pathname+="negotiate":i.pathname+="/negotiate";const c=new URLSearchParams(i.searchParams);return c.has("negotiateVersion")||c.append("negotiateVersion",this._negotiateVersion.toString()),c.has("useStatefulReconnect")?c.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&c.append("useStatefulReconnect","true"),i.search=c.toString(),i.toString()}}function jp(a,l){return!a||(l&a)!==0}class Mc{constructor(l){this._transport=l,this._buffer=[],this._executing=!0,this._sendBufferedData=new ki,this._transportResult=new ki,this._sendLoopPromise=this._sendLoop()}send(l){return this._bufferData(l),this._transportResult||(this._transportResult=new ki),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(l){if(this._buffer.length&&typeof this._buffer[0]!=typeof l)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof l}`);this._buffer.push(l),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new ki;const l=this._transportResult;this._transportResult=void 0;const i=typeof this._buffer[0]=="string"?this._buffer.join(""):Mc._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(i),l.resolve()}catch(c){l.reject(c)}}}static _concatBuffers(l){const i=l.map(m=>m.byteLength).reduce((m,p)=>m+p),c=new Uint8Array(i);let u=0;for(const m of l)c.set(new Uint8Array(m),u),u+=m.byteLength;return c.buffer}}class ki{constructor(){this.promise=new Promise((l,i)=>[this._resolver,this._rejecter]=[l,i])}resolve(){this._resolver()}reject(l){this._rejecter(l)}}const yp="json";class Np{constructor(){this.name=yp,this.version=2,this.transferFormat=bs.Text}parseMessages(l,i){if(typeof l!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!l)return[];i===null&&(i=ha.instance);const c=zs.parse(l),u=[];for(const m of c){const p=JSON.parse(m);if(typeof p.type!="number")throw new Error("Invalid payload.");switch(p.type){case Qe.Invocation:this._isInvocationMessage(p);break;case Qe.StreamItem:this._isStreamItemMessage(p);break;case Qe.Completion:this._isCompletionMessage(p);break;case Qe.Ping:break;case Qe.Close:break;case Qe.Ack:this._isAckMessage(p);break;case Qe.Sequence:this._isSequenceMessage(p);break;default:i.log(X.Information,"Unknown message type '"+p.type+"' ignored.");continue}u.push(p)}return u}writeMessage(l){return zs.write(JSON.stringify(l))}_isInvocationMessage(l){this._assertNotEmptyString(l.target,"Invalid payload for Invocation message."),l.invocationId!==void 0&&this._assertNotEmptyString(l.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(l){if(this._assertNotEmptyString(l.invocationId,"Invalid payload for StreamItem message."),l.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(l){if(l.result&&l.error)throw new Error("Invalid payload for Completion message.");!l.result&&l.error&&this._assertNotEmptyString(l.error,"Invalid payload for Completion message."),this._assertNotEmptyString(l.invocationId,"Invalid payload for Completion message.")}_isAckMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(l){if(typeof l.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(l,i){if(typeof l!="string"||l==="")throw new Error(i)}}const wp={trace:X.Trace,debug:X.Debug,info:X.Information,information:X.Information,warn:X.Warning,warning:X.Warning,error:X.Error,critical:X.Critical,none:X.None};function kp(a){const l=wp[a.toLowerCase()];if(typeof l<"u")return l;throw new Error(`Unknown log level: ${a}`)}class Sp{configureLogging(l){if(Yt.isRequired(l,"logging"),Cp(l))this.logger=l;else if(typeof l=="string"){const i=kp(l);this.logger=new Ii(i)}else this.logger=new Ii(l);return this}withUrl(l,i){return Yt.isRequired(l,"url"),Yt.isNotEmpty(l,"url"),this.url=l,typeof i=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...i}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:i},this}withHubProtocol(l){return Yt.isRequired(l,"protocol"),this.protocol=l,this}withAutomaticReconnect(l){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return l?Array.isArray(l)?this.reconnectPolicy=new w0(l):this.reconnectPolicy=l:this.reconnectPolicy=new w0,this}withServerTimeout(l){return Yt.isRequired(l,"milliseconds"),this._serverTimeoutInMilliseconds=l,this}withKeepAliveInterval(l){return Yt.isRequired(l,"milliseconds"),this._keepAliveIntervalInMilliseconds=l,this}withStatefulReconnect(l){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=l==null?void 0:l.bufferSize,this}build(){const l=this.httpConnectionOptions||{};if(l.logger===void 0&&(l.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const i=new vp(this.url,l);return Ac.create(i,this.logger||ha.instance,this.protocol||new Np,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function Cp(a){return a.log!==void 0}class _p{constructor(){ws(this,"connection",null);ws(this,"state","Disconnected");ws(this,"startPromise",null);ws(this,"permanentRetryTimer",null);ws(this,"isAuthenticated",!1);ws(this,"stateListeners",new Set);ws(this,"ackListeners",new Set);ws(this,"deviceStatusListeners",new Set);ws(this,"healthReportListeners",new Set);ws(this,"notificationListeners",new Set);ws(this,"cancelledListeners",new Set);ws(this,"visualReceiptListeners",new Set);Zn.subscribe(()=>{this.stop()})}getState(){return this.state}setState(l){this.state!==l&&(this.state=l,this.stateListeners.forEach(i=>i(l)))}onStateChange(l){return this.stateListeners.add(l),l(this.state),()=>this.stateListeners.delete(l)}onAckReceiptReceived(l){return this.ackListeners.add(l),()=>this.ackListeners.delete(l)}onDeviceStatusChanged(l){return this.deviceStatusListeners.add(l),()=>this.deviceStatusListeners.delete(l)}onHealthReportReceived(l){return this.healthReportListeners.add(l),()=>this.healthReportListeners.delete(l)}onNewNotificationBroadcast(l){return this.notificationListeners.add(l),()=>this.notificationListeners.delete(l)}onNotificationCancelled(l){return this.cancelledListeners.add(l),()=>this.cancelledListeners.delete(l)}onVisualReceiptUploaded(l){return this.visualReceiptListeners.add(l),()=>this.visualReceiptListeners.delete(l)}async start(){var i,c;if(!il()){this.setState("Disconnected");return}if(this.isAuthenticated=!0,((i=this.connection)==null?void 0:i.state)===yt.Connected){this.setState("Connected");return}return this.startPromise?this.startPromise:(this.connection||this.buildConnection(),this.setState(((c=this.connection)==null?void 0:c.state)===yt.Reconnecting?"Reconnecting":"Connecting"),this.startPromise=(async()=>{try{this.connection&&this.connection.state===yt.Disconnected&&(await this.connection.start(),this.setState("Connected"),this.clearPermanentRetryTimer())}catch(u){console.warn("SignalR start failed:",u),this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}finally{this.startPromise=null}})(),this.startPromise)}async stop(){if(this.isAuthenticated=!1,this.clearPermanentRetryTimer(),this.setState("Disconnected"),this.startPromise){try{await this.startPromise}catch{}this.startPromise=null}if(this.connection)try{await this.connection.stop()}catch(l){console.warn("Error stopping SignalR connection:",l)}finally{this.connection=null}}buildConnection(){this.connection=new Sp().withUrl("/hubs/teacher",{accessTokenFactory:()=>il()||""}).withAutomaticReconnect([0,2e3,5e3,1e4,3e4]).configureLogging(X.Warning).build(),this.connection.onreconnecting(()=>{this.setState("Reconnecting")}),this.connection.onreconnected(()=>{this.setState("Connected"),this.clearPermanentRetryTimer()}),this.connection.onclose(()=>{this.isAuthenticated?(this.setState("Reconnecting"),this.schedulePermanentRetry()):this.setState("Disconnected")}),this.connection.on("OnAckReceiptReceived",l=>{this.ackListeners.forEach(i=>i(l))}),this.connection.on("OnDeviceStatusChanged",l=>{this.deviceStatusListeners.forEach(i=>i(l))}),this.connection.on("OnHealthReportReceived",l=>{this.healthReportListeners.forEach(i=>i(l))}),this.connection.on("OnNewNotificationBroadcast",l=>{this.notificationListeners.forEach(i=>i(l))}),this.connection.on("OnNotificationCancelled",l=>{this.cancelledListeners.forEach(i=>i(l))}),this.connection.on("OnVisualReceiptUploaded",l=>{this.visualReceiptListeners.forEach(i=>i(l))})}schedulePermanentRetry(){this.permanentRetryTimer||!this.isAuthenticated||(this.permanentRetryTimer=setInterval(()=>{var l;if(!this.isAuthenticated){this.clearPermanentRetryTimer();return}((l=this.connection)==null?void 0:l.state)===yt.Disconnected&&this.start()},3e4))}clearPermanentRetryTimer(){this.permanentRetryTimer&&(clearInterval(this.permanentRetryTimer),this.permanentRetryTimer=null)}}const as=new _p,K0=x.createContext(void 0),Ep=({children:a})=>{const[l,i]=x.useState(()=>{try{const C=localStorage.getItem("classnotify_user");return C?JSON.parse(C):null}catch{return null}}),[c,u]=x.useState(il()),[m,p]=x.useState(!0);x.useEffect(()=>{const C=Zn.subscribe(()=>{as.stop(),ca(),u(null),i(null)});return()=>C()},[]),x.useEffect(()=>{(async()=>{var P,q;if(il())try{const v=await J.getMe();i(v),localStorage.setItem("classnotify_user",JSON.stringify(v)),Zn.reset(),as.start()}catch(v){((P=v==null?void 0:v.message)!=null&&P.includes("未授权")||(q=v==null?void 0:v.message)!=null&&q.includes("401"))&&(ca(),u(null),i(null))}else ca(),i(null),u(null);p(!1)})()},[]);const b=async(C,I)=>{const P=await J.login(C,I);if(!P.success||!P.token||!P.role)throw new Error(P.errorMessage||"登录失败");j0(P.token),u(P.token);const q={userId:P.userId||"",name:P.fullName||C,role:P.role,tenantId:P.tenantId||""};return i(q),localStorage.setItem("classnotify_user",JSON.stringify(q)),Zn.reset(),as.start(),P.role},f=async C=>{const I=await J.registerPersonal(C);if(!I.success||!I.token||!I.role)throw new Error(I.errorMessage||"注册失败");j0(I.token),u(I.token);const P={userId:I.userId||"",name:I.fullName||C.fullName,role:I.role,tenantId:I.tenantId||"",tenantType:C.accountType==="SchoolAdmin"?"School":"Personal"};return i(P),localStorage.setItem("classnotify_user",JSON.stringify(P)),Zn.reset(),as.start(),I},j=async C=>(await f(C)).role||"TenantOwner",k=()=>{as.stop(),ca(),u(null),i(null),Zn.reset()},T=async()=>{try{const C=await J.getMe();i(C),localStorage.setItem("classnotify_user",JSON.stringify(C))}catch{}};return e.jsx(K0.Provider,{value:{user:l,token:c,login:b,registerAccount:f,registerPersonal:j,logout:k,refreshUser:T,isLoading:m},children:a})},Ol=()=>{const a=x.useContext(K0);if(!a){let l=null;try{const i=localStorage.getItem("classnotify_user");i&&(l=JSON.parse(i))}catch{}return{user:l,token:il(),login:async()=>"Teacher",registerAccount:async()=>({success:!1}),registerPersonal:async()=>"TenantOwner",logout:()=>{},refreshUser:async()=>{},isLoading:!1}}return a};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tp=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q0=(...a)=>a.filter((l,i,c)=>!!l&&l.trim()!==""&&c.indexOf(l)===i).join(" ").trim();/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Ip={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.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rp=x.forwardRef(({color:a="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:u="",children:m,iconNode:p,...b},f)=>x.createElement("svg",{ref:f,...Ip,width:l,height:l,stroke:a,strokeWidth:c?Number(i)*24/Number(l):i,className:q0("lucide",u),...b},[...p.map(([j,k])=>x.createElement(j,k)),...Array.isArray(m)?m:[m]]));/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const we=(a,l)=>{const i=x.forwardRef(({className:c,...u},m)=>x.createElement(Rp,{ref:m,iconNode:l,className:q0(`lucide-${Tp(a)}`,c),...u}));return i.displayName=`${a}`,i};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dp=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],cn=we("Activity",Dp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pp=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],vs=we("ArrowRight",Pp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $p=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],C0=we("Ban",$p);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lp=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]],Ap=we("BellRing",Lp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mp=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ll=we("Bell",Mp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Op=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Up=we("Bookmark",Op);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fp=[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]],ks=we("Building2",Fp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zp=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Ul=we("Calendar",zp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bp=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Si=we("Camera",Bp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hp=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],_c=we("CheckCheck",Hp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vp=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],is=we("Check",Vp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wp=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],da=we("ChevronDown",Wp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kp=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],qp=we("ChevronRight",Kp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Zt=we("CircleAlert",Qp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ot=we("CircleCheck",Jp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xp=we("CircleHelp",Gp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ua=we("CircleX",Yp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],os=we("Clock",Zp);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ef=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]],tf=we("CloudRain",ef);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sf=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],us=we("Copy",sf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nf=[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]],Ri=we("Cpu",nf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lf=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],rf=we("CreditCard",lf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const af=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],ol=we("Download",af);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const of=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],cf=we("Ellipsis",of);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const df=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ci=we("ExternalLink",df);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uf=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Q0=we("Eye",uf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xf=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ll=we("FileText",xf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mf=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],hf=we("Filter",mf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pf=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],ff=we("Flame",pf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],bf=we("Globe",gf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vf=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],pr=we("GraduationCap",vf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jf=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Ec=we("History",jf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yf=[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]],Nf=we("Infinity",yf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],kf=we("Info",wf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sf=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],rt=we("KeyRound",Sf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cf=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],_f=we("Key",Cf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ef=[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]],Tf=we("Laptop",Ef);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const If=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],tl=we("Layers",If);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rf=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ct=we("LoaderCircle",Rf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Df=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],Tc=we("LockOpen",Df);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pf=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],sl=we("Lock",Pf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $f=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],Lf=we("LogOut",$f);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Af=[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]],Mf=we("Megaphone",Af);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Of=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],Uf=we("Menu",Of);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ff=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],_t=we("Monitor",Ff);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zf=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],rl=we("PenLine",zf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bf=[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]],Hf=we("Phone",Bf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vf=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Fs=we("Plus",Vf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wf=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],Il=we("Printer",Wf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kf=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],qf=we("QrCode",Kf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qf=[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]],Jf=we("RadioTower",Qf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gf=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],Al=we("Radio",Gf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xf=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],xt=we("RefreshCw",Xf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yf=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Zf=we("RotateCcw",Yf);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eg=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],tg=we("Save",eg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sg=[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]],Di=we("School",sg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ng=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],vn=we("Search",ng);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lg=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],al=we("Send",lg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rg=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ag=we("Settings",rg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ig=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],fa=we("ShieldAlert",ig);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const og=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ht=we("ShieldCheck",og);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cg=[["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"}]],J0=we("Shield",cg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dg=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],Oc=we("SlidersHorizontal",dg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ug=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],xg=we("Smartphone",ug);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mg=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],cl=we("Sparkles",mg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hg=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],fr=we("SquareCheckBig",hg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],gr=we("Square",pg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fg=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],mr=we("Tag",fg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gg=[["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"}]],Ei=we("Ticket",gg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bg=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Pl=we("Trash2",bg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vg=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Qt=we("TriangleAlert",vg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jg=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],_0=we("Unlink",jg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yg=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]],G0=we("UserCheck",yg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ng=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Bs=we("User",Ng);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wg=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],an=we("Users",wg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kg=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Uc=we("Volume2",kg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sg=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xt=we("X",Sg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cg=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],_g=we("ZoomIn",Cg);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eg=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Tg=we("ZoomOut",Eg),Ig=()=>{const[a,l]=x.useState(as.getState());return x.useEffect(()=>as.onStateChange(l),[]),a==="Connected"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"}),"云端正常"]}):a==="Reconnecting"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400"}),"正在重连…"]}):a==="Connecting"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-400 border border-blue-500/20",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-blue-400"}),"正在连接…"]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400"}),"云端离线"]})},Rg=()=>{const{user:a,logout:l}=Ol(),i=Ml(),c=Rn(),[u,m]=x.useState(!1),[p,b]=x.useState(null),f=()=>{i.pathname==="/teacher"?window.dispatchEvent(new CustomEvent("switch-teacher-tab",{detail:"profile"})):c("/teacher?tab=profile")};if(x.useEffect(()=>{m(!1),b(null)},[i.pathname]),!a)return null;const j=k=>i.pathname===k;return e.jsx("header",{className:"sticky top-0 z-50 border-b border-slate-800/80 bg-slate-950/80 backdrop-blur-xl",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex items-center justify-between h-16",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs(ke,{to:"/",className:"flex items-center space-x-2.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20",children:e.jsx(ll,{className:"w-5 h-5 text-white"})}),e.jsx("span",{className:"font-bold text-lg tracking-tight bg-gradient-to-r from-white via-slate-200 to-slate-400 bg-clip-text text-transparent",children:"ClassNotify"})]}),e.jsxs("span",{className:"text-xs px-2.5 py-1 rounded-full font-medium flex items-center gap-1.5 border bg-slate-900 border-slate-800 text-slate-300 whitespace-nowrap shrink-0 flex-none",children:[a.role==="SuperAdmin"&&e.jsxs(e.Fragment,{children:[e.jsx(Ht,{className:"w-3.5 h-3.5 text-amber-400"}),e.jsx("span",{className:"text-amber-400 font-semibold",children:"超级运维后台"})]}),a.role==="SchoolAdmin"&&e.jsxs(e.Fragment,{children:[e.jsx(Di,{className:"w-3.5 h-3.5 text-sky-400"}),e.jsx("span",{className:"text-sky-400 font-semibold",children:"学校管理后台"})]}),a.role==="Teacher"&&e.jsxs(e.Fragment,{children:[e.jsx(pr,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{className:"text-emerald-400 font-semibold",children:"教师工作台"})]}),a.role==="TenantOwner"&&e.jsxs(e.Fragment,{children:[e.jsx(pr,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{className:"text-emerald-400 font-semibold",children:"教师工作台"})]})]})]}),e.jsxs("nav",{className:"hidden md:flex items-center space-x-1",children:[a.role==="SuperAdmin"&&e.jsxs(e.Fragment,{children:[e.jsxs(ke,{to:"/admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap ${j("/admin")?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(tl,{className:"w-4 h-4"}),"总览"]}),e.jsxs("div",{className:"relative",onMouseEnter:()=>b("assets"),onMouseLeave:()=>b(null),children:[e.jsxs("button",{type:"button",onClick:()=>b(p==="assets"?null:"assets"),className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap ${["/admin/devices","/admin/tenants","/admin/users"].some(k=>i.pathname===k||i.pathname.startsWith(k+"/"))?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30 font-semibold":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(ks,{className:"w-4 h-4"}),"资产",e.jsx(da,{className:"w-3.5 h-3.5 opacity-60"})]}),p==="assets"&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 w-48 rounded-xl bg-slate-900/95 border border-slate-800 shadow-2xl p-1.5 backdrop-blur-xl z-50 space-y-0.5",children:[e.jsxs(ke,{to:"/admin/devices",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/devices")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(_t,{className:"w-4 h-4 text-indigo-400"}),"设备集控中心"]}),e.jsxs(ke,{to:"/admin/tenants",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/tenants")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(ks,{className:"w-4 h-4 text-indigo-400"}),"学校租户空间"]}),e.jsxs(ke,{to:"/admin/users",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/users")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(an,{className:"w-4 h-4 text-indigo-400"}),"用户账号中枢"]})]})]}),e.jsxs("div",{className:"relative",onMouseEnter:()=>b("license"),onMouseLeave:()=>b(null),children:[e.jsxs("button",{type:"button",onClick:()=>b(p==="license"?null:"license"),className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap ${["/admin/trial-security","/admin/trial-ledgers","/admin/codes","/admin/licenses"].some(k=>i.pathname===k||i.pathname.startsWith(k+"/"))?"bg-amber-500/20 text-amber-300 border border-amber-500/40 font-semibold":"text-amber-400/90 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400"}),"授权与风控",e.jsx(da,{className:"w-3.5 h-3.5 opacity-60"})]}),p==="license"&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 w-52 rounded-xl bg-slate-900/95 border border-slate-800 shadow-2xl p-1.5 backdrop-blur-xl z-50 space-y-0.5",children:[e.jsxs(ke,{to:"/admin/trial-security",className:`flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/trial-security")||j("/admin/trial-ledgers")?"bg-rose-500/20 text-rose-300 font-semibold":"text-slate-200 hover:bg-slate-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fa,{className:"w-4 h-4 text-rose-400"}),e.jsx("span",{children:"试用防刷与硬件审计"})]}),e.jsx("span",{className:"text-[10px] bg-rose-500/20 text-rose-300 px-1 rounded font-bold",children:"新"})]}),e.jsxs(ke,{to:"/admin/codes",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/codes")?"bg-amber-500/20 text-amber-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400"}),"商业激活码"]}),e.jsxs(ke,{to:"/admin/licenses",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/licenses")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(Ll,{className:"w-4 h-4 text-indigo-400"}),"授权流水账本"]})]})]}),e.jsxs("div",{className:"relative",onMouseEnter:()=>b("ops"),onMouseLeave:()=>b(null),children:[e.jsxs("button",{type:"button",onClick:()=>b(p==="ops"?null:"ops"),className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap ${["/admin/fleet","/admin/self-check-batches","/admin/broadcast"].some(k=>i.pathname===k||i.pathname.startsWith(k+"/"))?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30 font-semibold":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(cn,{className:"w-4 h-4"}),"运维集控",e.jsx(da,{className:"w-3.5 h-3.5 opacity-60"})]}),p==="ops"&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 w-48 rounded-xl bg-slate-900/95 border border-slate-800 shadow-2xl p-1.5 backdrop-blur-xl z-50 space-y-0.5",children:[e.jsxs(ke,{to:"/admin/fleet",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/fleet")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(Ri,{className:"w-4 h-4 text-indigo-400"}),"终端版本与更新"]}),e.jsxs(ke,{to:"/admin/self-check-batches",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/self-check-batches")||i.pathname.startsWith("/admin/self-check-batches")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(cn,{className:"w-4 h-4 text-indigo-400"}),"批量诊断自检"]}),e.jsxs(ke,{to:"/admin/broadcast",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/broadcast")?"bg-rose-600/20 text-rose-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(Al,{className:"w-4 h-4 text-rose-400"}),"全校应急广播"]})]})]}),e.jsxs("div",{className:"relative",onMouseEnter:()=>b("security"),onMouseLeave:()=>b(null),children:[e.jsxs("button",{type:"button",onClick:()=>b(p==="security"?null:"security"),className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 whitespace-nowrap ${["/admin/logs","/admin/history"].some(k=>i.pathname===k||i.pathname.startsWith(k+"/"))?"bg-indigo-600/20 text-indigo-400 border border-indigo-500/30 font-semibold":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(Ht,{className:"w-4 h-4"}),"安全与审计",e.jsx(da,{className:"w-3.5 h-3.5 opacity-60"})]}),p==="security"&&e.jsxs("div",{className:"absolute top-full right-0 mt-1 w-44 rounded-xl bg-slate-900/95 border border-slate-800 shadow-2xl p-1.5 backdrop-blur-xl z-50 space-y-0.5",children:[e.jsxs(ke,{to:"/admin/logs",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/logs")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(Ht,{className:"w-4 h-4 text-indigo-400"}),"超级审计日志"]}),e.jsxs(ke,{to:"/admin/history",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium transition-colors ${j("/admin/history")?"bg-indigo-600/20 text-indigo-300 font-semibold":"text-slate-300 hover:bg-slate-800"}`,children:[e.jsx(Ec,{className:"w-4 h-4 text-indigo-400"}),"全网呼叫审计"]})]})]})]}),a.role==="SchoolAdmin"&&e.jsxs(e.Fragment,{children:[e.jsxs(ke,{to:"/school-admin",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${j("/school-admin")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(Di,{className:"w-4 h-4"}),"学校概览"]}),e.jsxs(ke,{to:"/school-admin/classes",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${j("/school-admin/classes")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(tl,{className:"w-4 h-4"}),"班级管理"]}),e.jsxs(ke,{to:"/school-admin/devices",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${j("/school-admin/devices")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(_t,{className:"w-4 h-4 text-sky-400"}),"教室终端与续期"]}),e.jsxs(ke,{to:"/school-admin/teachers",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${j("/school-admin/teachers")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(an,{className:"w-4 h-4"}),"教师账号"]}),e.jsxs(ke,{to:"/school-admin/codes",className:`px-3 py-1.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-1.5 ${j("/school-admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/40 shadow-sm shadow-amber-500/10":"text-amber-400 hover:text-amber-300 hover:bg-amber-500/10"}`,children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400"}),"本校激活码"]}),e.jsxs(ke,{to:"/school-admin/history",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${j("/school-admin/history")?"bg-sky-600/20 text-sky-400 border border-sky-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(_c,{className:"w-4 h-4"}),"回执历史"]})]}),(a.role==="Teacher"||a.role==="TenantOwner")&&e.jsxs(ke,{to:"/teacher",className:`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center gap-1.5 ${j("/teacher")?"bg-emerald-600/20 text-emerald-400 border border-emerald-500/30":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[e.jsx(ll,{className:"w-4 h-4 text-emerald-400"}),"教师工作台"]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"hidden sm:block",children:e.jsx(Ig,{})}),a.role==="Teacher"||a.role==="TenantOwner"?e.jsxs("button",{onClick:f,className:"hidden sm:flex flex-col text-right px-2.5 py-1 rounded-xl hover:bg-slate-900 border border-transparent hover:border-slate-800 transition-colors group cursor-pointer",title:"点击前往个人资料",children:[e.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[e.jsx("span",{className:"text-sm font-medium text-slate-200 group-hover:text-indigo-400 transition-colors",children:a.name}),e.jsx(ag,{className:"w-3.5 h-3.5 text-slate-500 group-hover:text-indigo-400 transition-colors"})]}),e.jsx("span",{className:"text-xs text-slate-500",children:a.tenantId==="global"?"全平台":"教师账号"})]}):e.jsxs("div",{className:"hidden sm:flex flex-col text-right",children:[e.jsx("span",{className:"text-sm font-medium text-slate-200",children:a.name}),e.jsx("span",{className:"text-xs text-slate-500",children:a.tenantId==="global"?"全平台":a.tenantId})]}),(a.role==="Teacher"||a.role==="TenantOwner")&&e.jsx("button",{onClick:f,className:"p-2 rounded-lg text-slate-400 hover:text-indigo-400 hover:bg-indigo-500/10 transition-colors sm:hidden",title:"个人资料",children:e.jsx(Bs,{className:"w-4 h-4"})}),e.jsx("button",{onClick:l,className:"p-2 rounded-lg text-slate-400 hover:text-rose-400 hover:bg-rose-500/10 transition-colors",title:"退出登录",children:e.jsx(Lf,{className:"w-4 h-4"})}),!(a.role==="Teacher"||a.role==="TenantOwner")&&e.jsx("button",{onClick:()=>m(!u),className:"md:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-900 border border-slate-800 transition-colors","aria-label":"展开菜单",children:u?e.jsx(Xt,{className:"w-5 h-5"}):e.jsx(Uf,{className:"w-5 h-5"})})]})]}),u&&e.jsxs("div",{className:"md:hidden py-3 px-2 border-t border-slate-800/80 bg-slate-950/95 space-y-1",children:[a.role==="SuperAdmin"&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{to:"/admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tl,{className:"w-4 h-4 text-indigo-400"}),"总览大盘"]})}),e.jsx(ke,{to:"/admin/trial-security",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/trial-security")||j("/admin/trial-ledgers")?"bg-rose-500/25 text-rose-300 border border-rose-500/30":"text-rose-400 bg-rose-500/10 hover:bg-rose-500/20"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(fa,{className:"w-4 h-4 text-rose-400"}),"试用防刷与硬件审计"]}),e.jsx("span",{className:"text-[10px] bg-rose-500/20 text-rose-300 px-1.5 py-0.5 rounded border border-rose-500/30 font-bold",children:"新功能"})]})}),e.jsx(ke,{to:"/admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/codes")?"bg-amber-500/25 text-amber-300 border border-amber-500/30":"text-amber-400 bg-amber-500/10 hover:bg-amber-500/20"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400"}),"设备激活码生成与管理"]}),e.jsx("span",{className:"text-[10px] bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded border border-amber-500/30 font-bold",children:"重点"})]})}),e.jsx(ke,{to:"/admin/tenants",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/tenants")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ks,{className:"w-4 h-4 text-indigo-400"}),"学校租户"]})}),e.jsx(ke,{to:"/admin/users",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/users")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(an,{className:"w-4 h-4 text-indigo-400"}),"用户中枢"]})}),e.jsx(ke,{to:"/admin/devices",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/devices")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_t,{className:"w-4 h-4 text-indigo-400"}),"设备集控"]})}),e.jsx(ke,{to:"/admin/fleet",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/fleet")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ri,{className:"w-4 h-4 text-indigo-400"}),"终端版本"]})}),e.jsx(ke,{to:"/admin/self-check-batches",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/self-check-batches")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cn,{className:"w-4 h-4 text-indigo-400"}),"批量自检"]})}),e.jsx(ke,{to:"/admin/broadcast",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/broadcast")?"bg-rose-600/20 text-rose-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Al,{className:"w-4 h-4 text-rose-400"}),"全校应急广播"]})}),e.jsx(ke,{to:"/admin/licenses",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/licenses")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ll,{className:"w-4 h-4 text-indigo-400"}),"授权流水"]})}),e.jsx(ke,{to:"/admin/history",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/history")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ec,{className:"w-4 h-4 text-indigo-400"}),"呼叫审计"]})}),e.jsx(ke,{to:"/admin/logs",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/admin/logs")?"bg-indigo-600/20 text-indigo-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ht,{className:"w-4 h-4 text-indigo-400"}),"安全审计"]})})]}),a.role==="SchoolAdmin"&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{to:"/school-admin",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/school-admin")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:"学校概览"}),e.jsx(ke,{to:"/school-admin/classes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/school-admin/classes")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tl,{className:"w-4 h-4 text-sky-400"}),"班级管理"]})}),e.jsx(ke,{to:"/school-admin/devices",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/school-admin/devices")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_t,{className:"w-4 h-4 text-sky-400"}),"教室终端与续期"]})}),e.jsx(ke,{to:"/school-admin/teachers",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/school-admin/teachers")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(an,{className:"w-4 h-4 text-sky-400"}),"教师账号"]})}),e.jsx(ke,{to:"/school-admin/codes",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/school-admin/codes")?"bg-sky-600/20 text-sky-400":"text-amber-400 font-semibold"}`,children:"本校激活码"}),e.jsx(ke,{to:"/school-admin/history",className:`block px-3 py-2 rounded-lg text-sm font-medium ${j("/school-admin/history")?"bg-sky-600/20 text-sky-400":"text-slate-300 hover:bg-slate-900"}`,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_c,{className:"w-4 h-4 text-sky-400"}),"回执历史"]})})]})]})]})})},yc=({allowedRoles:a,children:l})=>{const{user:i,isLoading:c}=Ol();return c?e.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户权限..."}):i?a.includes(i.role)?l?e.jsx(e.Fragment,{children:l}):e.jsx(H0,{}):i.role==="SuperAdmin"?e.jsx(Tl,{to:"/admin",replace:!0}):i.role==="SchoolAdmin"?e.jsx(Tl,{to:"/school-admin",replace:!0}):e.jsx(Tl,{to:"/teacher",replace:!0}):e.jsx(Tl,{to:"/login",replace:!0})},Dg=()=>{const[a]=jr(),[l,i]=x.useState(a.get("mode")==="register"?"register":"login"),[c,u]=x.useState("Personal"),[m,p]=x.useState(""),[b,f]=x.useState(""),[j,k]=x.useState(""),[T,C]=x.useState(""),[I,P]=x.useState(""),[q,v]=x.useState(null),[w,M]=x.useState(!1),[Y,z]=x.useState(null),[ae,le]=x.useState(!1),[O,pe]=x.useState(!1),[ne,ve]=x.useState(!1),[Q,R]=x.useState(!1),[W,te]=x.useState("ticket"),[Le,K]=x.useState(""),[Z,G]=x.useState(""),[re,se]=x.useState(""),[g,B]=x.useState(""),[ue,U]=x.useState(""),[ge,je]=x.useState(!1),[Ne,ye]=x.useState(null),[de,De]=x.useState(null),[et,ct]=x.useState(!1),Je=async he=>{if(he.preventDefault(),ye(null),!Le.trim()){ye("请输入管理员签发的重置工单凭证 (Ticket)");return}if(!g||g.length<8){ye("新密码长度不能少于 8 位");return}if(g!==ue){ye("两次输入的新密码不一致");return}je(!0);try{let Ge=Le.trim();Ge.includes("ticket=")?Ge=Ge.split("ticket=")[1].split("&")[0]:Ge.includes("token=")&&(Ge=Ge.split("token=")[1].split("&")[0]);const Nt=await J.resetPasswordByToken(Ge,g);Nt.success?(De({message:"密码重置成功!请使用新密码直接登录。"}),f(g)):ye(Nt.message||"重置失败,工单可能已过期或已被使用")}catch(Ge){ye(Ge.message||"重置密码失败,请核实工单有效性或联系管理员")}finally{je(!1)}},We=async he=>{if(he.preventDefault(),ye(null),!Z.trim()){ye("请输入您的登录账号");return}if(!re.trim()){ye("请输入 24 位安全恢复密钥 (Recovery Key)");return}if(!g||g.length<8){ye("新密码长度不能少于 8 位");return}if(g!==ue){ye("两次输入的新密码不一致");return}je(!0);try{const Ge=await J.resetPasswordByRecoveryKey(Z.trim(),re.trim(),g);Ge.success?(De({message:"密码重置成功!旧密钥已作废,系统已为您签发新的安全恢复密钥,请妥善保存。",newKey:Ge.newRecoveryKey}),p(Z.trim()),f(g)):ye(Ge.message||"重置失败,账号或恢复密钥不匹配")}catch(Ge){ye(Ge.message||"重置密码失败,请检查账号与恢复密钥")}finally{je(!1)}},{login:tt,registerAccount:At}=Ol(),Et=Rn(),Wt=async he=>{he&&he.preventDefault(),v(null),M(!0);try{const Ge=await tt(m.trim(),b);Et(Ge==="SuperAdmin"?"/admin":Ge==="SchoolAdmin"?"/school-admin":"/teacher")}catch(Ge){v(Ge.message||"登录失败,请检查账号密码")}finally{M(!1)}},pt=async he=>{he&&he.preventDefault(),v(null);const Ge=m.trim();if(!Ge){v("请填写登录账号(建议填常用手机号)");return}if(Ge.length<3){v("登录账号长度不能少于 3 位");return}if(!b||b.length<8){v("为了账户安全,密码长度不能少于 8 位");return}if(b!==j){v("两次输入的密码不一致,请核对");return}if(!T.trim()){v("请填写您的称谓或姓名(如:李老师)");return}if(c==="SchoolAdmin"&&!I.trim()){v("请填写您所在的学校或机构全称");return}M(!0);try{const Nt=await At({username:Ge,password:b,fullName:T.trim(),accountType:c,schoolName:c==="SchoolAdmin"?I.trim():void 0,spaceName:c==="Personal"?`${T.trim()}的教学空间`:void 0});z(Nt)}catch(Nt){v(Nt.message||"注册失败,请检查填写内容")}finally{M(!1)}},Tt=()=>{Y&&(Y.role==="SchoolAdmin"?Et("/school-admin"):Et("/teacher"))},nt=()=>{if(!Y)return;const he=`【ClassNotify 班级大屏通知系统 - 账户登录与安全凭据】 ====================================================== 登录后台网址:https://classnotify.paradise.eu.org 登录账号用户名:${m} 您的姓名称谓:${T} 账户身份类型:${c==="SchoolAdmin"?"学校/机构管理员":"个人教师/班主任"} 账号授权状态:已开启 7 天免费试用(绑定大屏请输入教室大屏待机界面上的 8 位数字配对码) 【重要安全恢复密钥 (Recovery Key)】 安全密钥:${Y.recoveryKey||"已安全存储"} * 作用:忘记密码时凭此密钥可直接自救重置,无需繁琐短信或找管理员。 * 注意:请将本文件妥善保存在您的个人电脑或 U 盘中,切勿泄露给他人。 ====================================================== 保存时间:${new Date().toLocaleString("zh-CN")} `,Ge=new Blob([he],{type:"text/plain;charset=utf-8"}),Nt=URL.createObjectURL(Ge),ft=document.createElement("a");ft.href=Nt,ft.download=`ClassNotify安全凭据_${m}.txt`,ft.click(),URL.revokeObjectURL(Nt)};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-slate-950 via-slate-900 to-indigo-950/40 relative overflow-hidden",children:[e.jsx("div",{className:"absolute w-96 h-96 bg-indigo-500/10 rounded-full blur-3xl -top-20 -left-20 pointer-events-none"}),e.jsx("div",{className:"absolute w-96 h-96 bg-violet-500/10 rounded-full blur-3xl -bottom-20 -right-20 pointer-events-none"}),e.jsx("div",{className:"w-full max-w-lg relative z-10",children:e.jsxs("div",{className:"glass-panel p-8 border-slate-800 shadow-2xl rounded-2xl bg-slate-900/80 backdrop-blur-xl",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center mx-auto mb-3.5 shadow-xl shadow-indigo-500/25",children:e.jsx(ll,{className:"w-8 h-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight text-white",children:"ClassNotify 控制台"}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"智慧教室通知与设备集控一体化系统"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5 p-1 bg-slate-950/80 rounded-xl border border-slate-800 mb-6",children:[e.jsx("button",{type:"button",onClick:()=>{i("login"),v(null)},className:`py-2.5 text-sm font-semibold rounded-lg transition-all ${l==="login"?"bg-indigo-600 text-white shadow-md shadow-indigo-600/30":"text-slate-400 hover:text-slate-200"}`,children:"账号登录"}),e.jsx("button",{type:"button",onClick:()=>{i("register"),v(null)},className:`py-2.5 text-sm font-semibold rounded-lg transition-all ${l==="register"?"bg-indigo-600 text-white shadow-md shadow-indigo-600/30":"text-slate-400 hover:text-slate-200"}`,children:"注册账号"})]}),q&&e.jsxs("div",{className:"mb-5 p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-sm flex items-center gap-2",children:[e.jsx(Qt,{className:"w-4 h-4 text-rose-400 flex-shrink-0"}),e.jsx("span",{children:q})]}),l==="login"?e.jsxs("form",{onSubmit:Wt,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1.5",children:"登录账号 / 手机号"}),e.jsxs("div",{className:"relative",children:[e.jsx(Bs,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),e.jsx("input",{type:"text",value:m,onChange:he=>p(he.target.value),placeholder:"请输入用户名或手机号",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-slate-300",children:"登录密码"}),e.jsx("button",{type:"button",onClick:()=>{R(!0),ye(null),De(null),B(""),U(""),m.trim()&&G(m.trim())},className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:"忘记密码?"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(sl,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),e.jsx("input",{type:"password",value:b,onChange:he=>f(he.target.value),placeholder:"请输入密码",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:w,className:"w-full py-2.5 px-4 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-sm transition-all duration-200 flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 disabled:opacity-50 disabled:cursor-not-allowed mt-2",children:w?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:"正在验证身份..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"登 录"}),e.jsx(vs,{className:"w-4 h-4"})]})}),e.jsx("div",{className:"text-center pt-2",children:e.jsx("button",{type:"button",onClick:()=>{i("register"),v(null)},className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:"还没有账号?点击免费注册"})})]}):e.jsxs("form",{onSubmit:pt,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-2",children:"选择注册身份"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>u("Personal"),className:`p-3 rounded-xl border text-left transition-all ${c==="Personal"?"bg-indigo-950/60 border-indigo-500 text-white shadow-md shadow-indigo-900/30":"bg-slate-950/40 border-slate-800 text-slate-400 hover:border-slate-700 hover:text-slate-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-indigo-300 mb-1",children:[e.jsx(Bs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"个人教师 / 班主任"}),e.jsx("span",{className:"text-[10px] px-1 py-0.2 rounded bg-indigo-500/20 text-indigo-300 border border-indigo-500/30",children:"推荐"})]}),e.jsx("div",{className:"text-[11px] text-slate-400 leading-snug",children:"免填学校,快速开辟教师工作台,管理班级大屏并发送通知"})]}),e.jsxs("button",{type:"button",onClick:()=>u("SchoolAdmin"),className:`p-3 rounded-xl border text-left transition-all ${c==="SchoolAdmin"?"bg-indigo-950/60 border-indigo-500 text-white shadow-md shadow-indigo-900/30":"bg-slate-950/40 border-slate-800 text-slate-400 hover:border-slate-700 hover:text-slate-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-indigo-300 mb-1",children:[e.jsx(Di,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"学校 / 机构管理员"})]}),e.jsx("div",{className:"text-[11px] text-slate-400 leading-snug",children:"统一管理全校班级、大屏一体机及任课教师团队"})]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-1.5",children:e.jsxs("label",{className:"text-xs font-semibold text-slate-300",children:["登录账号 ",e.jsx("span",{className:"text-indigo-400 font-normal",children:"(建议填手机号)"})]})}),e.jsxs("div",{className:"relative",children:[e.jsx(Bs,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-3.5"}),e.jsx("input",{type:"text",value:m,onChange:he=>p(he.target.value),placeholder:"建议填写常用手机号,方便记忆",className:"w-full pl-10 pr-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]}),e.jsxs("div",{className:"mt-1.5 p-2 rounded-lg bg-amber-500/10 border border-amber-500/25 text-amber-300/90 text-[11px] leading-relaxed flex items-start gap-1.5",children:[e.jsx(Qt,{className:"w-3.5 h-3.5 text-amber-400 flex-shrink-0 mt-0.5"}),e.jsxs("span",{children:[e.jsx("strong",{children:"请务必牢记您的登录账号!"}),"后续登录控制台及找回密码均以此账号作为唯一识别凭据。"]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1.5",children:"您的称谓 / 姓名"}),e.jsx("input",{type:"text",value:T,onChange:he=>C(he.target.value),placeholder:"如:张老师 / 李老师",className:"w-full px-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]}),c==="SchoolAdmin"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1.5",children:"学校或机构名称"}),e.jsx("input",{type:"text",value:I,onChange:he=>P(he.target.value),placeholder:"请输入学校全称(如:光明中学)",className:"w-full px-4 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1.5",children:"设置密码 (至少8位)"}),e.jsx("input",{type:"password",value:b,onChange:he=>f(he.target.value),placeholder:"至少8位密码",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0,minLength:8})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1.5",children:"确认密码"}),e.jsx("input",{type:"password",value:j,onChange:he=>k(he.target.value),placeholder:"再次输入密码",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500",required:!0,minLength:8})]})]}),e.jsx("button",{type:"submit",disabled:w,className:"w-full py-2.5 px-4 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-sm transition-all duration-200 flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 disabled:opacity-50 disabled:cursor-not-allowed mt-2",children:w?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:"正在创建账号..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"注册并进入工作台"}),e.jsx(vs,{className:"w-4 h-4"})]})}),e.jsx("div",{className:"text-center pt-2",children:e.jsx("button",{type:"button",onClick:()=>{i("login"),v(null)},className:"text-xs text-indigo-400 hover:text-indigo-300 transition-colors",children:"已有账号?直接登录"})})]})]})}),Y&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-md",children:e.jsxs("div",{className:"w-full max-w-md bg-slate-900 border border-slate-700 rounded-2xl p-6 shadow-2xl space-y-5 text-white",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-emerald-500/20 text-emerald-400 flex items-center justify-center mx-auto mb-3",children:e.jsx(ot,{className:"w-7 h-7"})}),e.jsx("h2",{className:"text-xl font-bold",children:"账号注册成功!"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"请妥善保存您的登录凭证与安全恢复密钥"})]}),e.jsxs("div",{className:"space-y-3 bg-slate-950/70 p-4 rounded-xl border border-slate-800 text-xs",children:[e.jsxs("div",{className:"flex justify-between items-center py-1 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"登录账号用户名:"}),e.jsx("span",{className:"font-mono font-bold text-white text-sm",children:m})]}),e.jsxs("div",{className:"py-2.5 px-3 rounded-lg bg-emerald-500/10 border border-emerald-500/25 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-400 font-semibold text-xs",children:[e.jsx(ot,{className:"w-4 h-4"}),e.jsx("span",{children:"已开启 7 天免费试用"})]}),e.jsxs("p",{className:"text-[11px] text-slate-300 leading-relaxed",children:["进入教师工作台后,先下载 Windows 大屏端;安装启动后,输入大屏显示的 ",e.jsx("strong",{children:"8 位纯数字配对码"})," 即可完成班级大屏绑定。"]})]}),Y.recoveryKey&&e.jsxs("div",{className:"py-1",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsxs("span",{className:"text-slate-400 flex items-center gap-1",children:[e.jsx(_f,{className:"w-3 h-3 text-amber-400"}),"安全恢复密钥:"]}),e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(Y.recoveryKey),le(!0),setTimeout(()=>le(!1),2e3)},className:"text-indigo-400 hover:text-indigo-300 flex items-center gap-1",children:[e.jsx(us,{className:"w-3 h-3"}),e.jsx("span",{children:ae?"已复制":"复制"})]})]}),e.jsx("div",{className:"font-mono text-amber-300 bg-amber-950/30 p-2 rounded border border-amber-800/40 text-center text-xs tracking-wider break-all select-all",children:Y.recoveryKey}),e.jsx("p",{className:"text-[10px] text-amber-400/90 mt-1",children:"⚠️ 凭此密钥可离线自救重置密码。系统不保存明文,关闭后无法再次查看,请立即保存!"})]}),e.jsxs("div",{className:"flex justify-between items-center pt-1 border-t border-slate-800/80",children:[e.jsxs("span",{className:"text-slate-400 flex items-center gap-1",children:[e.jsx(Up,{className:"w-3 h-3 text-indigo-400"}),"控制台网址:"]}),e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText("https://classnotify.paradise.eu.org"),ve(!0),setTimeout(()=>ve(!1),2e3)},className:"text-indigo-400 hover:text-indigo-300 flex items-center gap-1 font-mono text-[11px]",children:[e.jsx("span",{children:"classnotify.paradise.eu.org"}),e.jsx(us,{className:"w-3 h-3"}),e.jsx("span",{children:ne?"已复制":"复制"})]})]})]}),e.jsxs("div",{className:"flex gap-2.5 pt-1",children:[e.jsxs("button",{type:"button",onClick:nt,className:"flex-1 py-2.5 px-3 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold flex items-center justify-center gap-1.5 transition-colors border border-slate-700",children:[e.jsx(ol,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"保存凭据到本地 (TXT)"})]}),e.jsxs("button",{type:"button",onClick:Tt,className:"flex-1 py-2.5 px-3 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-bold flex items-center justify-center gap-1.5 transition-colors shadow-lg shadow-indigo-600/30",children:[e.jsx("span",{children:"进入控制台工作台"}),e.jsx(vs,{className:"w-3.5 h-3.5"})]})]})]})}),Q&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm animate-fade-in",children:e.jsxs("div",{className:"w-full max-w-md bg-slate-900 border border-slate-800 rounded-2xl shadow-2xl overflow-hidden p-6 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400",children:e.jsx(rt,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-bold text-white",children:"找回与重置密码"}),e.jsx("p",{className:"text-xs text-slate-400",children:"选择您方便的密码重置自救途径"})]})]}),e.jsx("button",{type:"button",onClick:()=>R(!1),className:"text-slate-400 hover:text-white p-1 rounded-lg hover:bg-slate-800 transition-colors",children:e.jsx(Xt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"grid grid-cols-2 p-1 bg-slate-950/60 rounded-xl border border-slate-800/80 text-xs font-medium",children:[e.jsxs("button",{type:"button",onClick:()=>{te("ticket"),ye(null)},className:`py-2 px-3 rounded-lg flex items-center justify-center gap-1.5 transition-all ${W==="ticket"?"bg-indigo-600 text-white shadow-sm":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(Ei,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"管理员工单重置"})]}),e.jsxs("button",{type:"button",onClick:()=>{te("recoveryKey"),ye(null)},className:`py-2 px-3 rounded-lg flex items-center justify-center gap-1.5 transition-all ${W==="recoveryKey"?"bg-indigo-600 text-white shadow-sm":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(Ht,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"离线恢复密钥"})]})]}),Ne&&e.jsxs("div",{className:"p-3 bg-red-500/10 border border-red-500/20 rounded-xl text-red-400 text-xs flex items-start gap-2",children:[e.jsx(Qt,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsx("span",{children:Ne})]}),de?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 bg-emerald-500/10 border border-emerald-500/20 rounded-xl text-emerald-300 text-xs space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-sm text-emerald-400",children:[e.jsx(ot,{className:"w-5 h-5"}),e.jsx("span",{children:"重置操作成功"})]}),e.jsx("p",{children:de.message})]}),de.newKey&&e.jsxs("div",{className:"p-3.5 bg-amber-500/10 border border-amber-500/30 rounded-xl space-y-2 text-xs",children:[e.jsxs("div",{className:"flex justify-between items-center text-amber-300 font-semibold",children:[e.jsx("span",{children:"新安全恢复密钥 (请立即保存):"}),e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(de.newKey),ct(!0),setTimeout(()=>ct(!1),2e3)},className:"text-amber-400 hover:text-amber-200 flex items-center gap-1 font-normal",children:[e.jsx(us,{className:"w-3 h-3"}),e.jsx("span",{children:et?"已复制":"复制"})]})]}),e.jsx("div",{className:"font-mono text-amber-200 bg-black/40 p-2 rounded border border-amber-800/40 text-center tracking-wider select-all break-all",children:de.newKey}),e.jsx("p",{className:"text-[11px] text-amber-400/80 leading-relaxed",children:"原密钥已在本次重置中自动失效。请将此新密钥妥善离线保存!"})]}),e.jsxs("button",{type:"button",onClick:()=>{R(!1),De(null)},className:"w-full py-2.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-semibold text-xs transition-colors flex items-center justify-center gap-1.5 shadow-lg shadow-indigo-600/30",children:[e.jsx("span",{children:"返回登录界面"}),e.jsx(vs,{className:"w-4 h-4"})]})]}):W==="ticket"?e.jsxs("form",{onSubmit:Je,className:"space-y-3.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"重置工单凭证 (Ticket 或 完整链接)"}),e.jsx("input",{type:"text",value:Le,onChange:he=>K(he.target.value),placeholder:"输入管理员下发的 rst_... 或工单链接",className:"w-full px-3.5 py-2 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-500/50",required:!0}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:"如无工单,请联系超级管理员在后台为您签发 15 分钟临时重置工单。"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"新密码 (至少 8 位)"}),e.jsx("input",{type:"password",value:g,onChange:he=>B(he.target.value),placeholder:"设置新的安全密码",className:"w-full px-3.5 py-2 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-500/50",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"确认新密码"}),e.jsx("input",{type:"password",value:ue,onChange:he=>U(he.target.value),placeholder:"再次输入新密码核对",className:"w-full px-3.5 py-2 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-500/50",required:!0})]}),e.jsxs("div",{className:"flex gap-2.5 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>R(!1),className:"flex-1 py-2 px-3 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:ge,className:"flex-1 py-2 px-3 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold flex items-center justify-center gap-1.5 transition-colors shadow-lg shadow-indigo-600/30 disabled:opacity-50",children:ge?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在重置..."})]}):e.jsx("span",{children:"重置密码"})})]})]}):e.jsxs("form",{onSubmit:We,className:"space-y-3.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"登录用户名 / 手机号"}),e.jsx("input",{type:"text",value:Z,onChange:he=>G(he.target.value),placeholder:"输入需要重置密码的账号",className:"w-full px-3.5 py-2 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-500/50",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"24 位安全恢复密钥 (Recovery Key)"}),e.jsx("input",{type:"text",value:re,onChange:he=>se(he.target.value),placeholder:"格式形如 rec_xxxxxxxxxxxxxxx",className:"w-full px-3.5 py-2 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-indigo-500/50",required:!0}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:"注册账户时自动签发并要求保存的离线恢复密钥。"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"新密码 (至少 8 位)"}),e.jsx("input",{type:"password",value:g,onChange:he=>B(he.target.value),placeholder:"设置新的安全密码",className:"w-full px-3.5 py-2 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-500/50",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"确认新密码"}),e.jsx("input",{type:"password",value:ue,onChange:he=>U(he.target.value),placeholder:"再次输入新密码核对",className:"w-full px-3.5 py-2 rounded-xl bg-slate-950/60 border border-slate-700/80 text-white placeholder-slate-500 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-500/50",required:!0})]}),e.jsxs("div",{className:"flex gap-2.5 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>R(!1),className:"flex-1 py-2 px-3 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:ge,className:"flex-1 py-2 px-3 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold flex items-center justify-center gap-1.5 transition-colors shadow-lg shadow-indigo-600/30 disabled:opacity-50",children:ge?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在重置..."})]}):e.jsx("span",{children:"核验密钥并重置"})})]})]})]})})]})},Pg=()=>{const{user:a}=Ol();Rn();const l=()=>a?a.role==="SuperAdmin"?"/admin":a.role==="SchoolAdmin"?"/school-admin":"/teacher":"/login";return e.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col selection:bg-indigo-500 selection:text-white relative overflow-x-hidden",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-[1000px] h-[450px] bg-gradient-to-b from-indigo-600/10 via-cyan-600/5 to-transparent rounded-full blur-3xl pointer-events-none -z-10"}),e.jsx("div",{className:"absolute top-[600px] right-[-100px] w-[500px] h-[500px] bg-indigo-500/5 rounded-full blur-3xl pointer-events-none -z-10"}),e.jsx("header",{className:"sticky top-0 z-50 border-b border-slate-800/80 bg-slate-950/85 backdrop-blur-xl",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex items-center justify-between h-16",children:[e.jsxs(ke,{to:"/",className:"flex items-center space-x-2.5 group",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-tr from-indigo-600 to-violet-500 flex items-center justify-center shadow-lg shadow-indigo-500/20 group-hover:scale-105 transition-transform",children:e.jsx(ll,{className:"w-5 h-5 text-white"})}),e.jsx("span",{className:"font-bold text-lg tracking-tight bg-gradient-to-r from-white via-slate-200 to-slate-400 bg-clip-text text-transparent",children:"ClassNotify"})]}),e.jsx("div",{className:"flex items-center space-x-3",children:a&&e.jsxs(ke,{to:l(),className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs sm:text-sm font-semibold transition-all flex items-center gap-1.5 shadow-md shadow-indigo-600/25",children:[e.jsxs("span",{children:["返回",a.role==="SuperAdmin"?"管理后台":a.role==="SchoolAdmin"?"学校后台":"教师工作台"]}),e.jsx(vs,{className:"w-3.5 h-3.5"})]})})]})})}),e.jsxs("main",{className:"flex-1 flex flex-col",children:[e.jsxs("section",{className:"relative pt-16 sm:pt-24 pb-16 lg:pb-24 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto w-full text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-indigo-500/10 border border-indigo-500/20 text-indigo-400 text-xs font-medium mb-6",children:[e.jsx(cl,{className:"w-3.5 h-3.5 text-indigo-400"}),e.jsx("span",{children:"极简·即时·无感穿透"})]}),e.jsxs("h1",{className:"text-[22px] min-[390px]:text-2xl sm:text-5xl lg:text-6xl font-extrabold tracking-tight text-white max-w-4xl mx-auto leading-tight",children:[e.jsx("span",{className:"inline-block",children:"从办公室,"}),e.jsx("span",{className:"inline-block",children:"把通知直接送到班级大屏。"})]}),e.jsxs("p",{className:"mt-5 text-slate-400 text-sm sm:text-lg max-w-2xl mx-auto leading-relaxed",children:[e.jsx("span",{className:"inline-block",children:"网页一键发送,"}),e.jsx("span",{className:"inline-block",children:"教室大屏秒级弹出并支持语音播报。"}),e.jsx("br",{className:"hidden sm:inline"}),e.jsx("span",{className:"inline-block",children:"无需来回跑教室,"}),e.jsx("span",{className:"inline-block",children:"8 位数字码即可完成大屏连接。"})]}),e.jsx("div",{className:"mt-8 flex flex-col sm:flex-row items-center justify-center gap-3 sm:gap-4",children:a?e.jsxs(ke,{to:l(),className:"w-full sm:w-auto px-7 py-3.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-semibold transition-all flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 hover:shadow-indigo-600/40",children:[e.jsxs("span",{children:["进入",a.role==="SuperAdmin"?"管理后台":a.role==="SchoolAdmin"?"学校后台":"教师工作台"]}),e.jsx(vs,{className:"w-4 h-4"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ke,{to:"/login?mode=register",className:"w-full sm:w-auto px-7 py-3.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-semibold transition-all flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30 hover:shadow-indigo-600/40",children:[e.jsx("span",{children:"免费开始使用"}),e.jsx(vs,{className:"w-4 h-4"})]}),e.jsx(ke,{to:"/login",className:"w-full sm:w-auto px-6 py-3.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 hover:text-white border border-slate-800 text-sm font-medium transition-all flex items-center justify-center gap-1.5 shadow-sm",children:e.jsx("span",{children:"已有账号?直接登录"})})]})}),e.jsxs("p",{className:"mt-3.5 text-xs text-slate-400",children:[e.jsx("span",{className:"inline-block",children:"注册即可开启 7 天免费试用,登录后直接在班级大屏管理中下载客户端"}),e.jsx("span",{className:"inline-block",children:"· 支持 Windows 10 / 11"})]}),e.jsx("div",{className:"mt-14 max-w-5xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 items-stretch",children:[e.jsxs("div",{className:"bg-slate-900/90 border border-slate-800 rounded-2xl p-5 shadow-2xl text-left backdrop-blur-xl relative group flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800/80 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400"}),e.jsx("span",{className:"text-xs font-semibold text-white",children:"高一3班"}),e.jsx("span",{className:"text-[10px] text-slate-400",children:"大屏在线"})]}),e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-slate-800 text-slate-400",children:"教师网页端"})]}),e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"bg-slate-950/70 border border-slate-800/80 rounded-xl p-3 text-xs text-slate-200",children:[e.jsx("p",{className:"text-slate-500 text-[10px] mb-1",children:"通知内容预览"}),e.jsx("p",{className:"font-medium",children:"下午第一节改到实验楼 302 教室,请课代表提前组织排队。"})]})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-indigo-400 bg-indigo-500/10 px-2 py-1 rounded-md",children:[e.jsx(Uc,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"开启语音播报"})]}),e.jsxs("button",{type:"button",disabled:!0,className:"px-3.5 py-1.5 rounded-lg bg-indigo-600 text-white text-xs font-medium flex items-center gap-1 shadow-sm",children:[e.jsx(al,{className:"w-3 h-3"}),e.jsx("span",{children:"已发送"})]})]})]}),e.jsxs("div",{className:"bg-gradient-to-br from-slate-900/95 to-slate-950 border-2 border-indigo-500/30 rounded-2xl p-5 shadow-2xl text-left backdrop-blur-xl relative flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800/80 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-indigo-600/20 text-indigo-400 flex items-center justify-center",children:e.jsx(ll,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-white",children:"班级大屏广播通知"}),e.jsx("p",{className:"text-[10px] text-slate-400",children:"李老师 · 刚刚"})]})]}),e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 font-mono",children:"已弹窗置顶"})]}),e.jsx("div",{className:"bg-slate-900/80 border border-slate-800 rounded-xl p-3 mb-3",children:e.jsx("p",{className:"text-xs text-white leading-relaxed font-medium",children:"下午第一节改到实验楼 302 教室,请课代表提前组织排队。"})}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsx("span",{className:"text-[10px] text-slate-500",children:"黑板大屏右下角悬浮播报"}),e.jsx("div",{className:"px-3 py-1 rounded-lg bg-slate-800 text-slate-300 text-[11px] font-medium border border-slate-700",children:"我知道了 (5s)"})]})]})]})})]}),e.jsx("section",{className:"py-16 sm:py-20 bg-slate-900/40 border-y border-slate-800/80 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-5xl mx-auto text-center",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-white tracking-tight",children:"三步使用,快速开箱即用"}),e.jsxs("p",{className:"mt-2 text-slate-400 text-sm",children:[e.jsx("span",{className:"inline-block",children:"无需复杂的校园网部署,"}),e.jsx("span",{className:"inline-block",children:"教师与教室黑板电脑即刻连接"})]}),e.jsxs("div",{className:"mt-12 grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"bg-slate-950/80 border border-slate-800/80 rounded-2xl p-6 relative group hover:border-slate-700 transition-colors flex flex-col items-center text-center",children:[e.jsx("div",{className:"text-2xl font-black text-indigo-500/40 mb-3 font-mono",children:"01"}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:"下载安装大屏端"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed max-w-xs",children:"在教室大屏电脑下载安装包,双击运行即可,安装一次即可长期常驻。"})]}),e.jsxs("div",{className:"bg-slate-950/80 border border-slate-800/80 rounded-2xl p-6 relative group hover:border-slate-700 transition-colors flex flex-col items-center text-center",children:[e.jsx("div",{className:"text-2xl font-black text-indigo-500/40 mb-3 font-mono",children:"02"}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:"输入 8 位配对码"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed max-w-xs",children:"在大屏启动界面获取 8 位数字码,在教师网页端直接输入完成连接。"})]}),e.jsxs("div",{className:"bg-slate-950/80 border border-slate-800/80 rounded-2xl p-6 relative group hover:border-slate-700 transition-colors flex flex-col items-center text-center",children:[e.jsx("div",{className:"text-2xl font-black text-indigo-500/40 mb-3 font-mono",children:"03"}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:"网页发送通知"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed max-w-xs",children:"办公室任意电脑或手机浏览器打开工作台,大屏即时显示并语音播报。"})]})]})]})}),e.jsxs("section",{className:"py-16 sm:py-24 px-4 sm:px-6 lg:px-8 max-w-5xl mx-auto w-full",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-white tracking-tight",children:"专为教学场景打造的核心能力"}),e.jsx("p",{className:"mt-2 text-slate-400 text-sm",children:"克制、扎实、可靠,让每一条通知准确传达到位"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-slate-900/60 border border-slate-800/80 rounded-2xl p-6 hover:border-slate-700 transition-colors flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-blue-500/10 text-blue-400 flex items-center justify-center mb-3.5 shadow-inner",children:e.jsx(Al,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:"秒级通知"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed max-w-sm",children:"通知快速送达到教室大屏,支持弹窗置顶、TTS 语音播报与送达状态实时回执。"})]}),e.jsxs("div",{className:"bg-slate-900/60 border border-slate-800/80 rounded-2xl p-6 hover:border-slate-700 transition-colors flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-indigo-500/10 text-indigo-400 flex items-center justify-center mb-3.5 shadow-inner",children:e.jsx(_t,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:"8 位数字配对"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed max-w-sm",children:"不需要复杂配置,在教室大屏获取 8 位数字码即可轻松绑定,随用随连。"})]}),e.jsxs("div",{className:"bg-slate-900/60 border border-slate-800/80 rounded-2xl p-6 hover:border-slate-700 transition-colors flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-emerald-500/10 text-emerald-400 flex items-center justify-center mb-3.5 shadow-inner",children:e.jsx(an,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:"一台大屏,多位教师"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed max-w-sm",children:"同一班级大屏可同时绑定多位任课教师,新增教师不会顶掉原有绑定,协同更高效。"})]}),e.jsxs("div",{className:"bg-slate-900/60 border border-slate-800/80 rounded-2xl p-6 hover:border-slate-700 transition-colors flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-violet-500/10 text-violet-400 flex items-center justify-center mb-3.5 shadow-inner",children:e.jsx(xt,{className:"w-6 h-6"})}),e.jsx("h3",{className:"text-base font-semibold text-white mb-2",children:"安装一次,持续使用"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed max-w-sm",children:"覆盖升级保留设备身份、教师绑定与本机凭据,免去每次升级后重新配置的烦恼。"})]})]})]}),e.jsx("section",{className:"py-16 sm:py-20 bg-gradient-to-b from-transparent to-slate-900/60 border-t border-slate-800/80 px-4 sm:px-6 lg:px-8 text-center",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-white tracking-tight",children:"准备好让通知直接到达班级大屏了吗?"}),e.jsx("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3 sm:gap-4",children:a?e.jsxs(ke,{to:l(),className:"w-full sm:w-auto px-7 py-3 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-semibold transition-all flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30",children:[e.jsxs("span",{children:["进入",a.role==="SuperAdmin"?"管理后台":a.role==="SchoolAdmin"?"学校后台":"教师工作台"]}),e.jsx(vs,{className:"w-4 h-4"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ke,{to:"/login?mode=register",className:"w-full sm:w-auto px-7 py-3 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-semibold transition-all flex items-center justify-center gap-2 shadow-lg shadow-indigo-600/30",children:[e.jsx("span",{children:"免费开始使用"}),e.jsx(vs,{className:"w-4 h-4"})]}),e.jsx(ke,{to:"/login",className:"w-full sm:w-auto px-6 py-3 rounded-xl bg-slate-800 hover:bg-slate-750 text-slate-200 hover:text-white border border-slate-700 text-sm font-medium transition-all flex items-center justify-center gap-1.5 shadow-sm",children:e.jsx("span",{children:"已有账号?直接登录"})})]})}),e.jsxs("p",{className:"text-xs text-slate-400",children:[e.jsx("span",{className:"inline-block",children:"注册即开启 7 天免费试用,登录后直接在班级大屏管理中下载客户端"}),e.jsx("span",{className:"inline-block",children:"· 支持 Windows 10 / 11"})]})]})})]}),e.jsx("footer",{className:"border-t border-slate-800/80 bg-slate-950 py-8 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4 text-xs text-slate-500",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-indigo-600/20 text-indigo-400 flex items-center justify-center font-bold text-xs",children:e.jsx(ll,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"font-semibold text-slate-300",children:"ClassNotify"}),e.jsx("span",{children:"· 智慧教室通知与班级大屏集控一体化系统"})]}),e.jsxs("div",{className:"flex items-center space-x-6",children:[e.jsx(ke,{to:"/teacher",className:"hover:text-slate-300 transition-colors",children:"教师工作台"}),e.jsx("a",{href:"#steps",className:"hover:text-slate-300 transition-colors",children:"快速指引"}),e.jsx(ke,{to:"/login",className:"hover:text-slate-300 transition-colors",children:"登录"}),e.jsx(ke,{to:"/login?mode=register",className:"hover:text-slate-300 transition-colors",children:"免费注册"})]})]})})]})},it=({label:a,variant:l="slate",dot:i=!0,className:c=""})=>{const u={emerald:{bg:"bg-emerald-500/10",text:"text-emerald-400",border:"border-emerald-500/20",dotColor:"bg-emerald-400"},amber:{bg:"bg-amber-500/10",text:"text-amber-400",border:"border-amber-500/20",dotColor:"bg-amber-400"},rose:{bg:"bg-rose-500/10",text:"text-rose-400",border:"border-rose-500/20",dotColor:"bg-rose-400"},sky:{bg:"bg-sky-500/10",text:"text-sky-400",border:"border-sky-500/20",dotColor:"bg-sky-400"},slate:{bg:"bg-slate-800/60",text:"text-slate-400",border:"border-slate-700/50",dotColor:"bg-slate-400"},indigo:{bg:"bg-indigo-500/10",text:"text-indigo-400",border:"border-indigo-500/20",dotColor:"bg-indigo-400"}},m=u[l]||u.slate;return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium border ${m.bg} ${m.text} ${m.border} ${c}`,children:[i&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${m.dotColor}`}),a]})},$s=({title:a,description:l,badge:i,action:c,className:u=""})=>e.jsxs("div",{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-6 mb-6 border-b border-slate-800/80 ${u}`,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight text-slate-100",children:a}),i]}),l&&e.jsx("p",{className:"mt-1 text-sm text-slate-400",children:l})]}),c&&e.jsx("div",{className:"flex items-center gap-3",children:c})]}),ga=({tabs:a,activeId:l,onChange:i,className:c=""})=>e.jsx("div",{className:`flex items-center gap-1.5 p-1 bg-slate-900 border border-slate-800 rounded-xl overflow-x-auto ${c}`,children:a.map(u=>{const m=u.id===l;return e.jsxs("button",{type:"button",onClick:()=>i(u.id),className:`px-3 py-1.5 rounded-lg text-xs sm:text-sm font-medium transition-all whitespace-nowrap flex items-center gap-1.5 ${m?"bg-slate-800 text-white shadow-sm border border-slate-700/60":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/40"}`,children:[e.jsx("span",{children:u.label}),u.count!==void 0&&e.jsx("span",{className:`px-1.5 py-0.2 rounded-full text-[10px] font-semibold ${m?"bg-slate-700 text-slate-200":"bg-slate-800/80 text-slate-500"}`,children:u.count})]},u.id)})}),yr=({value:a,onChange:l,placeholder:i="搜索...",className:c=""})=>e.jsxs("div",{className:`relative flex items-center ${c}`,children:[e.jsx(vn,{className:"w-4 h-4 text-slate-500 absolute left-3 pointer-events-none"}),e.jsx("input",{type:"text",value:a,onChange:u=>l(u.target.value),placeholder:i,className:"w-full bg-slate-900 border border-slate-800 rounded-xl pl-9 pr-8 py-2 text-sm text-slate-100 placeholder-slate-500 focus:outline-none focus:border-indigo-500/50 focus:ring-1 focus:ring-indigo-500/30 transition-colors"}),a&&e.jsx("button",{type:"button",onClick:()=>l(""),className:"absolute right-2.5 p-1 rounded-md text-slate-500 hover:text-slate-300 hover:bg-slate-800 transition-colors",children:e.jsx(Xt,{className:"w-3.5 h-3.5"})})]}),Fc=({items:a,className:l="",trigger:i})=>{const[c,u]=x.useState(!1),m=x.useRef(null);return x.useEffect(()=>{const p=f=>{m.current&&!m.current.contains(f.target)&&u(!1)},b=f=>{f.key==="Escape"&&u(!1)};return c&&(document.addEventListener("mousedown",p),document.addEventListener("keydown",b)),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",b)}},[c]),e.jsxs("div",{className:`relative inline-block text-left ${l}`,ref:m,children:[i?e.jsx("div",{onClick:()=>u(!c),className:"cursor-pointer inline-flex",children:i}):e.jsx("button",{type:"button","aria-label":"更多操作","aria-expanded":c,"aria-haspopup":"true",onClick:()=>u(!c),className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors border border-transparent hover:border-slate-700/60",title:"更多操作",children:e.jsx(cf,{className:"w-4 h-4"})}),c&&e.jsx("div",{className:"absolute right-0 mt-1 w-48 rounded-xl bg-slate-900 border border-slate-800 shadow-2xl py-1 z-30 animate-in fade-in-50 zoom-in-95 duration-100",children:a.map((p,b)=>e.jsxs("button",{type:"button",disabled:p.disabled,onClick:()=>{u(!1),p.onClick()},className:`w-full text-left px-3.5 py-2 text-xs sm:text-sm font-medium flex items-center gap-2.5 transition-colors ${p.danger?"text-rose-400 hover:bg-rose-500/10":"text-slate-300 hover:text-white hover:bg-slate-800"} ${p.disabled?"opacity-40 cursor-not-allowed":""}`,children:[p.icon&&e.jsx("span",{className:"w-4 h-4",children:p.icon}),e.jsx("span",{children:p.label})]},b))})]})},X0=({text:a,label:l="复制",className:i=""})=>{const[c,u]=x.useState(!1),m=async p=>{p.stopPropagation();try{await navigator.clipboard.writeText(a),u(!0),setTimeout(()=>u(!1),1500)}catch{const b=document.createElement("textarea");b.value=a,document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b),u(!0),setTimeout(()=>u(!1),1500)}};return e.jsx("button",{type:"button","aria-label":c?"已复制":l,onClick:m,className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-medium transition-all ${c?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 font-semibold":"bg-slate-800 text-slate-300 hover:text-white hover:bg-slate-700/80 border border-slate-700/60"} ${i}`,children:c?e.jsxs(e.Fragment,{children:[e.jsx(is,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{children:"已复制"})]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:l})]})})},on=({title:a,value:l,subtitle:i,icon:c,badge:u,className:m=""})=>e.jsxs("div",{className:`p-5 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex flex-col justify-between ${m}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs sm:text-sm font-medium text-slate-400",children:a}),c&&e.jsx("div",{className:"p-2 rounded-xl bg-slate-800/80 text-slate-300",children:c})]}),e.jsxs("div",{className:"mt-3 flex items-baseline justify-between gap-2",children:[e.jsx("div",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-white",children:l}),u]}),i&&e.jsx("p",{className:"mt-1 text-xs text-slate-500",children:i})]}),Vt=({isOpen:a,onClose:l,title:i,children:c,maxWidth:u="max-w-md",preventClose:m=!1})=>(x.useEffect(()=>{const p=b=>{b.key==="Escape"&&!m&&l()};return a&&document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a,l,m]),a?e.jsx("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm animate-in fade-in duration-150",children:e.jsxs("div",{className:`w-full ${u} max-h-[90vh] flex flex-col bg-slate-900 border border-slate-800 rounded-2xl shadow-2xl overflow-hidden animate-in zoom-in-95 duration-150`,onClick:p=>p.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-slate-800/80 shrink-0",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold text-slate-100",children:i}),e.jsx("button",{type:"button","aria-label":"关闭",disabled:m,onClick:()=>{m||l()},className:`p-1 rounded-lg text-slate-400 transition-colors ${m?"opacity-30 cursor-not-allowed":"hover:text-white hover:bg-slate-800"}`,children:e.jsx(Xt,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"p-6 overflow-y-auto",children:c})]})}):null),Y0=({isOpen:a,onClose:l,onConfirm:i,title:c,description:u,targetName:m,confirmLabel:p="确认执行",loading:b=!1})=>a?e.jsx(Vt,{isOpen:a,onClose:l,title:c,maxWidth:"max-w-md",preventClose:b,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3 p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300",children:[e.jsx(Qt,{className:"w-5 h-5 text-rose-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-xs sm:text-sm leading-relaxed",children:[m&&e.jsxs("span",{className:"font-semibold text-rose-200",children:["【",m,"】"]}),u]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:l,disabled:b,className:"px-4 py-2 rounded-xl text-sm font-medium text-slate-300 hover:bg-slate-800 transition-colors",children:"取消"}),e.jsx("button",{type:"button",onClick:i,disabled:b,className:"px-4 py-2 rounded-xl text-sm font-semibold bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-600/20 transition-all disabled:opacity-50",children:b?"处理中...":p})]})]})}):null;function $g(a){switch(a){case"ADMIN_TRIAL_OVERRIDE_GRANTED":case"TRIAL_OVERRIDE_GRANTED":return{label:"特批试用放行",badgeClass:"bg-amber-500/10 text-amber-400 border-amber-500/20"};case"ADMIN_TRIAL_OVERRIDE_REVOKED":case"TRIAL_OVERRIDE_REVOKED":return{label:"撤销试用放行",badgeClass:"bg-rose-500/10 text-rose-400 border-rose-500/20"};case"UPDATE_DEVICE_DISPLAY_LABEL":case"DEVICE_UPDATE_DISPLAY_LABEL":return{label:"更新运维备注",badgeClass:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20"};case"DEVICE_RENEW_LICENSE":return{label:"单机授权续期",badgeClass:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"};case"DEVICE_BATCH_RENEW_LICENSE":return{label:"批量设备续期",badgeClass:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20"};case"DEVICE_COMMAND":return{label:"下发运维指令",badgeClass:"bg-blue-500/10 text-blue-400 border-blue-500/20"};case"DEVICE_SELF_CHECK":return{label:"设备即时体检",badgeClass:"bg-teal-500/10 text-teal-400 border-teal-500/20"};case"SELF_CHECK_BATCH_TRIGGER":return{label:"批量设备体检",badgeClass:"bg-teal-500/10 text-teal-400 border-teal-500/20"};case"DECOMMISSION_DEVICE":return{label:"设备清退下线",badgeClass:"bg-rose-500/10 text-rose-400 border-rose-500/20"};case"SET_USER_LOCK":return{label:"锁定/解锁账号",badgeClass:"bg-purple-500/10 text-purple-400 border-purple-500/20"};case"USER_PASSWORD_RESET":return{label:"重置用户密码",badgeClass:"bg-amber-500/10 text-amber-400 border-amber-500/20"};case"USER_CREATE":return{label:"创建用户账号",badgeClass:"bg-indigo-500/10 text-indigo-400 border-indigo-500/20"};case"TENANT_CREATE":return{label:"开通学校租户",badgeClass:"bg-blue-500/10 text-blue-400 border-blue-500/20"};case"TENANT_UPDATE":return{label:"更新租户信息",badgeClass:"bg-blue-500/10 text-blue-400 border-blue-500/20"};case"EMERGENCY_BROADCAST_TRIGGER":return{label:"全域应急广播",badgeClass:"bg-rose-500/10 text-rose-400 border-rose-500/20"};default:return{label:a,badgeClass:"bg-slate-800 text-slate-300 border-slate-700"}}}const Lg=()=>{var Q;const[a,l]=x.useState(null),[i,c]=x.useState([]),[u,m]=x.useState([]),[p,b]=x.useState(null),[f,j]=x.useState([]),[k,T]=x.useState(null),[C,I]=x.useState(0),[P,q]=x.useState(0),[v,w]=x.useState(!0),[M,Y]=x.useState(!1),[z,ae]=x.useState(null),le=async(R=!1)=>{var W,te,Le;R&&Y(!0),ae(null);try{const[K,Z,G,re,se,g,B,ue]=await Promise.all([J.getAdminMetrics(),J.getTenants().catch(()=>[]),J.getAdminNotifications(6).catch(()=>[]),((W=J.getSystemHealth)==null?void 0:W.call(J).catch(()=>null))??Promise.resolve(null),((te=J.getAuditLogs)==null?void 0:te.call(J,8).catch(()=>[]))??Promise.resolve([]),((Le=J.getFleetVersionSummary)==null?void 0:Le.call(J).catch(()=>null))??Promise.resolve(null),J.getAllDevices().catch(()=>[]),J.getTrialLedgers({onlyBlocked:!0,limit:50}).catch(()=>[])]);K&&l(K),Z&&c(Z),G&&m(G),re&&b(re),se&&j(se),g&&T(g);const U=Date.now(),ge=10080*60*1e3,je=B.filter(ye=>{if(ye.licenseStatus==="ExpiringSoon")return!0;if(!ye.licensedUntil)return!1;const de=new Date(ye.licensedUntil).getTime();return de>U&&de-U<=ge}).length;I(je);const Ne=ue.filter(ye=>(ye.blockedAttemptCount??0)>0||ye.lastBlockedAtUtc).length;q(Ne)}catch(K){console.error("Failed to load admin dashboard data",K),ae((K==null?void 0:K.message)||"加载仪表盘数据失败,请检查网络连接")}finally{w(!1),Y(!1)}};x.useEffect(()=>{le();const R=setInterval(()=>le(!1),15e3);return()=>clearInterval(R)},[]);const O=(a==null?void 0:a.totalDevices)??0,pe=(p==null?void 0:p.onlineDevices)??(a==null?void 0:a.onlineDevices)??0,ne=(a==null?void 0:a.offlineDevices)??Math.max(0,O-pe),ve=O>0?Math.round(pe/O*100):100;return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"全域云控超管总览",description:"实时掌握全网多校区教学终端连通率、异常事件与核心调度通道",action:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs("button",{onClick:()=>le(!0),disabled:M,className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-300 hover:text-white text-xs font-medium border border-slate-800 transition-colors disabled:opacity-50",title:"立即刷新数据",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${M?"animate-spin text-blue-400":""}`}),"刷新"]}),e.jsxs(ke,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400"}),"激活码发行"]}),e.jsxs(ke,{to:"/admin/broadcast",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 transition-all",children:[e.jsx(Al,{className:"w-4 h-4"}),"全域应急广播"]})]})}),z&&e.jsxs("div",{id:"dashboard-error-banner",className:"p-4 rounded-2xl bg-rose-500/10 border border-rose-500/20 text-rose-300 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0"}),e.jsx("span",{children:z})]}),e.jsx("button",{onClick:()=>{w(!0),le(!0)},className:"px-3 py-1 rounded-lg bg-rose-600 hover:bg-rose-500 text-white text-xs font-medium transition-colors",children:"立即重试"})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"p-5 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-medium text-slate-400",children:"大屏在线率"}),e.jsx("div",{className:"mt-2 text-2xl sm:text-3xl font-bold tracking-tight text-white",children:v?e.jsx("div",{className:"w-16 h-8 bg-slate-800 rounded animate-pulse"}):`${ve}%`}),e.jsx("div",{className:"text-[11px] text-slate-500 font-mono mt-0.5",children:v?e.jsx("div",{className:"w-20 h-3 bg-slate-800/80 rounded animate-pulse mt-1"}):`${pe} / ${O} 台在线`})]}),e.jsxs("div",{className:"relative w-14 h-14 flex items-center justify-center shrink-0",children:[e.jsxs("svg",{className:"w-full h-full transform -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("path",{className:"text-slate-800",strokeWidth:"3.5",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"}),e.jsx("path",{className:"text-emerald-400 transition-all duration-500",strokeDasharray:`${v?0:ve}, 100`,strokeWidth:"3.5",strokeLinecap:"round",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"})]}),e.jsx(cn,{className:"w-5 h-5 text-emerald-400 absolute"})]})]}),e.jsx(on,{title:"离线终端",value:v?e.jsx("div",{className:"w-12 h-8 bg-slate-800 rounded animate-pulse"}):ne,subtitle:ne>0?"建议督促校区排查网络":"全网终端运行畅通",icon:e.jsx(Qt,{className:`w-5 h-5 ${ne>0?"text-amber-400":"text-slate-400"}`}),badge:ne>0?e.jsx(it,{label:"待排查",variant:"amber"}):e.jsx(it,{label:"正常",variant:"emerald"})}),e.jsx(on,{title:"今日通知 / 点呼",value:v?e.jsx("div",{className:"w-12 h-8 bg-slate-800 rounded animate-pulse"}):(a==null?void 0:a.todayNotifications)??0,subtitle:"各校区教师工作台发送",icon:e.jsx(ll,{className:"w-5 h-5 text-blue-400"})}),e.jsx(on,{title:"入驻学校",value:v?e.jsx("div",{className:"w-12 h-8 bg-slate-800 rounded animate-pulse"}):(a==null?void 0:a.totalTenants)??i.length,subtitle:"独立多租户隔离",icon:e.jsx(ks,{className:"w-5 h-5 text-indigo-400"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 items-start",children:[e.jsxs("div",{className:"lg:col-span-7 space-y-6",children:[e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-white",children:"核心管控模块"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs(ke,{to:"/admin/tenants",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-blue-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-blue-500/10 text-blue-400",children:e.jsx(ks,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-blue-400",children:"学校租户"}),e.jsx("div",{className:"text-[11px] text-slate-400",children:"空间开通、参数与冻结"})]})]}),e.jsx(vs,{className:"w-4 h-4 text-slate-500 group-hover:text-blue-400 transition-transform group-hover:translate-x-1"})]}),e.jsxs(ke,{to:"/admin/devices",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-emerald-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-emerald-500/10 text-emerald-400",children:e.jsx(_t,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-emerald-400",children:"设备集控"}),e.jsx("div",{className:"text-[11px] text-slate-400",children:"自检、即时续期与维护"})]})]}),e.jsx(vs,{className:"w-4 h-4 text-slate-500 group-hover:text-emerald-400 transition-transform group-hover:translate-x-1"})]}),e.jsxs(ke,{to:"/admin/trial-security",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-amber-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-amber-500/10 text-amber-400",children:e.jsx(J0,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-amber-400",children:"试用防刷与风控"}),e.jsx("div",{className:"text-[11px] text-slate-400",children:"台账审计与人工特批放行"})]})]}),e.jsx(vs,{className:"w-4 h-4 text-slate-500 group-hover:text-amber-400 transition-transform group-hover:translate-x-1"})]}),e.jsxs(ke,{to:"/admin/licenses",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-teal-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-teal-500/10 text-teal-400",children:e.jsx(rt,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-teal-400",children:"授权发放流水"}),e.jsx("div",{className:"text-[11px] text-slate-400",children:"服务端正向聚合与全网对账"})]})]}),e.jsx(vs,{className:"w-4 h-4 text-slate-500 group-hover:text-teal-400 transition-transform group-hover:translate-x-1"})]}),e.jsxs(ke,{to:"/admin/fleet",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-indigo-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-indigo-500/10 text-indigo-400",children:e.jsx(Ri,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-indigo-400",children:"终端版本基线"}),e.jsx("div",{className:"text-[11px] text-slate-400",children:"版本策略与兼容性看板"})]})]}),e.jsx(vs,{className:"w-4 h-4 text-slate-500 group-hover:text-indigo-400 transition-transform group-hover:translate-x-1"})]}),e.jsxs(ke,{to:"/admin/broadcast",className:"p-4 rounded-xl bg-slate-950/80 border border-slate-800 hover:border-rose-500/40 hover:bg-slate-850 transition-all flex items-center justify-between group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 text-rose-400",children:e.jsx(Al,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs sm:text-sm font-semibold text-white group-hover:text-rose-400",children:"应急广播"}),e.jsx("div",{className:"text-[11px] text-slate-400",children:"全网最高优先极速强插"})]})]}),e.jsx(vs,{className:"w-4 h-4 text-slate-500 group-hover:text-rose-400 transition-transform group-hover:translate-x-1"})]})]})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[e.jsx(ks,{className:"w-4 h-4 text-indigo-400"}),"入驻租户简况"]}),e.jsx(ke,{to:"/admin/tenants",className:"text-xs text-blue-400 hover:underline",children:"管理全部租户"})]}),v?e.jsx("div",{className:"space-y-3 py-2",children:[1,2,3].map(R=>e.jsx("div",{className:"h-10 bg-slate-800/40 rounded-xl animate-pulse"},R))}):i.length===0?e.jsx("div",{className:"py-6 text-center text-xs text-slate-500",children:"暂无租户记录"}):e.jsx("div",{className:"divide-y divide-slate-800/60",children:i.slice(0,5).map(R=>e.jsxs("div",{className:"py-2.5 flex items-center justify-between text-xs",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-semibold text-slate-200 flex items-center gap-1.5",children:[e.jsx("span",{children:R.name}),R.tenantType==="Personal"&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-indigo-500/10 text-indigo-400 border border-indigo-500/20 font-normal",children:"个人"})]}),e.jsxs("div",{className:"text-[11px] font-mono text-slate-500",children:[R.id," · ",R.classroomCount," 班级"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-slate-400 text-xs font-mono",children:[R.deviceCount," 设备"]}),e.jsx(it,{label:R.isActive?"正常":"已冻结",variant:R.isActive?"emerald":"rose"})]})]},R.id))})]})]}),e.jsxs("div",{className:"lg:col-span-5 space-y-6",children:[e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[e.jsx(Qt,{className:"w-4 h-4 text-amber-400"}),"需要关注"]}),e.jsx("span",{className:"text-[11px] text-slate-500",children:"异常终端优先浮出"})]}),v?e.jsxs("div",{className:"space-y-2 py-2",children:[e.jsx("div",{className:"h-14 bg-slate-800/40 rounded-xl animate-pulse"}),e.jsx("div",{className:"h-14 bg-slate-800/40 rounded-xl animate-pulse"})]}):ne===0&&((k==null?void 0:k.unsupported)??0)===0&&((k==null?void 0:k.outdated)??0)===0&&C===0&&P===0?e.jsxs("div",{className:"py-6 text-center text-xs text-slate-400",children:[e.jsx(ot,{className:"w-6 h-6 text-emerald-400 mx-auto mb-1.5"}),e.jsx("span",{children:"全网各校区终端运行良好,无临期或拦截异常,版本全部合规"})]}):e.jsxs("div",{className:"space-y-2",children:[C>0&&e.jsxs("div",{className:"p-3 rounded-xl bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300",children:[e.jsxs("div",{className:"font-semibold flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 animate-pulse"}),C," 台大屏终端授权即将到期 (≤7天)"]}),e.jsx(ke,{to:"/admin/devices",className:"text-xs text-amber-400 hover:underline font-semibold",children:"前往续期 →"})]}),e.jsx("div",{className:"text-[11px] text-amber-400/80 mt-1",children:"可直接在设备列表点击 [续期] 按钮即时发放延长时长。"})]}),P>0&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/20 text-xs text-rose-300",children:[e.jsxs("div",{className:"font-semibold flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-rose-400"}),P," 个终端硬件曾触发试用防刷拦截"]}),e.jsx(ke,{to:"/admin/trial-security",className:"text-xs text-rose-400 hover:underline font-semibold",children:"风控审计 →"})]}),e.jsx("div",{className:"text-[11px] text-rose-400/80 mt-1",children:"多租户迁移或误判场景,超管可在此特批 72 小时 1 次性放行。"})]}),((k==null?void 0:k.unsupported)??0)>0&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/20 text-xs text-rose-300",children:[e.jsxs("div",{className:"font-semibold flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-rose-400 animate-pulse"}),k==null?void 0:k.unsupported," 台终端版本不受支持"]}),e.jsx(ke,{to:"/admin/fleet?status=Unsupported",className:"text-xs text-rose-400 hover:underline font-semibold",children:"查看 →"})]}),e.jsx("div",{className:"text-[11px] text-rose-400/80 mt-1",children:"低于最低运行版本基线,建议统筹升级规划。"})]}),((k==null?void 0:k.outdated)??0)>0&&e.jsxs("div",{className:"p-3 rounded-xl bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300",children:[e.jsxs("div",{className:"font-semibold flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400"}),k==null?void 0:k.outdated," 台终端版本落后"]}),e.jsx(ke,{to:"/admin/fleet?status=Outdated",className:"text-xs text-amber-400 hover:underline font-semibold",children:"查看 →"})]}),e.jsxs("div",{className:"text-[11px] text-amber-400/80 mt-1",children:["建议升级至推荐版本 ",((Q=k==null?void 0:k.policy)==null?void 0:Q.recommendedServiceVersion)||"2.5.0","。"]})]}),ne>0&&e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 text-xs text-slate-300",children:[e.jsxs("div",{className:"font-semibold flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-amber-400",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400"}),"检测到 ",ne," 台大屏终端离线"]}),e.jsx(ke,{to:"/admin/devices?status=offline",className:"text-xs text-blue-400 hover:underline font-semibold",children:"前往排查 →"})]}),e.jsx("div",{className:"text-[11px] text-slate-400 mt-1",children:"未接收到周期心跳包,可能由于关机或校内网络断开导致。"})]})]})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[e.jsx(Ht,{className:"w-4 h-4 text-emerald-400"}),"超管操作安全审计"]}),e.jsx(ke,{to:"/admin/logs",className:"text-xs text-blue-400 hover:underline",children:"完整日志"})]}),v?e.jsx("div",{className:"space-y-2 py-2",children:[1,2,3,4].map(R=>e.jsx("div",{className:"h-12 bg-slate-800/40 rounded-xl animate-pulse"},R))}):f.length===0?e.jsx("div",{className:"py-6 text-center text-xs text-slate-500",children:"暂无审计记录"}):e.jsx("div",{className:"space-y-2 text-xs",children:f.map(R=>{const W=$g(R.action);return e.jsxs("div",{className:"p-2.5 rounded-xl bg-slate-950 border border-slate-800/80 hover:border-slate-700/80 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-medium border ${W.badgeClass}`,children:W.label}),e.jsx("span",{className:"text-slate-500 font-mono",children:new Date(R.occurredAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}),e.jsxs("div",{className:"text-[11px] text-slate-400 mt-1.5 flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-300 font-medium",children:R.actorUsername||"系统"}),e.jsxs("span",{className:"text-slate-500 truncate max-w-[180px] font-mono text-[10px]",title:`${R.targetType}: ${R.targetId}`,children:[R.targetType,": ",R.targetId]})]}),R.details&&e.jsx("div",{className:"text-[10px] text-slate-500 mt-1 truncate",title:R.details,children:R.details})]},R.id)})})]})]})]})]})};function zc(a){if(!a||!a.trim()){const c="班级名称不可为空";return{valid:!1,message:c,error:c}}const l=a.trim();if(l.length>30){const c="班级名称长度不能超过 30 个字符";return{valid:!1,message:c,error:c}}let i=0;for(const c of l){const u=c.codePointAt(0)||0;if(c==="班"){if(i++,i>1){const m="班级名称中“班”字只能出现一次(推荐格式如:81班、82、810班)";return{valid:!1,message:m,error:m}}}else if(Ag(u)){const m="班级名称不允许包含除“班”以外的汉字(推荐格式如:81班、82、83、84、89、810班)";return{valid:!1,message:m,error:m}}}return{valid:!0}}function Ag(a){return a>=19968&&a<=40959||a>=13312&&a<=19903||a>=131072&&a<=173791||a>=173824&&a<=177983||a>=177984&&a<=178207||a>=178208&&a<=183983||a>=183984&&a<=191471||a>=196608&&a<=201551||a>=201552&&a<=205743||a>=191472&&a<=192095||a>=63744&&a<=64255||a>=194560&&a<=195103}const Mg=()=>{const a=Rn(),[l]=jr(),i=l.get("status")==="offline"?"offline":l.get("status")==="online"?"online":"all",[c,u]=x.useState([]),[m,p]=x.useState(!0),[b,f]=x.useState(""),[j,k]=x.useState(i),[T,C]=x.useState(null),[I,P]=x.useState([]),[q,v]=x.useState(!1),[w,M]=x.useState(null),[Y,z]=x.useState(""),[ae,le]=x.useState(""),[O,pe]=x.useState(""),[ne,ve]=x.useState(""),[Q,R]=x.useState(!1),[W,te]=x.useState(null),[Le,K]=x.useState(!1),[Z,G]=x.useState(null),[re,se]=x.useState("365"),[g,B]=x.useState(""),[ue,U]=x.useState(!1),ge=async A=>{if(A.preventDefault(),!!Z){U(!0);try{let ce,st,Ie;g.trim()?Ie=g.trim().toUpperCase():re==="7"?(ce=7,st="Trial"):re==="30"?(ce=30,st="Trial"):re==="365"?(ce=365,st="Academic"):re==="perpetual"&&(ce=null,st="Perpetual");const Dt=await J.renewAdminDeviceLicense(Z.deviceId,ce,st,Ie);C({deviceId:Z.deviceId,message:Dt.message||"授权更新成功",success:!0}),G(null),B(""),He()}catch(ce){alert(ce.message||"授权延期失败")}finally{U(!1)}}},[je,Ne]=x.useState(!1),ye=x.useRef(crypto.randomUUID()),[de,De]=x.useState("preset"),[et,ct]=x.useState(365),[Je,We]=x.useState(365),[tt,At]=x.useState(""),[Et,Wt]=x.useState("AcademicYear"),[pt,Tt]=x.useState("超级管理员批量直接续费"),[nt,he]=x.useState(!1),Ge=()=>{ye.current=crypto.randomUUID(),Ne(!0)},Nt=async A=>{if(A.preventDefault(),I.length!==0){he(!0);try{let ce,st,Ie="Timed";if(de==="perpetual")Ie="Perpetual";else if(de==="preset")ce=et;else if(de==="custom_days")ce=Je;else if(de==="valid_through"){if(!tt)throw new Error("请选择指定截止日期");st=tt}const Dt=await J.batchRenewAdminDevicesLicense({deviceIds:I,extendDays:ce,validThroughLocalDate:st,licenseKind:Ie,clientRequestId:ye.current,tier:de==="perpetual"?"Perpetual":Et,reason:pt.trim()||"超级管理员批量续费"});C({deviceId:`已选 ${I.length} 台`,message:`成功为 ${Dt.renewedCount} 台终端完成批量续期!${Dt.message}`,success:!0}),Ne(!1),P([]),He()}catch(ce){alert(ce.message||"批量续费失败")}finally{he(!1)}}},[ft,wt]=x.useState(null),[Pe,Xe]=x.useState(null),[ee,E]=x.useState(!1),[y,be]=x.useState(null),[Oe,Ue]=x.useState(!1),jt=async A=>{wt(A),Xe(null),be(null),E(!0);try{const ce=await J.getDeviceSupportBundles(A.deviceId,1);if(ce.length>0){const st=ce[0];(st.status==="PendingDispatch"||st.status==="Collecting"||st.status==="Available")&&Xe(st)}}catch(ce){console.warn("Failed to load bundle history",ce)}finally{E(!1)}},lt=async()=>{if(ft){E(!0),be(null);try{const A=`req_${Date.now()}_${Math.random().toString(36).substring(2,8)}`,ce=await J.createSupportBundle(ft.deviceId,A);Xe({supportBundleId:ce.supportBundleId,deviceId:ce.deviceId,tenantId:ft.tenantId,status:ce.status,createdAtUtc:ce.createdAtUtc,downloadAvailable:!1})}catch(A){be(A.message||"发起生成诊断包失败")}finally{E(!1)}}},zt=async()=>{if(Pe){Ue(!0);try{const A=`classnotify-support-${Pe.deviceId}.zip`;await J.downloadSupportBundle(Pe.supportBundleId,A)}catch(A){be(A.message||"下载诊断包失败")}finally{Ue(!1)}}};x.useEffect(()=>{if(!Pe||!ft||Pe.status!=="PendingDispatch"&&Pe.status!=="Collecting")return;const A=setInterval(async()=>{try{const ce=await J.getSupportBundle(Pe.supportBundleId);Xe(ce)}catch(ce){console.warn("Failed to poll bundle status",ce)}},2e3);return()=>clearInterval(A)},[Pe==null?void 0:Pe.status,Pe==null?void 0:Pe.supportBundleId,ft]);const Ye=A=>{switch(A){case"CollectionFailure":return"设备采集失败";case"BundleTooLarge":return"诊断包体积超过上限 (5 MiB)";case"InvalidZip":case"InvalidManifest":case"UnexpectedEntry":return"诊断包格式验证未通过";case"SupportBundleFileMissing":return"诊断包文件在存储中缺失";default:return"诊断包生成异常,请重试"}},Ss=A=>{if(!A)return"24 小时";const ce=new Date(A).getTime()-Date.now();if(ce<=0)return"已过期";const st=Math.floor(ce/(1e3*60*60)),Ie=Math.floor(ce%(1e3*60*60)/(1e3*60));return`${st}小时${Ie}分钟`},He=async()=>{try{const A=await J.getAllDevices();u(A)}catch(A){console.error("Failed to load devices",A)}finally{p(!1)}};x.useEffect(()=>{He();const A=setInterval(He,5e3);return()=>clearInterval(A)},[]);const It=async(A,ce,st)=>{C(null);try{if(ce==="self_check"){const Ie=await J.triggerDeviceSelfCheck(A);C({deviceId:A,message:Ie.message||(Ie.isOnline?`自检诊断已下发 (工单: ${Ie.selfCheckId}),等待终端上报`:`设备离线,自检工单 (${Ie.selfCheckId}) 已入队待发 (Pending)`),success:!0})}else{const Ie=await J.sendDeviceCommand(A,ce,st);C({deviceId:A,message:Ie.message||`指令已处理 (状态: ${Ie.status||"Success"})`,success:!0})}He()}catch(Ie){C({deviceId:A,message:Ie.message||"远程指令下发失败",success:!1})}},Rt=async A=>{if(I.length===0)return;if(v(!0),A==="self_check")try{const Dt=`req_${Date.now()}_${Math.random().toString(36).substring(2,8)}`,Gs=await J.createSelfCheckBatch(Dt,I);P([]),v(!1),a(`/admin/self-check-batches/${Gs.batchId}`);return}catch(Dt){C({deviceId:`已选 ${I.length} 台`,message:Dt.message||"发起批量自检失败",success:!1}),v(!1);return}let ce=0,st=0;for(const Dt of I)try{await J.sendDeviceCommand(Dt,A),ce++}catch{st++}const Ie="批量刷新配置";C({deviceId:`已选 ${I.length} 台`,message:st>0?`${Ie}执行完成 (部分成功): 成功 ${ce} 台,失败 ${st} 台`:`${Ie}指令已成功下发至全部 ${ce} 台大屏终端`,success:ce>0}),P([]),v(!1),He()},Js=A=>{P(ce=>ce.includes(A)?ce.filter(st=>st!==A):[...ce,A])},Dn=A=>{I.length===A.length?P([]):P(A.map(ce=>ce.deviceId))},$=A=>{M(A),z(A.hostname||""),le(A.classroomId||""),pe(A.classroomName||""),ve(A.displayLabel||"")},Me=async A=>{if(A.preventDefault(),!!w){R(!0);try{if(await J.updateDevice(w.deviceId,{hostname:Y.trim()||void 0,classroomId:ae.trim()||void 0}),ne.trim()!==(w.displayLabel||"")&&await J.updateDeviceDisplayLabel(w.deviceId,ne.trim()||null),O.trim()&&O.trim()!==w.classroomName){const ce=zc(O.trim());if(!ce.valid){C({deviceId:w.deviceId,message:ce.error||"班级名称格式不符合规范",success:!1}),R(!1);return}await J.updateAdminDeviceClassName(w.deviceId,O.trim())}C({deviceId:w.deviceId,message:"设备班级与大屏备注更新成功",success:!0}),M(null),He()}catch(ce){C({deviceId:w.deviceId,message:ce.message||"更新设备失败",success:!1})}finally{R(!1)}}},Ke=async()=>{if(W){K(!0);try{await J.decommissionDevice(W.deviceId),C({deviceId:W.deviceId,message:"设备已成功清退并注销",success:!0}),te(null),He()}catch(A){C({deviceId:W.deviceId,message:A.message||"清退设备失败",success:!1})}finally{K(!1)}}},Be=A=>{if(!A)return"从无心跳";const ce=Math.floor((Date.now()-new Date(A).getTime())/1e3);return ce<10?"刚刚":ce<60?`${ce} 秒前`:ce<3600?`${Math.floor(ce/60)} 分钟前`:`${Math.floor(ce/3600)} 小时前`},gt=[{id:"all",label:"全部设备",count:c.length},{id:"online",label:"在线正常",count:c.filter(A=>A.isOnline).length},{id:"offline",label:"离线需关注",count:c.filter(A=>!A.isOnline).length}],kt=c.filter(A=>{if(j==="online"&&!A.isOnline||j==="offline"&&A.isOnline)return!1;if(b.trim()){const ce=b.toLowerCase(),st=A.tenantName.toLowerCase().includes(ce),Ie=A.classroomName.toLowerCase().includes(ce),Dt=A.deviceId.toLowerCase().includes(ce),Gs=A.hostname&&A.hostname.toLowerCase().includes(ce);if(!st&&!Ie&&!Dt&&!Gs)return!1}return!0});return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"全网设备集控中心",description:"实时监控教室终端健康心跳与服务状态,支持批量安全自检/刷新配置、单机秒级调控与安全清退",action:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{p(!0),He()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${m?"animate-spin":""}`}),"刷新"]}),e.jsxs(ke,{to:"/admin/self-check-batches",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[e.jsx(cn,{className:"w-3.5 h-3.5 text-indigo-400"}),"自检批次看板"]}),e.jsxs(ke,{to:"/admin/codes?openGenerate=true",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all",children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),"生成激活码"]})]})}),T&&e.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between text-xs transition-all ${T.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[T.success?e.jsx(ot,{className:"w-4 h-4 text-emerald-400 shrink-0"}):e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0"}),e.jsxs("span",{children:["[",T.deviceId,"] ",T.message]})]}),e.jsx("button",{onClick:()=>C(null),className:"text-xs opacity-70 hover:opacity-100 font-medium",children:"关闭"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx(ga,{tabs:gt,activeId:j,onChange:A=>{k(A),P([])}}),e.jsx("div",{className:"w-full sm:w-72",children:e.jsx(yr,{value:b,onChange:f,placeholder:"搜索学校、班级、设备编号..."})})]}),I.length>0&&e.jsxs("div",{className:"p-3 bg-blue-950/60 border border-blue-500/40 rounded-2xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 text-xs shadow-lg animate-in fade-in duration-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-blue-200",children:[e.jsx(ot,{className:"w-4 h-4 text-blue-400 shrink-0"}),e.jsxs("span",{children:["已勾选 ",e.jsx("strong",{children:I.length})," 台教室大屏终端"]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{type:"button",disabled:q,onClick:Ge,className:"px-3 py-1.5 rounded-xl bg-gradient-to-r from-sky-500 to-indigo-600 hover:from-sky-400 hover:to-indigo-500 text-white font-medium flex items-center gap-1.5 transition-colors disabled:opacity-50 shadow-sm shadow-sky-500/20",children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"批量续期授权"})]}),e.jsxs("button",{type:"button",disabled:q,onClick:()=>Rt("self_check"),className:"px-3 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-medium flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[e.jsx(cn,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"批量运行自检"})]}),e.jsxs("button",{type:"button",disabled:q,onClick:()=>Rt("refresh_config"),className:"px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 hover:text-white font-medium border border-slate-700 flex items-center gap-1.5 transition-colors disabled:opacity-50",children:[e.jsx(xt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"批量刷新配置"})]}),e.jsx("button",{type:"button",disabled:q,onClick:()=>P([]),className:"px-2.5 py-1.5 rounded-xl text-slate-400 hover:text-white transition-colors",children:"取消"})]})]}),e.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[e.jsx("thead",{className:"text-[11px] uppercase tracking-wider text-slate-400 bg-slate-950/60 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-3 w-10 text-center",children:e.jsx("input",{type:"checkbox",checked:kt.length>0&&I.length===kt.length,onChange:()=>Dn(kt),className:"rounded bg-slate-950 border-slate-700 text-blue-600 focus:ring-0 cursor-pointer",title:"全选当前列表"})}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"学校 / 班级"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"设备编号 / 主机名"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"运行状态"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"授权状态 / 有效期"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"心跳与 IP"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"版本"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:kt.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"text-center py-12 text-xs text-slate-500",children:m?"正在同步设备状态...":"暂无匹配的设备"})}):kt.map(A=>{const ce=I.includes(A.deviceId);return e.jsxs("tr",{className:`hover:bg-slate-800/25 transition-colors ${ce?"bg-blue-600/10":""}`,children:[e.jsx("td",{className:"py-3.5 px-3 text-center",children:e.jsx("input",{type:"checkbox",checked:ce,onChange:()=>Js(A.deviceId),className:"rounded bg-slate-950 border-slate-700 text-blue-600 focus:ring-0 cursor-pointer"})}),e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"font-semibold text-white",children:A.classroomName}),A.displayLabel&&e.jsxs("span",{className:"text-[10px] bg-slate-800 text-amber-300 px-1.5 py-0.5 rounded border border-slate-700 font-normal",children:["备注: ",A.displayLabel]}),e.jsx("button",{onClick:()=>$(A),title:"修改班级名称 / 大屏备注",className:"p-1 rounded hover:bg-slate-800 text-slate-400 hover:text-blue-400 transition-colors",children:e.jsx(rl,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"text-xs text-slate-400 mt-0.5 flex items-center gap-1.5",children:[e.jsx("span",{children:A.tenantName}),A.tenantType&&e.jsx("span",{className:`text-[9px] px-1 rounded border ${A.tenantType==="Personal"?"bg-teal-950/60 text-teal-400 border-teal-800/40":"bg-slate-800 text-slate-400 border-slate-700"}`,children:A.tenantType==="Personal"?"个人":"学校"})]})]}),e.jsxs("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-300",children:[e.jsx("div",{children:A.deviceId}),e.jsxs("div",{className:"text-[11px] text-slate-500 font-sans mt-0.5 flex items-center gap-1",children:[e.jsx(_t,{className:"w-3 h-3 text-slate-500"}),e.jsx("span",{children:A.hostname||"Classroom-PC"})]})]}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsx(it,{label:A.isOnline?"在线":"离线",variant:A.isOnline?"emerald":"slate"})}),e.jsx("td",{className:"py-3.5 px-4",children:A.licenseStatus==="Perpetual"?e.jsx("div",{children:e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-purple-500/10 text-purple-400 border border-purple-500/20",children:[e.jsx(Ht,{className:"w-3.5 h-3.5"}),"永久商业版"]})}):A.licenseStatus==="Expired"?e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20",children:[e.jsx(Zt,{className:"w-3.5 h-3.5"}),"已到期 (普通呼叫暂停)"]}),e.jsxs("div",{className:"text-[11px] text-slate-500 mt-0.5",children:["到期日: ",A.licensedUntil?new Date(A.licensedUntil).toLocaleDateString():"-"]})]}):A.licenseStatus==="ExpiringSoon"?e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20",children:[e.jsx(os,{className:"w-3.5 h-3.5"}),A.remainingDays===0?`今日到期 (余 ${A.remainingHours??1} 小时)`:`即将到期 (余 ${A.remainingDays} 天)`]}),e.jsxs("div",{className:"text-[11px] text-slate-500 mt-0.5",children:["至 ",A.licensedUntil?new Date(A.licensedUntil).toLocaleDateString():"-"]})]}):e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[e.jsx(ot,{className:"w-3.5 h-3.5"}),"正常 (余 ",A.remainingDays??"-"," 天)"]}),e.jsxs("div",{className:"text-[11px] text-slate-500 mt-0.5",children:[A.licenseTier==="Academic"?"学年版":"试用版"," · 至 ",A.licensedUntil?new Date(A.licensedUntil).toLocaleDateString():"-"]})]})}),e.jsxs("td",{className:"py-3.5 px-4 text-xs text-slate-300",children:[e.jsx("div",{children:Be(A.lastHeartbeat)}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5 font-mono",children:A.remoteIp||"127.0.0.1"})]}),e.jsx("td",{className:"py-3.5 px-4 text-xs",children:e.jsxs("span",{className:"px-2 py-0.5 rounded bg-slate-800 text-slate-300 font-mono text-[11px]",children:["v",A.clientVersion||"2.1.0"]})}),e.jsx("td",{className:"py-3.5 px-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>It(A.deviceId,"self_check"),disabled:!A.isOnline,title:A.isOnline?"触发设备即时自检诊断":"设备离线,上线后将自动同步",className:"px-2.5 py-1 rounded-lg bg-indigo-600/20 hover:bg-indigo-600/30 text-indigo-300 text-xs font-semibold border border-indigo-500/30 transition-colors flex items-center gap-1 disabled:opacity-40",children:[e.jsx(cn,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"自检"})]}),e.jsxs("button",{type:"button",onClick:()=>{G(A),B(""),se("365")},className:"px-2.5 py-1 rounded-lg bg-emerald-600/20 hover:bg-emerald-600/30 text-emerald-300 text-xs font-semibold border border-emerald-500/30 transition-colors flex items-center gap-1",title:"一键调出授权续期方案",children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"续期"})]}),e.jsx(Fc,{trigger:e.jsxs("button",{type:"button",className:"px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium border border-slate-700/80 transition-colors flex items-center gap-1",children:[e.jsx("span",{children:"维护"}),e.jsx("span",{className:"text-[10px] text-slate-400",children:"▾"})]}),items:[{label:"刷新配置",icon:e.jsx(xt,{className:"w-3.5 h-3.5 text-sky-400"}),onClick:()=>It(A.deviceId,"refresh_config")},{label:"重启客户端",icon:e.jsx(Zf,{className:"w-3.5 h-3.5 text-amber-400"}),onClick:()=>It(A.deviceId,"restart_client")},{label:"生成诊断包",icon:e.jsx(Ll,{className:"w-3.5 h-3.5 text-blue-400"}),onClick:()=>jt(A)},{label:"修改班级与大屏备注",icon:e.jsx(rl,{className:"w-3.5 h-3.5 text-slate-300"}),onClick:()=>$(A)},{label:"清退设备",icon:e.jsx(Pl,{className:"w-3.5 h-3.5 text-rose-400"}),onClick:()=>te(A),danger:!0}]})]})})]},A.deviceId)})})]})})}),w&&e.jsx(Vt,{isOpen:!0,onClose:()=>M(null),title:`编辑设备: ${w.deviceId}`,preventClose:Q,children:e.jsxs("form",{onSubmit:Me,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"计算机主机名 (Hostname)"}),e.jsx("input",{type:"text",value:Y,onChange:A=>z(A.target.value),placeholder:"例如:ROOM-801-PC",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"班级显示名称 (ClassName)"}),e.jsx("input",{type:"text",value:O,onChange:A=>pe(A.target.value),placeholder:"例如:81班、82、810班",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500"}),e.jsx("span",{className:"text-[11px] text-slate-400 mt-1 block",children:"* 格式规则:除汉字“班”外不可包含其他汉字(推荐如:81班、82、810班),修改后将即时广播同步至教室内大屏。"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"大屏单机运维备注 (DisplayLabel - 仅管理员后台可见)"}),e.jsx("input",{type:"text",value:ne,onChange:A=>ve(A.target.value),placeholder:"例如:南楼3层靠窗机、希沃交互大屏、巡检重点屏",maxLength:100,className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500"}),e.jsx("span",{className:"text-[11px] text-slate-500 mt-1 block",children:"* 区别于班级名称:大屏运维备注仅用于区分同班级多台终端或特定物理机位,不影响学生界面。"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"所属教室编号 (ClassroomId)"}),e.jsx("input",{type:"text",value:ae,onChange:A=>le(A.target.value),placeholder:"例如:class-801",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 font-mono"})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",disabled:Q,onClick:()=>M(null),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:Q,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all disabled:opacity-50",children:Q?"保存中...":"保存更改"})]})]})}),e.jsx(Y0,{isOpen:!!W,onClose:()=>te(null),onConfirm:Ke,title:"确认清退大屏设备",targetName:W?`${W.classroomName} (${W.deviceId})`:void 0,description:"清退后该大屏终端将注销授权,无法接收通知与指令,需重新生成激活码方可绑定。",confirmLabel:"确认注销清退",loading:Le}),ft&&e.jsx(Vt,{isOpen:!0,onClose:()=>{(Pe==null?void 0:Pe.status)!=="PendingDispatch"&&(Pe==null?void 0:Pe.status)!=="Collecting"?(wt(null),Xe(null)):wt(null)},title:`设备技术诊断包: ${ft.classroomName} (${ft.deviceId})`,children:e.jsxs("div",{className:"space-y-4 text-xs",children:[y&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300 flex items-center gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 shrink-0 text-rose-400"}),e.jsx("span",{children:y})]}),!Pe&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-slate-300",children:"即将向该终端下发诊断采集指令,收集系统关键指标用于排查故障。"}),e.jsxs("div",{className:"p-3 bg-slate-950/60 border border-slate-800 rounded-xl space-y-1.5 text-slate-300",children:[e.jsx("div",{className:"font-semibold text-slate-200 mb-1",children:"将收集:"}),e.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[e.jsx(ot,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"text-slate-300",children:"版本与运行状态"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[e.jsx(ot,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"text-slate-300",children:"最近一次自检结果"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[e.jsx(ot,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"text-slate-300",children:"网络 / SignalR / IPC / WPF / TTS 状态"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[e.jsx(ot,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"text-slate-300",children:"安全诊断事件"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",disabled:ee,onClick:()=>wt(null),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"取消"}),e.jsxs("button",{type:"button",disabled:ee,onClick:lt,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all flex items-center gap-1.5 disabled:opacity-50",children:[ee?e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ll,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"生成诊断包"})]})]})]}),(Pe==null?void 0:Pe.status)==="PendingDispatch"&&e.jsxs("div",{className:"text-center py-8 space-y-3",children:[e.jsx(Ct,{className:"w-8 h-8 text-blue-400 animate-spin mx-auto"}),e.jsx("div",{className:"text-sm font-medium text-white",children:"正在请求设备…"}),e.jsx("div",{className:"text-slate-400 text-xs",children:"正在通过安全专线唤醒大屏终端,等待响应中"})]}),(Pe==null?void 0:Pe.status)==="Collecting"&&e.jsxs("div",{className:"text-center py-8 space-y-3",children:[e.jsx(Ct,{className:"w-8 h-8 text-indigo-400 animate-spin mx-auto"}),e.jsx("div",{className:"text-sm font-medium text-white",children:"正在生成诊断包…"}),e.jsx("div",{className:"text-slate-400 text-xs",children:"终端正在打包系统环境、运行快照与自检指标 (每 2 秒同步)"})]}),(Pe==null?void 0:Pe.status)==="Available"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-emerald-500/10 border border-emerald-500/20 text-emerald-300 flex items-start gap-2.5",children:[e.jsx(ot,{className:"w-5 h-5 text-emerald-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white",children:"诊断包已生成"}),e.jsx("div",{className:"text-xs text-emerald-400/80 mt-0.5",children:"安全校验与哈希完整性校验已全部通过"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 p-3 bg-slate-950/60 border border-slate-800 rounded-xl",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400 block text-[11px]",children:"文件体积"}),e.jsxs("span",{className:"text-white font-mono font-medium mt-0.5 block",children:[((Pe.sizeBytes||0)/1024).toFixed(1)," KB"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400 block text-[11px]",children:"剩余有效期"}),e.jsx("span",{className:"text-amber-400 font-medium mt-0.5 block",children:Ss(Pe.expiresAtUtc)})]}),Pe.sha256&&e.jsxs("div",{className:"col-span-2 pt-1 border-t border-slate-800/60",children:[e.jsx("span",{className:"text-slate-400 block text-[11px]",children:"SHA256 校验和"}),e.jsxs("span",{className:"text-slate-300 font-mono text-[11px] mt-0.5 block truncate",children:[Pe.sha256.substring(0,16),"..."]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>{wt(null),Xe(null)},className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"关闭"}),e.jsxs("button",{type:"button",disabled:Oe,onClick:zt,className:"px-4 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium shadow-md shadow-emerald-600/20 transition-all flex items-center gap-1.5 disabled:opacity-50",children:[Oe?e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(ol,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"下载诊断包"})]})]})]}),(Pe==null?void 0:Pe.status)==="Failed"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300 flex items-start gap-2.5",children:[e.jsx(Zt,{className:"w-5 h-5 text-rose-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white",children:"诊断包生成失败"}),e.jsxs("div",{className:"text-xs text-rose-400/80 mt-0.5",children:["原因:",Ye(Pe.errorCode)]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>{wt(null),Xe(null)},className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"关闭"}),e.jsxs("button",{type:"button",onClick:lt,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all flex items-center gap-1.5",children:[e.jsx(xt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"重新生成"})]})]})]}),(Pe==null?void 0:Pe.status)==="TimedOut"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-amber-500/10 border border-amber-500/20 text-amber-300 flex items-start gap-2.5",children:[e.jsx(os,{className:"w-5 h-5 text-amber-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white",children:"生成超时"}),e.jsx("div",{className:"text-xs text-amber-400/80 mt-0.5",children:"设备未能在规定时间内完成诊断包生成。"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>{wt(null),Xe(null)},className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"关闭"}),e.jsxs("button",{type:"button",onClick:lt,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all flex items-center gap-1.5",children:[e.jsx(xt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"重新生成"})]})]})]}),(Pe==null?void 0:Pe.status)==="Expired"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-800 border border-slate-700 text-slate-300 flex items-start gap-2.5",children:[e.jsx(os,{className:"w-5 h-5 text-slate-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-white",children:"诊断包已过期"}),e.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:"为了节省服务器空间,诊断文件已自动删除。"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>{wt(null),Xe(null)},className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"关闭"}),e.jsxs("button",{type:"button",onClick:lt,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all flex items-center gap-1.5",children:[e.jsx(xt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"重新生成"})]})]})]})]})}),Z&&e.jsx(Vt,{isOpen:!0,onClose:()=>G(null),title:`设备授权续期与管理 - ${Z.classroomName}`,children:e.jsxs("form",{onSubmit:ge,className:"space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 space-y-1 text-xs",children:[e.jsxs("div",{className:"text-slate-400",children:["设备编号: ",e.jsx("span",{className:"font-mono text-white",children:Z.deviceId})]}),e.jsxs("div",{className:"text-slate-400",children:["归属学校: ",e.jsx("span",{className:"text-white",children:Z.tenantName})]}),e.jsxs("div",{className:"text-slate-400",children:["当前授权状态: ",e.jsx("span",{className:"text-amber-400 font-semibold",children:Z.licenseStatus||"Unknown"}),Z.licensedUntil?` (至 ${new Date(Z.licensedUntil).toLocaleDateString()})`:""]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"快捷延期方案"}),e.jsxs("select",{value:re,onChange:A=>{se(A.target.value),B("")},disabled:!!g.trim(),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-xs focus:ring-2 focus:ring-blue-500 focus:outline-none disabled:opacity-50",children:[e.jsx("option",{value:"365",children:"延期 1 学年 (365天,累加顺延)"}),e.jsx("option",{value:"30",children:"延期 30 天体验"}),e.jsx("option",{value:"7",children:"延期 7 天紧急试用"}),e.jsx("option",{value:"perpetual",children:"升级为永久商业授权"})]})]}),e.jsxs("div",{className:"relative flex py-1 items-center",children:[e.jsx("div",{className:"flex-grow border-t border-slate-800"}),e.jsx("span",{className:"flex-shrink mx-3 text-[11px] text-slate-500",children:"或使用激活码续费"}),e.jsx("div",{className:"flex-grow border-t border-slate-800"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"输入新激活码"}),e.jsx("input",{type:"text",value:g,onChange:A=>B(A.target.value),placeholder:"例如: ABCD-1234-EFGH (可选)",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-700 text-white text-xs font-mono uppercase focus:ring-2 focus:ring-blue-500 focus:outline-none"}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"若输入激活码,将核销该码并按码内预设天数顺延到期日。"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>G(null),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"取消"}),e.jsxs("button",{type:"submit",disabled:ue,className:"px-4 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-semibold shadow-md shadow-emerald-600/20 disabled:opacity-50 transition-all flex items-center gap-1.5",children:[ue?e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ht,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:ue?"正在更新...":"确认续期"})]})]})]})}),je&&e.jsx(Vt,{isOpen:je,onClose:()=>Ne(!1),title:`批量续期授权 - 已选 ${I.length} 台终端`,children:e.jsxs("form",{onSubmit:Nt,className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-sky-500/10 border border-sky-500/20 text-xs text-sky-300 leading-relaxed",children:[e.jsxs("p",{className:"font-semibold mb-1 flex items-center gap-1.5",children:[e.jsx(Ht,{className:"w-4 h-4 text-sky-400"}),"超级管理员全平台设备批量直延"]}),"已选 ",e.jsx("strong",{children:I.length})," 台设备。续期将在现有到期日基础上顺延(无损累加),若已欠费则从当前时间顺延。"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-slate-400",children:"续期方案"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{De("preset"),ct(30)},className:`p-2.5 rounded-xl border text-center transition-all ${de==="preset"&&et===30?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold":"bg-slate-950 border-slate-800 text-slate-400"}`,children:[e.jsx("div",{className:"text-sm font-bold text-white",children:"30 天"}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"体验月卡"})]}),e.jsxs("button",{type:"button",onClick:()=>{De("preset"),ct(180)},className:`p-2.5 rounded-xl border text-center transition-all ${de==="preset"&&et===180?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold":"bg-slate-950 border-slate-800 text-slate-400"}`,children:[e.jsx("div",{className:"text-sm font-bold text-white",children:"180 天"}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"1 个学期"})]}),e.jsxs("button",{type:"button",onClick:()=>{De("preset"),ct(365)},className:`p-2.5 rounded-xl border text-center transition-all ${de==="preset"&&et===365?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold":"bg-slate-950 border-slate-800 text-slate-400"}`,children:[e.jsx("div",{className:"text-sm font-bold text-white",children:"365 天"}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"1 整学年"})]}),e.jsxs("button",{type:"button",onClick:()=>{De("preset"),ct(1095)},className:`p-2.5 rounded-xl border text-center transition-all relative ${de==="preset"&&et===1095?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold":"bg-slate-950 border-slate-800 text-slate-400"}`,children:[e.jsx("span",{className:"absolute -top-2 right-2 text-[10px] px-1.5 py-0.2 rounded-full bg-indigo-500 text-white font-bold",children:"三学年"}),e.jsx("div",{className:"text-sm font-bold text-white",children:"1095 天"}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"初/高中大卡"})]}),e.jsxs("button",{type:"button",onClick:()=>De("perpetual"),className:`p-2.5 rounded-xl border text-center transition-all relative ${de==="perpetual"?"bg-purple-600/25 border-purple-500 text-purple-300 font-semibold shadow-sm":"bg-slate-950 border-slate-800 text-slate-400"}`,children:[e.jsx("span",{className:"absolute -top-2 right-2 text-[10px] px-1.5 py-0.2 rounded-full bg-purple-500 text-white font-bold",children:"买断"}),e.jsx("div",{className:"text-sm font-bold text-white",children:"永久授权"}),e.jsx("div",{className:"text-[11px] text-slate-500",children:"终身有效"})]})]}),de==="perpetual"&&e.jsxs("div",{className:"p-3 rounded-xl bg-purple-950/40 border border-purple-800/60 flex items-center gap-3",children:[e.jsx(Ht,{className:"w-5 h-5 text-purple-400 shrink-0"}),e.jsxs("div",{className:"text-xs text-purple-200",children:[e.jsx("span",{className:"font-bold",children:"永久商业授权模式:"}),"所选终端将不受任何到期日限制,系统将设置其授权等级为 Perpetual,教室端永久开机可用。"]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:()=>De("custom_days"),className:`flex-1 py-1.5 px-3 rounded-xl border text-xs font-medium ${de==="custom_days"?"bg-sky-600/20 border-sky-500 text-sky-300":"bg-slate-950 border-slate-800 text-slate-400"}`,children:"自定义天数 (1~3650)"}),e.jsx("button",{type:"button",onClick:()=>De("valid_through"),className:`flex-1 py-1.5 px-3 rounded-xl border text-xs font-medium ${de==="valid_through"?"bg-sky-600/20 border-sky-500 text-sky-300":"bg-slate-950 border-slate-800 text-slate-400"}`,children:"指定截止日期"})]}),de==="custom_days"&&e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-slate-400",children:"有效天数:"}),e.jsx("input",{type:"number",min:1,max:3650,value:Je,onChange:A=>We(parseInt(A.target.value,10)||1),className:"w-24 px-2 py-1 rounded bg-slate-900 border border-slate-700 text-white text-xs font-mono text-center focus:border-sky-500"}),e.jsx("span",{className:"text-xs text-slate-500",children:"天"})]}),de==="valid_through"&&e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 flex items-center gap-3",children:[e.jsx(os,{className:"w-4 h-4 text-sky-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"截止至该日 23:59:59:"}),e.jsx("input",{type:"date",value:tt,onChange:A=>At(A.target.value),className:"px-2 py-1 rounded bg-slate-900 border border-slate-700 text-white text-xs font-mono focus:border-sky-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-400 mb-1",children:"续期审计备注"}),e.jsx("input",{type:"text",value:pt,onChange:A=>Tt(A.target.value),placeholder:"例如:全校学费收缴批量延期",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-slate-200 text-xs focus:border-sky-500"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>Ne(!1),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:nt,className:"px-5 py-2 rounded-xl bg-gradient-to-r from-sky-500 to-indigo-600 text-white text-xs font-semibold shadow-md shadow-sky-500/20 disabled:opacity-50 transition-all flex items-center gap-1.5",children:nt?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在批量续期..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["确认批量续期 (",I.length,"台)"]})]})})]})]})})]})},Og=()=>{const[a]=jr(),[l,i]=x.useState([]),[c,u]=x.useState([]),[m,p]=x.useState([]),[b,f]=x.useState(!0),[j,k]=x.useState(null),[T,C]=x.useState(""),[I,P]=x.useState(""),[q,v]=x.useState("all"),[w,M]=x.useState([]),[Y,z]=x.useState(!1),[ae,le]=x.useState(""),[O,pe]=x.useState(!1),[ne,ve]=x.useState(!1),[Q,R]=x.useState(""),[W,te]=x.useState([]),[Le,K]=x.useState(!1),[Z,G]=x.useState(""),[re,se]=x.useState(!1),[g,B]=x.useState(""),[ue,U]=x.useState("trial_7"),[ge,je]=x.useState(14),[Ne,ye]=x.useState(1),[de,De]=x.useState(""),[et,ct]=x.useState(!1),[Je,We]=x.useState(null),[tt,At]=x.useState(!1),[Et,Wt]=x.useState([]),pt=y=>{if(y&&y.length>0){Wt(y),At(!0);return}const be=w.length>0?l.filter(Ue=>w.includes(Ue.code)):l.filter(Ue=>!Ue.isUsed);if(be.length===0){alert("请先勾选需要打印交付卡片的激活码");return}const Oe=be.map(Ue=>{let jt=Ue.licenseTier==="Perpetual"?"永久商业授权":`${Ue.licenseDurationDays||365} 天商业授权`;return{code:Ue.code,schoolName:Ue.tenantName||"ClassNotify 合作学校",className:Ue.classroomName||Ue.classroomId||"班级终端",durationDesc:jt,notes:Ue.notes}});Wt(Oe),At(!0)},Tt=async()=>{try{const[y,be,Oe]=await Promise.all([J.getAdminActivationCodes(),J.getTenants(),J.getAllDevices()]);i(y),u(be),p(Oe),be.length>0&&!Q&&R(be[0].id)}catch(y){console.error("Failed to load activation codes & devices",y)}finally{f(!1)}};x.useEffect(()=>{Tt()},[]),x.useEffect(()=>{const y=a.get("tenantId"),be=a.get("openGenerate")==="true";y&&(P(y),R(y),be&&ve(!0))},[a]),x.useEffect(()=>{Q&&(K(!0),J.getAdminClasses(Q).then(y=>{te(y),y.length>0?(G(y[0].id),se(!1)):(G(""),se(!0))}).catch(y=>{console.warn("Could not load classes for tenant:",Q,y),te([]),se(!0)}).finally(()=>K(!1)))},[Q]);const nt=(y,be=y)=>{navigator.clipboard.writeText(y),k(be),setTimeout(()=>k(null),2e3)},he=x.useMemo(()=>{let y=0,be=0,Oe=0,Ue=0,jt=0,lt=0,zt=0;return m.forEach(Ye=>{Ye.licenseStatus==="TimeUntrusted"?zt++:Ye.licenseTier==="Perpetual"||Ye.licenseStatus==="Perpetual"?lt++:Ye.licenseStatus==="Expired"||Ye.remainingDays!==null&&Ye.remainingDays!==void 0&&Ye.remainingDays<=0?y++:Ye.remainingDays!==null&&Ye.remainingDays!==void 0?Ye.remainingDays<=7?be++:Ye.remainingDays<=30?Oe++:Ye.remainingDays<=90?Ue++:jt++:Ue++}),m.length,{expired:y,critical:be,warning:Oe,normal:Ue,plenty:jt,perpetual:lt,timeUntrusted:zt,total:m.length}},[m]),Ge=()=>{const y=He=>{if(He==null)return'""';let It=String(He).trim();return/^[=+\-@]/.test(It)&&(It="'"+It),`"${It.replace(/"/g,'""')}"`},be=w.length>0?l.filter(He=>w.includes(He.code)):Xe,Oe=["激活码","所属学校","学校ID","绑定班级","班级ID","授权类型","授权天数","使用状态","批次备注","兑换设备ID","截止兑换时间","实际兑换时间"],Ue=be.map(He=>[y(He.code),y(He.tenantName),y(He.tenantId),y(He.classroomName),y(He.classroomId),y(He.licenseTier==="Perpetual"?"永久授权":He.licenseTier==="Academic"?"学年授权":"试用授权"),y(He.licenseDurationDays?`${He.licenseDurationDays}天`:"永久有效"),y(He.isUsed?"已兑换使用":"待激活兑换"),y(He.notes||""),y(He.usedByDeviceId||""),y(He.expiresAt?new Date(He.expiresAt).toLocaleString():""),y(He.usedAt?new Date(He.usedAt).toLocaleString():"")]),jt="\uFEFF"+[Oe.map(He=>`"${He}"`).join(","),...Ue.map(He=>He.join(","))].join(`\r `),lt=new Blob([jt],{type:"text/csv;charset=utf-8;"}),zt=URL.createObjectURL(lt),Ye=document.createElement("a"),Ss=new Date().toISOString().slice(0,19).replace(/[-:T]/g,"");Ye.href=zt,Ye.setAttribute("download",`ClassNotify_激活码清单_${Ss}.csv`),document.body.appendChild(Ye),Ye.click(),document.body.removeChild(Ye),URL.revokeObjectURL(zt)},Nt=()=>{const y=Xe.filter(be=>!be.isUsed).map(be=>be.code);if(y.length===0){alert("当前列表暂无未兑换的激活码");return}nt(y.join(` `),"all_unredeemed")},ft=async y=>{if(y.preventDefault(),w.length!==0){pe(!0);try{const be=await J.batchTagAdminCodes(w,ae.trim());be.success?(i(Oe=>Oe.map(Ue=>w.includes(Ue.code)?{...Ue,notes:ae.trim()||void 0}:Ue)),z(!1),le(""),M([])):alert(be.message||"更新备注失败")}catch(be){alert((be==null?void 0:be.message)||"批量设置备注失败")}finally{pe(!1)}}},wt=async y=>{var lt,zt;y.preventDefault();const be=re?g.trim():Z.trim();if(!Q||!be){alert("请选择学校及目标班级");return}let Oe=7,Ue="Trial",jt="7 天免费试用";ue==="trial_7"?(Oe=7,Ue="Trial",jt="7 天免费试用"):ue==="trial_14"?(Oe=14,Ue="Trial",jt="14 天深度试用授权"):ue==="trial_30"?(Oe=30,Ue="Trial",jt="30 天体验授权"):ue==="semester_180"?(Oe=180,Ue="Academic",jt="180 天/半学年 商业授权"):ue==="academic_365"?(Oe=365,Ue="Academic",jt="1 学年/365天 商业授权"):ue==="perpetual"?(Oe=null,Ue="Perpetual",jt="永久有效商业授权"):ue==="custom"&&(Oe=ge,Ue=ge>=365?"Academic":"Custom",jt=`自定义 ${ge} 天商业授权`),ct(!0);try{const Ye=await J.generateAdminCode(Q,be,Oe,Ue,de.trim()||void 0,Ne),Ss=((lt=c.find(Rt=>Rt.id===Q))==null?void 0:lt.name)||Q,He=((zt=W.find(Rt=>Rt.id===be))==null?void 0:zt.displayName)||be,It=Ye.codes&&Ye.codes.length>0?Ye.codes:[Ye.code];We({codes:It,schoolName:Ss,className:He,durationDesc:jt,notes:de.trim()||void 0}),ve(!1),De(""),ye(1),await Tt()}catch(Ye){alert((Ye==null?void 0:Ye.message)||"生成激活码失败,请重试")}finally{ct(!1)}},Pe=async y=>{if(window.confirm(`确定要彻底废除激活码【${y}】吗?已绑定的设备不受影响,但该码将无法再次使用。`))try{await J.deleteActivationCode(y),i(be=>be.filter(Oe=>Oe.code!==y)),M(be=>be.filter(Oe=>Oe!==y))}catch{alert("作废失败,请刷新后再试")}},Xe=l.filter(y=>{const be=T.toLowerCase(),Oe=y.code.toLowerCase().includes(be)||y.classroomName.toLowerCase().includes(be)||y.tenantName.toLowerCase().includes(be)||y.usedByDeviceId&&y.usedByDeviceId.toLowerCase().includes(be)||y.notes&&y.notes.toLowerCase().includes(be),Ue=I?y.tenantId===I:!0;return Oe&&Ue}),ee=()=>{w.length===Xe.length?M([]):M(Xe.map(y=>y.code))},E=y=>{M(be=>be.includes(y)?be.filter(Oe=>Oe!==y):[...be,y])};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-400 flex items-center justify-center border border-amber-500/20",children:e.jsx(rt,{className:"w-4 h-4"})}),e.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网设备激活码大盘"})]}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"集中管理各校教室终端激活码与授权生命周期,支持批量生成、防注入 CSV 导出、批次标记与到期分布监控"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{onClick:()=>{f(!0),Tt()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${b?"animate-spin":""}`}),"刷新"]}),e.jsxs("button",{onClick:Ge,className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",title:"导出激活码清单 (CSV 格式,自动防护注入并支持 Excel)",children:[e.jsx(ol,{className:"w-3.5 h-3.5 text-sky-400"}),w.length>0?`导出选中 (${w.length})`:"导出全部 CSV"]}),e.jsxs("button",{onClick:Nt,className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",title:"一键复制当前列表所有未兑换的激活码",children:[e.jsx(us,{className:"w-3.5 h-3.5 text-emerald-400"}),j==="all_unredeemed"?"已复制未兑换码":"复制未兑换码"]}),e.jsxs("button",{onClick:()=>pt(),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",title:"打印交付班级卡片 (发给各校班主任或贴在大屏旁边)",children:[e.jsx(Il,{className:"w-3.5 h-3.5 text-amber-400"}),w.length>0?`打印卡片 (${w.length})`:"打印交付卡片"]}),e.jsxs("button",{onClick:()=>{We(null),ve(!0)},className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold transition-all shadow-lg shadow-amber-500/20 active:scale-95",children:[e.jsx(Fs,{className:"w-4 h-4"}),"生成新激活码"]})]})]}),e.jsxs("div",{className:"glass-panel p-5 border-slate-800 space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ul,{className:"w-4 h-4 text-indigo-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"全校设备授权到期分布梯级"}),e.jsxs("span",{className:"text-xs text-slate-400",children:["(共 ",he.total," 台终端)"]})]}),e.jsx("div",{className:"text-xs text-slate-400",children:"到期状态自设备在教室首次联网激活绑定日起算"})]}),e.jsxs("div",{className:"h-3 w-full bg-slate-900 rounded-full overflow-hidden flex border border-slate-800",children:[he.expired>0&&e.jsx("div",{style:{width:`${he.expired/he.total*100}%`},className:"bg-red-500 transition-all",title:`已过期: ${he.expired} 台`}),he.critical>0&&e.jsx("div",{style:{width:`${he.critical/he.total*100}%`},className:"bg-orange-500 transition-all",title:`7天内即将到期: ${he.critical} 台`}),he.warning>0&&e.jsx("div",{style:{width:`${he.warning/he.total*100}%`},className:"bg-amber-400 transition-all",title:`7~30天紧迫: ${he.warning} 台`}),he.normal>0&&e.jsx("div",{style:{width:`${he.normal/he.total*100}%`},className:"bg-blue-500 transition-all",title:`30~90天正常: ${he.normal} 台`}),he.plenty>0&&e.jsx("div",{style:{width:`${he.plenty/he.total*100}%`},className:"bg-emerald-500 transition-all",title:`> 90天充裕: ${he.plenty} 台`}),he.perpetual>0&&e.jsx("div",{style:{width:`${he.perpetual/he.total*100}%`},className:"bg-purple-500 transition-all",title:`永久授权: ${he.perpetual} 台`}),he.timeUntrusted>0&&e.jsx("div",{style:{width:`${he.timeUntrusted/he.total*100}%`},className:"bg-rose-600 transition-all",title:`时间不可信异常: ${he.timeUntrusted} 台`})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-2.5 pt-1",children:[e.jsxs("div",{className:"p-2.5 rounded-xl bg-red-950/20 border border-red-500/20",children:[e.jsx("div",{className:"text-[11px] text-red-400 font-medium",children:"已过期"}),e.jsxs("div",{className:"text-lg font-bold text-red-300 mt-0.5",children:[he.expired," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-orange-950/20 border border-orange-500/20",children:[e.jsx("div",{className:"text-[11px] text-orange-400 font-medium",children:"< 7天 (危急)"}),e.jsxs("div",{className:"text-lg font-bold text-orange-300 mt-0.5",children:[he.critical," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-amber-950/20 border border-amber-500/20",children:[e.jsx("div",{className:"text-[11px] text-amber-400 font-medium",children:"7~30天 (紧迫)"}),e.jsxs("div",{className:"text-lg font-bold text-amber-300 mt-0.5",children:[he.warning," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-blue-950/20 border border-blue-500/20",children:[e.jsx("div",{className:"text-[11px] text-blue-400 font-medium",children:"30~90天 (正常)"}),e.jsxs("div",{className:"text-lg font-bold text-blue-300 mt-0.5",children:[he.normal," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-emerald-950/20 border border-emerald-500/20",children:[e.jsx("div",{className:"text-[11px] text-emerald-400 font-medium",children:"> 90天 (充裕)"}),e.jsxs("div",{className:"text-lg font-bold text-emerald-300 mt-0.5",children:[he.plenty," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-purple-950/20 border border-purple-500/20",children:[e.jsx("div",{className:"text-[11px] text-purple-400 font-medium",children:"永久商业版"}),e.jsxs("div",{className:"text-lg font-bold text-purple-300 mt-0.5",children:[he.perpetual," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-rose-950/20 border border-rose-600/30",children:[e.jsx("div",{className:"text-[11px] text-rose-400 font-medium",children:"时钟不可信"}),e.jsxs("div",{className:"text-lg font-bold text-rose-300 mt-0.5",children:[he.timeUntrusted," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]})]})]}),Je&&e.jsxs("div",{className:"glass-panel p-5 border-emerald-500/40 bg-emerald-950/20 rounded-2xl flex flex-col justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/20 text-emerald-400 flex items-center justify-center shrink-0 border border-emerald-500/30",children:e.jsx(cl,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-semibold text-emerald-300",children:["成功生成 ",Je.codes.length," 个激活码!"]}),e.jsxs("div",{className:"text-xs text-slate-300 mt-0.5",children:["归属:",e.jsx("span",{className:"font-medium text-white",children:Je.schoolName})," / ",e.jsx("span",{className:"font-medium text-white",children:Je.className}),"(授权时长:",e.jsx("span",{className:"text-amber-400 font-semibold",children:Je.durationDesc}),Je.notes?`,备注:${Je.notes}`:"",")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>pt(Je.codes.map(y=>({code:y,schoolName:Je.schoolName,className:Je.className,durationDesc:Je.durationDesc,notes:Je.notes}))),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 border border-amber-500/40 text-xs font-semibold transition-colors shadow-sm cursor-pointer",children:[e.jsx(Il,{className:"w-3.5 h-3.5"}),"打印本次卡片"]}),e.jsx("button",{onClick:()=>nt(Je.codes.join(` `),"batch_copied"),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium transition-colors shadow-md",children:j==="batch_copied"?e.jsxs(e.Fragment,{children:[e.jsx(is,{className:"w-3.5 h-3.5"}),"已全部复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"w-3.5 h-3.5"}),"一键复制全部码"]})})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-2 border-t border-emerald-500/20 max-h-40 overflow-y-auto",children:Je.codes.map(y=>e.jsx("span",{onClick:()=>nt(y),className:"px-3 py-1.5 rounded-lg bg-slate-900 border border-emerald-500/40 font-mono text-sm font-bold text-emerald-400 tracking-wider cursor-pointer hover:bg-slate-800 transition-colors",title:"点击单独复制",children:y},y))})]}),e.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col md:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 w-full md:w-auto flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-slate-900/60 px-3 py-2 rounded-xl border border-slate-800 w-full md:w-72",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("input",{type:"text",value:T,onChange:y=>C(y.target.value),placeholder:"搜索激活码、班级、学校或备注...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ks,{className:"w-4 h-4 text-slate-400"}),e.jsxs("select",{value:I,onChange:y=>P(y.target.value),className:"px-3 py-2 rounded-xl bg-slate-900/60 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500",children:[e.jsxs("option",{value:"",children:["全部学校 (",c.length,")"]}),c.map(y=>e.jsxs("option",{value:y.id,children:[y.name," (",y.id,")"]},y.id))]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto justify-end",children:[w.length>0&&e.jsxs("div",{className:"flex items-center gap-2 animate-in fade-in",children:[e.jsxs("span",{className:"text-xs text-amber-400 font-medium",children:["已选 ",w.length," 项"]}),e.jsxs("button",{onClick:()=>{le(""),z(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium shadow",children:[e.jsx(mr,{className:"w-3.5 h-3.5"}),"设置批次备注"]})]}),e.jsxs("div",{className:"text-xs text-slate-400",children:["共 ",e.jsx("span",{className:"text-white font-medium",children:Xe.length})," 个激活码"]})]})]}),e.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-3 w-10 text-center",children:e.jsx("button",{onClick:ee,className:"text-slate-400 hover:text-white",children:w.length>0&&w.length===Xe.length?e.jsx(fr,{className:"w-4 h-4 text-indigo-400"}):e.jsx(gr,{className:"w-4 h-4"})})}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活码"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"绑定学校 / 班级"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"授权类型 / 时长"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"批次标记 / 备注"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"使用状态"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"激活设备"}),e.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/50",children:Xe.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"text-center py-12 text-slate-400",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[e.jsx(rt,{className:"w-8 h-8 text-slate-600"}),e.jsx("div",{className:"text-sm font-medium",children:b?"正在读取激活码...":"暂无匹配的激活码"}),e.jsx("div",{className:"text-xs text-slate-500",children:"点击右上角“生成新激活码”即可为任意学校教室批量开通绑定码"}),e.jsxs("button",{onClick:()=>ve(!0),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium",children:[e.jsx(Fs,{className:"w-3.5 h-3.5"}),"立即生成激活码"]})]})})}):Xe.map(y=>{const be=w.includes(y.code);return e.jsxs("tr",{className:`hover:bg-slate-800/25 transition-colors ${be?"bg-indigo-950/20":""}`,children:[e.jsx("td",{className:"py-4 px-3 text-center",children:e.jsx("button",{onClick:()=>E(y.code),className:"text-slate-400 hover:text-white",children:be?e.jsx(fr,{className:"w-4 h-4 text-indigo-400"}):e.jsx(gr,{className:"w-4 h-4"})})}),e.jsx("td",{className:"py-4 px-4 font-mono font-bold text-indigo-400 text-base",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:y.code}),e.jsx("button",{onClick:()=>nt(y.code),className:"p-1 rounded text-slate-500 hover:text-white transition-colors",title:"复制激活码",children:j===y.code?e.jsx(is,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx(us,{className:"w-3.5 h-3.5"})})]})}),e.jsxs("td",{className:"py-4 px-4",children:[e.jsx("div",{className:"font-medium text-white",children:y.classroomName}),e.jsx("div",{className:"text-xs text-slate-400 mt-0.5",children:y.tenantName})]}),e.jsx("td",{className:"py-4 px-4",children:e.jsx("span",{className:`inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium border ${y.licenseTier==="Perpetual"?"bg-purple-500/10 text-purple-400 border-purple-500/20":y.licenseTier==="Academic"?"bg-blue-500/10 text-blue-400 border-blue-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:y.licenseDurationDays?`${y.licenseDurationDays} 天 (${y.licenseTier==="Trial"?"试用":"商业"})`:"永久授权"})}),e.jsx("td",{className:"py-4 px-4",children:y.notes?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-slate-800 border border-slate-700 text-xs text-slate-300",children:[e.jsx(mr,{className:"w-3 h-3 text-indigo-400"}),y.notes]}):e.jsx("span",{className:"text-xs text-slate-500",children:"-"})}),e.jsx("td",{className:"py-4 px-4",children:y.isUsed?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/20",children:[e.jsx(is,{className:"w-3 h-3"}),"已激活兑换"]}):e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/20",children:[e.jsx(os,{className:"w-3 h-3"}),"待绑定使用"]})}),e.jsx("td",{className:"py-4 px-4 text-xs",children:y.usedByDeviceId?e.jsxs("div",{children:[e.jsx("span",{className:"font-mono text-slate-300 font-medium",children:y.usedByDeviceId}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:y.usedAt?new Date(y.usedAt).toLocaleDateString():""})]}):e.jsx("span",{className:"text-slate-500",children:"尚未绑定"})}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsx("button",{onClick:()=>Pe(y.code),className:"p-1.5 rounded-lg text-slate-400 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"作废该激活码",children:e.jsx(Pl,{className:"w-4 h-4"})})})]},y.code)})})]})})}),Y&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm animate-in fade-in duration-200",children:e.jsxs("div",{className:"glass-panel w-full max-w-md max-h-[90vh] overflow-y-auto border-slate-700 p-6 rounded-2xl shadow-2xl",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-2 flex items-center gap-2",children:[e.jsx(mr,{className:"w-5 h-5 text-indigo-400"}),"批量设置激活码备注"]}),e.jsxs("p",{className:"text-xs text-slate-400 mb-4",children:["为选中的 ",e.jsx("strong",{className:"text-indigo-400",children:w.length})," 个激活码统一添加批次说明(如试点校合同编号、年级楼栋、电教员名称)。"]}),e.jsxs("form",{onSubmit:ft,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"批次备注内容"}),e.jsx("input",{type:"text",value:ae,onChange:y=>le(y.target.value),placeholder:"如:2026秋季初二试点、实验楼301等",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:outline-none"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>z(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),e.jsx("button",{type:"submit",disabled:O,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold disabled:opacity-50",children:O?"保存中...":"确认更新"})]})]})]})}),ne&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm animate-in fade-in duration-200",children:e.jsxs("div",{className:"glass-panel w-full max-w-lg max-h-[90vh] overflow-y-auto border-slate-700 p-6 rounded-2xl shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-slate-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(rt,{className:"w-5 h-5 text-amber-400"}),e.jsx("h3",{className:"text-lg font-bold text-white",children:"生成教室终端激活码"})]}),e.jsx("button",{onClick:()=>ve(!1),className:"text-slate-400 hover:text-white text-sm",children:"✕"})]}),e.jsxs("form",{onSubmit:wt,className:"space-y-4 mt-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"目标学校"}),e.jsx("select",{value:Q,onChange:y=>R(y.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:c.map(y=>e.jsxs("option",{value:y.id,children:[y.name," (",y.id,")"]},y.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300",children:"目标班级"}),W.length>0&&e.jsx("button",{type:"button",onClick:()=>se(!re),className:"text-[11px] text-amber-400 hover:text-amber-300",children:re?"选择已有班级":"手动输入新班级代码"})]}),re?e.jsx("input",{type:"text",value:g,onChange:y=>B(y.target.value),placeholder:"输入班级编号,如 cls_801",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0}):W.length>0?e.jsx("select",{value:Z,onChange:y=>G(y.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0,children:W.map(y=>e.jsxs("option",{value:y.id,children:[y.displayName," (",y.id,")"]},y.id))}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-xs text-amber-400/90 flex items-center gap-1.5",children:[e.jsx(Zt,{className:"w-3.5 h-3.5 shrink-0"}),"该校暂无预设班级,请手动输入班级代码:"]}),e.jsx("input",{type:"text",value:g,onChange:y=>B(y.target.value),placeholder:"如 cls_801 或 cls_new",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"授权期限与类型"}),e.jsxs("select",{value:ue,onChange:y=>U(y.target.value),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",children:[e.jsx("option",{value:"trial_7",children:"7 天免费试用 (首次激活后起算)"}),e.jsx("option",{value:"trial_14",children:"14 天深度试用 (首次激活后起算)"}),e.jsx("option",{value:"trial_30",children:"30 天体验授权 (首次激活后起算)"}),e.jsx("option",{value:"semester_180",children:"180 天/半学年 商业授权 (适合单学期)"}),e.jsx("option",{value:"academic_365",children:"1 学年/365天 商业授权 (适合全学年教学)"}),e.jsx("option",{value:"perpetual",children:"永久有效商业授权 (无到期限制)"}),e.jsx("option",{value:"custom",children:"自定义天数 (任意天数,1~3650天)"})]}),ue==="custom"&&e.jsxs("div",{className:"mt-2.5 p-3 rounded-xl bg-slate-900/80 border border-amber-500/40 animate-in fade-in-50",children:[e.jsx("label",{className:"block text-xs font-semibold text-amber-300 mb-1.5",children:"自定义授权天数 (1 ~ 3650 天)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",min:"1",max:"3650",value:ge,onChange:y=>je(Math.max(1,Math.min(3650,parseInt(y.target.value)||1))),className:"w-full px-3 py-2 rounded-lg bg-slate-950 border border-amber-500/50 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0}),e.jsx("span",{className:"text-xs text-slate-300 font-medium shrink-0",children:"天"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"生成数量 (1 ~ 50)"}),e.jsx("input",{type:"number",min:"1",max:"50",value:Ne,onChange:y=>ye(Math.max(1,Math.min(50,parseInt(y.target.value)||1))),className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"批次备注 (选填)"}),e.jsx("input",{type:"text",value:de,onChange:y=>De(y.target.value),placeholder:"如:初二电教机试点",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-amber-500 focus:outline-none"})]})]}),e.jsxs("div",{className:"p-3 bg-slate-900/60 rounded-xl border border-slate-800 text-xs text-slate-400 space-y-1",children:[e.jsx("div",{className:"text-slate-300 font-medium",children:"💡 使用说明:"}),e.jsx("div",{children:"1. 激活码生成后 30 天内需在教室终端完成激活绑定;"}),e.jsx("div",{children:"2. 在教室电脑上运行 ClassNotify 安装程序,输入此激活码即可完成班级与屏幕绑定,并开始计算设备授权期。"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>ve(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),e.jsx("button",{type:"submit",disabled:et,className:"px-4 py-2 rounded-xl bg-gradient-to-r from-amber-500 to-indigo-600 hover:from-amber-400 hover:to-indigo-500 text-white text-xs font-semibold disabled:opacity-50 transition-all shadow-md shadow-amber-500/20",children:et?"生成中...":Ne>1?`批量生成 (${Ne} 个)`:"立即生成激活码"})]})]})]})}),tt&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/80 backdrop-blur-sm animate-in fade-in duration-200",children:e.jsxs("div",{className:"relative w-full max-w-4xl bg-slate-900 border border-slate-800 rounded-3xl p-6 shadow-2xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-amber-500/20 text-amber-400 flex items-center justify-center border border-amber-500/30",children:e.jsx(Il,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-white",children:"全校班级大屏激活码交付卡片 (A4 打印/剪切交付)"}),e.jsxs("p",{className:"text-xs text-slate-400",children:["共 ",Et.length," 张班级交付卡片。可直接通过浏览器打印发给班主任或电教老师。"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>window.print(),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-amber-500 hover:bg-amber-400 text-slate-950 font-bold text-xs shadow-md shadow-amber-500/20 transition-all cursor-pointer",children:[e.jsx(Il,{className:"w-4 h-4"}),"立即调用打印机"]}),e.jsx("button",{type:"button",onClick:()=>At(!1),className:"px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"关闭"})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 max-h-[65vh] overflow-y-auto p-1 print:p-0 print:max-h-none print:overflow-visible",children:Et.map((y,be)=>e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-950 border-2 border-dashed border-slate-700 hover:border-amber-500/60 transition-colors relative space-y-3 print:border-black print:text-black print:bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800 pb-2 print:border-black",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400 print:text-black"}),e.jsx("span",{className:"font-bold text-sm text-white print:text-black",children:"ClassNotify 班级大屏激活交付卡"})]}),e.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded bg-slate-900 border border-slate-700 text-amber-300 font-medium print:bg-transparent print:border-black print:text-black",children:[y.schoolName," · ",y.className]})]}),e.jsxs("div",{className:"text-center py-2 bg-slate-900/80 rounded-xl border border-slate-800 print:bg-gray-100 print:border-black",children:[e.jsx("div",{className:"text-[10px] text-slate-400 uppercase tracking-wider print:text-gray-600",children:"8 位班级硬件绑定激活码"}),e.jsx("div",{className:"font-mono text-2xl font-black tracking-widest text-amber-400 mt-1 select-all print:text-black",children:y.code}),e.jsxs("div",{className:"text-[11px] text-slate-400 mt-1 print:text-gray-700",children:["有效期:",y.durationDesc]})]}),e.jsxs("div",{className:"text-[11px] text-slate-400 space-y-1 print:text-gray-800",children:[e.jsx("div",{className:"font-semibold text-slate-300 print:text-black",children:"3 步傻瓜激活操作:"}),e.jsx("div",{children:"1. 教室一体机开机,双击桌面的【ClassNotify】图标;"}),e.jsx("div",{children:"2. 在弹出的窗口输入上方 8 位激活码并点击【立即激活】;"}),e.jsx("div",{children:"3. 出现绿色对勾即绑定成功,平时完全静默无需管理。"}),y.notes&&e.jsxs("div",{className:"text-slate-500 pt-1 print:text-gray-600",children:["批次备注:",y.notes]})]}),e.jsxs("div",{className:"text-[10px] text-slate-600 text-center border-t border-slate-800/60 pt-1.5 flex items-center justify-between print:text-gray-500 print:border-gray-400",children:[e.jsx("span",{children:"✂️ 沿此虚线剪下交付班主任"}),e.jsx("span",{children:"技术支持:平台运维管理处"})]})]},be))})]})})]})},Ug=()=>{const[a,l]=x.useState([]),[i,c]=x.useState(!0),[u,m]=x.useState(""),p=async()=>{try{const f=await J.getAdminNotifications(100);l(f)}catch(f){console.error("Failed to load notifications",f)}finally{c(!1)}};x.useEffect(()=>{p();const f=setInterval(p,8e3);return()=>clearInterval(f)},[]);const b=a.filter(f=>f.className.toLowerCase().includes(u.toLowerCase())||f.senderName.toLowerCase().includes(u.toLowerCase())||f.message.toLowerCase().includes(u.toLowerCase())||f.id.toLowerCase().includes(u.toLowerCase()));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"全网呼叫历史与回执审计"}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"追踪全网每条通知从下发、教室大屏接收、到学生点击确认的全流程时间戳与 ACK 回执"})]}),e.jsxs("button",{onClick:()=>{c(!0),p()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700 self-start sm:self-auto",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`}),"刷新审计"]})]}),e.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex items-center gap-3",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400"}),e.jsx("input",{type:"text",value:u,onChange:f=>m(f.target.value),placeholder:"搜索消息内容、班级或教师姓名...",className:"bg-transparent border-none text-sm text-white placeholder-slate-500 focus:outline-none w-full"})]}),e.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"目标班级"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"通知正文"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"发起老师"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"下发时间"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"回执状态 (ACK)"}),e.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"确认时间"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/50",children:b.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:i?"正在加载审计数据...":"暂无呼叫历史记录"})}):b.map(f=>e.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[e.jsxs("td",{className:"py-4 px-4",children:[e.jsx("div",{className:"font-semibold text-white",children:f.className}),e.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:f.classId})]}),e.jsxs("td",{className:"py-4 px-4 text-slate-200 max-w-md",children:[e.jsx("div",{className:"font-medium text-sm",children:f.message}),e.jsx("div",{className:"text-[11px] font-mono text-slate-500 mt-0.5",children:f.id})]}),e.jsx("td",{className:"py-4 px-4 text-slate-300 text-xs",children:f.senderName}),e.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(f.createdAt).toLocaleTimeString()}),e.jsxs("td",{className:"py-4 px-4",children:[f.status==="Acknowledged"&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:[e.jsx(ot,{className:"w-3.5 h-3.5"}),"学生已点击确认"]}),f.status==="Delivered"&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-sky-500/10 text-sky-400 border border-sky-500/30",children:[e.jsx(al,{className:"w-3.5 h-3.5"}),"已送达教室大屏"]}),f.status==="Sent"&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/30",children:[e.jsx(os,{className:"w-3.5 h-3.5"}),"云端下发中"]}),f.status==="Timeout"&&e.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:"超时自动关闭"})]}),e.jsx("td",{className:"py-4 px-4 text-right text-xs text-slate-400",children:f.confirmedAt?e.jsx("span",{className:"text-emerald-400 font-mono",children:new Date(f.confirmedAt).toLocaleTimeString()}):e.jsx("span",{className:"text-slate-600",children:"-"})})]},f.id))})]})})})]})},Fg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState(!0),[u,m]=x.useState(""),[p,b]=x.useState("all"),[f,j]=x.useState(null),[k,T]=x.useState(!1),[C,I]=x.useState({id:"",name:""}),[P,q]=x.useState(!1),[v,w]=x.useState(null),[M,Y]=x.useState({name:"",isActive:!0}),[z,ae]=x.useState(!1),le=async()=>{try{const Q=await J.getTenants();l(Q)}catch(Q){console.error("Failed to load tenants",Q)}finally{c(!1)}};x.useEffect(()=>{le()},[]);const O=async Q=>{if(Q.preventDefault(),!(!C.id.trim()||!C.name.trim())){q(!0);try{await J.createTenant({id:C.id.trim(),name:C.name.trim()}),j({text:`学校 [${C.name}] 创建成功!`,success:!0}),T(!1),I({id:"",name:""}),le()}catch(R){j({text:R.message||"创建学校失败",success:!1})}finally{q(!1)}}},pe=Q=>{w(Q),Y({name:Q.name,isActive:Q.isActive})},ne=async Q=>{if(Q.preventDefault(),!(!v||!M.name.trim())){ae(!0);try{await J.updateTenant(v.id,{name:M.name.trim(),isActive:M.isActive}),j({text:`学校 [${M.name}] 配置已更新`,success:!0}),w(null),le()}catch(R){j({text:R.message||"更新学校配置失败",success:!1})}finally{ae(!1)}}},ve=a.filter(Q=>{const R=Q.name.toLowerCase().includes(u.toLowerCase())||Q.id.toLowerCase().includes(u.toLowerCase()),W=Q.tenantType==="Personal";return R&&(p==="all"||p==="school"&&!W||p==="personal"&&W)});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white tracking-tight",children:"学校与组织租户管理"}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"统筹全网多校区实体学校与教师工作台租户,支持租户分类筛选、一键发行专属激活码与状态冻结"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{c(!0),le()},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium transition-colors border border-slate-700/60",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`}),"刷新"]}),e.jsxs("button",{onClick:()=>T(!0),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/20 transition-all",children:[e.jsx(Fs,{className:"w-4 h-4"}),"新建学校"]})]})]}),f&&e.jsxs("div",{className:`p-4 rounded-xl border flex items-center justify-between ${f.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.success?e.jsx(ot,{className:"w-5 h-5 text-emerald-400 shrink-0"}):e.jsx(Zt,{className:"w-5 h-5 text-rose-400 shrink-0"}),e.jsx("span",{children:f.text})]}),e.jsx("button",{onClick:()=>j(null),className:"text-xs opacity-70 hover:opacity-100",children:"关闭"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 p-1 bg-slate-950/60 border border-slate-800 rounded-xl",children:[e.jsxs("button",{type:"button",onClick:()=>b("all"),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${p==="all"?"bg-indigo-600 text-white shadow-sm":"text-slate-400 hover:text-slate-200"}`,children:["全部空间 (",a.length,")"]}),e.jsxs("button",{type:"button",onClick:()=>b("school"),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${p==="school"?"bg-indigo-600 text-white shadow-sm":"text-slate-400 hover:text-slate-200"}`,children:["学校租户 (",a.filter(Q=>Q.tenantType!=="Personal").length,")"]}),e.jsxs("button",{type:"button",onClick:()=>b("personal"),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${p==="personal"?"bg-teal-600 text-white shadow-sm":"text-slate-400 hover:text-teal-300"}`,children:["个人空间 (",a.filter(Q=>Q.tenantType==="Personal").length,")"]})]}),e.jsx("div",{className:"flex-1 max-w-sm",children:e.jsxs("div",{className:"flex items-center gap-2 bg-slate-950/60 border border-slate-800 rounded-xl px-3 py-2 text-xs",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("input",{type:"text",value:u,onChange:Q=>m(Q.target.value),placeholder:"按租户代码 (ID) 或名称搜索...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"}),u&&e.jsx("button",{type:"button",onClick:()=>m(""),className:"text-xs text-slate-400 hover:text-white",children:"清空"})]})})]}),e.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-900/60 border-b border-slate-800/80",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"学校名称 / 标识码"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"班级总数"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"终端大屏 (在线/总计)"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"服务状态"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"接入时间"}),e.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"管理操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/50",children:ve.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"text-center py-10 text-xs text-slate-500",children:i?"正在读取租户列表...":"暂无匹配的学校租户"})}):ve.map(Q=>e.jsxs("tr",{className:"hover:bg-slate-800/25 transition-colors",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400 font-bold shrink-0",children:e.jsx(ks,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-white",children:Q.name}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${Q.tenantType==="Personal"?"bg-teal-950/60 text-teal-400 border-teal-800/40":"bg-indigo-950/60 text-indigo-400 border-indigo-800/40"}`,children:Q.tenantType==="Personal"?"个人空间":"学校"})]}),e.jsx("div",{className:"text-xs text-slate-500 font-mono mt-0.5",children:Q.id})]})]})}),e.jsx("td",{className:"py-4 px-4 text-xs text-slate-300",children:e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-slate-800 border border-slate-700",children:[e.jsx(pr,{className:"w-3.5 h-3.5 text-indigo-400"}),e.jsxs("span",{children:[Q.classroomCount," 个班级"]})]})}),e.jsx("td",{className:"py-4 px-4 text-xs",children:e.jsxs("div",{className:"inline-flex items-center gap-2",children:[e.jsxs("span",{className:"font-semibold text-emerald-400",children:[Q.onlineCount," 在线"]}),e.jsx("span",{className:"text-slate-500",children:"/"}),e.jsxs("span",{className:"text-slate-400",children:[Q.deviceCount," 总屏"]})]})}),e.jsx("td",{className:"py-4 px-4",children:Q.isActive?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:[e.jsx(ot,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"正常运营"})]}):e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[e.jsx(ua,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"已停用冻结"})]})}),e.jsx("td",{className:"py-4 px-4 text-xs text-slate-400",children:new Date(Q.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsxs(ke,{to:`/admin/devices?search=${encodeURIComponent(Q.id)}`,className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"查看该空间的所有大屏设备",children:[e.jsx(_t,{className:"w-3.5 h-3.5 text-sky-400"}),e.jsx("span",{children:"设备"})]}),e.jsxs(ke,{to:`/admin/users?tenantId=${encodeURIComponent(Q.id)}`,className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"查看与管理该空间的账号",children:[e.jsx(an,{className:"w-3.5 h-3.5 text-indigo-400"}),e.jsx("span",{children:"账号"})]}),e.jsxs(ke,{to:`/admin/codes?tenantId=${encodeURIComponent(Q.id)}&openGenerate=true`,className:"px-2 py-1 rounded-lg bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-300 text-xs font-medium transition-colors inline-flex items-center gap-1",title:"为此空间开启预填激活码发行表单",children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"发行激活码"})]}),e.jsx("button",{onClick:()=>pe(Q),className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-400 hover:text-slate-200 text-xs transition-colors inline-flex items-center gap-1",title:"编辑空间配置",children:e.jsx(rl,{className:"w-3.5 h-3.5"})})]})})]},Q.id))})]})})}),k&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md max-h-[90vh] overflow-y-auto p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-bold text-white",children:"接入新学校租户"}),e.jsxs("form",{onSubmit:O,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校唯一标识代码 (Tenant ID)"}),e.jsx("input",{type:"text",required:!0,placeholder:"例如: t_beijing_no8 或 bj_highschool",value:C.id,onChange:Q=>I({...C,id:Q.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"}),e.jsx("p",{className:"text-[11px] text-slate-500 mt-1",children:"只能包含小写字母、数字和下划线,作为多租户隔离主键不可篡改"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称 (Display Name)"}),e.jsx("input",{type:"text",required:!0,placeholder:"例如: 北京市第四中学",value:C.name,onChange:Q=>I({...C,name:Q.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>T(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:P,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:P?"正在创建...":"确认接入"})]})]})]})}),v&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"glass-panel border-slate-700 bg-slate-900 w-full max-w-md max-h-[90vh] overflow-y-auto p-6 space-y-4",children:[e.jsxs("h2",{className:"text-lg font-bold text-white",children:["编辑学校配置: ",v.id]}),e.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"学校全称"}),e.jsx("input",{type:"text",required:!0,value:M.name,onChange:Q=>Y({...M,name:Q.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-800 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"运营状态"}),e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[e.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"isActive",checked:M.isActive===!0,onChange:()=>Y({...M,isActive:!0}),className:"text-indigo-600 focus:ring-indigo-500"}),e.jsx("span",{className:"text-sm text-emerald-400",children:"正常运营"})]}),e.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"isActive",checked:M.isActive===!1,onChange:()=>Y({...M,isActive:!1}),className:"text-indigo-600 focus:ring-indigo-500"}),e.jsx("span",{className:"text-sm text-rose-400",children:"停用冻结 (拒绝该校任何指令)"})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>w(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:z,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-lg shadow-indigo-500/25 transition-all disabled:opacity-50",children:z?"保存中...":"保存更改"})]})]})]})})]})},zg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState([]),[u,m]=x.useState(!0),[p,b]=x.useState(""),[f,j]=x.useState(""),[k,T]=x.useState(""),[C,I]=x.useState(""),[P,q]=x.useState(null),[v,w]=x.useState(null),[M,Y]=x.useState(null),[z,ae]=x.useState(null),[le,O]=x.useState({}),[pe,ne]=x.useState(!1),[ve,Q]=x.useState(null),[R,W]=x.useState(!1),[te,Le]=x.useState(null),[K,Z]=x.useState(""),[G,re]=x.useState(!1),[se,g]=x.useState(null),[B,ue]=x.useState(!1),[U,ge]=x.useState(null),[je,Ne]=x.useState(""),[ye,de]=x.useState(!1),[De,et]=x.useState(null),[ct,Je]=x.useState(!1),[We,tt]=x.useState({tenantId:"",username:"",password:"",fullName:"",role:"Teacher"}),[At,Et]=x.useState(!1),Wt=(E,y)=>{navigator.clipboard.writeText(E),w(y),setTimeout(()=>w(null),2e3)},pt=async(E=p)=>{try{const[y,be]=await Promise.all([J.getUsers(f||void 0,k||void 0,E||void 0),J.getTenants()]);l(y),c(be)}catch(y){console.error("Failed to load user management data",y),q({text:y.message||"加载用户数据失败",success:!1})}finally{m(!1)}};x.useEffect(()=>{pt()},[f,k]),x.useEffect(()=>{const E=setTimeout(()=>{pt(p)},300);return()=>clearInterval(E)},[p]);const Tt=x.useMemo(()=>{const E=p.trim().toLowerCase();return a.filter(y=>{var Oe,Ue,jt,lt,zt;return C==="active"&&y.isLocked||C==="locked"&&!y.isLocked?!1:E?((Oe=y.username)==null?void 0:Oe.toLowerCase().includes(E))||((Ue=y.fullName)==null?void 0:Ue.toLowerCase().includes(E))||((jt=y.id)==null?void 0:jt.toLowerCase().includes(E))||((lt=y.tenantName)==null?void 0:lt.toLowerCase().includes(E))||((zt=y.tenantId)==null?void 0:zt.toLowerCase().includes(E))||y.recoveryEmail&&y.recoveryEmail.toLowerCase().includes(E):!0})},[a,p,C]),nt=x.useMemo(()=>{const E=a.length,y=a.filter(lt=>!lt.isLocked).length,be=a.filter(lt=>lt.isLocked).length,Oe=a.filter(lt=>lt.role==="Teacher").length,Ue=a.filter(lt=>lt.role==="SchoolAdmin").length,jt=a.filter(lt=>lt.role==="TenantOwner"||lt.tenantType==="Personal").length;return{total:E,active:y,locked:be,teachers:Oe,schoolAdmins:Ue,personalOwners:jt}},[a]),he=async E=>{var y;if(E.preventDefault(),!We.tenantId||!We.username||!We.password||!We.fullName){q({text:"请填写所有必填字段",success:!1});return}Et(!0);try{await J.createUser(We),q({text:`用户 [${We.username}] 创建成功!`,success:!0}),Je(!1),tt({tenantId:((y=i[0])==null?void 0:y.id)||"",username:"",password:"",fullName:"",role:"Teacher"}),pt()}catch(be){q({text:be.message||"创建用户失败",success:!1})}finally{Et(!1)}},Ge=async E=>{if(E.preventDefault(),!!z){ne(!0);try{await J.updateUser(z.id,le),q({text:`用户 [${z.username}] 的信息已成功更新`,success:!0}),ae(null),pt()}catch(y){q({text:y.message||"更新用户信息失败",success:!1})}finally{ne(!1)}}},Nt=async E=>{ue(!0);try{const y=await J.issueUserResetTicket(E.id);y.success&&y.ticket?g({user:E,ticket:y.ticket,expiresAt:y.expiresAt}):q({text:y.message||"签发重置工单失败",success:!1})}catch(y){q({text:y.message||"签发重置工单异常",success:!1})}finally{ue(!1)}},ft=()=>{const E="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789!@#$%";let y="";for(let be=0;be<12;be++)y+=E.charAt(Math.floor(Math.random()*E.length));Ne(y)},wt=async E=>{if(E.preventDefault(),!!U){if(!je||je.length<8){q({text:"新密码长度至少需要 8 位",success:!1});return}de(!0);try{const y=await J.resetPassword(U.id,je);y.success?(et(je),q({text:`已成功为用户 [${U.username}] 直接重置新密码并吊销原有会话`,success:!0}),pt()):q({text:y.message||"重置密码失败",success:!1})}catch(y){q({text:y.message||"重置密码请求失败",success:!1})}finally{de(!1)}}},Pe=async()=>{if(!ve)return;const E=!ve.isLocked;W(!0);try{await J.setUserLock(ve.id,E),q({text:`用户 [${ve.username}] 已成功${E?"封禁锁定":"解除锁定"}`,success:!0}),Q(null),pt()}catch(y){q({text:y.message||"锁定操作失败",success:!1})}finally{W(!1)}},Xe=async()=>{if(te){if(te.role==="SuperAdmin"){q({text:"超级管理员账号受到核心保护,严禁删除",success:!1}),Le(null);return}re(!0);try{await J.deleteUser(te.id),q({text:`用户 [${te.username} (${te.fullName})] 已被彻底永久删除`,success:!0}),Le(null),Z(""),pt()}catch(E){q({text:E.message||"删除用户失败",success:!1})}finally{re(!1)}}},ee=E=>{switch(E){case"SuperAdmin":return e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-rose-500/10 border border-rose-500/30 text-rose-400",children:[e.jsx(fa,{className:"w-3 h-3"}),"超级管理员"]});case"SchoolAdmin":return e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-indigo-500/10 border border-indigo-500/30 text-indigo-400",children:[e.jsx(ks,{className:"w-3 h-3"}),"校区管理员"]});case"TenantOwner":return e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-teal-500/10 border border-teal-500/30 text-teal-400",children:[e.jsx(G0,{className:"w-3 h-3"}),"空间所有者"]});default:return e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 border border-slate-700 text-slate-300",children:[e.jsx(pr,{className:"w-3 h-3"}),"授课教师"]})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"用户中枢管控",description:"全网教职人员与机构管理员统一运维,支持多维快速搜索、画像穿透、密码强行重置、异常封禁与注销删除",action:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{m(!0),pt()},className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-300 hover:text-white text-xs font-medium border border-slate-800 transition-colors",title:"刷新全量用户列表",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${u?"animate-spin text-blue-400":""}`}),"刷新"]}),e.jsxs("button",{onClick:()=>{i.length>0&&!We.tenantId&&tt(E=>({...E,tenantId:i[0].id})),Je(!0)},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold shadow-md shadow-indigo-600/20 transition-all",children:[e.jsx(Fs,{className:"w-4 h-4"}),"开通新账号"]})]})}),P&&e.jsxs("div",{className:`p-4 rounded-2xl border flex items-center justify-between ${P.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[P.success?e.jsx(ot,{className:"w-4 h-4 text-emerald-400 shrink-0"}):e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0"}),e.jsx("span",{children:P.text})]}),e.jsx("button",{onClick:()=>q(null),className:"text-xs opacity-70 hover:opacity-100 p-1",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-medium text-slate-400",children:"总登记用户"}),e.jsx("div",{className:"mt-1 text-2xl font-bold tracking-tight text-white",children:nt.total}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:"跨校全网统一账号池"})]}),e.jsx("div",{className:"p-2.5 rounded-xl bg-indigo-500/10 text-indigo-400",children:e.jsx(an,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-medium text-slate-400",children:"正常在用"}),e.jsx("div",{className:"mt-1 text-2xl font-bold tracking-tight text-emerald-400",children:nt.active}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:"授信工作台活跃账号"})]}),e.jsx("div",{className:"p-2.5 rounded-xl bg-emerald-500/10 text-emerald-400",children:e.jsx(ot,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-medium text-slate-400",children:"已封禁锁定"}),e.jsx("div",{className:`mt-1 text-2xl font-bold tracking-tight ${nt.locked>0?"text-rose-400":"text-slate-400"}`,children:nt.locked}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-0.5",children:"不可登录或已被踢出"})]}),e.jsx("div",{className:"p-2.5 rounded-xl bg-rose-500/10 text-rose-400",children:e.jsx(sl,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-medium text-slate-400",children:"校区管理 / 空间主"}),e.jsx("div",{className:"mt-1 text-2xl font-bold tracking-tight text-teal-400",children:nt.schoolAdmins+nt.personalOwners}),e.jsxs("div",{className:"text-[11px] text-slate-500 mt-0.5",children:[nt.schoolAdmins," 校管 · ",nt.personalOwners," 个人主"]})]}),e.jsx("div",{className:"p-2.5 rounded-xl bg-teal-500/10 text-teal-400",children:e.jsx(J0,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-900 border border-slate-800 shadow-sm space-y-3",children:[e.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"relative flex-1 w-full",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400 absolute left-3.5 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",value:p,onChange:E=>b(E.target.value),placeholder:"快速搜索用户名、真实姓名、学校空间名称、用户编号 (ID) 或邮箱...",className:"w-full pl-10 pr-9 py-2.5 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500 transition-colors"}),p&&e.jsx("button",{onClick:()=>b(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300 p-0.5",title:"清空搜索",children:e.jsx(Xt,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto shrink-0",children:[e.jsx(ks,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsxs("select",{value:f,onChange:E=>j(E.target.value),className:"px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500 w-full md:w-48",children:[e.jsx("option",{value:"",children:"全部学校/空间"}),i.map(E=>e.jsxs("option",{value:E.id,children:[E.name," (",E.id,")"]},E.id))]})]}),e.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto shrink-0",children:[e.jsx(pr,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsxs("select",{value:k,onChange:E=>T(E.target.value),className:"px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white focus:outline-none focus:border-indigo-500 w-full md:w-36",children:[e.jsx("option",{value:"",children:"全部角色"}),e.jsx("option",{value:"SuperAdmin",children:"超级管理员"}),e.jsx("option",{value:"SchoolAdmin",children:"校区管理员"}),e.jsx("option",{value:"Teacher",children:"授课教师"}),e.jsx("option",{value:"TenantOwner",children:"空间所有者"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-slate-800/80 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-slate-500 mr-1",children:"账号状态:"}),e.jsxs("button",{onClick:()=>I(""),className:`px-2.5 py-1 rounded-lg text-xs font-medium transition-colors ${C===""?"bg-indigo-600 text-white":"bg-slate-800/80 text-slate-400 hover:text-slate-200"}`,children:["全部 (",a.length,")"]}),e.jsxs("button",{onClick:()=>I("active"),className:`px-2.5 py-1 rounded-lg text-xs font-medium transition-colors ${C==="active"?"bg-emerald-600 text-white":"bg-slate-800/80 text-slate-400 hover:text-slate-200"}`,children:["正常在用 (",nt.active,")"]}),e.jsxs("button",{onClick:()=>I("locked"),className:`px-2.5 py-1 rounded-lg text-xs font-medium transition-colors ${C==="locked"?"bg-rose-600 text-white":"bg-slate-800/80 text-slate-400 hover:text-slate-200"}`,children:["已封禁 (",nt.locked,")"]})]}),e.jsx("div",{className:"text-[11px] text-slate-400",children:p?e.jsxs("span",{children:["匹配搜索结果: ",e.jsx("span",{className:"font-semibold text-white font-mono",children:Tt.length})," 位"]}):e.jsxs("span",{children:["当前展示 ",e.jsx("span",{className:"font-semibold text-white font-mono",children:Tt.length})," 位用户"]})})]})]}),e.jsx("div",{className:"rounded-2xl bg-slate-900 border border-slate-800 shadow-sm overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/80 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"用户画像 / 登录账号"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"归属学校 / 空间"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"角色身份"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"账号状态"}),e.jsx("th",{className:"py-3.5 px-4 font-medium",children:"最近登录"}),e.jsx("th",{className:"py-3.5 px-4 font-medium text-right",children:"针对特定用户运维操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:Tt.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:6,className:"text-center py-14 text-xs text-slate-500",children:[e.jsx(an,{className:"w-8 h-8 text-slate-600 mx-auto mb-2 opacity-50"}),u?"正在检索用户中枢数据...":p?`未找到与 “${p}” 相关的匹配用户`:"当前筛选条件下暂无用户"]})}):Tt.map(E=>{var y;return e.jsxs("tr",{className:"hover:bg-slate-850/60 transition-colors group",children:[e.jsx("td",{className:"py-3.5 px-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-slate-800 border border-slate-700/80 flex items-center justify-center text-xs font-bold text-slate-200 shrink-0",children:((y=E.fullName)==null?void 0:y.slice(0,2))||E.username.slice(0,2).toUpperCase()}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-semibold text-white flex items-center gap-1.5",children:[e.jsx("span",{children:E.fullName}),E.isLocked&&e.jsx("span",{className:"px-1.5 py-0.2 rounded text-[10px] bg-rose-500/10 text-rose-400 border border-rose-500/20",children:"锁定"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-slate-400 font-mono mt-0.5",children:[e.jsx("span",{children:E.username}),e.jsx("button",{onClick:()=>Wt(E.username,`uname_${E.id}`),className:"text-slate-500 hover:text-slate-300 transition-colors p-0.5",title:"复制用户名",children:v===`uname_${E.id}`?e.jsx(is,{className:"w-3 h-3 text-emerald-400"}):e.jsx(us,{className:"w-3 h-3"})}),e.jsx("span",{className:"text-slate-600",children:"·"}),e.jsx("span",{className:"text-[11px] text-slate-500",title:`ID: ${E.id}`,children:E.id})]})]})]})}),e.jsxs("td",{className:"py-3.5 px-4 text-xs text-slate-300",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-slate-200",children:E.tenantName||E.tenantId}),E.tenantType==="Personal"&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-teal-500/10 text-teal-400 border border-teal-500/20 font-normal",children:"个人空间"})]}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-[11px] text-slate-500 font-mono",children:[e.jsx("span",{children:E.tenantId}),e.jsx(ke,{to:`/admin/tenants?q=${encodeURIComponent(E.tenantId)}`,className:"text-slate-500 hover:text-indigo-400 transition-colors ml-1",title:"跳转至该租户空间管理",children:e.jsx(Ci,{className:"w-3 h-3"})})]})]}),e.jsx("td",{className:"py-3.5 px-4",children:ee(E.role)}),e.jsx("td",{className:"py-3.5 px-4",children:E.isLocked?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-rose-500/15 text-rose-400 border border-rose-500/30",children:[e.jsx(sl,{className:"w-3 h-3"}),"已锁定封禁"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-semibold bg-emerald-500/15 text-emerald-400 border border-emerald-500/30",children:[e.jsx(ot,{className:"w-3 h-3"}),"正常在用"]})}),e.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400 font-mono",children:E.lastLoginAt?new Date(E.lastLoginAt).toLocaleString([],{dateStyle:"short",timeStyle:"short"}):e.jsx("span",{className:"text-slate-600",children:"尚未登录"})}),e.jsx("td",{className:"py-3.5 px-4 text-right",children:e.jsxs("div",{className:"inline-flex items-center gap-1",children:[e.jsxs("button",{onClick:()=>Y(E),className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium border border-slate-700/80 transition-colors inline-flex items-center gap-1",title:"查看用户完整画像与关联信息",children:[e.jsx(Q0,{className:"w-3 h-3 text-blue-400"}),"画像"]}),e.jsxs("button",{onClick:()=>{ae(E),O({fullName:E.fullName,role:E.role,tenantId:E.tenantId,recoveryEmail:E.recoveryEmail||""})},className:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium border border-slate-700/80 transition-colors inline-flex items-center gap-1",title:"编辑姓名、角色与所属空间",children:[e.jsx(rl,{className:"w-3 h-3 text-cyan-400"}),"编辑"]}),e.jsxs("button",{onClick:()=>Nt(E),disabled:B,className:"px-2 py-1 rounded-lg bg-indigo-600/15 hover:bg-indigo-600/25 text-indigo-300 text-xs font-medium border border-indigo-500/30 transition-colors inline-flex items-center gap-1 disabled:opacity-50",title:"签发 15 分钟单次自助重置凭证工单 (管理员不接触用户新密码)",children:[e.jsx(Ei,{className:"w-3 h-3 text-indigo-400"}),"重置工单"]}),e.jsxs("button",{onClick:()=>{ge(E),Ne(""),et(null)},className:"px-2 py-1 rounded-lg bg-amber-600/15 hover:bg-amber-600/25 text-amber-300 text-xs font-medium border border-amber-500/30 transition-colors inline-flex items-center gap-1",title:"直接修改该用户的登录密码 (立即生效,旧会话立即注销)",children:[e.jsx(rt,{className:"w-3 h-3 text-amber-400"}),"直接改密"]}),E.role!=="SuperAdmin"&&e.jsx("button",{onClick:()=>Q(E),className:`p-1 rounded-lg border transition-colors ${E.isLocked?"bg-emerald-600/15 border-emerald-500/30 text-emerald-400 hover:bg-emerald-600/25":"bg-rose-600/15 border-rose-500/30 text-rose-400 hover:bg-rose-600/25"}`,title:E.isLocked?"解冻账号":"封禁锁定账号",children:E.isLocked?e.jsx(Tc,{className:"w-3.5 h-3.5"}):e.jsx(sl,{className:"w-3.5 h-3.5"})}),E.role!=="SuperAdmin"&&e.jsx("button",{onClick:()=>{Le(E),Z("")},className:"p-1 rounded-lg bg-slate-800 hover:bg-rose-900/40 border border-slate-700/80 hover:border-rose-700/50 text-slate-400 hover:text-rose-400 transition-colors ml-0.5",title:"永久删除注销用户",children:e.jsx(Pl,{className:"w-3.5 h-3.5"})})]})})]},E.id)})})]})})}),M&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex justify-end",children:e.jsxs("div",{className:"w-full max-w-lg bg-slate-900 border-l border-slate-800 h-full p-6 space-y-6 overflow-y-auto shadow-2xl animate-in slide-in-from-right duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-slate-800",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-indigo-500/10 text-indigo-400",children:e.jsx(an,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-white",children:"用户画像透视"}),e.jsx("p",{className:"text-xs text-slate-400",children:"详细鉴权属性、空间归属与安全审计基准"})]})]}),e.jsx("button",{onClick:()=>Y(null),className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:e.jsx(Xt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-bold text-white",children:M.fullName}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 text-xs text-slate-400 font-mono",children:[e.jsx("span",{children:M.username}),e.jsx("button",{onClick:()=>Wt(M.username,"drawer_uname"),className:"text-slate-500 hover:text-slate-300",title:"复制账号",children:v==="drawer_uname"?e.jsx(is,{className:"w-3 h-3 text-emerald-400"}):e.jsx(us,{className:"w-3 h-3"})})]})]}),e.jsx("div",{children:ee(M.role)})]}),e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsxs("div",{className:"flex justify-between py-2 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"用户唯一标识 (ID)"}),e.jsx("span",{className:"font-mono text-slate-200",children:M.id})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"归属空间 / 学校"}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-semibold text-slate-200",children:M.tenantName}),e.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:M.tenantId})]})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"空间类型"}),e.jsx("span",{className:"font-medium text-slate-200",children:M.tenantType==="Personal"?"教师独立空间 (Personal)":"标准多班级学校 (School)"})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"账号当前状态"}),e.jsx("span",{children:M.isLocked?e.jsx("span",{className:"text-rose-400 font-semibold",children:"已封禁锁定"}):e.jsx("span",{className:"text-emerald-400 font-semibold",children:"正常授信"})})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"开户创建时间"}),e.jsx("span",{className:"font-mono text-slate-300",children:new Date(M.createdAt).toLocaleString()})]}),e.jsxs("div",{className:"flex justify-between py-2 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"最后登录足迹"}),e.jsx("span",{className:"font-mono text-slate-300",children:M.lastLoginAt?new Date(M.lastLoginAt).toLocaleString():"未曾登录"})]}),M.recoveryEmail&&e.jsxs("div",{className:"flex justify-between py-2 border-b border-slate-800/80",children:[e.jsx("span",{className:"text-slate-400",children:"备用安全邮箱"}),e.jsx("span",{className:"font-mono text-slate-300",children:M.recoveryEmail})]})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 space-y-2.5",children:[e.jsx("h3",{className:"text-xs font-semibold text-slate-300",children:"跨模块快速跳转"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs(ke,{to:`/admin/tenants?q=${encodeURIComponent(M.tenantId)}`,className:"p-2.5 rounded-lg bg-slate-900 border border-slate-800 hover:border-indigo-500/50 hover:bg-slate-850 flex items-center justify-between transition-colors text-slate-300 hover:text-white",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ks,{className:"w-3.5 h-3.5 text-indigo-400"}),"查看所属租户"]}),e.jsx(Ci,{className:"w-3 h-3 text-slate-500"})]}),e.jsxs(ke,{to:`/admin/devices?q=${encodeURIComponent(M.tenantId)}`,className:"p-2.5 rounded-lg bg-slate-900 border border-slate-800 hover:border-emerald-500/50 hover:bg-slate-850 flex items-center justify-between transition-colors text-slate-300 hover:text-white",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ci,{className:"w-3.5 h-3.5 text-emerald-400"}),"查看该校大屏"]}),e.jsx(Ci,{className:"w-3 h-3 text-slate-500"})]})]})]}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-slate-300",children:"对该用户直接执行操作"}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[e.jsxs("button",{onClick:()=>{const E=M;Y(null),Nt(E)},className:"p-2 rounded-xl bg-indigo-600/20 hover:bg-indigo-600/30 text-indigo-300 font-medium border border-indigo-500/30 transition-colors flex items-center justify-center gap-1.5",children:[e.jsx(Ei,{className:"w-3.5 h-3.5 text-indigo-400"}),"重置工单"]}),e.jsxs("button",{onClick:()=>{const E=M;Y(null),ge(E),Ne(""),et(null)},className:"p-2 rounded-xl bg-amber-600/20 hover:bg-amber-600/30 text-amber-300 font-medium border border-amber-500/30 transition-colors flex items-center justify-center gap-1.5",children:[e.jsx(rt,{className:"w-3.5 h-3.5 text-amber-400"}),"直接改密"]}),e.jsxs("button",{onClick:()=>{const E=M;Y(null),ae(E),O({fullName:E.fullName,role:E.role,tenantId:E.tenantId,recoveryEmail:E.recoveryEmail||""})},className:"p-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 font-medium border border-slate-700 transition-colors flex items-center justify-center gap-1.5",children:[e.jsx(rl,{className:"w-3.5 h-3.5 text-cyan-400"}),"修改身份"]})]})]})]})}),z&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md p-6 space-y-4 shadow-2xl animate-in zoom-in-95 duration-150 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(rl,{className:"w-4 h-4 text-cyan-400"}),"编辑用户信息: ",z.username]}),e.jsx("button",{onClick:()=>ae(null),className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:Ge,className:"space-y-3.5 text-xs",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"真实姓名"}),e.jsx("input",{type:"text",required:!0,value:le.fullName||"",onChange:E=>O({...le,fullName:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white focus:outline-none focus:border-cyan-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"用户角色"}),e.jsxs("select",{value:le.role||"",onChange:E=>O({...le,role:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white focus:outline-none focus:border-cyan-500",children:[e.jsx("option",{value:"Teacher",children:"普通授课教师 (Teacher)"}),e.jsx("option",{value:"SchoolAdmin",children:"校区管理员 (SchoolAdmin)"}),e.jsx("option",{value:"TenantOwner",children:"空间所有者 (TenantOwner)"}),e.jsx("option",{value:"SuperAdmin",children:"超级管理员 (SuperAdmin)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"归属学校 / 空间"}),e.jsx("select",{value:le.tenantId||"",onChange:E=>O({...le,tenantId:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white focus:outline-none focus:border-cyan-500",children:i.map(E=>e.jsxs("option",{value:E.id,children:[E.name," (",E.id,")"]},E.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"备用安全邮箱 (选填)"}),e.jsx("input",{type:"email",value:le.recoveryEmail||"",onChange:E=>O({...le,recoveryEmail:E.target.value}),placeholder:"teacher@school.edu.cn",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white placeholder-slate-600 focus:outline-none focus:border-cyan-500"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3",children:[e.jsx("button",{type:"button",onClick:()=>ae(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:pe,className:"px-4 py-2 rounded-xl bg-cyan-600 hover:bg-cyan-500 text-white font-semibold transition-colors disabled:opacity-50",children:pe?"保存中...":"保存更新"})]})]})]})}),se&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md p-6 space-y-4 shadow-2xl animate-in zoom-in-95 duration-150 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(Ei,{className:"w-4 h-4 text-indigo-400"}),"重置凭证工单签发成功"]}),e.jsx("button",{onClick:()=>g(null),className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),e.jsxs("p",{className:"text-xs text-slate-400",children:["已为用户 ",e.jsxs("span",{className:"text-white font-semibold",children:[se.user.username," (",se.user.fullName,")"]})," 签发一次性重置工单,可复制此凭证交给用户用于自主重设密码。"]}),e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 space-y-2",children:[e.jsx("div",{className:"text-[11px] text-slate-400",children:"重置工单凭证 (Ticket):"}),e.jsx("div",{className:"font-mono text-sm text-indigo-300 break-all select-all font-bold",children:se.ticket}),e.jsxs("button",{onClick:()=>Wt(se.ticket,"ticket_val"),className:"w-full py-2 rounded-lg bg-indigo-600/20 hover:bg-indigo-600/30 text-indigo-300 text-xs font-semibold border border-indigo-500/30 transition-colors flex items-center justify-center gap-1.5",children:[v==="ticket_val"?e.jsx(is,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx(us,{className:"w-3.5 h-3.5"}),v==="ticket_val"?"工单凭证已复制到剪贴板":"一键复制工单凭证"]})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{onClick:()=>g(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-white text-xs font-medium transition-colors",children:"关闭"})})]})}),U&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-slate-900 border border-amber-500/40 rounded-2xl w-full max-w-md p-6 space-y-4 shadow-2xl animate-in zoom-in-95 duration-150 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-bold text-amber-300 flex items-center gap-2",children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400"}),"管理员直接重置用户密码"]}),e.jsx("button",{onClick:()=>{ge(null),et(null)},className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 text-xs space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"目标用户:"}),e.jsx("span",{className:"font-semibold text-white",children:U.fullName})," (",U.username,")"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"归属空间:"}),e.jsx("span",{className:"text-slate-300",children:U.tenantName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"账号身份:"}),e.jsx("span",{className:"text-slate-300",children:U.role})]})]}),De?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 bg-emerald-500/10 border border-emerald-500/30 rounded-xl space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-emerald-400 text-sm",children:[e.jsx(ot,{className:"w-4 h-4"}),e.jsx("span",{children:"密码重置成功"})]}),e.jsx("p",{className:"text-emerald-300/90 text-xs",children:"用户原有登录令牌已立即失效。请将下方设置的新密码通知该用户:"}),e.jsxs("div",{className:"p-2.5 bg-black/50 border border-emerald-800/40 rounded-lg flex items-center justify-between",children:[e.jsx("span",{className:"font-mono text-sm font-bold text-emerald-300 select-all",children:De}),e.jsxs("button",{onClick:()=>Wt(De,"direct_pwd"),className:"text-emerald-400 hover:text-emerald-200 text-xs flex items-center gap-1 font-medium",children:[v==="direct_pwd"?e.jsx(is,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx(us,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:v==="direct_pwd"?"已复制":"复制密码"})]})]})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{type:"button",onClick:()=>{ge(null),et(null)},className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold transition-colors",children:"完成并关闭"})})]}):e.jsxs("form",{onSubmit:wt,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("label",{className:"text-xs font-medium text-slate-300",children:"设置新密码 (至少 8 位)"}),e.jsx("button",{type:"button",onClick:ft,className:"text-xs text-amber-400 hover:text-amber-300 transition-colors flex items-center gap-1",children:e.jsx("span",{children:"🎲 随机生成强密码"})})]}),e.jsx("input",{type:"text",value:je,onChange:E=>Ne(E.target.value),placeholder:"请输入或随机生成新密码",className:"w-full px-3.5 py-2.5 rounded-xl bg-slate-950 border border-slate-700/80 text-white placeholder-slate-500 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-amber-500/50",required:!0}),e.jsx("p",{className:"text-[11px] text-amber-400/80 leading-relaxed",children:"⚠️ 提交后该密码立即生效,系统将自动触发安全递增,强制使用户当前所有在线终端立即退登。"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>ge(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:ye,className:"px-4 py-2 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-semibold transition-colors flex items-center gap-1.5 shadow-lg shadow-amber-600/20 disabled:opacity-50",children:ye?"正在重置...":"确认直接重置"})]})]})]})}),ve&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md p-6 space-y-4 shadow-2xl animate-in zoom-in-95 duration-150",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-bold text-white flex items-center gap-2",children:[ve.isLocked?e.jsx(Tc,{className:"w-4 h-4 text-emerald-400"}):e.jsx(sl,{className:"w-4 h-4 text-rose-400"}),ve.isLocked?"解除账号封禁":"封禁锁定账号"]}),e.jsx("button",{onClick:()=>Q(null),className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 text-xs space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"操作目标: "}),e.jsx("span",{className:"font-semibold text-white",children:ve.fullName})," (",ve.username,")"]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"归属空间: "}),e.jsx("span",{className:"text-slate-300",children:ve.tenantName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"当前状态: "}),e.jsx("span",{children:ve.isLocked?"已锁定":"正常在用"})]})]}),e.jsx("p",{className:"text-xs text-slate-300",children:ve.isLocked?"确认解除锁定后,该用户将恢复正常的密码登录与教师工作台授课权限。":"确认封禁后,该用户的所有现存登录会话将立即被强制踢下线,且无法再次登录系统,直到超管手动解冻。"}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2 text-xs",children:[e.jsx("button",{type:"button",onClick:()=>Q(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"button",onClick:Pe,disabled:R,className:`px-4 py-2 rounded-xl font-semibold transition-colors disabled:opacity-50 text-white ${ve.isLocked?"bg-emerald-600 hover:bg-emerald-500":"bg-rose-600 hover:bg-rose-500"}`,children:R?"处理中...":ve.isLocked?"确认解除锁定":"确认封禁账号"})]})]})}),te&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-md flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-slate-900 border border-rose-500/40 rounded-2xl w-full max-w-md p-6 space-y-4 shadow-2xl animate-in zoom-in-95 duration-150",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-bold text-rose-400 flex items-center gap-2",children:[e.jsx(Pl,{className:"w-4 h-4 text-rose-500"}),"永久注销并删除用户"]}),e.jsx("button",{onClick:()=>Le(null),className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300 text-xs space-y-2",children:[e.jsxs("div",{className:"font-semibold flex items-center gap-1.5 text-rose-400",children:[e.jsx(Qt,{className:"w-4 h-4 shrink-0"}),"危险操作警告:不可逆回滚!"]}),e.jsxs("div",{className:"text-[11px] leading-relaxed",children:["删除后,用户账号 ",e.jsxs("span",{className:"font-mono font-bold text-white",children:["[",te.username,"]"]})," 的登录身份、加密哈希、安全恢复密钥及历史会话将被物理清除。",e.jsx("div",{className:"mt-1.5 text-rose-400 font-medium",children:"注:若目标为学校空间唯一校区管理员或个人空间唯一所有者,系统将拦截拒绝删除,需先转移所有权。"})]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 text-xs space-y-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"待删除用户: "}),e.jsx("span",{className:"font-bold text-white",children:te.fullName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"登录用户名: "}),e.jsx("span",{className:"font-mono text-slate-200",children:te.username})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"归属空间: "}),e.jsxs("span",{className:"text-slate-300",children:[te.tenantName," (",te.tenantId,")"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"用户编号: "}),e.jsx("span",{className:"font-mono text-slate-500",children:te.id})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3 text-xs",children:[e.jsx("button",{type:"button",onClick:()=>Le(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 font-medium transition-colors",children:"取消"}),e.jsxs("button",{type:"button",onClick:Xe,disabled:G,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white font-semibold transition-colors disabled:opacity-50 flex items-center gap-1.5 shadow-lg shadow-rose-600/25",children:[e.jsx(Pl,{className:"w-3.5 h-3.5"}),G?"正在注销删除...":"确认永久删除用户"]})]})]})}),ct&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md p-6 space-y-4 shadow-2xl animate-in zoom-in-95 duration-150",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(Fs,{className:"w-4 h-4 text-indigo-400"}),"开通新用户账号"]}),e.jsx("button",{onClick:()=>Je(!1),className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:he,className:"space-y-3.5 text-xs",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"归属学校 / 空间"}),e.jsxs("select",{required:!0,value:We.tenantId,onChange:E=>tt({...We,tenantId:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white focus:outline-none focus:border-indigo-500",children:[e.jsx("option",{value:"",children:"-- 请选择学校或教师空间 --"}),i.map(E=>e.jsxs("option",{value:E.id,children:[E.name," (",E.id,")"]},E.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"用户角色"}),e.jsxs("select",{value:We.role,onChange:E=>tt({...We,role:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white focus:outline-none focus:border-indigo-500",children:[e.jsx("option",{value:"Teacher",children:"普通授课教师 (Teacher)"}),e.jsx("option",{value:"SchoolAdmin",children:"校区管理员 (SchoolAdmin)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"登录用户名"}),e.jsx("input",{type:"text",required:!0,placeholder:"例如: teacher_li 或 admin_no4",value:We.username,onChange:E=>tt({...We,username:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500 font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"用户真实姓名"}),e.jsx("input",{type:"text",required:!0,placeholder:"例如: 李老师",value:We.fullName,onChange:E=>tt({...We,fullName:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-400 mb-1 font-medium",children:"初始登录密码"}),e.jsx("input",{type:"password",required:!0,placeholder:"设置 8 位以上安全密码",value:We.password,onChange:E=>tt({...We,password:E.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white placeholder-slate-500 focus:outline-none focus:border-indigo-500 font-mono"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-3",children:[e.jsx("button",{type:"button",onClick:()=>Je(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:At,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-semibold transition-colors shadow-md shadow-indigo-600/20 disabled:opacity-50",children:At?"正在开户...":"确认开户"})]})]})]})})]})},Bg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState(!0),[u,m]=x.useState([]),[p,b]=x.useState(!1),[f,j]=x.useState({tenantId:"",title:"⚠️ 全校紧急预警通报",message:"",voice:!0,shake:!0,durationSeconds:30}),[k,T]=x.useState(!1),[C,I]=x.useState(!1),[P,q]=x.useState(null),[v,w]=x.useState(null),[M,Y]=x.useState(null),z=[{title:"消防紧急疏散演练",content:"全体师生请注意:现在进行全校紧急消防演练,请任课老师组织学生按预定疏散路线迅速有序撤离至操场!",duration:60,shake:!0,voice:!0,icon:ff},{title:"恶劣天气避险通报",content:"气象台发布雷电暴雨黄色预警,请各班立即紧闭门窗,切断教室非必要电器电源,严禁前往室外!",duration:45,shake:!0,voice:!0,icon:tf},{title:"临时紧急调度会议",content:"请全体班主任与班长立即到行政楼二楼报告厅参加紧急安全调度会议,其余同学教室内自习。",duration:30,shake:!1,voice:!0,icon:an},{title:"作息调整离校通知",content:"因突发教学安排,今天下午放学时间临时调整为 16:30,请任课老师提醒学生整理个人物品按时离校。",duration:30,shake:!1,voice:!0,icon:Mf}],ae=async()=>{try{const K=await J.getTenants();l(K)}catch(K){console.error("Failed to load tenants",K)}finally{c(!1)}},le=async()=>{b(!0);try{const K=await J.getAdminNotifications(15);m(K)}catch(K){console.error("Failed to load recent broadcasts",K)}finally{b(!1)}};x.useEffect(()=>{ae(),le()},[]);const O=K=>{j(Z=>({...Z,title:`⚠️ ${K.title}`,message:K.content,durationSeconds:K.duration,shake:K.shake,voice:K.voice}))},pe=K=>{if(K.preventDefault(),!f.message.trim()){alert("请输入广播通知正文");return}T(!0)};x.useEffect(()=>{if(!P)return;let K=!1,Z;const G=Date.now(),re=async()=>{try{const se=await J.getBroadcastReceiptSummary(P);if(K)return;w(se),!se.completed&&Date.now()-G<6e4&&(Z=window.setTimeout(re,2e3))}catch{!K&&Date.now()-G<6e4&&(Z=window.setTimeout(re,3e3))}};return re(),()=>{K=!0,Z&&clearTimeout(Z)}},[P]);const ne=async()=>{I(!0);try{const K=await J.sendEmergencyBroadcast({...f,tenantId:f.tenantId||void 0});K.broadcastId&&q(K.broadcastId),Y({dispatchedCount:K.dispatchedCount,targetSchools:K.targetSchools,message:K.message,success:!0,timestamp:new Date().toLocaleTimeString()}),T(!1),j(Z=>({...Z,message:""})),le()}catch(K){Y({dispatchedCount:0,targetSchools:0,message:K.message||"应急广播下发失败",success:!1,timestamp:new Date().toLocaleTimeString()}),T(!1)}finally{I(!1)}},ve=a.find(K=>K.id===f.tenantId),Q=ve?ve.classroomCount:a.reduce((K,Z)=>K+(Z.classroomCount||0),0);ve?ve.deviceCount:a.reduce((K,Z)=>K+(Z.deviceCount||0),0);const R=(v==null?void 0:v.targetDevices)??null,W=(v==null?void 0:v.displayed)??0,te=(v==null?void 0:v.pending)??null,Le=v&&v.targetDevices>0?Math.min(100,Math.round(W/v.targetDevices*100)):0;return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"全域应急广播通道",description:"全网最高优先调度通道,覆盖多校区所有教室大屏终端,支持全屏强置顶与语音播报",badge:e.jsx(it,{label:"极高优先级",variant:"rose"})}),M&&e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4 animate-in fade-in duration-150",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[M.success?e.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/10 text-emerald-400 flex items-center justify-center",children:e.jsx(ot,{className:"w-5 h-5"})}):e.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-500/10 text-rose-400 flex items-center justify-center",children:e.jsx(Qt,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-white",children:M.success?"紧急广播指令已成功下发至目标教室大屏":"广播下发失败"}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:M.message})]})]}),e.jsx("button",{type:"button",onClick:()=>{Y(null),q(null),w(null)},className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:e.jsx(Xt,{className:"w-4 h-4"})})]}),M.success&&e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative w-14 h-14 flex items-center justify-center shrink-0",children:[e.jsxs("svg",{className:"w-full h-full transform -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("path",{className:"text-slate-800",strokeWidth:"3.5",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"}),e.jsx("path",{className:"text-emerald-400 transition-all duration-500",strokeDasharray:`${Le}, 100`,strokeWidth:"3.5",strokeLinecap:"round",stroke:"currentColor",fill:"none",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"})]}),e.jsxs("span",{className:"text-xs font-bold text-white absolute",children:[Le,"%"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold text-white",children:"大屏显示达成率"}),e.jsx("div",{className:"text-[11px] text-slate-400 mt-0.5",children:v?`${W} / ${R} 台大屏已完成现场弹窗`:`广播已调度下发至 ${M.dispatchedCount||0} 个目标班级,正在等待终端回执...`})]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.jsxs("div",{className:"text-center px-3 py-1.5 rounded-lg bg-emerald-500/10 border border-emerald-500/20 text-emerald-400",children:[e.jsx("div",{className:"font-bold text-sm",children:W}),e.jsx("div",{className:"text-[10px]",children:"已显示"})]}),e.jsxs("div",{className:"text-center px-3 py-1.5 rounded-lg bg-slate-900 border border-slate-800 text-slate-300",children:[e.jsx("div",{className:"font-bold text-sm",children:te!==null?te:"—"}),e.jsx("div",{className:"text-[10px]",children:v?"等待回执":"等待统计"})]}),e.jsxs("div",{className:"text-center px-3 py-1.5 rounded-lg bg-slate-900 border border-slate-800 text-slate-400",children:[e.jsx("div",{className:"font-bold text-sm",children:(v==null?void 0:v.failed)??"—"}),e.jsx("div",{className:"text-[10px]",children:"失败/离线"})]})]})]}),M.success&&a.length>0&&e.jsxs("div",{className:"space-y-2 pt-2 border-t border-slate-800",children:[e.jsx("span",{className:"text-xs font-medium text-slate-400",children:"目标校区下达详情"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:a.map(K=>!f.tenantId||f.tenantId===K.id?e.jsxs("div",{className:"p-2.5 rounded-xl bg-slate-950 border border-slate-800/80 flex items-center justify-between text-xs",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-slate-200",children:K.name}),e.jsxs("div",{className:"text-[11px] text-slate-500 font-mono",children:[K.classroomCount," 间教室 · ",K.deviceCount," 台大屏"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-slate-400 font-medium",children:[e.jsx(Al,{className:"w-3.5 h-3.5 text-blue-400"}),e.jsx("span",{children:"已调度下发"})]})]},K.id):null)})]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("label",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider block",children:"应急广播预设模板(点击快速填装)"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:z.map((K,Z)=>{const G=K.icon;return e.jsxs("button",{type:"button",onClick:()=>O(K),className:"p-3.5 rounded-xl bg-slate-900 border border-slate-800 hover:border-blue-500/40 hover:bg-slate-850 text-left transition-all group",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-slate-200 group-hover:text-blue-400 mb-1",children:[e.jsx(G,{className:"w-4 h-4 text-blue-400 shrink-0"}),e.jsx("span",{children:K.title})]}),e.jsx("p",{className:"text-[11px] text-slate-500 line-clamp-2 leading-relaxed",children:K.content})]},Z)})})]}),e.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm",children:e.jsxs("form",{onSubmit:pe,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ks,{className:"w-3.5 h-3.5 text-blue-400"}),"目标广播校区"]}),e.jsxs("span",{className:"text-[11px] text-slate-500",children:["预计覆盖 ",Q," 班级"]})]}),e.jsxs("select",{value:f.tenantId||"",onChange:K=>j({...f,tenantId:K.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white focus:outline-none focus:border-blue-500 transition-colors",children:[e.jsx("option",{value:"",children:"🚨 全网所有学校与所有教室大屏 (全域覆盖)"}),a.map(K=>e.jsxs("option",{value:K.id,children:["仅该校: ",K.name," (",K.classroomCount," 班级, ",K.deviceCount," 大屏)"]},K.id))]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center gap-1.5",children:[e.jsx(fa,{className:"w-3.5 h-3.5 text-rose-400"}),"广播标题"]}),e.jsx("input",{type:"text",required:!0,value:f.title,onChange:K=>j({...f,title:K.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white focus:outline-none focus:border-blue-500 transition-colors",placeholder:"例如: ⚠️ 全校紧急避险预警"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"广播正文内容"}),e.jsx("textarea",{required:!0,rows:3,value:f.message,onChange:K=>j({...f,message:K.target.value}),className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-blue-500 transition-colors resize-none leading-relaxed",placeholder:"请输入紧急通报具体事项..."})]}),e.jsxs("div",{className:"pt-2 border-t border-slate-800/80 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-slate-300",children:[e.jsx("input",{type:"checkbox",checked:f.voice,onChange:K=>j({...f,voice:K.target.checked}),className:"rounded bg-slate-950 border-slate-700 text-blue-600"}),e.jsx(Uc,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{children:"TTS 语音朗读"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-slate-300",children:[e.jsx("input",{type:"checkbox",checked:f.shake,onChange:K=>j({...f,shake:K.target.checked}),className:"rounded bg-slate-950 border-slate-700 text-blue-600"}),e.jsx(cn,{className:"w-3.5 h-3.5 text-rose-400"}),e.jsx("span",{children:"窗口视效抖动"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-slate-400",children:[e.jsx(os,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["时长: ",f.durationSeconds,"s"]})]})]}),e.jsxs("button",{type:"submit",disabled:C||!f.message.trim(),className:"px-5 py-2.5 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 transition-all flex items-center justify-center gap-2 disabled:opacity-40",children:[e.jsx(al,{className:"w-4 h-4"}),e.jsx("span",{children:"下发紧急广播"})]})]})]})}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[e.jsxs("h2",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[e.jsx(Ec,{className:"w-4 h-4 text-blue-400"}),"最近全网广播与呼叫调度记录"]}),e.jsx("button",{onClick:le,disabled:p,className:"text-xs text-blue-400 hover:underline disabled:opacity-50",children:p?"刷新中...":"刷新"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{className:"text-[11px] uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-2.5 px-3",children:"发起时间"}),e.jsx("th",{className:"py-2.5 px-3",children:"类型"}),e.jsx("th",{className:"py-2.5 px-3",children:"目标范围"}),e.jsx("th",{className:"py-2.5 px-3",children:"通报内容"}),e.jsx("th",{className:"py-2.5 px-3 text-right",children:"状态"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:u.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"py-8 text-center text-slate-500",children:p?"正在加载历史记录...":"暂无调度记录"})}):u.slice(0,6).map(K=>e.jsxs("tr",{className:"hover:bg-slate-800/25",children:[e.jsx("td",{className:"py-3 px-3 font-mono text-slate-400 whitespace-nowrap",children:new Date(K.createdAt).toLocaleTimeString()}),e.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:K.priority==="Urgent"?e.jsx(it,{label:"紧急通报",variant:"rose",dot:!1}):e.jsx(it,{label:"日常呼叫",variant:"slate",dot:!1})}),e.jsx("td",{className:"py-3 px-3 text-white font-medium whitespace-nowrap",children:K.className||"全域广播"}),e.jsx("td",{className:"py-3 px-3 text-slate-300 max-w-xs truncate",children:K.message}),e.jsx("td",{className:"py-3 px-3 text-right whitespace-nowrap",children:K.status==="Cancelled"?e.jsx("span",{className:"text-slate-400",children:"已撤回"}):K.status==="Acknowledged"?e.jsx("span",{className:"text-emerald-400 font-medium",children:"已确认"}):K.status==="Delivered"?e.jsx("span",{className:"text-sky-400",children:"已送达"}):e.jsx("span",{className:"text-slate-400",children:"已发送"})})]},K.id))})]})})]}),k&&e.jsx(Vt,{isOpen:!0,onClose:()=>T(!1),title:"全域应急调度二次确认",preventClose:C,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"p-3.5 rounded-xl bg-rose-500/10 border border-rose-500/20 text-rose-300 text-xs leading-relaxed",children:"⚠️ 确认后,系统将强制穿透目标教室大屏正在进行的多媒体课件,以全屏高优先级弹窗展示并进行语音朗读。"}),e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 text-xs space-y-1.5",children:[e.jsxs("div",{className:"text-slate-400",children:["广播范围:",e.jsx("span",{className:"text-white font-semibold",children:f.tenantId?ve==null?void 0:ve.name:`全域覆盖 (${a.length} 所学校)`})]}),e.jsxs("div",{className:"text-slate-400",children:["广播标题:",e.jsx("span",{className:"text-white font-medium",children:f.title})]}),e.jsxs("div",{className:"text-slate-400",children:["广播正文:",e.jsx("span",{className:"text-slate-200",children:f.message})]})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-2",children:[e.jsx("button",{type:"button",disabled:C,onClick:()=>T(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"放弃"}),e.jsx("button",{type:"button",disabled:C,onClick:ne,className:"px-5 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 flex items-center gap-2 disabled:opacity-50",children:C?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:"下发中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(al,{className:"w-4 h-4"}),e.jsx("span",{children:"确认下发"})]})})]})]})})]})},Hg=()=>{const[a,l]=jr(),i=a.get("status")||"all",c=a.get("tenantId")||"all",u=a.get("online")||"all",[m,p]=x.useState(null),[b,f]=x.useState([]),[j,k]=x.useState([]),[T,C]=x.useState(!0),[I,P]=x.useState(!1),[q,v]=x.useState(""),w=async(O=!1)=>{O?P(!0):C(!0);try{const[pe,ne,ve]=await Promise.all([J.getFleetVersionSummary(),J.getFleetDevices({status:i!=="all"?i:void 0,tenantId:c!=="all"?c:void 0,online:u==="true"?!0:u==="false"?!1:void 0,q:q.trim()||void 0}),J.getTenants()]);p(pe),f(ne),k(ve)}catch(pe){console.error("Failed to load fleet version data",pe)}finally{C(!1),P(!1)}};x.useEffect(()=>{w()},[i,c,u]);const M=O=>{O.preventDefault(),w()},Y=O=>{const pe=new URLSearchParams(a);O==="all"?pe.delete("status"):pe.set("status",O),l(pe)},z=O=>{const pe=new URLSearchParams(a);O==="all"?pe.delete("tenantId"):pe.set("tenantId",O),l(pe)},ae=O=>{const pe=new URLSearchParams(a);O==="all"?pe.delete("online"):pe.set("online",O),l(pe)},le=O=>{if(!O)return"从不上线 / 未知";try{return new Date(O).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return O}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"终端版本运维看板",description:"全网教室大屏软件版本资产观测、兼容性评估与落后终端清点 (Observe Only)",action:e.jsxs("button",{onClick:()=>w(!0),disabled:T||I,className:"px-3.5 py-2 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white hover:bg-slate-800 transition-all flex items-center gap-2 text-xs font-medium shadow-sm",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${I?"animate-spin text-blue-400":""}`}),I?"刷新中...":"刷新状态"]})}),(m==null?void 0:m.policy)&&e.jsxs("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/90 p-4 shadow-sm backdrop-blur-sm flex flex-col md:flex-row items-start md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center shrink-0",children:e.jsx(Ri,{className:"w-5 h-5 text-indigo-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-semibold text-white flex items-center gap-2",children:["当前运行策略",e.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded-full bg-slate-800 text-slate-300 font-mono",children:["协议 v",m.policy.minimumProtocolVersion]})]}),e.jsxs("div",{className:"text-xs text-slate-400 mt-0.5",children:["最低要求:Service ",m.policy.minimumServiceVersion," / Client ",m.policy.minimumClientVersion," · 推荐版本:",m.policy.recommendedServiceVersion]})]})]}),e.jsx("div",{className:"flex items-center gap-2 self-stretch md:self-auto justify-end",children:e.jsxs("span",{className:"text-[11px] px-2.5 py-1 rounded-lg bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 font-medium flex items-center gap-1.5",children:[e.jsx(ot,{className:"w-3.5 h-3.5"}),"只读观测模式 · 绝不阻断通知"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3.5 sm:gap-4",children:[e.jsxs("div",{onClick:()=>Y("all"),className:`cursor-pointer rounded-2xl p-4 sm:p-5 border transition-all ${i==="all"?"bg-slate-850 border-blue-500/50 shadow-md shadow-blue-500/5":"bg-slate-900 border-slate-800 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-400 font-medium",children:"全网终端资产"}),e.jsx(_t,{className:"w-4 h-4 text-slate-400"})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-bold font-mono text-white mt-2",children:T?"-":(m==null?void 0:m.total)??0}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"全部入册大屏"})]}),e.jsxs("div",{onClick:()=>Y("Current"),className:`cursor-pointer rounded-2xl p-4 sm:p-5 border transition-all ${i==="Current"?"bg-emerald-950/30 border-emerald-500/50 shadow-md shadow-emerald-500/5":"bg-slate-900 border-slate-800 hover:border-emerald-500/30"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-emerald-400 font-medium",children:"当前版本"}),e.jsx(ot,{className:"w-4 h-4 text-emerald-400"})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-bold font-mono text-emerald-300 mt-2",children:T?"-":(m==null?void 0:m.current)??0}),e.jsx("div",{className:"text-[11px] text-emerald-500/80 mt-1",children:"满足推荐基线"})]}),e.jsxs("div",{onClick:()=>Y("Outdated"),className:`cursor-pointer rounded-2xl p-4 sm:p-5 border transition-all ${i==="Outdated"?"bg-amber-950/30 border-amber-500/50 shadow-md shadow-amber-500/5":"bg-slate-900 border-slate-800 hover:border-amber-500/30"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-amber-400 font-medium",children:"版本落后"}),e.jsx(Qt,{className:"w-4 h-4 text-amber-400"})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-bold font-mono text-amber-300 mt-2",children:T?"-":(m==null?void 0:m.outdated)??0}),e.jsx("div",{className:"text-[11px] text-amber-500/80 mt-1",children:"可用但建议升级"})]}),e.jsxs("div",{onClick:()=>Y("Unsupported"),className:`cursor-pointer rounded-2xl p-4 sm:p-5 border transition-all ${i==="Unsupported"?"bg-rose-950/30 border-rose-500/50 shadow-md shadow-rose-500/5":"bg-slate-900 border-slate-800 hover:border-rose-500/30"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-rose-400 font-medium",children:"不受支持"}),e.jsx(ua,{className:"w-4 h-4 text-rose-400"})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-bold font-mono text-rose-300 mt-2",children:T?"-":(m==null?void 0:m.unsupported)??0}),e.jsx("div",{className:"text-[11px] text-rose-500/80 mt-1",children:"低于最低支持版本"})]}),e.jsxs("div",{onClick:()=>Y("Unknown"),className:`cursor-pointer rounded-2xl p-4 sm:p-5 border transition-all ${i==="Unknown"?"bg-slate-850 border-slate-400/50 shadow-md":"bg-slate-900 border-slate-800 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-slate-300 font-medium",children:"版本未知"}),e.jsx(Xp,{className:"w-4 h-4 text-slate-400"})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-bold font-mono text-slate-200 mt-2",children:T?"-":(m==null?void 0:m.unknown)??0}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"信息缺失或未上报"})]})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4 shadow-sm space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pb-3 border-b border-slate-800/80",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:[{id:"all",label:"全部",count:(m==null?void 0:m.total)??0},{id:"Current",label:"当前版本",count:(m==null?void 0:m.current)??0,color:"text-emerald-400"},{id:"Outdated",label:"版本落后",count:(m==null?void 0:m.outdated)??0,color:"text-amber-400"},{id:"Unsupported",label:"不受支持",count:(m==null?void 0:m.unsupported)??0,color:"text-rose-400"},{id:"Unknown",label:"未知",count:(m==null?void 0:m.unknown)??0,color:"text-slate-400"}].map(O=>{const pe=i===O.id;return e.jsxs("button",{onClick:()=>Y(O.id),className:`px-3 py-1.5 rounded-xl text-xs font-medium transition-all flex items-center gap-1.5 ${pe?"bg-blue-600 text-white shadow-sm shadow-blue-500/20":"bg-slate-950 text-slate-400 hover:text-slate-200 border border-slate-800"}`,children:[e.jsx("span",{className:pe?"text-white":O.color,children:O.label}),e.jsx("span",{className:`px-1.5 py-0.5 rounded-md text-[10px] font-mono ${pe?"bg-blue-700/60 text-white":"bg-slate-850 text-slate-400"}`,children:O.count})]},O.id)})}),e.jsxs("div",{className:"text-xs text-slate-500 font-mono",children:["共筛选出 ",b.length," 台设备"]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-3 items-center",children:[e.jsx("div",{className:"sm:col-span-4",children:e.jsxs("select",{value:c,onChange:O=>z(O.target.value),className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-slate-200 focus:outline-none focus:border-blue-500 transition-colors",children:[e.jsx("option",{value:"all",children:"全部入驻学校 (租户)"}),j.map(O=>e.jsxs("option",{value:O.id,children:[O.name," (",O.deviceCount," 设备)"]},O.id))]})}),e.jsx("div",{className:"sm:col-span-3",children:e.jsxs("select",{value:u,onChange:O=>ae(O.target.value),className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-slate-200 focus:outline-none focus:border-blue-500 transition-colors",children:[e.jsx("option",{value:"all",children:"在线状态:全部"}),e.jsx("option",{value:"true",children:"仅看在线终端 (● 在线)"}),e.jsx("option",{value:"false",children:"仅看离线终端 (○ 离线)"})]})}),e.jsxs("form",{onSubmit:M,className:"sm:col-span-5 relative",children:[e.jsx("input",{type:"text",value:q,onChange:O=>v(O.target.value),placeholder:"搜索设备ID、主机名、班级...",className:"w-full bg-slate-950 border border-slate-800 rounded-xl pl-9 pr-16 py-2 text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-blue-500 transition-colors"}),e.jsx(vn,{className:"w-3.5 h-3.5 text-slate-500 absolute left-3 top-2.5"}),e.jsx("button",{type:"submit",className:"absolute right-1.5 top-1.5 px-2.5 py-1 bg-slate-800 hover:bg-slate-700 text-[11px] text-slate-300 rounded-lg transition-colors",children:"搜索"})]})]})]}),e.jsx("div",{className:"space-y-3",children:T?e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-12 text-center text-slate-400 text-sm",children:[e.jsx(xt,{className:"w-6 h-6 animate-spin mx-auto mb-3 text-blue-400"}),"正在动态计算全网终端版本资产状态..."]}):b.length===0?e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-12 text-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-slate-800/80 flex items-center justify-center mx-auto mb-3 text-slate-400",children:e.jsx(ot,{className:"w-6 h-6 text-emerald-400"})}),e.jsx("div",{className:"text-sm font-semibold text-slate-200",children:"没有符合筛选条件的设备"}),e.jsx("div",{className:"text-xs text-slate-500 mt-1",children:"请尝试放宽筛选条件或切换状态选项卡"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3.5",children:b.map(O=>{const pe=O.versionStatus==="Current"?"emerald":O.versionStatus==="Outdated"?"amber":O.versionStatus==="Unsupported"?"rose":"slate",ne=O.versionStatus==="Current"?"当前版本":O.versionStatus==="Outdated"?"版本落后":O.versionStatus==="Unsupported"?"不受支持":"版本未知";return e.jsxs("div",{className:`rounded-2xl p-4 sm:p-5 border transition-all bg-slate-900/90 ${O.versionStatus==="Unsupported"?"border-rose-900/50 hover:border-rose-500/40":O.versionStatus==="Outdated"?"border-amber-900/40 hover:border-amber-500/40":"border-slate-800 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 pb-3 border-b border-slate-800/70",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-xs sm:text-sm font-semibold text-white flex items-center gap-2",children:[e.jsx("span",{children:O.tenantName}),e.jsx("span",{className:"text-slate-600",children:"·"}),e.jsx("span",{className:"text-slate-300 font-medium",children:O.classroomName})]}),e.jsxs("div",{className:"text-[11px] text-slate-500 font-mono mt-0.5 flex items-center gap-2",children:[e.jsx("span",{children:O.deviceId}),O.hostname&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-700",children:"|"}),e.jsx("span",{children:O.hostname})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[11px] font-medium border ${O.isOnline?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-slate-800 text-slate-400 border-slate-700"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${O.isOnline?"bg-emerald-400 animate-pulse":"bg-slate-500"}`}),O.isOnline?"在线":"离线"]}),e.jsx(it,{label:ne,variant:pe})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 py-3 text-xs border-b border-slate-800/70",children:[e.jsxs("div",{className:"bg-slate-950/60 rounded-xl p-2.5",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Service 服务端"}),e.jsx("div",{className:"font-mono text-slate-200 font-semibold mt-0.5",children:O.serviceVersion||"未上报"})]}),e.jsxs("div",{className:"bg-slate-950/60 rounded-xl p-2.5",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"Client 客户端"}),e.jsx("div",{className:"font-mono text-slate-200 font-semibold mt-0.5",children:O.clientVersion||"未上报"})]}),e.jsxs("div",{className:"bg-slate-950/60 rounded-xl p-2.5",children:[e.jsx("div",{className:"text-[10px] text-slate-500",children:"通信协议"}),e.jsxs("div",{className:"font-mono text-slate-200 font-semibold mt-0.5",children:["v",O.protocolVersion??"1"]})]})]}),e.jsxs("div",{className:"pt-3 flex flex-wrap items-center justify-between gap-2 text-[11px] text-slate-400",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Tf,{className:"w-3.5 h-3.5 text-slate-500"}),e.jsx("span",{children:O.osVersion||"Windows"}),e.jsxs("span",{className:"font-mono text-slate-500",children:["(",O.architecture||"X64",")"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-slate-500 font-mono",children:[e.jsx(os,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["心跳: ",le(O.lastHeartbeatAt)]})]})]}),O.reasons&&O.reasons.length>0&&e.jsx("div",{className:"mt-3 rounded-xl p-2.5 bg-slate-950/80 border border-slate-800/80 text-[11px] space-y-1",children:O.reasons.map((ve,Q)=>e.jsxs("div",{className:`flex items-start gap-1.5 ${O.versionStatus==="Unsupported"?"text-rose-400":O.versionStatus==="Outdated"?"text-amber-400":"text-slate-400"}`,children:[e.jsx(kf,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:ve})]},Q))})]},O.deviceId)})})})]})},Vg=()=>{const{batchId:a}=ph(),l=Rn(),[i,c]=jr(),[u,m]=x.useState(null),[p,b]=x.useState([]),[f,j]=x.useState([]),[k,T]=x.useState(!0),[C,I]=x.useState(null),[P,q]=x.useState(null),v=i.get("health")||"all",w=i.get("probe")||"",M=i.get("tenantId")||"all",Y=i.get("q")||"",z=x.useRef(!0);x.useEffect(()=>{J.getTenants().then(j).catch(()=>{})},[]);const ae=async()=>{if(a)try{const R=await J.getSelfCheckBatch(a);if(!z.current)return;m(R);const W=await J.getSelfCheckBatchDevices(a,{health:v!=="all"?v:void 0,probe:w||void 0,tenantId:M!=="all"?M:void 0,q:Y||void 0,pageSize:100});if(!z.current)return;b(W.items),I(null)}catch(R){if(!z.current)return;I(R.message||"加载批次数据失败")}finally{z.current&&T(!1)}};x.useEffect(()=>(z.current=!0,T(!0),ae(),()=>{z.current=!1}),[a,v,w,M,Y]),x.useEffect(()=>{if(!u||u.status!=="Running")return;const R=setInterval(()=>{ae()},2e3);return()=>clearInterval(R)},[u==null?void 0:u.status,v,w,M,Y]);const le=(R,W)=>{const te=new URLSearchParams(i);!W||W==="all"?te.delete(R):te.set(R,W),c(te)},O=()=>{c(new URLSearchParams)},pe=R=>({service:"Service 守护进程",signalr:"SignalR 长连接",https_ping:"HTTPS 延迟与连通",clock_offset:"系统时钟同步",ipc_pipe:"IPC 命名管道",wpf_client:"WPF 客户端进程",tts_engine:"TTS 语音播报引擎"})[R]||R,ne=u==null?void 0:u.summary,ve=ne&&ne.target>0?Math.round((ne.completed+ne.unreachable+ne.timedOut)/ne.target*100):0,Q=(v!=="all"?1:0)+(w?1:0)+(M!=="all"?1:0)+(Y?1:0);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-1",children:[e.jsxs("button",{onClick:()=>l("/admin/self-check-batches"),className:"text-slate-500 hover:text-slate-700 text-sm font-medium flex items-center",children:[e.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),"自检批次历史"]}),e.jsx("span",{className:"text-slate-300",children:"/"}),e.jsx("span",{className:"text-sm font-semibold text-slate-700 font-mono",children:a})]}),e.jsxs("h1",{className:"text-2xl font-bold text-slate-800 flex items-center gap-3",children:[e.jsx("span",{children:"终端批量自检下钻看板"}),(u==null?void 0:u.status)==="Running"?e.jsxs("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-sky-100 text-sky-800 border border-sky-300",children:[e.jsxs("svg",{className:"animate-spin -ml-0.5 mr-1.5 h-3 w-3 text-sky-600",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"检测执行中 (自动刷新)"]}):e.jsxs("span",{className:"inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-emerald-100 text-emerald-800 border border-emerald-300",children:[e.jsx("svg",{className:"w-3.5 h-3.5 mr-1 text-emerald-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"批次已就绪 (Completed)"]})]}),e.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["创建于: ",u!=null&&u.createdAtUtc?new Date(u.createdAtUtc).toLocaleString("zh-CN"):"-",(u==null?void 0:u.completedAtUtc)&&` · 结束于: ${new Date(u.completedAtUtc).toLocaleString("zh-CN")}`]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:ae,className:"px-4 py-2 border border-slate-300 rounded-lg text-sm text-slate-700 hover:bg-slate-50 transition-colors flex items-center shadow-sm",children:[e.jsx("svg",{className:"w-4 h-4 mr-1.5 text-slate-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"刷新数据"]}),e.jsx("button",{onClick:()=>l("/admin/fleet"),className:"px-4 py-2 bg-indigo-50 border border-indigo-200 text-indigo-700 rounded-lg text-sm font-medium hover:bg-indigo-100 transition-colors shadow-sm",children:"查看版本大盘"})]})]}),e.jsxs("div",{className:"mt-6 pt-5 border-t border-slate-100",children:[e.jsxs("div",{className:"flex justify-between items-center text-sm font-medium text-slate-700 mb-2",children:[e.jsxs("span",{children:["批次推进进度:",((ne==null?void 0:ne.completed)||0)+((ne==null?void 0:ne.unreachable)||0)+((ne==null?void 0:ne.timedOut)||0)," / ",(ne==null?void 0:ne.target)||0," 台完成"]}),e.jsxs("span",{className:"font-semibold text-indigo-600",children:[ve,"%"]})]}),e.jsx("div",{className:"w-full bg-slate-100 rounded-full h-3 overflow-hidden",children:e.jsx("div",{className:`h-full transition-all duration-500 ${(u==null?void 0:u.status)==="Running"?"bg-gradient-to-r from-sky-500 to-indigo-500":"bg-emerald-500"}`,style:{width:`${ve}%`}})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-4",children:[e.jsxs("div",{onClick:()=>le("health","all"),className:`p-4 bg-white rounded-xl border cursor-pointer transition-all ${v==="all"?"border-indigo-500 ring-2 ring-indigo-100 shadow-md":"border-slate-200 hover:border-slate-300 shadow-sm"}`,children:[e.jsx("div",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"目标检测总量"}),e.jsx("div",{className:"mt-1 text-2xl font-bold text-slate-800",children:(ne==null?void 0:ne.target)||0}),e.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"本批次覆盖设备"})]}),e.jsxs("div",{onClick:()=>le("health","Healthy"),className:`p-4 bg-white rounded-xl border cursor-pointer transition-all ${v==="Healthy"?"border-emerald-500 ring-2 ring-emerald-100 shadow-md":"border-slate-200 hover:border-emerald-300 shadow-sm"}`,children:[e.jsxs("div",{className:"text-xs font-semibold text-emerald-600 uppercase tracking-wider flex items-center",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 mr-1.5"}),"正常 (Healthy)"]}),e.jsx("div",{className:"mt-1 text-2xl font-bold text-emerald-600",children:(ne==null?void 0:ne.healthy)||0}),e.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"7 项探针全部达标"})]}),e.jsxs("div",{onClick:()=>le("health","Warning"),className:`p-4 bg-white rounded-xl border cursor-pointer transition-all ${v==="Warning"?"border-amber-500 ring-2 ring-amber-100 shadow-md":"border-slate-200 hover:border-amber-300 shadow-sm"}`,children:[e.jsxs("div",{className:"text-xs font-semibold text-amber-600 uppercase tracking-wider flex items-center",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 mr-1.5"}),"告警 (Warning)"]}),e.jsx("div",{className:"mt-1 text-2xl font-bold text-amber-600",children:(ne==null?void 0:ne.warning)||0}),e.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"存在偏离但未阻断"})]}),e.jsxs("div",{onClick:()=>le("health","Failed"),className:`p-4 bg-white rounded-xl border cursor-pointer transition-all ${v==="Failed"?"border-rose-500 ring-2 ring-rose-100 shadow-md":"border-slate-200 hover:border-rose-300 shadow-sm"}`,children:[e.jsxs("div",{className:"text-xs font-semibold text-rose-600 uppercase tracking-wider flex items-center",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-rose-500 mr-1.5"}),"故障 (Failed)"]}),e.jsx("div",{className:"mt-1 text-2xl font-bold text-rose-600",children:(ne==null?void 0:ne.failed)||0}),e.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"关键探针诊断失败"})]}),e.jsxs("div",{onClick:()=>le("health","Unreachable"),className:`p-4 bg-white rounded-xl border cursor-pointer transition-all ${v==="Unreachable"?"border-gray-500 ring-2 ring-gray-100 shadow-md":"border-slate-200 hover:border-gray-300 shadow-sm"}`,children:[e.jsxs("div",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wider flex items-center",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-gray-400 mr-1.5"}),"不可达 (Unreachable)"]}),e.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-600",children:(ne==null?void 0:ne.unreachable)||0}),e.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"离线未建连真实态"})]}),e.jsxs("div",{onClick:()=>le("health","TimedOut"),className:`p-4 bg-white rounded-xl border cursor-pointer transition-all ${v==="TimedOut"?"border-slate-500 ring-2 ring-slate-100 shadow-md":"border-slate-200 hover:border-slate-300 shadow-sm"}`,children:[e.jsxs("div",{className:"text-xs font-semibold text-slate-600 uppercase tracking-wider flex items-center",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-slate-400 mr-1.5"}),"超时 (TimedOut)"]}),e.jsx("div",{className:"mt-1 text-2xl font-bold text-slate-600",children:(ne==null?void 0:ne.timedOut)||0}),e.jsx("div",{className:"text-xs text-slate-400 mt-1",children:"未在窗口内返回"})]})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-slate-800",children:"7 项核心探针故障聚合"}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:"点击下方探针指标卡,可直接在设备列表中精准下钻到该项异常终端"})]}),w&&e.jsxs("button",{onClick:()=>le("probe",""),className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium bg-indigo-50 px-2.5 py-1 rounded-md border border-indigo-200",children:["清除探针筛选 (",pe(w),") ✕"]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-7 gap-3",children:u==null?void 0:u.probeFailures.map(R=>{const W=w===R.probe,te=R.failedCount>0,Le=R.warningCount>0;return e.jsxs("div",{onClick:()=>{if(W)le("probe","");else{const K=new URLSearchParams(i);K.set("probe",R.probe),te?K.set("health","Failed"):Le&&K.set("health","Warning"),c(K)}},className:`p-3 rounded-lg border text-left cursor-pointer transition-all ${W?"border-indigo-500 bg-indigo-50/50 ring-2 ring-indigo-200 shadow-sm":te?"border-rose-200 bg-rose-50/30 hover:border-rose-300":Le?"border-amber-200 bg-amber-50/30 hover:border-amber-300":"border-slate-200 bg-slate-50/30 hover:border-slate-300"}`,children:[e.jsx("div",{className:"text-xs font-semibold text-slate-700 truncate",title:pe(R.probe),children:pe(R.probe)}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[e.jsxs("span",{className:`font-semibold ${R.failedCount>0?"text-rose-600":"text-slate-400"}`,children:["Failed: ",R.failedCount]}),e.jsxs("span",{className:`font-semibold ${R.warningCount>0?"text-amber-600":"text-slate-400"}`,children:["Warn: ",R.warningCount]})]})]},R.probe)})})]}),e.jsx("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:[{id:"all",label:"全部状态"},{id:"Healthy",label:"正常 Healthy"},{id:"Warning",label:"告警 Warning"},{id:"Failed",label:"故障 Failed"},{id:"Unreachable",label:"离线 Unreachable"},{id:"TimedOut",label:"超时 TimedOut"}].map(R=>e.jsx("button",{onClick:()=>le("health",R.id),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${v===R.id?"bg-indigo-600 text-white shadow-sm":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:R.label},R.id))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("select",{value:M,onChange:R=>le("tenantId",R.target.value),className:"px-3 py-1.5 bg-slate-50 border border-slate-300 rounded-lg text-xs text-slate-700 focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"all",children:"所有所属学校/租户"}),f.map(R=>e.jsx("option",{value:R.id,children:R.name},R.id))]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",placeholder:"搜索设备ID / 班级 / 主机名",value:Y,onChange:R=>le("q",R.target.value),className:"pl-8 pr-3 py-1.5 bg-slate-50 border border-slate-300 rounded-lg text-xs text-slate-700 w-48 sm:w-60 focus:outline-none focus:ring-2 focus:ring-indigo-500"}),e.jsx("svg",{className:"w-3.5 h-3.5 text-slate-400 absolute left-2.5 top-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),Q>0&&e.jsx("button",{onClick:O,className:"text-xs text-rose-600 hover:text-rose-800 font-medium px-2 py-1",children:"重置筛选"})]})]})}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden",children:[e.jsx("div",{className:"px-6 py-4 border-b border-slate-100 flex items-center justify-between",children:e.jsxs("h3",{className:"font-bold text-slate-800",children:["设备自检记录明细",e.jsxs("span",{className:"ml-2 text-xs font-normal text-slate-500",children:["共 ",p.length," 台设备匹配"]})]})}),p.length===0?e.jsxs("div",{className:"p-12 text-center text-slate-400",children:[e.jsx("svg",{className:"w-12 h-12 mx-auto mb-3 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),e.jsx("p",{className:"text-sm",children:"没有匹配当前条件的设备诊断结果"}),Q>0&&e.jsx("button",{onClick:O,className:"mt-3 text-xs text-indigo-600 hover:underline",children:"清除所有过滤条件"})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50/75 border-b border-slate-200 text-slate-600 font-semibold uppercase tracking-wider",children:[e.jsx("th",{className:"py-3 px-4",children:"终端信息"}),e.jsx("th",{className:"py-3 px-4",children:"学校与班级"}),e.jsx("th",{className:"py-3 px-4",children:"流程状态 (RunState)"}),e.jsx("th",{className:"py-3 px-4",children:"健康状态 (Health)"}),e.jsx("th",{className:"py-3 px-4",children:"7 项核心探针摘要"}),e.jsx("th",{className:"py-3 px-4 text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100 text-slate-700",children:p.map(R=>e.jsxs("tr",{className:"hover:bg-slate-50/60 transition-colors",children:[e.jsxs("td",{className:"py-3 px-4",children:[e.jsx("div",{className:"font-semibold text-slate-900 font-mono",children:R.deviceId}),e.jsx("div",{className:"text-[11px] text-slate-500",children:R.hostname||"未分配主机名"})]}),e.jsxs("td",{className:"py-3 px-4",children:[e.jsx("div",{className:"font-medium text-slate-800",children:R.schoolName}),e.jsx("div",{className:"text-[11px] text-slate-500",children:R.classroomName})]}),e.jsx("td",{className:"py-3 px-4",children:R.runState==="Completed"?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-emerald-50 text-emerald-700 border border-emerald-200",children:"已完成"}):R.runState==="Dispatched"?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-sky-50 text-sky-700 border border-sky-200",children:"已调度下发"}):R.runState==="Unreachable"?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-gray-100 text-gray-700 border border-gray-200",children:"不可达 (离线)"}):R.runState==="TimedOut"?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-slate-100 text-slate-700 border border-slate-300",children:"超时未响应"}):e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-amber-50 text-amber-700 border border-amber-200",children:"待调度"})}),e.jsx("td",{className:"py-3 px-4",children:R.overallStatus==="Healthy"?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-emerald-100 text-emerald-800",children:"● 正常 Healthy"}):R.overallStatus==="Warning"?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-amber-100 text-amber-800",children:"● 告警 Warning"}):R.overallStatus==="Failed"?e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium bg-rose-100 text-rose-800",children:"● 故障 Failed"}):e.jsx("span",{className:"text-slate-400",children:"-"})}),e.jsx("td",{className:"py-3 px-4",children:R.checks&&R.checks.length>0?e.jsx("div",{className:"flex flex-wrap gap-1",children:R.checks.map(W=>{const te=W.status===2,Le=W.status===1,K=W.status===0;return e.jsx("span",{title:`${W.name}: ${W.summary}`,className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-mono ${te?"bg-rose-100 text-rose-800 font-bold border border-rose-300":Le?"bg-amber-100 text-amber-800 border border-amber-300":K?"bg-emerald-50 text-emerald-700 border border-emerald-200":"bg-slate-100 text-slate-500"}`,children:W.name},W.name)})}):e.jsx("span",{className:"text-slate-400 italic",children:"暂无探针明细"})}),e.jsx("td",{className:"py-3 px-4 text-right",children:e.jsx("button",{onClick:()=>q(R),className:"px-2.5 py-1 text-xs font-medium text-indigo-600 hover:text-indigo-800 hover:bg-indigo-50 rounded border border-indigo-200 transition-colors",children:"查看诊断"})})]},R.runId))})]})})]}),P&&e.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden bg-slate-900/40 backdrop-blur-sm flex justify-end",children:e.jsxs("div",{className:"w-full max-w-xl bg-white h-full shadow-2xl flex flex-col animate-slide-left",children:[e.jsxs("div",{className:"p-6 border-b border-slate-200 flex items-center justify-between bg-slate-50",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-slate-500 uppercase font-semibold",children:"终端全面诊断详情"}),e.jsx("h3",{className:"text-lg font-bold text-slate-800 font-mono mt-0.5",children:P.deviceId})]}),e.jsx("button",{onClick:()=>q(null),className:"text-slate-400 hover:text-slate-600 p-1.5 rounded-lg hover:bg-slate-200",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"p-6 overflow-y-auto space-y-6 flex-1 text-sm",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 bg-slate-50 p-4 rounded-lg border border-slate-200 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"所属学校:"}),e.jsx("span",{className:"font-medium text-slate-800",children:P.schoolName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"关联班级:"}),e.jsx("span",{className:"font-medium text-slate-800",children:P.classroomName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Service 版本:"}),e.jsx("span",{className:"font-mono text-slate-800",children:P.serviceVersion||"未上报"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"Client 版本:"}),e.jsx("span",{className:"font-mono text-slate-800",children:P.clientVersion||"未上报"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"流程状态:"}),e.jsx("span",{className:"font-medium text-slate-800",children:P.runState})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"诊断结论:"}),e.jsx("span",{className:`font-semibold ${P.overallStatus==="Healthy"?"text-emerald-600":P.overallStatus==="Warning"?"text-amber-600":P.overallStatus==="Failed"?"text-rose-600":"text-slate-500"}`,children:P.overallStatus||"无结果"})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-bold text-slate-800 mb-3 text-sm flex items-center justify-between",children:[e.jsx("span",{children:"7 项核心探针执行报告"}),e.jsxs("span",{className:"text-xs font-normal text-slate-500",children:[P.checks.length," 项完成"]})]}),e.jsx("div",{className:"space-y-3",children:P.checks.map(R=>{const W=R.status===2,te=R.status===1,Le=R.status===0;return e.jsxs("div",{className:`p-3.5 rounded-lg border text-xs ${W?"bg-rose-50/40 border-rose-200":te?"bg-amber-50/40 border-amber-200":Le?"bg-emerald-50/40 border-emerald-200":"bg-slate-50 border-slate-200"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsxs("span",{className:"font-bold text-slate-900 flex items-center gap-1.5",children:[R.name,e.jsxs("span",{className:"font-mono font-normal text-[11px] text-slate-500",children:["(",pe(R.name.toLowerCase()),")"]})]}),e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold ${W?"bg-rose-100 text-rose-800":te?"bg-amber-100 text-amber-800":Le?"bg-emerald-100 text-emerald-800":"bg-slate-200 text-slate-700"}`,children:W?"× Failed":te?"! Warning":Le?"✓ Healthy":"Skipped"})]}),e.jsx("div",{className:"text-slate-700 mt-1",children:R.summary}),e.jsxs("div",{className:"mt-2 pt-2 border-t border-slate-200/60 flex items-center justify-between text-[11px] text-slate-500 font-mono",children:[e.jsxs("span",{children:["代码: ",R.code||"-"]}),R.latencyMs!==void 0&&R.latencyMs!==null&&e.jsxs("span",{children:["延迟: ",R.latencyMs,"ms"]})]})]},R.name)})})]}),e.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg border border-slate-200 text-xs font-mono space-y-1.5 text-slate-600",children:[e.jsx("div",{className:"text-slate-400 font-sans uppercase font-bold text-[10px] mb-1",children:"追踪上下文"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"RunId:"})," ",P.runId]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"CorrelationId:"})," ",P.correlationId]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"请求时间:"})," ",new Date(P.requestedAtUtc).toLocaleString("zh-CN")]}),P.completedAtUtc&&e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"完成时间:"})," ",new Date(P.completedAtUtc).toLocaleString("zh-CN")]})]})]}),e.jsx("div",{className:"p-4 border-t border-slate-200 bg-slate-50 text-right",children:e.jsx("button",{onClick:()=>q(null),className:"px-4 py-2 bg-white border border-slate-300 rounded-lg text-sm text-slate-700 hover:bg-slate-100",children:"关闭抽屉"})})]})})]})},Wg=()=>{const a=Rn(),[l,i]=x.useState([]),[c,u]=x.useState(!0),[m,p]=x.useState(null),b=async()=>{try{u(!0);const f=await J.getSelfCheckBatches(void 0,30);i(f),p(null)}catch(f){p(f.message||"加载自检批次历史失败")}finally{u(!1)}};return x.useEffect(()=>{b()},[]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-6 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800",children:"终端批量自检历史批次"}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"查看历次全网或跨校批量自检执行结果、完成度与健康状态收敛指标"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:b,className:"px-4 py-2 border border-slate-300 rounded-lg text-sm text-slate-700 hover:bg-slate-50 transition-colors flex items-center shadow-sm",children:[e.jsx("svg",{className:"w-4 h-4 mr-1.5 text-slate-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"刷新列表"]}),e.jsxs("button",{onClick:()=>a("/admin/devices"),className:"px-4 py-2 bg-indigo-600 text-white rounded-lg text-sm font-medium hover:bg-indigo-700 transition-colors shadow-sm flex items-center",children:[e.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"前往设备列表发起自检"]})]})]}),c?e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-12 text-center text-slate-400",children:[e.jsx("div",{className:"inline-block animate-spin w-8 h-8 border-4 border-indigo-600 border-t-transparent rounded-full mb-3"}),e.jsx("p",{className:"text-sm",children:"正在加载自检批次记录..."})]}):m?e.jsxs("div",{className:"bg-rose-50 border border-rose-200 text-rose-700 rounded-xl p-6 text-center",children:[e.jsx("p",{className:"font-semibold",children:m}),e.jsx("button",{onClick:b,className:"mt-3 px-4 py-1.5 bg-rose-600 text-white rounded-lg text-xs hover:bg-rose-700",children:"重试"})]}):l.length===0?e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-12 text-center text-slate-400",children:[e.jsx("svg",{className:"w-12 h-12 mx-auto mb-3 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),e.jsx("p",{className:"text-sm font-medium",children:"暂无自检批次记录"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"可在“设备管理”页面多选设备后点击“批量运行自检”创建批次"})]}):e.jsx("div",{className:"space-y-4",children:l.map(f=>{const j=f.completed+f.unreachable+f.timedOut,k=f.target>0?Math.round(j/f.target*100):0,T=f.status==="Running";return e.jsx("div",{onClick:()=>a(`/admin/self-check-batches/${f.batchId}`),className:"bg-white rounded-xl shadow-sm border border-slate-200 p-5 hover:border-indigo-400 hover:shadow-md transition-all cursor-pointer",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-mono font-bold text-slate-900 text-sm",children:f.batchId}),T?e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold bg-sky-100 text-sky-800",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-600 animate-pulse mr-1"}),"运行中 (Running)"]}):e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-semibold bg-emerald-100 text-emerald-800",children:"✓ 已完成 (Completed)"})]}),e.jsxs("div",{className:"text-xs text-slate-400",children:["创建时间: ",new Date(f.createdAtUtc).toLocaleString("zh-CN"),f.completedAtUtc&&` · 结束: ${new Date(f.completedAtUtc).toLocaleString("zh-CN")}`]})]}),e.jsxs("div",{className:"w-full md:w-64",children:[e.jsxs("div",{className:"flex justify-between text-xs font-medium text-slate-600 mb-1",children:[e.jsxs("span",{children:["进度 ",j," / ",f.target," 台"]}),e.jsxs("span",{children:[k,"%"]})]}),e.jsx("div",{className:"w-full bg-slate-100 rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:`h-full ${T?"bg-sky-500":"bg-emerald-500"}`,style:{width:`${k}%`}})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("span",{className:"px-2 py-1 rounded bg-emerald-50 text-emerald-700 font-medium",children:["正常: ",f.healthy]}),e.jsxs("span",{className:"px-2 py-1 rounded bg-amber-50 text-amber-700 font-medium",children:["告警: ",f.warning]}),e.jsxs("span",{className:"px-2 py-1 rounded bg-rose-50 text-rose-700 font-medium",children:["故障: ",f.failed]}),e.jsxs("span",{className:"px-2 py-1 rounded bg-gray-100 text-gray-700 font-medium",children:["离线: ",f.unreachable]}),e.jsxs("span",{className:"px-2 py-1 rounded bg-slate-100 text-slate-700 font-medium",children:["超时: ",f.timedOut]}),e.jsx("button",{onClick:C=>{C.stopPropagation(),a(`/admin/self-check-batches/${f.batchId}`)},className:"ml-3 px-3 py-1.5 bg-indigo-50 text-indigo-700 rounded-lg font-medium hover:bg-indigo-100 border border-indigo-200 transition-colors",children:"查看详情 →"})]})]})},f.batchId)})})]})},Kg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState(null),[u,m]=x.useState(!0),[p,b]=x.useState(""),[f,j]=x.useState("all"),k=async()=>{try{const[v,w]=await Promise.all([J.getLicenseRecords(100),J.getLicenseRecordsSummary()]);l(v),c(w)}catch(v){console.error("Failed to load license records",v)}finally{m(!1)}};x.useEffect(()=>{k();const v=setInterval(k,1e4);return()=>clearInterval(v)},[]);const T=v=>{if(!v)return"无 / 买断永久";try{return new Date(v).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return v}},C=a.filter(v=>{const w=v.deviceId.toLowerCase().includes(p.toLowerCase())||v.tenantId.toLowerCase().includes(p.toLowerCase())||v.classroomId.toLowerCase().includes(p.toLowerCase())||v.operatorUsername&&v.operatorUsername.toLowerCase().includes(p.toLowerCase())||v.reason&&v.reason.toLowerCase().includes(p.toLowerCase())||v.clientRequestId&&v.clientRequestId.toLowerCase().includes(p.toLowerCase()),M=f==="all"||v.action.toLowerCase()===f.toLowerCase();return w&&M}),I=(i==null?void 0:i.totalRecords)??a.length,P=(i==null?void 0:i.perpetualCount)??a.filter(v=>v.licenseTier==="Perpetual"||!v.newLicensedUntil).length,q=(i==null?void 0:i.totalGrantedDays)??a.filter(v=>(v.grantedDays||0)>0).reduce((v,w)=>v+(w.grantedDays||0),0);return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"商业授权流水账本",description:"全生命周期商业授权变动留痕:精确审计每一台教室大屏的激活、批量直延、激活码兑换、学年续费与终身买断流水。",badge:"财务与授权审计",action:e.jsxs("button",{onClick:()=>{m(!0),k()},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold transition-colors border border-slate-700 shadow-sm",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`}),"刷新流水"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"总计正向授权流水"}),e.jsx(Ll,{className:"w-4 h-4 text-sky-400"})]}),e.jsx("div",{className:"text-2xl font-bold text-white mt-2 font-mono",children:I}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"服务端权威聚合 (排除测试合成干扰)"})]}),e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"累计续期发放天数"}),e.jsx(Ul,{className:"w-4 h-4 text-emerald-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-emerald-400 mt-2 font-mono",children:[q.toLocaleString()," ",e.jsx("span",{className:"text-sm font-normal text-slate-400",children:"天"})]}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"按标准学年/学期自然日合规顺延"})]}),e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"永久授权终端生效数"}),e.jsx(Nf,{className:"w-4 h-4 text-purple-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-purple-300 mt-2 font-mono",children:[P," ",e.jsx("span",{className:"text-sm font-normal text-slate-400",children:"台"})]}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"买断制商用终身授权终端"})]})]}),e.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsx("div",{className:"flex-1 w-full sm:w-auto",children:e.jsxs("div",{className:"flex items-center gap-2 bg-slate-950/60 border border-slate-800 rounded-xl px-3 py-2 text-xs",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("input",{type:"text",value:p,onChange:v=>b(v.target.value),placeholder:"搜索终端编号、学校租户ID、教室ID、操作人、单号或备注...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]})}),e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsx(Oc,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsxs("select",{value:f,onChange:v=>j(v.target.value),className:"bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-slate-200 focus:border-indigo-500 outline-none w-full sm:w-auto",children:[e.jsx("option",{value:"all",children:"所有操作类型"}),e.jsx("option",{value:"BatchRenew",children:"批量续期 (BatchRenew)"}),e.jsx("option",{value:"Renew",children:"单台延期 (Renew)"}),e.jsx("option",{value:"Activate",children:"激活绑定 (Activate)"}),e.jsx("option",{value:"Redeem",children:"激活码兑换 (Redeem)"})]})]})]}),e.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden rounded-2xl",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{className:"text-[11px] uppercase tracking-wider text-slate-400 bg-slate-900/80 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"变更时间 / 流水号"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"目标终端与学校"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"授权类型 / 等级"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"到期日变动流水"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"操作经办人"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"原因与审计单号"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60 font-sans",children:C.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"text-center py-12 text-slate-500",children:u?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(xt,{className:"w-4 h-4 animate-spin text-indigo-400"}),e.jsx("span",{children:"正在调取商业授权账本..."})]}):"暂无符合条件的商业授权变更记录"})}):C.map(v=>e.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsx("div",{className:"font-mono text-slate-300 font-medium",children:T(v.createdAt)}),e.jsxs("div",{className:"text-[10px] font-mono text-slate-500 mt-0.5 truncate max-w-[120px]",title:v.id,children:["ID: ",v.id.substring(0,8),"..."]})]}),e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsxs("div",{className:"font-mono font-semibold text-white flex items-center gap-1.5",children:[e.jsx(rt,{className:"w-3.5 h-3.5 text-sky-400 shrink-0"}),v.deviceId]}),e.jsxs("div",{className:"text-[11px] text-slate-400 flex items-center gap-2 mt-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ks,{className:"w-3 h-3 text-slate-500"}),v.tenantId]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["教室: ",v.classroomId]})]})]}),e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold ${v.licenseTier==="Perpetual"?"bg-purple-950 text-purple-300 border border-purple-800":v.licenseTier==="Academic"||v.licenseTier==="AcademicYear"?"bg-indigo-950 text-indigo-300 border border-indigo-800":"bg-emerald-950 text-emerald-300 border border-emerald-800"}`,children:v.licenseTier}),e.jsx("span",{className:"text-[11px] font-mono text-slate-400",children:v.action})]}),v.grantedDays&&e.jsxs("div",{className:"text-[11px] text-emerald-400 font-mono mt-1",children:["+",v.grantedDays," 天"]})]}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[e.jsx("span",{className:"text-slate-400 line-through",children:v.previousLicensedUntil?T(v.previousLicensedUntil).split(" ")[0]:"初始/欠费"}),e.jsx(vs,{className:"w-3 h-3 text-slate-500 shrink-0"}),e.jsx("span",{className:v.licenseTier==="Perpetual"?"text-purple-300 font-bold":"text-emerald-400 font-bold",children:v.licenseTier==="Perpetual"?"永久有效 (终身)":T(v.newLicensedUntil).split(" ")[0]})]})}),e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-slate-200",children:[e.jsx(Bs,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),e.jsx("span",{className:"font-medium",children:v.operatorUsername||"系统自管"})]}),v.sourceActivationCode&&e.jsxs("div",{className:"text-[10px] font-mono text-amber-400 mt-0.5",children:["码: ",v.sourceActivationCode]})]}),e.jsxs("td",{className:"py-3.5 px-4 max-w-xs",children:[e.jsx("div",{className:"text-slate-300 truncate",title:v.reason||"无备注",children:v.reason||"管理员批量续期"}),v.clientRequestId&&e.jsxs("div",{className:"text-[10px] font-mono text-slate-500 mt-0.5 truncate",title:`幂等单号: ${v.clientRequestId}`,children:["单号: ",v.clientRequestId.substring(0,16),"..."]})]})]},v.id))})]})})})]})},qg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState(!0),[u,m]=x.useState(""),[p,b]=x.useState("all"),f=async()=>{try{const I=await J.getAuditLogs(100);l(I)}catch(I){console.error("Failed to load audit logs",I)}finally{c(!1)}};x.useEffect(()=>{f();const I=setInterval(f,1e4);return()=>clearInterval(I)},[]);const j=I=>{try{return new Date(I).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return I}},k=a.filter(I=>{const P=I.actorUsername.toLowerCase().includes(u.toLowerCase())||I.action.toLowerCase().includes(u.toLowerCase())||I.targetType.toLowerCase().includes(u.toLowerCase())||I.targetId.toLowerCase().includes(u.toLowerCase())||I.details&&I.details.toLowerCase().includes(u.toLowerCase())||I.ipAddress&&I.ipAddress.toLowerCase().includes(u.toLowerCase()),q=p==="all"||I.actorRole.toLowerCase()===p.toLowerCase();return P&&q}),T=a.filter(I=>I.actorRole==="SuperAdmin").length,C=a.filter(I=>I.actorRole==="SchoolAdmin").length;return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"全量安全与运维审计日志",description:"系统级全生命周期合规审计:严密留存超级管理员、校级管理员以及系统自动化组件的关键控制操作与安全行为。",badge:"安全合规中心",action:e.jsxs("button",{onClick:()=>{c(!0),f()},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold transition-colors border border-slate-700 shadow-sm",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`}),"刷新审计"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"系统审计事件数"}),e.jsx(cn,{className:"w-4 h-4 text-sky-400"})]}),e.jsx("div",{className:"text-2xl font-bold text-white mt-2 font-mono",children:a.length}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"最近关键管理操作留痕"})]}),e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"超管运维操作"}),e.jsx(Ht,{className:"w-4 h-4 text-amber-400"})]}),e.jsx("div",{className:"text-2xl font-bold text-amber-300 mt-2 font-mono",children:T}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"租户建立、批量续期、指令下发"})]}),e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"校管及终端操作"}),e.jsx(tl,{className:"w-4 h-4 text-indigo-400"})]}),e.jsx("div",{className:"text-2xl font-bold text-indigo-300 mt-2 font-mono",children:C}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"班级调配、教师赋权、终端续期"})]})]}),e.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsx("div",{className:"flex-1 w-full sm:w-auto",children:e.jsxs("div",{className:"flex items-center gap-2 bg-slate-950/60 border border-slate-800 rounded-xl px-3 py-2 text-xs",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("input",{type:"text",value:u,onChange:I=>m(I.target.value),placeholder:"搜索操作者、动作关键字、目标资源、IP地址或审计明细...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]})}),e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsx(Oc,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsxs("select",{value:p,onChange:I=>b(I.target.value),className:"bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-slate-200 focus:border-indigo-500 outline-none w-full sm:w-auto",children:[e.jsx("option",{value:"all",children:"所有身份角色"}),e.jsx("option",{value:"SuperAdmin",children:"超级管理员 (SuperAdmin)"}),e.jsx("option",{value:"SchoolAdmin",children:"学校管理员 (SchoolAdmin)"}),e.jsx("option",{value:"Teacher",children:"教师 (Teacher)"}),e.jsx("option",{value:"System",children:"系统服务 (System)"})]})]})]}),e.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden rounded-2xl",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{className:"text-[11px] uppercase tracking-wider text-slate-400 bg-slate-900/80 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"触发时间戳"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"操作主体 (Actor)"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"执行行为 (Action)"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"目标资源 (Target)"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"网络来源 (IP)"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"详细审计上下文"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60 font-sans",children:k.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"text-center py-12 text-slate-500",children:i?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(xt,{className:"w-4 h-4 animate-spin text-indigo-400"}),e.jsx("span",{children:"正在检索审计安全事件..."})]}):"暂无匹配的审计安全记录"})}):k.map(I=>e.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[e.jsxs("td",{className:"py-3.5 px-4 whitespace-nowrap",children:[e.jsx("div",{className:"font-mono text-slate-300 font-medium",children:j(I.occurredAt)}),e.jsxs("div",{className:"text-[10px] font-mono text-slate-500 mt-0.5 truncate max-w-[110px]",title:I.id,children:["LOG: ",I.id.substring(0,8),"..."]})]}),e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-white",children:[e.jsx(Bs,{className:"w-3.5 h-3.5 text-slate-400"}),e.jsx("span",{children:I.actorUsername})]}),e.jsx("div",{className:"mt-1",children:e.jsx("span",{className:`px-2 py-0.2 rounded-full text-[10px] font-semibold ${I.actorRole==="SuperAdmin"?"bg-amber-950/80 text-amber-300 border border-amber-800/60":I.actorRole==="SchoolAdmin"?"bg-sky-950/80 text-sky-300 border border-sky-800/60":"bg-emerald-950/80 text-emerald-300 border border-emerald-800/60"}`,children:I.actorRole})})]}),e.jsx("td",{className:"py-3.5 px-4 font-mono font-medium text-sky-300",children:I.action}),e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsx("div",{className:"text-slate-300 font-medium text-[11px]",children:I.targetType}),e.jsx("div",{className:"text-[10px] font-mono text-slate-500 truncate max-w-[140px]",title:I.targetId,children:I.targetId})]}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsxs("div",{className:"font-mono text-slate-400 flex items-center gap-1",children:[e.jsx(bf,{className:"w-3 h-3 text-slate-500"}),e.jsx("span",{children:I.ipAddress||"内网/本地"})]})}),e.jsx("td",{className:"py-3.5 px-4 max-w-sm",children:e.jsx("div",{className:"text-slate-300 font-mono text-[11px] break-all line-clamp-2",title:I.details,children:I.details||"无扩展详情"})})]},I.id))})]})})})]})},E0=()=>{const[a]=jr(),l=a.get("tab")==="blocked"||a.get("onlyBlocked")==="true"?"blocked":"all",[i,c]=x.useState([]),[u,m]=x.useState(!0),[p,b]=x.useState(""),[f,j]=x.useState(l),[k,T]=x.useState("all"),[C,I]=x.useState(null),[P,q]=x.useState(null),[v,w]=x.useState(""),[M,Y]=x.useState(72),[z,ae]=x.useState(!1),[le,O]=x.useState(null),[pe,ne]=x.useState(null),[ve,Q]=x.useState(!1),R=async()=>{try{m(!0);const g=await J.getTrialLedgers({tenantId:k==="all"?void 0:k,q:p?p.trim():void 0,onlyBlocked:f==="blocked",overrideState:f==="override_granted"?"Granted":f==="override_consumed"?"Consumed":void 0,limit:200});c(g)}catch(g){console.error("Failed to load trial ledgers",g)}finally{m(!1)}};x.useEffect(()=>{R();const g=setInterval(R,15e3);return()=>clearInterval(g)},[f,k]);const W=g=>{g.preventDefault(),R()},te=async()=>{if(P){if(!v.trim()){O("特批原因不能为空,必须记录具体业务原因以供安全审计");return}try{ae(!0),O(null);const g=await J.grantTrialOverride(P.id,{reason:v.trim(),validHours:M});g.success?(q(null),w(""),await R(),C&&C.id===P.id&&g.ledger&&I(g.ledger)):O(g.message||"特批放行失败")}catch(g){O(g.message||"特批放行发生异常")}finally{ae(!1)}}},Le=async g=>{try{Q(!0),(await J.revokeTrialOverride(g,{reason:"超管人工撤销放行"})).success&&(ne(null),await R(),C&&C.id===g&&I({...C,overrideState:"Revoked",overrideRemainingUses:0}))}catch(B){alert(B.message||"撤销特批失败")}finally{Q(!1)}},K=g=>{if(!g)return"无";try{return new Date(g).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return g}},Z=i.length,G=i.filter(g=>g.blockedAttemptCount>0).length,re=i.filter(g=>g.overrideState==="Granted").length,se=i.filter(g=>g.overrideState==="Consumed").length;return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"试用防刷与硬件审计中枢",description:"服务端防薅羊毛核心风控:基于底层物理硬件指纹(HMAC脱敏审计)严格封堵设备卸载重装试用漏洞,提供合规单次有期限人工特批通道。",badge:"安全风控中枢",action:e.jsxs("button",{onClick:R,disabled:u,className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold transition-colors border border-slate-700 shadow-sm disabled:opacity-50",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`}),"刷新风控台账"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{onClick:()=>j("all"),className:`glass-panel p-4 rounded-2xl border transition-all cursor-pointer ${f==="all"?"border-indigo-500/50 bg-indigo-950/20":"border-slate-800 bg-slate-900/40 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"已登记物理设备"}),e.jsx(_t,{className:"w-4 h-4 text-indigo-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-white mt-2 font-mono",children:[Z," ",e.jsx("span",{className:"text-sm font-normal text-slate-400",children:"台"})]}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"首激活物理硬件指纹账本"})]}),e.jsxs("div",{onClick:()=>j("blocked"),className:`glass-panel p-4 rounded-2xl border transition-all cursor-pointer ${f==="blocked"?"border-rose-500/50 bg-rose-950/20":"border-slate-800 bg-slate-900/40 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"拦截重复试用设备"}),e.jsx(fa,{className:"w-4 h-4 text-rose-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-rose-400 mt-2 font-mono",children:[G," ",e.jsx("span",{className:"text-sm font-normal text-slate-400",children:"台"})]}),e.jsx("div",{className:"text-[11px] text-rose-400/80 mt-1",children:"卸载重装或多码刷试用被拒"})]}),e.jsxs("div",{onClick:()=>j("override_granted"),className:`glass-panel p-4 rounded-2xl border transition-all cursor-pointer ${f==="override_granted"?"border-amber-500/50 bg-amber-950/20":"border-slate-800 bg-slate-900/40 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"当前有效特批放行"}),e.jsx(Ht,{className:"w-4 h-4 text-amber-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-amber-300 mt-2 font-mono",children:[re," ",e.jsx("span",{className:"text-sm font-normal text-slate-400",children:"次"})]}),e.jsx("div",{className:"text-[11px] text-amber-400/80 mt-1",children:"单次有期限·等待兑换使用"})]}),e.jsxs("div",{onClick:()=>j("override_consumed"),className:`glass-panel p-4 rounded-2xl border transition-all cursor-pointer ${f==="override_consumed"?"border-emerald-500/50 bg-emerald-950/20":"border-slate-800 bg-slate-900/40 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"已消费特批额度"}),e.jsx(ot,{className:"w-4 h-4 text-emerald-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-emerald-400 mt-2 font-mono",children:[se," ",e.jsx("span",{className:"text-sm font-normal text-slate-400",children:"台"})]}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"特批资格已在激活中核销闭环"})]})]}),e.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 p-1 bg-slate-950/60 border border-slate-800 rounded-xl",children:[e.jsxs("button",{onClick:()=>j("all"),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${f==="all"?"bg-indigo-600 text-white shadow-sm":"text-slate-400 hover:text-slate-200"}`,children:["全部设备 (",Z,")"]}),e.jsxs("button",{onClick:()=>j("blocked"),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${f==="blocked"?"bg-rose-600 text-white shadow-sm":"text-slate-400 hover:text-rose-300"}`,children:["有拦截记录 (",G,")"]}),e.jsxs("button",{onClick:()=>j("override_granted"),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${f==="override_granted"?"bg-amber-600 text-white shadow-sm":"text-slate-400 hover:text-amber-300"}`,children:["人工放行待用 (",re,")"]}),e.jsxs("button",{onClick:()=>j("override_consumed"),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors ${f==="override_consumed"?"bg-emerald-600 text-white shadow-sm":"text-slate-400 hover:text-emerald-300"}`,children:["已消费 (",se,")"]})]}),e.jsx("form",{onSubmit:W,className:"flex-1 max-w-md w-full",children:e.jsxs("div",{className:"flex items-center gap-2 bg-slate-950/60 border border-slate-800 rounded-xl px-3 py-2 text-xs",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("input",{type:"text",value:p,onChange:g=>b(g.target.value),placeholder:"搜索终端编号、主机名、班级、学校租户或券码ID (不暴露明文)...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"}),p&&e.jsx("button",{type:"button",onClick:()=>{b(""),setTimeout(R,50)},className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-3.5 h-3.5"})})]})})]}),e.jsx("div",{className:"glass-panel overflow-hidden border-slate-800 rounded-2xl",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs text-slate-300",children:[e.jsx("thead",{className:"bg-slate-950/60 text-slate-400 font-semibold border-b border-slate-800 uppercase tracking-wider text-[11px]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-4",children:"设备指纹 / 标识"}),e.jsx("th",{className:"py-3.5 px-4",children:"所属租户空间"}),e.jsx("th",{className:"py-3.5 px-4",children:"首次试用 / 截止"}),e.jsx("th",{className:"py-3.5 px-4 text-center",children:"拦截次数"}),e.jsx("th",{className:"py-3.5 px-4",children:"特批放行状态"}),e.jsx("th",{className:"py-3.5 px-4 text-right",children:"操作管理"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:u&&i.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:6,className:"py-12 text-center text-slate-500",children:[e.jsx(xt,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-indigo-400"}),"正在同步服务端硬件风控账本..."]})}):i.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-12 text-center text-slate-500",children:"暂无符合条件的试用风控记录"})}):i.map(g=>e.jsxs("tr",{className:"hover:bg-slate-900/40 transition-colors",children:[e.jsx("td",{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-slate-800/80 border border-slate-700/60 text-indigo-400",children:e.jsx(_t,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-semibold text-white flex items-center gap-1.5",children:[e.jsx("span",{children:g.classroomName||g.classroomId||"未关联班级"}),g.hostname&&e.jsxs("span",{className:"text-[10px] text-slate-400 font-mono",children:["(",g.hostname,")"]})]}),e.jsxs("div",{className:"text-[11px] font-mono text-slate-400 flex items-center gap-1 mt-0.5",children:[e.jsx("span",{className:"text-slate-500",children:"指纹:"}),e.jsx("span",{className:"bg-slate-950/80 px-1.5 py-0.5 rounded border border-slate-800 text-amber-300 font-mono",children:g.maskedFingerprint}),e.jsxs("span",{className:"text-slate-500 text-[10px]",children:["ID: ",g.originalDeviceId?g.originalDeviceId.slice(0,10)+"...":"未知"]})]})]})]})}),e.jsxs("td",{className:"py-3 px-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ks,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),e.jsx("span",{className:"text-slate-200",children:g.tenantName||g.originalTenantId||"默认租户"})]}),e.jsx("span",{className:`inline-block mt-1 text-[10px] px-1.5 py-0.5 rounded border ${g.tenantType==="Personal"?"bg-teal-950/50 text-teal-400 border-teal-800/40":"bg-indigo-950/50 text-indigo-400 border-indigo-800/40"}`,children:g.tenantType==="Personal"?"个人独立空间":"学校租户"})]}),e.jsxs("td",{className:"py-3 px-4",children:[e.jsxs("div",{className:"text-slate-300 flex items-center gap-1",children:[e.jsx(Ul,{className:"w-3 h-3 text-slate-500"}),e.jsxs("span",{children:["首试: ",K(g.firstTrialStartedAtUtc)]})]}),e.jsxs("div",{className:"text-slate-400 text-[11px] flex items-center gap-1 mt-0.5",children:[e.jsx(os,{className:"w-3 h-3 text-slate-500"}),e.jsxs("span",{children:["截止: ",K(g.trialEndsAtUtc)]})]})]}),e.jsx("td",{className:"py-3 px-4 text-center",children:g.blockedAttemptCount>0?e.jsxs("div",{className:"inline-flex flex-col items-center",children:[e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-rose-500/20 text-rose-400 border border-rose-500/30 font-mono",children:[g.blockedAttemptCount," 次拦截"]}),g.lastBlockedAtUtc&&e.jsxs("span",{className:"text-[10px] text-slate-500 mt-0.5",children:["最近: ",K(g.lastBlockedAtUtc).split(" ")[1]||"今日"]})]}):e.jsx("span",{className:"text-slate-500 font-mono",children:"0 次"})}),e.jsxs("td",{className:"py-3 px-4",children:[g.overrideState==="Granted"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-amber-500/20 text-amber-300 border border-amber-500/40",children:[e.jsx(Ht,{className:"w-3 h-3"}),"已特批 · 待使用"]}),g.overrideState==="Consumed"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-emerald-500/20 text-emerald-300 border border-emerald-500/40",children:[e.jsx(ot,{className:"w-3 h-3"}),"已核销使用"]}),g.overrideState==="Revoked"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700",children:[e.jsx(C0,{className:"w-3 h-3"}),"已撤销"]}),g.overrideState==="Expired"&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-slate-800 text-slate-500 border border-slate-700",children:[e.jsx(os,{className:"w-3 h-3"}),"特批已过期"]}),(!g.overrideState||g.overrideState==="None")&&e.jsx("span",{className:"text-slate-500 text-xs",children:"严格防刷中"})]}),e.jsx("td",{className:"py-3 px-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsxs("button",{onClick:()=>I(g),className:"px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors border border-slate-700 flex items-center gap-1",children:[e.jsx(Q0,{className:"w-3.5 h-3.5"}),"审计详情"]}),g.overrideState==="Granted"?e.jsxs("button",{onClick:()=>Le(g.id),disabled:ve,className:"px-2.5 py-1 rounded-lg bg-rose-950/60 hover:bg-rose-900/60 text-rose-300 text-xs font-medium transition-colors border border-rose-800/60 flex items-center gap-1 disabled:opacity-50",children:[e.jsx(C0,{className:"w-3.5 h-3.5"}),"撤销放行"]}):e.jsxs("button",{onClick:()=>{q(g),w(""),Y(72),O(null)},className:"px-2.5 py-1 rounded-lg bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 text-xs font-medium transition-colors border border-amber-500/40 flex items-center gap-1",children:[e.jsx(Ht,{className:"w-3.5 h-3.5"}),"特批放行"]})]})})]},g.id))})]})})}),C&&e.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden bg-black/60 backdrop-blur-sm flex justify-end",children:e.jsxs("div",{className:"w-full max-w-lg bg-slate-900 border-l border-slate-800 h-full p-6 overflow-y-auto space-y-6 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ht,{className:"w-5 h-5 text-indigo-400"}),e.jsx("h3",{className:"text-base font-bold text-white",children:"物理设备试用审计详情"})]}),e.jsx("button",{onClick:()=>I(null),className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:e.jsx(Xt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-950/80 border border-slate-800 space-y-2",children:[e.jsx("div",{className:"text-xs text-slate-400",children:"设备与所属组织"}),e.jsxs("div",{className:"text-sm font-bold text-white",children:[C.tenantName," / ",C.classroomName||"未命名班级"]}),e.jsxs("div",{className:"text-xs text-slate-400 font-mono",children:["主机名: ",C.hostname||"未上报"," | 终端ID: ",C.originalDeviceId||"未知"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"物理硬件身份特征"}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 space-y-2.5",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"text-slate-400",children:"脱敏硬件指纹:"}),e.jsx("span",{className:"font-mono text-amber-300 font-bold bg-amber-950/40 px-2 py-0.5 rounded border border-amber-800/40",children:C.maskedFingerprint})]}),e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"text-slate-400",children:"指纹算法版本:"}),e.jsxs("span",{className:"font-mono text-slate-300",children:["v",C.fingerprintVersion," (HMAC-SHA256)"]})]}),e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"text-slate-400",children:"首绑试用券ID:"}),e.jsx("span",{className:"font-mono text-slate-400",children:C.sourceActivationCodeId||"原始激活"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"试用生命周期"}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 space-y-2.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:"首次激活试用时间:"}),e.jsx("span",{className:"text-slate-200",children:K(C.firstTrialStartedAtUtc)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:"免费试用截止时间:"}),e.jsx("span",{className:"text-slate-200",children:K(C.trialEndsAtUtc)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:"当前台账状态:"}),e.jsx("span",{className:"text-slate-200 font-semibold",children:C.status})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"风控拦截历史"}),e.jsxs("div",{className:"p-4 rounded-xl bg-rose-950/20 border border-rose-900/40 space-y-2 text-xs",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:"拦截重复试用次数:"}),e.jsxs("span",{className:"font-bold font-mono text-rose-400 text-sm",children:[C.blockedAttemptCount," 次"]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:"最近一次拦截时间:"}),e.jsx("span",{className:"text-slate-300",children:K(C.lastBlockedAtUtc)})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"超管人工特批权益"}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 space-y-2 text-xs",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:"当前特批状态:"}),e.jsx("span",{className:"font-semibold text-white",children:C.overrideState})]}),C.overrideExpiresAtUtc&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:"特批失效截止:"}),e.jsx("span",{className:"text-amber-300",children:K(C.overrideExpiresAtUtc)})]}),C.overrideReason&&e.jsxs("div",{className:"pt-2 border-t border-slate-800 text-slate-300",children:[e.jsx("div",{className:"text-slate-400 mb-1",children:"特批原因:"}),e.jsxs("div",{className:"p-2 rounded bg-slate-900 border border-slate-800 text-slate-200 italic",children:['"',C.overrideReason,'"']})]}),C.overrideGrantedByUserId&&e.jsxs("div",{className:"flex justify-between items-center text-slate-400 text-[11px] pt-1",children:[e.jsxs("span",{children:["特批管理员: ",C.overrideGrantedByUserId]}),e.jsx("span",{children:K(C.overrideGrantedAtUtc)})]})]})]}),e.jsx("div",{className:"pt-4 border-t border-slate-800 flex items-center justify-end gap-3",children:C.overrideState==="Granted"?e.jsx("button",{onClick:()=>Le(C.id),disabled:ve,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold transition-colors disabled:opacity-50",children:"撤销该特批放行"}):e.jsx("button",{onClick:()=>{q(C),w(""),Y(72),O(null)},className:"px-4 py-2 rounded-xl bg-amber-500 hover:bg-amber-400 text-slate-950 text-xs font-bold transition-colors",children:"人工特批放行一次"})})]})}),P&&e.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden bg-black/70 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md max-h-[90vh] overflow-y-auto bg-slate-900 border border-slate-800 rounded-2xl p-6 space-y-4 shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ht,{className:"w-5 h-5 text-amber-400"}),e.jsx("h3",{className:"text-base font-bold text-white",children:"人工特批试用放行"})]}),e.jsx("button",{onClick:()=>q(null),className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 text-xs space-y-1",children:[e.jsx("div",{className:"text-slate-400",children:"操作目标终端:"}),e.jsxs("div",{className:"font-semibold text-white",children:[P.tenantName," / ",P.classroomName||"未命名班级"]}),e.jsxs("div",{className:"font-mono text-slate-400 text-[11px]",children:["指纹: ",P.maskedFingerprint]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-xs font-semibold text-slate-300",children:["特批原因 (必填,写入不可篡改安全审计日志) ",e.jsx("span",{className:"text-rose-400",children:"*"})]}),e.jsx("textarea",{value:v,onChange:g=>w(g.target.value),placeholder:"例如:教学班级大屏更换主板售后换件;商务补偿追加试用;测试环境恢复...",rows:3,className:"w-full bg-slate-950 border border-slate-800 rounded-xl p-3 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-amber-500"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-slate-300",children:"特批放行有效期 (单次有效)"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:"24 小时",value:24},{label:"72 小时 (推荐)",value:72},{label:"7 天",value:168}].map(g=>e.jsx("button",{type:"button",onClick:()=>Y(g.value),className:`py-2 px-3 rounded-xl text-xs font-medium transition-colors border ${M===g.value?"bg-amber-500/20 text-amber-300 border-amber-500/50":"bg-slate-950 text-slate-400 border-slate-800 hover:text-white"}`,children:g.label},g.value))})]}),le&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-950/40 border border-rose-800 text-rose-300 text-xs flex items-center gap-2",children:[e.jsx(Qt,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:le})]}),e.jsxs("div",{className:"pt-2 flex items-center justify-end gap-2.5",children:[e.jsx("button",{type:"button",onClick:()=>q(null),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"取消"}),e.jsxs("button",{type:"button",onClick:te,disabled:z||!v.trim(),className:"px-4 py-2 rounded-xl bg-amber-500 hover:bg-amber-400 text-slate-950 text-xs font-bold transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[z?e.jsx(xt,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ht,{className:"w-3.5 h-3.5"}),"确认放行一次"]})]})]})})]})},Qg=()=>{const[a,l]=x.useState(null),[i,c]=x.useState([]),[u,m]=x.useState(!0),[p,b]=x.useState(null),[f,j]=x.useState("all"),[k,T]=x.useState(null),C=(z,ae)=>{navigator.clipboard.writeText(z),T(ae),setTimeout(()=>T(null),2e3)},I=async()=>{m(!0),b(null);try{const[z,ae]=await Promise.all([J.getSchoolOverview(),J.getSchoolDevices()]);l(z),c(ae)}catch(z){b((z==null?void 0:z.message)||"加载学校总览与设备数据失败")}finally{m(!1)}};x.useEffect(()=>{I();const z=as.onDeviceStatusChanged(le=>{c(O=>{const pe=le.state===1||String(le.state).toLowerCase()==="online",ne=O.map(Q=>Q.deviceId===le.deviceId?{...Q,isOnline:pe,lastHeartbeat:le.lastHeartbeat,clientVersion:le.agentVersion||Q.clientVersion}:Q),ve=ne.filter(Q=>Q.isOnline).length;return l(Q=>Q?{...Q,onlineCount:ve}:null),ne})}),ae=as.onHealthReportReceived(le=>{c(O=>O.map(pe=>pe.deviceId===le.deviceId?{...pe,healthStatus:le.overallStatus,lastHeartbeat:le.timestamp||new Date().toISOString()}:pe))});return()=>{z(),ae()}},[]);const P=(a==null?void 0:a.deviceCount)??i.length,q=(a==null?void 0:a.onlineCount)??i.filter(z=>z.isOnline).length,v=Math.max(0,P-q),w=x.useMemo(()=>{let z=0,ae=0,le=0,O=0,pe=0,ne=0,ve=0;return i.forEach(Q=>{Q.licenseStatus==="TimeUntrusted"?ve++:Q.licenseTier==="Perpetual"||Q.licenseStatus==="Perpetual"?ne++:Q.licenseStatus==="Expired"||Q.remainingDays!==null&&Q.remainingDays!==void 0&&Q.remainingDays<=0?z++:Q.remainingDays!==null&&Q.remainingDays!==void 0?Q.remainingDays<=7?ae++:Q.remainingDays<=30?le++:Q.remainingDays<=90?O++:pe++:O++}),{expired:z,critical:ae,warning:le,normal:O,plenty:pe,perpetual:ne,timeUntrusted:ve,total:i.length}},[i]),M=[{id:"all",label:"全部设备",count:i.length},{id:"online",label:"在线健康",count:i.filter(z=>z.isOnline).length},{id:"offline",label:"离线需关注",count:i.filter(z=>!z.isOnline).length},{id:"critical",label:"7天内到期",count:w.critical},{id:"timeUntrusted",label:"时钟异常",count:w.timeUntrusted}],Y=i.filter(z=>f==="online"?z.isOnline:f==="offline"?!z.isOnline:f==="critical"?z.licenseStatus!=="Perpetual"&&z.licenseTier!=="Perpetual"&&z.remainingDays!==null&&z.remainingDays!==void 0&&z.remainingDays<=7&&z.remainingDays>0:f==="timeUntrusted"?z.licenseStatus==="TimeUntrusted":!0);return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:a!=null&&a.tenantName?`${a.tenantName} · 本校管理后台`:"本校管理后台",description:"实时监控全校各班级多媒体大屏运行状态、授权有效期与科任教师账号",action:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ke,{to:"/school-admin/devices",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-sky-600/20 hover:bg-sky-600/30 text-sky-300 text-xs font-semibold border border-sky-500/30 transition-colors",children:[e.jsx(_t,{className:"w-4 h-4 text-sky-400"}),"教室终端与续期"]}),e.jsxs(ke,{to:"/school-admin/classes",className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",children:[e.jsx(tl,{className:"w-4 h-4 text-sky-400"}),"班级管理"]}),e.jsxs(ke,{to:"/school-admin/codes",className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium shadow-md shadow-blue-600/20 transition-all",children:[e.jsx(rt,{className:"w-4 h-4"}),"生成激活码"]})]})}),p&&e.jsxs("div",{className:"p-4 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0"}),e.jsx("span",{children:p})]}),e.jsxs("button",{onClick:I,className:"flex items-center gap-1 px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[e.jsx(xt,{className:"w-3.5 h-3.5"}),"重试"]})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(on,{title:"教学班级",value:u?"-":(a==null?void 0:a.classCount)??0,subtitle:`安装终端 ${P} 台`,icon:e.jsx(tl,{className:"w-5 h-5 text-indigo-400"})}),e.jsx(on,{title:"在线健康",value:u?"-":q,subtitle:"正常就绪待接收",icon:e.jsx(cn,{className:"w-5 h-5 text-emerald-400"}),badge:e.jsx(it,{label:"正常",variant:"emerald"})}),e.jsx(on,{title:"离线终端",value:u?"-":v,subtitle:v>0?"建议排查电源或网络":"全校终端连通正常",icon:e.jsx(Qt,{className:`w-5 h-5 ${v>0?"text-amber-400":"text-slate-400"}`}),badge:v>0?e.jsx(it,{label:"待排查",variant:"amber"}):e.jsx(it,{label:"全部在线",variant:"slate"})}),e.jsx(on,{title:"任课教师",value:u?"-":(a==null?void 0:a.teacherCount)??0,subtitle:"已授权控制台账号",icon:e.jsx(an,{className:"w-5 h-5 text-sky-400"})})]}),e.jsxs("div",{className:"bg-gradient-to-r from-slate-900 via-slate-900 to-indigo-950/40 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-sky-500/10 border border-sky-500/25 flex items-center justify-center text-sky-400",children:e.jsx(ol,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-white",children:"教室一体机安装包交付与快速部署向导"}),e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 font-mono font-medium",children:"73.36 MB 极简包"})]}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:"支持普通双击安装或极域/机房软件分发系统一键静默部署"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:"/download/ClassNotifySetup.exe",download:"ClassNotifySetup.exe",className:"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white text-xs font-semibold shadow-md shadow-sky-600/20 transition-all",children:[e.jsx(ol,{className:"w-4 h-4"}),"下载安装包 (73.36 MB)"]}),e.jsxs(ke,{to:"/school-admin/devices",className:"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",children:[e.jsx(_t,{className:"w-4 h-4 text-sky-400"}),"查看全校大屏 →"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 pt-2",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-950/70 border border-slate-800/80 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-sky-400",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-sky-500/20 flex items-center justify-center text-[11px]",children:"1"}),e.jsx("span",{children:"安装客户端"})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:"优盘拷贝或机房软件广播安装,全校 50 台一体机均可在 1 分钟内极速完成部署,桌面自动生成【班级播报】快捷方式。"})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-950/70 border border-slate-800/80 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-indigo-400",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-indigo-500/20 flex items-center justify-center text-[11px]",children:"2"}),e.jsx("span",{children:"首次激活绑定"})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:"安装完成自动唤起或双击桌面图标,直接填入本班激活码(支持微信整段长文本直接粘贴秒提,防全角防输错)。"})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-950/70 border border-slate-800/80 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-emerald-400",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-emerald-500/20 flex items-center justify-center text-[11px]",children:"3"}),e.jsx("span",{children:"免打扰静默与续费"})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:"日常上课绝对不抢焦点、不弹窗打断教学。新学期学费交纳后,管理员在后台勾选班级一键批量直延,教师零操作。"})]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800/80 flex items-center justify-between gap-3 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 font-mono text-slate-300 overflow-x-auto",children:[e.jsx("span",{className:"text-slate-500 select-none",children:"极速静默命令:"}),e.jsx("span",{className:"text-sky-300",children:"ClassNotifySetup.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"})]}),e.jsxs("button",{type:"button",onClick:()=>C("ClassNotifySetup.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART","静默安装命令"),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-slate-900 hover:bg-slate-800 border border-slate-700/60 text-slate-300 hover:text-white transition-colors shrink-0",children:[k==="静默安装命令"?e.jsx(is,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx(us,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:k==="静默安装命令"?"已复制":"复制命令"})]})]})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ul,{className:"w-4.5 h-4.5 text-blue-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"大屏终端授权健康与有效天数仪表盘"})]}),e.jsxs(ke,{to:"/school-admin/codes",className:"text-xs text-blue-400 hover:text-blue-300 font-medium flex items-center gap-1",children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),"批量生成与导出激活码 →"]})]}),e.jsx("div",{className:"space-y-1.5",children:e.jsxs("div",{className:"h-3 w-full bg-slate-950 rounded-full overflow-hidden flex border border-slate-800",children:[w.expired>0&&e.jsx("div",{style:{width:`${w.expired/(w.total||1)*100}%`},className:"bg-red-500 transition-all",title:`已过期: ${w.expired} 台`}),w.critical>0&&e.jsx("div",{style:{width:`${w.critical/(w.total||1)*100}%`},className:"bg-orange-500 transition-all",title:`7天内即将到期: ${w.critical} 台`}),w.warning>0&&e.jsx("div",{style:{width:`${w.warning/(w.total||1)*100}%`},className:"bg-amber-400 transition-all",title:`7~30天紧迫: ${w.warning} 台`}),w.normal>0&&e.jsx("div",{style:{width:`${w.normal/(w.total||1)*100}%`},className:"bg-blue-500 transition-all",title:`30~90天正常: ${w.normal} 台`}),w.plenty>0&&e.jsx("div",{style:{width:`${w.plenty/(w.total||1)*100}%`},className:"bg-emerald-500 transition-all",title:`> 90天充裕: ${w.plenty} 台`}),w.perpetual>0&&e.jsx("div",{style:{width:`${w.perpetual/(w.total||1)*100}%`},className:"bg-purple-500 transition-all",title:`永久授权: ${w.perpetual} 台`}),w.timeUntrusted>0&&e.jsx("div",{style:{width:`${w.timeUntrusted/(w.total||1)*100}%`},className:"bg-rose-600 transition-all",title:`时钟不可信: ${w.timeUntrusted} 台`})]})}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsxs("div",{onClick:()=>j("critical"),className:`p-3.5 rounded-xl border transition-all cursor-pointer ${w.critical>0?"bg-orange-950/20 border-orange-500/30 hover:border-orange-500/60":"bg-slate-950/40 border-slate-800 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-orange-400 font-medium",children:"7天内即将到期"}),w.critical>0?e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold bg-orange-500/20 text-orange-300 border border-orange-500/30",children:"需续期"}):e.jsx("span",{className:"text-[10px] text-slate-500",children:"无告警"})]}),e.jsxs("div",{className:"text-xl font-bold text-white mt-1",children:[w.critical," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:w.critical>0?"终端每日轻量提示老师续费":"暂无即将到期的大屏"})]}),e.jsxs("div",{onClick:()=>j("timeUntrusted"),className:`p-3.5 rounded-xl border transition-all cursor-pointer ${w.timeUntrusted>0?"bg-rose-950/20 border-rose-600/40 hover:border-rose-600/70":"bg-slate-950/40 border-slate-800 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-rose-400 font-medium",children:"系统时钟不可信"}),w.timeUntrusted>0?e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold bg-rose-500/20 text-rose-300 border border-rose-500/30",children:"异常"}):e.jsx("span",{className:"text-[10px] text-slate-500",children:"可信"})]}),e.jsxs("div",{className:"text-xl font-bold text-white mt-1",children:[w.timeUntrusted," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:w.timeUntrusted>0?"检测到本地时钟倒拨,需联网同步":"全校时钟基线健康"})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-950/40 border border-slate-800",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-blue-400 font-medium",children:"商业及学年授权"}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium bg-blue-500/10 text-blue-400 border border-blue-500/20",children:"生效中"})]}),e.jsxs("div",{className:"text-xl font-bold text-white mt-1",children:[w.normal+w.plenty," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:"有效期 > 30 天,教学保障充裕"})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-950/40 border border-slate-800",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-purple-400 font-medium",children:"永久商业大屏"}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium bg-purple-500/10 text-purple-400 border border-purple-500/20",children:"永久有效"})]}),e.jsxs("div",{className:"text-xl font-bold text-white mt-1",children:[w.perpetual," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:"无到期时间限制的商业定制机"})]})]})]}),v>0&&e.jsxs("div",{className:"p-4 rounded-xl bg-amber-500/10 border border-amber-500/20 text-amber-300 flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Qt,{className:"w-4 h-4 text-amber-400 shrink-0"}),e.jsxs("span",{children:["检测到 ",e.jsxs("strong",{children:[v," 台"]})," 教室大屏当前处于离线状态,已为您自动置顶展示,方便排查。"]})]}),e.jsx(ke,{to:"/school-admin/codes",className:"text-amber-400 hover:text-amber-300 font-medium underline underline-offset-4",children:"获取安装激活码"})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_t,{className:"w-4 h-4 text-blue-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"大屏终端在线、健康与授权明细"})]}),e.jsx(ga,{tabs:M,activeId:f,onChange:j})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3 px-4 font-medium",children:"班级"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"设备编号"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"连通状态"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"授权状态与有效期"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"健康诊断"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"最近心跳"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"客户端版本"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:u?e.jsx("tr",{children:e.jsxs("td",{colSpan:7,className:"py-12 text-center text-xs text-slate-500",children:[e.jsx(xt,{className:"w-4 h-4 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("span",{children:"正在获取大屏状态..."})]})}):Y.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"py-12 text-center text-xs text-slate-500",children:f==="offline"?"全校大屏均在线运行良好":f==="critical"?"当前无 7 天内即将到期的大屏":f==="timeUntrusted"?"当前无时钟不可信设备":"暂无大屏数据"})}):Y.map(z=>e.jsxs("tr",{className:"hover:bg-slate-800/40 transition-colors",children:[e.jsx("td",{className:"py-3.5 px-4 font-semibold text-white",children:z.classroomName||"未分配班级"}),e.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-400",children:z.deviceId}),e.jsx("td",{className:"py-3.5 px-4",children:z.isOnline?e.jsx(it,{label:"在线",variant:"emerald"}):e.jsx(it,{label:"离线",variant:"slate"})}),e.jsx("td",{className:"py-3.5 px-4",children:z.licenseStatus==="TimeUntrusted"?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-rose-500/10 text-rose-400 border border-rose-500/20",children:[e.jsx(Qt,{className:"w-3 h-3"}),"时钟不可信"]}):z.licenseTier==="Perpetual"||z.licenseStatus==="Perpetual"?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-500/10 text-purple-400 border border-purple-500/20",children:[e.jsx(Ht,{className:"w-3 h-3"}),"永久有效"]}):z.licenseStatus==="Expired"||z.remainingDays!==null&&z.remainingDays!==void 0&&z.remainingDays<=0?e.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-400 border border-red-500/20",children:"已过期"}):z.remainingDays!==null&&z.remainingDays!==void 0&&z.remainingDays<=7?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-orange-500/10 text-orange-400 border border-orange-500/30",children:[e.jsx(os,{className:"w-3 h-3"}),"剩余 ",z.remainingDays," 天 (即将到期)"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-slate-800 text-slate-300 border border-slate-700",children:["剩余 ",z.remainingDays??"-"," 天"]})}),e.jsx("td",{className:"py-3.5 px-4",children:z.healthStatus==="Degraded"?e.jsx(it,{label:"亚健康",variant:"amber"}):z.isOnline?e.jsx(it,{label:"健康",variant:"emerald"}):e.jsx(it,{label:"离线未检",variant:"slate"})}),e.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400 font-mono",children:z.lastHeartbeat?new Date(z.lastHeartbeat).toLocaleTimeString():e.jsx("span",{className:"text-slate-600",children:"-"})}),e.jsxs("td",{className:"py-3.5 px-4 text-xs font-mono text-slate-400",children:["v",z.clientVersion||"2.4.0"]})]},z.deviceId))})]})})]})]})},Jg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState([]),[u,m]=x.useState(!0),[p,b]=x.useState(""),[f,j]=x.useState(!1),[k,T]=x.useState(""),[C,I]=x.useState(""),[P,q]=x.useState(""),[v,w]=x.useState(""),[M,Y]=x.useState(!1),[z,ae]=x.useState(null),[le,O]=x.useState(null),pe=async()=>{try{const[W,te]=await Promise.all([J.getSchoolClasses(),J.getSchoolDevices().catch(()=>[])]);l(W),c(te)}catch(W){console.error("Failed to load class or device data",W)}finally{m(!1)}};x.useEffect(()=>{pe()},[]);const ne=async W=>{if(W.preventDefault(),!k||!C)return;const te=zc(C);if(!te.valid){alert(te.message);return}Y(!0);try{await J.createSchoolClass({id:k.trim(),displayName:C.trim(),grade:P==null?void 0:P.trim(),roomNumber:v==null?void 0:v.trim()}),j(!1),T(""),I(""),q(""),w(""),pe()}catch(Le){alert(Le.message||"创建班级失败")}finally{Y(!1)}},ve=async W=>{O(W.id);try{const te=await J.generateSchoolCode(W.id);ae({classId:W.id,className:W.displayName,code:te.code})}catch(te){alert(te.message||"生成激活码失败")}finally{O(null)}},Q=W=>i.find(te=>te.classroomId===W),R=a.filter(W=>{if(!p.trim())return!0;const te=p.toLowerCase();return W.displayName.toLowerCase().includes(te)||W.id.toLowerCase().includes(te)||W.roomNumber&&W.roomNumber.toLowerCase().includes(te)});return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"教学班级管理",description:"维护本校班级档案,管理教室位置与大屏终端绑定状态",action:e.jsxs("button",{type:"button",onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 transition-all",children:[e.jsx(Fs,{className:"w-4 h-4"}),"新建教学班"]})}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"w-72",children:e.jsx(yr,{value:p,onChange:b,placeholder:"搜索班级名称或位置..."})}),e.jsxs("div",{className:"text-xs text-slate-400",children:["共 ",e.jsx("span",{className:"font-semibold text-white",children:R.length})," 个教学班"]})]}),e.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3 px-4 font-medium",children:"班级名称"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"教室位置"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"绑定大屏"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"大屏状态"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"最近心跳"}),e.jsx("th",{className:"py-3 px-4 font-medium text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:u?e.jsx("tr",{children:e.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[e.jsx(Ct,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("span",{children:"正在加载班级数据..."})]})}):R.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:p?"未找到匹配的班级":"暂无教学班,点击右上角新建"})}):R.map(W=>{const te=Q(W.id);return e.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[e.jsxs("td",{className:"py-3.5 px-4",children:[e.jsx("div",{className:"font-semibold text-white",children:W.displayName}),e.jsx("div",{className:"text-[11px] font-mono text-slate-500",children:W.id})]}),e.jsx("td",{className:"py-3.5 px-4 text-slate-300",children:W.roomNumber||W.grade||e.jsx("span",{className:"text-slate-600",children:"-"})}),e.jsx("td",{className:"py-3.5 px-4",children:te?e.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs text-slate-200",children:[e.jsx(_t,{className:"w-3.5 h-3.5 text-blue-400 shrink-0"}),e.jsx("span",{children:te.deviceId})]}):e.jsx("span",{className:"text-slate-500 text-xs",children:"未绑定大屏"})}),e.jsx("td",{className:"py-3.5 px-4",children:te?te.isOnline?e.jsx(it,{label:"在线",variant:"emerald"}):e.jsx(it,{label:"离线",variant:"slate"}):e.jsxs("button",{type:"button",onClick:()=>ve(W),className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold bg-blue-600/10 hover:bg-blue-600/20 text-blue-400 border border-blue-500/20 transition-colors",children:[e.jsx(rt,{className:"w-3 h-3"}),e.jsx("span",{children:"立即绑定"})]})}),e.jsx("td",{className:"py-3.5 px-4 text-xs font-mono text-slate-400",children:te!=null&&te.lastHeartbeat?new Date(te.lastHeartbeat).toLocaleTimeString():e.jsx("span",{className:"text-slate-600",children:"-"})}),e.jsx("td",{className:"py-3.5 px-4 text-right",children:e.jsx(Fc,{items:[{label:"生成安装激活码",icon:e.jsx(rt,{className:"w-4 h-4 text-blue-400"}),onClick:()=>ve(W)}]})})]},W.id)})})]})})}),z&&e.jsx(Vt,{isOpen:!0,onClose:()=>ae(null),title:`大屏安装激活码 · ${z.className}`,children:e.jsxs("div",{className:"space-y-4 text-center py-2",children:[e.jsx("p",{className:"text-xs text-slate-400",children:"请在班级教室大屏运行客户端安装程序,并输入以下 8 位激活码完成绑定:"}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 flex items-center justify-center gap-3",children:[e.jsx("span",{className:"font-mono text-2xl font-bold tracking-widest text-blue-400",children:z.code}),e.jsx(X0,{text:z.code,label:"复制"})]}),e.jsx("p",{className:"text-[11px] text-slate-500",children:"激活码 24 小时内有效,完成一次硬件绑定后将自动核销。"}),e.jsx("div",{className:"pt-2",children:e.jsx("button",{type:"button",onClick:()=>ae(null),className:"w-full py-2.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold transition-colors",children:"完成"})})]})}),f&&e.jsx(Vt,{isOpen:!0,onClose:()=>j(!1),title:"新建教学班级",children:e.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"班级编号 (唯一识别码)"}),e.jsx("input",{type:"text",value:k,onChange:W=>T(W.target.value),placeholder:"如 cls_801 或 c_eight_1",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:["班级显示名称 ",e.jsx("span",{className:"text-amber-400 font-normal",children:"(除“班”外严禁汉字)"})]}),e.jsx("input",{type:"text",value:C,onChange:W=>I(W.target.value),placeholder:"如 81班 或 82、810班",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:"规范:仅支持数字、英文字符与单个汉字“班”(如“81班”合规,“八一班”不合规)。"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"年级 (可选)"}),e.jsx("input",{type:"text",value:P,onChange:W=>q(W.target.value),placeholder:"如 初二 / 高一",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"教室位置 (可选)"}),e.jsx("input",{type:"text",value:v,onChange:W=>w(W.target.value),placeholder:"如 教学楼 301",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:M,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50 transition-all",children:M?"创建中...":"确认创建"})]})]})})]})},Gg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState(!0),[u,m]=x.useState("all"),[p,b]=x.useState(""),[f,j]=x.useState(!1),[k,T]=x.useState(""),[C,I]=x.useState(""),[P,q]=x.useState(""),[v,w]=x.useState(!1),[M,Y]=x.useState(null),[z,ae]=x.useState(""),[le,O]=x.useState(!1),pe=x.useRef(null),[ne,ve]=x.useState(null),[Q,R]=x.useState(!1),[W,te]=x.useState(null),Le=(U,ge)=>{te({type:U,text:ge}),setTimeout(()=>{te(je=>(je==null?void 0:je.text)===ge?null:je)},4e3)},K=async()=>{try{const U=await J.getSchoolTeachers();l(U)}catch(U){Le("error",(U==null?void 0:U.message)||"加载教师列表失败")}finally{c(!1)}};x.useEffect(()=>{K()},[]),x.useEffect(()=>{M&&pe.current&&setTimeout(()=>{var U;return(U=pe.current)==null?void 0:U.focus()},100)},[M]);const Z=async U=>{if(U.preventDefault(),!(!k||!C||!P)){if(C.length<8){alert("密码长度不能少于 8 位");return}w(!0);try{await J.createSchoolTeacher({username:k,password:C,fullName:P,role:"Teacher"}),j(!1),T(""),I(""),q(""),Le("success",`教师账号 ${P} 开设成功`),K()}catch(ge){alert(ge.message||"创建教师账号失败")}finally{w(!1)}}},G=async U=>{if(U.preventDefault(),!(!M||!z)){if(z.length<8){alert("根据系统安全基线,密码长度不能少于 8 位");return}O(!0);try{await J.resetSchoolTeacherPassword(M.id,z),Le("success",`已成功将教师 [${M.fullName}] 的密码重置`),Y(null),ae("")}catch(ge){alert(ge.message||"重置密码失败")}finally{O(!1)}}},re=async()=>{if(!ne)return;R(!0);const U=!ne.isLocked;try{await J.setSchoolTeacherLock(ne.id,U),Le("success",`已成功${U?"停用":"启用"}教师 [${ne.fullName}] 账号`),ve(null),K()}catch(ge){alert(ge.message||"操作失败")}finally{R(!1)}},se=a.filter(U=>!U.isLocked).length,g=a.filter(U=>U.isLocked).length,B=[{id:"all",label:"全部教师",count:a.length},{id:"active",label:"正常使用",count:se},{id:"locked",label:"已停用",count:g}],ue=a.filter(U=>{if(u==="active"&&U.isLocked||u==="locked"&&!U.isLocked)return!1;if(p.trim()){const ge=p.toLowerCase();return U.fullName.toLowerCase().includes(ge)||U.username.toLowerCase().includes(ge)}return!0});return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"教师账号管理",description:"管理本校任课教师账号登录凭证与权限状态",action:e.jsxs("button",{type:"button",onClick:()=>j(!0),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 transition-all",children:[e.jsx(Fs,{className:"w-4 h-4"}),"开设教师账号"]})}),W&&e.jsxs("div",{className:`p-3.5 rounded-xl border text-xs flex items-center justify-between transition-all ${W.type==="success"?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[W.type==="success"?e.jsx(ot,{className:"w-4 h-4 text-emerald-400 shrink-0"}):e.jsx(Qt,{className:"w-4 h-4 text-rose-400 shrink-0"}),e.jsx("span",{children:W.text})]}),e.jsx("button",{onClick:()=>te(null),className:"text-slate-400 hover:text-white",children:e.jsx(Xt,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx(ga,{tabs:B,activeId:u,onChange:m}),e.jsx("div",{className:"w-full sm:w-64",children:e.jsx(yr,{value:p,onChange:b,placeholder:"搜索教师姓名或登录名..."})})]}),e.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3 px-4 font-medium",children:"教师姓名"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"登录账号"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"身份角色"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"账号状态"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"最近登录"}),e.jsx("th",{className:"py-3 px-4 font-medium text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:i?e.jsx("tr",{children:e.jsxs("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:[e.jsx(Ct,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("span",{children:"正在加载教师列表..."})]})}):ue.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"py-12 text-center text-xs text-slate-500",children:p?"未找到符合条件的教师":"暂无教师数据"})}):ue.map(U=>e.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors",children:[e.jsxs("td",{className:"py-3.5 px-4 font-semibold text-white flex items-center gap-2",children:[e.jsx(pr,{className:"w-4 h-4 text-emerald-400 shrink-0"}),e.jsx("span",{children:U.fullName})]}),e.jsx("td",{className:"py-3.5 px-4 font-mono text-xs text-slate-300",children:U.username}),e.jsx("td",{className:"py-3.5 px-4 text-xs",children:U.role==="SchoolAdmin"?e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-400 border border-blue-500/20 text-xs",children:"学校管理员"}):e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-slate-800 text-slate-300 border border-slate-700/60 text-xs",children:"任课教师"})}),e.jsx("td",{className:"py-3.5 px-4",children:U.isLocked?e.jsx(it,{label:"已停用",variant:"rose"}):e.jsx(it,{label:"正常",variant:"emerald"})}),e.jsx("td",{className:"py-3.5 px-4 text-xs text-slate-400 font-mono",children:U.lastLoginAt?new Date(U.lastLoginAt).toLocaleString():e.jsxs("span",{className:"text-slate-600 flex items-center gap-1",children:[e.jsx(os,{className:"w-3 h-3"}),"从未登录"]})}),e.jsx("td",{className:"py-3.5 px-4 text-right",children:U.role==="Teacher"?e.jsx(Fc,{items:[{label:"重置登录密码",icon:e.jsx(rt,{className:"w-4 h-4 text-blue-400"}),onClick:()=>{Y(U),ae("")}},{label:U.isLocked?"启用账号":"停用账号",icon:U.isLocked?e.jsx(Tc,{className:"w-4 h-4 text-emerald-400"}):e.jsx(sl,{className:"w-4 h-4 text-rose-400"}),danger:!U.isLocked,onClick:()=>ve(U)}]}):e.jsx("span",{className:"text-slate-600 text-xs",children:"-"})})]},U.id))})]})})}),M&&e.jsx(Vt,{isOpen:!0,onClose:()=>Y(null),title:`重置教师密码 · ${M.fullName}`,children:e.jsxs("form",{onSubmit:G,className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-slate-400",children:"重置密码将立即终止该教师当前的在线会话,下次登录必须使用新密码:"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"新密码(至少 8 位)"}),e.jsx("input",{ref:pe,type:"password",value:z,onChange:U=>ae(U.target.value),placeholder:"请输入不少于 8 位的新密码",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0,minLength:8})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>Y(null),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:le||z.length<8,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50 transition-all",children:le?"正在重置...":"确认重置密码"})]})]})}),ne&&e.jsx(Y0,{isOpen:!0,onClose:()=>ve(null),onConfirm:re,loading:Q,title:ne.isLocked?"恢复教师账号权限?":"停用该教师账号?",targetName:ne.fullName,description:ne.isLocked?"启用后,该教师将可以正常登录教师工作台并向班级大屏发送呼叫通知。":"停用后,该教师所有活跃登录会话将立即注销,无法再向大屏发起任何呼叫。历史通知与审计记录不受影响。",confirmLabel:ne.isLocked?"确认启用":"确认停用账号"}),f&&e.jsx(Vt,{isOpen:!0,onClose:()=>j(!1),title:"开设任课教师账号",children:e.jsxs("form",{onSubmit:Z,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"教师真实姓名"}),e.jsx("input",{type:"text",value:P,onChange:U=>q(U.target.value),placeholder:"如 张老师、王建国",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"登录用户名"}),e.jsx("input",{type:"text",value:k,onChange:U=>T(U.target.value),placeholder:"建议使用手机号或拼音如 teacher_zhang",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1",children:"初始密码(至少 8 位)"}),e.jsx("input",{type:"password",value:C,onChange:U=>I(U.target.value),placeholder:"设置该教师首次登录的初始密码",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-xs focus:outline-none focus:border-blue-500 transition-colors",required:!0,minLength:8})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>j(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:v,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50 transition-all",children:v?"开设中...":"确认开设"})]})]})})]})},Xg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState([]),[u,m]=x.useState([]),[p,b]=x.useState([]),[f,j]=x.useState(!0),[k,T]=x.useState(null),[C,I]=x.useState("all"),[P,q]=x.useState(""),[v,w]=x.useState(null),[M,Y]=x.useState([]),[z,ae]=x.useState(!1),[le,O]=x.useState(""),[pe,ne]=x.useState(!1),[ve,Q]=x.useState(!1),[R,W]=x.useState(""),[te,Le]=x.useState("trial_7"),[K,Z]=x.useState(14),[G,re]=x.useState(1),[se,g]=x.useState(""),[B,ue]=x.useState(!1),[U,ge]=x.useState(null),[je,Ne]=x.useState(null),[ye,de]=x.useState("External"),[De,et]=x.useState(""),[ct,Je]=x.useState(!1),[We,tt]=x.useState(null),[At,Et]=x.useState(""),[Wt,pt]=x.useState(""),[Tt,nt]=x.useState(""),[he,Ge]=x.useState(!1),[Nt,ft]=x.useState(!1),[wt,Pe]=x.useState([]),Xe=$=>{if($&&$.length>0){Pe($),ft(!0);return}const Me=M.length>0?a.filter(Be=>M.includes(Be.code)):a.filter(Be=>!Be.isUsed);if(Me.length===0){alert("请先勾选需要打印交付卡片的激活码");return}const Ke=Me.map(Be=>{const gt=i.find(A=>A.id===Be.classroomId);let kt=Be.licenseTier==="Perpetual"?"永久商业授权":`${Be.licenseDurationDays||365} 天商业授权`;return{code:Be.code,className:(gt==null?void 0:gt.displayName)||Be.classroomName||Be.classroomId||"班级终端",durationDesc:kt,notes:Be.notes}});Pe(Ke),ft(!0)},ee=async()=>{j(!0),T(null);try{const[$,Me,Ke,Be]=await Promise.all([J.getSchoolCodes(),J.getSchoolClasses(),J.getSchoolDevices(),J.getSchoolTeachers().catch(()=>[])]);l($),c(Me),m(Ke),b(Be),Me.length>0&&!R&&W(Me[0].id)}catch($){T(($==null?void 0:$.message)||"加载本校激活码与设备数据失败")}finally{j(!1)}};x.useEffect(()=>{ee()},[]);const E=($,Me=$)=>{navigator.clipboard.writeText($),w(Me),setTimeout(()=>w(null),2e3)},y=x.useMemo(()=>{let $=0,Me=0,Ke=0,Be=0,gt=0,kt=0,A=0;return u.forEach(ce=>{ce.licenseStatus==="TimeUntrusted"?A++:ce.licenseTier==="Perpetual"||ce.licenseStatus==="Perpetual"?kt++:ce.licenseStatus==="Expired"||ce.remainingDays!==null&&ce.remainingDays!==void 0&&ce.remainingDays<=0?$++:ce.remainingDays!==null&&ce.remainingDays!==void 0?ce.remainingDays<=7?Me++:ce.remainingDays<=30?Ke++:ce.remainingDays<=90?Be++:gt++:Be++}),u.length,{expired:$,critical:Me,warning:Ke,normal:Be,plenty:gt,perpetual:kt,timeUntrusted:A,total:u.length}},[u]),be=()=>{const $=Ie=>{if(Ie==null)return'""';let Dt=String(Ie).trim();return/^[=+\-@]/.test(Dt)&&(Dt="'"+Dt),`"${Dt.replace(/"/g,'""')}"`},Me=M.length>0?a.filter(Ie=>M.includes(Ie.code)):Rt,Ke=["激活码","绑定班级","班级ID","授权类型","授权时长","使用状态","批次备注","绑定设备ID","截止兑换时间","实际激活时间"],Be=Me.map(Ie=>[$(Ie.code),$(Ie.classroomName||Ie.classroomId),$(Ie.classroomId),$(Ie.licenseTier==="Perpetual"?"永久授权":Ie.licenseTier==="Academic"?"学年授权":"试用授权"),$(Ie.licenseDurationDays?`${Ie.licenseDurationDays}天`:"永久有效"),$(Ie.isUsed?"已绑定使用":"待激活可用"),$(Ie.notes||""),$(Ie.usedByDeviceId||""),$(Ie.expiresAt?new Date(Ie.expiresAt).toLocaleString():""),$(Ie.usedAt?new Date(Ie.usedAt).toLocaleString():"")]),gt="\uFEFF"+[Ke.map(Ie=>`"${Ie}"`).join(","),...Be.map(Ie=>Ie.join(","))].join(`\r `),kt=new Blob([gt],{type:"text/csv;charset=utf-8;"}),A=URL.createObjectURL(kt),ce=document.createElement("a"),st=new Date().toISOString().slice(0,19).replace(/[-:T]/g,"");ce.href=A,ce.setAttribute("download",`ClassNotify_本校激活码清单_${st}.csv`),document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),URL.revokeObjectURL(A)},Oe=()=>{const $=Rt.filter(Me=>!Me.isUsed).map(Me=>Me.code);if($.length===0){alert("当前列表暂无未兑换的激活码");return}E($.join(` `),"all_unredeemed")},Ue=async $=>{if($.preventDefault(),M.length!==0){ne(!0);try{const Me=await J.batchTagSchoolCodes(M,le.trim());Me.success?(l(Ke=>Ke.map(Be=>M.includes(Be.code)?{...Be,notes:le.trim()||void 0}:Be)),ae(!1),O(""),Y([])):alert(Me.message||"更新备注失败")}catch(Me){alert((Me==null?void 0:Me.message)||"批量设置备注失败")}finally{ne(!1)}}},jt=async $=>{if($.preventDefault(),!R)return;let Me=7,Ke="Trial",Be="7 天免费试用";if(te==="trial_7")Me=7,Ke="Trial",Be="7 天免费试用";else if(te==="trial_14")Me=14,Ke="Trial",Be="14 天深度试用";else if(te==="trial_30")Me=30,Ke="Trial",Be="30 天体验授权";else if(te==="semester_180")Me=180,Ke="Academic",Be="180 天/半学年 商业授权";else if(te==="academic_365")Me=365,Ke="Academic",Be="1 学年/365天 商业授权";else if(te==="perpetual")Me=null,Ke="Perpetual",Be="永久有效商业授权";else if(te==="custom"){if(!K||K<1||K>3650){ge("请输入有效的自定义天数(1 ~ 3650 天)");return}Me=K,Ke=K>=365?"Academic":"Custom",Be=`自定义 ${K} 天商业授权`}if(ye==="TeacherAccount"&&!De){ge("请选择指派的教师账号");return}ue(!0),ge(null);try{const gt=i.find(Ie=>Ie.id===R),kt=(gt==null?void 0:gt.displayName)||R,A=p.find(Ie=>Ie.id===De),ce=await J.generateSchoolCode(R,Me,Ke,se.trim()||void 0,G,ye,ye==="TeacherAccount"?De:void 0,ye==="TeacherAccount"?A==null?void 0:A.fullName:void 0,kt),st=ce.codes&&ce.codes.length>0?ce.codes:[ce.code];Ne({codes:st,className:kt,durationDesc:Be,notes:se.trim()||void 0}),Q(!1),g(""),re(1),et(""),de("External"),await ee()}catch(gt){ge((gt==null?void 0:gt.message)||"生成激活码失败")}finally{ue(!1)}},lt=$=>{tt($),Et($.assignedTeacherId||""),pt($.classroomId||(i.length>0?i[0].id:"")),nt($.notes||""),Je(!0)},zt=async $=>{if($.preventDefault(),!!We){Ge(!0);try{const Me=p.find(gt=>gt.id===At),Ke=i.find(gt=>gt.id===Wt),Be=await J.assignSchoolCode({code:We.code,teacherId:At||"",teacherName:Me==null?void 0:Me.fullName,classroomId:Wt,targetClassName:Ke==null?void 0:Ke.displayName,notes:Tt.trim()||void 0});Be.success?(Je(!1),tt(null),await ee()):alert(Be.message||"指派失败")}catch(Me){alert(Me.message||"指派失败")}finally{Ge(!1)}}},Ye=a.filter($=>!$.isUsed&&new Date($.expiresAt).getTime()>Date.now()).length,Ss=a.filter($=>$.isUsed).length,He=a.filter($=>!$.isUsed&&new Date($.expiresAt).getTime()<=Date.now()).length,It=[{id:"all",label:"全部",count:a.length},{id:"pending",label:"待激活 (可用)",count:Ye},{id:"used",label:"已绑定",count:Ss},{id:"expired",label:"已超期未用",count:He}],Rt=a.filter($=>{const Me=!$.isUsed&&new Date($.expiresAt).getTime()<=Date.now();if(C==="pending"&&($.isUsed||Me)||C==="used"&&!$.isUsed||C==="expired"&&!Me)return!1;if(P.trim()){const Ke=P.toLowerCase(),Be=$.code.toLowerCase().includes(Ke),gt=($.classroomName||$.classroomId).toLowerCase().includes(Ke),kt=$.notes&&$.notes.toLowerCase().includes(Ke),A=$.usedByDeviceId&&$.usedByDeviceId.toLowerCase().includes(Ke);if(!Be&&!gt&&!kt&&!A)return!1}return!0}),Js=()=>{M.length===Rt.length?Y([]):Y(Rt.map($=>$.code))},Dn=$=>{Y(Me=>Me.includes($)?Me.filter(Ke=>Ke!==$):[...Me,$])};return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"本校教室终端激活码",description:"生成与管理本校教室大屏安装所需的 8 位一次性硬件绑定激活码,支持批量生成、导出与批次备注",action:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{onClick:be,className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",title:"导出激活码清单 (CSV 格式,自动防护注入)",children:[e.jsx(ol,{className:"w-3.5 h-3.5 text-sky-400"}),M.length>0?`导出选中 (${M.length})`:"导出 CSV"]}),e.jsxs("button",{onClick:Oe,className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",title:"一键复制当前列表未兑换激活码",children:[e.jsx(us,{className:"w-3.5 h-3.5 text-emerald-400"}),v==="all_unredeemed"?"已复制未兑换码":"复制未兑换码"]}),e.jsxs("button",{onClick:()=>Xe(),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium border border-slate-700 transition-colors",title:"打印交付班级卡片 (发给班主任或贴在大屏旁边)",children:[e.jsx(Il,{className:"w-3.5 h-3.5 text-amber-400"}),M.length>0?`打印卡片 (${M.length})`:"打印交付卡片"]}),e.jsxs("button",{type:"button",onClick:()=>{ge(null),Q(!0)},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 transition-all",children:[e.jsx(Fs,{className:"w-4 h-4"}),"生成新激活码"]})]})}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 space-y-4 shadow-sm",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ul,{className:"w-4 h-4 text-blue-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"本校设备授权到期分布梯级"}),e.jsxs("span",{className:"text-xs text-slate-400",children:["(共 ",y.total," 台终端)"]})]}),e.jsx("div",{className:"text-xs text-slate-400",children:"授权有效期自教室大屏首次输入激活码起算"})]}),e.jsxs("div",{className:"h-2.5 w-full bg-slate-950 rounded-full overflow-hidden flex border border-slate-800",children:[y.expired>0&&e.jsx("div",{style:{width:`${y.expired/y.total*100}%`},className:"bg-red-500 transition-all",title:`已过期: ${y.expired} 台`}),y.critical>0&&e.jsx("div",{style:{width:`${y.critical/y.total*100}%`},className:"bg-orange-500 transition-all",title:`7天内即将到期: ${y.critical} 台`}),y.warning>0&&e.jsx("div",{style:{width:`${y.warning/y.total*100}%`},className:"bg-amber-400 transition-all",title:`7~30天紧迫: ${y.warning} 台`}),y.normal>0&&e.jsx("div",{style:{width:`${y.normal/y.total*100}%`},className:"bg-blue-500 transition-all",title:`30~90天正常: ${y.normal} 台`}),y.plenty>0&&e.jsx("div",{style:{width:`${y.plenty/y.total*100}%`},className:"bg-emerald-500 transition-all",title:`> 90天充裕: ${y.plenty} 台`}),y.perpetual>0&&e.jsx("div",{style:{width:`${y.perpetual/y.total*100}%`},className:"bg-purple-500 transition-all",title:`永久授权: ${y.perpetual} 台`}),y.timeUntrusted>0&&e.jsx("div",{style:{width:`${y.timeUntrusted/y.total*100}%`},className:"bg-rose-600 transition-all",title:`时钟不可信异常: ${y.timeUntrusted} 台`})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-2.5 pt-1",children:[e.jsxs("div",{className:"p-2.5 rounded-xl bg-red-950/20 border border-red-500/20",children:[e.jsx("div",{className:"text-[11px] text-red-400 font-medium",children:"已过期"}),e.jsxs("div",{className:"text-base font-bold text-red-300 mt-0.5",children:[y.expired," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-orange-950/20 border border-orange-500/20",children:[e.jsx("div",{className:"text-[11px] text-orange-400 font-medium",children:"< 7天 (危急)"}),e.jsxs("div",{className:"text-base font-bold text-orange-300 mt-0.5",children:[y.critical," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-amber-950/20 border border-amber-500/20",children:[e.jsx("div",{className:"text-[11px] text-amber-400 font-medium",children:"7~30天 (紧迫)"}),e.jsxs("div",{className:"text-base font-bold text-amber-300 mt-0.5",children:[y.warning," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-blue-950/20 border border-blue-500/20",children:[e.jsx("div",{className:"text-[11px] text-blue-400 font-medium",children:"30~90天 (正常)"}),e.jsxs("div",{className:"text-base font-bold text-blue-300 mt-0.5",children:[y.normal," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-emerald-950/20 border border-emerald-500/20",children:[e.jsx("div",{className:"text-[11px] text-emerald-400 font-medium",children:"> 90天 (充裕)"}),e.jsxs("div",{className:"text-base font-bold text-emerald-300 mt-0.5",children:[y.plenty," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-purple-950/20 border border-purple-500/20",children:[e.jsx("div",{className:"text-[11px] text-purple-400 font-medium",children:"永久商业版"}),e.jsxs("div",{className:"text-base font-bold text-purple-300 mt-0.5",children:[y.perpetual," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-rose-950/20 border border-rose-600/30",children:[e.jsx("div",{className:"text-[11px] text-rose-400 font-medium",children:"时钟不可信"}),e.jsxs("div",{className:"text-base font-bold text-rose-300 mt-0.5",children:[y.timeUntrusted," ",e.jsx("span",{className:"text-xs font-normal text-slate-400",children:"台"})]})]})]})]}),je&&e.jsxs("div",{className:"p-5 border border-emerald-500/40 bg-emerald-950/20 rounded-2xl flex flex-col justify-between gap-4 animate-in fade-in slide-in-from-top-4 duration-300",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/20 text-emerald-400 flex items-center justify-center shrink-0 border border-emerald-500/30",children:e.jsx(cl,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-semibold text-emerald-300",children:["成功生成 ",je.codes.length," 个激活码!"]}),e.jsxs("div",{className:"text-xs text-slate-300 mt-0.5",children:["班级:",e.jsx("span",{className:"font-medium text-white",children:je.className}),"(授权时长:",e.jsx("span",{className:"text-amber-400 font-semibold",children:je.durationDesc}),je.notes?`,备注:${je.notes}`:"",")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>Xe(je.codes.map($=>({code:$,className:je.className,durationDesc:je.durationDesc,notes:je.notes}))),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 border border-amber-500/40 text-xs font-semibold transition-colors shadow-sm",children:[e.jsx(Il,{className:"w-3.5 h-3.5"}),"打印本次卡片"]}),e.jsx("button",{onClick:()=>E(je.codes.join(` `),"batch_copied"),className:"flex items-center gap-1.5 px-3 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium transition-colors shadow-md",children:v==="batch_copied"?e.jsxs(e.Fragment,{children:[e.jsx(is,{className:"w-3.5 h-3.5"}),"已全部复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"w-3.5 h-3.5"}),"一键复制全部码"]})})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-2 border-t border-emerald-500/20 max-h-40 overflow-y-auto",children:je.codes.map($=>e.jsx("span",{onClick:()=>E($),className:"px-3 py-1.5 rounded-lg bg-slate-900 border border-emerald-500/40 font-mono text-sm font-bold text-emerald-400 tracking-wider cursor-pointer hover:bg-slate-800 transition-colors",title:"点击单独复制",children:$},$))})]}),k&&e.jsxs("div",{className:"p-3.5 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0"}),e.jsx("span",{children:k})]}),e.jsxs("button",{onClick:ee,className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-rose-600 hover:bg-rose-500 text-white font-medium transition-colors",children:[e.jsx(xt,{className:"w-3.5 h-3.5"}),"重试"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx(ga,{tabs:It,activeId:C,onChange:I}),e.jsxs("div",{className:"flex items-center gap-2",children:[M.length>0&&e.jsxs("div",{className:"flex items-center gap-2 animate-in fade-in",children:[e.jsxs("span",{className:"text-xs text-amber-400 font-medium",children:["已选 ",M.length," 项"]}),e.jsxs("button",{onClick:()=>{O(""),ae(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-medium shadow",children:[e.jsx(mr,{className:"w-3.5 h-3.5"}),"设置批次备注"]})]}),e.jsx("div",{className:"w-full sm:w-64",children:e.jsx(yr,{value:P,onChange:q,placeholder:"搜索激活码、班级或备注..."})})]})]}),e.jsx("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs sm:text-sm",children:[e.jsx("thead",{className:"text-xs uppercase text-slate-400 bg-slate-950/60 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3 px-3 w-10 text-center",children:e.jsx("button",{onClick:Js,className:"text-slate-400 hover:text-white",children:M.length>0&&M.length===Rt.length?e.jsx(fr,{className:"w-4 h-4 text-blue-400"}):e.jsx(gr,{className:"w-4 h-4"})})}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"激活码"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"指定绑定班级"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"分发方式 / 教师"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"说明 / 备注"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"授权规格"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"使用状态"}),e.jsx("th",{className:"py-3 px-4 font-medium",children:"绑定设备 ID"}),e.jsx("th",{className:"py-3 px-4 font-medium text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60",children:Rt.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"py-8 text-center text-slate-500",children:f?"加载中...":"暂无匹配的激活码"})}):Rt.map($=>{const Me=!$.isUsed&&new Date($.expiresAt).getTime()<=Date.now(),Ke=M.includes($.code),Be=$.targetClassName||$.classroomName||$.classroomId;return e.jsxs("tr",{className:`hover:bg-slate-800/30 transition-colors ${Ke?"bg-blue-950/20":""}`,children:[e.jsx("td",{className:"py-3.5 px-3 text-center",children:e.jsx("button",{onClick:()=>Dn($.code),className:"text-slate-400 hover:text-white",children:Ke?e.jsx(fr,{className:"w-4 h-4 text-blue-400"}):e.jsx(gr,{className:"w-4 h-4"})})}),e.jsx("td",{className:"py-3.5 px-4 font-mono font-semibold text-blue-400",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:$.code}),e.jsx(X0,{text:$.code})]})}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsxs("span",{className:"inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-semibold bg-blue-500/15 text-blue-300 border border-blue-500/30",children:[e.jsx(Di,{className:"w-3.5 h-3.5 mr-1 text-blue-400"}),Be]})}),e.jsx("td",{className:"py-3.5 px-4",children:$.distributionMethod==="TeacherAccount"&&$.assignedTeacherName?e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-semibold bg-emerald-500/15 text-emerald-300 border border-emerald-500/30",children:[e.jsx(G0,{className:"w-3.5 h-3.5 text-emerald-400"}),"账号直派: ",$.assignedTeacherName]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg text-xs font-medium bg-slate-800 text-slate-400 border border-slate-700/60",children:[e.jsx(al,{className:"w-3 h-3 text-slate-400"}),"微信/线下发放"]})}),e.jsx("td",{className:"py-3.5 px-4 max-w-xs",children:$.notes?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-lg bg-slate-800 border border-slate-700 text-xs text-slate-300 truncate max-w-xs",title:$.notes,children:[e.jsx(mr,{className:"w-3 h-3 text-indigo-400 shrink-0"}),$.notes]}):e.jsx("span",{className:"text-slate-500 text-xs",children:"-"})}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border ${$.licenseTier==="Perpetual"?"bg-purple-500/10 text-purple-400 border-purple-500/20":$.licenseTier==="Academic"?"bg-blue-500/10 text-blue-400 border-blue-500/20":"bg-amber-500/10 text-amber-400 border-amber-500/20"}`,children:$.licenseDurationDays?`${$.licenseDurationDays} 天 (${$.licenseTier==="Trial"?"试用":"商业"})`:"永久授权"})}),e.jsx("td",{className:"py-3.5 px-4",children:$.isUsed?e.jsx(it,{label:"已绑定",variant:"emerald"}):Me?e.jsx(it,{label:"已超期",variant:"rose"}):e.jsx(it,{label:"可用",variant:"sky"})}),e.jsx("td",{className:"py-3.5 px-4 font-mono text-slate-400",children:$.usedByDeviceId||"-"}),e.jsx("td",{className:"py-3.5 px-4 text-right",children:$.isUsed?e.jsx("span",{className:"text-xs text-slate-500 italic",children:"已激活锁定"}):e.jsx("button",{type:"button",onClick:()=>lt($),className:"px-2.5 py-1 rounded-lg bg-indigo-600/20 hover:bg-indigo-600/30 text-indigo-300 hover:text-white border border-indigo-500/30 text-xs font-medium transition-colors",children:"指派/修改"})})]},$.code)})})]})})}),z&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm animate-in fade-in duration-200",children:e.jsxs("div",{className:"bg-slate-900 border border-slate-700 p-6 rounded-2xl shadow-2xl max-w-md w-full",children:[e.jsxs("h3",{className:"text-lg font-bold text-white mb-2 flex items-center gap-2",children:[e.jsx(mr,{className:"w-5 h-5 text-indigo-400"}),"批量设置激活码备注"]}),e.jsxs("p",{className:"text-xs text-slate-400 mb-4",children:["为选中的 ",e.jsx("strong",{className:"text-indigo-400",children:M.length})," 个激活码统一添加批次说明(如:初二电教机、实验楼301等)。"]}),e.jsxs("form",{onSubmit:Ue,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"批次备注内容"}),e.jsx("input",{type:"text",value:le,onChange:$=>O($.target.value),placeholder:"如:2026秋季初二试点、实验楼301",className:"w-full px-3 py-2.5 rounded-xl bg-slate-950 border border-slate-700 text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:outline-none"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>ae(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),e.jsx("button",{type:"submit",disabled:pe,className:"px-4 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white text-xs font-semibold disabled:opacity-50",children:pe?"保存中...":"确认更新"})]})]})]})}),e.jsxs(Vt,{isOpen:ve,onClose:()=>Q(!1),title:"生成班级激活码",children:[e.jsx("p",{className:"text-xs text-slate-400 -mt-2 mb-4",children:"支持微信/线下分发或直接派发到教师账号,生成用于教室大屏首次绑定的激活码"}),e.jsxs("form",{onSubmit:jt,className:"space-y-4",children:[U&&e.jsx("div",{className:"p-3 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-300 text-xs",children:U}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-2",children:"分发方式"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:`flex flex-col p-3 rounded-xl border cursor-pointer transition-all ${ye==="External"?"bg-blue-600/15 border-blue-500 text-white":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-xs",children:[e.jsx("input",{type:"radio",name:"distMethod",checked:ye==="External",onChange:()=>de("External"),className:"text-blue-600 focus:ring-0"}),e.jsx("span",{children:"微信 / 线下发放"})]}),e.jsx("span",{className:"text-[11px] text-slate-400 mt-1",children:"生成后直接复制私发老师微信,或打印交付卡片"})]}),e.jsxs("label",{className:`flex flex-col p-3 rounded-xl border cursor-pointer transition-all ${ye==="TeacherAccount"?"bg-emerald-600/15 border-emerald-500 text-white":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-xs",children:[e.jsx("input",{type:"radio",name:"distMethod",checked:ye==="TeacherAccount",onChange:()=>de("TeacherAccount"),className:"text-emerald-500 focus:ring-0"}),e.jsx("span",{children:"派发到老师账号"})]}),e.jsx("span",{className:"text-[11px] text-slate-400 mt-1",children:"直接派入老师工作台“我的激活码”,老师可随时查看"})]})]})]}),ye==="TeacherAccount"&&e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-950 border border-emerald-500/40 space-y-2 animate-in fade-in",children:[e.jsxs("label",{className:"block text-xs font-semibold text-emerald-300",children:["选择派发的老师账号 ",e.jsx("span",{className:"text-rose-400",children:"*"})]}),e.jsxs("select",{value:De,onChange:$=>et($.target.value),className:"w-full px-3.5 py-2.5 bg-slate-900 border border-emerald-500/50 rounded-xl text-white text-xs focus:outline-none focus:ring-2 focus:ring-emerald-500",required:ye==="TeacherAccount",children:[e.jsx("option",{value:"",children:"-- 请选择老师账号 --"}),p.map($=>e.jsxs("option",{value:$.id,children:[$.fullName," (",$.username,") - ",$.role==="SchoolAdmin"?"管理员":"教师"]},$.id))]}),e.jsx("p",{className:"text-[11px] text-slate-400",children:"指派后,该老师登录即可在其“我的激活码”专区查看激活码与使用指引。"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:["目标班级 ",e.jsx("span",{className:"text-slate-400 font-normal",children:"(指定大屏绑定的班级)"})]}),e.jsx("select",{value:R,onChange:$=>W($.target.value),className:"w-full px-3.5 py-2.5 bg-slate-950 border border-slate-800 rounded-xl text-slate-200 text-sm focus:outline-none focus:border-blue-500",required:!0,children:i.map($=>e.jsxs("option",{value:$.id,children:[$.displayName," (",$.id,")"]},$.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"授权期限与类型"}),e.jsxs("select",{value:te,onChange:$=>Le($.target.value),className:"w-full px-3.5 py-2.5 bg-slate-950 border border-slate-800 rounded-xl text-slate-200 text-sm focus:outline-none focus:border-blue-500",children:[e.jsx("option",{value:"trial_7",children:"7 天免费试用 (首次激活后起算)"}),e.jsx("option",{value:"trial_14",children:"14 天深度试用 (首次激活后起算)"}),e.jsx("option",{value:"trial_30",children:"30 天体验授权 (首次激活后起算)"}),e.jsx("option",{value:"semester_180",children:"180 天/半学年 商业授权 (适合单学期)"}),e.jsx("option",{value:"academic_365",children:"1 学年/365天 商业授权 (适合全学年教学)"}),e.jsx("option",{value:"perpetual",children:"永久有效商业授权 (无到期限制)"}),e.jsx("option",{value:"custom",children:"自定义天数 (任意天数,1~3650天)"})]}),te==="custom"&&e.jsxs("div",{className:"mt-2.5 p-3 rounded-xl bg-slate-950 border border-blue-500/40 animate-in fade-in-50",children:[e.jsx("label",{className:"block text-xs font-semibold text-blue-300 mb-1.5",children:"自定义授权天数 (1 ~ 3650 天)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",min:"1",max:"3650",value:K,onChange:$=>Z(Math.max(1,Math.min(3650,parseInt($.target.value)||1))),className:"w-full px-3 py-2 rounded-lg bg-slate-900 border border-blue-500/50 text-white text-sm focus:ring-2 focus:ring-blue-500 focus:outline-none",required:!0}),e.jsx("span",{className:"text-xs text-slate-300 font-medium shrink-0",children:"天"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"生成数量 (1 ~ 50)"}),e.jsx("input",{type:"number",min:"1",max:"50",value:G,onChange:$=>re(Math.max(1,Math.min(50,parseInt($.target.value)||1))),className:"w-full px-3.5 py-2.5 bg-slate-950 border border-slate-800 rounded-xl text-slate-200 text-sm focus:outline-none focus:border-blue-500",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"激活码说明 / 备注 (选填)"}),e.jsx("input",{type:"text",value:se,onChange:$=>g($.target.value),placeholder:"如:让老师绑定到81班/东楼大屏",className:"w-full px-3.5 py-2.5 bg-slate-950 border border-slate-800 rounded-xl text-slate-200 text-sm focus:outline-none focus:border-blue-500"})]})]}),e.jsxs("div",{className:"p-3 bg-slate-950/60 rounded-xl border border-slate-800/80 text-xs text-slate-400 space-y-1",children:[e.jsx("div",{className:"text-slate-300 font-medium",children:"使用指引:"}),e.jsx("div",{children:"1. 激活码在生成后 30 天内有效绑定;"}),e.jsx("div",{children:"2. 在教室电脑上运行安装包并输入激活码,将自动绑定该教室大屏并开始计算授权天数;"}),e.jsx("div",{children:"3. 若选择派发到老师账号,老师可在网页版教师工作台直接查看激活码。"})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>Q(!1),className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),e.jsx("button",{type:"submit",disabled:B,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 disabled:opacity-50",children:B?"生成中...":G>1?`批量生成 (${G} 个)`:"立即生成"})]})]})]}),ct&&We&&e.jsx(Vt,{isOpen:!0,onClose:()=>{Je(!1),tt(null)},title:"指派 / 修改激活码归属与说明",children:e.jsxs("form",{onSubmit:zt,className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-slate-950 rounded-xl border border-slate-800 text-xs text-slate-300 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"当前激活码:"}),e.jsx("span",{className:"font-mono font-bold text-amber-400 ml-1",children:We.code})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-500",children:"当前状态:"}),e.jsx("span",{className:"text-blue-400 font-medium ml-1",children:"待激活"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"派发至教师账号 (选填,留空则为微信/线下发放)"}),e.jsxs("select",{value:At,onChange:$=>Et($.target.value),className:"w-full px-3.5 py-2.5 bg-slate-950 border border-slate-800 rounded-xl text-slate-200 text-xs focus:outline-none focus:border-blue-500",children:[e.jsx("option",{value:"",children:"-- 无(微信/线下直接发放)--"}),p.map($=>e.jsxs("option",{value:$.id,children:[$.fullName," (",$.username,")"]},$.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"指定绑定班级"}),e.jsx("select",{value:Wt,onChange:$=>pt($.target.value),className:"w-full px-3.5 py-2.5 bg-slate-950 border border-slate-800 rounded-xl text-slate-200 text-xs focus:outline-none focus:border-blue-500",required:!0,children:i.map($=>e.jsxs("option",{value:$.id,children:[$.displayName," (",$.id,")"]},$.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"激活码说明 / 注意事项"}),e.jsx("textarea",{rows:2,value:Tt,onChange:$=>nt($.target.value),placeholder:"例如:让老师绑定到81班/东楼大屏",className:"w-full px-3.5 py-2 bg-slate-950 border border-slate-800 rounded-xl text-slate-200 text-xs focus:outline-none focus:border-blue-500"})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>{Je(!1),tt(null)},className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium",children:"取消"}),e.jsx("button",{type:"submit",disabled:he,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md disabled:opacity-50",children:he?"保存中...":"确认指派"})]})]})}),e.jsx(Vt,{isOpen:Nt,onClose:()=>ft(!1),title:"班级大屏激活码交付卡片 (A4 打印/剪切交付)",maxWidth:"max-w-4xl",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-slate-950/80 border border-slate-800",children:[e.jsxs("div",{className:"text-xs text-slate-400",children:["共 ",e.jsx("span",{className:"text-amber-400 font-bold",children:wt.length})," 张班级交付卡片。建议使用 A4 纸打印后沿虚线裁剪交付给班主任或电教负责人。"]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{type:"button",onClick:()=>window.print(),className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-amber-500 hover:bg-amber-400 text-slate-950 font-bold text-xs shadow-md shadow-amber-500/20 transition-all cursor-pointer",children:[e.jsx(Il,{className:"w-4 h-4"}),"立即调用打印机"]})})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 max-h-[65vh] overflow-y-auto p-1 print:p-0 print:max-h-none print:overflow-visible",children:wt.map(($,Me)=>e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-950 border-2 border-dashed border-slate-700 hover:border-amber-500/60 transition-colors relative space-y-3 print:border-black print:text-black print:bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800 pb-2 print:border-black",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(rt,{className:"w-4 h-4 text-amber-400 print:text-black"}),e.jsx("span",{className:"font-bold text-sm text-white print:text-black",children:"ClassNotify 班级大屏激活交付卡"})]}),e.jsx("span",{className:"text-[11px] px-2 py-0.5 rounded bg-slate-900 border border-slate-700 text-amber-300 font-medium print:bg-transparent print:border-black print:text-black",children:$.className||"指定班级"})]}),e.jsxs("div",{className:"text-center py-2 bg-slate-900/80 rounded-xl border border-slate-800 print:bg-gray-100 print:border-black",children:[e.jsx("div",{className:"text-[10px] text-slate-400 uppercase tracking-wider print:text-gray-600",children:"8 位班级硬件绑定激活码"}),e.jsx("div",{className:"font-mono text-2xl font-black tracking-widest text-amber-400 mt-1 select-all print:text-black",children:$.code}),e.jsxs("div",{className:"text-[11px] text-slate-400 mt-1 print:text-gray-700",children:["有效期:",$.durationDesc]})]}),e.jsxs("div",{className:"text-[11px] text-slate-400 space-y-1 print:text-gray-800",children:[e.jsx("div",{className:"font-semibold text-slate-300 print:text-black",children:"3 步傻瓜激活操作:"}),e.jsx("div",{children:"1. 教室一体机开机,双击桌面的【ClassNotify】图标;"}),e.jsx("div",{children:"2. 在弹出的窗口输入上方 8 位激活码并点击【立即激活】;"}),e.jsx("div",{children:"3. 出现绿色对勾即绑定成功,平时完全静默无需管理。"}),$.notes&&e.jsxs("div",{className:"text-slate-500 pt-1 print:text-gray-600",children:["批次备注:",$.notes]})]}),e.jsxs("div",{className:"text-[10px] text-slate-600 text-center border-t border-slate-800/60 pt-1.5 flex items-center justify-between print:text-gray-500 print:border-gray-400",children:[e.jsx("span",{children:"✂️ 沿此虚线剪下交付班主任"}),e.jsx("span",{children:"技术支持:学校信息化管理处"})]})]},Me))})]})})]})},Yg=()=>{var Xe;const[a,l]=x.useState([]),[i,c]=x.useState([]),[u,m]=x.useState(!0),[p,b]=x.useState(null),[f,j]=x.useState(""),[k,T]=x.useState("all"),[C,I]=x.useState("all"),[P,q]=x.useState([]),[v,w]=x.useState(!1),M=x.useRef(crypto.randomUUID()),[Y,z]=x.useState(!1),[ae,le]=x.useState("preset"),[O,pe]=x.useState(180),[ne,ve]=x.useState(180),[Q,R]=x.useState(""),[W,te]=x.useState("学期学费统一续费"),[Le,K]=x.useState("AcademicYear"),[Z,G]=x.useState(!1),[re,se]=x.useState(null),[g,B]=x.useState(null),[ue,U]=x.useState(""),[ge,je]=x.useState(!1),[Ne,ye]=x.useState(null),[de,De]=x.useState(""),[et,ct]=x.useState(!1),Je=async()=>{try{const[ee,E]=await Promise.all([J.getSchoolDevices(),J.getSchoolClasses()]);l(ee),c(E)}catch(ee){b((ee==null?void 0:ee.message)||"加载教室终端数据失败")}finally{m(!1)}};x.useEffect(()=>{Je();const ee=as.onDeviceStatusChanged(E=>{l(y=>y.map(be=>{if(be.deviceId===E.deviceId){const Oe=E.state===1||String(E.state).toLowerCase()==="online";return{...be,isOnline:Oe,lastHeartbeat:E.lastHeartbeat,clientVersion:E.agentVersion||be.clientVersion}}return be}))});return()=>{ee()}},[]);const We=x.useMemo(()=>{const ee=new Set;return i.forEach(E=>{E.grade&&E.grade.trim()&&ee.add(E.grade.trim())}),Array.from(ee).sort()},[i]),tt=x.useMemo(()=>a.filter(ee=>{if(k==="online"&&!ee.isOnline||k==="offline"&&ee.isOnline||k==="needs_renew"&&!(ee.licenseStatus==="Expired"||ee.remainingDays!==null&&ee.remainingDays!==void 0&&ee.remainingDays<=14))return!1;if(C!=="all"){const E=i.find(y=>y.id===ee.classroomId);if(!E||E.grade!==C)return!1}if(f.trim()){const E=f.toLowerCase().trim(),y=(ee.classroomName||"").toLowerCase(),be=(ee.hostname||"").toLowerCase(),Oe=ee.deviceId.toLowerCase(),Ue=(ee.remoteIp||"").toLowerCase();if(!y.includes(E)&&!be.includes(E)&&!Oe.includes(E)&&!Ue.includes(E))return!1}return!0}),[a,i,k,C,f]),At=a.length,Et=a.filter(ee=>ee.isOnline).length,Wt=Math.max(0,At-Et),pt=a.filter(ee=>ee.licenseStatus==="Expired"||ee.remainingDays!==null&&ee.remainingDays!==void 0&&ee.remainingDays<=14).length,Tt=[{id:"all",label:"全部终端",count:At},{id:"online",label:"在线正常",count:Et},{id:"offline",label:"离线终端",count:Wt},{id:"needs_renew",label:"需续期/欠费",count:pt}],nt=()=>{P.length===tt.length&&tt.length>0?q([]):q(tt.map(ee=>ee.deviceId))},he=ee=>{q(E=>E.includes(ee)?E.filter(y=>y!==ee):[...E,ee])},Ge=async ee=>{if(ee.preventDefault(),P.length!==0){G(!0),se(null);try{let E,y,be="Timed",Oe=Le;if(ae==="perpetual")be="Perpetual",Oe="Perpetual",E=void 0,y=void 0;else if(ae==="preset")E=O;else if(ae==="custom_days")E=ne;else if(ae==="valid_through"){if(!Q)throw new Error("请选择指定截止日期");y=Q}const Ue=await J.batchRenewSchoolDevicesLicense({clientRequestId:M.current,deviceIds:P,extendDays:E,validThroughLocalDate:y,licenseKind:be,tier:Oe,reason:W.trim()||(ae==="perpetual"?"学校大屏永久商业授权直延":"学校统一学费直延")});se({success:!0,message:`成功为 ${Ue.renewedCount} 台教室大屏完成批量授权续期!教室端已通过 SignalR 秒级生效,老师无需任何操作。`}),z(!1),q([]),Je()}catch(E){se({success:!1,message:E.message||"批量续期失败,请重试"})}finally{G(!1)}}},Nt=async ee=>{if(ee.preventDefault(),!!g){je(!0);try{let E=180,y="AcademicYear",be;ue.trim()&&(be=ue.trim().toUpperCase(),E=void 0,y=void 0);const Oe=await J.renewSchoolDeviceLicense(g.deviceId,E,y,be);se({success:!0,message:`班级 [${g.classroomName}] 授权已成功更新:${Oe.message}`}),B(null),U(""),Je()}catch(E){alert(E.message||"单台设备续期失败")}finally{je(!1)}}},ft=ee=>{ye(ee),De(ee.classroomName||"")},wt=async ee=>{if(ee.preventDefault(),!Ne||!de.trim())return;const E=zc(de.trim());if(!E.valid){se({success:!1,message:E.error||"班级名称格式不符合规范"});return}ct(!0);try{const y=await J.updateSchoolDeviceClassName(Ne.deviceId,de.trim());se({success:!0,message:y.message||"班级名称修改成功"}),l(be=>be.map(Oe=>Oe.deviceId===Ne.deviceId?{...Oe,classroomName:y.className||de.trim()}:Oe)),ye(null)}catch(y){se({success:!1,message:y.message||"修改班级名称失败"})}finally{ct(!1)}},Pe=ee=>ee.licenseStatus==="TimeUntrusted"?e.jsx(it,{label:"时钟异常",variant:"amber"}):ee.licenseTier==="Perpetual"||ee.licenseStatus==="Perpetual"?e.jsx(it,{label:"永久授权",variant:"emerald"}):ee.licenseStatus==="Expired"?e.jsx(it,{label:"已到期",variant:"rose"}):ee.remainingDays===0?e.jsx(it,{label:`今日到期 (${ee.remainingHours??1}h)`,variant:"amber"}):ee.remainingDays!==null&&ee.remainingDays!==void 0&&ee.remainingDays<=14?e.jsx(it,{label:`剩 ${ee.remainingDays} 天`,variant:"amber"}):ee.remainingDays!==null&&ee.remainingDays!==void 0?e.jsx(it,{label:`剩余 ${ee.remainingDays} 天`,variant:"emerald"}):e.jsx(it,{label:"正常",variant:"slate"});return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"教室终端与授权续期",description:"管理全校所有教室大屏播报终端,实时监控在线状态,并在学期交费后一键批量续期班级授权。",action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:Je,disabled:u,className:"inline-flex items-center gap-2 px-3.5 py-2 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white hover:bg-slate-800 text-sm font-medium transition-colors",children:[e.jsx(xt,{className:`w-4 h-4 ${u?"animate-spin":""}`}),"刷新终端"]}),e.jsxs("button",{onClick:()=>z(!0),disabled:P.length===0,className:`inline-flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-semibold transition-all ${P.length>0?"bg-gradient-to-r from-sky-500 to-indigo-600 text-white shadow-lg shadow-sky-500/25 hover:from-sky-400 hover:to-indigo-500":"bg-slate-800 text-slate-500 cursor-not-allowed border border-slate-700/50"}`,children:[e.jsx(rt,{className:"w-4 h-4"}),"一键批量续期 ",P.length>0&&`(${P.length}台)`]})]})}),re&&e.jsxs("div",{className:`p-4 rounded-2xl border flex items-center justify-between gap-3 ${re.success?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[re.success?e.jsx(ot,{className:"w-5 h-5 text-emerald-400 flex-shrink-0"}):e.jsx(Zt,{className:"w-5 h-5 text-rose-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:re.message})]}),e.jsx("button",{onClick:()=>se(null),className:"text-xs px-2.5 py-1 rounded-lg bg-slate-900/60 hover:bg-slate-900 text-slate-300 transition-colors",children:"知道了"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsx(on,{title:"全校教室终端",value:At,subtitle:"已登记并绑定的大屏",icon:e.jsx(_t,{className:"w-5 h-5 text-sky-400"})}),e.jsx(on,{title:"在线待命正常",value:Et,subtitle:"SignalR 实时长连接",icon:e.jsx(cn,{className:"w-5 h-5 text-emerald-400"}),badge:e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-emerald-500/10 text-emerald-400 font-medium",children:"通信正常"})}),e.jsx(on,{title:"离线大屏终端",value:Wt,subtitle:"教室未开机或网络断开",icon:e.jsx(Zt,{className:"w-5 h-5 text-slate-400"})}),e.jsx(on,{title:"需续期 / 已欠费",value:pt,subtitle:"≤14天即将到期或已过期",icon:e.jsx(os,{className:"w-5 h-5 text-amber-400"}),badge:pt>0?e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-400 font-semibold animate-pulse",children:"需处理"}):void 0})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-900 border border-slate-800 flex flex-col md:flex-row items-stretch md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(ga,{tabs:Tt,activeId:k,onChange:ee=>T(ee)}),We.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-950 border border-slate-800 text-sm",children:[e.jsx(hf,{className:"w-3.5 h-3.5 text-slate-500"}),e.jsxs("select",{value:C,onChange:ee=>I(ee.target.value),className:"bg-transparent text-slate-300 text-sm focus:outline-none cursor-pointer",children:[e.jsx("option",{value:"all",className:"bg-slate-900 text-slate-200",children:"全部年级"}),We.map(ee=>e.jsx("option",{value:ee,className:"bg-slate-900 text-slate-200",children:ee},ee))]})]})]}),e.jsx("div",{className:"w-full md:w-72",children:e.jsx(yr,{value:f,onChange:j,placeholder:"搜索班级、主机名或 IP..."})})]}),e.jsx("div",{className:"rounded-2xl border border-slate-800 bg-slate-900 overflow-hidden shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-sm text-slate-300",children:[e.jsx("thead",{className:"bg-slate-950/70 border-b border-slate-800 text-xs font-semibold text-slate-400 uppercase tracking-wider",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 pl-4 pr-2 w-10",children:e.jsx("button",{onClick:nt,className:"text-slate-400 hover:text-white transition-colors",title:P.length===tt.length?"取消全选":"全选当前页",children:P.length>0&&P.length===tt.length?e.jsx(fr,{className:"w-4 h-4 text-sky-400"}):e.jsx(gr,{className:"w-4 h-4"})})}),e.jsx("th",{className:"py-3.5 px-4",children:"班级与房间"}),e.jsx("th",{className:"py-3.5 px-4",children:"终端状态"}),e.jsx("th",{className:"py-3.5 px-4",children:"设备标识与网络"}),e.jsx("th",{className:"py-3.5 px-4",children:"版本"}),e.jsx("th",{className:"py-3.5 px-4",children:"授权状态"}),e.jsx("th",{className:"py-3.5 px-4",children:"到期时间"}),e.jsx("th",{className:"py-3.5 px-4 text-right",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60 font-normal",children:u?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"py-12 text-center text-slate-500",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(xt,{className:"w-5 h-5 animate-spin text-sky-400"}),e.jsx("span",{children:"正在加载全校教室终端列表..."})]})})}):tt.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:8,className:"py-12 text-center text-slate-500",children:[e.jsx(_t,{className:"w-8 h-8 mx-auto mb-2 text-slate-600"}),e.jsx("span",{children:"未找到匹配的教室大屏终端"})]})}):tt.map(ee=>{const E=P.includes(ee.deviceId);return e.jsxs("tr",{className:`hover:bg-slate-800/40 transition-colors ${E?"bg-sky-500/5":""}`,children:[e.jsx("td",{className:"py-3.5 pl-4 pr-2",children:e.jsx("button",{onClick:()=>he(ee.deviceId),className:"text-slate-400 hover:text-white transition-colors",children:E?e.jsx(fr,{className:"w-4 h-4 text-sky-400"}):e.jsx(gr,{className:"w-4 h-4"})})}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-semibold text-white",children:ee.classroomName||"未分配班级"}),e.jsx("span",{className:"text-xs text-slate-500",children:ee.classroomId})]}),e.jsx("button",{onClick:()=>ft(ee),title:"修改班级名称",className:"p-1 rounded hover:bg-slate-800 text-slate-400 hover:text-sky-400 transition-colors",children:e.jsx(rl,{className:"w-3.5 h-3.5"})})]})}),e.jsx("td",{className:"py-3.5 px-4",children:ee.isOnline?e.jsx(it,{label:"在线",variant:"emerald"}):e.jsx(it,{label:"离线",variant:"slate"})}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-mono text-xs text-slate-200",children:ee.hostname||ee.deviceId.slice(0,16)}),e.jsx("span",{className:"font-mono text-xs text-slate-500",children:ee.remoteIp||"内网DHCP"})]})}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsx("span",{className:"font-mono text-xs px-2 py-0.5 rounded bg-slate-950 border border-slate-800 text-slate-400",children:ee.clientVersion||"v2.1.0"})}),e.jsx("td",{className:"py-3.5 px-4",children:Pe(ee)}),e.jsx("td",{className:"py-3.5 px-4",children:e.jsx("span",{className:"text-xs text-slate-400",children:ee.licensedUntil?ee.licensedUntil.slice(0,10):"未激活"})}),e.jsx("td",{className:"py-3.5 px-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs("button",{onClick:()=>ft(ee),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-semibold bg-slate-800 text-slate-300 border border-slate-700/60 hover:bg-slate-700 hover:text-white transition-colors",children:[e.jsx(rl,{className:"w-3.5 h-3.5"}),"修改班级"]}),e.jsxs("button",{onClick:()=>B(ee),className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-lg text-xs font-semibold bg-sky-600/15 text-sky-400 border border-sky-500/25 hover:bg-sky-600/30 transition-colors",children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),"续期授权"]})]})})]},ee.deviceId)})})]})})}),e.jsx(Vt,{isOpen:Y,onClose:()=>z(!1),title:"学校统一学费批量直延 (Track A 零感续费)",children:e.jsxs("form",{onSubmit:Ge,className:"space-y-5",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-sky-500/10 border border-sky-500/20 text-xs text-sky-300 leading-relaxed",children:[e.jsxs("p",{className:"font-semibold mb-1 flex items-center gap-1.5",children:[e.jsx(cl,{className:"w-4 h-4 text-sky-400"}),"傻瓜式零感直延机制"]}),"已选择 ",e.jsx("strong",{children:P.length})," 台教室大屏。提交后服务端将原子化更新授权到期日,并通过 SignalR 广播至教室一体机即刻生效。",e.jsx("strong",{children:"一线任课教师无需在一体机上输入任何卡号,教学无打扰。"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-slate-400",children:"续期时长选择"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{le("preset"),pe(30)},className:`p-3 rounded-xl border text-center transition-all ${ae==="preset"&&O===30?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold shadow-sm":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700"}`,children:[e.jsx("div",{className:"text-sm font-bold text-white",children:"30 天"}),e.jsx("div",{className:"text-xs text-slate-500",children:"1 个月月卡"})]}),e.jsxs("button",{type:"button",onClick:()=>{le("preset"),pe(180)},className:`p-3 rounded-xl border text-center transition-all relative ${ae==="preset"&&O===180?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold shadow-sm":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700"}`,children:[e.jsx("span",{className:"absolute -top-2 right-2 text-[10px] px-1.5 py-0.2 rounded-full bg-sky-500 text-white font-bold",children:"常用"}),e.jsx("div",{className:"text-sm font-bold text-white",children:"180 天"}),e.jsx("div",{className:"text-xs text-slate-500",children:"半学年 / 1学期"})]}),e.jsxs("button",{type:"button",onClick:()=>{le("preset"),pe(365)},className:`p-3 rounded-xl border text-center transition-all relative ${ae==="preset"&&O===365?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold shadow-sm":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700"}`,children:[e.jsx("span",{className:"absolute -top-2 right-2 text-[10px] px-1.5 py-0.2 rounded-full bg-emerald-500 text-white font-bold",children:"推荐"}),e.jsx("div",{className:"text-sm font-bold text-white",children:"365 天"}),e.jsx("div",{className:"text-xs text-slate-500",children:"全学年 / 1整年"})]}),e.jsxs("button",{type:"button",onClick:()=>{le("preset"),pe(1095)},className:`p-3 rounded-xl border text-center transition-all relative ${ae==="preset"&&O===1095?"bg-sky-600/20 border-sky-500 text-sky-300 font-semibold shadow-sm":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700"}`,children:[e.jsx("span",{className:"absolute -top-2 right-2 text-[10px] px-1.5 py-0.2 rounded-full bg-indigo-500 text-white font-bold",children:"三学年"}),e.jsx("div",{className:"text-sm font-bold text-white",children:"1095 天"}),e.jsx("div",{className:"text-xs text-slate-500",children:"初/高中大卡"})]}),e.jsxs("button",{type:"button",onClick:()=>le("perpetual"),className:`p-3 rounded-xl border text-center transition-all relative ${ae==="perpetual"?"bg-purple-600/25 border-purple-500 text-purple-300 font-semibold shadow-sm":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700"}`,children:[e.jsx("span",{className:"absolute -top-2 right-2 text-[10px] px-1.5 py-0.2 rounded-full bg-purple-500 text-white font-bold",children:"买断"}),e.jsx("div",{className:"text-sm font-bold text-white",children:"永久授权"}),e.jsx("div",{className:"text-xs text-slate-500",children:"终身有效"})]})]}),ae==="perpetual"&&e.jsxs("div",{className:"p-3.5 rounded-xl bg-purple-950/40 border border-purple-800/60 flex items-center gap-3",children:[e.jsx(Ht,{className:"w-5 h-5 text-purple-400 shrink-0"}),e.jsxs("div",{className:"text-xs text-purple-200",children:[e.jsx("span",{className:"font-bold",children:"永久商业授权模式:"}),"所选终端将不受任何到期日限制,系统将设置其授权等级为 Perpetual,教室端永久开机可用。"]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>le("custom_days"),className:`flex-1 py-2 px-3 rounded-xl border text-xs font-medium transition-all ${ae==="custom_days"?"bg-sky-600/20 border-sky-500 text-sky-300":"bg-slate-950 border-slate-800 text-slate-400"}`,children:"自定义有效天数 (1~3650天)"}),e.jsx("button",{type:"button",onClick:()=>le("valid_through"),className:`flex-1 py-2 px-3 rounded-xl border text-xs font-medium transition-all ${ae==="valid_through"?"bg-sky-600/20 border-sky-500 text-sky-300":"bg-slate-950 border-slate-800 text-slate-400"}`,children:"指定绝对截止日期"})]}),ae==="custom_days"&&e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-slate-400",children:"增加有效天数:"}),e.jsx("input",{type:"number",min:1,max:3650,value:ne,onChange:ee=>ve(parseInt(ee.target.value,10)||1),className:"w-24 px-2 py-1 rounded bg-slate-900 border border-slate-700 text-white text-sm font-mono text-center focus:border-sky-500"}),e.jsx("span",{className:"text-xs text-slate-500",children:"天 (从当前到期日无损累加)"})]}),ae==="valid_through"&&e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 flex items-center gap-3",children:[e.jsx(Ul,{className:"w-4 h-4 text-sky-400"}),e.jsx("span",{className:"text-xs text-slate-400",children:"续期至该日 23:59:59:"}),e.jsx("input",{type:"date",value:Q,onChange:ee=>R(ee.target.value),className:"px-2 py-1 rounded bg-slate-900 border border-slate-700 text-white text-sm font-mono focus:border-sky-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-slate-400 mb-1.5",children:"续期审计备注"}),e.jsx("input",{type:"text",value:W,onChange:ee=>te(ee.target.value),placeholder:"例如:2026年秋季学期学费收缴统一顺延",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-slate-200 text-sm focus:border-sky-500"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>z(!1),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white hover:bg-slate-800 text-sm font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:Z,className:"inline-flex items-center gap-2 px-5 py-2 rounded-xl bg-gradient-to-r from-sky-500 to-indigo-600 text-white font-semibold text-sm shadow-lg shadow-sky-500/20 hover:from-sky-400 hover:to-indigo-500 disabled:opacity-50",children:Z?e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"w-4 h-4 animate-spin"}),"正在执行批量续期..."]}):e.jsxs(e.Fragment,{children:[e.jsx(is,{className:"w-4 h-4"}),"确认批量直延 (",P.length,"台)"]})})]})]})}),e.jsx(Vt,{isOpen:!!g,onClose:()=>B(null),title:`教室大屏授权续期 - ${(g==null?void 0:g.classroomName)||""}`,children:e.jsxs("form",{onSubmit:Nt,className:"space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 space-y-1 text-xs",children:[e.jsxs("div",{className:"text-slate-400",children:["设备标识: ",e.jsx("span",{className:"font-mono text-slate-200",children:g==null?void 0:g.deviceId})]}),e.jsxs("div",{className:"text-slate-400",children:["当前到期日: ",e.jsx("span",{className:"text-sky-300 font-semibold",children:((Xe=g==null?void 0:g.licensedUntil)==null?void 0:Xe.slice(0,10))||"未激活"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-400 mb-1.5",children:"方式一:直接后台延期 (默认顺延 180 天)"}),e.jsx("p",{className:"text-xs text-slate-500",children:"点击下方确认按钮,服务端直接顺延,教室端自动刷新。"})]}),e.jsxs("div",{className:"relative py-2",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-slate-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs",children:e.jsx("span",{className:"bg-slate-900 px-2 text-slate-500",children:"或"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-400 mb-1.5",children:"方式二:输入新发放的激活兑换码"}),e.jsx("input",{type:"text",value:ue,onChange:ee=>U(ee.target.value.toUpperCase()),placeholder:"例如: 8K4D-29DP",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-slate-100 font-mono text-sm tracking-wider uppercase focus:border-sky-500"}),e.jsx("span",{className:"text-xs text-slate-500 mt-1 block",children:"若输入新激活码,将核销该码并将码内时长累加到该设备中。"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>B(null),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-sm",children:"取消"}),e.jsx("button",{type:"submit",disabled:ge,className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white font-semibold text-sm disabled:opacity-50",children:ge?"正在更新授权...":"确认更新"})]})]})}),e.jsx(Vt,{isOpen:!!Ne,onClose:()=>ye(null),title:`修改班级名称 - ${(Ne==null?void 0:Ne.classroomName)||(Ne==null?void 0:Ne.deviceId)||""}`,preventClose:et,children:e.jsxs("form",{onSubmit:wt,className:"space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-slate-950 border border-slate-800 space-y-1 text-xs",children:[e.jsxs("div",{className:"text-slate-400",children:["设备标识: ",e.jsx("span",{className:"font-mono text-slate-200",children:Ne==null?void 0:Ne.deviceId})]}),e.jsxs("div",{className:"text-slate-400",children:["所属教室 ID: ",e.jsx("span",{className:"font-mono text-slate-300",children:Ne==null?void 0:Ne.classroomId})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-slate-300 mb-1.5",children:"班级显示名称"}),e.jsx("input",{type:"text",value:de,onChange:ee=>De(ee.target.value),placeholder:"例如:81班、82、810班",className:"w-full px-3 py-2 rounded-xl bg-slate-950 border border-slate-800 text-white text-sm focus:outline-none focus:border-sky-500",required:!0}),e.jsx("span",{className:"text-xs text-slate-400 mt-1 block",children:"* 格式规则:除汉字“班”外不可包含其他汉字(推荐如:81班、82、810班),保存后将即时广播同步至该教室一体机大屏界面。"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-3 border-t border-slate-800",children:[e.jsx("button",{type:"button",disabled:et,onClick:()=>ye(null),className:"px-4 py-2 rounded-xl text-slate-400 hover:text-white text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:et||!de.trim(),className:"px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white font-semibold text-xs transition-colors disabled:opacity-50",children:et?"保存中...":"确认修改"})]})]})})]})},Zg=()=>{const[a,l]=x.useState([]),[i,c]=x.useState(!0),[u,m]=x.useState(""),[p,b]=x.useState("all"),[f,j]=x.useState(null),k=async()=>{try{const w=await J.getSchoolNotifications(100);l(w)}catch(w){console.error("Failed to load school notifications",w)}finally{c(!1)}};x.useEffect(()=>{k();const w=setInterval(k,8e3);return()=>clearInterval(w)},[]);const T=w=>{if(!w)return"--";try{return new Date(w).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return w}},C=(w,M)=>{if(!M)return null;try{const Y=new Date(w).getTime(),z=new Date(M).getTime(),ae=Math.round((z-Y)/1e3);return ae>=0?ae:0}catch{return null}},I=a.filter(w=>{const M=w.className.toLowerCase().includes(u.toLowerCase())||w.senderName.toLowerCase().includes(u.toLowerCase())||w.message.toLowerCase().includes(u.toLowerCase())||w.id.toLowerCase().includes(u.toLowerCase()),Y=p==="all"||w.status.toLowerCase()===p.toLowerCase();return M&&Y}),P=a.length,q=a.filter(w=>w.status==="Acknowledged"||w.confirmedAt).length,v=P>0?Math.round(q/P*100):100;return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{title:"本校通知广播与回执审计",description:"全校点对点呼叫与应急广播历史留痕:实时查验每间教室大屏对教师通知的接收与学生点击确认闭环。",badge:"校级回执审计",action:e.jsxs("button",{onClick:()=>{c(!0),k()},className:"flex items-center gap-1.5 px-3.5 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold transition-colors border border-slate-700 shadow-sm",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${i?"animate-spin":""}`}),"刷新回执"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"本校通知呼叫总数"}),e.jsx(ll,{className:"w-4 h-4 text-sky-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-white mt-2 font-mono",children:[P," ",e.jsx("span",{className:"text-sm font-normal text-slate-400",children:"次"})]}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"包含教师点名、寻人、教务通知"})]}),e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"大屏确认闭环率 (ACK)"}),e.jsx(_c,{className:"w-4 h-4 text-emerald-400"})]}),e.jsxs("div",{className:"text-2xl font-bold text-emerald-400 mt-2 font-mono",children:[v,"%"]}),e.jsxs("div",{className:"text-[11px] text-slate-500 mt-1",children:["已确认: ",q," / ",P]})]}),e.jsxs("div",{className:"glass-panel p-4 rounded-2xl border-slate-800 bg-slate-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-400",children:"终端回执在线率"}),e.jsx(_t,{className:"w-4 h-4 text-indigo-400"})]}),e.jsx("div",{className:"text-2xl font-bold text-indigo-300 mt-2 font-mono",children:"100%"}),e.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"教室大屏实时双向长连接保障"})]})]}),e.jsxs("div",{className:"glass-panel p-4 border-slate-800 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsx("div",{className:"flex-1 w-full sm:w-auto",children:e.jsxs("div",{className:"flex items-center gap-2 bg-slate-950/60 border border-slate-800 rounded-xl px-3 py-2 text-xs",children:[e.jsx(vn,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("input",{type:"text",value:u,onChange:w=>m(w.target.value),placeholder:"搜索班级、发送教师姓名、通知正文或单号...",className:"bg-transparent border-none text-xs text-white placeholder-slate-500 focus:outline-none w-full"})]})}),e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsx(Oc,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsxs("select",{value:p,onChange:w=>b(w.target.value),className:"bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-slate-200 focus:border-sky-500 outline-none w-full sm:w-auto",children:[e.jsx("option",{value:"all",children:"所有状态"}),e.jsx("option",{value:"Acknowledged",children:"已收到并确认 (Acknowledged)"}),e.jsx("option",{value:"Delivered",children:"已送达大屏 (Delivered)"}),e.jsx("option",{value:"Sent",children:"已下发待送达 (Sent)"}),e.jsx("option",{value:"Timeout",children:"超时未确认 (Timeout)"})]})]})]}),e.jsx("div",{className:"glass-panel border-slate-800 overflow-hidden rounded-2xl",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs",children:[e.jsx("thead",{className:"text-[11px] uppercase tracking-wider text-slate-400 bg-slate-900/80 border-b border-slate-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"目标班级"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"通知正文与级别"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"发起教师"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"下发时间"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold",children:"大屏回执状态"}),e.jsx("th",{className:"py-3.5 px-4 font-semibold text-right",children:"确认时间 / 耗时"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-800/60 font-sans",children:I.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"text-center py-12 text-slate-500",children:i?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(xt,{className:"w-4 h-4 animate-spin text-sky-400"}),e.jsx("span",{children:"正在调取本校呼叫记录..."})]}):"暂无符合条件的通知历史"})}):I.map(w=>{const M=C(w.createdAt,w.confirmedAt),Y=w.status==="Acknowledged"||!!w.confirmedAt;return e.jsxs("tr",{className:"hover:bg-slate-800/30 transition-colors cursor-pointer",onClick:()=>j(w),children:[e.jsxs("td",{className:"py-3.5 px-4 whitespace-nowrap",children:[e.jsxs("div",{className:"font-semibold text-white flex items-center gap-1.5",children:[e.jsx(tl,{className:"w-3.5 h-3.5 text-sky-400 shrink-0"}),e.jsx("span",{children:w.className})]}),e.jsxs("div",{className:"text-[10px] font-mono text-slate-500 mt-0.5",children:["ID: ",w.classId]})]}),e.jsxs("td",{className:"py-3.5 px-4 max-w-md",children:[e.jsx("div",{className:"text-slate-200 font-medium text-xs break-words line-clamp-2",children:w.message}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:`px-1.5 py-0.2 rounded text-[10px] font-bold ${w.priority==="Urgent"||w.priority==="High"?"bg-rose-950 text-rose-300 border border-rose-800":"bg-slate-800 text-slate-300"}`,children:w.priority||"普通"}),e.jsxs("span",{className:"text-[10px] font-mono text-slate-500",children:["ID: ",w.id.substring(0,8),"..."]})]})]}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-1.5 text-slate-200 font-medium",children:[e.jsx(Bs,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),e.jsx("span",{children:w.senderName})]})}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap font-mono text-slate-400",children:T(w.createdAt)}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap",children:e.jsx("span",{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-semibold border ${Y?"bg-emerald-950/80 text-emerald-300 border-emerald-800/80":w.status==="Delivered"?"bg-sky-950/80 text-sky-300 border-sky-800/80":"bg-amber-950/80 text-amber-300 border-amber-800/80"}`,children:Y?e.jsxs(e.Fragment,{children:[e.jsx(ot,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{children:"已确认 (ACK)"})]}):e.jsxs(e.Fragment,{children:[e.jsx(os,{className:"w-3.5 h-3.5 text-amber-400"}),e.jsx("span",{children:w.status})]})})}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap text-right",children:w.confirmedAt?e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-emerald-400 font-medium",children:T(w.confirmedAt)}),M!==null&&e.jsxs("div",{className:"text-[10px] text-slate-500 font-mono mt-0.5",children:["响应耗时: ",M,"s"]})]}):e.jsx("span",{className:"text-slate-500 text-[11px]",children:"等待大屏点击"})})]},w.id)})})]})})})]})},eb=({isOpen:a,onClose:l,onPaymentSuccess:i})=>{const c=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),[u,m]=x.useState(c?"voucher":"pay"),[p,b]=x.useState("WeChatPay"),[f,j]=x.useState(null),[k,T]=x.useState(null),[C,I]=x.useState(19900),[P,q]=x.useState(null),[v,w]=x.useState("Idle"),[M,Y]=x.useState(null),[z,ae]=x.useState(900),[le,O]=x.useState(""),[pe,ne]=x.useState(!1),[ve,Q]=x.useState(null),[R,W]=x.useState(null),[te,Le]=x.useState(!1),K=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||!1,Z=x.useRef(null),G=async(ue=p)=>{w("Creating"),Y(null),j(null),T(null);try{const U=await J.createPayOrder(ue);j(U.orderNo),T(U.codeUrl||null),I(U.amountFen||19900),q(U.expiredAtUtc),w("Pending"),ae(900)}catch(U){w("Error"),Y((U==null?void 0:U.message)||"创建订单失败,请稍后重试")}};x.useEffect(()=>{a&&u==="pay"&&!f&&v==="Idle"&&G(p),a||(Z.current&&clearTimeout(Z.current),w("Idle"),j(null),T(null),Q(null),W(null),O(""))},[a,u]),x.useEffect(()=>{if(!a||!f||v!=="Pending"){Z.current&&clearTimeout(Z.current);return}const ue=Date.now(),U=async()=>{const ge=Date.now()-ue;if(ge>900*1e3){w("Timeout");return}try{const Ne=await J.getOrderStatus(f);if(Ne.status==="Paid"){w("Paid"),i&&i();return}else if(Ne.status==="Expired"||Ne.status==="Closed"){w("Timeout");return}}catch{}const je=ge<30*1e3?2e3:5e3;Z.current=setTimeout(U,je)};return Z.current=setTimeout(U,2e3),()=>{Z.current&&clearTimeout(Z.current)}},[a,f,v]),x.useEffect(()=>{if(v!=="Pending")return;const ue=setInterval(()=>{ae(U=>U<=1?(clearInterval(ue),w("Timeout"),0):U-1)},1e3);return()=>clearInterval(ue)},[v]);const re=async ue=>{if(ue.preventDefault(),!!le.trim()){ne(!0),W(null),Q(null);try{const U=await J.redeemVoucher(le.trim());Q(`兑换成功!已为您延长 ${U.durationDays||365} 天正式版服务。`),O(""),i&&i()}catch(U){W((U==null?void 0:U.message)||"服务兑换码核销失败,请核对兑换码是否正确或已被使用")}finally{ne(!1)}}},se=ue=>{const U=ue.replace(/[^A-Za-z0-9]/g,"").toUpperCase().slice(0,16),ge=[];for(let je=0;je{if(f){Le(!0);try{await J.mockPayOrder(f),w("Paid"),i&&i()}catch(ue){alert((ue==null?void 0:ue.message)||"模拟支付调用失败")}finally{Le(!1)}}},B=ue=>{const U=Math.floor(ue/60),ge=ue%60;return`${U.toString().padStart(2,"0")}:${ge.toString().padStart(2,"0")}`};return e.jsx(Vt,{isOpen:a,onClose:l,title:"开通 / 续费 ClassNotify 正式版",maxWidth:"max-w-lg",children:e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"bg-gradient-to-r from-blue-900/40 via-indigo-900/30 to-purple-900/40 border border-blue-500/30 rounded-2xl p-4 flex items-center justify-between",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cl,{className:"w-4 h-4 text-blue-400"}),e.jsx("span",{className:"font-bold text-white text-sm sm:text-base",children:"个人教师年度版"}),e.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded-full bg-blue-400/20 text-blue-300 font-semibold border border-blue-400/30",children:["¥",(C/100).toFixed(2)," / 年"]})]}),e.jsx("p",{className:"text-xs text-slate-300",children:"1 个教师账号 · 支持绑定最多 4 台班级大屏 · 全年无休实时送达"})]})}),e.jsxs("div",{className:"flex rounded-xl bg-slate-950 p-1 border border-slate-800",children:[e.jsxs("button",{type:"button",onClick:()=>{m("pay"),f||G(p)},className:`flex-1 py-2 rounded-lg text-xs font-medium flex items-center justify-center gap-1.5 transition-all ${u==="pay"?"bg-blue-600 text-white shadow-sm":"text-slate-400 hover:text-white"}`,children:[e.jsx(rf,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"在线扫码支付"})]}),e.jsxs("button",{type:"button",onClick:()=>m("voucher"),className:`flex-1 py-2 rounded-lg text-xs font-medium flex items-center justify-center gap-1.5 transition-all ${u==="voucher"?"bg-blue-600 text-white shadow-sm":"text-slate-400 hover:text-white"}`,children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"服务兑换码"})]})]}),u==="pay"&&e.jsx("div",{className:"space-y-4",children:c?e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 text-center space-y-3",children:[e.jsx(xg,{className:"w-10 h-10 text-blue-400 mx-auto"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-white",children:"检测到您正处于移动端设备"}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:"为保障支付安全与扫码体验,推荐您在电脑端浏览器打开 ClassNotify 完成微信或支付宝扫码,或直接在下方切换为服务兑换码。"})]}),e.jsxs("button",{type:"button",onClick:()=>m("voucher"),className:"w-full py-2.5 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold flex items-center justify-center gap-2 transition-colors",children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"使用服务兑换码直接兑换"})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{b("WeChatPay"),G("WeChatPay")},className:`py-2 px-3 rounded-xl border text-xs font-medium flex items-center justify-center gap-2 transition-all ${p==="WeChatPay"?"border-emerald-500 bg-emerald-500/10 text-emerald-400 font-semibold":"border-slate-800 bg-slate-950/60 text-slate-400 hover:text-white"}`,children:e.jsx("span",{children:"🟢 微信支付"})}),e.jsx("button",{type:"button",onClick:()=>{b("Alipay"),G("Alipay")},className:`py-2 px-3 rounded-xl border text-xs font-medium flex items-center justify-center gap-2 transition-all ${p==="Alipay"?"border-blue-500 bg-blue-500/10 text-blue-400 font-semibold":"border-slate-800 bg-slate-950/60 text-slate-400 hover:text-white"}`,children:e.jsx("span",{children:"🔵 支付宝"})})]}),e.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-2xl p-6 flex flex-col items-center justify-center min-h-[300px]",children:[v==="Creating"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 py-8",children:[e.jsx(xt,{className:"w-8 h-8 animate-spin text-blue-400"}),e.jsx("span",{className:"text-xs",children:"正在向支付网关创建安全订单..."})]}),v==="Error"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-rose-400 py-8 text-center px-4",children:[e.jsx(Zt,{className:"w-8 h-8 text-rose-500"}),e.jsx("span",{className:"text-xs",children:M}),e.jsx("button",{type:"button",onClick:()=>G(p),className:"px-4 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs mt-2",children:"重新生成支付二维码"})]}),v==="Timeout"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-amber-400 py-8 text-center px-4",children:[e.jsx(os,{className:"w-8 h-8 text-amber-500"}),e.jsx("span",{className:"text-xs font-medium",children:"订单已过期(超过 15 分钟)"}),e.jsx("button",{type:"button",onClick:()=>G(p),className:"px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-500 text-white text-xs mt-2",children:"重新发起支付"})]}),v==="Paid"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-emerald-400 py-8 text-center animate-in zoom-in-95",children:[e.jsx(ot,{className:"w-12 h-12 text-emerald-400"}),e.jsx("span",{className:"text-sm font-semibold text-white",children:"支付成功!"}),e.jsx("span",{className:"text-xs text-slate-300",children:"您的教师正式版服务已即时生效并延长 365 天。"}),e.jsx("button",{type:"button",onClick:l,className:"px-6 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-medium mt-3",children:"返回控制台"})]}),v==="Pending"&&k&&e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"p-3 bg-white rounded-2xl shadow-xl border border-slate-200 flex items-center justify-center",children:e.jsx("img",{src:`https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(k)}&size=220x220`,alt:"支付二维码",width:220,height:220,className:"rounded-lg select-none"})}),e.jsxs("div",{className:"text-center space-y-1",children:[e.jsxs("p",{className:"text-xs font-medium text-slate-200 flex items-center justify-center gap-1.5",children:[e.jsx(qf,{className:"w-3.5 h-3.5 text-blue-400"}),e.jsxs("span",{children:["请使用",p==="WeChatPay"?"微信":"支付宝","扫一扫"]})]}),e.jsxs("p",{className:"text-[11px] text-slate-400 flex items-center justify-center gap-1",children:[e.jsx(os,{className:"w-3 h-3 text-amber-400"}),e.jsx("span",{children:"二维码有效剩余时间:"}),e.jsx("span",{className:"font-mono text-amber-400 font-semibold",children:B(z)})]})]}),e.jsxs("div",{className:"text-[11px] text-slate-500 font-mono",children:["订单号:",f]}),K&&e.jsx("div",{className:"pt-2 border-t border-slate-800 w-full text-center",children:e.jsx("button",{type:"button",onClick:g,disabled:te,className:"px-3 py-1.5 rounded-lg bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 text-xs font-medium border border-amber-500/30 transition-colors",children:te?"正在模拟支付...":"⚡ 开发环境:一键模拟支付成功"})})]})]})]})}),u==="voucher"&&e.jsxs("form",{onSubmit:re,className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 text-xs space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-300 font-medium",children:[e.jsx(rt,{className:"w-4 h-4 text-emerald-400"}),e.jsx("span",{children:"服务兑换码说明"})]}),e.jsxs("p",{className:"text-slate-400 leading-relaxed text-[11px]",children:["输入销售渠道或机构统一采购发放的服务兑换码(如 ",e.jsx("span",{className:"font-mono text-slate-300",children:"XXXX-XXXX-XXXX-XXXX"}),"),即可即时开通 365 天教师正式版服务。"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-medium text-slate-300",children:"服务兑换码"}),e.jsx("input",{type:"text",value:le,onChange:ue=>se(ue.target.value),placeholder:"例如:3RCU-JWWH-R9FK-8Y6K",maxLength:24,className:"w-full px-4 py-2.5 rounded-xl bg-slate-950 border border-slate-800 text-white placeholder-slate-600 font-mono text-sm tracking-wider focus:outline-none focus:border-blue-500 transition-colors"})]}),R&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs flex items-center gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 shrink-0 text-rose-400"}),e.jsx("span",{children:R})]}),ve&&e.jsxs("div",{className:"p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 text-xs flex items-center gap-2",children:[e.jsx(ot,{className:"w-4 h-4 shrink-0 text-emerald-400"}),e.jsx("span",{children:ve})]}),e.jsx("button",{type:"submit",disabled:pe||le.replace(/[\s-]/g,"").length<8,className:"w-full py-2.5 rounded-xl bg-blue-600 hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed text-white text-xs font-semibold transition-colors flex items-center justify-center gap-2",children:pe?e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在安全核销服务兑换码..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"立即核销兑换正式版服务"})]})})]})]})})},tb=({onOpenCheckout:a})=>{const{user:l,refreshUser:i}=Ol(),[c,u]=x.useState(null),[m,p]=x.useState(!1),[b,f]=x.useState(""),[j,k]=x.useState(""),[T,C]=x.useState(!1),[I,P]=x.useState(""),[q,v]=x.useState(""),[w,M]=x.useState(""),[Y,z]=x.useState(""),[ae,le]=x.useState(""),[O,pe]=x.useState(!1),[ne,ve]=x.useState(""),[Q,R]=x.useState(""),[W,te]=x.useState(""),[Le,K]=x.useState(!1),[Z,G]=x.useState(null),[re,se]=x.useState(!1),[g,B]=x.useState("");x.useEffect(()=>{ue()},[]);const ue=async()=>{p(!0);try{const de=await J.getTeacherProfile();u(de),f(de.fullName||(l==null?void 0:l.name)||""),k(de.spaceName||"")}catch(de){v((de==null?void 0:de.message)||"获取个人资料失败")}finally{p(!1)}},U=async de=>{de.preventDefault(),C(!0),P(""),v("");try{const De=await J.updateTeacherProfile({fullName:b.trim(),spaceName:j.trim()});u(De),P("个人资料修改成功!"),await i(),setTimeout(()=>P(""),3e3)}catch(De){v((De==null?void 0:De.message)||"修改个人资料失败")}finally{C(!1)}},ge=async de=>{if(de.preventDefault(),ve(""),R(""),!w){R("请输入当前原密码");return}if(Y.length<8){R("新密码长度不能少于 8 位");return}if(Y!==ae){R("两次输入的新密码不一致");return}pe(!0);try{await J.changeTeacherPassword({currentPassword:w,newPassword:Y,confirmPassword:ae}),ve("密码修改成功!所有会话已安全更新。"),M(""),z(""),le(""),setTimeout(()=>ve(""),4e3)}catch(De){R((De==null?void 0:De.message)||"密码修改失败,请核对当前密码")}finally{pe(!1)}},je=async de=>{if(de.preventDefault(),B(""),!W){B("请输入当前登录密码以验证身份");return}K(!0);try{const De=await J.rotateRecoveryKey(W);G(De.recoveryKey),te("")}catch(De){B((De==null?void 0:De.message)||"生成新密钥失败,请核对密码是否正确")}finally{K(!1)}},Ne=()=>{Z&&(navigator.clipboard.writeText(Z),se(!0),setTimeout(()=>se(!1),2e3))},ye=()=>{if(!Z)return;const de=`======================================== ClassNotify 教师安全恢复密钥备份 ======================================== 教师称谓: ${b||(c==null?void 0:c.fullName)||(l==null?void 0:l.name)||"未知"} 登录账号: ${(c==null?void 0:c.mobile)||(c==null?void 0:c.username)||(l==null?void 0:l.userId)||"未知"} 生成时间: ${new Date().toLocaleString()} 【安全恢复密钥】: ${Z} ---------------------------------------- ⚠️ 重要安全说明: 1. 此密钥是您在忘记登录密码且无法接收短信时的唯一自主重置凭据。 2. 服务端仅保留此密钥的哈希特征,无法反查明文,请妥善保存在安全的离线磁盘或打印备查。 ======================================== `,De=new Blob([de],{type:"text/plain;charset=utf-8"}),et=URL.createObjectURL(De),ct=document.createElement("a");ct.href=et,ct.download=`ClassNotify_安全恢复密钥_${(c==null?void 0:c.mobile)||(c==null?void 0:c.username)||"teacher"}.txt`,ct.click(),URL.revokeObjectURL(et)};return e.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-4 border-b border-slate-800",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl sm:text-2xl font-bold text-white tracking-tight flex items-center gap-2.5",children:[e.jsx(Bs,{className:"w-6 h-6 text-indigo-400"}),"个人资料"]}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-400 mt-1",children:"管理教师称谓、登录密码与安全自救凭据"})]}),c&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:`px-3 py-1 rounded-full text-xs font-medium border flex items-center gap-1.5 ${c.subscriptionState==="VIP"?"bg-blue-500/10 border-blue-500/30 text-blue-300":c.subscriptionState==="Trial"?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${c.subscriptionState==="VIP"?"bg-blue-400":c.subscriptionState==="Trial"?"bg-emerald-400":"bg-rose-400"}`}),c.subscriptionState==="VIP"?`正式版${c.vipExpiresAt?` · 至 ${c.vipExpiresAt.slice(0,10)}`:""}`:c.subscriptionState==="Trial"?c.trialEndsAt?`免费试用中 · 剩 ${Math.max(0,Math.ceil((new Date(c.trialEndsAt).getTime()-Date.now())/(1e3*60*60*24)))} 天`:"免费试用 · 待绑定首台大屏":"服务已到期"]}),a&&e.jsx("button",{type:"button",onClick:a,className:"px-3 py-1 rounded-full text-xs font-semibold bg-indigo-600 hover:bg-indigo-500 text-white transition-colors",children:c.subscriptionState==="VIP"?"续费":"开通正式版"})]})]}),m?e.jsxs("div",{className:"py-20 flex flex-col items-center justify-center space-y-3",children:[e.jsx(Ct,{className:"w-8 h-8 text-indigo-500 animate-spin"}),e.jsx("p",{className:"text-sm text-slate-400",children:"正在加载个人资料..."})]}):e.jsxs("div",{className:"space-y-6",children:[c&&e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-xl flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center shrink-0 ${c.subscriptionState==="VIP"?"bg-blue-500/10 border border-blue-500/20 text-blue-400":c.subscriptionState==="Trial"?c.trialEndsAt?"bg-emerald-500/10 border border-emerald-500/20 text-emerald-400":"bg-amber-500/10 border border-amber-500/20 text-amber-400":"bg-rose-500/10 border border-rose-500/20 text-rose-400"}`,children:e.jsx(Ul,{className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-bold text-white",children:c.subscriptionState==="VIP"?"正式版授权":c.subscriptionState==="Trial"?c.trialEndsAt?"免费试用期":"免费试用(待开启)":"授权已到期"}),e.jsx("span",{className:`text-xs px-2.5 py-0.5 rounded-full font-medium ${c.subscriptionState==="VIP"?"bg-blue-500/20 text-blue-300":c.subscriptionState==="Trial"?c.trialEndsAt?"bg-emerald-500/20 text-emerald-300":"bg-amber-500/20 text-amber-300":"bg-rose-500/20 text-rose-300"}`,children:c.subscriptionState==="VIP"?"正常服务":c.subscriptionState==="Trial"?c.trialEndsAt?"试用中":"未开启":"已暂停"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 mt-1.5 text-xs text-slate-300",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"服务到期时间:"}),e.jsx("span",{className:"font-semibold text-white",children:c.subscriptionState==="VIP"?c.vipExpiresAt?new Date(c.vipExpiresAt).toLocaleString():"永久有效":c.subscriptionState==="Trial"?c.trialEndsAt?new Date(c.trialEndsAt).toLocaleString():"未开启(绑定首台大屏后自动开启7天试用)":"已到期"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"剩余有效期:"}),e.jsx("span",{className:"font-semibold text-indigo-400",children:c.subscriptionState==="VIP"&&c.vipExpiresAt?`${Math.max(0,Math.ceil((new Date(c.vipExpiresAt).getTime()-Date.now())/(1e3*60*60*24)))} 天`:c.subscriptionState==="Trial"?c.trialEndsAt?`${Math.max(0,Math.ceil((new Date(c.trialEndsAt).getTime()-Date.now())/(1e3*60*60*24)))} 天`:"7 天(绑定首台大屏后生效)":"已到期"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-400",children:"大屏配额:"}),e.jsxs("span",{className:"font-medium text-slate-300",children:["已绑定 ",c.activeScreenCount," / ",c.screenLimit," 块大屏"]})]})]})]})]}),a&&e.jsxs("button",{type:"button",onClick:a,className:"px-4 py-2 rounded-xl text-xs font-semibold bg-indigo-600 hover:bg-indigo-500 text-white shadow-lg transition-colors flex items-center gap-1.5 shrink-0 self-start sm:self-center",children:[e.jsx(cl,{className:"w-3.5 h-3.5"}),c.subscriptionState==="VIP"?"续费延长到期时间":"升级正式版"]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-6 shadow-xl flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 pb-4 mb-5 border-b border-slate-800/80",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400",children:e.jsx(Bs,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-white",children:"教师称谓与工作台信息"}),e.jsx("p",{className:"text-xs text-slate-400",children:"设置发送通知时的署名与工作台抬头"})]})]}),I&&e.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 text-xs flex items-center gap-2",children:[e.jsx(is,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:I})]}),q&&e.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs flex items-center gap-2",children:[e.jsx(Qt,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:q})]}),e.jsxs("form",{onSubmit:U,id:"profile-form",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Hf,{className:"w-3.5 h-3.5 text-slate-400"}),"登录手机账号"]}),e.jsx("span",{className:"text-[11px] text-slate-500",children:"不可修改"})]}),e.jsx("input",{type:"text",disabled:!0,value:(c==null?void 0:c.mobile)||(c==null?void 0:c.username)||(l==null?void 0:l.userId)||"",className:"w-full bg-slate-950/80 border border-slate-800 rounded-xl px-3.5 py-2.5 text-sm text-slate-400 cursor-not-allowed font-mono"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Bs,{className:"w-3.5 h-3.5 text-indigo-400"}),"教师称谓 / 姓名"]}),e.jsx("span",{className:"text-[11px] text-slate-400",children:"用于通知落款"})]}),e.jsx("input",{type:"text",required:!0,maxLength:20,placeholder:"例如:张老师、李主任",value:b,onChange:de=>f(de.target.value),className:"w-full bg-slate-950 border border-slate-700/80 focus:border-indigo-500 rounded-xl px-3.5 py-2.5 text-sm text-white placeholder-slate-500 outline-none transition-colors"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ks,{className:"w-3.5 h-3.5 text-indigo-400"}),"工作台备注名称"]}),e.jsx("span",{className:"text-[11px] text-slate-400",children:"个性化标记"})]}),e.jsx("input",{type:"text",maxLength:30,placeholder:"例如:高一创新班教学主页、初三数学组",value:j,onChange:de=>k(de.target.value),className:"w-full bg-slate-950 border border-slate-700/80 focus:border-indigo-500 rounded-xl px-3.5 py-2.5 text-sm text-white placeholder-slate-500 outline-none transition-colors"})]})]})]}),e.jsx("div",{className:"pt-5 mt-4 border-t border-slate-800/80 flex items-center justify-end",children:e.jsx("button",{type:"submit",form:"profile-form",disabled:T,className:"px-5 py-2.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 disabled:opacity-50 text-white font-medium text-xs flex items-center gap-2 transition-colors shadow-lg shadow-indigo-600/20",children:T?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在保存..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(tg,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"保存资料设置"})]})})})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-6 shadow-xl flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 pb-4 mb-5 border-b border-slate-800/80",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-amber-500/10 border border-amber-500/20 flex items-center justify-center text-amber-400",children:e.jsx(sl,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-white",children:"修改登录密码"}),e.jsx("p",{className:"text-xs text-slate-400",children:"需验证当前原密码,更新后安全刷新登录会话"})]})]}),ne&&e.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 text-xs flex items-center gap-2",children:[e.jsx(is,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:ne})]}),Q&&e.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs flex items-center gap-2",children:[e.jsx(Qt,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:Q})]}),e.jsxs("form",{onSubmit:ge,id:"password-form",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"当前原密码"}),e.jsx("input",{type:"password",required:!0,placeholder:"输入当前使用的登录密码",value:w,onChange:de=>M(de.target.value),className:"w-full bg-slate-950 border border-slate-700/80 focus:border-amber-500 rounded-xl px-3.5 py-2.5 text-sm text-white placeholder-slate-500 outline-none transition-colors"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-slate-300 mb-1.5 flex items-center justify-between",children:[e.jsx("span",{children:"新密码"}),e.jsx("span",{className:"text-[11px] text-slate-400",children:"至少 8 位"})]}),e.jsx("input",{type:"password",required:!0,minLength:8,placeholder:"输入 8 位以上新密码",value:Y,onChange:de=>z(de.target.value),className:"w-full bg-slate-950 border border-slate-700/80 focus:border-amber-500 rounded-xl px-3.5 py-2.5 text-sm text-white placeholder-slate-500 outline-none transition-colors"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"确认新密码"}),e.jsx("input",{type:"password",required:!0,minLength:8,placeholder:"再次输入新密码",value:ae,onChange:de=>le(de.target.value),className:"w-full bg-slate-950 border border-slate-700/80 focus:border-amber-500 rounded-xl px-3.5 py-2.5 text-sm text-white placeholder-slate-500 outline-none transition-colors"})]})]})]}),e.jsx("div",{className:"pt-5 mt-4 border-t border-slate-800/80 flex items-center justify-end",children:e.jsx("button",{type:"submit",form:"password-form",disabled:O,className:"px-5 py-2.5 rounded-xl bg-amber-600 hover:bg-amber-500 disabled:opacity-50 text-white font-medium text-xs flex items-center gap-2 transition-colors shadow-lg shadow-amber-600/20",children:O?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在更新..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(sl,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"更新登录密码"})]})})})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-6 shadow-xl lg:col-span-2",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-4 mb-5 border-b border-slate-800/80",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-rose-500/10 border border-rose-500/20 flex items-center justify-center text-rose-400",children:e.jsx(rt,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-white",children:"安全自救恢复密钥 (Recovery Key)"}),e.jsx("p",{className:"text-xs text-slate-400",children:"忘记密码时的最高重置凭据,系统采用零知识单向哈希,无法查看旧明文"})]})]})}),g&&e.jsxs("div",{className:"mb-4 p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-rose-300 text-xs flex items-center gap-2",children:[e.jsx(Qt,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:g})]}),Z?e.jsxs("div",{className:"p-5 rounded-xl bg-rose-950/30 border border-rose-800/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-rose-400 text-sm font-semibold",children:[e.jsx(Ht,{className:"w-4 h-4"}),e.jsx("span",{children:"新恢复密钥已生成(此密钥仅展示一次,请立即备份)"})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 flex flex-col sm:flex-row sm:items-center justify-between gap-3 font-mono text-base text-rose-300 tracking-wider font-bold",children:[e.jsx("span",{children:Z}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:Ne,className:"px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-xs text-white flex items-center gap-1.5 transition-colors font-sans",children:[re?e.jsx(is,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx(us,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:re?"已复制":"复制密钥"})]}),e.jsxs("button",{type:"button",onClick:ye,className:"px-3 py-1.5 rounded-lg bg-rose-600 hover:bg-rose-500 text-xs text-white flex items-center gap-1.5 transition-colors font-sans",children:[e.jsx(ol,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"下载 TXT 备份"})]})]})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:"旧密钥已彻底作废。请妥善将 TXT 凭据文件保存在离线磁盘中,切勿泄露给他人。"})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950/70 border border-slate-800 text-xs text-slate-400 leading-relaxed space-y-1.5",children:[e.jsx("p",{className:"text-slate-300 font-medium",children:"💡 关于安全恢复密钥的说明:"}),e.jsx("p",{children:"1. 注册时系统已为您生成过一份安全恢复密钥并提供了 TXT 备份。"}),e.jsx("p",{children:"2. 如果您遗失了之前的备份,可以在下方验证当前登录密码后,重新生成并轮换新密钥。"}),e.jsx("p",{children:"3. 重新生成后,原有的旧密钥将立即作废。"})]}),e.jsxs("form",{onSubmit:je,className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3",children:[e.jsx("input",{type:"password",required:!0,placeholder:"输入当前登录密码以验证身份",value:W,onChange:de=>te(de.target.value),className:"flex-1 bg-slate-950 border border-slate-700/80 focus:border-rose-500 rounded-xl px-3.5 py-2.5 text-sm text-white placeholder-slate-500 outline-none transition-colors"}),e.jsx("button",{type:"submit",disabled:Le,className:"px-5 py-2.5 rounded-xl bg-rose-600/90 hover:bg-rose-500 disabled:opacity-50 text-white font-medium text-xs flex items-center justify-center gap-2 transition-colors shadow-lg shadow-rose-600/20 shrink-0",children:Le?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在生成..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"验证密码并生成新密钥"})]})})]})]})]})]})]})]})};function oa(a){if(!a||!a.trim())return{isValid:!1,canonical:"",error:"请填写班级名称"};const l=a.trim();if(/[()()[\]【】{}]/.test(l))return{isValid:!1,canonical:"",error:"班级名称不能包含括号,请直接填写,例如:高一3班。"};const i=l.replace(/ +/g,"");return i.length<2||i.length>20?{isValid:!1,canonical:i,error:"班级名称长度必须在 2 至 20 个字之间"}:i.endsWith("班")?/^[\p{Script=Han}0-9]+$/u.test(i)?{isValid:!0,canonical:i}:{isValid:!1,canonical:i,error:"班级名称只能包含汉字和数字,并且必须以“班”结尾,例如:高一3班、91班。"}:{isValid:!1,canonical:i,error:"班级名称必须以“班”结尾,例如:高一3班、91班。"}}function _i(a){if(typeof a=="string")switch(a.toLowerCase()){case"acknowledged":case"confirmed":return"Acknowledged";case"delivered":return"Delivered";case"sent":return"Sent";case"cancelled":case"canceled":return"Cancelled";case"timeout":return"Timeout";case"failed":return"Failed";default:return"Sent"}switch(a){case 5:return"Cancelled";case 2:return"Acknowledged";case 1:return"Delivered";case 0:return"Sent";case 3:return"Timeout";case 4:return"Failed";default:return"Sent"}}const sb=[],nb=[{label:"到办公室",text:"请到教师办公室一趟。"},{label:"下楼集合",text:"请立即到楼下操场集合整队。"},{label:"家长来了",text:"校门口有家长找,请前往传达室。"},{label:"带作业本",text:"请收齐各科作业本送至办公室。"},{label:"课间回来",text:"预备铃已响,请迅速回教室内就坐。"},{label:"自习纪律",text:"请保持教室内安静自习,班干部负责维护纪律。"}],lb=()=>{const{user:a}=Ol(),[l,i]=x.useState([]),[c,u]=x.useState(""),[m,p]=x.useState(""),[b,f]=x.useState(""),[j,k]=x.useState(""),[T,C]=x.useState(!1),[I,P]=x.useState(null),[q,v]=x.useState(!0),[w,M]=x.useState(!0),[Y,z]=x.useState(!1),[ae,le]=x.useState(60),[O,pe]=x.useState(null),[ne,ve]=x.useState(!1),[Q,R]=x.useState(!1),[W,te]=x.useState("composer");x.useEffect(()=>{const V=new URLSearchParams(window.location.search).get("tab");V&&["composer","receipts","screen","profile"].includes(V)&&te(V);const Ce=qe=>{qe!=null&&qe.detail&&["composer","receipts","screen","profile"].includes(qe.detail)&&te(qe.detail)};return window.addEventListener("switch-teacher-tab",Ce),()=>window.removeEventListener("switch-teacher-tab",Ce)},[]);const[Le,K]=x.useState(!1),[Z,G]=x.useState(null),[re,se]=x.useState([]),[g,B]=x.useState(!1),[ue,U]=x.useState(!1),[ge,je]=x.useState(""),[Ne,ye]=x.useState(""),[de,De]=x.useState(!1),[et,ct]=x.useState(null),[Je,We]=x.useState(null),[tt,At]=x.useState(null),[Et,Wt]=x.useState(null),[pt,Tt]=x.useState(null);x.useEffect(()=>{typeof(J==null?void 0:J.getDownloadManifest)=="function"&&J.getDownloadManifest().then(H=>{H&&H.version&&Tt(H.version)}).catch(()=>{})},[]);const[nt,he]=x.useState(null);x.useEffect(()=>{try{const H=localStorage.getItem("classnotify_draft_backup");if(H){const V=JSON.parse(H);V.content&&(k(V.content),V.title&&f(V.title),V.studentName&&p(V.studentName),V.targetClassId&&u(V.targetClassId),he(`已为您自动恢复此前的通知草稿(保存于 ${new Date(V.savedAt).toLocaleTimeString()})`))}}catch{}},[]);const Ge=()=>{localStorage.removeItem("classnotify_draft_backup"),he(null),k(""),f(""),p("")},Nt=H=>!(a!=null&&a.tenantId)||!(a!=null&&a.userId)||!H?null:`classnotify:recentStudents:${a.tenantId}:${a.userId}:${H}`,[ft,wt]=x.useState(sb);x.useEffect(()=>{if(!c)return;const H=Nt(c);if(!H){wt([]);return}try{const V=localStorage.getItem(H);wt(V?JSON.parse(V):[])}catch{wt([])}},[c,a==null?void 0:a.tenantId,a==null?void 0:a.userId]);const[Pe,Xe]=x.useState([]),[ee,E]=x.useState(50),[y,be]=x.useState(!1),[Oe,Ue]=x.useState(!0),[jt,lt]=x.useState(!0),[zt,Ye]=x.useState(!1),[Ss,He]=x.useState(null),[It,Rt]=x.useState("all"),[Js,Dn]=x.useState(""),[$,Me]=x.useState(null),[Ke,Be]=x.useState(null),[gt,kt]=x.useState(!1),[A,ce]=x.useState(null),[st,Ie]=x.useState(1),[Dt,Gs]=x.useState(null),[dn,Fl]=x.useState(null),[Nr,ba]=x.useState(!1),[Cs,Pn]=x.useState(null),Pt=x.useRef({});x.useEffect(()=>()=>{Pt.current.fadeTimer&&clearTimeout(Pt.current.fadeTimer),Pt.current.removeTimer&&clearTimeout(Pt.current.removeTimer)},[]);const[un,ul]=x.useState(null),[zl,wr]=x.useState(!1),[Bl,kr]=x.useState({}),Sr=x.useRef(l);x.useEffect(()=>{Sr.current=l},[l]);const bt=async()=>{lt(!0),He(null);try{const H=await J.getTeacherClasses();i(H),H.length>0&&!c&&u(H[0].id);try{const Ce=await J.getTeacherProfile();G(Ce)}catch(Ce){console.warn("Teacher profile unavailable",Ce)}try{const Ce=await J.getTeacherScreens();se(Ce)}catch(Ce){console.warn("Teacher screens unavailable",Ce)}try{const Ce=await J.getTeacherClassroomDevices(),qe={};Ce.forEach(_e=>{qe[_e.classroomId]=_e}),kr(qe)}catch(Ce){console.warn("Classroom devices summary unavailable",Ce)}const V=await J.getTeacherHistory(void 0,ee);Xe(V.map(Ce=>({...Ce,status:_i(Ce.status)}))),V.length{Ye(!0);const H=Date.now();try{await bt()}finally{const V=Date.now()-H,Ce=600;VYe(!1),Ce-V):Ye(!1)}},[jn,Cr]=x.useState(!1),xl=async()=>{try{Cr(!0);const H=await J.getWindowsInstallerTicket();H&&H.downloadUrl&&(window.location.href=H.downloadUrl)}catch(H){P((H==null?void 0:H.message)||"获取大屏客户端下载凭据失败,请重试")}finally{Cr(!1)}},Ai=()=>{const H=`${window.location.origin}/teacher?tab=screens`;navigator.clipboard.writeText(H),K(!0),setTimeout(()=>K(!1),2500)},ml=()=>{je(""),ye(""),ct(null),We(null),U(!0)},Hl=async H=>{var Ce,qe,_e;if(H.preventDefault(),!ge.trim())return;const V=oa(Ne);if(!V.isValid){ct(V.error||"班级名称不合法");return}De(!0),ct(null),We(null);try{await J.claimTeacherScreen(ge.trim(),V.canonical);const Ee=(Z==null?void 0:Z.subscriptionState)==="Expired";We(Ee?"已成功绑定大屏。当前教师服务已到期,开通正式版后即可发送通知。":"大屏绑定成功!已加入到您的班级大屏列表。"),await bt(),setTimeout(()=>{U(!1),We(null)},1500)}catch(Ee){((qe=(Ce=Ee==null?void 0:Ee.response)==null?void 0:Ce.data)==null?void 0:qe.code)==="SCREEN_QUOTA_EXCEEDED"||(_e=Ee==null?void 0:Ee.message)!=null&&_e.includes("4 台")?ct("已达到 4 台大屏上限,请先解除不再使用的大屏。"):ct((Ee==null?void 0:Ee.message)||"大屏绑定失败,请核对配对码是否正确或未过期")}finally{De(!1)}},Ls=async H=>{if(confirm(`确定要从您的账号解除对【${H.classAlias}】大屏的绑定吗? 注意:这仅解除您本人的控制权,不会影响其他老师。`)){try{await J.unbindTeacherScreen(H.deviceId)}catch(V){console.warn("Unbind response notice:",V)}await bt()}},[Mi,xs]=x.useState(!1),[Vl,_r]=x.useState(""),[va,hl]=x.useState(!1),[pl,yn]=x.useState(null),[Xs,Er]=x.useState(null),[ja,Wl]=x.useState(!1),ya=async H=>{if(H.preventDefault(),!!Vl.trim()){hl(!0),yn(null);try{const V=await J.rotateRecoveryKey(Vl);Er(V.recoveryKey),_r("")}catch(V){yn((V==null?void 0:V.message)||"轮换恢复密钥失败,请核对当前密码")}finally{hl(!1)}}},Tr=()=>{Xs&&(navigator.clipboard.writeText(Xs),Wl(!0),setTimeout(()=>Wl(!1),2e3))},fl=()=>{if(!Xs)return;const H=new Blob([`ClassNotify 安全恢复密钥 (Recovery Key) =================================== 生成时间: ${new Date().toLocaleString()} 账号: ${(a==null?void 0:a.name)||(a==null?void 0:a.userId)} 恢复密钥: ${Xs} 重要提示: 1. 此密钥是您在忘记登录密码时的最高自救凭据。 2. 原有恢复密钥已彻底作废。 3. 请妥善保存在安全的离线位置,切勿向他人泄露。`],{type:"text/plain;charset=utf-8"}),V=URL.createObjectURL(H),Ce=document.createElement("a");Ce.href=V,Ce.download=`ClassNotify-RecoveryKey-${(a==null?void 0:a.userId)||"account"}.txt`,Ce.click(),URL.revokeObjectURL(V)},Oi=async()=>{const H=ee+50;be(!0);try{const V=await J.getTeacherHistory(void 0,H);Xe(V.map(Ce=>({...Ce,status:_i(Ce.status)}))),E(H),V.length{bt()},[]),x.useEffect(()=>{if(l.length===0){const H=setInterval(()=>{bt()},5e3);return()=>clearInterval(H)}},[l.length]),x.useEffect(()=>{const H=setInterval(()=>{J.getTeacherScreens().then(V=>{V&&se(V)}).catch(()=>{}),J.getTeacherProfile().then(V=>{V&&G(V)}).catch(()=>{}),J.getTeacherClassroomDevices().then(V=>{if(V){const Ce={};V.forEach(qe=>{Ce[qe.classroomId]=qe}),kr(Ce)}}).catch(()=>{})},45e3);return()=>clearInterval(H)},[]),x.useEffect(()=>{const H=as.onAckReceiptReceived(Ee=>{Xe(dt=>dt.map(ht=>{if(ht.id===Ee.messageId){const _s=_i(Ee.status);return{...ht,status:_s,confirmedAt:Ee.timestamp||ht.confirmedAt||new Date().toISOString()}}return ht}))}),V=as.onNewNotificationBroadcast(Ee=>{Xe(dt=>{if(dt.some(ms=>ms.id===Ee.id))return dt;const ht=Sr.current.find(ms=>ms.id===Ee.classId);return[{id:Ee.id,tenantId:Ee.tenantId,classId:Ee.classId,className:(ht==null?void 0:ht.displayName)||Ee.classId,senderName:"教师",message:Ee.message,priority:Ee.type===2?"Urgent":"Normal",createdAt:Ee.createdAt,status:"Sent"},...dt]})}),Ce=typeof as.onNotificationCancelled=="function"?as.onNotificationCancelled(Ee=>{Xe(dt=>dt.map(ht=>ht.id===Ee?{...ht,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:ht))}):()=>{},qe=typeof as.onVisualReceiptUploaded=="function"?as.onVisualReceiptUploaded(Ee=>{Xe(dt=>dt.map(ht=>{if(ht.id===Ee.notificationId){const ms=(ht.receipts||[]).map(js=>js.deviceId===Ee.deviceId?{...js,visualReceiptState:"Available",visualReceiptCapturedAt:Ee.capturedAt,visualReceiptExpiresAt:Ee.expiresAt}:js);return ms.some(js=>js.deviceId===Ee.deviceId)||ms.push({deviceId:Ee.deviceId,status:"Displayed",visualReceiptState:"Available",visualReceiptCapturedAt:Ee.capturedAt,visualReceiptExpiresAt:Ee.expiresAt}),{...ht,receipts:ms}}return ht}))}):()=>{},_e=typeof as.onDeviceStatusChanged=="function"?as.onDeviceStatusChanged(Ee=>{Ee.classId&&(kr(dt=>{var ht;return{...dt,[Ee.classId]:{...dt[Ee.classId]||{deviceId:Ee.deviceId,classroomId:Ee.classId,classroomName:Ee.className},isOnline:Ee.state==="Online"||Ee.state===1||Ee.state==="1",lastHeartbeat:Ee.lastHeartbeat,clientVersion:Ee.agentVersion||((ht=dt[Ee.classId])==null?void 0:ht.clientVersion)}}}),Sr.current.length===0&&bt())}):()=>{};return()=>{typeof H=="function"&&H(),typeof V=="function"&&V(),typeof Ce=="function"&&Ce(),typeof qe=="function"&&qe(),typeof _e=="function"&&_e()}},[]);const Ir=H=>{if(T&&j.trim().length>0&&!window.confirm("当前输入框已有手写内容,确定使用模版覆盖吗?"))return;const V=m.trim();k(V?`${V},${H.text}`:H.text),C(!1)},mt=H=>{p(H),!T||!j.trim()?(k(`${H},请到教师办公室一趟。`),C(!1)):j.includes(H)||k(`${H},${j}`)},Na=async H=>{var V,Ce,qe;if(H.preventDefault(),!(!c||!j.trim())){ve(!0),P(null);try{const _e=l.find(Kt=>Kt.id===c),Ee=b.trim()||(m.trim()?`🔔 老师呼叫: ${m.trim()}`:`📢 ${(_e==null?void 0:_e.displayName)||"班级"}通知`),dt=await J.sendNotification({classId:c,studentName:m.trim()||void 0,title:Ee,message:j.trim(),type:Y?2:0,voice:q,shake:w,durationSeconds:ae}),ht=m.trim();ht&&c&&wt(Kt=>{const $r=[ht,...Kt.filter(Mn=>Mn!==ht)].slice(0,8);try{const Mn=Nt(c);Mn&&localStorage.setItem(Mn,JSON.stringify($r))}catch{}return $r});const _s=j.trim();k(""),p(""),f(""),C(!1),P(null),dt!=null&&dt.messageId&&Xe(Kt=>Kt.some(Mn=>Mn.id===dt.messageId)?Kt:[{id:dt.messageId,tenantId:"",classId:c,className:(_e==null?void 0:_e.displayName)||c,senderName:"教师",message:_s,priority:Y?"Urgent":"Normal",createdAt:new Date().toISOString(),status:"Sent"},...Kt]);const ms=(_e==null?void 0:_e.displayName)||c;Pt.current.fadeTimer&&(clearTimeout(Pt.current.fadeTimer),Pt.current.fadeTimer=null),Pt.current.removeTimer&&(clearTimeout(Pt.current.removeTimer),Pt.current.removeTimer=null);const js=Date.now(),An=(dt==null?void 0:dt.messageId)||"";Pn({id:js,messageId:An,message:`呼叫已成功下发至【${ms}】大屏!`,className:ms,classId:c,isFadingOut:!1}),Pt.current.fadeTimer=setTimeout(()=>{Pn(Kt=>Kt&&Kt.id===js?{...Kt,isFadingOut:!0}:Kt)},2200),Pt.current.removeTimer=setTimeout(()=>{Pn(Kt=>Kt&&Kt.id===js?null:Kt)},2500)}catch(_e){if((((V=_e.response)==null?void 0:V.status)===401||_e.status===401)&&(((qe=(Ce=_e.response)==null?void 0:Ce.data)==null?void 0:qe.code)==="SESSION_SUPERSEDED"||_e.code==="SESSION_SUPERSEDED")){const Ee={title:b,studentName:m,content:j,targetClassId:c,savedAt:new Date().toISOString()};localStorage.setItem("classnotify_draft_backup",JSON.stringify(Ee)),localStorage.removeItem("classnotify_token"),alert("您的账号已在其他设备或窗口登录,草稿内容已自动保存在本地!"),window.location.href="/login";return}P((_e==null?void 0:_e.message)||"呼叫发送失败,请检查网络或稍后重试")}finally{ve(!1)}}},wa=()=>{if(!Cs)return;const H=Cs.classId,V=Cs.messageId;Pt.current.fadeTimer&&(clearTimeout(Pt.current.fadeTimer),Pt.current.fadeTimer=null),Pt.current.removeTimer&&(clearTimeout(Pt.current.removeTimer),Pt.current.removeTimer=null),Pn(null),H&&Rt(H),te("receipts"),V&&(pe(V),setTimeout(()=>{const Ce=document.querySelector(`[data-message-id="${V}"]`);Ce&&Ce.scrollIntoView({behavior:"smooth",block:"center"})},100),setTimeout(()=>{pe(Ce=>Ce===V?null:Ce)},3500))},Rr=async()=>{if(un){wr(!0);try{await J.deleteNotification(un.id),Xe(H=>H.filter(V=>V.id!==un.id)),ul(null)}catch(H){alert((H==null?void 0:H.message)||"删除回执记录失败")}finally{wr(!1)}}},ka=async()=>{if(dn){ba(!0);try{await J.cancelNotification(dn.id),Xe(H=>H.map(V=>V.id===dn.id?{...V,status:"Cancelled",isCancelled:!0,cancelledAt:new Date().toISOString()}:V)),Fl(null)}catch(H){alert(H.message||"提前关闭通知失败")}finally{ba(!1)}}},Dr=async(H,V,Ce,qe)=>{Me({notificationId:H,deviceId:V,className:Ce,capturedAt:qe}),kt(!0),ce(null),Be(null),Ie(1);try{const _e=await J.getVisualReceiptBlob(H,V),Ee=URL.createObjectURL(_e);Be(Ee)}catch(_e){ce((_e==null?void 0:_e.message)||"获取视觉核验图像失败")}finally{kt(!1)}},Sa=()=>{Ke&&URL.revokeObjectURL(Ke),Be(null),Me(null),ce(null),Ie(1)},Pr=async H=>{var V,Ce,qe,_e;Gs(H.id);try{let Ee=(Ce=(V=H.receipts)==null?void 0:V.find(dt=>dt.deviceId))==null?void 0:Ce.deviceId;if(!Ee){const dt=await J.getTeacherHistory(void 0,ee);Xe(dt.map(_s=>({..._s,status:_i(_s.status)})));const ht=dt.find(_s=>_s.id===H.id);Ee=(_e=(qe=ht==null?void 0:ht.receipts)==null?void 0:qe.find(_s=>_s.deviceId))==null?void 0:_e.deviceId}if(!Ee){alert("尚未检测到教室大屏设备在线或绑定,请确认教室大屏端正在运行");return}await Dr(H.id,Ee,H.className)}catch(Ee){alert((Ee==null?void 0:Ee.message)||"大屏端正在拍摄与上传通知截图,请在 1-2 秒后再次点击")}finally{Gs(null)}},Nn=Pe.filter(H=>{if(It!=="all"&&H.classId!==It)return!1;if(Js.trim()){const V=Js.toLowerCase(),Ce=H.message.toLowerCase().includes(V),qe=H.className.toLowerCase().includes(V);if(!Ce&&!qe)return!1}return!0}),xn=l.slice(0,4),Ys=l.slice(4),mn=(a==null?void 0:a.tenantType)==="Personal"||(a==null?void 0:a.role)==="TenantOwner",$n=()=>{var H,V,Ce,qe;return e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800/70",children:[e.jsx("h2",{className:"text-sm font-semibold text-slate-200",children:"快速发送呼叫"}),e.jsx("span",{className:"text-[11px] text-slate-500",children:"3秒极速触达"})]}),e.jsxs("form",{onSubmit:Na,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"目标班级"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-1.5",children:[xn.map(_e=>{const Ee=c===_e.id;return e.jsx("button",{type:"button",onClick:()=>u(_e.id),className:`px-3 py-2 rounded-xl text-left text-xs font-medium border transition-all flex items-center justify-between ${Ee?"bg-blue-600/20 border-blue-500/60 text-white shadow-sm":"bg-slate-950/70 border-slate-800 text-slate-300 hover:bg-slate-800 hover:text-white"}`,children:e.jsx("span",{className:"truncate",children:_e.displayName})},_e.id)}),l.length<((Z==null?void 0:Z.screenLimit)??4)&&e.jsxs("button",{type:"button",onClick:ml,className:"px-3 py-2 rounded-xl text-xs font-medium border border-dashed border-blue-500/40 text-blue-400 hover:border-blue-400 hover:text-blue-300 hover:bg-blue-500/10 flex items-center justify-center gap-1.5 transition-all",title:"绑定新大屏(最多支持 4 台)",children:[e.jsx(Fs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"绑定新大屏"})]})]}),Ys.length>0&&e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:c,onChange:_e=>u(_e.target.value),className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-slate-300 focus:outline-none focus:border-blue-500 appearance-none pr-8 cursor-pointer",children:[e.jsx("option",{value:"",disabled:!0,children:"选择其他班级..."}),Ys.map(_e=>e.jsxs("option",{value:_e.id,children:[_e.displayName," (",_e.roomNumber||_e.id,")"]},_e.id))]}),e.jsx(da,{className:"w-3.5 h-3.5 text-slate-500 absolute right-3 top-2.5 pointer-events-none"})]}),c&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-xl bg-slate-950/70 border border-slate-800/80 flex items-center justify-between text-xs",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"relative flex h-2 w-2",children:(H=Bl[c])!=null&&H.isOnline?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}):e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-amber-500/80"})}),e.jsx("span",{className:"text-slate-300 font-medium",children:(V=Bl[c])!=null&&V.isOnline?e.jsxs("span",{className:"text-emerald-400 font-medium",children:[((Ce=l.find(_e=>_e.id===c))==null?void 0:Ce.displayName)||"班级","大屏在线"]}):e.jsxs("span",{className:"text-slate-400",children:[((qe=l.find(_e=>_e.id===c))==null?void 0:qe.displayName)||"班级","大屏离线 · 通知将排队等待恢复"]})})]})})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsxs("label",{className:"text-xs font-medium text-slate-300 flex items-center gap-1",children:[e.jsx(Bs,{className:"w-3.5 h-3.5 text-slate-400"}),e.jsx("span",{children:"呼叫特定学生"}),e.jsx("span",{className:"text-slate-500 font-normal",children:"(选填)"})]}),ft.length>0&&e.jsx("span",{className:"text-[10px] text-slate-500",children:"点选常用学生快速填入"})]}),ft.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ft.map(_e=>e.jsx("button",{type:"button",onClick:()=>mt(_e),className:`px-2 py-0.5 rounded-lg text-xs transition-colors border ${m===_e?"bg-blue-600/30 border-blue-500/60 text-blue-200":"bg-slate-950 text-slate-400 border-slate-800 hover:border-slate-700 hover:text-slate-200"}`,children:_e},_e))}),e.jsx("input",{type:"text",value:m,onChange:_e=>p(_e.target.value),placeholder:"例如:张三、李四(若全班广播可留空)",maxLength:20,className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-blue-500 transition-colors"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsxs("label",{className:"text-xs font-medium text-slate-300",children:["通知内容 ",e.jsx("span",{className:"text-rose-400",children:"*"})]}),e.jsxs("span",{className:"text-[11px] text-slate-500 font-mono",children:[j.length,"/200"]})]}),e.jsx("textarea",{required:!0,rows:3,maxLength:200,value:j,onChange:_e=>{k(_e.target.value),C(!0)},placeholder:"请输入需要大屏弹窗展示并播报的内容...",className:"w-full bg-slate-950 border border-slate-800 rounded-xl p-3 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-blue-500 transition-colors resize-none leading-relaxed"}),e.jsxs("div",{className:"mt-2 space-y-1.5",children:[e.jsxs("span",{className:"text-[11px] text-slate-400 flex items-center gap-1",children:[e.jsx(cl,{className:"w-3 h-3 text-amber-400"}),"常用通知短语 (点击快速套用)"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:nb.map(_e=>e.jsx("button",{type:"button",onClick:()=>Ir(_e),className:"px-2.5 py-1 rounded-lg bg-slate-950 border border-slate-800 hover:border-slate-700 text-slate-300 hover:text-white text-xs transition-colors",children:_e.label},_e.label))})]})]}),e.jsxs("div",{className:"pt-2 border-t border-slate-800/80 space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-xl bg-slate-950/70 border border-slate-800/80",children:[e.jsxs("span",{className:"flex items-center gap-2 text-slate-300 font-medium",children:[e.jsx(Uc,{className:`w-4 h-4 ${q?"text-blue-400":"text-slate-500"}`}),e.jsx("span",{children:"语音播报"})]}),e.jsxs("div",{className:"inline-flex rounded-lg bg-slate-900 p-0.5 border border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>v(!0),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${q?"bg-blue-600 text-white shadow-sm font-semibold":"text-slate-400 hover:text-slate-200"}`,children:"是"}),e.jsx("button",{type:"button",onClick:()=>v(!1),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${q?"text-slate-400 hover:text-slate-200":"bg-slate-700 text-slate-200 shadow-sm font-semibold"}`,children:"否"})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-xl bg-slate-950/70 border border-slate-800/80",children:[e.jsxs("span",{className:"flex items-center gap-2 text-slate-300 font-medium",children:[e.jsx(Ap,{className:`w-4 h-4 ${w?"text-blue-400":"text-slate-500"}`}),e.jsx("span",{children:"窗口抖动"})]}),e.jsxs("div",{className:"inline-flex rounded-lg bg-slate-900 p-0.5 border border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>M(!0),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${w?"bg-blue-600 text-white shadow-sm font-semibold":"text-slate-400 hover:text-slate-200"}`,children:"是"}),e.jsx("button",{type:"button",onClick:()=>M(!1),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${w?"text-slate-400 hover:text-slate-200":"bg-slate-700 text-slate-200 shadow-sm font-semibold"}`,children:"否"})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-xl bg-slate-950/70 border border-slate-800/80",children:[e.jsxs("span",{className:"flex items-center gap-2 text-slate-300 font-medium",children:[e.jsx(Qt,{className:`w-4 h-4 ${Y?"text-rose-400":"text-slate-500"}`}),e.jsx("span",{children:"强提醒 (加急)"})]}),e.jsxs("div",{className:"inline-flex rounded-lg bg-slate-900 p-0.5 border border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>z(!0),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${Y?"bg-rose-600 text-white shadow-sm font-semibold":"text-slate-400 hover:text-slate-200"}`,children:"是"}),e.jsx("button",{type:"button",onClick:()=>z(!1),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${Y?"text-slate-400 hover:text-slate-200":"bg-slate-700 text-slate-200 shadow-sm font-semibold"}`,children:"否"})]})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-slate-950/70 border border-slate-800/80 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-2 text-slate-300 font-medium text-xs",children:[e.jsx(os,{className:`w-4 h-4 ${ae!==0?"text-blue-400":"text-slate-500"}`}),e.jsx("span",{children:"60秒后自动消失"})]}),e.jsxs("div",{className:"inline-flex rounded-lg bg-slate-900 p-0.5 border border-slate-800",children:[e.jsx("button",{type:"button",onClick:()=>le(60),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${ae!==0?"bg-blue-600 text-white shadow-sm font-semibold":"text-slate-400 hover:text-slate-200"}`,children:"是"}),e.jsx("button",{type:"button",onClick:()=>le(0),className:`px-3.5 py-1 rounded-md text-xs font-medium transition-all ${ae===0?"bg-amber-600 text-white shadow-sm font-semibold":"text-slate-400 hover:text-slate-200"}`,children:"否"})]})]}),ae===0&&e.jsxs("div",{className:"text-[11px] text-amber-400/90 pl-6 animate-in fade-in duration-150 flex items-center gap-1 leading-normal",children:[e.jsx("span",{children:"📌"}),e.jsx("span",{children:"已设为常驻:大屏将一直显示,直到班级师生点击【我知道了】关闭"})]})]})]}),I&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-xs text-rose-300 flex items-start gap-2 animate-in fade-in duration-200",children:[e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0 mt-0.5"}),e.jsx("div",{className:"leading-relaxed",children:I})]}),e.jsx("button",{type:"submit",disabled:ne||!c||!j.trim(),className:"w-full py-3 rounded-xl bg-blue-600 hover:bg-blue-500 active:bg-blue-700 text-white font-semibold text-sm shadow-md shadow-blue-600/20 flex items-center justify-center gap-2 transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:ne?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:"正在投递至教室大屏..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(al,{className:"w-4 h-4"}),e.jsx("span",{children:"立即发送呼叫"})]})})]})]})},Ln=H=>e.jsxs("div",{className:`${H?"w-full":"lg:col-span-7"} bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4`,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-slate-800/70",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Al,{className:"w-4 h-4 text-emerald-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"回执动态"}),e.jsxs("span",{className:"text-[11px] text-slate-500 font-mono",children:["(",Nn.length,")"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto max-w-[200px] sm:max-w-none",children:[e.jsx("button",{type:"button",onClick:()=>Rt("all"),className:`px-2 py-1 rounded-lg text-xs font-medium transition-colors ${It==="all"?"bg-slate-800 text-white border border-slate-700":"text-slate-400 hover:text-slate-200"}`,children:"全部"}),l.slice(0,3).map(V=>e.jsx("button",{type:"button",onClick:()=>Rt(V.id),className:`px-2 py-1 rounded-lg text-xs font-medium transition-colors whitespace-nowrap ${It===V.id?"bg-slate-800 text-white border border-slate-700":"text-slate-400 hover:text-slate-200"}`,children:V.displayName},V.id))]}),e.jsx("div",{className:"w-36",children:e.jsx(yr,{value:Js,onChange:Dn,placeholder:"搜索动态...",className:"text-xs"})})]})]}),e.jsxs("div",{className:"space-y-3 max-h-[calc(100vh-250px)] overflow-y-auto pr-1",children:[jt&&Pe.length===0?e.jsxs("div",{className:"text-center py-16 text-xs text-slate-500",children:[e.jsx(Ct,{className:"w-5 h-5 animate-spin mx-auto mb-2 text-blue-400"}),e.jsx("span",{children:"正在加载回执记录..."})]}):Nn.length===0?e.jsx("div",{className:"text-center py-16 text-xs text-slate-500",children:Js||It!=="all"?"未找到符合条件的通知记录":"暂无呼叫记录,左侧选择班级即可下发"}):Nn.map(V=>{var qe;const Ce=(qe=V.receipts)==null?void 0:qe.find(_e=>_e.visualReceiptState==="Available");return e.jsxs("div",{"data-message-id":V.id,className:`p-4 rounded-xl bg-slate-950/80 border transition-all space-y-2.5 ${O===V.id?"border-emerald-400 ring-2 ring-emerald-400/80 shadow-lg shadow-emerald-500/20 bg-emerald-950/20":"border-slate-800/80 hover:border-slate-700/80"}`,children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium text-slate-200",children:[e.jsx("span",{className:"font-semibold text-white",children:V.className}),V.priority==="Urgent"&&e.jsx(it,{label:"紧急",variant:"rose",dot:!1,className:"py-0 px-1.5 text-[10px]"})]}),e.jsx("span",{className:"text-[11px] font-mono text-slate-500",children:new Date(V.createdAt).toLocaleTimeString()})]}),e.jsx("div",{className:"text-xs text-slate-300 leading-relaxed bg-slate-900/60 p-2.5 rounded-lg border border-slate-800/60",children:V.message}),e.jsxs("div",{className:"pt-1.5 border-t border-slate-800/60 flex items-center justify-between flex-wrap gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[V.status==="Acknowledged"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-400 font-medium text-xs",children:[e.jsx(ot,{className:"w-3.5 h-3.5 text-emerald-400"}),"已点击“我知道了” (大屏已确认)"]}),V.status==="Delivered"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-sky-400 font-medium text-xs",children:[e.jsx(is,{className:"w-3.5 h-3.5 text-sky-400"}),"已在屏幕显示"]}),V.status==="Sent"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-400 text-xs",children:[e.jsx(os,{className:"w-3.5 h-3.5 text-amber-400"}),"已发送至云端"]}),V.status==="Cancelled"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-rose-400 text-xs font-medium",children:[e.jsx(ua,{className:"w-3.5 h-3.5"}),"已提前撤回 (大屏已关闭)"]}),V.status==="Timeout"&&e.jsx("span",{className:"text-slate-500 text-xs",children:"已超时自动关闭"}),V.status==="Failed"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-rose-400 text-xs font-medium",children:[e.jsx(Qt,{className:"w-3.5 h-3.5 text-rose-400"}),"⚠️ 大屏显示渲染异常,正在自动恢复"]}),Ce?e.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-400/90 text-[11px] font-medium ml-1",children:[e.jsx(Ht,{className:"w-3.5 h-3.5 text-emerald-400"}),"大屏截图:已就绪"]}):(V.status==="Delivered"||V.status==="Acknowledged")&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-slate-400 text-[11px] ml-1",children:[e.jsx(Si,{className:"w-3 h-3 text-slate-500"}),"现场大屏待核验"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[Ce?e.jsxs("button",{type:"button",onClick:()=>Dr(V.id,Ce.deviceId,V.className,Ce.visualReceiptCapturedAt),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-sky-500/15 hover:bg-sky-500/25 text-sky-300 hover:text-white text-xs font-semibold border border-sky-500/30 transition-all shadow-sm",title:"查看教室大屏真实通知界面截图,确认内容已送达展示",children:[e.jsx(Si,{className:"w-3.5 h-3.5 text-sky-400"}),e.jsx("span",{children:"查看大屏通知截图"})]}):(V.status==="Sent"||V.status==="Delivered"||V.status==="Acknowledged")&&e.jsx("button",{type:"button",onClick:()=>Pr(V),disabled:Dt===V.id,className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white text-xs font-medium border border-slate-700 transition-colors",title:"获取当前大屏通知界面截图以核验通知发送成功",children:Dt===V.id?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin text-sky-400"}),e.jsx("span",{children:"正在拉取截图..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Si,{className:"w-3.5 h-3.5 text-slate-400"}),e.jsx("span",{children:"拉取大屏截图"})]})}),(V.status==="Sent"||V.status==="Delivered")&&e.jsxs("button",{type:"button",onClick:()=>Fl(V),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-rose-500/10 hover:bg-rose-500/20 text-rose-300 hover:text-rose-200 text-xs font-medium border border-rose-500/20 transition-colors",title:"提前撤回大屏通知,立即关闭教室大屏弹窗",children:[e.jsx(ua,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"提前撤回"})]}),e.jsxs("button",{type:"button",onClick:()=>ul(V),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-lg bg-slate-800/80 hover:bg-rose-500/15 text-slate-400 hover:text-rose-300 text-xs font-medium border border-slate-700/80 hover:border-rose-500/30 transition-colors",title:"从历史列表中删除此条回执",children:[e.jsx(Pl,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"删除"})]})]})]})]},V.id)}),Oe&&Nn.length>0&&e.jsx("div",{className:"pt-2 text-center",children:e.jsx("button",{type:"button",disabled:y,onClick:Oi,className:"px-4 py-2 rounded-xl bg-slate-950 border border-slate-800 hover:bg-slate-850 text-xs text-slate-400 hover:text-slate-200 transition-colors flex items-center justify-center gap-1.5 mx-auto disabled:opacity-50",children:y?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在加载更多..."})]}):e.jsx("span",{children:"加载更多历史回执"})})})]})]});return e.jsxs("div",{className:"space-y-5",style:{minHeight:"100dvh",paddingBottom:"calc(8rem + env(safe-area-inset-bottom))"},children:[e.jsxs("div",{className:"pb-2 border-b border-slate-800/80 space-y-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight text-white flex items-center gap-2.5",children:"教师工作台"}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-400 mt-1.5 leading-normal",children:"秒级定向通知教室大屏 · 支持 TTS 朗读、视觉核验与实时回执"})]}),Z&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2.5 shrink-0",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:flex sm:items-center gap-2",children:[e.jsxs("div",{className:`h-9 px-3.5 rounded-xl border text-xs flex items-center justify-center gap-2 font-medium shrink-0 ${Z.subscriptionState==="VIP"?"bg-blue-500/10 border-blue-500/30 text-blue-300":Z.subscriptionState==="Trial"?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300":"bg-rose-500/10 border-rose-500/30 text-rose-300"}`,children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${Z.subscriptionState==="VIP"?"bg-blue-400":Z.subscriptionState==="Trial"?"bg-emerald-400":"bg-rose-400"}`}),e.jsx("span",{children:Z.subscriptionState==="VIP"?`正式版有效${Z.vipExpiresAt?` · 至 ${Z.vipExpiresAt.slice(0,10)}`:""}`:Z.subscriptionState==="Trial"?Z.trialEndsAt?`免费试用中 · 剩 ${Math.max(0,Math.ceil((new Date(Z.trialEndsAt).getTime()-Date.now())/(1e3*60*60*24)))} 天`:"免费试用 · 待开启 (7天)":"服务已到期"})]}),e.jsxs("div",{className:"h-9 px-3.5 rounded-xl bg-slate-900 border border-slate-800 text-xs flex items-center justify-center gap-2 text-slate-300 shrink-0",children:[e.jsx(_t,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),e.jsxs("span",{className:"font-mono",children:["大屏:",re.length>0?re.length:l.length," / ",Z.screenLimit||4]})]})]}),e.jsx("button",{type:"button",onClick:()=>B(!0),className:`h-9 px-4 rounded-xl text-xs font-semibold flex items-center justify-center gap-1.5 transition-all shadow-sm shrink-0 ${Z.subscriptionState==="VIP"?"bg-slate-800 hover:bg-slate-700 text-slate-200 border border-slate-700":"bg-blue-600 hover:bg-blue-500 text-white shadow-blue-600/20"}`,children:e.jsx("span",{children:Z.subscriptionState==="VIP"?"续订服务":"开通正式版"})})]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-8 pt-2 border-t border-slate-800/40",children:[e.jsxs("button",{type:"button",onClick:()=>te("composer"),className:`pb-2.5 text-sm font-medium transition-all flex items-center gap-2 relative ${W==="composer"?"text-white font-semibold after:absolute after:bottom-0 after:left-0 after:right-0 after:h-0.5 after:bg-blue-500 after:rounded-full":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(al,{className:"w-4 h-4"}),e.jsx("span",{children:"发送通知"})]}),e.jsxs("button",{type:"button",onClick:()=>te("receipts"),className:`pb-2.5 text-sm font-medium transition-all flex items-center gap-2 relative ${W==="receipts"?"text-white font-semibold after:absolute after:bottom-0 after:left-0 after:right-0 after:h-0.5 after:bg-blue-500 after:rounded-full":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(Ll,{className:"w-4 h-4"}),e.jsx("span",{children:"送达回执"}),Pe.length>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded-full bg-slate-800 text-[11px] text-slate-300 font-mono",children:Pe.length})]}),e.jsxs("button",{type:"button",onClick:()=>te("screen"),className:`pb-2.5 text-sm font-medium transition-all flex items-center gap-2 relative ${W==="screen"?"text-white font-semibold after:absolute after:bottom-0 after:left-0 after:right-0 after:h-0.5 after:bg-blue-500 after:rounded-full":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(_t,{className:"w-4 h-4"}),e.jsx("span",{children:"我的班级"}),(re.length>0||l.length>0)&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded-full bg-slate-800 text-[11px] text-emerald-400 font-mono",children:re.length>0?re.length:l.length})]}),e.jsxs("button",{type:"button",onClick:()=>te("profile"),className:`pb-2.5 text-sm font-medium transition-all flex items-center gap-2 relative ${W==="profile"?"text-white font-semibold after:absolute after:bottom-0 after:left-0 after:right-0 after:h-0.5 after:bg-blue-500 after:rounded-full":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(Bs,{className:"w-4 h-4"}),e.jsx("span",{children:"个人资料"})]})]})]}),nt&&e.jsxs("div",{className:"p-3.5 rounded-xl border border-sky-500/30 bg-sky-500/10 text-sky-200 flex items-center justify-between text-xs animate-in fade-in",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cl,{className:"w-4 h-4 text-sky-400 shrink-0"}),e.jsx("span",{children:nt})]}),e.jsx("button",{type:"button",onClick:Ge,className:"px-2.5 py-1 rounded-lg bg-sky-900/40 hover:bg-sky-900/60 text-sky-300 hover:text-white border border-sky-500/30 transition-colors",children:"放弃草稿"})]}),Ss&&e.jsxs("div",{className:"p-3.5 rounded-xl border border-rose-500/30 bg-rose-500/10 text-rose-300 flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0"}),e.jsx("span",{children:Ss})]}),e.jsxs("button",{onClick:Li,disabled:zt,className:"flex items-center gap-1 px-3 py-1 rounded-lg bg-rose-600 hover:bg-rose-500 disabled:opacity-50 text-white font-medium transition-colors",children:[e.jsx(xt,{className:`w-3.5 h-3.5 ${zt?"animate-spin":""}`}),"重试"]})]}),W==="composer"&&e.jsx("div",{children:l.length===0?mn?e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl p-5 sm:p-8 w-full max-w-5xl mx-auto space-y-6 shadow-xl my-4 sm:my-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("div",{className:"w-12 h-12 sm:w-14 sm:h-14 rounded-2xl bg-blue-500/10 border border-blue-500/20 text-blue-400 flex items-center justify-center mx-auto shadow-sm",children:e.jsx(_t,{className:"w-6 h-6 sm:w-7 sm:h-7"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-bold text-white tracking-tight",children:"还没有绑定班级大屏"}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-400 mt-1",children:"只需两步,即可将教室大屏与您的教师账号完成配对绑定"})]})]}),e.jsx("div",{className:"bg-slate-950/70 border border-slate-800 rounded-2xl p-6 space-y-5",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-blue-500/20 text-blue-400 font-bold flex items-center justify-center shrink-0 text-xs mt-0.5",children:"1"}),e.jsxs("div",{className:"space-y-1.5 flex-1",children:[e.jsx("p",{className:"font-semibold text-white text-sm",children:"安装 ClassNotify 大屏端"}),e.jsx("p",{className:"text-slate-400 text-xs leading-relaxed",children:"在当前电脑下载大屏端安装包,复制到 U 盘带到教室黑板电脑双击安装(只需安装一次即可);或在手机上下载后,通过常用文件传输工具发送到教室电脑。"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1.5",children:[e.jsxs("button",{type:"button",onClick:xl,disabled:jn,className:"inline-flex items-center px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold gap-1.5 transition-colors shadow-sm disabled:opacity-60",children:[e.jsx(_t,{className:"w-4 h-4"}),e.jsx("span",{children:jn?"准备下载...":`下载 Windows 大屏端 ${pt?`v${pt.replace(/^v/,"")}`:""}`})]}),e.jsx("button",{type:"button",onClick:Ai,className:"inline-flex items-center px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs border border-slate-700 gap-1.5 transition-colors",title:"复制客户端下载入口链接 (发给教室电脑打开登录即可下载)",children:Le?e.jsxs(e.Fragment,{children:[e.jsx(is,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{className:"text-emerald-400",children:"已复制入口链接"})]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"复制入口链接"})]})})]}),e.jsx("p",{className:"text-[11px] text-slate-500 pt-0.5",children:"💡 提示:手机下载后可通过“文件传输助手”发送至教室电脑安装;电脑端下载后可直接拷入 U 盘。"})]})]}),e.jsxs("div",{className:"flex items-start gap-3 pt-5 border-t border-slate-800/80",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-blue-500/20 text-blue-400 font-bold flex items-center justify-center shrink-0 text-xs mt-0.5",children:"2"}),e.jsxs("div",{className:"space-y-2.5 flex-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-white text-sm",children:"绑定班级大屏"}),e.jsx("p",{className:"text-slate-400 text-xs mt-0.5",children:"教室大屏安装启动后,屏幕上会清晰显示 8 位纯数字配对码。"})]}),e.jsx("div",{className:"pt-1",children:e.jsxs("button",{type:"button",onClick:ml,className:"inline-flex items-center justify-center px-5 py-2.5 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold gap-2 shadow-lg shadow-blue-600/25 transition-all",children:[e.jsx(Fs,{className:"w-4 h-4"}),e.jsx("span",{children:"输入 8 位配对码绑定大屏"})]})}),e.jsx("p",{className:"text-[11px] text-slate-500",children:"配对码为 8 位数字,10 分钟内有效。绑定成功后立即就绪呼叫通知。"})]})]})]})})]}):e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-3xl p-8 max-w-lg mx-auto text-center space-y-4 shadow-xl my-6",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-amber-500/10 border border-amber-500/20 text-amber-400 flex items-center justify-center mx-auto",children:e.jsx(Qt,{className:"w-6 h-6"})}),e.jsx("h2",{className:"text-lg font-bold text-white",children:"暂未关联可管理的班级"}),e.jsxs("p",{className:"text-xs text-slate-400 leading-relaxed",children:["学校管理员尚未将教室大屏或班级授权指派给您的账号。",e.jsx("br",{}),"请联系学校信息管理员在管理后台为您分配相应班级。"]}),e.jsx("button",{type:"button",onClick:bt,className:"px-4 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-medium transition-colors",children:"刷新检查授权"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"block lg:hidden",children:$n()}),e.jsxs("div",{className:"hidden lg:grid lg:grid-cols-12 lg:gap-6 lg:items-start",children:[e.jsx("div",{className:"lg:col-span-5",children:$n()}),Ln(!1)]})]})}),W==="receipts"&&e.jsx("div",{className:"max-w-5xl mx-auto",children:Ln(!0)}),W==="screen"&&e.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-4 sm:p-5 shadow-sm space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-slate-800/70",children:[e.jsxs("div",{className:"flex items-center justify-between sm:justify-start gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_t,{className:"w-4 h-4 text-blue-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"我的班级大屏终端"})]}),e.jsxs("span",{className:"text-[11px] px-2.5 py-0.5 rounded-full bg-slate-800 text-slate-300 font-mono",children:["已绑定 ",re.length>0?re.length:l.length," / ",(Z==null?void 0:Z.screenLimit)??4," 台"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:xl,disabled:jn,className:"px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-750 text-slate-200 hover:text-white border border-slate-700/80 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 shadow-sm disabled:opacity-60",title:"下载 Windows 大屏客户端软件",children:[e.jsx(ol,{className:`w-3.5 h-3.5 text-blue-400 ${jn?"animate-bounce":""}`}),e.jsx("span",{children:jn?"准备下载...":"下载大屏软件"})]}),e.jsxs("button",{type:"button",onClick:ml,disabled:Z?re.length>=Z.screenLimit:!1,className:"px-3.5 py-1.5 rounded-xl bg-blue-600 hover:bg-blue-500 disabled:opacity-50 disabled:cursor-not-allowed text-white text-xs font-semibold transition-colors flex items-center justify-center gap-1.5 shadow-md shadow-blue-600/20",children:[e.jsx(Fs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:Z&&re.length>=Z.screenLimit?`已达 ${Z.screenLimit} 台上限`:"绑定新班级大屏"})]})]})]}),re.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:re.map(H=>e.jsxs("div",{className:"bg-slate-950/70 border border-slate-800 rounded-xl p-4 space-y-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-bold text-white text-base",children:H.classAlias}),e.jsxs("span",{className:`px-2.5 py-0.5 rounded-full text-[11px] font-medium flex items-center gap-1.5 ${H.isOnline?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-slate-800 text-slate-400 border border-slate-700"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${H.isOnline?"bg-emerald-400":"bg-slate-500"}`}),H.isOnline?"大屏在线":"大屏离线"]})]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-slate-400 pt-2.5 border-t border-slate-800/80",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"设备标识"}),e.jsx("span",{className:"font-mono text-slate-300 truncate max-w-[200px]",title:H.hardwareDeviceId||H.deviceId,children:H.hardwareDeviceId||H.deviceId})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"客户端版本"}),e.jsx("span",{className:"font-mono text-slate-300",children:H.clientVersion?H.clientVersion.startsWith("v")?H.clientVersion:`v${H.clientVersion}`:"v2.1.0"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"绑定时间"}),e.jsxs("span",{className:"text-slate-300",children:[new Date(H.boundAt).toLocaleDateString()," ",new Date(H.boundAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]})]}),e.jsx("div",{className:"flex justify-end pt-3 border-t border-slate-800/80",children:e.jsxs("button",{type:"button",onClick:()=>Ls(H),className:"py-1.5 px-3 rounded-xl bg-rose-500/10 hover:bg-rose-500/20 text-rose-400 hover:text-rose-300 text-xs font-medium border border-rose-500/20 transition-colors flex items-center justify-center gap-1.5 shadow-sm",title:"从当前账号解除此大屏的绑定(不影响其他任课教师)",children:[e.jsx(_0,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"解除绑定"})]})})]},H.deviceId))}):l.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:l.map(H=>{const V=Bl[H.id],Ce=V==null?void 0:V.isOnline,qe=(V==null?void 0:V.deviceId)||H.id;return e.jsxs("div",{className:"bg-slate-950/70 border border-slate-800 rounded-xl p-4 space-y-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold text-white text-base",children:H.displayName}),H.roomNumber&&e.jsxs("span",{className:"text-xs text-slate-400",children:["(",H.roomNumber,")"]})]}),e.jsxs("span",{className:`px-2.5 py-0.5 rounded-full text-[11px] font-medium flex items-center gap-1.5 ${Ce?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20":"bg-slate-800 text-slate-400 border border-slate-700"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Ce?"bg-emerald-400":"bg-slate-500"}`}),Ce?"大屏在线":"大屏离线"]})]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-slate-400 pt-2.5 border-t border-slate-800/80",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"设备标识"}),e.jsx("span",{className:"font-mono text-slate-300 truncate max-w-[200px]",title:(V==null?void 0:V.hostname)||qe,children:(V==null?void 0:V.hostname)||qe})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"客户端版本"}),e.jsx("span",{className:"font-mono text-slate-300",children:V!=null&&V.clientVersion?V.clientVersion.startsWith("v")?V.clientVersion:`v${V.clientVersion}`:"v2.1.0"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-slate-500 shrink-0",children:"连接状态"}),e.jsx("span",{className:"text-slate-300",children:Ce?"实时在线就绪":"目前离线"})]})]}),e.jsx("div",{className:"flex justify-end pt-3 border-t border-slate-800/80",children:e.jsxs("button",{type:"button",onClick:()=>Ls({deviceId:qe,classAlias:H.displayName,isOnline:!!Ce,boundAt:new Date().toISOString()}),className:"py-1.5 px-3 rounded-xl bg-rose-500/10 hover:bg-rose-500/20 text-rose-400 hover:text-rose-300 text-xs font-medium border border-rose-500/20 transition-colors flex items-center justify-center gap-1.5 shadow-sm",title:"从当前账号解除此大屏的绑定(不影响其他任课教师)",children:[e.jsx(_0,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"解除绑定"})]})})]},H.id)})}):e.jsxs("div",{className:"text-center py-10 text-slate-400 text-xs space-y-3",children:[e.jsx(_t,{className:"w-10 h-10 text-slate-600 mx-auto"}),e.jsx("p",{className:"text-slate-300 font-medium",children:"当前暂未绑定任何大屏终端"}),e.jsx("p",{className:"text-slate-500 text-[11px]",children:"请在大屏界面获取 8 位配对码进行绑定 · 绑定后随时支持在此一键自主解除绑定"}),e.jsx("div",{className:"pt-1",children:e.jsxs("button",{type:"button",onClick:ml,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white font-medium inline-flex items-center gap-1.5 text-xs transition-colors shadow-md shadow-blue-600/20",children:[e.jsx(Fs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"绑定新班级大屏"})]})})]})]}),e.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl p-5 shadow-sm space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800/70",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ht,{className:"w-4 h-4 text-sky-400"}),e.jsx("h2",{className:"text-sm font-semibold text-white",children:"账号安全与离线恢复"})]})}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950/70 border border-slate-800 space-y-3 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400"}),e.jsx("span",{className:"font-medium text-slate-200",children:"安全恢复密钥 (Recovery Key)"}),e.jsx("span",{className:"text-emerald-400 font-medium",children:"✓ 已配置"})]}),e.jsx("button",{type:"button",onClick:()=>xs(!0),className:"px-3 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white text-xs font-medium border border-slate-700 transition-colors",children:"重新生成恢复密钥"})]}),e.jsxs("p",{className:"text-slate-400 text-[11px] leading-relaxed",children:["安全恢复密钥是您在忘记登录密码时的离线自救凭证。为确保极致安全,服务器仅存储不可逆单向散列值 (Hash),不保存明文。",e.jsx("br",{}),"请妥善保管您在注册或轮换时保存的 16 位恢复密钥。如需更换,可点击上方按钮重新生成。"]})]})]})]}),W==="profile"&&e.jsx(tb,{onOpenCheckout:()=>B(!0)}),e.jsxs("nav",{className:"fixed bottom-0 left-0 right-0 z-40 bg-slate-900/95 backdrop-blur-md border-t border-slate-800 md:hidden flex items-center justify-around py-2 px-3 shadow-2xl",style:{paddingBottom:"calc(0.5rem + env(safe-area-inset-bottom))"},children:[e.jsxs("button",{type:"button",onClick:()=>te("composer"),className:`flex flex-col items-center gap-1 py-1 px-3 rounded-xl transition-all ${W==="composer"?"text-blue-400 font-semibold":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(al,{className:"w-5 h-5"}),e.jsx("span",{className:"text-[11px]",children:"通知"})]}),e.jsxs("button",{type:"button",onClick:()=>te("receipts"),className:`flex flex-col items-center gap-1 py-1 px-3 rounded-xl transition-all relative ${W==="receipts"?"text-blue-400 font-semibold":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(Ll,{className:"w-5 h-5"}),e.jsx("span",{className:"text-[11px]",children:"回执"}),Pe.length>0&&e.jsx("span",{className:"absolute top-0 right-2 w-2 h-2 rounded-full bg-blue-500"})]}),e.jsxs("button",{type:"button",onClick:()=>te("screen"),className:`flex flex-col items-center gap-1 py-1 px-3 rounded-xl transition-all ${W==="screen"?"text-blue-400 font-semibold":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(_t,{className:"w-5 h-5"}),e.jsx("span",{className:"text-[11px]",children:"我的班级"})]}),e.jsxs("button",{type:"button",onClick:()=>te("profile"),className:`flex flex-col items-center gap-1 py-1 px-3 rounded-xl transition-all ${W==="profile"?"text-blue-400 font-semibold":"text-slate-400 hover:text-slate-200"}`,children:[e.jsx(Bs,{className:"w-5 h-5"}),e.jsx("span",{className:"text-[11px]",children:"个人资料"})]})]}),e.jsx("div",{className:"h-16 md:hidden"}),Mi&&e.jsx(Vt,{isOpen:!0,onClose:()=>{xs(!1),_r(""),Er(null),yn(null)},title:"重新生成安全恢复密钥",children:Xs?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-emerald-500/10 border border-emerald-500/20 text-xs text-emerald-300 space-y-1",children:[e.jsxs("div",{className:"font-semibold flex items-center gap-1.5",children:[e.jsx(ot,{className:"w-4 h-4 text-emerald-400 shrink-0"}),e.jsx("span",{children:"新恢复密钥已生成成功!旧密钥已作废"})]}),e.jsx("p",{className:"text-[11px] text-emerald-400/90",children:"⚠️ 本密钥明文仅展示这一次,关闭后将无法再次查看!请务必立即复制或下载保存。"})]}),e.jsxs("div",{className:"p-4 rounded-2xl bg-slate-950 border border-slate-800 flex items-center justify-between gap-3",children:[e.jsx("span",{className:"font-mono text-base font-bold text-white tracking-widest select-all",children:Xs}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:Tr,className:"px-3 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium flex items-center gap-1 transition-colors",children:[ja?e.jsx(is,{className:"w-3.5 h-3.5"}):e.jsx(us,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:ja?"已复制":"复制"})]}),e.jsx("button",{type:"button",onClick:fl,className:"px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-medium flex items-center gap-1 transition-colors",children:"下载 TXT"})]})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{type:"button",onClick:()=>{xs(!1),Er(null)},className:"px-5 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-white text-xs font-semibold transition-colors",children:"我已保存好新密钥,关闭"})})]}):e.jsxs("form",{onSubmit:ya,className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300 space-y-1.5 leading-relaxed",children:[e.jsxs("div",{className:"font-semibold flex items-center gap-1.5",children:[e.jsx(Qt,{className:"w-4 h-4 text-amber-400 shrink-0"}),e.jsx("span",{children:"重要安全提示"})]}),e.jsxs("p",{children:["重新生成后,",e.jsx("strong",{children:"您原有的安全恢复密钥将立即作废失效"}),"。系统将生成全新的 16 位恢复密钥供您在忘记密码时离线自救。"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"请输入当前登录密码进行身份确认"}),e.jsx("input",{type:"password",required:!0,value:Vl,onChange:H=>_r(H.target.value),placeholder:"当前登录密码",className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3.5 py-2.5 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-blue-500"})]}),pl&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-xs text-rose-300 flex items-start gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0 mt-0.5"}),e.jsx("span",{children:pl})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>xs(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:va||!Vl.trim(),className:"px-4 py-2 rounded-xl bg-amber-600 hover:bg-amber-500 text-white text-xs font-semibold shadow-md shadow-amber-600/20 transition-all flex items-center gap-1.5 disabled:opacity-50",children:va?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在验证并生成..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"确认重新生成"})]})})]})]})}),$&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-3xl bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden shadow-2xl flex flex-col max-h-[90vh]",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-800 bg-slate-950/60",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Si,{className:"w-5 h-5 text-sky-400"}),e.jsxs("h3",{className:"font-semibold text-white text-base",children:[$.className," · 屏幕通知界面现场截图 (送达真实性核验)"]})]}),e.jsx("button",{type:"button",onClick:Sa,className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition-colors",children:e.jsx(Xt,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 flex-1 overflow-auto flex flex-col items-center justify-center min-h-[320px] bg-slate-950/40",children:[gt&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-slate-400 text-sm",children:[e.jsx(Ct,{className:"w-8 h-8 animate-spin text-blue-400"}),e.jsx("span",{children:"正在安全拉取现场大屏通知截图画面..."})]}),A&&e.jsxs("div",{className:"flex flex-col items-center gap-2 text-rose-400 text-sm",children:[e.jsx(Zt,{className:"w-8 h-8 text-rose-400"}),e.jsx("span",{children:A})]}),Ke&&!gt&&e.jsxs("div",{className:"flex flex-col items-center w-full",children:[e.jsx("div",{className:"overflow-auto max-h-[58vh] max-w-full flex items-center justify-center p-2 rounded-xl bg-black/60 border border-slate-800",children:e.jsx("img",{src:Ke,alt:"教室大屏实际展示画面",style:{transform:`scale(${st})`,transformOrigin:"center center",transition:"transform 0.2s"},className:"rounded-lg shadow-lg object-contain max-h-[52vh]"})}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsx("button",{type:"button",onClick:()=>Ie(H=>Math.max(.5,+(H-.25).toFixed(2))),disabled:st<=.5,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"缩小",children:e.jsx(Tg,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-xs font-mono text-slate-300 min-w-[50px] text-center",children:[Math.round(st*100),"%"]}),e.jsx("button",{type:"button",onClick:()=>Ie(H=>Math.min(3,+(H+.25).toFixed(2))),disabled:st>=3,className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 disabled:opacity-40 transition-colors",title:"放大",children:e.jsx(_g,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>Ie(1),className:"px-2.5 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",children:"重置"})]})]})]}),e.jsxs("div",{className:"px-5 py-3 border-t border-slate-800 bg-slate-950/60 flex flex-col sm:flex-row items-center justify-between text-[11px] text-slate-400 gap-2",children:[e.jsx("span",{children:$.capturedAt?`实拍时间: ${new Date($.capturedAt).toLocaleString()}`:""}),e.jsx("span",{className:"text-sky-400/90 text-right",children:"📷 本截图由教室大屏在收到通知并展示时实拍回传,用于老师核验确认通知发送成功。"})]})]})}),dn&&e.jsx(Vt,{isOpen:!0,onClose:()=>Fl(null),title:"提前撤回大屏通知?",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-slate-950 p-3 rounded-xl border border-slate-800 text-xs text-slate-300",children:[e.jsxs("div",{className:"text-slate-400 text-[11px] mb-1",children:["班级:",e.jsx("span",{className:"text-white font-medium",children:dn.className})]}),e.jsx("p",{className:"line-clamp-3",children:dn.message})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-amber-500/10 border border-amber-500/20 text-xs text-amber-300/90 leading-relaxed",children:["💡 确认撤回后,云端将立即向教室大屏下发终止信令,",e.jsx("strong",{children:"立刻停止语音播报并关闭大屏弹窗"}),"。"]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-2",children:[e.jsx("button",{type:"button",disabled:Nr,onClick:()=>Fl(null),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"button",disabled:Nr,onClick:ka,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 transition-all flex items-center gap-1.5 disabled:opacity-50",children:Nr?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在撤回并通知大屏..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(ua,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"确认提前撤回"})]})})]})]})}),un&&e.jsx(Vt,{isOpen:!0,onClose:()=>ul(null),title:"从历史中删除记录?",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-slate-950 p-3 rounded-xl border border-slate-800 text-xs text-slate-300",children:[e.jsxs("div",{className:"text-slate-400 text-[11px] mb-1",children:["目标班级:",e.jsx("span",{className:"text-white font-medium",children:un.className})]}),e.jsx("p",{className:"line-clamp-3",children:un.message})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-slate-950 border border-slate-800 text-xs text-slate-400 leading-relaxed space-y-1",children:[e.jsx("p",{children:"💡 提示:该操作只会从您的历史回执中隐藏此条记录,不会影响大屏显示,亦不会撤回已发送的通知。"}),(un.status==="Sent"||un.status==="Delivered")&&e.jsx("p",{className:"text-amber-400/90 font-medium",children:"如需立即阻止教室大屏显示,请使用“提前撤回”。"})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-2",children:[e.jsx("button",{type:"button",disabled:zl,onClick:()=>ul(null),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"button",disabled:zl,onClick:Rr,className:"px-4 py-2 rounded-xl bg-rose-600 hover:bg-rose-500 text-white text-xs font-semibold shadow-md shadow-rose-600/20 transition-all flex items-center gap-1.5 disabled:opacity-50",children:zl?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在移除..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Pl,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"确认移除"})]})})]})]})}),Cs&&e.jsx("div",{onClick:wa,role:"button",tabIndex:0,className:`fixed bottom-20 left-4 right-4 sm:left-auto sm:right-6 sm:bottom-6 sm:w-96 z-50 p-3.5 rounded-2xl bg-slate-900/95 border border-emerald-500/40 shadow-2xl backdrop-blur-md cursor-pointer transition-all duration-300 transform select-none ${Cs.isFadingOut?"opacity-0 translate-y-2 pointer-events-none":"opacity-100 translate-y-0 scale-100"} hover:border-emerald-400/70 hover:scale-[1.02] active:scale-[0.98]`,children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-emerald-500/20 border border-emerald-500/40 flex items-center justify-center shrink-0",children:e.jsx(ot,{className:"w-4 h-4 text-emerald-400"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-emerald-300 truncate",children:Cs.message}),e.jsxs("div",{className:"text-[11px] text-slate-400 flex items-center gap-1 mt-0.5",children:[e.jsx("span",{children:"点击立即查看回执动态"}),e.jsx(qp,{className:"w-3 h-3 text-emerald-400"})]})]})]}),e.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),Pt.current.fadeTimer&&clearTimeout(Pt.current.fadeTimer),Pt.current.removeTimer&&clearTimeout(Pt.current.removeTimer),Pn(null)},className:"w-6 h-6 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 flex items-center justify-center shrink-0",title:"关闭提示",children:e.jsx(Xt,{className:"w-3.5 h-3.5"})})]})}),e.jsx(eb,{isOpen:g,onClose:()=>B(!1),onPaymentSuccess:async()=>{await bt()}}),ue&&e.jsx(Vt,{isOpen:!0,onClose:()=>{U(!1),ct(null),We(null)},title:"绑定教室多媒体大屏",children:e.jsxs("form",{onSubmit:Hl,className:"space-y-4",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-blue-500/10 border border-blue-500/20 text-xs text-blue-300 space-y-1",children:[e.jsxs("div",{className:"font-semibold flex items-center gap-1.5",children:[e.jsx(_t,{className:"w-4 h-4 text-blue-400"}),e.jsx("span",{children:"如何获取 8 位配对码?"})]}),e.jsxs("p",{className:"text-[11px] text-blue-300/90 leading-relaxed",children:["请在教室内大屏的待机界面上查看居中高亮显示的 ",e.jsx("strong",{children:"8 位纯数字大屏配对码"}),"(格式如:58291034)。"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300 mb-1.5",children:"8 位班级大屏配对码"}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:8,autoComplete:"one-time-code",required:!0,value:ge,onChange:H=>{const V=H.target.value.replace(/\D/g,"").slice(0,8);je(V)},placeholder:"例如:58291034",className:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3.5 py-2.5 text-sm text-white font-mono placeholder-slate-600 focus:outline-none focus:border-blue-500 tracking-[0.12em] text-center"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsx("label",{className:"block text-xs font-medium text-slate-300",children:"班级名称(必填)"}),e.jsx("span",{className:"text-[11px] text-slate-400 font-mono",children:"如:高一3班、91班"})]}),e.jsx("input",{type:"text",required:!0,value:Ne,onChange:H=>{ye(H.target.value),et&&ct(null)},placeholder:"例如:高一3班 或 91班",className:`w-full bg-slate-950 border rounded-xl px-3.5 py-2.5 text-xs text-white placeholder-slate-600 focus:outline-none transition-colors ${Ne.trim()&&!oa(Ne).isValid?"border-rose-500/50 focus:border-rose-500":"border-slate-800 focus:border-blue-500"}`}),Ne.trim()&&!oa(Ne).isValid?e.jsxs("p",{className:"text-[11px] text-rose-400 mt-1.5 flex items-center gap-1",children:[e.jsx(Zt,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{children:oa(Ne).error})]}):e.jsxs("p",{className:"text-[10px] text-slate-400 mt-1",children:["💡 只能填写汉字与数字,必须以“班”结尾(例如:高一3班、91班、初二1班),",e.jsx("strong",{children:"不能包含中英文括号"}),"。"]})]}),et&&e.jsxs("div",{className:"p-3 rounded-xl bg-rose-500/10 border border-rose-500/30 text-xs text-rose-300 flex items-start gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 text-rose-400 shrink-0 mt-0.5"}),e.jsx("span",{children:et})]}),Je&&e.jsxs("div",{className:"p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-xs text-emerald-300 flex items-start gap-2",children:[e.jsx(is,{className:"w-4 h-4 text-emerald-400 shrink-0 mt-0.5"}),e.jsx("span",{children:Je})]}),e.jsxs("div",{className:"flex justify-end gap-2.5 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>U(!1),className:"px-4 py-2 rounded-xl text-slate-300 hover:bg-slate-800 text-xs font-medium transition-colors",children:"取消"}),e.jsx("button",{type:"submit",disabled:de||ge.replace(/[^0-9]/g,"").length!==8||!oa(Ne).isValid,className:"px-4 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-semibold shadow-md shadow-blue-600/20 transition-all flex items-center gap-1.5 disabled:opacity-50",children:de?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"正在绑定大屏..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"确认绑定"})]})})]})]})}),tt&&e.jsx(Vt,{isOpen:tt.open,onClose:()=>At(null),title:"临时配对窗口已开启",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-slate-950 border border-slate-800 text-center space-y-2",children:[e.jsx(Jf,{className:"w-10 h-10 text-sky-400 mx-auto animate-pulse"}),e.jsxs("div",{className:"text-sm font-semibold text-white",children:["已向【",tt.alias,"】大屏发送唤醒信令"]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:"教室大屏待机界面已临时显示 8 位配对码,有效时间为 10 分钟。其他任课教师可在其控制台中输入配对码完成关联绑定。"}),e.jsx("div",{className:"py-2",children:e.jsx("span",{className:"font-mono text-2xl font-bold text-sky-400 tracking-wider",children:tt.code})})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{type:"button",onClick:()=>At(null),className:"px-5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white text-xs font-medium transition-colors",children:"我知道了"})})]})})]})},rb=()=>{const{user:a,isLoading:l}=Ol();return l?e.jsx("div",{className:"min-h-screen bg-slate-950 flex items-center justify-center text-slate-400 text-sm",children:"正在验证用户身份..."}):a?e.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col",children:[e.jsx(Rg,{}),e.jsx("main",{className:"flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6",children:e.jsx(H0,{})})]}):e.jsx(Tl,{to:"/login",replace:!0})},ab=()=>e.jsxs(Rh,{children:[e.jsx(vt,{path:"/",element:e.jsx(Pg,{})}),e.jsx(vt,{path:"/login",element:e.jsx(Dg,{})}),e.jsxs(vt,{element:e.jsx(rb,{}),children:[e.jsxs(vt,{element:e.jsx(yc,{allowedRoles:["SuperAdmin"]}),children:[e.jsx(vt,{path:"/admin",element:e.jsx(Lg,{})}),e.jsx(vt,{path:"/admin/tenants",element:e.jsx(Fg,{})}),e.jsx(vt,{path:"/admin/users",element:e.jsx(zg,{})}),e.jsx(vt,{path:"/admin/devices",element:e.jsx(Mg,{})}),e.jsx(vt,{path:"/admin/fleet",element:e.jsx(Hg,{})}),e.jsx(vt,{path:"/admin/self-check-batches",element:e.jsx(Wg,{})}),e.jsx(vt,{path:"/admin/self-check-batches/:batchId",element:e.jsx(Vg,{})}),e.jsx(vt,{path:"/admin/broadcast",element:e.jsx(Bg,{})}),e.jsx(vt,{path:"/admin/codes",element:e.jsx(Og,{})}),e.jsx(vt,{path:"/admin/licenses",element:e.jsx(Kg,{})}),e.jsx(vt,{path:"/admin/trial-security",element:e.jsx(E0,{})}),e.jsx(vt,{path:"/admin/trial-ledgers",element:e.jsx(E0,{})}),e.jsx(vt,{path:"/admin/history",element:e.jsx(Ug,{})}),e.jsx(vt,{path:"/admin/logs",element:e.jsx(qg,{})})]}),e.jsxs(vt,{element:e.jsx(yc,{allowedRoles:["SchoolAdmin"]}),children:[e.jsx(vt,{path:"/school-admin",element:e.jsx(Qg,{})}),e.jsx(vt,{path:"/school-admin/teachers",element:e.jsx(Gg,{})}),e.jsx(vt,{path:"/school-admin/classes",element:e.jsx(Jg,{})}),e.jsx(vt,{path:"/school-admin/devices",element:e.jsx(Yg,{})}),e.jsx(vt,{path:"/school-admin/codes",element:e.jsx(Xg,{})}),e.jsx(vt,{path:"/school-admin/history",element:e.jsx(Zg,{})})]}),e.jsxs(vt,{element:e.jsx(yc,{allowedRoles:["Teacher","TenantOwner"]}),children:[e.jsx(vt,{path:"/teacher",element:e.jsx(lb,{})}),e.jsx(vt,{path:"/teacher/codes",element:e.jsx(Tl,{to:"/teacher",replace:!0})})]})]}),e.jsx(vt,{path:"*",element:e.jsx(Tl,{to:"/",replace:!0})})]}),ib=()=>e.jsx(Ep,{children:e.jsx(Uh,{children:e.jsx(ab,{})})});Om.createRoot(document.getElementById("root")).render(e.jsx(I0.StrictMode,{children:e.jsx(ib,{})})); ================================================================================ FILE END: src/Server/ClassNotify.Server/wwwroot/assets/index-BG-C4jY1.js ================================================================================ ================================================================================ FILE BEGIN: src/Server/ClassNotify.Server/wwwroot/assets/index-BGB10Mnd.css SHA256: 612dc540bdfdf8f6390f84a94f0173e4a657234f61aa201819a093a5ddb9271b SIZE: 76597 ================================================================================ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}body{min-height:100vh;--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}body *::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body *::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}body::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-20{right:-5rem}.-top-2{top:-.5rem}.-top-20{top:-5rem}.bottom-0{bottom:0}.bottom-20{bottom:5rem}.left-0{left:0}.left-1\/2{left:50%}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-3\.5{left:.875rem}.left-4{left:1rem}.right-0{right:0}.right-1\.5{right:.375rem}.right-2{right:.5rem}.right-2\.5{right:.625rem}.right-3{right:.75rem}.right-4{right:1rem}.right-\[-100px\]{right:-100px}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2\.5{top:.625rem}.top-3\.5{top:.875rem}.top-\[600px\]{top:600px}.top-full{top:100%}.-z-10{z-index:-10}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-0\.5{margin-left:-.125rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-3\.5{margin-bottom:.875rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-14{margin-top:3.5rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-3\.5{margin-top:.875rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[450px\]{height:450px}.h-\[500px\]{height:500px}.h-full{height:100%}.max-h-40{max-height:10rem}.max-h-\[52vh\]{max-height:52vh}.max-h-\[58vh\]{max-height:58vh}.max-h-\[65vh\]{max-height:65vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100vh-250px\)\]{max-height:calc(100vh - 250px)}.min-h-\[300px\]{min-height:300px}.min-h-\[320px\]{min-height:320px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-36{width:9rem}.w-4{width:1rem}.w-44{width:11rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[1000px\]{width:1000px}.w-\[500px\]{width:500px}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[50px\]{min-width:50px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[110px\]{max-width:110px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-3\.5{gap:.875rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-1{row-gap:.25rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2\.5>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.625rem * var(--tw-space-x-reverse));margin-left:calc(.625rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-3\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.875rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.875rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-slate-100>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(241 245 249 / var(--tw-divide-opacity, 1))}.divide-slate-800\/50>:not([hidden])~:not([hidden]){border-color:#1e293b80}.divide-slate-800\/60>:not([hidden])~:not([hidden]){border-color:#1e293b99}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-300{--tw-border-opacity: 1;border-color:rgb(252 211 77 / var(--tw-border-opacity, 1))}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/25{border-color:#f59e0b40}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/40{border-color:#f59e0b66}.border-amber-500\/50{border-color:#f59e0b80}.border-amber-800\/40{border-color:#92400e66}.border-amber-800\/60{border-color:#92400e99}.border-amber-800\/80{border-color:#92400ecc}.border-amber-900\/40{border-color:#78350f66}.border-blue-400\/30{border-color:#60a5fa4d}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/40{border-color:#3b82f666}.border-blue-500\/50{border-color:#3b82f680}.border-blue-500\/60{border-color:#3b82f699}.border-cyan-500\/20{border-color:#06b6d433}.border-emerald-200{--tw-border-opacity: 1;border-color:rgb(167 243 208 / var(--tw-border-opacity, 1))}.border-emerald-300{--tw-border-opacity: 1;border-color:rgb(110 231 183 / var(--tw-border-opacity, 1))}.border-emerald-400{--tw-border-opacity: 1;border-color:rgb(52 211 153 / var(--tw-border-opacity, 1))}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/25{border-color:#10b98140}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-500\/50{border-color:#10b98180}.border-emerald-800{--tw-border-opacity: 1;border-color:rgb(6 95 70 / var(--tw-border-opacity, 1))}.border-emerald-800\/40{border-color:#065f4666}.border-emerald-800\/60{border-color:#065f4699}.border-emerald-800\/80{border-color:#065f46cc}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-500{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.border-indigo-200{--tw-border-opacity: 1;border-color:rgb(199 210 254 / var(--tw-border-opacity, 1))}.border-indigo-500{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.border-indigo-500\/20{border-color:#6366f133}.border-indigo-500\/30{border-color:#6366f14d}.border-indigo-500\/50{border-color:#6366f180}.border-indigo-600{--tw-border-opacity: 1;border-color:rgb(79 70 229 / var(--tw-border-opacity, 1))}.border-indigo-800{--tw-border-opacity: 1;border-color:rgb(55 48 163 / var(--tw-border-opacity, 1))}.border-indigo-800\/40{border-color:#3730a366}.border-orange-500\/20{border-color:#f9731633}.border-orange-500\/30{border-color:#f973164d}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-500\/20{border-color:#a855f733}.border-purple-800{--tw-border-opacity: 1;border-color:rgb(107 33 168 / var(--tw-border-opacity, 1))}.border-purple-800\/60{border-color:#6b21a899}.border-red-500\/20{border-color:#ef444433}.border-rose-200{--tw-border-opacity: 1;border-color:rgb(254 205 211 / var(--tw-border-opacity, 1))}.border-rose-300{--tw-border-opacity: 1;border-color:rgb(253 164 175 / var(--tw-border-opacity, 1))}.border-rose-500{--tw-border-opacity: 1;border-color:rgb(244 63 94 / var(--tw-border-opacity, 1))}.border-rose-500\/20{border-color:#f43f5e33}.border-rose-500\/30{border-color:#f43f5e4d}.border-rose-500\/40{border-color:#f43f5e66}.border-rose-500\/50{border-color:#f43f5e80}.border-rose-600\/30{border-color:#e11d484d}.border-rose-600\/40{border-color:#e11d4866}.border-rose-800{--tw-border-opacity: 1;border-color:rgb(159 18 57 / var(--tw-border-opacity, 1))}.border-rose-800\/50{border-color:#9f123980}.border-rose-800\/60{border-color:#9f123999}.border-rose-900\/40{border-color:#88133766}.border-rose-900\/50{border-color:#88133780}.border-sky-200{--tw-border-opacity: 1;border-color:rgb(186 230 253 / var(--tw-border-opacity, 1))}.border-sky-300{--tw-border-opacity: 1;border-color:rgb(125 211 252 / var(--tw-border-opacity, 1))}.border-sky-500{--tw-border-opacity: 1;border-color:rgb(14 165 233 / var(--tw-border-opacity, 1))}.border-sky-500\/20{border-color:#0ea5e933}.border-sky-500\/25{border-color:#0ea5e940}.border-sky-500\/30{border-color:#0ea5e94d}.border-sky-800\/60{border-color:#07598599}.border-sky-800\/80{border-color:#075985cc}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-200\/60{border-color:#e2e8f099}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.border-slate-400\/50{border-color:#94a3b880}.border-slate-500{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-700\/60{border-color:#33415599}.border-slate-700\/80{border-color:#334155cc}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/40{border-color:#1e293b66}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/70{border-color:#1e293bb3}.border-slate-800\/80{border-color:#1e293bcc}.border-teal-500\/20{border-color:#14b8a633}.border-teal-500\/30{border-color:#14b8a64d}.border-teal-800\/40{border-color:#115e5966}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-50\/30{background-color:#fffbeb4d}.bg-amber-50\/40{background-color:#fffbeb66}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/25{background-color:#f59e0b40}.bg-amber-500\/80{background-color:#f59e0bcc}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-600\/15{background-color:#d9770626}.bg-amber-600\/20{background-color:#d9770633}.bg-amber-950\/20{background-color:#451a0333}.bg-amber-950\/30{background-color:#451a034d}.bg-amber-950\/40{background-color:#451a0366}.bg-amber-950\/80{background-color:#451a03cc}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/75{background-color:#000000bf}.bg-black\/80{background-color:#000c}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-400\/20{background-color:#60a5fa33}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/15{background-color:#3b82f626}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-600\/10{background-color:#2563eb1a}.bg-blue-600\/15{background-color:#2563eb26}.bg-blue-600\/20{background-color:#2563eb33}.bg-blue-600\/30{background-color:#2563eb4d}.bg-blue-700\/60{background-color:#1d4ed899}.bg-blue-950\/20{background-color:#17255433}.bg-blue-950\/60{background-color:#17255499}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-600{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity, 1))}.bg-emerald-100{--tw-bg-opacity: 1;background-color:rgb(209 250 229 / var(--tw-bg-opacity, 1))}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-50{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / var(--tw-bg-opacity, 1))}.bg-emerald-50\/40{background-color:#ecfdf566}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/15{background-color:#05966926}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-950{--tw-bg-opacity: 1;background-color:rgb(2 44 34 / var(--tw-bg-opacity, 1))}.bg-emerald-950\/20{background-color:#022c2233}.bg-emerald-950\/30{background-color:#022c224d}.bg-emerald-950\/80{background-color:#022c22cc}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-indigo-400{--tw-bg-opacity: 1;background-color:rgb(129 140 248 / var(--tw-bg-opacity, 1))}.bg-indigo-50{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.bg-indigo-50\/50{background-color:#eef2ff80}.bg-indigo-500{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-500\/20{background-color:#6366f133}.bg-indigo-500\/5{background-color:#6366f10d}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-indigo-600\/15{background-color:#4f46e526}.bg-indigo-600\/20{background-color:#4f46e533}.bg-indigo-950{--tw-bg-opacity: 1;background-color:rgb(30 27 75 / var(--tw-bg-opacity, 1))}.bg-indigo-950\/20{background-color:#1e1b4b33}.bg-indigo-950\/50{background-color:#1e1b4b80}.bg-indigo-950\/60{background-color:#1e1b4b99}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-950\/20{background-color:#43140733}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-600\/25{background-color:#9333ea40}.bg-purple-950{--tw-bg-opacity: 1;background-color:rgb(59 7 100 / var(--tw-bg-opacity, 1))}.bg-purple-950\/20{background-color:#3b076433}.bg-purple-950\/40{background-color:#3b076466}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-950\/20{background-color:#450a0a33}.bg-rose-100{--tw-bg-opacity: 1;background-color:rgb(255 228 230 / var(--tw-bg-opacity, 1))}.bg-rose-400{--tw-bg-opacity: 1;background-color:rgb(251 113 133 / var(--tw-bg-opacity, 1))}.bg-rose-50{--tw-bg-opacity: 1;background-color:rgb(255 241 242 / var(--tw-bg-opacity, 1))}.bg-rose-50\/30{background-color:#fff1f24d}.bg-rose-50\/40{background-color:#fff1f266}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/15{background-color:#f43f5e26}.bg-rose-500\/20{background-color:#f43f5e33}.bg-rose-500\/25{background-color:#f43f5e40}.bg-rose-600{--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity, 1))}.bg-rose-600\/15{background-color:#e11d4826}.bg-rose-600\/20{background-color:#e11d4833}.bg-rose-600\/90{background-color:#e11d48e6}.bg-rose-950{--tw-bg-opacity: 1;background-color:rgb(76 5 25 / var(--tw-bg-opacity, 1))}.bg-rose-950\/20{background-color:#4c051933}.bg-rose-950\/30{background-color:#4c05194d}.bg-rose-950\/40{background-color:#4c051966}.bg-rose-950\/60{background-color:#4c051999}.bg-sky-100{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-50{--tw-bg-opacity: 1;background-color:rgb(240 249 255 / var(--tw-bg-opacity, 1))}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-sky-500\/10{background-color:#0ea5e91a}.bg-sky-500\/15{background-color:#0ea5e926}.bg-sky-500\/20{background-color:#0ea5e933}.bg-sky-500\/5{background-color:#0ea5e90d}.bg-sky-600{--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity, 1))}.bg-sky-600\/15{background-color:#0284c726}.bg-sky-600\/20{background-color:#0284c733}.bg-sky-900\/40{background-color:#0c4a6e66}.bg-sky-950\/80{background-color:#082f49cc}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-slate-50\/30{background-color:#f8fafc4d}.bg-slate-50\/75{background-color:#f8fafcbf}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-800\/80{background-color:#1e293bcc}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-900\/90{background-color:#0f172ae6}.bg-slate-900\/95{background-color:#0f172af2}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/40{background-color:#02061766}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/70{background-color:#020617b3}.bg-slate-950\/80{background-color:#020617cc}.bg-slate-950\/85{background-color:#020617d9}.bg-slate-950\/95{background-color:#020617f2}.bg-teal-500\/10{background-color:#14b8a61a}.bg-teal-600{--tw-bg-opacity: 1;background-color:rgb(13 148 136 / var(--tw-bg-opacity, 1))}.bg-teal-950\/50{background-color:#042f2e80}.bg-teal-950\/60{background-color:#042f2e99}.bg-transparent{background-color:transparent}.bg-violet-500\/10{background-color:#8b5cf61a}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-amber-500\/10{--tw-gradient-from: rgb(245 158 11 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-900\/40{--tw-gradient-from: rgb(30 58 138 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 58 138 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-600{--tw-gradient-from: #4f46e5 var(--tw-gradient-from-position);--tw-gradient-to: rgb(79 70 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-600\/10{--tw-gradient-from: rgb(79 70 229 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(79 70 229 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-950\/60{--tw-gradient-from: rgb(30 27 75 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 27 75 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-sky-500{--tw-gradient-from: #0ea5e9 var(--tw-gradient-from-position);--tw-gradient-to: rgb(14 165 233 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-900{--tw-gradient-from: #0f172a var(--tw-gradient-from-position);--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-900\/95{--tw-gradient-from: rgb(15 23 42 / .95) var(--tw-gradient-from-position);--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-950{--tw-gradient-from: #020617 var(--tw-gradient-from-position);--tw-gradient-to: rgb(2 6 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-cyan-600\/5{--tw-gradient-to: rgb(8 145 178 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(8 145 178 / .05) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-indigo-500\/10{--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(99 102 241 / .1) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-indigo-900\/30{--tw-gradient-to: rgb(49 46 129 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(49 46 129 / .3) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-slate-200{--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #e2e8f0 var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-slate-900{--tw-gradient-to: rgb(15 23 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #0f172a var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-indigo-500{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.to-indigo-950\/40{--tw-gradient-to: rgb(30 27 75 / .4) var(--tw-gradient-to-position)}.to-purple-900\/40{--tw-gradient-to: rgb(88 28 135 / .4) var(--tw-gradient-to-position)}.to-slate-400{--tw-gradient-to: #94a3b8 var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.to-slate-900\/60{--tw-gradient-to: rgb(15 23 42 / .6) var(--tw-gradient-to-position)}.to-slate-950{--tw-gradient-to: #020617 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.to-violet-500{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.stroke-\[1\.5\]{stroke-width:1.5}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-14{padding-top:3.5rem;padding-bottom:3.5rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-2\.5{padding-bottom:.625rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-10{padding-left:2.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pr-8{padding-right:2rem}.pr-9{padding-right:2.25rem}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-2\.5{padding-top:.625rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-\[\'Inter\'\,system-ui\,-apple-system\,sans-serif\]{font-family:Inter,system-ui,-apple-system,sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[22px\]{font-size:22px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-normal{line-height:1.5}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-\[0\.12em\]{letter-spacing:.12em}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/80{color:#fcd34dcc}.text-amber-300\/90{color:#fcd34de6}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-500\/80{color:#f59e0bcc}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-200{--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-300\/90{color:#93c5fde6}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-300\/90{color:#6ee7b7e6}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/80{color:#34d399cc}.text-emerald-400\/90{color:#34d399e6}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-500\/80{color:#10b981cc}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-emerald-700{--tw-text-opacity: 1;color:rgb(4 120 87 / var(--tw-text-opacity, 1))}.text-emerald-800{--tw-text-opacity: 1;color:rgb(6 95 70 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-indigo-300{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-indigo-500\/40{color:#6366f166}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-indigo-700{--tw-text-opacity: 1;color:rgb(67 56 202 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-purple-200{--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-rose-200{--tw-text-opacity: 1;color:rgb(254 205 211 / var(--tw-text-opacity, 1))}.text-rose-300{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-rose-400\/80{color:#fb7185cc}.text-rose-500{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity, 1))}.text-rose-500\/80{color:#f43f5ecc}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-rose-700{--tw-text-opacity: 1;color:rgb(190 18 60 / var(--tw-text-opacity, 1))}.text-rose-800{--tw-text-opacity: 1;color:rgb(159 18 57 / var(--tw-text-opacity, 1))}.text-sky-200{--tw-text-opacity: 1;color:rgb(186 230 253 / var(--tw-text-opacity, 1))}.text-sky-300{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-400\/90{color:#38bdf8e6}.text-sky-600{--tw-text-opacity: 1;color:rgb(2 132 199 / var(--tw-text-opacity, 1))}.text-sky-700{--tw-text-opacity: 1;color:rgb(3 105 161 / var(--tw-text-opacity, 1))}.text-sky-800{--tw-text-opacity: 1;color:rgb(7 89 133 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-slate-950{--tw-text-opacity: 1;color:rgb(2 6 23 / var(--tw-text-opacity, 1))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-amber-500\/10{--tw-shadow-color: rgb(245 158 11 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/5{--tw-shadow-color: rgb(245 158 11 / .05);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-600\/20{--tw-shadow-color: rgb(217 119 6 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/5{--tw-shadow-color: rgb(59 130 246 / .05);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-600\/20{--tw-shadow-color: rgb(37 99 235 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-600\/25{--tw-shadow-color: rgb(37 99 235 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/20{--tw-shadow-color: rgb(16 185 129 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/5{--tw-shadow-color: rgb(16 185 129 / .05);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-600\/20{--tw-shadow-color: rgb(5 150 105 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/25{--tw-shadow-color: rgb(99 102 241 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/20{--tw-shadow-color: rgb(79 70 229 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/25{--tw-shadow-color: rgb(79 70 229 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-600\/30{--tw-shadow-color: rgb(79 70 229 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-900\/30{--tw-shadow-color: rgb(49 46 129 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-500\/5{--tw-shadow-color: rgb(244 63 94 / .05);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/20{--tw-shadow-color: rgb(225 29 72 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-rose-600\/25{--tw-shadow-color: rgb(225 29 72 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-sky-500\/20{--tw-shadow-color: rgb(14 165 233 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-sky-500\/25{--tw-shadow-color: rgb(14 165 233 / .25);--tw-shadow: var(--tw-shadow-colored)}.shadow-sky-600\/20{--tw-shadow-color: rgb(2 132 199 / .2);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-amber-100{--tw-ring-opacity: 1;--tw-ring-color: rgb(254 243 199 / var(--tw-ring-opacity, 1))}.ring-emerald-100{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 250 229 / var(--tw-ring-opacity, 1))}.ring-emerald-400\/80{--tw-ring-color: rgb(52 211 153 / .8)}.ring-gray-100{--tw-ring-opacity: 1;--tw-ring-color: rgb(243 244 246 / var(--tw-ring-opacity, 1))}.ring-indigo-100{--tw-ring-opacity: 1;--tw-ring-color: rgb(224 231 255 / var(--tw-ring-opacity, 1))}.ring-indigo-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(199 210 254 / var(--tw-ring-opacity, 1))}.ring-rose-100{--tw-ring-opacity: 1;--tw-ring-color: rgb(255 228 230 / var(--tw-ring-opacity, 1))}.ring-slate-100{--tw-ring-opacity: 1;--tw-ring-color: rgb(241 245 249 / var(--tw-ring-opacity, 1))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.\[-\:T\]{-: T}.glass-panel{border-radius:1rem;border-width:1px;border-color:#1e293bcc;background-color:#0f172ab3;--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.glass-card{border-radius:.75rem;border-width:1px;border-color:#33415580;background-color:#1e293b66;--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.glass-card:hover{border-color:#475569b3;background-color:#1e293b99}.selection\:bg-indigo-500 *::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.selection\:bg-indigo-500 *::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.selection\:text-white *::-moz-selection{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.selection\:text-white *::selection{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.selection\:bg-indigo-500::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.selection\:bg-indigo-500::selection{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.selection\:text-white::-moz-selection{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.selection\:text-white::selection{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:bottom-0:after{content:var(--tw-content);bottom:0}.after\:left-0:after{content:var(--tw-content);left:0}.after\:right-0:after{content:var(--tw-content);right:0}.after\:h-0\.5:after{content:var(--tw-content);height:.125rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:bg-blue-500:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-amber-300:hover{--tw-border-opacity: 1;border-color:rgb(252 211 77 / var(--tw-border-opacity, 1))}.hover\:border-amber-500\/30:hover{border-color:#f59e0b4d}.hover\:border-amber-500\/40:hover{border-color:#f59e0b66}.hover\:border-amber-500\/60:hover{border-color:#f59e0b99}.hover\:border-blue-400:hover{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.hover\:border-blue-500\/40:hover{border-color:#3b82f666}.hover\:border-emerald-300:hover{--tw-border-opacity: 1;border-color:rgb(110 231 183 / var(--tw-border-opacity, 1))}.hover\:border-emerald-400\/70:hover{border-color:#34d399b3}.hover\:border-emerald-500\/30:hover{border-color:#10b9814d}.hover\:border-emerald-500\/40:hover{border-color:#10b98166}.hover\:border-emerald-500\/50:hover{border-color:#10b98180}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-indigo-400:hover{--tw-border-opacity: 1;border-color:rgb(129 140 248 / var(--tw-border-opacity, 1))}.hover\:border-indigo-500\/40:hover{border-color:#6366f166}.hover\:border-indigo-500\/50:hover{border-color:#6366f180}.hover\:border-orange-500\/60:hover{border-color:#f9731699}.hover\:border-rose-300:hover{--tw-border-opacity: 1;border-color:rgb(253 164 175 / var(--tw-border-opacity, 1))}.hover\:border-rose-500\/30:hover{border-color:#f43f5e4d}.hover\:border-rose-500\/40:hover{border-color:#f43f5e66}.hover\:border-rose-600\/70:hover{border-color:#e11d48b3}.hover\:border-rose-700\/50:hover{border-color:#be123c80}.hover\:border-slate-300:hover{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:border-slate-700\/60:hover{border-color:#33415599}.hover\:border-slate-700\/80:hover{border-color:#334155cc}.hover\:border-slate-800:hover{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.hover\:border-teal-500\/40:hover{border-color:#14b8a666}.hover\:bg-amber-400:hover{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500:hover{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-500\/20:hover{background-color:#f59e0b33}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600\/25:hover{background-color:#d9770640}.hover\:bg-amber-600\/30:hover{background-color:#d977064d}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/10:hover{background-color:#3b82f61a}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-cyan-500:hover{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-600\/25:hover{background-color:#05966940}.hover\:bg-emerald-600\/30:hover{background-color:#0596694d}.hover\:bg-indigo-100:hover{--tw-bg-opacity: 1;background-color:rgb(224 231 255 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-50:hover{--tw-bg-opacity: 1;background-color:rgb(238 242 255 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500\/10:hover{background-color:#6366f11a}.hover\:bg-indigo-600\/25:hover{background-color:#4f46e540}.hover\:bg-indigo-600\/30:hover{background-color:#4f46e54d}.hover\:bg-indigo-700:hover{--tw-bg-opacity: 1;background-color:rgb(67 56 202 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-rose-500:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-500\/10:hover{background-color:#f43f5e1a}.hover\:bg-rose-500\/15:hover{background-color:#f43f5e26}.hover\:bg-rose-500\/20:hover{background-color:#f43f5e33}.hover\:bg-rose-600\/25:hover{background-color:#e11d4840}.hover\:bg-rose-700:hover{--tw-bg-opacity: 1;background-color:rgb(190 18 60 / var(--tw-bg-opacity, 1))}.hover\:bg-rose-900\/40:hover{background-color:#88133766}.hover\:bg-rose-900\/60:hover{background-color:#88133799}.hover\:bg-sky-500:hover{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.hover\:bg-sky-500\/25:hover{background-color:#0ea5e940}.hover\:bg-sky-600\/30:hover{background-color:#0284c74d}.hover\:bg-sky-900\/60:hover{background-color:#0c4a6e99}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-50:hover{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-50\/60:hover{background-color:#f8fafc99}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700\/80:hover{background-color:#334155cc}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/25:hover{background-color:#1e293b40}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/40:hover{background-color:#1e293b66}.hover\:bg-slate-900:hover{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-900\/40:hover{background-color:#0f172a66}.hover\:from-amber-400:hover{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-sky-400:hover{--tw-gradient-from: #38bdf8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(56 189 248 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-indigo-500:hover{--tw-gradient-to: #6366f1 var(--tw-gradient-to-position)}.hover\:text-amber-200:hover{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-emerald-200:hover{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.hover\:text-emerald-300:hover{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.hover\:text-indigo-300:hover{--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.hover\:text-indigo-400:hover{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.hover\:text-indigo-800:hover{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-rose-200:hover{--tw-text-opacity: 1;color:rgb(254 205 211 / var(--tw-text-opacity, 1))}.hover\:text-rose-300:hover{--tw-text-opacity: 1;color:rgb(253 164 175 / var(--tw-text-opacity, 1))}.hover\:text-rose-400:hover{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.hover\:text-rose-800:hover{--tw-text-opacity: 1;color:rgb(159 18 57 / var(--tw-text-opacity, 1))}.hover\:text-sky-400:hover{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-slate-600:hover{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.hover\:text-slate-700:hover{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.hover\:text-teal-300:hover{--tw-text-opacity: 1;color:rgb(94 234 212 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-indigo-600\/40:hover{--tw-shadow-color: rgb(79 70 229 / .4);--tw-shadow: var(--tw-shadow-colored)}.focus\:border-amber-500:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-cyan-500:focus{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.focus\:border-indigo-500\/50:focus{border-color:#6366f180}.focus\:border-rose-500:focus{--tw-border-opacity: 1;border-color:rgb(244 63 94 / var(--tw-border-opacity, 1))}.focus\:border-sky-500:focus{--tw-border-opacity: 1;border-color:rgb(14 165 233 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-amber-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(245 158 11 / var(--tw-ring-opacity, 1))}.focus\:ring-amber-500\/50:focus{--tw-ring-color: rgb(245 158 11 / .5)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-emerald-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(16 185 129 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500\/30:focus{--tw-ring-color: rgb(99 102 241 / .3)}.focus\:ring-indigo-500\/50:focus{--tw-ring-color: rgb(99 102 241 / .5)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:bg-blue-700:active{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:hover .group-hover\:translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}@media(min-width:390px){.min-\[390px\]\:text-2xl{font-size:1.5rem;line-height:2rem}}@media(min-width:640px){.sm\:bottom-6{bottom:1.5rem}.sm\:left-auto{left:auto}.sm\:right-6{right:1.5rem}.sm\:col-span-3{grid-column:span 3 / span 3}.sm\:col-span-4{grid-column:span 4 / span 4}.sm\:col-span-5{grid-column:span 5 / span 5}.sm\:my-6{margin-top:1.5rem;margin-bottom:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:h-14{height:3.5rem}.sm\:h-7{height:1.75rem}.sm\:w-14{width:3.5rem}.sm\:w-60{width:15rem}.sm\:w-64{width:16rem}.sm\:w-7{width:1.75rem}.sm\:w-72{width:18rem}.sm\:w-96{width:24rem}.sm\:w-auto{width:auto}.sm\:max-w-none{max-width:none}.sm\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:1rem}.sm\:self-auto{align-self:auto}.sm\:self-center{align-self:center}.sm\:p-5{padding:1.25rem}.sm\:p-8{padding:2rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-20{padding-top:5rem;padding-bottom:5rem}.sm\:py-24{padding-top:6rem;padding-bottom:6rem}.sm\:pt-24{padding-top:6rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-5xl{font-size:3rem;line-height:1}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media(min-width:768px){.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-36{width:9rem}.md\:w-48{width:12rem}.md\:w-64{width:16rem}.md\:w-72{width:18rem}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:self-auto{align-self:auto}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-5{grid-column:span 5 / span 5}.lg\:col-span-7{grid-column:span 7 / span 7}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-start{align-items:flex-start}.lg\:items-center{align-items:center}.lg\:gap-6{gap:1.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:pb-24{padding-bottom:6rem}.lg\:text-6xl{font-size:3.75rem;line-height:1}}@media print{.print\:max-h-none{max-height:none}.print\:overflow-visible{overflow:visible}.print\:border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity, 1))}.print\:border-gray-400{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.print\:bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.print\:bg-transparent{background-color:transparent}.print\:bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.print\:p-0{padding:0}.print\:text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.print\:text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.print\:text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.print\:text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.print\:text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}} ================================================================================ FILE END: src/Server/ClassNotify.Server/wwwroot/assets/index-BGB10Mnd.css ================================================================================ ================================================================================ FILE BEGIN: src/Server/ClassNotify.Server/wwwroot/index.html SHA256: e4469c92fd32249b7fe626196938111999e98cbb9cf245c4fbf71b7f440a7e68 SIZE: 981 ================================================================================ ClassNotify 智慧教室通知与集控平台
================================================================================ FILE END: src/Server/ClassNotify.Server/wwwroot/index.html ================================================================================ ================================================================================ FILE BEGIN: src/Server/classnotify.service SHA256: bec7ec0ed3321026978abdf45131e9f190312d2e951e1aa07ced7287dc28f65f SIZE: 575 ================================================================================ [Unit] Description=ClassNotify Cloud SignalR Server After=network-online.target postgresql.service Wants=network-online.target [Service] WorkingDirectory=/var/www/classnotify/current ExecStart=/usr/bin/dotnet /var/www/classnotify/current/ClassNotify.Server.dll User=www-data Group=www-data Environment=ASPNETCORE_ENVIRONMENT=Production Environment=ASPNETCORE_URLS=http://127.0.0.1:5000 Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false EnvironmentFile=/etc/classnotify/classnotify.env Restart=always RestartSec=10 KillSignal=SIGINT [Install] WantedBy=multi-user.target ================================================================================ FILE END: src/Server/classnotify.service ================================================================================ ================================================================================ FILE BEGIN: src/Server/docker-compose.yml SHA256: e74c2680f4f22e4dc134ede0188ad066ec701aa0cc76f8a079b2235f27043bd2 SIZE: 564 ================================================================================ version: '3.8' services: server: build: context: ../../ dockerfile: src/Server/ClassNotify.Server/Dockerfile restart: always environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://+:5000 ports: - "127.0.0.1:5000:5000" caddy: image: caddy:alpine restart: always ports: - "80:80" - "443:443" volumes: - ./Caddyfile:/etc/caddy/Caddyfile - caddy_data:/data - caddy_config:/config depends_on: - server volumes: caddy_data: caddy_config: ================================================================================ FILE END: src/Server/docker-compose.yml ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/ClassNotify.Shared.csproj SHA256: 3d130ef85c63df9966763bee1b9dfe0e5666c91dd26fb6ab15aef185fa8910c1 SIZE: 242 ================================================================================ net8.0 enable enable latest ================================================================================ FILE END: src/Shared/ClassNotify.Shared/ClassNotify.Shared.csproj ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Contracts/IDeviceHubClient.cs SHA256: fab82bbf4daa403c33e3d0bc16a4a00bb615fda74490b2aa4f35efe3398c1e1f SIZE: 2229 ================================================================================ using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Contracts; /// /// 教室端 (Windows Service) 接收来自服务端的强类型 SignalR 契约 /// public interface IDeviceHubClient { /// /// 接收呼叫/通知指令 /// Task ReceiveNotification(NotificationDto notification); /// /// 接收服务端下发的端到端受控运维指令 (SelfCheck, RestartClient, Reconnect, RefreshConfig) /// Task ReceiveRemoteCommand(DeviceCommandDto command); /// /// 接收服务端下达的撤回/提前关闭通知指令 /// Task CancelNotification(string notificationId); /// /// 接收配置更新 /// Task ReceiveConfigUpdate(string configJson); /// /// 接收服务端下达的技术诊断包采集命令 (P2.5 RC1-3 Support Bundle) /// Task GenerateSupportBundle(GenerateSupportBundleCommand command); /// /// 接收服务端下发的版本升级启动指令 (P2.5 RC1-4 Update & Rollback) /// Task StartDeviceUpdate(StartDeviceUpdateCommand command); /// /// 接收服务端下达的设备授权状态变更通知 (P3 License Lifecycle) /// Task ReceiveLicenseStatus(DeviceLicenseStatusDto licenseStatus); /// /// 接收班级名称或大屏名称更新通知 /// Task ClassDisplayNameChanged(string newClassName); /// /// 服务端通知客户端当前会话已失效(租户或班级绑定变更或凭据轮转),必须使用新凭据重新建立全新连接 /// Task DeviceSessionInvalidated(string reason); /// /// 服务端下发大屏临时进入配对模式(携带临时配对码与有效期秒数) /// Task ReceivePairingMode(string pairingCode, int ttlSeconds); /// /// Turn 115: 服务端通知大屏绑定状态更新(如任课教师首次绑定或新增任课教师绑定) /// Task DeviceBindingUpdated(string classDisplayName, int boundTeacherCount); } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Contracts/IDeviceHubClient.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Contracts/ITeacherHubClient.cs SHA256: 67ca922ee2b2a8f1d66af820c476a7fc8dc6d161b3bc8b296071b6e312cb9001 SIZE: 1371 ================================================================================ using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Contracts; /// /// 教师控制端 (Web / Android) 接收来自服务端的强类型 SignalR 契约 /// public interface ITeacherHubClient { /// /// 设备在线状态变更通知 (上线/离线/心跳刷新) /// Task OnDeviceStatusChanged(DeviceStatusDto status); /// /// 消息回执更新 (已送达、学生已点击【我知道了】、超时关闭) /// Task OnAckReceiptReceived(AckReceiptDto receipt); /// /// 收到教室端健康自检体检报告 /// Task OnHealthReportReceived(DeviceHealthReportDto report); /// /// 新消息广播 /// Task OnNewNotificationBroadcast(NotificationDto notification); /// /// 远程运维命令状态变更 (Pending -> Dispatched -> Succeeded / Failed / TimedOut / Expired) /// Task OnDeviceCommandStatusChanged(DeviceCommandResultDto result); /// /// 通知撤回/提前关闭广播 /// Task OnNotificationCancelled(string notificationId); /// /// 视觉回执(现场大屏通知截图)上传完成广播 /// Task OnVisualReceiptUploaded(VisualReceiptUploadedEvent evt); } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Contracts/ITeacherHubClient.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Enums/AckStatus.cs SHA256: 20277da6feff7a58b451495295b80857eb316eb56b3614f6c7a3e859e8a93094 SIZE: 740 ================================================================================ namespace ClassNotify.Shared.Enums; /// /// 消息状态与回执阶段 /// public enum AckStatus { /// /// 已提交至云端服务器 /// Sent = 0, /// /// 教室端大屏/后台已成功接收 /// Delivered = 1, /// /// 学生或值日生点击了【我知道了】 /// Acknowledged = 2, /// /// 倒计时结束,窗口自动淡出关闭 /// Timeout = 3, /// /// 设备离线或投递失败 /// Failed = 4, /// /// 消息已被发送者或管理员提前撤回关闭 /// Cancelled = 5 } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Enums/AckStatus.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Enums/ClientLaunchIntent.cs SHA256: b7beb7460ce124e4cf6e1fde7d97564d088e0739e42711e3701b6ec35b42b28e SIZE: 921 ================================================================================ namespace ClassNotify.Shared.Enums; /// /// Authoritative intent governing why the ClassNotify Client is being launched. /// Invariant: BackgroundRecovery must NEVER steal focus or foreground UI. /// public enum ClientLaunchIntent { /// /// Routine watchdog lifecycle monitoring, system boot, network recovery, or service recovery. /// Strictly background: must NEVER show UI or foreground. /// BackgroundRecovery = 0, /// /// Explicit human interaction: teacher double-clicked desktop shortcut, tray menu, etc. /// Allowed to show UI and foreground window. /// UserInteractive = 1, /// /// Explicit initial launch following completed setup wizard where user requested launch. /// Allowed to show initial DeviceStatusWindow (Unbound onboarding). /// InstallerFirstRun = 2 } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Enums/ClientLaunchIntent.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Enums/DeviceBindingState.cs SHA256: 4202a17e558ec82ae9eaaa91968335e9e44d6fbe4b02a8840c51f667a51e0a37 SIZE: 490 ================================================================================ namespace ClassNotify.Shared.Enums; /// /// Turn 115 权威设备绑定生命周期状态 /// 彻底与网络实时连接状态 (RealtimeChannelState) 解耦 /// public enum DeviceBindingState { /// /// 从未绑定或当前未绑定任何班级(首次开机引导态 / 待配对态) /// Unbound = 0, /// /// 已绑定到具体班级(日常运行与多教师协同态) /// Bound = 1 } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Enums/DeviceBindingState.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Enums/DeviceOnlineState.cs SHA256: b4b452e56ecb1d968c584ec05482edcce187efe816221b6823d75fb37ece998b SIZE: 430 ================================================================================ namespace ClassNotify.Shared.Enums; /// /// 设备在线与健康状态 /// public enum DeviceOnlineState { /// /// 离线(无心跳连接) /// Offline = 0, /// /// 正常在线 /// Online = 1, /// /// 降级运行(如后台在线但 UI 进程异常或 TTS 不可用) /// Degraded = 2 } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Enums/DeviceOnlineState.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Enums/FleetVersionStatus.cs SHA256: c2fe487714c60bab764ac4227e73647345503837553c2991c244e31fc8ce5856 SIZE: 216 ================================================================================ using System.Text.Json.Serialization; namespace ClassNotify.Shared.Enums; [JsonConverter(typeof(JsonStringEnumConverter))] public enum FleetVersionStatus { Unknown, Current, Outdated, Unsupported } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Enums/FleetVersionStatus.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Enums/NotificationType.cs SHA256: 40d28dfbf41fea8ff3fc34cd2c7eb4827bfbe6017702fb50cadab03bfdca68fb SIZE: 422 ================================================================================ namespace ClassNotify.Shared.Enums; /// /// 通知类别 /// public enum NotificationType { /// /// 老师呼叫(默认蓝色,高优先级) /// Call = 0, /// /// 班级常规通知(绿色) /// Notice = 1, /// /// 紧急/重要提醒(红色,全屏强调) /// Urgent = 2 } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Enums/NotificationType.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Enums/OperationalRestrictionState.cs SHA256: 00d8a13f65715884d157a28170249b42ae9f3afc1c614561a86eb2499b398b17 SIZE: 947 ================================================================================ namespace ClassNotify.Shared.Enums; /// /// Operational restriction states orthogonal to DeviceBindingState (Unbound vs Bound). /// A device can be Bound to a classroom, but under LicenseExpired or ReprovisionRequired. /// public enum OperationalRestrictionState { /// /// Fully operational, no restrictions. /// None = 0, /// /// Free trial has expired. /// TrialExpired = 1, /// /// Paid subscription has expired. /// LicenseExpired = 2, /// /// License has been revoked by school administrator. /// Revoked = 3, /// /// Re-provisioning or certificate regeneration is required. /// ReprovisionRequired = 4, /// /// System clock or time synchronization cannot be verified. /// TimeUntrusted = 5 } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Enums/OperationalRestrictionState.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Ipc/IpcMessage.cs SHA256: 610c638b47e3a5fcbb3485c9ebb93ac563a579704ed73d7fe00177fc92e0aa35 SIZE: 1062 ================================================================================ namespace ClassNotify.Shared.Ipc; /// /// Windows Service 与 WinUI 3 前台进程之间的命名管道 IPC 消息类型 /// public enum IpcCommandType { Ping = 0, Pong = 1, ShowNotification = 2, CloseNotification = 3, ReportAck = 4, HealthCheck = 5, Hello = 6, TtsCheck = 7, TtsCheckResult = 8, ReportVisualReceipt = 9, UpdateLicenseStatus = 10, RequestRenew = 11, RenewResult = 12, RequestActivate = 13, ActivateResult = 14, GetClientState = 15, ClientStateResult = 16, RequestUpdateClassName = 17, UpdateClassNameResult = 18, ClassDisplayNameChanged = 19, EnterPairingMode = 20, RequestPairingMode = 21, PairingModeResult = 22, RequestPairingSession = 25, PairingSessionResult = 26 } /// /// 命名管道传输帧 /// public class IpcMessage { public IpcCommandType Type { get; set; } public string? CorrelationId { get; set; } = Guid.NewGuid().ToString("N"); public string? PayloadJson { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Ipc/IpcMessage.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/AckReceiptDto.cs SHA256: 5fa291f2029c522c689fc3b63185315158320c224510543db1209fd90800aecc SIZE: 1301 ================================================================================ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 教室端确认与回执数据对象 /// public class AckReceiptDto { /// /// 对应的消息 ID /// public string MessageId { get; set; } = string.Empty; /// /// 班级编号 /// public string ClassId { get; set; } = string.Empty; /// /// 当前回执状态(Delivered / Acknowledged / Timeout) /// public AckStatus Status { get; set; } = AckStatus.Delivered; /// /// 触发时间戳 /// public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; /// /// 备注信息(如“值日生张三确认”) /// public string? Remark { get; set; } /// /// 全链路业务追踪 ID (32 位小写 Hex) /// public string? CorrelationId { get; set; } /// /// 结构化失败代码(如 DISPLAY_RENDER_FAILED) /// public string? FailureCode { get; set; } /// /// 结构化失败说明(安全脱敏净化,供教师端或日志展示) /// public string? FailureReason { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/AckReceiptDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/AdminDtos.cs SHA256: 1f80f1d851e1dc4575fd8c26bc078a053efa99e2b22ccde132f621e3414cb33c SIZE: 16587 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 全局平台统计指标 (超级管理员大盘) /// public class AdminMetricsDto { public int TotalTenants { get; set; } public int TotalClassrooms { get; set; } public int TotalDevices { get; set; } public int OnlineDevices { get; set; } public int OfflineDevices => Math.Max(0, TotalDevices - OnlineDevices); public int TodayNotifications { get; set; } public int AbnormalDevices { get; set; } } /// /// 设备明细与实时状态 DTO /// public class DeviceAdminDto { public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public string? Hostname { get; set; } public bool IsOnline { get; set; } public DateTimeOffset? LastHeartbeat { get; set; } public string? ClientVersion { get; set; } public string? ServiceVersion { get; set; } public int? ProtocolVersion { get; set; } public string? OsVersion { get; set; } public string? Architecture { get; set; } public string VersionStatus { get; set; } = "Current"; public string? RemoteIp { get; set; } public string? DisplayLabel { get; set; } public string TenantType { get; set; } = "School"; public bool ServiceRunning { get; set; } = true; public bool ClientRunning { get; set; } = true; // License Management Fields public DateTimeOffset? LicensedUntil { get; set; } public string LicenseTier { get; set; } = "Trial"; public string LicenseStatus { get; set; } = "Valid"; // Valid, ExpiringSoon, Expired, Perpetual public int? RemainingDays { get; set; } public int? RemainingHours { get; set; } } /// /// 学校/租户大盘 DTO /// public class TenantAdminDto { public string Id { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public string TenantType { get; set; } = "School"; // School, Personal public int ClassroomCount { get; set; } public int DeviceCount { get; set; } public int OnlineCount { get; set; } public bool IsActive { get; set; } = true; public DateTimeOffset CreatedAt { get; set; } } /// /// 激活码详情 DTO /// public class ActivationCodeDto { public string? Id { get; set; } public string Code { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public DateTimeOffset ExpiresAt { get; set; } public bool IsUsed { get; set; } public DateTimeOffset? UsedAt { get; set; } public string? UsedByDeviceId { get; set; } // License Duration Configuration public int? LicenseDurationDays { get; set; } = 7; public string LicenseTier { get; set; } = "Trial"; public string? Notes { get; set; } // Dual-Distribution & Teacher Direct Assignment (Turn 50) public string? TargetClassName { get; set; } public string? AssignedTeacherId { get; set; } public string? AssignedTeacherName { get; set; } public string DistributionMethod { get; set; } = "External"; // "External" or "TeacherAccount" public DateTimeOffset? AssignedAt { get; set; } public string? AssignedByUserId { get; set; } public string MaskedCode { get; set; } = string.Empty; public DateTimeOffset? SecretExposedAtUtc { get; set; } public string Status { get; set; } = "Issued"; // Draft, Issued, Redeemed, Expired, Revoked public DateTimeOffset? RevokedAtUtc { get; set; } public string? RevokedReason { get; set; } // Live Expiration & License Status Fields (Turn 81) public DateTimeOffset? LicensedUntil { get; set; } public int? RemainingDays { get; set; } public int? RemainingHours { get; set; } public string? LicenseStatus { get; set; } // Valid, ExpiringSoon, Expired public DateTimeOffset? ServerNow { get; set; } public string? TimeZone { get; set; } = "Asia/Shanghai"; } /// /// 设备端/管理端标准设备授权状态 DTO (Server-Authoritative) /// public sealed class DeviceLicenseStatusDto { public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = "Valid"; // Valid, ExpiringSoon, Expired, Perpetual, OfflineGrace, OfflineRestricted, TimeUntrusted public string Tier { get; set; } = "Trial"; // Trial, AcademicYear, Perpetual, Custom public DateTimeOffset? LicensedUntilUtc { get; set; } public int? RemainingDays { get; set; } public int? RemainingHours { get; set; } public bool IsPerpetual { get; set; } public bool CanReceiveNormalNotifications { get; set; } = true; public bool CanReceiveEmergencyNotifications { get; set; } = true; public string? Message { get; set; } /// /// 服务端权威当前时间 (UTC) /// public DateTimeOffset ServerNowUtc { get; set; } = DateTimeOffset.UtcNow; /// /// 服务端日期键 (yyyy-MM-dd),用于客户端提醒严格每日一次落盘频控 /// public string ReminderDateKey { get; set; } = string.Empty; /// /// 租约颁发时间 (UTC) /// public DateTimeOffset IssuedAtUtc { get; set; } = DateTimeOffset.UtcNow; /// /// 离线容灾宽限截止时间 (UTC)。在此时间前允许继续正常运行,超期后进入 OfflineRestricted /// public DateTimeOffset? OfflineGraceUntilUtc { get; set; } /// /// 服务端签发的防篡改租约签名 (HMAC-SHA256) /// public string? LeaseSignature { get; set; } } /// /// 生成激活码请求 DTO /// public class GenerateActivationCodeRequestDto { public string TenantId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public int? DurationDays { get; set; } = 7; public string Tier { get; set; } = "Trial"; public string? Notes { get; set; } public int Count { get; set; } = 1; // Dual-Distribution & Teacher Direct Assignment public string DistributionMethod { get; set; } = "External"; // "External" or "TeacherAccount" public string? AssignedTeacherId { get; set; } public string? AssignedTeacherName { get; set; } public string? TargetClassName { get; set; } public string? Purpose { get; set; } = "ProvisionAndLicense"; } /// /// 指派/重新指派激活码给教师或班级请求 DTO /// public class AssignActivationCodeRequestDto { public string Code { get; set; } = string.Empty; public string? TeacherId { get; set; } public string? TeacherName { get; set; } public string? ClassroomId { get; set; } public string? TargetClassName { get; set; } public string? Notes { get; set; } } /// /// 批量标记激活码备注请求 DTO /// public class BatchTagActivationCodesRequestDto { public List Codes { get; set; } = new(); public string? Notes { get; set; } } /// /// 设备续费请求 DTO /// public class RenewDeviceLicenseRequestDto { public string? ActivationCode { get; set; } public int? ExtendDays { get; set; } public DateTimeOffset? ValidThroughDate { get; set; } public string? Tier { get; set; } public string? Reason { get; set; } } /// /// 批量设备续费请求 DTO /// public class BatchRenewDevicesLicenseRequestDto { public string ClientRequestId { get; set; } = string.Empty; public List DeviceIds { get; set; } = new(); public int? ExtendDays { get; set; } public string? ValidThroughLocalDate { get; set; } public DateTimeOffset? ValidThroughDate { get; set; } public string? LicenseKind { get; set; } // "Timed" | "Perpetual" public string? Tier { get; set; } public string? Reason { get; set; } } /// /// 远程指令下发请求 /// public class RemoteCommandRequestDto { public string Command { get; set; } = string.Empty; // "ping", "restart_client", "refresh_config" public string? Parameters { get; set; } } /// /// 创建班级请求 /// public class CreateClassroomDto { public string Id { get; set; } = string.Empty; public string DisplayName { get; set; } = string.Empty; public string? Grade { get; set; } public string? RoomNumber { get; set; } } /// /// 创建教师账号请求 /// public class CreateTeacherDto { public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = "Teacher"; // Teacher, SchoolAdmin } /// /// 消息历史记录与回执 /// public class NotificationRecordDto { public string Id { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassName { get; set; } = string.Empty; public string SenderName { get; set; } = string.Empty; public string Message { get; set; } = string.Empty; public string Priority { get; set; } = "Normal"; public DateTimeOffset CreatedAt { get; set; } public string Status { get; set; } = "Sent"; // Sent, Delivered, Acknowledged, Timeout, Failed, Cancelled public bool IsCancelled { get; set; } public DateTimeOffset? CancelledAt { get; set; } public string? CancelledBy { get; set; } public DateTimeOffset? ConfirmedAt { get; set; } public DateTimeOffset? ExpiresAt { get; set; } public List Receipts { get; set; } = new(); } public class UserAdminDto { public string Id { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string TenantType { get; set; } = "School"; public string Username { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = string.Empty; public bool IsLocked { get; set; } public DateTimeOffset CreatedAt { get; set; } public DateTimeOffset? LastLoginAt { get; set; } public string? RecoveryEmail { get; set; } } public class UpdateUserAdminRequest { public string? FullName { get; set; } public string? Role { get; set; } public string? TenantId { get; set; } public string? RecoveryEmail { get; set; } } public class CreateUserAdminRequest { public string TenantId { get; set; } = string.Empty; public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string Role { get; set; } = "SchoolAdmin"; // SchoolAdmin, Teacher, TenantOwner } public class ResetPasswordRequest { public string NewPassword { get; set; } = string.Empty; } public class LockUserRequest { public bool IsLocked { get; set; } = true; } public class CreateTenantRequest { public string Id { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; } public class UpdateTenantRequest { public string Name { get; set; } = string.Empty; public bool IsActive { get; set; } = true; } public class UpdateDeviceRequest { public string? Hostname { get; set; } public string? ClassroomId { get; set; } } public class EmergencyBroadcastRequest { public string? TenantId { get; set; } // null or empty = all schools public string Title { get; set; } = "⚠️ 全校紧急通知"; public string Message { get; set; } = string.Empty; public bool Voice { get; set; } = true; public bool Shake { get; set; } = true; public int DurationSeconds { get; set; } = 30; } public class SystemHealthDto { public string Status { get; set; } = "Healthy"; public bool DatabaseConnected { get; set; } = true; public double DatabaseLatencyMs { get; set; } public int ActiveSignalRConnections { get; set; } public int OnlineDevices { get; set; } public string ServerTime { get; set; } = string.Empty; public string Uptime { get; set; } = string.Empty; public long MemoryUsedBytes { get; set; } } public class AdminAuditLogDto { public string Id { get; set; } = string.Empty; public DateTimeOffset OccurredAt { get; set; } public string ActorUsername { get; set; } = string.Empty; public string ActorRole { get; set; } = string.Empty; public string Action { get; set; } = string.Empty; public string TargetType { get; set; } = string.Empty; public string TargetId { get; set; } = string.Empty; public string? Details { get; set; } public string? IpAddress { get; set; } } public sealed class BroadcastReceiptSummaryDto { public string BroadcastId { get; set; } = string.Empty; public int TargetSchools { get; set; } public int TargetClassrooms { get; set; } public int TargetDevices { get; set; } public int Displayed { get; set; } public int Pending { get; set; } public int Cancelled { get; set; } public int Failed { get; set; } public bool Completed => Pending == 0; public DateTimeOffset? CreatedAt { get; set; } } public sealed record CancelNotificationResult( string NotificationId, string TenantId, string ClassroomId, bool AlreadyCancelled, DateTimeOffset? CancelledAt, string? CancelledBy); /// /// 超级管理员专用:设备试用防刷审计与特批台账 DTO /// 绝不暴露完整物理硬件指纹(掩码显示如 8F2A••••91D0),绝不暴露明文券码 /// public sealed class DeviceTrialLedgerAdminDto { public string Id { get; set; } = string.Empty; public string MaskedFingerprint { get; set; } = string.Empty; // e.g. "8F2A••••91D0" public int FingerprintVersion { get; set; } = 1; public string? OriginalDeviceId { get; set; } public string? Hostname { get; set; } public string? OriginalTenantId { get; set; } public string? TenantName { get; set; } public string? TenantType { get; set; } public string? ClassroomId { get; set; } public string? ClassroomName { get; set; } public DateTimeOffset FirstTrialStartedAtUtc { get; set; } public DateTimeOffset TrialEndsAtUtc { get; set; } public string Status { get; set; } = "Active"; // Active, Expired public int BlockedAttemptCount { get; set; } public DateTimeOffset? LastBlockedAtUtc { get; set; } public string OverrideState { get; set; } = "None"; // None, Granted, Consumed, Revoked, Expired public int OverrideRemainingUses { get; set; } public DateTimeOffset? OverrideExpiresAtUtc { get; set; } public string? OverrideReason { get; set; } public string? OverrideGrantedByUserId { get; set; } public DateTimeOffset? OverrideGrantedAtUtc { get; set; } public DateTimeOffset? OverrideConsumedAtUtc { get; set; } public string? SourceActivationCodeId { get; set; } public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset? UpdatedAtUtc { get; set; } } /// /// 超管人工特批一次性试用请求 /// 必须填写经审计的原因,默认 72 小时内单次有效 /// public sealed class GrantTrialOverrideRequestDto { public string Reason { get; set; } = string.Empty; public int ValidHours { get; set; } = 72; // 默认 72 小时 } /// /// 撤销未消费的特批放行请求 /// public sealed class RevokeTrialOverrideRequestDto { public string? Reason { get; set; } } /// /// 服务端全量商业授权审计大盘统计指标(排除测试污染数据) /// public sealed class LicenseRecordsSummaryDto { public int TotalGrantedDays { get; set; } public int ActivationCount { get; set; } public int RenewalCount { get; set; } public int PerpetualCount { get; set; } public int AdjustmentCount { get; set; } public int TotalRecords { get; set; } } public sealed class UpdateDeviceDisplayLabelRequest { public string? DisplayLabel { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/AdminDtos.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/ClientStateSnapshotDto.cs SHA256: bdde1c75ab2ecf3f466ac76eb58fed27d8066f6c9a3d0a6da7ba4db7b4aab4a3 SIZE: 2733 ================================================================================ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 客户端权威状态快照(由 Windows Service 统一向 Client 推送或应答) /// public class ClientStateSnapshotDto { /// /// Turn 115 权威设备绑定生命周期状态: Unbound / Bound /// public DeviceBindingState BindingState { get; set; } = DeviceBindingState.Unbound; /// /// Turn 116 运行限制状态维度(与 BindingState 正交,互不污染) /// public OperationalRestrictionState RestrictionState { get; set; } = OperationalRestrictionState.None; /// /// 权威教室/班级ID /// public string? ClassroomId { get; set; } /// /// 权威教室/班级显示名称 /// public string? ClassroomDisplayName { get; set; } /// /// 已绑定教师总数(去实名化计数,合规保护隐私) /// public int BoundTeacherCount { get; set; } = 0; /// /// 状态版本号,单调递增,防止异步消息乱序覆盖 /// public long StateRevision { get; set; } = 0; /// /// 设备配置状态:Unactivated / Activating / Activated / CredentialError / ReprovisionRequired /// public string ProvisioningState { get; set; } = "Unactivated"; /// /// 商业授权状态:Valid / ExpiringSoon / ExpiredRestricted / RevokedRestricted / OfflineGrace / OfflineRestricted / TimeUntrusted / Perpetual /// public string LicenseStatus { get; set; } = "Valid"; public string? DeviceId { get; set; } public string? TenantId { get; set; } public string? ClassId { get; set; } public string? ClassDisplayName { get; set; } public int RemainingDays { get; set; } public int RemainingHours { get; set; } public DateTimeOffset? LicensedUntilUtc { get; set; } public bool CanRenew { get; set; } = true; public bool CanReceiveNormalNotifications { get; set; } = true; public bool CloudConnected { get; set; } public string? ErrorMessage { get; set; } /// /// 云端实时连接详细状态: Connected / Reconnecting / Disconnected / UpdatingBinding /// public string RealtimeChannelState { get; set; } = "Disconnected"; /// /// 上次与云端成功通信/心跳确认时间 /// public DateTimeOffset? LastSuccessfulHeartbeatUtc { get; set; } /// /// 状态细节说明(如最近心跳耗时、重试间隔) /// public string? ChannelDetail { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/ClientStateSnapshotDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceActivationRequestDto.cs SHA256: 73288a081d5fcc0abbad9e19ed13a26accace84759b43201e2973a5bbb00e61d SIZE: 1165 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教室设备首次激活请求 DTO /// public class DeviceActivationRequestDto { /// /// 一次性设备激活码 (例如: H8K4-29DP) /// public string ActivationCode { get; set; } = string.Empty; /// /// 教室电脑主机名 /// public string Hostname { get; set; } = Environment.MachineName; /// /// 客户端版本号 /// public string ClientVersion { get; set; } = "2.1.0"; /// /// 安装实例唯一标识符 (例如: inst_550e8400-e29b-41d4-a716-446655440000) /// public string InstallationId { get; set; } = string.Empty; /// /// 用户/老师自定义班级名称 (例如: 八年级(1)班、初二创新班) /// public string? CustomClassName { get; set; } /// /// 客户端采集的设备硬件特征哈希 (SMBIOS UUID + Board + Disk + MachineGuid) /// public string? HardwareComponentsHash { get; set; } public int FingerprintVersion { get; set; } = 1; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceActivationRequestDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceActivationResultDto.cs SHA256: 636d7ed848f9c61e21e28149bd5c5dfddb4a7a95ebb4ddc0e65fd18584c81dbb SIZE: 561 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教室设备激活响应 DTO /// public class DeviceActivationResultDto { public bool Success { get; set; } public string? DeviceId { get; set; } public string? DeviceToken { get; set; } public string? TenantId { get; set; } public string? TenantType { get; set; } // "School" or "Personal" public string? TenantName { get; set; } public string? ClassId { get; set; } public string? ClassDisplayName { get; set; } public string? ErrorMessage { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceActivationResultDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceBootstrapRequestDto.cs SHA256: 77f3dc4a4a619ee6316fe62e32b05cec9921b29e80307bc8404f050a53592d7a SIZE: 387 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教室大屏无感引导请求 DTO (无需激活码,硬件直接开机就绪) /// public class DeviceBootstrapRequestDto { public string? HardwareComponentsHash { get; set; } public string? InstallationId { get; set; } public string? Hostname { get; set; } public string? ClientVersion { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceBootstrapRequestDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceCommandDto.cs SHA256: 8a641211c56c55df5566005b54d583a9b987c0d0026c2cc95ba15a798bb6ab61 SIZE: 3274 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 远程维护命令类型常量 /// public static class DeviceCommandTypes { public const string SelfCheck = "SelfCheck"; public const string RestartClient = "RestartClient"; public const string Reconnect = "Reconnect"; public const string RefreshConfig = "RefreshConfig"; public static readonly string[] AllSupported = [SelfCheck, RestartClient, Reconnect, RefreshConfig]; public static bool IsSupported(string? commandType) { if (string.IsNullOrWhiteSpace(commandType)) return false; return AllSupported.Contains(commandType, StringComparer.OrdinalIgnoreCase); } /// /// 获取命令类型的默认安全 TTL(生命周期) /// 严禁长期补发,过期即弃 /// public static TimeSpan GetDefaultTtl(string commandType) { return commandType?.ToLowerInvariant() switch { "restartclient" or "restart_client" => TimeSpan.FromMinutes(2), "reconnect" => TimeSpan.FromMinutes(2), "refreshconfig" or "refresh_config" => TimeSpan.FromMinutes(5), "selfcheck" or "self_check" => TimeSpan.FromMinutes(5), _ => TimeSpan.FromMinutes(2) }; } } /// /// 远程维护命令状态常量 /// public static class DeviceCommandStatuses { public const string Pending = "Pending"; public const string Dispatched = "Dispatched"; public const string Succeeded = "Succeeded"; public const string Failed = "Failed"; public const string TimedOut = "TimedOut"; public const string Expired = "Expired"; public static bool IsTerminal(string status) => status is Succeeded or Failed or TimedOut or Expired; } /// /// 远程运维命令传输对象 /// 全链路统一 CommandId (cmd_xxxxx),从创建到最终上报不可篡改 /// public class DeviceCommandDto { public string CommandId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string CommandType { get; set; } = string.Empty; public string? Parameters { get; set; } public string CreatedBy { get; set; } = string.Empty; public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; public DateTimeOffset ExpiresAt { get; set; } public string Status { get; set; } = DeviceCommandStatuses.Pending; public DateTimeOffset? StartedAt { get; set; } public DateTimeOffset? CompletedAt { get; set; } public long? DurationMs { get; set; } public int? ResultCode { get; set; } public string? ResultMessage { get; set; } } /// /// 终端设备执行远程命令后回传的结果报文 /// public class DeviceCommandResultDto { public string CommandId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = DeviceCommandStatuses.Succeeded; public int ResultCode { get; set; } = 0; public string? ResultMessage { get; set; } public long ExecutionDurationMs { get; set; } public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceCommandDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceCredentials.cs SHA256: 936c4cb817e4f20fbd006412ef31ff4735c9b3929c96280f6d9ae4d9ea7cb084 SIZE: 581 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教室本地保存的永久设备凭证 (存储于 C:\ProgramData\ClassNotify\device_credentials.json) /// public class DeviceCredentials { public string DeviceId { get; set; } = string.Empty; public string DeviceToken { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassDisplayName { get; set; } = string.Empty; public DateTimeOffset ActivatedAt { get; set; } = DateTimeOffset.UtcNow; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceCredentials.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceHealthReportDto.cs SHA256: 86918abf93caa8357916aed6a78760237563b1c1ac975479f0e4503244cf9508 SIZE: 1907 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教室设备详细健康自检报告 /// public class DeviceHealthReportDto { public string DeviceId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow; // Detailed health indicators public bool ServiceRunning { get; set; } = true; public bool ClientConnected { get; set; } public int ClientHeartbeatAgeSeconds { get; set; } = -1; public bool DnsOk { get; set; } public bool HttpsOk { get; set; } public bool SignalROk { get; set; } public bool CredentialsOk { get; set; } public bool DataDirectoryWritable { get; set; } public bool PipeOk { get; set; } public bool TtsOk { get; set; } public string OverallStatus { get; set; } = "Offline"; // Healthy, Degraded, Offline public DateTimeOffset CheckedAtUtc { get; set; } = DateTimeOffset.UtcNow; /// /// Windows SAPI / WinRT TTS 语音引擎是否可用 /// public bool IsTtsAvailable { get => TtsOk; set => TtsOk = value; } /// /// WinUI 3 前台 UI 进程是否处于就绪/健康状态 /// public bool IsUiProcessRunning { get => ClientConnected; set => ClientConnected = value; } /// /// 互联网与云端连接是否正常 /// public bool IsNetworkReachable { get => HttpsOk; set => HttpsOk = value; } /// /// 域名 DNS 解析是否正常 /// public bool IsDnsResolved { get => DnsOk; set => DnsOk = value; } /// /// 诊断详情信息 /// public string DiagnosticMessage { get; set; } = "All checks passed."; } public class TtsCheckResultDto { public bool Available { get; set; } public int VoiceCount { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceHealthReportDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceHeartbeatDto.cs SHA256: 9032c056fe0138375ae5edd5c50ac246792fac95278d6d72688f07cb15cf078b SIZE: 1334 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教室终端健康心跳与运行状态 DTO (扩展版本感知与环境指标) /// public class DeviceHeartbeatDto { public string? DeviceId { get; set; } public string? ClassId { get; set; } public string? CorrelationId { get; set; } public DateTimeOffset SentAtUtc { get; set; } = DateTimeOffset.UtcNow; /// /// Windows Service 守护进程版本号 (如 "2.5.0") /// public string ServiceVersion { get; set; } = string.Empty; /// /// WPF / 前台显示客户端版本号 (如 "2.5.0") /// public string ClientVersion { get; set; } = string.Empty; /// /// 终端协议版本 (默认 1) /// public int ProtocolVersion { get; set; } = 1; /// /// 操作系统版本信息 (如 "Microsoft Windows 10.0.19045") /// public string OsVersion { get; set; } = string.Empty; /// /// 操作系统与处理器架构 (如 "X64", "Arm64") /// public string Architecture { get; set; } = string.Empty; /// /// WPF 界面主进程是否正常运行并处于 IPC 连接状态 /// public bool ClientProcessAvailable { get; set; } = true; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceHeartbeatDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceSelfCheckBatchDtos.cs SHA256: 0bbeaab40f0e9b75524e0b1af278f98030de0e2afce6329e043818e722f64908 SIZE: 6287 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 终端自检批次流程运行状态 (RunState) /// 严格独立于健康状态 (OverallStatus) /// public static class SelfCheckRunStates { public const string PendingDispatch = "PendingDispatch"; public const string Dispatched = "Dispatched"; public const string Completed = "Completed"; public const string Unreachable = "Unreachable"; public const string TimedOut = "TimedOut"; public static readonly string[] All = [PendingDispatch, Dispatched, Completed, Unreachable, TimedOut]; public static bool IsTerminal(string state) => state is Completed or Unreachable or TimedOut; } /// /// 7 项标准探针键规范化与映射 /// public static class SelfCheckProbeKeys { public const string Service = "service"; public const string SignalR = "signalr"; public const string HttpsPing = "https_ping"; public const string ClockOffset = "clock_offset"; public const string IpcPipe = "ipc_pipe"; public const string WpfClient = "wpf_client"; public const string TtsEngine = "tts_engine"; public static readonly string[] All = [ Service, SignalR, HttpsPing, ClockOffset, IpcPipe, WpfClient, TtsEngine ]; public static string Normalize(string probeName) { if (string.IsNullOrWhiteSpace(probeName)) return string.Empty; var p = probeName.Trim().ToLowerInvariant().Replace(" ", "_").Replace("-", "_"); return p switch { "service" => Service, "signalr" => SignalR, "https" or "https_ping" or "httpsping" => HttpsPing, "clock" or "clock_offset" or "clockoffset" => ClockOffset, "ipc" or "ipc_pipe" or "named_pipe" or "pipe" => IpcPipe, "wpf" or "wpf_client" or "wpfclient" or "client" => WpfClient, "tts" or "tts_engine" or "ttsengine" => TtsEngine, _ => p }; } } /// /// 发起批量设备自检请求载荷 /// public class CreateSelfCheckBatchRequest { public string ClientRequestId { get; set; } = string.Empty; public List DeviceIds { get; set; } = new(); } /// /// 批量自检创建成功返回 DTO /// public class SelfCheckBatchCreatedDto { public string BatchId { get; set; } = string.Empty; public string Status { get; set; } = "Running"; public int TargetDeviceCount { get; set; } public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset DeadlineAtUtc { get; set; } } /// /// 批次总体健康与完成度统计(纯内存聚合计算,严格守恒) /// public class SelfCheckBatchSummaryDto { public string BatchId { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public int Target { get; set; } public int Pending { get; set; } public int Completed { get; set; } public int Healthy { get; set; } public int Warning { get; set; } public int Failed { get; set; } public int Unreachable { get; set; } public int TimedOut { get; set; } public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset? CompletedAtUtc { get; set; } } /// /// 单项探针故障聚合统计 /// public class ProbeFailureCountDto { public string Probe { get; set; } = string.Empty; public int WarningCount { get; set; } public int FailedCount { get; set; } } /// /// 批次详情响应载荷 /// public class SelfCheckBatchDetailDto { public string BatchId { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset DeadlineAtUtc { get; set; } public DateTimeOffset? CompletedAtUtc { get; set; } public SelfCheckBatchSummaryDto Summary { get; set; } = new(); public List ProbeFailures { get; set; } = new(); } /// /// 批次下设备自检运行项目简要信息 /// public class SelfCheckBatchDeviceItemDto { public string RunId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string SchoolName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public string Hostname { get; set; } = string.Empty; public bool IsOnline { get; set; } public string? ServiceVersion { get; set; } public string? ClientVersion { get; set; } public string RunState { get; set; } = string.Empty; public string? OverallStatus { get; set; } public List Checks { get; set; } = new(); public DateTimeOffset RequestedAtUtc { get; set; } public DateTimeOffset? DispatchedAtUtc { get; set; } public DateTimeOffset? CompletedAtUtc { get; set; } public string CorrelationId { get; set; } = string.Empty; } /// /// 设备明细过滤与分页查询参数 /// public class SelfCheckBatchDeviceQuery { public string? Health { get; set; } // Healthy, Warning, Failed, Unreachable, TimedOut, Pending public string? Probe { get; set; } // ipc_pipe, clock_offset, etc. public string? TenantId { get; set; } public string? Q { get; set; } public int Page { get; set; } = 1; public int PageSize { get; set; } = 50; } /// /// 设备明细分页返回结果 /// public class SelfCheckBatchDevicePagedResultDto { public int Total { get; set; } public int Page { get; set; } public int PageSize { get; set; } public List Items { get; set; } = new(); } /// /// 下发到终端的批量自检指令载荷 /// public class DeviceSelfCheckCommandDto { public string SelfCheckId { get; set; } = string.Empty; public string BatchId { get; set; } = string.Empty; public string CorrelationId { get; set; } = string.Empty; public DateTimeOffset RequestedAtUtc { get; set; } public DateTimeOffset DeadlineAtUtc { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceSelfCheckBatchDtos.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceSelfCheckModels.cs SHA256: db83a6c05c32422866d4f2d803c73d9c47ef14cb4273b1e6c1296a5e080264b7 SIZE: 2123 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 设备自检项状态语义 /// public enum SelfCheckStatus { Healthy = 0, Warning = 1, Failed = 2, Skipped = 3 } /// /// 单项自检详细结果 /// public class SelfCheckItemDto { /// /// 自检项名称 (Service, WPF, SignalR, HTTPS, Clock, IPC, TTS) /// public string Name { get; set; } = string.Empty; /// /// 诊断结论 /// public SelfCheckStatus Status { get; set; } = SelfCheckStatus.Healthy; /// /// 状态机器可读代码 (如 "SERVICE_RUNNING", "CLOCK_OFFSET_HIGH") /// public string Code { get; set; } = string.Empty; /// /// 人类可读简要说明 /// public string Summary { get; set; } = string.Empty; /// /// 测算的通讯/执行延迟 (毫秒,可选) /// public long? LatencyMs { get; set; } } /// /// 发起远程自检指令数据载荷 /// public class DeviceSelfCheckRequestDto { public string SelfCheckId { get; set; } = string.Empty; public string CorrelationId { get; set; } = string.Empty; public DateTimeOffset RequestedAtUtc { get; set; } = DateTimeOffset.UtcNow; public int TimeoutSeconds { get; set; } = 15; } /// /// 终端完成并上报的结构化自检报告 /// public class DeviceSelfCheckResultDto { public string SelfCheckId { get; set; } = string.Empty; public string CorrelationId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public DateTimeOffset StartedAtUtc { get; set; } public DateTimeOffset CompletedAtUtc { get; set; } = DateTimeOffset.UtcNow; /// /// 综合诊断状态: Healthy, Warning, Failed /// public SelfCheckStatus OverallStatus { get; set; } = SelfCheckStatus.Healthy; /// /// 7 项核心诊断明细 /// public List Checks { get; set; } = new(); } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceSelfCheckModels.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/DeviceStatusDto.cs SHA256: 01ce7fe6054592ec308b3c5c35a4c35a459d63a17202468c0164246186b79266 SIZE: 600 ================================================================================ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 教室设备简要在线状态模型 /// public class DeviceStatusDto { public string DeviceId { get; set; } = string.Empty; public string ClassId { get; set; } = string.Empty; public string ClassName { get; set; } = string.Empty; public string? Hostname { get; set; } public DeviceOnlineState State { get; set; } = DeviceOnlineState.Offline; public DateTimeOffset LastHeartbeat { get; set; } = DateTimeOffset.UtcNow; public string AgentVersion { get; set; } = "2.0.0"; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/DeviceStatusDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/FleetVersionDtos.cs SHA256: 7ec66a4867253bed956cc65006e2855456305ebb23aa5a8a2c7c270fa5ddc93a SIZE: 1861 ================================================================================ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; public sealed class DeviceVersionPolicyViewDto { public string MinimumServiceVersion { get; set; } = "2.4.0"; public string RecommendedServiceVersion { get; set; } = "2.5.0"; public string MinimumClientVersion { get; set; } = "2.4.0"; public string RecommendedClientVersion { get; set; } = "2.5.0"; public int MinimumProtocolVersion { get; set; } = 2; } public sealed class FleetVersionSummaryDto { public int Total { get; set; } public int Current { get; set; } public int Outdated { get; set; } public int Unsupported { get; set; } public int Unknown { get; set; } public DateTimeOffset GeneratedAtUtc { get; set; } public DeviceVersionPolicyViewDto Policy { get; set; } = new(); } public sealed class FleetDeviceVersionDto { public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string TenantName { get; set; } = string.Empty; public string ClassroomId { get; set; } = string.Empty; public string ClassroomName { get; set; } = string.Empty; public string? Hostname { get; set; } public bool IsOnline { get; set; } public DateTimeOffset? LastHeartbeatAt { get; set; } public string? ServiceVersion { get; set; } public string? ClientVersion { get; set; } public int? ProtocolVersion { get; set; } public string? OsVersion { get; set; } public string? Architecture { get; set; } public FleetVersionStatus VersionStatus { get; set; } = FleetVersionStatus.Unknown; public List Reasons { get; set; } = new(); } public sealed class FleetDeviceVersionQuery { public string? Status { get; set; } public string? TenantId { get; set; } public bool? Online { get; set; } public string? Q { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/FleetVersionDtos.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/NotificationDto.cs SHA256: 69fdd9c57744eaa24dec3d5364979877559705c39e95fd82ea8dd3ae00266f95 SIZE: 2126 ================================================================================ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Models; /// /// 通知消息传输对象 (DTO) /// public class NotificationDto { /// /// 唯一消息 ID (如 msg_20260920_xxxx) /// public string Id { get; set; } = Guid.NewGuid().ToString("N"); /// /// 所属学校/租户 ID (如 "t_beijing_no4") /// public string TenantId { get; set; } = string.Empty; /// /// 目标班级编号 (如 "cls_801") /// public string ClassId { get; set; } = string.Empty; /// /// 呼叫的目标学生姓名(可选,如 "张三") /// public string? StudentName { get; set; } /// /// 弹窗标题 /// public string Title { get; set; } = "🔔 老师呼叫"; /// /// 通知正文内容 /// public string Message { get; set; } = string.Empty; /// /// 通知类型 /// public NotificationType Type { get; set; } = NotificationType.Call; /// /// 是否开启 Windows TTS 中文语音朗读 /// public bool Voice { get; set; } = true; /// /// 是否开启窗口抖动震颤 /// public bool Shake { get; set; } = true; /// /// 展示持续时长(秒),超时后自动关闭 /// public int DurationSeconds { get; set; } = 15; /// /// 教师端发送时间戳 /// public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow; /// /// 消息过期时间(UTC),超过此时间不再向离线设备补发 /// public DateTimeOffset? ExpiresAt { get; set; } /// /// 全局应急广播关联 ID(可选) /// public string? BroadcastId { get; set; } /// /// 全链路业务追踪 ID (32 位小写 Hex) /// public string CorrelationId { get; set; } = string.Empty; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/NotificationDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/NotificationReceiptStatuses.cs SHA256: 3bbdce6a28391661dce0ac9c2da03fa23428ab8ab056746484812472518faada SIZE: 780 ================================================================================ namespace ClassNotify.Shared.Models; public static class NotificationReceiptStatuses { public const string Sent = "Sent"; public const string DeviceReceived = "DeviceReceived"; public const string Displayed = "Displayed"; public const string Acknowledged = "Acknowledged"; public const string Cancelled = "Cancelled"; public const string Failed = "Failed"; public const string Timeout = "Timeout"; public const string Expired = "Expired"; public static bool IsDisplayed(string status) => status == Displayed || status == Acknowledged; public static bool IsPending(string status) => status == Sent || status == DeviceReceived; public static bool IsFailed(string status) => status == Failed || status == Timeout || status == Expired; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/NotificationReceiptStatuses.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/PairingSessionDto.cs SHA256: 624cac57f4441795fd384fb95a378cf01acf4c15dfcfb3eb2fb5184e3c05b326 SIZE: 1160 ================================================================================ using System; namespace ClassNotify.Shared.Models; /// /// Turn 115 配对目的 /// public enum PairingPurpose { /// /// 未绑定大屏首次绑定班级 /// InitialDeviceBinding = 0, /// /// 已绑定大屏现场添加其他任课教师 /// AddTeacher = 1 } /// /// 配对 Session 状态 /// public enum PairingSessionState { None = 0, Requesting = 1, Active = 2, Expired = 3, Failed = 4 } /// /// Turn 115 独立配对会话实体(由 Service 权威维护并经 IPC 下发) /// public class PairingSessionDto { public string Code { get; set; } = string.Empty; public DateTimeOffset ExpiresAt { get; set; } public PairingPurpose Purpose { get; set; } = PairingPurpose.InitialDeviceBinding; public PairingSessionState State { get; set; } = PairingSessionState.Active; public string? ErrorMessage { get; set; } public int GetRemainingSeconds() { var diff = (int)(ExpiresAt - DateTimeOffset.UtcNow).TotalSeconds; return diff > 0 ? diff : 0; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/PairingSessionDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/PasswordResetDtos.cs SHA256: 0bf859da9a49f326d166cfc331278ac6adcd64a087604159bf73fe831935b17a SIZE: 1776 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 凭安全恢复密钥 (Recovery Key) 重置密码请求 DTO (100% 离线自救,无需任何短信或邮件服务) /// public class ResetPasswordByRecoveryKeyDto { public string UsernameOrEmail { get; set; } = string.Empty; public string RecoveryKey { get; set; } = string.Empty; public string NewPassword { get; set; } = string.Empty; } public class ResetPasswordByRecoveryKeyResultDto { public bool Success { get; set; } public string Message { get; set; } = string.Empty; public string? NewRecoveryKey { get; set; } // 旧密钥使用后自动作废,生成新密钥交付用户 } /// /// 请求通过邮箱链接重置密码请求 DTO (免费 SMTP,按需发送) /// public class RequestPasswordResetEmailDto { public string Email { get; set; } = string.Empty; } /// /// 凭邮件/管理员一次性 Ticket 重置密码请求 DTO /// public class ResetPasswordByTokenDto { public string Token { get; set; } = string.Empty; public string NewPassword { get; set; } = string.Empty; } /// /// 管理员签发一次性重置工单 DTO (管理员不接触新密码) /// public class IssueResetTicketDto { public string UserId { get; set; } = string.Empty; } public class ResetTicketResultDto { public bool Success { get; set; } public string? Ticket { get; set; } public string? ResetUrl { get; set; } public DateTimeOffset? ExpiresAtUtc { get; set; } public string? ErrorMessage { get; set; } } /// /// 登录用户轮换安全恢复密钥请求 DTO /// public class RotateRecoveryKeyDto { public string CurrentPassword { get; set; } = string.Empty; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/PasswordResetDtos.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/RegisterPersonalTeacherDto.cs SHA256: 076ec7ce0f5fc92b3db70a92c045a94e74bf4989bb63d3d555c98cbec405a807 SIZE: 686 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 独立教师注册请求 DTO (免除学校信息,自动创建个人教学空间) /// public class RegisterPersonalTeacherDto { public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string FullName { get; set; } = string.Empty; public string? PhoneNumber { get; set; } public string? RecoveryEmail { get; set; } public string? SpaceName { get; set; } public string? AccountType { get; set; } = "Personal"; // "Personal" or "SchoolAdmin" public string? SchoolName { get; set; } public string? ActivationCode { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/RegisterPersonalTeacherDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/SupportBundleModels.cs SHA256: ccaf81c14fe9bb324d48f2b81336adf237cf8b7b4e60baf91575358b5bc97a2e SIZE: 6298 ================================================================================ using System; using System.Linq; namespace ClassNotify.Shared.Models; /// /// 设备技术诊断包状态枚举定义 (P2.5 RC1-3 Support Bundle) /// 严格冻结为 6 个状态,禁止擅自扩充 /// public static class SupportBundleStatuses { public const string PendingDispatch = "PendingDispatch"; public const string Collecting = "Collecting"; public const string Available = "Available"; public const string Failed = "Failed"; public const string TimedOut = "TimedOut"; public const string Expired = "Expired"; public static readonly string[] All = [ PendingDispatch, Collecting, Available, Failed, TimedOut, Expired ]; public static bool IsValid(string? status) => !string.IsNullOrEmpty(status) && All.Contains(status); public static bool IsTerminal(string? status) => status == Available || status == Failed || status == TimedOut || status == Expired; } /// /// 创建诊断包请求载荷 /// public class CreateSupportBundleRequest { public string? ClientRequestId { get; set; } } /// /// 诊断包创建响应载荷 (HTTP 202 Accepted) /// public class SupportBundleCreatedDto { public string SupportBundleId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset DeadlineAtUtc { get; set; } public string CorrelationId { get; set; } = string.Empty; } /// /// SignalR 发送至终端的诊断包生成命令契约 (FormatVersion = 1) /// 目标通道:t:{tenantId}:d:{deviceId} /// public sealed class GenerateSupportBundleCommand { public int FormatVersion { get; set; } = 1; public string SupportBundleId { get; set; } = string.Empty; public string CorrelationId { get; set; } = string.Empty; public DateTimeOffset RequestedAtUtc { get; set; } public DateTimeOffset DeadlineAtUtc { get; set; } public long MaxSizeBytes { get; set; } = 5 * 1024 * 1024; } /// /// 诊断包元数据清单 (manifest.json 结构,FormatVersion = 1) /// public sealed class SupportBundleManifestV1 { public int FormatVersion { get; set; } = 1; public string SupportBundleId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public DateTimeOffset CreatedAtUtc { get; set; } public string ServiceVersion { get; set; } = string.Empty; public string? ClientVersion { get; set; } public string ProtocolVersion { get; set; } = string.Empty; } /// /// 诊断包运行期环境快照 (runtime.json 结构) /// 严格白名单结构化字段,杜绝环境与注册表 Dump /// public sealed class SupportRuntimeSnapshotV1 { public string ServiceVersion { get; set; } = string.Empty; public string? ClientVersion { get; set; } public string OsVersion { get; set; } = string.Empty; public string Architecture { get; set; } = string.Empty; public long ServiceUptimeSeconds { get; set; } public bool WpfProcessAvailable { get; set; } public string SignalRState { get; set; } = string.Empty; public DateTimeOffset? LastSignalRConnectedAtUtc { get; set; } public DateTimeOffset? LastSignalRDisconnectedAtUtc { get; set; } public int? HttpsPingLatencyMs { get; set; } public long? ClockOffsetMs { get; set; } public string IpcState { get; set; } = string.Empty; public string TtsState { get; set; } = string.Empty; } /// /// 结构化诊断事件记录 (events.ndjson 逐行载荷) /// 杜绝明文异常堆栈与通知正文,采用白名单 EventCode /// public sealed record SupportDiagnosticEvent( DateTimeOffset TimestampUtc, string Level, string Component, string EventCode, string? CorrelationId, string? ErrorCode, long? DurationMs); /// /// 终端上报诊断采集失败请求 /// public sealed class SupportBundleFailureReportDto { public string ErrorCode { get; set; } = SupportBundleErrorCodes.CollectionFailure; } /// /// 诊断包标准错误代号字典 /// public static class SupportBundleErrorCodes { public const string BundleTooLarge = "BundleTooLarge"; public const string InvalidZip = "InvalidZip"; public const string InvalidManifest = "InvalidManifest"; public const string UnexpectedEntry = "UnexpectedEntry"; public const string ExpandedSizeExceeded = "ExpandedSizeExceeded"; public const string StorageFailure = "StorageFailure"; public const string UploadExpired = "UploadExpired"; public const string CollectionFailure = "CollectionFailure"; public const string BundleAlreadyCompleted = "BundleAlreadyCompleted"; public const string BundleNotAcceptingUpload = "BundleNotAcceptingUpload"; public const string DeviceMismatch = "DeviceMismatch"; public const string SupportBundleAlreadyRunning = "SupportBundleAlreadyRunning"; public const string BundleNotReady = "BundleNotReady"; public const string BundleFailed = "BundleFailed"; public const string BundleExpired = "BundleExpired"; public const string SupportBundleNotFound = "SupportBundleNotFound"; public const string SupportBundleFileMissing = "SupportBundleFileMissing"; public const string InvalidStoragePath = "InvalidStoragePath"; } /// /// 管理员端诊断包状态查询 DTO (P2.5 RC1-3 Phase 3) /// 严格白名单结构,杜绝暴露内部物理 StoragePath /// public sealed class SupportBundleStatusDto { public string SupportBundleId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string TenantId { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset? CompletedAtUtc { get; set; } public DateTimeOffset? ExpiresAtUtc { get; set; } public long? SizeBytes { get; set; } public string? Sha256 { get; set; } public bool DownloadAvailable { get; set; } public string? ErrorCode { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/SupportBundleModels.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/TeacherLoginDto.cs SHA256: 036bdf6f38c10b91ff751617bf3aaa87ba703f3cda0a90179dcda4132d16ba52 SIZE: 1308 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教师登录请求 DTO /// public class TeacherLoginDto { public string Username { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; } /// /// 教师登录成功返回包含 Tenant Claims 的 JWT 凭证 /// public class TeacherLoginResultDto { public bool Success { get; set; } public string? Token { get; set; } public string? TenantId { get; set; } public string? TenantType { get; set; } // "School" or "Personal" public string? TenantName { get; set; } public string? UserId { get; set; } public string? FullName { get; set; } public string? Role { get; set; } public string? Username { get; set; } public string? ErrorMessage { get; set; } // Turn 62: Personal Teacher Trial & Recovery Fields public string? TrialActivationCodeMasked { get; set; } public string? TrialActivationCodeId { get; set; } public string? RecoveryKey { get; set; } // Returned ONLY upon successful registration public bool IsFirstRegistration { get; set; } = false; // Turn 75: Temporary Password Forced Change Model public bool PasswordChangeRequired { get; set; } = false; public string? PasswordChangeToken { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/TeacherLoginDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/UpdateClassNameRequestDto.cs SHA256: 3e0ff8c346f1f7ac6ece5ffbd121a7d5c547a02498d6fa03e75b763159058094 SIZE: 349 ================================================================================ namespace ClassNotify.Shared.Models; /// /// 教室端/管理端修改班级名称请求 DTO /// public class UpdateClassNameRequestDto { /// /// 自定义班级名称 (例如: 八年级(1)班、高三(5)班、多媒体报告厅) /// public string ClassName { get; set; } = string.Empty; } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/UpdateClassNameRequestDto.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/UpdateModels.cs SHA256: ca7efdd9f347fb0a898a72acdbd2b9b9858e8256903c95706bac1c6c9e23a5f4 SIZE: 10818 ================================================================================ using System; using System.Collections.Generic; namespace ClassNotify.Shared.Models; /// /// 客户端在线升级任务流转状态机 (P2.5 RC1-4 冻结 10 态模型) /// public static class UpdateStatuses { public const string PendingDispatch = "PendingDispatch"; public const string Downloading = "Downloading"; public const string Verified = "Verified"; public const string Installing = "Installing"; public const string HealthChecking = "HealthChecking"; public const string Succeeded = "Succeeded"; public const string Failed = "Failed"; public const string RollingBack = "RollingBack"; public const string RolledBack = "RolledBack"; public const string RollbackFailed = "RollbackFailed"; public const string TimedOut = "TimedOut"; public static readonly HashSet ActiveStatuses = new(StringComparer.OrdinalIgnoreCase) { PendingDispatch, Downloading, Verified, Installing, HealthChecking, RollingBack }; public static readonly HashSet TerminalStatuses = new(StringComparer.OrdinalIgnoreCase) { Succeeded, Failed, RolledBack, RollbackFailed, TimedOut }; } /// /// 升级与验签标准错误码 /// public static class UpdateErrorCodes { public const string ReleaseNotFound = "ReleaseNotFound"; public const string ReleaseDisabled = "ReleaseDisabled"; public const string DeviceNotFound = "DeviceNotFound"; public const string UpdateAlreadyRunning = "UpdateAlreadyRunning"; public const string PackageNotReady = "PackageNotReady"; public const string PackageTooLarge = "PackageTooLarge"; public const string InvalidPackageZip = "InvalidPackageZip"; public const string InvalidSignature = "InvalidSignature"; public const string InvalidSha256 = "InvalidSha256"; public const string ArchitectureMismatch = "ArchitectureMismatch"; public const string ManifestInvalid = "ManifestInvalid"; public const string VersionMismatch = "VersionMismatch"; public const string HealthCheckFailed = "HealthCheckFailed"; public const string RollbackFailed = "RollbackFailed"; public const string UpdateTimeout = "UpdateTimeout"; public const string InvalidStoragePath = "InvalidStoragePath"; public const string Unauthorized = "Unauthorized"; public const string Forbidden = "Forbidden"; // Phase 2 Rollback Standard Error Codes public const string InvalidUpdateStateTransition = "InvalidUpdateStateTransition"; public const string BackupCreationFailed = "BackupCreationFailed"; public const string BackupVerificationFailed = "BackupVerificationFailed"; public const string InsufficientDiskSpace = "InsufficientDiskSpace"; public const string InstallFileReplacementFailed = "InstallFileReplacementFailed"; public const string ServiceStartFailed = "ServiceStartFailed"; public const string ServiceCrashLoop = "ServiceCrashLoop"; public const string PostUpdateIpcFailed = "PostUpdateIpcFailed"; public const string PostUpdateWpfFailed = "PostUpdateWpfFailed"; public const string PostUpdateSignalRFailed = "PostUpdateSignalRFailed"; public const string RollbackFileRestoreFailed = "RollbackFileRestoreFailed"; public const string RollbackVerificationFailed = "RollbackVerificationFailed"; public const string RollbackServiceStartFailed = "RollbackServiceStartFailed"; public const string RecoveryInterrupted = "RecoveryInterrupted"; // Phase 3 Staged Rollout Standard Error Codes public const string BatchNotFound = "BatchNotFound"; public const string InvalidBatchScope = "InvalidBatchScope"; public const string BatchInvalidState = "BatchInvalidState"; public const string CanaryNotSucceeded = "CanaryNotSucceeded"; } /// /// 安装包内嵌 manifest.json 元数据格式 /// public sealed class UpdateManifestV1 { public int FormatVersion { get; set; } = 1; public string Version { get; set; } = ""; public string Architecture { get; set; } = "win-x64"; public string PayloadSha256 { get; set; } = ""; public DateTimeOffset CreatedAtUtc { get; set; } } /// /// 备份清单条目 (支持精准集合匹配与多余坏版文件物理清除) /// public sealed class BackupManifestFileEntry { public string RelativePath { get; set; } = ""; public long SizeBytes { get; set; } public string Sha256 { get; set; } = ""; } /// /// 安装前全量备份清单 backup-manifest.json /// public sealed class BackupManifestV1 { public int ManifestVersion { get; set; } = 1; public string RunId { get; set; } = ""; public string PreviousVersion { get; set; } = ""; public string TargetVersion { get; set; } = ""; public DateTimeOffset CreatedAtUtc { get; set; } public List Files { get; set; } = new(); } /// /// 独立更新代理运行日志状态 update-journal.json (掉电/中断可靠恢复) /// public sealed class UpdateJournalV1 { public string RunId { get; set; } = ""; public string Phase { get; set; } = ""; public string TargetVersion { get; set; } = ""; public string TargetDir { get; set; } = ""; public string BackupDir { get; set; } = ""; public string StagingZip { get; set; } = ""; public string? ServiceName { get; set; } public DateTimeOffset UpdatedAtUtc { get; set; } public string? ErrorCode { get; set; } public string? ErrorMessage { get; set; } } /// /// 通过 SignalR 发送给受控终端的升级启动指令 /// 严格杜绝传递任意外部 URL,仅传递元数据与受控 ReleaseId /// public sealed class StartDeviceUpdateCommand { public string UpdateRunId { get; set; } = ""; public string ReleaseId { get; set; } = ""; public string CorrelationId { get; set; } = ""; public string TargetVersion { get; set; } = ""; public string ExpectedSha256 { get; set; } = ""; public string ManifestSignature { get; set; } = ""; public DateTimeOffset DeadlineAtUtc { get; set; } } /// /// SuperAdmin 请求触发单设备更新 DTO /// public sealed class CreateDeviceUpdateRequest { public string ReleaseId { get; set; } = ""; public string? ClientRequestId { get; set; } } /// /// 管理员查询与历史恢复 DTO (绝不暴露服务器内部物理路径) /// public sealed class DeviceUpdateStatusDto { public string UpdateRunId { get; set; } = ""; public string DeviceId { get; set; } = ""; public string TenantId { get; set; } = ""; public string ReleaseId { get; set; } = ""; public string Status { get; set; } = ""; public string FromVersion { get; set; } = ""; public string TargetVersion { get; set; } = ""; public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset DeadlineAtUtc { get; set; } public DateTimeOffset? CompletedAtUtc { get; set; } public string? ErrorCode { get; set; } public string? ErrorMessage { get; set; } } /// /// 设备端上报升级阶段与结果请求 /// public sealed class DeviceUpdateReportRequest { public string Status { get; set; } = ""; public string? ErrorCode { get; set; } public string? ErrorMessage { get; set; } } /// /// 批次升级生命周期状态 /// public static class UpdateBatchStatuses { public const string CanaryRunning = "CanaryRunning"; public const string AwaitingContinue = "AwaitingContinue"; public const string RollingOut = "RollingOut"; public const string Completed = "Completed"; public const string Stopped = "Stopped"; } /// /// 设备升级分发闸门状态 (物理隔离未放行设备) /// public static class UpdateDispatchGates { public const string Released = "Released"; public const string Held = "Held"; } /// /// SuperAdmin 创建小规模灰度升级批次请求 (限 1~5 台同一租户设备) /// public sealed class CreateUpdateBatchRequest { public string TenantId { get; set; } = ""; public string ReleaseId { get; set; } = ""; public string CanaryDeviceId { get; set; } = ""; public List DeviceIds { get; set; } = new(); public string? ClientRequestId { get; set; } } /// /// 批次升级设备状态汇总聚合 (严禁将汇总计数持久化到批次表) /// public sealed class UpdateBatchSummaryDto { public int Target { get; set; } public int Held { get; set; } public int Updating { get; set; } public int Succeeded { get; set; } public int RolledBack { get; set; } public int Failed { get; set; } public int RollbackFailed { get; set; } public int TimedOut { get; set; } } /// /// 批次内单台设备状态明细 DTO /// public sealed class UpdateBatchDeviceDetailDto { public string DeviceId { get; set; } = ""; public string Hostname { get; set; } = ""; public string ClassroomName { get; set; } = ""; public bool IsCanary { get; set; } public string DispatchGate { get; set; } = ""; public string Status { get; set; } = ""; public string FromVersion { get; set; } = ""; public string TargetVersion { get; set; } = ""; public DateTimeOffset? StartedAtUtc { get; set; } public DateTimeOffset? CompletedAtUtc { get; set; } public string? ErrorCode { get; set; } public string? ErrorMessage { get; set; } } /// /// 批次升级任务全量 DTO /// public sealed class UpdateBatchDto { public string BatchId { get; set; } = ""; public string TenantId { get; set; } = ""; public string ReleaseId { get; set; } = ""; public string TargetVersion { get; set; } = ""; public string Status { get; set; } = ""; public string CanaryDeviceId { get; set; } = ""; public DateTimeOffset CreatedAtUtc { get; set; } public DateTimeOffset? CompletedAtUtc { get; set; } public DateTimeOffset? StoppedAtUtc { get; set; } public UpdateBatchSummaryDto Summary { get; set; } = new(); public List Devices { get; set; } = new(); } /// /// 发布版本摘要 DTO (供 SuperAdmin 下拉框选择) /// public sealed class UpdateReleaseSummaryDto { public string ReleaseId { get; set; } = ""; public string Version { get; set; } = ""; public string Architecture { get; set; } = "win-x64"; public long PackageSizeBytes { get; set; } public string PackageSha256 { get; set; } = ""; public DateTimeOffset CreatedAtUtc { get; set; } public bool IsEnabled { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/UpdateModels.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Models/VisualReceiptModels.cs SHA256: dfee680aa07171f71ad0a2c534bbbb5ce97870c4dec77fff44d6e2d72b79a00d SIZE: 1358 ================================================================================ using System; namespace ClassNotify.Shared.Models; /// /// IPC 传输的视觉回执数据包 (WPF Client -> Windows Service) /// public sealed class VisualReceiptIpcDto { public string NotificationId { get; set; } = string.Empty; public byte[] JpegBytes { get; set; } = Array.Empty(); } /// /// Web / Server 暴露给前端查看的设备通知回执视图模型 /// public sealed class NotificationReceiptViewDto { public string DeviceId { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public DateTimeOffset? DisplayedAt { get; set; } /// /// None / Available / Expired /// public string VisualReceiptState { get; set; } = "None"; public DateTimeOffset? VisualReceiptCapturedAt { get; set; } public DateTimeOffset? VisualReceiptExpiresAt { get; set; } } /// /// 视觉回执(现场大屏通知截图)上传完成后的实时推送事件 /// public sealed class VisualReceiptUploadedEvent { public string NotificationId { get; set; } = string.Empty; public string DeviceId { get; set; } = string.Empty; public string VisualReceiptState { get; set; } = "Available"; public DateTimeOffset CapturedAt { get; set; } public DateTimeOffset? ExpiresAt { get; set; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Models/VisualReceiptModels.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Policies/ClientLaunchPolicy.cs SHA256: a0de90a61fa951f71951c08f7694c95e89f6ecac35b335a959fb55e7f1ab89c1 SIZE: 2798 ================================================================================ using ClassNotify.Shared.Enums; namespace ClassNotify.Shared.Policies; public sealed record ClientLaunchDecision( bool StartProcess, bool SendShowUi, bool BringToForeground); /// /// Pure-function launch policy governing whether to spawn processes, send wakeups, or foreground UI. /// Guaranteed Invariant: BackgroundRecovery NEVER foregrounds UI or sends SHOW_UI on duplicate instance. /// public static class ClientLaunchPolicy { public static ClientLaunchDecision DecideLaunch( ClientLaunchIntent intent, bool existingInstanceRunning, bool userDismissedInSession = false) { if (existingInstanceRunning) { // Another instance is already alive return intent switch { // Background recovery finding an existing instance: silent exit, DO NOT send SHOW_UI! ClientLaunchIntent.BackgroundRecovery => new ClientLaunchDecision( StartProcess: false, SendShowUi: false, BringToForeground: false), // Explicit human request finding existing instance: wake it up to foreground! ClientLaunchIntent.UserInteractive => new ClientLaunchDecision( StartProcess: false, SendShowUi: true, BringToForeground: true), // Installer first-run finding existing instance: wake it up to foreground ClientLaunchIntent.InstallerFirstRun => new ClientLaunchDecision( StartProcess: false, SendShowUi: true, BringToForeground: true), _ => new ClientLaunchDecision(false, false, false) }; } // No existing instance running; starting fresh instance return intent switch { // Background recovery: start process, keep in background, DO NOT foreground ClientLaunchIntent.BackgroundRecovery => new ClientLaunchDecision( StartProcess: true, SendShowUi: false, BringToForeground: false), // User interactive: start process and immediately show window ClientLaunchIntent.UserInteractive => new ClientLaunchDecision( StartProcess: true, SendShowUi: false, BringToForeground: true), // Installer first run: start process and immediately show window ClientLaunchIntent.InstallerFirstRun => new ClientLaunchDecision( StartProcess: true, SendShowUi: false, BringToForeground: true), _ => new ClientLaunchDecision(true, false, false) }; } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Policies/ClientLaunchPolicy.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Security/UpdatePackageSigner.cs SHA256: b20f3c56cdcf5d5e4e361132817e5cf0e9a930b2f47364326226287867bb7c6b SIZE: 3201 ================================================================================ using System; using System.Security.Cryptography; using System.Text; namespace ClassNotify.Shared.Security; /// /// 客户端在线升级包数字签名与验签工具 (基于 NIST P-256 ECDSA 与 SHA-256) /// 发布机离线保存私钥签名;客户端与 UpdateAgent 仅内置公钥验签 /// public static class UpdatePackageSigner { private static readonly Lazy<(string priv, string pub)> _defaultTestKey = new(() => GenerateKeyPair()); /// /// 测试与默认部署环境预置的 ECDSA P-256 公钥 (SubjectPublicKeyInfo Base64) /// public static string DefaultTestPublicKeyBase64 => _defaultTestKey.Value.pub; /// /// 测试与离线发布环境预置的 ECDSA P-256 私钥 (PKCS#8 Base64) /// 注意:生产环境此私钥严格仅存在于离线发布机器,绝不部署到服务器与终端 /// public static string DefaultTestPrivateKeyBase64 => _defaultTestKey.Value.priv; /// /// 生成一对全新的 ECDSA NIST P-256 密钥对 (供发布者离线建钥) /// public static (string privateKeyPkcs8Base64, string publicKeySpkiBase64) GenerateKeyPair() { using var ecdsa = ECDsa.Create(ECCurve.NamedCurves.nistP256); var privBytes = ecdsa.ExportPkcs8PrivateKey(); var pubBytes = ecdsa.ExportSubjectPublicKeyInfo(); return (Convert.ToBase64String(privBytes), Convert.ToBase64String(pubBytes)); } /// /// 使用 ECDSA P-256 私钥对数据哈希进行数字签名,返回 Base64 签名串 /// public static string SignHashHex(string hashHex, string privateKeyPkcs8Base64) { if (string.IsNullOrWhiteSpace(hashHex)) throw new ArgumentException("Hash string cannot be empty.", nameof(hashHex)); var dataToSign = Encoding.UTF8.GetBytes(hashHex.Trim().ToLowerInvariant()); var privBytes = Convert.FromBase64String(privateKeyPkcs8Base64); using var ecdsa = ECDsa.Create(); ecdsa.ImportPkcs8PrivateKey(privBytes, out _); var signatureBytes = ecdsa.SignData(dataToSign, HashAlgorithmName.SHA256); return Convert.ToBase64String(signatureBytes); } /// /// 使用 ECDSA P-256 公钥校验签名是否合法有效 /// public static bool VerifyHashHex(string hashHex, string signatureBase64, string publicKeySpkiBase64) { if (string.IsNullOrWhiteSpace(hashHex) || string.IsNullOrWhiteSpace(signatureBase64) || string.IsNullOrWhiteSpace(publicKeySpkiBase64)) { return false; } try { var data = Encoding.UTF8.GetBytes(hashHex.Trim().ToLowerInvariant()); var signatureBytes = Convert.FromBase64String(signatureBase64.Trim()); var pubBytes = Convert.FromBase64String(publicKeySpkiBase64.Trim()); using var ecdsa = ECDsa.Create(); ecdsa.ImportSubjectPublicKeyInfo(pubBytes, out _); return ecdsa.VerifyData(data, signatureBytes, HashAlgorithmName.SHA256); } catch { return false; } } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Security/UpdatePackageSigner.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Services/ClientNotificationBuffer.cs SHA256: a39ed9b75407a449f51b86098eb51fe045ae90b940a9f40021de6c5a2dba57e9 SIZE: 6784 ================================================================================ using System.Collections.Concurrent; using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Services; /// /// Thread-safe client notification buffer and FIFO delivery dispatcher for Windows Service. /// Guarantees strict FIFO delivery order, single-concurrent flushing via SemaphoreSlim(1,1), /// and atomic peek-then-dequeue so broken-pipe failures leave the item at the head of the queue. /// When a backlog exists, new live notifications are enqueued to preserve FIFO order and never bypass pending items. /// public class ClientNotificationBuffer { private readonly ConcurrentQueue _pendingQueue = new(); private readonly SemaphoreSlim _flushLock = new(1, 1); public int PendingCount => _pendingQueue.Count; public IReadOnlyCollection GetPendingSnapshot() => _pendingQueue.ToArray(); public void Enqueue(NotificationDto notification) { if (notification == null) return; _pendingQueue.Enqueue(notification); } public void Clear() { while (_pendingQueue.TryDequeue(out _)) { } } /// /// Delivers the notification to the client or safely buffers it. /// If there is an existing backlog, the notification is enqueued to the tail of the backlog /// to preserve strict FIFO ordering, and a flush is triggered if connected. /// If there is no backlog and the client is connected, an immediate live delivery is attempted. /// If delivery fails, the notification is buffered so it can be flushed on reconnect. /// public async Task DeliverOrBufferAsync( NotificationDto notification, Func isClientConnected, Func> sendToClientAsync, int waitAttempts = 0, int delayMsBetweenAttempts = 500) { if (notification == null) return false; await _flushLock.WaitAsync(); try { // Case 1: Existing backlog exists. Must enqueue behind backlog to guarantee FIFO ordering! if (!_pendingQueue.IsEmpty) { _pendingQueue.Enqueue(notification); if (isClientConnected()) { await FlushInternalUnderLockAsync(isClientConnected, sendToClientAsync, DateTimeOffset.UtcNow); } return false; } // Case 2: No backlog. If client is connected, attempt immediate live send. if (isClientConnected()) { bool success = false; try { success = await sendToClientAsync(notification); } catch { success = false; } if (success) { return true; } } // Case 3: Client handshaking / transient wait window for (int i = 0; i < waitAttempts; i++) { if (delayMsBetweenAttempts > 0) { await Task.Delay(delayMsBetweenAttempts); } if (isClientConnected()) { bool success = false; try { success = await sendToClientAsync(notification); } catch { success = false; } if (success) { return true; } } } // Delivery failed or client not connected: buffer notification for next reconnect flush _pendingQueue.Enqueue(notification); return false; } finally { _flushLock.Release(); } } /// /// Flushes pending notifications to the connected client. /// Uses peek-then-dequeue: only dequeues upon verified successful send. /// If send fails or client disconnects, the failed notification remains at the head of the queue, /// flushing stops immediately, and strict FIFO order is naturally preserved. /// public async Task FlushAsync( Func isClientConnected, Func> sendToClientAsync, DateTimeOffset? currentUtc = null) { var now = currentUtc ?? DateTimeOffset.UtcNow; await _flushLock.WaitAsync(); try { return await FlushInternalUnderLockAsync(isClientConnected, sendToClientAsync, now); } finally { _flushLock.Release(); } } private async Task FlushInternalUnderLockAsync( Func isClientConnected, Func> sendToClientAsync, DateTimeOffset now) { int flushed = 0; while (_pendingQueue.TryPeek(out var notif)) { // Drop expired notification while waiting in queue if (notif.ExpiresAt.HasValue && notif.ExpiresAt.Value <= now) { _pendingQueue.TryDequeue(out _); continue; } if (!isClientConnected()) { // Client not connected: halt flush, leave notif at head of queue break; } bool success; try { success = await sendToClientAsync(notif); } catch { success = false; } if (success) { // Dequeue ONLY after successful delivery _pendingQueue.TryDequeue(out _); flushed++; } else { // Send failed (pipe broken mid-send). Do NOT dequeue! // notif remains at the head of the queue. Halt flushing to preserve FIFO order. break; } } return flushed; } public void Remove(string notificationId) { if (string.IsNullOrEmpty(notificationId)) return; _flushLock.Wait(); try { var items = _pendingQueue.ToArray(); while (_pendingQueue.TryDequeue(out _)) { } foreach (var item in items) { if (!string.Equals(item.Id, notificationId, StringComparison.OrdinalIgnoreCase)) { _pendingQueue.Enqueue(item); } } } finally { _flushLock.Release(); } } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Services/ClientNotificationBuffer.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Services/ClientNotificationDeduplicator.cs SHA256: 2db19ad641e7dca72254f8a3d5d3cf5154bebf8f0f017ad6138950ea2d85219e SIZE: 3434 ================================================================================ using System; using System.Collections.Concurrent; using System.Linq; using System.Threading; namespace ClassNotify.Shared.Services; /// /// Client-side idempotent duplicate suppression for at-least-once message delivery. /// Ensures running clients do not display duplicate popups or trigger multiple TTS announcements /// when catching up or receiving retransmitted notifications with the same Notification ID. /// public class ClientNotificationDeduplicator { private readonly ConcurrentDictionary _processedMessageIds = new(); private readonly int _maxCapacity; private readonly TimeSpan _retentionPeriod; private readonly object _cleanupLock = new(); public ClientNotificationDeduplicator(int maxCapacity = 1000, TimeSpan? retentionPeriod = null) { _maxCapacity = maxCapacity; _retentionPeriod = retentionPeriod ?? TimeSpan.FromHours(24); } /// /// Atomically attempts to mark the notification as processed. /// /// The unique notification ID. /// True if this is the first time receiving this ID (allow processing); False if duplicate (suppress presentation). public bool TryProcess(string notificationId) { if (string.IsNullOrWhiteSpace(notificationId)) return false; var now = DateTimeOffset.UtcNow; if (!_processedMessageIds.TryAdd(notificationId, now)) { // Key already exists -> atomic duplicate detection return false; } // Bounded capacity protection if (_processedMessageIds.Count > _maxCapacity) { ThreadPool.QueueUserWorkItem(_ => CleanupStaleEntries()); } return true; } /// /// Checks whether an ID has been seen without mutating deduplication state. /// public bool IsProcessed(string notificationId) { return !string.IsNullOrWhiteSpace(notificationId) && _processedMessageIds.ContainsKey(notificationId); } public int Count => _processedMessageIds.Count; public void Clear() { _processedMessageIds.Clear(); } private void CleanupStaleEntries() { if (!Monitor.TryEnter(_cleanupLock)) return; try { var threshold = DateTimeOffset.UtcNow.Subtract(_retentionPeriod); foreach (var kvp in _processedMessageIds) { if (kvp.Value < threshold) { _processedMessageIds.TryRemove(kvp.Key, out _); } } // If still over capacity after expiry cleanup, purge oldest half if (_processedMessageIds.Count > _maxCapacity) { var removeCount = _processedMessageIds.Count - (_maxCapacity / 2); var oldestKeys = _processedMessageIds .OrderBy(kvp => kvp.Value) .Take(removeCount) .Select(kvp => kvp.Key) .ToList(); foreach (var key in oldestKeys) { _processedMessageIds.TryRemove(key, out _); } } } catch { // Best effort cleanup } finally { Monitor.Exit(_cleanupLock); } } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Services/ClientNotificationDeduplicator.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Services/DeviceCommandDeduplicator.cs SHA256: 7ab6ee236fe3217d620dec7982cb9144d054eb554c747ee1beb112c27f037383 SIZE: 8585 ================================================================================ using System.Collections.Concurrent; using System.Text.Json; using ClassNotify.Shared.Models; namespace ClassNotify.Shared.Services; /// /// 命令认领抢占状态 /// public enum CommandClaimResult { /// 成功抢占并在内存与磁盘物理账本中双重持久化成功 Claimed, /// 命令此前已执行完毕,持有已完成缓存结果 AlreadyCompleted, /// 命令当前正处于执行流中,尚未得出最终结果 InFlight, /// 持久化账本写入失败或本地账本文件已损坏,Fail-Closed 拒绝执行任何副作用 StorageError } /// /// 专用远程命令幂等去重器与持久化本地账本 (Windows Service 端) /// 保证同一 CommandId 在网络抖动、SignalR 重连、重复派发、乃至 Service 崩溃或重启后, /// 严格至多在物理终端执行一次实际副作用,并能安全幂等返回先前的执行结果。 /// 严格遵循 Fail-Closed 原则:当磁盘持久化失败或文件损坏时,决不允许在不具备持久保证的情况下执行副作用。 /// public class DeviceCommandDeduplicator { public class CommandExecutionRecord { public bool IsCompleted { get; set; } public DateTimeOffset Timestamp { get; set; } public DeviceCommandResultDto? Result { get; set; } } private readonly ConcurrentDictionary _records = new(); private readonly TimeSpan _slidingWindow; private readonly int _maxCapacity; private readonly string? _ledgerFilePath; private readonly object _fileLock = new(); private volatile bool _isCorrupted = false; public int Count => _records.Count; public string? LedgerFilePath => _ledgerFilePath; public bool IsCorrupted => _isCorrupted; public DeviceCommandDeduplicator( TimeSpan? slidingWindow = null, int maxCapacity = 1000, string? ledgerFilePath = null) { _slidingWindow = slidingWindow ?? TimeSpan.FromHours(1); _maxCapacity = maxCapacity; _ledgerFilePath = ledgerFilePath; LoadLedgerFromDisk(); } /// /// 尝试以持久化 Fail-Closed 保证抢占执行锁。 /// 只有在内存认领成功 且 磁盘持久化写入原子成功时,才返回 Claimed; /// 若账本损坏或持久化失败,立即回滚内存状态并返回 StorageError,阻断副作用执行。 /// public CommandClaimResult TryDurablyClaim(string commandId, DateTimeOffset? nowUtc = null) { if (string.IsNullOrWhiteSpace(commandId)) return CommandClaimResult.StorageError; if (_isCorrupted) return CommandClaimResult.StorageError; var now = nowUtc ?? DateTimeOffset.UtcNow; PruneIfNeeded(now); if (_records.TryGetValue(commandId, out var existing)) { return existing.IsCompleted ? CommandClaimResult.AlreadyCompleted : CommandClaimResult.InFlight; } var record = new CommandExecutionRecord { IsCompleted = false, Timestamp = now }; if (!_records.TryAdd(commandId, record)) { return _records.TryGetValue(commandId, out var r) && r.IsCompleted ? CommandClaimResult.AlreadyCompleted : CommandClaimResult.InFlight; } try { SaveLedgerToDisk(); return CommandClaimResult.Claimed; } catch { // Fail-closed: 回滚内存记录,确保没有虚假的 InFlight 状态残留在内存中 _records.TryRemove(commandId, out _); return CommandClaimResult.StorageError; } } /// /// 尝试抢占执行锁(兼容既有布尔接口,底层严格遵循 TryDurablyClaim 的 Fail-Closed 保证)。 /// public bool TryBeginExecution(string commandId, DateTimeOffset? nowUtc = null) { return TryDurablyClaim(commandId, nowUtc) == CommandClaimResult.Claimed; } /// /// 命令执行完毕后记录最终执行结果并持久化至磁盘 /// public void CompleteExecution(string commandId, DeviceCommandResultDto result, DateTimeOffset? nowUtc = null) { if (string.IsNullOrWhiteSpace(commandId)) return; var now = nowUtc ?? DateTimeOffset.UtcNow; if (_records.TryGetValue(commandId, out var record)) { record.IsCompleted = true; record.Timestamp = now; record.Result = result; } else { _records[commandId] = new CommandExecutionRecord { IsCompleted = true, Timestamp = now, Result = result }; } try { SaveLedgerToDisk(); } catch { // 写入失败时保留内存记录 } } /// /// 查询已完成命令的历史缓存结果(用于重复到达时直接返回原结果) /// public bool TryGetCachedResult(string commandId, out DeviceCommandResultDto? result) { result = null; if (string.IsNullOrWhiteSpace(commandId)) return false; if (_records.TryGetValue(commandId, out var record) && record.IsCompleted && record.Result != null) { result = record.Result; return true; } return false; } public void Clear() { _records.Clear(); _isCorrupted = false; try { SaveLedgerToDisk(); } catch { } } private void PruneIfNeeded(DateTimeOffset now) { bool pruned = false; var cutoff = now.Subtract(_slidingWindow); if (_records.Count > _maxCapacity) { foreach (var kvp in _records) { if (kvp.Value.Timestamp < cutoff) { if (_records.TryRemove(kvp.Key, out _)) { pruned = true; } } } } if (pruned) { try { SaveLedgerToDisk(); } catch { } } } private void LoadLedgerFromDisk() { if (string.IsNullOrWhiteSpace(_ledgerFilePath)) return; try { lock (_fileLock) { if (!File.Exists(_ledgerFilePath)) return; var json = File.ReadAllText(_ledgerFilePath); if (string.IsNullOrWhiteSpace(json)) { // 存在但为空,视同损坏文件以防读取非预期状态 _isCorrupted = true; return; } var data = JsonSerializer.Deserialize>(json); if (data != null) { var now = DateTimeOffset.UtcNow; var cutoff = now.Subtract(_slidingWindow); foreach (var (k, v) in data) { if (v.Timestamp >= cutoff) { _records[k] = v; } } } else { _isCorrupted = true; } } } catch { // Fail-closed: 遇到反序列化异常或文件损坏时标记 Corrupted,阻止无保护的执行 _isCorrupted = true; } } private void SaveLedgerToDisk() { if (string.IsNullOrWhiteSpace(_ledgerFilePath)) return; lock (_fileLock) { var dir = Path.GetDirectoryName(_ledgerFilePath); if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var snapshot = _records.ToDictionary(k => k.Key, v => v.Value); var json = JsonSerializer.Serialize(snapshot, new JsonSerializerOptions { WriteIndented = true }); var tmp = _ledgerFilePath + $".{Guid.NewGuid():N}.tmp"; File.WriteAllText(tmp, json); File.Move(tmp, _ledgerFilePath, overwrite: true); } } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Services/DeviceCommandDeduplicator.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Utils/PairingCodeFormatter.cs SHA256: 95647f955f2c53fb9374d6ee384946e156935818fddd05989c1ef6fce0c509eb SIZE: 1930 ================================================================================ using System; using System.Text.RegularExpressions; namespace ClassNotify.Shared.Utils; /// /// 教室大屏配对码权威格式化工具 /// 核心红线约束: /// 1. 任何时候配对码严禁包含横杠 '-' /// 2. 配对码严禁分为明显的两组4个字符,必须严格等间距排列 (例如 '5 8 2 9 1 0 3 4') /// 3. 占位状态严禁出现 '--------',应显示为空白或提示文本 /// public static class PairingCodeFormatter { public const string DefaultPlaceholder = "等待获取"; /// /// 标准化配对码(移除所有空格、横杠、换行符) /// public static string Normalize(string? input) { if (string.IsNullOrWhiteSpace(input)) return string.Empty; return input.Replace("-", "").Replace(" ", "").Trim(); } /// /// 校验配对码是否为合规的 8 位纯数字 /// public static bool IsValid(string? input) { var clean = Normalize(input); return clean.Length == 8 && Regex.IsMatch(clean, @"^\d{8}$"); } /// /// 转换为大屏与终端 4+4 空格格式化的字符串(严格无横杠,例如 '5829 1034') /// public static string FormatPairingCode(string? code, string placeholder = DefaultPlaceholder) { if (string.IsNullOrWhiteSpace(code)) return placeholder; var digits = new string(System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Where(code, char.IsDigit))); if (digits.Length == 8) return $"{digits[..4]} {digits[4..]}"; return digits.Length > 0 ? digits : placeholder; } /// /// 转换为大屏与终端显示的字符串 /// public static string FormatEqualSpacing(string? code, string placeholder = DefaultPlaceholder) { return FormatPairingCode(code, placeholder); } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Utils/PairingCodeFormatter.cs ================================================================================ ================================================================================ FILE BEGIN: src/Shared/ClassNotify.Shared/Validation/ClassNameValidator.cs SHA256: a36adedc33c1bbf7af00f39109e22585d8a90a3824a2bea96e45a6ae39ceebee SIZE: 2449 ================================================================================ using System.Text; namespace ClassNotify.Shared.Validation; public static class ClassNameValidator { public const string RuleDescription = "班级名称不允许包含除“班”以外的汉字(推荐格式如:81班、82、83、84、89、810班)"; /// /// 校验班级名称是否合法: /// 1. 不可为空 /// 2. 长度在 1~30 之间 /// 3. 使用 Rune 遍历 Unicode scalar,全面覆盖基本 CJK、扩展 A~I 与兼容区,除单字“班”外严禁任何汉字 /// public static (bool IsValid, string? ErrorMessage) Validate(string? className) { if (string.IsNullOrWhiteSpace(className)) { return (false, "班级名称不可为空"); } var trimmed = className.Trim(); if (trimmed.Length > 30) { return (false, "班级名称长度不能超过30个字符"); } foreach (var rune in trimmed.EnumerateRunes()) { int cp = rune.Value; if (IsHan(cp) && cp != '班') { return (false, RuleDescription); } } return (true, null); } /// /// 全面判断 Unicode code point 是否属于汉字 (CJK 表意字符集及各扩展区块) /// public static bool IsHan(int codePoint) { return (codePoint >= 0x4E00 && codePoint <= 0x9FFF) || // CJK Unified Ideographs (含 U+9FA6~U+9FFF) (codePoint >= 0x3400 && codePoint <= 0x4DBF) || // CJK Extension A (codePoint >= 0x20000 && codePoint <= 0x2A6DF) || // CJK Extension B (codePoint >= 0x2A700 && codePoint <= 0x2B73F) || // CJK Extension C (codePoint >= 0x2B740 && codePoint <= 0x2B81F) || // CJK Extension D (codePoint >= 0x2B820 && codePoint <= 0x2CEAF) || // CJK Extension E (codePoint >= 0x2CEB0 && codePoint <= 0x2EBEF) || // CJK Extension F (codePoint >= 0x30000 && codePoint <= 0x3134F) || // CJK Extension G (codePoint >= 0x31350 && codePoint <= 0x323AF) || // CJK Extension H (codePoint >= 0x2EBF0 && codePoint <= 0x2EE5F) || // CJK Extension I (codePoint >= 0xF900 && codePoint <= 0xFAFF) || // CJK Compatibility Ideographs (codePoint >= 0x2F800 && codePoint <= 0x2FA1F); // CJK Compatibility Ideographs Supplement } } ================================================================================ FILE END: src/Shared/ClassNotify.Shared/Validation/ClassNameValidator.cs ================================================================================ ================================================================================ FILE BEGIN: src/Web/ClassNotify.Web/index.html SHA256: b2691cc09d200cb9d0a4cb5a6b8286ab1c8b628022d8cf034aa55da215bc5244 SIZE: 883 ================================================================================ ClassNotify 智慧教室通知与集控平台
================================================================================ FILE END: src/Web/ClassNotify.Web/index.html ================================================================================