From ab9ff389f250cefa06523ed50a88024a0a379da9 Mon Sep 17 00:00:00 2001 From: Rogee Date: Mon, 21 Sep 2026 11:18:09 +0800 Subject: [PATCH] fix authorized remote message reads --- .../{index-imGrBp_j.js => index-C2PP8Qbj.js} | 16 +-- control-plane/web/dist/index.html | 2 +- control-plane/web/src/main.jsx | 29 +++- .../WxAgent.Host/WindowsAgentBackend.cs | 7 +- .../RemoteAgentHostedService.cs | 102 +++++++++++--- node-agent/WxAgent.Tray/Program.cs | 127 +++++++++++++++++- .../WxAgent.Windows/WechatChatClient.cs | 23 +--- 7 files changed, 245 insertions(+), 61 deletions(-) rename control-plane/web/dist/assets/{index-imGrBp_j.js => index-C2PP8Qbj.js} (68%) diff --git a/control-plane/web/dist/assets/index-imGrBp_j.js b/control-plane/web/dist/assets/index-C2PP8Qbj.js similarity index 68% rename from control-plane/web/dist/assets/index-imGrBp_j.js rename to control-plane/web/dist/assets/index-C2PP8Qbj.js index 80e228b..be33691 100644 --- a/control-plane/web/dist/assets/index-imGrBp_j.js +++ b/control-plane/web/dist/assets/index-C2PP8Qbj.js @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var er=Symbol.for("react.element"),xc=Symbol.for("react.portal"),wc=Symbol.for("react.fragment"),Sc=Symbol.for("react.strict_mode"),kc=Symbol.for("react.profiler"),jc=Symbol.for("react.provider"),Cc=Symbol.for("react.context"),Nc=Symbol.for("react.forward_ref"),Ec=Symbol.for("react.suspense"),_c=Symbol.for("react.memo"),zc=Symbol.for("react.lazy"),Ys=Symbol.iterator;function Pc(e){return e===null||typeof e!="object"?null:(e=Ys&&e[Ys]||e["@@iterator"],typeof e=="function"?e:null)}var iu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},su=Object.assign,ou={};function fn(e,t,n){this.props=e,this.context=t,this.refs=ou,this.updater=n||iu}fn.prototype.isReactComponent={};fn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};fn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function uu(){}uu.prototype=fn.prototype;function Ji(e,t,n){this.props=e,this.context=t,this.refs=ou,this.updater=n||iu}var qi=Ji.prototype=new uu;qi.constructor=Ji;su(qi,fn.prototype);qi.isPureReactComponent=!0;var Gs=Array.isArray,au=Object.prototype.hasOwnProperty,bi={current:null},cu={key:!0,ref:!0,__self:!0,__source:!0};function du(e,t,n){var r,l={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)au.call(t,r)&&!cu.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,q=C[Y];if(0>>1;Yl(zl,T))wtl(or,zl)?(C[Y]=or,C[wt]=T,Y=wt):(C[Y]=zl,C[xt]=T,Y=xt);else if(wtl(or,T))C[Y]=or,C[wt]=T,Y=wt;else break e}}return P}function l(C,P){var T=C.sortIndex-P.sortIndex;return T!==0?T:C.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var a=[],f=[],g=1,h=null,m=3,x=!1,w=!1,S=!1,z=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(C){for(var P=n(f);P!==null;){if(P.callback===null)r(f);else if(P.startTime<=C)r(f),P.sortIndex=P.expirationTime,t(a,P);else break;P=n(f)}}function v(C){if(S=!1,p(C),!w)if(n(a)!==null)w=!0,El(k);else{var P=n(f);P!==null&&_l(v,P.startTime-C)}}function k(C,P){w=!1,S&&(S=!1,d(_),_=-1),x=!0;var T=m;try{for(p(P),h=n(a);h!==null&&(!(h.expirationTime>P)||C&&!ge());){var Y=h.callback;if(typeof Y=="function"){h.callback=null,m=h.priorityLevel;var q=Y(h.expirationTime<=P);P=e.unstable_now(),typeof q=="function"?h.callback=q:h===n(a)&&r(a),p(P)}else r(a);h=n(a)}if(h!==null)var sr=!0;else{var xt=n(f);xt!==null&&_l(v,xt.startTime-P),sr=!1}return sr}finally{h=null,m=T,x=!1}}var N=!1,E=null,_=-1,F=5,R=-1;function ge(){return!(e.unstable_now()-RC||125Y?(C.sortIndex=T,t(f,C),n(a)===null&&C===n(f)&&(S?(d(_),_=-1):S=!0,_l(v,T-Y))):(C.sortIndex=q,t(a,C),w||x||(w=!0,El(k))),C},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(C){var P=m;return function(){var T=m;m=P;try{return C.apply(this,arguments)}finally{m=T}}}})(vu);mu.exports=vu;var Ac=mu.exports;/** + */(function(e){function t(C,P){var L=C.length;C.push(P);e:for(;0>>1,q=C[Y];if(0>>1;Yl(zl,L))wtl(or,zl)?(C[Y]=or,C[wt]=L,Y=wt):(C[Y]=zl,C[xt]=L,Y=xt);else if(wtl(or,L))C[Y]=or,C[wt]=L,Y=wt;else break e}}return P}function l(C,P){var L=C.sortIndex-P.sortIndex;return L!==0?L:C.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var a=[],f=[],g=1,h=null,m=3,x=!1,w=!1,S=!1,z=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(C){for(var P=n(f);P!==null;){if(P.callback===null)r(f);else if(P.startTime<=C)r(f),P.sortIndex=P.expirationTime,t(a,P);else break;P=n(f)}}function v(C){if(S=!1,p(C),!w)if(n(a)!==null)w=!0,El(k);else{var P=n(f);P!==null&&_l(v,P.startTime-C)}}function k(C,P){w=!1,S&&(S=!1,d(_),_=-1),x=!0;var L=m;try{for(p(P),h=n(a);h!==null&&(!(h.expirationTime>P)||C&&!ge());){var Y=h.callback;if(typeof Y=="function"){h.callback=null,m=h.priorityLevel;var q=Y(h.expirationTime<=P);P=e.unstable_now(),typeof q=="function"?h.callback=q:h===n(a)&&r(a),p(P)}else r(a);h=n(a)}if(h!==null)var sr=!0;else{var xt=n(f);xt!==null&&_l(v,xt.startTime-P),sr=!1}return sr}finally{h=null,m=L,x=!1}}var N=!1,E=null,_=-1,F=5,R=-1;function ge(){return!(e.unstable_now()-RC||125Y?(C.sortIndex=L,t(f,C),n(a)===null&&C===n(f)&&(S?(d(_),_=-1):S=!0,_l(v,L-Y))):(C.sortIndex=q,t(a,C),w||x||(w=!0,El(k))),C},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(C){var P=m;return function(){var L=m;m=P;try{return C.apply(this,arguments)}finally{m=L}}}})(vu);mu.exports=vu;var $c=mu.exports;/** * @license React * react-dom.production.min.js * @@ -30,11 +30,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Vc=L,Se=Ac;function y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ti=Object.prototype.hasOwnProperty,Wc=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Zs={},Js={};function Bc(e){return ti.call(Js,e)?!0:ti.call(Zs,e)?!1:Wc.test(e)?Js[e]=!0:(Zs[e]=!0,!1)}function Hc(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Qc(e,t,n,r){if(t===null||typeof t>"u"||Hc(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function de(e,t,n,r,l,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var re={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){re[e]=new de(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];re[t]=new de(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){re[e]=new de(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){re[e]=new de(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){re[e]=new de(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){re[e]=new de(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){re[e]=new de(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){re[e]=new de(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){re[e]=new de(e,5,!1,e.toLowerCase(),null,!1,!1)});var ts=/[\-:]([a-z])/g;function ns(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ts,ns);re[t]=new de(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ts,ns);re[t]=new de(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ts,ns);re[t]=new de(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!1,!1)});re.xlinkHref=new de("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!0,!0)});function rs(e,t,n,r){var l=re.hasOwnProperty(t)?re[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ti=Object.prototype.hasOwnProperty,Wc=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Zs={},Js={};function Bc(e){return ti.call(Js,e)?!0:ti.call(Zs,e)?!1:Wc.test(e)?Js[e]=!0:(Zs[e]=!0,!1)}function Hc(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Qc(e,t,n,r){if(t===null||typeof t>"u"||Hc(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function de(e,t,n,r,l,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var re={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){re[e]=new de(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];re[t]=new de(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){re[e]=new de(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){re[e]=new de(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){re[e]=new de(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){re[e]=new de(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){re[e]=new de(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){re[e]=new de(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){re[e]=new de(e,5,!1,e.toLowerCase(),null,!1,!1)});var ts=/[\-:]([a-z])/g;function ns(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ts,ns);re[t]=new de(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ts,ns);re[t]=new de(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ts,ns);re[t]=new de(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!1,!1)});re.xlinkHref=new de("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!0,!0)});function rs(e,t,n,r){var l=re.hasOwnProperty(t)?re[t]:null;(l!==null?l.type!==0:r||!(2u||l[s]!==i[u]){var a=` -`+l[s].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=s&&0<=u);break}}}finally{Tl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?jn(e):""}function Kc(e){switch(e.tag){case 5:return jn(e.type);case 16:return jn("Lazy");case 13:return jn("Suspense");case 19:return jn("SuspenseList");case 0:case 2:case 15:return e=Rl(e.type,!1),e;case 11:return e=Rl(e.type.render,!1),e;case 1:return e=Rl(e.type,!0),e;default:return""}}function ii(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 $t:return"Fragment";case Ut:return"Portal";case ni:return"Profiler";case ls:return"StrictMode";case ri:return"Suspense";case li:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case xu:return(e.displayName||"Context")+".Consumer";case yu:return(e._context.displayName||"Context")+".Provider";case is:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ss:return t=e.displayName||null,t!==null?t:ii(e.type)||"Memo";case et:t=e._payload,e=e._init;try{return ii(e(t))}catch{}}return null}function Yc(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 ii(t);case 8:return t===ls?"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 ht(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Su(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Gc(e){var t=Su(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=Gc(e))}function ku(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Su(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Dr(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 si(e,t){var n=t.checked;return H({},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=ht(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 ju(e,t){t=t.checked,t!=null&&rs(e,"checked",t,!1)}function oi(e,t){ju(e,t);var n=ht(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")?ui(e,t.type,n):t.hasOwnProperty("defaultValue")&&ui(e,t.type,ht(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 ui(e,t,n){(t!=="number"||Dr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Cn=Array.isArray;function Zt(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 Un(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var _n={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},Xc=["Webkit","ms","Moz","O"];Object.keys(_n).forEach(function(e){Xc.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),_n[t]=_n[e]})});function _u(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||_n.hasOwnProperty(e)&&_n[e]?(""+t).trim():t+"px"}function zu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=_u(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Zc=H({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 di(e,t){if(t){if(Zc[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 fi(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 pi=null;function os(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hi=null,Jt=null,qt=null;function ro(e){if(e=rr(e)){if(typeof hi!="function")throw Error(y(280));var t=e.stateNode;t&&(t=pl(t),hi(e.stateNode,e.type,t))}}function Pu(e){Jt?qt?qt.push(e):qt=[e]:Jt=e}function Lu(){if(Jt){var e=Jt,t=qt;if(qt=Jt=null,ro(e),t)for(e=0;e>>=0,e===0?32:31-(od(e)/ud|0)|0}var fr=64,pr=4194304;function Nn(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 Vr(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=Nn(u):(i&=s,i!==0&&(r=Nn(i)))}else s=n&~l,s!==0?r=Nn(s):i!==0&&(r=Nn(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-Ie(t),e[t]=n}function fd(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=Pn),po=" ",ho=!1;function Zu(e,t){switch(e){case"keyup":return Ad.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ju(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var At=!1;function Wd(e,t){switch(e){case"compositionend":return Ju(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 Bd(e,t){if(At)return e==="compositionend"||!ms&&Zu(e,t)?(e=Gu(),zr=fs=lt=null,At=!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 ta(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ta(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function na(){for(var e=window,t=Dr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dr(e.document)}return t}function vs(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 qd(e){var t=na(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ta(n.ownerDocument.documentElement,n)){if(r!==null&&vs(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,Vt=null,wi=null,Tn=null,Si=!1;function wo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Si||Vt==null||Vt!==Dr(r)||(r=Vt,"selectionStart"in r&&vs(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}),Tn&&Hn(Tn,r)||(Tn=r,r=Hr(wi,"onSelect"),0Ht||(e.current=_i[Ht],_i[Ht]=null,Ht--)}function U(e,t){Ht++,_i[Ht]=e.current,e.current=t}var mt={},oe=gt(mt),he=gt(!1),Pt=mt;function rn(e,t){var n=e.type.contextTypes;if(!n)return mt;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 me(e){return e=e.childContextTypes,e!=null}function Kr(){A(he),A(oe)}function _o(e,t,n){if(oe.current!==mt)throw Error(y(168));U(oe,t),U(he,n)}function da(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,Yc(e)||"Unknown",l));return H({},n,r)}function Yr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mt,Pt=oe.current,U(oe,e),U(he,he.current),!0}function zo(e,t,n){var r=e.stateNode;if(!r)throw Error(y(169));n?(e=da(e,t,Pt),r.__reactInternalMemoizedMergedChildContext=e,A(he),A(oe),U(oe,e)):A(he),U(he,n)}var He=null,hl=!1,Kl=!1;function fa(e){He===null?He=[e]:He.push(e)}function df(e){hl=!0,fa(e)}function yt(){if(!Kl&&He!==null){Kl=!0;var e=0,t=O;try{var n=He;for(O=1;e>=s,l-=s,Qe=1<<32-Ie(t)+l|n<_?(F=E,E=null):F=E.sibling;var R=m(d,E,p[_],v);if(R===null){E===null&&(E=F);break}e&&E&&R.alternate===null&&t(d,E),c=i(R,c,_),N===null?k=R:N.sibling=R,N=R,E=F}if(_===p.length)return n(d,E),V&&St(d,_),k;if(E===null){for(;__?(F=E,E=null):F=E.sibling;var ge=m(d,E,R.value,v);if(ge===null){E===null&&(E=F);break}e&&E&&ge.alternate===null&&t(d,E),c=i(ge,c,_),N===null?k=ge:N.sibling=ge,N=ge,E=F}if(R.done)return n(d,E),V&&St(d,_),k;if(E===null){for(;!R.done;_++,R=p.next())R=h(d,R.value,v),R!==null&&(c=i(R,c,_),N===null?k=R:N.sibling=R,N=R);return V&&St(d,_),k}for(E=r(d,E);!R.done;_++,R=p.next())R=x(E,d,_,R.value,v),R!==null&&(e&&R.alternate!==null&&E.delete(R.key===null?_:R.key),c=i(R,c,_),N===null?k=R:N.sibling=R,N=R);return e&&E.forEach(function(D){return t(d,D)}),V&&St(d,_),k}function z(d,c,p,v){if(typeof p=="object"&&p!==null&&p.type===$t&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case ar:e:{for(var k=p.key,N=c;N!==null;){if(N.key===k){if(k=p.type,k===$t){if(N.tag===7){n(d,N.sibling),c=l(N,p.props.children),c.return=d,d=c;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===et&&To(k)===N.type){n(d,N.sibling),c=l(N,p.props),c.ref=wn(d,N,p),c.return=d,d=c;break e}n(d,N);break}else t(d,N);N=N.sibling}p.type===$t?(c=zt(p.props.children,d.mode,v,p.key),c.return=d,d=c):(v=Fr(p.type,p.key,p.props,null,d.mode,v),v.ref=wn(d,c,p),v.return=d,d=v)}return s(d);case Ut:e:{for(N=p.key;c!==null;){if(c.key===N)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=ei(p,d.mode,v),c.return=d,d=c}return s(d);case et:return N=p._init,z(d,c,N(p._payload),v)}if(Cn(p))return w(d,c,p,v);if(mn(p))return S(d,c,p,v);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=bl(p,d.mode,v),c.return=d,d=c),s(d)):n(d,c)}return z}var sn=va(!0),ga=va(!1),Zr=gt(null),Jr=null,Yt=null,ws=null;function Ss(){ws=Yt=Jr=null}function ks(e){var t=Zr.current;A(Zr),e._currentValue=t}function Li(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 en(e,t){Jr=e,ws=Yt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pe=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(ws!==e)if(e={context:e,memoizedValue:t,next:null},Yt===null){if(Jr===null)throw Error(y(308));Yt=e,Jr.dependencies={lanes:0,firstContext:e}}else Yt=Yt.next=e;return t}var Ct=null;function js(e){Ct===null?Ct=[e]:Ct.push(e)}function ya(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,js(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ze(e,r)}function Ze(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 tt=!1;function Cs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xa(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 Ye(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ct(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,I&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ze(e,n)}return l=r.interleaved,l===null?(t.next=t,js(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ze(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,as(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 qr(e,t,n,r){var l=e.updateQueue;tt=!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 g=e.alternate;g!==null&&(g=g.updateQueue,u=g.lastBaseUpdate,u!==s&&(u===null?g.firstBaseUpdate=f:u.next=f,g.lastBaseUpdate=a))}if(i!==null){var h=l.baseState;s=0,g=f=a=null,u=i;do{var m=u.lane,x=u.eventTime;if((r&m)===m){g!==null&&(g=g.next={eventTime:x,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var w=e,S=u;switch(m=t,x=n,S.tag){case 1:if(w=S.payload,typeof w=="function"){h=w.call(x,h,m);break e}h=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=S.payload,m=typeof w=="function"?w.call(x,h,m):w,m==null)break e;h=H({},h,m);break e;case 2:tt=!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},g===null?(f=g=x,a=h):g=g.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(g===null&&(a=h),l.baseState=a,l.firstBaseUpdate=f,l.lastBaseUpdate=g,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=Gl.transition;Gl.transition={};try{e(!1),t()}finally{O=n,Gl.transition=r}}function Fa(){return Pe().memoizedState}function mf(e,t,n){var r=ft(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Da(e))Ua(t,n);else if(n=ya(e,t,n,r),n!==null){var l=ae();Oe(n,e,r,l),$a(n,t,r)}}function vf(e,t,n){var r=ft(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Da(e))Ua(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,Fe(u,s)){var a=t.interleaved;a===null?(l.next=l,js(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=ya(e,t,l,r),n!==null&&(l=ae(),Oe(n,e,r,l),$a(n,t,r))}}function Da(e){var t=e.alternate;return e===B||t!==null&&t===B}function Ua(e,t){Rn=el=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $a(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,as(e,n)}}var tl={readContext:ze,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useInsertionEffect:le,useLayoutEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useMutableSource:le,useSyncExternalStore:le,useId:le,unstable_isNewReconciler:!1},gf={readContext:ze,useCallback:function(e,t){return $e().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Oo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Rr(4194308,4,Ta.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Rr(4,2,e,t)},useMemo:function(e,t){var n=$e();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=$e();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=mf.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=$e();return e={current:e},t.memoizedState=e},useState:Io,useDebugValue:Rs,useDeferredValue:function(e){return $e().memoizedState=e},useTransition:function(){var e=Io(!1),t=e[0];return e=hf.bind(null,e[1]),$e().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=B,l=$e();if(V){if(n===void 0)throw Error(y(407));n=n()}else{if(n=t(),ee===null)throw Error(y(349));Tt&30||ja(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Oo(Na.bind(null,r,i,e),[e]),r.flags|=2048,qn(9,Ca.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=$e(),t=ee.identifierPrefix;if(V){var n=Ke,r=Qe;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zn++,0")&&(a=a.replace("",e.displayName)),a}while(1<=s&&0<=u);break}}}finally{Ll=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cn(e):""}function Kc(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=Rl(e.type,!1),e;case 11:return e=Rl(e.type.render,!1),e;case 1:return e=Rl(e.type,!0),e;default:return""}}function ii(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 At:return"Fragment";case Ut:return"Portal";case ni:return"Profiler";case ls:return"StrictMode";case ri:return"Suspense";case li:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case xu:return(e.displayName||"Context")+".Consumer";case yu:return(e._context.displayName||"Context")+".Provider";case is:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ss:return t=e.displayName||null,t!==null?t:ii(e.type)||"Memo";case et:t=e._payload,e=e._init;try{return ii(e(t))}catch{}}return null}function Yc(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 ii(t);case 8:return t===ls?"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 ht(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Su(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Gc(e){var t=Su(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=Gc(e))}function ku(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Su(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Dr(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 si(e,t){var n=t.checked;return H({},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=ht(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 ju(e,t){t=t.checked,t!=null&&rs(e,"checked",t,!1)}function oi(e,t){ju(e,t);var n=ht(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")?ui(e,t.type,n):t.hasOwnProperty("defaultValue")&&ui(e,t.type,ht(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 ui(e,t,n){(t!=="number"||Dr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Nn=Array.isArray;function Jt(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 Un(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},Xc=["Webkit","ms","Moz","O"];Object.keys(zn).forEach(function(e){Xc.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zn[t]=zn[e]})});function _u(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 zu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=_u(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Zc=H({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 di(e,t){if(t){if(Zc[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 fi(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 pi=null;function os(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hi=null,qt=null,bt=null;function ro(e){if(e=rr(e)){if(typeof hi!="function")throw Error(y(280));var t=e.stateNode;t&&(t=pl(t),hi(e.stateNode,e.type,t))}}function Pu(e){qt?bt?bt.push(e):bt=[e]:qt=e}function Tu(){if(qt){var e=qt,t=bt;if(bt=qt=null,ro(e),t)for(e=0;e>>=0,e===0?32:31-(od(e)/ud|0)|0}var fr=64,pr=4194304;function En(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 Vr(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=En(u):(i&=s,i!==0&&(r=En(i)))}else s=n&~l,s!==0?r=En(s):i!==0&&(r=En(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-Ie(t),e[t]=n}function fd(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 Zu(e,t){switch(e){case"keyup":return $d.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ju(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $t=!1;function Wd(e,t){switch(e){case"compositionend":return Ju(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 Bd(e,t){if($t)return e==="compositionend"||!ms&&Zu(e,t)?(e=Gu(),zr=fs=lt=null,$t=!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 ta(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ta(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function na(){for(var e=window,t=Dr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dr(e.document)}return t}function vs(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 qd(e){var t=na(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ta(n.ownerDocument.documentElement,n)){if(r!==null&&vs(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,Vt=null,wi=null,Rn=null,Si=!1;function wo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Si||Vt==null||Vt!==Dr(r)||(r=Vt,"selectionStart"in r&&vs(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=Hr(wi,"onSelect"),0Ht||(e.current=_i[Ht],_i[Ht]=null,Ht--)}function U(e,t){Ht++,_i[Ht]=e.current,e.current=t}var mt={},oe=gt(mt),he=gt(!1),Pt=mt;function ln(e,t){var n=e.type.contextTypes;if(!n)return mt;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 me(e){return e=e.childContextTypes,e!=null}function Kr(){$(he),$(oe)}function _o(e,t,n){if(oe.current!==mt)throw Error(y(168));U(oe,t),U(he,n)}function da(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,Yc(e)||"Unknown",l));return H({},n,r)}function Yr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mt,Pt=oe.current,U(oe,e),U(he,he.current),!0}function zo(e,t,n){var r=e.stateNode;if(!r)throw Error(y(169));n?(e=da(e,t,Pt),r.__reactInternalMemoizedMergedChildContext=e,$(he),$(oe),U(oe,e)):$(he),U(he,n)}var He=null,hl=!1,Kl=!1;function fa(e){He===null?He=[e]:He.push(e)}function df(e){hl=!0,fa(e)}function yt(){if(!Kl&&He!==null){Kl=!0;var e=0,t=O;try{var n=He;for(O=1;e>=s,l-=s,Qe=1<<32-Ie(t)+l|n<_?(F=E,E=null):F=E.sibling;var R=m(d,E,p[_],v);if(R===null){E===null&&(E=F);break}e&&E&&R.alternate===null&&t(d,E),c=i(R,c,_),N===null?k=R:N.sibling=R,N=R,E=F}if(_===p.length)return n(d,E),V&&St(d,_),k;if(E===null){for(;__?(F=E,E=null):F=E.sibling;var ge=m(d,E,R.value,v);if(ge===null){E===null&&(E=F);break}e&&E&&ge.alternate===null&&t(d,E),c=i(ge,c,_),N===null?k=ge:N.sibling=ge,N=ge,E=F}if(R.done)return n(d,E),V&&St(d,_),k;if(E===null){for(;!R.done;_++,R=p.next())R=h(d,R.value,v),R!==null&&(c=i(R,c,_),N===null?k=R:N.sibling=R,N=R);return V&&St(d,_),k}for(E=r(d,E);!R.done;_++,R=p.next())R=x(E,d,_,R.value,v),R!==null&&(e&&R.alternate!==null&&E.delete(R.key===null?_:R.key),c=i(R,c,_),N===null?k=R:N.sibling=R,N=R);return e&&E.forEach(function(D){return t(d,D)}),V&&St(d,_),k}function z(d,c,p,v){if(typeof p=="object"&&p!==null&&p.type===At&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case ar:e:{for(var k=p.key,N=c;N!==null;){if(N.key===k){if(k=p.type,k===At){if(N.tag===7){n(d,N.sibling),c=l(N,p.props.children),c.return=d,d=c;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===et&&Lo(k)===N.type){n(d,N.sibling),c=l(N,p.props),c.ref=Sn(d,N,p),c.return=d,d=c;break e}n(d,N);break}else t(d,N);N=N.sibling}p.type===At?(c=zt(p.props.children,d.mode,v,p.key),c.return=d,d=c):(v=Fr(p.type,p.key,p.props,null,d.mode,v),v.ref=Sn(d,c,p),v.return=d,d=v)}return s(d);case Ut:e:{for(N=p.key;c!==null;){if(c.key===N)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=ei(p,d.mode,v),c.return=d,d=c}return s(d);case et:return N=p._init,z(d,c,N(p._payload),v)}if(Nn(p))return w(d,c,p,v);if(vn(p))return S(d,c,p,v);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=bl(p,d.mode,v),c.return=d,d=c),s(d)):n(d,c)}return z}var on=va(!0),ga=va(!1),Zr=gt(null),Jr=null,Yt=null,ws=null;function Ss(){ws=Yt=Jr=null}function ks(e){var t=Zr.current;$(Zr),e._currentValue=t}function Ti(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 tn(e,t){Jr=e,ws=Yt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pe=!0),e.firstContext=null)}function ze(e){var t=e._currentValue;if(ws!==e)if(e={context:e,memoizedValue:t,next:null},Yt===null){if(Jr===null)throw Error(y(308));Yt=e,Jr.dependencies={lanes:0,firstContext:e}}else Yt=Yt.next=e;return t}var Ct=null;function js(e){Ct===null?Ct=[e]:Ct.push(e)}function ya(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,js(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ze(e,r)}function Ze(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 tt=!1;function Cs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xa(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 Ye(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ct(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,I&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ze(e,n)}return l=r.interleaved,l===null?(t.next=t,js(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ze(e,n)}function Tr(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,as(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 qr(e,t,n,r){var l=e.updateQueue;tt=!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 g=e.alternate;g!==null&&(g=g.updateQueue,u=g.lastBaseUpdate,u!==s&&(u===null?g.firstBaseUpdate=f:u.next=f,g.lastBaseUpdate=a))}if(i!==null){var h=l.baseState;s=0,g=f=a=null,u=i;do{var m=u.lane,x=u.eventTime;if((r&m)===m){g!==null&&(g=g.next={eventTime:x,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var w=e,S=u;switch(m=t,x=n,S.tag){case 1:if(w=S.payload,typeof w=="function"){h=w.call(x,h,m);break e}h=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=S.payload,m=typeof w=="function"?w.call(x,h,m):w,m==null)break e;h=H({},h,m);break e;case 2:tt=!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},g===null?(f=g=x,a=h):g=g.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(g===null&&(a=h),l.baseState=a,l.firstBaseUpdate=f,l.lastBaseUpdate=g,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=Gl.transition;Gl.transition={};try{e(!1),t()}finally{O=n,Gl.transition=r}}function Fa(){return Pe().memoizedState}function mf(e,t,n){var r=ft(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Da(e))Ua(t,n);else if(n=ya(e,t,n,r),n!==null){var l=ae();Oe(n,e,r,l),Aa(n,t,r)}}function vf(e,t,n){var r=ft(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Da(e))Ua(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,Fe(u,s)){var a=t.interleaved;a===null?(l.next=l,js(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=ya(e,t,l,r),n!==null&&(l=ae(),Oe(n,e,r,l),Aa(n,t,r))}}function Da(e){var t=e.alternate;return e===B||t!==null&&t===B}function Ua(e,t){Mn=el=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Aa(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,as(e,n)}}var tl={readContext:ze,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useInsertionEffect:le,useLayoutEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useMutableSource:le,useSyncExternalStore:le,useId:le,unstable_isNewReconciler:!1},gf={readContext:ze,useCallback:function(e,t){return Ae().memoizedState=[e,t===void 0?null:t],e},useContext:ze,useEffect:Oo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Rr(4194308,4,La.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Rr(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=mf.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=Ae();return e={current:e},t.memoizedState=e},useState:Io,useDebugValue:Rs,useDeferredValue:function(e){return Ae().memoizedState=e},useTransition:function(){var e=Io(!1),t=e[0];return e=hf.bind(null,e[1]),Ae().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=B,l=Ae();if(V){if(n===void 0)throw Error(y(407));n=n()}else{if(n=t(),ee===null)throw Error(y(349));Lt&30||ja(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Oo(Na.bind(null,r,i,e),[e]),r.flags|=2048,qn(9,Ca.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ae(),t=ee.identifierPrefix;if(V){var n=Ke,r=Qe;n=(r&~(1<<32-Ie(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[Ae]=t,e[Yn]=r,Xa(e,t,!1,!1),t.stateNode=e;e:{switch(s=fi(n,r),n){case"dialog":$("cancel",e),$("close",e),l=r;break;case"iframe":case"object":case"embed":$("load",e),l=r;break;case"video":case"audio":for(l=0;lan&&(t.flags|=128,r=!0,Sn(i,!1),t.lanes=4194304)}else{if(!r)if(e=br(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Sn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!V)return ie(t),null}else 2*G()-i.renderingStartTime>an&&n!==1073741824&&(t.flags|=128,r=!0,Sn(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=G(),t.sibling=null,n=W.current,U(W,r?n&1|2:n&1),t):(ie(t),null);case 22:case 23:return Us(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ye&1073741824&&(ie(t),t.subtreeFlags&6&&(t.flags|=8192)):ie(t),null;case 24:return null;case 25:return null}throw Error(y(156,t.tag))}function Nf(e,t){switch(ys(t),t.tag){case 1:return me(t.type)&&Kr(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return on(),A(he),A(oe),_s(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Es(t),null;case 13:if(A(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(y(340));ln()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return A(W),null;case 4:return on(),null;case 10:return ks(t.type._context),null;case 22:case 23:return Us(),null;case 24:return null;default:return null}}var kr=!1,se=!1,Ef=typeof WeakSet=="function"?WeakSet:Set,j=null;function Gt(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Q(e,t,r)}else n.current=null}function $i(e,t,n){try{n()}catch(r){Q(e,t,r)}}var Ko=!1;function _f(e,t){if(ki=Wr,e=na(),vs(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,g=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&&++g===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(ji={focusedElem:e,selectionRange:n},Wr=!1,j=t;j!==null;)if(t=j,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,j=e;else for(;j!==null;){t=j;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var S=w.memoizedProps,z=w.memoizedState,d=t.stateNode,c=d.getSnapshotBeforeUpdate(t.elementType===t.type?S:Te(t.type,S),z);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(v){Q(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,j=e;break}j=t.return}return w=Ko,Ko=!1,w}function Mn(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&&$i(t,n,i)}l=l.next}while(l!==r)}}function gl(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 Ai(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 qa(e){var t=e.alternate;t!==null&&(e.alternate=null,qa(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ae],delete t[Yn],delete t[Ei],delete t[af],delete t[cf])),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 ba(e){return e.tag===5||e.tag===3||e.tag===4}function Yo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ba(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 Vi(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=Qr));else if(r!==4&&(e=e.child,e!==null))for(Vi(e,t,n),e=e.sibling;e!==null;)Vi(e,t,n),e=e.sibling}function Wi(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(Wi(e,t,n),e=e.sibling;e!==null;)Wi(e,t,n),e=e.sibling}var te=null,Re=!1;function be(e,t,n){for(n=n.child;n!==null;)ec(e,t,n),n=n.sibling}function ec(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount=="function")try{Ve.onCommitFiberUnmount(al,n)}catch{}switch(n.tag){case 5:se||Gt(n,t);case 6:var r=te,l=Re;te=null,be(e,t,n),te=r,Re=l,te!==null&&(Re?(e=te,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):te.removeChild(n.stateNode));break;case 18:te!==null&&(Re?(e=te,n=n.stateNode,e.nodeType===8?Ql(e.parentNode,n):e.nodeType===1&&Ql(e,n),Wn(e)):Ql(te,n.stateNode));break;case 4:r=te,l=Re,te=n.stateNode.containerInfo,Re=!0,be(e,t,n),te=r,Re=l;break;case 0:case 11:case 14:case 15:if(!se&&(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)&&$i(n,t,s),l=l.next}while(l!==r)}be(e,t,n);break;case 1:if(!se&&(Gt(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){Q(n,t,u)}be(e,t,n);break;case 21:be(e,t,n);break;case 22:n.mode&1?(se=(r=se)||n.memoizedState!==null,be(e,t,n),se=r):be(e,t,n);break;default:be(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 Ef),t.forEach(function(r){var l=Ff.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=G()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Pf(r/1960))-r,10e?16:e,it===null)var r=!1;else{if(e=it,it=null,ll=0,I&6)throw Error(y(331));var l=I;for(I|=4,j=e.current;j!==null;){var i=j,s=i.child;if(j.flags&16){var u=i.deletions;if(u!==null){for(var a=0;aG()-Fs?_t(e,0):Os|=n),ve(e,t)}function uc(e,t){t===0&&(e.mode&1?(t=pr,pr<<=1,!(pr&130023424)&&(pr=4194304)):t=1);var n=ae();e=Ze(e,t),e!==null&&(tr(e,t,n),ve(e,n))}function Of(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),uc(e,n)}function Ff(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),uc(e,n)}var ac;ac=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||he.current)pe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pe=!1,jf(e,t,n);pe=!!(e.flags&131072)}else pe=!1,V&&t.flags&1048576&&pa(t,Xr,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Mr(e,t),e=t.pendingProps;var l=rn(t,oe.current);en(t,n),l=Ps(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,me(r)?(i=!0,Yr(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Cs(t),l.updater=vl,t.stateNode=l,l._reactInternals=t,Ri(t,r,e,n),t=Oi(null,t,r,!0,i,n)):(t.tag=0,V&&i&&gs(t),ue(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Mr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Uf(r),e=Te(r,e),l){case 0:t=Ii(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,Te(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:Te(r,l),Ii(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Te(r,l),Bo(e,t,r,l,n);case 3:e:{if(Ka(t),e===null)throw Error(y(387));r=t.pendingProps,i=t.memoizedState,l=i.element,xa(e,t),qr(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=un(Error(y(423)),t),t=Ho(e,t,r,n,l);break e}else if(r!==l){l=un(Error(y(424)),t),t=Ho(e,t,r,n,l);break e}else for(xe=at(t.stateNode.containerInfo.firstChild),we=t,V=!0,Me=null,n=ga(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ln(),r===l){t=Je(e,t,n);break e}ue(e,t,r,n)}t=t.child}return t;case 5:return wa(t),e===null&&Pi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ci(r,l)?s=null:i!==null&&Ci(r,i)&&(t.flags|=32),Qa(e,t),ue(e,t,s,n),t.child;case 6:return e===null&&Pi(t),null;case 13:return Ya(e,t,n);case 4:return Ns(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=sn(t,null,r,n):ue(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Te(r,l),Vo(e,t,r,l,n);case 7:return ue(e,t,t.pendingProps,n),t.child;case 8:return ue(e,t,t.pendingProps.children,n),t.child;case 12:return ue(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,U(Zr,r._currentValue),r._currentValue=s,i!==null)if(Fe(i.value,s)){if(i.children===l.children&&!he.current){t=Je(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=Ye(-1,n&-n),a.tag=2;var f=i.updateQueue;if(f!==null){f=f.shared;var g=f.pending;g===null?a.next=a:(a.next=g.next,g.next=a),f.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Li(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),Li(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}ue(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,en(t,n),l=ze(l),r=r(l),t.flags|=1,ue(e,t,r,n),t.child;case 14:return r=t.type,l=Te(r,t.pendingProps),l=Te(r.type,l),Wo(e,t,r,l,n);case 15:return Ba(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Te(r,l),Mr(e,t),t.tag=1,me(r)?(e=!0,Yr(t)):e=!1,en(t,n),Aa(t,r,l),Ri(t,r,l,n),Oi(null,t,r,!0,e,n);case 19:return Ga(e,t,n);case 22:return Ha(e,t,n)}throw Error(y(156,t.tag))};function cc(e,t){return Du(e,t)}function Df(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 Df(e,t,n,r)}function As(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Uf(e){if(typeof e=="function")return As(e)?1:0;if(e!=null){if(e=e.$$typeof,e===is)return 11;if(e===ss)return 14}return 2}function pt(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 Fr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")As(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case $t:return zt(n.children,l,i,t);case ls:s=8,l|=8;break;case ni:return e=Ee(12,n,t,l|2),e.elementType=ni,e.lanes=i,e;case ri:return e=Ee(13,n,t,l),e.elementType=ri,e.lanes=i,e;case li:return e=Ee(19,n,t,l),e.elementType=li,e.lanes=i,e;case wu:return xl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yu:s=10;break e;case xu:s=9;break e;case is:s=11;break e;case ss:s=14;break e;case et: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 xl(e,t,n,r){return e=Ee(22,e,r,t),e.elementType=wu,e.lanes=n,e.stateNode={isHidden:!1},e}function bl(e,t,n){return e=Ee(6,e,null,t),e.lanes=n,e}function ei(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 $f(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=Il(0),this.expirationTimes=Il(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Il(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Vs(e,t,n,r,l,i,s,u,a){return e=new $f(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},Cs(i),e}function Af(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(hc)}catch(e){console.error(e)}}hc(),hu.exports=ke;var Qf=hu.exports,mc,nu=Qf;mc=nu.createRoot,nu.hydrateRoot;const vc=[{id:"messages",label:"消息",description:"查找会话、阅读并回复",icon:"message"},{id:"broadcast",label:"群发",description:"创建受控群发任务",icon:"send"},{id:"contacts",label:"通讯录",description:"查找联系人和群聊",icon:"contacts"},{id:"tasks",label:"任务",description:"查看执行结果",icon:"tasks"}],gc={Online:"在线",Degraded:"需要注意",Offline:"已离线",Registered:"已注册",SessionLocked:"桌面已锁定",WechatNotRunning:"微信未运行",WechatNotLoggedIn:"微信未登录",Pending:"待处理",WaitingForClient:"等待 Client",Accepted:"已接收",Running:"执行中",Succeeded:"已完成",Failed:"失败",Cancelled:"已取消",Expired:"已过期",ResultUnconfirmed:"待核对"},Kf=new Set(["Succeeded","Failed","Cancelled","Expired","ResultUnconfirmed"]);class Fn extends Error{constructor(t,n,r="RequestFailed"){super(t),this.status=n,this.code=r}}async function Et(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 Fn(((u=s.error)==null?void 0:u.message)||`请求失败(${i.status})`,i.status,(a=s.error)==null?void 0:a.code);return s}const Yf=e=>new Promise(t=>window.setTimeout(t,e));async function Gf(e,t){var l,i,s;const n=Date.now()+3e4;let r=250;for(;Date.now()t?`${e.slice(0,t)}…`:e:"—"}function Xf(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 yc(e){return gc[e]||e||"未知"}function ol(e){return!!(e&&["Online","Degraded","Registered"].includes(e.status))}function Qs(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 Ks(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 Zf(e){return Ks(e,["items","sessions","chats"]).map((t,n)=>({id:String(t.chat_id??t.chatId??t.session_id??t.id??n),title:String(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 Jf(e){return Ks(e,["items","messages"]).map((t,n)=>({id:String(t.message_id??t.messageId??t.id??n),sender:String(t.sender??t.sender_name??t.senderName??"对方"),text:typeof t=="string"?t:String(t.content??t.text??t.message??""),at:t.occurred_at??t.occurredAt??t.created_at??t.createdAt}))}function qf(e){return Ks(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 K({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 dn({value:e}){return o.jsxs("span",{className:`status-badge ${Xf(e)}`,children:[o.jsx("i",{}),yc(e)]})}function bf({onLogin:e}){const[t,n]=L.useState(""),[r,l]=L.useState(""),[i,s]=L.useState(""),[u,a]=L.useState(!1),f=async g=>{g.preventDefault(),s(""),a(!0);try{const h=await Et("/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:g=>n(g.target.value),autoComplete:"username"})]}),o.jsxs("label",{children:["密码",o.jsx("input",{type:"password",value:r,onChange:g=>l(g.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 ep({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:vc.map(l=>o.jsxs("button",{className:e===l.id?"nav-item active":"nav-item",onClick:()=>t(l.id),children:[o.jsx(K,{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(K,{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(K,{name:"logout",size:17})})]})]})}function tp({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," · ",yc(a.status)]},a.node_id))]})]}),u&&o.jsx(dn,{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(K,{name:"refresh",size:16})}),s?"同步中":"刷新"]})]})]})}function np({nodes:e,selectedNode:t,onSettings:n}){if(!e.length)return o.jsxs("div",{className:"connection-banner negative",children:[o.jsx(K,{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(!ol(t)){const r=e.some(ol);return o.jsxs("div",{className:"connection-banner warning",children:[o.jsx(K,{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 Qs(t)?null:o.jsxs("div",{className:"connection-banner warning",children:[o.jsx(K,{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 Gi({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(K,{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 Xi({text:e="正在读取…"}){return o.jsxs("div",{className:"loading-state",children:[o.jsx("span",{className:"loader"}),e]})}function It({text:e,action:t}){return o.jsxs("div",{className:"empty-state",children:[o.jsx("div",{className:"empty-icon",children:o.jsx(K,{name:"search",size:26})}),o.jsx("p",{children:e}),t]})}function Zi({error:e,onRetry:t}){return o.jsxs("div",{className:"inline-error",role:"alert",children:[o.jsx(K,{name:"alert",size:17}),o.jsx("span",{children:e}),t&&o.jsx("button",{className:"text-button",onClick:t,children:"重试"})]})}function rp({token:e,client:t,onSettings:n}){const r=(t==null?void 0:t.node_id)||"",l=Qs(t),[i,s]=L.useState([]),[u,a]=L.useState({loading:!1,error:""}),[f,g]=L.useState(""),[h,m]=L.useState(null),[x,w]=L.useState([]),[S,z]=L.useState({loading:!1,error:""}),d=L.useRef(0),c=L.useCallback(async()=>{if(!r||!l)return;const v=++d.current;a({loading:!0,error:""});try{const k=await Yi("/v1/reads/sessions",{node_id:r,account_id:l,limit:100},e);if(v!==d.current)return;s(Zf(k))}catch(k){v===d.current&&a({loading:!1,error:k.message});return}a({loading:!1,error:""})},[l,r,e]);if(L.useEffect(()=>{m(null),s([]),w([]),!(!r||!l)&&c()},[r,l,c]),L.useEffect(()=>{if(!h||h.clientId!==r||!r||!l)return;const v=++d.current;z({loading:!0,error:""}),Yi("/v1/reads/messages",{node_id:r,account_id:l,chat_id:h.id,limit:100,include_content:!0},e).then(k=>{v===d.current&&(w(Jf(k)),z({loading:!1,error:""}))}).catch(k=>{v===d.current&&z({loading:!1,error:k.message})})},[l,r,h,e]),!t)return o.jsx(Gi,{onSettings:n});const p=i.filter(v=>!f||`${v.title} ${v.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(K,{name:"refresh",size:16})})]}),o.jsxs("label",{className:"search-box",children:[o.jsx(K,{name:"search",size:16}),o.jsx("input",{value:f,onChange:v=>g(v.target.value),placeholder:"搜索会话"})]}),u.loading?o.jsx(Xi,{text:"正在读取会话…"}):u.error?o.jsx(Zi,{error:u.error,onRetry:c}):p.length===0?o.jsx(It,{text:"暂无会话,或当前账号还没有可见数据。"}):o.jsx("div",{className:"session-list",children:p.map(v=>o.jsxs("button",{className:(h==null?void 0:h.id)===v.id?"session-row selected":"session-row",onClick:()=>m({...v,clientId:r}),children:[o.jsx("span",{className:"session-avatar",children:v.title.slice(0,1).toUpperCase()}),o.jsxs("span",{className:"session-copy",children:[o.jsx("strong",{children:v.title}),o.jsx("small",{children:v.preview})]}),v.unread>0&&o.jsx("b",{children:v.unread})]},v.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"?"群聊":"私聊"," · ",Cl(h.id,28)]})]}),o.jsx(dn,{value:t.status})]}),S.loading?o.jsx(Xi,{text:"正在读取消息…"}):S.error?o.jsx(Zi,{error:S.error,onRetry:()=>m({...h})}):x.length===0?o.jsx(It,{text:"这个会话暂时没有可显示的消息。"}):o.jsx("div",{className:"message-list",children:x.map(v=>o.jsxs("article",{className:"message-row",children:[o.jsx("div",{className:"message-avatar",children:v.sender.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsxs("div",{className:"message-meta",children:[o.jsx("strong",{children:v.sender}),o.jsx("span",{children:cn(v.at)})]}),o.jsx("p",{children:v.text||"(无正文)"})]})]},v.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(Gi,{title:"选择一个会话",text:"从左侧选择会话后,读取该 Client 的消息。"})})]})}function lp({client:e,onSettings:t}){return o.jsxs("section",{className:"workspace-panel gated-panel",children:[o.jsx("div",{className:"gated-mark",children:o.jsx(K,{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(K,{name:"arrow",size:14})]})]})]})}function ip({token:e,client:t,onSettings:n}){const r=(t==null?void 0:t.node_id)||"",l=Qs(t),[i,s]=L.useState(!1),[u,a]=L.useState(""),[f,g]=L.useState([]),[h,m]=L.useState({loading:!1,error:""}),x=L.useRef(0),w=L.useCallback(async()=>{if(!r||!l)return;const z=++x.current;m({loading:!0,error:""});try{const d=await Yi("/v1/reads/contacts",{node_id:r,account_id:l,limit:200,groups_only:i,contains:u},e);if(z!==x.current)return;g(qf(d)),m({loading:!1,error:""})}catch(d){z===x.current&&m({loading:!1,error:d.message})}},[l,r,i,u,e]);if(L.useEffect(()=>{g([]),r&&l&&w()},[r,l,i]),!t)return o.jsx(Gi,{onSettings:n});const S=f.filter(z=>!u||`${z.title} ${z.id} ${z.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:z=>s(z.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(K,{name:"search",size:16}),o.jsx("input",{value:u,onChange:z=>a(z.target.value),onKeyDown:z=>z.key==="Enter"&&w(),placeholder:"搜索联系人或群聊"})]}),o.jsx("button",{className:"secondary-button",onClick:w,disabled:h.loading,children:h.loading?"读取中…":"刷新"})]}),h.loading?o.jsx(Xi,{text:"正在读取通讯录…"}):h.error?o.jsx(Zi,{error:h.error,onRetry:w}):S.length===0?o.jsx(It,{text:"暂无可见联系人或群聊。"}):o.jsx("div",{className:"contact-list",children:S.map(z=>o.jsxs("div",{className:"contact-row",children:[o.jsx("span",{className:"contact-avatar",children:z.title.slice(0,1).toUpperCase()}),o.jsxs("div",{children:[o.jsx("strong",{children:z.title}),o.jsxs("small",{children:[z.type==="Group"?"群聊":"联系人"," · ",Cl(z.id,28),z.detail?` · ${z.detail}`:""]})]}),o.jsx("button",{className:"text-button",disabled:!0,title:"写操作尚未通过真机验收",children:"添加好友"})]},z.id))})]})}function sp({tasks:e,selectedClientId:t}){const[n,r]=L.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(K,{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(It,{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(dn,{value:i.status})]}),o.jsxs("p",{children:[i.account_id," · ",Cl(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)||`更新于 ${cn(i.updated_at)}`})]}),o.jsxs("div",{className:"task-meta",children:[o.jsxs("span",{children:["第 ",i.lease_generation||0," 代租约"]}),o.jsx("time",{children:cn(i.updated_at)})]})]},i.task_id)})})]})}function op({nodes:e}){return o.jsx("div",{className:"diagnostic-list",children:e.length===0?o.jsx(It,{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||"尚未确认活动账号"," · 最近心跳 ",cn(t.last_heartbeat_at)]})]})]}),o.jsx(dn,{value:t.status})]},t.node_id))})}function up({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(It,{text:"当前 Client 暂无事件。"}):n.slice(0,30).map(r=>o.jsxs("article",{className:"diagnostic-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Cl(r.chat_id,24)}),o.jsxs("small",{children:[r.node_id," · ",r.chat_type==="Group"?"群聊":"私聊"," · ",cn(r.received_at)]})]}),o.jsx("span",{className:"event-preview",children:r.content||"无正文"})]},r.event_id))})}function ap({audit:e}){return o.jsx("div",{className:"diagnostic-list",children:e.length===0?o.jsx(It,{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:cn(t.at)})]},t.id))})}function cp({nodes:e,events:t,audit:n,selectedClientId:r,onSelectClient:l}){const[i,s]=L.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(dn,{value:e.some(ol)?"Online":"Offline"})]}),o.jsx(op,{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(K,{name:"check",size:15}),"消息、通讯录、任务结果按选定 Client 隔离读取"]}),o.jsxs("li",{children:[o.jsx(K,{name:"check",size:15}),"Client 掉线只影响当前上下文,任务不会自动改投"]}),o.jsxs("li",{children:[o.jsx(K,{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(dn,{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(K,{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(up,{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(ap,{audit:n})]})]})})]})}function dp(){const[e,t]=L.useState(()=>sessionStorage.getItem("wxagent-token")||""),[n,r]=L.useState(()=>sessionStorage.getItem("wxagent-user")||""),[l,i]=L.useState("messages"),[s,u]=L.useState([]),[a,f]=L.useState(()=>sessionStorage.getItem("wxagent-client")||""),[g,h]=L.useState([]),[m,x]=L.useState([]),[w,S]=L.useState([]),[z,d]=L.useState(!1),[c,p]=L.useState(""),v=L.useCallback(()=>{sessionStorage.removeItem("wxagent-token"),sessionStorage.removeItem("wxagent-user"),sessionStorage.removeItem("wxagent-client"),t(""),r("")},[]),k=L.useCallback(async()=>{if(e){d(!0),p("");try{const[D,De,ir,Nl]=await Promise.all([Et("/v1/nodes",{token:e}),Et("/v1/tasks?limit=200",{token:e}),Et("/v1/events?limit=200",{token:e}),Et("/v1/audit?limit=200",{token:e})]);u(D.nodes||[]),h(De.tasks||[]),x(ir.events||[]),S(Nl.audit||[])}catch(D){D.status===401?v():p(D.message)}finally{d(!1)}}},[v,e]);L.useEffect(()=>{if(k(),!e)return;const D=window.setInterval(k,15e3);return()=>window.clearInterval(D)},[k,e]),L.useEffect(()=>{if(!s.length){f("");return}if(!s.some(D=>D.node_id===a)){const D=s.find(ol)||s[0];f(D.node_id),sessionStorage.setItem("wxagent-client",D.node_id)}},[s,a]);const N=D=>{f(D),sessionStorage.setItem("wxagent-client",D)},E=(D,De)=>{sessionStorage.setItem("wxagent-token",D),sessionStorage.setItem("wxagent-user",De),t(D),r(De)},_=L.useMemo(()=>s.find(D=>D.node_id===a),[s,a]),F=vc.find(D=>D.id===l),R=(F==null?void 0:F.label)||"设置与诊断",ge=(F==null?void 0:F.description)||"连接、账号和高级诊断信息";return e?o.jsxs("div",{className:"app-shell",children:[o.jsx(ep,{view:l,setView:i,onLogout:v,username:n}),o.jsxs("main",{className:"main-area",children:[o.jsx(tp,{title:R,subtitle:ge,nodes:s,selectedClientId:a,onClientChange:N,onRefresh:k,loading:z}),c&&o.jsxs("div",{className:"global-error",role:"alert",children:[o.jsx(K,{name:"alert",size:16}),o.jsx("span",{children:c}),o.jsx("button",{onClick:()=>p(""),"aria-label":"关闭错误",children:o.jsx(K,{name:"close",size:16})})]}),o.jsx(np,{nodes:s,selectedNode:_,onSettings:()=>i("settings")}),o.jsxs("div",{className:"page-content",children:[l==="messages"&&o.jsx(rp,{token:e,client:_,onSettings:()=>i("settings")}),l==="broadcast"&&o.jsx(lp,{client:_,onSettings:()=>i("settings")}),l==="contacts"&&o.jsx(ip,{token:e,client:_,onSettings:()=>i("settings")}),l==="tasks"&&o.jsx(sp,{tasks:g,selectedClientId:a}),l==="settings"&&o.jsx(cp,{nodes:s,events:m,audit:w,selectedClientId:a,onSelectClient:N})]}),o.jsxs("footer",{className:"footer",children:[o.jsx("span",{children:"WxAgent 工作台 · Client 独立隔离"}),o.jsx("span",{children:"写操作需通过真实能力与真机验收"})]})]})]}):o.jsx(bf,{onLogin:E})}mc(document.getElementById("root")).render(o.jsx(dp,{})); +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function Jl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Mi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var wf=typeof WeakMap=="function"?WeakMap:Map;function Va(e,t,n){n=Ye(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,Bi=r),Mi(e,t)},n}function Wa(e,t,n){n=Ye(-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(){Mi(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Mi(e,t),typeof r!="function"&&(dt===null?dt=new Set([this]):dt.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Uo(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new wf;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=If.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 $o(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=Ye(-1,1),t.tag=2,ct(n,t,1))),n.lanes|=1),e)}var Sf=qe.ReactCurrentOwner,pe=!1;function ue(e,t,n,r){t.child=e===null?ga(t,null,n,r):on(t,e.child,n,r)}function Vo(e,t,n,r,l){n=n.render;var i=t.ref;return tn(t,l),r=Ps(e,t,n,r,i,l),n=Ts(),e!==null&&!pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Je(e,t,l)):(V&&n&&gs(t),t.flags|=1,ue(e,t,r,l),t.child)}function Wo(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!$s(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Ba(e,t,i,r,l)):(e=Fr(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 Je(e,t,l)}return t.flags|=1,e=pt(i,r),e.ref=t.ref,e.return=t,t.child=e}function Ba(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(Hn(i,r)&&e.ref===t.ref)if(pe=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(pe=!0);else return t.lanes=e.lanes,Je(e,t,l)}return Ii(e,t,n,r,l)}function Ha(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},U(Xt,ye),ye|=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,U(Xt,ye),ye|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,U(Xt,ye),ye|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,U(Xt,ye),ye|=r;return ue(e,t,l,n),t.child}function Qa(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ii(e,t,n,r,l){var i=me(n)?Pt:oe.current;return i=ln(t,i),tn(t,l),n=Ps(e,t,n,r,i,l),r=Ts(),e!==null&&!pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Je(e,t,l)):(V&&r&&gs(t),t.flags|=1,ue(e,t,n,l),t.child)}function Bo(e,t,n,r,l){if(me(n)){var i=!0;Yr(t)}else i=!1;if(tn(t,l),t.stateNode===null)Mr(e,t),$a(t,n,r),Ri(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=ze(f):(f=me(n)?Pt:oe.current,f=ln(t,f));var g=n.getDerivedStateFromProps,h=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function";h||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u!==r||a!==f)&&Do(t,s,r,f),tt=!1;var m=t.memoizedState;s.state=m,qr(t,r,s,l),a=t.memoizedState,u!==r||m!==a||he.current||tt?(typeof g=="function"&&(Li(t,n,g,r),a=t.memoizedState),(u=tt||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,xa(e,t),u=t.memoizedProps,f=t.type===t.elementType?u:Le(t.type,u),s.props=f,h=t.pendingProps,m=s.context,a=n.contextType,typeof a=="object"&&a!==null?a=ze(a):(a=me(n)?Pt:oe.current,a=ln(t,a));var x=n.getDerivedStateFromProps;(g=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),tt=!1,m=t.memoizedState,s.state=m,qr(t,r,s,l);var w=t.memoizedState;u!==h||m!==w||he.current||tt?(typeof x=="function"&&(Li(t,n,x,r),w=t.memoizedState),(f=tt||Fo(t,n,f,r,m,w,a)||!1)?(g||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,w,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,w,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=w),s.props=r,s.state=w,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 Oi(e,t,n,r,i,l)}function Oi(e,t,n,r,l,i){Qa(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return l&&zo(t,n,!1),Je(e,t,i);r=t.stateNode,Sf.current=t;var u=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=on(t,e.child,null,i),t.child=on(t,null,u,i)):ue(e,t,u,i),t.memoizedState=r.state,l&&zo(t,n,!0),t.child}function Ka(e){var t=e.stateNode;t.pendingContext?_o(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_o(e,t.context,!1),Ns(e,t.containerInfo)}function Ho(e,t,n,r,l){return sn(),xs(l),t.flags|=256,ue(e,t,n,r),t.child}var Fi={dehydrated:null,treeContext:null,retryLane:0};function Di(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ya(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),U(W,l&1),e===null)return Pi(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=xl(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=Di(n),t.memoizedState=Fi,e):Ms(t,s));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return kf(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=pt(l,a),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?i=pt(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?Di(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Fi,r}return i=e.child,e=i.sibling,r=pt(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 Ms(e,t){return t=xl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Sr(e,t,n,r){return r!==null&&xs(r),on(t,e.child,null,n),e=Ms(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kf(e,t,n,r,l,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Jl(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=xl({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&&on(t,e.child,null,s),t.child.memoizedState=Di(s),t.memoizedState=Fi,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=Jl(i,r,void 0),Sr(e,t,s,r)}if(u=(s&e.childLanes)!==0,pe||u){if(r=ee,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,Ze(e,l),Oe(r,e,l,-1))}return As(),r=Jl(Error(y(421))),Sr(e,t,s,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Of.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,xe=at(l.nextSibling),we=t,V=!0,Me=null,e!==null&&(Ce[Ne++]=Qe,Ce[Ne++]=Ke,Ce[Ne++]=Tt,Qe=e.id,Ke=e.overflow,Tt=t),t=Ms(t,r.children),t.flags|=4096,t)}function Qo(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ti(e.return,t,n)}function ql(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 Ga(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(ue(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(U(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&&br(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ql(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&&br(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ql(t,!0,n,null,i);break;case"together":ql(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Mr(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Je(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=pt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=pt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jf(e,t,n){switch(t.tag){case 3:Ka(t),sn();break;case 5:wa(t);break;case 1:me(t.type)&&Yr(t);break;case 4:Ns(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;U(Zr,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(U(W,W.current&1),t.flags|=128,null):n&t.child.childLanes?Ya(e,t,n):(U(W,W.current&1),e=Je(e,t,n),e!==null?e.sibling:null);U(W,W.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ga(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),U(W,W.current),r)break;return null;case 22:case 23:return t.lanes=0,Ha(e,t,n)}return Je(e,t,n)}var Xa,Ui,Za,Ja;Xa=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(){};Za=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Nt(We.current);var i=null;switch(n){case"input":l=si(e,l),r=si(e,r),i=[];break;case"select":l=H({},l,{value:void 0}),r=H({},r,{value:void 0}),i=[];break;case"textarea":l=ai(e,l),r=ai(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Qr)}di(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)}};Ja=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 ie(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 Cf(e,t,n){var r=t.pendingProps;switch(ys(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ie(t),null;case 1:return me(t.type)&&Kr(),ie(t),null;case 3:return r=t.stateNode,un(),$(he),$(oe),_s(),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,Me!==null&&(Ki(Me),Me=null))),Ui(e,t),ie(t),null;case 5:Es(t);var l=Nt(Xn.current);if(n=t.type,e!==null&&t.stateNode!=null)Za(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 ie(t),null}if(e=Nt(We.current),xr(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[$e]=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<_n.length;l++)A(_n[l],r);break;case"source":A("error",r);break;case"img":case"image":case"link":A("error",r),A("load",r);break;case"details":A("toggle",r);break;case"input":bs(r,i),A("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},A("invalid",r);break;case"textarea":to(r,i),A("invalid",r)}di(n,i),l=null;for(var s in i)if(i.hasOwnProperty(s)){var u=i[s];s==="children"?typeof u=="string"?r.textContent!==u&&(i.suppressHydrationWarning!==!0&&yr(r.textContent,u,e),l=["children",u]):typeof u=="number"&&r.textContent!==""+u&&(i.suppressHydrationWarning!==!0&&yr(r.textContent,u,e),l=["children",""+u]):Dn.hasOwnProperty(s)&&u!=null&&s==="onScroll"&&A("scroll",r)}switch(n){case"input":cr(r),eo(r,i,!0);break;case"textarea":cr(r),no(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Qr)}r=l,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=l.nodeType===9?l:l.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Nu(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML=" + diff --git a/control-plane/web/src/main.jsx b/control-plane/web/src/main.jsx index 0fbf715..a061528 100644 --- a/control-plane/web/src/main.jsx +++ b/control-plane/web/src/main.jsx @@ -66,26 +66,41 @@ async function api(path, { token, method = "GET", body } = {}) { const wait = (duration) => new Promise((resolve) => window.setTimeout(resolve, duration)); +const TASK_ERROR_MESSAGES = { + ReportingDisabled: "Client 未启用 Reporting 白名单。请在托盘远程连接页启用并配置白名单。", + ReportingConfigInvalid: "Client 的 Reporting 配置无效,请检查托盘远程连接页。", + AccountNotAuthorized: "当前账号未加入 Client 的 Reporting 白名单。", + ChatNotAuthorized: "当前会话不在 Client 的 Reporting 白名单中。", + ChatIdentityUnconfirmed: "当前会话身份尚未确认,暂不能读取。", + DataTypeNotAuthorized: "当前读取类型未被 Reporting 白名单授权。", +}; + +function taskFailureMessage(task) { + const code = task.result?.error_code || task.status; + return TASK_ERROR_MESSAGES[code] || task.result?.message || `读取任务${STATUS_LABELS[task.status] || "未完成"}。`; +} + async function waitForTask(token, taskId) { const deadline = Date.now() + 30000; let delay = 250; + let lastTask = { status: "Pending" }; while (Date.now() < deadline) { const task = await api(`/v1/tasks/${encodeURIComponent(taskId)}`, { token }); + lastTask = task; if (task.status === "Succeeded") return task.result?.content || {}; if (task.status === "WaitingForClient") { throw new ApiError("当前 Client 暂不可用,请切换 Client 后重试。", 409, "ClientNotReady"); } if (TERMINAL_TASKS.has(task.status)) { - throw new ApiError( - task.result?.message || `读取任务${STATUS_LABELS[task.status] || "未完成"}。`, - 409, - task.result?.error_code || task.status, - ); + throw new ApiError(taskFailureMessage(task), 409, task.result?.error_code || task.status); } await wait(delay); delay = Math.min(1000, delay + 150); } - throw new ApiError("读取超时,请稍后重试。", 408, "ReadTimeout"); + if (lastTask.status === "Running") { + throw new ApiError(`Client 仍在执行读取任务(${taskId.slice(0, 12)}…),请稍后在任务页查看结果。`, 408, "TaskRunning"); + } + throw new ApiError(`任务仍在等待 Client 领取(${taskId.slice(0, 12)}…),请检查 Reporting 账号配置。`, 408, "TaskPending"); } async function readWithTask(path, body, token) { @@ -159,7 +174,7 @@ function extractItems(content, keys) { function normalizeSessions(content) { return extractItems(content, ["items", "sessions", "chats"]).map((item, index) => ({ - id: String(item.chat_id ?? item.chatId ?? item.session_id ?? item.id ?? index), + id: String(item.chat_id ?? item.chatId ?? item.session_id ?? item.sessionId ?? item.automation_id ?? item.automationId ?? item.id ?? index), title: String(item.name ?? item.display_name ?? item.displayName ?? item.nickname ?? item.chat_id ?? item.id ?? "未命名会话"), preview: String(item.last_message ?? item.lastMessage ?? item.preview ?? "暂无最近消息"), unread: Number(item.unread_count ?? item.unreadCount ?? 0), diff --git a/node-agent/WxAgent.Host/WindowsAgentBackend.cs b/node-agent/WxAgent.Host/WindowsAgentBackend.cs index 6d0552c..8fa6357 100644 --- a/node-agent/WxAgent.Host/WindowsAgentBackend.cs +++ b/node-agent/WxAgent.Host/WindowsAgentBackend.cs @@ -370,9 +370,10 @@ public sealed class WindowsAgentBackend(AccountBindingStore bindings, ServiceOpt { if (!string.IsNullOrWhiteSpace(session)) { - var matches = await WechatChatClient.SearchSessionsAsync(session, exactOnly: true, cancellationToken: cancellationToken); - if (matches.Count != 1) throw new ServiceException(matches.Count == 0 ? "NotFound" : "AmbiguousTarget", 409, "Session name is not unique or not found."); - await WechatChatClient.OpenSessionAsync(matches[0].Name, cancellationToken, session); + var requestedName = session.StartsWith("session_item_", StringComparison.Ordinal) + ? session["session_item_".Length..] + : session; + await WechatChatClient.OpenSessionAsync(requestedName, cancellationToken); } var messages = await WechatChatClient.ReadVisibleAsync(cancellationToken); return messages.Select(m => new MessageInfo(m.Fingerprint, m.Type.ToString(), m.Quote?.Sender, diff --git a/node-agent/WxAgent.Service/RemoteAgentHostedService.cs b/node-agent/WxAgent.Service/RemoteAgentHostedService.cs index 7fde772..7092e06 100644 --- a/node-agent/WxAgent.Service/RemoteAgentHostedService.cs +++ b/node-agent/WxAgent.Service/RemoteAgentHostedService.cs @@ -64,9 +64,20 @@ public sealed class RemoteAgentHostedService( await client.HeartbeatAsync(CreateHeartbeat(remote, reporting, snapshot, null), stoppingToken); await ReplayUnreportedResultsAsync(client, ledger, reporting, stoppingToken); await client.FlushEventsAsync(eventQueue, reporting, stoppingToken); - foreach (var account in reporting.Accounts.Where(account => account.Enabled)) + var pollAccountIds = reporting.Accounts + .Where(account => account.Enabled) + .Select(account => account.AccountId) + .ToList(); + if (snapshot.ActiveAccountId is { Length: > 0 } activeAccountId && + !pollAccountIds.Contains(activeAccountId, StringComparer.Ordinal)) { - var tasks = await client.PollTasksAsync(account.AccountId, stoppingToken, waitSeconds: 5); + // Poll the verified active account even before a Reporting whitelist is configured. + // The task then returns an explicit authorization result instead of staying Pending. + pollAccountIds.Add(activeAccountId); + } + foreach (var accountId in pollAccountIds) + { + var tasks = await client.PollTasksAsync(accountId, stoppingToken, waitSeconds: 5); foreach (var task in tasks) { await ProcessTaskAsync(client, remote, reporting, ledger, task, stoppingToken); @@ -254,11 +265,13 @@ public sealed class RemoteAgentHostedService( var payload = ReadPayload(task.Payload); ValidatePage(payload.Limit, payload.Offset); var scopes = AuthorizedChatScopes(reporting, task.AccountId); - RequireScopes(scopes); - var sessions = (await backend.SessionsAsync(task.AccountId, cancellationToken)) - .Where(session => scopes.Any(scope => scope.ChatId == session.AutomationId)) + RequireScopes(reporting, task.AccountId, scopes); + var sessions = await backend.SessionsAsync(task.AccountId, cancellationToken); + var contacts = await ReadContactsForScopesAsync(task.AccountId, scopes, cancellationToken); + var visibleSessions = sessions + .Where(session => scopes.Any(scope => SessionMatchesScope(session, scope, contacts))) .ToArray(); - var page = sessions.ToPage(payload.Limit, payload.Offset); + var page = visibleSessions.ToPage(payload.Limit, payload.Offset); return new RemoteReadExecution(JsonSerializer.SerializeToElement(page, RemoteJson.Options), scopes); } case "read-contacts": @@ -267,7 +280,7 @@ public sealed class RemoteAgentHostedService( ValidatePage(payload.Limit, payload.Offset); var chatType = payload.GroupsOnly ? ReportingChatType.Group : ReportingChatType.Private; var scopes = AuthorizedChatScopes(reporting, task.AccountId, chatType); - RequireScopes(scopes); + RequireScopes(reporting, task.AccountId, scopes); var all = new List(); for (var offset = 0; ;) { @@ -288,17 +301,31 @@ public sealed class RemoteAgentHostedService( { var payload = ReadPayload(task.Payload); ValidatePage(payload.Limit, payload.Offset); - var scopes = AuthorizedChatScopes(reporting, task.AccountId) - .Where(scope => string.Equals(scope.ChatId, payload.ChatId, StringComparison.Ordinal)) - .ToArray(); - if (scopes.Length != 1) - throw new ServiceException("ChatNotAuthorized", 403, "The requested chat is not enabled in the local whitelist."); - var sessions = (await backend.SessionsAsync(task.AccountId, cancellationToken)) + var scopes = AuthorizedChatScopes(reporting, task.AccountId); + RequireScopes(reporting, task.AccountId, scopes); + var sessions = await backend.SessionsAsync(task.AccountId, cancellationToken); + var contacts = await ReadContactsForScopesAsync(task.AccountId, scopes, cancellationToken); + var candidateSessions = sessions .Where(session => string.Equals(session.AutomationId, payload.ChatId, StringComparison.Ordinal)) .ToArray(); - if (sessions.Length != 1) + var scope = scopes.FirstOrDefault(allowed => string.Equals(allowed.ChatId, payload.ChatId, StringComparison.Ordinal)); + if (scope is null) + { + var mapped = sessions + .Where(session => scopes.Any(allowed => SessionMatchesScope(session, allowed, contacts))) + .Where(session => string.Equals(session.AutomationId, payload.ChatId, StringComparison.Ordinal)) + .ToArray(); + if (mapped.Length == 1) + { + candidateSessions = mapped; + scope = scopes.First(allowed => SessionMatchesScope(mapped[0], allowed, contacts)); + } + } + if (scope is null) + throw new ServiceException("ChatNotAuthorized", 403, "The requested chat is not enabled in the local whitelist."); + if (candidateSessions.Length != 1) throw new ServiceException("ChatIdentityUnconfirmed", 409, "The requested chat identity is not uniquely visible."); - var messages = await backend.MessagesAsync(task.AccountId, sessions[0].Name, payload.IncludeContent, cancellationToken); + var messages = await backend.MessagesAsync(task.AccountId, candidateSessions[0].AutomationId, payload.IncludeContent, cancellationToken); var page = messages.ToPage(payload.Limit, payload.Offset); return new RemoteReadExecution(JsonSerializer.SerializeToElement(page, RemoteJson.Options), scopes); } @@ -307,6 +334,44 @@ public sealed class RemoteAgentHostedService( } } + private async Task> ReadContactsForScopesAsync( + string accountId, IReadOnlyList scopes, CancellationToken cancellationToken) + { + var contacts = new Dictionary(StringComparer.Ordinal); + foreach (var scope in scopes) + { + for (var offset = 0; ;) + { + var page = await backend.ContactsAsync( + accountId, + contains: scope.ChatId, + groupsOnly: scope.ChatType == ReportingChatType.Group, + 200, + offset, + cancellationToken); + foreach (var contact in page.Items.Where(contact => string.Equals(contact.Id, scope.ChatId, StringComparison.Ordinal))) + contacts[contact.Id] = contact; + if (!page.HasMore) break; + var next = page.NextOffset ?? offset + page.Items.Count; + if (next <= offset) + throw new ServiceException("InvalidPage", 500, "The node returned a non-advancing contact page."); + offset = next; + } + } + return contacts.Values.ToArray(); + } + + private static bool SessionMatchesScope(SessionInfo session, RemoteReportingScope scope, IReadOnlyList contacts) + { + if (string.Equals(scope.ChatId, session.AutomationId, StringComparison.Ordinal) || + string.Equals(scope.ChatId, session.Name, StringComparison.Ordinal)) + return true; + var matches = contacts.Where(contact => string.Equals(contact.Id, scope.ChatId, StringComparison.Ordinal)).ToArray(); + return matches.Length == 1 && matches[0] is { } contact && + (string.Equals(contact.DisplayName, session.Name, StringComparison.Ordinal) || + string.Equals(contact.Remark, session.Name, StringComparison.Ordinal)); + } + private static IReadOnlyList AuthorizedChatScopes( ReportingConfig reporting, string accountId, ReportingChatType? chatType = null) => (reporting.FindAccount(accountId)?.AllowedChats ?? []) @@ -316,8 +381,13 @@ public sealed class RemoteAgentHostedService( .Distinct() .ToArray(); - private static void RequireScopes(IReadOnlyList scopes) + private static void RequireScopes(ReportingConfig reporting, string accountId, IReadOnlyList scopes) { + if (!reporting.Enabled) + throw new ServiceException("ReportingDisabled", 403, "Reporting is disabled on the node."); + var account = reporting.FindAccount(accountId); + if (account is null || !account.Enabled) + throw new ServiceException("AccountNotAuthorized", 403, "The target account is not enabled in the local Reporting configuration."); if (scopes.Count == 0) throw new ServiceException("ChatNotAuthorized", 403, "The requested data scope is not enabled in the local whitelist."); } diff --git a/node-agent/WxAgent.Tray/Program.cs b/node-agent/WxAgent.Tray/Program.cs index 913c2da..641c081 100644 --- a/node-agent/WxAgent.Tray/Program.cs +++ b/node-agent/WxAgent.Tray/Program.cs @@ -379,23 +379,33 @@ internal static class ServiceSettingsEditor throw new InvalidDataException("ListenUrl is invalid."); static string? Optional(TextBox box) => string.IsNullOrWhiteSpace(box.Text) ? null : box.Text.Trim(); + static string[] Lines(TextBox box) => box.Lines + .Select(line => line.Trim()) + .Where(line => line.Length > 0) + .Distinct(StringComparer.Ordinal) + .ToArray(); var host = uri.Host.Trim('[', ']'); var token = current.AccessToken ?? ServiceOptions.GenerateToken(); var remote = current.Remote; + var reporting = (current.Reporting ?? new ReportingConfig()).NormalizeAndValidate(); + var reportingAccount = reporting.Accounts.FirstOrDefault(); + var boundAccounts = new AccountBindingStore(current).ReadAll(); + var reportingAccountId = reportingAccount?.AccountId + ?? (boundAccounts.Count == 1 ? boundAccounts[0].AccountId : ""); ServiceOptions? result = null; using var form = new Form { Text = "WxAgent 服务设置", Width = 720, - Height = 535, + Height = 805, StartPosition = FormStartPosition.CenterScreen, MinimizeBox = false, MaximizeBox = false, FormBorderStyle = FormBorderStyle.FixedDialog }; - var tabs = new TabControl { Left = 12, Top = 12, Width = 680, Height = 450 }; + var tabs = new TabControl { Left = 12, Top = 12, Width = 680, Height = 720 }; var localTab = new TabPage("本地服务"); var remoteTab = new TabPage("远程连接"); tabs.TabPages.Add(localTab); @@ -477,24 +487,84 @@ internal static class ServiceSettingsEditor Left = 18, Top = 372, Width = 620, Height = 40, Text = "控制面令牌与控制面 WXAGENT_NODE_TOKEN 一致;HTTP 仅允许私有 IP,公网或域名请使用 HTTPS。" }; + var reportingTitle = new Label + { + Left = 18, Top = 416, Width = 620, Height = 24, + Text = "远程读取白名单(不填写不会默认放行)" + }; + var reportingEnabled = new CheckBox + { + Left = 18, Top = 442, Width = 620, + Text = "启用 Reporting 数据读取", + Checked = reporting.Enabled + }; + var reportingAccountEnabled = new CheckBox + { + Left = 150, Top = 470, Width = 485, + Text = "启用当前账号", + Checked = reportingAccount?.Enabled ?? true + }; + var reportingAccountLabel = new Label { Left = 18, Top = 505, Width = 125, Text = "账号 ID" }; + var reportingAccountBox = new TextBox { Left = 150, Top = 501, Width = 485, Text = reportingAccountId }; + var groupChatsLabel = new Label { Left = 18, Top = 541, Width = 125, Text = "群聊白名单" }; + var groupChatsBox = new TextBox + { + Left = 150, Top = 537, Width = 485, Height = 48, + Multiline = true, AcceptsReturn = true, ScrollBars = ScrollBars.Vertical, + Text = string.Join(Environment.NewLine, reportingAccount?.AllowedChats + .Where(chat => chat.Type == ReportingChatType.Group).Select(chat => chat.ChatId) ?? []) + }; + var privateChatsLabel = new Label { Left = 18, Top = 593, Width = 125, Text = "私聊白名单" }; + var privateChatsBox = new TextBox + { + Left = 150, Top = 589, Width = 485, Height = 48, + Multiline = true, AcceptsReturn = true, ScrollBars = ScrollBars.Vertical, + Text = string.Join(Environment.NewLine, reportingAccount?.AllowedChats + .Where(chat => chat.Type == ReportingChatType.Private).Select(chat => chat.ChatId) ?? []) + }; + var reportingIdentityConfirmed = new CheckBox + { + Left = 150, Top = 645, Width = 485, + Text = "确认上述 chatId 已与微信身份核对", + Checked = reportingAccount is not null && reportingAccount.AllowedChats.Count > 0 && reportingAccount.AllowedChats.All(chat => chat.IdentityVerified) + }; + var reportingNote = new Label + { + Left = 18, Top = 674, Width = 620, Height = 36, + Text = "每行一个 chatId;通讯录/会话读取只返回白名单范围。" + }; remoteTab.Controls.AddRange([ remoteEnabled, remoteAddressLabel, remoteAddressBox, remoteNodeLabel, remoteNodeBox, remoteAccountLabel, remoteAccountBox, remoteTokenLabel, remoteTokenBox, remoteTokenFileLabel, remoteTokenFileBox, allowInsecureHttp, remoteServerCaLabel, remoteServerCaBox, remoteClientCertLabel, remoteClientCertBox, remoteClientKeyLabel, - remoteClientKeyBox, remoteNote + remoteClientKeyBox, remoteNote, reportingTitle, reportingEnabled, reportingAccountEnabled, + reportingAccountLabel, reportingAccountBox, groupChatsLabel, groupChatsBox, + privateChatsLabel, privateChatsBox, reportingIdentityConfirmed, reportingNote ]); var remoteInputs = new Control[] { remoteAddressBox, remoteNodeBox, remoteAccountBox, remoteTokenBox, remoteTokenFileBox, allowInsecureHttp, remoteServerCaBox, remoteClientCertBox, remoteClientKeyBox }; - void SetRemoteEnabled() { foreach (var control in remoteInputs) control.Enabled = remoteEnabled.Checked; } + var reportingInputs = new Control[] + { + reportingAccountEnabled, reportingAccountBox, groupChatsBox, privateChatsBox, + reportingIdentityConfirmed + }; + void SetRemoteEnabled() + { + foreach (var control in remoteInputs) control.Enabled = remoteEnabled.Checked; + reportingEnabled.Enabled = remoteEnabled.Checked; + var reportingInputsEnabled = remoteEnabled.Checked && reportingEnabled.Checked; + foreach (var control in reportingInputs) control.Enabled = reportingInputsEnabled; + } remoteEnabled.CheckedChanged += (_, _) => SetRemoteEnabled(); + reportingEnabled.CheckedChanged += (_, _) => SetRemoteEnabled(); SetRemoteEnabled(); - var save = new Button { Left = 470, Top = 470, Width = 105, Text = "保存" }; - var cancel = new Button { Left = 585, Top = 470, Width = 105, Text = "取消" }; + var save = new Button { Left = 470, Top = 740, Width = 105, Text = "保存" }; + var cancel = new Button { Left = 585, Top = 740, Width = 105, Text = "取消" }; copy.Click += (_, _) => { Clipboard.SetText(tokenBox.Text); copy.Text = "已复制"; }; regenerate.Click += (_, _) => { @@ -525,6 +595,49 @@ internal static class ServiceSettingsEditor AllowInsecureHttp = allowInsecureHttp.Checked } : null; + var reportingOptions = reporting; + if (remoteEnabled.Checked && reportingEnabled.Checked) + { + var accountId = Optional(reportingAccountBox); + if (accountId is null) + { + MessageBox.Show("启用 Reporting 时必须填写账号 ID。", "WxAgent 设置无效", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + var allowedChats = Lines(groupChatsBox).Select(chatId => new AllowedChat + { + Type = ReportingChatType.Group, + ChatId = chatId, + Enabled = true, + IdentityVerified = reportingIdentityConfirmed.Checked + }).Concat(Lines(privateChatsBox).Select(chatId => new AllowedChat + { + Type = ReportingChatType.Private, + ChatId = chatId, + Enabled = true, + IdentityVerified = reportingIdentityConfirmed.Checked + })).ToArray(); + var account = new AccountReportingConfig + { + AccountId = accountId, + Enabled = reportingAccountEnabled.Checked, + AllowedChats = allowedChats + }; + var accounts = reporting.Accounts + .Where(existing => !string.Equals(existing.AccountId, accountId, StringComparison.Ordinal)) + .Append(account) + .ToArray(); + reportingOptions = reporting with + { + Enabled = true, + ConfigVersion = checked(reporting.ConfigVersion + 1), + Accounts = accounts + }; + } + else if (remoteEnabled.Checked && !reportingEnabled.Checked) + { + reportingOptions = reporting with { Enabled = false }; + } var edited = new ServiceOptions { ListenUrl = $"http://{formattedHost}:{portBox.Value}", @@ -535,7 +648,7 @@ internal static class ServiceSettingsEditor CredentialFile = current.CredentialFile, DataDirectory = current.DataDirectory, Remote = remoteOptions, - Reporting = current.Reporting, + Reporting = reportingOptions, RemoteConfigurationFile = null, EnableValidationOperations = validation.Checked, EnableListenerEvents = listenerEvents.Checked, diff --git a/node-agent/WxAgent.Windows/WechatChatClient.cs b/node-agent/WxAgent.Windows/WechatChatClient.cs index 37ad7f5..5f9b497 100644 --- a/node-agent/WxAgent.Windows/WechatChatClient.cs +++ b/node-agent/WxAgent.Windows/WechatChatClient.cs @@ -98,25 +98,10 @@ public static partial class WechatChatClient var selected = await OpenLocalSearchSessionAsync(window, name, cancellationToken, query).ConfigureAwait(false); return new WechatSessionSnapshot(name, selected.AutomationId, true); } - if (SafeName(FindByAutomationId(window, WechatLocators.CurrentChatName)) == name) - { - return new WechatSessionSnapshot(name, SafeAutomationId(FindByAutomationId(window, WechatLocators.CurrentChatName)!), true); - } - - var target = FindByAutomationId(window, "session_item_" + name); - if (target is null) - { - var selected = await OpenLocalSearchSessionAsync(window, name, cancellationToken).ConfigureAwait(false); - return new WechatSessionSnapshot(name, selected.AutomationId, true); - } - - ClickCenter(target); - if (!await WaitForSessionAsync(window, name, TimeSpan.FromSeconds(10), cancellationToken)) - { - throw new WxAgentException(WxAgentErrorCode.ResultUnconfirmed, "The requested session did not become active."); - } - - return new WechatSessionSnapshot(name, SafeAutomationId(target), true); + await OpenNamedSessionAsync(window, name, cancellationToken).ConfigureAwait(false); + var current = FindByAutomationId(window, WechatLocators.CurrentChatName); + var currentAutomationId = current is null ? null : SafeAutomationId(current); + return new WechatSessionSnapshot(name, currentAutomationId ?? "session_item_" + name, true); } finally {