(function(){const h=document.createElement("link").relList;if(h&&h.supports&&h.supports("modulepreload"))return;for(const E of document.querySelectorAll('link[rel="modulepreload"]'))O(E);new MutationObserver(E=>{for(const D of E)if(D.type==="childList")for(const K of D.addedNodes)K.tagName==="LINK"&&K.rel==="modulepreload"&&O(K)}).observe(document,{childList:!0,subtree:!0});function p(E){const D={};return E.integrity&&(D.integrity=E.integrity),E.referrerPolicy&&(D.referrerPolicy=E.referrerPolicy),E.crossOrigin==="use-credentials"?D.credentials="include":E.crossOrigin==="anonymous"?D.credentials="omit":D.credentials="same-origin",D}function O(E){if(E.ep)return;E.ep=!0;const D=p(E);fetch(E.href,D)}})();function Cc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Si={exports:{}},Ts={},wi={exports:{}},ue={};var tc;function ff(){if(tc)return ue;tc=1;var i=Symbol.for("react.element"),h=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),D=Symbol.for("react.provider"),K=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),I=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),T=Symbol.iterator;function H(g){return g===null||typeof g!="object"?null:(g=T&&g[T]||g["@@iterator"],typeof g=="function"?g:null)}var fe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ye=Object.assign,ne={};function X(g,j,ee){this.props=g,this.context=j,this.refs=ne,this.updater=ee||fe}X.prototype.isReactComponent={},X.prototype.setState=function(g,j){if(typeof g!="object"&&typeof g!="function"&&g!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,g,j,"setState")},X.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};function G(){}G.prototype=X.prototype;function se(g,j,ee){this.props=g,this.context=j,this.refs=ne,this.updater=ee||fe}var Se=se.prototype=new G;Se.constructor=se,ye(Se,X.prototype),Se.isPureReactComponent=!0;var Le=Array.isArray,Oe=Object.prototype.hasOwnProperty,$e={current:null},Ue={key:!0,ref:!0,__self:!0,__source:!0};function Ge(g,j,ee){var oe,le={},ae=null,re=null;if(j!=null)for(oe in j.ref!==void 0&&(re=j.ref),j.key!==void 0&&(ae=""+j.key),j)Oe.call(j,oe)&&!Ue.hasOwnProperty(oe)&&(le[oe]=j[oe]);var he=arguments.length-2;if(he===1)le.children=ee;else if(1>>1,j=A[g];if(0>>1;gE(le,L))aeE(re,le)?(A[g]=re,A[ae]=L,g=ae):(A[g]=le,A[oe]=L,g=oe);else if(aeE(re,L))A[g]=re,A[ae]=L,g=ae;else break e}}return R}function E(A,R){var L=A.sortIndex-R.sortIndex;return L!==0?L:A.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var D=performance;i.unstable_now=function(){return D.now()}}else{var K=Date,Z=K.now();i.unstable_now=function(){return K.now()-Z}}var B=[],I=[],q=1,T=null,H=3,fe=!1,ye=!1,ne=!1,X=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Se(A){for(var R=p(I);R!==null;){if(R.callback===null)O(I);else if(R.startTime<=A)O(I),R.sortIndex=R.expirationTime,h(B,R);else break;R=p(I)}}function Le(A){if(ne=!1,Se(A),!ye)if(p(B)!==null)ye=!0,xe(Oe);else{var R=p(I);R!==null&&me(Le,R.startTime-A)}}function Oe(A,R){ye=!1,ne&&(ne=!1,G(Ge),Ge=-1),fe=!0;var L=H;try{for(Se(R),T=p(B);T!==null&&(!(T.expirationTime>R)||A&&!Ct());){var g=T.callback;if(typeof g=="function"){T.callback=null,H=T.priorityLevel;var j=g(T.expirationTime<=R);R=i.unstable_now(),typeof j=="function"?T.callback=j:T===p(B)&&O(B),Se(R)}else O(B);T=p(B)}if(T!==null)var ee=!0;else{var oe=p(I);oe!==null&&me(Le,oe.startTime-R),ee=!1}return ee}finally{T=null,H=L,fe=!1}}var $e=!1,Ue=null,Ge=-1,Ze=5,ft=-1;function Ct(){return!(i.unstable_now()-ftA||125g?(A.sortIndex=L,h(I,A),p(B)===null&&A===p(I)&&(ne?(G(Ge),Ge=-1):ne=!0,me(Le,L-g))):(A.sortIndex=j,h(B,A),ye||fe||(ye=!0,xe(Oe))),A},i.unstable_shouldYield=Ct,i.unstable_wrapCallback=function(A){var R=H;return function(){var L=H;H=R;try{return A.apply(this,arguments)}finally{H=L}}}})(Ci)),Ci}var lc;function vf(){return lc||(lc=1,ki.exports=gf()),ki.exports}var ic;function yf(){if(ic)return kt;ic=1;var i=Mi(),h=vf();function p(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"),B=Object.prototype.hasOwnProperty,I=/^[: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]*$/,q={},T={};function H(e){return B.call(T,e)?!0:B.call(q,e)?!1:I.test(e)?T[e]=!0:(q[e]=!0,!1)}function fe(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 ye(e,t,n,r){if(t===null||typeof t>"u"||fe(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 ne(e,t,n,r,s,l,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=a}var X={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){X[e]=new ne(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];X[t]=new ne(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){X[e]=new ne(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){X[e]=new ne(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){X[e]=new ne(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){X[e]=new ne(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){X[e]=new ne(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){X[e]=new ne(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){X[e]=new ne(e,5,!1,e.toLowerCase(),null,!1,!1)});var G=/[\-:]([a-z])/g;function se(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(G,se);X[t]=new ne(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(G,se);X[t]=new ne(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(G,se);X[t]=new ne(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){X[e]=new ne(e,1,!1,e.toLowerCase(),null,!1,!1)}),X.xlinkHref=new ne("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){X[e]=new ne(e,1,!1,e.toLowerCase(),null,!0,!0)});function Se(e,t,n,r){var s=X.hasOwnProperty(t)?X[t]:null;(s!==null?s.type!==0:r||!(2c||s[a]!==l[c]){var d=` `+s[a].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=a&&0<=c);break}}}finally{ee=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?j(e):""}function le(e){switch(e.tag){case 5:return j(e.type);case 16:return j("Lazy");case 13:return j("Suspense");case 19:return j("SuspenseList");case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return""}}function ae(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 Ue:return"Fragment";case $e:return"Portal";case Ze:return"Profiler";case Ge:return"StrictMode";case ie:return"Suspense";case Be:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ct:return(e.displayName||"Context")+".Consumer";case ft:return(e._context.displayName||"Context")+".Provider";case rt:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return t=e.displayName||null,t!==null?t:ae(e.type)||"Memo";case xe:t=e._payload,e=e._init;try{return ae(e(t))}catch{}}return null}function re(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 ae(t);case 8:return t===Ge?"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 he(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ce(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ke(e){var t=ce(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 s=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,l.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function zt(e){e._valueTracker||(e._valueTracker=ke(e))}function wn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ce(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function cn(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 Nt(e,t){var n=t.checked;return L({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Jt(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=he(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 jn(e,t){t=t.checked,t!=null&&Se(e,"checked",t,!1)}function bt(e,t){jn(e,t);var n=he(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")?Cn(e,t.type,n):t.hasOwnProperty("defaultValue")&&Cn(e,t.type,he(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function kn(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 Cn(e,t,n){(t!=="number"||cn(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Et=Array.isArray;function Dt(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=$t.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ee(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var pn={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},Pt=["Webkit","ms","Moz","O"];Object.keys(pn).forEach(function(e){Pt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pn[t]=pn[e]})});function cr(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||pn.hasOwnProperty(e)&&pn[e]?(""+t).trim():t+"px"}function gt(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=cr(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var de=L({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 We(e,t){if(t){if(de[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(p(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(p(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(p(61))}if(t.style!=null&&typeof t.style!="object")throw Error(p(62))}}function mn(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 Rt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var st=null,Ft=null,Je=null;function Ve(e){if(e=hs(e)){if(typeof st!="function")throw Error(p(280));var t=e.stateNode;t&&(t=Ys(t),st(e.stateNode,e.type,t))}}function je(e){Ft?Je?Je.push(e):Je=[e]:Ft=e}function En(){if(Ft){var e=Ft,t=Je;if(Je=Ft=null,Ve(e),t)for(e=0;e>>=0,e===0?32:31-(Ec(e)/Pc|0)|0}var Ls=64,As=4194304;function Yr(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 Os(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,l=e.pingedLanes,a=n&268435455;if(a!==0){var c=a&~s;c!==0?r=Yr(c):(l&=a,l!==0&&(r=Yr(l)))}else a=n&~s,a!==0?r=Yr(a):l!==0&&(r=Yr(l));if(r===0)return 0;if(t!==0&&t!==r&&(t&s)===0&&(s=r&-r,l=t&-t,s>=l||s===16&&(l&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Xr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-pe(t),e[t]=n}function Ic(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=ls),Gi=" ",Ji=!1;function bi(e,t){switch(e){case"keyup":return ld.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yi(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tr=!1;function ad(e,t){switch(e){case"compositionend":return Yi(t);case"keypress":return t.which!==32?null:(Ji=!0,Gi);case"textInput":return e=t.data,e===Gi&&Ji?null:e;default:return null}}function ud(e,t){if(Tr)return e==="compositionend"||!tl&&bi(e,t)?(e=Hi(),Us=Jo=Gn=null,Tr=!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=sa(n)}}function la(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?la(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ia(){for(var e=window,t=cn();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=cn(e.document)}return t}function sl(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 yd(e){var t=ia(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&la(n.ownerDocument.documentElement,n)){if(r!==null&&sl(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 s=n.textContent.length,l=Math.min(r.start,s);r=r.end===void 0?l:Math.min(r.end,s),!e.extend&&l>r&&(s=r,r=l,l=s),s=oa(n,l);var a=oa(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.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,Mr=null,ol=null,cs=null,ll=!1;function aa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ll||Mr==null||Mr!==cn(r)||(r=Mr,"selectionStart"in r&&sl(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}),cs&&us(cs,r)||(cs=r,r=Gs(ol,"onSelect"),0zr||(e.current=yl[zr],yl[zr]=null,zr--)}function Pe(e,t){zr++,yl[zr]=e.current,e.current=t}var Xn={},lt=Yn(Xn),xt=Yn(!1),hr=Xn;function Dr(e,t){var n=e.type.contextTypes;if(!n)return Xn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function _t(e){return e=e.childContextTypes,e!=null}function Xs(){Me(xt),Me(lt)}function ja(e,t,n){if(lt.current!==Xn)throw Error(p(168));Pe(lt,t),Pe(xt,n)}function ka(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(p(108,re(e)||"Unknown",s));return L({},n,r)}function Zs(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xn,hr=lt.current,Pe(lt,e),Pe(xt,xt.current),!0}function Ca(e,t,n){var r=e.stateNode;if(!r)throw Error(p(169));n?(e=ka(e,t,hr),r.__reactInternalMemoizedMergedChildContext=e,Me(xt),Me(lt),Pe(lt,e)):Me(xt),Pe(xt,n)}var Mn=null,eo=!1,xl=!1;function Na(e){Mn===null?Mn=[e]:Mn.push(e)}function Td(e){eo=!0,Na(e)}function Zn(){if(!xl&&Mn!==null){xl=!0;var e=0,t=Ce;try{var n=Mn;for(Ce=1;e>=a,s-=a,In=1<<32-pe(t)+s|n<te?(Xe=b,b=null):Xe=b.sibling;var we=k(v,b,y[te],M);if(we===null){b===null&&(b=Xe);break}e&&b&&we.alternate===null&&t(v,b),m=l(we,m,te),J===null?W=we:J.sibling=we,J=we,b=Xe}if(te===y.length)return n(v,b),Ae&&vr(v,te),W;if(b===null){for(;tete?(Xe=b,b=null):Xe=b.sibling;var ar=k(v,b,we.value,M);if(ar===null){b===null&&(b=Xe);break}e&&b&&ar.alternate===null&&t(v,b),m=l(ar,m,te),J===null?W=ar:J.sibling=ar,J=ar,b=Xe}if(we.done)return n(v,b),Ae&&vr(v,te),W;if(b===null){for(;!we.done;te++,we=y.next())we=N(v,we.value,M),we!==null&&(m=l(we,m,te),J===null?W=we:J.sibling=we,J=we);return Ae&&vr(v,te),W}for(b=r(v,b);!we.done;te++,we=y.next())we=$(b,v,te,we.value,M),we!==null&&(e&&we.alternate!==null&&b.delete(we.key===null?te:we.key),m=l(we,m,te),J===null?W=we:J.sibling=we,J=we);return e&&b.forEach(function(df){return t(v,df)}),Ae&&vr(v,te),W}function He(v,m,y,M){if(typeof y=="object"&&y!==null&&y.type===Ue&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Oe:e:{for(var W=y.key,J=m;J!==null;){if(J.key===W){if(W=y.type,W===Ue){if(J.tag===7){n(v,J.sibling),m=s(J,y.props.children),m.return=v,v=m;break e}}else if(J.elementType===W||typeof W=="object"&&W!==null&&W.$$typeof===xe&&Ia(W)===J.type){n(v,J.sibling),m=s(J,y.props),m.ref=gs(v,J,y),m.return=v,v=m;break e}n(v,J);break}else t(v,J);J=J.sibling}y.type===Ue?(m=Cr(y.props.children,v.mode,M,y.key),m.return=v,v=m):(M=Ro(y.type,y.key,y.props,null,v.mode,M),M.ref=gs(v,m,y),M.return=v,v=M)}return a(v);case $e:e:{for(J=y.key;m!==null;){if(m.key===J)if(m.tag===4&&m.stateNode.containerInfo===y.containerInfo&&m.stateNode.implementation===y.implementation){n(v,m.sibling),m=s(m,y.children||[]),m.return=v,v=m;break e}else{n(v,m);break}else t(v,m);m=m.sibling}m=gi(y,v.mode,M),m.return=v,v=m}return a(v);case xe:return J=y._init,He(v,m,J(y._payload),M)}if(Et(y))return V(v,m,y,M);if(R(y))return Q(v,m,y,M);so(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,m!==null&&m.tag===6?(n(v,m.sibling),m=s(m,y),m.return=v,v=m):(n(v,m),m=hi(y,v.mode,M),m.return=v,v=m),a(v)):n(v,m)}return He}var Br=La(!0),Aa=La(!1),oo=Yn(null),lo=null,Hr=null,Cl=null;function Nl(){Cl=Hr=lo=null}function El(e){var t=oo.current;Me(oo),e._currentValue=t}function Pl(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 Vr(e,t){lo=e,Cl=Hr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(St=!0),e.firstContext=null)}function Wt(e){var t=e._currentValue;if(Cl!==e)if(e={context:e,memoizedValue:t,next:null},Hr===null){if(lo===null)throw Error(p(308));Hr=e,lo.dependencies={lanes:0,firstContext:e}}else Hr=Hr.next=e;return t}var yr=null;function Rl(e){yr===null?yr=[e]:yr.push(e)}function Oa(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Rl(t)):(n.next=s.next,s.next=n),t.interleaved=n,An(e,r)}function An(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 er=!1;function Tl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function za(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 On(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function tr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(_e&2)!==0){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,An(e,n)}return s=r.interleaved,s===null?(t.next=t,Rl(r)):(t.next=s.next,s.next=t),r.interleaved=t,An(e,n)}function io(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,Qo(e,n)}}function Da(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?s=l=a:l=l.next=a,n=n.next}while(n!==null);l===null?s=l=t:l=l.next=t}else s=l=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:l,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 ao(e,t,n,r){var s=e.updateQueue;er=!1;var l=s.firstBaseUpdate,a=s.lastBaseUpdate,c=s.shared.pending;if(c!==null){s.shared.pending=null;var d=c,_=d.next;d.next=null,a===null?l=_:a.next=_,a=d;var C=e.alternate;C!==null&&(C=C.updateQueue,c=C.lastBaseUpdate,c!==a&&(c===null?C.firstBaseUpdate=_:c.next=_,C.lastBaseUpdate=d))}if(l!==null){var N=s.baseState;a=0,C=_=d=null,c=l;do{var k=c.lane,$=c.eventTime;if((r&k)===k){C!==null&&(C=C.next={eventTime:$,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var V=e,Q=c;switch(k=t,$=n,Q.tag){case 1:if(V=Q.payload,typeof V=="function"){N=V.call($,N,k);break e}N=V;break e;case 3:V.flags=V.flags&-65537|128;case 0:if(V=Q.payload,k=typeof V=="function"?V.call($,N,k):V,k==null)break e;N=L({},N,k);break e;case 2:er=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,k=s.effects,k===null?s.effects=[c]:k.push(c))}else $={eventTime:$,lane:k,tag:c.tag,payload:c.payload,callback:c.callback,next:null},C===null?(_=C=$,d=N):C=C.next=$,a|=k;if(c=c.next,c===null){if(c=s.shared.pending,c===null)break;k=c,c=k.next,k.next=null,s.lastBaseUpdate=k,s.shared.pending=null}}while(!0);if(C===null&&(d=N),s.baseState=d,s.firstBaseUpdate=_,s.lastBaseUpdate=C,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else l===null&&(s.shared.lanes=0);Sr|=a,e.lanes=a,e.memoizedState=N}}function $a(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ol.transition;Ol.transition={};try{e(!1),t()}finally{Ce=n,Ol.transition=r}}function ru(){return Kt().memoizedState}function Ad(e,t,n){var r=or(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},su(e))ou(t,n);else if(n=Oa(e,t,n,r),n!==null){var s=ht();un(n,e,r,s),lu(n,t,r)}}function Od(e,t,n){var r=or(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(su(e))ou(t,s);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var a=t.lastRenderedState,c=l(a,n);if(s.hasEagerState=!0,s.eagerState=c,rn(c,a)){var d=t.interleaved;d===null?(s.next=s,Rl(t)):(s.next=d.next,d.next=s),t.interleaved=s;return}}catch{}n=Oa(e,t,s,r),n!==null&&(s=ht(),un(n,e,r,s),lu(n,t,r))}}function su(e){var t=e.alternate;return e===De||t!==null&&t===De}function ou(e,t){_s=fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function lu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qo(e,n)}}var ho={readContext:Wt,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useInsertionEffect:it,useLayoutEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useMutableSource:it,useSyncExternalStore:it,useId:it,unstable_isNewReconciler:!1},zd={readContext:Wt,useCallback:function(e,t){return xn().memoizedState=[e,t===void 0?null:t],e},useContext:Wt,useEffect:Ja,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,po(4194308,4,Xa.bind(null,t,e),n)},useLayoutEffect:function(e,t){return po(4194308,4,e,t)},useInsertionEffect:function(e,t){return po(4,2,e,t)},useMemo:function(e,t){var n=xn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=xn();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=Ad.bind(null,De,e),[r.memoizedState,e]},useRef:function(e){var t=xn();return e={current:e},t.memoizedState=e},useState:qa,useDebugValue:Hl,useDeferredValue:function(e){return xn().memoizedState=e},useTransition:function(){var e=qa(!1),t=e[0];return e=Ld.bind(null,e[1]),xn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=De,s=xn();if(Ae){if(n===void 0)throw Error(p(407));n=n()}else{if(n=t(),Ye===null)throw Error(p(349));(_r&30)!==0||Ha(r,t,n)}s.memoizedState=n;var l={value:n,getSnapshot:t};return s.queue=l,Ja(Qa.bind(null,r,l,e),[e]),r.flags|=2048,js(9,Va.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=xn(),t=Ye.identifierPrefix;if(Ae){var n=Ln,r=In;n=(r&~(1<<32-pe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ss++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[vn]=t,e[ms]=r,Nu(e,t,!1,!1),t.stateNode=e;e:{switch(a=mn(n,r),n){case"dialog":Te("cancel",e),Te("close",e),s=r;break;case"iframe":case"object":case"embed":Te("load",e),s=r;break;case"video":case"audio":for(s=0;sGr&&(t.flags|=128,r=!0,ks(l,!1),t.lanes=4194304)}else{if(!r)if(e=uo(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ks(l,!0),l.tail===null&&l.tailMode==="hidden"&&!a.alternate&&!Ae)return at(t),null}else 2*f()-l.renderingStartTime>Gr&&n!==1073741824&&(t.flags|=128,r=!0,ks(l,!1),t.lanes=4194304);l.isBackwards?(a.sibling=t.child,t.child=a):(n=l.last,n!==null?n.sibling=a:t.child=a,l.last=a)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=f(),t.sibling=null,n=ze.current,Pe(ze,r?n&1|2:n&1),t):(at(t),null);case 22:case 23:return fi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(Ot&1073741824)!==0&&(at(t),t.subtreeFlags&6&&(t.flags|=8192)):at(t),null;case 24:return null;case 25:return null}throw Error(p(156,t.tag))}function Qd(e,t){switch(Sl(t),t.tag){case 1:return _t(t.type)&&Xs(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qr(),Me(xt),Me(lt),Al(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Il(t),null;case 13:if(Me(ze),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(p(340));Ur()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Me(ze),null;case 4:return Qr(),null;case 10:return El(t.type._context),null;case 22:case 23:return fi(),null;case 24:return null;default:return null}}var xo=!1,ut=!1,Wd=typeof WeakSet=="function"?WeakSet:Set,U=null;function Kr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Fe(e,t,r)}else n.current=null}function ei(e,t,n){try{n()}catch(r){Fe(e,t,r)}}var Ru=!1;function Kd(e,t){if(fl=$s,e=ia(),sl(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 s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var a=0,c=-1,d=-1,_=0,C=0,N=e,k=null;t:for(;;){for(var $;N!==n||s!==0&&N.nodeType!==3||(c=a+s),N!==l||r!==0&&N.nodeType!==3||(d=a+r),N.nodeType===3&&(a+=N.nodeValue.length),($=N.firstChild)!==null;)k=N,N=$;for(;;){if(N===e)break t;if(k===n&&++_===s&&(c=a),k===l&&++C===r&&(d=a),($=N.nextSibling)!==null)break;N=k,k=N.parentNode}N=$}n=c===-1||d===-1?null:{start:c,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(pl={focusedElem:e,selectionRange:n},$s=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var V=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(V!==null){var Q=V.memoizedProps,He=V.memoizedState,v=t.stateNode,m=v.getSnapshotBeforeUpdate(t.elementType===t.type?Q:on(t.type,Q),He);v.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(M){Fe(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return V=Ru,Ru=!1,V}function Cs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var l=s.destroy;s.destroy=void 0,l!==void 0&&ei(t,n,l)}s=s.next}while(s!==r)}}function _o(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 ti(e){var t=e.ref;if(t!==null){var n=e.stateNode;e.tag,e=n,typeof t=="function"?t(e):t.current=e}}function Tu(e){var t=e.alternate;t!==null&&(e.alternate=null,Tu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vn],delete t[ms],delete t[vl],delete t[Pd],delete t[Rd])),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 Mu(e){return e.tag===5||e.tag===3||e.tag===4}function Iu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Mu(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 ni(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=bs));else if(r!==4&&(e=e.child,e!==null))for(ni(e,t,n),e=e.sibling;e!==null;)ni(e,t,n),e=e.sibling}function ri(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(ri(e,t,n),e=e.sibling;e!==null;)ri(e,t,n),e=e.sibling}var tt=null,ln=!1;function nr(e,t,n){for(n=n.child;n!==null;)Lu(e,t,n),n=n.sibling}function Lu(e,t,n){if(z&&typeof z.onCommitFiberUnmount=="function")try{z.onCommitFiberUnmount(x,n)}catch{}switch(n.tag){case 5:ut||Kr(n,t);case 6:var r=tt,s=ln;tt=null,nr(e,t,n),tt=r,ln=s,tt!==null&&(ln?(e=tt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):tt.removeChild(n.stateNode));break;case 18:tt!==null&&(ln?(e=tt,n=n.stateNode,e.nodeType===8?gl(e.parentNode,n):e.nodeType===1&&gl(e,n),rs(e)):gl(tt,n.stateNode));break;case 4:r=tt,s=ln,tt=n.stateNode.containerInfo,ln=!0,nr(e,t,n),tt=r,ln=s;break;case 0:case 11:case 14:case 15:if(!ut&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,a=l.destroy;l=l.tag,a!==void 0&&((l&2)!==0||(l&4)!==0)&&ei(n,t,a),s=s.next}while(s!==r)}nr(e,t,n);break;case 1:if(!ut&&(Kr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Fe(n,t,c)}nr(e,t,n);break;case 21:nr(e,t,n);break;case 22:n.mode&1?(ut=(r=ut)||n.memoizedState!==null,nr(e,t,n),ut=r):nr(e,t,n);break;default:nr(e,t,n)}}function Au(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Wd),t.forEach(function(r){var s=tf.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function an(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~l}if(r=s,r=f()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Gd(r/1960))-r,10e?16:e,sr===null)var r=!1;else{if(e=sr,sr=null,Co=0,(_e&6)!==0)throw Error(p(331));var s=_e;for(_e|=4,U=e.current;U!==null;){var l=U,a=l.child;if((U.flags&16)!==0){var c=l.deletions;if(c!==null){for(var d=0;df()-li?jr(e,0):oi|=n),jt(e,t)}function qu(e,t){t===0&&((e.mode&1)===0?t=1:(t=As,As<<=1,(As&130023424)===0&&(As=4194304)));var n=ht();e=An(e,t),e!==null&&(Xr(e,t,n),jt(e,n))}function ef(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function tf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(p(314))}r!==null&&r.delete(t),qu(e,n)}var Gu;Gu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||xt.current)St=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return St=!1,Hd(e,t,n);St=(e.flags&131072)!==0}else St=!1,Ae&&(t.flags&1048576)!==0&&Ea(t,no,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;yo(e,t),e=t.pendingProps;var s=Dr(t,lt.current);Vr(t,n),s=Dl(null,t,r,e,s,n);var l=$l();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(r)?(l=!0,Zs(t)):l=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Tl(t),s.updater=go,t.stateNode=s,s._reactInternals=t,Ql(t,r,e,n),t=Gl(null,t,r,!0,l,n)):(t.tag=0,Ae&&l&&_l(t),mt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(yo(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=rf(r),e=on(r,e),s){case 0:t=ql(null,t,r,e,n);break e;case 1:t=_u(null,t,r,e,n);break e;case 11:t=hu(null,t,r,e,n);break e;case 14:t=gu(null,t,r,on(r.type,e),n);break e}throw Error(p(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:on(r,s),ql(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:on(r,s),_u(e,t,r,s,n);case 3:e:{if(Su(t),e===null)throw Error(p(387));r=t.pendingProps,l=t.memoizedState,s=l.element,za(e,t),ao(t,r,null,n);var a=t.memoizedState;if(r=a.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){s=Wr(Error(p(423)),t),t=wu(e,t,r,n,s);break e}else if(r!==s){s=Wr(Error(p(424)),t),t=wu(e,t,r,n,s);break e}else for(At=bn(t.stateNode.containerInfo.firstChild),Lt=t,Ae=!0,sn=null,n=Aa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ur(),r===s){t=zn(e,t,n);break e}mt(e,t,r,n)}t=t.child}return t;case 5:return Fa(t),e===null&&jl(t),r=t.type,s=t.pendingProps,l=e!==null?e.memoizedProps:null,a=s.children,ml(r,s)?a=null:l!==null&&ml(r,l)&&(t.flags|=32),xu(e,t),mt(e,t,a,n),t.child;case 6:return e===null&&jl(t),null;case 13:return ju(e,t,n);case 4:return Ml(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Br(t,null,r,n):mt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:on(r,s),hu(e,t,r,s,n);case 7:return mt(e,t,t.pendingProps,n),t.child;case 8:return mt(e,t,t.pendingProps.children,n),t.child;case 12:return mt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,l=t.memoizedProps,a=s.value,Pe(oo,r._currentValue),r._currentValue=a,l!==null)if(rn(l.value,a)){if(l.children===s.children&&!xt.current){t=zn(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var c=l.dependencies;if(c!==null){a=l.child;for(var d=c.firstContext;d!==null;){if(d.context===r){if(l.tag===1){d=On(-1,n&-n),d.tag=2;var _=l.updateQueue;if(_!==null){_=_.shared;var C=_.pending;C===null?d.next=d:(d.next=C.next,C.next=d),_.pending=d}}l.lanes|=n,d=l.alternate,d!==null&&(d.lanes|=n),Pl(l.return,n,t),c.lanes|=n;break}d=d.next}}else if(l.tag===10)a=l.type===t.type?null:l.child;else if(l.tag===18){if(a=l.return,a===null)throw Error(p(341));a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Pl(a,n,t),a=l.sibling}else a=l.child;if(a!==null)a.return=l;else for(a=l;a!==null;){if(a===t){a=null;break}if(l=a.sibling,l!==null){l.return=a.return,a=l;break}a=a.return}l=a}mt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Vr(t,n),s=Wt(s),r=r(s),t.flags|=1,mt(e,t,r,n),t.child;case 14:return r=t.type,s=on(r,t.pendingProps),s=on(r.type,s),gu(e,t,r,s,n);case 15:return vu(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:on(r,s),yo(e,t),t.tag=1,_t(r)?(e=!0,Zs(t)):e=!1,Vr(t,n),au(t,r,s),Ql(t,r,s,n),Gl(null,t,r,!0,e,n);case 19:return Cu(e,t,n);case 22:return yu(e,t,n)}throw Error(p(156,t.tag))};function Ju(e,t){return Hn(e,t)}function nf(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 Gt(e,t,n,r){return new nf(e,t,n,r)}function mi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function rf(e){if(typeof e=="function")return mi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rt)return 11;if(e===Re)return 14}return 2}function ir(e,t){var n=e.alternate;return n===null?(n=Gt(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 Ro(e,t,n,r,s,l){var a=2;if(r=e,typeof e=="function")mi(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ue:return Cr(n.children,s,l,t);case Ge:a=8,s|=8;break;case Ze:return e=Gt(12,n,t,s|2),e.elementType=Ze,e.lanes=l,e;case ie:return e=Gt(13,n,t,s),e.elementType=ie,e.lanes=l,e;case Be:return e=Gt(19,n,t,s),e.elementType=Be,e.lanes=l,e;case me:return To(n,s,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ft:a=10;break e;case Ct:a=9;break e;case rt:a=11;break e;case Re:a=14;break e;case xe:a=16,r=null;break e}throw Error(p(130,e==null?e:typeof e,""))}return t=Gt(a,n,t,s),t.elementType=e,t.type=r,t.lanes=l,t}function Cr(e,t,n,r){return e=Gt(7,e,r,t),e.lanes=n,e}function To(e,t,n,r){return e=Gt(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function hi(e,t,n){return e=Gt(6,e,null,t),e.lanes=n,e}function gi(e,t,n){return t=Gt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sf(e,t,n,r,s){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=Vo(0),this.expirationTimes=Vo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vo(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function vi(e,t,n,r,s,l,a,c,d){return e=new sf(e,t,n,c,d),t===1?(t=1,l===!0&&(t|=8)):t=0,l=Gt(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tl(l),e}function of(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(h){console.error(h)}}return i(),ji.exports=yf(),ji.exports}var uc;function _f(){if(uc)return Do;uc=1;var i=xf();return Do.createRoot=i.createRoot,Do.hydrateRoot=i.hydrateRoot,Do}var Sf=_f();const wf=Cc(Sf),jf="/api";async function Ne(i,h){const p=await fetch(`${jf}${i}`,{...h,headers:{"Content-Type":"application/json",...h?.headers??{}}}),O=await p.json();if(!p.ok){const E=O.error?.message??"Ошибка запроса";throw new Error(E)}return O}const Ie={async listModels(i){return Ne("/llm/models",{method:"POST",body:JSON.stringify({llmProvider:i.llmProvider,apiKey:i.apiKey,model:i.model,baseUrl:i.baseUrl})})},async testConnection(i){return Ne("/llm/test-connection",{method:"POST",body:JSON.stringify({llmProvider:i.llmProvider,apiKey:i.apiKey,model:i.model,baseUrl:i.baseUrl})})},async normalize(i){return Ne("/normalize",{method:"POST",body:JSON.stringify({llmProvider:i.connection.llmProvider,apiKey:i.connection.apiKey,model:i.connection.model,baseUrl:i.connection.baseUrl,temperature:i.connection.temperature,maxOutputTokens:i.connection.maxOutputTokens,promptVersion:i.promptVersion,systemPrompt:i.prompts.systemPrompt,developerPrompt:i.prompts.developerPrompt,domainPrompt:i.prompts.domainPrompt,fewShotExamples:i.prompts.fewShotExamples,userQuestion:i.query.userQuestion,context:{period_hint:i.query.periodHint??"",business_context:i.query.businessContext??"",expected_route:i.query.expectedRoute??""},saveAsTestCase:!!i.saveAsTestCase,useMock:!!i.useMock})})},async loadHistory(){return Ne("/history")},async loadTrace(i){return Ne(`/history/${i}`)},async loadPresets(){return Ne("/presets")},async savePreset(i){return Ne("/presets/save",{method:"POST",body:JSON.stringify(i)})},async runEval(i){return Ne("/eval/run",{method:"POST",body:JSON.stringify({normalizeConfig:{llmProvider:i.connection.llmProvider,apiKey:i.connection.apiKey,model:i.connection.model,baseUrl:i.connection.baseUrl,temperature:i.connection.temperature,maxOutputTokens:i.connection.maxOutputTokens,promptVersion:i.promptVersion,systemPrompt:i.prompts.systemPrompt,developerPrompt:i.prompts.developerPrompt,domainPrompt:i.prompts.domainPrompt,fewShotExamples:i.prompts.fewShotExamples},caseIds:i.caseIds,useMock:!!i.useMock,mode:i.mode??"standard",caseSetFile:i.caseSetFile,rawQuestions:i.rawQuestions,eval_target:i.evalTarget,compare_with_report_file:i.compareWithReportFile})})},async startEvalRunAsync(i){return Ne("/eval/run-async/start",{method:"POST",body:JSON.stringify({normalizeConfig:{llmProvider:i.connection.llmProvider,apiKey:i.connection.apiKey,model:i.connection.model,baseUrl:i.connection.baseUrl,temperature:i.connection.temperature,maxOutputTokens:i.connection.maxOutputTokens,promptVersion:i.promptVersion,systemPrompt:i.prompts.systemPrompt,developerPrompt:i.prompts.developerPrompt,domainPrompt:i.prompts.domainPrompt,fewShotExamples:i.prompts.fewShotExamples},caseIds:i.caseIds,useMock:!!i.useMock,mode:i.mode??"standard",caseSetFile:i.caseSetFile,rawQuestions:i.rawQuestions,eval_target:i.evalTarget,compare_with_report_file:i.compareWithReportFile,questions:i.questions})})},async loadEvalRunAsyncStatus(i){return Ne(`/eval/run-async/${encodeURIComponent(i)}`)},async startRun(){return Ne("/accounting-agent/v1/runs/start",{method:"POST",body:JSON.stringify({initiator:"ndc_operator",source:"gui"})})},async finishRun(i){return Ne("/accounting-agent/v1/runs/finish",{method:"POST",body:JSON.stringify({runId:i,status:"DONE",source:"gui",reason:"Остановлено оператором из GUI"})})},async listRuns(){return Ne("/accounting-agent/v1/runs")},async listResults(){return Ne("/accounting-agent/v1/results")},async runTrace(i){return Ne(`/accounting-agent/v1/trace/run/${i}`)},async sendAssistantMessage(i){return Ne("/assistant/message",{method:"POST",body:JSON.stringify({session_id:i.sessionId??"",mode:"assistant",message:i.userMessage,user_message:i.userMessage,llmProvider:i.connection.llmProvider,apiKey:i.connection.apiKey,model:i.connection.model,baseUrl:i.connection.baseUrl,temperature:i.connection.temperature,maxOutputTokens:i.connection.maxOutputTokens,promptVersion:i.promptVersion??"address_query_runtime_v1",systemPrompt:i.prompts.systemPrompt,developerPrompt:i.prompts.developerPrompt,domainPrompt:i.prompts.domainPrompt,fewShotExamples:i.prompts.fewShotExamples,context:{period_hint:i.context?.periodHint??"",business_context:i.context?.businessContext??""},useMock:!!i.useMock})})},async loadAssistantSession(i){return Ne(`/assistant/session/${i}`)},async loadAutoRunsHistory(i){const h=new URLSearchParams;i?.from&&h.set("from",i.from),i?.to&&h.set("to",i.to),i?.target&&h.set("target",i.target),i?.mode&&h.set("mode",i.mode),i?.use_mock&&h.set("use_mock",i.use_mock),i?.prompt_contains&&h.set("prompt_contains",i.prompt_contains),typeof i?.limit=="number"&&h.set("limit",String(i.limit)),typeof i?.scan_limit=="number"&&h.set("scan_limit",String(i.scan_limit));const p=h.toString();return Ne(`/autoruns/history${p?`?${p}`:""}`)},async loadAutoRunDetail(i){return Ne(`/autoruns/history/${encodeURIComponent(i)}`)},async loadAutoRunCaseDialog(i,h){return Ne(`/autoruns/history/${encodeURIComponent(i)}/case/${encodeURIComponent(h)}/dialog`)},async loadAutoRunAnnotations(i){const h=new URLSearchParams;i?.run_id&&h.set("run_id",i.run_id),i?.case_id&&h.set("case_id",i.case_id),typeof i?.min_rating=="number"&&h.set("min_rating",String(i.min_rating)),i?.manual_case_decision&&h.set("manual_case_decision",i.manual_case_decision),typeof i?.limit=="number"&&h.set("limit",String(i.limit));const p=h.toString();return Ne(`/autoruns/annotations${p?`?${p}`:""}`)},async saveAutoRunAnnotation(i){return Ne("/autoruns/annotations",{method:"POST",body:JSON.stringify(i)})},async updateAutoRunAnnotation(i){return Ne(`/autoruns/annotations/${encodeURIComponent(i.annotation_id)}`,{method:"PATCH",body:JSON.stringify({resolved:i.resolved,resolved_by:i.resolved_by})})},async loadAutoRunPostAnalysis(i){const h=new URLSearchParams;i?.run_id&&h.set("run_id",i.run_id),typeof i?.limit_per_queue=="number"&&h.set("limit_per_queue",String(i.limit_per_queue)),typeof i?.annotation_limit=="number"&&h.set("annotation_limit",String(i.annotation_limit)),typeof i?.scan_limit=="number"&&h.set("scan_limit",String(i.scan_limit)),i?.from&&h.set("from",i.from),i?.to&&h.set("to",i.to),i?.target&&h.set("target",i.target),i?.mode&&h.set("mode",i.mode),i?.use_mock&&h.set("use_mock",i.use_mock),i?.prompt_contains&&h.set("prompt_contains",i.prompt_contains);const p=h.toString();return Ne(`/autoruns/post-analysis${p?`?${p}`:""}`)},async loadAutoRunAutogenHistory(i){const h=new URLSearchParams;i?.mode&&h.set("mode",i.mode),typeof i?.limit=="number"&&h.set("limit",String(i.limit));const p=h.toString();return Ne(`/autoruns/autogen/history${p?`?${p}`:""}`)},async loadAutoRunAutogenPersonalityCatalog(){return Ne("/autoruns/autogen/personality-catalog")},async generateAutoRunQuestions(i){return Ne("/autoruns/autogen/generate",{method:"POST",body:JSON.stringify(i)})}};function dt({value:i}){return o.jsx("pre",{className:"json-view",children:JSON.stringify(i??{},null,2)})}function Sn({title:i,subtitle:h,actions:p,className:O,hideHeader:E,children:D}){return o.jsxs("section",{className:O?`panel-frame ${O}`:"panel-frame",children:[E?null:o.jsxs("header",{className:"panel-header",children:[o.jsxs("div",{children:[o.jsx("h2",{children:i}),h?o.jsx("p",{children:h}):null]}),p?o.jsx("div",{className:"panel-actions",children:p}):null]}),o.jsx("div",{className:"panel-body",children:D})]})}function kf(i){const h=new Date(i);return Number.isNaN(h.getTime())?i:h.toLocaleString("ru-RU")}function Cf({sessionId:i,conversation:h,statusText:p,errorMessage:O,useMock:E,appLogs:D}){const K=h.filter(I=>I.role==="assistant").length,Z=h.filter(I=>I.role==="user").length,B=h.length>0?h[h.length-1]:null;return o.jsxs(Sn,{title:"SAM",subtitle:"System Assistant Monitor: срез по текущей сессии и логам.",children:[o.jsxs("div",{className:"metrics-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"session_id"}),o.jsx("strong",{children:i||"новая сессия"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"mock_mode"}),o.jsx("strong",{children:E?"on":"off"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"сообщений пользователя"}),o.jsx("strong",{children:Z})]}),o.jsxs("div",{children:[o.jsx("span",{children:"ответов ассистента"}),o.jsx("strong",{children:K})]}),o.jsxs("div",{children:[o.jsx("span",{children:"статус"}),o.jsx("strong",{children:p||"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"ошибка"}),o.jsx("strong",{children:O||"нет"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"последнее сообщение"}),o.jsx("strong",{children:B?.created_at?kf(B.created_at):"нет данных"})]})]}),o.jsx("h3",{style:{marginTop:12},children:"Последние системные логи"}),o.jsx(dt,{value:D.slice(0,120)})]})}const Ni={fromLocal:"",toLocal:"",target:"all",mode:"all",useMock:"any",promptContains:"",limit:120},$o="needs_dialog_policy_fix",ct="__all__",Bo="__live__:",cc="ndc_autoruns_ui_config_v1",dc="ndc-autoruns-save",Ti=[{id:"general",label:"Общий контур",domain:"",defaultPrompt:"Генерируй реалистичные живые вопросы бухгалтера по 1С. Добавляй разговорные формулировки и опечатки, но сохраняй бизнес-смысл."}];function Nf(i=Ti){return i.reduce((h,p)=>(h[p.id]=p.defaultPrompt,h),{})}const fc={mode:"codex_creative",count:24,personalityId:"general",personalityPrompts:Nf(),persistToEvalCases:!0,generatedBy:"manual_reviewer"};function Ef(i){const h=i.getFullYear(),p=String(i.getMonth()+1).padStart(2,"0"),O=String(i.getDate()).padStart(2,"0"),E=String(i.getHours()).padStart(2,"0"),D=String(i.getMinutes()).padStart(2,"0");return`${h}-${p}-${O}T${E}:${D}`}function pc(){const i=new Date;return i.setDate(i.getDate()-14),Ef(i)}function Fo(i){if(!i.trim())return;const h=Date.parse(i);if(Number.isFinite(h))return new Date(h).toISOString()}function ur(i){if(!i)return"нет данных";const h=Date.parse(i);return Number.isFinite(h)?new Date(h).toLocaleString("ru-RU"):i}function Pf(i,h){return h<=0?0:Math.max(0,Math.min(100,Number((i/h*100).toFixed(1))))}function Ms(i){return typeof i!="number"?"нет данных":`${i.toFixed(1)}%`}function Rf(i){return i==="assistant_stage1"?"assistant/s1":i==="assistant_stage2"?"assistant/s2":i==="assistant_p0"?"assistant/p0":i}function mc(i){return i==="up"?"Рост":i==="down"?"Регресс":"Без изменений"}function Tf(i,h){return i.find(p=>p.case_id===h)??null}function hc(i){const h=Math.max(1,Math.min(5,Math.round(i)));return`${"●".repeat(h)}${"○".repeat(5-h)}`}function gc(i){return i.length===0?o.jsx("p",{className:"muted",children:"Покрытие доменов пока не сформировано."}):o.jsx("div",{className:"autoruns-coverage-list",children:i.map(h=>{const p=Pf(h.closed_cases,h.total_cases);return o.jsxs("div",{className:"autoruns-coverage-item",children:[o.jsxs("div",{className:"autoruns-coverage-head",children:[o.jsx("strong",{children:h.domain}),o.jsxs("span",{children:[h.closed_cases,"/",h.total_cases," (",p,"%)"]})]}),o.jsx("div",{className:"autoruns-coverage-bar",children:o.jsx("div",{style:{width:`${p}%`}})})]},h.domain)})})}function Uo(i){return`${Bo}${i}`}function br(i){return i.startsWith(Bo)}function vc(i){return i.startsWith(Bo)?i.slice(Bo.length):""}function Nc(i){const h=i.report_summary?.run_timestamp??i.created_at,p=Math.max(0,i.total_cases-i.completed_cases);return{run_id:Uo(i.job_id),eval_target:i.eval_target,run_timestamp:h,mode:"single-pass-strict",llm_provider:null,model:null,use_mock:null,prompt_version:null,schema_version:null,suite_id:i.case_set_file,cases_total:i.total_cases,requests_total:null,report_path:`async_job:${i.job_id}`,score_index:i.report_summary?.score_index??null,blocking_failures:0,quality_failures:0,closed_cases:i.completed_cases,open_cases:p,domain_coverage:[{domain:"runtime",total_cases:i.total_cases,closed_cases:i.completed_cases}]}}function Is(i,h){const p=Nc(i),O=i.cases.map(q=>({case_id:q.case_id,domain:null,query_class:null,status:q.status==="completed"?"closed":q.status==="failed"?"open":"unknown",score_index:null,trace_id:null,reply_type:null,session_id:`${i.run_id}-${q.case_id}`,dialog_available:q.messages.length>0,commented_count:0,latest_annotation_at:null,avg_rating:null,checks:null,metric_subscores:null})),D=h!==ct&&O.some(q=>q.case_id===h)?h:O.length>0?ct:"",K={ok:!0,run:p,coverage:{closed_cases:i.completed_cases,open_cases:Math.max(0,i.total_cases-i.completed_cases),domain_coverage:[{domain:"runtime",total_cases:i.total_cases,closed_cases:i.completed_cases}]},cases:O,annotations_summary:{total:0},report:i.report_summary?{run_id:i.report_summary.run_id,run_timestamp:i.report_summary.run_timestamp,score_index:i.report_summary.score_index,cases_total:i.report_summary.cases_total}:{}},Z=[];let B=0;if(D===ct)for(const q of i.cases)for(let T=0;TT.case_id===D)??null;for(let T=0;T<(q?.messages.length??0);T+=1){const H=q?.messages[T];H&&Z.push({...H,message_index:T,case_id:D,case_message_index:T,commented:!1,annotation:null})}}const I={ok:!0,run_id:p.run_id,case_id:D,source:"assistant_session",session_id:D===ct?`${i.run_id}::__all__`:`${i.run_id}-${D}`,messages:Z,decomposition:[],assistant_mode:{status:i.status,completed_cases:i.completed_cases,total_cases:i.total_cases},annotations:[]};return{detail:K,dialog:I,caseId:D}}function Mf({commented:i}){const h=i?"comment-icon-svg commented":"comment-icon-svg";return o.jsxs("svg",{className:h,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M5 6.5h14v9H11.5l-4.5 3v-3H5z"}),o.jsx("circle",{className:"comment-icon-dot",cx:"9",cy:"11",r:"1.05"}),o.jsx("circle",{className:"comment-icon-dot",cx:"12",cy:"11",r:"1.05"}),o.jsx("circle",{className:"comment-icon-dot",cx:"15",cy:"11",r:"1.05"})]})}function yc({resolved:i}){return o.jsxs("svg",{className:i?"resolve-icon-svg resolved":"resolve-icon-svg",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[o.jsx("circle",{cx:"8",cy:"8",r:"6.2"}),i?o.jsx("path",{d:"M5.1 8.2 7.2 10.3 11 6.5"}):null]})}function If({connection:i,prompts:h,assistantPromptVersion:p,decompositionPromptVersion:O,showAssistantMode:E,showDecompositionMode:D,showProgressMode:K,showCommentsMode:Z,onLog:B}){const[I,q]=S.useState({...Ni,fromLocal:pc()}),[T,H]=S.useState(null),[fe,ye]=S.useState(null),[ne,X]=S.useState(null),[G,se]=S.useState([]),[Se,Le]=S.useState("all"),[Oe,$e]=S.useState(!1),[Ue,Ge]=S.useState(null),[Ze,ft]=S.useState([]),[Ct,rt]=S.useState(""),[ie,Be]=S.useState(""),[Re,xe]=S.useState(""),[me,A]=S.useState(Ti),[R,L]=S.useState(fc),[g,j]=S.useState([]),[ee,oe]=S.useState(""),[le,ae]=S.useState([]),[re,he]=S.useState(null),[ce,ke]=S.useState(null),[zt,wn]=S.useState(!1),[cn,Nt]=S.useState(!1),[Jt,jn]=S.useState(!1),[bt,kn]=S.useState(!1),[Cn,Et]=S.useState(!1),[Dt,Yt]=S.useState(!1),[Fn,dn]=S.useState(!1),[Xt,fn]=S.useState(!1),[Nn,$t]=S.useState(""),[Un,Ee]=S.useState(""),[pn,Pt]=S.useState(String(Ni.limit)),[cr,gt]=S.useState(String(fc.count)),[de,We]=S.useState({open:!1,caseId:"",caseMessageIndex:-1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:$o,annotationAuthor:"manual_reviewer",saving:!1,error:""}),mn=S.useRef(!1),Rt=S.useRef(null),Zt=S.useMemo(()=>me.find(u=>u.id===R.personalityId)??me[0]??Ti[0],[R.personalityId,me]),st=S.useMemo(()=>g.find(u=>u.generation_id===ee)??g[0]??null,[g,ee]),Ft=T?.items.find(u=>u.run_id===ie)??fe?.run??null,Je=fe?Tf(fe.cases,Re):null,Ve=S.useMemo(()=>Oe?G.filter(u=>!u.resolved):G,[G,Oe]),je=Ve.find(u=>u.annotation_id===Ct)??null,En=ne?.messages.find(u=>u.message_index===de.messageIndex)??null,dr=S.useMemo(()=>{if(!ne||de.messageIndex<0)return null;for(let u=de.messageIndex-1;u>=0;u-=1){const f=ne.messages[u];if(f?.role==="user")return f}return null},[de.messageIndex,ne]),Pn=S.useMemo(()=>{if(Ve.length===0)return null;const u=Ve.reduce((f,w)=>f+w.rating,0)/Ve.length;return Number(u.toFixed(2))},[Ve]),hn=S.useMemo(()=>{const u=[...T?.items??[]];return re&&u.unshift(Nc(re)),ie&&!u.some(f=>f.run_id===ie)&&fe?.run&&u.unshift(fe.run),u},[re,T?.items,fe?.run,ie]),ge=S.useCallback(u=>{B?.(`[autoruns] ${u}`)},[B]),en=S.useCallback(u=>{const f=u.trim();if(!f){Pt(String(I.limit));return}if(!/^\d+$/.test(f)){Pt(String(I.limit));return}const w=Number.parseInt(f,10);if(!Number.isFinite(w)){Pt(String(I.limit));return}const F=Math.max(1,Math.min(500,w));F!==I.limit&&q(ve=>({...ve,limit:F})),Pt(String(F))},[I.limit]),Ut=S.useCallback(u=>{const f=u.trim();if(!f){gt(String(R.count));return}if(!/^\d+$/.test(f)){gt(String(R.count));return}const w=Number.parseInt(f,10);if(!Number.isFinite(w)){gt(String(R.count));return}const F=Math.max(1,Math.min(200,w));F!==R.count&&L(ve=>({...ve,count:F})),gt(String(F))},[R.count]),vt=S.useCallback(async()=>{fn(!0);try{const u=await Ie.loadAutoRunAnnotations({limit:800,manual_case_decision:Se});se(u.items),Ge(u.manual_case_decision_schema??null),ft(u.available_manual_case_decisions??[]),rt(f=>u.items.length===0?"":u.items.some(w=>w.annotation_id===f)?f:u.items[0].annotation_id)}catch(u){ge(`Annotations load error: ${u instanceof Error?u.message:String(u)}`)}finally{fn(!1)}},[Se,ge]),Tt=S.useCallback(async()=>{kn(!0);try{const u=await Ie.loadAutoRunAutogenHistory({limit:180});j(u.items)}catch(u){ge(`Autogen history load error: ${u instanceof Error?u.message:String(u)}`)}finally{kn(!1)}},[ge]),Mt=S.useCallback(async()=>{try{const f=(await Ie.loadAutoRunAutogenPersonalityCatalog()).items.map(w=>({id:String(w.id??"").trim(),label:String(w.label??"").trim(),domain:typeof w.domain=="string"?w.domain.trim():"",defaultPrompt:String(w.default_prompt??"").trim()})).filter(w=>w.id.length>0&&w.label.length>0);if(f.length===0)return;A(f.map(w=>({id:w.id,label:w.label,domain:w.domain||"",defaultPrompt:w.defaultPrompt||"Генерируй реалистичные вопросы бухгалтера по выбранному профилю. Не выдумывай непокрытые возможности."})))}catch(u){ge(`Autogen personality catalog load error: ${u instanceof Error?u.message:String(u)}`)}},[ge]),et=S.useCallback(async()=>{jn(!0);try{const u=await Ie.loadAutoRunPostAnalysis({run_id:ie&&!br(ie)?ie:void 0,limit_per_queue:30,annotation_limit:1500,from:Fo(I.fromLocal),to:Fo(I.toLocal),target:I.target,mode:I.mode,use_mock:I.useMock,prompt_contains:I.promptContains.trim()||void 0});ke(u)}catch(u){ge(`Post-analysis load error: ${u instanceof Error?u.message:String(u)}`),ke(null)}finally{jn(!1)}},[I.fromLocal,I.mode,I.promptContains,I.target,I.toLocal,I.useMock,ge,ie]),Y=S.useCallback(async()=>{wn(!0),Ee("");try{const u=R.personalityPrompts[R.personalityId]??"",f=[h.systemPrompt,h.developerPrompt,h.domainPrompt,h.schemaNotes,h.fewShotExamples].join(` `).slice(0,900),w=await Ie.generateAutoRunQuestions({mode:R.mode,count:R.count,domain:Zt.domain||void 0,persist_to_eval_cases:R.persistToEvalCases,generated_by:R.generatedBy.trim()||void 0,llm:{llm_provider:i.llmProvider,api_key:i.apiKey,model:i.model,base_url:i.baseUrl,temperature:i.temperature,max_output_tokens:i.maxOutputTokens},context:{llm_provider:i.llmProvider,model:i.model,assistant_prompt_version:p,decomposition_prompt_version:O,prompt_fingerprint:f,autogen_personality_id:Zt.id,autogen_personality_prompt:u.trim()||void 0}});ge(`Generated ${w.generation.count} questions (${w.generation.mode}) id=${w.generation.generation_id}`+(w.generation.saved_case_set_file?` saved=${w.generation.saved_case_set_file}`:"")),oe(w.generation.generation_id),ae([...w.generation.questions??[]]),await Tt()}catch(u){const f=u instanceof Error?u.message:String(u);Ee(`Автогенерация: ${f}`),ge(`Autogen generate error: ${f}`)}finally{wn(!1)}},[p,R.count,R.generatedBy,R.mode,R.personalityId,R.personalityPrompts,R.persistToEvalCases,i.apiKey,i.baseUrl,i.llmProvider,i.maxOutputTokens,i.model,i.temperature,O,Tt,ge,h.developerPrompt,h.domainPrompt,h.fewShotExamples,h.schemaNotes,h.systemPrompt,Zt.domain,Zt.id]),tn=S.useCallback(async(u,f)=>{if(br(u)){const w=vc(u);if(re&&re.job_id===w){const F=Is(re,f);Be(u),xe(F.caseId),X(F.dialog);return}X(null);return}dn(!0);try{const w=await Ie.loadAutoRunCaseDialog(u,f);X(w)}catch(w){const F=w instanceof Error?w.message:String(w);Ee(`Диалог кейса: ${F}`),X(null),ge(`Dialog load error for ${u}/${f}: ${F}`)}finally{dn(!1)}},[re,ge]),pt=S.useCallback(async(u,f)=>{if(br(u)){const w=vc(u);if(re&&re.job_id===w){const F=Is(re,f??ct);Be(u),xe(F.caseId),ye(F.detail),X(F.dialog);return}Be(u),xe(""),ye(null),X(null);return}Yt(!0);try{const w=await Ie.loadAutoRunDetail(u);ye(w);const F=(f&&(f===ct||w.cases.some(ve=>ve.case_id===f))?f:"")||(w.cases.length>0?ct:"")||"";Be(u),xe(F),F?await tn(u,F):X(null)}catch(w){const F=w instanceof Error?w.message:String(w);Ee(`Детализация прогона: ${F}`),ye(null),X(null),ge(`Run detail load error for ${u}: ${F}`)}finally{Yt(!1)}},[re,tn,ge]),gn=S.useCallback(async u=>{Et(!0),Ee("");try{const f=await Ie.loadAutoRunsHistory({from:Fo(I.fromLocal),to:Fo(I.toLocal),target:I.target,mode:I.mode,use_mock:I.useMock,prompt_contains:I.promptContains.trim()||void 0,limit:I.limit});if(H(f),f.items.length===0){Be(""),xe(""),ye(null),X(null);return}const w=u?.keepSelection??!0,F=u?.preferredRunId??"",ve=u?.preferredCaseId??"",Bt=w&&F&&f.items.some(Ht=>Ht.run_id===F)?F:f.items[0].run_id;await pt(Bt,w?ve:void 0),et()}catch(f){const w=f instanceof Error?f.message:String(f);Ee(`История прогонов: ${w}`),ge(`History load error: ${w}`)}finally{Et(!1)}},[I.fromLocal,I.limit,I.mode,I.promptContains,I.target,I.toLocal,I.useMock,et,pt,ge]),ot=S.useCallback(()=>{Rt.current!==null&&(window.clearTimeout(Rt.current),Rt.current=null)},[]),yt=S.useCallback(async u=>{try{const f=await Ie.loadEvalRunAsyncStatus(u);he(f.job);const w=Uo(u);if(ie===w){const F=Is(f.job,Re||ct);ye(F.detail),X(F.dialog),xe(F.caseId)}if(f.job.status==="completed"){ot(),Nt(!1);const F=f.job.report_summary?.run_id??f.job.run_id;await gn({keepSelection:!0,preferredRunId:F||ie,preferredCaseId:ct}),await Tt(),he(null);return}if(f.job.status==="failed"){ot(),Nt(!1),Ee(`Запуск прогонов: ${f.job.error??"неизвестная ошибка"}`),ge(`Autogen async run failed: ${f.job.error??"unknown error"}`);return}ot(),Rt.current=window.setTimeout(()=>{yt(u)},500)}catch(f){ot(),Nt(!1);const w=f instanceof Error?f.message:String(f);Ee(`Запуск прогонов: ${w}`),ge(`Autogen async status error: ${w}`)}},[Tt,gn,ge,Re,ie,ot]),Nr=S.useCallback(async()=>{ot(),Nt(!0),Ee("");try{const u=st;if(!u)throw new Error("История автогенерации пуста. Сначала сгенерируйте пачку вопросов.");const f=le.map(nn=>nn.trim()).filter(nn=>nn.length>0);if(f.length===0)throw new Error("Нет вопросов для запуска: список пустой после ручного редактирования.");const w=I.useMock==="true",ve=(await Ie.startEvalRunAsync({connection:i,prompts:h,promptVersion:p,mode:"single-pass-strict",caseSetFile:u.saved_case_set_file??void 0,useMock:w,evalTarget:"assistant_stage1",questions:f})).job;he(ve);const Bt=Uo(ve.job_id),Ht=Is(ve,ct);Be(Bt),xe(Ht.caseId),ye(Ht.detail),X(Ht.dialog),ge(`Запущен async-прогон job=${ve.job_id}, run_id=${ve.run_id}, вопросов=${f.length}`+(u.saved_case_set_file?`, base_case_set=${u.saved_case_set_file}`:"")),yt(ve.job_id)}catch(u){const f=u instanceof Error?u.message:String(u);Ee(`Запуск прогонов: ${f}`),ge(`Autogen run error: ${f}`),Nt(!1)}},[p,i,le,I.useMock,ge,yt,h,st,ot]),fr=S.useCallback(u=>{if(u.role!=="assistant")return;const f=u.case_id??Re,w=u.case_message_index??u.message_index;We({open:!0,caseId:f,caseMessageIndex:w,messageIndex:u.message_index,rating:u.annotation?.rating??3,comment:u.annotation?.comment??"",manualCaseDecision:u.annotation?.manual_case_decision??$o,annotationAuthor:u.annotation?.annotation_author??R.generatedBy,saving:!1,error:""})},[R.generatedBy,Re]),Rn=S.useCallback(u=>{We(f=>f.saving&&!u?.force?f:{open:!1,caseId:"",caseMessageIndex:-1,messageIndex:-1,rating:3,comment:"",manualCaseDecision:$o,annotationAuthor:R.generatedBy,saving:!1,error:""})},[R.generatedBy]),Er=S.useCallback(async()=>{const u=ie,f=de.caseId,w=de.caseMessageIndex;if(!(!u||!f||w<0)){if(br(u)){We(F=>({...F,error:"Комментарий можно сохранить после завершения прогона."}));return}if(!de.comment.trim()){We(F=>({...F,error:"Добавьте комментарий."}));return}We(F=>({...F,saving:!0,error:""}));try{await Ie.saveAutoRunAnnotation({run_id:u,case_id:f,message_index:w,rating:de.rating,comment:de.comment.trim(),manual_case_decision:de.manualCaseDecision,annotation_author:de.annotationAuthor.trim()||void 0}),Rn({force:!0}),Promise.all([pt(u,Re),vt(),et()]).catch(F=>{const ve=F instanceof Error?F.message:String(F);Ee(`Обновление после комментария: ${ve}`),ge(`Comment refresh error: ${ve}`)})}catch(F){We(ve=>({...ve,saving:!1,error:F instanceof Error?F.message:String(F)}))}}},[Rn,de.annotationAuthor,de.caseId,de.caseMessageIndex,de.comment,de.manualCaseDecision,de.rating,vt,et,pt,ge,Re,ie]),Bn=S.useCallback(u=>{se(f=>f.map(w=>w.annotation_id===u.annotation_id?{...w,...u}:w)),X(f=>f&&{...f,annotations:f.annotations.map(w=>w.annotation_id===u.annotation_id?u:w),messages:f.messages.map(w=>!w.annotation||w.annotation.annotation_id!==u.annotation_id?w:{...w,commented:!0,annotation:u})})},[]),Hn=S.useCallback(async(u,f)=>{if(u.annotation_id){if(br(u.run_id)){Ee("Статус выполнения можно менять только для завершённых прогонов.");return}$t(u.annotation_id);try{const w=await Ie.updateAutoRunAnnotation({annotation_id:u.annotation_id,resolved:f,resolved_by:R.generatedBy||void 0});Bn(w.annotation),et()}catch(w){const F=w instanceof Error?w.message:String(w);Ee(`Смена статуса кейса: ${F}`),ge(`Annotation resolve toggle error: ${F}`)}finally{$t("")}}},[Bn,R.generatedBy,et,ge]),Vn=S.useCallback(async u=>{rt(u.annotation_id),await pt(u.run_id,u.case_id),T?.items.some(f=>f.run_id===u.run_id)||Ee("Комментарий относится к прогону вне текущего фильтра. Детали загружены напрямую.")},[T?.items,pt]);S.useEffect(()=>{mn.current||(mn.current=!0,gn({keepSelection:!1}),Tt(),Mt(),et())},[Tt,Mt,gn,et]),S.useEffect(()=>{mn.current&&vt()},[Se,vt]),S.useEffect(()=>{rt(u=>Ve.length===0?"":Ve.some(f=>f.annotation_id===u)?u:Ve[0].annotation_id)},[Ve]),S.useEffect(()=>{oe(u=>g.length===0?"":u&&g.some(f=>f.generation_id===u)?u:g[0].generation_id)},[g]),S.useEffect(()=>{if(!st){ae([]);return}ae([...st.questions])},[st?.generation_id]),S.useEffect(()=>{Pt(String(I.limit))},[I.limit]),S.useEffect(()=>{gt(String(R.count))},[R.count]),S.useEffect(()=>{if(!re)return;const u=Uo(re.job_id);if(ie!==u)return;const f=Is(re,Re||ct);ye(f.detail),X(f.dialog),xe(f.caseId)},[re,Re,ie]),S.useEffect(()=>()=>{ot()},[ot]),S.useEffect(()=>{me.length!==0&&L(u=>{let f=!1;const w={...u.personalityPrompts};for(const ve of me)(typeof w[ve.id]!="string"||w[ve.id].trim().length===0)&&(w[ve.id]=ve.defaultPrompt,f=!0);let F=u.personalityId;return me.some(ve=>ve.id===u.personalityId)||(F=me[0].id,f=!0),f?{...u,personalityId:F,personalityPrompts:w}:u})},[me]),S.useEffect(()=>{const u=localStorage.getItem(cc);if(u)try{const f=JSON.parse(u);if(f.filters){const w=f.filters;q(F=>({...F,...w,limit:typeof w.limit=="number"?Math.max(1,Math.min(500,w.limit)):F.limit}))}f.autoGenSettings&&L(w=>{const F={...w.personalityPrompts},ve=f.autoGenSettings?.personalityPrompts??{};for(const[Ht,nn]of Object.entries(ve))typeof nn=="string"&&Ht.trim().length>0&&(F[Ht.trim()]=nn);const Bt=typeof f.autoGenSettings?.personalityId=="string"&&f.autoGenSettings.personalityId.trim().length>0?f.autoGenSettings.personalityId.trim():w.personalityId;return{...w,mode:f.autoGenSettings?.mode==="codex_creative"||f.autoGenSettings?.mode==="qwen_seed"?f.autoGenSettings.mode:w.mode,count:typeof f.autoGenSettings?.count=="number"?Math.max(1,Math.min(200,f.autoGenSettings.count)):w.count,personalityId:Bt,personalityPrompts:F,persistToEvalCases:typeof f.autoGenSettings?.persistToEvalCases=="boolean"?f.autoGenSettings.persistToEvalCases:w.persistToEvalCases,generatedBy:typeof f.autoGenSettings?.generatedBy=="string"?f.autoGenSettings.generatedBy:w.generatedBy}}),(f.annotationDecisionFilter==="all"||typeof f.annotationDecisionFilter=="string"&&f.annotationDecisionFilter.length>0)&&Le(f.annotationDecisionFilter),typeof f.hideResolvedAnnotations=="boolean"&&$e(f.hideResolvedAnnotations)}catch{}},[]);const pr=S.useCallback(()=>{const u={filters:I,autoGenSettings:{mode:R.mode,count:R.count,personalityId:R.personalityId,personalityPrompts:R.personalityPrompts,persistToEvalCases:R.persistToEvalCases,generatedBy:R.generatedBy},annotationDecisionFilter:Se,hideResolvedAnnotations:Oe};localStorage.setItem(cc,JSON.stringify(u))},[Se,R,I,Oe]);return S.useEffect(()=>{const u=()=>{pr(),ge("Сохранены настройки панели автопрогонов.")};return window.addEventListener(dc,u),()=>{window.removeEventListener(dc,u)}},[ge,pr]),o.jsxs(Sn,{className:"autoruns-frame",title:"",hideHeader:!0,children:[o.jsxs("div",{className:"autoruns-columns",children:[o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Настройки"})}),o.jsx("h4",{children:"Настройки выборки"}),o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Дата с",o.jsx("input",{type:"datetime-local",value:I.fromLocal,onChange:u=>q(f=>({...f,fromLocal:u.target.value}))})]}),o.jsxs("label",{children:["Дата по",o.jsx("input",{type:"datetime-local",value:I.toLocal,onChange:u=>q(f=>({...f,toLocal:u.target.value}))})]}),o.jsxs("label",{children:["Целевой контур",o.jsxs("select",{value:I.target,onChange:u=>q(f=>({...f,target:u.target.value})),children:[o.jsx("option",{value:"all",children:"все"}),(T?.available.targets??[]).map(u=>o.jsx("option",{value:u,children:u},u))]})]}),o.jsxs("label",{children:["Режим",o.jsxs("select",{value:I.mode,onChange:u=>q(f=>({...f,mode:u.target.value})),children:[o.jsx("option",{value:"all",children:"все"}),(T?.available.modes??[]).map(u=>o.jsx("option",{value:u,children:u},u))]})]}),o.jsxs("label",{children:["Использовать mock",o.jsxs("select",{value:I.useMock,onChange:u=>q(f=>({...f,useMock:u.target.value})),children:[o.jsx("option",{value:"any",children:"любой"}),o.jsx("option",{value:"true",children:"да"}),o.jsx("option",{value:"false",children:"нет"})]})]}),o.jsxs("label",{children:["Лимит",o.jsx("input",{type:"number",min:1,max:500,value:pn,onChange:u=>{const f=u.target.value;(f===""||/^\d+$/.test(f))&&Pt(f)},onBlur:u=>en(u.target.value),onKeyDown:u=>{u.key==="Enter"&&en(u.target.value)}})]}),o.jsxs("label",{className:"full-width",children:["Версия промпта содержит",o.jsx("input",{value:I.promptContains,onChange:u=>q(f=>({...f,promptContains:u.target.value})),placeholder:"normalizer_v2_0_2 / address_query_runtime_v1",list:"autoruns-prompt-versions"})]})]}),o.jsx("datalist",{id:"autoruns-prompt-versions",children:(T?.available.prompt_versions??[]).map(u=>o.jsx("option",{value:u},u))}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:Cn,onClick:()=>{gn({keepSelection:!1})},children:Cn?"Обновляю...":"Применить"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>{q({...Ni,fromLocal:pc()}),Ee("")},children:"Сбросить фильтры"})]}),o.jsx("h4",{children:"Контур генерации"}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Провайдер:"}),o.jsx("strong",{children:i.llmProvider})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Модель:"}),o.jsx("strong",{children:i.model||"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Промпт ассистента:"}),o.jsx("strong",{children:p})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Промпт декомпозиции:"}),o.jsx("strong",{children:O})]})]}),o.jsx("h4",{children:"Автогенерация вопросов"}),o.jsx("p",{className:"muted",children:"`qwen_seed` использует текущую LLM-модель из активного контура подключения (та же модель, что и для ответов ассистента)."}),o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Режим генерации",o.jsxs("select",{value:R.mode,onChange:u=>L(f=>({...f,mode:u.target.value})),children:[o.jsx("option",{value:"codex_creative",children:"codex_creative"}),o.jsx("option",{value:"qwen_seed",children:"qwen_seed"})]})]}),o.jsxs("label",{children:["Кол-во",o.jsx("input",{type:"number",min:1,max:200,value:cr,onChange:u=>{const f=u.target.value;(f===""||/^\d+$/.test(f))&>(f)},onBlur:u=>Ut(u.target.value),onKeyDown:u=>{u.key==="Enter"&&Ut(u.target.value)}})]}),o.jsxs("label",{children:["Личность автогенерации",o.jsx("select",{value:R.personalityId,onChange:u=>L(f=>({...f,personalityId:u.target.value})),children:me.map(u=>o.jsx("option",{value:u.id,children:u.label},u.id))})]}),o.jsxs("label",{children:["Кто генерирует",o.jsx("input",{value:R.generatedBy,onChange:u=>L(f=>({...f,generatedBy:u.target.value})),placeholder:"manual_reviewer"})]}),o.jsxs("label",{className:"full-width",children:["Промпт личности",o.jsx("textarea",{value:R.personalityPrompts[R.personalityId]??"",onChange:u=>L(f=>({...f,personalityPrompts:{...f.personalityPrompts,[f.personalityId]:u.target.value}})),placeholder:"Текст промпта для выбранной личности автогенерации"})]}),o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:R.persistToEvalCases,onChange:u=>L(f=>({...f,persistToEvalCases:u.target.checked}))}),"Сохранять кейс-сет в `eval_cases`"]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:zt,onClick:()=>{Y()},children:zt?"Генерирую...":"Сгенерировать пачку"}),o.jsx("button",{type:"button",className:"tab",disabled:bt,onClick:()=>{Tt()},children:bt?"Обновляю...":"Обновить историю"}),o.jsx("button",{type:"button",className:"tab",disabled:cn||le.length===0,onClick:()=>{Nr()},children:cn?"Запускаю...":"Запустить прогоны"})]}),o.jsx("div",{className:"autoruns-form-grid",children:o.jsxs("label",{className:"full-width",children:["Кейс-сет для запуска",o.jsxs("select",{value:ee,onChange:u=>oe(u.target.value),disabled:g.length===0,children:[g.length===0?o.jsx("option",{value:"",children:"нет генераций"}):null,g.map(u=>o.jsxs("option",{value:u.generation_id,children:[ur(u.created_at)," | ",u.mode," | ",u.count," | ",u.saved_case_set_file??"без файла"]},u.generation_id))]})]})}),o.jsxs("div",{className:"autoruns-generated-questions",children:[o.jsxs("div",{className:"autoruns-generated-questions-head",children:[o.jsxs("strong",{children:["Вопросы к запуску: ",le.length]}),o.jsx("button",{type:"button",className:"tab",onClick:()=>ae([...st?.questions??[]]),disabled:!st,children:"Восстановить"})]}),le.length===0?o.jsx("p",{className:"muted",children:"Список вопросов пуст. Сгенерируйте пачку или восстановите из выбранной генерации."}):o.jsx("div",{className:"autoruns-generated-questions-list",children:le.map((u,f)=>o.jsxs("div",{className:"autoruns-generated-question-item",children:[o.jsxs("span",{children:[f+1,". ",u]}),o.jsx("button",{type:"button",className:"autoruns-remove-question-btn",onClick:()=>ae(w=>w.filter((F,ve)=>ve!==f)),title:"Удалить вопрос из запуска","aria-label":"Удалить вопрос из запуска",children:"X"})]},`${f}-${u.slice(0,24)}`))})]}),o.jsx("p",{className:"muted",children:"Запуск выполняет `assistant_stage1` eval по выбранному кейс-сету."}),o.jsxs("div",{className:"autoruns-autogen-list",children:[bt?o.jsx("p",{className:"muted",children:"Загружаю историю автогенераций..."}):null,!bt&&g.length===0?o.jsx("p",{className:"muted",children:"История автогенераций пока пустая."}):null,g.slice(0,30).map(u=>o.jsxs("article",{className:ee===u.generation_id?"autoruns-autogen-item selected":"autoruns-autogen-item",onClick:()=>oe(u.generation_id),children:[o.jsxs("header",{children:[o.jsx("strong",{children:ur(u.created_at)}),o.jsx("span",{children:u.mode})]}),o.jsxs("div",{className:"autoruns-run-meta",children:["id=",u.generation_id," | count=",u.count]}),o.jsxs("div",{className:"autoruns-run-meta",children:["домен=",u.domain??"общий",u.generated_by?` | автор=${u.generated_by}`:""]}),u.saved_case_set_file?o.jsxs("div",{className:"autoruns-run-meta",children:["кейс-сет=",u.saved_case_set_file]}):null,(u.questions??[]).length>0?o.jsx("p",{children:u.questions[0]}):null]},u.generation_id))]}),o.jsxs("details",{className:"autoruns-prompt-details",children:[o.jsx("summary",{children:"Копия активного промпта (только чтение)"}),o.jsxs("label",{children:["Системный",o.jsx("textarea",{readOnly:!0,value:h.systemPrompt})]}),o.jsxs("label",{children:["Разработчика",o.jsx("textarea",{readOnly:!0,value:h.developerPrompt})]}),o.jsxs("label",{children:["Доменный",o.jsx("textarea",{readOnly:!0,value:h.domainPrompt})]}),o.jsxs("label",{children:["Заметки по схеме",o.jsx("textarea",{readOnly:!0,value:h.schemaNotes})]}),o.jsxs("label",{children:["Примеры few-shot",o.jsx("textarea",{readOnly:!0,value:h.fewShotExamples})]})]}),Un?o.jsx("p",{className:"error-text",children:Un}):null]}),o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Выдача прогонов"})}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Всего"}),o.jsx("strong",{children:(T?.stats.runs_total??0)+(re?1:0)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Средний score"}),o.jsx("strong",{children:Ms(T?.stats.avg_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Тренд"}),o.jsx("strong",{children:T?mc(T.stats.trend):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Блокеры"}),o.jsx("strong",{children:T?.stats.blocking_runs??0})]})]}),o.jsxs("div",{className:"autoruns-run-list",children:[hn.map(u=>o.jsxs("button",{type:"button",className:ie===u.run_id?"autoruns-run-item selected":"autoruns-run-item",onClick:()=>{pt(u.run_id)},children:[o.jsxs("div",{className:"autoruns-run-head",children:[o.jsx("strong",{children:ur(u.run_timestamp)}),o.jsx("span",{children:Rf(u.eval_target)})]}),o.jsx("div",{className:"autoruns-run-meta",children:u.run_id}),o.jsxs("div",{className:"autoruns-run-meta",children:["режим=",u.mode??"нет данных"," | mock=",String(u.use_mock)]}),u.llm_provider||u.model?o.jsxs("div",{className:"autoruns-run-meta",children:["llm=",u.llm_provider??"нет данных"," | модель=",u.model??"нет данных"]}):null,o.jsxs("div",{className:"autoruns-run-meta",children:["промпт=",u.prompt_version??"нет данных"]}),o.jsxs("div",{className:"autoruns-run-foot",children:[o.jsxs("span",{children:["оценка: ",Ms(u.score_index)]}),o.jsxs("span",{children:["закрыто/открыто: ",u.closed_cases,"/",u.open_cases]})]}),o.jsxs("div",{className:"autoruns-run-foot",children:[o.jsxs("span",{children:["блокеры: ",u.blocking_failures]}),o.jsxs("span",{children:["качество: ",u.quality_failures]})]})]},u.run_id)),hn.length===0?o.jsx("p",{className:"muted",children:"За выбранный диапазон прогонов нет."}):null]})]}),o.jsxs("section",{className:"autoruns-col",children:[o.jsxs("div",{className:"autoruns-col-header",children:[o.jsx("h3",{children:"Диалог прогона"}),o.jsxs("div",{className:"autoruns-dialog-toolbar",children:[o.jsxs("label",{children:["Прогон",o.jsx("select",{value:ie,onChange:u=>{const f=u.target.value;pt(f)},children:hn.map(u=>o.jsxs("option",{value:u.run_id,children:[ur(u.run_timestamp)," | ",u.run_id]},u.run_id))})]}),o.jsxs("label",{children:["Кейс",o.jsxs("select",{value:Re,onChange:u=>{const f=u.target.value;xe(f),ie&&f&&tn(ie,f)},children:[(fe?.cases.length??0)>0?o.jsx("option",{value:ct,children:"ВСЕ кейсы подряд"}):null,(fe?.cases??[]).map(u=>o.jsxs("option",{value:u.case_id,children:[u.case_id," | ",u.status]},u.case_id))]})]})]})]}),o.jsxs("div",{className:"autoruns-case-list",children:[(fe?.cases.length??0)>0?o.jsxs("button",{type:"button",className:Re===ct?"autoruns-case-item selected":"autoruns-case-item",onClick:()=>{xe(ct),ie&&tn(ie,ct)},children:[o.jsx("span",{children:"ВСЕ кейсы подряд"}),o.jsx("span",{children:fe?.cases.length})]},ct):null,(fe?.cases??[]).map(u=>o.jsxs("button",{type:"button",className:Re===u.case_id?"autoruns-case-item selected":"autoruns-case-item",onClick:()=>{xe(u.case_id),ie&&tn(ie,u.case_id)},children:[o.jsx("span",{children:u.case_id}),o.jsxs("span",{children:[u.status,u.commented_count>0?` | комм=${u.commented_count}`:""]})]},u.case_id))]}),o.jsxs("div",{className:"autoruns-dialog-view",children:[Fn||Dt?o.jsx("p",{className:"muted",children:"Загружаю диалог..."}):null,!Fn&&!Dt&&(ne?.messages.length??0)===0?o.jsx("p",{className:"muted",children:"Диалог для этого прогона не найден."}):null,(ne?.messages??[]).map((u,f)=>{const w=u.role==="assistant"?"assistant":"user";return o.jsxs("article",{className:`autoruns-msg ${w}`,children:[o.jsxs("header",{children:[o.jsx("strong",{children:w==="assistant"?"Система":"Модель/вопрос"}),o.jsxs("div",{className:"autoruns-msg-head-actions",children:[u.case_id?o.jsx("span",{className:"autoruns-msg-case-tag",children:u.case_id}):null,o.jsx("span",{children:u.created_at?ur(u.created_at):"нет данных"}),w==="assistant"&&!br(ie)?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:u.commented?"autoruns-comment-icon commented":"autoruns-comment-icon",onClick:()=>fr(u),title:"\\u041a\\u043e\\u043c\\u043c\\u0435\\u043d\\u0442\\u0438\\u0440\\u043e\\u0432\\u0430\\u0442\\u044c \\u043e\\u0442\\u0432\\u0435\\u0442 \\u0441\\u0438\\u0441\\u0442\\u0435\\u043c\\u044b","aria-label":"\\u041a\\u043e\\u043c\\u043c\\u0435\\u043d\\u0442\\u0438\\u0440\\u043e\\u0432\\u0430\\u0442\\u044c \\u043e\\u0442\\u0432\\u0435\\u0442 \\u0441\\u0438\\u0441\\u0442\\u0435\\u043c\\u044b",children:o.jsx(Mf,{commented:u.commented})}),u.annotation?o.jsx("button",{type:"button",className:u.annotation.resolved?"autoruns-resolve-toggle resolved":"autoruns-resolve-toggle",onClick:()=>{Hn(u.annotation,!u.annotation.resolved)},disabled:Nn===u.annotation.annotation_id,title:u.annotation.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный","aria-label":u.annotation.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный",children:o.jsx(yc,{resolved:u.annotation.resolved})}):null]}):null]})]}),o.jsx("p",{children:u.text}),w==="assistant"&&u.annotation?o.jsxs("div",{className:"autoruns-msg-annotation",children:[o.jsx("strong",{children:hc(u.annotation.rating)}),o.jsx("span",{children:u.annotation.comment}),o.jsxs("span",{className:"muted",children:[u.annotation.manual_case_decision,u.annotation.annotation_author?` | ${u.annotation.annotation_author}`:""]})]}):null,(u.trace_id||u.reply_type)&&o.jsxs("footer",{children:[u.trace_id?o.jsxs("span",{children:["trace=",u.trace_id]}):null,u.reply_type?o.jsxs("span",{children:["reply_type=",u.reply_type]}):null]})]},u.message_id??`${w}-${f}`)})]})]}),E?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Режим ассистента"})}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"источник:"}),o.jsx("strong",{children:ne?.source??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"сессия:"}),o.jsx("strong",{children:ne?.session_id??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"контур прогона:"}),o.jsx("strong",{children:Ft?.eval_target??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"оценка прогона:"}),o.jsx("strong",{children:Ms(Ft?.score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"комментарии:"}),o.jsx("strong",{children:fe?.annotations_summary?.total??0})]})]}),o.jsx("h4",{children:"Пакет режима ассистента"}),o.jsx(dt,{value:ne?.assistant_mode??{note:"assistant_mode недоступен"}}),o.jsx("h4",{style:{marginTop:12},children:"Проверки кейса"}),o.jsx(dt,{value:Je?.checks??{note:"checks недоступен"}}),o.jsx("h4",{style:{marginTop:12},children:"Сабскор метрик"}),o.jsx(dt,{value:Je?.metric_subscores??{note:"metric_subscores недоступен"}})]}):null,D?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Режим декомпозиции"})}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"кейс:"}),o.jsx("strong",{children:Je?.case_id??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"домен:"}),o.jsx("strong",{children:Je?.domain??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"класс запроса:"}),o.jsx("strong",{children:Je?.query_class??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"trace:"}),o.jsx("strong",{children:Je?.trace_id??"нет данных"})]})]}),o.jsx("h4",{children:"Шаги декомпозиции"}),(ne?.decomposition.length??0)>0?o.jsx("ol",{className:"autoruns-decomposition-list",children:(ne?.decomposition??[]).map((u,f)=>o.jsx("li",{children:u},`${f}-${u.slice(0,24)}`))}):o.jsx("p",{className:"muted",children:"В логах кейса нет явной декомпозиции."})]}):null,K?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Прогресс / регресс"})}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Последний score"}),o.jsx("strong",{children:Ms(T?.stats.latest_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Предыдущий"}),o.jsx("strong",{children:Ms(T?.stats.previous_score_index??null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Тренд"}),o.jsx("strong",{children:T?mc(T.stats.trend):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Пробелы качества"}),o.jsx("strong",{children:T?.stats.quality_gap_runs??0})]})]}),o.jsx("h4",{children:"Покрытие доменов (история)"}),gc(T?.stats.domain_coverage??[]),o.jsx("h4",{style:{marginTop:14},children:"Покрытие доменов (выбранный прогон)"}),gc(fe?.coverage.domain_coverage??[]),o.jsx("h4",{style:{marginTop:14},children:"Очереди фиксов пост-анализа"}),Jt?o.jsx("p",{className:"muted",children:"Собираю пост-анализ..."}):null,Jt?null:o.jsx("div",{className:"autoruns-stats-grid",children:Object.entries(ce?.post_analysis.stats.by_queue??{}).map(([u,f])=>o.jsxs("div",{children:[o.jsx("span",{children:u}),o.jsx("strong",{children:f})]},u))}),o.jsxs("div",{className:"autoruns-autogen-list",children:[(ce?.post_analysis.recommended_regression_candidates??[]).slice(0,12).map(u=>o.jsxs("article",{className:"autoruns-autogen-item",children:[o.jsxs("header",{children:[o.jsx("strong",{children:u.manual_case_decision}),o.jsxs("span",{children:[u.rating,"/5"]})]}),o.jsxs("div",{className:"autoruns-run-meta",children:[u.domain??"неизвестно"," / ",u.query_class??"неизвестно"]}),o.jsx("p",{children:u.comment})]},u.annotation_id)),!Jt&&(ce?.post_analysis.recommended_regression_candidates.length??0)===0?o.jsx("p",{className:"muted",children:"Рекомендованных кандидатов пока нет."}):null]})]}):null,Z?o.jsxs("section",{className:"autoruns-col",children:[o.jsx("div",{className:"autoruns-col-header",children:o.jsx("h3",{children:"Комментарии"})}),o.jsx("h4",{children:"Размеченные ответы"}),o.jsxs("div",{className:"autoruns-comment-filter-row",children:[o.jsxs("label",{children:["Фильтр решений",o.jsxs("select",{value:Se,onChange:u=>Le(u.target.value),children:[o.jsx("option",{value:"all",children:"все"}),(Ze.length>0?Ze:Ue?.enum??[]).map(u=>o.jsx("option",{value:u,children:String(Ue?.labels?.[u]??u)},u))]})]}),o.jsx("button",{type:"button",className:"tab autoruns-resolved-filter-toggle",onClick:()=>$e(u=>!u),children:Oe?"Показать выполненные":"Скрыть выполненные"})]}),o.jsxs("div",{className:"autoruns-stats-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Комментариев"}),o.jsx("strong",{children:Ve.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Средний рейтинг"}),o.jsx("strong",{children:Pn===null?"нет данных":`${Pn.toFixed(2)} / 5`})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Последний"}),o.jsx("strong",{children:Ve.length>0?ur(Ve[0].updated_at):"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Статус"}),o.jsx("strong",{children:Xt?"обновляю":"готово"})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",disabled:Xt,onClick:()=>{vt()},children:Xt?"Обновляю...":"Обновить список"}),o.jsx("button",{type:"button",className:"tab",disabled:Jt,onClick:()=>{et()},children:Jt?"Идет пост-анализ...":"Обновить пост-анализ"})]}),o.jsxs("div",{className:"autoruns-comments-list",children:[Xt?o.jsx("p",{className:"muted",children:"Загружаю комментарии..."}):null,!Xt&&Ve.length===0?o.jsx("p",{className:"muted",children:G.length===0?"Пока нет откомментированных ответов.":"Нет открытых кейсов по текущему фильтру."}):null,Ve.map(u=>o.jsxs("article",{className:Ct===u.annotation_id?"autoruns-comment-item selected":"autoruns-comment-item",onClick:()=>{Vn(u)},role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),Vn(u))},children:[o.jsxs("div",{className:"autoruns-comment-head",children:[o.jsx("strong",{children:hc(u.rating)}),o.jsxs("div",{className:"autoruns-comment-head-actions",children:[o.jsx("span",{children:ur(u.updated_at)}),o.jsx("button",{type:"button",className:u.resolved?"autoruns-resolve-toggle resolved":"autoruns-resolve-toggle",onClick:f=>{f.preventDefault(),f.stopPropagation(),Hn(u,!u.resolved)},disabled:Nn===u.annotation_id,title:u.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный","aria-label":u.resolved?"Отметить кейс как невыполненный":"Отметить кейс как выполненный",children:o.jsx(yc,{resolved:u.resolved})})]})]}),o.jsx("div",{className:"autoruns-run-meta",children:u.run_id}),o.jsxs("div",{className:"autoruns-run-meta",children:["case=",u.case_id," | msg=",u.message_index]}),o.jsxs("div",{className:"autoruns-run-meta",children:["decision=",u.manual_case_decision,u.annotation_author?` | author=${u.annotation_author}`:""]}),u.resolved_at?o.jsxs("div",{className:"autoruns-run-meta",children:["выполнено",": ",ur(u.resolved_at),u.resolved_by?` | by=${u.resolved_by}`:""]}):null,u.context.question_text?o.jsxs("p",{children:["Q: ",u.context.question_text]}):null,u.context.answer_text?o.jsxs("p",{children:["A: ",u.context.answer_text]}):null,o.jsx("p",{children:u.comment})]},u.annotation_id))]}),je?o.jsxs(o.Fragment,{children:[o.jsx("h4",{children:"Тех-контекст брака"}),o.jsxs("div",{className:"autoruns-meta-list",children:[o.jsxs("div",{children:[o.jsx("span",{children:"trace:"}),o.jsx("strong",{children:je.technical_context.trace_id??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"reply_type:"}),o.jsx("strong",{children:je.technical_context.reply_type??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"domain:"}),o.jsx("strong",{children:je.technical_context.domain??"нет данных"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"query_class:"}),o.jsx("strong",{children:je.technical_context.query_class??"нет данных"})]})]}),o.jsx("h4",{children:"JSON разбор"}),o.jsx(dt,{value:{annotation_id:je.annotation_id,run_id:je.run_id,case_id:je.case_id,message_index:je.message_index,rating:je.rating,comment:je.comment,manual_case_decision:je.manual_case_decision,annotation_author:je.annotation_author,resolved:je.resolved,resolved_at:je.resolved_at,resolved_by:je.resolved_by,context:je.context,technical_context:je.technical_context,case_summary:je.case_summary?{case_id:je.case_summary.case_id,domain:je.case_summary.domain,query_class:je.case_summary.query_class,checks:je.case_summary.checks,metric_subscores:je.case_summary.metric_subscores}:null}})]}):null]}):null]}),de.open?o.jsx("div",{className:"autoruns-comment-modal-backdrop",onClick:u=>{u.target===u.currentTarget&&Rn()},children:o.jsxs("div",{className:"autoruns-comment-modal",children:[o.jsx("h3",{children:"Комментарий к ответу системы"}),o.jsx("p",{className:"muted",children:"Оцените ответ по 5-балльной шкале и добавьте комментарий по браку."}),En?o.jsxs(o.Fragment,{children:[o.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[o.jsx("summary",{children:"Вопрос пользователя"}),o.jsx("p",{className:"autoruns-comment-quote",children:dr?.text??"Вопрос в диалоге не найден."})]}),o.jsxs("details",{className:"autoruns-prompt-details",open:!0,children:[o.jsx("summary",{children:"Ответ системы"}),o.jsx("p",{className:"autoruns-comment-quote",children:En.text})]})]}):null,o.jsx("div",{className:"autoruns-rating-row",role:"group","aria-label":"Рейтинг ответа",children:[1,2,3,4,5].map(u=>o.jsx("button",{type:"button",className:de.rating>=u?"autoruns-rating-dot active":"autoruns-rating-dot",onClick:()=>We(f=>({...f,rating:u})),disabled:de.saving,"aria-label":`Оценка ${u}`,children:de.rating>=u?"●":"○"},u))}),o.jsxs("div",{className:"autoruns-form-grid",children:[o.jsxs("label",{children:["Решение по кейсу",o.jsx("select",{value:de.manualCaseDecision,onChange:u=>We(f=>({...f,manualCaseDecision:u.target.value})),disabled:de.saving,children:(Ze.length>0?Ze:Ue?.enum??[$o]).map(u=>o.jsx("option",{value:u,children:String(Ue?.labels?.[u]??u)},u))})]}),o.jsxs("label",{children:["Автор комментария",o.jsx("input",{value:de.annotationAuthor,onChange:u=>We(f=>({...f,annotationAuthor:u.target.value})),placeholder:"manual_reviewer",disabled:de.saving})]})]}),o.jsxs("label",{children:["Комментарий",o.jsx("textarea",{value:de.comment,onChange:u=>We(f=>({...f,comment:u.target.value})),placeholder:"Почему ответ бракованный, что именно пошло не так, какие технические детали проверить.",rows:4,disabled:de.saving})]}),de.error?o.jsx("p",{className:"error-text",children:de.error}):null,o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>{Er()},disabled:de.saving,children:de.saving?"Сохраняю...":"Готово"}),o.jsx("button",{type:"button",className:"tab",onClick:()=>Rn(),disabled:de.saving,children:"Отмена"})]})]})}):null]})}const Lf=/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json|debug_payload|technical_breakdown)\b/i,Af=[/\b(?:debug_payload_json|technical_breakdown_json)\b/i,/\b(?:route_summary|semantic_profile|domain_scope|relation_patterns|account_scope)\b/i,/\b(?:coverage_report|retrieval_status|problem_unit_state|candidate_evidence)\b/i,/\b(?:graph_domain_scope|graph_runtime|selection_reason|why_included)\b/i];function Of(i){try{return JSON.stringify(i,null,2)}catch{return String(i)}}function zf(i){const h=String(i??""),p=h.match(Lf);return(p?h.slice(0,p.index):h).replace(/###\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)[\s\S]*?(?:```[\s\S]*?```|$)/gi,"").replace(/(?:^|\n)\s*#{0,6}\s*(?:debug_payload_json|technical_breakdown_json|route_summary_json)\b[\s\S]*$/gi,"").split(/\r?\n/g).map(K=>K.trimEnd()).filter(K=>K.trim().length>0).filter(K=>!Af.some(Z=>Z.test(K))).join(` `).trim()}function Df(i,h,p="default"){const O=p==="technical",E=[];E.push("# Assistant conversation export"),E.push(`session_id: ${i||"n/a"}`),E.push(`export_mode: ${p}`),E.push(`exported_at: ${new Date().toISOString()}`),E.push("");for(let D=0;D{T.current&&(T.current.scrollTop=T.current.scrollHeight)},[h,I]),S.useEffect(()=>()=>{H.current!==null&&window.clearTimeout(H.current)},[]);async function G(se){if(h.length===0)return;const Se=Df(i,h,se),Le=await Uf(Se);X(se==="technical"?"тех":"чат"),ye(Le?"success":"error"),H.current!==null&&window.clearTimeout(H.current),H.current=window.setTimeout(()=>{ye("idle")},2200)}return o.jsxs(Sn,{title:"Режим ассистента",subtitle:"Диалоговый слой поверх normalizer, маршрутизации и factual retrieval.",actions:o.jsxs("div",{className:"assistant-panel-actions",children:[o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{G("default")},disabled:h.length===0,title:"Экспорт только user-facing чата",children:"Скопировать чат"}),o.jsx("button",{type:"button",className:"assistant-copy-btn",onClick:()=>{G("technical")},disabled:h.length===0,title:"Технический экспорт с debug payload",children:"Скопировать техчат"}),fe==="success"?o.jsxs("span",{className:"assistant-copy-feedback success",children:["Скопировано (",ne,")"]}):null,fe==="error"?o.jsx("span",{className:"assistant-copy-feedback error",children:"Ошибка копирования"}):null,o.jsx("span",{className:"status-chip",children:i?`session: ${i}`:"новая сессия"})]}),children:[o.jsxs("div",{ref:T,className:"assistant-chat-list",children:[h.length===0?o.jsx("div",{className:"assistant-empty muted",children:"Диалог пуст. Отправьте первый вопрос, чтобы запустить контур ассистента."}):null,h.map(se=>o.jsxs("article",{className:`assistant-msg ${se.role}`,children:[o.jsxs("header",{className:"assistant-msg-head",children:[o.jsx("strong",{children:$f(se.role)}),o.jsx("span",{children:Ff(se.created_at)})]}),o.jsx("div",{className:"assistant-msg-body",children:se.text}),se.role==="assistant"&&se.debug?o.jsxs("details",{className:"assistant-debug",children:[o.jsx("summary",{children:"Показать технический разбор"}),o.jsx(dt,{value:se.debug})]}):null]},se.message_id))]}),o.jsxs("div",{className:"assistant-compose",children:[o.jsxs("label",{className:"full-width",children:["Сообщение",o.jsx("textarea",{value:p,onChange:se=>O(se.target.value),rows:4,placeholder:"Введите вопрос к данным компании..."})]}),o.jsxs("div",{className:"button-row",children:[o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:E,onChange:se=>D(se.target.checked)}),"Mock-режим"]}),o.jsx("button",{type:"button",onClick:()=>K(),disabled:B||!p.trim(),children:B?"Выполняю...":"Отправить"}),o.jsx("button",{type:"button",onClick:()=>Z(),disabled:B&&h.length===0,children:"Сбросить сессию"})]}),I?o.jsx("p",{className:"diff-summary",children:I}):null,q?o.jsx("p",{className:"error-text",children:q}):null]})]})}function xc({value:i,modelOptions:h,modelsBusy:p,onChange:O,onReloadModels:E,onTestConnection:D,onSaveLocalConfig:K,lastStatus:Z,busy:B}){const I=i.llmProvider==="local",q=h.includes(i.model),[T,H]=S.useState(String(i.temperature)),[fe,ye]=S.useState(String(i.maxOutputTokens));S.useEffect(()=>{H(String(i.temperature))},[i.temperature]),S.useEffect(()=>{ye(String(i.maxOutputTokens))},[i.maxOutputTokens]);const ne=G=>{const se=G.replace(",",".").trim();if(!se){H(String(i.temperature));return}const Se=Number(se);if(!Number.isFinite(Se)){H(String(i.temperature));return}O({...i,temperature:Se}),H(String(Se))},X=G=>{const se=G.trim();if(!se){ye(String(i.maxOutputTokens));return}const Se=Number.parseInt(se,10);if(!Number.isFinite(Se)||Se<=0){ye(String(i.maxOutputTokens));return}O({...i,maxOutputTokens:Se}),ye(String(Se))};return o.jsxs(Sn,{title:"LLM Connection",subtitle:"Switch between OpenAI cloud and local OpenAI-compatible server.",actions:o.jsx("span",{className:"status-chip",children:Z||"Status: not checked"}),children:[o.jsxs("div",{className:"grid-two",children:[o.jsxs("label",{children:["Provider",o.jsxs("select",{value:i.llmProvider,onChange:G=>{const se=G.target.value==="local"?"local":"openai";O({...i,llmProvider:se,baseUrl:se==="local"?"http://127.0.0.1:1234/v1":"https://api.openai.com/v1"})},children:[o.jsx("option",{value:"openai",children:"OpenAI (token)"}),o.jsx("option",{value:"local",children:"Local (LM Studio / OpenAI-compatible)"})]})]}),o.jsxs("label",{children:["Model",o.jsxs("select",{value:q?i.model:"__manual__",onChange:G=>{const se=G.target.value;se!=="__manual__"&&O({...i,model:se})},children:[o.jsx("option",{value:"__manual__",children:"Manual input"}),h.map(G=>o.jsx("option",{value:G,children:G},G))]})]}),o.jsxs("label",{children:["Model ID (manual)",o.jsx("input",{value:i.model,onChange:G=>O({...i,model:G.target.value}),placeholder:"qwen2.5-14b-instruct or lmstudio loaded model id"})]}),I?null:o.jsxs("label",{className:"full-width",children:["OpenAI API Key",o.jsx("input",{type:"password",value:i.apiKey,onChange:G=>O({...i,apiKey:G.target.value}),placeholder:"sk-..."})]}),o.jsxs("label",{className:I?"full-width":void 0,children:[I?"Local server base URL":"Base URL",o.jsx("input",{value:i.baseUrl,onChange:G=>O({...i,baseUrl:G.target.value}),placeholder:I?"http://127.0.0.1:1234/v1":"https://api.openai.com/v1"})]}),o.jsxs("label",{children:["Temperature",o.jsx("input",{type:"number",step:"0.1",value:T,onChange:G=>H(G.target.value),onBlur:G=>ne(G.target.value),onKeyDown:G=>{G.key==="Enter"&&ne(G.target.value)}})]}),o.jsxs("label",{children:["Max output tokens",o.jsx("input",{type:"number",value:fe,onChange:G=>ye(G.target.value),onBlur:G=>X(G.target.value),onKeyDown:G=>{G.key==="Enter"&&X(G.target.value)}})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>K(),children:"Save local config"}),o.jsx("button",{type:"button",onClick:()=>E(),disabled:B||p,children:p?"Loading models...":"Load model list"}),o.jsx("button",{type:"button",onClick:()=>D(),disabled:B,children:B?"Checking...":"Test connection"})]})]})}function Hf({items:i,onRefresh:h,onOpenTrace:p}){return o.jsx(Sn,{title:"История нормализаций",subtitle:"Короткий вопрос, confidence, route hint и статус валидации.",actions:o.jsx("button",{type:"button",onClick:()=>h(),children:"Обновить"}),children:o.jsxs("div",{className:"history-list",children:[i.length===0?o.jsx("p",{className:"muted",children:"История пока пустая."}):null,i.map(O=>o.jsxs("button",{type:"button",className:"history-item",onClick:()=>p(O.trace_id),children:[o.jsxs("div",{className:"history-row",children:[o.jsx("strong",{children:O.route_hint??"route: n/a"}),o.jsx("span",{children:O.validation_passed?"schema: ok":"schema: fail"})]}),o.jsx("p",{children:O.question_short}),o.jsxs("div",{className:"history-row",children:[o.jsx("span",{children:O.model}),o.jsx("span",{children:new Date(O.timestamp).toLocaleString("ru-RU")})]})]},O.trace_id))]})})}function $n(i){return i==null||i===""?"—":String(i)}function Vf({result:i}){return o.jsx(Sn,{title:"Runtime метрики",subtitle:"trace_id, токены, latency и статус валидации.",children:o.jsxs("div",{className:"metrics-grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"trace_id"}),o.jsx("strong",{children:$n(i?.trace_id)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"request_started_at"}),o.jsx("strong",{children:$n(i?new Date(Date.now()-i.latency_ms).toISOString():null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"request_finished_at"}),o.jsx("strong",{children:$n(i?new Date().toISOString():null)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"latency_ms"}),o.jsx("strong",{children:$n(i?.latency_ms)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"input_tokens"}),o.jsx("strong",{children:$n(i?.usage?.input_tokens)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"output_tokens"}),o.jsx("strong",{children:$n(i?.usage?.output_tokens)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"total_tokens"}),o.jsx("strong",{children:$n(i?.usage?.total_tokens)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"validation_status"}),o.jsx("strong",{children:i?.validation?.passed?"passed":"failed"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"prompt_version"}),o.jsx("strong",{children:$n(i?.prompt_version)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"schema_version"}),o.jsx("strong",{children:$n(i?.schema_version)})]})]})})}const Qf={normalized:"Normalized JSON",fragments:"Fragment View",scope:"Scope View",flags:"Flags View",route:"Route Simulation",raw:"Raw model output",validation:"Validation",logs:"Logs"};function Wf(i){return i&&typeof i=="object"?i:null}function Kf({tab:i,onTabChange:h,result:p,appLogs:O}){const E=["normalized","fragments","scope","flags","route","raw","validation","logs"],D=Wf(p?.normalized),K=String(D?.schema_version??""),Z=K==="normalized_query_v2"||K==="normalized_query_v2_0_1"||K==="normalized_query_v2_0_2",B=Z?{fragments:D?.fragments??[],discarded_fragments:D?.discarded_fragments??[]}:{note:"Fragment View доступен для normalized_query_v2."},I=Z?{message_in_scope:D?.message_in_scope??null,scope_confidence:D?.scope_confidence??null,contains_multiple_tasks:D?.contains_multiple_tasks??null,global_notes:D?.global_notes??null}:{note:"Scope View доступен для normalized_query_v2."},q=Z?Array.isArray(D?.fragments)?(D?.fragments).map(T=>({fragment_id:T.fragment_id??null,domain_relevance:T.domain_relevance??null,candidate_labels:T.candidate_labels??[],execution_readiness:T.execution_readiness??null,clarification_reason:T.clarification_reason??null,soft_assumption_used:T.soft_assumption_used??[],route_status:T.route_status??null,no_route_reason:T.no_route_reason??null,flags:T.flags??{}})):[]:{note:"Flags View доступен для normalized_query_v2."};return o.jsxs(Sn,{title:"Выходные данные",subtitle:"Structured output и диагностические вкладки.",children:[o.jsx("div",{className:"tab-row",children:E.map(T=>o.jsx("button",{type:"button",className:i===T?"tab active":"tab",onClick:()=>h(T),children:Qf[T]},T))}),i==="normalized"?o.jsx(dt,{value:p?.normalized??{note:"Нет данных."}}):null,i==="fragments"?o.jsx(dt,{value:B}):null,i==="scope"?o.jsx(dt,{value:I}):null,i==="flags"?o.jsx(dt,{value:q}):null,i==="route"?o.jsx(dt,{value:p?.route_hint_summary??{note:"Нет данных."}}):null,i==="raw"?o.jsx(dt,{value:p?.raw_model_output??{note:"Нет данных."}}):null,i==="validation"?o.jsx(dt,{value:p?.validation??{note:"Нет данных."}}):null,i==="logs"?o.jsx(dt,{value:O}):null]})}function _c({value:i,onChange:h,presets:p,selectedPresetId:O,onSelectPreset:E,onLoadPreset:D,onSavePreset:K,onResetDefaults:Z,onDiffPrevious:B,presetName:I,onPresetNameChange:q,diffSummary:T}){return o.jsxs(Sn,{title:"Prompt Manager",subtitle:"Системный, developer и domain уровни управляются отдельно.",children:[o.jsxs("div",{className:"prompt-manager-grid",children:[o.jsxs("label",{children:["Системный prompt",o.jsx("textarea",{value:i.systemPrompt,onChange:H=>h({...i,systemPrompt:H.target.value}),rows:6})]}),o.jsxs("label",{children:["Developer / Instruction prompt",o.jsx("textarea",{value:i.developerPrompt,onChange:H=>h({...i,developerPrompt:H.target.value}),rows:6})]}),o.jsxs("label",{children:["Domain prompt",o.jsx("textarea",{value:i.domainPrompt,onChange:H=>h({...i,domainPrompt:H.target.value}),rows:6})]}),o.jsxs("label",{children:["Schema notes",o.jsx("textarea",{value:i.schemaNotes,onChange:H=>h({...i,schemaNotes:H.target.value}),rows:6})]}),o.jsxs("label",{className:"full-width",children:["Few-shot examples",o.jsx("textarea",{value:i.fewShotExamples,onChange:H=>h({...i,fewShotExamples:H.target.value}),rows:8})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsxs("select",{value:O,onChange:H=>E(H.target.value),children:[o.jsx("option",{value:"",children:"Выберите preset..."}),p.map(H=>o.jsx("option",{value:H.id,children:H.name},H.id))]}),o.jsx("button",{type:"button",onClick:()=>D(),children:"Загрузить preset"}),o.jsx("input",{value:I,onChange:H=>q(H.target.value),placeholder:"Имя для сохранения"}),o.jsx("button",{type:"button",onClick:()=>K(),children:"Сохранить preset"}),o.jsx("button",{type:"button",onClick:()=>B(),children:"Diff с предыдущим"}),o.jsx("button",{type:"button",onClick:()=>Z(),children:"Сбросить к default"})]}),T?o.jsx("p",{className:"diff-summary",children:T}):null]})}function qf({value:i,onChange:h,onApplyBatchFormat:p,onNormalize:O,busy:E,useMock:D,onUseMockChange:K,errorMessage:Z}){return o.jsxs(Sn,{title:"Запрос пользователя",subtitle:"NDC semantic front-end: нормализуем, но не отвечаем за бухгалтерскую суть.",children:[o.jsxs("div",{className:"grid-two",children:[o.jsxs("label",{className:"full-width",children:["Raw user question",o.jsx("textarea",{value:i.userQuestion,onChange:B=>h({...i,userQuestion:B.target.value}),rows:6,placeholder:"Например: По каким покупателям у нас на конец июня висят отгрузки без оплаты..."})]}),o.jsxs("label",{className:"full-width",children:["Batch queries (`;` separator)",o.jsx("textarea",{value:i.batchQuestionsRaw,onChange:B=>h({...i,batchQuestionsRaw:B.target.value}),onBlur:()=>p(),rows:8,placeholder:"Вопрос 1; Вопрос 2; Вопрос 3"})]}),o.jsxs("label",{children:["Optional period context",o.jsx("input",{value:i.periodHint,onChange:B=>h({...i,periodHint:B.target.value})})]}),o.jsxs("label",{children:["Optional business context",o.jsx("input",{value:i.businessContext,onChange:B=>h({...i,businessContext:B.target.value})})]}),o.jsxs("label",{children:["Optional expected route (eval)",o.jsx("input",{value:i.expectedRoute,onChange:B=>h({...i,expectedRoute:B.target.value})})]})]}),o.jsxs("div",{className:"button-row",children:[o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:D,onChange:B=>K(B.target.checked)}),"Mock-режим (без вызова OpenAI)"]}),o.jsx("button",{type:"button",onClick:()=>p(),disabled:E||!i.batchQuestionsRaw.trim(),children:"Применить `;` в переносы"}),o.jsx("button",{type:"button",onClick:()=>O(!1),disabled:E||!i.userQuestion.trim(),children:E?"Нормализуем...":"Normalize"}),o.jsx("button",{type:"button",onClick:()=>O(!0),disabled:E||!i.userQuestion.trim(),children:E?"Сохраняем...":"Normalize + Save as test case"})]}),Z?o.jsx("p",{className:"error-text",children:Z}):null]})}function Gf({runs:i,selectedRunId:h,onSelectRun:p,onStartRun:O,onFinishRun:E,onRefreshRuns:D,onRunEval:K,onCopyEvalReport:Z,evalBusy:B,traceItems:I,evalReport:q}){return o.jsxs(Sn,{title:"NDC Run Monitor",subtitle:"Важно: кнопка Запустить run создает только run-сущность. Кнопка eval запускает batch-проверку normalizer v2.0.2.",children:[o.jsxs("div",{className:"button-row",children:[o.jsx("button",{type:"button",onClick:()=>O(),children:"Запустить run"}),o.jsx("button",{type:"button",onClick:()=>E(),disabled:!h,children:"Завершить выбранный run"}),o.jsx("button",{type:"button",onClick:()=>D(),children:"Обновить runs"}),o.jsx("button",{type:"button",onClick:()=>K(),disabled:B,children:B?"Идет eval v2.0.2...":"Запустить eval v2.0.2"})]}),o.jsxs("div",{className:"runtime-stack",children:[o.jsxs("div",{className:"runtime-runs",children:[i.map(T=>o.jsxs("button",{type:"button",className:h===T.runId?"history-item selected":"history-item",onClick:()=>p(T.runId),children:[o.jsxs("div",{className:"history-row",children:[o.jsx("strong",{children:T.status}),o.jsx("span",{children:T.runId})]}),o.jsxs("div",{className:"history-row",children:[o.jsx("span",{children:T.sessionId}),o.jsx("span",{children:new Date(T.updatedAt).toLocaleString("ru-RU")})]})]},T.runId)),i.length===0?o.jsx("p",{className:"muted",children:"Нет активных запусков."}):null]}),o.jsxs("div",{className:"runtime-details",children:[o.jsx("h3",{children:"Trace выбранного run"}),o.jsx(dt,{value:I}),o.jsxs("div",{className:"eval-report-wrap",children:[o.jsx("h3",{style:{marginTop:12},children:"Отчет eval"}),o.jsx(dt,{value:q??{note:"Eval пока не запускался"}}),o.jsx("button",{type:"button",className:"copy-cube-button",title:"Скопировать отчет eval",onClick:()=>Z(),children:"⧉"})]})]})]})]})}const Jf={llmProvider:"openai",apiKey:"",model:"gpt-4o-mini",baseUrl:"https://api.openai.com/v1",temperature:0,maxOutputTokens:700},Sc={systemPrompt:"Ты semantic-normalizer для бухгалтерского ассистента NDC. Возвращай только JSON по схеме normalized_query_v2_0_2.",developerPrompt:"Сначала делай decomposition сообщения на task fragments, затем определяй domain scope и route-critical flags. Для каждого fragment заполняй execution_readiness + route_status + no_route_reason. Если fragment routable, не оставляй его в no_route.",domainPrompt:"Контур: данные текущего предприятия в 1С/NDC. In-scope: документы, проводки, взаиморасчеты, остатки, периодное закрытие, аномалии и контрольные проверки. Out-of-scope: общая теория, законы и оффтоп.",schemaNotes:"schema_version: normalized_query_v2_0_2. Строгий JSON без дополнительных полей.",fewShotExamples:"Q: Проверь по поставщикам хвосты и разложи цепочку документов/оплат. => fragment in_scope, flags: multi_entity + chain_explanation. Q: Как вообще по ФСБУ? => out_of_scope/generic_accounting."},bf={userQuestion:"",batchQuestionsRaw:"",periodHint:"",businessContext:"",expectedRoute:""},Ei={colors:{backgroundRgb:"18, 18, 18",mainSurfaceRgb:"25, 25, 25",horizontalSurfaceRgb:"30, 30, 30",focusSurfaceRgb:"35, 35, 35",activeRgb:"167, 59, 255",activeTextRgb:"240, 240, 240",textMainRgb:"240, 240, 240",textMutedRgb:"166, 166, 166",dangerRgb:"126, 126, 126",scrollbarTrackRgb:"20, 20, 20",scrollbarThumbRgb:"30, 30, 30",scrollbarThumbHoverRgb:"30, 50, 30"},layout:{modeColumnWidthPx:440,modeToggleWidthPx:188}},wc="ndc_normalizer_session_config_v1",jc="ndc_autoruns_layout_config_v1",Yf="ndc-autoruns-save",Pi=["Анализ запроса","Получение данных","Подготовка ответа"],Xf="assistant",Ri="normalizer_v2_0_2",kc="address_query_runtime_v1",Zf=["normalized","fragments","scope","flags","route","raw","validation","logs"];function ep(i){return`[${new Date().toLocaleTimeString("ru-RU")}] ${i}`}function tp(i,h){if(!h)return"Previous preset is not selected.";const O=["systemPrompt","developerPrompt","domainPrompt","schemaNotes","fewShotExamples"].filter(E=>i[E]!==h[E]).map(E=>`${E}: ${Math.abs(i[E].length-h[E].length)} chars delta`);return O.length===0?"No changes against previous preset.":`Changed fields: ${O.length}. ${O.join(" | ")}`}function np(){const[i,h]=S.useState(Jf),[p,O]=S.useState(Sc),[E,D]=S.useState(bf),[K,Z]=S.useState(null),[B,I]=S.useState([]),[q,T]=S.useState([]),[H,fe]=S.useState("normalized"),[ye,ne]=S.useState(!1),[X,G]=S.useState(!1),[se,Se]=S.useState([]),[Le,Oe]=S.useState(""),[$e,Ue]=S.useState([]),[Ge,Ze]=S.useState(""),[ft,Ct]=S.useState("NDC custom preset"),[rt,ie]=S.useState(null),[Be,Re]=S.useState(""),[xe,me]=S.useState(!1),[A,R]=S.useState([]),[L,g]=S.useState(""),[j,ee]=S.useState([]),[oe,le]=S.useState(!1),[ae,re]=S.useState(null),[he,ce]=S.useState(""),[ke,zt]=S.useState(Xf),[wn,cn]=S.useState(!0),[Nt,Jt]=S.useState(!0),[jn,bt]=S.useState(!0),[kn,Cn]=S.useState(!0),[Et,Dt]=S.useState(!0),[Yt,Fn]=S.useState(!0),[dn,Xt]=S.useState(!0),[fn,Nn]=S.useState(!0),[$t,Un]=S.useState(!0),[Ee,pn]=S.useState(!0),[Pt,cr]=S.useState(!0),[gt,de]=S.useState(!0),[We,mn]=S.useState(!0),[Rt,Zt]=S.useState(!0),[st,Ft]=S.useState(!0),[Je,Ve]=S.useState(""),[je,En]=S.useState([]),[dr,Pn]=S.useState(""),[hn,ge]=S.useState(!1),[en,Ut]=S.useState(""),[vt,Tt]=S.useState(""),Mt=S.useRef(!1),et=S.useRef(!1);S.useEffect(()=>{const x=document.documentElement,{colors:z}=Ei;x.style.setProperty("--rgb-background",z.backgroundRgb),x.style.setProperty("--rgb-surface-main",z.mainSurfaceRgb),x.style.setProperty("--rgb-surface-horizontal",z.horizontalSurfaceRgb),x.style.setProperty("--rgb-surface-focus",z.focusSurfaceRgb),x.style.setProperty("--rgb-active",z.activeRgb),x.style.setProperty("--rgb-active-text",z.activeTextRgb),x.style.setProperty("--rgb-text-main",z.textMainRgb),x.style.setProperty("--rgb-text-muted",z.textMutedRgb),x.style.setProperty("--rgb-danger",z.dangerRgb),x.style.setProperty("--rgb-scrollbar-track",z.scrollbarTrackRgb),x.style.setProperty("--rgb-scrollbar-thumb",z.scrollbarThumbRgb),x.style.setProperty("--rgb-scrollbar-thumb-hover",z.scrollbarThumbHoverRgb),x.style.setProperty("--mode-column-width",`${Ei.layout.modeColumnWidthPx}px`),x.style.setProperty("--mode-toggle-width",`${Ei.layout.modeToggleWidthPx}px`)},[]);const Y=x=>{T(z=>[ep(x),...z].slice(0,300))};function tn(){let x=0;Ut(Pi[0]);const z=window.setInterval(()=>{x=Math.min(x+1,Pi.length-1),Ut(Pi[x])},650);return()=>window.clearInterval(z)}S.useEffect(()=>{const x=localStorage.getItem(wc);if(x)try{const P=JSON.parse(x);h(pe=>({...pe,llmProvider:P.llmProvider==="local"?"local":"openai",model:P.model??pe.model,baseUrl:P.baseUrl??pe.baseUrl,temperature:P.temperature??pe.temperature,maxOutputTokens:P.maxOutputTokens??pe.maxOutputTokens}))}catch{}const z=localStorage.getItem(jc);if(z)try{const P=JSON.parse(z);(P.uiMode==="assistant"||P.uiMode==="decomposition"||P.uiMode==="autoruns")&&zt(P.uiMode),P.activeTab&&Zf.includes(P.activeTab)&&fe(P.activeTab),typeof P.showAutorunsAssistantMode=="boolean"&&cn(P.showAutorunsAssistantMode),typeof P.showAutorunsDecompositionMode=="boolean"&&Jt(P.showAutorunsDecompositionMode),typeof P.showAutorunsProgressMode=="boolean"&&bt(P.showAutorunsProgressMode),typeof P.showAutorunsCommentsMode=="boolean"&&Cn(P.showAutorunsCommentsMode),typeof P.showAssistantConnectionMode=="boolean"&&Dt(P.showAssistantConnectionMode),typeof P.showAssistantPromptMode=="boolean"&&Fn(P.showAssistantPromptMode),typeof P.showAssistantChatMode=="boolean"&&Xt(P.showAssistantChatMode),typeof P.showAssistantSamMode=="boolean"&&Nn(P.showAssistantSamMode),typeof P.showDecompositionConnectionMode=="boolean"&&Un(P.showDecompositionConnectionMode),typeof P.showDecompositionPromptMode=="boolean"&&pn(P.showDecompositionPromptMode),typeof P.showDecompositionQueryMode=="boolean"&&cr(P.showDecompositionQueryMode),typeof P.showDecompositionOutputMode=="boolean"&&de(P.showDecompositionOutputMode),typeof P.showDecompositionMetricsMode=="boolean"&&mn(P.showDecompositionMetricsMode),typeof P.showDecompositionHistoryMode=="boolean"&&Zt(P.showDecompositionHistoryMode),typeof P.showDecompositionRuntimeMode=="boolean"&&Ft(P.showDecompositionRuntimeMode),P.prompts&&(O(pe=>({...pe,...P.prompts})),et.current=!0)}catch{}pt(),gn(),ot()},[]);async function pt(){try{const x=await Ie.loadHistory();I(x.items??[])}catch(x){Y(`History load error: ${x instanceof Error?x.message:String(x)}`)}}async function gn(){try{const z=(await Ie.loadPresets()).presets??[];if(Ue(z),et.current){Mt.current=!0;return}if(Mt.current)return;const P=z.find(pe=>pe.prompt_version===Ri)??z.find(pe=>pe.id==="default-normalizer-v2_0_2");if(!P){Mt.current=!0,Y(`Preset autoload skipped: ${Ri} not found.`);return}Ze(P.id),ie(p),O({systemPrompt:P.systemPrompt,developerPrompt:P.developerPrompt,domainPrompt:P.domainPrompt,schemaNotes:P.schemaNotes??"",fewShotExamples:P.fewShotExamples??""}),Mt.current=!0,Y(`Preset autoloaded: ${P.name} (${P.prompt_version}).`)}catch(x){Y(`Presets load error: ${x instanceof Error?x.message:String(x)}`)}}async function ot(){try{const x=await Ie.listRuns();R(x.items??[])}catch(x){Y(`Runs load error: ${x instanceof Error?x.message:String(x)}`)}}function yt(){localStorage.setItem(wc,JSON.stringify({model:i.model,llmProvider:i.llmProvider,baseUrl:i.baseUrl,temperature:i.temperature,maxOutputTokens:i.maxOutputTokens})),Y("Local config saved (without API key).")}function Nr(){localStorage.setItem(jc,JSON.stringify({uiMode:ke,activeTab:H,showAutorunsAssistantMode:wn,showAutorunsDecompositionMode:Nt,showAutorunsProgressMode:jn,showAutorunsCommentsMode:kn,showAssistantConnectionMode:Et,showAssistantPromptMode:Yt,showAssistantChatMode:dn,showAssistantSamMode:fn,showDecompositionConnectionMode:$t,showDecompositionPromptMode:Ee,showDecompositionQueryMode:Pt,showDecompositionOutputMode:gt,showDecompositionMetricsMode:We,showDecompositionHistoryMode:Rt,showDecompositionRuntimeMode:st,prompts:p})),window.dispatchEvent(new CustomEvent(Yf)),Y("UI layout and prompts saved.")}async function fr(){ne(!0),ce("");try{const x=await Ie.testConnection(i);x.provider==="local"?x.model_found===!0?(Oe(`LOCAL OK - ${x.model}`),Y(`Local model is available: ${x.model} (catalog size=${x.models_count??"n/a"}).`)):x.model_found===!1?(Oe(`LOCAL OK, model not loaded - ${x.model}`),Y(`Local server is reachable, but model '${x.model}' is not in loaded catalog. Use 'Load model list' and select one of loaded models.`)):(Oe(`LOCAL OK (model list unavailable) - ${x.model}`),Y("Local server is reachable, but model catalog could not be verified.")):(Oe(`OPENAI OK - ${x.model}`),Y(`OpenAI connection ok: ${x.model}`))}catch(x){const z=x instanceof Error?x.message:String(x);Oe("Connection error"),ce(`Test connection: ${z}`),Y(`Test connection error: ${z}`)}finally{ne(!1)}}async function Rn(){G(!0);try{const z=(await Ie.listModels(i)).models??[];Se(z),z.length>0&&h(P=>P.model&&z.includes(P.model)?P:{...P,model:z[0]}),Y(`Model catalog loaded (${i.llmProvider}): ${z.length} items.`)}catch(x){const z=x instanceof Error?x.message:String(x);Y(`Load model list error: ${z}`)}finally{G(!1)}}S.useEffect(()=>{Se([])},[i.llmProvider,i.baseUrl]);async function Er(x){ne(!0),ce("");try{const z=await Ie.normalize({connection:i,prompts:p,promptVersion:"normalizer_v2_0_2",query:{userQuestion:E.userQuestion,periodHint:E.periodHint,businessContext:E.businessContext,expectedRoute:E.expectedRoute},saveAsTestCase:x,useMock:xe});Z(z),fe("normalized"),Y(`Normalize done: trace=${z.trace_id}, validation=${z.validation.passed?"passed":"failed"}`),pt()}catch(z){const P=z instanceof Error?z.message:String(z);ce(`Normalize: ${P}`),Y(`Normalize error: ${P}`)}finally{ne(!1)}}function Bn(){const x=$e.find(z=>z.id===Ge);if(!x){Y("Preset is not selected.");return}ie(p),O({systemPrompt:x.systemPrompt,developerPrompt:x.developerPrompt,domainPrompt:x.domainPrompt,schemaNotes:x.schemaNotes??"",fewShotExamples:x.fewShotExamples??""}),Y(`Preset loaded: ${x.name}`)}async function Hn(){try{await Ie.savePreset({name:ft||"NDC preset",prompt_version:"normalizer_v2_0_2",systemPrompt:p.systemPrompt,developerPrompt:p.developerPrompt,domainPrompt:p.domainPrompt,schemaNotes:p.schemaNotes,fewShotExamples:p.fewShotExamples}),Y("Preset saved."),await gn()}catch(x){Y(`Preset save error: ${x instanceof Error?x.message:String(x)}`)}}function Vn(){O(Sc),Y("Prompt panel reset to defaults.")}function pr(){const x=tp(p,rt);Re(x),Y(x)}function u(){const x=E.batchQuestionsRaw.split(";").map(z=>z.trim()).filter(Boolean).join(` `);x&&(D(z=>({...z,batchQuestionsRaw:x})),Y("Batch field formatted: `;` converted to blank-line separators."))}async function f(x){try{const P=(await Ie.loadTrace(x)).trace,pe=P.parsed_normalized_json??null;Z({trace_id:String(P.trace_id??x),ok:!!P.validation_result?.passed,normalized:pe,route_hint_summary:P.route_hint_summary??(pe?{route_hint:pe.route_hint??null,confidence:pe.confidence?.route_hint??null}:null),raw_model_output:P.raw_model_response??{},validation:P.validation_result??{passed:!1,errors:["validation not found"]},usage:P.usage??{input_tokens:0,output_tokens:0,total_tokens:0},latency_ms:Number(P.latency_ms??0),prompt_version:String(P.prompt_version??"unknown"),schema_version:String(P.schema_version??"unknown")}),fe("raw"),ce(""),Y(`Trace opened: ${x}`)}catch(z){const P=z instanceof Error?z.message:String(z);ce(`Trace: ${P}`),Y(`Trace open error ${x}: ${P}`)}}async function w(){try{const x=await Ie.startRun();g(x.run.runId),Y(`Run started: ${x.run.runId}`),Y("Tip: start run does not execute normalize by itself. Use 'Run eval v2.0.2' button."),await ot()}catch(x){Y(`Run start error: ${x instanceof Error?x.message:String(x)}`)}}async function F(){if(L)try{await Ie.finishRun(L),Y(`Run finished: ${L}`),await ot()}catch(x){Y(`Run finish error: ${x instanceof Error?x.message:String(x)}`)}}async function ve(){le(!0),ce("");try{Y("Starting eval in v2 contour.");const x=E.batchQuestionsRaw.trim()||E.userQuestion.trim();if(!x)throw new Error("Fill batch field or Raw user question first.");const z=await Ie.runEval({connection:i,prompts:p,promptVersion:"normalizer_v2_0_2",mode:"single-pass-strict",rawQuestions:x,useMock:xe});re(z.report),Y("Eval v2.0.2 run finished.");const P=z.report;if(P.run_id&&Y(`Eval run id: ${P.run_id}`),P.metrics){const pe=P.metrics;Y(`Eval metrics v2.0.2: schema=${pe.schema_validation_pass_rate??"n/a"}%, route_accuracy=${pe.route_resolution_accuracy??"n/a"}%, no_route_precision=${pe.no_route_precision??"n/a"}%, state_consistency=${pe.execution_state_consistency_rate??"n/a"}%`)}await pt()}catch(x){const z=x instanceof Error?x.message:String(x);z.includes("Legacy eval runner supports normalized_query_v1 only")?(re({status:"plan_only",prompt_version:"normalizer_v2",reason:"backend eval runner is still legacy-v1 only",plan_file:"reports/v2_pilot_eval_plan.md",next_steps:["run cheap mock sanity for schema/fragment/scope","run small real batch (10-15 messages, temperature=0)","run challenge-30 replay with v2 metrics"]}),Y("Backend is legacy-only for eval right now. Showing v2 pilot plan.")):(ce(`Eval: ${z}`),Y(`Eval run error: ${z}`))}finally{le(!1)}}async function Bt(){try{const x=JSON.stringify(ae??{},null,2);await navigator.clipboard.writeText(x),Y("Eval report copied to clipboard.")}catch(x){Y(`Eval report copy error: ${x instanceof Error?x.message:String(x)}`)}}function Ht(){Ve(""),En([]),Pn(""),Ut(""),Tt(""),Y("Assistant session reset.")}async function nn(){const x=dr.trim();if(!x)return;ge(!0),Tt(""),Pn(""),En(P=>[...P,{message_id:`local-${Date.now()}`,session_id:Je||"pending",role:"user",text:x,reply_type:null,created_at:new Date().toISOString(),trace_id:null,debug:null}]);const z=tn();try{const P=await Ie.sendAssistantMessage({connection:i,prompts:p,userMessage:x,sessionId:Je||void 0,promptVersion:kc,useMock:xe});Ve(P.session_id),En(P.conversation),Ut("Ответ готов"),Y(`Assistant reply received: trace=${P.debug.trace_id}`)}catch(P){const pe=P instanceof Error?P.message:String(P);Tt(pe),Ut("Ошибка ассистента"),Y(`Assistant error: ${pe}`)}finally{z(),ge(!1)}}return S.useEffect(()=>{if(!L){ee([]);return}Ie.runTrace(L).then(x=>ee(x.items)).catch(x=>Y(`Run trace error: ${x instanceof Error?x.message:String(x)}`))},[L]),o.jsxs("main",{className:`app-root ${ke==="assistant"||ke==="decomposition"||ke==="autoruns"?"app-root-autoruns":""}`,children:[o.jsxs("header",{className:"app-topbar",children:[o.jsxs("div",{className:"mode-switch-row",children:[o.jsx("button",{type:"button",className:ke==="assistant"?"tab active":"tab",onClick:()=>zt("assistant"),children:"Ассистент"}),o.jsx("button",{type:"button",className:ke==="decomposition"?"tab active":"tab",onClick:()=>zt("decomposition"),children:"Декомпозиция"}),o.jsx("button",{type:"button",className:ke==="autoruns"?"tab active":"tab",onClick:()=>zt("autoruns"),children:"История автопрогонов"}),o.jsx("button",{type:"button",className:"tab",onClick:Nr,children:"Сохранить"})]}),ke==="assistant"?o.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[o.jsx("button",{type:"button",className:Et?"tab active":"tab",onClick:()=>Dt(x=>!x),children:"LLM Connector"}),o.jsx("button",{type:"button",className:Yt?"tab active":"tab",onClick:()=>Fn(x=>!x),children:"Prompt Manager"}),o.jsx("button",{type:"button",className:dn?"tab active":"tab",onClick:()=>Xt(x=>!x),children:"Режим ассистента"}),o.jsx("button",{type:"button",className:fn?"tab active":"tab",onClick:()=>Nn(x=>!x),children:"SAM"})]}):ke==="decomposition"?o.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[o.jsx("button",{type:"button",className:$t?"tab active":"tab",onClick:()=>Un(x=>!x),children:"LLM"}),o.jsx("button",{type:"button",className:Ee?"tab active":"tab",onClick:()=>pn(x=>!x),children:"Prompt"}),o.jsx("button",{type:"button",className:Pt?"tab active":"tab",onClick:()=>cr(x=>!x),children:"Запрос"}),o.jsx("button",{type:"button",className:gt?"tab active":"tab",onClick:()=>de(x=>!x),children:"Выход"}),o.jsx("button",{type:"button",className:We?"tab active":"tab",onClick:()=>mn(x=>!x),children:"Метрики"}),o.jsx("button",{type:"button",className:Rt?"tab active":"tab",onClick:()=>Zt(x=>!x),children:"История"}),o.jsx("button",{type:"button",className:st?"tab active":"tab",onClick:()=>Ft(x=>!x),children:"NDC Run Monitor"})]}):ke==="autoruns"?o.jsxs("div",{className:"mode-switch-row mode-switch-row-right",children:[o.jsx("button",{type:"button",className:wn?"tab active":"tab",onClick:()=>cn(x=>!x),children:"Режим ассистента"}),o.jsx("button",{type:"button",className:Nt?"tab active":"tab",onClick:()=>Jt(x=>!x),children:"Режим декомпозиции"}),o.jsx("button",{type:"button",className:jn?"tab active":"tab",onClick:()=>bt(x=>!x),children:"Прогресс/регресс"}),o.jsx("button",{type:"button",className:kn?"tab active":"tab",onClick:()=>Cn(x=>!x),children:"Комментарии"})]}):null]}),ke==="assistant"?o.jsx("div",{className:"layout-grid layout-grid-mode-columns",children:o.jsxs("div",{className:"mode-columns",children:[Et?o.jsx("div",{className:"mode-col",children:o.jsx(xc,{value:i,modelOptions:se,modelsBusy:X,onChange:h,onReloadModels:Rn,onSaveLocalConfig:yt,onTestConnection:fr,lastStatus:Le,busy:ye||hn})}):null,Yt?o.jsx("div",{className:"mode-col mode-col-wide",children:o.jsx(_c,{value:p,onChange:O,presets:$e,selectedPresetId:Ge,onSelectPreset:Ze,onLoadPreset:Bn,onSavePreset:Hn,onResetDefaults:Vn,onDiffPrevious:pr,presetName:ft,onPresetNameChange:Ct,diffSummary:Be})}):null,dn?o.jsx("div",{className:"mode-col mode-col-xwide",children:o.jsx(Bf,{sessionId:Je,conversation:je,inputValue:dr,onInputChange:Pn,useMock:xe,onUseMockChange:me,onSend:nn,onClear:Ht,busy:hn,statusText:en,errorMessage:vt})}):null,fn?o.jsx("div",{className:"mode-col",children:o.jsx(Cf,{sessionId:Je,conversation:je,statusText:en,errorMessage:vt,useMock:xe,appLogs:q})}):null,!Et&&!Yt&&!dn&&!fn?o.jsx("div",{className:"mode-columns-empty",children:"Все панели режима ассистента скрыты. Включите нужные блоки справа в шапке."}):null]})}):ke==="decomposition"?o.jsx("div",{className:"layout-grid layout-grid-mode-columns",children:o.jsxs("div",{className:"mode-columns",children:[$t?o.jsx("div",{className:"mode-col",children:o.jsx(xc,{value:i,modelOptions:se,modelsBusy:X,onChange:h,onReloadModels:Rn,onSaveLocalConfig:yt,onTestConnection:fr,lastStatus:Le,busy:ye})}):null,Ee?o.jsx("div",{className:"mode-col mode-col-wide",children:o.jsx(_c,{value:p,onChange:O,presets:$e,selectedPresetId:Ge,onSelectPreset:Ze,onLoadPreset:Bn,onSavePreset:Hn,onResetDefaults:Vn,onDiffPrevious:pr,presetName:ft,onPresetNameChange:Ct,diffSummary:Be})}):null,Pt?o.jsx("div",{className:"mode-col",children:o.jsx(qf,{value:E,onChange:D,onApplyBatchFormat:u,onNormalize:Er,busy:ye,useMock:xe,onUseMockChange:me,errorMessage:he})}):null,gt?o.jsx("div",{className:"mode-col mode-col-xwide",children:o.jsx(Kf,{tab:H,onTabChange:fe,result:K,appLogs:q})}):null,We?o.jsx("div",{className:"mode-col",children:o.jsx(Vf,{result:K})}):null,Rt?o.jsx("div",{className:"mode-col",children:o.jsx(Hf,{items:B,onRefresh:pt,onOpenTrace:f})}):null,st?o.jsx("div",{className:"mode-col mode-col-xwide",children:o.jsx(Gf,{runs:A,selectedRunId:L,onSelectRun:g,onStartRun:w,onFinishRun:F,onRefreshRuns:ot,onRunEval:ve,onCopyEvalReport:Bt,evalBusy:oe,traceItems:j,evalReport:ae})}):null,!$t&&!Ee&&!Pt&&!gt&&!We&&!Rt&&!st?o.jsx("div",{className:"mode-columns-empty",children:"Все панели режима декомпозиции скрыты. Включите нужные блоки справа в шапке."}):null]})}):o.jsx("div",{className:"layout-grid layout-grid-autoruns",children:o.jsx(If,{connection:i,prompts:p,assistantPromptVersion:kc,decompositionPromptVersion:Ri,showAssistantMode:wn,showDecompositionMode:Nt,showProgressMode:jn,showCommentsMode:kn,onLog:Y})})]})}wf.createRoot(document.getElementById("root")).render(o.jsx(hf.StrictMode,{children:o.jsx(np,{})}));