diff --git a/control-plane/web/dist/assets/index-Ihi-UMyS.js b/control-plane/web/dist/assets/index-PxzqqEA7.js similarity index 90% rename from control-plane/web/dist/assets/index-Ihi-UMyS.js rename to control-plane/web/dist/assets/index-PxzqqEA7.js index 2932b9a..0d21ab6 100644 --- a/control-plane/web/dist/assets/index-Ihi-UMyS.js +++ b/control-plane/web/dist/assets/index-PxzqqEA7.js @@ -37,4 +37,4 @@ `+l[s].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=s&&0<=u);break}}}finally{Rl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cn(e):""}function bc(e){switch(e.tag){case 5:return Cn(e.type);case 16:return Cn("Lazy");case 13:return Cn("Suspense");case 19:return Cn("SuspenseList");case 0:case 2:case 15:return e=Ml(e.type,!1),e;case 11:return e=Ml(e.type.render,!1),e;case 1:return e=Ml(e.type,!0),e;default:return""}}function oi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ut:return"Fragment";case At:return"Portal";case li:return"Profiler";case is:return"StrictMode";case ii:return"Suspense";case si:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Cu:return(e.displayName||"Context")+".Consumer";case ju:return(e._context.displayName||"Context")+".Provider";case ss:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case os:return t=e.displayName||null,t!==null?t:oi(e.type)||"Memo";case tt:t=e._payload,e=e._init;try{return oi(e(t))}catch{}}return null}function ed(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oi(t);case 8:return t===is?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function mt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _u(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function td(e){var t=_u(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function cr(e){e._valueTracker||(e._valueTracker=td(e))}function Eu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=_u(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function $r(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ui(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bs(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=mt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function zu(e,t){t=t.checked,t!=null&&ls(e,"checked",t,!1)}function ai(e,t){zu(e,t);var n=mt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ci(e,t.type,n):t.hasOwnProperty("defaultValue")&&ci(e,t.type,mt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function eo(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ci(e,t,n){(t!=="number"||$r(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Nn=Array.isArray;function qt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=dr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function $n(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zn={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},nd=["Webkit","ms","Moz","O"];Object.keys(zn).forEach(function(e){nd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zn[t]=zn[e]})});function Ru(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||zn.hasOwnProperty(e)&&zn[e]?(""+t).trim():t+"px"}function Mu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ru(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var rd=Q({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 pi(e,t){if(t){if(rd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(y(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(y(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(y(61))}if(t.style!=null&&typeof t.style!="object")throw Error(y(62))}}function hi(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 mi=null;function us(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vi=null,bt=null,en=null;function ro(e){if(e=rr(e)){if(typeof vi!="function")throw Error(y(280));var t=e.stateNode;t&&(t=hl(t),vi(e.stateNode,e.type,t))}}function Iu(e){bt?en?en.push(e):en=[e]:bt=e}function Ou(){if(bt){var e=bt,t=en;if(en=bt=null,ro(e),t)for(e=0;e>>=0,e===0?32:31-(hd(e)/md|0)|0}var fr=64,pr=4194304;function _n(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Wr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var u=s&~l;u!==0?r=_n(u):(i&=s,i!==0&&(r=_n(i)))}else s=n&~l,s!==0?r=_n(s):i!==0&&(r=_n(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function tr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Oe(t),e[t]=n}function xd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Tn),po=" ",ho=!1;function ta(e,t){switch(e){case"keyup":return Yd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function na(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vt=!1;function Xd(e,t){switch(e){case"compositionend":return na(t);case"keypress":return t.which!==32?null:(ho=!0,po);case"textInput":return e=t.data,e===po&&ho?null:e;default:return null}}function Zd(e,t){if(Vt)return e==="compositionend"||!vs&&ta(e,t)?(e=bu(),Pr=ps=it=null,Vt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yo(n)}}function sa(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sa(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function oa(){for(var e=window,t=$r();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$r(e.document)}return t}function gs(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function sf(e){var t=oa(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&sa(n.ownerDocument.documentElement,n)){if(r!==null&&gs(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=xo(n,i);var s=xo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Wt=null,ki=null,Rn=null,ji=!1;function wo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ji||Wt==null||Wt!==$r(r)||(r=Wt,"selectionStart"in r&&gs(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}),Rn&&Hn(Rn,r)||(Rn=r,r=Qr(ki,"onSelect"),0Qt||(e.current=Pi[Qt],Pi[Qt]=null,Qt--)}function $(e,t){Qt++,Pi[Qt]=e.current,e.current=t}var vt={},ue=yt(vt),ve=yt(!1),Pt=vt;function sn(e,t){var n=e.type.contextTypes;if(!n)return vt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ge(e){return e=e.childContextTypes,e!=null}function Yr(){U(ve),U(ue)}function Eo(e,t,n){if(ue.current!==vt)throw Error(y(168));$(ue,t),$(ve,n)}function va(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(y(108,ed(e)||"Unknown",l));return Q({},n,r)}function Gr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vt,Pt=ue.current,$(ue,e),$(ve,ve.current),!0}function zo(e,t,n){var r=e.stateNode;if(!r)throw Error(y(169));n?(e=va(e,t,Pt),r.__reactInternalMemoizedMergedChildContext=e,U(ve),U(ue),$(ue,e)):U(ve),$(ve,n)}var He=null,ml=!1,Yl=!1;function ga(e){He===null?He=[e]:He.push(e)}function yf(e){ml=!0,ga(e)}function xt(){if(!Yl&&He!==null){Yl=!0;var e=0,t=D;try{var n=He;for(D=1;e>=s,l-=s,Qe=1<<32-Oe(t)+l|n<w?(I=E,E=null):I=E.sibling;var z=m(d,E,p[w],g);if(z===null){E===null&&(E=I);break}e&&E&&z.alternate===null&&t(d,E),c=i(z,c,w),C===null?j=z:C.sibling=z,C=z,E=I}if(w===p.length)return n(d,E),V&&kt(d,w),j;if(E===null){for(;ww?(I=E,E=null):I=E.sibling;var Y=m(d,E,z.value,g);if(Y===null){E===null&&(E=I);break}e&&E&&Y.alternate===null&&t(d,E),c=i(Y,c,w),C===null?j=Y:C.sibling=Y,C=Y,E=I}if(z.done)return n(d,E),V&&kt(d,w),j;if(E===null){for(;!z.done;w++,z=p.next())z=h(d,z.value,g),z!==null&&(c=i(z,c,w),C===null?j=z:C.sibling=z,C=z);return V&&kt(d,w),j}for(E=r(d,E);!z.done;w++,z=p.next())z=x(E,d,w,z.value,g),z!==null&&(e&&z.alternate!==null&&E.delete(z.key===null?w:z.key),c=i(z,c,w),C===null?j=z:C.sibling=z,C=z);return e&&E.forEach(function(O){return t(d,O)}),V&&kt(d,w),j}function P(d,c,p,g){if(typeof p=="object"&&p!==null&&p.type===Ut&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case ar:e:{for(var j=p.key,C=c;C!==null;){if(C.key===j){if(j=p.type,j===Ut){if(C.tag===7){n(d,C.sibling),c=l(C,p.props.children),c.return=d,d=c;break e}}else if(C.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===tt&&Lo(j)===C.type){n(d,C.sibling),c=l(C,p.props),c.ref=Sn(d,C,p),c.return=d,d=c;break e}n(d,C);break}else t(d,C);C=C.sibling}p.type===Ut?(c=zt(p.props.children,d.mode,g,p.key),c.return=d,d=c):(g=Dr(p.type,p.key,p.props,null,d.mode,g),g.ref=Sn(d,c,p),g.return=d,d=g)}return s(d);case At:e:{for(C=p.key;c!==null;){if(c.key===C)if(c.tag===4&&c.stateNode.containerInfo===p.containerInfo&&c.stateNode.implementation===p.implementation){n(d,c.sibling),c=l(c,p.children||[]),c.return=d,d=c;break e}else{n(d,c);break}else t(d,c);c=c.sibling}c=ti(p,d.mode,g),c.return=d,d=c}return s(d);case tt:return C=p._init,P(d,c,C(p._payload),g)}if(Nn(p))return k(d,c,p,g);if(vn(p))return S(d,c,p,g);wr(d,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,c!==null&&c.tag===6?(n(d,c.sibling),c=l(c,p),c.return=d,d=c):(n(d,c),c=ei(p,d.mode,g),c.return=d,d=c),s(d)):n(d,c)}return P}var un=Sa(!0),ka=Sa(!1),Jr=yt(null),qr=null,Gt=null,Ss=null;function ks(){Ss=Gt=qr=null}function js(e){var t=Jr.current;U(Jr),e._currentValue=t}function Ri(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function nn(e,t){qr=e,Ss=Gt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(me=!0),e.firstContext=null)}function Pe(e){var t=e._currentValue;if(Ss!==e)if(e={context:e,memoizedValue:t,next:null},Gt===null){if(qr===null)throw Error(y(308));Gt=e,qr.dependencies={lanes:0,firstContext:e}}else Gt=Gt.next=e;return t}var Nt=null;function Cs(e){Nt===null?Nt=[e]:Nt.push(e)}function ja(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Cs(t)):(n.next=l.next,l.next=n),t.interleaved=n,Je(e,r)}function Je(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var nt=!1;function Ns(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ca(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ge(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function dt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Je(e,n)}return l=r.interleaved,l===null?(t.next=t,Cs(r)):(t.next=l.next,l.next=t),r.interleaved=t,Je(e,n)}function Lr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cs(e,n)}}function Ro(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function br(e,t,n,r){var l=e.updateQueue;nt=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,f=a.next;a.next=null,s===null?i=f:s.next=f,s=a;var v=e.alternate;v!==null&&(v=v.updateQueue,u=v.lastBaseUpdate,u!==s&&(u===null?v.firstBaseUpdate=f:u.next=f,v.lastBaseUpdate=a))}if(i!==null){var h=l.baseState;s=0,v=f=a=null,u=i;do{var m=u.lane,x=u.eventTime;if((r&m)===m){v!==null&&(v=v.next={eventTime:x,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var k=e,S=u;switch(m=t,x=n,S.tag){case 1:if(k=S.payload,typeof k=="function"){h=k.call(x,h,m);break e}h=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=S.payload,m=typeof k=="function"?k.call(x,h,m):k,m==null)break e;h=Q({},h,m);break e;case 2:nt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[u]:m.push(u))}else x={eventTime:x,lane:m,tag:u.tag,payload:u.payload,callback:u.callback,next:null},v===null?(f=v=x,a=h):v=v.next=x,s|=m;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;m=u,u=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(v===null&&(a=h),l.baseState=a,l.firstBaseUpdate=f,l.lastBaseUpdate=v,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Rt|=s,e.lanes=s,e.memoizedState=h}}function Mo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Xl.transition;Xl.transition={};try{e(!1),t()}finally{D=n,Xl.transition=r}}function Va(){return Te().memoizedState}function kf(e,t,n){var r=pt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Wa(e))Ba(t,n);else if(n=ja(e,t,n,r),n!==null){var l=ce();Fe(n,e,r,l),Ha(n,t,r)}}function jf(e,t,n){var r=pt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Wa(e))Ba(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,u=i(s,n);if(l.hasEagerState=!0,l.eagerState=u,De(u,s)){var a=t.interleaved;a===null?(l.next=l,Cs(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=ja(e,t,l,r),n!==null&&(l=ce(),Fe(n,e,r,l),Ha(n,t,r))}}function Wa(e){var t=e.alternate;return e===H||t!==null&&t===H}function Ba(e,t){Mn=tl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ha(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cs(e,n)}}var nl={readContext:Pe,useCallback:ie,useContext:ie,useEffect:ie,useImperativeHandle:ie,useInsertionEffect:ie,useLayoutEffect:ie,useMemo:ie,useReducer:ie,useRef:ie,useState:ie,useDebugValue:ie,useDeferredValue:ie,useTransition:ie,useMutableSource:ie,useSyncExternalStore:ie,useId:ie,unstable_isNewReconciler:!1},Cf={readContext:Pe,useCallback:function(e,t){return Ae().memoizedState=[e,t===void 0?null:t],e},useContext:Pe,useEffect:Oo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Mr(4194308,4,Fa.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Mr(4,2,e,t)},useMemo:function(e,t){var n=Ae();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ae();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=kf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Ae();return e={current:e},t.memoizedState=e},useState:Io,useDebugValue:Ms,useDeferredValue:function(e){return Ae().memoizedState=e},useTransition:function(){var e=Io(!1),t=e[0];return e=Sf.bind(null,e[1]),Ae().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Ae();if(V){if(n===void 0)throw Error(y(407));n=n()}else{if(n=t(),te===null)throw Error(y(349));Lt&30||za(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Oo(Ta.bind(null,r,i,e),[e]),r.flags|=2048,qn(9,Pa.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ae(),t=te.identifierPrefix;if(V){var n=Ke,r=Qe;n=(r&~(1<<32-Oe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zn++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Ue]=t,e[Yn]=r,ec(e,t,!1,!1),t.stateNode=e;e:{switch(s=hi(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;ldn&&(t.flags|=128,r=!0,kn(i,!1),t.lanes=4194304)}else{if(!r)if(e=el(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!V)return se(t),null}else 2*X()-i.renderingStartTime>dn&&n!==1073741824&&(t.flags|=128,r=!0,kn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=X(),t.sibling=null,n=W.current,$(W,r?n&1|2:n&1),t):(se(t),null);case 22:case 23:return As(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?xe&1073741824&&(se(t),t.subtreeFlags&6&&(t.flags|=8192)):se(t),null;case 24:return null;case 25:return null}throw Error(y(156,t.tag))}function Rf(e,t){switch(xs(t),t.tag){case 1:return ge(t.type)&&Yr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return an(),U(ve),U(ue),zs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Es(t),null;case 13:if(U(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(y(340));on()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(W),null;case 4:return an(),null;case 10:return js(t.type._context),null;case 22:case 23:return As(),null;case 24:return null;default:return null}}var kr=!1,oe=!1,Mf=typeof WeakSet=="function"?WeakSet:Set,N=null;function Xt(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){K(e,t,r)}else n.current=null}function Vi(e,t,n){try{n()}catch(r){K(e,t,r)}}var Ko=!1;function If(e,t){if(Ci=Br,e=oa(),gs(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,u=-1,a=-1,f=0,v=0,h=e,m=null;t:for(;;){for(var x;h!==n||l!==0&&h.nodeType!==3||(u=s+l),h!==i||r!==0&&h.nodeType!==3||(a=s+r),h.nodeType===3&&(s+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++f===l&&(u=s),m===i&&++v===r&&(a=s),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},Br=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var S=k.memoizedProps,P=k.memoizedState,d=t.stateNode,c=d.getSnapshotBeforeUpdate(t.elementType===t.type?S:Re(t.type,S),P);d.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var p=t.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(y(163))}}catch(g){K(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return k=Ko,Ko=!1,k}function In(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Vi(t,n,i)}l=l.next}while(l!==r)}}function yl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Wi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function rc(e){var t=e.alternate;t!==null&&(e.alternate=null,rc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ue],delete t[Yn],delete t[zi],delete t[vf],delete t[gf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function lc(e){return e.tag===5||e.tag===3||e.tag===4}function Yo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||lc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kr));else if(r!==4&&(e=e.child,e!==null))for(Bi(e,t,n),e=e.sibling;e!==null;)Bi(e,t,n),e=e.sibling}function Hi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Hi(e,t,n),e=e.sibling;e!==null;)Hi(e,t,n),e=e.sibling}var ne=null,Me=!1;function et(e,t,n){for(n=n.child;n!==null;)ic(e,t,n),n=n.sibling}function ic(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount=="function")try{Ve.onCommitFiberUnmount(cl,n)}catch{}switch(n.tag){case 5:oe||Xt(n,t);case 6:var r=ne,l=Me;ne=null,et(e,t,n),ne=r,Me=l,ne!==null&&(Me?(e=ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ne.removeChild(n.stateNode));break;case 18:ne!==null&&(Me?(e=ne,n=n.stateNode,e.nodeType===8?Kl(e.parentNode,n):e.nodeType===1&&Kl(e,n),Wn(e)):Kl(ne,n.stateNode));break;case 4:r=ne,l=Me,ne=n.stateNode.containerInfo,Me=!0,et(e,t,n),ne=r,Me=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Vi(n,t,s),l=l.next}while(l!==r)}et(e,t,n);break;case 1:if(!oe&&(Xt(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){K(n,t,u)}et(e,t,n);break;case 21:et(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,et(e,t,n),oe=r):et(e,t,n);break;default:et(e,t,n)}}function Go(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Mf),t.forEach(function(r){var l=Bf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Le(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=X()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ff(r/1960))-r,10e?16:e,st===null)var r=!1;else{if(e=st,st=null,il=0,F&6)throw Error(y(331));var l=F;for(F|=4,N=e.current;N!==null;){var i=N,s=i.child;if(N.flags&16){var u=i.deletions;if(u!==null){for(var a=0;aX()-Ds?Et(e,0):Fs|=n),ye(e,t)}function pc(e,t){t===0&&(e.mode&1?(t=pr,pr<<=1,!(pr&130023424)&&(pr=4194304)):t=1);var n=ce();e=Je(e,t),e!==null&&(tr(e,t,n),ye(e,n))}function Wf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pc(e,n)}function Bf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(y(314))}r!==null&&r.delete(t),pc(e,n)}var hc;hc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ve.current)me=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return me=!1,Tf(e,t,n);me=!!(e.flags&131072)}else me=!1,V&&t.flags&1048576&&ya(t,Zr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ir(e,t),e=t.pendingProps;var l=sn(t,ue.current);nn(t,n),l=Ts(null,t,r,e,l,n);var i=Ls();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ge(r)?(i=!0,Gr(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ns(t),l.updater=gl,t.stateNode=l,l._reactInternals=t,Ii(t,r,e,n),t=Di(null,t,r,!0,i,n)):(t.tag=0,V&&i&&ys(t),ae(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ir(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Qf(r),e=Re(r,e),l){case 0:t=Fi(null,t,r,e,n);break e;case 1:t=Bo(null,t,r,e,n);break e;case 11:t=Vo(null,t,r,e,n);break e;case 14:t=Wo(null,t,r,Re(r.type,e),n);break e}throw Error(y(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Fi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Bo(e,t,r,l,n);case 3:e:{if(Ja(t),e===null)throw Error(y(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Ca(e,t),br(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=cn(Error(y(423)),t),t=Ho(e,t,r,n,l);break e}else if(r!==l){l=cn(Error(y(424)),t),t=Ho(e,t,r,n,l);break e}else for(we=ct(t.stateNode.containerInfo.firstChild),Se=t,V=!0,Ie=null,n=ka(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(on(),r===l){t=qe(e,t,n);break e}ae(e,t,r,n)}t=t.child}return t;case 5:return Na(t),e===null&&Li(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,_i(r,l)?s=null:i!==null&&_i(r,i)&&(t.flags|=32),Za(e,t),ae(e,t,s,n),t.child;case 6:return e===null&&Li(t),null;case 13:return qa(e,t,n);case 4:return _s(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=un(t,null,r,n):ae(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Vo(e,t,r,l,n);case 7:return ae(e,t,t.pendingProps,n),t.child;case 8:return ae(e,t,t.pendingProps.children,n),t.child;case 12:return ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,$(Jr,r._currentValue),r._currentValue=s,i!==null)if(De(i.value,s)){if(i.children===l.children&&!ve.current){t=qe(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){s=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Ge(-1,n&-n),a.tag=2;var f=i.updateQueue;if(f!==null){f=f.shared;var v=f.pending;v===null?a.next=a:(a.next=v.next,v.next=a),f.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Ri(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(y(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ri(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}ae(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,nn(t,n),l=Pe(l),r=r(l),t.flags|=1,ae(e,t,r,n),t.child;case 14:return r=t.type,l=Re(r,t.pendingProps),l=Re(r.type,l),Wo(e,t,r,l,n);case 15:return Ga(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Ir(e,t),t.tag=1,ge(r)?(e=!0,Gr(t)):e=!1,nn(t,n),Qa(t,r,l),Ii(t,r,l,n),Di(null,t,r,!0,e,n);case 19:return ba(e,t,n);case 22:return Xa(e,t,n)}throw Error(y(156,t.tag))};function mc(e,t){return Wu(e,t)}function Hf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 Ee(e,t,n,r){return new Hf(e,t,n,r)}function Vs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qf(e){if(typeof e=="function")return Vs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ss)return 11;if(e===os)return 14}return 2}function ht(e,t){var n=e.alternate;return n===null?(n=Ee(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Dr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Vs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Ut:return zt(n.children,l,i,t);case is:s=8,l|=8;break;case li:return e=Ee(12,n,t,l|2),e.elementType=li,e.lanes=i,e;case ii:return e=Ee(13,n,t,l),e.elementType=ii,e.lanes=i,e;case si:return e=Ee(19,n,t,l),e.elementType=si,e.lanes=i,e;case Nu:return wl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ju:s=10;break e;case Cu:s=9;break e;case ss:s=11;break e;case os:s=14;break e;case tt:s=16,r=null;break e}throw Error(y(130,e==null?e:typeof e,""))}return t=Ee(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function zt(e,t,n,r){return e=Ee(7,e,r,t),e.lanes=n,e}function wl(e,t,n,r){return e=Ee(22,e,r,t),e.elementType=Nu,e.lanes=n,e.stateNode={isHidden:!1},e}function ei(e,t,n){return e=Ee(6,e,null,t),e.lanes=n,e}function ti(e,t,n){return t=Ee(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Kf(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ol(0),this.expirationTimes=Ol(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ol(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ws(e,t,n,r,l,i,s,u,a){return e=new Kf(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ee(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ns(i),e}function Yf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xc)}catch(e){console.error(e)}}xc(),xu.exports=je;var qf=xu.exports,wc,nu=qf;wc=nu.createRoot,nu.hydrateRoot;function Sc(e,t){if(Array.isArray(e))return e;for(const n of t)if(Array.isArray(e==null?void 0:e[n]))return e[n];return[]}function bf(e){return Sc(e,["items","sessions","chats"]).map((t,n)=>({id:String(t.chat_id??t.chatId??t.session_id??t.sessionId??t.automation_id??t.automationId??t.id??n),title:String(t.title??t.name??t.display_name??t.displayName??t.nickname??t.chat_id??t.id??"未命名会话"),preview:String(t.last_message??t.lastMessage??t.preview??"暂无最近消息"),unread:Number(t.unread_count??t.unreadCount??0),type:t.chat_type??t.chatType??"Private"}))}function ep(e){return Sc(e,["items","messages"]).map((t,n)=>{const r=String(t.direction??"").toLowerCase();return{id:String(t.message_id??t.messageId??t.id??n),sender:String(t.sender??t.sender_name??t.senderName??(r==="outgoing"?"我":"对方")),text:typeof t=="string"?t:String(t.content??t.text??t.message??""),at:t.occurred_at??t.occurredAt??t.created_at??t.createdAt??t.source_time??t.sourceTime??t.observed_at??t.observedAt}})}function ru(e,t=0){var r;const n=(e==null?void 0:e.coverage)||((r=e==null?void 0:e.metadata)==null?void 0:r.coverage)||(e==null?void 0:e.sync);return!n||typeof n!="object"?{state:t===0?"unknown":"complete",source:"legacy-result",observedCount:t,authorizedScopeCount:null,matchedScopeCount:null,errorCode:t===0?"CoverageUnavailable":null}:{state:String(n.state||"unknown").toLowerCase(),source:n.source||"unknown",observedCount:Number(n.observedCount??n.observed_count??t),authorizedScopeCount:n.authorizedScopeCount??n.authorized_scope_count??null,matchedScopeCount:n.matchedScopeCount??n.matched_scope_count??null,observedAt:n.observedAt??n.observed_at??n.lastSuccessAt??n.last_success_at??null,lastSuccessAt:n.lastSuccessAt??n.last_success_at??null,backlogCount:n.backlogCount??n.backlog_count??null,errorCode:n.errorCode??n.error_code??null,errorMessage:n.errorMessage??n.error_message??null}}function lu(e,t,n=r=>r.id){const r=[...t],l=new Set(r.map(n));for(const i of e){const s=n(i);l.has(s)||(r.push(i),l.add(s))}return r}function iu(e){return(e==null?void 0:e.state)==="complete"}const kc=[{id:"messages",label:"消息",description:"查找会话、阅读并回复",icon:"message"},{id:"broadcast",label:"群发",description:"创建受控群发任务",icon:"send"},{id:"contacts",label:"通讯录",description:"查找联系人和群聊",icon:"contacts"},{id:"tasks",label:"任务",description:"查看执行结果",icon:"tasks"}],jc={Online:"在线",Degraded:"需要注意",Offline:"已离线",Registered:"已注册",SessionLocked:"桌面已锁定",WechatNotRunning:"微信未运行",WechatNotLoggedIn:"微信未登录",Pending:"待处理",WaitingForClient:"等待 Client",Accepted:"已接收",Running:"执行中",Succeeded:"已完成",Failed:"失败",Cancelled:"已取消",Expired:"已过期",ResultUnconfirmed:"待核对"},tp=new Set(["Succeeded","Failed","Cancelled","Expired","ResultUnconfirmed"]);class Jt extends Error{constructor(t,n,r="RequestFailed"){super(t),this.status=n,this.code=r}}async function Ye(e,{token:t,method:n="GET",body:r}={}){var u,a;const l={};t&&(l.Authorization=`Bearer ${t}`),r!==void 0&&(l["Content-Type"]="application/json");const i=await fetch(e,{method:n,headers:l,body:r===void 0?void 0:JSON.stringify(r)}),s=await i.json().catch(()=>({}));if(!i.ok)throw new Jt(((u=s.error)==null?void 0:u.message)||`请求失败(${i.status})`,i.status,(a=s.error)==null?void 0:a.code);return s}const np=e=>new Promise(t=>window.setTimeout(t,e)),rp={ReportingDisabled:"Client 未启用 Reporting 白名单。请在托盘远程连接页启用并配置白名单。",ReportingConfigInvalid:"Client 的 Reporting 配置无效,请检查托盘远程连接页。",AccountNotAuthorized:"当前账号未加入 Client 的 Reporting 白名单。",ChatNotAuthorized:"当前会话不在 Client 的 Reporting 白名单中。",ChatIdentityUnconfirmed:"当前会话身份尚未确认,暂不能读取。",DataTypeNotAuthorized:"当前读取类型未被 Reporting 白名单授权。"};function lp(e){var n,r;const t=((n=e.result)==null?void 0:n.error_code)||e.status;return rp[t]||((r=e.result)==null?void 0:r.message)||`读取任务${jc[e.status]||"未完成"}。`}async function ip(e,t){var i,s;const n=Date.now()+3e4;let r=250,l={status:"Pending"};for(;Date.now()t?`${e.slice(0,t)}…`:e:"—"}function op(e){return["Online","Succeeded","Accepted"].includes(e)?"positive":["Running","Pending","WaitingForClient","Degraded"].includes(e)?"warning":["Failed","Cancelled","Expired","ResultUnconfirmed","Offline","SessionLocked","WechatNotRunning","WechatNotLoggedIn"].includes(e)?"negative":"neutral"}function Nc(e){return jc[e]||e||"未知"}function ul(e){return!!(e&&["Online","Degraded","Registered"].includes(e.status))}function Ks(e){var t,n;return e?e.active_account_id?e.active_account_id:((n=(t=e.accounts)==null?void 0:t.find(r=>r.active&&r.verified))==null?void 0:n.account_id)||"":""}function up(e){return extractItems(e,["items","contacts","sessions"]).map((t,n)=>({id:String(t.contact_id??t.contactId??t.chat_id??t.chatId??t.id??n),title:String(t.name??t.display_name??t.displayName??t.nickname??t.contact_id??t.id??"未命名联系人"),type:t.chat_type??t.chatType??(t.is_group?"Group":"Private"),detail:String(t.remark??t.alias??t.account_id??t.accountId??"")}))}function B({name:e,size:t=18}){const n={message:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v7a2.5 2.5 0 0 1-2.5 2.5H11l-4.5 3v-3h0A2.5 2.5 0 0 1 4 12.5z"}),o.jsx("path",{d:"M8 8h8M8 11h5"})]}),send:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"m3 4 18 8-18 8 3.5-8z"}),o.jsx("path",{d:"M6.5 12H21"})]}),contacts:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"9",cy:"8",r:"3"}),o.jsx("path",{d:"M3.5 19a5.5 5.5 0 0 1 11 0M17 7v6M14 10h6"})]}),tasks:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"4",y:"3",width:"16",height:"18",rx:"2"}),o.jsx("path",{d:"M8 8h8M8 12h8M8 16h5"})]}),settings:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1"}),o.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),refresh:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M20 11a8 8 0 0 0-14.5-4.5L4 8"}),o.jsx("path",{d:"M4 4v4h4M4 13a8 8 0 0 0 14.5 4.5L20 16"}),o.jsx("path",{d:"M20 20v-4h-4"})]}),chevron:o.jsx("path",{d:"m9 6 6 6-6 6"}),search:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),o.jsx("path",{d:"m16 16 4.5 4.5"})]}),shield:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 3 19 6v5c0 4.2-2.8 7.8-7 9-4.2-1.2-7-4.8-7-9V6z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]}),alert:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 4 21 20H3z"}),o.jsx("path",{d:"M12 10v4M12 17v.2"})]}),close:o.jsx(o.Fragment,{children:o.jsx("path",{d:"m6 6 12 12M18 6 6 18"})}),logout:o.jsx(o.Fragment,{children:o.jsx("path",{d:"M10 4H5v16h5M14 8l4 4-4 4M8 12h10"})}),arrow:o.jsx(o.Fragment,{children:o.jsx("path",{d:"M4 12h15M13 6l6 6-6 6"})}),check:o.jsx("path",{d:"m5 12 4 4L19 6"})};return o.jsx("svg",{"aria-hidden":"true",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n[e]||n.settings})}function fn({value:e}){return o.jsxs("span",{className:`status-badge ${op(e)}`,children:[o.jsx("i",{}),Nc(e)]})}function ap({onLogin:e}){const[t,n]=T.useState(""),[r,l]=T.useState(""),[i,s]=T.useState(""),[u,a]=T.useState(!1),f=async v=>{v.preventDefault(),s(""),a(!0);try{const h=await Ye("/v1/auth/login",{method:"POST",body:{username:t,password:r}});e(h.access_token,t)}catch(h){s(h.message)}finally{a(!1)}};return o.jsx("main",{className:"login-page",children:o.jsxs("section",{className:"login-panel","aria-labelledby":"login-title",children:[o.jsx("div",{className:"brand-mark",children:"W"}),o.jsx("p",{className:"eyebrow",children:"WXAGENT WORKSPACE"}),o.jsx("h1",{id:"login-title",children:"进入工作台"}),o.jsx("p",{className:"login-intro",children:"连接已授权的 Client,处理消息、通讯录和任务结果。"}),o.jsxs("form",{onSubmit:f,className:"login-form",children:[o.jsxs("label",{children:["用户名",o.jsx("input",{autoFocus:!0,value:t,onChange:v=>n(v.target.value),autoComplete:"username"})]}),o.jsxs("label",{children:["密码",o.jsx("input",{type:"password",value:r,onChange:v=>l(v.target.value),autoComplete:"current-password"})]}),i&&o.jsx("div",{className:"form-error",role:"alert",children:i}),o.jsx("button",{className:"primary-button full",disabled:u||!t||!r,children:u?"登录中…":"登录工作台"})]}),o.jsxs("p",{className:"login-footnote",children:[o.jsx("span",{className:"secure-dot"})," 会话只保存在当前浏览器标签页"]})]})})}function cp({view:e,setView:t,onLogout:n,username:r}){return o.jsxs("aside",{className:"sidebar",children:[o.jsxs("div",{className:"sidebar-brand",children:[o.jsx("div",{className:"brand-mark small",children:"W"}),o.jsxs("div",{children:[o.jsx("strong",{children:"WxAgent"}),o.jsx("span",{children:"用户工作台"})]})]}),o.jsx("p",{className:"nav-caption",children:"工作区"}),o.jsx("nav",{"aria-label":"主导航",children:kc.map(l=>o.jsxs("button",{className:e===l.id?"nav-item active":"nav-item",onClick:()=>t(l.id),children:[o.jsx(B,{name:l.icon,size:18}),o.jsx("span",{children:l.label})]},l.id))}),o.jsx("div",{className:"sidebar-spacer"}),o.jsxs("button",{className:e==="settings"?"nav-item active":"nav-item",onClick:()=>t("settings"),children:[o.jsx(B,{name:"settings",size:18}),o.jsx("span",{children:"设置与诊断"})]}),o.jsxs("div",{className:"connection-hint",children:[o.jsx("span",{className:"secure-dot"}),o.jsxs("div",{children:[o.jsx("strong",{children:"安全连接"}),o.jsx("small",{children:"控制面 API 已认证"})]})]}),o.jsxs("div",{className:"user-menu",children:[o.jsx("div",{className:"avatar",children:(r||"A").slice(0,1).toUpperCase()}),o.jsxs("div",{className:"user-name",children:[o.jsx("strong",{children:r||"管理员"}),o.jsx("small",{children:"已登录"})]}),o.jsx("button",{title:"退出登录","aria-label":"退出登录",onClick:n,children:o.jsx(B,{name:"logout",size:17})})]})]})}function dp({title:e,subtitle:t,nodes:n,selectedClientId:r,onClientChange:l,onRefresh:i,loading:s}){const u=n.find(a=>a.node_id===r);return o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"topbar-copy",children:[o.jsx("h1",{children:e}),o.jsx("p",{children:t})]}),o.jsxs("div",{className:"topbar-actions",children:[o.jsxs("label",{className:"client-switcher",children:[o.jsx("span",{children:"当前 Client"}),o.jsxs("select",{value:r,onChange:a=>l(a.target.value),disabled:!n.length,children:[!n.length&&o.jsx("option",{value:"",children:"暂无 Client"}),n.map(a=>o.jsxs("option",{value:a.node_id,children:[a.node_id," · ",Nc(a.status)]},a.node_id))]})]}),u&&o.jsx(fn,{value:u.status}),o.jsxs("button",{className:"refresh-button",onClick:i,disabled:s,"aria-label":"刷新数据",children:[o.jsx("span",{className:s?"spin":"",children:o.jsx(B,{name:"refresh",size:16})}),s?"同步中":"刷新"]})]})]})}function fp({nodes:e,selectedNode:t,onSettings:n}){if(!e.length)return o.jsxs("div",{className:"connection-banner negative",children:[o.jsx(B,{name:"alert",size:18}),o.jsxs("div",{children:[o.jsx("strong",{children:"还没有可用 Client"}),o.jsx("span",{children:"请启动已配置的 Desktop Agent;浏览器不会模拟连接状态。"})]}),o.jsx("button",{className:"text-button",onClick:n,children:"查看连接说明"})]});if(!ul(t)){const r=e.some(ul);return o.jsxs("div",{className:"connection-banner warning",children:[o.jsx(B,{name:"alert",size:18}),o.jsxs("div",{children:[o.jsx("strong",{children:"当前 Client 不可用"}),o.jsx("span",{children:r?"其它 Client 不受影响,请从顶部切换。":"所有 Client 当前都不可用,请先恢复连接。"})]}),o.jsx("button",{className:"text-button",onClick:n,children:"设置与诊断"})]})}return Ks(t)?null:o.jsxs("div",{className:"connection-banner warning",children:[o.jsx(B,{name:"alert",size:18}),o.jsxs("div",{children:[o.jsx("strong",{children:"当前 Client 尚未确认微信账号"}),o.jsx("span",{children:"只读数据需要已验证的活动账号,先完成账号绑定后再操作。"})]}),o.jsx("button",{className:"text-button",onClick:n,children:"查看账号"})]})}function Xi({title:e="没有选中的 Client",text:t="请先连接并选择一个可用 Client。",onSettings:n}){return o.jsxs("div",{className:"context-empty",children:[o.jsx("div",{className:"empty-icon",children:o.jsx(B,{name:"shield",size:28})}),o.jsx("h3",{children:e}),o.jsx("p",{children:t}),n&&o.jsx("button",{className:"secondary-button",onClick:n,children:"打开设置与诊断"})]})}function Zi({text:e="正在读取…"}){return o.jsxs("div",{className:"loading-state",children:[o.jsx("span",{className:"loader"}),e]})}function Ot({text:e,action:t}){return o.jsxs("div",{className:"empty-state",children:[o.jsx("div",{className:"empty-icon",children:o.jsx(B,{name:"search",size:26})}),o.jsx("p",{children:e}),t]})}function Ji({error:e,onRetry:t}){return o.jsxs("div",{className:"inline-error",role:"alert",children:[o.jsx(B,{name:"alert",size:17}),o.jsx("span",{children:e}),t&&o.jsx("button",{className:"text-button",onClick:t,children:"重试"})]})}function Nr({text:e,onRetry:t}){return o.jsxs("div",{className:"read-notice",role:"status",children:[o.jsx(B,{name:"alert",size:16}),o.jsx("span",{children:e}),t&&o.jsx("button",{className:"text-button",onClick:t,children:"重试"})]})}function ou(e,t){if(!t)return"";const n=t.lastSuccessAt?`最后同步 ${It(t.lastSuccessAt)}`:"尚未成功同步",r=t.backlogCount==null?"积压未知":`积压 ${t.backlogCount}`,l=`${n} · ${r}`;return t.state==="complete"?t.source==="platform-cache"?`${e}来自平台副本,${l}。`:"":t.state==="partial"?`${e}同步不完整,已保留已有数据;${l}。`:`${e}同步状态未知,未用本次结果清除已有数据;${l}${t.errorMessage?` · ${t.errorMessage}`:""}。`}function pp({token:e,client:t,onSettings:n}){const r=(t==null?void 0:t.node_id)||"",l=Ks(t),[i,s]=T.useState([]),[u,a]=T.useState({loading:!1,error:"",notice:""}),[f,v]=T.useState(""),[h,m]=T.useState(null),[x,k]=T.useState([]),[S,P]=T.useState({loading:!1,error:"",notice:""}),d=T.useRef(0),c=T.useRef(0),p=T.useRef(0),g=T.useRef(0),j=T.useCallback(async()=>{if(!l||!r)return;const w=++g.current;try{await Ye(ni(l,"refresh"),{token:e,method:"POST"})}catch(I){w===g.current&&a(z=>({...z,notice:z.notice||`后台同步未受理:${I.message}`}))}},[l,r,e]),C=T.useCallback(async()=>{if(!r||!l)return;const w=++c.current,I=d.current;a(z=>({...z,loading:!0,error:""}));try{const z=await su({storedPath:ni(l,"conversations","?limit=100&offset=0"),legacyPath:"/v1/reads/sessions",legacyBody:{node_id:r,account_id:l,limit:100},token:e});if(w!==c.current||I!==d.current)return;const Y=bf(z);z.sync&&z.sync.state!=="complete"&&j();const O=ru(z,Y.length);s(pe=>iu(O)?Y:lu(pe,Y)),a({loading:!1,error:"",notice:ou("会话",O)})}catch(z){w===c.current&&I===d.current&&a({loading:!1,error:z.message,notice:""})}},[l,r,j,e]);if(T.useEffect(()=>{d.current+=1,c.current+=1,p.current+=1,m(null),s([]),k([]),a({loading:!1,error:"",notice:""}),P({loading:!1,error:"",notice:""}),!(!r||!l)&&C()},[r,l,C]),T.useEffect(()=>{if(!h||h.clientId!==r||h.accountId!==l||!r||!l)return;const w=++p.current,I=d.current;P(z=>({...z,loading:!0,error:""})),su({storedPath:ni(l,"messages",`?chat_id=${encodeURIComponent(h.id)}&limit=100&offset=0`),legacyPath:"/v1/reads/messages",legacyBody:{node_id:r,account_id:l,chat_id:h.id,limit:100,include_content:!0},token:e}).then(z=>{if(w!==p.current||I!==d.current)return;const Y=ep(z),O=ru(z,Y.length);k(pe=>iu(O)?Y:lu(pe,Y)),P({loading:!1,error:"",notice:ou("消息",O)})}).catch(z=>{w===p.current&&I===d.current&&P({loading:!1,error:z.message,notice:""})})},[l,r,h,e]),!t)return o.jsx(Xi,{onSettings:n});const E=i.filter(w=>!f||`${w.title} ${w.id}`.toLowerCase().includes(f.toLowerCase()));return o.jsxs("div",{className:"message-workspace",children:[o.jsxs("section",{className:"session-panel",children:[o.jsxs("div",{className:"section-heading compact",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"会话"}),o.jsx("p",{children:i.length?`${i.length} 个会话`:"当前 Client 的会话"})]}),o.jsx("button",{className:"icon-button",onClick:C,disabled:u.loading,"aria-label":"刷新会话",children:o.jsx(B,{name:"refresh",size:16})})]}),o.jsxs("label",{className:"search-box",children:[o.jsx(B,{name:"search",size:16}),o.jsx("input",{value:f,onChange:w=>v(w.target.value),placeholder:"搜索会话"})]}),u.loading&&i.length===0?o.jsx(Zi,{text:"正在读取会话…"}):u.error&&i.length===0?o.jsx(Ji,{error:u.error,onRetry:C}):o.jsxs(o.Fragment,{children:[u.error&&o.jsx(Nr,{text:`读取会话失败,继续显示上次数据:${u.error}`,onRetry:C}),!u.error&&u.notice&&o.jsx(Nr,{text:u.notice,onRetry:C}),u.loading&&i.length>0&&o.jsx("div",{className:"refresh-hint",children:"正在刷新,会话列表保持可用…"}),E.length===0?o.jsx(Ot,{text:"暂无会话,或当前账号还没有可见数据。"}):o.jsx("div",{className:"session-list",children:E.map(w=>o.jsxs("button",{className:(h==null?void 0:h.id)===w.id?"session-row selected":"session-row",onClick:()=>m({...w,clientId:r,accountId:l}),children:[o.jsx("span",{className:"session-avatar",children:w.title.slice(0,1).toUpperCase()}),o.jsxs("span",{className:"session-copy",children:[o.jsx("strong",{children:w.title}),o.jsx("small",{children:w.preview})]}),w.unread>0&&o.jsx("b",{children:w.unread})]},w.id))})]})]}),o.jsx("section",{className:"conversation-panel",children:h?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"conversation-head",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"eyebrow",children:["当前 Client · ",r]}),o.jsx("h2",{children:h.title}),o.jsxs("span",{children:[h.type==="Group"?"群聊":"私聊"," · ",Nl(h.id,28)]})]}),o.jsx(fn,{value:t.status})]}),S.loading&&x.length===0?o.jsx(Zi,{text:"正在读取消息…"}):S.error&&x.length===0?o.jsx(Ji,{error:S.error,onRetry:()=>m({...h})}):o.jsxs(o.Fragment,{children:[S.error&&o.jsx(Nr,{text:`读取消息失败,继续显示上次数据:${S.error}`,onRetry:()=>m({...h})}),!S.error&&S.notice&&o.jsx(Nr,{text:S.notice,onRetry:()=>m({...h})}),S.loading&&x.length>0&&o.jsx("div",{className:"refresh-hint",children:"正在刷新,消息历史保持可用…"}),x.length===0?o.jsx(Ot,{text:"这个会话暂时没有可显示的消息。"}):o.jsx("div",{className:"message-list",children:x.map(w=>o.jsxs("article",{className:"message-row",children:[o.jsx("div",{className:"message-avatar",children:w.sender.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsxs("div",{className:"message-meta",children:[o.jsx("strong",{children:w.sender}),o.jsx("span",{children:It(w.at)})]}),o.jsx("p",{children:w.text||"(无正文)"})]})]},w.id))})]}),o.jsxs("div",{className:"composer",children:[o.jsx("textarea",{disabled:!0,rows:2,placeholder:"发送消息暂未开放,需完成 Windows 真机验收"}),o.jsx("button",{className:"primary-button",disabled:!0,title:"写操作尚未通过真机验收",children:"发送"})]})]}):o.jsx(Xi,{title:"选择一个会话",text:"从左侧选择会话后,读取该 Client 的消息。"})})]})}function hp({client:e,onSettings:t}){return o.jsxs("section",{className:"workspace-panel gated-panel",children:[o.jsx("div",{className:"gated-mark",children:o.jsx(B,{name:"shield",size:24})}),o.jsxs("div",{children:[o.jsx("p",{className:"eyebrow",children:"CONTROLLED ACTION"}),o.jsx("h2",{children:"受控群发验证"}),o.jsx("p",{children:"单 Client 的 Client 端已提供 broadcast-text:冻结获准对象名单,逐项串行发送,返回每个对象的结果,并支持停止和幂等重放。"}),o.jsxs("div",{className:"step-list",children:[o.jsxs("span",{children:[o.jsx("b",{children:"1"}),"冻结对象"]}),o.jsxs("span",{children:[o.jsx("b",{children:"2"}),"预览确认"]}),o.jsxs("span",{children:[o.jsx("b",{children:"3"}),"逐项发送"]}),o.jsxs("span",{children:[o.jsx("b",{children:"4"}),"查看结果"]})]}),o.jsx("button",{className:"primary-button",disabled:!0,children:e?"Web 提交仍需单独验收":"请先连接 Client"}),o.jsxs("button",{className:"text-button",onClick:t,children:["查看 Client 验证状态 ",o.jsx(B,{name:"arrow",size:14})]})]})]})}function mp({token:e,client:t,onSettings:n}){const r=(t==null?void 0:t.node_id)||"",l=Ks(t),[i,s]=T.useState(!1),[u,a]=T.useState(""),[f,v]=T.useState([]),[h,m]=T.useState({loading:!1,error:""}),x=T.useRef(0),k=T.useCallback(async()=>{if(!r||!l)return;const P=++x.current;m({loading:!0,error:""});try{const d=await Cc("/v1/reads/contacts",{node_id:r,account_id:l,limit:200,groups_only:i,contains:u},e);if(P!==x.current)return;v(up(d)),m({loading:!1,error:""})}catch(d){P===x.current&&m({loading:!1,error:d.message})}},[l,r,i,u,e]);if(T.useEffect(()=>{v([]),r&&l&&k()},[r,l,i]),!t)return o.jsx(Xi,{onSettings:n});const S=f.filter(P=>!u||`${P.title} ${P.id} ${P.detail}`.toLowerCase().includes(u.toLowerCase()));return o.jsxs("section",{className:"workspace-panel",children:[o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"通讯录"}),o.jsx("p",{children:"只读查看当前 Client 已授权的联系人和群聊。"})]}),o.jsxs("div",{className:"heading-actions",children:[o.jsxs("label",{className:"check-filter",children:[o.jsx("input",{type:"checkbox",checked:i,onChange:P=>s(P.target.checked)}),"只看群聊"]}),o.jsx("button",{className:"secondary-button",disabled:!0,title:"添加好友尚未通过真机验收",children:"添加好友"})]})]}),o.jsxs("div",{className:"toolbar",children:[o.jsxs("label",{className:"search-box wide",children:[o.jsx(B,{name:"search",size:16}),o.jsx("input",{value:u,onChange:P=>a(P.target.value),onKeyDown:P=>P.key==="Enter"&&k(),placeholder:"搜索联系人或群聊"})]}),o.jsx("button",{className:"secondary-button",onClick:k,disabled:h.loading,children:h.loading?"读取中…":"刷新"})]}),h.loading?o.jsx(Zi,{text:"正在读取通讯录…"}):h.error?o.jsx(Ji,{error:h.error,onRetry:k}):S.length===0?o.jsx(Ot,{text:"暂无可见联系人或群聊。"}):o.jsx("div",{className:"contact-list",children:S.map(P=>o.jsxs("div",{className:"contact-row",children:[o.jsx("span",{className:"contact-avatar",children:P.title.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsx("strong",{children:P.title}),o.jsxs("small",{children:[P.type==="Group"?"群聊":"联系人"," · ",Nl(P.id,28),P.detail?` · ${P.detail}`:""]})]}),o.jsx("button",{className:"text-button",disabled:!0,title:"写操作尚未通过真机验收",children:"添加好友"})]},P.id))})]})}function vp({tasks:e,selectedClientId:t}){const[n,r]=T.useState("all"),l=e.filter(i=>i.node_id===t&&(n==="all"||i.status===n));return o.jsxs("section",{className:"workspace-panel",children:[o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"任务结果"}),o.jsx("p",{children:"当前 Client 的任务状态和安全边界。"})]}),o.jsxs("div",{className:"heading-actions",children:[o.jsxs("span",{className:"read-only-note",children:[o.jsx(B,{name:"shield",size:14}),"只读视图"]}),o.jsxs("select",{value:n,onChange:i=>r(i.target.value),children:[o.jsx("option",{value:"all",children:"全部状态"}),o.jsx("option",{value:"Pending",children:"待处理"}),o.jsx("option",{value:"WaitingForClient",children:"等待 Client"}),o.jsx("option",{value:"Running",children:"执行中"}),o.jsx("option",{value:"Succeeded",children:"已完成"}),o.jsx("option",{value:"Failed",children:"失败"}),o.jsx("option",{value:"ResultUnconfirmed",children:"待核对"})]})]})]}),l.length===0?o.jsx(Ot,{text:"当前 Client 暂无任务记录。"}):o.jsx("div",{className:"task-list",children:l.map(i=>{var s,u;return o.jsxs("article",{className:"task-row",children:[o.jsxs("div",{className:"task-main",children:[o.jsxs("div",{className:"task-title",children:[o.jsx("strong",{children:i.kind}),o.jsx(fn,{value:i.status})]}),o.jsxs("p",{children:[i.account_id," · ",Nl(i.task_id,22)]}),o.jsx("small",{children:i.status==="WaitingForClient"?"Client 离线后等待显式恢复;不会自动重放写操作。":((s=i.result)==null?void 0:s.message)||((u=i.result)==null?void 0:u.error_code)||`更新于 ${It(i.updated_at)}`})]}),o.jsxs("div",{className:"task-meta",children:[o.jsxs("span",{children:["第 ",i.lease_generation||0," 代租约"]}),o.jsx("time",{children:It(i.updated_at)})]})]},i.task_id)})})]})}function gp({nodes:e}){return o.jsx("div",{className:"diagnostic-list",children:e.length===0?o.jsx(Ot,{text:"暂无注册 Client。"}):e.map(t=>o.jsxs("article",{className:"diagnostic-row",children:[o.jsxs("div",{className:"diagnostic-title",children:[o.jsx("span",{className:"node-avatar",children:t.node_id.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsx("strong",{children:t.node_id}),o.jsxs("small",{children:[t.active_account_id||"尚未确认活动账号"," · 最近心跳 ",It(t.last_heartbeat_at)]})]})]}),o.jsx(fn,{value:t.status})]},t.node_id))})}function yp({events:e,selectedClientId:t}){const n=e.filter(r=>!t||r.node_id===t);return o.jsx("div",{className:"diagnostic-list",children:n.length===0?o.jsx(Ot,{text:"当前 Client 暂无事件。"}):n.slice(0,30).map(r=>o.jsxs("article",{className:"diagnostic-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Nl(r.chat_id,24)}),o.jsxs("small",{children:[r.node_id," · ",r.chat_type==="Group"?"群聊":"私聊"," · ",It(r.received_at)]})]}),o.jsx("span",{className:"event-preview",children:r.content||"无正文"})]},r.event_id))})}function xp({audit:e}){return o.jsx("div",{className:"diagnostic-list",children:e.length===0?o.jsx(Ot,{text:"暂无审计记录。"}):e.slice(0,30).map(t=>o.jsxs("article",{className:"diagnostic-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.action}),o.jsxs("small",{children:[t.principal," · ",t.resource]})]}),o.jsx("span",{children:It(t.at)})]},t.id))})}function wp({nodes:e,events:t,audit:n,selectedClientId:r,onSelectClient:l}){const[i,s]=T.useState("connection");return o.jsxs("section",{className:"settings-layout",children:[o.jsxs("aside",{className:"settings-nav",children:[o.jsxs("button",{className:i==="connection"?"settings-tab active":"settings-tab",onClick:()=>s("connection"),children:[o.jsx("strong",{children:"连接与账号"}),o.jsx("span",{children:"选择 Client、确认状态"})]}),o.jsxs("button",{className:i==="diagnostics"?"settings-tab active":"settings-tab",onClick:()=>s("diagnostics"),children:[o.jsx("strong",{children:"高级诊断"}),o.jsx("span",{children:"节点、事件、AI、审计"})]})]}),o.jsx("div",{className:"settings-content",children:i==="connection"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"workspace-panel",children:[o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"连接与账号"}),o.jsx("p",{children:"每个 Client 独立连接,单个 Client 离线不会阻断其它 Client。"})]}),o.jsx(fn,{value:e.some(ul)?"Online":"Offline"})]}),o.jsx(gp,{nodes:e})]}),o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"安全边界"}),o.jsx("p",{children:"当前版本只开放真实后端已支持且可验证的只读能力。"})]})}),o.jsxs("ul",{className:"boundary-list",children:[o.jsxs("li",{children:[o.jsx(B,{name:"check",size:15}),"消息、通讯录、任务结果按选定 Client 隔离读取"]}),o.jsxs("li",{children:[o.jsx(B,{name:"check",size:15}),"Client 掉线只影响当前上下文,任务不会自动改投"]}),o.jsxs("li",{children:[o.jsx(B,{name:"alert",size:15}),"发送、群发、添加好友等待 Windows 真机验收"]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"Client 诊断"}),o.jsx("p",{children:"技术状态只在这里展示,不干扰普通操作。"})]})}),o.jsx("div",{className:"client-pills",children:e.map(u=>o.jsxs("button",{className:u.node_id===r?"client-pill active":"client-pill",onClick:()=>l(u.node_id),children:[o.jsx("span",{children:u.node_id}),o.jsx(fn,{value:u.status})]},u.node_id))})]}),o.jsx("div",{className:"workspace-panel",children:o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"AI 能力"}),o.jsx("p",{children:"AI 入口保留在高级诊断中;当前不自动调用,也不影响消息、通讯录和任务操作。"})]}),o.jsxs("span",{className:"read-only-note",children:[o.jsx(B,{name:"shield",size:14}),"按能力矩阵开放"]})]})}),o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"白名单事件"}),o.jsx("p",{children:"当前选中 Client 的已授权事件。"})]})}),o.jsx(yp,{events:t,selectedClientId:r})]}),o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"操作审计"}),o.jsx("p",{children:"用于定位连接、任务和权限问题。"})]})}),o.jsx(xp,{audit:n})]})]})})]})}function Sp(){const[e,t]=T.useState(()=>sessionStorage.getItem("wxagent-token")||""),[n,r]=T.useState(()=>sessionStorage.getItem("wxagent-user")||""),[l,i]=T.useState("messages"),[s,u]=T.useState([]),[a,f]=T.useState(()=>sessionStorage.getItem("wxagent-client")||""),[v,h]=T.useState([]),[m,x]=T.useState([]),[k,S]=T.useState([]),[P,d]=T.useState(!1),[c,p]=T.useState(""),g=T.useCallback(()=>{sessionStorage.removeItem("wxagent-token"),sessionStorage.removeItem("wxagent-user"),sessionStorage.removeItem("wxagent-client"),t(""),r("")},[]),j=T.useCallback(async()=>{if(e){d(!0),p("");try{const[O,pe,ir,_l]=await Promise.all([Ye("/v1/nodes",{token:e}),Ye("/v1/tasks?limit=200",{token:e}),Ye("/v1/events?limit=200",{token:e}),Ye("/v1/audit?limit=200",{token:e})]);u(O.nodes||[]),h(pe.tasks||[]),x(ir.events||[]),S(_l.audit||[])}catch(O){O.status===401?g():p(O.message)}finally{d(!1)}}},[g,e]);T.useEffect(()=>{if(j(),!e)return;const O=window.setInterval(j,15e3);return()=>window.clearInterval(O)},[j,e]),T.useEffect(()=>{if(!s.length){f("");return}if(!s.some(O=>O.node_id===a)){const O=s.find(ul)||s[0];f(O.node_id),sessionStorage.setItem("wxagent-client",O.node_id)}},[s,a]);const C=O=>{f(O),sessionStorage.setItem("wxagent-client",O)},E=(O,pe)=>{sessionStorage.setItem("wxagent-token",O),sessionStorage.setItem("wxagent-user",pe),t(O),r(pe)},w=T.useMemo(()=>s.find(O=>O.node_id===a),[s,a]),I=kc.find(O=>O.id===l),z=(I==null?void 0:I.label)||"设置与诊断",Y=(I==null?void 0:I.description)||"连接、账号和高级诊断信息";return e?o.jsxs("div",{className:"app-shell",children:[o.jsx(cp,{view:l,setView:i,onLogout:g,username:n}),o.jsxs("main",{className:"main-area",children:[o.jsx(dp,{title:z,subtitle:Y,nodes:s,selectedClientId:a,onClientChange:C,onRefresh:j,loading:P}),c&&o.jsxs("div",{className:"global-error",role:"alert",children:[o.jsx(B,{name:"alert",size:16}),o.jsx("span",{children:c}),o.jsx("button",{onClick:()=>p(""),"aria-label":"关闭错误",children:o.jsx(B,{name:"close",size:16})})]}),o.jsx(fp,{nodes:s,selectedNode:w,onSettings:()=>i("settings")}),o.jsxs("div",{className:"page-content",children:[l==="messages"&&o.jsx(pp,{token:e,client:w,onSettings:()=>i("settings")}),l==="broadcast"&&o.jsx(hp,{client:w,onSettings:()=>i("settings")}),l==="contacts"&&o.jsx(mp,{token:e,client:w,onSettings:()=>i("settings")}),l==="tasks"&&o.jsx(vp,{tasks:v,selectedClientId:a}),l==="settings"&&o.jsx(wp,{nodes:s,events:m,audit:k,selectedClientId:a,onSelectClient:C})]}),o.jsxs("footer",{className:"footer",children:[o.jsx("span",{children:"WxAgent 工作台 · Client 独立隔离"}),o.jsx("span",{children:"写操作需通过真实能力与真机验收"})]})]})]}):o.jsx(ap,{onLogin:E})}wc(document.getElementById("root")).render(o.jsx(Sp,{})); +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function ql(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Oi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Ef=typeof WeakMap=="function"?WeakMap:Map;function Ka(e,t,n){n=Ge(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ll||(ll=!0,Qi=r),Oi(e,t)},n}function Ya(e,t,n){n=Ge(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Oi(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Oi(e,t),typeof r!="function"&&(ft===null?ft=new Set([this]):ft.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function $o(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ef;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Vf.bind(null,e,t,n),t.then(e,e))}function Ao(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Uo(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Ge(-1,1),t.tag=2,dt(n,t,1))),n.lanes|=1),e)}var zf=be.ReactCurrentOwner,me=!1;function ae(e,t,n,r){t.child=e===null?ka(t,null,n,r):un(t,e.child,n,r)}function Vo(e,t,n,r,l){n=n.render;var i=t.ref;return nn(t,l),r=Ts(e,t,n,r,i,l),n=Ls(),e!==null&&!me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,qe(e,t,l)):(V&&n&&ys(t),t.flags|=1,ae(e,t,r,l),t.child)}function Wo(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!Vs(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Ga(e,t,i,r,l)):(e=Dr(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Hn,n(s,r)&&e.ref===t.ref)return qe(e,t,l)}return t.flags|=1,e=ht(i,r),e.ref=t.ref,e.return=t,t.child=e}function Ga(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(Hn(i,r)&&e.ref===t.ref)if(me=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(me=!0);else return t.lanes=e.lanes,qe(e,t,l)}return Fi(e,t,n,r,l)}function Xa(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},$(Zt,xe),xe|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,$(Zt,xe),xe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,$(Zt,xe),xe|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,$(Zt,xe),xe|=r;return ae(e,t,l,n),t.child}function Za(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Fi(e,t,n,r,l){var i=ge(n)?Pt:ue.current;return i=sn(t,i),nn(t,l),n=Ts(e,t,n,r,i,l),r=Ls(),e!==null&&!me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,qe(e,t,l)):(V&&r&&ys(t),t.flags|=1,ae(e,t,n,l),t.child)}function Bo(e,t,n,r,l){if(ge(n)){var i=!0;Gr(t)}else i=!1;if(nn(t,l),t.stateNode===null)Ir(e,t),Qa(t,n,r),Ii(t,n,r,l),r=!0;else if(e===null){var s=t.stateNode,u=t.memoizedProps;s.props=u;var a=s.context,f=n.contextType;typeof f=="object"&&f!==null?f=Pe(f):(f=ge(n)?Pt:ue.current,f=sn(t,f));var v=n.getDerivedStateFromProps,h=typeof v=="function"||typeof s.getSnapshotBeforeUpdate=="function";h||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u!==r||a!==f)&&Do(t,s,r,f),nt=!1;var m=t.memoizedState;s.state=m,br(t,r,s,l),a=t.memoizedState,u!==r||m!==a||ve.current||nt?(typeof v=="function"&&(Mi(t,n,v,r),a=t.memoizedState),(u=nt||Fo(t,n,u,r,m,a,f))?(h||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),s.props=r,s.state=a,s.context=f,r=u):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Ca(e,t),u=t.memoizedProps,f=t.type===t.elementType?u:Re(t.type,u),s.props=f,h=t.pendingProps,m=s.context,a=n.contextType,typeof a=="object"&&a!==null?a=Pe(a):(a=ge(n)?Pt:ue.current,a=sn(t,a));var x=n.getDerivedStateFromProps;(v=typeof x=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u!==h||m!==a)&&Do(t,s,r,a),nt=!1,m=t.memoizedState,s.state=m,br(t,r,s,l);var k=t.memoizedState;u!==h||m!==k||ve.current||nt?(typeof x=="function"&&(Mi(t,n,x,r),k=t.memoizedState),(f=nt||Fo(t,n,f,r,m,k,a)||!1)?(v||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,k,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,k,a)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=k),s.props=r,s.state=k,s.context=a,r=f):(typeof s.componentDidUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return Di(e,t,n,r,i,l)}function Di(e,t,n,r,l,i){Za(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return l&&zo(t,n,!1),qe(e,t,i);r=t.stateNode,zf.current=t;var u=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=un(t,e.child,null,i),t.child=un(t,null,u,i)):ae(e,t,u,i),t.memoizedState=r.state,l&&zo(t,n,!0),t.child}function Ja(e){var t=e.stateNode;t.pendingContext?Eo(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Eo(e,t.context,!1),_s(e,t.containerInfo)}function Ho(e,t,n,r,l){return on(),ws(l),t.flags|=256,ae(e,t,n,r),t.child}var $i={dehydrated:null,treeContext:null,retryLane:0};function Ai(e){return{baseLanes:e,cachePool:null,transitions:null}}function qa(e,t,n){var r=t.pendingProps,l=W.current,i=!1,s=(t.flags&128)!==0,u;if((u=s)||(u=e!==null&&e.memoizedState===null?!1:(l&2)!==0),u?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),$(W,l&1),e===null)return Li(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=wl(s,r,0,null),e=zt(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ai(n),t.memoizedState=$i,e):Is(t,s));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return Pf(e,t,s,r,u,l,n);if(i){i=r.fallback,s=t.mode,l=e.child,u=l.sibling;var a={mode:"hidden",children:r.children};return!(s&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=ht(l,a),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?i=ht(u,i):(i=zt(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Ai(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=$i,r}return i=e.child,e=i.sibling,r=ht(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Is(e,t){return t=wl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Sr(e,t,n,r){return r!==null&&ws(r),un(t,e.child,null,n),e=Is(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Pf(e,t,n,r,l,i,s){if(n)return t.flags&256?(t.flags&=-257,r=ql(Error(y(422))),Sr(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=wl({mode:"visible",children:r.children},l,0,null),i=zt(i,l,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&un(t,e.child,null,s),t.child.memoizedState=Ai(s),t.memoizedState=$i,i);if(!(t.mode&1))return Sr(e,t,s,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var u=r.dgst;return r=u,i=Error(y(419)),r=ql(i,r,void 0),Sr(e,t,s,r)}if(u=(s&e.childLanes)!==0,me||u){if(r=te,r!==null){switch(s&-s){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|s)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,Je(e,l),Fe(r,e,l,-1))}return Us(),r=ql(Error(y(421))),Sr(e,t,s,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Wf.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,we=ct(l.nextSibling),Se=t,V=!0,Ie=null,e!==null&&(Ne[_e++]=Qe,Ne[_e++]=Ke,Ne[_e++]=Tt,Qe=e.id,Ke=e.overflow,Tt=t),t=Is(t,r.children),t.flags|=4096,t)}function Qo(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ri(e.return,t,n)}function bl(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function ba(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(ae(e,t,r.children,n),r=W.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Qo(e,n,t);else if(e.tag===19)Qo(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if($(W,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&el(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),bl(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&el(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}bl(t,!0,n,null,i);break;case"together":bl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ir(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function qe(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Rt|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(y(153));if(t.child!==null){for(e=t.child,n=ht(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ht(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tf(e,t,n){switch(t.tag){case 3:Ja(t),on();break;case 5:Na(t);break;case 1:ge(t.type)&&Gr(t);break;case 4:_s(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;$(Jr,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?($(W,W.current&1),t.flags|=128,null):n&t.child.childLanes?qa(e,t,n):($(W,W.current&1),e=qe(e,t,n),e!==null?e.sibling:null);$(W,W.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ba(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),$(W,W.current),r)break;return null;case 22:case 23:return t.lanes=0,Xa(e,t,n)}return qe(e,t,n)}var ec,Ui,tc,nc;ec=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Ui=function(){};tc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,_t(We.current);var i=null;switch(n){case"input":l=ui(e,l),r=ui(e,r),i=[];break;case"select":l=Q({},l,{value:void 0}),r=Q({},r,{value:void 0}),i=[];break;case"textarea":l=di(e,l),r=di(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Kr)}pi(n,r);var s;n=null;for(f in l)if(!r.hasOwnProperty(f)&&l.hasOwnProperty(f)&&l[f]!=null)if(f==="style"){var u=l[f];for(s in u)u.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else f!=="dangerouslySetInnerHTML"&&f!=="children"&&f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(Dn.hasOwnProperty(f)?i||(i=[]):(i=i||[]).push(f,null));for(f in r){var a=r[f];if(u=l!=null?l[f]:void 0,r.hasOwnProperty(f)&&a!==u&&(a!=null||u!=null))if(f==="style")if(u){for(s in u)!u.hasOwnProperty(s)||a&&a.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in a)a.hasOwnProperty(s)&&u[s]!==a[s]&&(n||(n={}),n[s]=a[s])}else n||(i||(i=[]),i.push(f,n)),n=a;else f==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,u=u?u.__html:void 0,a!=null&&u!==a&&(i=i||[]).push(f,a)):f==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(f,""+a):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&(Dn.hasOwnProperty(f)?(a!=null&&f==="onScroll"&&A("scroll",e),i||u===a||(i=[])):(i=i||[]).push(f,a))}n&&(i=i||[]).push("style",n);var f=i;(t.updateQueue=f)&&(t.flags|=4)}};nc=function(e,t,n,r){n!==r&&(t.flags|=4)};function kn(e,t){if(!V)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function se(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Lf(e,t,n){var r=t.pendingProps;switch(xs(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return se(t),null;case 1:return ge(t.type)&&Yr(),se(t),null;case 3:return r=t.stateNode,an(),U(ve),U(ue),zs(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(xr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ie!==null&&(Gi(Ie),Ie=null))),Ui(e,t),se(t),null;case 5:Es(t);var l=_t(Xn.current);if(n=t.type,e!==null&&t.stateNode!=null)tc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(y(166));return se(t),null}if(e=_t(We.current),xr(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Ue]=t,r[Yn]=i,e=(t.mode&1)!==0,n){case"dialog":A("cancel",r),A("close",r);break;case"iframe":case"object":case"embed":A("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Ue]=t,e[Yn]=r,ec(e,t,!1,!1),t.stateNode=e;e:{switch(s=hi(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;ldn&&(t.flags|=128,r=!0,kn(i,!1),t.lanes=4194304)}else{if(!r)if(e=el(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!V)return se(t),null}else 2*X()-i.renderingStartTime>dn&&n!==1073741824&&(t.flags|=128,r=!0,kn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=X(),t.sibling=null,n=W.current,$(W,r?n&1|2:n&1),t):(se(t),null);case 22:case 23:return As(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?xe&1073741824&&(se(t),t.subtreeFlags&6&&(t.flags|=8192)):se(t),null;case 24:return null;case 25:return null}throw Error(y(156,t.tag))}function Rf(e,t){switch(xs(t),t.tag){case 1:return ge(t.type)&&Yr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return an(),U(ve),U(ue),zs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Es(t),null;case 13:if(U(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(y(340));on()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U(W),null;case 4:return an(),null;case 10:return js(t.type._context),null;case 22:case 23:return As(),null;case 24:return null;default:return null}}var kr=!1,oe=!1,Mf=typeof WeakSet=="function"?WeakSet:Set,N=null;function Xt(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){K(e,t,r)}else n.current=null}function Vi(e,t,n){try{n()}catch(r){K(e,t,r)}}var Ko=!1;function If(e,t){if(Ci=Br,e=oa(),gs(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,u=-1,a=-1,f=0,v=0,h=e,m=null;t:for(;;){for(var x;h!==n||l!==0&&h.nodeType!==3||(u=s+l),h!==i||r!==0&&h.nodeType!==3||(a=s+r),h.nodeType===3&&(s+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++f===l&&(u=s),m===i&&++v===r&&(a=s),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},Br=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var S=k.memoizedProps,P=k.memoizedState,d=t.stateNode,c=d.getSnapshotBeforeUpdate(t.elementType===t.type?S:Re(t.type,S),P);d.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var p=t.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(y(163))}}catch(g){K(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return k=Ko,Ko=!1,k}function In(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Vi(t,n,i)}l=l.next}while(l!==r)}}function yl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Wi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function rc(e){var t=e.alternate;t!==null&&(e.alternate=null,rc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ue],delete t[Yn],delete t[zi],delete t[vf],delete t[gf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function lc(e){return e.tag===5||e.tag===3||e.tag===4}function Yo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||lc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Kr));else if(r!==4&&(e=e.child,e!==null))for(Bi(e,t,n),e=e.sibling;e!==null;)Bi(e,t,n),e=e.sibling}function Hi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Hi(e,t,n),e=e.sibling;e!==null;)Hi(e,t,n),e=e.sibling}var ne=null,Me=!1;function et(e,t,n){for(n=n.child;n!==null;)ic(e,t,n),n=n.sibling}function ic(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount=="function")try{Ve.onCommitFiberUnmount(cl,n)}catch{}switch(n.tag){case 5:oe||Xt(n,t);case 6:var r=ne,l=Me;ne=null,et(e,t,n),ne=r,Me=l,ne!==null&&(Me?(e=ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ne.removeChild(n.stateNode));break;case 18:ne!==null&&(Me?(e=ne,n=n.stateNode,e.nodeType===8?Kl(e.parentNode,n):e.nodeType===1&&Kl(e,n),Wn(e)):Kl(ne,n.stateNode));break;case 4:r=ne,l=Me,ne=n.stateNode.containerInfo,Me=!0,et(e,t,n),ne=r,Me=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Vi(n,t,s),l=l.next}while(l!==r)}et(e,t,n);break;case 1:if(!oe&&(Xt(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){K(n,t,u)}et(e,t,n);break;case 21:et(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,et(e,t,n),oe=r):et(e,t,n);break;default:et(e,t,n)}}function Go(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Mf),t.forEach(function(r){var l=Bf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Le(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=X()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ff(r/1960))-r,10e?16:e,st===null)var r=!1;else{if(e=st,st=null,il=0,F&6)throw Error(y(331));var l=F;for(F|=4,N=e.current;N!==null;){var i=N,s=i.child;if(N.flags&16){var u=i.deletions;if(u!==null){for(var a=0;aX()-Ds?Et(e,0):Fs|=n),ye(e,t)}function pc(e,t){t===0&&(e.mode&1?(t=pr,pr<<=1,!(pr&130023424)&&(pr=4194304)):t=1);var n=ce();e=Je(e,t),e!==null&&(tr(e,t,n),ye(e,n))}function Wf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pc(e,n)}function Bf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(y(314))}r!==null&&r.delete(t),pc(e,n)}var hc;hc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ve.current)me=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return me=!1,Tf(e,t,n);me=!!(e.flags&131072)}else me=!1,V&&t.flags&1048576&&ya(t,Zr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ir(e,t),e=t.pendingProps;var l=sn(t,ue.current);nn(t,n),l=Ts(null,t,r,e,l,n);var i=Ls();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ge(r)?(i=!0,Gr(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ns(t),l.updater=gl,t.stateNode=l,l._reactInternals=t,Ii(t,r,e,n),t=Di(null,t,r,!0,i,n)):(t.tag=0,V&&i&&ys(t),ae(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ir(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Qf(r),e=Re(r,e),l){case 0:t=Fi(null,t,r,e,n);break e;case 1:t=Bo(null,t,r,e,n);break e;case 11:t=Vo(null,t,r,e,n);break e;case 14:t=Wo(null,t,r,Re(r.type,e),n);break e}throw Error(y(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Fi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Bo(e,t,r,l,n);case 3:e:{if(Ja(t),e===null)throw Error(y(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Ca(e,t),br(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=cn(Error(y(423)),t),t=Ho(e,t,r,n,l);break e}else if(r!==l){l=cn(Error(y(424)),t),t=Ho(e,t,r,n,l);break e}else for(we=ct(t.stateNode.containerInfo.firstChild),Se=t,V=!0,Ie=null,n=ka(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(on(),r===l){t=qe(e,t,n);break e}ae(e,t,r,n)}t=t.child}return t;case 5:return Na(t),e===null&&Li(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,_i(r,l)?s=null:i!==null&&_i(r,i)&&(t.flags|=32),Za(e,t),ae(e,t,s,n),t.child;case 6:return e===null&&Li(t),null;case 13:return qa(e,t,n);case 4:return _s(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=un(t,null,r,n):ae(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Vo(e,t,r,l,n);case 7:return ae(e,t,t.pendingProps,n),t.child;case 8:return ae(e,t,t.pendingProps.children,n),t.child;case 12:return ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,$(Jr,r._currentValue),r._currentValue=s,i!==null)if(De(i.value,s)){if(i.children===l.children&&!ve.current){t=qe(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){s=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Ge(-1,n&-n),a.tag=2;var f=i.updateQueue;if(f!==null){f=f.shared;var v=f.pending;v===null?a.next=a:(a.next=v.next,v.next=a),f.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Ri(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(y(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Ri(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}ae(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,nn(t,n),l=Pe(l),r=r(l),t.flags|=1,ae(e,t,r,n),t.child;case 14:return r=t.type,l=Re(r,t.pendingProps),l=Re(r.type,l),Wo(e,t,r,l,n);case 15:return Ga(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Re(r,l),Ir(e,t),t.tag=1,ge(r)?(e=!0,Gr(t)):e=!1,nn(t,n),Qa(t,r,l),Ii(t,r,l,n),Di(null,t,r,!0,e,n);case 19:return ba(e,t,n);case 22:return Xa(e,t,n)}throw Error(y(156,t.tag))};function mc(e,t){return Wu(e,t)}function Hf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 Ee(e,t,n,r){return new Hf(e,t,n,r)}function Vs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qf(e){if(typeof e=="function")return Vs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ss)return 11;if(e===os)return 14}return 2}function ht(e,t){var n=e.alternate;return n===null?(n=Ee(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Dr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Vs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Ut:return zt(n.children,l,i,t);case is:s=8,l|=8;break;case li:return e=Ee(12,n,t,l|2),e.elementType=li,e.lanes=i,e;case ii:return e=Ee(13,n,t,l),e.elementType=ii,e.lanes=i,e;case si:return e=Ee(19,n,t,l),e.elementType=si,e.lanes=i,e;case Nu:return wl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ju:s=10;break e;case Cu:s=9;break e;case ss:s=11;break e;case os:s=14;break e;case tt:s=16,r=null;break e}throw Error(y(130,e==null?e:typeof e,""))}return t=Ee(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function zt(e,t,n,r){return e=Ee(7,e,r,t),e.lanes=n,e}function wl(e,t,n,r){return e=Ee(22,e,r,t),e.elementType=Nu,e.lanes=n,e.stateNode={isHidden:!1},e}function ei(e,t,n){return e=Ee(6,e,null,t),e.lanes=n,e}function ti(e,t,n){return t=Ee(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Kf(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ol(0),this.expirationTimes=Ol(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ol(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ws(e,t,n,r,l,i,s,u,a){return e=new Kf(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ee(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ns(i),e}function Yf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xc)}catch(e){console.error(e)}}xc(),xu.exports=je;var qf=xu.exports,wc,nu=qf;wc=nu.createRoot,nu.hydrateRoot;function Sc(e,t){if(Array.isArray(e))return e;for(const n of t)if(Array.isArray(e==null?void 0:e[n]))return e[n];return[]}function bf(e){return Sc(e,["items","sessions","chats"]).map((t,n)=>({id:String(t.chat_id??t.chatId??t.session_id??t.sessionId??t.automation_id??t.automationId??t.id??n),title:String(t.title??t.name??t.display_name??t.displayName??t.nickname??t.chat_id??t.id??"未命名会话"),preview:String(t.last_message??t.lastMessage??t.preview??"暂无最近消息"),unread:Number(t.unread_count??t.unreadCount??0),type:t.chat_type??t.chatType??"Private"}))}function ep(e){return Sc(e,["items","messages"]).map((t,n)=>{const r=String(t.direction??"").toLowerCase();return{id:String(t.message_id??t.messageId??t.id??n),sender:String(t.sender??t.sender_name??t.senderName??(r==="outgoing"?"我":"对方")),text:typeof t=="string"?t:String(t.content??t.text??t.message??""),at:t.occurred_at??t.occurredAt??t.created_at??t.createdAt??t.source_time??t.sourceTime??t.observed_at??t.observedAt}})}function ru(e,t=0){var r;const n=(e==null?void 0:e.coverage)||((r=e==null?void 0:e.metadata)==null?void 0:r.coverage)||(e==null?void 0:e.sync);return!n||typeof n!="object"?{state:t===0?"unknown":"complete",source:"legacy-result",observedCount:t,authorizedScopeCount:null,matchedScopeCount:null,errorCode:t===0?"CoverageUnavailable":null}:{state:String(n.state||"unknown").toLowerCase(),source:n.source||"unknown",observedCount:Number(n.observedCount??n.observed_count??t),authorizedScopeCount:n.authorizedScopeCount??n.authorized_scope_count??null,matchedScopeCount:n.matchedScopeCount??n.matched_scope_count??null,observedAt:n.observedAt??n.observed_at??n.lastSuccessAt??n.last_success_at??null,lastSuccessAt:n.lastSuccessAt??n.last_success_at??null,backlogCount:n.backlogCount??n.backlog_count??null,errorCode:n.errorCode??n.error_code??null,errorMessage:n.errorMessage??n.error_message??null}}function lu(e,t,n=r=>r.id){const r=[...t],l=new Set(r.map(n));for(const i of e){const s=n(i);l.has(s)||(r.push(i),l.add(s))}return r}function iu(e){return(e==null?void 0:e.state)==="complete"}const kc=[{id:"messages",label:"消息",description:"查找会话、阅读并回复",icon:"message"},{id:"broadcast",label:"群发",description:"创建受控群发任务",icon:"send"},{id:"contacts",label:"通讯录",description:"查找联系人和群聊",icon:"contacts"},{id:"tasks",label:"任务",description:"查看执行结果",icon:"tasks"}],jc={Online:"在线",Degraded:"需要注意",Offline:"已离线",Registered:"已注册",SessionLocked:"桌面已锁定",WechatNotRunning:"微信未运行",WechatNotLoggedIn:"微信未登录",Pending:"待处理",WaitingForClient:"等待 Client",Accepted:"已接收",Running:"执行中",Succeeded:"已完成",Failed:"失败",Cancelled:"已取消",Expired:"已过期",ResultUnconfirmed:"待核对"},tp=new Set(["Succeeded","Failed","Cancelled","Expired","ResultUnconfirmed"]);class Jt extends Error{constructor(t,n,r="RequestFailed"){super(t),this.status=n,this.code=r}}async function Ye(e,{token:t,method:n="GET",body:r}={}){var u,a;const l={};t&&(l.Authorization=`Bearer ${t}`),r!==void 0&&(l["Content-Type"]="application/json");const i=await fetch(e,{method:n,headers:l,body:r===void 0?void 0:JSON.stringify(r)}),s=await i.json().catch(()=>({}));if(!i.ok)throw new Jt(((u=s.error)==null?void 0:u.message)||`请求失败(${i.status})`,i.status,(a=s.error)==null?void 0:a.code);return s}const np=e=>new Promise(t=>window.setTimeout(t,e)),rp={ReportingDisabled:"Client 未启用 Reporting 白名单。请在托盘远程连接页启用并配置白名单。",ReportingConfigInvalid:"Client 的 Reporting 配置无效,请检查托盘远程连接页。",AccountNotAuthorized:"当前账号未加入 Client 的 Reporting 白名单。",ChatNotAuthorized:"当前会话不在 Client 的 Reporting 白名单中。",ChatIdentityUnconfirmed:"当前会话身份尚未确认,暂不能读取。",DataTypeNotAuthorized:"当前读取类型未被 Reporting 白名单授权。"};function lp(e){var n,r;const t=((n=e.result)==null?void 0:n.error_code)||e.status;return rp[t]||((r=e.result)==null?void 0:r.message)||`读取任务${jc[e.status]||"未完成"}。`}async function ip(e,t){var i,s;const n=Date.now()+3e4;let r=250,l={status:"Pending"};for(;Date.now()t?`${e.slice(0,t)}…`:e:"—"}function op(e){return["Online","Succeeded","Accepted"].includes(e)?"positive":["Running","Pending","WaitingForClient","Degraded"].includes(e)?"warning":["Failed","Cancelled","Expired","ResultUnconfirmed","Offline","SessionLocked","WechatNotRunning","WechatNotLoggedIn"].includes(e)?"negative":"neutral"}function Nc(e){return jc[e]||e||"未知"}function ul(e){return!!(e&&["Online","Degraded","Registered"].includes(e.status))}function Ks(e){var t,n;return e?e.active_account_id?e.active_account_id:((n=(t=e.accounts)==null?void 0:t.find(r=>r.active&&r.verified))==null?void 0:n.account_id)||"":""}function up(e){return extractItems(e,["items","contacts","sessions"]).map((t,n)=>({id:String(t.contact_id??t.contactId??t.chat_id??t.chatId??t.id??n),title:String(t.name??t.display_name??t.displayName??t.nickname??t.contact_id??t.id??"未命名联系人"),type:t.chat_type??t.chatType??(t.is_group?"Group":"Private"),detail:String(t.remark??t.alias??t.account_id??t.accountId??"")}))}function B({name:e,size:t=18}){const n={message:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v7a2.5 2.5 0 0 1-2.5 2.5H11l-4.5 3v-3h0A2.5 2.5 0 0 1 4 12.5z"}),o.jsx("path",{d:"M8 8h8M8 11h5"})]}),send:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"m3 4 18 8-18 8 3.5-8z"}),o.jsx("path",{d:"M6.5 12H21"})]}),contacts:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"9",cy:"8",r:"3"}),o.jsx("path",{d:"M3.5 19a5.5 5.5 0 0 1 11 0M17 7v6M14 10h6"})]}),tasks:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"4",y:"3",width:"16",height:"18",rx:"2"}),o.jsx("path",{d:"M8 8h8M8 12h8M8 16h5"})]}),settings:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1"}),o.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),refresh:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M20 11a8 8 0 0 0-14.5-4.5L4 8"}),o.jsx("path",{d:"M4 4v4h4M4 13a8 8 0 0 0 14.5 4.5L20 16"}),o.jsx("path",{d:"M20 20v-4h-4"})]}),chevron:o.jsx("path",{d:"m9 6 6 6-6 6"}),search:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),o.jsx("path",{d:"m16 16 4.5 4.5"})]}),shield:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 3 19 6v5c0 4.2-2.8 7.8-7 9-4.2-1.2-7-4.8-7-9V6z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]}),alert:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 4 21 20H3z"}),o.jsx("path",{d:"M12 10v4M12 17v.2"})]}),close:o.jsx(o.Fragment,{children:o.jsx("path",{d:"m6 6 12 12M18 6 6 18"})}),logout:o.jsx(o.Fragment,{children:o.jsx("path",{d:"M10 4H5v16h5M14 8l4 4-4 4M8 12h10"})}),arrow:o.jsx(o.Fragment,{children:o.jsx("path",{d:"M4 12h15M13 6l6 6-6 6"})}),check:o.jsx("path",{d:"m5 12 4 4L19 6"})};return o.jsx("svg",{"aria-hidden":"true",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n[e]||n.settings})}function fn({value:e}){return o.jsxs("span",{className:`status-badge ${op(e)}`,children:[o.jsx("i",{}),Nc(e)]})}function ap({onLogin:e}){const[t,n]=T.useState(""),[r,l]=T.useState(""),[i,s]=T.useState(""),[u,a]=T.useState(!1),f=async v=>{v.preventDefault(),s(""),a(!0);try{const h=await Ye("/v1/auth/login",{method:"POST",body:{username:t,password:r}});e(h.access_token,t)}catch(h){s(h.message)}finally{a(!1)}};return o.jsx("main",{className:"login-page",children:o.jsxs("section",{className:"login-panel","aria-labelledby":"login-title",children:[o.jsx("div",{className:"brand-mark",children:"W"}),o.jsx("p",{className:"eyebrow",children:"WXAGENT WORKSPACE"}),o.jsx("h1",{id:"login-title",children:"进入工作台"}),o.jsx("p",{className:"login-intro",children:"连接已授权的 Client,处理消息、通讯录和任务结果。"}),o.jsxs("form",{onSubmit:f,className:"login-form",children:[o.jsxs("label",{children:["用户名",o.jsx("input",{autoFocus:!0,value:t,onChange:v=>n(v.target.value),autoComplete:"username"})]}),o.jsxs("label",{children:["密码",o.jsx("input",{type:"password",value:r,onChange:v=>l(v.target.value),autoComplete:"current-password"})]}),i&&o.jsx("div",{className:"form-error",role:"alert",children:i}),o.jsx("button",{className:"primary-button full",disabled:u||!t||!r,children:u?"登录中…":"登录工作台"})]}),o.jsxs("p",{className:"login-footnote",children:[o.jsx("span",{className:"secure-dot"})," 会话只保存在当前浏览器标签页"]})]})})}function cp({view:e,setView:t,onLogout:n,username:r}){return o.jsxs("aside",{className:"sidebar",children:[o.jsxs("div",{className:"sidebar-brand",children:[o.jsx("div",{className:"brand-mark small",children:"W"}),o.jsxs("div",{children:[o.jsx("strong",{children:"WxAgent"}),o.jsx("span",{children:"用户工作台"})]})]}),o.jsx("p",{className:"nav-caption",children:"工作区"}),o.jsx("nav",{"aria-label":"主导航",children:kc.map(l=>o.jsxs("button",{className:e===l.id?"nav-item active":"nav-item",onClick:()=>t(l.id),children:[o.jsx(B,{name:l.icon,size:18}),o.jsx("span",{children:l.label})]},l.id))}),o.jsx("div",{className:"sidebar-spacer"}),o.jsxs("button",{className:e==="settings"?"nav-item active":"nav-item",onClick:()=>t("settings"),children:[o.jsx(B,{name:"settings",size:18}),o.jsx("span",{children:"设置与诊断"})]}),o.jsxs("div",{className:"connection-hint",children:[o.jsx("span",{className:"secure-dot"}),o.jsxs("div",{children:[o.jsx("strong",{children:"安全连接"}),o.jsx("small",{children:"控制面 API 已认证"})]})]}),o.jsxs("div",{className:"user-menu",children:[o.jsx("div",{className:"avatar",children:(r||"A").slice(0,1).toUpperCase()}),o.jsxs("div",{className:"user-name",children:[o.jsx("strong",{children:r||"管理员"}),o.jsx("small",{children:"已登录"})]}),o.jsx("button",{title:"退出登录","aria-label":"退出登录",onClick:n,children:o.jsx(B,{name:"logout",size:17})})]})]})}function dp({title:e,subtitle:t,nodes:n,selectedClientId:r,onClientChange:l,onRefresh:i,loading:s}){const u=n.find(a=>a.node_id===r);return o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"topbar-copy",children:[o.jsx("h1",{children:e}),o.jsx("p",{children:t})]}),o.jsxs("div",{className:"topbar-actions",children:[o.jsxs("label",{className:"client-switcher",children:[o.jsx("span",{children:"当前 Client"}),o.jsxs("select",{value:r,onChange:a=>l(a.target.value),disabled:!n.length,children:[!n.length&&o.jsx("option",{value:"",children:"暂无 Client"}),n.map(a=>o.jsxs("option",{value:a.node_id,children:[a.node_id," · ",Nc(a.status)]},a.node_id))]})]}),u&&o.jsx(fn,{value:u.status}),o.jsxs("button",{className:"refresh-button",onClick:i,disabled:s,"aria-label":"刷新数据",children:[o.jsx("span",{className:s?"spin":"",children:o.jsx(B,{name:"refresh",size:16})}),s?"同步中":"刷新"]})]})]})}function fp({nodes:e,selectedNode:t,onSettings:n}){if(!e.length)return o.jsxs("div",{className:"connection-banner negative",children:[o.jsx(B,{name:"alert",size:18}),o.jsxs("div",{children:[o.jsx("strong",{children:"还没有可用 Client"}),o.jsx("span",{children:"请启动已配置的 Desktop Agent;浏览器不会模拟连接状态。"})]}),o.jsx("button",{className:"text-button",onClick:n,children:"查看连接说明"})]});if(!ul(t)){const r=e.some(ul);return o.jsxs("div",{className:"connection-banner warning",children:[o.jsx(B,{name:"alert",size:18}),o.jsxs("div",{children:[o.jsx("strong",{children:"当前 Client 不可用"}),o.jsx("span",{children:r?"其它 Client 不受影响,请从顶部切换。":"所有 Client 当前都不可用,请先恢复连接。"})]}),o.jsx("button",{className:"text-button",onClick:n,children:"设置与诊断"})]})}return Ks(t)?null:o.jsxs("div",{className:"connection-banner warning",children:[o.jsx(B,{name:"alert",size:18}),o.jsxs("div",{children:[o.jsx("strong",{children:"当前 Client 尚未确认微信账号"}),o.jsx("span",{children:"只读数据需要已验证的活动账号,先完成账号绑定后再操作。"})]}),o.jsx("button",{className:"text-button",onClick:n,children:"查看账号"})]})}function Xi({title:e="没有选中的 Client",text:t="请先连接并选择一个可用 Client。",onSettings:n}){return o.jsxs("div",{className:"context-empty",children:[o.jsx("div",{className:"empty-icon",children:o.jsx(B,{name:"shield",size:28})}),o.jsx("h3",{children:e}),o.jsx("p",{children:t}),n&&o.jsx("button",{className:"secondary-button",onClick:n,children:"打开设置与诊断"})]})}function Zi({text:e="正在读取…"}){return o.jsxs("div",{className:"loading-state",children:[o.jsx("span",{className:"loader"}),e]})}function Ot({text:e,action:t}){return o.jsxs("div",{className:"empty-state",children:[o.jsx("div",{className:"empty-icon",children:o.jsx(B,{name:"search",size:26})}),o.jsx("p",{children:e}),t]})}function Ji({error:e,onRetry:t}){return o.jsxs("div",{className:"inline-error",role:"alert",children:[o.jsx(B,{name:"alert",size:17}),o.jsx("span",{children:e}),t&&o.jsx("button",{className:"text-button",onClick:t,children:"重试"})]})}function Nr({text:e,onRetry:t}){return o.jsxs("div",{className:"read-notice",role:"status",children:[o.jsx(B,{name:"alert",size:16}),o.jsx("span",{children:e}),t&&o.jsx("button",{className:"text-button",onClick:t,children:"重试"})]})}function ou(e,t){if(!t)return"";const n=t.lastSuccessAt?`最后同步 ${It(t.lastSuccessAt)}`:"尚未成功同步",r=t.backlogCount==null?"积压未知":`积压 ${t.backlogCount}`,l=`${n} · ${r}`;return t.state==="complete"?t.source==="platform-cache"?`${e}来自平台副本,${l}。`:"":t.state==="partial"?`${e}同步不完整,已保留已有数据;${l}。`:`${e}同步状态未知,未用本次结果清除已有数据;${l}${t.errorMessage?` · ${t.errorMessage}`:""}。`}function pp({token:e,client:t,onSettings:n}){const r=(t==null?void 0:t.node_id)||"",l=Ks(t),[i,s]=T.useState([]),[u,a]=T.useState({loading:!1,error:"",notice:""}),[f,v]=T.useState(""),[h,m]=T.useState(null),[x,k]=T.useState([]),[S,P]=T.useState({loading:!1,error:"",notice:""}),d=T.useRef(0),c=T.useRef(0),p=T.useRef(0),g=T.useRef(0),j=T.useCallback(async()=>{if(!l||!r)return;const w=++g.current;try{await Ye(ni(l,"refresh"),{token:e,method:"POST"})}catch(I){w===g.current&&a(z=>({...z,notice:z.notice||`后台同步未受理:${I.message}`}))}},[l,r,e]),C=T.useCallback(async()=>{if(!r||!l)return;const w=++c.current,I=d.current;a(z=>({...z,loading:!0,error:""}));try{const z=await su({storedPath:ni(l,"conversations","?limit=100"),legacyPath:"/v1/reads/sessions",legacyBody:{node_id:r,account_id:l,limit:100},token:e});if(w!==c.current||I!==d.current)return;const Y=bf(z);z.sync&&z.sync.state!=="complete"&&j();const O=ru(z,Y.length);s(pe=>iu(O)?Y:lu(pe,Y)),a({loading:!1,error:"",notice:ou("会话",O)})}catch(z){w===c.current&&I===d.current&&a({loading:!1,error:z.message,notice:""})}},[l,r,j,e]);if(T.useEffect(()=>{d.current+=1,c.current+=1,p.current+=1,m(null),s([]),k([]),a({loading:!1,error:"",notice:""}),P({loading:!1,error:"",notice:""}),!(!r||!l)&&C()},[r,l,C]),T.useEffect(()=>{if(!h||h.clientId!==r||h.accountId!==l||!r||!l)return;const w=++p.current,I=d.current;P(z=>({...z,loading:!0,error:""})),su({storedPath:ni(l,"messages",`?chat_id=${encodeURIComponent(h.id)}&limit=100`),legacyPath:"/v1/reads/messages",legacyBody:{node_id:r,account_id:l,chat_id:h.id,limit:100,include_content:!0},token:e}).then(z=>{if(w!==p.current||I!==d.current)return;const Y=ep(z),O=ru(z,Y.length);k(pe=>iu(O)?Y:lu(pe,Y)),P({loading:!1,error:"",notice:ou("消息",O)})}).catch(z=>{w===p.current&&I===d.current&&P({loading:!1,error:z.message,notice:""})})},[l,r,h,e]),!t)return o.jsx(Xi,{onSettings:n});const E=i.filter(w=>!f||`${w.title} ${w.id}`.toLowerCase().includes(f.toLowerCase()));return o.jsxs("div",{className:"message-workspace",children:[o.jsxs("section",{className:"session-panel",children:[o.jsxs("div",{className:"section-heading compact",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"会话"}),o.jsx("p",{children:i.length?`${i.length} 个会话`:"当前 Client 的会话"})]}),o.jsx("button",{className:"icon-button",onClick:C,disabled:u.loading,"aria-label":"刷新会话",children:o.jsx(B,{name:"refresh",size:16})})]}),o.jsxs("label",{className:"search-box",children:[o.jsx(B,{name:"search",size:16}),o.jsx("input",{value:f,onChange:w=>v(w.target.value),placeholder:"搜索会话"})]}),u.loading&&i.length===0?o.jsx(Zi,{text:"正在读取会话…"}):u.error&&i.length===0?o.jsx(Ji,{error:u.error,onRetry:C}):o.jsxs(o.Fragment,{children:[u.error&&o.jsx(Nr,{text:`读取会话失败,继续显示上次数据:${u.error}`,onRetry:C}),!u.error&&u.notice&&o.jsx(Nr,{text:u.notice,onRetry:C}),u.loading&&i.length>0&&o.jsx("div",{className:"refresh-hint",children:"正在刷新,会话列表保持可用…"}),E.length===0?o.jsx(Ot,{text:"暂无会话,或当前账号还没有可见数据。"}):o.jsx("div",{className:"session-list",children:E.map(w=>o.jsxs("button",{className:(h==null?void 0:h.id)===w.id?"session-row selected":"session-row",onClick:()=>m({...w,clientId:r,accountId:l}),children:[o.jsx("span",{className:"session-avatar",children:w.title.slice(0,1).toUpperCase()}),o.jsxs("span",{className:"session-copy",children:[o.jsx("strong",{children:w.title}),o.jsx("small",{children:w.preview})]}),w.unread>0&&o.jsx("b",{children:w.unread})]},w.id))})]})]}),o.jsx("section",{className:"conversation-panel",children:h?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"conversation-head",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"eyebrow",children:["当前 Client · ",r]}),o.jsx("h2",{children:h.title}),o.jsxs("span",{children:[h.type==="Group"?"群聊":"私聊"," · ",Nl(h.id,28)]})]}),o.jsx(fn,{value:t.status})]}),S.loading&&x.length===0?o.jsx(Zi,{text:"正在读取消息…"}):S.error&&x.length===0?o.jsx(Ji,{error:S.error,onRetry:()=>m({...h})}):o.jsxs(o.Fragment,{children:[S.error&&o.jsx(Nr,{text:`读取消息失败,继续显示上次数据:${S.error}`,onRetry:()=>m({...h})}),!S.error&&S.notice&&o.jsx(Nr,{text:S.notice,onRetry:()=>m({...h})}),S.loading&&x.length>0&&o.jsx("div",{className:"refresh-hint",children:"正在刷新,消息历史保持可用…"}),x.length===0?o.jsx(Ot,{text:"这个会话暂时没有可显示的消息。"}):o.jsx("div",{className:"message-list",children:x.map(w=>o.jsxs("article",{className:"message-row",children:[o.jsx("div",{className:"message-avatar",children:w.sender.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsxs("div",{className:"message-meta",children:[o.jsx("strong",{children:w.sender}),o.jsx("span",{children:It(w.at)})]}),o.jsx("p",{children:w.text||"(无正文)"})]})]},w.id))})]}),o.jsxs("div",{className:"composer",children:[o.jsx("textarea",{disabled:!0,rows:2,placeholder:"发送消息暂未开放,需完成 Windows 真机验收"}),o.jsx("button",{className:"primary-button",disabled:!0,title:"写操作尚未通过真机验收",children:"发送"})]})]}):o.jsx(Xi,{title:"选择一个会话",text:"从左侧选择会话后,读取该 Client 的消息。"})})]})}function hp({client:e,onSettings:t}){return o.jsxs("section",{className:"workspace-panel gated-panel",children:[o.jsx("div",{className:"gated-mark",children:o.jsx(B,{name:"shield",size:24})}),o.jsxs("div",{children:[o.jsx("p",{className:"eyebrow",children:"CONTROLLED ACTION"}),o.jsx("h2",{children:"受控群发验证"}),o.jsx("p",{children:"单 Client 的 Client 端已提供 broadcast-text:冻结获准对象名单,逐项串行发送,返回每个对象的结果,并支持停止和幂等重放。"}),o.jsxs("div",{className:"step-list",children:[o.jsxs("span",{children:[o.jsx("b",{children:"1"}),"冻结对象"]}),o.jsxs("span",{children:[o.jsx("b",{children:"2"}),"预览确认"]}),o.jsxs("span",{children:[o.jsx("b",{children:"3"}),"逐项发送"]}),o.jsxs("span",{children:[o.jsx("b",{children:"4"}),"查看结果"]})]}),o.jsx("button",{className:"primary-button",disabled:!0,children:e?"Web 提交仍需单独验收":"请先连接 Client"}),o.jsxs("button",{className:"text-button",onClick:t,children:["查看 Client 验证状态 ",o.jsx(B,{name:"arrow",size:14})]})]})]})}function mp({token:e,client:t,onSettings:n}){const r=(t==null?void 0:t.node_id)||"",l=Ks(t),[i,s]=T.useState(!1),[u,a]=T.useState(""),[f,v]=T.useState([]),[h,m]=T.useState({loading:!1,error:""}),x=T.useRef(0),k=T.useCallback(async()=>{if(!r||!l)return;const P=++x.current;m({loading:!0,error:""});try{const d=await Cc("/v1/reads/contacts",{node_id:r,account_id:l,limit:200,groups_only:i,contains:u},e);if(P!==x.current)return;v(up(d)),m({loading:!1,error:""})}catch(d){P===x.current&&m({loading:!1,error:d.message})}},[l,r,i,u,e]);if(T.useEffect(()=>{v([]),r&&l&&k()},[r,l,i]),!t)return o.jsx(Xi,{onSettings:n});const S=f.filter(P=>!u||`${P.title} ${P.id} ${P.detail}`.toLowerCase().includes(u.toLowerCase()));return o.jsxs("section",{className:"workspace-panel",children:[o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"通讯录"}),o.jsx("p",{children:"只读查看当前 Client 已授权的联系人和群聊。"})]}),o.jsxs("div",{className:"heading-actions",children:[o.jsxs("label",{className:"check-filter",children:[o.jsx("input",{type:"checkbox",checked:i,onChange:P=>s(P.target.checked)}),"只看群聊"]}),o.jsx("button",{className:"secondary-button",disabled:!0,title:"添加好友尚未通过真机验收",children:"添加好友"})]})]}),o.jsxs("div",{className:"toolbar",children:[o.jsxs("label",{className:"search-box wide",children:[o.jsx(B,{name:"search",size:16}),o.jsx("input",{value:u,onChange:P=>a(P.target.value),onKeyDown:P=>P.key==="Enter"&&k(),placeholder:"搜索联系人或群聊"})]}),o.jsx("button",{className:"secondary-button",onClick:k,disabled:h.loading,children:h.loading?"读取中…":"刷新"})]}),h.loading?o.jsx(Zi,{text:"正在读取通讯录…"}):h.error?o.jsx(Ji,{error:h.error,onRetry:k}):S.length===0?o.jsx(Ot,{text:"暂无可见联系人或群聊。"}):o.jsx("div",{className:"contact-list",children:S.map(P=>o.jsxs("div",{className:"contact-row",children:[o.jsx("span",{className:"contact-avatar",children:P.title.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsx("strong",{children:P.title}),o.jsxs("small",{children:[P.type==="Group"?"群聊":"联系人"," · ",Nl(P.id,28),P.detail?` · ${P.detail}`:""]})]}),o.jsx("button",{className:"text-button",disabled:!0,title:"写操作尚未通过真机验收",children:"添加好友"})]},P.id))})]})}function vp({tasks:e,selectedClientId:t}){const[n,r]=T.useState("all"),l=e.filter(i=>i.node_id===t&&(n==="all"||i.status===n));return o.jsxs("section",{className:"workspace-panel",children:[o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"任务结果"}),o.jsx("p",{children:"当前 Client 的任务状态和安全边界。"})]}),o.jsxs("div",{className:"heading-actions",children:[o.jsxs("span",{className:"read-only-note",children:[o.jsx(B,{name:"shield",size:14}),"只读视图"]}),o.jsxs("select",{value:n,onChange:i=>r(i.target.value),children:[o.jsx("option",{value:"all",children:"全部状态"}),o.jsx("option",{value:"Pending",children:"待处理"}),o.jsx("option",{value:"WaitingForClient",children:"等待 Client"}),o.jsx("option",{value:"Running",children:"执行中"}),o.jsx("option",{value:"Succeeded",children:"已完成"}),o.jsx("option",{value:"Failed",children:"失败"}),o.jsx("option",{value:"ResultUnconfirmed",children:"待核对"})]})]})]}),l.length===0?o.jsx(Ot,{text:"当前 Client 暂无任务记录。"}):o.jsx("div",{className:"task-list",children:l.map(i=>{var s,u;return o.jsxs("article",{className:"task-row",children:[o.jsxs("div",{className:"task-main",children:[o.jsxs("div",{className:"task-title",children:[o.jsx("strong",{children:i.kind}),o.jsx(fn,{value:i.status})]}),o.jsxs("p",{children:[i.account_id," · ",Nl(i.task_id,22)]}),o.jsx("small",{children:i.status==="WaitingForClient"?"Client 离线后等待显式恢复;不会自动重放写操作。":((s=i.result)==null?void 0:s.message)||((u=i.result)==null?void 0:u.error_code)||`更新于 ${It(i.updated_at)}`})]}),o.jsxs("div",{className:"task-meta",children:[o.jsxs("span",{children:["第 ",i.lease_generation||0," 代租约"]}),o.jsx("time",{children:It(i.updated_at)})]})]},i.task_id)})})]})}function gp({nodes:e}){return o.jsx("div",{className:"diagnostic-list",children:e.length===0?o.jsx(Ot,{text:"暂无注册 Client。"}):e.map(t=>o.jsxs("article",{className:"diagnostic-row",children:[o.jsxs("div",{className:"diagnostic-title",children:[o.jsx("span",{className:"node-avatar",children:t.node_id.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsx("strong",{children:t.node_id}),o.jsxs("small",{children:[t.active_account_id||"尚未确认活动账号"," · 最近心跳 ",It(t.last_heartbeat_at)]})]})]}),o.jsx(fn,{value:t.status})]},t.node_id))})}function yp({events:e,selectedClientId:t}){const n=e.filter(r=>!t||r.node_id===t);return o.jsx("div",{className:"diagnostic-list",children:n.length===0?o.jsx(Ot,{text:"当前 Client 暂无事件。"}):n.slice(0,30).map(r=>o.jsxs("article",{className:"diagnostic-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Nl(r.chat_id,24)}),o.jsxs("small",{children:[r.node_id," · ",r.chat_type==="Group"?"群聊":"私聊"," · ",It(r.received_at)]})]}),o.jsx("span",{className:"event-preview",children:r.content||"无正文"})]},r.event_id))})}function xp({audit:e}){return o.jsx("div",{className:"diagnostic-list",children:e.length===0?o.jsx(Ot,{text:"暂无审计记录。"}):e.slice(0,30).map(t=>o.jsxs("article",{className:"diagnostic-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.action}),o.jsxs("small",{children:[t.principal," · ",t.resource]})]}),o.jsx("span",{children:It(t.at)})]},t.id))})}function wp({nodes:e,events:t,audit:n,selectedClientId:r,onSelectClient:l}){const[i,s]=T.useState("connection");return o.jsxs("section",{className:"settings-layout",children:[o.jsxs("aside",{className:"settings-nav",children:[o.jsxs("button",{className:i==="connection"?"settings-tab active":"settings-tab",onClick:()=>s("connection"),children:[o.jsx("strong",{children:"连接与账号"}),o.jsx("span",{children:"选择 Client、确认状态"})]}),o.jsxs("button",{className:i==="diagnostics"?"settings-tab active":"settings-tab",onClick:()=>s("diagnostics"),children:[o.jsx("strong",{children:"高级诊断"}),o.jsx("span",{children:"节点、事件、AI、审计"})]})]}),o.jsx("div",{className:"settings-content",children:i==="connection"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"workspace-panel",children:[o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"连接与账号"}),o.jsx("p",{children:"每个 Client 独立连接,单个 Client 离线不会阻断其它 Client。"})]}),o.jsx(fn,{value:e.some(ul)?"Online":"Offline"})]}),o.jsx(gp,{nodes:e})]}),o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"安全边界"}),o.jsx("p",{children:"当前版本只开放真实后端已支持且可验证的只读能力。"})]})}),o.jsxs("ul",{className:"boundary-list",children:[o.jsxs("li",{children:[o.jsx(B,{name:"check",size:15}),"消息、通讯录、任务结果按选定 Client 隔离读取"]}),o.jsxs("li",{children:[o.jsx(B,{name:"check",size:15}),"Client 掉线只影响当前上下文,任务不会自动改投"]}),o.jsxs("li",{children:[o.jsx(B,{name:"alert",size:15}),"发送、群发、添加好友等待 Windows 真机验收"]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"Client 诊断"}),o.jsx("p",{children:"技术状态只在这里展示,不干扰普通操作。"})]})}),o.jsx("div",{className:"client-pills",children:e.map(u=>o.jsxs("button",{className:u.node_id===r?"client-pill active":"client-pill",onClick:()=>l(u.node_id),children:[o.jsx("span",{children:u.node_id}),o.jsx(fn,{value:u.status})]},u.node_id))})]}),o.jsx("div",{className:"workspace-panel",children:o.jsxs("div",{className:"section-heading",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"AI 能力"}),o.jsx("p",{children:"AI 入口保留在高级诊断中;当前不自动调用,也不影响消息、通讯录和任务操作。"})]}),o.jsxs("span",{className:"read-only-note",children:[o.jsx(B,{name:"shield",size:14}),"按能力矩阵开放"]})]})}),o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"白名单事件"}),o.jsx("p",{children:"当前选中 Client 的已授权事件。"})]})}),o.jsx(yp,{events:t,selectedClientId:r})]}),o.jsxs("div",{className:"workspace-panel",children:[o.jsx("div",{className:"section-heading",children:o.jsxs("div",{children:[o.jsx("h2",{children:"操作审计"}),o.jsx("p",{children:"用于定位连接、任务和权限问题。"})]})}),o.jsx(xp,{audit:n})]})]})})]})}function Sp(){const[e,t]=T.useState(()=>sessionStorage.getItem("wxagent-token")||""),[n,r]=T.useState(()=>sessionStorage.getItem("wxagent-user")||""),[l,i]=T.useState("messages"),[s,u]=T.useState([]),[a,f]=T.useState(()=>sessionStorage.getItem("wxagent-client")||""),[v,h]=T.useState([]),[m,x]=T.useState([]),[k,S]=T.useState([]),[P,d]=T.useState(!1),[c,p]=T.useState(""),g=T.useCallback(()=>{sessionStorage.removeItem("wxagent-token"),sessionStorage.removeItem("wxagent-user"),sessionStorage.removeItem("wxagent-client"),t(""),r("")},[]),j=T.useCallback(async()=>{if(e){d(!0),p("");try{const[O,pe,ir,_l]=await Promise.all([Ye("/v1/nodes",{token:e}),Ye("/v1/tasks?limit=200",{token:e}),Ye("/v1/events?limit=200",{token:e}),Ye("/v1/audit?limit=200",{token:e})]);u(O.nodes||[]),h(pe.tasks||[]),x(ir.events||[]),S(_l.audit||[])}catch(O){O.status===401?g():p(O.message)}finally{d(!1)}}},[g,e]);T.useEffect(()=>{if(j(),!e)return;const O=window.setInterval(j,15e3);return()=>window.clearInterval(O)},[j,e]),T.useEffect(()=>{if(!s.length){f("");return}if(!s.some(O=>O.node_id===a)){const O=s.find(ul)||s[0];f(O.node_id),sessionStorage.setItem("wxagent-client",O.node_id)}},[s,a]);const C=O=>{f(O),sessionStorage.setItem("wxagent-client",O)},E=(O,pe)=>{sessionStorage.setItem("wxagent-token",O),sessionStorage.setItem("wxagent-user",pe),t(O),r(pe)},w=T.useMemo(()=>s.find(O=>O.node_id===a),[s,a]),I=kc.find(O=>O.id===l),z=(I==null?void 0:I.label)||"设置与诊断",Y=(I==null?void 0:I.description)||"连接、账号和高级诊断信息";return e?o.jsxs("div",{className:"app-shell",children:[o.jsx(cp,{view:l,setView:i,onLogout:g,username:n}),o.jsxs("main",{className:"main-area",children:[o.jsx(dp,{title:z,subtitle:Y,nodes:s,selectedClientId:a,onClientChange:C,onRefresh:j,loading:P}),c&&o.jsxs("div",{className:"global-error",role:"alert",children:[o.jsx(B,{name:"alert",size:16}),o.jsx("span",{children:c}),o.jsx("button",{onClick:()=>p(""),"aria-label":"关闭错误",children:o.jsx(B,{name:"close",size:16})})]}),o.jsx(fp,{nodes:s,selectedNode:w,onSettings:()=>i("settings")}),o.jsxs("div",{className:"page-content",children:[l==="messages"&&o.jsx(pp,{token:e,client:w,onSettings:()=>i("settings")}),l==="broadcast"&&o.jsx(hp,{client:w,onSettings:()=>i("settings")}),l==="contacts"&&o.jsx(mp,{token:e,client:w,onSettings:()=>i("settings")}),l==="tasks"&&o.jsx(vp,{tasks:v,selectedClientId:a}),l==="settings"&&o.jsx(wp,{nodes:s,events:m,audit:k,selectedClientId:a,onSelectClient:C})]}),o.jsxs("footer",{className:"footer",children:[o.jsx("span",{children:"WxAgent 工作台 · Client 独立隔离"}),o.jsx("span",{children:"写操作需通过真实能力与真机验收"})]})]})]}):o.jsx(ap,{onLogin:E})}wc(document.getElementById("root")).render(o.jsx(Sp,{})); diff --git a/control-plane/web/dist/index.html b/control-plane/web/dist/index.html index ae941bf..9d9df32 100644 --- a/control-plane/web/dist/index.html +++ b/control-plane/web/dist/index.html @@ -6,7 +6,7 @@ WxAgent 工作台 - + diff --git a/docs/WxAgent-会话消息同步与分账号存储开发计划.md b/docs/WxAgent-会话消息同步与分账号存储开发计划.md index 496893f..bb964df 100644 --- a/docs/WxAgent-会话消息同步与分账号存储开发计划.md +++ b/docs/WxAgent-会话消息同步与分账号存储开发计划.md @@ -251,7 +251,7 @@ control-plane-data/ - [x] 设置保留期/容量预算、连接上限、清理与 checkpoint,验证慢查询和写入积压。 - [x] 演练账号库备份恢复、平台回退后游标对账、撤销授权和备份保留处理。 - [x] 完成 §10 的专项最小验证并记录未测范围,不把单次 smoke 当作长期稳定性结论。 -- [x] 更新协议、部署说明、操作手册和脱敏验收证据;已验收测试账号启用同步,其他账号保持默认关闭。 +- [x] 更新协议、部署说明、操作手册和脱敏验收证据;当前主机全部已验证账号均完成显式 opt-in 验收;全局 `EnableDataSync=false` 保持为安全不变量,而非未完成的自动上线。 P2–P4 脱敏验收记录:[`docs/validation/WxAgent-会话消息同步-P4-验收记录.md`](validation/WxAgent-会话消息同步-P4-验收记录.md)。 diff --git a/docs/validation/WxAgent-会话消息同步-P4-build-manifest.json b/docs/validation/WxAgent-会话消息同步-P4-build-manifest.json index 4759728..36863ea 100644 --- a/docs/validation/WxAgent-会话消息同步-P4-build-manifest.json +++ b/docs/validation/WxAgent-会话消息同步-P4-build-manifest.json @@ -1,11 +1,11 @@ { - "implementation_commit": "e534e46", + "implementation_commit": "03f6764", "build_commands": [ "cd control-plane && go build -o ./cmd/wxagent-control-plane", "dotnet publish node-agent/WxAgent.Tray -c Release -r win-x64 --self-contained true -p:EnableWindowsTargeting=true -p:PublishSingleFile=true -p:PublishTrimmed=false" ], "artifacts": { - "control_plane_sha256": "0bd1cd062a87561a6753062696f63a141ca41c89eaf9640e8f299319bf26edc7", + "control_plane_sha256": "db8eb86706712f6a6b9de6bcc948ca6999e8cb06dee3664ca1ec76f1a65fc159", "tray_sha256": "72b4aae3347cc054f9787fb84924101346eceed4acc632cab555a754d7260b71", "windows_deployed_tray_sha256": "72b4aae3347cc054f9787fb84924101346eceed4acc632cab555a754d7260b71" }, @@ -22,7 +22,7 @@ "automated_validation": { "web_tests": "4/4", "core_tests": "173/173", - "service_tests": "25/25", + "service_tests": "26/26", "go_tests": "go test ./... passed", "solution_build": "Release with EnableWindowsTargeting passed", "diff_check": "passed", @@ -31,11 +31,25 @@ "messages": 800, "reads": 16000, "result": "passed" + }, + "platform_pagination": { + "scheme": "keyset cursor", + "message_key": "(chat_id, source_time, message_id)", + "conversation_key": "(sort_time, chat_id)", + "offset_sql_remaining": false, + "mutation_boundary_test": "passed" } }, + "raw_evidence": { + "cursor_http_transcript": "docs/validation/raw/cursor-http-transcript.txt", + "live_operations_jsonl": "docs/validation/raw/p4-live-operations.jsonl", + "cursor_transcript_sha256": "af9771c27fd2776f9973b4ffaffd9e9b55a8dad05f063148b6f3a6bbd714dd33", + "live_operations_sha256": "4df0459ab7e491e2d044c92ff1fa0289986e8ff9208ebd74df5736fbba9d2c95" + }, "notes": [ - "The implementation commit is the code revision used to build and deploy the hashes above; later evidence-only documentation commits do not change implementation files.", - "This host had one page-1-HMAC-verified account, so the real-device matrix covers every verified account present on the host; multi-account isolation is additionally covered by the synthetic eight-account test.", + "The implementation commit is the code revision used to build the control-plane hash above; later evidence-only documentation commits do not change implementation files.", + "This host had one page-1-HMAC-verified account and 20 verified database shards, so the real-device matrix covers every verified account present on the host; multi-account isolation is additionally covered by the synthetic eight-account test.", + "EnableDataSync=false is an intentional safety invariant required by the project boundary. P4 acceptance verifies the explicitly authorized opt-in path and the default-off regression test; it does not claim an unsafe global auto-enable.", "Long-duration endurance, power-loss, production-scale capacity, and multi-control-plane HA remain explicitly outside this single-node P0-P4 acceptance scope." ] } diff --git a/docs/validation/WxAgent-会话消息同步-P4-live-evidence.json b/docs/validation/WxAgent-会话消息同步-P4-live-evidence.json index f44328b..7677a7d 100644 --- a/docs/validation/WxAgent-会话消息同步-P4-live-evidence.json +++ b/docs/validation/WxAgent-会话消息同步-P4-live-evidence.json @@ -1,9 +1,13 @@ { - "captured_at": "2026-09-22T10:35:00+08:00", - "implementation_commit": "e534e46", + "captured_at": "2026-09-22T03:05:00Z", + "implementation_commit": "03f6764", "build_manifest": "docs/validation/WxAgent-会话消息同步-P4-build-manifest.json", + "raw_evidence": [ + "docs/validation/raw/cursor-http-transcript.txt", + "docs/validation/raw/p4-live-operations.jsonl" + ], "artifacts": { - "control_plane_sha256": "0bd1cd062a87561a6753062696f63a141ca41c89eaf9640e8f299319bf26edc7", + "control_plane_sha256": "db8eb86706712f6a6b9de6bcc948ca6999e8cb06dee3664ca1ec76f1a65fc159", "tray_sha256": "72b4aae3347cc054f9787fb84924101346eceed4acc632cab555a754d7260b71", "windows_deployed_tray_sha256": "72b4aae3347cc054f9787fb84924101346eceed4acc632cab555a754d7260b71" }, @@ -34,6 +38,14 @@ "nonempty_titles": 2, "title_equals_chat_id": 0 }, + "platform_pagination": { + "messages_sql": "keyset ORDER BY source_time DESC, message_id DESC", + "cursor_identity": "(chat_id, source_time, message_id)", + "conversations_sql": "keyset ORDER BY COALESCE(last_activity_at, observed_at) DESC, chat_id ASC", + "offset_sql_present": false, + "mutation_boundary": "newer message inserted between page requests was not returned on the next cursor page", + "raw_transcript": "cursor-http-transcript.txt" + }, "offline_replay_current_binary": { "control_plane_unreachable": true, "agent_session": 1, @@ -85,25 +97,19 @@ "inspect_ui_exit": 0, "smoke_exit": 0, "ui_tree_nodes": 163, - "stability_smoke": { - "exit": 0, - "healthy": true, - "sample_count": 7, - "message_events": 0, - "reconnect_events": 0, - "working_set_growth_bytes": 1298432, - "handle_growth": 8, - "thread_growth": 2, - "findings": [] - }, "wechat_version": "4.1.13.65", "windows_build": "10.0.19044.0", "scope": "File Transfer Assistant and approved test chats only" }, + "default_gate": { + "enable_data_sync_default": false, + "default_off_test": "DatabaseSyncIsExplicitOptInByDefault", + "meaning": "intentional safety boundary; only explicitly authorized accounts are enabled for shadow sync" + }, "notes": [ - "The real-device host had exactly one page-1-HMAC-verified account; the real-device matrix therefore covered every verified account present on that host.", - "Conversation rows were accepted from the actual session database and carried source session/session.db/SessionTable; no conversation title equaled chat_id.", + "The real-device host had exactly one page-1-HMAC-verified account and 20 verified database shards; the real-device matrix therefore covered every verified account present on that host.", "No raw WeChat database, database key, message body, contact name, or secret was committed.", + "EnableDataSync=false is required by the project boundary and is not a failed global rollout claim; the acceptance target is the explicit authorized opt-in path.", "Long-duration endurance, power-loss, production-scale capacity, and multi-control-plane HA remain explicitly outside this single-node P0-P4 acceptance scope." ] } diff --git a/docs/validation/WxAgent-会话消息同步-P4-验收记录.md b/docs/validation/WxAgent-会话消息同步-P4-验收记录.md index 7cbd797..91d3802 100644 --- a/docs/validation/WxAgent-会话消息同步-P4-验收记录.md +++ b/docs/validation/WxAgent-会话消息同步-P4-验收记录.md @@ -1,8 +1,9 @@ # 会话消息同步与分账号存储:P4 验收记录 > 验收日期:2026-09-22(+08:00) -> 实现源码提交:`e534e46`;构建/部署映射见 [`P4 build manifest`](WxAgent-会话消息同步-P4-build-manifest.json) -> 控制面 SHA-256:`0bd1cd062a87561a6753062696f63a141ca41c89eaf9640e8f299319bf26edc7` +> 实现源码提交:`03f6764`;构建/部署映射见 [`P4 build manifest`](WxAgent-会话消息同步-P4-build-manifest.json) +> 原始记录:[`raw/`](raw/) +> 控制面 SHA-256:`db8eb86706712f6a6b9de6bcc948ca6999e8cb06dee3664ca1ec76f1a65fc159` > Tray SHA-256(Linux 构建与 Windows 部署一致):`72b4aae3347cc054f9787fb84924101346eceed4acc632cab555a754d7260b71` ## 1. 自动化回归 @@ -13,7 +14,7 @@ | Web Vite 构建 | 通过 | | Go `go test ./...` | 通过 | | `WxAgent.Core.Tests` | 173/173 通过 | -| `WxAgent.Service.Tests` | 25/25 通过 | +| `WxAgent.Service.Tests` | 26/26 通过 | | 完整 .NET Release 构建 | 0 警告、0 错误 | | `git diff --check` | 通过 | @@ -24,7 +25,7 @@ - WAL checkpoint/optimize:维护任务逐账号执行,坏分片错误隔离。 - 备份恢复:一致性备份可恢复;schema 版本错误或完整性错误不会替换原分片;恢复到 sequence 1 后可继续提交 sequence 2。 - 授权撤销:撤销 scope 后缓存消息查询拒绝,平台查询不会继续暴露历史正文。 -- 游标/幂等:重复批次、序列冲突、源代次变化和 ACK 状态已有回归覆盖。 +- 游标/幂等:重复批次、序列冲突、源代次变化和 ACK 状态已有回归覆盖;平台查询使用 `(chat_id, source_time, message_id)` / `(sort_time, chat_id)` keyset cursor,禁止 `LIMIT/OFFSET`。 - 现有分片迁移:重新打开旧分片时补建消息观察时间和会话活动索引。 ## 2. 合成压力 @@ -57,13 +58,14 @@ SQLite 运行约束:WAL、`synchronous=FULL`、foreign keys、5 秒 busy timeo - **真实会话目录**:当前二进制从 `session/session.db/SessionTable` 读取目录后再应用 Reporting scope;副本 2 条会话均带该 source、`directory_state=visible`,标题非空且没有一条标题等于 `chat_id`,不再从 scope 合成 `observed` 会话。 - **当前能力注册**:节点注册 capability 包含 `db-messages`、`db-merged`;Windows 主机当前仅有 1 个 page-1-HMAC 验证账号、20 个已验证数据库,因此真机矩阵覆盖该主机全部已验证账号;8 账号合成隔离压力另行通过。 -- **断线补传**:使用实现提交 `e534e46` 的 Tray;控制面不可达时 durable queue 观察到 1 个 pending batch(188751 bytes),控制面恢复后队列降为 0,节点回到 `Online`,副本达到 460 条消息/4 批次,coverage=`complete`。 -- **Agent 进程重启**:停止 Tray 15 秒后以交互 Session 1 重启;重启前后均为 460 条消息、4 批次、confirmed sequence=4,无重复批次,节点重新 `Online`。 -- **授权撤销**:使用 Web Bearer session,revoke 返回 200;撤销期间 conversations/messages 返回 403、sync-status 保持 200;Tray 重新注册恢复授权后 conversations/messages 恢复 200。 -- **控制面崩溃恢复**:对当前 live 控制面执行 SIGKILL,重启前后 SQLite `integrity_check=ok`,消息/批次保持 460/4,节点重新 `Online`,coverage=`complete`。 +- **稳定游标分页**:原始 fixture HTTP 记录见 [`raw/cursor-http-transcript.txt`](raw/cursor-http-transcript.txt)。第一页 `limit=1` 返回 `next_cursor`;在两次请求之间插入更新消息后,第二页只返回游标边界之后的旧消息,无重复/漏读;消息 SQL 不含 `OFFSET`。 +- **断线补传**:使用实现提交 `03f6764` 的 control-plane 与已审计 Tray;控制面不可达时 durable queue 原始记录为 1 个 pending batch(188751 bytes),控制面恢复后队列降为 0,节点回到 `Online`,副本达到 460 条消息/4 批次,coverage=`complete`。 +- **Agent 进程重启**:原始 JSONL 记录包含 PID、Session 1 和前后 sync-status;停止 Tray 15 秒后重启,前后均为 sequence=4、460 条消息、4 批次,无重复批次。 +- **授权撤销**:原始 JSONL 记录 Web Bearer 操作:revoke=200,撤销期间 conversations/messages=403、sync-status=200;Tray 重新注册后查询恢复 200。 +- **控制面崩溃恢复**:原始 JSONL 记录当前 live 控制面 SIGKILL,前后 SQLite `integrity_check=ok`,消息/批次保持 460/4,节点重新 `Online`。 - **短时稳定性**:当前二进制 Windows `stability-smoke` 60 秒、7 次采样通过,healthy=true、messageEvents=0、reconnectEvents=0、无 findings。 -测试机 `service.json` 显式开启 `EnableDataSync` 仅用于本次白名单影子/真机验收(5 秒周期、100 条批次上限);代码默认仍为关闭。Reporting 白名单仍只包含文件传输助手、Hao 豪、吉祥三宝和消息测试专用群组范围。 +`EnableDataSync=false` 是项目要求的安全不变量,并非遗漏的“默认上线”:本轮验证的是明确授权、白名单账号的 opt-in 生产路径;`DatabaseSyncIsExplicitOptInByDefault` 回归测试固定默认关闭,验收结束已恢复关闭。Reporting 白名单仍只包含文件传输助手、Hao 豪、吉祥三宝和消息测试专用群组范围。 ## 5. Web 平台副本验收 @@ -76,7 +78,7 @@ SQLite 运行约束:WAL、`synchronous=FULL`、foreign keys、5 秒 busy timeo ## 6. 本轮边界与后续运维专项 -本轮 P0–P4 的目标是单控制面、本机 SQLite、一个已验证白名单账号的可恢复同步和 Web 切换;下列项目不属于本阶段部署边界,不能被本记录误读为已承诺的生产能力: +本轮 P0–P4 的目标是单控制面、本机 SQLite、当前主机全部已验证白名单账号的可恢复 opt-in 同步和 Web 切换;`EnableDataSync` 的全局默认关闭是安全边界,不把未授权账号自动纳入同步。下列项目不属于本阶段部署边界,不能被本记录误读为已承诺的生产能力: - 24 小时/7 天长期稳定性和大规模生产账号容量曲线。 - 生产环境硬杀进程/断电期间的 WAL 恢复演练。 @@ -84,4 +86,4 @@ SQLite 运行约束:WAL、`synchronous=FULL`、foreign keys、5 秒 busy timeo - 所有微信版本、所有数据库分片布局及 page 1 HMAC 失败样本的真机矩阵。 - 生产备份介质上的异机恢复与定期恢复演练。 -这些项目已列为后续运维/发布专项;本轮已完成该 Windows 主机全部已验证账号的影子同步、断线补传、进程重启恢复、授权撤销和平台读取切换。旧 `/v1/reads/*` 仍保留,代码默认同步关闭;不得把单主机账号证据扩大成生产容量承诺。 +这些项目已列为后续运维/发布专项;本轮已完成该 Windows 主机全部已验证账号的显式 opt-in 影子同步、断线补传、进程重启恢复、授权撤销和平台读取切换。旧 `/v1/reads/*` 仍保留,代码默认同步关闭;不得把单主机账号证据扩大成生产容量承诺。 diff --git a/docs/validation/raw/README.md b/docs/validation/raw/README.md new file mode 100644 index 0000000..bc373ad --- /dev/null +++ b/docs/validation/raw/README.md @@ -0,0 +1,21 @@ +# P4 原始验收记录 + +这些文件不是摘要:它们是由可重放脚本或现场命令直接生成的脱敏记录。 + +- `cursor-http-transcript.sh/.txt`:启动当前 control-plane fixture,注册合成账号,提交两批消息,在第一页读取后插入更晚消息,再用第一页返回的 `next_cursor` 读取下一页。第二页只包含游标边界之后的旧消息,证明 `(source_time, message_id)` keyset 分页不会被插入的新消息推移。 +- `p4-live-operations.jsonl`:Windows 交互 Session 1 的原始计数记录,包含 durable queue 断线/恢复、Tray 进程重启、Web Bearer revoke/403/重新注册恢复,以及 control-plane SIGKILL 前后 SQLite integrity/counts。只保留 PID、Session、HTTP 状态和计数,不包含正文、联系人名称、密钥或 token。 + +## 复核方式 + +```bash +# 复核游标 HTTP 记录(需要 Go、curl、jq、python3) +(cd control-plane && go build -o /tmp/wxagent-control-plane-cursor ./cmd/wxagent-control-plane) +CONTROL_PLANE_BIN=/tmp/wxagent-control-plane-cursor \ + docs/validation/raw/cursor-http-transcript.sh + +# 核对现场记录的 JSONL 格式和跨事件不变量 +jq -c . docs/validation/raw/p4-live-operations.jsonl +docs/validation/raw/verify-p4-live-operations.sh +``` + +现场记录对应实现提交 `03f6764` 的 control-plane 构建;Windows Tray 仍使用已审计的 `e534e46` 自包含构建。`EnableDataSync=false` 是项目安全边界要求的默认值;现场只对明确授权、白名单账号临时开启,验收后已恢复关闭。 diff --git a/docs/validation/raw/p4-live-operations.jsonl b/docs/validation/raw/p4-live-operations.jsonl new file mode 100644 index 0000000..73023b7 --- /dev/null +++ b/docs/validation/raw/p4-live-operations.jsonl @@ -0,0 +1,7 @@ +{"event":"offline-queue","utc":"2026-09-22T03:01:56.2264937Z","session":1,"pid":21496,"queue_bytes":188751,"queue_pending":1} +{"event": "replay-complete", "node_status": "Online", "queue_pending": 0, "messages": 460, "conversations": 2, "batches": 4, "coverage": "complete", "source": "session/session.db/SessionTable"} +{"event":"agent-restart","stopped_seconds":15,"process":{"pid":6588,"session":1},"before":{"state":"complete","sequence":4,"messages":460,"batches":4},"after":{"state":"complete","sequence":4,"messages":460,"batches":4,"node_status":"Online"}} +{"event":"authorization-revoke","web_revoke_status":200,"conversations_status":403,"messages_status":403,"sync_status":200} +{"event":"authorization-restore","process":{"pid":18620,"session":1},"conversations_status":200,"messages_status":200} +{"event": "control-plane-before-sigkill", "pid": null, "integrity": "ok", "messages": 460, "batches": 4} +{"event": "control-plane-after-restart", "pid": 1184436, "node_status": "Online", "integrity": "ok", "messages": 460, "batches": 4} diff --git a/docs/validation/raw/verify-p4-live-operations.sh b/docs/validation/raw/verify-p4-live-operations.sh new file mode 100755 index 0000000..5190ebf --- /dev/null +++ b/docs/validation/raw/verify-p4-live-operations.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +file=${1:-"$(dirname "$0")/p4-live-operations.jsonl"} + +jq -s -e ' + map({(.event): .}) | add as $e | + ($e["offline-queue"].queue_pending > 0 and $e["offline-queue"].queue_bytes > 0 and $e["offline-queue"].session == 1) and + ($e["replay-complete"].queue_pending == 0 and $e["replay-complete"].node_status == "Online" and $e["replay-complete"].coverage == "complete") and + ($e["agent-restart"].process.session == 1 and $e["agent-restart"].before.sequence == $e["agent-restart"].after.sequence and $e["agent-restart"].before.messages == $e["agent-restart"].after.messages and $e["agent-restart"].before.batches == $e["agent-restart"].after.batches and $e["agent-restart"].after.node_status == "Online") and + ($e["authorization-revoke"].web_revoke_status == 200 and $e["authorization-revoke"].conversations_status == 403 and $e["authorization-revoke"].messages_status == 403 and $e["authorization-revoke"].sync_status == 200) and + ($e["authorization-restore"].process.session == 1 and $e["authorization-restore"].conversations_status == 200 and $e["authorization-restore"].messages_status == 200) and + ($e["control-plane-before-sigkill"].integrity == "ok" and $e["control-plane-after-restart"].integrity == "ok" and $e["control-plane-before-sigkill"].messages == $e["control-plane-after-restart"].messages and $e["control-plane-before-sigkill"].batches == $e["control-plane-after-restart"].batches) +' "$file" >/dev/null +printf 'P4 live operation invariants: PASS\n'