@mmmbuto/nexuscrew 0.8.10 → 0.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@
37
37
  `+f[C].replace(" at new "," at ");return i.displayName&&H.includes("<anonymous>")&&(H=H.replace("<anonymous>",i.displayName)),H}while(1<=C&&0<=T);break}}}finally{L=!1,Error.prepareStackTrace=a}return(i=i?i.displayName||i.name:"")?J(i):""}function X(i){switch(i.tag){case 5:return J(i.type);case 16:return J("Lazy");case 13:return J("Suspense");case 19:return J("SuspenseList");case 0:case 2:case 15:return i=x(i.type,!1),i;case 11:return i=x(i.type.render,!1),i;case 1:return i=x(i.type,!0),i;default:return""}}function re(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case I:return"Fragment";case A:return"Portal";case U:return"Profiler";case V:return"StrictMode";case D:return"Suspense";case j:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case ee:return(i.displayName||"Context")+".Consumer";case ie:return(i._context.displayName||"Context")+".Provider";case k:var n=i.render;return i=i.displayName,i||(i=n.displayName||n.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Y:return n=i.displayName||null,n!==null?n:re(i.type)||"Memo";case F:n=i._payload,i=i._init;try{return re(i(n))}catch{}}return null}function se(i){var n=i.type;switch(i.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=n.render,i=i.displayName||i.name||"",n.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return re(n);case 8:return n===V?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function ae(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function de(i){var n=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function ve(i){var n=de(i)?"checked":"value",a=Object.getOwnPropertyDescriptor(i.constructor.prototype,n),c=""+i[n];if(!i.hasOwnProperty(n)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,g=a.set;return Object.defineProperty(i,n,{configurable:!0,get:function(){return f.call(this)},set:function(C){c=""+C,g.call(this,C)}}),Object.defineProperty(i,n,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){i._valueTracker=null,delete i[n]}}}}function Oe(i){i._valueTracker||(i._valueTracker=ve(i))}function oe(i){if(!i)return!1;var n=i._valueTracker;if(!n)return!0;var a=n.getValue(),c="";return i&&(c=de(i)?i.checked?"true":"false":i.value),i=c,i!==a?(n.setValue(i),!0):!1}function pe(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function De(i,n){var a=n.checked;return G({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??i._wrapperState.initialChecked})}function Xe(i,n){var a=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;a=ae(n.value!=null?n.value:a),i._wrapperState={initialChecked:c,initialValue:a,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function ot(i,n){n=n.checked,n!=null&&z(i,"checked",n,!1)}function zt(i,n){ot(i,n);var a=ae(n.value),c=n.type;if(a!=null)c==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+a):i.value!==""+a&&(i.value=""+a);else if(c==="submit"||c==="reset"){i.removeAttribute("value");return}n.hasOwnProperty("value")?ht(i,n.type,a):n.hasOwnProperty("defaultValue")&&ht(i,n.type,ae(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(i.defaultChecked=!!n.defaultChecked)}function at(i,n,a){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+i._wrapperState.initialValue,a||n===i.value||(i.value=n),i.defaultValue=n}a=i.name,a!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,a!==""&&(i.name=a)}function ht(i,n,a){(n!=="number"||pe(i.ownerDocument)!==i)&&(a==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+a&&(i.defaultValue=""+a))}var Ge=Array.isArray;function ki(i,n,a,c){if(i=i.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<i.length;a++)f=n.hasOwnProperty("$"+i[a].value),i[a].selected!==f&&(i[a].selected=f),f&&c&&(i[a].defaultSelected=!0)}else{for(a=""+ae(a),n=null,f=0;f<i.length;f++){if(i[f].value===a){i[f].selected=!0,c&&(i[f].defaultSelected=!0);return}n!==null||i[f].disabled||(n=i[f])}n!==null&&(n.selected=!0)}}function ei(i,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return G({},n,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function jr(i,n){var a=n.value;if(a==null){if(a=n.children,n=n.defaultValue,a!=null){if(n!=null)throw Error(r(92));if(Ge(a)){if(1<a.length)throw Error(r(93));a=a[0]}n=a}n==null&&(n=""),a=n}i._wrapperState={initialValue:ae(a)}}function Br(i,n){var a=ae(n.value),c=ae(n.defaultValue);a!=null&&(a=""+a,a!==i.value&&(i.value=a),n.defaultValue==null&&i.defaultValue!==a&&(i.defaultValue=a)),c!=null&&(i.defaultValue=""+c)}function Ir(i){var n=i.textContent;n===i._wrapperState.initialValue&&n!==""&&n!==null&&(i.value=n)}function Ar(i){switch(i){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ft(i,n){return i==null||i==="http://www.w3.org/1999/xhtml"?Ar(n):i==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var ti,Yi=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,a,c,f){MSApp.execUnsafeLocalFunction(function(){return i(n,a,c,f)})}:i})(function(i,n){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=n;else{for(ti=ti||document.createElement("div"),ti.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=ti.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;n.firstChild;)i.appendChild(n.firstChild)}});function ii(i,n){if(n){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=n;return}}i.textContent=n}var me={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},Ie=["Webkit","ms","Moz","O"];Object.keys(me).forEach(function(i){Ie.forEach(function(n){n=n+i.charAt(0).toUpperCase()+i.substring(1),me[n]=me[i]})});function $e(i,n,a){return n==null||typeof n=="boolean"||n===""?"":a||typeof n!="number"||n===0||me.hasOwnProperty(i)&&me[i]?(""+n).trim():n+"px"}function le(i,n){i=i.style;for(var a in n)if(n.hasOwnProperty(a)){var c=a.indexOf("--")===0,f=$e(a,n[a],c);a==="float"&&(a="cssFloat"),c?i.setProperty(a,f):i[a]=f}}var xe=G({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 Le(i,n){if(n){if(xe[i]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,i));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Pt(i,n){if(i.indexOf("-")===-1)return typeof n.is=="string";switch(i){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 ri=null;function Va(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Ya=null,hn=null,dn=null;function Vh(i){if(i=ps(i)){if(typeof Ya!="function")throw Error(r(280));var n=i.stateNode;n&&(n=xo(n),Ya(i.stateNode,i.type,n))}}function Yh(i){hn?dn?dn.push(i):dn=[i]:hn=i}function Xh(){if(hn){var i=hn,n=dn;if(dn=hn=null,Vh(i),n)for(i=0;i<n.length;i++)Vh(n[i])}}function Gh(i,n){return i(n)}function Qh(){}var Xa=!1;function Jh(i,n,a){if(Xa)return i(n,a);Xa=!0;try{return Gh(i,n,a)}finally{Xa=!1,(hn!==null||dn!==null)&&(Qh(),Xh())}}function Vn(i,n){var a=i.stateNode;if(a===null)return null;var c=xo(a);if(c===null)return null;a=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Ga=!1;if(d)try{var Yn={};Object.defineProperty(Yn,"passive",{get:function(){Ga=!0}}),window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch{Ga=!1}function Tv(i,n,a,c,f,g,C,T,H){var ne=Array.prototype.slice.call(arguments,3);try{n.apply(a,ne)}catch(he){this.onError(he)}}var Xn=!1,to=null,io=!1,Qa=null,jv={onError:function(i){Xn=!0,to=i}};function Bv(i,n,a,c,f,g,C,T,H){Xn=!1,to=null,Tv.apply(jv,arguments)}function Iv(i,n,a,c,f,g,C,T,H){if(Bv.apply(this,arguments),Xn){if(Xn){var ne=to;Xn=!1,to=null}else throw Error(r(198));io||(io=!0,Qa=ne)}}function Or(i){var n=i,a=i;if(i.alternate)for(;n.return;)n=n.return;else{i=n;do n=i,(n.flags&4098)!==0&&(a=n.return),i=n.return;while(i)}return n.tag===3?a:null}function Zh(i){if(i.tag===13){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function ed(i){if(Or(i)!==i)throw Error(r(188))}function Av(i){var n=i.alternate;if(!n){if(n=Or(i),n===null)throw Error(r(188));return n!==i?null:i}for(var a=i,c=n;;){var f=a.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){a=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===a)return ed(f),i;if(g===c)return ed(f),n;g=g.sibling}throw Error(r(188))}if(a.return!==c.return)a=f,c=g;else{for(var C=!1,T=f.child;T;){if(T===a){C=!0,a=f,c=g;break}if(T===c){C=!0,c=f,a=g;break}T=T.sibling}if(!C){for(T=g.child;T;){if(T===a){C=!0,a=g,c=f;break}if(T===c){C=!0,c=g,a=f;break}T=T.sibling}if(!C)throw Error(r(189))}}if(a.alternate!==c)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:n}function td(i){return i=Av(i),i!==null?id(i):null}function id(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var n=id(i);if(n!==null)return n;i=i.sibling}return null}var rd=t.unstable_scheduleCallback,nd=t.unstable_cancelCallback,Ov=t.unstable_shouldYield,zv=t.unstable_requestPaint,lt=t.unstable_now,Fv=t.unstable_getCurrentPriorityLevel,Ja=t.unstable_ImmediatePriority,sd=t.unstable_UserBlockingPriority,ro=t.unstable_NormalPriority,Hv=t.unstable_LowPriority,od=t.unstable_IdlePriority,no=null,Bi=null;function $v(i){if(Bi&&typeof Bi.onCommitFiberRoot=="function")try{Bi.onCommitFiberRoot(no,i,void 0,(i.current.flags&128)===128)}catch{}}var Ei=Math.clz32?Math.clz32:qv,Wv=Math.log,Uv=Math.LN2;function qv(i){return i>>>=0,i===0?32:31-(Wv(i)/Uv|0)|0}var so=64,oo=4194304;function Gn(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function ao(i,n){var a=i.pendingLanes;if(a===0)return 0;var c=0,f=i.suspendedLanes,g=i.pingedLanes,C=a&268435455;if(C!==0){var T=C&~f;T!==0?c=Gn(T):(g&=C,g!==0&&(c=Gn(g)))}else C=a&~f,C!==0?c=Gn(C):g!==0&&(c=Gn(g));if(c===0)return 0;if(n!==0&&n!==c&&(n&f)===0&&(f=c&-c,g=n&-n,f>=g||f===16&&(g&4194240)!==0))return n;if((c&4)!==0&&(c|=a&16),n=i.entangledLanes,n!==0)for(i=i.entanglements,n&=c;0<n;)a=31-Ei(n),f=1<<a,c|=i[a],n&=~f;return c}function Kv(i,n){switch(i){case 1:case 2:case 4:return n+250;case 8:case 16:case 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 n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vv(i,n){for(var a=i.suspendedLanes,c=i.pingedLanes,f=i.expirationTimes,g=i.pendingLanes;0<g;){var C=31-Ei(g),T=1<<C,H=f[C];H===-1?((T&a)===0||(T&c)!==0)&&(f[C]=Kv(T,n)):H<=n&&(i.expiredLanes|=T),g&=~T}}function Za(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function ad(){var i=so;return so<<=1,(so&4194240)===0&&(so=64),i}function el(i){for(var n=[],a=0;31>a;a++)n.push(i);return n}function Qn(i,n,a){i.pendingLanes|=n,n!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,n=31-Ei(n),i[n]=a}function Yv(i,n){var a=i.pendingLanes&~n;i.pendingLanes=n,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=n,i.mutableReadLanes&=n,i.entangledLanes&=n,n=i.entanglements;var c=i.eventTimes;for(i=i.expirationTimes;0<a;){var f=31-Ei(a),g=1<<f;n[f]=0,c[f]=-1,i[f]=-1,a&=~g}}function tl(i,n){var a=i.entangledLanes|=n;for(i=i.entanglements;a;){var c=31-Ei(a),f=1<<c;f&n|i[c]&n&&(i[c]|=n),a&=~f}}var We=0;function ld(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var cd,il,ud,hd,dd,rl=!1,lo=[],ar=null,lr=null,cr=null,Jn=new Map,Zn=new Map,ur=[],Xv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function fd(i,n){switch(i){case"focusin":case"focusout":ar=null;break;case"dragenter":case"dragleave":lr=null;break;case"mouseover":case"mouseout":cr=null;break;case"pointerover":case"pointerout":Jn.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zn.delete(n.pointerId)}}function es(i,n,a,c,f,g){return i===null||i.nativeEvent!==g?(i={blockedOn:n,domEventName:a,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},n!==null&&(n=ps(n),n!==null&&il(n)),i):(i.eventSystemFlags|=c,n=i.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),i)}function Gv(i,n,a,c,f){switch(n){case"focusin":return ar=es(ar,i,n,a,c,f),!0;case"dragenter":return lr=es(lr,i,n,a,c,f),!0;case"mouseover":return cr=es(cr,i,n,a,c,f),!0;case"pointerover":var g=f.pointerId;return Jn.set(g,es(Jn.get(g)||null,i,n,a,c,f)),!0;case"gotpointercapture":return g=f.pointerId,Zn.set(g,es(Zn.get(g)||null,i,n,a,c,f)),!0}return!1}function pd(i){var n=zr(i.target);if(n!==null){var a=Or(n);if(a!==null){if(n=a.tag,n===13){if(n=Zh(a),n!==null){i.blockedOn=n,dd(i.priority,function(){ud(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function co(i){if(i.blockedOn!==null)return!1;for(var n=i.targetContainers;0<n.length;){var a=sl(i.domEventName,i.eventSystemFlags,n[0],i.nativeEvent);if(a===null){a=i.nativeEvent;var c=new a.constructor(a.type,a);ri=c,a.target.dispatchEvent(c),ri=null}else return n=ps(a),n!==null&&il(n),i.blockedOn=a,!1;n.shift()}return!0}function md(i,n,a){co(i)&&a.delete(n)}function Qv(){rl=!1,ar!==null&&co(ar)&&(ar=null),lr!==null&&co(lr)&&(lr=null),cr!==null&&co(cr)&&(cr=null),Jn.forEach(md),Zn.forEach(md)}function ts(i,n){i.blockedOn===n&&(i.blockedOn=null,rl||(rl=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Qv)))}function is(i){function n(f){return ts(f,i)}if(0<lo.length){ts(lo[0],i);for(var a=1;a<lo.length;a++){var c=lo[a];c.blockedOn===i&&(c.blockedOn=null)}}for(ar!==null&&ts(ar,i),lr!==null&&ts(lr,i),cr!==null&&ts(cr,i),Jn.forEach(n),Zn.forEach(n),a=0;a<ur.length;a++)c=ur[a],c.blockedOn===i&&(c.blockedOn=null);for(;0<ur.length&&(a=ur[0],a.blockedOn===null);)pd(a),a.blockedOn===null&&ur.shift()}var fn=B.ReactCurrentBatchConfig,uo=!0;function Jv(i,n,a,c){var f=We,g=fn.transition;fn.transition=null;try{We=1,nl(i,n,a,c)}finally{We=f,fn.transition=g}}function Zv(i,n,a,c){var f=We,g=fn.transition;fn.transition=null;try{We=4,nl(i,n,a,c)}finally{We=f,fn.transition=g}}function nl(i,n,a,c){if(uo){var f=sl(i,n,a,c);if(f===null)bl(i,n,c,ho,a),fd(i,c);else if(Gv(f,i,n,a,c))c.stopPropagation();else if(fd(i,c),n&4&&-1<Xv.indexOf(i)){for(;f!==null;){var g=ps(f);if(g!==null&&cd(g),g=sl(i,n,a,c),g===null&&bl(i,n,c,ho,a),g===f)break;f=g}f!==null&&c.stopPropagation()}else bl(i,n,c,null,a)}}var ho=null;function sl(i,n,a,c){if(ho=null,i=Va(c),i=zr(i),i!==null)if(n=Or(i),n===null)i=null;else if(a=n.tag,a===13){if(i=Zh(n),i!==null)return i;i=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;i=null}else n!==i&&(i=null);return ho=i,null}function gd(i){switch(i){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Fv()){case Ja:return 1;case sd:return 4;case ro:case Hv:return 16;case od:return 536870912;default:return 16}default:return 16}}var hr=null,ol=null,fo=null;function _d(){if(fo)return fo;var i,n=ol,a=n.length,c,f="value"in hr?hr.value:hr.textContent,g=f.length;for(i=0;i<a&&n[i]===f[i];i++);var C=a-i;for(c=1;c<=C&&n[a-c]===f[g-c];c++);return fo=f.slice(i,1<c?1-c:void 0)}function po(i){var n=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&n===13&&(i=13)):i=n,i===10&&(i=13),32<=i||i===13?i:0}function mo(){return!0}function vd(){return!1}function ni(i){function n(a,c,f,g,C){this._reactName=a,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=C,this.currentTarget=null;for(var T in i)i.hasOwnProperty(T)&&(a=i[T],this[T]=a?a(g):g[T]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?mo:vd,this.isPropagationStopped=vd,this}return G(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=mo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=mo)},persist:function(){},isPersistent:mo}),n}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},al=ni(pn),rs=G({},pn,{view:0,detail:0}),ey=ni(rs),ll,cl,ns,go=G({},rs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hl,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==ns&&(ns&&i.type==="mousemove"?(ll=i.screenX-ns.screenX,cl=i.screenY-ns.screenY):cl=ll=0,ns=i),ll)},movementY:function(i){return"movementY"in i?i.movementY:cl}}),yd=ni(go),ty=G({},go,{dataTransfer:0}),iy=ni(ty),ry=G({},rs,{relatedTarget:0}),ul=ni(ry),ny=G({},pn,{animationName:0,elapsedTime:0,pseudoElement:0}),sy=ni(ny),oy=G({},pn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),ay=ni(oy),ly=G({},pn,{data:0}),Sd=ni(ly),cy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uy={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},hy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dy(i){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(i):(i=hy[i])?!!n[i]:!1}function hl(){return dy}var fy=G({},rs,{key:function(i){if(i.key){var n=cy[i.key]||i.key;if(n!=="Unidentified")return n}return i.type==="keypress"?(i=po(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?uy[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hl,charCode:function(i){return i.type==="keypress"?po(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?po(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),py=ni(fy),my=G({},go,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wd=ni(my),gy=G({},rs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hl}),_y=ni(gy),vy=G({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0}),yy=ni(vy),Sy=G({},go,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),wy=ni(Sy),by=[9,13,27,32],dl=d&&"CompositionEvent"in window,ss=null;d&&"documentMode"in document&&(ss=document.documentMode);var Cy=d&&"TextEvent"in window&&!ss,bd=d&&(!dl||ss&&8<ss&&11>=ss),Cd=" ",xd=!1;function kd(i,n){switch(i){case"keyup":return by.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ed(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var mn=!1;function xy(i,n){switch(i){case"compositionend":return Ed(n);case"keypress":return n.which!==32?null:(xd=!0,Cd);case"textInput":return i=n.data,i===Cd&&xd?null:i;default:return null}}function ky(i,n){if(mn)return i==="compositionend"||!dl&&kd(i,n)?(i=_d(),fo=ol=hr=null,mn=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return bd&&n.locale!=="ko"?null:n.data;default:return null}}var Ey={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Nd(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n==="input"?!!Ey[i.type]:n==="textarea"}function Rd(i,n,a,c){Yh(c),n=wo(n,"onChange"),0<n.length&&(a=new al("onChange","change",null,a,c),i.push({event:a,listeners:n}))}var os=null,as=null;function Ny(i){Kd(i,0)}function _o(i){var n=Sn(i);if(oe(n))return i}function Ry(i,n){if(i==="change")return n}var Pd=!1;if(d){var fl;if(d){var pl="oninput"in document;if(!pl){var Dd=document.createElement("div");Dd.setAttribute("oninput","return;"),pl=typeof Dd.oninput=="function"}fl=pl}else fl=!1;Pd=fl&&(!document.documentMode||9<document.documentMode)}function Ld(){os&&(os.detachEvent("onpropertychange",Md),as=os=null)}function Md(i){if(i.propertyName==="value"&&_o(as)){var n=[];Rd(n,as,i,Va(i)),Jh(Ny,n)}}function Py(i,n,a){i==="focusin"?(Ld(),os=n,as=a,os.attachEvent("onpropertychange",Md)):i==="focusout"&&Ld()}function Dy(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return _o(as)}function Ly(i,n){if(i==="click")return _o(n)}function My(i,n){if(i==="input"||i==="change")return _o(n)}function Ty(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var Ni=typeof Object.is=="function"?Object.is:Ty;function ls(i,n){if(Ni(i,n))return!0;if(typeof i!="object"||i===null||typeof n!="object"||n===null)return!1;var a=Object.keys(i),c=Object.keys(n);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var f=a[c];if(!p.call(n,f)||!Ni(i[f],n[f]))return!1}return!0}function Td(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function jd(i,n){var a=Td(i);i=0;for(var c;a;){if(a.nodeType===3){if(c=i+a.textContent.length,i<=n&&c>=n)return{node:a,offset:n-i};i=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Td(a)}}function Bd(i,n){return i&&n?i===n?!0:i&&i.nodeType===3?!1:n&&n.nodeType===3?Bd(i,n.parentNode):"contains"in i?i.contains(n):i.compareDocumentPosition?!!(i.compareDocumentPosition(n)&16):!1:!1}function Id(){for(var i=window,n=pe();n instanceof i.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)i=n.contentWindow;else break;n=pe(i.document)}return n}function ml(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n&&(n==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||n==="textarea"||i.contentEditable==="true")}function jy(i){var n=Id(),a=i.focusedElem,c=i.selectionRange;if(n!==a&&a&&a.ownerDocument&&Bd(a.ownerDocument.documentElement,a)){if(c!==null&&ml(a)){if(n=c.start,i=c.end,i===void 0&&(i=n),"selectionStart"in a)a.selectionStart=n,a.selectionEnd=Math.min(i,a.value.length);else if(i=(n=a.ownerDocument||document)&&n.defaultView||window,i.getSelection){i=i.getSelection();var f=a.textContent.length,g=Math.min(c.start,f);c=c.end===void 0?g:Math.min(c.end,f),!i.extend&&g>c&&(f=c,c=g,g=f),f=jd(a,g);var C=jd(a,c);f&&C&&(i.rangeCount!==1||i.anchorNode!==f.node||i.anchorOffset!==f.offset||i.focusNode!==C.node||i.focusOffset!==C.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),i.removeAllRanges(),g>c?(i.addRange(n),i.extend(C.node,C.offset)):(n.setEnd(C.node,C.offset),i.addRange(n)))}}for(n=[],i=a;i=i.parentNode;)i.nodeType===1&&n.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<n.length;a++)i=n[a],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var By=d&&"documentMode"in document&&11>=document.documentMode,gn=null,gl=null,cs=null,_l=!1;function Ad(i,n,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;_l||gn==null||gn!==pe(c)||(c=gn,"selectionStart"in c&&ml(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),cs&&ls(cs,c)||(cs=c,c=wo(gl,"onSelect"),0<c.length&&(n=new al("onSelect","select",null,n,a),i.push({event:n,listeners:c}),n.target=gn)))}function vo(i,n){var a={};return a[i.toLowerCase()]=n.toLowerCase(),a["Webkit"+i]="webkit"+n,a["Moz"+i]="moz"+n,a}var _n={animationend:vo("Animation","AnimationEnd"),animationiteration:vo("Animation","AnimationIteration"),animationstart:vo("Animation","AnimationStart"),transitionend:vo("Transition","TransitionEnd")},vl={},Od={};d&&(Od=document.createElement("div").style,"AnimationEvent"in window||(delete _n.animationend.animation,delete _n.animationiteration.animation,delete _n.animationstart.animation),"TransitionEvent"in window||delete _n.transitionend.transition);function yo(i){if(vl[i])return vl[i];if(!_n[i])return i;var n=_n[i],a;for(a in n)if(n.hasOwnProperty(a)&&a in Od)return vl[i]=n[a];return i}var zd=yo("animationend"),Fd=yo("animationiteration"),Hd=yo("animationstart"),$d=yo("transitionend"),Wd=new Map,Ud="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function dr(i,n){Wd.set(i,n),l(n,[i])}for(var yl=0;yl<Ud.length;yl++){var Sl=Ud[yl],Iy=Sl.toLowerCase(),Ay=Sl[0].toUpperCase()+Sl.slice(1);dr(Iy,"on"+Ay)}dr(zd,"onAnimationEnd"),dr(Fd,"onAnimationIteration"),dr(Hd,"onAnimationStart"),dr("dblclick","onDoubleClick"),dr("focusin","onFocus"),dr("focusout","onBlur"),dr($d,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var us="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Oy=new Set("cancel close invalid load scroll toggle".split(" ").concat(us));function qd(i,n,a){var c=i.type||"unknown-event";i.currentTarget=a,Iv(c,n,void 0,i),i.currentTarget=null}function Kd(i,n){n=(n&4)!==0;for(var a=0;a<i.length;a++){var c=i[a],f=c.event;c=c.listeners;e:{var g=void 0;if(n)for(var C=c.length-1;0<=C;C--){var T=c[C],H=T.instance,ne=T.currentTarget;if(T=T.listener,H!==g&&f.isPropagationStopped())break e;qd(f,T,ne),g=H}else for(C=0;C<c.length;C++){if(T=c[C],H=T.instance,ne=T.currentTarget,T=T.listener,H!==g&&f.isPropagationStopped())break e;qd(f,T,ne),g=H}}}if(io)throw i=Qa,io=!1,Qa=null,i}function Ke(i,n){var a=n[Rl];a===void 0&&(a=n[Rl]=new Set);var c=i+"__bubble";a.has(c)||(Vd(n,i,2,!1),a.add(c))}function wl(i,n,a){var c=0;n&&(c|=4),Vd(a,i,c,n)}var So="_reactListening"+Math.random().toString(36).slice(2);function hs(i){if(!i[So]){i[So]=!0,s.forEach(function(a){a!=="selectionchange"&&(Oy.has(a)||wl(a,!1,i),wl(a,!0,i))});var n=i.nodeType===9?i:i.ownerDocument;n===null||n[So]||(n[So]=!0,wl("selectionchange",!1,n))}}function Vd(i,n,a,c){switch(gd(n)){case 1:var f=Jv;break;case 4:f=Zv;break;default:f=nl}a=f.bind(null,n,a,i),f=void 0,!Ga||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),c?f!==void 0?i.addEventListener(n,a,{capture:!0,passive:f}):i.addEventListener(n,a,!0):f!==void 0?i.addEventListener(n,a,{passive:f}):i.addEventListener(n,a,!1)}function bl(i,n,a,c,f){var g=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var C=c.tag;if(C===3||C===4){var T=c.stateNode.containerInfo;if(T===f||T.nodeType===8&&T.parentNode===f)break;if(C===4)for(C=c.return;C!==null;){var H=C.tag;if((H===3||H===4)&&(H=C.stateNode.containerInfo,H===f||H.nodeType===8&&H.parentNode===f))return;C=C.return}for(;T!==null;){if(C=zr(T),C===null)return;if(H=C.tag,H===5||H===6){c=g=C;continue e}T=T.parentNode}}c=c.return}Jh(function(){var ne=g,he=Va(a),fe=[];e:{var ue=Wd.get(i);if(ue!==void 0){var Se=al,be=i;switch(i){case"keypress":if(po(a)===0)break e;case"keydown":case"keyup":Se=py;break;case"focusin":be="focus",Se=ul;break;case"focusout":be="blur",Se=ul;break;case"beforeblur":case"afterblur":Se=ul;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=yd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=iy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=_y;break;case zd:case Fd:case Hd:Se=sy;break;case $d:Se=yy;break;case"scroll":Se=ey;break;case"wheel":Se=wy;break;case"copy":case"cut":case"paste":Se=ay;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=wd}var Ce=(n&4)!==0,ct=!Ce&&i==="scroll",Z=Ce?ue!==null?ue+"Capture":null:ue;Ce=[];for(var K=ne,te;K!==null;){te=K;var ge=te.stateNode;if(te.tag===5&&ge!==null&&(te=ge,Z!==null&&(ge=Vn(K,Z),ge!=null&&Ce.push(ds(K,ge,te)))),ct)break;K=K.return}0<Ce.length&&(ue=new Se(ue,be,null,a,he),fe.push({event:ue,listeners:Ce}))}}if((n&7)===0){e:{if(ue=i==="mouseover"||i==="pointerover",Se=i==="mouseout"||i==="pointerout",ue&&a!==ri&&(be=a.relatedTarget||a.fromElement)&&(zr(be)||be[Xi]))break e;if((Se||ue)&&(ue=he.window===he?he:(ue=he.ownerDocument)?ue.defaultView||ue.parentWindow:window,Se?(be=a.relatedTarget||a.toElement,Se=ne,be=be?zr(be):null,be!==null&&(ct=Or(be),be!==ct||be.tag!==5&&be.tag!==6)&&(be=null)):(Se=null,be=ne),Se!==be)){if(Ce=yd,ge="onMouseLeave",Z="onMouseEnter",K="mouse",(i==="pointerout"||i==="pointerover")&&(Ce=wd,ge="onPointerLeave",Z="onPointerEnter",K="pointer"),ct=Se==null?ue:Sn(Se),te=be==null?ue:Sn(be),ue=new Ce(ge,K+"leave",Se,a,he),ue.target=ct,ue.relatedTarget=te,ge=null,zr(he)===ne&&(Ce=new Ce(Z,K+"enter",be,a,he),Ce.target=te,Ce.relatedTarget=ct,ge=Ce),ct=ge,Se&&be)t:{for(Ce=Se,Z=be,K=0,te=Ce;te;te=vn(te))K++;for(te=0,ge=Z;ge;ge=vn(ge))te++;for(;0<K-te;)Ce=vn(Ce),K--;for(;0<te-K;)Z=vn(Z),te--;for(;K--;){if(Ce===Z||Z!==null&&Ce===Z.alternate)break t;Ce=vn(Ce),Z=vn(Z)}Ce=null}else Ce=null;Se!==null&&Yd(fe,ue,Se,Ce,!1),be!==null&&ct!==null&&Yd(fe,ct,be,Ce,!0)}}e:{if(ue=ne?Sn(ne):window,Se=ue.nodeName&&ue.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ue.type==="file")var ke=Ry;else if(Nd(ue))if(Pd)ke=My;else{ke=Dy;var Ee=Py}else(Se=ue.nodeName)&&Se.toLowerCase()==="input"&&(ue.type==="checkbox"||ue.type==="radio")&&(ke=Ly);if(ke&&(ke=ke(i,ne))){Rd(fe,ke,a,he);break e}Ee&&Ee(i,ue,ne),i==="focusout"&&(Ee=ue._wrapperState)&&Ee.controlled&&ue.type==="number"&&ht(ue,"number",ue.value)}switch(Ee=ne?Sn(ne):window,i){case"focusin":(Nd(Ee)||Ee.contentEditable==="true")&&(gn=Ee,gl=ne,cs=null);break;case"focusout":cs=gl=gn=null;break;case"mousedown":_l=!0;break;case"contextmenu":case"mouseup":case"dragend":_l=!1,Ad(fe,a,he);break;case"selectionchange":if(By)break;case"keydown":case"keyup":Ad(fe,a,he)}var Ne;if(dl)e:{switch(i){case"compositionstart":var Re="onCompositionStart";break e;case"compositionend":Re="onCompositionEnd";break e;case"compositionupdate":Re="onCompositionUpdate";break e}Re=void 0}else mn?kd(i,a)&&(Re="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(Re="onCompositionStart");Re&&(bd&&a.locale!=="ko"&&(mn||Re!=="onCompositionStart"?Re==="onCompositionEnd"&&mn&&(Ne=_d()):(hr=he,ol="value"in hr?hr.value:hr.textContent,mn=!0)),Ee=wo(ne,Re),0<Ee.length&&(Re=new Sd(Re,i,null,a,he),fe.push({event:Re,listeners:Ee}),Ne?Re.data=Ne:(Ne=Ed(a),Ne!==null&&(Re.data=Ne)))),(Ne=Cy?xy(i,a):ky(i,a))&&(ne=wo(ne,"onBeforeInput"),0<ne.length&&(he=new Sd("onBeforeInput","beforeinput",null,a,he),fe.push({event:he,listeners:ne}),he.data=Ne))}Kd(fe,n)})}function ds(i,n,a){return{instance:i,listener:n,currentTarget:a}}function wo(i,n){for(var a=n+"Capture",c=[];i!==null;){var f=i,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=Vn(i,a),g!=null&&c.unshift(ds(i,g,f)),g=Vn(i,n),g!=null&&c.push(ds(i,g,f))),i=i.return}return c}function vn(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function Yd(i,n,a,c,f){for(var g=n._reactName,C=[];a!==null&&a!==c;){var T=a,H=T.alternate,ne=T.stateNode;if(H!==null&&H===c)break;T.tag===5&&ne!==null&&(T=ne,f?(H=Vn(a,g),H!=null&&C.unshift(ds(a,H,T))):f||(H=Vn(a,g),H!=null&&C.push(ds(a,H,T)))),a=a.return}C.length!==0&&i.push({event:n,listeners:C})}var zy=/\r\n?/g,Fy=/\u0000|\uFFFD/g;function Xd(i){return(typeof i=="string"?i:""+i).replace(zy,`
38
38
  `).replace(Fy,"")}function bo(i,n,a){if(n=Xd(n),Xd(i)!==n&&a)throw Error(r(425))}function Co(){}var Cl=null,xl=null;function kl(i,n){return i==="textarea"||i==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var El=typeof setTimeout=="function"?setTimeout:void 0,Hy=typeof clearTimeout=="function"?clearTimeout:void 0,Gd=typeof Promise=="function"?Promise:void 0,$y=typeof queueMicrotask=="function"?queueMicrotask:typeof Gd<"u"?function(i){return Gd.resolve(null).then(i).catch(Wy)}:El;function Wy(i){setTimeout(function(){throw i})}function Nl(i,n){var a=n,c=0;do{var f=a.nextSibling;if(i.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(c===0){i.removeChild(f),is(n);return}c--}else a!=="$"&&a!=="$?"&&a!=="$!"||c++;a=f}while(a);is(n)}function fr(i){for(;i!=null;i=i.nextSibling){var n=i.nodeType;if(n===1||n===3)break;if(n===8){if(n=i.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return i}function Qd(i){i=i.previousSibling;for(var n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"){if(n===0)return i;n--}else a==="/$"&&n++}i=i.previousSibling}return null}var yn=Math.random().toString(36).slice(2),Ii="__reactFiber$"+yn,fs="__reactProps$"+yn,Xi="__reactContainer$"+yn,Rl="__reactEvents$"+yn,Uy="__reactListeners$"+yn,qy="__reactHandles$"+yn;function zr(i){var n=i[Ii];if(n)return n;for(var a=i.parentNode;a;){if(n=a[Xi]||a[Ii]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(i=Qd(i);i!==null;){if(a=i[Ii])return a;i=Qd(i)}return n}i=a,a=i.parentNode}return null}function ps(i){return i=i[Ii]||i[Xi],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function Sn(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(r(33))}function xo(i){return i[fs]||null}var Pl=[],wn=-1;function pr(i){return{current:i}}function Ve(i){0>wn||(i.current=Pl[wn],Pl[wn]=null,wn--)}function qe(i,n){wn++,Pl[wn]=i.current,i.current=n}var mr={},jt=pr(mr),Kt=pr(!1),Fr=mr;function bn(i,n){var a=i.type.contextTypes;if(!a)return mr;var c=i.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in a)f[g]=n[g];return c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=n,i.__reactInternalMemoizedMaskedChildContext=f),f}function Vt(i){return i=i.childContextTypes,i!=null}function ko(){Ve(Kt),Ve(jt)}function Jd(i,n,a){if(jt.current!==mr)throw Error(r(168));qe(jt,n),qe(Kt,a)}function Zd(i,n,a){var c=i.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return a;c=c.getChildContext();for(var f in c)if(!(f in n))throw Error(r(108,se(i)||"Unknown",f));return G({},a,c)}function Eo(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||mr,Fr=jt.current,qe(jt,i),qe(Kt,Kt.current),!0}function ef(i,n,a){var c=i.stateNode;if(!c)throw Error(r(169));a?(i=Zd(i,n,Fr),c.__reactInternalMemoizedMergedChildContext=i,Ve(Kt),Ve(jt),qe(jt,i)):Ve(Kt),qe(Kt,a)}var Gi=null,No=!1,Dl=!1;function tf(i){Gi===null?Gi=[i]:Gi.push(i)}function Ky(i){No=!0,tf(i)}function gr(){if(!Dl&&Gi!==null){Dl=!0;var i=0,n=We;try{var a=Gi;for(We=1;i<a.length;i++){var c=a[i];do c=c(!0);while(c!==null)}Gi=null,No=!1}catch(f){throw Gi!==null&&(Gi=Gi.slice(i+1)),rd(Ja,gr),f}finally{We=n,Dl=!1}}return null}var Cn=[],xn=0,Ro=null,Po=0,mi=[],gi=0,Hr=null,Qi=1,Ji="";function $r(i,n){Cn[xn++]=Po,Cn[xn++]=Ro,Ro=i,Po=n}function rf(i,n,a){mi[gi++]=Qi,mi[gi++]=Ji,mi[gi++]=Hr,Hr=i;var c=Qi;i=Ji;var f=32-Ei(c)-1;c&=~(1<<f),a+=1;var g=32-Ei(n)+f;if(30<g){var C=f-f%5;g=(c&(1<<C)-1).toString(32),c>>=C,f-=C,Qi=1<<32-Ei(n)+f|a<<f|c,Ji=g+i}else Qi=1<<g|a<<f|c,Ji=i}function Ll(i){i.return!==null&&($r(i,1),rf(i,1,0))}function Ml(i){for(;i===Ro;)Ro=Cn[--xn],Cn[xn]=null,Po=Cn[--xn],Cn[xn]=null;for(;i===Hr;)Hr=mi[--gi],mi[gi]=null,Ji=mi[--gi],mi[gi]=null,Qi=mi[--gi],mi[gi]=null}var si=null,oi=null,Qe=!1,Ri=null;function nf(i,n){var a=Si(5,null,null,0);a.elementType="DELETED",a.stateNode=n,a.return=i,n=i.deletions,n===null?(i.deletions=[a],i.flags|=16):n.push(a)}function sf(i,n){switch(i.tag){case 5:var a=i.type;return n=n.nodeType!==1||a.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(i.stateNode=n,si=i,oi=fr(n.firstChild),!0):!1;case 6:return n=i.pendingProps===""||n.nodeType!==3?null:n,n!==null?(i.stateNode=n,si=i,oi=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(a=Hr!==null?{id:Qi,overflow:Ji}:null,i.memoizedState={dehydrated:n,treeContext:a,retryLane:1073741824},a=Si(18,null,null,0),a.stateNode=n,a.return=i,i.child=a,si=i,oi=null,!0):!1;default:return!1}}function Tl(i){return(i.mode&1)!==0&&(i.flags&128)===0}function jl(i){if(Qe){var n=oi;if(n){var a=n;if(!sf(i,n)){if(Tl(i))throw Error(r(418));n=fr(a.nextSibling);var c=si;n&&sf(i,n)?nf(c,a):(i.flags=i.flags&-4097|2,Qe=!1,si=i)}}else{if(Tl(i))throw Error(r(418));i.flags=i.flags&-4097|2,Qe=!1,si=i}}}function of(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;si=i}function Do(i){if(i!==si)return!1;if(!Qe)return of(i),Qe=!0,!1;var n;if((n=i.tag!==3)&&!(n=i.tag!==5)&&(n=i.type,n=n!=="head"&&n!=="body"&&!kl(i.type,i.memoizedProps)),n&&(n=oi)){if(Tl(i))throw af(),Error(r(418));for(;n;)nf(i,n),n=fr(n.nextSibling)}if(of(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,n=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"){if(n===0){oi=fr(i.nextSibling);break e}n--}else a!=="$"&&a!=="$!"&&a!=="$?"||n++}i=i.nextSibling}oi=null}}else oi=si?fr(i.stateNode.nextSibling):null;return!0}function af(){for(var i=oi;i;)i=fr(i.nextSibling)}function kn(){oi=si=null,Qe=!1}function Bl(i){Ri===null?Ri=[i]:Ri.push(i)}var Vy=B.ReactCurrentBatchConfig;function ms(i,n,a){if(i=a.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(r(309));var c=a.stateNode}if(!c)throw Error(r(147,i));var f=c,g=""+i;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===g?n.ref:(n=function(C){var T=f.refs;C===null?delete T[g]:T[g]=C},n._stringRef=g,n)}if(typeof i!="string")throw Error(r(284));if(!a._owner)throw Error(r(290,i))}return i}function Lo(i,n){throw i=Object.prototype.toString.call(n),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":i))}function lf(i){var n=i._init;return n(i._payload)}function cf(i){function n(Z,K){if(i){var te=Z.deletions;te===null?(Z.deletions=[K],Z.flags|=16):te.push(K)}}function a(Z,K){if(!i)return null;for(;K!==null;)n(Z,K),K=K.sibling;return null}function c(Z,K){for(Z=new Map;K!==null;)K.key!==null?Z.set(K.key,K):Z.set(K.index,K),K=K.sibling;return Z}function f(Z,K){return Z=xr(Z,K),Z.index=0,Z.sibling=null,Z}function g(Z,K,te){return Z.index=te,i?(te=Z.alternate,te!==null?(te=te.index,te<K?(Z.flags|=2,K):te):(Z.flags|=2,K)):(Z.flags|=1048576,K)}function C(Z){return i&&Z.alternate===null&&(Z.flags|=2),Z}function T(Z,K,te,ge){return K===null||K.tag!==6?(K=Ec(te,Z.mode,ge),K.return=Z,K):(K=f(K,te),K.return=Z,K)}function H(Z,K,te,ge){var ke=te.type;return ke===I?he(Z,K,te.props.children,ge,te.key):K!==null&&(K.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===F&&lf(ke)===K.type)?(ge=f(K,te.props),ge.ref=ms(Z,K,te),ge.return=Z,ge):(ge=ta(te.type,te.key,te.props,null,Z.mode,ge),ge.ref=ms(Z,K,te),ge.return=Z,ge)}function ne(Z,K,te,ge){return K===null||K.tag!==4||K.stateNode.containerInfo!==te.containerInfo||K.stateNode.implementation!==te.implementation?(K=Nc(te,Z.mode,ge),K.return=Z,K):(K=f(K,te.children||[]),K.return=Z,K)}function he(Z,K,te,ge,ke){return K===null||K.tag!==7?(K=Gr(te,Z.mode,ge,ke),K.return=Z,K):(K=f(K,te),K.return=Z,K)}function fe(Z,K,te){if(typeof K=="string"&&K!==""||typeof K=="number")return K=Ec(""+K,Z.mode,te),K.return=Z,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case W:return te=ta(K.type,K.key,K.props,null,Z.mode,te),te.ref=ms(Z,null,K),te.return=Z,te;case A:return K=Nc(K,Z.mode,te),K.return=Z,K;case F:var ge=K._init;return fe(Z,ge(K._payload),te)}if(Ge(K)||q(K))return K=Gr(K,Z.mode,te,null),K.return=Z,K;Lo(Z,K)}return null}function ue(Z,K,te,ge){var ke=K!==null?K.key:null;if(typeof te=="string"&&te!==""||typeof te=="number")return ke!==null?null:T(Z,K,""+te,ge);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case W:return te.key===ke?H(Z,K,te,ge):null;case A:return te.key===ke?ne(Z,K,te,ge):null;case F:return ke=te._init,ue(Z,K,ke(te._payload),ge)}if(Ge(te)||q(te))return ke!==null?null:he(Z,K,te,ge,null);Lo(Z,te)}return null}function Se(Z,K,te,ge,ke){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return Z=Z.get(te)||null,T(K,Z,""+ge,ke);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case W:return Z=Z.get(ge.key===null?te:ge.key)||null,H(K,Z,ge,ke);case A:return Z=Z.get(ge.key===null?te:ge.key)||null,ne(K,Z,ge,ke);case F:var Ee=ge._init;return Se(Z,K,te,Ee(ge._payload),ke)}if(Ge(ge)||q(ge))return Z=Z.get(te)||null,he(K,Z,ge,ke,null);Lo(K,ge)}return null}function be(Z,K,te,ge){for(var ke=null,Ee=null,Ne=K,Re=K=0,bt=null;Ne!==null&&Re<te.length;Re++){Ne.index>Re?(bt=Ne,Ne=null):bt=Ne.sibling;var Fe=ue(Z,Ne,te[Re],ge);if(Fe===null){Ne===null&&(Ne=bt);break}i&&Ne&&Fe.alternate===null&&n(Z,Ne),K=g(Fe,K,Re),Ee===null?ke=Fe:Ee.sibling=Fe,Ee=Fe,Ne=bt}if(Re===te.length)return a(Z,Ne),Qe&&$r(Z,Re),ke;if(Ne===null){for(;Re<te.length;Re++)Ne=fe(Z,te[Re],ge),Ne!==null&&(K=g(Ne,K,Re),Ee===null?ke=Ne:Ee.sibling=Ne,Ee=Ne);return Qe&&$r(Z,Re),ke}for(Ne=c(Z,Ne);Re<te.length;Re++)bt=Se(Ne,Z,Re,te[Re],ge),bt!==null&&(i&&bt.alternate!==null&&Ne.delete(bt.key===null?Re:bt.key),K=g(bt,K,Re),Ee===null?ke=bt:Ee.sibling=bt,Ee=bt);return i&&Ne.forEach(function(kr){return n(Z,kr)}),Qe&&$r(Z,Re),ke}function Ce(Z,K,te,ge){var ke=q(te);if(typeof ke!="function")throw Error(r(150));if(te=ke.call(te),te==null)throw Error(r(151));for(var Ee=ke=null,Ne=K,Re=K=0,bt=null,Fe=te.next();Ne!==null&&!Fe.done;Re++,Fe=te.next()){Ne.index>Re?(bt=Ne,Ne=null):bt=Ne.sibling;var kr=ue(Z,Ne,Fe.value,ge);if(kr===null){Ne===null&&(Ne=bt);break}i&&Ne&&kr.alternate===null&&n(Z,Ne),K=g(kr,K,Re),Ee===null?ke=kr:Ee.sibling=kr,Ee=kr,Ne=bt}if(Fe.done)return a(Z,Ne),Qe&&$r(Z,Re),ke;if(Ne===null){for(;!Fe.done;Re++,Fe=te.next())Fe=fe(Z,Fe.value,ge),Fe!==null&&(K=g(Fe,K,Re),Ee===null?ke=Fe:Ee.sibling=Fe,Ee=Fe);return Qe&&$r(Z,Re),ke}for(Ne=c(Z,Ne);!Fe.done;Re++,Fe=te.next())Fe=Se(Ne,Z,Re,Fe.value,ge),Fe!==null&&(i&&Fe.alternate!==null&&Ne.delete(Fe.key===null?Re:Fe.key),K=g(Fe,K,Re),Ee===null?ke=Fe:Ee.sibling=Fe,Ee=Fe);return i&&Ne.forEach(function(ES){return n(Z,ES)}),Qe&&$r(Z,Re),ke}function ct(Z,K,te,ge){if(typeof te=="object"&&te!==null&&te.type===I&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case W:e:{for(var ke=te.key,Ee=K;Ee!==null;){if(Ee.key===ke){if(ke=te.type,ke===I){if(Ee.tag===7){a(Z,Ee.sibling),K=f(Ee,te.props.children),K.return=Z,Z=K;break e}}else if(Ee.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===F&&lf(ke)===Ee.type){a(Z,Ee.sibling),K=f(Ee,te.props),K.ref=ms(Z,Ee,te),K.return=Z,Z=K;break e}a(Z,Ee);break}else n(Z,Ee);Ee=Ee.sibling}te.type===I?(K=Gr(te.props.children,Z.mode,ge,te.key),K.return=Z,Z=K):(ge=ta(te.type,te.key,te.props,null,Z.mode,ge),ge.ref=ms(Z,K,te),ge.return=Z,Z=ge)}return C(Z);case A:e:{for(Ee=te.key;K!==null;){if(K.key===Ee)if(K.tag===4&&K.stateNode.containerInfo===te.containerInfo&&K.stateNode.implementation===te.implementation){a(Z,K.sibling),K=f(K,te.children||[]),K.return=Z,Z=K;break e}else{a(Z,K);break}else n(Z,K);K=K.sibling}K=Nc(te,Z.mode,ge),K.return=Z,Z=K}return C(Z);case F:return Ee=te._init,ct(Z,K,Ee(te._payload),ge)}if(Ge(te))return be(Z,K,te,ge);if(q(te))return Ce(Z,K,te,ge);Lo(Z,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,K!==null&&K.tag===6?(a(Z,K.sibling),K=f(K,te),K.return=Z,Z=K):(a(Z,K),K=Ec(te,Z.mode,ge),K.return=Z,Z=K),C(Z)):a(Z,K)}return ct}var En=cf(!0),uf=cf(!1),Mo=pr(null),To=null,Nn=null,Il=null;function Al(){Il=Nn=To=null}function Ol(i){var n=Mo.current;Ve(Mo),i._currentValue=n}function zl(i,n,a){for(;i!==null;){var c=i.alternate;if((i.childLanes&n)!==n?(i.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),i===a)break;i=i.return}}function Rn(i,n){To=i,Il=Nn=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&n)!==0&&(Yt=!0),i.firstContext=null)}function _i(i){var n=i._currentValue;if(Il!==i)if(i={context:i,memoizedValue:n,next:null},Nn===null){if(To===null)throw Error(r(308));Nn=i,To.dependencies={lanes:0,firstContext:i}}else Nn=Nn.next=i;return n}var Wr=null;function Fl(i){Wr===null?Wr=[i]:Wr.push(i)}function hf(i,n,a,c){var f=n.interleaved;return f===null?(a.next=a,Fl(n)):(a.next=f.next,f.next=a),n.interleaved=a,Zi(i,c)}function Zi(i,n){i.lanes|=n;var a=i.alternate;for(a!==null&&(a.lanes|=n),a=i,i=i.return;i!==null;)i.childLanes|=n,a=i.alternate,a!==null&&(a.childLanes|=n),a=i,i=i.return;return a.tag===3?a.stateNode:null}var _r=!1;function Hl(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function df(i,n){i=i.updateQueue,n.updateQueue===i&&(n.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function er(i,n){return{eventTime:i,lane:n,tag:0,payload:null,callback:null,next:null}}function vr(i,n,a){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(ze&2)!==0){var f=c.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),c.pending=n,Zi(i,a)}return f=c.interleaved,f===null?(n.next=n,Fl(c)):(n.next=f.next,f.next=n),c.interleaved=n,Zi(i,a)}function jo(i,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194240)!==0)){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,tl(i,a)}}function ff(i,n){var a=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,g=null;if(a=a.firstBaseUpdate,a!==null){do{var C={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};g===null?f=g=C:g=g.next=C,a=a.next}while(a!==null);g===null?f=g=n:g=g.next=n}else f=g=n;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,effects:c.effects},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=n:i.next=n,a.lastBaseUpdate=n}function Bo(i,n,a,c){var f=i.updateQueue;_r=!1;var g=f.firstBaseUpdate,C=f.lastBaseUpdate,T=f.shared.pending;if(T!==null){f.shared.pending=null;var H=T,ne=H.next;H.next=null,C===null?g=ne:C.next=ne,C=H;var he=i.alternate;he!==null&&(he=he.updateQueue,T=he.lastBaseUpdate,T!==C&&(T===null?he.firstBaseUpdate=ne:T.next=ne,he.lastBaseUpdate=H))}if(g!==null){var fe=f.baseState;C=0,he=ne=H=null,T=g;do{var ue=T.lane,Se=T.eventTime;if((c&ue)===ue){he!==null&&(he=he.next={eventTime:Se,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var be=i,Ce=T;switch(ue=n,Se=a,Ce.tag){case 1:if(be=Ce.payload,typeof be=="function"){fe=be.call(Se,fe,ue);break e}fe=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ce.payload,ue=typeof be=="function"?be.call(Se,fe,ue):be,ue==null)break e;fe=G({},fe,ue);break e;case 2:_r=!0}}T.callback!==null&&T.lane!==0&&(i.flags|=64,ue=f.effects,ue===null?f.effects=[T]:ue.push(T))}else Se={eventTime:Se,lane:ue,tag:T.tag,payload:T.payload,callback:T.callback,next:null},he===null?(ne=he=Se,H=fe):he=he.next=Se,C|=ue;if(T=T.next,T===null){if(T=f.shared.pending,T===null)break;ue=T,T=ue.next,ue.next=null,f.lastBaseUpdate=ue,f.shared.pending=null}}while(!0);if(he===null&&(H=fe),f.baseState=H,f.firstBaseUpdate=ne,f.lastBaseUpdate=he,n=f.shared.interleaved,n!==null){f=n;do C|=f.lane,f=f.next;while(f!==n)}else g===null&&(f.shared.lanes=0);Kr|=C,i.lanes=C,i.memoizedState=fe}}function pf(i,n,a){if(i=n.effects,n.effects=null,i!==null)for(n=0;n<i.length;n++){var c=i[n],f=c.callback;if(f!==null){if(c.callback=null,c=a,typeof f!="function")throw Error(r(191,f));f.call(c)}}}var gs={},Ai=pr(gs),_s=pr(gs),vs=pr(gs);function Ur(i){if(i===gs)throw Error(r(174));return i}function $l(i,n){switch(qe(vs,n),qe(_s,i),qe(Ai,gs),i=n.nodeType,i){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:Ft(null,"");break;default:i=i===8?n.parentNode:n,n=i.namespaceURI||null,i=i.tagName,n=Ft(n,i)}Ve(Ai),qe(Ai,n)}function Pn(){Ve(Ai),Ve(_s),Ve(vs)}function mf(i){Ur(vs.current);var n=Ur(Ai.current),a=Ft(n,i.type);n!==a&&(qe(_s,i),qe(Ai,a))}function Wl(i){_s.current===i&&(Ve(Ai),Ve(_s))}var Ze=pr(0);function Io(i){for(var n=i;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ul=[];function ql(){for(var i=0;i<Ul.length;i++)Ul[i]._workInProgressVersionPrimary=null;Ul.length=0}var Ao=B.ReactCurrentDispatcher,Kl=B.ReactCurrentBatchConfig,qr=0,et=null,mt=null,St=null,Oo=!1,ys=!1,Ss=0,Yy=0;function Bt(){throw Error(r(321))}function Vl(i,n){if(n===null)return!1;for(var a=0;a<n.length&&a<i.length;a++)if(!Ni(i[a],n[a]))return!1;return!0}function Yl(i,n,a,c,f,g){if(qr=g,et=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Ao.current=i===null||i.memoizedState===null?Jy:Zy,i=a(c,f),ys){g=0;do{if(ys=!1,Ss=0,25<=g)throw Error(r(301));g+=1,St=mt=null,n.updateQueue=null,Ao.current=eS,i=a(c,f)}while(ys)}if(Ao.current=Ho,n=mt!==null&&mt.next!==null,qr=0,St=mt=et=null,Oo=!1,n)throw Error(r(300));return i}function Xl(){var i=Ss!==0;return Ss=0,i}function Oi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?et.memoizedState=St=i:St=St.next=i,St}function vi(){if(mt===null){var i=et.alternate;i=i!==null?i.memoizedState:null}else i=mt.next;var n=St===null?et.memoizedState:St.next;if(n!==null)St=n,mt=i;else{if(i===null)throw Error(r(310));mt=i,i={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},St===null?et.memoizedState=St=i:St=St.next=i}return St}function ws(i,n){return typeof n=="function"?n(i):n}function Gl(i){var n=vi(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var c=mt,f=c.baseQueue,g=a.pending;if(g!==null){if(f!==null){var C=f.next;f.next=g.next,g.next=C}c.baseQueue=f=g,a.pending=null}if(f!==null){g=f.next,c=c.baseState;var T=C=null,H=null,ne=g;do{var he=ne.lane;if((qr&he)===he)H!==null&&(H=H.next={lane:0,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),c=ne.hasEagerState?ne.eagerState:i(c,ne.action);else{var fe={lane:he,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null};H===null?(T=H=fe,C=c):H=H.next=fe,et.lanes|=he,Kr|=he}ne=ne.next}while(ne!==null&&ne!==g);H===null?C=c:H.next=T,Ni(c,n.memoizedState)||(Yt=!0),n.memoizedState=c,n.baseState=C,n.baseQueue=H,a.lastRenderedState=c}if(i=a.interleaved,i!==null){f=i;do g=f.lane,et.lanes|=g,Kr|=g,f=f.next;while(f!==i)}else f===null&&(a.lanes=0);return[n.memoizedState,a.dispatch]}function Ql(i){var n=vi(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var c=a.dispatch,f=a.pending,g=n.memoizedState;if(f!==null){a.pending=null;var C=f=f.next;do g=i(g,C.action),C=C.next;while(C!==f);Ni(g,n.memoizedState)||(Yt=!0),n.memoizedState=g,n.baseQueue===null&&(n.baseState=g),a.lastRenderedState=g}return[g,c]}function gf(){}function _f(i,n){var a=et,c=vi(),f=n(),g=!Ni(c.memoizedState,f);if(g&&(c.memoizedState=f,Yt=!0),c=c.queue,Jl(Sf.bind(null,a,c,i),[i]),c.getSnapshot!==n||g||St!==null&&St.memoizedState.tag&1){if(a.flags|=2048,bs(9,yf.bind(null,a,c,f,n),void 0,null),wt===null)throw Error(r(349));(qr&30)!==0||vf(a,n,f)}return f}function vf(i,n,a){i.flags|=16384,i={getSnapshot:n,value:a},n=et.updateQueue,n===null?(n={lastEffect:null,stores:null},et.updateQueue=n,n.stores=[i]):(a=n.stores,a===null?n.stores=[i]:a.push(i))}function yf(i,n,a,c){n.value=a,n.getSnapshot=c,wf(n)&&bf(i)}function Sf(i,n,a){return a(function(){wf(n)&&bf(i)})}function wf(i){var n=i.getSnapshot;i=i.value;try{var a=n();return!Ni(i,a)}catch{return!0}}function bf(i){var n=Zi(i,1);n!==null&&Mi(n,i,1,-1)}function Cf(i){var n=Oi();return typeof i=="function"&&(i=i()),n.memoizedState=n.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:i},n.queue=i,i=i.dispatch=Qy.bind(null,et,i),[n.memoizedState,i]}function bs(i,n,a,c){return i={tag:i,create:n,destroy:a,deps:c,next:null},n=et.updateQueue,n===null?(n={lastEffect:null,stores:null},et.updateQueue=n,n.lastEffect=i.next=i):(a=n.lastEffect,a===null?n.lastEffect=i.next=i:(c=a.next,a.next=i,i.next=c,n.lastEffect=i)),i}function xf(){return vi().memoizedState}function zo(i,n,a,c){var f=Oi();et.flags|=i,f.memoizedState=bs(1|n,a,void 0,c===void 0?null:c)}function Fo(i,n,a,c){var f=vi();c=c===void 0?null:c;var g=void 0;if(mt!==null){var C=mt.memoizedState;if(g=C.destroy,c!==null&&Vl(c,C.deps)){f.memoizedState=bs(n,a,g,c);return}}et.flags|=i,f.memoizedState=bs(1|n,a,g,c)}function kf(i,n){return zo(8390656,8,i,n)}function Jl(i,n){return Fo(2048,8,i,n)}function Ef(i,n){return Fo(4,2,i,n)}function Nf(i,n){return Fo(4,4,i,n)}function Rf(i,n){if(typeof n=="function")return i=i(),n(i),function(){n(null)};if(n!=null)return i=i(),n.current=i,function(){n.current=null}}function Pf(i,n,a){return a=a!=null?a.concat([i]):null,Fo(4,4,Rf.bind(null,n,i),a)}function Zl(){}function Df(i,n){var a=vi();n=n===void 0?null:n;var c=a.memoizedState;return c!==null&&n!==null&&Vl(n,c[1])?c[0]:(a.memoizedState=[i,n],i)}function Lf(i,n){var a=vi();n=n===void 0?null:n;var c=a.memoizedState;return c!==null&&n!==null&&Vl(n,c[1])?c[0]:(i=i(),a.memoizedState=[i,n],i)}function Mf(i,n,a){return(qr&21)===0?(i.baseState&&(i.baseState=!1,Yt=!0),i.memoizedState=a):(Ni(a,n)||(a=ad(),et.lanes|=a,Kr|=a,i.baseState=!0),n)}function Xy(i,n){var a=We;We=a!==0&&4>a?a:4,i(!0);var c=Kl.transition;Kl.transition={};try{i(!1),n()}finally{We=a,Kl.transition=c}}function Tf(){return vi().memoizedState}function Gy(i,n,a){var c=br(i);if(a={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null},jf(i))Bf(n,a);else if(a=hf(i,n,a,c),a!==null){var f=$t();Mi(a,i,c,f),If(a,n,c)}}function Qy(i,n,a){var c=br(i),f={lane:c,action:a,hasEagerState:!1,eagerState:null,next:null};if(jf(i))Bf(n,f);else{var g=i.alternate;if(i.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var C=n.lastRenderedState,T=g(C,a);if(f.hasEagerState=!0,f.eagerState=T,Ni(T,C)){var H=n.interleaved;H===null?(f.next=f,Fl(n)):(f.next=H.next,H.next=f),n.interleaved=f;return}}catch{}finally{}a=hf(i,n,f,c),a!==null&&(f=$t(),Mi(a,i,c,f),If(a,n,c))}}function jf(i){var n=i.alternate;return i===et||n!==null&&n===et}function Bf(i,n){ys=Oo=!0;var a=i.pending;a===null?n.next=n:(n.next=a.next,a.next=n),i.pending=n}function If(i,n,a){if((a&4194240)!==0){var c=n.lanes;c&=i.pendingLanes,a|=c,n.lanes=a,tl(i,a)}}var Ho={readContext:_i,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useInsertionEffect:Bt,useLayoutEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useMutableSource:Bt,useSyncExternalStore:Bt,useId:Bt,unstable_isNewReconciler:!1},Jy={readContext:_i,useCallback:function(i,n){return Oi().memoizedState=[i,n===void 0?null:n],i},useContext:_i,useEffect:kf,useImperativeHandle:function(i,n,a){return a=a!=null?a.concat([i]):null,zo(4194308,4,Rf.bind(null,n,i),a)},useLayoutEffect:function(i,n){return zo(4194308,4,i,n)},useInsertionEffect:function(i,n){return zo(4,2,i,n)},useMemo:function(i,n){var a=Oi();return n=n===void 0?null:n,i=i(),a.memoizedState=[i,n],i},useReducer:function(i,n,a){var c=Oi();return n=a!==void 0?a(n):n,c.memoizedState=c.baseState=n,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:n},c.queue=i,i=i.dispatch=Gy.bind(null,et,i),[c.memoizedState,i]},useRef:function(i){var n=Oi();return i={current:i},n.memoizedState=i},useState:Cf,useDebugValue:Zl,useDeferredValue:function(i){return Oi().memoizedState=i},useTransition:function(){var i=Cf(!1),n=i[0];return i=Xy.bind(null,i[1]),Oi().memoizedState=i,[n,i]},useMutableSource:function(){},useSyncExternalStore:function(i,n,a){var c=et,f=Oi();if(Qe){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),wt===null)throw Error(r(349));(qr&30)!==0||vf(c,n,a)}f.memoizedState=a;var g={value:a,getSnapshot:n};return f.queue=g,kf(Sf.bind(null,c,g,i),[i]),c.flags|=2048,bs(9,yf.bind(null,c,g,a,n),void 0,null),a},useId:function(){var i=Oi(),n=wt.identifierPrefix;if(Qe){var a=Ji,c=Qi;a=(c&~(1<<32-Ei(c)-1)).toString(32)+a,n=":"+n+"R"+a,a=Ss++,0<a&&(n+="H"+a.toString(32)),n+=":"}else a=Yy++,n=":"+n+"r"+a.toString(32)+":";return i.memoizedState=n},unstable_isNewReconciler:!1},Zy={readContext:_i,useCallback:Df,useContext:_i,useEffect:Jl,useImperativeHandle:Pf,useInsertionEffect:Ef,useLayoutEffect:Nf,useMemo:Lf,useReducer:Gl,useRef:xf,useState:function(){return Gl(ws)},useDebugValue:Zl,useDeferredValue:function(i){var n=vi();return Mf(n,mt.memoizedState,i)},useTransition:function(){var i=Gl(ws)[0],n=vi().memoizedState;return[i,n]},useMutableSource:gf,useSyncExternalStore:_f,useId:Tf,unstable_isNewReconciler:!1},eS={readContext:_i,useCallback:Df,useContext:_i,useEffect:Jl,useImperativeHandle:Pf,useInsertionEffect:Ef,useLayoutEffect:Nf,useMemo:Lf,useReducer:Ql,useRef:xf,useState:function(){return Ql(ws)},useDebugValue:Zl,useDeferredValue:function(i){var n=vi();return mt===null?n.memoizedState=i:Mf(n,mt.memoizedState,i)},useTransition:function(){var i=Ql(ws)[0],n=vi().memoizedState;return[i,n]},useMutableSource:gf,useSyncExternalStore:_f,useId:Tf,unstable_isNewReconciler:!1};function Pi(i,n){if(i&&i.defaultProps){n=G({},n),i=i.defaultProps;for(var a in i)n[a]===void 0&&(n[a]=i[a]);return n}return n}function ec(i,n,a,c){n=i.memoizedState,a=a(c,n),a=a==null?n:G({},n,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var $o={isMounted:function(i){return(i=i._reactInternals)?Or(i)===i:!1},enqueueSetState:function(i,n,a){i=i._reactInternals;var c=$t(),f=br(i),g=er(c,f);g.payload=n,a!=null&&(g.callback=a),n=vr(i,g,f),n!==null&&(Mi(n,i,f,c),jo(n,i,f))},enqueueReplaceState:function(i,n,a){i=i._reactInternals;var c=$t(),f=br(i),g=er(c,f);g.tag=1,g.payload=n,a!=null&&(g.callback=a),n=vr(i,g,f),n!==null&&(Mi(n,i,f,c),jo(n,i,f))},enqueueForceUpdate:function(i,n){i=i._reactInternals;var a=$t(),c=br(i),f=er(a,c);f.tag=2,n!=null&&(f.callback=n),n=vr(i,f,c),n!==null&&(Mi(n,i,c,a),jo(n,i,c))}};function Af(i,n,a,c,f,g,C){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,g,C):n.prototype&&n.prototype.isPureReactComponent?!ls(a,c)||!ls(f,g):!0}function Of(i,n,a){var c=!1,f=mr,g=n.contextType;return typeof g=="object"&&g!==null?g=_i(g):(f=Vt(n)?Fr:jt.current,c=n.contextTypes,g=(c=c!=null)?bn(i,f):mr),n=new n(a,g),i.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=$o,i.stateNode=n,n._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=f,i.__reactInternalMemoizedMaskedChildContext=g),n}function zf(i,n,a,c){i=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,c),n.state!==i&&$o.enqueueReplaceState(n,n.state,null)}function tc(i,n,a,c){var f=i.stateNode;f.props=a,f.state=i.memoizedState,f.refs={},Hl(i);var g=n.contextType;typeof g=="object"&&g!==null?f.context=_i(g):(g=Vt(n)?Fr:jt.current,f.context=bn(i,g)),f.state=i.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(ec(i,n,g,a),f.state=i.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(n=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),n!==f.state&&$o.enqueueReplaceState(f,f.state,null),Bo(i,a,f,c),f.state=i.memoizedState),typeof f.componentDidMount=="function"&&(i.flags|=4194308)}function Dn(i,n){try{var a="",c=n;do a+=X(c),c=c.return;while(c);var f=a}catch(g){f=`
39
39
  Error generating stack: `+g.message+`
40
- `+g.stack}return{value:i,source:n,stack:f,digest:null}}function ic(i,n,a){return{value:i,source:null,stack:a??null,digest:n??null}}function rc(i,n){try{console.error(n.value)}catch(a){setTimeout(function(){throw a})}}var tS=typeof WeakMap=="function"?WeakMap:Map;function Ff(i,n,a){a=er(-1,a),a.tag=3,a.payload={element:null};var c=n.value;return a.callback=function(){Xo||(Xo=!0,vc=c),rc(i,n)},a}function Hf(i,n,a){a=er(-1,a),a.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var f=n.value;a.payload=function(){return c(f)},a.callback=function(){rc(i,n)}}var g=i.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){rc(i,n),typeof c!="function"&&(Sr===null?Sr=new Set([this]):Sr.add(this));var C=n.stack;this.componentDidCatch(n.value,{componentStack:C!==null?C:""})}),a}function $f(i,n,a){var c=i.pingCache;if(c===null){c=i.pingCache=new tS;var f=new Set;c.set(n,f)}else f=c.get(n),f===void 0&&(f=new Set,c.set(n,f));f.has(a)||(f.add(a),i=mS.bind(null,i,n,a),n.then(i,i))}function Wf(i){do{var n;if((n=i.tag===13)&&(n=i.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return i;i=i.return}while(i!==null);return null}function Uf(i,n,a,c,f){return(i.mode&1)===0?(i===n?i.flags|=65536:(i.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(n=er(-1,1),n.tag=2,vr(a,n,1))),a.lanes|=1),i):(i.flags|=65536,i.lanes=f,i)}var iS=B.ReactCurrentOwner,Yt=!1;function Ht(i,n,a,c){n.child=i===null?uf(n,null,a,c):En(n,i.child,a,c)}function qf(i,n,a,c,f){a=a.render;var g=n.ref;return Rn(n,f),c=Yl(i,n,a,c,g,f),a=Xl(),i!==null&&!Yt?(n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~f,tr(i,n,f)):(Qe&&a&&Ll(n),n.flags|=1,Ht(i,n,c,f),n.child)}function Kf(i,n,a,c,f){if(i===null){var g=a.type;return typeof g=="function"&&!kc(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(n.tag=15,n.type=g,Vf(i,n,g,c,f)):(i=ta(a.type,null,c,n,n.mode,f),i.ref=n.ref,i.return=n,n.child=i)}if(g=i.child,(i.lanes&f)===0){var C=g.memoizedProps;if(a=a.compare,a=a!==null?a:ls,a(C,c)&&i.ref===n.ref)return tr(i,n,f)}return n.flags|=1,i=xr(g,c),i.ref=n.ref,i.return=n,n.child=i}function Vf(i,n,a,c,f){if(i!==null){var g=i.memoizedProps;if(ls(g,c)&&i.ref===n.ref)if(Yt=!1,n.pendingProps=c=g,(i.lanes&f)!==0)(i.flags&131072)!==0&&(Yt=!0);else return n.lanes=i.lanes,tr(i,n,f)}return nc(i,n,a,c,f)}function Yf(i,n,a){var c=n.pendingProps,f=c.children,g=i!==null?i.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(Mn,ai),ai|=a;else{if((a&1073741824)===0)return i=g!==null?g.baseLanes|a:a,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:i,cachePool:null,transitions:null},n.updateQueue=null,qe(Mn,ai),ai|=i,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=g!==null?g.baseLanes:a,qe(Mn,ai),ai|=c}else g!==null?(c=g.baseLanes|a,n.memoizedState=null):c=a,qe(Mn,ai),ai|=c;return Ht(i,n,f,a),n.child}function Xf(i,n){var a=n.ref;(i===null&&a!==null||i!==null&&i.ref!==a)&&(n.flags|=512,n.flags|=2097152)}function nc(i,n,a,c,f){var g=Vt(a)?Fr:jt.current;return g=bn(n,g),Rn(n,f),a=Yl(i,n,a,c,g,f),c=Xl(),i!==null&&!Yt?(n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~f,tr(i,n,f)):(Qe&&c&&Ll(n),n.flags|=1,Ht(i,n,a,f),n.child)}function Gf(i,n,a,c,f){if(Vt(a)){var g=!0;Eo(n)}else g=!1;if(Rn(n,f),n.stateNode===null)Uo(i,n),Of(n,a,c),tc(n,a,c,f),c=!0;else if(i===null){var C=n.stateNode,T=n.memoizedProps;C.props=T;var H=C.context,ne=a.contextType;typeof ne=="object"&&ne!==null?ne=_i(ne):(ne=Vt(a)?Fr:jt.current,ne=bn(n,ne));var he=a.getDerivedStateFromProps,fe=typeof he=="function"||typeof C.getSnapshotBeforeUpdate=="function";fe||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(T!==c||H!==ne)&&zf(n,C,c,ne),_r=!1;var ue=n.memoizedState;C.state=ue,Bo(n,c,C,f),H=n.memoizedState,T!==c||ue!==H||Kt.current||_r?(typeof he=="function"&&(ec(n,a,he,c),H=n.memoizedState),(T=_r||Af(n,a,T,c,ue,H,ne))?(fe||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(n.flags|=4194308)):(typeof C.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=H),C.props=c,C.state=H,C.context=ne,c=T):(typeof C.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{C=n.stateNode,df(i,n),T=n.memoizedProps,ne=n.type===n.elementType?T:Pi(n.type,T),C.props=ne,fe=n.pendingProps,ue=C.context,H=a.contextType,typeof H=="object"&&H!==null?H=_i(H):(H=Vt(a)?Fr:jt.current,H=bn(n,H));var Se=a.getDerivedStateFromProps;(he=typeof Se=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(T!==fe||ue!==H)&&zf(n,C,c,H),_r=!1,ue=n.memoizedState,C.state=ue,Bo(n,c,C,f);var be=n.memoizedState;T!==fe||ue!==be||Kt.current||_r?(typeof Se=="function"&&(ec(n,a,Se,c),be=n.memoizedState),(ne=_r||Af(n,a,ne,c,ue,be,H)||!1)?(he||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(c,be,H),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(c,be,H)),typeof C.componentDidUpdate=="function"&&(n.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof C.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=be),C.props=c,C.state=be,C.context=H,c=ne):(typeof C.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=1024),c=!1)}return sc(i,n,a,c,g,f)}function sc(i,n,a,c,f,g){Xf(i,n);var C=(n.flags&128)!==0;if(!c&&!C)return f&&ef(n,a,!1),tr(i,n,g);c=n.stateNode,iS.current=n;var T=C&&typeof a.getDerivedStateFromError!="function"?null:c.render();return n.flags|=1,i!==null&&C?(n.child=En(n,i.child,null,g),n.child=En(n,null,T,g)):Ht(i,n,T,g),n.memoizedState=c.state,f&&ef(n,a,!0),n.child}function Qf(i){var n=i.stateNode;n.pendingContext?Jd(i,n.pendingContext,n.pendingContext!==n.context):n.context&&Jd(i,n.context,!1),$l(i,n.containerInfo)}function Jf(i,n,a,c,f){return kn(),Bl(f),n.flags|=256,Ht(i,n,a,c),n.child}var oc={dehydrated:null,treeContext:null,retryLane:0};function ac(i){return{baseLanes:i,cachePool:null,transitions:null}}function Zf(i,n,a){var c=n.pendingProps,f=Ze.current,g=!1,C=(n.flags&128)!==0,T;if((T=C)||(T=i!==null&&i.memoizedState===null?!1:(f&2)!==0),T?(g=!0,n.flags&=-129):(i===null||i.memoizedState!==null)&&(f|=1),qe(Ze,f&1),i===null)return jl(n),i=n.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((n.mode&1)===0?n.lanes=1:i.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(C=c.children,i=c.fallback,g?(c=n.mode,g=n.child,C={mode:"hidden",children:C},(c&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=C):g=ia(C,c,0,null),i=Gr(i,c,a,null),g.return=n,i.return=n,g.sibling=i,n.child=g,n.child.memoizedState=ac(a),n.memoizedState=oc,i):lc(n,C));if(f=i.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return rS(i,n,C,c,T,f,a);if(g){g=c.fallback,C=n.mode,f=i.child,T=f.sibling;var H={mode:"hidden",children:c.children};return(C&1)===0&&n.child!==f?(c=n.child,c.childLanes=0,c.pendingProps=H,n.deletions=null):(c=xr(f,H),c.subtreeFlags=f.subtreeFlags&14680064),T!==null?g=xr(T,g):(g=Gr(g,C,a,null),g.flags|=2),g.return=n,c.return=n,c.sibling=g,n.child=c,c=g,g=n.child,C=i.child.memoizedState,C=C===null?ac(a):{baseLanes:C.baseLanes|a,cachePool:null,transitions:C.transitions},g.memoizedState=C,g.childLanes=i.childLanes&~a,n.memoizedState=oc,c}return g=i.child,i=g.sibling,c=xr(g,{mode:"visible",children:c.children}),(n.mode&1)===0&&(c.lanes=a),c.return=n,c.sibling=null,i!==null&&(a=n.deletions,a===null?(n.deletions=[i],n.flags|=16):a.push(i)),n.child=c,n.memoizedState=null,c}function lc(i,n){return n=ia({mode:"visible",children:n},i.mode,0,null),n.return=i,i.child=n}function Wo(i,n,a,c){return c!==null&&Bl(c),En(n,i.child,null,a),i=lc(n,n.pendingProps.children),i.flags|=2,n.memoizedState=null,i}function rS(i,n,a,c,f,g,C){if(a)return n.flags&256?(n.flags&=-257,c=ic(Error(r(422))),Wo(i,n,C,c)):n.memoizedState!==null?(n.child=i.child,n.flags|=128,null):(g=c.fallback,f=n.mode,c=ia({mode:"visible",children:c.children},f,0,null),g=Gr(g,f,C,null),g.flags|=2,c.return=n,g.return=n,c.sibling=g,n.child=c,(n.mode&1)!==0&&En(n,i.child,null,C),n.child.memoizedState=ac(C),n.memoizedState=oc,g);if((n.mode&1)===0)return Wo(i,n,C,null);if(f.data==="$!"){if(c=f.nextSibling&&f.nextSibling.dataset,c)var T=c.dgst;return c=T,g=Error(r(419)),c=ic(g,c,void 0),Wo(i,n,C,c)}if(T=(C&i.childLanes)!==0,Yt||T){if(c=wt,c!==null){switch(C&-C){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(c.suspendedLanes|C))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,Zi(i,f),Mi(c,i,f,-1))}return xc(),c=ic(Error(r(421))),Wo(i,n,C,c)}return f.data==="$?"?(n.flags|=128,n.child=i.child,n=gS.bind(null,i),f._reactRetry=n,null):(i=g.treeContext,oi=fr(f.nextSibling),si=n,Qe=!0,Ri=null,i!==null&&(mi[gi++]=Qi,mi[gi++]=Ji,mi[gi++]=Hr,Qi=i.id,Ji=i.overflow,Hr=n),n=lc(n,c.children),n.flags|=4096,n)}function ep(i,n,a){i.lanes|=n;var c=i.alternate;c!==null&&(c.lanes|=n),zl(i.return,n,a)}function cc(i,n,a,c,f){var g=i.memoizedState;g===null?i.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(g.isBackwards=n,g.rendering=null,g.renderingStartTime=0,g.last=c,g.tail=a,g.tailMode=f)}function tp(i,n,a){var c=n.pendingProps,f=c.revealOrder,g=c.tail;if(Ht(i,n,c.children,a),c=Ze.current,(c&2)!==0)c=c&1|2,n.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=n.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&ep(i,a,n);else if(i.tag===19)ep(i,a,n);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(qe(Ze,c),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(a=n.child,f=null;a!==null;)i=a.alternate,i!==null&&Io(i)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),cc(n,!1,f,a,g);break;case"backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(i=f.alternate,i!==null&&Io(i)===null){n.child=f;break}i=f.sibling,f.sibling=a,a=f,f=i}cc(n,!0,a,null,g);break;case"together":cc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function Uo(i,n){(n.mode&1)===0&&i!==null&&(i.alternate=null,n.alternate=null,n.flags|=2)}function tr(i,n,a){if(i!==null&&(n.dependencies=i.dependencies),Kr|=n.lanes,(a&n.childLanes)===0)return null;if(i!==null&&n.child!==i.child)throw Error(r(153));if(n.child!==null){for(i=n.child,a=xr(i,i.pendingProps),n.child=a,a.return=n;i.sibling!==null;)i=i.sibling,a=a.sibling=xr(i,i.pendingProps),a.return=n;a.sibling=null}return n.child}function nS(i,n,a){switch(n.tag){case 3:Qf(n),kn();break;case 5:mf(n);break;case 1:Vt(n.type)&&Eo(n);break;case 4:$l(n,n.stateNode.containerInfo);break;case 10:var c=n.type._context,f=n.memoizedProps.value;qe(Mo,c._currentValue),c._currentValue=f;break;case 13:if(c=n.memoizedState,c!==null)return c.dehydrated!==null?(qe(Ze,Ze.current&1),n.flags|=128,null):(a&n.child.childLanes)!==0?Zf(i,n,a):(qe(Ze,Ze.current&1),i=tr(i,n,a),i!==null?i.sibling:null);qe(Ze,Ze.current&1);break;case 19:if(c=(a&n.childLanes)!==0,(i.flags&128)!==0){if(c)return tp(i,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),qe(Ze,Ze.current),c)break;return null;case 22:case 23:return n.lanes=0,Yf(i,n,a)}return tr(i,n,a)}var ip,uc,rp,np;ip=function(i,n){for(var a=n.child;a!==null;){if(a.tag===5||a.tag===6)i.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},uc=function(){},rp=function(i,n,a,c){var f=i.memoizedProps;if(f!==c){i=n.stateNode,Ur(Ai.current);var g=null;switch(a){case"input":f=De(i,f),c=De(i,c),g=[];break;case"select":f=G({},f,{value:void 0}),c=G({},c,{value:void 0}),g=[];break;case"textarea":f=ei(i,f),c=ei(i,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=Co)}Le(a,c);var C;a=null;for(ne in f)if(!c.hasOwnProperty(ne)&&f.hasOwnProperty(ne)&&f[ne]!=null)if(ne==="style"){var T=f[ne];for(C in T)T.hasOwnProperty(C)&&(a||(a={}),a[C]="")}else ne!=="dangerouslySetInnerHTML"&&ne!=="children"&&ne!=="suppressContentEditableWarning"&&ne!=="suppressHydrationWarning"&&ne!=="autoFocus"&&(o.hasOwnProperty(ne)?g||(g=[]):(g=g||[]).push(ne,null));for(ne in c){var H=c[ne];if(T=f!=null?f[ne]:void 0,c.hasOwnProperty(ne)&&H!==T&&(H!=null||T!=null))if(ne==="style")if(T){for(C in T)!T.hasOwnProperty(C)||H&&H.hasOwnProperty(C)||(a||(a={}),a[C]="");for(C in H)H.hasOwnProperty(C)&&T[C]!==H[C]&&(a||(a={}),a[C]=H[C])}else a||(g||(g=[]),g.push(ne,a)),a=H;else ne==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,T=T?T.__html:void 0,H!=null&&T!==H&&(g=g||[]).push(ne,H)):ne==="children"?typeof H!="string"&&typeof H!="number"||(g=g||[]).push(ne,""+H):ne!=="suppressContentEditableWarning"&&ne!=="suppressHydrationWarning"&&(o.hasOwnProperty(ne)?(H!=null&&ne==="onScroll"&&Ke("scroll",i),g||T===H||(g=[])):(g=g||[]).push(ne,H))}a&&(g=g||[]).push("style",a);var ne=g;(n.updateQueue=ne)&&(n.flags|=4)}},np=function(i,n,a,c){a!==c&&(n.flags|=4)};function Cs(i,n){if(!Qe)switch(i.tailMode){case"hidden":n=i.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function It(i){var n=i.alternate!==null&&i.alternate.child===i.child,a=0,c=0;if(n)for(var f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&14680064,c|=f.flags&14680064,f.return=i,f=f.sibling;else for(f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=c,i.childLanes=a,n}function sS(i,n,a){var c=n.pendingProps;switch(Ml(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return It(n),null;case 1:return Vt(n.type)&&ko(),It(n),null;case 3:return c=n.stateNode,Pn(),Ve(Kt),Ve(jt),ql(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Do(n)?n.flags|=4:i===null||i.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Ri!==null&&(wc(Ri),Ri=null))),uc(i,n),It(n),null;case 5:Wl(n);var f=Ur(vs.current);if(a=n.type,i!==null&&n.stateNode!=null)rp(i,n,a,c,f),i.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!c){if(n.stateNode===null)throw Error(r(166));return It(n),null}if(i=Ur(Ai.current),Do(n)){c=n.stateNode,a=n.type;var g=n.memoizedProps;switch(c[Ii]=n,c[fs]=g,i=(n.mode&1)!==0,a){case"dialog":Ke("cancel",c),Ke("close",c);break;case"iframe":case"object":case"embed":Ke("load",c);break;case"video":case"audio":for(f=0;f<us.length;f++)Ke(us[f],c);break;case"source":Ke("error",c);break;case"img":case"image":case"link":Ke("error",c),Ke("load",c);break;case"details":Ke("toggle",c);break;case"input":Xe(c,g),Ke("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!g.multiple},Ke("invalid",c);break;case"textarea":jr(c,g),Ke("invalid",c)}Le(a,g),f=null;for(var C in g)if(g.hasOwnProperty(C)){var T=g[C];C==="children"?typeof T=="string"?c.textContent!==T&&(g.suppressHydrationWarning!==!0&&bo(c.textContent,T,i),f=["children",T]):typeof T=="number"&&c.textContent!==""+T&&(g.suppressHydrationWarning!==!0&&bo(c.textContent,T,i),f=["children",""+T]):o.hasOwnProperty(C)&&T!=null&&C==="onScroll"&&Ke("scroll",c)}switch(a){case"input":Oe(c),at(c,g,!0);break;case"textarea":Oe(c),Ir(c);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(c.onclick=Co)}c=f,n.updateQueue=c,c!==null&&(n.flags|=4)}else{C=f.nodeType===9?f:f.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ar(a)),i==="http://www.w3.org/1999/xhtml"?a==="script"?(i=C.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof c.is=="string"?i=C.createElement(a,{is:c.is}):(i=C.createElement(a),a==="select"&&(C=i,c.multiple?C.multiple=!0:c.size&&(C.size=c.size))):i=C.createElementNS(i,a),i[Ii]=n,i[fs]=c,ip(i,n,!1,!1),n.stateNode=i;e:{switch(C=Pt(a,c),a){case"dialog":Ke("cancel",i),Ke("close",i),f=c;break;case"iframe":case"object":case"embed":Ke("load",i),f=c;break;case"video":case"audio":for(f=0;f<us.length;f++)Ke(us[f],i);f=c;break;case"source":Ke("error",i),f=c;break;case"img":case"image":case"link":Ke("error",i),Ke("load",i),f=c;break;case"details":Ke("toggle",i),f=c;break;case"input":Xe(i,c),f=De(i,c),Ke("invalid",i);break;case"option":f=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},f=G({},c,{value:void 0}),Ke("invalid",i);break;case"textarea":jr(i,c),f=ei(i,c),Ke("invalid",i);break;default:f=c}Le(a,f),T=f;for(g in T)if(T.hasOwnProperty(g)){var H=T[g];g==="style"?le(i,H):g==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,H!=null&&Yi(i,H)):g==="children"?typeof H=="string"?(a!=="textarea"||H!=="")&&ii(i,H):typeof H=="number"&&ii(i,""+H):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(o.hasOwnProperty(g)?H!=null&&g==="onScroll"&&Ke("scroll",i):H!=null&&z(i,g,H,C))}switch(a){case"input":Oe(i),at(i,c,!1);break;case"textarea":Oe(i),Ir(i);break;case"option":c.value!=null&&i.setAttribute("value",""+ae(c.value));break;case"select":i.multiple=!!c.multiple,g=c.value,g!=null?ki(i,!!c.multiple,g,!1):c.defaultValue!=null&&ki(i,!!c.multiple,c.defaultValue,!0);break;default:typeof f.onClick=="function"&&(i.onclick=Co)}switch(a){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return It(n),null;case 6:if(i&&n.stateNode!=null)np(i,n,i.memoizedProps,c);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(a=Ur(vs.current),Ur(Ai.current),Do(n)){if(c=n.stateNode,a=n.memoizedProps,c[Ii]=n,(g=c.nodeValue!==a)&&(i=si,i!==null))switch(i.tag){case 3:bo(c.nodeValue,a,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&bo(c.nodeValue,a,(i.mode&1)!==0)}g&&(n.flags|=4)}else c=(a.nodeType===9?a:a.ownerDocument).createTextNode(c),c[Ii]=n,n.stateNode=c}return It(n),null;case 13:if(Ve(Ze),c=n.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Qe&&oi!==null&&(n.mode&1)!==0&&(n.flags&128)===0)af(),kn(),n.flags|=98560,g=!1;else if(g=Do(n),c!==null&&c.dehydrated!==null){if(i===null){if(!g)throw Error(r(318));if(g=n.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Ii]=n}else kn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;It(n),g=!1}else Ri!==null&&(wc(Ri),Ri=null),g=!0;if(!g)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=a,n):(c=c!==null,c!==(i!==null&&i.memoizedState!==null)&&c&&(n.child.flags|=8192,(n.mode&1)!==0&&(i===null||(Ze.current&1)!==0?gt===0&&(gt=3):xc())),n.updateQueue!==null&&(n.flags|=4),It(n),null);case 4:return Pn(),uc(i,n),i===null&&hs(n.stateNode.containerInfo),It(n),null;case 10:return Ol(n.type._context),It(n),null;case 17:return Vt(n.type)&&ko(),It(n),null;case 19:if(Ve(Ze),g=n.memoizedState,g===null)return It(n),null;if(c=(n.flags&128)!==0,C=g.rendering,C===null)if(c)Cs(g,!1);else{if(gt!==0||i!==null&&(i.flags&128)!==0)for(i=n.child;i!==null;){if(C=Io(i),C!==null){for(n.flags|=128,Cs(g,!1),c=C.updateQueue,c!==null&&(n.updateQueue=c,n.flags|=4),n.subtreeFlags=0,c=a,a=n.child;a!==null;)g=a,i=c,g.flags&=14680066,C=g.alternate,C===null?(g.childLanes=0,g.lanes=i,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=C.childLanes,g.lanes=C.lanes,g.child=C.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=C.memoizedProps,g.memoizedState=C.memoizedState,g.updateQueue=C.updateQueue,g.type=C.type,i=C.dependencies,g.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),a=a.sibling;return qe(Ze,Ze.current&1|2),n.child}i=i.sibling}g.tail!==null&&lt()>Tn&&(n.flags|=128,c=!0,Cs(g,!1),n.lanes=4194304)}else{if(!c)if(i=Io(C),i!==null){if(n.flags|=128,c=!0,a=i.updateQueue,a!==null&&(n.updateQueue=a,n.flags|=4),Cs(g,!0),g.tail===null&&g.tailMode==="hidden"&&!C.alternate&&!Qe)return It(n),null}else 2*lt()-g.renderingStartTime>Tn&&a!==1073741824&&(n.flags|=128,c=!0,Cs(g,!1),n.lanes=4194304);g.isBackwards?(C.sibling=n.child,n.child=C):(a=g.last,a!==null?a.sibling=C:n.child=C,g.last=C)}return g.tail!==null?(n=g.tail,g.rendering=n,g.tail=n.sibling,g.renderingStartTime=lt(),n.sibling=null,a=Ze.current,qe(Ze,c?a&1|2:a&1),n):(It(n),null);case 22:case 23:return Cc(),c=n.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(n.flags|=8192),c&&(n.mode&1)!==0?(ai&1073741824)!==0&&(It(n),n.subtreeFlags&6&&(n.flags|=8192)):It(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function oS(i,n){switch(Ml(n),n.tag){case 1:return Vt(n.type)&&ko(),i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 3:return Pn(),Ve(Kt),Ve(jt),ql(),i=n.flags,(i&65536)!==0&&(i&128)===0?(n.flags=i&-65537|128,n):null;case 5:return Wl(n),null;case 13:if(Ve(Ze),i=n.memoizedState,i!==null&&i.dehydrated!==null){if(n.alternate===null)throw Error(r(340));kn()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 19:return Ve(Ze),null;case 4:return Pn(),null;case 10:return Ol(n.type._context),null;case 22:case 23:return Cc(),null;case 24:return null;default:return null}}var qo=!1,At=!1,aS=typeof WeakSet=="function"?WeakSet:Set,we=null;function Ln(i,n){var a=i.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){rt(i,n,c)}else a.current=null}function hc(i,n,a){try{a()}catch(c){rt(i,n,c)}}var sp=!1;function lS(i,n){if(Cl=uo,i=Id(),ml(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var C=0,T=-1,H=-1,ne=0,he=0,fe=i,ue=null;t:for(;;){for(var Se;fe!==a||f!==0&&fe.nodeType!==3||(T=C+f),fe!==g||c!==0&&fe.nodeType!==3||(H=C+c),fe.nodeType===3&&(C+=fe.nodeValue.length),(Se=fe.firstChild)!==null;)ue=fe,fe=Se;for(;;){if(fe===i)break t;if(ue===a&&++ne===f&&(T=C),ue===g&&++he===c&&(H=C),(Se=fe.nextSibling)!==null)break;fe=ue,ue=fe.parentNode}fe=Se}a=T===-1||H===-1?null:{start:T,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(xl={focusedElem:i,selectionRange:a},uo=!1,we=n;we!==null;)if(n=we,i=n.child,(n.subtreeFlags&1028)!==0&&i!==null)i.return=n,we=i;else for(;we!==null;){n=we;try{var be=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var Ce=be.memoizedProps,ct=be.memoizedState,Z=n.stateNode,K=Z.getSnapshotBeforeUpdate(n.elementType===n.type?Ce:Pi(n.type,Ce),ct);Z.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var te=n.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ge){rt(n,n.return,ge)}if(i=n.sibling,i!==null){i.return=n.return,we=i;break}we=n.return}return be=sp,sp=!1,be}function xs(i,n,a){var c=n.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&i)===i){var g=f.destroy;f.destroy=void 0,g!==void 0&&hc(n,a,g)}f=f.next}while(f!==c)}}function Ko(i,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&i)===i){var c=a.create;a.destroy=c()}a=a.next}while(a!==n)}}function dc(i){var n=i.ref;if(n!==null){var a=i.stateNode;switch(i.tag){case 5:i=a;break;default:i=a}typeof n=="function"?n(i):n.current=i}}function op(i){var n=i.alternate;n!==null&&(i.alternate=null,op(n)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(n=i.stateNode,n!==null&&(delete n[Ii],delete n[fs],delete n[Rl],delete n[Uy],delete n[qy])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function ap(i){return i.tag===5||i.tag===3||i.tag===4}function lp(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||ap(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function fc(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?a.nodeType===8?a.parentNode.insertBefore(i,n):a.insertBefore(i,n):(a.nodeType===8?(n=a.parentNode,n.insertBefore(i,a)):(n=a,n.appendChild(i)),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Co));else if(c!==4&&(i=i.child,i!==null))for(fc(i,n,a),i=i.sibling;i!==null;)fc(i,n,a),i=i.sibling}function pc(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?a.insertBefore(i,n):a.appendChild(i);else if(c!==4&&(i=i.child,i!==null))for(pc(i,n,a),i=i.sibling;i!==null;)pc(i,n,a),i=i.sibling}var Dt=null,Di=!1;function yr(i,n,a){for(a=a.child;a!==null;)cp(i,n,a),a=a.sibling}function cp(i,n,a){if(Bi&&typeof Bi.onCommitFiberUnmount=="function")try{Bi.onCommitFiberUnmount(no,a)}catch{}switch(a.tag){case 5:At||Ln(a,n);case 6:var c=Dt,f=Di;Dt=null,yr(i,n,a),Dt=c,Di=f,Dt!==null&&(Di?(i=Dt,a=a.stateNode,i.nodeType===8?i.parentNode.removeChild(a):i.removeChild(a)):Dt.removeChild(a.stateNode));break;case 18:Dt!==null&&(Di?(i=Dt,a=a.stateNode,i.nodeType===8?Nl(i.parentNode,a):i.nodeType===1&&Nl(i,a),is(i)):Nl(Dt,a.stateNode));break;case 4:c=Dt,f=Di,Dt=a.stateNode.containerInfo,Di=!0,yr(i,n,a),Dt=c,Di=f;break;case 0:case 11:case 14:case 15:if(!At&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){f=c=c.next;do{var g=f,C=g.destroy;g=g.tag,C!==void 0&&((g&2)!==0||(g&4)!==0)&&hc(a,n,C),f=f.next}while(f!==c)}yr(i,n,a);break;case 1:if(!At&&(Ln(a,n),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(T){rt(a,n,T)}yr(i,n,a);break;case 21:yr(i,n,a);break;case 22:a.mode&1?(At=(c=At)||a.memoizedState!==null,yr(i,n,a),At=c):yr(i,n,a);break;default:yr(i,n,a)}}function up(i){var n=i.updateQueue;if(n!==null){i.updateQueue=null;var a=i.stateNode;a===null&&(a=i.stateNode=new aS),n.forEach(function(c){var f=_S.bind(null,i,c);a.has(c)||(a.add(c),c.then(f,f))})}}function Li(i,n){var a=n.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];try{var g=i,C=n,T=C;e:for(;T!==null;){switch(T.tag){case 5:Dt=T.stateNode,Di=!1;break e;case 3:Dt=T.stateNode.containerInfo,Di=!0;break e;case 4:Dt=T.stateNode.containerInfo,Di=!0;break e}T=T.return}if(Dt===null)throw Error(r(160));cp(g,C,f),Dt=null,Di=!1;var H=f.alternate;H!==null&&(H.return=null),f.return=null}catch(ne){rt(f,n,ne)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)hp(n,i),n=n.sibling}function hp(i,n){var a=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Li(n,i),zi(i),c&4){try{xs(3,i,i.return),Ko(3,i)}catch(Ce){rt(i,i.return,Ce)}try{xs(5,i,i.return)}catch(Ce){rt(i,i.return,Ce)}}break;case 1:Li(n,i),zi(i),c&512&&a!==null&&Ln(a,a.return);break;case 5:if(Li(n,i),zi(i),c&512&&a!==null&&Ln(a,a.return),i.flags&32){var f=i.stateNode;try{ii(f,"")}catch(Ce){rt(i,i.return,Ce)}}if(c&4&&(f=i.stateNode,f!=null)){var g=i.memoizedProps,C=a!==null?a.memoizedProps:g,T=i.type,H=i.updateQueue;if(i.updateQueue=null,H!==null)try{T==="input"&&g.type==="radio"&&g.name!=null&&ot(f,g),Pt(T,C);var ne=Pt(T,g);for(C=0;C<H.length;C+=2){var he=H[C],fe=H[C+1];he==="style"?le(f,fe):he==="dangerouslySetInnerHTML"?Yi(f,fe):he==="children"?ii(f,fe):z(f,he,fe,ne)}switch(T){case"input":zt(f,g);break;case"textarea":Br(f,g);break;case"select":var ue=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var Se=g.value;Se!=null?ki(f,!!g.multiple,Se,!1):ue!==!!g.multiple&&(g.defaultValue!=null?ki(f,!!g.multiple,g.defaultValue,!0):ki(f,!!g.multiple,g.multiple?[]:"",!1))}f[fs]=g}catch(Ce){rt(i,i.return,Ce)}}break;case 6:if(Li(n,i),zi(i),c&4){if(i.stateNode===null)throw Error(r(162));f=i.stateNode,g=i.memoizedProps;try{f.nodeValue=g}catch(Ce){rt(i,i.return,Ce)}}break;case 3:if(Li(n,i),zi(i),c&4&&a!==null&&a.memoizedState.isDehydrated)try{is(n.containerInfo)}catch(Ce){rt(i,i.return,Ce)}break;case 4:Li(n,i),zi(i);break;case 13:Li(n,i),zi(i),f=i.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(_c=lt())),c&4&&up(i);break;case 22:if(he=a!==null&&a.memoizedState!==null,i.mode&1?(At=(ne=At)||he,Li(n,i),At=ne):Li(n,i),zi(i),c&8192){if(ne=i.memoizedState!==null,(i.stateNode.isHidden=ne)&&!he&&(i.mode&1)!==0)for(we=i,he=i.child;he!==null;){for(fe=we=he;we!==null;){switch(ue=we,Se=ue.child,ue.tag){case 0:case 11:case 14:case 15:xs(4,ue,ue.return);break;case 1:Ln(ue,ue.return);var be=ue.stateNode;if(typeof be.componentWillUnmount=="function"){c=ue,a=ue.return;try{n=c,be.props=n.memoizedProps,be.state=n.memoizedState,be.componentWillUnmount()}catch(Ce){rt(c,a,Ce)}}break;case 5:Ln(ue,ue.return);break;case 22:if(ue.memoizedState!==null){pp(fe);continue}}Se!==null?(Se.return=ue,we=Se):pp(fe)}he=he.sibling}e:for(he=null,fe=i;;){if(fe.tag===5){if(he===null){he=fe;try{f=fe.stateNode,ne?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(T=fe.stateNode,H=fe.memoizedProps.style,C=H!=null&&H.hasOwnProperty("display")?H.display:null,T.style.display=$e("display",C))}catch(Ce){rt(i,i.return,Ce)}}}else if(fe.tag===6){if(he===null)try{fe.stateNode.nodeValue=ne?"":fe.memoizedProps}catch(Ce){rt(i,i.return,Ce)}}else if((fe.tag!==22&&fe.tag!==23||fe.memoizedState===null||fe===i)&&fe.child!==null){fe.child.return=fe,fe=fe.child;continue}if(fe===i)break e;for(;fe.sibling===null;){if(fe.return===null||fe.return===i)break e;he===fe&&(he=null),fe=fe.return}he===fe&&(he=null),fe.sibling.return=fe.return,fe=fe.sibling}}break;case 19:Li(n,i),zi(i),c&4&&up(i);break;case 21:break;default:Li(n,i),zi(i)}}function zi(i){var n=i.flags;if(n&2){try{e:{for(var a=i.return;a!==null;){if(ap(a)){var c=a;break e}a=a.return}throw Error(r(160))}switch(c.tag){case 5:var f=c.stateNode;c.flags&32&&(ii(f,""),c.flags&=-33);var g=lp(i);pc(i,g,f);break;case 3:case 4:var C=c.stateNode.containerInfo,T=lp(i);fc(i,T,C);break;default:throw Error(r(161))}}catch(H){rt(i,i.return,H)}i.flags&=-3}n&4096&&(i.flags&=-4097)}function cS(i,n,a){we=i,dp(i)}function dp(i,n,a){for(var c=(i.mode&1)!==0;we!==null;){var f=we,g=f.child;if(f.tag===22&&c){var C=f.memoizedState!==null||qo;if(!C){var T=f.alternate,H=T!==null&&T.memoizedState!==null||At;T=qo;var ne=At;if(qo=C,(At=H)&&!ne)for(we=f;we!==null;)C=we,H=C.child,C.tag===22&&C.memoizedState!==null?mp(f):H!==null?(H.return=C,we=H):mp(f);for(;g!==null;)we=g,dp(g),g=g.sibling;we=f,qo=T,At=ne}fp(i)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,we=g):fp(i)}}function fp(i){for(;we!==null;){var n=we;if((n.flags&8772)!==0){var a=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:At||Ko(5,n);break;case 1:var c=n.stateNode;if(n.flags&4&&!At)if(a===null)c.componentDidMount();else{var f=n.elementType===n.type?a.memoizedProps:Pi(n.type,a.memoizedProps);c.componentDidUpdate(f,a.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var g=n.updateQueue;g!==null&&pf(n,g,c);break;case 3:var C=n.updateQueue;if(C!==null){if(a=null,n.child!==null)switch(n.child.tag){case 5:a=n.child.stateNode;break;case 1:a=n.child.stateNode}pf(n,C,a)}break;case 5:var T=n.stateNode;if(a===null&&n.flags&4){a=T;var H=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":H.autoFocus&&a.focus();break;case"img":H.src&&(a.src=H.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var ne=n.alternate;if(ne!==null){var he=ne.memoizedState;if(he!==null){var fe=he.dehydrated;fe!==null&&is(fe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}At||n.flags&512&&dc(n)}catch(ue){rt(n,n.return,ue)}}if(n===i){we=null;break}if(a=n.sibling,a!==null){a.return=n.return,we=a;break}we=n.return}}function pp(i){for(;we!==null;){var n=we;if(n===i){we=null;break}var a=n.sibling;if(a!==null){a.return=n.return,we=a;break}we=n.return}}function mp(i){for(;we!==null;){var n=we;try{switch(n.tag){case 0:case 11:case 15:var a=n.return;try{Ko(4,n)}catch(H){rt(n,a,H)}break;case 1:var c=n.stateNode;if(typeof c.componentDidMount=="function"){var f=n.return;try{c.componentDidMount()}catch(H){rt(n,f,H)}}var g=n.return;try{dc(n)}catch(H){rt(n,g,H)}break;case 5:var C=n.return;try{dc(n)}catch(H){rt(n,C,H)}}}catch(H){rt(n,n.return,H)}if(n===i){we=null;break}var T=n.sibling;if(T!==null){T.return=n.return,we=T;break}we=n.return}}var uS=Math.ceil,Vo=B.ReactCurrentDispatcher,mc=B.ReactCurrentOwner,yi=B.ReactCurrentBatchConfig,ze=0,wt=null,dt=null,Lt=0,ai=0,Mn=pr(0),gt=0,ks=null,Kr=0,Yo=0,gc=0,Es=null,Xt=null,_c=0,Tn=1/0,ir=null,Xo=!1,vc=null,Sr=null,Go=!1,wr=null,Qo=0,Ns=0,yc=null,Jo=-1,Zo=0;function $t(){return(ze&6)!==0?lt():Jo!==-1?Jo:Jo=lt()}function br(i){return(i.mode&1)===0?1:(ze&2)!==0&&Lt!==0?Lt&-Lt:Vy.transition!==null?(Zo===0&&(Zo=ad()),Zo):(i=We,i!==0||(i=window.event,i=i===void 0?16:gd(i.type)),i)}function Mi(i,n,a,c){if(50<Ns)throw Ns=0,yc=null,Error(r(185));Qn(i,a,c),((ze&2)===0||i!==wt)&&(i===wt&&((ze&2)===0&&(Yo|=a),gt===4&&Cr(i,Lt)),Gt(i,c),a===1&&ze===0&&(n.mode&1)===0&&(Tn=lt()+500,No&&gr()))}function Gt(i,n){var a=i.callbackNode;Vv(i,n);var c=ao(i,i===wt?Lt:0);if(c===0)a!==null&&nd(a),i.callbackNode=null,i.callbackPriority=0;else if(n=c&-c,i.callbackPriority!==n){if(a!=null&&nd(a),n===1)i.tag===0?Ky(_p.bind(null,i)):tf(_p.bind(null,i)),$y(function(){(ze&6)===0&&gr()}),a=null;else{switch(ld(c)){case 1:a=Ja;break;case 4:a=sd;break;case 16:a=ro;break;case 536870912:a=od;break;default:a=ro}a=kp(a,gp.bind(null,i))}i.callbackPriority=n,i.callbackNode=a}}function gp(i,n){if(Jo=-1,Zo=0,(ze&6)!==0)throw Error(r(327));var a=i.callbackNode;if(jn()&&i.callbackNode!==a)return null;var c=ao(i,i===wt?Lt:0);if(c===0)return null;if((c&30)!==0||(c&i.expiredLanes)!==0||n)n=ea(i,c);else{n=c;var f=ze;ze|=2;var g=yp();(wt!==i||Lt!==n)&&(ir=null,Tn=lt()+500,Yr(i,n));do try{fS();break}catch(T){vp(i,T)}while(!0);Al(),Vo.current=g,ze=f,dt!==null?n=0:(wt=null,Lt=0,n=gt)}if(n!==0){if(n===2&&(f=Za(i),f!==0&&(c=f,n=Sc(i,f))),n===1)throw a=ks,Yr(i,0),Cr(i,c),Gt(i,lt()),a;if(n===6)Cr(i,c);else{if(f=i.current.alternate,(c&30)===0&&!hS(f)&&(n=ea(i,c),n===2&&(g=Za(i),g!==0&&(c=g,n=Sc(i,g))),n===1))throw a=ks,Yr(i,0),Cr(i,c),Gt(i,lt()),a;switch(i.finishedWork=f,i.finishedLanes=c,n){case 0:case 1:throw Error(r(345));case 2:Xr(i,Xt,ir);break;case 3:if(Cr(i,c),(c&130023424)===c&&(n=_c+500-lt(),10<n)){if(ao(i,0)!==0)break;if(f=i.suspendedLanes,(f&c)!==c){$t(),i.pingedLanes|=i.suspendedLanes&f;break}i.timeoutHandle=El(Xr.bind(null,i,Xt,ir),n);break}Xr(i,Xt,ir);break;case 4:if(Cr(i,c),(c&4194240)===c)break;for(n=i.eventTimes,f=-1;0<c;){var C=31-Ei(c);g=1<<C,C=n[C],C>f&&(f=C),c&=~g}if(c=f,c=lt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*uS(c/1960))-c,10<c){i.timeoutHandle=El(Xr.bind(null,i,Xt,ir),c);break}Xr(i,Xt,ir);break;case 5:Xr(i,Xt,ir);break;default:throw Error(r(329))}}}return Gt(i,lt()),i.callbackNode===a?gp.bind(null,i):null}function Sc(i,n){var a=Es;return i.current.memoizedState.isDehydrated&&(Yr(i,n).flags|=256),i=ea(i,n),i!==2&&(n=Xt,Xt=a,n!==null&&wc(n)),i}function wc(i){Xt===null?Xt=i:Xt.push.apply(Xt,i)}function hS(i){for(var n=i;;){if(n.flags&16384){var a=n.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var c=0;c<a.length;c++){var f=a[c],g=f.getSnapshot;f=f.value;try{if(!Ni(g(),f))return!1}catch{return!1}}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Cr(i,n){for(n&=~gc,n&=~Yo,i.suspendedLanes|=n,i.pingedLanes&=~n,i=i.expirationTimes;0<n;){var a=31-Ei(n),c=1<<a;i[a]=-1,n&=~c}}function _p(i){if((ze&6)!==0)throw Error(r(327));jn();var n=ao(i,0);if((n&1)===0)return Gt(i,lt()),null;var a=ea(i,n);if(i.tag!==0&&a===2){var c=Za(i);c!==0&&(n=c,a=Sc(i,c))}if(a===1)throw a=ks,Yr(i,0),Cr(i,n),Gt(i,lt()),a;if(a===6)throw Error(r(345));return i.finishedWork=i.current.alternate,i.finishedLanes=n,Xr(i,Xt,ir),Gt(i,lt()),null}function bc(i,n){var a=ze;ze|=1;try{return i(n)}finally{ze=a,ze===0&&(Tn=lt()+500,No&&gr())}}function Vr(i){wr!==null&&wr.tag===0&&(ze&6)===0&&jn();var n=ze;ze|=1;var a=yi.transition,c=We;try{if(yi.transition=null,We=1,i)return i()}finally{We=c,yi.transition=a,ze=n,(ze&6)===0&&gr()}}function Cc(){ai=Mn.current,Ve(Mn)}function Yr(i,n){i.finishedWork=null,i.finishedLanes=0;var a=i.timeoutHandle;if(a!==-1&&(i.timeoutHandle=-1,Hy(a)),dt!==null)for(a=dt.return;a!==null;){var c=a;switch(Ml(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ko();break;case 3:Pn(),Ve(Kt),Ve(jt),ql();break;case 5:Wl(c);break;case 4:Pn();break;case 13:Ve(Ze);break;case 19:Ve(Ze);break;case 10:Ol(c.type._context);break;case 22:case 23:Cc()}a=a.return}if(wt=i,dt=i=xr(i.current,null),Lt=ai=n,gt=0,ks=null,gc=Yo=Kr=0,Xt=Es=null,Wr!==null){for(n=0;n<Wr.length;n++)if(a=Wr[n],c=a.interleaved,c!==null){a.interleaved=null;var f=c.next,g=a.pending;if(g!==null){var C=g.next;g.next=f,c.next=C}a.pending=c}Wr=null}return i}function vp(i,n){do{var a=dt;try{if(Al(),Ao.current=Ho,Oo){for(var c=et.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Oo=!1}if(qr=0,St=mt=et=null,ys=!1,Ss=0,mc.current=null,a===null||a.return===null){gt=1,ks=n,dt=null;break}e:{var g=i,C=a.return,T=a,H=n;if(n=Lt,T.flags|=32768,H!==null&&typeof H=="object"&&typeof H.then=="function"){var ne=H,he=T,fe=he.tag;if((he.mode&1)===0&&(fe===0||fe===11||fe===15)){var ue=he.alternate;ue?(he.updateQueue=ue.updateQueue,he.memoizedState=ue.memoizedState,he.lanes=ue.lanes):(he.updateQueue=null,he.memoizedState=null)}var Se=Wf(C);if(Se!==null){Se.flags&=-257,Uf(Se,C,T,g,n),Se.mode&1&&$f(g,ne,n),n=Se,H=ne;var be=n.updateQueue;if(be===null){var Ce=new Set;Ce.add(H),n.updateQueue=Ce}else be.add(H);break e}else{if((n&1)===0){$f(g,ne,n),xc();break e}H=Error(r(426))}}else if(Qe&&T.mode&1){var ct=Wf(C);if(ct!==null){(ct.flags&65536)===0&&(ct.flags|=256),Uf(ct,C,T,g,n),Bl(Dn(H,T));break e}}g=H=Dn(H,T),gt!==4&&(gt=2),Es===null?Es=[g]:Es.push(g),g=C;do{switch(g.tag){case 3:g.flags|=65536,n&=-n,g.lanes|=n;var Z=Ff(g,H,n);ff(g,Z);break e;case 1:T=H;var K=g.type,te=g.stateNode;if((g.flags&128)===0&&(typeof K.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(Sr===null||!Sr.has(te)))){g.flags|=65536,n&=-n,g.lanes|=n;var ge=Hf(g,T,n);ff(g,ge);break e}}g=g.return}while(g!==null)}wp(a)}catch(ke){n=ke,dt===a&&a!==null&&(dt=a=a.return);continue}break}while(!0)}function yp(){var i=Vo.current;return Vo.current=Ho,i===null?Ho:i}function xc(){(gt===0||gt===3||gt===2)&&(gt=4),wt===null||(Kr&268435455)===0&&(Yo&268435455)===0||Cr(wt,Lt)}function ea(i,n){var a=ze;ze|=2;var c=yp();(wt!==i||Lt!==n)&&(ir=null,Yr(i,n));do try{dS();break}catch(f){vp(i,f)}while(!0);if(Al(),ze=a,Vo.current=c,dt!==null)throw Error(r(261));return wt=null,Lt=0,gt}function dS(){for(;dt!==null;)Sp(dt)}function fS(){for(;dt!==null&&!Ov();)Sp(dt)}function Sp(i){var n=xp(i.alternate,i,ai);i.memoizedProps=i.pendingProps,n===null?wp(i):dt=n,mc.current=null}function wp(i){var n=i;do{var a=n.alternate;if(i=n.return,(n.flags&32768)===0){if(a=sS(a,n,ai),a!==null){dt=a;return}}else{if(a=oS(a,n),a!==null){a.flags&=32767,dt=a;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{gt=6,dt=null;return}}if(n=n.sibling,n!==null){dt=n;return}dt=n=i}while(n!==null);gt===0&&(gt=5)}function Xr(i,n,a){var c=We,f=yi.transition;try{yi.transition=null,We=1,pS(i,n,a,c)}finally{yi.transition=f,We=c}return null}function pS(i,n,a,c){do jn();while(wr!==null);if((ze&6)!==0)throw Error(r(327));a=i.finishedWork;var f=i.finishedLanes;if(a===null)return null;if(i.finishedWork=null,i.finishedLanes=0,a===i.current)throw Error(r(177));i.callbackNode=null,i.callbackPriority=0;var g=a.lanes|a.childLanes;if(Yv(i,g),i===wt&&(dt=wt=null,Lt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Go||(Go=!0,kp(ro,function(){return jn(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=yi.transition,yi.transition=null;var C=We;We=1;var T=ze;ze|=4,mc.current=null,lS(i,a),hp(a,i),jy(xl),uo=!!Cl,xl=Cl=null,i.current=a,cS(a),zv(),ze=T,We=C,yi.transition=g}else i.current=a;if(Go&&(Go=!1,wr=i,Qo=f),g=i.pendingLanes,g===0&&(Sr=null),$v(a.stateNode),Gt(i,lt()),n!==null)for(c=i.onRecoverableError,a=0;a<n.length;a++)f=n[a],c(f.value,{componentStack:f.stack,digest:f.digest});if(Xo)throw Xo=!1,i=vc,vc=null,i;return(Qo&1)!==0&&i.tag!==0&&jn(),g=i.pendingLanes,(g&1)!==0?i===yc?Ns++:(Ns=0,yc=i):Ns=0,gr(),null}function jn(){if(wr!==null){var i=ld(Qo),n=yi.transition,a=We;try{if(yi.transition=null,We=16>i?16:i,wr===null)var c=!1;else{if(i=wr,wr=null,Qo=0,(ze&6)!==0)throw Error(r(331));var f=ze;for(ze|=4,we=i.current;we!==null;){var g=we,C=g.child;if((we.flags&16)!==0){var T=g.deletions;if(T!==null){for(var H=0;H<T.length;H++){var ne=T[H];for(we=ne;we!==null;){var he=we;switch(he.tag){case 0:case 11:case 15:xs(8,he,g)}var fe=he.child;if(fe!==null)fe.return=he,we=fe;else for(;we!==null;){he=we;var ue=he.sibling,Se=he.return;if(op(he),he===ne){we=null;break}if(ue!==null){ue.return=Se,we=ue;break}we=Se}}}var be=g.alternate;if(be!==null){var Ce=be.child;if(Ce!==null){be.child=null;do{var ct=Ce.sibling;Ce.sibling=null,Ce=ct}while(Ce!==null)}}we=g}}if((g.subtreeFlags&2064)!==0&&C!==null)C.return=g,we=C;else e:for(;we!==null;){if(g=we,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:xs(9,g,g.return)}var Z=g.sibling;if(Z!==null){Z.return=g.return,we=Z;break e}we=g.return}}var K=i.current;for(we=K;we!==null;){C=we;var te=C.child;if((C.subtreeFlags&2064)!==0&&te!==null)te.return=C,we=te;else e:for(C=K;we!==null;){if(T=we,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Ko(9,T)}}catch(ke){rt(T,T.return,ke)}if(T===C){we=null;break e}var ge=T.sibling;if(ge!==null){ge.return=T.return,we=ge;break e}we=T.return}}if(ze=f,gr(),Bi&&typeof Bi.onPostCommitFiberRoot=="function")try{Bi.onPostCommitFiberRoot(no,i)}catch{}c=!0}return c}finally{We=a,yi.transition=n}}return!1}function bp(i,n,a){n=Dn(a,n),n=Ff(i,n,1),i=vr(i,n,1),n=$t(),i!==null&&(Qn(i,1,n),Gt(i,n))}function rt(i,n,a){if(i.tag===3)bp(i,i,a);else for(;n!==null;){if(n.tag===3){bp(n,i,a);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Sr===null||!Sr.has(c))){i=Dn(a,i),i=Hf(n,i,1),n=vr(n,i,1),i=$t(),n!==null&&(Qn(n,1,i),Gt(n,i));break}}n=n.return}}function mS(i,n,a){var c=i.pingCache;c!==null&&c.delete(n),n=$t(),i.pingedLanes|=i.suspendedLanes&a,wt===i&&(Lt&a)===a&&(gt===4||gt===3&&(Lt&130023424)===Lt&&500>lt()-_c?Yr(i,0):gc|=a),Gt(i,n)}function Cp(i,n){n===0&&((i.mode&1)===0?n=1:(n=oo,oo<<=1,(oo&130023424)===0&&(oo=4194304)));var a=$t();i=Zi(i,n),i!==null&&(Qn(i,n,a),Gt(i,a))}function gS(i){var n=i.memoizedState,a=0;n!==null&&(a=n.retryLane),Cp(i,a)}function _S(i,n){var a=0;switch(i.tag){case 13:var c=i.stateNode,f=i.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(n),Cp(i,a)}var xp;xp=function(i,n,a){if(i!==null)if(i.memoizedProps!==n.pendingProps||Kt.current)Yt=!0;else{if((i.lanes&a)===0&&(n.flags&128)===0)return Yt=!1,nS(i,n,a);Yt=(i.flags&131072)!==0}else Yt=!1,Qe&&(n.flags&1048576)!==0&&rf(n,Po,n.index);switch(n.lanes=0,n.tag){case 2:var c=n.type;Uo(i,n),i=n.pendingProps;var f=bn(n,jt.current);Rn(n,a),f=Yl(null,n,c,i,f,a);var g=Xl();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Vt(c)?(g=!0,Eo(n)):g=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Hl(n),f.updater=$o,n.stateNode=f,f._reactInternals=n,tc(n,c,i,a),n=sc(null,n,c,!0,g,a)):(n.tag=0,Qe&&g&&Ll(n),Ht(null,n,f,a),n=n.child),n;case 16:c=n.elementType;e:{switch(Uo(i,n),i=n.pendingProps,f=c._init,c=f(c._payload),n.type=c,f=n.tag=yS(c),i=Pi(c,i),f){case 0:n=nc(null,n,c,i,a);break e;case 1:n=Gf(null,n,c,i,a);break e;case 11:n=qf(null,n,c,i,a);break e;case 14:n=Kf(null,n,c,Pi(c.type,i),a);break e}throw Error(r(306,c,""))}return n;case 0:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),nc(i,n,c,f,a);case 1:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),Gf(i,n,c,f,a);case 3:e:{if(Qf(n),i===null)throw Error(r(387));c=n.pendingProps,g=n.memoizedState,f=g.element,df(i,n),Bo(n,c,null,a);var C=n.memoizedState;if(c=C.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){f=Dn(Error(r(423)),n),n=Jf(i,n,c,a,f);break e}else if(c!==f){f=Dn(Error(r(424)),n),n=Jf(i,n,c,a,f);break e}else for(oi=fr(n.stateNode.containerInfo.firstChild),si=n,Qe=!0,Ri=null,a=uf(n,null,c,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(kn(),c===f){n=tr(i,n,a);break e}Ht(i,n,c,a)}n=n.child}return n;case 5:return mf(n),i===null&&jl(n),c=n.type,f=n.pendingProps,g=i!==null?i.memoizedProps:null,C=f.children,kl(c,f)?C=null:g!==null&&kl(c,g)&&(n.flags|=32),Xf(i,n),Ht(i,n,C,a),n.child;case 6:return i===null&&jl(n),null;case 13:return Zf(i,n,a);case 4:return $l(n,n.stateNode.containerInfo),c=n.pendingProps,i===null?n.child=En(n,null,c,a):Ht(i,n,c,a),n.child;case 11:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),qf(i,n,c,f,a);case 7:return Ht(i,n,n.pendingProps,a),n.child;case 8:return Ht(i,n,n.pendingProps.children,a),n.child;case 12:return Ht(i,n,n.pendingProps.children,a),n.child;case 10:e:{if(c=n.type._context,f=n.pendingProps,g=n.memoizedProps,C=f.value,qe(Mo,c._currentValue),c._currentValue=C,g!==null)if(Ni(g.value,C)){if(g.children===f.children&&!Kt.current){n=tr(i,n,a);break e}}else for(g=n.child,g!==null&&(g.return=n);g!==null;){var T=g.dependencies;if(T!==null){C=g.child;for(var H=T.firstContext;H!==null;){if(H.context===c){if(g.tag===1){H=er(-1,a&-a),H.tag=2;var ne=g.updateQueue;if(ne!==null){ne=ne.shared;var he=ne.pending;he===null?H.next=H:(H.next=he.next,he.next=H),ne.pending=H}}g.lanes|=a,H=g.alternate,H!==null&&(H.lanes|=a),zl(g.return,a,n),T.lanes|=a;break}H=H.next}}else if(g.tag===10)C=g.type===n.type?null:g.child;else if(g.tag===18){if(C=g.return,C===null)throw Error(r(341));C.lanes|=a,T=C.alternate,T!==null&&(T.lanes|=a),zl(C,a,n),C=g.sibling}else C=g.child;if(C!==null)C.return=g;else for(C=g;C!==null;){if(C===n){C=null;break}if(g=C.sibling,g!==null){g.return=C.return,C=g;break}C=C.return}g=C}Ht(i,n,f.children,a),n=n.child}return n;case 9:return f=n.type,c=n.pendingProps.children,Rn(n,a),f=_i(f),c=c(f),n.flags|=1,Ht(i,n,c,a),n.child;case 14:return c=n.type,f=Pi(c,n.pendingProps),f=Pi(c.type,f),Kf(i,n,c,f,a);case 15:return Vf(i,n,n.type,n.pendingProps,a);case 17:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),Uo(i,n),n.tag=1,Vt(c)?(i=!0,Eo(n)):i=!1,Rn(n,a),Of(n,c,f),tc(n,c,f,a),sc(null,n,c,!0,i,a);case 19:return tp(i,n,a);case 22:return Yf(i,n,a)}throw Error(r(156,n.tag))};function kp(i,n){return rd(i,n)}function vS(i,n,a,c){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Si(i,n,a,c){return new vS(i,n,a,c)}function kc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function yS(i){if(typeof i=="function")return kc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===k)return 11;if(i===Y)return 14}return 2}function xr(i,n){var a=i.alternate;return a===null?(a=Si(i.tag,n,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=n,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&14680064,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,n=i.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a}function ta(i,n,a,c,f,g){var C=2;if(c=i,typeof i=="function")kc(i)&&(C=1);else if(typeof i=="string")C=5;else e:switch(i){case I:return Gr(a.children,f,g,n);case V:C=8,f|=8;break;case U:return i=Si(12,a,n,f|2),i.elementType=U,i.lanes=g,i;case D:return i=Si(13,a,n,f),i.elementType=D,i.lanes=g,i;case j:return i=Si(19,a,n,f),i.elementType=j,i.lanes=g,i;case Q:return ia(a,f,g,n);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case ie:C=10;break e;case ee:C=9;break e;case k:C=11;break e;case Y:C=14;break e;case F:C=16,c=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return n=Si(C,a,n,f),n.elementType=i,n.type=c,n.lanes=g,n}function Gr(i,n,a,c){return i=Si(7,i,c,n),i.lanes=a,i}function ia(i,n,a,c){return i=Si(22,i,c,n),i.elementType=Q,i.lanes=a,i.stateNode={isHidden:!1},i}function Ec(i,n,a){return i=Si(6,i,null,n),i.lanes=a,i}function Nc(i,n,a){return n=Si(4,i.children!==null?i.children:[],i.key,n),n.lanes=a,n.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},n}function SS(i,n,a,c,f){this.tag=n,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=el(0),this.expirationTimes=el(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=el(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Rc(i,n,a,c,f,g,C,T,H){return i=new SS(i,n,a,T,H),n===1?(n=1,g===!0&&(n|=8)):n=0,g=Si(3,null,null,n),i.current=g,g.stateNode=i,g.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hl(g),i}function wS(i,n,a){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:c==null?null:""+c,children:i,containerInfo:n,implementation:a}}function Ep(i){if(!i)return mr;i=i._reactInternals;e:{if(Or(i)!==i||i.tag!==1)throw Error(r(170));var n=i;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Vt(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(i.tag===1){var a=i.type;if(Vt(a))return Zd(i,a,n)}return n}function Np(i,n,a,c,f,g,C,T,H){return i=Rc(a,c,!0,i,f,g,C,T,H),i.context=Ep(null),a=i.current,c=$t(),f=br(a),g=er(c,f),g.callback=n??null,vr(a,g,f),i.current.lanes=f,Qn(i,f,c),Gt(i,c),i}function ra(i,n,a,c){var f=n.current,g=$t(),C=br(f);return a=Ep(a),n.context===null?n.context=a:n.pendingContext=a,n=er(g,C),n.payload={element:i},c=c===void 0?null:c,c!==null&&(n.callback=c),i=vr(f,n,C),i!==null&&(Mi(i,f,C,g),jo(i,f,C)),C}function na(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function Rp(i,n){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<n?a:n}}function Pc(i,n){Rp(i,n),(i=i.alternate)&&Rp(i,n)}function bS(){return null}var Pp=typeof reportError=="function"?reportError:function(i){console.error(i)};function Dc(i){this._internalRoot=i}sa.prototype.render=Dc.prototype.render=function(i){var n=this._internalRoot;if(n===null)throw Error(r(409));ra(i,n,null,null)},sa.prototype.unmount=Dc.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var n=i.containerInfo;Vr(function(){ra(null,i,null,null)}),n[Xi]=null}};function sa(i){this._internalRoot=i}sa.prototype.unstable_scheduleHydration=function(i){if(i){var n=hd();i={blockedOn:null,target:i,priority:n};for(var a=0;a<ur.length&&n!==0&&n<ur[a].priority;a++);ur.splice(a,0,i),a===0&&pd(i)}};function Lc(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function oa(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Dp(){}function CS(i,n,a,c,f){if(f){if(typeof c=="function"){var g=c;c=function(){var ne=na(C);g.call(ne)}}var C=Np(n,c,i,0,null,!1,!1,"",Dp);return i._reactRootContainer=C,i[Xi]=C.current,hs(i.nodeType===8?i.parentNode:i),Vr(),C}for(;f=i.lastChild;)i.removeChild(f);if(typeof c=="function"){var T=c;c=function(){var ne=na(H);T.call(ne)}}var H=Rc(i,0,!1,null,null,!1,!1,"",Dp);return i._reactRootContainer=H,i[Xi]=H.current,hs(i.nodeType===8?i.parentNode:i),Vr(function(){ra(n,H,a,c)}),H}function aa(i,n,a,c,f){var g=a._reactRootContainer;if(g){var C=g;if(typeof f=="function"){var T=f;f=function(){var H=na(C);T.call(H)}}ra(n,C,i,f)}else C=CS(a,n,i,f,c);return na(C)}cd=function(i){switch(i.tag){case 3:var n=i.stateNode;if(n.current.memoizedState.isDehydrated){var a=Gn(n.pendingLanes);a!==0&&(tl(n,a|1),Gt(n,lt()),(ze&6)===0&&(Tn=lt()+500,gr()))}break;case 13:Vr(function(){var c=Zi(i,1);if(c!==null){var f=$t();Mi(c,i,1,f)}}),Pc(i,1)}},il=function(i){if(i.tag===13){var n=Zi(i,134217728);if(n!==null){var a=$t();Mi(n,i,134217728,a)}Pc(i,134217728)}},ud=function(i){if(i.tag===13){var n=br(i),a=Zi(i,n);if(a!==null){var c=$t();Mi(a,i,n,c)}Pc(i,n)}},hd=function(){return We},dd=function(i,n){var a=We;try{return We=i,n()}finally{We=a}},Ya=function(i,n,a){switch(n){case"input":if(zt(i,a),n=a.name,a.type==="radio"&&n!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<a.length;n++){var c=a[n];if(c!==i&&c.form===i.form){var f=xo(c);if(!f)throw Error(r(90));oe(c),zt(c,f)}}}break;case"textarea":Br(i,a);break;case"select":n=a.value,n!=null&&ki(i,!!a.multiple,n,!1)}},Gh=bc,Qh=Vr;var xS={usingClientEntryPoint:!1,Events:[ps,Sn,xo,Yh,Xh,bc]},Rs={findFiberByHostInstance:zr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},kS={bundleType:Rs.bundleType,version:Rs.version,rendererPackageName:Rs.rendererPackageName,rendererConfig:Rs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:B.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=td(i),i===null?null:i.stateNode},findFiberByHostInstance:Rs.findFiberByHostInstance||bS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var la=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!la.isDisabled&&la.supportsFiber)try{no=la.inject(kS),Bi=la}catch{}}return Qt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xS,Qt.createPortal=function(i,n){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lc(n))throw Error(r(200));return wS(i,n,null,a)},Qt.createRoot=function(i,n){if(!Lc(i))throw Error(r(299));var a=!1,c="",f=Pp;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),n=Rc(i,1,!1,null,null,a,!1,c,f),i[Xi]=n.current,hs(i.nodeType===8?i.parentNode:i),new Dc(n)},Qt.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var n=i._reactInternals;if(n===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=td(n),i=i===null?null:i.stateNode,i},Qt.flushSync=function(i){return Vr(i)},Qt.hydrate=function(i,n,a){if(!oa(n))throw Error(r(200));return aa(null,i,n,!0,a)},Qt.hydrateRoot=function(i,n,a){if(!Lc(i))throw Error(r(405));var c=a!=null&&a.hydratedSources||null,f=!1,g="",C=Pp;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),n=Np(n,null,i,1,a??null,f,!1,g,C),i[Xi]=n.current,hs(i),c)for(i=0;i<c.length;i++)a=c[i],f=a._getVersion,f=f(a._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[a,f]:n.mutableSourceEagerHydrationData.push(a,f);return new sa(n)},Qt.render=function(i,n,a){if(!oa(n))throw Error(r(200));return aa(null,i,n,!1,a)},Qt.unmountComponentAtNode=function(i){if(!oa(i))throw Error(r(40));return i._reactRootContainer?(Vr(function(){aa(null,null,i,!1,function(){i._reactRootContainer=null,i[Xi]=null})}),!0):!1},Qt.unstable_batchedUpdates=bc,Qt.unstable_renderSubtreeIntoContainer=function(i,n,a,c){if(!oa(a))throw Error(r(200));if(i==null||i._reactInternals===void 0)throw Error(r(38));return aa(i,n,a,!1,c)},Qt.version="18.3.1-next-f1338f8080-20240426",Qt}var Op;function jS(){if(Op)return jc.exports;Op=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),jc.exports=TS(),jc.exports}var zp;function BS(){if(zp)return ca;zp=1;var e=jS();return ca.createRoot=e.createRoot,ca.hydrateRoot=e.hydrateRoot,ca}var IS=BS();const AS=bh(IS);function Nt(e,t,r={}){return fetch(e,{...r,headers:{...r.headers||{},Authorization:`Bearer ${t}`}})}const Xg=e=>`nc_seen_${e}`;async function Te(e,t,r={}){const s=await Nt(e,t,{method:r.method||"GET",headers:{"content-type":"application/json"},body:r.body?JSON.stringify(r.body):void 0}),o=await s.json().catch(()=>({}));if(!s.ok){const l=new Error(o.error||`HTTP ${s.status}`);throw l.status=s.status,l.data=o,l}return o}const di=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",fi=(e,t)=>`${di(e)}/fleet/${t}`,an=(e,t)=>Te(fi(t,"status"),e),xh=(e,t,r)=>Te(fi(r,"up"),e,{method:"POST",body:t}),Pa=(e,t,r)=>Te(fi(r,"down"),e,{method:"POST",body:t}),wa=(e,t,r)=>Te(fi(r,"restart"),e,{method:"POST",body:{cell:t}}),kh=(e,t)=>Te(fi(t,"definitions"),e),OS=(e,t,r)=>Te(fi(r,"define-engine"),e,{method:"POST",body:{def:t}}),zS=(e,t,r,s,o)=>Te(fi(o,"edit-engine"),e,{method:"POST",body:{id:t,patch:r,envChanges:s}}),FS=(e,t,r)=>Te(fi(r,"remove-engine"),e,{method:"POST",body:{id:t}}),HS=(e,t,r)=>Te(fi(r,"define-cell"),e,{method:"POST",body:{def:t}}),$S=(e,t,r,s)=>Te(fi(s,"edit-cell"),e,{method:"POST",body:{id:t,patch:r}}),Gg=(e,t,r=!1,s)=>Te(fi(s,"remove-cell"),e,{method:"POST",body:{id:t,stop:r}}),WS=(e,t,r)=>Te(fi(r,"import-cell"),e,{method:"POST",body:t}),US=(e,t,r)=>Te(fi(r,"restore-cells"),e,{method:"POST",body:{cells:t}}),Eh=(e,t,r)=>Te(`${di(r)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),Qg=(e,t,r)=>Te(`${di(r)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),Jg=e=>Te("/api/settings",e),Zg=e=>Te("/api/nodes",e),qS=e=>Te("/api/topology",e),e_=(e,t)=>Te(`${di(t)}/sessions`,e),Nh=(e,t)=>Te(`${di(t)}/config`,e),Fp=(e,t)=>Te(`${di(t)}/topology`,e),t_=(e,t)=>Te("/api/settings/config",e,{method:"POST",body:t}),KS=e=>Te("/api/settings/token/rotate",e,{method:"POST"}),VS=(e,t)=>Te("/api/settings/nodes/pair",e,{method:"POST",body:t}),Hp=(e,t,r=[])=>Te(`${di(r)}/settings/peering/invite`,e,{method:"POST",body:t||{}}),YS=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:r}}),XS=(e,t)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),Rh=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/${r}`,e,{method:"POST"}),GS=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/share`,e,{method:"PATCH",body:{shared:r}}),$p=(e,t,r,s=[])=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:r,selected:s}}),QS=e=>Te("/api/settings/service/regenerate",e,{method:"POST"}),JS=e=>Te("/api/settings/update/check",e,{method:"POST"}),ZS=e=>Te("/api/settings/update/apply",e,{method:"POST"}),ew=(e,t=!0)=>Te(`/api/asks${t?"?open=1":""}`,e),tw=(e,t,r)=>Te(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:r}}),ua=(e,t=[])=>Te(`${di(t)}/decks`,e),Wp=(e,t,r=[])=>Te(`${di(r)}/decks`,e,{method:"POST",body:{name:t}}),ha=(e,t,r,s,o=[])=>Te(`${di(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:r,expectedRevision:s}}),iw=(e,t,r,s,o=[])=>Te(`${di(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:r,expectedRevision:s}}),rw=(e,t,r,s=[])=>Te(`${di(s)}/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:r}}),nw={power:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3v8"}),h.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:h.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L12.4 6H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"}),keyboard:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),h.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),h.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),h.jsx("path",{d:"M12 18v3"})]}),enter:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),h.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),h.jsx("path",{d:"M22 2 11 13"})]}),trash:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M4 7h16"}),h.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),h.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),h.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:h.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),h.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 16V5"}),h.jsx("polyline",{points:"8 9 12 5 16 9"}),h.jsx("path",{d:"M5 20h14"})]}),chevronLeft:h.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:h.jsx("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"}),file:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14.5 4h-5L7.5 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.5z"}),h.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),h.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),h.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6"})]}),gear:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),copy:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function He({name:e,size:t=20}){return h.jsx("svg",{className:"nc-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:nw[e]||null})}const i_="nc_pins";function r_(){try{const e=JSON.parse(localStorage.getItem(i_));return Array.isArray(e)?e:[]}catch{return[]}}function n_(e,t){const r=e.includes(t)?e.filter(s=>s!==t):[...e,t];try{localStorage.setItem(i_,JSON.stringify(r))}catch{}return r}function zs(e,t,r){const s=e.indexOf(t);return[s===-1?1e9:s,-(r||0)]}function Eu(e,t){return e[0]-t[0]||e[1]-t[1]}const Ph=["it","en","es"];function sw(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Ph.includes(t)?t:"en"}catch{return"en"}}const ba=sw(),s_="nc_lang",Nu="nc-lang";function o_(){return typeof localStorage<"u"?localStorage:null}const da={it:{"update-available":"nuova versione {v} disponibile","install-version-mismatch":"installazione incompleta: frontend e server non coincidono (v{v})",reload:"ricarica","grid-empty":"trascina qui una sessione dalla sidebar, o doppio-clic per la vista singola","grid-full":"il deck può mostrare al massimo 9 sessioni",pin:"fissa in cima",sessions:"sessioni","new-session":"nuova sessione",new:"nuova",fleet:"Flotta","fleet-tmux":"flotta tmux","other-sessions":"Altre sessioni","view-all":"tutte","view-pinned":"fissate","view-active":"attive","view-off":"spente","position-local":"Locale",files:"file",refresh:"aggiorna","filter-placeholder":"filtra sessioni…","loading-fleet":"carico la flotta…","no-sessions":"nessuna sessione tmux viva — la flotta parte al boot (systemd)","no-match":'nessuna sessione contiene "{q}"',"copy-url":"clicca per copiare l'URL","ssh-only":"solo tunnel SSH/VPN","new-files-outbox":"nuovi file in outbox",terminate:"termina","terminate-confirm":'Terminare la sessione "{name}"?',"cell-on":"tmux vivo","cell-off":"spenta","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","state-on":"accesa","state-off":"spenta",engine:"Engine",model:"Modello","model-default":"Modello predefinito del provider","model-remembered":"Ultimo modello usato con questo engine","boot-persist":"avvia al boot","remove-boot":"togli anche dal boot","power-config-in-settings":"Engine, provider, profilo, modello e permessi si modificano in Impostazioni → Flotta.","no-remote-control":"⚠ engine non-native: niente RC da app claude.ai (da qui la piloti comunque)",cancel:"annulla",name:"nome","name-invalid":"nome non valido: a-zA-Z0-9._- max 64, senza '-' iniziale",cwd:"cartella",browse:"sfoglia","fs-home":"home","fs-parent":".. su",preset:"preset","preset-2x2":"griglia 2×2","preset-columns":"colonne","preset-equalize":"equalizza",collapse:"comprimi",expand:"espandi",create:"crea","auth-prompt":"Incolla il token (stampato dal server):","remember-device":"ricorda su questo device","zoom-out":"testo più piccolo","zoom-in":"testo più grande",composer:"composer",windows:"{n} finestre","empty-files":"vuota",upload:"carica","no-sessions-short":"nessuna sessione","composer-placeholder":"scrivi o detta…",attach:"allega","attach-file":"File","attach-camera":"Fotocamera","attach-gallery":"Galleria","attach-uploading":"carico…","attach-upload-progress":"allegato {n}/{total}…","attach-uploaded":"{n} allegati caricati",voice:"voice",send:"invia","composer-send-failed":"connessione non pronta — testo conservato, riprova",close:"chiudi","lang-label":"lingua",decks:"deck","new-deck":"nuovo deck","deck-name":"nome deck","open-deck-window":"apri in una nuova finestra","detach-deck":"stacca in una nuova finestra","deck-current":"questo deck (finestra corrente)","deck-owner-unavailable":"nodo owner non condiviso o non raggiungibile","rename-deck":"rinomina deck","delete-deck":"elimina deck","delete-deck-confirm":'Eliminare il deck "{name}"?',"send-to-deck":"manda al deck…","deck-autosave":"salvataggio automatico",saving:"salvataggio…",saved:"salvato","popup-blocked":"popup bloccato: apri qui","select-drag":"trascina per selezionare","copy-manual":"seleziona e copia manualmente","toggle-sidebar":"mostra/nascondi la barra laterale",settings:"impostazioni","tab-roles":"ruoli","tab-nodes":"nodi",local:"Locale",location:"Dove","pairing-link":"link di pairing","pairing-required":"nome, alias SSH e link di pairing sono obbligatori","pairing-connect-help":"Per collegare un nodo servono: nome, Host SSH già funzionante e link/QR creato sull’altra installazione NexusCrew.","pairing-localhost-hint":"127.0.0.1 nel link è corretto: non aprirlo qui. NexusCrew usa invito e porta attraverso l’Host SSH.","scan-qr":"scansiona QR","pairing-qr-invalid":"QR di pairing non valido","invite-node":"invita un nodo","create-pairing-link":"crea link / QR","visibility-network":"tutta la rete","visibility-relay":"solo relay","visibility-selected":"nodi selezionati","hydra-simple":"locale + nodi, una sola rete","local-ready":"Questo dispositivo è pronto. Puoi usarlo da solo o collegarlo a un nodo.","local-only":"solo locale","add-node":"aggiungi nodo",connect:"collega","node-connected":"Nodo collegato. La rete verrà sincronizzata automaticamente.","tab-system":"sistema","tab-fleet":"flotta","fleet-editor-unavailable":"Editor disponibile solo con il provider fleet builtin.","fleet-managed":"gestito da NexusCrew","fleet-custom":"comando personalizzato","fleet-managed-help":"Client, provider e avvio sono gestiti internamente; i segreti non vengono mostrati.","fleet-model-default":"modello predefinito (opzionale)","fleet-model-required":"modello (obbligatorio)","fleet-standard-permissions":"permessi standard","fleet-unsafe-permissions":"non sicuro · ignora approvazioni/sandbox","fleet-unsafe-warning":"Modalità non sicura esplicita: il worker può agire senza le normali approvazioni o protezioni sandbox.","fleet-provider-display":"nome visualizzato del provider","fleet-custom-provider-default":"Provider personalizzato","fleet-api-key-env":"NOME_VARIABILE_API_KEY","fleet-provider-id":"id-provider","fleet-custom-secret-help":"NexusCrew salva solo il nome della variabile d’ambiente, mai il suo valore.","fleet-model-override":"modello alternativo","fleet-ready":"pronto","fleet-not-ready":"non configurato","fleet-engines":"Engine","fleet-cells":"Celle / sessioni cloud","fleet-backup":"backup / ripristino","fleet-backup-help":"Esporta o ripristina selettivamente celle e system prompt. Token, API key e segreti provider non entrano mai nel file.","fleet-backup-export":"esporta","fleet-backup-import":"importa","fleet-backup-download":"scarica backup","fleet-backup-restore":"ripristina selezionate","fleet-backup-import-help":"Scegli un backup JSON, controlla le celle e seleziona l’engine di destinazione prima del ripristino.","fleet-backup-overwrite":"sovrascrive la cella esistente","fleet-backup-new":"nuova cella","fleet-backup-engine-missing":"scegli un engine disponibile","fleet-backup-restore-unavailable":"Il nodo selezionato supporta solo l’esportazione; aggiornalo per ripristinare backup.","fleet-backup-restored":"{n} celle ripristinate","fleet-backup-confirm-overwrite":"Sovrascrivere queste celle? {cells}","fleet-backup-needs-restart":"riavvio necessario: {cells}","fleet-backup-empty":"nessuna cella da esportare","fleet-backup-select-one":"seleziona almeno una cella","fleet-backup-too-large":"backup troppo grande (massimo 1 MB)","fleet-backup-invalid-json":"il file non contiene JSON valido","fleet-backup-invalid-format":"formato o versione del backup non supportati","fleet-backup-invalid-cell":"il backup contiene una cella non valida","fleet-backup-duplicate-cell":"il backup contiene ID cella duplicati","fleet-system-prompt":"system prompt",characters:"caratteri","select-all":"seleziona tutte","select-none":"nessuna",edit:"modifica",save:"salva",label:"etichetta","command-path":"path assoluto del comando","args-lines":"argomenti, uno per riga","env-write-only":"I valori env sono write-only: vuoto mantiene il valore esistente.","fleet-new-engine":"Nuovo engine","fleet-new-cell":"Nuova cella","fleet-saved":"Definizione salvata.","fleet-restart-confirm":"Modifica salvata. Riavviare ora: {cells}?","fleet-remove-engine":'Eliminare l’engine "{id}"?',"fleet-remove-cell":'Eliminare la cella "{id}"? Se è attiva verrà prima fermata.',"settings-readonly":"READONLY attivo: le modifiche sono bloccate dal server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"questa macchina guarda altri nodi via tunnel SSH","role-node":"nodo (raggiungibile)","published-port":"porta pubblicata (opzionale)","no-nodes":"nessun nodo remoto configurato","node-add":"collega installazione NexusCrew","node-connect-help":"La porta SSH serve a raggiungere il server SSH. La porta NexusCrew è invece la porta locale mostrata da `nexuscrew status` sul nodo remoto.","node-name-label":"Nome del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Porta SSH","node-ssh-port-help":"Di solito 22; usa la porta pubblica del server SSH.","node-app-port-label":"Porta NexusCrew sul nodo","node-app-port-help":"È la porta mostrata da `nexuscrew status` sul nodo remoto.","node-name-ph":"nome (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"porta remota (opz.)","node-remove-confirm":'Rimuovere il nodo "{name}"?',"node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","share-node":"Condividi questo nodo","share-node-off-desc":"Privato: resta collegato al nodo hub, ma gli altri client non possono raggiungerlo.","share-node-on-desc":"Condiviso: il nodo hub può mostrarlo e smistare celle e deck autorizzati.","peer-shared":"Nodo client condiviso nella rete Hydra","peer-private":"Nodo client privato: collegato, non pubblicato nella rete Hydra","node-connected-client":"client collegato","transport-used":"in uso","tunnel-up":"tunnel su","tunnel-down":"tunnel giù","authorized-keys-hint":"incolla questa riga in ~/.ssh/authorized_keys sull'host remoto:",copy:"copia",copied:"copiato","token-rotate":"ruota token","token-rotate-explain":"Il nuovo token NON verrà mostrato: recuperalo con `nexuscrew show token`. La sessione corrente verrà invalidata.","service-regenerate":"rigenera service","npm-auto-update":"aggiornamenti automatici da npm","npm-auto-update-help":"Controlla periodicamente latest e installa solo versioni più recenti. Mai downgrade.","npm-update-current":"installata","npm-update-latest":"npm latest","npm-update-check":"controlla ora","npm-update-install":"aggiorna ora","npm-update-restarting":"Aggiornamento avviato; NexusCrew si riaprirà dopo il riavvio del servizio.","npm-update-idle":"aggiornato","npm-update-checking":"controllo in corso","npm-update-available":"aggiornamento disponibile","npm-update-installing":"installazione in corso","npm-update-installed":"installato, riavvio in corso","npm-update-error":"controllo fallito","npm-update-unsupported":"disponibile solo con installazione npm globale","service-installed":"service installato","service-missing":"service non installato","service-active":"attivo","service-inactive":"non attivo",confirm:"conferma",add:"aggiungi",enable:"attiva","wizard-title":"benvenuto in NexusCrew","wizard-skip":"configura dopo dai settings","wizard-step-roles":"ruoli di questa installazione","wizard-step-node":"primo nodo remoto (opzionale)","wizard-done":"tutto pronto","wizard-done-desc":"setup completato — puoi cambiare tutto dai settings",next:"continua",back:"indietro",skip:"salta",finish:"fine","err-node-name":"nome non valido (a-z, 0-9, -, max 32)","err-ssh":"ssh non valido (atteso user@host o alias)","err-port":"porta non valida (1–65535)","err-ssh-port":"porta SSH non valida (1–65535)","err-node-port":"porta NexusCrew non valida (1–65535)","node-sessions":"{n} sessioni","tunnel-down-since":"tunnel giù da {t}","node-unreachable":"nodo non raggiungibile","node-passive":"client offline · stato normale","node-offline":"nodo offline","node-offline-seen":"offline · visto {t} fa","node-needs-repair":"legacy · ripeti il pairing","asks-title":"domande dalle celle","ask-reply-ph":"scrivi la risposta…","push-enable":"attiva notifiche push","push-disable":"disattiva notifiche push","push-on":"push attive su questo device","push-off":"push non attive","push-denied":"permesso notifiche negato dal browser","push-unsupported":"push non supportate in questo browser","node-display-label":"Nome (etichetta)","node-slug-hint":"routing su slug: {slug}","device-name-label":"Nome dispositivo","device-name-hint":"come ti vedono i peer (modificabile)","err-label":"etichetta non valida (max 64 char, niente a capo)","fleet-inventory":"Celle e sessioni","fleet-inventory-help":"tutte le posizioni (Locale + route Hydra)","fleet-manage-location":"Gestisci posizione","fleet-network-overview":"Panoramica rete","fleet-manage-help":"crea e configura celle nella posizione selezionata","fleet-overview-help":"stato operativo di tutte le posizioni, senza duplicare l’editor","fleet-inventory-empty":"nessuna cella o sessione","fleet-not-available":"fleet non disponibile su questa posizione",start:"avvia",stop:"ferma",restart:"riavvia",delete:"elimina","copy-manual":"copia non riuscita — seleziona e Cmd+C, o copia a mano","copy-empty":"niente selezione: trascina con Shift per selezionare","save-and-start":"salva e avvia",permissions:"Permessi","power-on-hint":"Spegni la cella; puoi anche toglierla dal boot.","launch-engine-help":"Provider, credenziali e nuovi engine si creano in Impostazioni → Flotta. Modello e permessi sono per questa cella.","launch-external-hint":"Provider esterno: engine/modello si configurano nel fleet esterno.","import-as-cell":"Importa come cella","import-help":"Riconcilia una sessione tmux esistente in una cella gestita. Scegli un engine già dichiarato: nessun engine viene inventato.","import-engine-required":"scegli un engine (obbligatorio)","test-and-connect":"testa e collega","pairing-v2-hint":"Incolla o scansiona UN solo link: precompila nome, Host SSH ed etichetta quando il link li include (v2).","invite-v2-hint":"Crea un invito monouso completo. Se sei già collegato a un hub, viene usato automaticamente; altrimenti serve solo il suo indirizzo SSH raggiungibile.","invite-network-hint":"Crea un invito per la rete a cui sei già collegato. Il nuovo dispositivo entrerà attraverso l’hub, non si collegherà direttamente a questo dispositivo.","invite-network-label":"Rete di destinazione","invite-network-via":"Hub","invite-network-route":"Un solo collegamento verso l’hub; nodi, celle e deck vengono smistati internamente.","invite-endpoint-label":"Indirizzo SSH di questo hub visto dagli altri dispositivi","invite-endpoint-auto":"Endpoint già configurato","invite-endpoint-needed":"Inserisci user@host o un alias SSH condiviso. Non è 127.0.0.1 e non è l’URL HTTP NexusCrew.","invite-ssh-hint":"Il target SSH con cui L’ALTRO dispositivo raggiunge QUESTA installazione (user@host o alias). Obbligatorio: viene incluso nel link.","invite-next-steps":"copia questo link, apri NexusCrew sull’altro dispositivo e incollalo in Impostazioni → Nodi (o scansiona il QR): al resto pensa NexusCrew","pair-card-title":"collega con un solo link","pair-card-help":"Incolla il link di pairing generato sull’altro dispositivo (o scansiona il suo QR): NexusCrew decodifica, prova la connessione SSH e collega da solo.","pair-paste-ph":"incolla qui il link di pairing","pair-paste-btn":"incolla","pair-advanced":"avanzate / modifica","pair-progress":"collegamento in corso: SSH → invito → conferma → verifica…","pair-retry":"riprova","pair-invalid-link":"questo non è un link di pairing valido","pair-invalid-hint":"serve il link completo (http://…#pair=…) generato dall’altro NexusCrew: non aprirlo, incollalo qui","pair-missing-ssh":"il link non include il target SSH (formato v1): indica in “avanzate” come questo dispositivo raggiunge l’altro via SSH — non viene mai inventato","pair-missing-name":"manca il nome del nodo: completalo in “avanzate”","pair-clipboard-denied":"lettura degli appunti non consentita: incolla manualmente nel campo","pair-clipboard-empty":"appunti vuoti: copia prima il link di pairing","pair-stage-validation":"dati non validi","pair-stage-conflict":"nome già in uso","pair-stage-ssh-start":"avvio del tunnel SSH fallito","pair-stage-ssh-ready":"peer non raggiungibile via SSH","pair-stage-join":"scambio dell’invito fallito","pair-stage-tunnel-final":"tunnel negoziato fallito","pair-stage-confirm":"conferma del pairing fallita","pair-stage-health":"verifica finale della federazione fallita","pair-stage-internal":"errore interno","pair-stage-generic":"connessione fallita","qr-no-camera":"nessuna camera disponibile su questo dispositivo: usa una foto del QR","qr-permission":"permesso camera negato: consentilo nel browser o usa una foto del QR","qr-unsupported":"scanner live non supportato qui: carica una foto del QR","qr-upload":"usa una foto"},en:{"update-available":"new version {v} available","install-version-mismatch":"incomplete installation: frontend and server do not match (v{v})",reload:"reload","grid-empty":"drag a session here from the sidebar, or double-click for single view","grid-full":"a deck can show at most 9 sessions",pin:"pin to top",sessions:"sessions","new-session":"new session",new:"new",fleet:"Fleet","fleet-tmux":"tmux fleet","other-sessions":"Other sessions","view-all":"all","view-pinned":"pinned","view-active":"active","view-off":"off","position-local":"Local",files:"files",refresh:"refresh","filter-placeholder":"filter sessions…","loading-fleet":"loading fleet…","no-sessions":"no live tmux sessions — the fleet starts at boot (systemd)","no-match":'no session matches "{q}"',"copy-url":"click to copy URL","ssh-only":"SSH/VPN tunnel only","new-files-outbox":"new files in outbox",terminate:"terminate","terminate-confirm":'Terminate session "{name}"?',"cell-on":"tmux alive","cell-off":"off","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","state-on":"running","state-off":"stopped",engine:"Engine",model:"Model","model-default":"Provider default model","model-remembered":"Last model used with this engine","boot-persist":"start at boot","remove-boot":"also remove from boot","power-config-in-settings":"Edit engine, provider, profile, model and permissions in Settings → Fleet.","no-remote-control":"⚠ non-native engine: no claude.ai app RC (you can still drive it from here)",cancel:"cancel",name:"name","name-invalid":"invalid name: a-zA-Z0-9._- max 64, no leading '-'",cwd:"folder",browse:"browse","fs-home":"home","fs-parent":".. up",preset:"preset","preset-2x2":"2×2 grid","preset-columns":"columns","preset-equalize":"equalize",collapse:"collapse",expand:"expand",create:"create","auth-prompt":"Paste the token (printed by the server):","remember-device":"remember on this device","zoom-out":"smaller text","zoom-in":"bigger text",composer:"composer",windows:"{n} windows","empty-files":"empty",upload:"upload","no-sessions-short":"no sessions","composer-placeholder":"type or dictate…",attach:"attach","attach-file":"File","attach-camera":"Camera","attach-gallery":"Gallery","attach-uploading":"uploading…","attach-upload-progress":"attachment {n}/{total}…","attach-uploaded":"{n} attachments uploaded",voice:"voice",send:"send","composer-send-failed":"connection not ready — text kept, try again",close:"close","lang-label":"language",decks:"decks","new-deck":"new deck","deck-name":"deck name","open-deck-window":"open in a new window","detach-deck":"detach into a new window","deck-current":"this deck (current window)","deck-owner-unavailable":"owner node is not shared or reachable","rename-deck":"rename deck","delete-deck":"delete deck","delete-deck-confirm":'Delete deck "{name}"?',"send-to-deck":"send to deck…","deck-autosave":"autosave",saving:"saving…",saved:"saved","popup-blocked":"popup blocked: open here","select-drag":"drag to select","copy-manual":"select and copy manually","toggle-sidebar":"show/hide the sidebar",settings:"settings","tab-roles":"roles","tab-nodes":"nodes",local:"Local",location:"Location","pairing-link":"pairing link","pairing-required":"name, SSH alias and pairing link are required","pairing-connect-help":"Connecting a node requires a name, a working SSH Host, and a link/QR created by the other NexusCrew installation.","pairing-localhost-hint":"127.0.0.1 in the link is correct: do not open it here. NexusCrew carries the invite and port through the SSH Host.","scan-qr":"scan QR","pairing-qr-invalid":"invalid pairing QR","invite-node":"invite a node","create-pairing-link":"create link / QR","visibility-network":"whole network","visibility-relay":"relay only","visibility-selected":"selected nodes","hydra-simple":"local + nodes, one network","local-ready":"This device is ready. Use it alone or connect it to a node.","local-only":"local only","add-node":"add node",connect:"connect","node-connected":"Node connected. The network will synchronize automatically.","tab-system":"system","tab-fleet":"fleet","fleet-editor-unavailable":"The editor is available only with the builtin fleet provider.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-model-default":"default model (optional)","fleet-model-required":"model (required)","fleet-standard-permissions":"standard permissions","fleet-unsafe-permissions":"unsafe · bypass approvals/sandbox","fleet-unsafe-warning":"Explicit unsafe mode: the worker can act without normal approval or sandbox gates.","fleet-provider-display":"provider display name","fleet-custom-provider-default":"Custom provider","fleet-api-key-env":"API_KEY_ENV_NAME","fleet-provider-id":"provider-id","fleet-custom-secret-help":"NexusCrew stores only the environment-variable name, never its value.","fleet-model-override":"model override","fleet-ready":"ready","fleet-not-ready":"not configured","fleet-engines":"Engines","fleet-cells":"Cells / cloud sessions","fleet-backup":"backup / restore","fleet-backup-help":"Selectively export or restore cells and system prompts. Tokens, API keys and provider secrets never enter the file.","fleet-backup-export":"export","fleet-backup-import":"import","fleet-backup-download":"download backup","fleet-backup-restore":"restore selected","fleet-backup-import-help":"Choose a JSON backup, review the cells and select a destination engine before restoring.","fleet-backup-overwrite":"overwrites existing cell","fleet-backup-new":"new cell","fleet-backup-engine-missing":"choose an available engine","fleet-backup-restore-unavailable":"The selected node supports export only; update it to restore backups.","fleet-backup-restored":"{n} cells restored","fleet-backup-confirm-overwrite":"Overwrite these cells? {cells}","fleet-backup-needs-restart":"restart required: {cells}","fleet-backup-empty":"no cells to export","fleet-backup-select-one":"select at least one cell","fleet-backup-too-large":"backup is too large (1 MB maximum)","fleet-backup-invalid-json":"the file does not contain valid JSON","fleet-backup-invalid-format":"unsupported backup format or version","fleet-backup-invalid-cell":"the backup contains an invalid cell","fleet-backup-duplicate-cell":"the backup contains duplicate cell IDs","fleet-system-prompt":"system prompt",characters:"characters","select-all":"select all","select-none":"select none",edit:"edit",save:"save",label:"label","command-path":"absolute command path","args-lines":"arguments, one per line","env-write-only":"Environment values are write-only: blank keeps the existing value.","fleet-new-engine":"New engine","fleet-new-cell":"New cell","fleet-saved":"Definition saved.","fleet-restart-confirm":"Change saved. Restart now: {cells}?","fleet-remove-engine":'Delete engine "{id}"?',"fleet-remove-cell":'Delete cell "{id}"? If active it will be stopped first.',"settings-readonly":"READONLY active: changes are blocked by the server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"this machine watches other nodes via SSH tunnels","role-node":"node (reachable)","published-port":"published port (optional)","no-nodes":"no remote nodes configured","node-add":"connect a NexusCrew installation","node-connect-help":"The SSH port reaches the SSH server. The NexusCrew port is the local port reported by `nexuscrew status` on the remote node.","node-name-label":"Node name","node-ssh-label":"SSH host","node-ssh-port-label":"SSH port","node-ssh-port-help":"Usually 22; use the SSH server public port.","node-app-port-label":"NexusCrew port on node","node-app-port-help":"The port reported by `nexuscrew status` on the remote node.","node-name-ph":"name (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"remote port (opt.)","node-remove-confirm":'Remove node "{name}"?',"node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","share-node":"Share this node","share-node-off-desc":"Private: it stays connected to the hub, but other clients cannot reach it.","share-node-on-desc":"Shared: the hub may advertise it and route authorized cells and decks.","peer-shared":"Client node shared on the Hydra network","peer-private":"Private client node: connected, not published on Hydra","node-connected-client":"connected client","transport-used":"in use","tunnel-up":"tunnel up","tunnel-down":"tunnel down","authorized-keys-hint":"paste this line into ~/.ssh/authorized_keys on the remote host:",copy:"copy",copied:"copied","token-rotate":"rotate token","token-rotate-explain":"The new token will NOT be shown: retrieve it with `nexuscrew show token`. The current session will be invalidated.","service-regenerate":"regenerate service","npm-auto-update":"automatic updates from npm","npm-auto-update-help":"Periodically checks latest and installs only newer versions. Never downgrades.","npm-update-current":"installed","npm-update-latest":"npm latest","npm-update-check":"check now","npm-update-install":"update now","npm-update-restarting":"Update started; NexusCrew will return after the service restarts.","npm-update-idle":"up to date","npm-update-checking":"checking","npm-update-available":"update available","npm-update-installing":"installing","npm-update-installed":"installed, restarting","npm-update-error":"check failed","npm-update-unsupported":"available only for global npm installations","service-installed":"service installed","service-missing":"service not installed","service-active":"active","service-inactive":"not active",confirm:"confirm",add:"add",enable:"enable","wizard-title":"welcome to NexusCrew","wizard-skip":"configure later from settings","wizard-step-roles":"roles of this install","wizard-step-node":"first remote node (optional)","wizard-done":"all set","wizard-done-desc":"setup complete — you can change everything from settings",next:"continue",back:"back",skip:"skip",finish:"finish","err-node-name":"invalid name (a-z, 0-9, -, max 32)","err-ssh":"invalid ssh (expected user@host or alias)","err-port":"invalid port (1–65535)","err-ssh-port":"invalid SSH port (1–65535)","err-node-port":"invalid NexusCrew port (1–65535)","node-sessions":"{n} sessions","tunnel-down-since":"tunnel down for {t}","node-unreachable":"node unreachable","node-passive":"client offline · expected","node-offline":"node offline","node-offline-seen":"offline · seen {t} ago","node-needs-repair":"legacy · pair again","asks-title":"questions from the cells","ask-reply-ph":"type your answer…","push-enable":"enable push notifications","push-disable":"disable push notifications","push-on":"push active on this device","push-off":"push not active","push-denied":"notification permission denied by the browser","push-unsupported":"push not supported in this browser","node-display-label":"Name (label)","node-slug-hint":"routing on slug: {slug}","device-name-label":"Device name","device-name-hint":"how peers see you (editable)","err-label":"invalid label (max 64 chars, no line breaks)","fleet-inventory":"Cells and sessions","fleet-inventory-help":"all positions (Local + Hydra routes)","fleet-manage-location":"Manage location","fleet-network-overview":"Network overview","fleet-manage-help":"create and configure cells at the selected location","fleet-overview-help":"operational state of every location, separate from the editor","fleet-inventory-empty":"no cells or sessions","fleet-not-available":"fleet not available on this position",start:"start",stop:"stop",restart:"restart",delete:"delete","copy-manual":"copy failed — select and press Cmd+C, or copy manually","copy-empty":"nothing selected: drag with Shift to select","save-and-start":"save and start",permissions:"Permissions","power-on-hint":"Stop the cell; you can also remove it from boot.","launch-engine-help":"Providers, credentials and new engines are created in Settings → Fleet. Model and permissions are per cell.","launch-external-hint":"External provider: engine/model are configured in the external fleet.","import-as-cell":"Import as cell","import-help":"Reconcile an existing tmux session into a managed cell. Pick an already-declared engine: no engine is invented.","import-engine-required":"pick an engine (required)","test-and-connect":"test and connect","pairing-v2-hint":"Paste or scan ONE link: it prefills name, SSH host and label when the link carries them (v2).","invite-v2-hint":"Create one complete one-time invitation. If this device already joined a hub, that hub is used automatically; otherwise only its reachable SSH address is required.","invite-network-hint":"Create an invitation for the network you already joined. The new device enters through the hub instead of connecting directly to this device.","invite-network-label":"Destination network","invite-network-via":"Hub","invite-network-route":"One connection to the hub; nodes, cells and decks are routed internally.","invite-endpoint-label":"This hub’s SSH address as seen by other devices","invite-endpoint-auto":"Configured endpoint","invite-endpoint-needed":"Enter user@host or a shared SSH alias. This is not 127.0.0.1 and not the NexusCrew HTTP URL.","invite-ssh-hint":"The SSH target the OTHER device uses to reach THIS installation (user@host or alias). Required: it is included in the link.","invite-next-steps":"copy this link, open NexusCrew on the other device and paste it in Settings → Nodes (or scan the QR): NexusCrew does the rest","pair-card-title":"connect with one link","pair-card-help":"Paste the pairing link generated on the other device (or scan its QR): NexusCrew decodes it, tests the SSH connection and connects on its own.","pair-paste-ph":"paste the pairing link here","pair-paste-btn":"paste","pair-advanced":"advanced / edit","pair-progress":"connecting: SSH → invite → confirm → verify…","pair-retry":"retry","pair-invalid-link":"this is not a valid pairing link","pair-invalid-hint":"you need the full link (http://…#pair=…) generated by the other NexusCrew: don’t open it, paste it here","pair-missing-ssh":"the link carries no SSH target (v1 format): set in “advanced” how this device reaches the other one over SSH — it is never invented","pair-missing-name":"the node name is missing: fill it in “advanced”","pair-clipboard-denied":"clipboard read not allowed: paste manually into the field","pair-clipboard-empty":"clipboard is empty: copy the pairing link first","pair-stage-validation":"invalid data","pair-stage-conflict":"name already in use","pair-stage-ssh-start":"SSH tunnel start failed","pair-stage-ssh-ready":"peer unreachable over SSH","pair-stage-join":"invite exchange failed","pair-stage-tunnel-final":"negotiated tunnel failed","pair-stage-confirm":"pairing confirmation failed","pair-stage-health":"final federation check failed","pair-stage-internal":"internal error","pair-stage-generic":"connection failed","qr-no-camera":"no camera available on this device: use a photo of the QR","qr-permission":"camera permission denied: allow it in the browser or use a photo of the QR","qr-unsupported":"live scanner not supported here: upload a photo of the QR","qr-upload":"use a photo"},es:{"update-available":"nueva versión {v} disponible","install-version-mismatch":"instalación incompleta: frontend y servidor no coinciden (v{v})",reload:"recargar","grid-empty":"arrastra aquí una sesión desde la barra lateral, o doble clic para vista única","grid-full":"un deck puede mostrar como máximo 9 sesiones",pin:"fijar arriba",sessions:"sesiones","new-session":"nueva sesión",new:"nueva",fleet:"Flota","fleet-tmux":"flota tmux","other-sessions":"Otras sesiones","view-all":"todas","view-pinned":"fijadas","view-active":"activas","view-off":"apagadas","position-local":"Local",files:"archivos",refresh:"actualizar","filter-placeholder":"filtrar sesiones…","loading-fleet":"cargando flota…","no-sessions":"sin sesiones tmux vivas — la flota arranca en el boot (systemd)","no-match":"ninguna sesión coincide con «{q}»","copy-url":"clic para copiar la URL","ssh-only":"solo túnel SSH/VPN","new-files-outbox":"archivos nuevos en outbox",terminate:"terminar","terminate-confirm":"¿Terminar la sesión «{name}»?","cell-on":"tmux activo","cell-off":"apagada","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","state-on":"encendida","state-off":"apagada",engine:"Motor",model:"Modelo","model-default":"Modelo predeterminado del proveedor","model-remembered":"Último modelo usado con este motor","boot-persist":"iniciar en el boot","remove-boot":"quitar también del boot","power-config-in-settings":"Modifica motor, proveedor, perfil, modelo y permisos en Ajustes → Flota.","no-remote-control":"⚠ motor no nativo: sin RC de la app claude.ai (aquí puedes pilotarla igual)",cancel:"cancelar",name:"nombre","name-invalid":"nombre inválido: a-zA-Z0-9._- máx 64, sin '-' inicial",cwd:"carpeta",browse:"explorar","fs-home":"home","fs-parent":".. arriba",preset:"preset","preset-2x2":"cuadrícula 2×2","preset-columns":"columnas","preset-equalize":"igualar",collapse:"contraer",expand:"expandir",create:"crear","auth-prompt":"Pega el token (impreso por el servidor):","remember-device":"recordar en este dispositivo","zoom-out":"texto más pequeño","zoom-in":"texto más grande",composer:"composer",windows:"{n} ventanas","empty-files":"vacía",upload:"subir","no-sessions-short":"sin sesiones","composer-placeholder":"escribe o dicta…",attach:"adjuntar","attach-file":"Archivo","attach-camera":"Cámara","attach-gallery":"Galería","attach-uploading":"subiendo…","attach-upload-progress":"adjunto {n}/{total}…","attach-uploaded":"{n} adjuntos subidos",voice:"voz",send:"enviar","composer-send-failed":"conexión no disponible — texto conservado, inténtalo de nuevo",close:"cerrar","lang-label":"idioma",decks:"decks","new-deck":"nuevo deck","deck-name":"nombre del deck","open-deck-window":"abrir en una ventana nueva","detach-deck":"separar en una ventana nueva","deck-current":"este deck (ventana actual)","deck-owner-unavailable":"el nodo propietario no está compartido o accesible","rename-deck":"renombrar deck","delete-deck":"eliminar deck","delete-deck-confirm":"¿Eliminar el deck «{name}»?","send-to-deck":"enviar al deck…","deck-autosave":"guardado automático",saving:"guardando…",saved:"guardado","popup-blocked":"ventana bloqueada: abrir aquí","select-drag":"arrastra para seleccionar","copy-manual":"selecciona y copia manualmente","toggle-sidebar":"mostrar/ocultar la barra lateral",settings:"ajustes","tab-roles":"roles","tab-nodes":"nodos",local:"Local",location:"Ubicación","pairing-link":"enlace de emparejamiento","pairing-required":"nombre, alias SSH y enlace son obligatorios","pairing-connect-help":"Para conectar un nodo necesitas un nombre, un Host SSH funcional y el enlace/QR creado por la otra instalación NexusCrew.","pairing-localhost-hint":"127.0.0.1 en el enlace es correcto: no lo abras aquí. NexusCrew usa la invitación y el puerto mediante el Host SSH.","scan-qr":"escanear QR","pairing-qr-invalid":"QR de emparejamiento no válido","invite-node":"invitar un nodo","create-pairing-link":"crear enlace / QR","visibility-network":"toda la red","visibility-relay":"solo relay","visibility-selected":"nodos seleccionados","hydra-simple":"local + nodos, una red","local-ready":"Este dispositivo está listo. Úsalo solo o conéctalo a un nodo.","local-only":"solo local","add-node":"añadir nodo",connect:"conectar","node-connected":"Nodo conectado. La red se sincronizará automáticamente.","tab-system":"sistema","tab-fleet":"flota","fleet-editor-unavailable":"El editor solo está disponible con el proveedor builtin.","fleet-managed":"gestionado por NexusCrew","fleet-custom":"comando personalizado","fleet-managed-help":"Cliente, proveedor e inicio se gestionan internamente; los secretos nunca se muestran.","fleet-model-default":"modelo predeterminado (opcional)","fleet-model-required":"modelo (obligatorio)","fleet-standard-permissions":"permisos estándar","fleet-unsafe-permissions":"inseguro · omitir aprobaciones/sandbox","fleet-unsafe-warning":"Modo inseguro explícito: el worker puede actuar sin las aprobaciones normales ni las protecciones del sandbox.","fleet-provider-display":"nombre visible del proveedor","fleet-custom-provider-default":"Proveedor personalizado","fleet-api-key-env":"NOMBRE_VARIABLE_API_KEY","fleet-provider-id":"id-proveedor","fleet-custom-secret-help":"NexusCrew guarda solo el nombre de la variable de entorno, nunca su valor.","fleet-model-override":"modelo alternativo","fleet-ready":"listo","fleet-not-ready":"no configurado","fleet-engines":"Motores","fleet-cells":"Celdas / sesiones cloud","fleet-backup":"copia / restauración","fleet-backup-help":"Exporta o restaura selectivamente celdas y system prompts. Tokens, claves API y secretos del proveedor nunca entran en el archivo.","fleet-backup-export":"exportar","fleet-backup-import":"importar","fleet-backup-download":"descargar copia","fleet-backup-restore":"restaurar seleccionadas","fleet-backup-import-help":"Elige una copia JSON, revisa las celdas y selecciona un motor de destino antes de restaurar.","fleet-backup-overwrite":"sobrescribe la celda existente","fleet-backup-new":"celda nueva","fleet-backup-engine-missing":"elige un motor disponible","fleet-backup-restore-unavailable":"El nodo seleccionado solo admite exportación; actualízalo para restaurar copias.","fleet-backup-restored":"{n} celdas restauradas","fleet-backup-confirm-overwrite":"¿Sobrescribir estas celdas? {cells}","fleet-backup-needs-restart":"reinicio necesario: {cells}","fleet-backup-empty":"no hay celdas para exportar","fleet-backup-select-one":"selecciona al menos una celda","fleet-backup-too-large":"copia demasiado grande (máximo 1 MB)","fleet-backup-invalid-json":"el archivo no contiene JSON válido","fleet-backup-invalid-format":"formato o versión de copia no compatible","fleet-backup-invalid-cell":"la copia contiene una celda no válida","fleet-backup-duplicate-cell":"la copia contiene IDs de celda duplicados","fleet-system-prompt":"system prompt",characters:"caracteres","select-all":"seleccionar todas","select-none":"ninguna",edit:"editar",save:"guardar",label:"etiqueta","command-path":"ruta absoluta del comando","args-lines":"argumentos, uno por línea","env-write-only":"Los valores env son de solo escritura: vacío conserva el valor existente.","fleet-new-engine":"Nuevo motor","fleet-new-cell":"Nueva celda","fleet-saved":"Definición guardada.","fleet-restart-confirm":"Cambio guardado. ¿Reiniciar ahora: {cells}?","fleet-remove-engine":'¿Eliminar el motor "{id}"?',"fleet-remove-cell":'¿Eliminar la celda "{id}"? Si está activa se detendrá primero.',"settings-readonly":"READONLY activo: los cambios están bloqueados por el servidor (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"esta máquina observa otros nodos vía túneles SSH","role-node":"nodo (alcanzable)","published-port":"puerto publicado (opcional)","no-nodes":"sin nodos remotos configurados","node-add":"conectar una instalación NexusCrew","node-connect-help":"El puerto SSH conecta con el servidor SSH. El puerto NexusCrew es el puerto local indicado por `nexuscrew status` en el nodo remoto.","node-name-label":"Nombre del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Puerto SSH","node-ssh-port-help":"Normalmente 22; usa el puerto público del servidor SSH.","node-app-port-label":"Puerto NexusCrew del nodo","node-app-port-help":"El puerto indicado por `nexuscrew status` en el nodo remoto.","node-name-ph":"nombre (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"puerto remoto (opc.)","node-remove-confirm":"¿Eliminar el nodo «{name}»?","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","share-node":"Compartir este nodo","share-node-off-desc":"Privado: sigue conectado al hub, pero otros clientes no pueden alcanzarlo.","share-node-on-desc":"Compartido: el hub puede anunciarlo y enrutar celdas y decks autorizados.","peer-shared":"Nodo cliente compartido en la red Hydra","peer-private":"Nodo cliente privado: conectado, no publicado en Hydra","node-connected-client":"cliente conectado","transport-used":"en uso","tunnel-up":"túnel activo","tunnel-down":"túnel caído","authorized-keys-hint":"pega esta línea en ~/.ssh/authorized_keys del host remoto:",copy:"copiar",copied:"copiado","token-rotate":"rotar token","token-rotate-explain":"El nuevo token NO se mostrará: recupéralo con `nexuscrew show token`. La sesión actual quedará invalidada.","service-regenerate":"regenerar service","npm-auto-update":"actualizaciones automáticas desde npm","npm-auto-update-help":"Comprueba latest periódicamente e instala solo versiones más recientes. Nunca baja de versión.","npm-update-current":"instalada","npm-update-latest":"npm latest","npm-update-check":"comprobar ahora","npm-update-install":"actualizar ahora","npm-update-restarting":"Actualización iniciada; NexusCrew volverá después de reiniciar el servicio.","npm-update-idle":"actualizado","npm-update-checking":"comprobando","npm-update-available":"actualización disponible","npm-update-installing":"instalando","npm-update-installed":"instalada, reiniciando","npm-update-error":"comprobación fallida","npm-update-unsupported":"disponible solo con instalación npm global","service-installed":"service instalado","service-missing":"service no instalado","service-active":"activo","service-inactive":"no activo",confirm:"confirmar",add:"añadir",enable:"activar","wizard-title":"bienvenido a NexusCrew","wizard-skip":"configura después desde ajustes","wizard-step-roles":"roles de esta instalación","wizard-step-node":"primer nodo remoto (opcional)","wizard-done":"todo listo","wizard-done-desc":"configuración completa — puedes cambiarlo todo desde ajustes",next:"continuar",back:"atrás",skip:"omitir",finish:"terminar","err-node-name":"nombre inválido (a-z, 0-9, -, máx 32)","err-ssh":"ssh inválido (se espera user@host o alias)","err-port":"puerto inválido (1–65535)","err-ssh-port":"puerto SSH inválido (1–65535)","err-node-port":"puerto NexusCrew inválido (1–65535)","node-sessions":"{n} sesiones","tunnel-down-since":"túnel caído desde hace {t}","node-unreachable":"nodo inalcanzable","node-passive":"cliente desconectado · estado normal","node-offline":"nodo desconectado","node-offline-seen":"sin conexión · visto hace {t}","node-needs-repair":"legacy · vuelve a enlazar","asks-title":"preguntas de las celdas","ask-reply-ph":"escribe la respuesta…","push-enable":"activar notificaciones push","push-disable":"desactivar notificaciones push","push-on":"push activas en este dispositivo","push-off":"push no activas","push-denied":"permiso de notificaciones denegado por el navegador","push-unsupported":"push no soportadas en este navegador","node-display-label":"Nombre (etiqueta)","node-slug-hint":"enrutado por slug: {slug}","device-name-label":"Nombre del dispositivo","device-name-hint":"cómo te ven los pares (editable)","err-label":"etiqueta no válida (máx 64 caracteres, sin saltos de línea)","fleet-inventory":"Celdas y sesiones","fleet-inventory-help":"todas las posiciones (Local + rutas Hydra)","fleet-manage-location":"Gestionar ubicación","fleet-network-overview":"Vista de red","fleet-manage-help":"crea y configura celdas en la ubicación seleccionada","fleet-overview-help":"estado operativo de todas las ubicaciones, separado del editor","fleet-inventory-empty":"sin celdas ni sesiones","fleet-not-available":"fleet no disponible en esta posición",start:"iniciar",stop:"detener",restart:"reiniciar",delete:"eliminar","copy-manual":"copia fallida — selecciona y pulsa Cmd+C, o copia a mano","copy-empty":"nada seleccionado: arrastra con Shift para seleccionar","save-and-start":"guardar e iniciar",permissions:"Permisos","power-on-hint":"Detén la celda; también puedes quitarla del boot.","launch-engine-help":"Proveedores, credenciales y nuevos motores se crean en Ajustes → Flota. Modelo y permisos son por celda.","launch-external-hint":"Proveedor externo: motor/modelo se configuran en el fleet externo.","import-as-cell":"Importar como celda","import-help":"Reconcilia una sesión tmux existente en una celda gestionada. Elige un motor ya declarado: no se inventa ninguno.","import-engine-required":"elige un motor (obligatorio)","test-and-connect":"probar y conectar","pairing-v2-hint":"Pega o escanea UN solo enlace: rellena nombre, Host SSH y etiqueta cuando los incluye (v2).","invite-v2-hint":"Crea una invitación completa de un solo uso. Si este dispositivo ya está unido a un hub, se usa automáticamente; si no, solo hace falta su dirección SSH alcanzable.","invite-network-hint":"Crea una invitación para la red a la que ya estás conectado. El nuevo dispositivo entra por el hub y no se conecta directamente a este dispositivo.","invite-network-label":"Red de destino","invite-network-via":"Hub","invite-network-route":"Una sola conexión al hub; nodos, celdas y decks se enrutan internamente.","invite-endpoint-label":"Dirección SSH de este hub vista por los otros dispositivos","invite-endpoint-auto":"Endpoint ya configurado","invite-endpoint-needed":"Introduce usuario@host o un alias SSH compartido. No es 127.0.0.1 ni la URL HTTP de NexusCrew.","invite-ssh-hint":"El destino SSH con el que el OTRO dispositivo alcanza ESTA instalación (usuario@host o alias). Obligatorio: se incluye en el enlace.","invite-next-steps":"copia este enlace, abre NexusCrew en el otro dispositivo y pégalo en Ajustes → Nodos (o escanea el QR): NexusCrew hace el resto","pair-card-title":"conectar con un solo enlace","pair-card-help":"Pega el enlace de emparejamiento generado en el otro dispositivo (o escanea su QR): NexusCrew lo decodifica, prueba la conexión SSH y conecta solo.","pair-paste-ph":"pega aquí el enlace de emparejamiento","pair-paste-btn":"pegar","pair-advanced":"avanzado / editar","pair-progress":"conectando: SSH → invitación → confirmación → verificación…","pair-retry":"reintentar","pair-invalid-link":"esto no es un enlace de emparejamiento válido","pair-invalid-hint":"se necesita el enlace completo (http://…#pair=…) generado por el otro NexusCrew: no lo abras, pégalo aquí","pair-missing-ssh":"el enlace no incluye el destino SSH (formato v1): indica en “avanzado” cómo este dispositivo alcanza al otro por SSH — nunca se inventa","pair-missing-name":"falta el nombre del nodo: complétalo en “avanzado”","pair-clipboard-denied":"lectura del portapapeles no permitida: pega manualmente en el campo","pair-clipboard-empty":"portapapeles vacío: copia primero el enlace","pair-stage-validation":"datos no válidos","pair-stage-conflict":"nombre ya en uso","pair-stage-ssh-start":"fallo al iniciar el túnel SSH","pair-stage-ssh-ready":"peer inaccesible por SSH","pair-stage-join":"intercambio de invitación fallido","pair-stage-tunnel-final":"túnel negociado fallido","pair-stage-confirm":"confirmación de emparejamiento fallida","pair-stage-health":"verificación final de la federación fallida","pair-stage-internal":"error interno","pair-stage-generic":"conexión fallida","qr-no-camera":"no hay cámara disponible en este dispositivo: usa una foto del QR","qr-permission":"permiso de cámara denegado: permítelo en el navegador o usa una foto del QR","qr-unsupported":"escáner en vivo no soportado aquí: sube una foto del QR","qr-upload":"usar una foto"}};function Ru(){const e=o_(),t=e?e.getItem(s_):null;return Ph.includes(t)?t:ba}function ow(e){const t=o_();if(t)try{t.setItem(s_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Nu))}function S(e){const t=Ru(),r=da[t]||da[ba];return Object.prototype.hasOwnProperty.call(r,e)?r[e]:Object.prototype.hasOwnProperty.call(da[ba],e)?da[ba][e]:e}function aw(e){return typeof window>"u"?()=>{}:(window.addEventListener(Nu,e),()=>window.removeEventListener(Nu,e))}const a_=Ph;function pi(){return[M.useSyncExternalStore(aw,Ru,Ru),ow]}function Da({cell:e,token:t,route:r=[],onConfirm:s,onClose:o}){var Y,F;pi();const l=!!(e&&e.active),u=Array.isArray(r)?r.join("/"):"",[d,p]=M.useState([]),[m,y]=M.useState(!1);M.useEffect(()=>{let Q=!0;return(async()=>{if(t)try{const $=await an(t,u?u.split("/"):[]);if(!Q)return;if(y($.provider==="builtin"&&($.capabilities||[]).includes("edit")),$.provider==="builtin"&&($.capabilities||[]).includes("definitions")){const q=await kh(t,u?u.split("/"):[]);if(!Q)return;const G=new Map(($.engines||[]).map(P=>[P.id,P]));p((q.engines||[]).map(P=>{var J,L,x,X,re,se,ae;return{id:P.id,label:P.label||P.id,client:((J=P.managed)==null?void 0:J.client)||"",models:[...new Set([...((L=G.get(P.id))==null?void 0:L.models)||[],...((x=P.managedInfo)==null?void 0:x.models)||[]])].filter(Boolean),defaultModel:((X=P.managed)==null?void 0:X.model)||((re=P.managedInfo)==null?void 0:re.defaultModel)||"",policyDefault:((se=P.managed)==null?void 0:se.permissionPolicy)||((ae=P.managed)!=null&&ae.client&&P.managed.client==="claude"?"unsafe":"standard")}}))}}catch{}})(),()=>{Q=!1}},[t,u]);const w=(e==null?void 0:e.engine)||((Y=d[0])==null?void 0:Y.id)||"",v=Q=>(e==null?void 0:e.models)&&e.models[Q]||"",_=Q=>{const $=(e==null?void 0:e.permissionPolicies)&&e.permissionPolicies[Q];if($==="standard"||$==="unsafe")return $;const q=d.find(G=>G.id===Q);return q?q.policyDefault:"standard"},[b,E]=M.useState(w),[N,R]=M.useState((e==null?void 0:e.model)||""),O=(e==null?void 0:e.permissionPolicy)==="standard"||(e==null?void 0:e.permissionPolicy)==="unsafe"?e.permissionPolicy:((F=e==null?void 0:e.permissionPolicies)==null?void 0:F[e==null?void 0:e.engine])||"",[z,B]=M.useState(O),[W,A]=M.useState((e==null?void 0:e.boot)??!0),[I,V]=M.useState(!1),[U,ie]=M.useState(null);M.useEffect(()=>{d.length&&(E(Q=>Q||w),R(Q=>Q||v((e==null?void 0:e.engine)||w)||""),B(Q=>Q==="standard"||Q==="unsafe"?Q:_((e==null?void 0:e.engine)||w)))},[d.length]);const ee=M.useMemo(()=>d.find(Q=>Q.id===b)||null,[d,b]),k=!!(ee&&["claude","codex","codex-vl"].includes(ee.client));function D(Q){E(Q);const $=d.find(q=>q.id===Q);R(v(Q)||($==null?void 0:$.defaultModel)||""),B(_(Q))}async function j(Q){Q.preventDefault(),V(!0),ie(null);try{if(l)await s({action:"down",boot:W});else{const $=z==="standard"||z==="unsafe"?z:(ee==null?void 0:ee.policyDefault)||"standard";await s({action:"up",...m?{engine:b,model:N||"",...k?{permissionPolicy:$}:(ee==null?void 0:ee.client)==="pi"?{permissionPolicy:"standard"}:{}}:{},boot:W})}o()}catch($){ie(String($&&$.message||$)),V(!1)}}return h.jsx("div",{className:"nc-sheet-overlay nc-launch-overlay",onClick:o,children:h.jsxs("form",{className:"nc-sheet nc-power-sheet nc-launch-sheet",onClick:Q=>Q.stopPropagation(),onSubmit:j,children:[h.jsxs("div",{className:"nc-sheet-head",children:[h.jsx("b",{children:e==null?void 0:e.cell}),h.jsx("span",{className:"nc-sheet-state",children:S(l?"state-on":"state-off")})]}),l?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:S("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[S("model"),": ",e.model]}),h.jsx("small",{children:S("power-on-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:W,onChange:Q=>A(Q.target.checked)}),S("remove-boot")]})]}):h.jsxs(h.Fragment,{children:[m&&d.length>0?h.jsxs("div",{className:"nc-launch-fields",children:[h.jsxs("label",{className:"nc-field",children:[S("engine"),h.jsx("select",{value:b,onChange:Q=>D(Q.target.value),children:d.map(Q=>h.jsx("option",{value:Q.id,children:Q.label},Q.id))})]}),h.jsxs("label",{className:"nc-field",children:[S("model"),h.jsx("input",{value:N,list:"nc-launch-models",placeholder:S("model-default"),onChange:Q=>R(Q.target.value)}),h.jsx("datalist",{id:"nc-launch-models",children:((ee==null?void 0:ee.models)||[]).map(Q=>h.jsx("option",{value:Q},Q))})]}),k?h.jsxs("label",{className:"nc-field",children:[S("permissions"),h.jsxs("select",{value:z,onChange:Q=>B(Q.target.value),children:[h.jsx("option",{value:"standard",children:S("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:S("fleet-unsafe-permissions")})]})]}):h.jsx("small",{className:"nc-note",children:S("fleet-standard-permissions")}),k&&z==="unsafe"&&h.jsx("small",{className:"nc-err",children:S("fleet-unsafe-warning")}),h.jsx("small",{className:"nc-note",children:S("launch-engine-help")})]}):h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:S("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[S("model"),": ",e.model]}),h.jsx("small",{children:S("launch-external-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:W,onChange:Q=>A(Q.target.checked)}),S("boot-persist")]})]}),U&&h.jsx("div",{className:"nc-err",children:U}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:o,disabled:I,children:S("cancel")}),h.jsx("button",{type:"submit",className:"nc-btn primary",disabled:I,children:S(l?"power-off":"save-and-start")})]})]})})}const Up=/^[a-z0-9-]{1,32}$/;function fa(e,t){const r=Array.isArray(e)?e:[];return r.length?`${r.map(encodeURIComponent).join("/")}:${t}`:String(t)}function lw(e,t,r){const s={};for(const o of Array.isArray(t)?t:[]){const l=Array.isArray(o==null?void 0:o.route)?o.route:typeof(o==null?void 0:o.name)=="string"?[o.name]:[];if(!l.length)continue;const u=l.join("/"),d=o.status==="up"||o.tunnel&&o.tunnel.status==="up",p=o.status==="passive"||o.tunnel&&o.tunnel.status==="passive";!d&&!p&&(s[u]=e&&e[u]||r)}return s}function qp(e,t,r){return!e||!Array.isArray(e.cells)?[]:e.cells.map(s=>({...s,route:t,key:`${r}:${s.tmuxSession||s.cell}`}))}function Kp({nodes:e,topology:t,remote:r,down:s,fleet:o}={}){var p,m,y,w;const l=[],u=new Set,d=new Set;for(const v of Array.isArray(e)?e:[]){if(!v||typeof v.name!="string"||!Up.test(v.name)||v.direction==="inbound"&&v.shared!==!0)continue;const _=[v.name],b=v.name;u.add(b);const E=((p=v.tunnel)==null?void 0:p.status)||"unknown",N=E==="up",R={name:v.name,label:v.label||v.name,route:_,direct:!0,instanceId:v.nodeId||null,shared:v.shared===!0,tunnelStatus:E,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:v.health||null,direction:v.direction||"outbound",roles:v.roles||null,rolesKnown:v.rolesKnown===!0};if(v.nodeId&&d.add(v.nodeId),!v.nodeId&&v.paired===!1){l.push({...R,status:"needs-repair",downSince:s&&s[b]||null});continue}if(((m=v.health)==null?void 0:m.auth)==="failed"||E==="degraded"&&((y=v.health)==null?void 0:y.status)==="degraded"){l.push({...R,status:"needs-repair",downSince:s&&s[b]||null});continue}if(E==="passive"||((w=v.health)==null?void 0:w.status)==="passive"){l.push({...R,status:"passive",downSince:null});continue}if(!N){l.push({...R,status:"down",downSince:s&&s[b]||null});continue}const O=r&&(r[b]||r[v.name])||null;if(!O||O.error||!Array.isArray(O.sessions)){l.push({...R,status:"unreachable"});continue}const z=O.sessions.filter(I=>I&&typeof I.name=="string"&&I.name).map(I=>({...I,node:b,route:_,key:`${b}:${I.name}`})),B=o&&(o[b]||o[v.name]),W=qp(B,_,b),A=new Set(W.map(I=>I.tmuxSession).filter(Boolean));l.push({...R,status:"up",sessions:z,cells:W,unmanaged:z.filter(I=>!A.has(I.name)),fleetAvailable:!!(B&&B.available),capabilities:B&&B.capabilities||[],engines:B&&B.engines||[],fleetProvider:B&&B.provider||null})}for(const v of Array.isArray(t)?t:[]){if(!v||!Array.isArray(v.route)||v.route.length<1||v.route.some(B=>!Up.test(B)))continue;const _=v.route.join("/");if(u.has(_)||v.instanceId&&d.has(v.instanceId))continue;v.instanceId&&d.add(v.instanceId);const b={name:v.name,label:v.label||v.route.join(" › "),route:[...v.route],direct:!1,instanceId:v.instanceId||null,shared:!0,tunnelStatus:null,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:v.health||null,lastSeen:v.lastSeen||null};if(v.stale){l.push({...b,status:"offline",downSince:s&&s[_]||v.lastSeen||null});continue}const E=r&&r[_]||null;if(!E||E.error||!Array.isArray(E.sessions)){l.push({...b,status:"unreachable",downSince:s&&s[_]||null});continue}const N=E.sessions.filter(B=>B&&typeof B.name=="string"&&B.name).map(B=>({...B,node:_,route:v.route,key:`${_}:${B.name}`})),R=o&&o[_],O=qp(R,v.route,_),z=new Set(O.map(B=>B.tmuxSession).filter(Boolean));l.push({...b,status:"up",sessions:N,cells:O,unmanaged:N.filter(B=>!z.has(B.name)),fleetAvailable:!!(R&&R.available),capabilities:R&&R.capabilities||[],engines:R&&R.engines||[],fleetProvider:R&&R.provider||null,lastSeen:v.lastSeen||null})}return l.sort((v,_)=>v.label.localeCompare(_.label))}const cw=4e3;function Dh(e,t=!0){const[r,s]=M.useState([]),o=M.useRef({});return M.useEffect(()=>{if(!t||!e){s([]);return}let l=!0;async function u(){var E;let p=[],m=[];if(await Promise.all([Zg(e).then(N=>{p=Array.isArray(N.nodes)?N.nodes:[]}).catch(()=>{}),qS(e).then(N=>{m=Array.isArray(N.nodes)?N.nodes:[]}).catch(()=>{})]),!l)return;const y={},w={},v=new Set(p.map(N=>N.name)),_=[];for(const N of p)((E=N.tunnel)==null?void 0:E.status)==="up"&&(N.nodeId||N.paired!==!1)&&(N.direction!=="inbound"||N.shared===!0)&&_.push([N.name]);for(const N of m)!N.stale&&Array.isArray(N.route)&&!(N.route.length===1&&v.has(N.route[0]))&&_.push(N.route);if(await Promise.all(_.map(async N=>{const R=N.join("/");try{y[R]=await e_(e,N)}catch{y[R]={error:"unreachable"}}try{w[R]=await an(e,N)}catch{w[R]={available:!1}}})),!l)return;const b=Kp({nodes:p,topology:m,remote:y,fleet:w,down:o.current});o.current=lw(o.current,b,Math.floor(Date.now()/1e3)),s(Kp({nodes:p,topology:m,remote:y,fleet:w,down:o.current}))}u();const d=setInterval(u,cw);return()=>{l=!1,clearInterval(d)}},[e,t]),r}function Vp(e,t){return t?0:e.attached?1:2}function qs(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function Ac(e){return e.status==="down"?e.downSince?S("tunnel-down-since").replace("{t}",qs(e.downSince)):S("tunnel-down"):e.status==="unreachable"?S("node-unreachable"):e.status==="offline"?e.lastSeen?S("node-offline-seen").replace("{t}",qs(e.lastSeen)):S("node-offline"):e.status==="needs-repair"?S("node-needs-repair"):""}function uw(e){return e?e.status==="healthy"?"on":"warn":null}function Yp(e){return e&&(e.detail||e.status)||""}function hw({onPick:e,token:t,onSettings:r}){const[s,o]=pi(),l=Dh(t),[u,d]=M.useState(null),[p,m]=M.useState(null),[y,w]=M.useState(""),[v,_]=M.useState(""),[b,E]=M.useState({bind:"127.0.0.1",port:""}),[N,R]=M.useState([]),[O,z]=M.useState(!1),[B,W]=M.useState(null),[A,I]=M.useState(null);async function V(){try{const X=await(await Nt("/api/sessions",t)).json();X.error?(m(X.error),d([])):(m(null),d(X.sessions||[]))}catch(x){m(String(x)),d([])}try{const x=await an(t);z(!!x.available),R(x.available?x.cells||[]:[])}catch{z(!1),R([])}}M.useEffect(()=>{V(),Nt("/api/config",t).then(X=>X.json()).then(X=>{_(X.version||""),E({bind:X.bind||"127.0.0.1",port:X.port||""})}).catch(()=>{});const x=setInterval(V,4e3);return()=>clearInterval(x)},[]);async function U(){if(!b.port)return;const x=`http://${b.bind}:${b.port}/#token=${t}`;try{await navigator.clipboard.writeText(x)}catch{}}async function ie(x){if(!B)return;const{cell:X}=B,re=Array.isArray(B.route)?B.route:[];x.action==="up"?await xh(t,{cell:X,boot:!!x.boot,...x.engine?{engine:x.engine}:{},...x.model!==void 0?{model:x.model}:{},...x.permissionPolicy?{permissionPolicy:x.permissionPolicy}:{}},re):await Pa(t,{cell:X,boot:!!x.boot},re),V()}async function ee(x,X=[]){try{await Eh(t,x,X)}catch{return}V()}async function k(x){if(!(!(x!=null&&x.direct)||A)){I(x.name);try{await Rh(t,x.name,x.tunnelStatus==="up"?"down":"up")}catch{}I(null)}}const D=M.useMemo(()=>{const x=new Map;for(const X of u||[])x.set(X.name,X);return x},[u]),j=M.useMemo(()=>new Set(N.map(x=>x.tmuxSession)),[N]),[Y,F]=M.useState(r_),Q=x=>F(X=>n_(X,x)),$=M.useMemo(()=>{const x=(u||[]).map(re=>{const se=Number(localStorage.getItem(Xg(re.name))||0),ae=!!(re.outbox&&re.outbox.count>0&&re.outbox.latest>se);return{...re,fresh:ae}}),X=y.trim().toLowerCase();return x.filter(re=>!X||re.name.toLowerCase().includes(X)).sort((re,se)=>Eu(zs(Y,re.name,re.activity),zs(Y,se.name,se.activity))||Vp(re,re.fresh)-Vp(se,se.fresh)||re.name.localeCompare(se.name))},[u,y,Y]),q=$.filter(x=>!j.has(x.name)),G=M.useMemo(()=>[...N].sort((x,X)=>Eu(zs(Y,x.tmuxSession,(D.get(x.tmuxSession)||{}).activity),zs(Y,X.tmuxSession,(D.get(X.tmuxSession)||{}).activity))||Number(X.active)-Number(x.active)||x.cell.localeCompare(X.cell)),[N,Y,D]),P=u?u.length:0,J=(u||[]).filter(x=>x.attached).length,L=b.port?`${b.bind}:${b.port}`:b.bind;return h.jsxs("div",{className:"nc-home",children:[h.jsxs("header",{className:"nc-home-head",children:[h.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",h.jsx("span",{className:"nc-cursor"})]}),h.jsxs("div",{className:"nc-home-sub",children:[S("fleet-tmux")," · ",P," ",S("sessions"),J>0&&` · ${J} attached`]}),h.jsxs("span",{className:"nc-head-actions",children:[h.jsx("button",{className:"nc-refresh",onClick:()=>r("nodes",!1),title:S("settings"),children:h.jsx(He,{name:"gear",size:18})}),h.jsx("button",{className:"nc-refresh",onClick:V,title:S("refresh"),children:h.jsx(He,{name:"refresh",size:18})})]})]}),h.jsxs("main",{className:"nc-home-scroll",children:[P>8&&h.jsx("input",{className:"nc-filter",type:"search",placeholder:S("filter-placeholder"),value:y,onChange:x=>w(x.target.value)}),p&&h.jsx("div",{className:"nc-err",children:p}),O&&N.length>0&&h.jsxs("section",{className:"nc-group",children:[h.jsx("div",{className:"nc-group-title",children:S("fleet")}),G.map(x=>{const X=D.get(x.tmuxSession)||{},re=x.degraded?"warn":x.tmux?"on":"",se=[`${x.engine}${x.key?`·${x.key}`:""}`,X.preview].filter(Boolean).join(" · ");return h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>x.tmux&&e(x.tmuxSession),title:x.degraded?S("cell-degraded"):x.tmux?S("cell-on"):S("cell-off"),children:[h.jsx("span",{className:`dot ${re}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:x.cell}),h.jsx("small",{children:se})]})]}),X.activity?h.jsx("span",{className:"nc-rel",children:qs(X.activity)}):null,X.outbox&&X.outbox.count>0&&h.jsx("span",{className:"nc-badge",title:S("new-files-outbox"),children:X.outbox.count}),h.jsx("button",{className:`nc-act pin${Y.includes(x.tmuxSession)?" on":""}`,title:S("pin"),onClick:()=>Q(x.tmuxSession),children:Y.includes(x.tmuxSession)?"★":"☆"}),h.jsx("button",{className:`nc-act power${x.tmux?" on":""}${x.degraded?" warn":""}`,onClick:()=>W(x),title:x.active?S("power-off"):S("power-on"),children:h.jsx(He,{name:"power",size:16})})]},x.cell)})]}),h.jsxs("section",{className:"nc-group",children:[h.jsx("div",{className:"nc-group-title",children:S("local")}),q.map(x=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(x.name),children:[h.jsx("span",{className:x.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:x.name}),h.jsx("small",{children:x.preview?x.preview:x.cmd?x.cmd:S("windows").replace("{n}",String(x.windows||0))})]})]}),x.activity?h.jsx("span",{className:"nc-rel",children:qs(x.activity)}):null,x.fresh&&h.jsx("span",{className:"nc-badge",title:S("new-files-outbox"),children:x.outbox.count}),h.jsx("button",{className:`nc-act pin${Y.includes(x.name)?" on":""}`,title:S("pin"),onClick:()=>Q(x.name),children:Y.includes(x.name)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:S("terminate"),onClick:()=>{window.confirm(S("terminate-confirm").replace("{name}",x.name))&&ee(x.name)},children:"⋯"})]},x.name)),u===null&&h.jsx("div",{className:"nc-empty",children:S("loading-fleet")}),u!==null&&q.length===0&&$.length===0&&!p&&h.jsx("div",{className:"nc-empty",children:y?S("no-match").replace("{q}",y):S("no-sessions")})]}),l.map(x=>{const re=uw(x.health)||(x.status==="up"?"on":"warn"),se=x.health?Yp(x.health):x.status==="up"?"":Ac(x);return h.jsxs("section",{className:"nc-group",children:[h.jsxs("div",{className:"nc-group-title nc-node-title",children:[h.jsx("span",{className:`dot ${re}`,title:se}),x.label||x.name," · ",x.status==="up"?S("node-sessions").replace("{n}",String(x.cells.length+x.unmanaged.length)):x.health&&Yp(x.health)||Ac(x),x.direct&&x.health&&x.health.managed!==!1&&h.jsx("button",{type:"button",className:`nc-act power${x.tunnelStatus==="up"?" on":""}`,disabled:A===x.name,title:x.tunnelStatus==="up"?S("power-off"):S("power-on"),onClick:()=>k(x),children:h.jsx(He,{name:"power",size:15})})]}),x.status==="up"&&x.cells.length>0&&x.cells.map(ae=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>ae.tmux&&e({session:ae.tmuxSession,node:(x.route||[x.name]).join("/")}),title:ae.active?S("cell-on"):S("cell-off"),children:[h.jsx("span",{className:`dot ${ae.degraded?"warn":ae.tmux?"on":""}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:ae.cell}),h.jsxs("small",{children:[`${ae.engine}${ae.key?`·${ae.key}`:""}`,ae.active?"":` · ${S("cell-off")}`]})]})]}),(x.capabilities||[]).includes(ae.active?"down":"up")&&h.jsx("button",{className:`nc-act power${ae.active?" on":""}${ae.degraded?" warn":""}`,title:ae.active?S("power-off"):S("power-on"),onClick:()=>W({...ae,route:x.route}),children:h.jsx(He,{name:"power",size:15})})]},ae.key)),x.status==="up"&&x.unmanaged.map(ae=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e({session:ae.name,node:ae.node}),children:[h.jsx("span",{className:ae.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:ae.name}),h.jsx("small",{children:ae.preview?ae.preview:ae.cmd?ae.cmd:S("windows").replace("{n}",String(ae.windows||0))})]})]}),ae.activity?h.jsx("span",{className:"nc-rel",children:qs(ae.activity)}):null,h.jsx("button",{className:"nc-menu",title:S("terminate"),onClick:()=>{window.confirm(S("terminate-confirm").replace("{name}",ae.name))&&ee(ae.name,x.route)},children:"⋯"})]},ae.key)),x.status==="up"&&x.cells.length===0&&x.unmanaged.length===0&&h.jsx("div",{className:"nc-empty",children:S("no-sessions-short")})]},`nodo-${(x.route||[x.name]).join("/")}`)}),h.jsxs("footer",{className:"nc-home-foot",onClick:U,title:S("copy-url"),children:[v&&h.jsxs("span",{children:["v",v]}),h.jsxs("span",{children:[L," · ",S("ssh-only")]}),h.jsx("span",{className:"nc-lang",onClick:x=>x.stopPropagation(),children:a_.map((x,X)=>h.jsxs("span",{children:[X>0&&" · ",h.jsx("button",{className:`nc-lang-btn${s===x?" on":""}`,onClick:()=>o(x),title:x,children:x.toUpperCase()})]},x))})]})]}),h.jsx("button",{className:"nc-fab",onClick:()=>r("fleet",!0),title:S("fleet-new-cell"),"aria-label":S("fleet-new-cell"),children:"+"}),B&&h.jsx(Da,{cell:B,token:t,route:Array.isArray(B.route)?B.route:[],onConfirm:ie,onClose:()=>W(null)})]})}/**
40
+ `+g.stack}return{value:i,source:n,stack:f,digest:null}}function ic(i,n,a){return{value:i,source:null,stack:a??null,digest:n??null}}function rc(i,n){try{console.error(n.value)}catch(a){setTimeout(function(){throw a})}}var tS=typeof WeakMap=="function"?WeakMap:Map;function Ff(i,n,a){a=er(-1,a),a.tag=3,a.payload={element:null};var c=n.value;return a.callback=function(){Xo||(Xo=!0,vc=c),rc(i,n)},a}function Hf(i,n,a){a=er(-1,a),a.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var f=n.value;a.payload=function(){return c(f)},a.callback=function(){rc(i,n)}}var g=i.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(a.callback=function(){rc(i,n),typeof c!="function"&&(Sr===null?Sr=new Set([this]):Sr.add(this));var C=n.stack;this.componentDidCatch(n.value,{componentStack:C!==null?C:""})}),a}function $f(i,n,a){var c=i.pingCache;if(c===null){c=i.pingCache=new tS;var f=new Set;c.set(n,f)}else f=c.get(n),f===void 0&&(f=new Set,c.set(n,f));f.has(a)||(f.add(a),i=mS.bind(null,i,n,a),n.then(i,i))}function Wf(i){do{var n;if((n=i.tag===13)&&(n=i.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return i;i=i.return}while(i!==null);return null}function Uf(i,n,a,c,f){return(i.mode&1)===0?(i===n?i.flags|=65536:(i.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(n=er(-1,1),n.tag=2,vr(a,n,1))),a.lanes|=1),i):(i.flags|=65536,i.lanes=f,i)}var iS=B.ReactCurrentOwner,Yt=!1;function Ht(i,n,a,c){n.child=i===null?uf(n,null,a,c):En(n,i.child,a,c)}function qf(i,n,a,c,f){a=a.render;var g=n.ref;return Rn(n,f),c=Yl(i,n,a,c,g,f),a=Xl(),i!==null&&!Yt?(n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~f,tr(i,n,f)):(Qe&&a&&Ll(n),n.flags|=1,Ht(i,n,c,f),n.child)}function Kf(i,n,a,c,f){if(i===null){var g=a.type;return typeof g=="function"&&!kc(g)&&g.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(n.tag=15,n.type=g,Vf(i,n,g,c,f)):(i=ta(a.type,null,c,n,n.mode,f),i.ref=n.ref,i.return=n,n.child=i)}if(g=i.child,(i.lanes&f)===0){var C=g.memoizedProps;if(a=a.compare,a=a!==null?a:ls,a(C,c)&&i.ref===n.ref)return tr(i,n,f)}return n.flags|=1,i=xr(g,c),i.ref=n.ref,i.return=n,n.child=i}function Vf(i,n,a,c,f){if(i!==null){var g=i.memoizedProps;if(ls(g,c)&&i.ref===n.ref)if(Yt=!1,n.pendingProps=c=g,(i.lanes&f)!==0)(i.flags&131072)!==0&&(Yt=!0);else return n.lanes=i.lanes,tr(i,n,f)}return nc(i,n,a,c,f)}function Yf(i,n,a){var c=n.pendingProps,f=c.children,g=i!==null?i.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(Mn,ai),ai|=a;else{if((a&1073741824)===0)return i=g!==null?g.baseLanes|a:a,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:i,cachePool:null,transitions:null},n.updateQueue=null,qe(Mn,ai),ai|=i,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=g!==null?g.baseLanes:a,qe(Mn,ai),ai|=c}else g!==null?(c=g.baseLanes|a,n.memoizedState=null):c=a,qe(Mn,ai),ai|=c;return Ht(i,n,f,a),n.child}function Xf(i,n){var a=n.ref;(i===null&&a!==null||i!==null&&i.ref!==a)&&(n.flags|=512,n.flags|=2097152)}function nc(i,n,a,c,f){var g=Vt(a)?Fr:jt.current;return g=bn(n,g),Rn(n,f),a=Yl(i,n,a,c,g,f),c=Xl(),i!==null&&!Yt?(n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~f,tr(i,n,f)):(Qe&&c&&Ll(n),n.flags|=1,Ht(i,n,a,f),n.child)}function Gf(i,n,a,c,f){if(Vt(a)){var g=!0;Eo(n)}else g=!1;if(Rn(n,f),n.stateNode===null)Uo(i,n),Of(n,a,c),tc(n,a,c,f),c=!0;else if(i===null){var C=n.stateNode,T=n.memoizedProps;C.props=T;var H=C.context,ne=a.contextType;typeof ne=="object"&&ne!==null?ne=_i(ne):(ne=Vt(a)?Fr:jt.current,ne=bn(n,ne));var he=a.getDerivedStateFromProps,fe=typeof he=="function"||typeof C.getSnapshotBeforeUpdate=="function";fe||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(T!==c||H!==ne)&&zf(n,C,c,ne),_r=!1;var ue=n.memoizedState;C.state=ue,Bo(n,c,C,f),H=n.memoizedState,T!==c||ue!==H||Kt.current||_r?(typeof he=="function"&&(ec(n,a,he,c),H=n.memoizedState),(T=_r||Af(n,a,T,c,ue,H,ne))?(fe||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(n.flags|=4194308)):(typeof C.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=H),C.props=c,C.state=H,C.context=ne,c=T):(typeof C.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{C=n.stateNode,df(i,n),T=n.memoizedProps,ne=n.type===n.elementType?T:Pi(n.type,T),C.props=ne,fe=n.pendingProps,ue=C.context,H=a.contextType,typeof H=="object"&&H!==null?H=_i(H):(H=Vt(a)?Fr:jt.current,H=bn(n,H));var Se=a.getDerivedStateFromProps;(he=typeof Se=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(T!==fe||ue!==H)&&zf(n,C,c,H),_r=!1,ue=n.memoizedState,C.state=ue,Bo(n,c,C,f);var be=n.memoizedState;T!==fe||ue!==be||Kt.current||_r?(typeof Se=="function"&&(ec(n,a,Se,c),be=n.memoizedState),(ne=_r||Af(n,a,ne,c,ue,be,H)||!1)?(he||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(c,be,H),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(c,be,H)),typeof C.componentDidUpdate=="function"&&(n.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof C.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=be),C.props=c,C.state=be,C.context=H,c=ne):(typeof C.componentDidUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&ue===i.memoizedState||(n.flags|=1024),c=!1)}return sc(i,n,a,c,g,f)}function sc(i,n,a,c,f,g){Xf(i,n);var C=(n.flags&128)!==0;if(!c&&!C)return f&&ef(n,a,!1),tr(i,n,g);c=n.stateNode,iS.current=n;var T=C&&typeof a.getDerivedStateFromError!="function"?null:c.render();return n.flags|=1,i!==null&&C?(n.child=En(n,i.child,null,g),n.child=En(n,null,T,g)):Ht(i,n,T,g),n.memoizedState=c.state,f&&ef(n,a,!0),n.child}function Qf(i){var n=i.stateNode;n.pendingContext?Jd(i,n.pendingContext,n.pendingContext!==n.context):n.context&&Jd(i,n.context,!1),$l(i,n.containerInfo)}function Jf(i,n,a,c,f){return kn(),Bl(f),n.flags|=256,Ht(i,n,a,c),n.child}var oc={dehydrated:null,treeContext:null,retryLane:0};function ac(i){return{baseLanes:i,cachePool:null,transitions:null}}function Zf(i,n,a){var c=n.pendingProps,f=Ze.current,g=!1,C=(n.flags&128)!==0,T;if((T=C)||(T=i!==null&&i.memoizedState===null?!1:(f&2)!==0),T?(g=!0,n.flags&=-129):(i===null||i.memoizedState!==null)&&(f|=1),qe(Ze,f&1),i===null)return jl(n),i=n.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((n.mode&1)===0?n.lanes=1:i.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(C=c.children,i=c.fallback,g?(c=n.mode,g=n.child,C={mode:"hidden",children:C},(c&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=C):g=ia(C,c,0,null),i=Gr(i,c,a,null),g.return=n,i.return=n,g.sibling=i,n.child=g,n.child.memoizedState=ac(a),n.memoizedState=oc,i):lc(n,C));if(f=i.memoizedState,f!==null&&(T=f.dehydrated,T!==null))return rS(i,n,C,c,T,f,a);if(g){g=c.fallback,C=n.mode,f=i.child,T=f.sibling;var H={mode:"hidden",children:c.children};return(C&1)===0&&n.child!==f?(c=n.child,c.childLanes=0,c.pendingProps=H,n.deletions=null):(c=xr(f,H),c.subtreeFlags=f.subtreeFlags&14680064),T!==null?g=xr(T,g):(g=Gr(g,C,a,null),g.flags|=2),g.return=n,c.return=n,c.sibling=g,n.child=c,c=g,g=n.child,C=i.child.memoizedState,C=C===null?ac(a):{baseLanes:C.baseLanes|a,cachePool:null,transitions:C.transitions},g.memoizedState=C,g.childLanes=i.childLanes&~a,n.memoizedState=oc,c}return g=i.child,i=g.sibling,c=xr(g,{mode:"visible",children:c.children}),(n.mode&1)===0&&(c.lanes=a),c.return=n,c.sibling=null,i!==null&&(a=n.deletions,a===null?(n.deletions=[i],n.flags|=16):a.push(i)),n.child=c,n.memoizedState=null,c}function lc(i,n){return n=ia({mode:"visible",children:n},i.mode,0,null),n.return=i,i.child=n}function Wo(i,n,a,c){return c!==null&&Bl(c),En(n,i.child,null,a),i=lc(n,n.pendingProps.children),i.flags|=2,n.memoizedState=null,i}function rS(i,n,a,c,f,g,C){if(a)return n.flags&256?(n.flags&=-257,c=ic(Error(r(422))),Wo(i,n,C,c)):n.memoizedState!==null?(n.child=i.child,n.flags|=128,null):(g=c.fallback,f=n.mode,c=ia({mode:"visible",children:c.children},f,0,null),g=Gr(g,f,C,null),g.flags|=2,c.return=n,g.return=n,c.sibling=g,n.child=c,(n.mode&1)!==0&&En(n,i.child,null,C),n.child.memoizedState=ac(C),n.memoizedState=oc,g);if((n.mode&1)===0)return Wo(i,n,C,null);if(f.data==="$!"){if(c=f.nextSibling&&f.nextSibling.dataset,c)var T=c.dgst;return c=T,g=Error(r(419)),c=ic(g,c,void 0),Wo(i,n,C,c)}if(T=(C&i.childLanes)!==0,Yt||T){if(c=wt,c!==null){switch(C&-C){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(c.suspendedLanes|C))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,Zi(i,f),Mi(c,i,f,-1))}return xc(),c=ic(Error(r(421))),Wo(i,n,C,c)}return f.data==="$?"?(n.flags|=128,n.child=i.child,n=gS.bind(null,i),f._reactRetry=n,null):(i=g.treeContext,oi=fr(f.nextSibling),si=n,Qe=!0,Ri=null,i!==null&&(mi[gi++]=Qi,mi[gi++]=Ji,mi[gi++]=Hr,Qi=i.id,Ji=i.overflow,Hr=n),n=lc(n,c.children),n.flags|=4096,n)}function ep(i,n,a){i.lanes|=n;var c=i.alternate;c!==null&&(c.lanes|=n),zl(i.return,n,a)}function cc(i,n,a,c,f){var g=i.memoizedState;g===null?i.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(g.isBackwards=n,g.rendering=null,g.renderingStartTime=0,g.last=c,g.tail=a,g.tailMode=f)}function tp(i,n,a){var c=n.pendingProps,f=c.revealOrder,g=c.tail;if(Ht(i,n,c.children,a),c=Ze.current,(c&2)!==0)c=c&1|2,n.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=n.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&ep(i,a,n);else if(i.tag===19)ep(i,a,n);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(qe(Ze,c),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(a=n.child,f=null;a!==null;)i=a.alternate,i!==null&&Io(i)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),cc(n,!1,f,a,g);break;case"backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(i=f.alternate,i!==null&&Io(i)===null){n.child=f;break}i=f.sibling,f.sibling=a,a=f,f=i}cc(n,!0,a,null,g);break;case"together":cc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function Uo(i,n){(n.mode&1)===0&&i!==null&&(i.alternate=null,n.alternate=null,n.flags|=2)}function tr(i,n,a){if(i!==null&&(n.dependencies=i.dependencies),Kr|=n.lanes,(a&n.childLanes)===0)return null;if(i!==null&&n.child!==i.child)throw Error(r(153));if(n.child!==null){for(i=n.child,a=xr(i,i.pendingProps),n.child=a,a.return=n;i.sibling!==null;)i=i.sibling,a=a.sibling=xr(i,i.pendingProps),a.return=n;a.sibling=null}return n.child}function nS(i,n,a){switch(n.tag){case 3:Qf(n),kn();break;case 5:mf(n);break;case 1:Vt(n.type)&&Eo(n);break;case 4:$l(n,n.stateNode.containerInfo);break;case 10:var c=n.type._context,f=n.memoizedProps.value;qe(Mo,c._currentValue),c._currentValue=f;break;case 13:if(c=n.memoizedState,c!==null)return c.dehydrated!==null?(qe(Ze,Ze.current&1),n.flags|=128,null):(a&n.child.childLanes)!==0?Zf(i,n,a):(qe(Ze,Ze.current&1),i=tr(i,n,a),i!==null?i.sibling:null);qe(Ze,Ze.current&1);break;case 19:if(c=(a&n.childLanes)!==0,(i.flags&128)!==0){if(c)return tp(i,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),qe(Ze,Ze.current),c)break;return null;case 22:case 23:return n.lanes=0,Yf(i,n,a)}return tr(i,n,a)}var ip,uc,rp,np;ip=function(i,n){for(var a=n.child;a!==null;){if(a.tag===5||a.tag===6)i.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},uc=function(){},rp=function(i,n,a,c){var f=i.memoizedProps;if(f!==c){i=n.stateNode,Ur(Ai.current);var g=null;switch(a){case"input":f=De(i,f),c=De(i,c),g=[];break;case"select":f=G({},f,{value:void 0}),c=G({},c,{value:void 0}),g=[];break;case"textarea":f=ei(i,f),c=ei(i,c),g=[];break;default:typeof f.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=Co)}Le(a,c);var C;a=null;for(ne in f)if(!c.hasOwnProperty(ne)&&f.hasOwnProperty(ne)&&f[ne]!=null)if(ne==="style"){var T=f[ne];for(C in T)T.hasOwnProperty(C)&&(a||(a={}),a[C]="")}else ne!=="dangerouslySetInnerHTML"&&ne!=="children"&&ne!=="suppressContentEditableWarning"&&ne!=="suppressHydrationWarning"&&ne!=="autoFocus"&&(o.hasOwnProperty(ne)?g||(g=[]):(g=g||[]).push(ne,null));for(ne in c){var H=c[ne];if(T=f!=null?f[ne]:void 0,c.hasOwnProperty(ne)&&H!==T&&(H!=null||T!=null))if(ne==="style")if(T){for(C in T)!T.hasOwnProperty(C)||H&&H.hasOwnProperty(C)||(a||(a={}),a[C]="");for(C in H)H.hasOwnProperty(C)&&T[C]!==H[C]&&(a||(a={}),a[C]=H[C])}else a||(g||(g=[]),g.push(ne,a)),a=H;else ne==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,T=T?T.__html:void 0,H!=null&&T!==H&&(g=g||[]).push(ne,H)):ne==="children"?typeof H!="string"&&typeof H!="number"||(g=g||[]).push(ne,""+H):ne!=="suppressContentEditableWarning"&&ne!=="suppressHydrationWarning"&&(o.hasOwnProperty(ne)?(H!=null&&ne==="onScroll"&&Ke("scroll",i),g||T===H||(g=[])):(g=g||[]).push(ne,H))}a&&(g=g||[]).push("style",a);var ne=g;(n.updateQueue=ne)&&(n.flags|=4)}},np=function(i,n,a,c){a!==c&&(n.flags|=4)};function Cs(i,n){if(!Qe)switch(i.tailMode){case"hidden":n=i.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function It(i){var n=i.alternate!==null&&i.alternate.child===i.child,a=0,c=0;if(n)for(var f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&14680064,c|=f.flags&14680064,f.return=i,f=f.sibling;else for(f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=c,i.childLanes=a,n}function sS(i,n,a){var c=n.pendingProps;switch(Ml(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return It(n),null;case 1:return Vt(n.type)&&ko(),It(n),null;case 3:return c=n.stateNode,Pn(),Ve(Kt),Ve(jt),ql(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Do(n)?n.flags|=4:i===null||i.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Ri!==null&&(wc(Ri),Ri=null))),uc(i,n),It(n),null;case 5:Wl(n);var f=Ur(vs.current);if(a=n.type,i!==null&&n.stateNode!=null)rp(i,n,a,c,f),i.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!c){if(n.stateNode===null)throw Error(r(166));return It(n),null}if(i=Ur(Ai.current),Do(n)){c=n.stateNode,a=n.type;var g=n.memoizedProps;switch(c[Ii]=n,c[fs]=g,i=(n.mode&1)!==0,a){case"dialog":Ke("cancel",c),Ke("close",c);break;case"iframe":case"object":case"embed":Ke("load",c);break;case"video":case"audio":for(f=0;f<us.length;f++)Ke(us[f],c);break;case"source":Ke("error",c);break;case"img":case"image":case"link":Ke("error",c),Ke("load",c);break;case"details":Ke("toggle",c);break;case"input":Xe(c,g),Ke("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!g.multiple},Ke("invalid",c);break;case"textarea":jr(c,g),Ke("invalid",c)}Le(a,g),f=null;for(var C in g)if(g.hasOwnProperty(C)){var T=g[C];C==="children"?typeof T=="string"?c.textContent!==T&&(g.suppressHydrationWarning!==!0&&bo(c.textContent,T,i),f=["children",T]):typeof T=="number"&&c.textContent!==""+T&&(g.suppressHydrationWarning!==!0&&bo(c.textContent,T,i),f=["children",""+T]):o.hasOwnProperty(C)&&T!=null&&C==="onScroll"&&Ke("scroll",c)}switch(a){case"input":Oe(c),at(c,g,!0);break;case"textarea":Oe(c),Ir(c);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(c.onclick=Co)}c=f,n.updateQueue=c,c!==null&&(n.flags|=4)}else{C=f.nodeType===9?f:f.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ar(a)),i==="http://www.w3.org/1999/xhtml"?a==="script"?(i=C.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof c.is=="string"?i=C.createElement(a,{is:c.is}):(i=C.createElement(a),a==="select"&&(C=i,c.multiple?C.multiple=!0:c.size&&(C.size=c.size))):i=C.createElementNS(i,a),i[Ii]=n,i[fs]=c,ip(i,n,!1,!1),n.stateNode=i;e:{switch(C=Pt(a,c),a){case"dialog":Ke("cancel",i),Ke("close",i),f=c;break;case"iframe":case"object":case"embed":Ke("load",i),f=c;break;case"video":case"audio":for(f=0;f<us.length;f++)Ke(us[f],i);f=c;break;case"source":Ke("error",i),f=c;break;case"img":case"image":case"link":Ke("error",i),Ke("load",i),f=c;break;case"details":Ke("toggle",i),f=c;break;case"input":Xe(i,c),f=De(i,c),Ke("invalid",i);break;case"option":f=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},f=G({},c,{value:void 0}),Ke("invalid",i);break;case"textarea":jr(i,c),f=ei(i,c),Ke("invalid",i);break;default:f=c}Le(a,f),T=f;for(g in T)if(T.hasOwnProperty(g)){var H=T[g];g==="style"?le(i,H):g==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,H!=null&&Yi(i,H)):g==="children"?typeof H=="string"?(a!=="textarea"||H!=="")&&ii(i,H):typeof H=="number"&&ii(i,""+H):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(o.hasOwnProperty(g)?H!=null&&g==="onScroll"&&Ke("scroll",i):H!=null&&z(i,g,H,C))}switch(a){case"input":Oe(i),at(i,c,!1);break;case"textarea":Oe(i),Ir(i);break;case"option":c.value!=null&&i.setAttribute("value",""+ae(c.value));break;case"select":i.multiple=!!c.multiple,g=c.value,g!=null?ki(i,!!c.multiple,g,!1):c.defaultValue!=null&&ki(i,!!c.multiple,c.defaultValue,!0);break;default:typeof f.onClick=="function"&&(i.onclick=Co)}switch(a){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return It(n),null;case 6:if(i&&n.stateNode!=null)np(i,n,i.memoizedProps,c);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(a=Ur(vs.current),Ur(Ai.current),Do(n)){if(c=n.stateNode,a=n.memoizedProps,c[Ii]=n,(g=c.nodeValue!==a)&&(i=si,i!==null))switch(i.tag){case 3:bo(c.nodeValue,a,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&bo(c.nodeValue,a,(i.mode&1)!==0)}g&&(n.flags|=4)}else c=(a.nodeType===9?a:a.ownerDocument).createTextNode(c),c[Ii]=n,n.stateNode=c}return It(n),null;case 13:if(Ve(Ze),c=n.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Qe&&oi!==null&&(n.mode&1)!==0&&(n.flags&128)===0)af(),kn(),n.flags|=98560,g=!1;else if(g=Do(n),c!==null&&c.dehydrated!==null){if(i===null){if(!g)throw Error(r(318));if(g=n.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Ii]=n}else kn(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;It(n),g=!1}else Ri!==null&&(wc(Ri),Ri=null),g=!0;if(!g)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=a,n):(c=c!==null,c!==(i!==null&&i.memoizedState!==null)&&c&&(n.child.flags|=8192,(n.mode&1)!==0&&(i===null||(Ze.current&1)!==0?gt===0&&(gt=3):xc())),n.updateQueue!==null&&(n.flags|=4),It(n),null);case 4:return Pn(),uc(i,n),i===null&&hs(n.stateNode.containerInfo),It(n),null;case 10:return Ol(n.type._context),It(n),null;case 17:return Vt(n.type)&&ko(),It(n),null;case 19:if(Ve(Ze),g=n.memoizedState,g===null)return It(n),null;if(c=(n.flags&128)!==0,C=g.rendering,C===null)if(c)Cs(g,!1);else{if(gt!==0||i!==null&&(i.flags&128)!==0)for(i=n.child;i!==null;){if(C=Io(i),C!==null){for(n.flags|=128,Cs(g,!1),c=C.updateQueue,c!==null&&(n.updateQueue=c,n.flags|=4),n.subtreeFlags=0,c=a,a=n.child;a!==null;)g=a,i=c,g.flags&=14680066,C=g.alternate,C===null?(g.childLanes=0,g.lanes=i,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=C.childLanes,g.lanes=C.lanes,g.child=C.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=C.memoizedProps,g.memoizedState=C.memoizedState,g.updateQueue=C.updateQueue,g.type=C.type,i=C.dependencies,g.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),a=a.sibling;return qe(Ze,Ze.current&1|2),n.child}i=i.sibling}g.tail!==null&&lt()>Tn&&(n.flags|=128,c=!0,Cs(g,!1),n.lanes=4194304)}else{if(!c)if(i=Io(C),i!==null){if(n.flags|=128,c=!0,a=i.updateQueue,a!==null&&(n.updateQueue=a,n.flags|=4),Cs(g,!0),g.tail===null&&g.tailMode==="hidden"&&!C.alternate&&!Qe)return It(n),null}else 2*lt()-g.renderingStartTime>Tn&&a!==1073741824&&(n.flags|=128,c=!0,Cs(g,!1),n.lanes=4194304);g.isBackwards?(C.sibling=n.child,n.child=C):(a=g.last,a!==null?a.sibling=C:n.child=C,g.last=C)}return g.tail!==null?(n=g.tail,g.rendering=n,g.tail=n.sibling,g.renderingStartTime=lt(),n.sibling=null,a=Ze.current,qe(Ze,c?a&1|2:a&1),n):(It(n),null);case 22:case 23:return Cc(),c=n.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(n.flags|=8192),c&&(n.mode&1)!==0?(ai&1073741824)!==0&&(It(n),n.subtreeFlags&6&&(n.flags|=8192)):It(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function oS(i,n){switch(Ml(n),n.tag){case 1:return Vt(n.type)&&ko(),i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 3:return Pn(),Ve(Kt),Ve(jt),ql(),i=n.flags,(i&65536)!==0&&(i&128)===0?(n.flags=i&-65537|128,n):null;case 5:return Wl(n),null;case 13:if(Ve(Ze),i=n.memoizedState,i!==null&&i.dehydrated!==null){if(n.alternate===null)throw Error(r(340));kn()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 19:return Ve(Ze),null;case 4:return Pn(),null;case 10:return Ol(n.type._context),null;case 22:case 23:return Cc(),null;case 24:return null;default:return null}}var qo=!1,At=!1,aS=typeof WeakSet=="function"?WeakSet:Set,we=null;function Ln(i,n){var a=i.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(c){rt(i,n,c)}else a.current=null}function hc(i,n,a){try{a()}catch(c){rt(i,n,c)}}var sp=!1;function lS(i,n){if(Cl=uo,i=Id(),ml(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{a.nodeType,g.nodeType}catch{a=null;break e}var C=0,T=-1,H=-1,ne=0,he=0,fe=i,ue=null;t:for(;;){for(var Se;fe!==a||f!==0&&fe.nodeType!==3||(T=C+f),fe!==g||c!==0&&fe.nodeType!==3||(H=C+c),fe.nodeType===3&&(C+=fe.nodeValue.length),(Se=fe.firstChild)!==null;)ue=fe,fe=Se;for(;;){if(fe===i)break t;if(ue===a&&++ne===f&&(T=C),ue===g&&++he===c&&(H=C),(Se=fe.nextSibling)!==null)break;fe=ue,ue=fe.parentNode}fe=Se}a=T===-1||H===-1?null:{start:T,end:H}}else a=null}a=a||{start:0,end:0}}else a=null;for(xl={focusedElem:i,selectionRange:a},uo=!1,we=n;we!==null;)if(n=we,i=n.child,(n.subtreeFlags&1028)!==0&&i!==null)i.return=n,we=i;else for(;we!==null;){n=we;try{var be=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(be!==null){var Ce=be.memoizedProps,ct=be.memoizedState,Z=n.stateNode,K=Z.getSnapshotBeforeUpdate(n.elementType===n.type?Ce:Pi(n.type,Ce),ct);Z.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var te=n.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ge){rt(n,n.return,ge)}if(i=n.sibling,i!==null){i.return=n.return,we=i;break}we=n.return}return be=sp,sp=!1,be}function xs(i,n,a){var c=n.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var f=c=c.next;do{if((f.tag&i)===i){var g=f.destroy;f.destroy=void 0,g!==void 0&&hc(n,a,g)}f=f.next}while(f!==c)}}function Ko(i,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&i)===i){var c=a.create;a.destroy=c()}a=a.next}while(a!==n)}}function dc(i){var n=i.ref;if(n!==null){var a=i.stateNode;switch(i.tag){case 5:i=a;break;default:i=a}typeof n=="function"?n(i):n.current=i}}function op(i){var n=i.alternate;n!==null&&(i.alternate=null,op(n)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(n=i.stateNode,n!==null&&(delete n[Ii],delete n[fs],delete n[Rl],delete n[Uy],delete n[qy])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function ap(i){return i.tag===5||i.tag===3||i.tag===4}function lp(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||ap(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function fc(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?a.nodeType===8?a.parentNode.insertBefore(i,n):a.insertBefore(i,n):(a.nodeType===8?(n=a.parentNode,n.insertBefore(i,a)):(n=a,n.appendChild(i)),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Co));else if(c!==4&&(i=i.child,i!==null))for(fc(i,n,a),i=i.sibling;i!==null;)fc(i,n,a),i=i.sibling}function pc(i,n,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,n?a.insertBefore(i,n):a.appendChild(i);else if(c!==4&&(i=i.child,i!==null))for(pc(i,n,a),i=i.sibling;i!==null;)pc(i,n,a),i=i.sibling}var Dt=null,Di=!1;function yr(i,n,a){for(a=a.child;a!==null;)cp(i,n,a),a=a.sibling}function cp(i,n,a){if(Bi&&typeof Bi.onCommitFiberUnmount=="function")try{Bi.onCommitFiberUnmount(no,a)}catch{}switch(a.tag){case 5:At||Ln(a,n);case 6:var c=Dt,f=Di;Dt=null,yr(i,n,a),Dt=c,Di=f,Dt!==null&&(Di?(i=Dt,a=a.stateNode,i.nodeType===8?i.parentNode.removeChild(a):i.removeChild(a)):Dt.removeChild(a.stateNode));break;case 18:Dt!==null&&(Di?(i=Dt,a=a.stateNode,i.nodeType===8?Nl(i.parentNode,a):i.nodeType===1&&Nl(i,a),is(i)):Nl(Dt,a.stateNode));break;case 4:c=Dt,f=Di,Dt=a.stateNode.containerInfo,Di=!0,yr(i,n,a),Dt=c,Di=f;break;case 0:case 11:case 14:case 15:if(!At&&(c=a.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){f=c=c.next;do{var g=f,C=g.destroy;g=g.tag,C!==void 0&&((g&2)!==0||(g&4)!==0)&&hc(a,n,C),f=f.next}while(f!==c)}yr(i,n,a);break;case 1:if(!At&&(Ln(a,n),c=a.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(T){rt(a,n,T)}yr(i,n,a);break;case 21:yr(i,n,a);break;case 22:a.mode&1?(At=(c=At)||a.memoizedState!==null,yr(i,n,a),At=c):yr(i,n,a);break;default:yr(i,n,a)}}function up(i){var n=i.updateQueue;if(n!==null){i.updateQueue=null;var a=i.stateNode;a===null&&(a=i.stateNode=new aS),n.forEach(function(c){var f=_S.bind(null,i,c);a.has(c)||(a.add(c),c.then(f,f))})}}function Li(i,n){var a=n.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];try{var g=i,C=n,T=C;e:for(;T!==null;){switch(T.tag){case 5:Dt=T.stateNode,Di=!1;break e;case 3:Dt=T.stateNode.containerInfo,Di=!0;break e;case 4:Dt=T.stateNode.containerInfo,Di=!0;break e}T=T.return}if(Dt===null)throw Error(r(160));cp(g,C,f),Dt=null,Di=!1;var H=f.alternate;H!==null&&(H.return=null),f.return=null}catch(ne){rt(f,n,ne)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)hp(n,i),n=n.sibling}function hp(i,n){var a=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(Li(n,i),zi(i),c&4){try{xs(3,i,i.return),Ko(3,i)}catch(Ce){rt(i,i.return,Ce)}try{xs(5,i,i.return)}catch(Ce){rt(i,i.return,Ce)}}break;case 1:Li(n,i),zi(i),c&512&&a!==null&&Ln(a,a.return);break;case 5:if(Li(n,i),zi(i),c&512&&a!==null&&Ln(a,a.return),i.flags&32){var f=i.stateNode;try{ii(f,"")}catch(Ce){rt(i,i.return,Ce)}}if(c&4&&(f=i.stateNode,f!=null)){var g=i.memoizedProps,C=a!==null?a.memoizedProps:g,T=i.type,H=i.updateQueue;if(i.updateQueue=null,H!==null)try{T==="input"&&g.type==="radio"&&g.name!=null&&ot(f,g),Pt(T,C);var ne=Pt(T,g);for(C=0;C<H.length;C+=2){var he=H[C],fe=H[C+1];he==="style"?le(f,fe):he==="dangerouslySetInnerHTML"?Yi(f,fe):he==="children"?ii(f,fe):z(f,he,fe,ne)}switch(T){case"input":zt(f,g);break;case"textarea":Br(f,g);break;case"select":var ue=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var Se=g.value;Se!=null?ki(f,!!g.multiple,Se,!1):ue!==!!g.multiple&&(g.defaultValue!=null?ki(f,!!g.multiple,g.defaultValue,!0):ki(f,!!g.multiple,g.multiple?[]:"",!1))}f[fs]=g}catch(Ce){rt(i,i.return,Ce)}}break;case 6:if(Li(n,i),zi(i),c&4){if(i.stateNode===null)throw Error(r(162));f=i.stateNode,g=i.memoizedProps;try{f.nodeValue=g}catch(Ce){rt(i,i.return,Ce)}}break;case 3:if(Li(n,i),zi(i),c&4&&a!==null&&a.memoizedState.isDehydrated)try{is(n.containerInfo)}catch(Ce){rt(i,i.return,Ce)}break;case 4:Li(n,i),zi(i);break;case 13:Li(n,i),zi(i),f=i.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(_c=lt())),c&4&&up(i);break;case 22:if(he=a!==null&&a.memoizedState!==null,i.mode&1?(At=(ne=At)||he,Li(n,i),At=ne):Li(n,i),zi(i),c&8192){if(ne=i.memoizedState!==null,(i.stateNode.isHidden=ne)&&!he&&(i.mode&1)!==0)for(we=i,he=i.child;he!==null;){for(fe=we=he;we!==null;){switch(ue=we,Se=ue.child,ue.tag){case 0:case 11:case 14:case 15:xs(4,ue,ue.return);break;case 1:Ln(ue,ue.return);var be=ue.stateNode;if(typeof be.componentWillUnmount=="function"){c=ue,a=ue.return;try{n=c,be.props=n.memoizedProps,be.state=n.memoizedState,be.componentWillUnmount()}catch(Ce){rt(c,a,Ce)}}break;case 5:Ln(ue,ue.return);break;case 22:if(ue.memoizedState!==null){pp(fe);continue}}Se!==null?(Se.return=ue,we=Se):pp(fe)}he=he.sibling}e:for(he=null,fe=i;;){if(fe.tag===5){if(he===null){he=fe;try{f=fe.stateNode,ne?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(T=fe.stateNode,H=fe.memoizedProps.style,C=H!=null&&H.hasOwnProperty("display")?H.display:null,T.style.display=$e("display",C))}catch(Ce){rt(i,i.return,Ce)}}}else if(fe.tag===6){if(he===null)try{fe.stateNode.nodeValue=ne?"":fe.memoizedProps}catch(Ce){rt(i,i.return,Ce)}}else if((fe.tag!==22&&fe.tag!==23||fe.memoizedState===null||fe===i)&&fe.child!==null){fe.child.return=fe,fe=fe.child;continue}if(fe===i)break e;for(;fe.sibling===null;){if(fe.return===null||fe.return===i)break e;he===fe&&(he=null),fe=fe.return}he===fe&&(he=null),fe.sibling.return=fe.return,fe=fe.sibling}}break;case 19:Li(n,i),zi(i),c&4&&up(i);break;case 21:break;default:Li(n,i),zi(i)}}function zi(i){var n=i.flags;if(n&2){try{e:{for(var a=i.return;a!==null;){if(ap(a)){var c=a;break e}a=a.return}throw Error(r(160))}switch(c.tag){case 5:var f=c.stateNode;c.flags&32&&(ii(f,""),c.flags&=-33);var g=lp(i);pc(i,g,f);break;case 3:case 4:var C=c.stateNode.containerInfo,T=lp(i);fc(i,T,C);break;default:throw Error(r(161))}}catch(H){rt(i,i.return,H)}i.flags&=-3}n&4096&&(i.flags&=-4097)}function cS(i,n,a){we=i,dp(i)}function dp(i,n,a){for(var c=(i.mode&1)!==0;we!==null;){var f=we,g=f.child;if(f.tag===22&&c){var C=f.memoizedState!==null||qo;if(!C){var T=f.alternate,H=T!==null&&T.memoizedState!==null||At;T=qo;var ne=At;if(qo=C,(At=H)&&!ne)for(we=f;we!==null;)C=we,H=C.child,C.tag===22&&C.memoizedState!==null?mp(f):H!==null?(H.return=C,we=H):mp(f);for(;g!==null;)we=g,dp(g),g=g.sibling;we=f,qo=T,At=ne}fp(i)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,we=g):fp(i)}}function fp(i){for(;we!==null;){var n=we;if((n.flags&8772)!==0){var a=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:At||Ko(5,n);break;case 1:var c=n.stateNode;if(n.flags&4&&!At)if(a===null)c.componentDidMount();else{var f=n.elementType===n.type?a.memoizedProps:Pi(n.type,a.memoizedProps);c.componentDidUpdate(f,a.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var g=n.updateQueue;g!==null&&pf(n,g,c);break;case 3:var C=n.updateQueue;if(C!==null){if(a=null,n.child!==null)switch(n.child.tag){case 5:a=n.child.stateNode;break;case 1:a=n.child.stateNode}pf(n,C,a)}break;case 5:var T=n.stateNode;if(a===null&&n.flags&4){a=T;var H=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":H.autoFocus&&a.focus();break;case"img":H.src&&(a.src=H.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var ne=n.alternate;if(ne!==null){var he=ne.memoizedState;if(he!==null){var fe=he.dehydrated;fe!==null&&is(fe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}At||n.flags&512&&dc(n)}catch(ue){rt(n,n.return,ue)}}if(n===i){we=null;break}if(a=n.sibling,a!==null){a.return=n.return,we=a;break}we=n.return}}function pp(i){for(;we!==null;){var n=we;if(n===i){we=null;break}var a=n.sibling;if(a!==null){a.return=n.return,we=a;break}we=n.return}}function mp(i){for(;we!==null;){var n=we;try{switch(n.tag){case 0:case 11:case 15:var a=n.return;try{Ko(4,n)}catch(H){rt(n,a,H)}break;case 1:var c=n.stateNode;if(typeof c.componentDidMount=="function"){var f=n.return;try{c.componentDidMount()}catch(H){rt(n,f,H)}}var g=n.return;try{dc(n)}catch(H){rt(n,g,H)}break;case 5:var C=n.return;try{dc(n)}catch(H){rt(n,C,H)}}}catch(H){rt(n,n.return,H)}if(n===i){we=null;break}var T=n.sibling;if(T!==null){T.return=n.return,we=T;break}we=n.return}}var uS=Math.ceil,Vo=B.ReactCurrentDispatcher,mc=B.ReactCurrentOwner,yi=B.ReactCurrentBatchConfig,ze=0,wt=null,dt=null,Lt=0,ai=0,Mn=pr(0),gt=0,ks=null,Kr=0,Yo=0,gc=0,Es=null,Xt=null,_c=0,Tn=1/0,ir=null,Xo=!1,vc=null,Sr=null,Go=!1,wr=null,Qo=0,Ns=0,yc=null,Jo=-1,Zo=0;function $t(){return(ze&6)!==0?lt():Jo!==-1?Jo:Jo=lt()}function br(i){return(i.mode&1)===0?1:(ze&2)!==0&&Lt!==0?Lt&-Lt:Vy.transition!==null?(Zo===0&&(Zo=ad()),Zo):(i=We,i!==0||(i=window.event,i=i===void 0?16:gd(i.type)),i)}function Mi(i,n,a,c){if(50<Ns)throw Ns=0,yc=null,Error(r(185));Qn(i,a,c),((ze&2)===0||i!==wt)&&(i===wt&&((ze&2)===0&&(Yo|=a),gt===4&&Cr(i,Lt)),Gt(i,c),a===1&&ze===0&&(n.mode&1)===0&&(Tn=lt()+500,No&&gr()))}function Gt(i,n){var a=i.callbackNode;Vv(i,n);var c=ao(i,i===wt?Lt:0);if(c===0)a!==null&&nd(a),i.callbackNode=null,i.callbackPriority=0;else if(n=c&-c,i.callbackPriority!==n){if(a!=null&&nd(a),n===1)i.tag===0?Ky(_p.bind(null,i)):tf(_p.bind(null,i)),$y(function(){(ze&6)===0&&gr()}),a=null;else{switch(ld(c)){case 1:a=Ja;break;case 4:a=sd;break;case 16:a=ro;break;case 536870912:a=od;break;default:a=ro}a=kp(a,gp.bind(null,i))}i.callbackPriority=n,i.callbackNode=a}}function gp(i,n){if(Jo=-1,Zo=0,(ze&6)!==0)throw Error(r(327));var a=i.callbackNode;if(jn()&&i.callbackNode!==a)return null;var c=ao(i,i===wt?Lt:0);if(c===0)return null;if((c&30)!==0||(c&i.expiredLanes)!==0||n)n=ea(i,c);else{n=c;var f=ze;ze|=2;var g=yp();(wt!==i||Lt!==n)&&(ir=null,Tn=lt()+500,Yr(i,n));do try{fS();break}catch(T){vp(i,T)}while(!0);Al(),Vo.current=g,ze=f,dt!==null?n=0:(wt=null,Lt=0,n=gt)}if(n!==0){if(n===2&&(f=Za(i),f!==0&&(c=f,n=Sc(i,f))),n===1)throw a=ks,Yr(i,0),Cr(i,c),Gt(i,lt()),a;if(n===6)Cr(i,c);else{if(f=i.current.alternate,(c&30)===0&&!hS(f)&&(n=ea(i,c),n===2&&(g=Za(i),g!==0&&(c=g,n=Sc(i,g))),n===1))throw a=ks,Yr(i,0),Cr(i,c),Gt(i,lt()),a;switch(i.finishedWork=f,i.finishedLanes=c,n){case 0:case 1:throw Error(r(345));case 2:Xr(i,Xt,ir);break;case 3:if(Cr(i,c),(c&130023424)===c&&(n=_c+500-lt(),10<n)){if(ao(i,0)!==0)break;if(f=i.suspendedLanes,(f&c)!==c){$t(),i.pingedLanes|=i.suspendedLanes&f;break}i.timeoutHandle=El(Xr.bind(null,i,Xt,ir),n);break}Xr(i,Xt,ir);break;case 4:if(Cr(i,c),(c&4194240)===c)break;for(n=i.eventTimes,f=-1;0<c;){var C=31-Ei(c);g=1<<C,C=n[C],C>f&&(f=C),c&=~g}if(c=f,c=lt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*uS(c/1960))-c,10<c){i.timeoutHandle=El(Xr.bind(null,i,Xt,ir),c);break}Xr(i,Xt,ir);break;case 5:Xr(i,Xt,ir);break;default:throw Error(r(329))}}}return Gt(i,lt()),i.callbackNode===a?gp.bind(null,i):null}function Sc(i,n){var a=Es;return i.current.memoizedState.isDehydrated&&(Yr(i,n).flags|=256),i=ea(i,n),i!==2&&(n=Xt,Xt=a,n!==null&&wc(n)),i}function wc(i){Xt===null?Xt=i:Xt.push.apply(Xt,i)}function hS(i){for(var n=i;;){if(n.flags&16384){var a=n.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var c=0;c<a.length;c++){var f=a[c],g=f.getSnapshot;f=f.value;try{if(!Ni(g(),f))return!1}catch{return!1}}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Cr(i,n){for(n&=~gc,n&=~Yo,i.suspendedLanes|=n,i.pingedLanes&=~n,i=i.expirationTimes;0<n;){var a=31-Ei(n),c=1<<a;i[a]=-1,n&=~c}}function _p(i){if((ze&6)!==0)throw Error(r(327));jn();var n=ao(i,0);if((n&1)===0)return Gt(i,lt()),null;var a=ea(i,n);if(i.tag!==0&&a===2){var c=Za(i);c!==0&&(n=c,a=Sc(i,c))}if(a===1)throw a=ks,Yr(i,0),Cr(i,n),Gt(i,lt()),a;if(a===6)throw Error(r(345));return i.finishedWork=i.current.alternate,i.finishedLanes=n,Xr(i,Xt,ir),Gt(i,lt()),null}function bc(i,n){var a=ze;ze|=1;try{return i(n)}finally{ze=a,ze===0&&(Tn=lt()+500,No&&gr())}}function Vr(i){wr!==null&&wr.tag===0&&(ze&6)===0&&jn();var n=ze;ze|=1;var a=yi.transition,c=We;try{if(yi.transition=null,We=1,i)return i()}finally{We=c,yi.transition=a,ze=n,(ze&6)===0&&gr()}}function Cc(){ai=Mn.current,Ve(Mn)}function Yr(i,n){i.finishedWork=null,i.finishedLanes=0;var a=i.timeoutHandle;if(a!==-1&&(i.timeoutHandle=-1,Hy(a)),dt!==null)for(a=dt.return;a!==null;){var c=a;switch(Ml(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ko();break;case 3:Pn(),Ve(Kt),Ve(jt),ql();break;case 5:Wl(c);break;case 4:Pn();break;case 13:Ve(Ze);break;case 19:Ve(Ze);break;case 10:Ol(c.type._context);break;case 22:case 23:Cc()}a=a.return}if(wt=i,dt=i=xr(i.current,null),Lt=ai=n,gt=0,ks=null,gc=Yo=Kr=0,Xt=Es=null,Wr!==null){for(n=0;n<Wr.length;n++)if(a=Wr[n],c=a.interleaved,c!==null){a.interleaved=null;var f=c.next,g=a.pending;if(g!==null){var C=g.next;g.next=f,c.next=C}a.pending=c}Wr=null}return i}function vp(i,n){do{var a=dt;try{if(Al(),Ao.current=Ho,Oo){for(var c=et.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Oo=!1}if(qr=0,St=mt=et=null,ys=!1,Ss=0,mc.current=null,a===null||a.return===null){gt=1,ks=n,dt=null;break}e:{var g=i,C=a.return,T=a,H=n;if(n=Lt,T.flags|=32768,H!==null&&typeof H=="object"&&typeof H.then=="function"){var ne=H,he=T,fe=he.tag;if((he.mode&1)===0&&(fe===0||fe===11||fe===15)){var ue=he.alternate;ue?(he.updateQueue=ue.updateQueue,he.memoizedState=ue.memoizedState,he.lanes=ue.lanes):(he.updateQueue=null,he.memoizedState=null)}var Se=Wf(C);if(Se!==null){Se.flags&=-257,Uf(Se,C,T,g,n),Se.mode&1&&$f(g,ne,n),n=Se,H=ne;var be=n.updateQueue;if(be===null){var Ce=new Set;Ce.add(H),n.updateQueue=Ce}else be.add(H);break e}else{if((n&1)===0){$f(g,ne,n),xc();break e}H=Error(r(426))}}else if(Qe&&T.mode&1){var ct=Wf(C);if(ct!==null){(ct.flags&65536)===0&&(ct.flags|=256),Uf(ct,C,T,g,n),Bl(Dn(H,T));break e}}g=H=Dn(H,T),gt!==4&&(gt=2),Es===null?Es=[g]:Es.push(g),g=C;do{switch(g.tag){case 3:g.flags|=65536,n&=-n,g.lanes|=n;var Z=Ff(g,H,n);ff(g,Z);break e;case 1:T=H;var K=g.type,te=g.stateNode;if((g.flags&128)===0&&(typeof K.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(Sr===null||!Sr.has(te)))){g.flags|=65536,n&=-n,g.lanes|=n;var ge=Hf(g,T,n);ff(g,ge);break e}}g=g.return}while(g!==null)}wp(a)}catch(ke){n=ke,dt===a&&a!==null&&(dt=a=a.return);continue}break}while(!0)}function yp(){var i=Vo.current;return Vo.current=Ho,i===null?Ho:i}function xc(){(gt===0||gt===3||gt===2)&&(gt=4),wt===null||(Kr&268435455)===0&&(Yo&268435455)===0||Cr(wt,Lt)}function ea(i,n){var a=ze;ze|=2;var c=yp();(wt!==i||Lt!==n)&&(ir=null,Yr(i,n));do try{dS();break}catch(f){vp(i,f)}while(!0);if(Al(),ze=a,Vo.current=c,dt!==null)throw Error(r(261));return wt=null,Lt=0,gt}function dS(){for(;dt!==null;)Sp(dt)}function fS(){for(;dt!==null&&!Ov();)Sp(dt)}function Sp(i){var n=xp(i.alternate,i,ai);i.memoizedProps=i.pendingProps,n===null?wp(i):dt=n,mc.current=null}function wp(i){var n=i;do{var a=n.alternate;if(i=n.return,(n.flags&32768)===0){if(a=sS(a,n,ai),a!==null){dt=a;return}}else{if(a=oS(a,n),a!==null){a.flags&=32767,dt=a;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{gt=6,dt=null;return}}if(n=n.sibling,n!==null){dt=n;return}dt=n=i}while(n!==null);gt===0&&(gt=5)}function Xr(i,n,a){var c=We,f=yi.transition;try{yi.transition=null,We=1,pS(i,n,a,c)}finally{yi.transition=f,We=c}return null}function pS(i,n,a,c){do jn();while(wr!==null);if((ze&6)!==0)throw Error(r(327));a=i.finishedWork;var f=i.finishedLanes;if(a===null)return null;if(i.finishedWork=null,i.finishedLanes=0,a===i.current)throw Error(r(177));i.callbackNode=null,i.callbackPriority=0;var g=a.lanes|a.childLanes;if(Yv(i,g),i===wt&&(dt=wt=null,Lt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Go||(Go=!0,kp(ro,function(){return jn(),null})),g=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||g){g=yi.transition,yi.transition=null;var C=We;We=1;var T=ze;ze|=4,mc.current=null,lS(i,a),hp(a,i),jy(xl),uo=!!Cl,xl=Cl=null,i.current=a,cS(a),zv(),ze=T,We=C,yi.transition=g}else i.current=a;if(Go&&(Go=!1,wr=i,Qo=f),g=i.pendingLanes,g===0&&(Sr=null),$v(a.stateNode),Gt(i,lt()),n!==null)for(c=i.onRecoverableError,a=0;a<n.length;a++)f=n[a],c(f.value,{componentStack:f.stack,digest:f.digest});if(Xo)throw Xo=!1,i=vc,vc=null,i;return(Qo&1)!==0&&i.tag!==0&&jn(),g=i.pendingLanes,(g&1)!==0?i===yc?Ns++:(Ns=0,yc=i):Ns=0,gr(),null}function jn(){if(wr!==null){var i=ld(Qo),n=yi.transition,a=We;try{if(yi.transition=null,We=16>i?16:i,wr===null)var c=!1;else{if(i=wr,wr=null,Qo=0,(ze&6)!==0)throw Error(r(331));var f=ze;for(ze|=4,we=i.current;we!==null;){var g=we,C=g.child;if((we.flags&16)!==0){var T=g.deletions;if(T!==null){for(var H=0;H<T.length;H++){var ne=T[H];for(we=ne;we!==null;){var he=we;switch(he.tag){case 0:case 11:case 15:xs(8,he,g)}var fe=he.child;if(fe!==null)fe.return=he,we=fe;else for(;we!==null;){he=we;var ue=he.sibling,Se=he.return;if(op(he),he===ne){we=null;break}if(ue!==null){ue.return=Se,we=ue;break}we=Se}}}var be=g.alternate;if(be!==null){var Ce=be.child;if(Ce!==null){be.child=null;do{var ct=Ce.sibling;Ce.sibling=null,Ce=ct}while(Ce!==null)}}we=g}}if((g.subtreeFlags&2064)!==0&&C!==null)C.return=g,we=C;else e:for(;we!==null;){if(g=we,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:xs(9,g,g.return)}var Z=g.sibling;if(Z!==null){Z.return=g.return,we=Z;break e}we=g.return}}var K=i.current;for(we=K;we!==null;){C=we;var te=C.child;if((C.subtreeFlags&2064)!==0&&te!==null)te.return=C,we=te;else e:for(C=K;we!==null;){if(T=we,(T.flags&2048)!==0)try{switch(T.tag){case 0:case 11:case 15:Ko(9,T)}}catch(ke){rt(T,T.return,ke)}if(T===C){we=null;break e}var ge=T.sibling;if(ge!==null){ge.return=T.return,we=ge;break e}we=T.return}}if(ze=f,gr(),Bi&&typeof Bi.onPostCommitFiberRoot=="function")try{Bi.onPostCommitFiberRoot(no,i)}catch{}c=!0}return c}finally{We=a,yi.transition=n}}return!1}function bp(i,n,a){n=Dn(a,n),n=Ff(i,n,1),i=vr(i,n,1),n=$t(),i!==null&&(Qn(i,1,n),Gt(i,n))}function rt(i,n,a){if(i.tag===3)bp(i,i,a);else for(;n!==null;){if(n.tag===3){bp(n,i,a);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Sr===null||!Sr.has(c))){i=Dn(a,i),i=Hf(n,i,1),n=vr(n,i,1),i=$t(),n!==null&&(Qn(n,1,i),Gt(n,i));break}}n=n.return}}function mS(i,n,a){var c=i.pingCache;c!==null&&c.delete(n),n=$t(),i.pingedLanes|=i.suspendedLanes&a,wt===i&&(Lt&a)===a&&(gt===4||gt===3&&(Lt&130023424)===Lt&&500>lt()-_c?Yr(i,0):gc|=a),Gt(i,n)}function Cp(i,n){n===0&&((i.mode&1)===0?n=1:(n=oo,oo<<=1,(oo&130023424)===0&&(oo=4194304)));var a=$t();i=Zi(i,n),i!==null&&(Qn(i,n,a),Gt(i,a))}function gS(i){var n=i.memoizedState,a=0;n!==null&&(a=n.retryLane),Cp(i,a)}function _S(i,n){var a=0;switch(i.tag){case 13:var c=i.stateNode,f=i.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(n),Cp(i,a)}var xp;xp=function(i,n,a){if(i!==null)if(i.memoizedProps!==n.pendingProps||Kt.current)Yt=!0;else{if((i.lanes&a)===0&&(n.flags&128)===0)return Yt=!1,nS(i,n,a);Yt=(i.flags&131072)!==0}else Yt=!1,Qe&&(n.flags&1048576)!==0&&rf(n,Po,n.index);switch(n.lanes=0,n.tag){case 2:var c=n.type;Uo(i,n),i=n.pendingProps;var f=bn(n,jt.current);Rn(n,a),f=Yl(null,n,c,i,f,a);var g=Xl();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Vt(c)?(g=!0,Eo(n)):g=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Hl(n),f.updater=$o,n.stateNode=f,f._reactInternals=n,tc(n,c,i,a),n=sc(null,n,c,!0,g,a)):(n.tag=0,Qe&&g&&Ll(n),Ht(null,n,f,a),n=n.child),n;case 16:c=n.elementType;e:{switch(Uo(i,n),i=n.pendingProps,f=c._init,c=f(c._payload),n.type=c,f=n.tag=yS(c),i=Pi(c,i),f){case 0:n=nc(null,n,c,i,a);break e;case 1:n=Gf(null,n,c,i,a);break e;case 11:n=qf(null,n,c,i,a);break e;case 14:n=Kf(null,n,c,Pi(c.type,i),a);break e}throw Error(r(306,c,""))}return n;case 0:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),nc(i,n,c,f,a);case 1:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),Gf(i,n,c,f,a);case 3:e:{if(Qf(n),i===null)throw Error(r(387));c=n.pendingProps,g=n.memoizedState,f=g.element,df(i,n),Bo(n,c,null,a);var C=n.memoizedState;if(c=C.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){f=Dn(Error(r(423)),n),n=Jf(i,n,c,a,f);break e}else if(c!==f){f=Dn(Error(r(424)),n),n=Jf(i,n,c,a,f);break e}else for(oi=fr(n.stateNode.containerInfo.firstChild),si=n,Qe=!0,Ri=null,a=uf(n,null,c,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(kn(),c===f){n=tr(i,n,a);break e}Ht(i,n,c,a)}n=n.child}return n;case 5:return mf(n),i===null&&jl(n),c=n.type,f=n.pendingProps,g=i!==null?i.memoizedProps:null,C=f.children,kl(c,f)?C=null:g!==null&&kl(c,g)&&(n.flags|=32),Xf(i,n),Ht(i,n,C,a),n.child;case 6:return i===null&&jl(n),null;case 13:return Zf(i,n,a);case 4:return $l(n,n.stateNode.containerInfo),c=n.pendingProps,i===null?n.child=En(n,null,c,a):Ht(i,n,c,a),n.child;case 11:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),qf(i,n,c,f,a);case 7:return Ht(i,n,n.pendingProps,a),n.child;case 8:return Ht(i,n,n.pendingProps.children,a),n.child;case 12:return Ht(i,n,n.pendingProps.children,a),n.child;case 10:e:{if(c=n.type._context,f=n.pendingProps,g=n.memoizedProps,C=f.value,qe(Mo,c._currentValue),c._currentValue=C,g!==null)if(Ni(g.value,C)){if(g.children===f.children&&!Kt.current){n=tr(i,n,a);break e}}else for(g=n.child,g!==null&&(g.return=n);g!==null;){var T=g.dependencies;if(T!==null){C=g.child;for(var H=T.firstContext;H!==null;){if(H.context===c){if(g.tag===1){H=er(-1,a&-a),H.tag=2;var ne=g.updateQueue;if(ne!==null){ne=ne.shared;var he=ne.pending;he===null?H.next=H:(H.next=he.next,he.next=H),ne.pending=H}}g.lanes|=a,H=g.alternate,H!==null&&(H.lanes|=a),zl(g.return,a,n),T.lanes|=a;break}H=H.next}}else if(g.tag===10)C=g.type===n.type?null:g.child;else if(g.tag===18){if(C=g.return,C===null)throw Error(r(341));C.lanes|=a,T=C.alternate,T!==null&&(T.lanes|=a),zl(C,a,n),C=g.sibling}else C=g.child;if(C!==null)C.return=g;else for(C=g;C!==null;){if(C===n){C=null;break}if(g=C.sibling,g!==null){g.return=C.return,C=g;break}C=C.return}g=C}Ht(i,n,f.children,a),n=n.child}return n;case 9:return f=n.type,c=n.pendingProps.children,Rn(n,a),f=_i(f),c=c(f),n.flags|=1,Ht(i,n,c,a),n.child;case 14:return c=n.type,f=Pi(c,n.pendingProps),f=Pi(c.type,f),Kf(i,n,c,f,a);case 15:return Vf(i,n,n.type,n.pendingProps,a);case 17:return c=n.type,f=n.pendingProps,f=n.elementType===c?f:Pi(c,f),Uo(i,n),n.tag=1,Vt(c)?(i=!0,Eo(n)):i=!1,Rn(n,a),Of(n,c,f),tc(n,c,f,a),sc(null,n,c,!0,i,a);case 19:return tp(i,n,a);case 22:return Yf(i,n,a)}throw Error(r(156,n.tag))};function kp(i,n){return rd(i,n)}function vS(i,n,a,c){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Si(i,n,a,c){return new vS(i,n,a,c)}function kc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function yS(i){if(typeof i=="function")return kc(i)?1:0;if(i!=null){if(i=i.$$typeof,i===k)return 11;if(i===Y)return 14}return 2}function xr(i,n){var a=i.alternate;return a===null?(a=Si(i.tag,n,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=n,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&14680064,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,n=i.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a}function ta(i,n,a,c,f,g){var C=2;if(c=i,typeof i=="function")kc(i)&&(C=1);else if(typeof i=="string")C=5;else e:switch(i){case I:return Gr(a.children,f,g,n);case V:C=8,f|=8;break;case U:return i=Si(12,a,n,f|2),i.elementType=U,i.lanes=g,i;case D:return i=Si(13,a,n,f),i.elementType=D,i.lanes=g,i;case j:return i=Si(19,a,n,f),i.elementType=j,i.lanes=g,i;case Q:return ia(a,f,g,n);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case ie:C=10;break e;case ee:C=9;break e;case k:C=11;break e;case Y:C=14;break e;case F:C=16,c=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return n=Si(C,a,n,f),n.elementType=i,n.type=c,n.lanes=g,n}function Gr(i,n,a,c){return i=Si(7,i,c,n),i.lanes=a,i}function ia(i,n,a,c){return i=Si(22,i,c,n),i.elementType=Q,i.lanes=a,i.stateNode={isHidden:!1},i}function Ec(i,n,a){return i=Si(6,i,null,n),i.lanes=a,i}function Nc(i,n,a){return n=Si(4,i.children!==null?i.children:[],i.key,n),n.lanes=a,n.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},n}function SS(i,n,a,c,f){this.tag=n,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=el(0),this.expirationTimes=el(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=el(0),this.identifierPrefix=c,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Rc(i,n,a,c,f,g,C,T,H){return i=new SS(i,n,a,T,H),n===1?(n=1,g===!0&&(n|=8)):n=0,g=Si(3,null,null,n),i.current=g,g.stateNode=i,g.memoizedState={element:c,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hl(g),i}function wS(i,n,a){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:c==null?null:""+c,children:i,containerInfo:n,implementation:a}}function Ep(i){if(!i)return mr;i=i._reactInternals;e:{if(Or(i)!==i||i.tag!==1)throw Error(r(170));var n=i;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Vt(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(i.tag===1){var a=i.type;if(Vt(a))return Zd(i,a,n)}return n}function Np(i,n,a,c,f,g,C,T,H){return i=Rc(a,c,!0,i,f,g,C,T,H),i.context=Ep(null),a=i.current,c=$t(),f=br(a),g=er(c,f),g.callback=n??null,vr(a,g,f),i.current.lanes=f,Qn(i,f,c),Gt(i,c),i}function ra(i,n,a,c){var f=n.current,g=$t(),C=br(f);return a=Ep(a),n.context===null?n.context=a:n.pendingContext=a,n=er(g,C),n.payload={element:i},c=c===void 0?null:c,c!==null&&(n.callback=c),i=vr(f,n,C),i!==null&&(Mi(i,f,C,g),jo(i,f,C)),C}function na(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function Rp(i,n){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<n?a:n}}function Pc(i,n){Rp(i,n),(i=i.alternate)&&Rp(i,n)}function bS(){return null}var Pp=typeof reportError=="function"?reportError:function(i){console.error(i)};function Dc(i){this._internalRoot=i}sa.prototype.render=Dc.prototype.render=function(i){var n=this._internalRoot;if(n===null)throw Error(r(409));ra(i,n,null,null)},sa.prototype.unmount=Dc.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var n=i.containerInfo;Vr(function(){ra(null,i,null,null)}),n[Xi]=null}};function sa(i){this._internalRoot=i}sa.prototype.unstable_scheduleHydration=function(i){if(i){var n=hd();i={blockedOn:null,target:i,priority:n};for(var a=0;a<ur.length&&n!==0&&n<ur[a].priority;a++);ur.splice(a,0,i),a===0&&pd(i)}};function Lc(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function oa(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Dp(){}function CS(i,n,a,c,f){if(f){if(typeof c=="function"){var g=c;c=function(){var ne=na(C);g.call(ne)}}var C=Np(n,c,i,0,null,!1,!1,"",Dp);return i._reactRootContainer=C,i[Xi]=C.current,hs(i.nodeType===8?i.parentNode:i),Vr(),C}for(;f=i.lastChild;)i.removeChild(f);if(typeof c=="function"){var T=c;c=function(){var ne=na(H);T.call(ne)}}var H=Rc(i,0,!1,null,null,!1,!1,"",Dp);return i._reactRootContainer=H,i[Xi]=H.current,hs(i.nodeType===8?i.parentNode:i),Vr(function(){ra(n,H,a,c)}),H}function aa(i,n,a,c,f){var g=a._reactRootContainer;if(g){var C=g;if(typeof f=="function"){var T=f;f=function(){var H=na(C);T.call(H)}}ra(n,C,i,f)}else C=CS(a,n,i,f,c);return na(C)}cd=function(i){switch(i.tag){case 3:var n=i.stateNode;if(n.current.memoizedState.isDehydrated){var a=Gn(n.pendingLanes);a!==0&&(tl(n,a|1),Gt(n,lt()),(ze&6)===0&&(Tn=lt()+500,gr()))}break;case 13:Vr(function(){var c=Zi(i,1);if(c!==null){var f=$t();Mi(c,i,1,f)}}),Pc(i,1)}},il=function(i){if(i.tag===13){var n=Zi(i,134217728);if(n!==null){var a=$t();Mi(n,i,134217728,a)}Pc(i,134217728)}},ud=function(i){if(i.tag===13){var n=br(i),a=Zi(i,n);if(a!==null){var c=$t();Mi(a,i,n,c)}Pc(i,n)}},hd=function(){return We},dd=function(i,n){var a=We;try{return We=i,n()}finally{We=a}},Ya=function(i,n,a){switch(n){case"input":if(zt(i,a),n=a.name,a.type==="radio"&&n!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<a.length;n++){var c=a[n];if(c!==i&&c.form===i.form){var f=xo(c);if(!f)throw Error(r(90));oe(c),zt(c,f)}}}break;case"textarea":Br(i,a);break;case"select":n=a.value,n!=null&&ki(i,!!a.multiple,n,!1)}},Gh=bc,Qh=Vr;var xS={usingClientEntryPoint:!1,Events:[ps,Sn,xo,Yh,Xh,bc]},Rs={findFiberByHostInstance:zr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},kS={bundleType:Rs.bundleType,version:Rs.version,rendererPackageName:Rs.rendererPackageName,rendererConfig:Rs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:B.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=td(i),i===null?null:i.stateNode},findFiberByHostInstance:Rs.findFiberByHostInstance||bS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var la=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!la.isDisabled&&la.supportsFiber)try{no=la.inject(kS),Bi=la}catch{}}return Qt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xS,Qt.createPortal=function(i,n){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lc(n))throw Error(r(200));return wS(i,n,null,a)},Qt.createRoot=function(i,n){if(!Lc(i))throw Error(r(299));var a=!1,c="",f=Pp;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),n=Rc(i,1,!1,null,null,a,!1,c,f),i[Xi]=n.current,hs(i.nodeType===8?i.parentNode:i),new Dc(n)},Qt.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var n=i._reactInternals;if(n===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=td(n),i=i===null?null:i.stateNode,i},Qt.flushSync=function(i){return Vr(i)},Qt.hydrate=function(i,n,a){if(!oa(n))throw Error(r(200));return aa(null,i,n,!0,a)},Qt.hydrateRoot=function(i,n,a){if(!Lc(i))throw Error(r(405));var c=a!=null&&a.hydratedSources||null,f=!1,g="",C=Pp;if(a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),n=Np(n,null,i,1,a??null,f,!1,g,C),i[Xi]=n.current,hs(i),c)for(i=0;i<c.length;i++)a=c[i],f=a._getVersion,f=f(a._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[a,f]:n.mutableSourceEagerHydrationData.push(a,f);return new sa(n)},Qt.render=function(i,n,a){if(!oa(n))throw Error(r(200));return aa(null,i,n,!1,a)},Qt.unmountComponentAtNode=function(i){if(!oa(i))throw Error(r(40));return i._reactRootContainer?(Vr(function(){aa(null,null,i,!1,function(){i._reactRootContainer=null,i[Xi]=null})}),!0):!1},Qt.unstable_batchedUpdates=bc,Qt.unstable_renderSubtreeIntoContainer=function(i,n,a,c){if(!oa(a))throw Error(r(200));if(i==null||i._reactInternals===void 0)throw Error(r(38));return aa(i,n,a,!1,c)},Qt.version="18.3.1-next-f1338f8080-20240426",Qt}var Op;function jS(){if(Op)return jc.exports;Op=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),jc.exports=TS(),jc.exports}var zp;function BS(){if(zp)return ca;zp=1;var e=jS();return ca.createRoot=e.createRoot,ca.hydrateRoot=e.hydrateRoot,ca}var IS=BS();const AS=bh(IS);function Nt(e,t,r={}){return fetch(e,{...r,headers:{...r.headers||{},Authorization:`Bearer ${t}`}})}const Xg=e=>`nc_seen_${e}`;async function Te(e,t,r={}){const s=await Nt(e,t,{method:r.method||"GET",headers:{"content-type":"application/json"},body:r.body?JSON.stringify(r.body):void 0}),o=await s.json().catch(()=>({}));if(!s.ok){const l=new Error(o.error||`HTTP ${s.status}`);throw l.status=s.status,l.data=o,l}return o}const di=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",fi=(e,t)=>`${di(e)}/fleet/${t}`,an=(e,t)=>Te(fi(t,"status"),e),xh=(e,t,r)=>Te(fi(r,"up"),e,{method:"POST",body:t}),Pa=(e,t,r)=>Te(fi(r,"down"),e,{method:"POST",body:t}),wa=(e,t,r)=>Te(fi(r,"restart"),e,{method:"POST",body:{cell:t}}),kh=(e,t)=>Te(fi(t,"definitions"),e),OS=(e,t,r)=>Te(fi(r,"define-engine"),e,{method:"POST",body:{def:t}}),zS=(e,t,r,s,o)=>Te(fi(o,"edit-engine"),e,{method:"POST",body:{id:t,patch:r,envChanges:s}}),FS=(e,t,r)=>Te(fi(r,"remove-engine"),e,{method:"POST",body:{id:t}}),HS=(e,t,r)=>Te(fi(r,"define-cell"),e,{method:"POST",body:{def:t}}),$S=(e,t,r,s)=>Te(fi(s,"edit-cell"),e,{method:"POST",body:{id:t,patch:r}}),Gg=(e,t,r=!1,s)=>Te(fi(s,"remove-cell"),e,{method:"POST",body:{id:t,stop:r}}),WS=(e,t,r)=>Te(fi(r,"import-cell"),e,{method:"POST",body:t}),US=(e,t,r)=>Te(fi(r,"restore-cells"),e,{method:"POST",body:{cells:t}}),Eh=(e,t,r)=>Te(`${di(r)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),Qg=(e,t,r)=>Te(`${di(r)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),Jg=e=>Te("/api/settings",e),Zg=e=>Te("/api/nodes",e),qS=e=>Te("/api/topology",e),e_=(e,t)=>Te(`${di(t)}/sessions`,e),Nh=(e,t)=>Te(`${di(t)}/config`,e),Fp=(e,t)=>Te(`${di(t)}/topology`,e),t_=(e,t)=>Te("/api/settings/config",e,{method:"POST",body:t}),KS=e=>Te("/api/settings/token/rotate",e,{method:"POST"}),VS=(e,t)=>Te("/api/settings/nodes/pair",e,{method:"POST",body:t}),Hp=(e,t,r=[])=>Te(`${di(r)}/settings/peering/invite`,e,{method:"POST",body:t||{}}),YS=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:r}}),XS=(e,t)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),Rh=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/${r}`,e,{method:"POST"}),GS=(e,t,r)=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/share`,e,{method:"PATCH",body:{shared:r}}),$p=(e,t,r,s=[])=>Te(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:r,selected:s}}),QS=e=>Te("/api/settings/service/regenerate",e,{method:"POST"}),JS=e=>Te("/api/settings/update/check",e,{method:"POST"}),ZS=e=>Te("/api/settings/update/apply",e,{method:"POST"}),ew=(e,t=!0)=>Te(`/api/asks${t?"?open=1":""}`,e),tw=(e,t,r)=>Te(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:r}}),ua=(e,t=[])=>Te(`${di(t)}/decks`,e),Wp=(e,t,r=[])=>Te(`${di(r)}/decks`,e,{method:"POST",body:{name:t}}),ha=(e,t,r,s,o=[])=>Te(`${di(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:r,expectedRevision:s}}),iw=(e,t,r,s,o=[])=>Te(`${di(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:r,expectedRevision:s}}),rw=(e,t,r,s=[])=>Te(`${di(s)}/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:r}}),nw={power:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3v8"}),h.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:h.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L12.4 6H18a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z"}),keyboard:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),h.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),h.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),h.jsx("path",{d:"M12 18v3"})]}),enter:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),h.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),h.jsx("path",{d:"M22 2 11 13"})]}),trash:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M4 7h16"}),h.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),h.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),h.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:h.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),h.jsx("polyline",{points:"21 3 21 8 16 8"})]}),upload:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 16V5"}),h.jsx("polyline",{points:"8 9 12 5 16 9"}),h.jsx("path",{d:"M5 20h14"})]}),chevronLeft:h.jsx("polyline",{points:"14 6 8 12 14 18"}),attach:h.jsx("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"}),file:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M14.5 4h-5L7.5 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.5z"}),h.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),h.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),h.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"M21 21l-4.35-4.35"}),h.jsx("path",{d:"M8 11h6"})]}),gear:h.jsxs(h.Fragment,{children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),copy:h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function He({name:e,size:t=20}){return h.jsx("svg",{className:"nc-icon",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:nw[e]||null})}const i_="nc_pins";function r_(){try{const e=JSON.parse(localStorage.getItem(i_));return Array.isArray(e)?e:[]}catch{return[]}}function n_(e,t){const r=e.includes(t)?e.filter(s=>s!==t):[...e,t];try{localStorage.setItem(i_,JSON.stringify(r))}catch{}return r}function zs(e,t,r){const s=e.indexOf(t);return[s===-1?1e9:s,-(r||0)]}function Eu(e,t){return e[0]-t[0]||e[1]-t[1]}const Ph=["it","en","es"];function sw(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Ph.includes(t)?t:"en"}catch{return"en"}}const ba=sw(),s_="nc_lang",Nu="nc-lang";function o_(){return typeof localStorage<"u"?localStorage:null}const da={it:{"update-available":"nuova versione {v} disponibile","install-version-mismatch":"installazione incompleta: frontend e server non coincidono (v{v})",reload:"ricarica","grid-empty":"trascina qui una sessione dalla sidebar, o doppio-clic per la vista singola","grid-full":"il deck può mostrare al massimo 9 sessioni",pin:"fissa in cima",sessions:"sessioni","new-session":"nuova sessione",new:"nuova",fleet:"Flotta","fleet-tmux":"flotta tmux","other-sessions":"Altre sessioni","view-all":"tutte","view-pinned":"fissate","view-active":"attive","view-off":"spente","position-local":"Locale",files:"file",refresh:"aggiorna","filter-placeholder":"filtra sessioni…","loading-fleet":"carico la flotta…","no-sessions":"nessuna sessione tmux viva — la flotta parte al boot (systemd)","no-match":'nessuna sessione contiene "{q}"',"copy-url":"clicca per copiare l'URL","ssh-only":"solo tunnel SSH/VPN","new-files-outbox":"nuovi file in outbox",terminate:"termina","terminate-confirm":'Terminare la sessione "{name}"?',"cell-on":"tmux vivo","cell-off":"spenta","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","state-on":"accesa","state-off":"spenta",engine:"Engine",model:"Modello","model-default":"Modello predefinito del provider","model-remembered":"Ultimo modello usato con questo engine","boot-persist":"avvia al boot","remove-boot":"togli anche dal boot","power-config-in-settings":"Engine, provider, profilo, modello e permessi si modificano in Impostazioni → Flotta.","no-remote-control":"⚠ engine non-native: niente RC da app claude.ai (da qui la piloti comunque)",cancel:"annulla",name:"nome","name-invalid":"nome non valido: a-zA-Z0-9._- max 64, senza '-' iniziale",cwd:"cartella",browse:"sfoglia","fs-home":"home","fs-parent":".. su",preset:"preset","preset-2x2":"griglia 2×2","preset-columns":"colonne","preset-equalize":"equalizza",collapse:"comprimi",expand:"espandi",create:"crea","auth-prompt":"Incolla il token (stampato dal server):","remember-device":"ricorda su questo device","zoom-out":"testo più piccolo","zoom-in":"testo più grande",composer:"composer",windows:"{n} finestre","empty-files":"vuota",upload:"carica","no-sessions-short":"nessuna sessione","composer-placeholder":"scrivi o detta…",attach:"allega","attach-file":"File","attach-camera":"Fotocamera","attach-gallery":"Galleria","attach-uploading":"carico…","attach-upload-progress":"allegato {n}/{total}…","attach-uploaded":"{n} allegati caricati",voice:"voice",send:"invia","composer-send-failed":"connessione non pronta — testo conservato, riprova",close:"chiudi","lang-label":"lingua",decks:"deck","new-deck":"nuovo deck","deck-name":"nome deck","open-deck-window":"apri in una nuova finestra","detach-deck":"stacca in una nuova finestra","deck-current":"questo deck (finestra corrente)","deck-owner-unavailable":"nodo owner non condiviso o non raggiungibile","rename-deck":"rinomina deck","delete-deck":"elimina deck","delete-deck-confirm":'Eliminare il deck "{name}"?',"send-to-deck":"manda al deck…","deck-autosave":"salvataggio automatico",saving:"salvataggio…",saved:"salvato","popup-blocked":"popup bloccato: apri qui","select-drag":"trascina per selezionare","copy-manual":"seleziona e copia manualmente","toggle-sidebar":"mostra/nascondi la barra laterale",settings:"impostazioni","tab-roles":"ruoli","tab-nodes":"nodi",local:"Locale",location:"Dove","pairing-link":"link di pairing","pairing-required":"nome, alias SSH e link di pairing sono obbligatori","pairing-connect-help":"Per collegare un nodo servono: nome, Host SSH già funzionante e link/QR creato sull’altra installazione NexusCrew.","pairing-localhost-hint":"127.0.0.1 nel link è corretto: non aprirlo qui. NexusCrew usa invito e porta attraverso l’Host SSH.","scan-qr":"scansiona QR","pairing-qr-invalid":"QR di pairing non valido","invite-node":"invita un nodo","create-pairing-link":"crea link / QR","visibility-network":"tutta la rete","visibility-relay":"solo relay","visibility-selected":"nodi selezionati","hydra-simple":"locale + nodi, una sola rete","local-ready":"Questo dispositivo è pronto. Puoi usarlo da solo o collegarlo a un nodo.","local-only":"solo locale","add-node":"aggiungi nodo",connect:"collega","node-connected":"Nodo collegato. La rete verrà sincronizzata automaticamente.","tab-system":"sistema","tab-fleet":"flotta","fleet-editor-unavailable":"Editor disponibile solo con il provider fleet builtin.","fleet-managed":"gestito da NexusCrew","fleet-custom":"comando personalizzato","fleet-managed-help":"Client, provider e avvio sono gestiti internamente; i segreti non vengono mostrati.","fleet-model-default":"modello predefinito (opzionale)","fleet-model-required":"modello (obbligatorio)","fleet-standard-permissions":"permessi standard","fleet-unsafe-permissions":"non sicuro · ignora approvazioni/sandbox","fleet-unsafe-warning":"Modalità non sicura esplicita: il worker può agire senza le normali approvazioni o protezioni sandbox.","fleet-provider-display":"nome visualizzato del provider","fleet-custom-provider-default":"Provider personalizzato","fleet-api-key-env":"NOME_VARIABILE_API_KEY","fleet-provider-id":"id-provider","fleet-custom-secret-help":"NexusCrew salva solo il nome della variabile d’ambiente, mai il suo valore.","fleet-model-override":"modello alternativo","fleet-ready":"pronto","fleet-not-ready":"non configurato","fleet-engines":"Engine","fleet-cells":"Celle / sessioni cloud","fleet-backup":"backup / ripristino","fleet-backup-help":"Esporta o ripristina selettivamente celle e system prompt. Token, API key e segreti provider non entrano mai nel file.","fleet-backup-export":"esporta","fleet-backup-import":"importa","fleet-backup-download":"scarica backup","fleet-backup-restore":"ripristina selezionate","fleet-backup-import-help":"Scegli un backup JSON, controlla le celle e seleziona l’engine di destinazione prima del ripristino.","fleet-backup-overwrite":"sovrascrive la cella esistente","fleet-backup-new":"nuova cella","fleet-backup-engine-missing":"scegli un engine disponibile","fleet-backup-restore-unavailable":"Il nodo selezionato supporta solo l’esportazione; aggiornalo per ripristinare backup.","fleet-backup-restored":"{n} celle ripristinate","fleet-backup-confirm-overwrite":"Sovrascrivere queste celle? {cells}","fleet-backup-needs-restart":"riavvio necessario: {cells}","fleet-backup-empty":"nessuna cella da esportare","fleet-backup-select-one":"seleziona almeno una cella","fleet-backup-too-large":"backup troppo grande (massimo 1 MB)","fleet-backup-invalid-json":"il file non contiene JSON valido","fleet-backup-invalid-format":"formato o versione del backup non supportati","fleet-backup-invalid-cell":"il backup contiene una cella non valida","fleet-backup-duplicate-cell":"il backup contiene ID cella duplicati","fleet-system-prompt":"system prompt",characters:"caratteri","select-all":"seleziona tutte","select-none":"nessuna",edit:"modifica",save:"salva",label:"etichetta","command-path":"path assoluto del comando","args-lines":"argomenti, uno per riga","env-write-only":"I valori env sono write-only: vuoto mantiene il valore esistente.","fleet-new-engine":"Nuovo engine","fleet-new-cell":"Nuova cella","fleet-saved":"Definizione salvata.","fleet-restart-confirm":"Modifica salvata. Riavviare ora: {cells}?","fleet-remove-engine":'Eliminare l’engine "{id}"?',"fleet-remove-cell":'Eliminare la cella "{id}"? Se è attiva verrà prima fermata.',"settings-readonly":"READONLY attivo: le modifiche sono bloccate dal server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"questa macchina guarda altri nodi via tunnel SSH","role-node":"nodo (raggiungibile)","published-port":"porta pubblicata (opzionale)","no-nodes":"nessun nodo remoto configurato","node-add":"collega installazione NexusCrew","node-connect-help":"La porta SSH serve a raggiungere il server SSH. La porta NexusCrew è invece la porta locale mostrata da `nexuscrew status` sul nodo remoto.","node-name-label":"Nome del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Porta SSH","node-ssh-port-help":"Di solito 22; usa la porta pubblica del server SSH.","node-app-port-label":"Porta NexusCrew sul nodo","node-app-port-help":"È la porta mostrata da `nexuscrew status` sul nodo remoto.","node-name-ph":"nome (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"porta remota (opz.)","node-remove-confirm":'Rimuovere il nodo "{name}"?',"node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","share-node":"Condividi questo nodo","share-node-off-desc":"Privato: resta collegato al nodo hub, ma gli altri client non possono raggiungerlo.","share-node-on-desc":"Condiviso: il nodo hub può mostrarlo e smistare celle e deck autorizzati.","peer-shared":"Nodo client condiviso nella rete Hydra","peer-private":"Nodo client privato: collegato, non pubblicato nella rete Hydra","node-connected-client":"client collegato","transport-used":"in uso","tunnel-up":"tunnel su","tunnel-down":"tunnel giù","authorized-keys-hint":"incolla questa riga in ~/.ssh/authorized_keys sull'host remoto:",copy:"copia",copied:"copiato","token-rotate":"ruota token","token-rotate-explain":"Il nuovo token NON verrà mostrato: recuperalo con `nexuscrew show token`. La sessione corrente verrà invalidata.","service-regenerate":"rigenera service","npm-auto-update":"aggiornamenti automatici da npm","npm-auto-update-help":"Controlla periodicamente latest e installa solo versioni più recenti. Mai downgrade.","npm-update-current":"installata","npm-update-latest":"npm latest","npm-update-check":"controlla ora","npm-update-install":"aggiorna ora","npm-update-restarting":"Aggiornamento avviato; NexusCrew si riaprirà dopo il riavvio del servizio.","npm-update-idle":"aggiornato","npm-update-checking":"controllo in corso","npm-update-available":"aggiornamento disponibile","npm-update-installing":"installazione in corso","npm-update-installed":"installato, riavvio in corso","npm-update-error":"controllo fallito","npm-update-unsupported":"disponibile solo con installazione npm globale","service-installed":"service installato","service-missing":"service non installato","service-active":"attivo","service-inactive":"non attivo",confirm:"conferma",add:"aggiungi",enable:"attiva","wizard-title":"benvenuto in NexusCrew","wizard-skip":"configura dopo dai settings","wizard-step-roles":"ruoli di questa installazione","wizard-step-node":"primo nodo remoto (opzionale)","wizard-done":"tutto pronto","wizard-done-desc":"setup completato — puoi cambiare tutto dai settings",next:"continua",back:"indietro",skip:"salta",finish:"fine","err-node-name":"nome non valido (a-z, 0-9, -, max 32)","err-ssh":"ssh non valido (atteso user@host o alias)","err-port":"porta non valida (1–65535)","err-ssh-port":"porta SSH non valida (1–65535)","err-node-port":"porta NexusCrew non valida (1–65535)","node-sessions":"{n} sessioni","tunnel-down-since":"tunnel giù da {t}","node-unreachable":"nodo non raggiungibile","node-passive":"client offline · stato normale","node-offline":"nodo offline","node-offline-seen":"offline · visto {t} fa","node-needs-repair":"legacy · ripeti il pairing","asks-title":"domande dalle celle","ask-reply-ph":"scrivi la risposta…","push-enable":"attiva notifiche push","push-disable":"disattiva notifiche push","push-on":"push attive su questo device","push-off":"push non attive","push-denied":"permesso notifiche negato dal browser","push-unsupported":"push non supportate in questo browser","node-display-label":"Nome (etichetta)","node-slug-hint":"routing su slug: {slug}","device-name-label":"Nome dispositivo","device-name-hint":"come ti vedono i peer (modificabile)","err-label":"etichetta non valida (max 64 char, niente a capo)","fleet-inventory":"Celle e sessioni","fleet-inventory-help":"tutte le posizioni (Locale + route Hydra)","fleet-manage-location":"Gestisci posizione","fleet-network-overview":"Panoramica rete","fleet-manage-help":"crea e configura celle nella posizione selezionata","fleet-overview-help":"stato operativo di tutte le posizioni, senza duplicare l’editor","fleet-inventory-empty":"nessuna cella o sessione","fleet-not-available":"fleet non disponibile su questa posizione",start:"avvia",stop:"ferma",restart:"riavvia",delete:"elimina","copy-manual":"copia non riuscita — seleziona e Cmd+C, o copia a mano","copy-empty":"niente selezione: trascina con Shift per selezionare","save-and-start":"salva e avvia",permissions:"Permessi","power-on-hint":"Spegni la cella; puoi anche toglierla dal boot.","launch-engine-help":"Provider, credenziali e nuovi engine si creano in Impostazioni → Flotta. Modello e permessi sono per questa cella.","launch-external-hint":"Provider esterno: engine/modello si configurano nel fleet esterno.","import-as-cell":"Importa come cella","import-help":"Riconcilia una sessione tmux esistente in una cella gestita. Scegli un engine già dichiarato: nessun engine viene inventato.","import-engine-required":"scegli un engine (obbligatorio)","test-and-connect":"testa e collega","pairing-v2-hint":"Incolla o scansiona UN solo link: precompila nome, Host SSH ed etichetta quando il link li include (v2).","invite-v2-hint":"Crea un invito monouso completo. Se sei già collegato a un hub, viene usato automaticamente; altrimenti serve solo il suo indirizzo SSH raggiungibile.","invite-network-hint":"Crea un invito per la rete a cui sei già collegato. Il nuovo dispositivo entrerà attraverso l’hub, non si collegherà direttamente a questo dispositivo.","invite-network-label":"Rete di destinazione","invite-network-via":"Hub","invite-network-route":"Un solo collegamento verso l’hub; nodi, celle e deck vengono smistati internamente.","invite-endpoint-label":"Indirizzo SSH di questo hub visto dagli altri dispositivi","invite-endpoint-auto":"Endpoint già configurato","invite-endpoint-needed":"Inserisci user@host o un alias SSH condiviso. Non è 127.0.0.1 e non è l’URL HTTP NexusCrew.","invite-ssh-hint":"Il target SSH con cui L’ALTRO dispositivo raggiunge QUESTA installazione (user@host o alias). Obbligatorio: viene incluso nel link.","invite-next-steps":"copia questo link, apri NexusCrew sull’altro dispositivo e incollalo in Impostazioni → Nodi (o scansiona il QR): al resto pensa NexusCrew","pair-card-title":"collega con un solo link","pair-card-help":"Incolla il link di pairing generato sull’altro dispositivo (o scansiona il suo QR): NexusCrew decodifica, prova la connessione SSH e collega da solo.","pair-paste-ph":"incolla qui il link di pairing","pair-paste-btn":"incolla","pair-advanced":"avanzate / modifica","pair-progress":"collegamento in corso: SSH → invito → conferma → verifica…","pair-retry":"riprova","pair-invalid-link":"questo non è un link di pairing valido","pair-invalid-hint":"serve il link completo (http://…#pair=…) generato dall’altro NexusCrew: non aprirlo, incollalo qui","pair-missing-ssh":"il link non include il target SSH (formato v1): indica in “avanzate” come questo dispositivo raggiunge l’altro via SSH — non viene mai inventato","pair-missing-name":"manca il nome del nodo: completalo in “avanzate”","pair-clipboard-denied":"lettura degli appunti non consentita: incolla manualmente nel campo","pair-clipboard-empty":"appunti vuoti: copia prima il link di pairing","pair-stage-validation":"dati non validi","pair-stage-conflict":"nome già in uso","pair-stage-ssh-start":"avvio del tunnel SSH fallito","pair-stage-ssh-ready":"peer non raggiungibile via SSH","pair-stage-join":"scambio dell’invito fallito","pair-stage-tunnel-final":"tunnel negoziato fallito","pair-stage-confirm":"conferma del pairing fallita","pair-stage-health":"verifica finale della federazione fallita","pair-stage-internal":"errore interno","pair-stage-generic":"connessione fallita","qr-no-camera":"nessuna camera disponibile su questo dispositivo: usa una foto del QR","qr-permission":"permesso camera negato: consentilo nel browser o usa una foto del QR","qr-unsupported":"scanner live non supportato qui: carica una foto del QR","qr-upload":"usa una foto"},en:{"update-available":"new version {v} available","install-version-mismatch":"incomplete installation: frontend and server do not match (v{v})",reload:"reload","grid-empty":"drag a session here from the sidebar, or double-click for single view","grid-full":"a deck can show at most 9 sessions",pin:"pin to top",sessions:"sessions","new-session":"new session",new:"new",fleet:"Fleet","fleet-tmux":"tmux fleet","other-sessions":"Other sessions","view-all":"all","view-pinned":"pinned","view-active":"active","view-off":"off","position-local":"Local",files:"files",refresh:"refresh","filter-placeholder":"filter sessions…","loading-fleet":"loading fleet…","no-sessions":"no live tmux sessions — the fleet starts at boot (systemd)","no-match":'no session matches "{q}"',"copy-url":"click to copy URL","ssh-only":"SSH/VPN tunnel only","new-files-outbox":"new files in outbox",terminate:"terminate","terminate-confirm":'Terminate session "{name}"?',"cell-on":"tmux alive","cell-off":"off","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","state-on":"running","state-off":"stopped",engine:"Engine",model:"Model","model-default":"Provider default model","model-remembered":"Last model used with this engine","boot-persist":"start at boot","remove-boot":"also remove from boot","power-config-in-settings":"Edit engine, provider, profile, model and permissions in Settings → Fleet.","no-remote-control":"⚠ non-native engine: no claude.ai app RC (you can still drive it from here)",cancel:"cancel",name:"name","name-invalid":"invalid name: a-zA-Z0-9._- max 64, no leading '-'",cwd:"folder",browse:"browse","fs-home":"home","fs-parent":".. up",preset:"preset","preset-2x2":"2×2 grid","preset-columns":"columns","preset-equalize":"equalize",collapse:"collapse",expand:"expand",create:"create","auth-prompt":"Paste the token (printed by the server):","remember-device":"remember on this device","zoom-out":"smaller text","zoom-in":"bigger text",composer:"composer",windows:"{n} windows","empty-files":"empty",upload:"upload","no-sessions-short":"no sessions","composer-placeholder":"type or dictate…",attach:"attach","attach-file":"File","attach-camera":"Camera","attach-gallery":"Gallery","attach-uploading":"uploading…","attach-upload-progress":"attachment {n}/{total}…","attach-uploaded":"{n} attachments uploaded",voice:"voice",send:"send","composer-send-failed":"connection not ready — text kept, try again",close:"close","lang-label":"language",decks:"decks","new-deck":"new deck","deck-name":"deck name","open-deck-window":"open in a new window","detach-deck":"detach into a new window","deck-current":"this deck (current window)","deck-owner-unavailable":"owner node is not shared or reachable","rename-deck":"rename deck","delete-deck":"delete deck","delete-deck-confirm":'Delete deck "{name}"?',"send-to-deck":"send to deck…","deck-autosave":"autosave",saving:"saving…",saved:"saved","popup-blocked":"popup blocked: open here","select-drag":"drag to select","copy-manual":"select and copy manually","toggle-sidebar":"show/hide the sidebar",settings:"settings","tab-roles":"roles","tab-nodes":"nodes",local:"Local",location:"Location","pairing-link":"pairing link","pairing-required":"name, SSH alias and pairing link are required","pairing-connect-help":"Connecting a node requires a name, a working SSH Host, and a link/QR created by the other NexusCrew installation.","pairing-localhost-hint":"127.0.0.1 in the link is correct: do not open it here. NexusCrew carries the invite and port through the SSH Host.","scan-qr":"scan QR","pairing-qr-invalid":"invalid pairing QR","invite-node":"invite a node","create-pairing-link":"create link / QR","visibility-network":"whole network","visibility-relay":"relay only","visibility-selected":"selected nodes","hydra-simple":"local + nodes, one network","local-ready":"This device is ready. Use it alone or connect it to a node.","local-only":"local only","add-node":"add node",connect:"connect","node-connected":"Node connected. The network will synchronize automatically.","tab-system":"system","tab-fleet":"fleet","fleet-editor-unavailable":"The editor is available only with the builtin fleet provider.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-model-default":"default model (optional)","fleet-model-required":"model (required)","fleet-standard-permissions":"standard permissions","fleet-unsafe-permissions":"unsafe · bypass approvals/sandbox","fleet-unsafe-warning":"Explicit unsafe mode: the worker can act without normal approval or sandbox gates.","fleet-provider-display":"provider display name","fleet-custom-provider-default":"Custom provider","fleet-api-key-env":"API_KEY_ENV_NAME","fleet-provider-id":"provider-id","fleet-custom-secret-help":"NexusCrew stores only the environment-variable name, never its value.","fleet-model-override":"model override","fleet-ready":"ready","fleet-not-ready":"not configured","fleet-engines":"Engines","fleet-cells":"Cells / cloud sessions","fleet-backup":"backup / restore","fleet-backup-help":"Selectively export or restore cells and system prompts. Tokens, API keys and provider secrets never enter the file.","fleet-backup-export":"export","fleet-backup-import":"import","fleet-backup-download":"download backup","fleet-backup-restore":"restore selected","fleet-backup-import-help":"Choose a JSON backup, review the cells and select a destination engine before restoring.","fleet-backup-overwrite":"overwrites existing cell","fleet-backup-new":"new cell","fleet-backup-engine-missing":"choose an available engine","fleet-backup-restore-unavailable":"The selected node supports export only; update it to restore backups.","fleet-backup-restored":"{n} cells restored","fleet-backup-confirm-overwrite":"Overwrite these cells? {cells}","fleet-backup-needs-restart":"restart required: {cells}","fleet-backup-empty":"no cells to export","fleet-backup-select-one":"select at least one cell","fleet-backup-too-large":"backup is too large (1 MB maximum)","fleet-backup-invalid-json":"the file does not contain valid JSON","fleet-backup-invalid-format":"unsupported backup format or version","fleet-backup-invalid-cell":"the backup contains an invalid cell","fleet-backup-duplicate-cell":"the backup contains duplicate cell IDs","fleet-system-prompt":"system prompt",characters:"characters","select-all":"select all","select-none":"select none",edit:"edit",save:"save",label:"label","command-path":"absolute command path","args-lines":"arguments, one per line","env-write-only":"Environment values are write-only: blank keeps the existing value.","fleet-new-engine":"New engine","fleet-new-cell":"New cell","fleet-saved":"Definition saved.","fleet-restart-confirm":"Change saved. Restart now: {cells}?","fleet-remove-engine":'Delete engine "{id}"?',"fleet-remove-cell":'Delete cell "{id}"? If active it will be stopped first.',"settings-readonly":"READONLY active: changes are blocked by the server (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"this machine watches other nodes via SSH tunnels","role-node":"node (reachable)","published-port":"published port (optional)","no-nodes":"no remote nodes configured","node-add":"connect a NexusCrew installation","node-connect-help":"The SSH port reaches the SSH server. The NexusCrew port is the local port reported by `nexuscrew status` on the remote node.","node-name-label":"Node name","node-ssh-label":"SSH host","node-ssh-port-label":"SSH port","node-ssh-port-help":"Usually 22; use the SSH server public port.","node-app-port-label":"NexusCrew port on node","node-app-port-help":"The port reported by `nexuscrew status` on the remote node.","node-name-ph":"name (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"remote port (opt.)","node-remove-confirm":'Remove node "{name}"?',"node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","share-node":"Share this node","share-node-off-desc":"Private: it stays connected to the hub, but other clients cannot reach it.","share-node-on-desc":"Shared: the hub may advertise it and route authorized cells and decks.","peer-shared":"Client node shared on the Hydra network","peer-private":"Private client node: connected, not published on Hydra","node-connected-client":"connected client","transport-used":"in use","tunnel-up":"tunnel up","tunnel-down":"tunnel down","authorized-keys-hint":"paste this line into ~/.ssh/authorized_keys on the remote host:",copy:"copy",copied:"copied","token-rotate":"rotate token","token-rotate-explain":"The new token will NOT be shown: retrieve it with `nexuscrew show token`. The current session will be invalidated.","service-regenerate":"regenerate service","npm-auto-update":"automatic updates from npm","npm-auto-update-help":"Periodically checks latest and installs only newer versions. Never downgrades.","npm-update-current":"installed","npm-update-latest":"npm latest","npm-update-check":"check now","npm-update-install":"update now","npm-update-restarting":"Update started; NexusCrew will return after the service restarts.","npm-update-idle":"up to date","npm-update-checking":"checking","npm-update-available":"update available","npm-update-installing":"installing","npm-update-installed":"installed, restarting","npm-update-error":"check failed","npm-update-unsupported":"available only for global npm installations","service-installed":"service installed","service-missing":"service not installed","service-active":"active","service-inactive":"not active",confirm:"confirm",add:"add",enable:"enable","wizard-title":"welcome to NexusCrew","wizard-skip":"configure later from settings","wizard-step-roles":"roles of this install","wizard-step-node":"first remote node (optional)","wizard-done":"all set","wizard-done-desc":"setup complete — you can change everything from settings",next:"continue",back:"back",skip:"skip",finish:"finish","err-node-name":"invalid name (a-z, 0-9, -, max 32)","err-ssh":"invalid ssh (expected user@host or alias)","err-port":"invalid port (1–65535)","err-ssh-port":"invalid SSH port (1–65535)","err-node-port":"invalid NexusCrew port (1–65535)","node-sessions":"{n} sessions","tunnel-down-since":"tunnel down for {t}","node-unreachable":"node unreachable","node-passive":"client offline · expected","node-offline":"node offline","node-offline-seen":"offline · seen {t} ago","node-needs-repair":"legacy · pair again","asks-title":"questions from the cells","ask-reply-ph":"type your answer…","push-enable":"enable push notifications","push-disable":"disable push notifications","push-on":"push active on this device","push-off":"push not active","push-denied":"notification permission denied by the browser","push-unsupported":"push not supported in this browser","node-display-label":"Name (label)","node-slug-hint":"routing on slug: {slug}","device-name-label":"Device name","device-name-hint":"how peers see you (editable)","err-label":"invalid label (max 64 chars, no line breaks)","fleet-inventory":"Cells and sessions","fleet-inventory-help":"all positions (Local + Hydra routes)","fleet-manage-location":"Manage location","fleet-network-overview":"Network overview","fleet-manage-help":"create and configure cells at the selected location","fleet-overview-help":"operational state of every location, separate from the editor","fleet-inventory-empty":"no cells or sessions","fleet-not-available":"fleet not available on this position",start:"start",stop:"stop",restart:"restart",delete:"delete","copy-manual":"copy failed — select and press Cmd+C, or copy manually","copy-empty":"nothing selected: drag with Shift to select","save-and-start":"save and start",permissions:"Permissions","power-on-hint":"Stop the cell; you can also remove it from boot.","launch-engine-help":"Providers, credentials and new engines are created in Settings → Fleet. Model and permissions are per cell.","launch-external-hint":"External provider: engine/model are configured in the external fleet.","import-as-cell":"Import as cell","import-help":"Reconcile an existing tmux session into a managed cell. Pick an already-declared engine: no engine is invented.","import-engine-required":"pick an engine (required)","test-and-connect":"test and connect","pairing-v2-hint":"Paste or scan ONE link: it prefills name, SSH host and label when the link carries them (v2).","invite-v2-hint":"Create one complete one-time invitation. If this device already joined a hub, that hub is used automatically; otherwise only its reachable SSH address is required.","invite-network-hint":"Create an invitation for the network you already joined. The new device enters through the hub instead of connecting directly to this device.","invite-network-label":"Destination network","invite-network-via":"Hub","invite-network-route":"One connection to the hub; nodes, cells and decks are routed internally.","invite-endpoint-label":"This hub’s SSH address as seen by other devices","invite-endpoint-auto":"Configured endpoint","invite-endpoint-needed":"Enter user@host or a shared SSH alias. This is not 127.0.0.1 and not the NexusCrew HTTP URL.","invite-ssh-hint":"The SSH target the OTHER device uses to reach THIS installation (user@host or alias). Required: it is included in the link.","invite-next-steps":"copy this link, open NexusCrew on the other device and paste it in Settings → Nodes (or scan the QR): NexusCrew does the rest","pair-card-title":"connect with one link","pair-card-help":"Paste the pairing link generated on the other device (or scan its QR): NexusCrew decodes it, tests the SSH connection and connects on its own.","pair-paste-ph":"paste the pairing link here","pair-paste-btn":"paste","pair-advanced":"advanced / edit","pair-progress":"connecting: SSH → invite → confirm → verify…","pair-retry":"retry","pair-invalid-link":"this is not a valid pairing link","pair-invalid-hint":"you need the full link (http://…#pair=…) generated by the other NexusCrew: don’t open it, paste it here","pair-missing-ssh":"the link carries no SSH target (v1 format): set in “advanced” how this device reaches the other one over SSH — it is never invented","pair-missing-name":"the node name is missing: fill it in “advanced”","pair-clipboard-denied":"clipboard read not allowed: paste manually into the field","pair-clipboard-empty":"clipboard is empty: copy the pairing link first","pair-stage-validation":"invalid data","pair-stage-conflict":"name already in use","pair-stage-ssh-start":"SSH tunnel start failed","pair-stage-ssh-ready":"peer unreachable over SSH","pair-stage-join":"invite exchange failed","pair-stage-tunnel-final":"negotiated tunnel failed","pair-stage-confirm":"pairing confirmation failed","pair-stage-health":"final federation check failed","pair-stage-internal":"internal error","pair-stage-generic":"connection failed","qr-no-camera":"no camera available on this device: use a photo of the QR","qr-permission":"camera permission denied: allow it in the browser or use a photo of the QR","qr-unsupported":"live scanner not supported here: upload a photo of the QR","qr-upload":"use a photo"},es:{"update-available":"nueva versión {v} disponible","install-version-mismatch":"instalación incompleta: frontend y servidor no coinciden (v{v})",reload:"recargar","grid-empty":"arrastra aquí una sesión desde la barra lateral, o doble clic para vista única","grid-full":"un deck puede mostrar como máximo 9 sesiones",pin:"fijar arriba",sessions:"sesiones","new-session":"nueva sesión",new:"nueva",fleet:"Flota","fleet-tmux":"flota tmux","other-sessions":"Otras sesiones","view-all":"todas","view-pinned":"fijadas","view-active":"activas","view-off":"apagadas","position-local":"Local",files:"archivos",refresh:"actualizar","filter-placeholder":"filtrar sesiones…","loading-fleet":"cargando flota…","no-sessions":"sin sesiones tmux vivas — la flota arranca en el boot (systemd)","no-match":"ninguna sesión coincide con «{q}»","copy-url":"clic para copiar la URL","ssh-only":"solo túnel SSH/VPN","new-files-outbox":"archivos nuevos en outbox",terminate:"terminar","terminate-confirm":"¿Terminar la sesión «{name}»?","cell-on":"tmux activo","cell-off":"apagada","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","state-on":"encendida","state-off":"apagada",engine:"Motor",model:"Modelo","model-default":"Modelo predeterminado del proveedor","model-remembered":"Último modelo usado con este motor","boot-persist":"iniciar en el boot","remove-boot":"quitar también del boot","power-config-in-settings":"Modifica motor, proveedor, perfil, modelo y permisos en Ajustes → Flota.","no-remote-control":"⚠ motor no nativo: sin RC de la app claude.ai (aquí puedes pilotarla igual)",cancel:"cancelar",name:"nombre","name-invalid":"nombre inválido: a-zA-Z0-9._- máx 64, sin '-' inicial",cwd:"carpeta",browse:"explorar","fs-home":"home","fs-parent":".. arriba",preset:"preset","preset-2x2":"cuadrícula 2×2","preset-columns":"columnas","preset-equalize":"igualar",collapse:"contraer",expand:"expandir",create:"crear","auth-prompt":"Pega el token (impreso por el servidor):","remember-device":"recordar en este dispositivo","zoom-out":"texto más pequeño","zoom-in":"texto más grande",composer:"composer",windows:"{n} ventanas","empty-files":"vacía",upload:"subir","no-sessions-short":"sin sesiones","composer-placeholder":"escribe o dicta…",attach:"adjuntar","attach-file":"Archivo","attach-camera":"Cámara","attach-gallery":"Galería","attach-uploading":"subiendo…","attach-upload-progress":"adjunto {n}/{total}…","attach-uploaded":"{n} adjuntos subidos",voice:"voz",send:"enviar","composer-send-failed":"conexión no disponible — texto conservado, inténtalo de nuevo",close:"cerrar","lang-label":"idioma",decks:"decks","new-deck":"nuevo deck","deck-name":"nombre del deck","open-deck-window":"abrir en una ventana nueva","detach-deck":"separar en una ventana nueva","deck-current":"este deck (ventana actual)","deck-owner-unavailable":"el nodo propietario no está compartido o accesible","rename-deck":"renombrar deck","delete-deck":"eliminar deck","delete-deck-confirm":"¿Eliminar el deck «{name}»?","send-to-deck":"enviar al deck…","deck-autosave":"guardado automático",saving:"guardando…",saved:"guardado","popup-blocked":"ventana bloqueada: abrir aquí","select-drag":"arrastra para seleccionar","copy-manual":"selecciona y copia manualmente","toggle-sidebar":"mostrar/ocultar la barra lateral",settings:"ajustes","tab-roles":"roles","tab-nodes":"nodos",local:"Local",location:"Ubicación","pairing-link":"enlace de emparejamiento","pairing-required":"nombre, alias SSH y enlace son obligatorios","pairing-connect-help":"Para conectar un nodo necesitas un nombre, un Host SSH funcional y el enlace/QR creado por la otra instalación NexusCrew.","pairing-localhost-hint":"127.0.0.1 en el enlace es correcto: no lo abras aquí. NexusCrew usa la invitación y el puerto mediante el Host SSH.","scan-qr":"escanear QR","pairing-qr-invalid":"QR de emparejamiento no válido","invite-node":"invitar un nodo","create-pairing-link":"crear enlace / QR","visibility-network":"toda la red","visibility-relay":"solo relay","visibility-selected":"nodos seleccionados","hydra-simple":"local + nodos, una red","local-ready":"Este dispositivo está listo. Úsalo solo o conéctalo a un nodo.","local-only":"solo local","add-node":"añadir nodo",connect:"conectar","node-connected":"Nodo conectado. La red se sincronizará automáticamente.","tab-system":"sistema","tab-fleet":"flota","fleet-editor-unavailable":"El editor solo está disponible con el proveedor builtin.","fleet-managed":"gestionado por NexusCrew","fleet-custom":"comando personalizado","fleet-managed-help":"Cliente, proveedor e inicio se gestionan internamente; los secretos nunca se muestran.","fleet-model-default":"modelo predeterminado (opcional)","fleet-model-required":"modelo (obligatorio)","fleet-standard-permissions":"permisos estándar","fleet-unsafe-permissions":"inseguro · omitir aprobaciones/sandbox","fleet-unsafe-warning":"Modo inseguro explícito: el worker puede actuar sin las aprobaciones normales ni las protecciones del sandbox.","fleet-provider-display":"nombre visible del proveedor","fleet-custom-provider-default":"Proveedor personalizado","fleet-api-key-env":"NOMBRE_VARIABLE_API_KEY","fleet-provider-id":"id-proveedor","fleet-custom-secret-help":"NexusCrew guarda solo el nombre de la variable de entorno, nunca su valor.","fleet-model-override":"modelo alternativo","fleet-ready":"listo","fleet-not-ready":"no configurado","fleet-engines":"Motores","fleet-cells":"Celdas / sesiones cloud","fleet-backup":"copia / restauración","fleet-backup-help":"Exporta o restaura selectivamente celdas y system prompts. Tokens, claves API y secretos del proveedor nunca entran en el archivo.","fleet-backup-export":"exportar","fleet-backup-import":"importar","fleet-backup-download":"descargar copia","fleet-backup-restore":"restaurar seleccionadas","fleet-backup-import-help":"Elige una copia JSON, revisa las celdas y selecciona un motor de destino antes de restaurar.","fleet-backup-overwrite":"sobrescribe la celda existente","fleet-backup-new":"celda nueva","fleet-backup-engine-missing":"elige un motor disponible","fleet-backup-restore-unavailable":"El nodo seleccionado solo admite exportación; actualízalo para restaurar copias.","fleet-backup-restored":"{n} celdas restauradas","fleet-backup-confirm-overwrite":"¿Sobrescribir estas celdas? {cells}","fleet-backup-needs-restart":"reinicio necesario: {cells}","fleet-backup-empty":"no hay celdas para exportar","fleet-backup-select-one":"selecciona al menos una celda","fleet-backup-too-large":"copia demasiado grande (máximo 1 MB)","fleet-backup-invalid-json":"el archivo no contiene JSON válido","fleet-backup-invalid-format":"formato o versión de copia no compatible","fleet-backup-invalid-cell":"la copia contiene una celda no válida","fleet-backup-duplicate-cell":"la copia contiene IDs de celda duplicados","fleet-system-prompt":"system prompt",characters:"caracteres","select-all":"seleccionar todas","select-none":"ninguna",edit:"editar",save:"guardar",label:"etiqueta","command-path":"ruta absoluta del comando","args-lines":"argumentos, uno por línea","env-write-only":"Los valores env son de solo escritura: vacío conserva el valor existente.","fleet-new-engine":"Nuevo motor","fleet-new-cell":"Nueva celda","fleet-saved":"Definición guardada.","fleet-restart-confirm":"Cambio guardado. ¿Reiniciar ahora: {cells}?","fleet-remove-engine":'¿Eliminar el motor "{id}"?',"fleet-remove-cell":'¿Eliminar la celda "{id}"? Si está activa se detendrá primero.',"settings-readonly":"READONLY activo: los cambios están bloqueados por el servidor (NEXUSCREW_READONLY=1)","role-client":"client (hub)","role-client-desc":"esta máquina observa otros nodos vía túneles SSH","role-node":"nodo (alcanzable)","published-port":"puerto publicado (opcional)","no-nodes":"sin nodos remotos configurados","node-add":"conectar una instalación NexusCrew","node-connect-help":"El puerto SSH conecta con el servidor SSH. El puerto NexusCrew es el puerto local indicado por `nexuscrew status` en el nodo remoto.","node-name-label":"Nombre del nodo","node-ssh-label":"Host SSH","node-ssh-port-label":"Puerto SSH","node-ssh-port-help":"Normalmente 22; usa el puerto público del servidor SSH.","node-app-port-label":"Puerto NexusCrew del nodo","node-app-port-help":"El puerto indicado por `nexuscrew status` en el nodo remoto.","node-name-ph":"nombre (a-z 0-9 -)","node-ssh-ph":"ssh (user@host)","node-port-ph":"puerto remoto (opc.)","node-remove-confirm":"¿Eliminar el nodo «{name}»?","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","share-node":"Compartir este nodo","share-node-off-desc":"Privado: sigue conectado al hub, pero otros clientes no pueden alcanzarlo.","share-node-on-desc":"Compartido: el hub puede anunciarlo y enrutar celdas y decks autorizados.","peer-shared":"Nodo cliente compartido en la red Hydra","peer-private":"Nodo cliente privado: conectado, no publicado en Hydra","node-connected-client":"cliente conectado","transport-used":"en uso","tunnel-up":"túnel activo","tunnel-down":"túnel caído","authorized-keys-hint":"pega esta línea en ~/.ssh/authorized_keys del host remoto:",copy:"copiar",copied:"copiado","token-rotate":"rotar token","token-rotate-explain":"El nuevo token NO se mostrará: recupéralo con `nexuscrew show token`. La sesión actual quedará invalidada.","service-regenerate":"regenerar service","npm-auto-update":"actualizaciones automáticas desde npm","npm-auto-update-help":"Comprueba latest periódicamente e instala solo versiones más recientes. Nunca baja de versión.","npm-update-current":"instalada","npm-update-latest":"npm latest","npm-update-check":"comprobar ahora","npm-update-install":"actualizar ahora","npm-update-restarting":"Actualización iniciada; NexusCrew volverá después de reiniciar el servicio.","npm-update-idle":"actualizado","npm-update-checking":"comprobando","npm-update-available":"actualización disponible","npm-update-installing":"instalando","npm-update-installed":"instalada, reiniciando","npm-update-error":"comprobación fallida","npm-update-unsupported":"disponible solo con instalación npm global","service-installed":"service instalado","service-missing":"service no instalado","service-active":"activo","service-inactive":"no activo",confirm:"confirmar",add:"añadir",enable:"activar","wizard-title":"bienvenido a NexusCrew","wizard-skip":"configura después desde ajustes","wizard-step-roles":"roles de esta instalación","wizard-step-node":"primer nodo remoto (opcional)","wizard-done":"todo listo","wizard-done-desc":"configuración completa — puedes cambiarlo todo desde ajustes",next:"continuar",back:"atrás",skip:"omitir",finish:"terminar","err-node-name":"nombre inválido (a-z, 0-9, -, máx 32)","err-ssh":"ssh inválido (se espera user@host o alias)","err-port":"puerto inválido (1–65535)","err-ssh-port":"puerto SSH inválido (1–65535)","err-node-port":"puerto NexusCrew inválido (1–65535)","node-sessions":"{n} sesiones","tunnel-down-since":"túnel caído desde hace {t}","node-unreachable":"nodo inalcanzable","node-passive":"cliente desconectado · estado normal","node-offline":"nodo desconectado","node-offline-seen":"sin conexión · visto hace {t}","node-needs-repair":"legacy · vuelve a enlazar","asks-title":"preguntas de las celdas","ask-reply-ph":"escribe la respuesta…","push-enable":"activar notificaciones push","push-disable":"desactivar notificaciones push","push-on":"push activas en este dispositivo","push-off":"push no activas","push-denied":"permiso de notificaciones denegado por el navegador","push-unsupported":"push no soportadas en este navegador","node-display-label":"Nombre (etiqueta)","node-slug-hint":"enrutado por slug: {slug}","device-name-label":"Nombre del dispositivo","device-name-hint":"cómo te ven los pares (editable)","err-label":"etiqueta no válida (máx 64 caracteres, sin saltos de línea)","fleet-inventory":"Celdas y sesiones","fleet-inventory-help":"todas las posiciones (Local + rutas Hydra)","fleet-manage-location":"Gestionar ubicación","fleet-network-overview":"Vista de red","fleet-manage-help":"crea y configura celdas en la ubicación seleccionada","fleet-overview-help":"estado operativo de todas las ubicaciones, separado del editor","fleet-inventory-empty":"sin celdas ni sesiones","fleet-not-available":"fleet no disponible en esta posición",start:"iniciar",stop:"detener",restart:"reiniciar",delete:"eliminar","copy-manual":"copia fallida — selecciona y pulsa Cmd+C, o copia a mano","copy-empty":"nada seleccionado: arrastra con Shift para seleccionar","save-and-start":"guardar e iniciar",permissions:"Permisos","power-on-hint":"Detén la celda; también puedes quitarla del boot.","launch-engine-help":"Proveedores, credenciales y nuevos motores se crean en Ajustes → Flota. Modelo y permisos son por celda.","launch-external-hint":"Proveedor externo: motor/modelo se configuran en el fleet externo.","import-as-cell":"Importar como celda","import-help":"Reconcilia una sesión tmux existente en una celda gestionada. Elige un motor ya declarado: no se inventa ninguno.","import-engine-required":"elige un motor (obligatorio)","test-and-connect":"probar y conectar","pairing-v2-hint":"Pega o escanea UN solo enlace: rellena nombre, Host SSH y etiqueta cuando los incluye (v2).","invite-v2-hint":"Crea una invitación completa de un solo uso. Si este dispositivo ya está unido a un hub, se usa automáticamente; si no, solo hace falta su dirección SSH alcanzable.","invite-network-hint":"Crea una invitación para la red a la que ya estás conectado. El nuevo dispositivo entra por el hub y no se conecta directamente a este dispositivo.","invite-network-label":"Red de destino","invite-network-via":"Hub","invite-network-route":"Una sola conexión al hub; nodos, celdas y decks se enrutan internamente.","invite-endpoint-label":"Dirección SSH de este hub vista por los otros dispositivos","invite-endpoint-auto":"Endpoint ya configurado","invite-endpoint-needed":"Introduce usuario@host o un alias SSH compartido. No es 127.0.0.1 ni la URL HTTP de NexusCrew.","invite-ssh-hint":"El destino SSH con el que el OTRO dispositivo alcanza ESTA instalación (usuario@host o alias). Obligatorio: se incluye en el enlace.","invite-next-steps":"copia este enlace, abre NexusCrew en el otro dispositivo y pégalo en Ajustes → Nodos (o escanea el QR): NexusCrew hace el resto","pair-card-title":"conectar con un solo enlace","pair-card-help":"Pega el enlace de emparejamiento generado en el otro dispositivo (o escanea su QR): NexusCrew lo decodifica, prueba la conexión SSH y conecta solo.","pair-paste-ph":"pega aquí el enlace de emparejamiento","pair-paste-btn":"pegar","pair-advanced":"avanzado / editar","pair-progress":"conectando: SSH → invitación → confirmación → verificación…","pair-retry":"reintentar","pair-invalid-link":"esto no es un enlace de emparejamiento válido","pair-invalid-hint":"se necesita el enlace completo (http://…#pair=…) generado por el otro NexusCrew: no lo abras, pégalo aquí","pair-missing-ssh":"el enlace no incluye el destino SSH (formato v1): indica en “avanzado” cómo este dispositivo alcanza al otro por SSH — nunca se inventa","pair-missing-name":"falta el nombre del nodo: complétalo en “avanzado”","pair-clipboard-denied":"lectura del portapapeles no permitida: pega manualmente en el campo","pair-clipboard-empty":"portapapeles vacío: copia primero el enlace","pair-stage-validation":"datos no válidos","pair-stage-conflict":"nombre ya en uso","pair-stage-ssh-start":"fallo al iniciar el túnel SSH","pair-stage-ssh-ready":"peer inaccesible por SSH","pair-stage-join":"intercambio de invitación fallido","pair-stage-tunnel-final":"túnel negociado fallido","pair-stage-confirm":"confirmación de emparejamiento fallida","pair-stage-health":"verificación final de la federación fallida","pair-stage-internal":"error interno","pair-stage-generic":"conexión fallida","qr-no-camera":"no hay cámara disponible en este dispositivo: usa una foto del QR","qr-permission":"permiso de cámara denegado: permítelo en el navegador o usa una foto del QR","qr-unsupported":"escáner en vivo no soportado aquí: sube una foto del QR","qr-upload":"usar una foto"}};function Ru(){const e=o_(),t=e?e.getItem(s_):null;return Ph.includes(t)?t:ba}function ow(e){const t=o_();if(t)try{t.setItem(s_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Nu))}function S(e){const t=Ru(),r=da[t]||da[ba];return Object.prototype.hasOwnProperty.call(r,e)?r[e]:Object.prototype.hasOwnProperty.call(da[ba],e)?da[ba][e]:e}function aw(e){return typeof window>"u"?()=>{}:(window.addEventListener(Nu,e),()=>window.removeEventListener(Nu,e))}const a_=Ph;function pi(){return[M.useSyncExternalStore(aw,Ru,Ru),ow]}function Da({cell:e,token:t,route:r=[],onConfirm:s,onClose:o}){var Y,F;pi();const l=!!(e&&e.active),u=Array.isArray(r)?r.join("/"):"",[d,p]=M.useState([]),[m,y]=M.useState(!1);M.useEffect(()=>{let Q=!0;return(async()=>{if(t)try{const $=await an(t,u?u.split("/"):[]);if(!Q)return;if(y($.provider==="builtin"&&($.capabilities||[]).includes("edit")),$.provider==="builtin"&&($.capabilities||[]).includes("definitions")){const q=await kh(t,u?u.split("/"):[]);if(!Q)return;const G=new Map(($.engines||[]).map(P=>[P.id,P]));p((q.engines||[]).map(P=>{var J,L,x,X,re,se,ae;return{id:P.id,label:P.label||P.id,client:((J=P.managed)==null?void 0:J.client)||"",models:[...new Set([...((L=G.get(P.id))==null?void 0:L.models)||[],...((x=P.managedInfo)==null?void 0:x.models)||[]])].filter(Boolean),defaultModel:((X=P.managed)==null?void 0:X.model)||((re=P.managedInfo)==null?void 0:re.defaultModel)||"",policyDefault:((se=P.managed)==null?void 0:se.permissionPolicy)||((ae=P.managed)!=null&&ae.client&&P.managed.client==="claude"?"unsafe":"standard")}}))}}catch{}})(),()=>{Q=!1}},[t,u]);const w=(e==null?void 0:e.engine)||((Y=d[0])==null?void 0:Y.id)||"",v=Q=>(e==null?void 0:e.models)&&e.models[Q]||"",_=Q=>{const $=(e==null?void 0:e.permissionPolicies)&&e.permissionPolicies[Q];if($==="standard"||$==="unsafe")return $;const q=d.find(G=>G.id===Q);return q?q.policyDefault:"standard"},[b,E]=M.useState(w),[N,R]=M.useState((e==null?void 0:e.model)||""),O=(e==null?void 0:e.permissionPolicy)==="standard"||(e==null?void 0:e.permissionPolicy)==="unsafe"?e.permissionPolicy:((F=e==null?void 0:e.permissionPolicies)==null?void 0:F[e==null?void 0:e.engine])||"",[z,B]=M.useState(O),[W,A]=M.useState((e==null?void 0:e.boot)??!0),[I,V]=M.useState(!1),[U,ie]=M.useState(null);M.useEffect(()=>{d.length&&(E(Q=>Q||w),R(Q=>Q||v((e==null?void 0:e.engine)||w)||""),B(Q=>Q==="standard"||Q==="unsafe"?Q:_((e==null?void 0:e.engine)||w)))},[d.length]);const ee=M.useMemo(()=>d.find(Q=>Q.id===b)||null,[d,b]),k=!!(ee&&["claude","codex","codex-vl"].includes(ee.client));function D(Q){E(Q);const $=d.find(q=>q.id===Q);R(v(Q)||($==null?void 0:$.defaultModel)||""),B(_(Q))}async function j(Q){Q.preventDefault(),V(!0),ie(null);try{if(l)await s({action:"down",boot:W});else{const $=z==="standard"||z==="unsafe"?z:(ee==null?void 0:ee.policyDefault)||"standard";await s({action:"up",...m?{engine:b,model:N||"",...k?{permissionPolicy:$}:(ee==null?void 0:ee.client)==="pi"?{permissionPolicy:"standard"}:{}}:{},boot:W})}o()}catch($){ie(String($&&$.message||$)),V(!1)}}return h.jsx("div",{className:"nc-sheet-overlay nc-launch-overlay",onClick:o,children:h.jsxs("form",{className:"nc-sheet nc-power-sheet nc-launch-sheet",onClick:Q=>Q.stopPropagation(),onSubmit:j,children:[h.jsxs("div",{className:"nc-sheet-head",children:[h.jsx("b",{children:e==null?void 0:e.cell}),h.jsx("span",{className:"nc-sheet-state",children:S(l?"state-on":"state-off")})]}),l?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:S("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[S("model"),": ",e.model]}),h.jsx("small",{children:S("power-on-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:W,onChange:Q=>A(Q.target.checked)}),S("remove-boot")]})]}):h.jsxs(h.Fragment,{children:[m&&d.length>0?h.jsxs("div",{className:"nc-launch-fields",children:[h.jsxs("label",{className:"nc-field",children:[S("engine"),h.jsx("select",{value:b,onChange:Q=>D(Q.target.value),children:d.map(Q=>h.jsx("option",{value:Q.id,children:Q.label},Q.id))})]}),h.jsxs("label",{className:"nc-field",children:[S("model"),h.jsx("input",{value:N,list:"nc-launch-models",placeholder:S("model-default"),onChange:Q=>R(Q.target.value)}),h.jsx("datalist",{id:"nc-launch-models",children:((ee==null?void 0:ee.models)||[]).map(Q=>h.jsx("option",{value:Q},Q))})]}),k?h.jsxs("label",{className:"nc-field",children:[S("permissions"),h.jsxs("select",{value:z,onChange:Q=>B(Q.target.value),children:[h.jsx("option",{value:"standard",children:S("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:S("fleet-unsafe-permissions")})]})]}):h.jsx("small",{className:"nc-note",children:S("fleet-standard-permissions")}),k&&z==="unsafe"&&h.jsx("small",{className:"nc-err",children:S("fleet-unsafe-warning")}),h.jsx("small",{className:"nc-note",children:S("launch-engine-help")})]}):h.jsxs("div",{className:"nc-power-config",children:[h.jsx("span",{children:S("engine")}),h.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&h.jsxs("small",{children:[S("model"),": ",e.model]}),h.jsx("small",{children:S("launch-external-hint")})]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:W,onChange:Q=>A(Q.target.checked)}),S("boot-persist")]})]}),U&&h.jsx("div",{className:"nc-err",children:U}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:o,disabled:I,children:S("cancel")}),h.jsx("button",{type:"submit",className:"nc-btn primary",disabled:I,children:S(l?"power-off":"save-and-start")})]})]})})}const Up=/^[a-z0-9-]{1,32}$/;function fa(e,t){const r=Array.isArray(e)?e:[];return r.length?`${r.map(encodeURIComponent).join("/")}:${t}`:String(t)}function lw(e,t,r){const s={};for(const o of Array.isArray(t)?t:[]){const l=Array.isArray(o==null?void 0:o.route)?o.route:typeof(o==null?void 0:o.name)=="string"?[o.name]:[];if(!l.length)continue;const u=l.join("/"),d=o.status==="up"||o.tunnel&&o.tunnel.status==="up",p=o.status==="passive"||o.tunnel&&o.tunnel.status==="passive";!d&&!p&&(s[u]=e&&e[u]||r)}return s}function qp(e,t,r){return!e||!Array.isArray(e.cells)?[]:e.cells.map(s=>({...s,route:t,key:`${r}:${s.tmuxSession||s.cell}`}))}function Kp({nodes:e,topology:t,remote:r,down:s,fleet:o}={}){var p,m,y,w;const l=[],u=new Set,d=new Set;for(const v of Array.isArray(e)?e:[]){if(!v||typeof v.name!="string"||!Up.test(v.name)||v.direction==="inbound"&&v.shared!==!0)continue;const _=[v.name],b=v.name;u.add(b);const E=((p=v.tunnel)==null?void 0:p.status)||"unknown",N=E==="up",R={name:v.name,label:v.label||v.name,route:_,direct:!0,instanceId:v.nodeId||null,shared:v.shared===!0,tunnelStatus:E,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:v.health||null,direction:v.direction||"outbound",roles:v.roles||null,rolesKnown:v.rolesKnown===!0};if(v.nodeId&&d.add(v.nodeId),!v.nodeId&&v.paired===!1){l.push({...R,status:"needs-repair",downSince:s&&s[b]||null});continue}if(((m=v.health)==null?void 0:m.auth)==="failed"||E==="degraded"&&((y=v.health)==null?void 0:y.status)==="degraded"){l.push({...R,status:"needs-repair",downSince:s&&s[b]||null});continue}if(E==="passive"||((w=v.health)==null?void 0:w.status)==="passive"){l.push({...R,status:"passive",downSince:null});continue}if(!N){l.push({...R,status:"down",downSince:s&&s[b]||null});continue}const O=r&&(r[b]||r[v.name])||null;if(!O||O.error||!Array.isArray(O.sessions)){l.push({...R,status:"unreachable"});continue}const z=O.sessions.filter(I=>I&&typeof I.name=="string"&&I.name).map(I=>({...I,node:b,route:_,key:`${b}:${I.name}`})),B=o&&(o[b]||o[v.name]),W=qp(B,_,b),A=new Set(W.map(I=>I.tmuxSession).filter(Boolean));l.push({...R,status:"up",sessions:z,cells:W,unmanaged:z.filter(I=>!A.has(I.name)),fleetAvailable:!!(B&&B.available),capabilities:B&&B.capabilities||[],engines:B&&B.engines||[],fleetProvider:B&&B.provider||null})}for(const v of Array.isArray(t)?t:[]){if(!v||!Array.isArray(v.route)||v.route.length<1||v.route.some(B=>!Up.test(B)))continue;const _=v.route.join("/");if(u.has(_)||v.instanceId&&d.has(v.instanceId))continue;v.instanceId&&d.add(v.instanceId);const b={name:v.name,label:v.label||v.route.join(" › "),route:[...v.route],direct:!1,instanceId:v.instanceId||null,shared:!0,tunnelStatus:null,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:v.health||null,lastSeen:v.lastSeen||null};if(v.stale){l.push({...b,status:"offline",downSince:s&&s[_]||v.lastSeen||null});continue}const E=r&&r[_]||null;if(!E||E.error||!Array.isArray(E.sessions)){l.push({...b,status:"unreachable",downSince:s&&s[_]||null});continue}const N=E.sessions.filter(B=>B&&typeof B.name=="string"&&B.name).map(B=>({...B,node:_,route:v.route,key:`${_}:${B.name}`})),R=o&&o[_],O=qp(R,v.route,_),z=new Set(O.map(B=>B.tmuxSession).filter(Boolean));l.push({...b,status:"up",sessions:N,cells:O,unmanaged:N.filter(B=>!z.has(B.name)),fleetAvailable:!!(R&&R.available),capabilities:R&&R.capabilities||[],engines:R&&R.engines||[],fleetProvider:R&&R.provider||null,lastSeen:v.lastSeen||null})}return l.sort((v,_)=>v.label.localeCompare(_.label))}const cw=4e3;function Dh(e,t=!0){const[r,s]=M.useState([]),o=M.useRef({});return M.useEffect(()=>{if(!t||!e){s([]);return}let l=!0;async function u(){var E;let p=[],m=[];if(await Promise.all([Zg(e).then(N=>{p=Array.isArray(N.nodes)?N.nodes:[]}).catch(()=>{}),qS(e).then(N=>{m=Array.isArray(N.nodes)?N.nodes:[]}).catch(()=>{})]),!l)return;const y={},w={},v=new Set(p.map(N=>N.name)),_=[];for(const N of p)((E=N.tunnel)==null?void 0:E.status)==="up"&&(N.nodeId||N.paired!==!1)&&(N.direction!=="inbound"||N.shared===!0)&&_.push([N.name]);for(const N of m)!N.stale&&Array.isArray(N.route)&&!(N.route.length===1&&v.has(N.route[0]))&&_.push(N.route);if(await Promise.all(_.map(async N=>{const R=N.join("/");try{y[R]=await e_(e,N)}catch{y[R]={error:"unreachable"}}try{w[R]=await an(e,N)}catch{w[R]={available:!1}}})),!l)return;const b=Kp({nodes:p,topology:m,remote:y,fleet:w,down:o.current});o.current=lw(o.current,b,Math.floor(Date.now()/1e3)),s(Kp({nodes:p,topology:m,remote:y,fleet:w,down:o.current}))}u();const d=setInterval(u,cw);return()=>{l=!1,clearInterval(d)}},[e,t]),r}function Vp(e,t){return t?0:e.attached?1:2}function qs(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function Ac(e){return e.status==="down"?e.downSince?S("tunnel-down-since").replace("{t}",qs(e.downSince)):S("tunnel-down"):e.status==="unreachable"?S("node-unreachable"):e.status==="offline"?e.lastSeen?S("node-offline-seen").replace("{t}",qs(e.lastSeen)):S("node-offline"):e.status==="needs-repair"?S("node-needs-repair"):""}function uw(e){return e?e.status==="healthy"?"on":"warn":null}function Yp(e){return e&&(e.detail||e.status)||""}function hw({onPick:e,token:t,onSettings:r}){const[s,o]=pi(),l=Dh(t),[u,d]=M.useState(null),[p,m]=M.useState(null),[y,w]=M.useState(""),[v,_]=M.useState(""),[b,E]=M.useState({bind:"127.0.0.1",port:""}),[N,R]=M.useState([]),[O,z]=M.useState(!1),[B,W]=M.useState(null),[A,I]=M.useState(null);async function V(){try{const X=await(await Nt("/api/sessions",t)).json();X.error?(m(X.error),d([])):(m(null),d(X.sessions||[]))}catch(x){m(String(x)),d([])}try{const x=await an(t);z(!!x.available),R(x.available?x.cells||[]:[])}catch{z(!1),R([])}}M.useEffect(()=>{V(),Nt("/api/config",t).then(X=>X.json()).then(X=>{_(X.version||""),E({bind:X.bind||"127.0.0.1",port:X.port||""})}).catch(()=>{});const x=setInterval(V,4e3);return()=>clearInterval(x)},[]);async function U(){if(!b.port)return;const x=`http://${b.bind}:${b.port}/#token=${t}`;try{await navigator.clipboard.writeText(x)}catch{}}async function ie(x){if(!B)return;const{cell:X}=B,re=Array.isArray(B.route)?B.route:[];x.action==="up"?await xh(t,{cell:X,boot:!!x.boot,...x.engine?{engine:x.engine}:{},...x.model!==void 0?{model:x.model}:{},...x.permissionPolicy?{permissionPolicy:x.permissionPolicy}:{}},re):await Pa(t,{cell:X,boot:!!x.boot},re),V()}async function ee(x,X=[]){try{await Eh(t,x,X)}catch{return}V()}async function k(x){if(!(!(x!=null&&x.direct)||A)){I(x.name);try{await Rh(t,x.name,x.tunnelStatus==="up"?"down":"up")}catch{}I(null)}}const D=M.useMemo(()=>{const x=new Map;for(const X of u||[])x.set(X.name,X);return x},[u]),j=M.useMemo(()=>new Set(N.map(x=>x.tmuxSession)),[N]),[Y,F]=M.useState(r_),Q=x=>F(X=>n_(X,x)),$=M.useMemo(()=>{const x=(u||[]).map(re=>{const se=Number(localStorage.getItem(Xg(re.name))||0),ae=!!(re.outbox&&re.outbox.count>0&&re.outbox.latest>se);return{...re,fresh:ae}}),X=y.trim().toLowerCase();return x.filter(re=>!X||re.name.toLowerCase().includes(X)).sort((re,se)=>Eu(zs(Y,re.name,re.activity),zs(Y,se.name,se.activity))||Vp(re,re.fresh)-Vp(se,se.fresh)||re.name.localeCompare(se.name))},[u,y,Y]),q=$.filter(x=>!j.has(x.name)),G=M.useMemo(()=>[...N].sort((x,X)=>Eu(zs(Y,x.tmuxSession,(D.get(x.tmuxSession)||{}).activity),zs(Y,X.tmuxSession,(D.get(X.tmuxSession)||{}).activity))||Number(X.active)-Number(x.active)||x.cell.localeCompare(X.cell)),[N,Y,D]),P=u?u.length:0,J=(u||[]).filter(x=>x.attached).length,L=b.port?`${b.bind}:${b.port}`:b.bind;return h.jsxs("div",{className:"nc-home",children:[h.jsxs("header",{className:"nc-home-head",children:[h.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",h.jsx("span",{className:"nc-cursor"})]}),h.jsxs("div",{className:"nc-home-sub",children:[S("fleet-tmux")," · ",P," ",S("sessions"),J>0&&` · ${J} attached`]}),h.jsxs("span",{className:"nc-head-actions",children:[h.jsx("button",{className:"nc-refresh",onClick:()=>r("nodes",!1),title:S("settings"),children:h.jsx(He,{name:"gear",size:18})}),h.jsx("button",{className:"nc-refresh",onClick:V,title:S("refresh"),children:h.jsx(He,{name:"refresh",size:18})})]})]}),h.jsxs("main",{className:"nc-home-scroll",children:[P>8&&h.jsx("input",{className:"nc-filter",type:"search",placeholder:S("filter-placeholder"),value:y,onChange:x=>w(x.target.value)}),p&&h.jsx("div",{className:"nc-err",children:p}),O&&N.length>0&&h.jsxs("section",{className:"nc-group",children:[h.jsx("div",{className:"nc-group-title",children:S("fleet")}),G.map(x=>{const X=D.get(x.tmuxSession)||{},re=x.degraded?"warn":x.tmux?"on":"",se=[`${x.engine}${x.key?`·${x.key}`:""}`,X.preview].filter(Boolean).join(" · ");return h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>x.tmux&&e(x.tmuxSession),title:x.degraded?S("cell-degraded"):x.tmux?S("cell-on"):S("cell-off"),children:[h.jsx("span",{className:`dot ${re}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:x.cell}),h.jsx("small",{children:se})]})]}),X.activity?h.jsx("span",{className:"nc-rel",children:qs(X.activity)}):null,X.outbox&&X.outbox.count>0&&h.jsx("span",{className:"nc-badge",title:S("new-files-outbox"),children:X.outbox.count}),h.jsx("button",{className:`nc-act pin${Y.includes(x.tmuxSession)?" on":""}`,title:S("pin"),onClick:()=>Q(x.tmuxSession),children:Y.includes(x.tmuxSession)?"★":"☆"}),h.jsx("button",{className:`nc-act power${x.tmux?" on":""}${x.degraded?" warn":""}`,onClick:()=>W(x),title:x.active?S("power-off"):S("power-on"),children:h.jsx(He,{name:"power",size:16})})]},x.cell)})]}),h.jsxs("section",{className:"nc-group",children:[h.jsx("div",{className:"nc-group-title",children:S("local")}),q.map(x=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e(x.name),children:[h.jsx("span",{className:x.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:x.name}),h.jsx("small",{children:x.preview?x.preview:x.cmd?x.cmd:S("windows").replace("{n}",String(x.windows||0))})]})]}),x.activity?h.jsx("span",{className:"nc-rel",children:qs(x.activity)}):null,x.fresh&&h.jsx("span",{className:"nc-badge",title:S("new-files-outbox"),children:x.outbox.count}),h.jsx("button",{className:`nc-act pin${Y.includes(x.name)?" on":""}`,title:S("pin"),onClick:()=>Q(x.name),children:Y.includes(x.name)?"★":"☆"}),h.jsx("button",{className:"nc-menu",title:S("terminate"),onClick:()=>{window.confirm(S("terminate-confirm").replace("{name}",x.name))&&ee(x.name)},children:"⋯"})]},x.name)),u===null&&h.jsx("div",{className:"nc-empty",children:S("loading-fleet")}),u!==null&&q.length===0&&$.length===0&&!p&&h.jsx("div",{className:"nc-empty",children:y?S("no-match").replace("{q}",y):S("no-sessions")})]}),l.map(x=>{const re=uw(x.health)||(x.status==="up"?"on":"warn"),se=x.health?Yp(x.health):x.status==="up"?"":Ac(x);return h.jsxs("section",{className:"nc-group",children:[h.jsxs("div",{className:"nc-group-title nc-node-title",children:[h.jsx("span",{className:`dot ${re}`,title:se}),x.label||x.name," · ",x.status==="up"?S("node-sessions").replace("{n}",String(x.cells.length+x.unmanaged.length)):x.health&&Yp(x.health)||Ac(x),x.direct&&x.health&&x.health.managed!==!1&&h.jsx("button",{type:"button",className:`nc-act power${x.tunnelStatus==="up"?" on":""}`,disabled:A===x.name,title:x.tunnelStatus==="up"?S("power-off"):S("power-on"),onClick:()=>k(x),children:h.jsx(He,{name:"power",size:15})})]}),x.status==="up"&&x.cells.length>0&&x.cells.map(ae=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>ae.tmux&&e({session:ae.tmuxSession,node:(x.route||[x.name]).join("/")}),title:ae.active?S("cell-on"):S("cell-off"),children:[h.jsx("span",{className:`dot ${ae.degraded?"warn":ae.tmux?"on":""}`}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:ae.cell}),h.jsxs("small",{children:[`${ae.engine}${ae.key?`·${ae.key}`:""}`,ae.active?"":` · ${S("cell-off")}`]})]})]}),(x.capabilities||[]).includes(ae.active?"down":"up")&&h.jsx("button",{className:`nc-act power${ae.active?" on":""}${ae.degraded?" warn":""}`,title:ae.active?S("power-off"):S("power-on"),onClick:()=>W({...ae,route:x.route}),children:h.jsx(He,{name:"power",size:15})})]},ae.key)),x.status==="up"&&x.unmanaged.map(ae=>h.jsxs("div",{className:"nc-mcard",children:[h.jsxs("button",{className:"nc-mcard-main",onClick:()=>e({session:ae.name,node:ae.node}),children:[h.jsx("span",{className:ae.attached?"dot on":"dot"}),h.jsxs("span",{className:"nc-mcard-text",children:[h.jsx("b",{children:ae.name}),h.jsx("small",{children:ae.preview?ae.preview:ae.cmd?ae.cmd:S("windows").replace("{n}",String(ae.windows||0))})]})]}),ae.activity?h.jsx("span",{className:"nc-rel",children:qs(ae.activity)}):null,h.jsx("button",{className:"nc-menu",title:S("terminate"),onClick:()=>{window.confirm(S("terminate-confirm").replace("{name}",ae.name))&&ee(ae.name,x.route)},children:"⋯"})]},ae.key)),x.status==="up"&&x.cells.length===0&&x.unmanaged.length===0&&h.jsx("div",{className:"nc-empty",children:S("no-sessions-short")})]},`nodo-${(x.route||[x.name]).join("/")}`)}),h.jsxs("footer",{className:"nc-home-foot",onClick:U,title:S("copy-url"),children:[h.jsxs("span",{className:"nc-home-meta",children:[v&&h.jsxs("span",{className:"nc-home-version",children:["v",v]}),h.jsxs("span",{className:"nc-home-endpoint",children:[L," · ",S("ssh-only")]})]}),h.jsx("span",{className:"nc-lang",onClick:x=>x.stopPropagation(),children:a_.map((x,X)=>h.jsxs("span",{children:[X>0&&" · ",h.jsx("button",{className:`nc-lang-btn${s===x?" on":""}`,onClick:()=>o(x),title:x,children:x.toUpperCase()})]},x))})]})]}),h.jsx("button",{className:"nc-fab",onClick:()=>r("fleet",!0),title:S("fleet-new-cell"),"aria-label":S("fleet-new-cell"),children:"+"}),B&&h.jsx(Da,{cell:B,token:t,route:Array.isArray(B.route)?B.route:[],onConfirm:ie,onClose:()=>W(null)})]})}/**
41
41
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
42
42
  * @license MIT
43
43
  *
@@ -88,4 +88,4 @@ Minimum version required to store current data is: `+ee+`.
88
88
  `;return typeof d=="function"&&d(null,N),N},Cu}var Pg;function IC(){if(Pg)return An;Pg=1;const e=gC(),t=TC(),r=jC(),s=BC();function o(l,u,d,p,m){const y=[].slice.call(arguments,1),w=y.length,v=typeof y[w-1]=="function";if(!v&&!e())throw new Error("Callback required as last argument");if(v){if(w<2)throw new Error("Too few arguments provided");w===2?(m=d,d=u,u=p=void 0):w===3&&(u.getContext&&typeof m>"u"?(m=p,p=void 0):(m=p,p=d,d=u,u=void 0))}else{if(w<1)throw new Error("Too few arguments provided");return w===1?(d=u,u=p=void 0):w===2&&!u.getContext&&(p=d,d=u,u=void 0),new Promise(function(_,b){try{const E=t.create(d,p);_(l(E,u,p))}catch(E){b(E)}})}try{const _=t.create(d,p);m(null,l(_,u,p))}catch(_){m(_)}}return An.create=t.create,An.toCanvas=o.bind(null,r.render),An.toDataURL=o.bind(null,r.renderToDataURL),An.toString=o.bind(null,function(l,u,d){return s.render(l,d)}),An}var AC=IC();const OC=bh(AC),vv=/^[a-z0-9-]{1,32}$/,zC=/^[A-Za-z0-9._-]{1,32}$/,FC=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/,HC=320;function $C(e){return typeof e=="string"&&vv.test(e)}const WC=64;function _h(e){if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&t.length<=WC&&!/[\x00-\x1f\x7f]/.test(t)}function Hn(e){return String(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/g,"")||"node"}function yv(e){if(typeof e!="string"||!e||e.length>HC||e.startsWith("-")||/[\0-\x20\x7f]/.test(e))return!1;if(!e.includes("@"))return/^[A-Za-z0-9][A-Za-z0-9._:-]{0,254}$/.test(e);const t=e.indexOf("@");return t<=0||t!==e.lastIndexOf("@")?!1:zC.test(e.slice(0,t))&&FC.test(e.slice(t+1))}function Dg(e){if(e===""||e===null||e===void 0)return null;const t=String(e).trim();if(!/^[0-9]{1,5}$/.test(t))return;const r=Number(t);return Number.isInteger(r)&&r>=1&&r<=65535?r:void 0}function Lg({name:e,ssh:t,sshPort:r,remotePort:s}={}){const o=typeof e=="string"?e.trim():e,l=typeof t=="string"?t.trim():t;if(!$C(o))return{ok:!1,error:"err-node-name"};if(!yv(l))return{ok:!1,error:"err-ssh"};const u=Dg(r);if(u===void 0)return{ok:!1,error:"err-ssh-port"};const d=Dg(s);if(d===void 0)return{ok:!1,error:"err-node-port"};const p={name:o,ssh:l};return u!==null&&(p.sshPort=u),d!==null&&(p.remotePort=d),{ok:!0,value:p}}function UC(e,t){if(!e||!t||t<e)return null;const r=Math.floor((t-e)/1e3);return r<60?"ora":r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}g`}function qC(e,t){const r=!!(e&&e.status==="up"),s=!!(e&&e.status==="passive");return{up:r,...s?{passive:!0}:{},label:r?"tunnel-up":s?"node-passive":"tunnel-down",since:r?UC(e.since,t):null}}const KC=new Set(["v","instanceId","port","label","invite"]),VC=new Set(["v","instanceId","port","label","invite","name","ssh","sshPort"]);function YC(e){const t=String(e).replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4),s=typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("binary"),o=Uint8Array.from(s,l=>l.charCodeAt(0));return typeof TextDecoder<"u"?new TextDecoder().decode(o):Buffer.from(o).toString("utf8")}function XC(e){let t="";try{const u=new URL(String(e));t=new URLSearchParams(u.hash.replace(/^#/,"")).get("pair")||""}catch{return{ok:!1}}if(!t)return{ok:!1};let r;try{r=JSON.parse(YC(t))}catch{return{ok:!1}}if(!r||typeof r!="object"||Array.isArray(r))return{ok:!1};const s=r.v===1?KC:r.v===2?VC:null;if(!s)return{ok:!1};for(const u of Object.keys(r))if(!s.has(u))return{ok:!1};if(!/^[a-f0-9]{16,64}$/.test(String(r.instanceId)))return{ok:!1};const o=Number(r.port);if(!Number.isInteger(o)||o<1||o>65535)return{ok:!1};if(typeof r.label!="string")return{ok:!1};if(typeof r.invite!="string"||!r.invite)return{ok:!1};const l={ok:!0,version:r.v,label:r.label,invite:r.invite,instanceId:r.instanceId,port:o};if(r.v===2){if(r.name!==void 0){if(typeof r.name!="string"||!vv.test(r.name))return{ok:!1};l.name=r.name}if(r.ssh!==void 0){if(!yv(r.ssh))return{ok:!1};l.ssh=String(r.ssh).trim()}if(r.sshPort!==void 0){const u=Number(r.sshPort);if(!Number.isInteger(u)||u<1||u>65535)return{ok:!1};l.sshPort=u}}return l}function GC(e,t,r=new Set){if(!t||!t.ok)return e;const s={...e},o=(l,u)=>{u==null||u===""||r.has(l)||(s[l]=u)};return o("label",t.label),t.version===2&&(o("name",t.name||(t.ssh?Hn(t.label):"")),o("ssh",t.ssh),t.sshPort!==void 0&&o("sshPort",String(t.sshPort))),s}function Mg(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.data=="string"?e.data.trim():""}function QC(e){const t=String(e||"").trim();if(!t)return{kind:"empty"};const r=XC(t);if(!r||!r.ok)return{kind:"invalid"};const s=[];return r.ssh||s.push("ssh"),r.name||s.push("name"),s.length?{kind:"partial",decoded:r,missing:s}:{kind:"complete",decoded:r}}function JC(e,t,r=new Set,s=!1){if(!t||!t.ok)return e;const o=GC(e,t,r);return t.version===2&&t.name&&!r.has("name")&&!s&&(o.name=t.name),!r.has("label")&&!o.label&&t.label&&(o.label=t.label),o}function Tg(e,t,r=new Set,s=!1){const o=String(t||"").trim(),l=QC(o);let u={...e,pairingUrl:o};return(l.kind==="complete"||l.kind==="partial")&&(u={...JC(u,l.decoded,r,s),pairingUrl:o}),{classification:l,form:u}}function ZC(e,{deviceDefault:t=""}={}){const r={name:e.name,ssh:e.ssh,pairingUrl:e.pairingUrl,...e.label?{label:e.label}:{},...e.sshPort?{sshPort:Number(e.sshPort)}:{}},s=e.localLabel||t;return s&&(r.localLabel=s),r}function ex(){const e=new Set;let t=!1;return{canAuto(r){return!t&&!e.has(String(r||""))},start(r){return t?!1:(t=!0,e.add(String(r||"")),!0)},finish(){t=!1},reset(r){e.delete(String(r||""))},isBusy(){return t}}}const tx=["validation","conflict","ssh-start","ssh-ready","join","tunnel-final","confirm","health"];function ix(e){const t=e&&e.data||{},r=typeof t.stage=="string"&&t.stage?t.stage:"",s=typeof t.detail=="string"&&t.detail?t.detail:"";return{stage:r,code:typeof t.code=="string"?t.code:"",detail:s,hint:typeof t.hint=="string"?t.hint:"",retryable:typeof t.retryable=="boolean"?t.retryable:!r,message:s||String(e&&e.message||e)}}const rx="modulepreload",nx=function(e){return"/"+e},jg={},sx=function(t,r,s){let o=Promise.resolve();if(r&&r.length>0){let u=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=u(r.map(m=>{if(m=nx(m),m in jg)return;jg[m]=!0;const y=m.endsWith(".css"),w=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${w}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":rx,y||(v.as="script"),v.crossOrigin="",v.href=m,p&&v.setAttribute("nonce",p),document.head.appendChild(v),y)return new Promise((_,b)=>{v.addEventListener("load",_),v.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return o.then(u=>{for(const d of u||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})};class Me{constructor(t,r,s,o,l){this._legacyCanvasSize=Me.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),s&&typeof s=="object"?this._onDecode=r:(console.warn(s||o||l?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=r),r=typeof s=="object"?s:{},this._onDecodeError=r.onDecodeError||(typeof s=="function"?s:this._onDecodeError),this._calculateScanRegion=r.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=r.preferredCamera||l||this._preferredCamera,this._legacyCanvasSize=typeof s=="number"?s:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=r.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let u=!1;if(t.hidden&&(t.hidden=!1,u=!0),document.body.contains(t)||(document.body.appendChild(t),u=!0),s=t.parentElement,r.highlightScanRegion||r.highlightCodeOutline){if(o=!!r.overlay,this.$overlay=r.overlay||document.createElement("div"),l=this.$overlay.style,l.position="absolute",l.display="none",l.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&r.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}s.insertBefore(this.$overlay,this.$video.nextSibling)}r.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let d=window.getComputedStyle(t);d.display==="none"&&(t.style.setProperty("display","block","important"),u=!0),d.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),u=!0),u&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=Me.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await Me.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let r=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),s;try{t&&(await r()).every(o=>!o.label)&&(s=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await r()).map((o,l)=>({id:o.deviceId,label:o.label||(l===0?"Default Camera":`Camera ${l+1}`)}))}finally{s&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),Me._stopVideoStream(s))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),Me._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),Me._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:r}=await this._getCameraStream();!this._active||this._paused?Me._stopVideoStream(t):(this._setVideoMirror(r),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let r=()=>{this.$video.srcObject instanceof MediaStream&&(Me._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(r(),!0):(await new Promise(s=>setTimeout(s,300)),this._paused?(r(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,r,s,o,l=!1,u=!1){let d,p=!1;r&&("scanRegion"in r||"qrEngine"in r||"canvas"in r||"disallowCanvasResizing"in r||"alsoTryWithoutScanRegion"in r||"returnDetailedScanResult"in r)?(d=r.scanRegion,s=r.qrEngine,o=r.canvas,l=r.disallowCanvasResizing||!1,u=r.alsoTryWithoutScanRegion||!1,p=!0):console.warn(r||s||o||l||u?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),r=!!s;try{let m,y;[s,m]=await Promise.all([s||Me.createQrEngine(),Me._loadImage(t)]),[o,y]=Me._drawToCanvas(m,d,o,l);let w;if(s instanceof Worker){let v=s;r||Me._postWorkerMessageSync(v,"inversionMode","both"),w=await new Promise((_,b)=>{let E,N,R,O=-1;N=B=>{B.data.id===O&&(v.removeEventListener("message",N),v.removeEventListener("error",R),clearTimeout(E),B.data.data!==null?_({data:B.data.data,cornerPoints:Me._convertPoints(B.data.cornerPoints,d)}):b(Me.NO_QR_CODE_FOUND))},R=B=>{v.removeEventListener("message",N),v.removeEventListener("error",R),clearTimeout(E),b("Scanner error: "+(B?B.message||B:"Unknown Error"))},v.addEventListener("message",N),v.addEventListener("error",R),E=setTimeout(()=>R("timeout"),1e4);let z=y.getImageData(0,0,o.width,o.height);O=Me._postWorkerMessageSync(v,"decode",z,[z.data.buffer])})}else w=await Promise.race([new Promise((v,_)=>window.setTimeout(()=>_("Scanner error: timeout"),1e4)),(async()=>{try{var[v]=await s.detect(o);if(!v)throw Me.NO_QR_CODE_FOUND;return{data:v.rawValue,cornerPoints:Me._convertPoints(v.cornerPoints,d)}}catch(_){if(v=_.message||_,/not implemented|service unavailable/.test(v))return Me._disableBarcodeDetector=!0,Me.scanImage(t,{scanRegion:d,canvas:o,disallowCanvasResizing:l,alsoTryWithoutScanRegion:u});throw`Scanner error: ${v}`}})()]);return p?w:w.data}catch(m){if(!d||!u)throw m;let y=await Me.scanImage(t,{qrEngine:s,canvas:o,disallowCanvasResizing:l});return p?y:y.data}finally{r||Me._postWorkerMessage(s,"close")}}setGrayscaleWeights(t,r,s,o=!0){Me._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:r,blue:s,useIntegerApproximation:o})}setInversionMode(t){Me._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>sx(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(s=>s.createWorker()),!(!Me._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let r=navigator.userAgentData;return r&&r.brands.some(({brand:s})=>/Chromium/i.test(s))&&/mac ?OS/i.test(r.platform)&&await r.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:s,platformVersion:o})=>/arm/i.test(s||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let r=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-r)/2),y:Math.round((t.videoHeight-r)/2),width:r,height:r,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,r=t.videoWidth,s=t.videoHeight,o=t.offsetWidth,l=t.offsetHeight,u=t.offsetLeft,d=t.offsetTop,p=window.getComputedStyle(t),m=p.objectFit,y=r/s,w=o/l;switch(m){case"none":var v=r,_=s;break;case"fill":v=o,_=l;break;default:(m==="cover"?y>w:y<w)?(_=l,v=_*y):(v=o,_=v/y),m==="scale-down"&&(v=Math.min(v,r),_=Math.min(_,s))}var[b,E]=p.objectPosition.split(" ").map((R,O)=>{const z=parseFloat(R);return R.endsWith("%")?(O?l-_:o-v)*z/100:z});p=this._scanRegion.width||r,w=this._scanRegion.height||s,m=this._scanRegion.x||0;var N=this._scanRegion.y||0;y=this.$overlay.style,y.width=`${p/r*v}px`,y.height=`${w/s*_}px`,y.top=`${d+E+N/s*_}px`,s=/scaleX\(-1\)/.test(t.style.transform),y.left=`${u+(s?o-b-v:b)+(s?r-m-p:m)/r*v}px`,y.transform=t.style.transform}})}static _convertPoints(t,r){if(!r)return t;let s=r.x||0,o=r.y||0,l=r.width&&r.downScaledWidth?r.width/r.downScaledWidth:1;r=r.height&&r.downScaledHeight?r.height/r.downScaledHeight:1;for(let u of t)u.x=u.x*l+s,u.y=u.y*r+o;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,r=1e3/this._maxScansPerSecond;t<r&&await new Promise(o=>setTimeout(o,r-t)),this._lastScanTimestamp=Date.now();try{var s=await Me.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!Me._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Me.createQrEngine()),s?(this._onDecode?this._onDecode(s):this._legacyOnDecode&&this._legacyOnDecode(s.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",s.cornerPoints.map(({x:o,y:l})=>`${o},${l}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==Me.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",r=[{width:{min:1024}},{width:{min:768}},{}],s=r.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...s,...r])try{let l=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),u=this._getFacingMode(l)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:l,facingMode:u}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let r of t.getTracks())r.stop(),t.removeTrack(r)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,r,s,o=!1){s=s||document.createElement("canvas");let l=r&&r.x?r.x:0,u=r&&r.y?r.y:0,d=r&&r.width?r.width:t.videoWidth||t.width,p=r&&r.height?r.height:t.videoHeight||t.height;return o||(o=r&&r.downScaledWidth?r.downScaledWidth:d,r=r&&r.downScaledHeight?r.downScaledHeight:p,s.width!==o&&(s.width=o),s.height!==r&&(s.height=r)),r=s.getContext("2d",{alpha:!1}),r.imageSmoothingEnabled=!1,r.drawImage(t,l,u,d,p,0,0,s.width,s.height),[s,r]}static async _loadImage(t){if(t instanceof Image)return await Me._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let r=new Image;r.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await Me._awaitImageLoad(r),r}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(r.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((r,s)=>{let o=l=>{t.removeEventListener("load",o),t.removeEventListener("error",o),l instanceof ErrorEvent?s("Image load error"):r()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,r,s,o){return Me._postWorkerMessageSync(await t,r,s,o)}static _postWorkerMessageSync(t,r,s,o){if(!(t instanceof Worker))return-1;let l=Me._workerMessageId++;return t.postMessage({id:l,type:r,data:s},o),l}}Me.DEFAULT_CANVAS_SIZE=400;Me.NO_QR_CODE_FOUND="No QR code found";Me._disableBarcodeDetector=!1;Me._workerMessageId=0;function ox({onResult:e,onClose:t}){const r=M.useRef(null),s=M.useRef(null),o=M.useRef(!1),[l,u]=M.useState("");M.useEffect(()=>{let p=!1;const m=r.current,y=w=>{p||o.current||(o.current=!0,e(w))};return(async()=>{if(typeof navigator>"u"||!navigator.mediaDevices||typeof navigator.mediaDevices.getUserMedia!="function"){u(S("qr-unsupported"));return}let w=!1;try{w=await Me.hasCamera()}catch{w=!1}if(!w){u(S("qr-no-camera"));return}if(p||!m)return;const v=new Me(m,_=>{const b=Mg(_);b&&y(b)},{returnDetailedScanResult:!0,preferredCamera:"environment",calculateScanRegion:_=>{const b=_.videoWidth||640,E=_.videoHeight||480,N=Math.max(1,Math.round(Math.min(b,E)*.92));return{x:Math.round((b-N)/2),y:Math.round((E-N)/2),width:N,height:N,downScaledWidth:600,downScaledHeight:600}},highlightScanRegion:!0,highlightCodeOutline:!0});s.current=v;try{await v.start()}catch(_){if(p)return;const b=_&&_.name||"";u(S(b==="NotAllowedError"||b==="SecurityError"?"qr-permission":b==="NotFoundError"||b==="OverconstrainedError"||b==="NotReadableError"?"qr-no-camera":"qr-unsupported"))}})(),()=>{p=!0;const w=s.current;if(w){try{w.stop()}catch{}try{w.destroy()}catch{}s.current=null}const v=m,_=v&&v.srcObject;if(_&&typeof _.getTracks=="function"){for(const b of _.getTracks())try{b.stop()}catch{}try{v.srcObject=null}catch{}}}},[]);const d=async p=>{const m=p.target.files&&p.target.files[0];if(p.target.value="",!!m)try{const y=await Me.scanImage(m,{returnDetailedScanResult:!0}),w=Mg(y);if(!w)throw new Error("empty");o.current||(o.current=!0,e(w))}catch{u(S("pairing-qr-invalid"))}};return h.jsx("div",{className:"nc-sheet-overlay nc-qr-overlay",onClick:t,children:h.jsxs("div",{className:"nc-sheet nc-qr-modal",onClick:p=>p.stopPropagation(),children:[h.jsx("div",{className:"nc-sheet-head",children:h.jsx("b",{children:S("scan-qr")})}),h.jsx("video",{ref:r,className:"nc-qr-video",playsInline:!0,muted:!0}),l&&h.jsx("div",{className:"nc-err",role:"alert",children:l}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsxs("label",{className:"nc-btn ghost nc-qr-upload",children:[S("qr-upload"),h.jsx("input",{type:"file",accept:"image/*",hidden:!0,onChange:d})]}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:t,children:S("cancel")})]})]})})}const Bg=()=>({name:"",label:"",ssh:"",sshPort:"",pairingUrl:"",localLabel:""});function Sv({token:e,initial:t="",autoStart:r=!1,deviceDefault:s="",readonly:o=!1,onSuccess:l,onBusyChange:u}){const[d,p]=M.useState(Bg),[m,y]=M.useState(!1),[w,v]=M.useState(!1),[_,b]=M.useState("idle"),[E,N]=M.useState(null),[R,O]=M.useState(""),[z,B]=M.useState(!1),W=M.useRef(ex()),A=M.useRef(new Set),I=_==="busy";M.useEffect(()=>(u&&u(I),()=>{u&&u(!1)}),[I,u]);const V=async j=>{const Y=String(j.pairingUrl||"").trim();if(W.current.start(Y)){b("busy"),N(null),O("");try{await VS(e,ZC(j,{deviceDefault:s})),b("ok"),y(!1),p(Bg()),A.current=new Set,B(!1),W.current.finish(),l&&await l()}catch(F){const Q=ix(F);N(Q),b("idle"),W.current.finish(),(Q.stage==="validation"||Q.stage==="conflict")&&y(!0)}}},U=(j,Y=!0)=>{const{classification:F,form:Q}=Tg(d,j,A.current,z),$=Q.pairingUrl;if(N(null),O(""),_==="ok"&&b("idle"),p(Q),F.kind==="invalid"){N({stage:"validation",code:"bad-link",message:S("pair-invalid-link"),hint:S("pair-invalid-hint"),retryable:!0});return}if(F.kind==="partial"){y(!0),O(F.missing.includes("ssh")?S("pair-missing-ssh"):S("pair-missing-name"));return}F.kind==="complete"&&Y&&!o&&W.current.canAuto($)&&V(Q)};M.useEffect(()=>{t&&U(t,r)},[]);const ie=()=>{const j=String(d.pairingUrl||"").trim(),{classification:Y,form:F}=Tg(d,j,A.current,z);if(p(F),O(""),N(null),Y.kind==="empty"){N({stage:"validation",message:S("pairing-required"),retryable:!0});return}if(Y.kind==="invalid"){N({stage:"validation",code:"bad-link",message:S("pair-invalid-link"),hint:S("pair-invalid-hint"),retryable:!0});return}if(!F.ssh||!F.name){y(!0),O(F.ssh?S("pair-missing-name"):S("pair-missing-ssh"));return}if(F.label&&!_h(F.label)){N({stage:"validation",message:S("err-label"),retryable:!0});return}if(F.localLabel&&!_h(F.localLabel)){N({stage:"validation",message:S("err-label"),retryable:!0});return}W.current.reset(j),V(F)},ee=async()=>{try{if(!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error("unsupported");const j=await navigator.clipboard.readText();j&&j.trim()?U(j):O(S("pair-clipboard-empty"))}catch{O(S("pair-clipboard-denied"))}},k=(j,Y)=>{A.current.add(j),p(F=>({...F,[j]:Y}))},D=E&&E.stage&&(tx.includes(E.stage)||E.stage==="internal")?S(`pair-stage-${E.stage}`):S("pair-stage-generic");return h.jsxs("div",{className:"nc-set-form nc-pair-card",children:[h.jsx("div",{className:"nc-sheet-label",children:S("pair-card-title")}),h.jsx("div",{className:"nc-set-info",children:S("pair-card-help")}),h.jsx("input",{className:"nc-pair-input",placeholder:S("pair-paste-ph"),value:d.pairingUrl,disabled:o||I,onChange:j=>{p({...d,pairingUrl:j.target.value}),N(null),O("")},onPaste:j=>{const Y=j.clipboardData&&j.clipboardData.getData("text")||"";Y.trim()&&(j.preventDefault(),U(Y))},onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),ie())}}),h.jsxs("div",{className:"nc-pair-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||I,onClick:ee,children:S("pair-paste-btn")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||I,onClick:()=>v(!0),children:S("scan-qr")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:o||I,title:o?S("settings-readonly"):"",onClick:ie,children:S("test-and-connect")})]}),h.jsxs("div",{className:"nc-pair-status","aria-live":"polite",children:[I&&h.jsx("div",{className:"nc-pair-progress",children:S("pair-progress")}),_==="ok"&&h.jsx("div",{className:"nc-set-test ok",children:S("node-connected")}),R&&h.jsx("div",{className:"nc-set-hint nc-pair-notice",children:R}),E&&h.jsxs("div",{className:"nc-err",role:"alert",children:[h.jsx("b",{children:D})," — ",E.message,E.hint&&h.jsx("div",{className:"nc-pair-hint",children:E.hint}),E.retryable&&h.jsx("div",{children:h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||I,onClick:ie,children:S("pair-retry")})})]})]}),h.jsxs("button",{type:"button",className:"nc-btn ghost nc-pair-advanced-toggle",disabled:I,onClick:()=>y(j=>!j),children:[m?"▾":"▸"," ",S("pair-advanced")]}),m&&h.jsxs("div",{className:"nc-pair-advanced",children:[h.jsxs("label",{className:"nc-field",children:[S("node-display-label"),h.jsx("input",{placeholder:"Home Relay",value:d.label,disabled:o||I,onChange:j=>{A.current.add("label"),p(Y=>({...Y,label:j.target.value,name:z?Y.name:Hn(j.target.value)}))}})]}),h.jsxs("label",{className:"nc-field",children:[S("node-name-label"),h.jsx("input",{placeholder:S("node-name-ph"),value:d.name,disabled:o||I,onChange:j=>{B(!0),A.current.add("name"),p(Y=>({...Y,name:j.target.value?Hn(j.target.value):""}))}})]}),h.jsx("small",{className:"nc-set-hint",children:S("node-slug-hint").replace("{slug}",d.name||"home-relay")}),h.jsxs("label",{className:"nc-field",children:[S("node-ssh-label"),h.jsx("input",{placeholder:"my-relay",value:d.ssh,disabled:o||I,onChange:j=>{A.current.add("ssh"),k("ssh",j.target.value)}})]}),h.jsxs("label",{className:"nc-field",children:[S("node-ssh-port-label"),h.jsx("input",{inputMode:"numeric",placeholder:S("node-ssh-port-help"),value:d.sshPort,disabled:o||I,onChange:j=>k("sshPort",j.target.value.replace(/[^0-9]/g,"").slice(0,5))})]}),h.jsxs("label",{className:"nc-field",children:[S("device-name-label"),h.jsx("input",{placeholder:s||"NexusCrew",value:d.localLabel,disabled:o||I,onChange:j=>k("localLabel",j.target.value)}),h.jsx("small",{className:"nc-set-hint",children:S("device-name-hint")})]})]}),w&&h.jsx(ox,{onResult:j=>{v(!1),U(j)},onClose:()=>v(!1)})]})}function qh(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function ax(e){const t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=atob(r),o=new Uint8Array(s.length);for(let l=0;l<s.length;l+=1)o[l]=s.charCodeAt(l);return o}async function lx(){if(!qh())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function cx(e){if(!qh())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const r=await Nt("/api/push/vapid",e),{publicKey:s}=await r.json();if(!s)throw new Error("vapid non disponibile");const l=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ax(s)}),u=await Nt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:l.toJSON()})});if(!u.ok){try{await l.unsubscribe()}catch{}const d=await u.json().catch(()=>({}));throw new Error(d.error||`HTTP ${u.status}`)}return!0}async function ux(e){if(!qh())return!1;const r=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!r)return!1;const s=r.endpoint;try{await r.unsubscribe()}catch{}try{await Nt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:s})})}catch{}return!0}const wv="nexuscrew.cells",bv=1,hx=/^[A-Za-z0-9._-]{1,32}$/,Cv=/^[a-z0-9._-]{1,32}$/,dx=new Set(["standard","unsafe"]),fx=4096,Ig=256,px=8192,mx=32,gx=new Set(["format","version","exportedAt","cells"]),_x=new Set(["id","cwd","engine","boot","model","models","permissionPolicies","systemPrompt","prompt"]);function Ag(e,t){if(e===void 0)return{};if(!e||typeof e!="object"||Array.isArray(e))return null;const r=Object.entries(e);if(r.length>128)return null;const s={};for(const[o,l]of r){if(!Cv.test(o)||!t(l))return null;s[o]=l}return s}function xv(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(l=>!_x.has(l))||!hx.test(String(e.id||""))||typeof e.cwd!="string"||!e.cwd||e.cwd.length>fx||!Cv.test(String(e.engine||""))||e.boot!==void 0&&typeof e.boot!="boolean"||e.model!==void 0&&(typeof e.model!="string"||e.model.length>Ig)||e.systemPrompt!==void 0&&e.prompt!==void 0&&e.systemPrompt!==e.prompt)return null;const t=e.systemPrompt===void 0?e.prompt===void 0?"":e.prompt:e.systemPrompt;if(typeof t!="string"||t.length>px)return null;const r=Ag(e.models,l=>typeof l=="string"&&!!l&&l.length<=Ig),s=Ag(e.permissionPolicies,l=>dx.has(l));if(r===null||s===null)return null;const o={id:e.id,cwd:e.cwd,engine:e.engine,boot:e.boot===!0,systemPrompt:t};return e.model&&(o.model=e.model),Object.keys(r).length&&(o.models=r),Object.keys(s).length&&(o.permissionPolicies=s),o}function vx(e,t,r=new Date){const s=t instanceof Set?t:new Set(t||[]),o=[];for(const l of Array.isArray(e)?e:[]){if(!s.has(l.id))continue;const u=xv({id:l.id,cwd:l.cwd,engine:l.engine,boot:l.boot===!0,...l.model?{model:l.model}:{},...l.models?{models:l.models}:{},...l.permissionPolicies?{permissionPolicies:l.permissionPolicies}:{},systemPrompt:l.prompt||""});u&&o.push(u)}return{format:wv,version:bv,exportedAt:r.toISOString(),cells:o}}function yx(e){let t;try{t=JSON.parse(String(e||""))}catch{return{ok:!1,error:"invalid-json",cells:[]}}if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(o=>!gx.has(o))||t.format!==wv||t.version!==bv||!Array.isArray(t.cells)||t.cells.length>mx)return{ok:!1,error:"invalid-format",cells:[]};const r=new Set,s=[];for(const o of t.cells){const l=xv(o);if(!l)return{ok:!1,error:"invalid-cell",cells:[]};if(r.has(l.id))return{ok:!1,error:"duplicate-cell",cells:[]};r.add(l.id),s.push(l)}return{ok:!0,cells:s,exportedAt:typeof t.exportedAt=="string"?t.exportedAt:""}}function Sx(e,t,r){const s=new Set(r||[]);if(!s.has(t))return null;const o=p=>Object.fromEntries(Object.entries(p||{}).filter(([m])=>s.has(m))),l={id:e.id,cwd:e.cwd,engine:t,boot:e.boot===!0,prompt:e.systemPrompt||""};t===e.engine&&e.model?l.model=e.model:e.models&&e.models[t]&&(l.model=e.models[t]);const u=o(e.models),d=o(e.permissionPolicies);return Object.keys(u).length&&(l.models=u),Object.keys(d).length&&(l.permissionPolicies=d),l}const wx=()=>({kind:"managed",id:"claude.native",label:"",client:"claude",provider:"native",credentialProfile:"",managedModel:"",permissionPolicy:"unsafe",displayName:"",protocol:"anthropic_messages",baseUrl:"",envKey:"",providerId:"nexuscrew-custom",command:"",argsText:"",rc:!0,promptMode:"send-keys",promptFlag:"",modelFlag:"",modelValue:"",envRows:[]}),Og=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:""}),kv=e=>e==="claude"?"unsafe":"standard",Fa=(e,t)=>e.find(r=>r.client===t.client&&r.provider===t.provider&&(r.credentialProfile||"")===(t.credentialProfile||"")),bx=(e,t)=>{var r;return((r=Fa(e,t))==null?void 0:r.label)||`${t.client} · ${t.provider}`};function Cx(e){var t,r,s,o,l,u,d,p,m,y,w,v,_,b;return{kind:e.managed?"managed":"custom",id:e.id,label:e.label||"",command:e.command||"",argsText:(e.args||[]).join(`
89
89
  `),rc:!!e.rc,client:((t=e.managed)==null?void 0:t.client)||"claude",provider:((r=e.managed)==null?void 0:r.provider)||"native",credentialProfile:((s=e.managed)==null?void 0:s.credentialProfile)||"",managedModel:((o=e.managed)==null?void 0:o.model)||"",permissionPolicy:((l=e.managed)==null?void 0:l.permissionPolicy)||kv((u=e.managed)==null?void 0:u.client),displayName:((d=e.managed)==null?void 0:d.displayName)||"",protocol:((p=e.managed)==null?void 0:p.protocol)||"",baseUrl:((m=e.managed)==null?void 0:m.baseUrl)||"",envKey:((y=e.managed)==null?void 0:y.envKey)||"",providerId:((w=e.managed)==null?void 0:w.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((v=e.managedInfo)==null?void 0:v.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((_=e.model)==null?void 0:_.flag)||"",modelValue:((b=e.model)==null?void 0:b.value)||"",envRows:(e.envKeys||[]).map(E=>({key:E,value:"",configured:!0,remove:!1}))}}function xx(e,t,r=[]){if(e.kind==="managed"){const o={client:e.client,provider:e.provider,model:e.managedModel||"",permissionPolicy:e.permissionPolicy||kv(e.client)};e.credentialProfile&&(o.credentialProfile=e.credentialProfile);const l=Fa(r,e);return l!=null&&l.credentialEnv&&(o.envKey=e.envKey),e.provider==="custom"&&Object.assign(o,{displayName:e.displayName,protocol:e.protocol,baseUrl:e.baseUrl,envKey:e.envKey,providerId:e.providerId}),{...t?{id:e.id}:{},label:e.label||bx(r,e),rc:!!e.rc,managed:o}}const s={...t?{id:e.id}:{},label:e.label||e.id,rc:!!e.rc,command:e.command,args:e.argsText.split(`
90
90
  `).filter(o=>o!==""),promptMode:e.promptMode};return e.modelFlag&&(s.model={flag:e.modelFlag,value:e.modelValue||""}),e.promptMode==="flag"&&(s.promptFlag=e.promptFlag),t&&(s.env=Object.fromEntries(e.envRows.filter(o=>!o.remove&&o.key).map(o=>[o.key,o.value]))),s}function As({children:e,onClose:t,label:r,error:s=""}){const o=M.useRef(null),l=M.useRef(null),u=M.useRef(t);return u.current=t,M.useEffect(()=>{const d=document.activeElement,p=o.current,m=()=>Array.from((p==null?void 0:p.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))||[]).filter(v=>v.offsetParent!==null),y=requestAnimationFrame(()=>{var v;return(v=m()[0]||p)==null?void 0:v.focus({preventScroll:!0})}),w=v=>{var N;if(v.key==="Escape"){v.preventDefault(),(N=u.current)==null||N.call(u);return}if(v.key!=="Tab")return;const _=m();if(!_.length){v.preventDefault(),p==null||p.focus();return}const b=_[0],E=_[_.length-1];v.shiftKey&&document.activeElement===b?(v.preventDefault(),E.focus()):!v.shiftKey&&document.activeElement===E&&(v.preventDefault(),b.focus())};return document.addEventListener("keydown",w),()=>{cancelAnimationFrame(y),document.removeEventListener("keydown",w),d&&d.isConnected&&typeof d.focus=="function"&&d.focus({preventScroll:!0})}},[]),M.useEffect(()=>{s&&requestAnimationFrame(()=>{var d;return(d=l.current)==null?void 0:d.scrollIntoView({block:"nearest"})})},[s]),h.jsx("div",{className:"nc-fleet-modal",role:"presentation",onMouseDown:d=>{d.target===d.currentTarget&&t()},children:h.jsxs("div",{ref:o,className:"nc-fleet-modal-dialog",role:"dialog","aria-modal":"true","aria-label":r||S("settings"),tabIndex:-1,children:[e,s&&h.jsx("div",{ref:l,className:"nc-err nc-fleet-modal-error",role:"alert","aria-live":"assertive",children:s})]})})}function kx({token:e,readonly:t,targets:r=[],startNewCell:s=!1,initialLocation:o=""}){const[l,u]=M.useState({engines:[],cells:[],managedCatalog:[]}),[d,p]=M.useState({available:!1,capabilities:[]}),[m,y]=M.useState(null),[w,v]=M.useState(null),[_,b]=M.useState(!1),[E,N]=M.useState(""),[R,O]=M.useState(""),[z,B]=M.useState(o),[W,A]=M.useState(!1),[I,V]=M.useState(null),[U,ie]=M.useState(null),[ee,k]=M.useState(!1),[D,j]=M.useState("manage"),Y=M.useRef(!1),F=z?z.split("/"):[],Q=M.useCallback(async()=>{try{const oe=await an(e,F);p(oe);try{const pe=await Nh(e,F);A(!!pe.readonlyDefault)}catch{A(!1)}if(oe.provider==="builtin"&&(oe.capabilities||[]).includes("definitions")){const pe=await kh(e,F),De=new Map((oe.engines||[]).map(Xe=>[Xe.id,Xe]));pe.engines=(pe.engines||[]).map(Xe=>{var ot;return{...Xe,availableModels:((ot=De.get(Xe.id))==null?void 0:ot.models)||[]}}),u(pe)}}catch(oe){N(String(oe.message||oe))}},[e,z]);M.useEffect(()=>{Q();const oe=setInterval(Q,5e3);return()=>clearInterval(oe)},[Q]);const $=new Set((d.cells||[]).filter(oe=>oe.active).map(oe=>oe.cell)),q=d.provider==="builtin"&&(d.capabilities||[]).includes("edit"),G=(d.capabilities||[]).includes("restore");M.useEffect(()=>{!s||Y.current||!q||!l.engines.length||(Y.current=!0,v({mode:"new",form:Og(l.engines[0].id)}))},[s,q,l.engines]);const P=async oe=>{b(!0),N(""),O("");try{await oe(),await Q()}catch(pe){N(String(pe.message||pe))}b(!1)},J=()=>P(async()=>{const oe=m.mode==="new",pe=xx(m.form,oe,l.managedCatalog||[]);!oe&&m.form.kind==="custom"&&!m.form.modelFlag&&(pe.model=null),!oe&&m.form.kind==="custom"&&m.form.promptMode!=="flag"&&(pe.promptFlag=null);let De;if(oe)De=await OS(e,pe,F);else{const ot=m.original,zt=new Set(m.form.envRows.filter(Ge=>!Ge.remove).map(Ge=>Ge.key)),at=(ot.envKeys||[]).filter(Ge=>!zt.has(Ge)),ht=Object.fromEntries(m.form.envRows.filter(Ge=>!Ge.remove&&Ge.key&&(!Ge.configured||Ge.value!=="")).map(Ge=>[Ge.key,Ge.value]));De=await zS(e,ot.id,pe,m.form.kind==="custom"?{set:ht,remove:at}:void 0,F)}y(null),O(S("fleet-saved"));const Xe=(De==null?void 0:De.activeCells)||[];if(Xe.length&&window.confirm(S("fleet-restart-confirm").replace("{cells}",Xe.join(", "))))for(const ot of Xe)await wa(e,ot,F)}),L=()=>P(async()=>{const oe=w.mode==="new",pe=w.form,De={...oe?{id:pe.id}:{},cwd:pe.cwd,engine:pe.engine,boot:!!pe.boot};oe?(pe.model&&(De.model=pe.model),pe.prompt&&(De.prompt=pe.prompt)):(De.model=pe.model||null,De.prompt=pe.prompt||null);const Xe=oe?await HS(e,De,F):await $S(e,w.original.id,De,F),ot=oe?pe.id:w.original.id;v(null),O(S("fleet-saved")),!oe&&(Xe!=null&&Xe.active)&&window.confirm(S("fleet-restart-confirm").replace("{cells}",ot))&&await wa(e,ot,F)}),x=t||W,X=oe=>V({...oe,route:Array.isArray(oe==null?void 0:oe.route)?oe.route:F}),re=async oe=>{if(!I)return;const pe=I.cell||I.id,De=Array.isArray(I.route)?I.route:F;oe.action==="up"?await xh(e,{cell:pe,boot:!!oe.boot,...oe.engine?{engine:oe.engine}:{},...oe.model!==void 0?{model:oe.model}:{},...oe.permissionPolicy?{permissionPolicy:oe.permissionPolicy}:{}},De):await Pa(e,{cell:pe,boot:!!oe.boot},De)},se=(oe,pe)=>{N(""),ie({mode:"new",route:Array.isArray(pe)?pe:F,form:{tmuxSession:oe.name,id:"",engine:"",cwd:"",boot:!1},err:""})},ae=()=>P(async()=>{const oe=U.form;if(!oe.engine){ie({...U,err:S("import-engine-required")});return}await WS(e,{tmuxSession:oe.tmuxSession,id:oe.id||void 0,engine:oe.engine,cwd:oe.cwd||void 0,boot:!!oe.boot},oe.route||F),ie(null),O(S("fleet-saved"))}),de=oe=>P(async()=>{const pe=l.engines.map(at=>at.id),De=[];for(const at of oe){const ht=Sx(at.cell,at.engine,pe);if(!ht)throw new Error(`${at.cell.id}: ${S("fleet-backup-engine-missing")}`);De.push(ht)}const Xe=oe.filter(at=>at.exists).map(at=>at.cell.id);if(Xe.length&&!window.confirm(S("fleet-backup-confirm-overwrite").replace("{cells}",Xe.join(", "))))return;const zt=(await US(e,De,F)).needsRestart||[];k(!1),O(`${S("fleet-backup-restored").replace("{n}",String(oe.length))}${zt.length?` · ${S("fleet-backup-needs-restart").replace("{cells}",zt.join(", "))}`:""}`)}),ve=h.jsxs("label",{className:"nc-field",children:[S("location"),h.jsxs("select",{value:z,onChange:oe=>{B(oe.target.value),y(null),v(null),N(""),O(""),A(!1),p({available:!1,capabilities:[]}),u({engines:[],cells:[],managedCatalog:[]})},children:[h.jsx("option",{value:"",children:S("local")}),r.map(oe=>h.jsxs("option",{value:oe.route.join("/"),disabled:oe.status&&oe.status!=="up",children:[oe.label,oe.status&&oe.status!=="up"?` · ${S("node-offline")}`:""]},oe.route.join("/")))]})]}),Oe=h.jsxs("div",{className:"nc-fleet-view-tabs",role:"tablist","aria-label":S("tab-fleet"),children:[h.jsx("button",{type:"button",role:"tab","aria-selected":D==="manage",className:`nc-set-tabbtn${D==="manage"?" on":""}`,onClick:()=>j("manage"),children:S("fleet-manage-location")}),h.jsx("button",{type:"button",role:"tab","aria-selected":D==="overview",className:`nc-set-tabbtn${D==="overview"?" on":""}`,onClick:()=>j("overview"),children:S("fleet-network-overview")})]});return q?h.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[Oe,D==="overview"?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"nc-set-info",children:S("fleet-overview-help")}),h.jsx(zg,{token:e,targets:r,readonly:t,onPower:X,onImport:se})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"nc-set-info",children:S("fleet-manage-help")}),ve,h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:S("fleet-cells")}),h.jsxs("span",{className:"nc-fleet-head-actions",children:[h.jsx("button",{className:"nc-btn ghost",disabled:x||_,onClick:()=>{N(""),k(!0)},children:S("fleet-backup")}),h.jsxs("button",{className:"nc-btn primary",disabled:x||_||!l.engines.length,onClick:()=>{var oe;N(""),v({mode:"new",form:Og((oe=l.engines[0])==null?void 0:oe.id)})},children:["+ ",S("add")]})]})]}),l.cells.map(oe=>{const pe=$.has(oe.id),De=d.capabilities||[];return h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:oe.id}),h.jsxs("small",{children:[oe.engine," · ",oe.cwd,pe?` · ${S("service-active")}`:` · ${S("cell-off")}`]})]}),h.jsxs("span",{children:[pe&&De.includes("down")&&h.jsx("button",{className:"nc-btn ghost",disabled:x||_,onClick:()=>P(()=>Pa(e,{cell:oe.id},F)),children:S("stop")}),!pe&&De.includes("up")&&h.jsx("button",{className:"nc-btn primary",disabled:x||_,onClick:()=>X({cell:oe.id,id:oe.id,engine:oe.engine,model:oe.model,models:oe.models,permissionPolicies:oe.permissionPolicies,active:!1,boot:oe.boot}),children:S("start")}),pe&&De.includes("restart")&&h.jsx("button",{className:"nc-btn ghost",disabled:x||_,onClick:()=>P(()=>wa(e,oe.id,F)),children:S("restart")}),h.jsx("button",{className:"nc-btn ghost",disabled:x||_,onClick:()=>{N(""),v({mode:"edit",original:oe,form:{...oe}})},children:S("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:x||_,onClick:()=>P(async()=>{window.confirm(S("fleet-remove-cell").replace("{id}",oe.id))&&await Gg(e,oe.id,!0,F)}),children:"×"})]})]},oe.id)}),h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:S("fleet-engines")}),h.jsxs("button",{className:"nc-btn primary",disabled:x||_,onClick:()=>{N(""),y({mode:"new",form:wx()})},children:["+ ",S("add")]})]}),l.engines.map(oe=>{var pe,De;return h.jsxs("div",{className:"nc-fleet-item",children:[h.jsxs("span",{children:[h.jsx("b",{children:oe.label}),h.jsx("small",{children:oe.managed?`${oe.id} · ${oe.managed.client} / ${oe.managed.provider} · ${(pe=oe.managedInfo)!=null&&pe.configured?S("fleet-ready"):((De=oe.managedInfo)==null?void 0:De.reason)||S("fleet-not-ready")}`:`${oe.id} · ${oe.command}`})]}),h.jsxs("span",{children:[h.jsx("button",{className:"nc-btn ghost",disabled:x||_,onClick:()=>{N(""),y({mode:"edit",original:oe,form:Cx(oe)})},children:S("edit")}),h.jsx("button",{className:"nc-btn danger",disabled:x||_,onClick:()=>P(async()=>{window.confirm(S("fleet-remove-engine").replace("{id}",oe.id))&&await FS(e,oe.id,F)}),children:"×"})]})]},oe.id)})]}),m&&h.jsx(As,{onClose:()=>y(null),label:S("fleet-new-engine"),error:E,children:h.jsx(Nx,{state:m,setState:y,busy:_,onSave:J,catalog:l.managedCatalog||[]})}),w&&h.jsx(As,{onClose:()=>v(null),label:S("fleet-new-cell"),error:E,children:h.jsx(Rx,{token:e,route:F,targets:r,location:z,setLocation:B,state:w,setState:v,engines:l.engines,busy:_,onSave:L})}),R&&h.jsx("div",{className:"nc-set-note",children:R}),E&&h.jsx("div",{className:"nc-err",children:E}),ee&&h.jsx(As,{onClose:()=>k(!1),label:S("fleet-backup"),error:E,children:h.jsx(Ex,{cells:l.cells,engines:l.engines,busy:_,canRestore:G,onRestore:de,onClose:()=>k(!1)})}),U&&h.jsx(As,{onClose:()=>ie(null),label:S("import-as-cell"),error:E,children:h.jsx(Fg,{token:e,route:U.route||F,state:U,setState:ie,busy:_,onSave:ae})}),I&&h.jsx(Da,{cell:I,token:e,route:Array.isArray(I.route)?I.route:F,onConfirm:async oe=>{try{await re(oe)}finally{await Q()}},onClose:()=>V(null)})]}):h.jsxs("div",{className:"nc-set-tab",children:[Oe,D==="overview"?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"nc-set-info",children:S("fleet-overview-help")}),h.jsx(zg,{token:e,targets:r,readonly:t,onPower:X,onImport:se})]}):h.jsxs(h.Fragment,{children:[ve,h.jsx("div",{className:"nc-set-info",children:S("fleet-editor-unavailable")})]}),E&&h.jsx("div",{className:"nc-err",children:E}),U&&h.jsx(As,{onClose:()=>ie(null),label:S("import-as-cell"),error:E,children:h.jsx(Fg,{token:e,route:U.route||F,state:U,setState:ie,busy:_,onSave:ae})}),I&&h.jsx(Da,{cell:I,token:e,route:Array.isArray(I.route)?I.route:F,onConfirm:async oe=>{try{await re(oe)}finally{await Q()}},onClose:()=>V(null)})]})}function zg({token:e,targets:t=[],readonly:r=!1,onPower:s,onImport:o}){const[l,u]=M.useState([]),[d,p]=M.useState(0);M.useEffect(()=>{let N=!0;async function R(){const z=[{route:[],label:S("local")}].concat((t||[]).map(W=>({route:Array.isArray(W.route)?W.route:[],label:W.label||(W.route||[]).join(" › ")}))),B=await Promise.all(z.map(async W=>{const A={...W,available:!1,readonly:!1,capabilities:[],provider:null,cells:[],unmanaged:[],err:""};try{const I=await an(e,W.route);A.available=!!I.available,A.capabilities=I.capabilities||[],A.provider=I.provider||null,A.cells=(I.cells||[]).map(V=>({...V,route:W.route}));try{A.readonly=!!(await Nh(e,W.route)).readonlyDefault}catch{}try{const V=await e_(e,W.route),U=new Set(A.cells.map(ie=>ie.tmuxSession).filter(Boolean));A.unmanaged=(V.sessions||[]).filter(ie=>ie&&!U.has(ie.name))}catch{}}catch(I){A.err=String(I&&I.message||I)}return A}));N&&u(B)}R();const O=setInterval(R,6e3);return()=>{N=!1,clearInterval(O)}},[e,t,d]);const m=(N,R)=>Array.isArray(N.capabilities)&&N.capabilities.includes(R)&&!r&&!N.readonly,y=()=>p(N=>N+1),w=(N,R)=>{s&&s({...N,route:R})},v=(N,R)=>{s&&s({...N,route:R})},_=async(N,R)=>{try{await wa(e,N.cell,R)}catch{}y()},b=async(N,R)=>{if(window.confirm(S("fleet-remove-cell").replace("{id}",N.cell))){try{await Gg(e,N.cell,!0,R)}catch{}y()}},E=async(N,R)=>{if(window.confirm(S("terminate-confirm").replace("{name}",N.name))){try{await Eh(e,N.name,R)}catch{}y()}};return h.jsxs("div",{className:"nc-fleet-inventory",children:[h.jsxs("div",{className:"nc-fleet-section-head",children:[h.jsx("b",{children:S("fleet-inventory")}),h.jsx("small",{children:S("fleet-inventory-help")})]}),l.map(N=>{const R=N.route.length?N.route.join("/"):"local";return h.jsxs("div",{className:"nc-fleet-pos",children:[h.jsxs("div",{className:"nc-fleet-pos-title",children:[h.jsx("span",{className:`dot ${N.available?"on":"warn"}`}),h.jsx("b",{children:N.label}),h.jsx("small",{children:N.available?`${N.cells.length} ${S("fleet-cells")} · ${N.unmanaged.length} ${S("fleet-tmux")}`:N.err||S("fleet-not-available")})]}),N.cells.map(O=>h.jsxs("div",{className:"nc-fleet-item nc-fleet-cell",children:[h.jsxs("span",{children:[h.jsx("b",{children:O.cell}),h.jsx("small",{children:`${O.engine||""}${O.key?`·${O.key}`:""}${O.active?"":` · ${S("cell-off")}`}`})]}),h.jsxs("span",{className:"nc-fleet-cell-actions",children:[O.active&&m(N,"down")&&h.jsx("button",{className:"nc-btn ghost",title:S("power-off"),onClick:()=>v(O,N.route),children:S("stop")}),!O.active&&m(N,"up")&&h.jsx("button",{className:"nc-btn ghost",title:S("power-on"),onClick:()=>w(O,N.route),children:S("start")}),m(N,"restart")&&O.active&&h.jsx("button",{className:"nc-btn ghost",title:S("restart"),onClick:()=>_(O,N.route),children:S("restart")}),m(N,"remove")&&h.jsx("button",{className:"nc-btn danger",title:S("delete"),onClick:()=>b(O,N.route),children:"×"})]})]},`${R}:${O.cell}`)),N.unmanaged.map(O=>h.jsxs("div",{className:"nc-fleet-item nc-fleet-unmanaged",children:[h.jsxs("span",{children:[h.jsx("b",{children:O.name}),h.jsx("small",{children:S("fleet-tmux")})]}),h.jsxs("span",{className:"nc-fleet-cell-actions",children:[m(N,"import")&&o&&h.jsx("button",{className:"nc-btn ghost",title:S("import-as-cell"),onClick:()=>o(O,N.route),children:S("import-as-cell")}),h.jsx("button",{className:"nc-btn danger",title:S("terminate"),onClick:()=>E(O,N.route),children:"×"})]})]},`${R}:u:${O.name}`)),N.available&&N.cells.length===0&&N.unmanaged.length===0&&h.jsx("div",{className:"nc-empty",children:S("fleet-inventory-empty")})]},R)})]})}function Ex({cells:e=[],engines:t=[],busy:r,canRestore:s=!1,onRestore:o,onClose:l}){const[u,d]=M.useState("export"),[p,m]=M.useState(()=>new Set(e.map(W=>W.id))),[y,w]=M.useState([]),[v,_]=M.useState(""),b=t.map(W=>W.id),E=new Set(e.map(W=>W.id)),N=W=>m(A=>{const I=new Set(A);return I.has(W)?I.delete(W):I.add(W),I}),R=()=>{const W=vx(e,p);if(!W.cells.length){_(S("fleet-backup-select-one"));return}const A=new Blob([`${JSON.stringify(W,null,2)}
91
- `],{type:"application/json"}),I=URL.createObjectURL(A),V=document.createElement("a");V.href=I,V.download=`nexuscrew-cells-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(V),V.click(),V.remove(),setTimeout(()=>URL.revokeObjectURL(I),0),_("")},O=async W=>{if(_(""),w([]),!!W){if(W.size>1024*1024){_(S("fleet-backup-too-large"));return}try{const A=yx(await W.text());if(!A.ok){_(S(`fleet-backup-${A.error}`));return}w(A.cells.map(I=>{const V=b.includes(I.engine),U=E.has(I.id);return{cell:I,engine:V?I.engine:"",selected:V&&!U,exists:U}}))}catch(A){_(String(A.message||A))}}},z=(W,A)=>w(I=>I.map((V,U)=>U===W?{...V,...A}:V)),B=y.filter(W=>W.selected&&W.engine);return h.jsxs("div",{className:"nc-set-form nc-fleet-form nc-backup-dialog",children:[h.jsx("b",{children:S("fleet-backup")}),h.jsx("small",{children:S("fleet-backup-help")}),h.jsxs("div",{className:"nc-set-tabs nc-backup-tabs",children:[h.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="export"?" on":""}`,onClick:()=>{d("export"),_("")},children:S("fleet-backup-export")}),h.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="import"?" on":""}`,disabled:!s,title:s?"":S("fleet-backup-restore-unavailable"),onClick:()=>{d("import"),_("")},children:S("fleet-backup-import")})]}),u==="export"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>m(new Set(e.map(W=>W.id))),children:S("select-all")}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>m(new Set),children:S("select-none")})]}),h.jsxs("div",{className:"nc-backup-list",children:[e.map(W=>h.jsxs("label",{className:"nc-check nc-backup-row",children:[h.jsx("input",{type:"checkbox",checked:p.has(W.id),onChange:()=>N(W.id)}),h.jsxs("span",{children:[h.jsx("b",{children:W.id}),h.jsxs("small",{children:[W.engine," · ",S("fleet-system-prompt")," ",(W.prompt||"").length," ",S("characters")]})]})]},W.id)),!e.length&&h.jsx("div",{className:"nc-empty",children:S("fleet-backup-empty")})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:l,children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:!p.size,onClick:R,children:S("fleet-backup-download")})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"file",accept:"application/json,.json",disabled:r,onChange:W=>O(W.target.files&&W.target.files[0])}),h.jsx("small",{children:S("fleet-backup-import-help")}),!!y.length&&h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>w(W=>W.map(A=>({...A,selected:!!A.engine}))),children:S("select-all")}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>w(W=>W.map(A=>({...A,selected:!1}))),children:S("select-none")})]}),h.jsx("div",{className:"nc-backup-list",children:y.map((W,A)=>h.jsxs("div",{className:"nc-backup-import-row",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:W.selected,disabled:!W.engine,onChange:I=>z(A,{selected:I.target.checked})}),h.jsxs("span",{children:[h.jsx("b",{children:W.cell.id}),h.jsxs("small",{children:[W.exists?S("fleet-backup-overwrite"):S("fleet-backup-new")," · ",S("fleet-system-prompt")," ",W.cell.systemPrompt.length," ",S("characters")]})]})]}),h.jsxs("select",{value:W.engine,onChange:I=>z(A,{engine:I.target.value,selected:!!I.target.value}),children:[h.jsx("option",{value:"",children:S("fleet-backup-engine-missing")}),t.map(I=>h.jsx("option",{value:I.id,children:I.label||I.id},I.id))]})]},W.cell.id))}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:l,children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||!B.length,onClick:()=>o(B),children:S("fleet-backup-restore")})]})]}),v&&h.jsx("div",{className:"nc-err",children:v})]})}function Nx({state:e,setState:t,busy:r,onSave:s,catalog:o}){var v;const l=e.form,u=_=>t({...e,form:{...l,..._}}),d=l.envRows||[],p=[...new Map(o.map(_=>[_.client,_.clientLabel||_.client])).entries()],m=o.filter(_=>_.client===l.client),y=Fa(o,l),w=_=>{_&&u({client:_.client,provider:_.provider,credentialProfile:_.credentialProfile||"",managedModel:_.model||"",protocol:_.protocol||"",permissionPolicy:_.permissionPolicyDefault||"standard",rc:!!_.rc,displayName:_.custom?S("fleet-custom-provider-default"):"",baseUrl:_.custom?"":_.endpoint||"",envKey:_.defaultEnvKey||"",providerId:"nexuscrew-custom",...e.mode==="new"?{id:_.id,label:""}:{}})};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:e.mode==="new"?S("fleet-new-engine"):`${S("edit")} ${l.id}`}),h.jsx("input",{value:l.id,disabled:e.mode!=="new",placeholder:"id",onChange:_=>u({id:_.target.value})}),h.jsx("input",{value:l.label,placeholder:S("label"),onChange:_=>u({label:_.target.value})}),h.jsxs("select",{value:l.kind,disabled:e.mode!=="new",onChange:_=>u({kind:_.target.value}),children:[h.jsx("option",{value:"managed",children:S("fleet-managed")}),h.jsx("option",{value:"custom",children:S("fleet-custom")})]}),l.kind==="managed"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("select",{value:l.client,disabled:e.mode!=="new",onChange:_=>w(o.find(b=>b.client===_.target.value&&b.default)||o.find(b=>b.client===_.target.value)),children:p.map(([_,b])=>h.jsx("option",{value:_,children:b},_))}),h.jsx("select",{value:((v=Fa(o,l))==null?void 0:v.id)||"",disabled:e.mode!=="new",onChange:_=>w(o.find(b=>b.id===_.target.value)),children:m.map(_=>h.jsx("option",{value:_.id,children:_.label},_.id))})]}),h.jsx("input",{value:l.managedModel,list:"nc-managed-models",placeholder:S(y!=null&&y.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:_=>u({managedModel:_.target.value})}),h.jsx("datalist",{id:"nc-managed-models",children:[...(y==null?void 0:y.models)||[],...l.modelOptions||[]].filter((_,b,E)=>_&&E.indexOf(_)===b).map(_=>h.jsx("option",{value:_},_))}),y!=null&&y.supportsUnsafe?h.jsxs("select",{value:l.permissionPolicy,onChange:_=>u({permissionPolicy:_.target.value}),children:[h.jsx("option",{value:"standard",children:S("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:S("fleet-unsafe-permissions")})]}):h.jsx("small",{children:S("fleet-standard-permissions")}),(y==null?void 0:y.supportsUnsafe)&&l.permissionPolicy==="unsafe"&&h.jsx("small",{className:"nc-err",children:S("fleet-unsafe-warning")}),(y==null?void 0:y.credentialEnv)&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.envKey,placeholder:S("fleet-api-key-env"),onChange:_=>u({envKey:_.target.value})}),h.jsx("small",{children:S("fleet-custom-secret-help")})]}),l.provider==="custom"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.displayName,placeholder:S("fleet-provider-display"),onChange:_=>u({displayName:_.target.value})}),h.jsx("input",{value:l.baseUrl,placeholder:"https://api.example.com/v1",onChange:_=>u({baseUrl:_.target.value})}),((y==null?void 0:y.protocols)||[]).length>1&&h.jsx("select",{value:l.protocol,onChange:_=>u({protocol:_.target.value}),children:y.protocols.map(_=>h.jsx("option",{value:_,children:_},_))}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.envKey,placeholder:S("fleet-api-key-env"),onChange:_=>u({envKey:_.target.value})}),h.jsx("input",{value:l.providerId,placeholder:S("fleet-provider-id"),onChange:_=>u({providerId:_.target.value})})]}),h.jsxs("small",{children:[l.protocol," · ",S("fleet-custom-secret-help")]})]}),h.jsx("small",{children:S("fleet-managed-help")})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.command,placeholder:S("command-path"),onChange:_=>u({command:_.target.value})}),h.jsx("textarea",{value:l.argsText,placeholder:S("args-lines"),onChange:_=>u({argsText:_.target.value})}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:l.rc,onChange:_=>u({rc:_.target.checked})})," remote control"]}),h.jsxs("select",{value:l.promptMode,onChange:_=>u({promptMode:_.target.value}),children:[h.jsx("option",{value:"send-keys",children:"send-keys"}),h.jsx("option",{value:"flag",children:"flag"})]}),l.promptMode==="flag"&&h.jsx("input",{value:l.promptFlag,placeholder:"prompt flag",onChange:_=>u({promptFlag:_.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.modelFlag,placeholder:"model flag",onChange:_=>u({modelFlag:_.target.value})}),h.jsx("input",{value:l.modelValue,placeholder:"model default",onChange:_=>u({modelValue:_.target.value})})]}),h.jsx("small",{children:S("env-write-only")}),d.map((_,b)=>h.jsxs("div",{className:"nc-fleet-env",children:[h.jsx("input",{value:_.key,disabled:_.configured,placeholder:"ENV_KEY",onChange:E=>{const N=d.slice();N[b]={..._,key:E.target.value},u({envRows:N})}}),h.jsx("input",{type:"password",value:_.value,placeholder:_.configured?"•••••• (unchanged)":"value",onChange:E=>{const N=d.slice();N[b]={..._,value:E.target.value},u({envRows:N})}}),h.jsx("button",{className:"nc-btn danger",onClick:()=>u({envRows:d.filter((E,N)=>N!==b)}),children:"×"})]},`${_.key}-${b}`)),h.jsx("button",{className:"nc-btn ghost",onClick:()=>u({envRows:[...d,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:r||!l.id||l.kind==="custom"&&!l.command||l.kind==="managed"&&(y==null?void 0:y.requiresModel)&&!l.managedModel||l.kind==="managed"&&(y==null?void 0:y.credentialEnv)&&!l.envKey||l.kind==="managed"&&l.provider==="custom"&&(!l.displayName||!l.baseUrl||!l.envKey||!l.providerId),onClick:s,children:S("save")})]})]})}function Rx({token:e,route:t,targets:r=[],location:s,setLocation:o,state:l,setState:u,engines:d,busy:p,onSave:m}){const[y,w]=M.useState(null),[v,_]=M.useState(""),b=l.form,E=z=>u({...l,form:{...b,...z}}),N=d.find(z=>z.id===b.engine),R=z=>{var W,A,I;const B=d.find(V=>V.id===z);E({engine:z,model:((W=b.models)==null?void 0:W[z])||((A=B==null?void 0:B.managed)==null?void 0:A.model)||((I=B==null?void 0:B.model)==null?void 0:I.value)||""})},O=async z=>{try{const B=await Qg(e,z,t);w(B),E({cwd:B.path}),_("")}catch(B){_(String(B.message||B))}};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:l.mode==="new"?S("fleet-new-cell"):`${S("edit")} ${b.id}`}),l.mode==="new"&&h.jsxs("label",{className:"nc-field",children:[S("location"),h.jsx("span",{className:"nc-req",children:" *"}),h.jsxs("select",{value:s,onChange:z=>{o(z.target.value),E({engine:""})},children:[h.jsx("option",{value:"",children:S("local")}),r.map(z=>h.jsxs("option",{value:z.route.join("/"),disabled:z.status&&z.status!=="up",children:[z.label,z.status&&z.status!=="up"?` · ${S("node-offline")}`:""]},z.route.join("/")))]})]}),h.jsx("input",{value:b.id,disabled:l.mode!=="new",placeholder:"id",onChange:z=>E({id:z.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:b.cwd,placeholder:S("cwd"),onChange:z=>E({cwd:z.target.value})}),h.jsx("button",{className:"nc-btn ghost",onClick:()=>y?w(null):O(b.cwd),children:S("browse")})]}),y&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:y.path}),h.jsxs("div",{className:"nc-fs-list",children:[y.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>O(y.parent),children:["↑ ",S("fs-parent")]}),(y.dirs||[]).map(z=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>O(`${y.path.replace(/\/$/,"")}/${z}`),children:["📁 ",z]},z))]})]}),v&&h.jsx("div",{className:"nc-err",children:v}),h.jsx("select",{value:b.engine,onChange:z=>R(z.target.value),children:d.map(z=>h.jsx("option",{value:z.id,children:z.label},z.id))}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!b.boot,onChange:z=>E({boot:z.target.checked})})," boot"]}),h.jsx("input",{value:b.model||"",list:"nc-cell-models",placeholder:S("fleet-model-override"),onChange:z=>E({model:z.target.value})}),h.jsx("datalist",{id:"nc-cell-models",children:((N==null?void 0:N.availableModels)||[]).map(z=>h.jsx("option",{value:z},z))}),h.jsx("textarea",{value:b.prompt||"",placeholder:"prompt",onChange:z=>E({prompt:z.target.value})}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>u(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:p||!b.id||!b.cwd||!b.engine,onClick:m,children:S("save")})]})]})}function Fg({token:e,route:t=[],state:r,setState:s,busy:o,onSave:l}){const[u,d]=M.useState(null),[p,m]=M.useState([]),[y,w]=M.useState(""),v=Array.isArray(t)?t.join("/"):"";M.useEffect(()=>{let R=!0;return kh(e,v?v.split("/"):[]).then(O=>{R&&(m(O.engines||[]),w(""))}).catch(O=>{R&&(m([]),w(String(O.message||O)))}),()=>{R=!1}},[e,v]);const _=r.form,b=R=>s({...r,form:{..._,...R}}),E=async R=>{try{const O=await Qg(e,R,t);d(O),b({cwd:O.path})}catch{}},N=!_.id&&_.tmuxSession?_.tmuxSession.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32):_.id;return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsxs("b",{children:[S("import-as-cell")," · ",_.tmuxSession]}),h.jsx("small",{children:S("import-help")}),h.jsx("input",{value:_.tmuxSession,disabled:!0,placeholder:"tmux session",readOnly:!0}),h.jsx("input",{value:_.id,placeholder:S("name"),onChange:R=>b({id:R.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:_.cwd,placeholder:S("cwd"),onChange:R=>b({cwd:R.target.value})}),h.jsx("button",{className:"nc-btn ghost",type:"button",onClick:()=>u?d(null):E(_.cwd),children:S("browse")})]}),u&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:u.path}),h.jsxs("div",{className:"nc-fs-list",children:[u.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>E(u.parent),children:["↑ ",S("fs-parent")]}),(u.dirs||[]).map(R=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>E(`${u.path.replace(/\/$/,"")}/${R}`),children:["📁 ",R]},R))]})]}),h.jsxs("select",{value:_.engine,onChange:R=>b({engine:R.target.value}),children:[h.jsx("option",{value:"",children:S("import-engine-required")}),p.map(R=>h.jsx("option",{value:R.id,children:R.label},R.id))]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!_.boot,onChange:R=>b({boot:R.target.checked})})," boot"]}),(r.err||y)&&h.jsx("div",{className:"nc-err",children:r.err||y}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>s(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:o||!_.tmuxSession||!_.engine||!p.length,onClick:l,children:S(N?"import-as-cell":"save")})]})]})}function Px({text:e}){const[t,r]=M.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return h.jsxs("div",{className:"nc-set-copyline",children:[h.jsx("code",{children:e}),h.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:s,children:[h.jsx(He,{name:"copy",size:14})," ",S(t?"copied":"copy")]})]})}function Dx({value:e}){const[t,r]=M.useState("");return M.useEffect(()=>{let s=!0;return OC.toDataURL(e,{margin:1,width:220}).then(o=>{s&&r(o)}).catch(()=>{}),()=>{s=!1}},[e]),t?h.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function Lx({token:e,nodes:t,settings:r,readonly:s,refresh:o}){const[l,u]=M.useState(null),[d,p]=M.useState(null),[m,y]=M.useState({}),[w,v]=M.useState(null),[_,b]=M.useState({ssh:"",sshPort:"",name:""}),[E,N]=M.useState(""),[R,O]=M.useState(""),[z,B]=M.useState(!1),W=Date.now(),A=r&&r.deviceName||"",I=(t||[]).filter(k=>k&&k.direction==="outbound"&&k.name&&k.ssh),V=I.find(k=>k.name===E)||I[0]||null,U=async(k,D)=>{u(null),p(`${k}:${D}`);try{const j=await Rh(e,k,D);D==="test"&&y(Y=>({...Y,[k]:j})),await o()}catch(j){u(`${k}: ${String(j.message||j)}`)}p(null)},ie=async k=>{if(window.confirm(S("node-remove-confirm").replace("{name}",k))){u(null),p(`${k}:remove`);try{await XS(e,k),await o()}catch(D){u(`${k}: ${String(D.message||D)}`)}p(null)}},ee=async()=>{if(u(null),V){const j=Lg({name:V.name,ssh:V.ssh,sshPort:V.sshPort||""});if(!j.ok){u(S(j.error));return}p("invite");try{v(await Hp(e,{ssh:j.value.ssh,...j.value.sshPort?{sshPort:j.value.sshPort}:{}},[V.name]))}catch(Y){u(String(Y.message||Y))}p(null);return}const k=Hn(_.name||R||A||"NexusCrew"),D=Lg({name:k,ssh:_.ssh,sshPort:_.sshPort});if(!D.ok){u(S(D.error));return}p("invite");try{v(await Hp(e,{...R||A?{label:R||A}:{},name:k,ssh:D.value.ssh,...D.value.sshPort?{sshPort:D.value.sshPort}:{}}))}catch(j){u(String(j.message||j))}p(null)};return h.jsxs("div",{className:"nc-set-tab",children:[h.jsx(Sv,{token:e,deviceDefault:A,readonly:s,onSuccess:o}),(t||[]).length===0&&h.jsx("div",{className:"nc-empty",children:S("no-nodes")}),(t||[]).map(k=>{var Y,F,Q,$,q;const D=qC(k.tunnel,W),j=m[k.name];return h.jsxs("div",{className:"nc-set-node",children:[h.jsxs("div",{className:"nc-set-node-head",children:[h.jsx("span",{className:`nc-dot ${D.up?"on":""}`}),h.jsx("b",{children:k.label||k.name}),h.jsxs("small",{children:[k.name,k.direction==="outbound"?` · SSH ${k.ssh||""}`:` · ${S("node-connected-client")}`,(Y=k.tunnel)!=null&&Y.transport?` · ${k.tunnel.transport} ${S("transport-used")}`:""]}),h.jsxs("span",{className:`nc-set-tunnel${D.up?" up":""}`,children:[S(D.label),D.since?` · ${D.since}`:""]}),k.shared&&h.jsxs("select",{value:k.visibility||"network",disabled:s||!!d,onChange:async G=>{p(`${k.name}:visibility`);try{await $p(e,k.name,G.target.value),await o()}catch(P){u(String(P.message||P))}p(null)},children:[h.jsx("option",{value:"network",children:S("visibility-network")}),h.jsx("option",{value:"relay-only",children:S("visibility-relay")}),h.jsx("option",{value:"selected",children:S("visibility-selected")})]})]}),k.direction==="outbound"?h.jsxs("label",{className:"nc-check nc-node-share",children:[h.jsx("input",{type:"checkbox",checked:k.shared===!0,disabled:s||!!d||!D.up&&!k.shared,onChange:async G=>{u(null),p(`${k.name}:share`);try{await GS(e,k.name,G.target.checked),await o()}catch(P){u(`${k.name}: ${String(P.message||P)}`)}p(null)}}),h.jsxs("span",{children:[h.jsx("b",{children:S("share-node")}),h.jsx("small",{children:S(k.shared?"share-node-on-desc":"share-node-off-desc")})]})]}):h.jsx("div",{className:"nc-set-info",children:S(k.shared?"peer-shared":"peer-private")}),k.shared&&k.visibility==="selected"&&h.jsx("div",{className:"nc-set-row",children:(t||[]).filter(G=>G.name!==k.name&&G.nodeId).map(G=>{const P=(k.selected||[]).includes(G.nodeId);return h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:P,disabled:s||!!d,onChange:async J=>{const L=J.target.checked?[...k.selected||[],G.nodeId]:(k.selected||[]).filter(x=>x!==G.nodeId);p(`${k.name}:visibility`);try{await $p(e,k.name,"selected",L),await o()}catch(x){u(String(x.message||x))}p(null)}})," ",G.name]},G.nodeId)})}),h.jsxs("div",{className:"nc-set-node-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:s||!!d,onClick:async()=>{const G=window.prompt(S("node-display-label"),k.label||k.name);if(G!=null){if(!_h(G)){u(S("err-label"));return}p(`${k.name}:label`);try{await YS(e,k.name,G),await o()}catch(P){u(String(P.message||P))}p(null)}},children:S("edit")}),((F=k.health)==null?void 0:F.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"test"),children:S("node-test")}),((Q=k.health)==null?void 0:Q.managed)!==!1&&(D.up?h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"down"),children:S("tunnel-stop")}):h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"up"),children:S("tunnel-start")})),(($=k.health)==null?void 0:$.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"restart"),children:S("tunnel-restart")}),h.jsx("button",{type:"button",className:"nc-btn danger",disabled:s||!!d,title:S(s?"settings-readonly":"terminate"),onClick:()=>ie(k.name),children:h.jsx(He,{name:"trash",size:14})})]}),((q=k.health)==null?void 0:q.detail)&&h.jsx("div",{className:`nc-set-test${k.health.status==="healthy"?" ok":k.health.status==="passive"?"":" ko"}`,children:k.health.detail}),j&&h.jsxs("div",{className:`nc-set-test${j.ok?" ok":" ko"}`,children:[j.result,j.detail?` — ${j.detail}`:""]})]},k.name)}),h.jsxs("div",{className:"nc-set-form",children:[h.jsx("div",{className:"nc-sheet-label",children:S("invite-node")}),h.jsx("small",{className:"nc-set-hint",children:S(V?"invite-network-hint":"invite-v2-hint")}),V?h.jsxs(h.Fragment,{children:[I.length>1&&h.jsxs("label",{className:"nc-field",children:[S("invite-network-label"),h.jsx("select",{value:V.name,disabled:s||!!d,onChange:k=>{N(k.target.value),v(null)},children:I.map(k=>h.jsx("option",{value:k.name,children:k.label||k.name},k.name))})]}),h.jsxs("div",{className:"nc-set-info nc-invite-endpoint",children:[S("invite-network-via"),": ",h.jsx("b",{children:V.label||V.name})," · ",V.ssh,V.sshPort?`:${V.sshPort}`:""]}),h.jsx("small",{className:"nc-set-hint",children:S("invite-network-route")})]}):h.jsxs("label",{className:"nc-field",children:[S("invite-endpoint-label"),h.jsx("input",{placeholder:"user@host",value:_.ssh,disabled:s,onChange:k=>b({..._,ssh:k.target.value})}),h.jsx("small",{className:"nc-set-hint",children:S("invite-endpoint-needed")})]}),!V&&z&&h.jsxs("div",{className:"nc-invite-advanced",children:[h.jsxs("label",{className:"nc-field",children:[S("node-ssh-port-label"),h.jsx("input",{inputMode:"numeric",placeholder:"22",value:_.sshPort,disabled:s,onChange:k=>b({..._,sshPort:k.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),h.jsxs("label",{className:"nc-field",children:[S("device-name-label"),h.jsx("input",{placeholder:A||"NexusCrew",value:R,disabled:s,onChange:k=>O(k.target.value)}),h.jsx("small",{className:"nc-set-hint",children:S("device-name-hint")})]}),h.jsxs("label",{className:"nc-field",children:[S("node-name-label"),h.jsx("input",{placeholder:Hn(R||A||S("node-name-ph")),value:_.name,disabled:s,onChange:k=>b({..._,name:k.target.value?Hn(k.target.value):""})})]})]}),h.jsxs("div",{className:"nc-set-row nc-invite-actions",children:[h.jsx("button",{type:"button",className:"nc-btn primary",disabled:s||!!d||!V&&!_.ssh.trim(),onClick:ee,children:S("create-pairing-link")}),!V&&h.jsxs("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>B(k=>!k),children:[z?"▾":"▸"," ",S("pair-advanced")]})]}),w&&h.jsxs(h.Fragment,{children:[h.jsx(Dx,{value:w.pairingUrl}),h.jsx(Px,{text:w.pairingUrl}),h.jsx("div",{className:"nc-set-info",children:S("invite-next-steps")})]})]}),l&&h.jsx("div",{className:"nc-err",children:l})]})}function Mx({token:e,readonly:t}){const[r,s]=M.useState("idle"),[o,l]=M.useState(!1),[u,d]=M.useState(null);M.useEffect(()=>{let m=!1;return lx().then(y=>{m||s(y)}),()=>{m=!0}},[]);const p=async()=>{d(null),l(!0);try{r==="subscribed"?(await ux(e),s("idle")):(await cx(e),s("subscribed"))}catch(m){const y=String(m.message||m);y==="push-denied"?(s("denied"),d(S("push-denied"))):y==="push-unsupported"?(s("unsupported"),d(S("push-unsupported"))):d(y)}l(!1)};return r==="unsupported"?h.jsx("div",{className:"nc-set-info",children:S("push-unsupported")}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||o||r==="denied",title:t?S("settings-readonly"):"",onClick:p,children:S(r==="subscribed"?"push-disable":"push-enable")}),h.jsx("span",{className:"nc-set-info",children:S(r==="subscribed"?"push-on":r==="denied"?"push-denied":"push-off")})]}),u&&h.jsx("div",{className:"nc-err",children:u})]})}function Tx({token:e,settings:t,readonly:r,refresh:s}){const[o,l]=M.useState(null),[u,d]=M.useState(null),[p,m]=M.useState(!1),[y,w]=M.useState(!1),[v,_]=M.useState(null),[b,E]=M.useState(!0);M.useEffect(()=>{_(t&&t.update||null),E(!t||t.autoUpdate!==!1)},[t]);const N=async()=>{l(null),d(null),w(!0);try{const A=await KS(e);d(A.note||"ok"),m(!1)}catch(A){l(String(A.message||A))}w(!1)},R=async()=>{l(null),d(null),w(!0);try{const A=await QS(e);d(`${A.note||"ok"}${A.target?` (${A.target})`:""}`)}catch(A){l(String(A.message||A))}w(!1)},O=async A=>{l(null),d(null),w(!0);try{await t_(e,{autoUpdate:A}),E(A),s&&await s()}catch(I){l(String(I.message||I))}w(!1)},z=async()=>{l(null),d(null),w(!0);try{_(await JS(e))}catch(A){l(String(A.message||A))}w(!1)},B=async()=>{l(null),d(null),w(!0);try{const A=await ZS(e);_(A),d(S("npm-update-restarting"))}catch(A){l(String(A.message||A))}w(!1)},W=t&&t.service;return h.jsxs("div",{className:"nc-set-tab",children:[t&&h.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,h.jsx("br",{}),W&&W.installed?S("service-installed"):S("service-missing"),W&&W.installed?` · ${W.active?S("service-active"):S("service-inactive")}`:"",W?` · boot ${W.boot?"on":"off"}`:""]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y,title:r?S("settings-readonly"):"",onClick:()=>{l(null),d(null),m(!0)},children:S("token-rotate")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y,title:r?S("settings-readonly"):"",onClick:R,children:S("service-regenerate")})]}),h.jsxs("div",{className:"nc-set-form nc-update-settings",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:b,disabled:r||y||v&&!v.supported,onChange:A=>O(A.target.checked)}),h.jsxs("span",{children:[h.jsx("b",{children:S("npm-auto-update")}),h.jsx("small",{children:S("npm-auto-update-help")})]})]}),v&&h.jsxs("div",{className:"nc-set-info",children:[S("npm-update-current")," v",v.current,v.latest?` · ${S("npm-update-latest")} v${v.latest}`:""," · ",S(`npm-update-${v.supported?v.phase:"unsupported"}`)]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y||!v||!v.supported,onClick:z,children:S("npm-update-check")}),v&&v.available&&h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||y||v.phase==="installing",onClick:B,children:S("npm-update-install")})]}),v&&v.lastError&&h.jsx("div",{className:"nc-err",children:v.lastError})]}),h.jsx(Mx,{token:e,readonly:r}),p&&h.jsxs("div",{className:"nc-set-confirm",children:[h.jsx("div",{children:S("token-rotate-explain")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:y,onClick:()=>m(!1),children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:y,onClick:N,children:S("confirm")})]})]}),u&&h.jsx("div",{className:"nc-set-note",children:u}),o&&h.jsx("div",{className:"nc-err",children:o})]})}function jx({token:e,onClose:t,initialTab:r="nodes",initialLocation:s="",startNewCell:o=!1}){pi();const[l,u]=M.useState(r),[d,p]=M.useState(null),[m,y]=M.useState([]),[w,v]=M.useState(!1),[_,b]=M.useState(null),E=Dh(e),N=M.useCallback(async()=>{try{const R=await Jg(e);p(R),b(null)}catch(R){b(String(R.message||R))}try{const R=await Zg(e);y(R.nodes||[])}catch(R){b(String(R.message||R))}},[e]);return M.useEffect(()=>{N();const R=setInterval(N,5e3);return()=>clearInterval(R)},[N]),M.useEffect(()=>{let R=!1;return Nt("/api/config",e).then(O=>O.json()).then(O=>{R||v(!!O.readonlyDefault)}).catch(()=>{}),()=>{R=!0}},[e]),h.jsx("div",{className:"nc-set-overlay",onClick:t,children:h.jsxs("div",{className:"nc-set-panel",onClick:R=>R.stopPropagation(),children:[h.jsxs("div",{className:"nc-set-head",children:[h.jsx(He,{name:"gear",size:18}),h.jsx("b",{children:S("settings")}),h.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:S("close"),children:h.jsx(He,{name:"x",size:18})})]}),w&&h.jsx("div",{className:"nc-set-readonly",children:S("settings-readonly")}),_&&h.jsx("div",{className:"nc-err",children:_}),h.jsx("div",{className:"nc-set-tabs",children:["nodes","fleet","system"].map(R=>h.jsx("button",{type:"button",className:`nc-set-tabbtn${l===R?" on":""}`,onClick:()=>u(R),children:S(`tab-${R}`)},R))}),h.jsxs("div",{className:"nc-set-body",children:[l==="nodes"&&h.jsx(Lx,{token:e,nodes:m,settings:d,readonly:w,refresh:N}),l==="fleet"&&h.jsx(kx,{token:e,readonly:w,startNewCell:o,initialLocation:s,targets:E.map(R=>({route:R.route,label:R.label||R.name,status:R.status}))}),l==="system"&&h.jsx(Tx,{token:e,settings:d,readonly:w,refresh:N})]})]})})}function Bx({token:e,initialPair:t,onPairDone:r,onDone:s}){pi();const[o,l]=M.useState(t?"pair":"welcome"),[u,d]=M.useState(!1),[p,m]=M.useState(null),y=async()=>{d(!0),m(null);try{await t_(e,{wizardDone:!0}),r&&r(),s()}catch(w){m(String(w.message||w)),d(!1)}};return h.jsx("div",{className:"nc-wiz-overlay",children:h.jsxs("div",{className:"nc-wiz",children:[h.jsxs("div",{className:"nc-wiz-head",children:[h.jsx("b",{children:S("wizard-title")}),h.jsx("small",{children:S("hydra-simple")})]}),o==="welcome"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:S("local-ready")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",disabled:u,onClick:y,children:S("local-only")}),h.jsx("button",{className:"nc-btn primary",disabled:u,onClick:()=>l("pair"),children:S("add-node")})]})]}),o==="pair"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx(Sv,{token:e,initial:t||"",autoStart:!!t,onBusyChange:d,onSuccess:async()=>{r&&r(),l("done")}}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{className:"nc-btn ghost",disabled:u,onClick:()=>{r&&r(),l("welcome")},children:S("back")})})]}),o==="done"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:S("node-connected")}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{className:"nc-btn primary",disabled:u,onClick:y,children:S("finish")})})]}),p&&h.jsx("div",{className:"nc-err",children:p})]})})}function Ix(e,t){if(typeof EventSource>"u"||!e)return()=>{};const r=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return r.onmessage=s=>{try{const o=JSON.parse(s.data);o&&typeof o=="object"&&typeof o.type=="string"&&t(o)}catch{}},()=>{try{r.close()}catch{}}}const Ax=6e3,Ox=12e3;function zx({n:e,onClose:t}){return h.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[h.jsxs("div",{className:"nc-ntf-toast-txt",children:[h.jsx("b",{children:e.title}),e.body&&h.jsx("small",{children:e.body}),e.session&&h.jsx("span",{className:"nc-ntf-from",children:e.session})]}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:S("close"),children:h.jsx(He,{name:"x",size:14})})]})}function Fx({ask:e,token:t,onAnswered:r}){const[s,o]=M.useState(""),[l,u]=M.useState(!1),[d,p]=M.useState(null),m=async y=>{const w=String(y||"").trim();if(!(!w||l)){p(null),u(!0);try{await tw(t,e.id,w),r(e.id)}catch(v){p(String(v.message||v))}u(!1)}};return h.jsxs("div",{className:"nc-ask-card",children:[h.jsxs("div",{className:"nc-ask-head",children:[h.jsx("span",{className:"nc-ntf-from",children:e.session}),h.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),h.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&h.jsx("div",{className:"nc-ask-opts",children:e.options.map(y=>h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:l,onClick:()=>m(y),children:y},y))}),h.jsxs("div",{className:"nc-ask-reply",children:[h.jsx("textarea",{rows:2,placeholder:S("ask-reply-ph"),value:s,disabled:l,onChange:y=>o(y.target.value)}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:l||!s.trim(),onClick:()=>m(s),children:S("send")})]}),d&&h.jsx("div",{className:"nc-err",children:d})]})}function Hx({token:e}){pi();const[t,r]=M.useState([]),[s,o]=M.useState([]),[l,u]=M.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),d=M.useRef(0),p=M.useCallback(w=>{r(v=>v.filter(_=>_.key!==w))},[]),m=M.useCallback(w=>{const v=`t${d.current+=1}`;r(_=>[..._.slice(-3),{...w,key:v}]),setTimeout(()=>p(v),w.urgency==="high"?Ox:Ax)},[p]);M.useEffect(()=>{if(!e)return;let w=!1;ew(e).then(_=>{w||o(_.asks||[])}).catch(()=>{});const v=Ix(e,_=>{_.type==="notify"?m(_):_.type==="ask"&&_.ask&&_.ask.id?o(b=>b.some(E=>E.id===_.ask.id)?b:[...b,_.ask]):_.type==="ask-answered"&&_.id&&o(b=>b.filter(E=>E.id!==_.id))});return()=>{w=!0,v()}},[e,m]);const y=w=>o(v=>v.filter(_=>_.id!==w));return h.jsxs(h.Fragment,{children:[t.length>0&&h.jsx("div",{className:"nc-ntf-toasts",children:t.map(w=>h.jsx(zx,{n:w,onClose:()=>p(w.key)},w.key))}),s.length>0&&!l&&h.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>u(!0),title:S("asks-title"),children:["? ",h.jsx("span",{className:"nc-ask-count",children:s.length})]}),s.length>0&&l&&h.jsxs("div",{className:"nc-ask-panel",children:[h.jsxs("div",{className:"nc-ask-panel-head",children:[h.jsx("b",{children:S("asks-title")}),h.jsx("span",{className:"nc-ask-count",children:s.length}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>u(!1),title:S("close"),children:h.jsx(He,{name:"x",size:16})})]}),h.jsx("div",{className:"nc-ask-panel-body",children:s.map(w=>h.jsx(Fx,{ask:w,token:e,onAnswered:y},w.id))})]})]})}const xu=e=>Ki(nn(e)).length===0,ku=e=>Array.isArray(e)?e.join("/"):"";function $x(e){const t=new Set,r=[];for(const s of Array.isArray(e)?e:[])!s||!ji.test(String(s.instanceId||""))||!Array.isArray(s.route)||!s.route.length||t.has(s.instanceId)||(t.add(s.instanceId),r.push({instanceId:s.instanceId,route:[...s.route],label:String(s.label||s.name||s.route.join(" › ")),status:s.status||"offline"}));return r.sort((s,o)=>s.label.localeCompare(o.label))}function Os(e){return{instanceId:e.ownerId,route:e.ownerRoute||[],label:e.ownerLabel,status:e.available===!1?"offline":"up"}}function Jr(e,t,r,s=!1,o=!0){const l=t.instanceId;return{...e,id:Fn(s?null:l,e.name),ownerId:l,ownerRoute:s?[]:[...t.route],ownerLabel:s?"Local":t.label,local:s,available:o,ownerTopology:Array.isArray(r)?r:[],layout:ph(e.layout,l,r)}}function Wx(e,t,r,s,o=[]){const[l,u]=M.useState([]),[d,p]=M.useState(!1),[m,y]=M.useState("idle"),[w,v]=M.useState(""),[_,b]=M.useState(""),E=M.useRef([]),N=M.useRef([]),R=M.useRef(""),O=M.useRef(t),z=M.useRef(r),B=M.useRef(!1),W=M.useRef(!0),A=M.useRef(""),I=M.useMemo(()=>$x(o),[o]),V=I.map(q=>`${q.instanceId}:${ku(q.route)}:${q.status}:${q.label}`).join("|");N.current=I,z.current=r,O.current=t,E.current=l;const U=M.useCallback(q=>mh(q.layout,R.current,N.current),[]),ie=M.useCallback((q,G=!0,P=O.current)=>{const J=E.current.some(x=>x.id===P);E.current=q,u(q);const L=q.find(x=>x.id===P);if(G&&L){W.current=!0;const x=U(L);s(x),L.local&&pC(L.name,x)}else J&&!L&&(W.current=!0,s(zn()),v("deck non più condiviso dal nodo owner"));fC(q.filter(x=>x.local).map(x=>x.name))},[s,U]),ee=M.useCallback(async q=>{let G=await ua(e);const P=G.decks.find(J=>J.name==="main");if(G.decks.length===1&&P&&P.revision===0&&xu(P.layout)){const J=dC(),L=nn(gh("main")||zn());if(!xu(L)){const x=ph(L,q,[]);G.decks[0]=await ha(e,"main",x,0,[])}for(const x of J.filter(X=>X!=="main"))try{let X=await Wp(e,x,[]);const re=nn(gh(x)||zn());xu(re)||(X=await ha(e,x,ph(re,q,[]),X.revision,[]))}catch{}G=await ua(e)}return G},[e]),k=M.useCallback(async({migrate:q=!1}={})=>{const G=await Nh(e,[]),P=ji.test(String(G.instanceId||""))?G.instanceId:"";if(!P)throw new Error("instanceId locale non disponibile");R.current=P,b(P);const[J,L]=await Promise.all([q?ee(P):ua(e),Fp(e,[]).catch(()=>({nodes:[]}))]),x={instanceId:P,route:[],label:"Local"},X=J.decks.map(se=>Jr(se,x,L.nodes,!0,!0)),re=E.current;return await Promise.all(N.current.map(async se=>{if(se.status!=="up"){X.push(...re.filter(ae=>!ae.local&&ae.ownerId===se.instanceId).map(ae=>({...ae,ownerRoute:[...se.route],ownerLabel:se.label,available:!1})));return}try{const[ae,de]=await Promise.all([ua(e,se.route),Fp(e,se.route).catch(()=>({nodes:[]}))]);X.push(...ae.decks.map(ve=>Jr(ve,se,de.nodes,!1,!0)))}catch{X.push(...re.filter(de=>!de.local&&de.ownerId===se.instanceId).map(de=>({...de,ownerRoute:[...se.route],ownerLabel:se.label,available:!1})))}})),X.sort((se,ae)=>se.local===ae.local?se.ownerLabel.localeCompare(ae.ownerLabel)||(se.name==="main"?-1:ae.name==="main"?1:se.name.localeCompare(ae.name)):se.local?-1:1),X},[e,ee,V]);M.useEffect(()=>{if(!e)return;let q=!1;const G=A.current!==e;return A.current=e,k({migrate:G}).then(P=>{if(q)return;const J=E.current.find(X=>X.id===O.current),L=P.find(X=>X.id===O.current),x=L&&(!J||L.revision>J.revision||J.available!==L.available||ku(J.ownerRoute)!==ku(L.ownerRoute));ie(P,G||!!x&&!B.current),p(!0),L&&v("")}).catch(P=>{q||(p(!0),v(String(P.message||P)))}),()=>{q=!0}},[ie,k,V,e]);const D=M.useCallback(async(q=O.current)=>{if(!d||!B.current)return!0;const G=E.current.find(P=>P.id===q);if(!G)return v(`deck inesistente: ${q}`),!1;if(G.available===!1)return v(`nodo owner offline: ${G.ownerLabel}`),!1;y("saving");try{const P=eg(nn(z.current),G.ownerId,G.ownerTopology),J=await ha(e,G.name,P,G.revision,G.ownerRoute),L=Jr(J,Os(G),G.ownerTopology,G.local,!0);return ie(E.current.map(x=>x.id===q?L:x),!1),B.current=!1,y("saved"),v(""),setTimeout(()=>y("idle"),1500),!0}catch(P){if(y("error"),v(String(P.message||P)),P.status===409&&P.data&&P.data.current){const J=E.current.find(x=>x.id===q),L=Jr(P.data.current,Os(J),J.ownerTopology,J.local,!0);ie(E.current.map(x=>x.id===q?L:x),!1)}return!1}},[d,e,ie]);return M.useEffect(()=>{if(!d)return;if(W.current){W.current=!1;return}B.current=!0,y("saving");const q=setTimeout(D,650);return()=>clearTimeout(q)},[r,d,D]),M.useEffect(()=>{if(!d)return;const q=setInterval(async()=>{try{const G=await k(),P=E.current.find(x=>x.id===O.current),J=G.find(x=>x.id===O.current),L=J&&(!P||J.revision>P.revision||P.available!==J.available);ie(G,L&&!B.current)}catch{}},5e3);return()=>clearInterval(q)},[d,k,ie]),{decks:l,records:l,localNodeId:_,ready:d,saveState:m,error:w,setError:v,saveNow:D,select:async q=>{if(B.current&&!await D(O.current))throw new Error("salvataggio del deck corrente fallito: cambio annullato");const G=E.current.find(P=>P.id===q);if(!G)throw new Error(`deck inesistente: ${q}`);return B.current=!1,W.current=!0,U(G)},add:async(q,G=null)=>{const P=G?E.current.find(x=>x.ownerId===G):E.current.find(x=>x.id===O.current)||E.current.find(x=>x.local);if(!P||P.available===!1)throw new Error("nodo owner non disponibile");const J=await Wp(e,q,P.ownerRoute),L=Jr(J,Os(P),P.ownerTopology,P.local,!0);return ie([...E.current,L],!1),L},rename:async(q,G)=>{const P=E.current.find(X=>X.id===q);if(!P)throw new Error("deck inesistente");if(q===O.current&&B.current&&!await D(q))throw new Error(`salvataggio di "${P.name}" fallito: rinomina annullata`);const J=E.current.find(X=>X.id===q);if(!J)throw new Error("deck inesistente");const L=await iw(e,J.name,G,J.revision,J.ownerRoute),x=Jr(L,Os(J),J.ownerTopology,J.local,!0);return ie(E.current.map(X=>X.id===q?x:X),!1),x},remove:async q=>{const G=E.current.find(P=>P.id===q);if(!G)throw new Error("deck inesistente");q===O.current&&(B.current=!1),await rw(e,G.name,G.revision,G.ownerRoute),ie(E.current.filter(P=>P.id!==q),!1)},addTileTo:async(q,G)=>{const P=E.current.find(se=>se.id===q);if(!P)throw new Error("deck inesistente");if(P.available===!1)throw new Error(`nodo owner offline: ${P.ownerLabel}`);const J=uv(G,R.current,N.current);if(!J)throw new Error("riferimento sessione non valido");const L=U(P),x=eg(av(L,J),P.ownerId,P.ownerTopology),X=await ha(e,P.name,x,P.revision,P.ownerRoute),re=Jr(X,Os(P),P.ownerTopology,P.local,!0);return ie(E.current.map(se=>se.id===q?re:se),!1),re},localMainId:Fn(null,"main"),parseDeckId:cv}}const Ux="/sw.js",vh="nc-sw-update";let yh=null,Sh=!1,wh=null,Ev=Object.freeze({needed:!1,kind:null,version:""}),Nv=!1;function Rv(){typeof window<"u"&&window.dispatchEvent(new Event(vh))}function Pv(){const e=wh||(Sh?{kind:"reload",version:""}:null);Ev=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function Hg(){return Ev}function qx(e){return typeof window>"u"?()=>{}:(window.addEventListener(vh,e),()=>window.removeEventListener(vh,e))}function Kh(e){Sh!==e&&(Sh=e,Pv(),Rv())}function Kx(e,t,r){let s=null;e&&t&&e!==t?s={kind:"install",version:e}:t&&r&&t!==r&&(s={kind:"reload",version:t});const o=JSON.stringify(s)===JSON.stringify(wh);wh=s,Pv(),o||Rv()}function Vx(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Kh(!0)})}function Yx(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Nv&&location.reload()}),navigator.serviceWorker.register(Ux).then(e=>{yh=e,e.waiting&&Kh(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&Vx(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function Xx(){Nv=!0,Kh(!1);const e=yh&&yh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function Gx({hash:e="",origin:t="",pathname:r="",search:s=""}={}){const o=String(e||"").replace(/^#/,""),l=`${r||""}${s||""}`;if(!o)return{token:"",pair:"",nextUrl:l};const u=new URLSearchParams(o),d=u.get("token")||"",p=u.get("pair")||"",m=p?`${t||""}${r||""}#pair=${p}`:"";return{token:d,pair:m,nextUrl:l}}const Dv=9,Lv=24,Mv="nc_side_w",$g="nc_side_min",Qx=240,Wg="(min-width:1024px) and (pointer:fine)";function Jx(){const e=Number(localStorage.getItem(Mv));return e>=180&&e<=480?e:Qx}function Zx(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Dv&&e<=Lv?e:13}function ek(){const e={token:"",pair:""};try{const{token:t,pair:r,nextUrl:s}=Gx({hash:location.hash,origin:location.origin,pathname:location.pathname,search:location.search});if(t){e.token=t;try{localStorage.setItem("nc_token",t)}catch{}}if(r){e.pair=r;try{sessionStorage.setItem("nc_pair",r)}catch{}}if(location.hash)try{history.replaceState(null,"",s)}catch{}}catch{}if(e.token||(e.token=sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""),!e.pair){const t=sessionStorage.getItem("nc_pair");t&&(e.pair=t)}return e}function tk(e){try{return nn(gh(e))}catch{return zn()}}function Ug(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function ik(){const[e,t]=M.useState(()=>window.matchMedia(Wg).matches);return M.useEffect(()=>{const r=window.matchMedia(Wg),s=o=>t(o.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),e}function qg({session:e,node:t,token:r,readonly:s=!1,onBack:o}){pi();const[l,u]=M.useState(!1),[d,p]=M.useState(()=>window.matchMedia("(pointer: coarse)").matches),[m,y]=M.useState(null),[w,v]=M.useState(Zx),[_,b]=M.useState(""),E=U=>v(ie=>{const ee=Math.max(Dv,Math.min(Lv,ie+U));return localStorage.setItem("nc_fontsize",String(ee)),ee}),N=M.useRef(()=>{}),R=M.useRef(()=>!1),O=M.useRef(()=>{}),z=M.useRef(!1),[B,W]=M.useState(!1),[A,I]=M.useState(!1),V=()=>{z.current=!z.current,W(z.current)};return M.useEffect(()=>{let U=!0;const ie=t?t.split("/"):[],ee=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function k(){let j=null,Y=null;try{const $=await(await Nt(`${ee}/sessions`,r)).json();Array.isArray($.sessions)&&(j=$.sessions.find(q=>q.name===e))}catch{}try{const Q=await an(r,ie);Q.available&&Array.isArray(Q.cells)&&(Y=Q.cells.find($=>$.tmuxSession===e))}catch{}if(!U)return;let F="";Y?F=`${Y.engine}${Y.key?`·${Y.key}`:""}`:j&&(F=j.attached?`attached · ${Ug(j.activity)}`:j.activity?Ug(j.activity):""),b(F)}k();const D=setInterval(k,4e3);return()=>{U=!1,clearInterval(D)}},[e,t,r]),h.jsxs("div",{className:"nc-app",children:[h.jsxs("header",{className:"nc-bar nc-bar-single",children:[h.jsxs("button",{onClick:o,title:S("sessions"),children:[h.jsx(He,{name:"chevronLeft",size:18}),h.jsx("span",{className:"nc-bar-label",children:S("sessions")})]}),h.jsxs("span",{className:"nc-bar-center",children:[h.jsx("b",{children:t?`${t}:${e}`:e}),_&&h.jsx("small",{className:"nc-bar-sub",children:_})]}),h.jsxs("span",{className:"nc-bar-right",children:[h.jsx("button",{onClick:()=>E(-1),title:S("zoom-out"),children:h.jsx(He,{name:"zoomOut",size:18})}),h.jsx("button",{onClick:()=>E(1),title:S("zoom-in"),children:h.jsx(He,{name:"zoomIn",size:18})}),h.jsx("button",{onClick:()=>p(U=>!U),title:S("composer"),children:h.jsx(He,{name:"keyboard",size:20})}),h.jsx("button",{onClick:()=>u(U=>!U),title:S("files"),children:h.jsx(He,{name:"folder",size:20})})]})]}),h.jsx("div",{className:"nc-termwrap",children:h.jsx(Z_,{session:e,node:t,token:r,readonly:s,takeSize:!0,sendRef:N,composerRef:R,actionRef:O,ctrlRef:z,setCtrlArmed:W,onFiles:y,fontSize:w,selectionMode:A,onSelectionModeChange:I})}),h.jsx(Ib,{onKeyboard:()=>p(U=>!U),send:U=>N.current(U),action:U=>O.current(U),ctrlArmed:B,onCtrl:V,selectionMode:A,onSelectionMode:I}),d&&h.jsx(tv,{submitText:U=>R.current(U),token:r,session:e,node:t}),l&&h.jsx(ev,{session:e,node:t,token:r,filesEvent:m,onClose:()=>u(!1)})]})}function rk(){pi();const[e]=M.useState(ek),[t,r]=M.useState(e.token),[s,o]=M.useState(e.pair||""),l=M.useCallback(()=>{o("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[u,d]=M.useState(!1),p=ik(),[m]=M.useState(()=>hC(typeof location<"u"?location.pathname:"/")),[y,w]=M.useState(m.id),v=y===Fn(null,hi),[_,b]=M.useState(null),E=le=>b(Tr(le)),[N,R]=M.useState([]),[O,z]=M.useState([]),[B,W]=M.useState(()=>m.ownerId?zn():tk(m.name)),[A,I]=M.useState(null),[V,U]=M.useState(null),ie=le=>U(Tr(le)),ee=Dh(t,p),k=M.useMemo(()=>(ee||[]).filter(le=>le.instanceId).map(le=>({instanceId:le.instanceId,route:le.route,label:le.label,status:le.status})),[ee]),D=Wx(t,y,B,W,k),j=D.decks,Y=j.find(le=>le.id===y)||null;M.useEffect(()=>{const le=new Map;for(const xe of ee||[]){const Le=(xe.route||[xe.name]).join("/"),Pt=new Set((xe.sessions||[]).map(ri=>ri.name));for(const ri of xe.cells||[])!ri.cell||!ri.tmuxSession||ri.cell===ri.tmuxSession||Pt.has(ri.cell)||le.set(`${Le}:${ri.cell}`,`${Le}:${ri.tmuxSession}`)}W(xe=>Qb(xe,le))},[ee]),M.useEffect(()=>{D.localNodeId&&W(le=>{const xe=mh(le,D.localNodeId,k);return JSON.stringify(xe)===JSON.stringify(le)?le:xe})},[k,D.localNodeId]);const[F,Q]=M.useState(null),[$,q]=M.useState(!1),[G,P]=M.useState(Jx),[J,L]=M.useState(!v),[x,X]=M.useState(()=>v?localStorage.getItem($g)==="1":!0),[re,se]=M.useState(!1),[ae,de]=M.useState("nodes"),[ve,Oe]=M.useState(!1),[oe,pe]=M.useState(""),De=(le="nodes",xe=!1,Le="")=>{de(le),Oe(xe),pe(Le),se(!0)},[Xe,ot]=M.useState(!1),[zt,at]=M.useState(!1);M.useEffect(()=>{try{localStorage.setItem(Mv,String(G))}catch{}},[G]),M.useEffect(()=>{try{localStorage.setItem($g,x?"1":"")}catch{}},[x]),M.useEffect(()=>{if(!t)return;let le=!1;return Promise.all([Jg(t),Nt("/api/config",t).then(xe=>xe.json())]).then(([xe,Le])=>{le||(at(!!Le.readonlyDefault),(xe.firstRun===!0&&!Le.readonlyDefault||s)&&ot(!0))}).catch(()=>{}),()=>{le=!0}},[t,s]);const ht=M.useCallback(async()=>{try{const xe=await(await Nt("/api/sessions",t)).json();xe.error||R(xe.sessions||[])}catch{}try{const le=await an(t);z(le.available?le.cells||[]:[])}catch{z([])}},[t]);M.useEffect(()=>{if(!p)return;ht();const le=setInterval(ht,4e3);return()=>clearInterval(le)},[p,ht]),M.useEffect(()=>{let le=!1;return Nt("/api/config",t).then(xe=>xe.json()).then(xe=>{le||Kx(xe.version,xe.uiVersion,"0.8.10")}).catch(()=>{}),()=>{le=!0}},[t]);const Ge=new Set([...N.map(le=>le.name),...ee.flatMap(le=>le.sessions.map(xe=>xe.key))]),ki=Ki(B),ei=le=>W(xe=>{const Le=uv(le,D.localNodeId,k)||le,Pt=av(xe,Le);return Pt===xe&&Ki(xe).length>=9&&D.setError(S("grid-full")),Pt}),jr=async(le,xe=[])=>{try{await Eh(t,le,xe)}catch{return}const Le=xe.length?`${xe.join("/")}:${le}`:le;W(Pt=>za(Pt,Le)),ht()},Br=async le=>{if(!F)return;const{cell:xe}=F,Le=Array.isArray(F.route)?F.route:[];le.action==="up"?await xh(t,{cell:xe,boot:!!le.boot,...le.engine?{engine:le.engine}:{},...le.model!==void 0?{model:le.model}:{},...le.permissionPolicy?{permissionPolicy:le.permissionPolicy}:{}},Le):await Pa(t,{cell:xe,boot:!!le.boot},Le),ht()},Ir=async le=>{if(!(!(le!=null&&le.direct)||$)){q(!0);try{await Rh(t,le.name,le.tunnelStatus==="up"?"down":"up")}finally{q(!1)}}},Ar=le=>{const xe=j.find(Le=>Le.id===le);if(!xe)return!1;try{const Le=window.open(eu(xe,t),"_blank");return Le&&(Le.opener=null),!!Le}catch{return!1}},Ft=async le=>{if(!le||le===y)return;const xe=await D.select(le),Le=D.records.find(Pt=>Pt.id===le);w(le),W(xe),I(null),U(null);try{history.replaceState(null,"",eu(Le||le,null))}catch{}},ti=async le=>{const xe=await D.add(le,Y&&Y.ownerId);await Ft(xe.id)},Yi=async(le,xe)=>{const Le=await D.rename(le,xe);if(le===y){w(Le.id),W(mh(Le.layout,D.localNodeId,k)),I(null),U(null);try{history.replaceState(null,"",eu(Le,null))}catch{}}},ii=async le=>{await D.remove(le),le===y&&await Ft(D.localMainId)},me=async(le,xe)=>{!xe||xe===y||(await D.addTileTo(xe,le),W(Le=>za(Le,le)))};if(!t)return h.jsxs("div",{className:"nc-auth",children:[h.jsx("p",{children:S("auth-prompt")}),h.jsx("input",{onChange:le=>r(le.target.value.trim()),placeholder:"token"}),h.jsxs("label",{children:[h.jsx("input",{type:"checkbox",checked:u,onChange:le=>d(le.target.checked)})," ",S("remember-device")]}),h.jsx("button",{onClick:()=>{(u?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const Ie=h.jsxs(h.Fragment,{children:[re&&h.jsx(jx,{token:t,initialTab:ae,initialLocation:oe,startNewCell:ve,onClose:()=>{se(!1),Oe(!1),pe("")}}),Xe&&h.jsx(Bx,{token:t,initialPair:s,onPairDone:l,onDone:()=>ot(!1)}),h.jsx(Hx,{token:t})]});if(!p)return _?h.jsxs(h.Fragment,{children:[h.jsx(qg,{session:_.session,node:_.node,token:t,readonly:zt,onBack:()=>b(null)}),Ie]}):h.jsxs(h.Fragment,{children:[h.jsx(hw,{onPick:E,token:t,onSettings:De}),Ie]});const $e=v||!J;return h.jsxs("div",{className:"nc-workspace",children:[$e&&h.jsx(qb,{sessions:N,cells:O,activeSessions:ki,nodeGroups:ee,onPick:ie,onAddTile:ei,onPower:Q,onNodePower:Ir,onKill:jr,onNew:()=>De("fleet",!0),onSettings:De,width:G,collapsed:x,onResize:P,onToggleCollapse:()=>X(le=>!le)}),h.jsxs("div",{className:"nc-workspace-main",children:[h.jsx(mC,{decks:j,currentDeck:y,onCreate:ti,onRename:Yi,onDelete:ii,onOpenWindow:Ar,onNavigate:Ft,saveState:D.saveState,error:D.error,sidebarVisible:$e,onToggleSidebar:v?null:()=>L(le=>!le)}),h.jsx(sC,{layout:B,onLayoutChange:W,token:t,readonly:zt,sessionsAlive:Ge,focusSession:A,onFocus:I,onOpenSingle:ie,decks:j,currentDeck:y,onSendToDeck:me})]}),V&&h.jsx("div",{className:"nc-single-overlay",children:h.jsx(qg,{session:V.session,node:V.node,token:t,readonly:zt,onBack:()=>U(null)})}),F&&h.jsx(Da,{cell:F,token:t,route:Array.isArray(F.route)?F.route:[],onConfirm:Br,onClose:()=>Q(null)}),Ie]})}function nk(){pi();const e=M.useSyncExternalStore(qx,Hg,Hg);if(!e.needed)return null;const t=e.kind==="install"?S("install-version-mismatch").replace("{v}",e.version):S("update-available").replace("{v}",e.version).replace(" "," ").trim();return h.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[h.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&h.jsx("button",{className:"nc-update-btn",onClick:Xx,children:S("reload")})]})}Yx();AS.createRoot(document.getElementById("root")).render(h.jsxs(DS.StrictMode,{children:[h.jsx(rk,{}),h.jsx(nk,{})]}));
91
+ `],{type:"application/json"}),I=URL.createObjectURL(A),V=document.createElement("a");V.href=I,V.download=`nexuscrew-cells-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(V),V.click(),V.remove(),setTimeout(()=>URL.revokeObjectURL(I),0),_("")},O=async W=>{if(_(""),w([]),!!W){if(W.size>1024*1024){_(S("fleet-backup-too-large"));return}try{const A=yx(await W.text());if(!A.ok){_(S(`fleet-backup-${A.error}`));return}w(A.cells.map(I=>{const V=b.includes(I.engine),U=E.has(I.id);return{cell:I,engine:V?I.engine:"",selected:V&&!U,exists:U}}))}catch(A){_(String(A.message||A))}}},z=(W,A)=>w(I=>I.map((V,U)=>U===W?{...V,...A}:V)),B=y.filter(W=>W.selected&&W.engine);return h.jsxs("div",{className:"nc-set-form nc-fleet-form nc-backup-dialog",children:[h.jsx("b",{children:S("fleet-backup")}),h.jsx("small",{children:S("fleet-backup-help")}),h.jsxs("div",{className:"nc-set-tabs nc-backup-tabs",children:[h.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="export"?" on":""}`,onClick:()=>{d("export"),_("")},children:S("fleet-backup-export")}),h.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="import"?" on":""}`,disabled:!s,title:s?"":S("fleet-backup-restore-unavailable"),onClick:()=>{d("import"),_("")},children:S("fleet-backup-import")})]}),u==="export"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>m(new Set(e.map(W=>W.id))),children:S("select-all")}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>m(new Set),children:S("select-none")})]}),h.jsxs("div",{className:"nc-backup-list",children:[e.map(W=>h.jsxs("label",{className:"nc-check nc-backup-row",children:[h.jsx("input",{type:"checkbox",checked:p.has(W.id),onChange:()=>N(W.id)}),h.jsxs("span",{children:[h.jsx("b",{children:W.id}),h.jsxs("small",{children:[W.engine," · ",S("fleet-system-prompt")," ",(W.prompt||"").length," ",S("characters")]})]})]},W.id)),!e.length&&h.jsx("div",{className:"nc-empty",children:S("fleet-backup-empty")})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:l,children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:!p.size,onClick:R,children:S("fleet-backup-download")})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{type:"file",accept:"application/json,.json",disabled:r,onChange:W=>O(W.target.files&&W.target.files[0])}),h.jsx("small",{children:S("fleet-backup-import-help")}),!!y.length&&h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>w(W=>W.map(A=>({...A,selected:!!A.engine}))),children:S("select-all")}),h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>w(W=>W.map(A=>({...A,selected:!1}))),children:S("select-none")})]}),h.jsx("div",{className:"nc-backup-list",children:y.map((W,A)=>h.jsxs("div",{className:"nc-backup-import-row",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:W.selected,disabled:!W.engine,onChange:I=>z(A,{selected:I.target.checked})}),h.jsxs("span",{children:[h.jsx("b",{children:W.cell.id}),h.jsxs("small",{children:[W.exists?S("fleet-backup-overwrite"):S("fleet-backup-new")," · ",S("fleet-system-prompt")," ",W.cell.systemPrompt.length," ",S("characters")]})]})]}),h.jsxs("select",{value:W.engine,onChange:I=>z(A,{engine:I.target.value,selected:!!I.target.value}),children:[h.jsx("option",{value:"",children:S("fleet-backup-engine-missing")}),t.map(I=>h.jsx("option",{value:I.id,children:I.label||I.id},I.id))]})]},W.cell.id))}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",onClick:l,children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||!B.length,onClick:()=>o(B),children:S("fleet-backup-restore")})]})]}),v&&h.jsx("div",{className:"nc-err",children:v})]})}function Nx({state:e,setState:t,busy:r,onSave:s,catalog:o}){var v;const l=e.form,u=_=>t({...e,form:{...l,..._}}),d=l.envRows||[],p=[...new Map(o.map(_=>[_.client,_.clientLabel||_.client])).entries()],m=o.filter(_=>_.client===l.client),y=Fa(o,l),w=_=>{_&&u({client:_.client,provider:_.provider,credentialProfile:_.credentialProfile||"",managedModel:_.model||"",protocol:_.protocol||"",permissionPolicy:_.permissionPolicyDefault||"standard",rc:!!_.rc,displayName:_.custom?S("fleet-custom-provider-default"):"",baseUrl:_.custom?"":_.endpoint||"",envKey:_.defaultEnvKey||"",providerId:"nexuscrew-custom",...e.mode==="new"?{id:_.id,label:""}:{}})};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:e.mode==="new"?S("fleet-new-engine"):`${S("edit")} ${l.id}`}),h.jsx("input",{value:l.id,disabled:e.mode!=="new",placeholder:"id",onChange:_=>u({id:_.target.value})}),h.jsx("input",{value:l.label,placeholder:S("label"),onChange:_=>u({label:_.target.value})}),h.jsxs("select",{value:l.kind,disabled:e.mode!=="new",onChange:_=>u({kind:_.target.value}),children:[h.jsx("option",{value:"managed",children:S("fleet-managed")}),h.jsx("option",{value:"custom",children:S("fleet-custom")})]}),l.kind==="managed"?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("select",{value:l.client,disabled:e.mode!=="new",onChange:_=>w(o.find(b=>b.client===_.target.value&&b.default)||o.find(b=>b.client===_.target.value)),children:p.map(([_,b])=>h.jsx("option",{value:_,children:b},_))}),h.jsx("select",{value:((v=Fa(o,l))==null?void 0:v.id)||"",disabled:e.mode!=="new",onChange:_=>w(o.find(b=>b.id===_.target.value)),children:m.map(_=>h.jsx("option",{value:_.id,children:_.label},_.id))})]}),h.jsx("input",{value:l.managedModel,list:"nc-managed-models",placeholder:S(y!=null&&y.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:_=>u({managedModel:_.target.value})}),h.jsx("datalist",{id:"nc-managed-models",children:[...(y==null?void 0:y.models)||[],...l.modelOptions||[]].filter((_,b,E)=>_&&E.indexOf(_)===b).map(_=>h.jsx("option",{value:_},_))}),y!=null&&y.supportsUnsafe?h.jsxs("select",{value:l.permissionPolicy,onChange:_=>u({permissionPolicy:_.target.value}),children:[h.jsx("option",{value:"standard",children:S("fleet-standard-permissions")}),h.jsx("option",{value:"unsafe",children:S("fleet-unsafe-permissions")})]}):h.jsx("small",{children:S("fleet-standard-permissions")}),(y==null?void 0:y.supportsUnsafe)&&l.permissionPolicy==="unsafe"&&h.jsx("small",{className:"nc-err",children:S("fleet-unsafe-warning")}),(y==null?void 0:y.credentialEnv)&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.envKey,placeholder:S("fleet-api-key-env"),onChange:_=>u({envKey:_.target.value})}),h.jsx("small",{children:S("fleet-custom-secret-help")})]}),l.provider==="custom"&&h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.displayName,placeholder:S("fleet-provider-display"),onChange:_=>u({displayName:_.target.value})}),h.jsx("input",{value:l.baseUrl,placeholder:"https://api.example.com/v1",onChange:_=>u({baseUrl:_.target.value})}),((y==null?void 0:y.protocols)||[]).length>1&&h.jsx("select",{value:l.protocol,onChange:_=>u({protocol:_.target.value}),children:y.protocols.map(_=>h.jsx("option",{value:_,children:_},_))}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.envKey,placeholder:S("fleet-api-key-env"),onChange:_=>u({envKey:_.target.value})}),h.jsx("input",{value:l.providerId,placeholder:S("fleet-provider-id"),onChange:_=>u({providerId:_.target.value})})]}),h.jsxs("small",{children:[l.protocol," · ",S("fleet-custom-secret-help")]})]}),h.jsx("small",{children:S("fleet-managed-help")})]}):h.jsxs(h.Fragment,{children:[h.jsx("input",{value:l.command,placeholder:S("command-path"),onChange:_=>u({command:_.target.value})}),h.jsx("textarea",{value:l.argsText,placeholder:S("args-lines"),onChange:_=>u({argsText:_.target.value})}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:l.rc,onChange:_=>u({rc:_.target.checked})})," remote control"]}),h.jsxs("select",{value:l.promptMode,onChange:_=>u({promptMode:_.target.value}),children:[h.jsx("option",{value:"send-keys",children:"send-keys"}),h.jsx("option",{value:"flag",children:"flag"})]}),l.promptMode==="flag"&&h.jsx("input",{value:l.promptFlag,placeholder:"prompt flag",onChange:_=>u({promptFlag:_.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:l.modelFlag,placeholder:"model flag",onChange:_=>u({modelFlag:_.target.value})}),h.jsx("input",{value:l.modelValue,placeholder:"model default",onChange:_=>u({modelValue:_.target.value})})]}),h.jsx("small",{children:S("env-write-only")}),d.map((_,b)=>h.jsxs("div",{className:"nc-fleet-env",children:[h.jsx("input",{value:_.key,disabled:_.configured,placeholder:"ENV_KEY",onChange:E=>{const N=d.slice();N[b]={..._,key:E.target.value},u({envRows:N})}}),h.jsx("input",{type:"password",value:_.value,placeholder:_.configured?"•••••• (unchanged)":"value",onChange:E=>{const N=d.slice();N[b]={..._,value:E.target.value},u({envRows:N})}}),h.jsx("button",{className:"nc-btn danger",onClick:()=>u({envRows:d.filter((E,N)=>N!==b)}),children:"×"})]},`${_.key}-${b}`)),h.jsx("button",{className:"nc-btn ghost",onClick:()=>u({envRows:[...d,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:r||!l.id||l.kind==="custom"&&!l.command||l.kind==="managed"&&(y==null?void 0:y.requiresModel)&&!l.managedModel||l.kind==="managed"&&(y==null?void 0:y.credentialEnv)&&!l.envKey||l.kind==="managed"&&l.provider==="custom"&&(!l.displayName||!l.baseUrl||!l.envKey||!l.providerId),onClick:s,children:S("save")})]})]})}function Rx({token:e,route:t,targets:r=[],location:s,setLocation:o,state:l,setState:u,engines:d,busy:p,onSave:m}){const[y,w]=M.useState(null),[v,_]=M.useState(""),b=l.form,E=z=>u({...l,form:{...b,...z}}),N=d.find(z=>z.id===b.engine),R=z=>{var W,A,I;const B=d.find(V=>V.id===z);E({engine:z,model:((W=b.models)==null?void 0:W[z])||((A=B==null?void 0:B.managed)==null?void 0:A.model)||((I=B==null?void 0:B.model)==null?void 0:I.value)||""})},O=async z=>{try{const B=await Qg(e,z,t);w(B),E({cwd:B.path}),_("")}catch(B){_(String(B.message||B))}};return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsx("b",{children:l.mode==="new"?S("fleet-new-cell"):`${S("edit")} ${b.id}`}),l.mode==="new"&&h.jsxs("label",{className:"nc-field",children:[S("location"),h.jsx("span",{className:"nc-req",children:" *"}),h.jsxs("select",{value:s,onChange:z=>{o(z.target.value),E({engine:""})},children:[h.jsx("option",{value:"",children:S("local")}),r.map(z=>h.jsxs("option",{value:z.route.join("/"),disabled:z.status&&z.status!=="up",children:[z.label,z.status&&z.status!=="up"?` · ${S("node-offline")}`:""]},z.route.join("/")))]})]}),h.jsx("input",{value:b.id,disabled:l.mode!=="new",placeholder:"id",onChange:z=>E({id:z.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:b.cwd,placeholder:S("cwd"),onChange:z=>E({cwd:z.target.value})}),h.jsx("button",{className:"nc-btn ghost",onClick:()=>y?w(null):O(b.cwd),children:S("browse")})]}),y&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:y.path}),h.jsxs("div",{className:"nc-fs-list",children:[y.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>O(y.parent),children:["↑ ",S("fs-parent")]}),(y.dirs||[]).map(z=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>O(`${y.path.replace(/\/$/,"")}/${z}`),children:["📁 ",z]},z))]})]}),v&&h.jsx("div",{className:"nc-err",children:v}),h.jsx("select",{value:b.engine,onChange:z=>R(z.target.value),children:d.map(z=>h.jsx("option",{value:z.id,children:z.label},z.id))}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!b.boot,onChange:z=>E({boot:z.target.checked})})," boot"]}),h.jsx("input",{value:b.model||"",list:"nc-cell-models",placeholder:S("fleet-model-override"),onChange:z=>E({model:z.target.value})}),h.jsx("datalist",{id:"nc-cell-models",children:((N==null?void 0:N.availableModels)||[]).map(z=>h.jsx("option",{value:z},z))}),h.jsx("textarea",{value:b.prompt||"",placeholder:"prompt",onChange:z=>E({prompt:z.target.value})}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>u(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:p||!b.id||!b.cwd||!b.engine,onClick:m,children:S("save")})]})]})}function Fg({token:e,route:t=[],state:r,setState:s,busy:o,onSave:l}){const[u,d]=M.useState(null),[p,m]=M.useState([]),[y,w]=M.useState(""),v=Array.isArray(t)?t.join("/"):"";M.useEffect(()=>{let R=!0;return kh(e,v?v.split("/"):[]).then(O=>{R&&(m(O.engines||[]),w(""))}).catch(O=>{R&&(m([]),w(String(O.message||O)))}),()=>{R=!1}},[e,v]);const _=r.form,b=R=>s({...r,form:{..._,...R}}),E=async R=>{try{const O=await Qg(e,R,t);d(O),b({cwd:O.path})}catch{}},N=!_.id&&_.tmuxSession?_.tmuxSession.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32):_.id;return h.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[h.jsxs("b",{children:[S("import-as-cell")," · ",_.tmuxSession]}),h.jsx("small",{children:S("import-help")}),h.jsx("input",{value:_.tmuxSession,disabled:!0,placeholder:"tmux session",readOnly:!0}),h.jsx("input",{value:_.id,placeholder:S("name"),onChange:R=>b({id:R.target.value})}),h.jsxs("div",{className:"nc-fleet-pair",children:[h.jsx("input",{value:_.cwd,placeholder:S("cwd"),onChange:R=>b({cwd:R.target.value})}),h.jsx("button",{className:"nc-btn ghost",type:"button",onClick:()=>u?d(null):E(_.cwd),children:S("browse")})]}),u&&h.jsxs("div",{className:"nc-fs",children:[h.jsx("div",{className:"nc-fs-path",children:u.path}),h.jsxs("div",{className:"nc-fs-list",children:[u.parent&&h.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>E(u.parent),children:["↑ ",S("fs-parent")]}),(u.dirs||[]).map(R=>h.jsxs("button",{className:"nc-fs-item",onClick:()=>E(`${u.path.replace(/\/$/,"")}/${R}`),children:["📁 ",R]},R))]})]}),h.jsxs("select",{value:_.engine,onChange:R=>b({engine:R.target.value}),children:[h.jsx("option",{value:"",children:S("import-engine-required")}),p.map(R=>h.jsx("option",{value:R.id,children:R.label},R.id))]}),h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:!!_.boot,onChange:R=>b({boot:R.target.checked})})," boot"]}),(r.err||y)&&h.jsx("div",{className:"nc-err",children:r.err||y}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",onClick:()=>s(null),children:S("cancel")}),h.jsx("button",{className:"nc-btn primary",disabled:o||!_.tmuxSession||!_.engine||!p.length,onClick:l,children:S(N?"import-as-cell":"save")})]})]})}function Px({text:e}){const[t,r]=M.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}};return h.jsxs("div",{className:"nc-set-copyline",children:[h.jsx("code",{children:e}),h.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:s,children:[h.jsx(He,{name:"copy",size:14})," ",S(t?"copied":"copy")]})]})}function Dx({value:e}){const[t,r]=M.useState("");return M.useEffect(()=>{let s=!0;return OC.toDataURL(e,{margin:1,width:220}).then(o=>{s&&r(o)}).catch(()=>{}),()=>{s=!1}},[e]),t?h.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function Lx({token:e,nodes:t,settings:r,readonly:s,refresh:o}){const[l,u]=M.useState(null),[d,p]=M.useState(null),[m,y]=M.useState({}),[w,v]=M.useState(null),[_,b]=M.useState({ssh:"",sshPort:"",name:""}),[E,N]=M.useState(""),[R,O]=M.useState(""),[z,B]=M.useState(!1),W=Date.now(),A=r&&r.deviceName||"",I=(t||[]).filter(k=>k&&k.direction==="outbound"&&k.name&&k.ssh),V=I.find(k=>k.name===E)||I[0]||null,U=async(k,D)=>{u(null),p(`${k}:${D}`);try{const j=await Rh(e,k,D);D==="test"&&y(Y=>({...Y,[k]:j})),await o()}catch(j){u(`${k}: ${String(j.message||j)}`)}p(null)},ie=async k=>{if(window.confirm(S("node-remove-confirm").replace("{name}",k))){u(null),p(`${k}:remove`);try{await XS(e,k),await o()}catch(D){u(`${k}: ${String(D.message||D)}`)}p(null)}},ee=async()=>{if(u(null),V){const j=Lg({name:V.name,ssh:V.ssh,sshPort:V.sshPort||""});if(!j.ok){u(S(j.error));return}p("invite");try{v(await Hp(e,{ssh:j.value.ssh,...j.value.sshPort?{sshPort:j.value.sshPort}:{}},[V.name]))}catch(Y){u(String(Y.message||Y))}p(null);return}const k=Hn(_.name||R||A||"NexusCrew"),D=Lg({name:k,ssh:_.ssh,sshPort:_.sshPort});if(!D.ok){u(S(D.error));return}p("invite");try{v(await Hp(e,{...R||A?{label:R||A}:{},name:k,ssh:D.value.ssh,...D.value.sshPort?{sshPort:D.value.sshPort}:{}}))}catch(j){u(String(j.message||j))}p(null)};return h.jsxs("div",{className:"nc-set-tab",children:[h.jsx(Sv,{token:e,deviceDefault:A,readonly:s,onSuccess:o}),(t||[]).length===0&&h.jsx("div",{className:"nc-empty",children:S("no-nodes")}),(t||[]).map(k=>{var Y,F,Q,$,q;const D=qC(k.tunnel,W),j=m[k.name];return h.jsxs("div",{className:"nc-set-node",children:[h.jsxs("div",{className:"nc-set-node-head",children:[h.jsx("span",{className:`nc-dot ${D.up?"on":""}`}),h.jsx("b",{children:k.label||k.name}),h.jsxs("small",{children:[k.name,k.direction==="outbound"?` · SSH ${k.ssh||""}`:` · ${S("node-connected-client")}`,(Y=k.tunnel)!=null&&Y.transport?` · ${k.tunnel.transport} ${S("transport-used")}`:""]}),h.jsxs("span",{className:`nc-set-tunnel${D.up?" up":""}`,children:[S(D.label),D.since?` · ${D.since}`:""]}),k.shared&&h.jsxs("select",{value:k.visibility||"network",disabled:s||!!d,onChange:async G=>{p(`${k.name}:visibility`);try{await $p(e,k.name,G.target.value),await o()}catch(P){u(String(P.message||P))}p(null)},children:[h.jsx("option",{value:"network",children:S("visibility-network")}),h.jsx("option",{value:"relay-only",children:S("visibility-relay")}),h.jsx("option",{value:"selected",children:S("visibility-selected")})]})]}),k.direction==="outbound"?h.jsxs("label",{className:"nc-check nc-node-share",children:[h.jsx("input",{type:"checkbox",checked:k.shared===!0,disabled:s||!!d||!D.up&&!k.shared,onChange:async G=>{u(null),p(`${k.name}:share`);try{await GS(e,k.name,G.target.checked),await o()}catch(P){u(`${k.name}: ${String(P.message||P)}`)}p(null)}}),h.jsxs("span",{children:[h.jsx("b",{children:S("share-node")}),h.jsx("small",{children:S(k.shared?"share-node-on-desc":"share-node-off-desc")})]})]}):h.jsx("div",{className:"nc-set-info",children:S(k.shared?"peer-shared":"peer-private")}),k.shared&&k.visibility==="selected"&&h.jsx("div",{className:"nc-set-row",children:(t||[]).filter(G=>G.name!==k.name&&G.nodeId).map(G=>{const P=(k.selected||[]).includes(G.nodeId);return h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:P,disabled:s||!!d,onChange:async J=>{const L=J.target.checked?[...k.selected||[],G.nodeId]:(k.selected||[]).filter(x=>x!==G.nodeId);p(`${k.name}:visibility`);try{await $p(e,k.name,"selected",L),await o()}catch(x){u(String(x.message||x))}p(null)}})," ",G.name]},G.nodeId)})}),h.jsxs("div",{className:"nc-set-node-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:s||!!d,onClick:async()=>{const G=window.prompt(S("node-display-label"),k.label||k.name);if(G!=null){if(!_h(G)){u(S("err-label"));return}p(`${k.name}:label`);try{await YS(e,k.name,G),await o()}catch(P){u(String(P.message||P))}p(null)}},children:S("edit")}),((F=k.health)==null?void 0:F.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"test"),children:S("node-test")}),((Q=k.health)==null?void 0:Q.managed)!==!1&&(D.up?h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"down"),children:S("tunnel-stop")}):h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"up"),children:S("tunnel-start")})),(($=k.health)==null?void 0:$.managed)!==!1&&h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>U(k.name,"restart"),children:S("tunnel-restart")}),h.jsx("button",{type:"button",className:"nc-btn danger",disabled:s||!!d,title:S(s?"settings-readonly":"terminate"),onClick:()=>ie(k.name),children:h.jsx(He,{name:"trash",size:14})})]}),((q=k.health)==null?void 0:q.detail)&&h.jsx("div",{className:`nc-set-test${k.health.status==="healthy"?" ok":k.health.status==="passive"?"":" ko"}`,children:k.health.detail}),j&&h.jsxs("div",{className:`nc-set-test${j.ok?" ok":" ko"}`,children:[j.result,j.detail?` — ${j.detail}`:""]})]},k.name)}),h.jsxs("div",{className:"nc-set-form",children:[h.jsx("div",{className:"nc-sheet-label",children:S("invite-node")}),h.jsx("small",{className:"nc-set-hint",children:S(V?"invite-network-hint":"invite-v2-hint")}),V?h.jsxs(h.Fragment,{children:[I.length>1&&h.jsxs("label",{className:"nc-field",children:[S("invite-network-label"),h.jsx("select",{value:V.name,disabled:s||!!d,onChange:k=>{N(k.target.value),v(null)},children:I.map(k=>h.jsx("option",{value:k.name,children:k.label||k.name},k.name))})]}),h.jsxs("div",{className:"nc-set-info nc-invite-endpoint",children:[S("invite-network-via"),": ",h.jsx("b",{children:V.label||V.name})," · ",V.ssh,V.sshPort?`:${V.sshPort}`:""]}),h.jsx("small",{className:"nc-set-hint",children:S("invite-network-route")})]}):h.jsxs("label",{className:"nc-field",children:[S("invite-endpoint-label"),h.jsx("input",{placeholder:"user@host",value:_.ssh,disabled:s,onChange:k=>b({..._,ssh:k.target.value})}),h.jsx("small",{className:"nc-set-hint",children:S("invite-endpoint-needed")})]}),!V&&z&&h.jsxs("div",{className:"nc-invite-advanced",children:[h.jsxs("label",{className:"nc-field",children:[S("node-ssh-port-label"),h.jsx("input",{inputMode:"numeric",placeholder:"22",value:_.sshPort,disabled:s,onChange:k=>b({..._,sshPort:k.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),h.jsxs("label",{className:"nc-field",children:[S("device-name-label"),h.jsx("input",{placeholder:A||"NexusCrew",value:R,disabled:s,onChange:k=>O(k.target.value)}),h.jsx("small",{className:"nc-set-hint",children:S("device-name-hint")})]}),h.jsxs("label",{className:"nc-field",children:[S("node-name-label"),h.jsx("input",{placeholder:Hn(R||A||S("node-name-ph")),value:_.name,disabled:s,onChange:k=>b({..._,name:k.target.value?Hn(k.target.value):""})})]})]}),h.jsxs("div",{className:"nc-set-row nc-invite-actions",children:[h.jsx("button",{type:"button",className:"nc-btn primary",disabled:s||!!d||!V&&!_.ssh.trim(),onClick:ee,children:S("create-pairing-link")}),!V&&h.jsxs("button",{type:"button",className:"nc-btn ghost",disabled:!!d,onClick:()=>B(k=>!k),children:[z?"▾":"▸"," ",S("pair-advanced")]})]}),w&&h.jsxs(h.Fragment,{children:[h.jsx(Dx,{value:w.pairingUrl}),h.jsx(Px,{text:w.pairingUrl}),h.jsx("div",{className:"nc-set-info",children:S("invite-next-steps")})]})]}),l&&h.jsx("div",{className:"nc-err",children:l})]})}function Mx({token:e,readonly:t}){const[r,s]=M.useState("idle"),[o,l]=M.useState(!1),[u,d]=M.useState(null);M.useEffect(()=>{let m=!1;return lx().then(y=>{m||s(y)}),()=>{m=!0}},[]);const p=async()=>{d(null),l(!0);try{r==="subscribed"?(await ux(e),s("idle")):(await cx(e),s("subscribed"))}catch(m){const y=String(m.message||m);y==="push-denied"?(s("denied"),d(S("push-denied"))):y==="push-unsupported"?(s("unsupported"),d(S("push-unsupported"))):d(y)}l(!1)};return r==="unsupported"?h.jsx("div",{className:"nc-set-info",children:S("push-unsupported")}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||o||r==="denied",title:t?S("settings-readonly"):"",onClick:p,children:S(r==="subscribed"?"push-disable":"push-enable")}),h.jsx("span",{className:"nc-set-info",children:S(r==="subscribed"?"push-on":r==="denied"?"push-denied":"push-off")})]}),u&&h.jsx("div",{className:"nc-err",children:u})]})}function Tx({token:e,settings:t,readonly:r,refresh:s}){const[o,l]=M.useState(null),[u,d]=M.useState(null),[p,m]=M.useState(!1),[y,w]=M.useState(!1),[v,_]=M.useState(null),[b,E]=M.useState(!0);M.useEffect(()=>{_(t&&t.update||null),E(!t||t.autoUpdate!==!1)},[t]);const N=async()=>{l(null),d(null),w(!0);try{const A=await KS(e);d(A.note||"ok"),m(!1)}catch(A){l(String(A.message||A))}w(!1)},R=async()=>{l(null),d(null),w(!0);try{const A=await QS(e);d(`${A.note||"ok"}${A.target?` (${A.target})`:""}`)}catch(A){l(String(A.message||A))}w(!1)},O=async A=>{l(null),d(null),w(!0);try{await t_(e,{autoUpdate:A}),E(A),s&&await s()}catch(I){l(String(I.message||I))}w(!1)},z=async()=>{l(null),d(null),w(!0);try{_(await JS(e))}catch(A){l(String(A.message||A))}w(!1)},B=async()=>{l(null),d(null),w(!0);try{const A=await ZS(e);_(A),d(S("npm-update-restarting"))}catch(A){l(String(A.message||A))}w(!1)},W=t&&t.service;return h.jsxs("div",{className:"nc-set-tab",children:[t&&h.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,h.jsx("br",{}),W&&W.installed?S("service-installed"):S("service-missing"),W&&W.installed?` · ${W.active?S("service-active"):S("service-inactive")}`:"",W?` · boot ${W.boot?"on":"off"}`:""]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y,title:r?S("settings-readonly"):"",onClick:()=>{l(null),d(null),m(!0)},children:S("token-rotate")}),h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y,title:r?S("settings-readonly"):"",onClick:R,children:S("service-regenerate")})]}),h.jsxs("div",{className:"nc-set-form nc-update-settings",children:[h.jsxs("label",{className:"nc-check",children:[h.jsx("input",{type:"checkbox",checked:b,disabled:r||y||v&&!v.supported,onChange:A=>O(A.target.checked)}),h.jsxs("span",{children:[h.jsx("b",{children:S("npm-auto-update")}),h.jsx("small",{children:S("npm-auto-update-help")})]})]}),v&&h.jsxs("div",{className:"nc-set-info",children:[S("npm-update-current")," v",v.current,v.latest?` · ${S("npm-update-latest")} v${v.latest}`:""," · ",S(`npm-update-${v.supported?v.phase:"unsupported"}`)]}),h.jsxs("div",{className:"nc-set-row",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:r||y||!v||!v.supported,onClick:z,children:S("npm-update-check")}),v&&v.available&&h.jsx("button",{type:"button",className:"nc-btn primary",disabled:r||y||v.phase==="installing",onClick:B,children:S("npm-update-install")})]}),v&&v.lastError&&h.jsx("div",{className:"nc-err",children:v.lastError})]}),h.jsx(Mx,{token:e,readonly:r}),p&&h.jsxs("div",{className:"nc-set-confirm",children:[h.jsx("div",{children:S("token-rotate-explain")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:y,onClick:()=>m(!1),children:S("cancel")}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:y,onClick:N,children:S("confirm")})]})]}),u&&h.jsx("div",{className:"nc-set-note",children:u}),o&&h.jsx("div",{className:"nc-err",children:o})]})}function jx({token:e,onClose:t,initialTab:r="nodes",initialLocation:s="",startNewCell:o=!1}){pi();const[l,u]=M.useState(r),[d,p]=M.useState(null),[m,y]=M.useState([]),[w,v]=M.useState(!1),[_,b]=M.useState(null),E=Dh(e),N=M.useCallback(async()=>{try{const R=await Jg(e);p(R),b(null)}catch(R){b(String(R.message||R))}try{const R=await Zg(e);y(R.nodes||[])}catch(R){b(String(R.message||R))}},[e]);return M.useEffect(()=>{N();const R=setInterval(N,5e3);return()=>clearInterval(R)},[N]),M.useEffect(()=>{let R=!1;return Nt("/api/config",e).then(O=>O.json()).then(O=>{R||v(!!O.readonlyDefault)}).catch(()=>{}),()=>{R=!0}},[e]),h.jsx("div",{className:"nc-set-overlay",onClick:t,children:h.jsxs("div",{className:"nc-set-panel",onClick:R=>R.stopPropagation(),children:[h.jsxs("div",{className:"nc-set-head",children:[h.jsx(He,{name:"gear",size:18}),h.jsx("b",{children:S("settings")}),h.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:S("close"),children:h.jsx(He,{name:"x",size:18})})]}),w&&h.jsx("div",{className:"nc-set-readonly",children:S("settings-readonly")}),_&&h.jsx("div",{className:"nc-err",children:_}),h.jsx("div",{className:"nc-set-tabs",children:["nodes","fleet","system"].map(R=>h.jsx("button",{type:"button",className:`nc-set-tabbtn${l===R?" on":""}`,onClick:()=>u(R),children:S(`tab-${R}`)},R))}),h.jsxs("div",{className:"nc-set-body",children:[l==="nodes"&&h.jsx(Lx,{token:e,nodes:m,settings:d,readonly:w,refresh:N}),l==="fleet"&&h.jsx(kx,{token:e,readonly:w,startNewCell:o,initialLocation:s,targets:E.map(R=>({route:R.route,label:R.label||R.name,status:R.status}))}),l==="system"&&h.jsx(Tx,{token:e,settings:d,readonly:w,refresh:N})]})]})})}function Bx({token:e,initialPair:t,onPairDone:r,onDone:s}){pi();const[o,l]=M.useState(t?"pair":"welcome"),[u,d]=M.useState(!1),[p,m]=M.useState(null),y=async()=>{d(!0),m(null);try{await t_(e,{wizardDone:!0}),r&&r(),s()}catch(w){m(String(w.message||w)),d(!1)}};return h.jsx("div",{className:"nc-wiz-overlay",children:h.jsxs("div",{className:"nc-wiz",children:[h.jsxs("div",{className:"nc-wiz-head",children:[h.jsx("b",{children:S("wizard-title")}),h.jsx("small",{children:S("hydra-simple")})]}),o==="welcome"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:S("local-ready")}),h.jsxs("div",{className:"nc-sheet-actions",children:[h.jsx("button",{className:"nc-btn ghost",disabled:u,onClick:y,children:S("local-only")}),h.jsx("button",{className:"nc-btn primary",disabled:u,onClick:()=>l("pair"),children:S("add-node")})]})]}),o==="pair"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx(Sv,{token:e,initial:t||"",autoStart:!!t,onBusyChange:d,onSuccess:async()=>{r&&r(),l("done")}}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{className:"nc-btn ghost",disabled:u,onClick:()=>{r&&r(),l("welcome")},children:S("back")})})]}),o==="done"&&h.jsxs("div",{className:"nc-wiz-body",children:[h.jsx("div",{className:"nc-wiz-done",children:S("node-connected")}),h.jsx("div",{className:"nc-sheet-actions",children:h.jsx("button",{className:"nc-btn primary",disabled:u,onClick:y,children:S("finish")})})]}),p&&h.jsx("div",{className:"nc-err",children:p})]})})}function Ix(e,t){if(typeof EventSource>"u"||!e)return()=>{};const r=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return r.onmessage=s=>{try{const o=JSON.parse(s.data);o&&typeof o=="object"&&typeof o.type=="string"&&t(o)}catch{}},()=>{try{r.close()}catch{}}}const Ax=6e3,Ox=12e3;function zx({n:e,onClose:t}){return h.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[h.jsxs("div",{className:"nc-ntf-toast-txt",children:[h.jsx("b",{children:e.title}),e.body&&h.jsx("small",{children:e.body}),e.session&&h.jsx("span",{className:"nc-ntf-from",children:e.session})]}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:S("close"),children:h.jsx(He,{name:"x",size:14})})]})}function Fx({ask:e,token:t,onAnswered:r}){const[s,o]=M.useState(""),[l,u]=M.useState(!1),[d,p]=M.useState(null),m=async y=>{const w=String(y||"").trim();if(!(!w||l)){p(null),u(!0);try{await tw(t,e.id,w),r(e.id)}catch(v){p(String(v.message||v))}u(!1)}};return h.jsxs("div",{className:"nc-ask-card",children:[h.jsxs("div",{className:"nc-ask-head",children:[h.jsx("span",{className:"nc-ntf-from",children:e.session}),h.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),h.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&h.jsx("div",{className:"nc-ask-opts",children:e.options.map(y=>h.jsx("button",{type:"button",className:"nc-btn ghost",disabled:l,onClick:()=>m(y),children:y},y))}),h.jsxs("div",{className:"nc-ask-reply",children:[h.jsx("textarea",{rows:2,placeholder:S("ask-reply-ph"),value:s,disabled:l,onChange:y=>o(y.target.value)}),h.jsx("button",{type:"button",className:"nc-btn primary",disabled:l||!s.trim(),onClick:()=>m(s),children:S("send")})]}),d&&h.jsx("div",{className:"nc-err",children:d})]})}function Hx({token:e}){pi();const[t,r]=M.useState([]),[s,o]=M.useState([]),[l,u]=M.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),d=M.useRef(0),p=M.useCallback(w=>{r(v=>v.filter(_=>_.key!==w))},[]),m=M.useCallback(w=>{const v=`t${d.current+=1}`;r(_=>[..._.slice(-3),{...w,key:v}]),setTimeout(()=>p(v),w.urgency==="high"?Ox:Ax)},[p]);M.useEffect(()=>{if(!e)return;let w=!1;ew(e).then(_=>{w||o(_.asks||[])}).catch(()=>{});const v=Ix(e,_=>{_.type==="notify"?m(_):_.type==="ask"&&_.ask&&_.ask.id?o(b=>b.some(E=>E.id===_.ask.id)?b:[...b,_.ask]):_.type==="ask-answered"&&_.id&&o(b=>b.filter(E=>E.id!==_.id))});return()=>{w=!0,v()}},[e,m]);const y=w=>o(v=>v.filter(_=>_.id!==w));return h.jsxs(h.Fragment,{children:[t.length>0&&h.jsx("div",{className:"nc-ntf-toasts",children:t.map(w=>h.jsx(zx,{n:w,onClose:()=>p(w.key)},w.key))}),s.length>0&&!l&&h.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>u(!0),title:S("asks-title"),children:["? ",h.jsx("span",{className:"nc-ask-count",children:s.length})]}),s.length>0&&l&&h.jsxs("div",{className:"nc-ask-panel",children:[h.jsxs("div",{className:"nc-ask-panel-head",children:[h.jsx("b",{children:S("asks-title")}),h.jsx("span",{className:"nc-ask-count",children:s.length}),h.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>u(!1),title:S("close"),children:h.jsx(He,{name:"x",size:16})})]}),h.jsx("div",{className:"nc-ask-panel-body",children:s.map(w=>h.jsx(Fx,{ask:w,token:e,onAnswered:y},w.id))})]})]})}const xu=e=>Ki(nn(e)).length===0,ku=e=>Array.isArray(e)?e.join("/"):"";function $x(e){const t=new Set,r=[];for(const s of Array.isArray(e)?e:[])!s||!ji.test(String(s.instanceId||""))||!Array.isArray(s.route)||!s.route.length||t.has(s.instanceId)||(t.add(s.instanceId),r.push({instanceId:s.instanceId,route:[...s.route],label:String(s.label||s.name||s.route.join(" › ")),status:s.status||"offline"}));return r.sort((s,o)=>s.label.localeCompare(o.label))}function Os(e){return{instanceId:e.ownerId,route:e.ownerRoute||[],label:e.ownerLabel,status:e.available===!1?"offline":"up"}}function Jr(e,t,r,s=!1,o=!0){const l=t.instanceId;return{...e,id:Fn(s?null:l,e.name),ownerId:l,ownerRoute:s?[]:[...t.route],ownerLabel:s?"Local":t.label,local:s,available:o,ownerTopology:Array.isArray(r)?r:[],layout:ph(e.layout,l,r)}}function Wx(e,t,r,s,o=[]){const[l,u]=M.useState([]),[d,p]=M.useState(!1),[m,y]=M.useState("idle"),[w,v]=M.useState(""),[_,b]=M.useState(""),E=M.useRef([]),N=M.useRef([]),R=M.useRef(""),O=M.useRef(t),z=M.useRef(r),B=M.useRef(!1),W=M.useRef(!0),A=M.useRef(""),I=M.useMemo(()=>$x(o),[o]),V=I.map(q=>`${q.instanceId}:${ku(q.route)}:${q.status}:${q.label}`).join("|");N.current=I,z.current=r,O.current=t,E.current=l;const U=M.useCallback(q=>mh(q.layout,R.current,N.current),[]),ie=M.useCallback((q,G=!0,P=O.current)=>{const J=E.current.some(x=>x.id===P);E.current=q,u(q);const L=q.find(x=>x.id===P);if(G&&L){W.current=!0;const x=U(L);s(x),L.local&&pC(L.name,x)}else J&&!L&&(W.current=!0,s(zn()),v("deck non più condiviso dal nodo owner"));fC(q.filter(x=>x.local).map(x=>x.name))},[s,U]),ee=M.useCallback(async q=>{let G=await ua(e);const P=G.decks.find(J=>J.name==="main");if(G.decks.length===1&&P&&P.revision===0&&xu(P.layout)){const J=dC(),L=nn(gh("main")||zn());if(!xu(L)){const x=ph(L,q,[]);G.decks[0]=await ha(e,"main",x,0,[])}for(const x of J.filter(X=>X!=="main"))try{let X=await Wp(e,x,[]);const re=nn(gh(x)||zn());xu(re)||(X=await ha(e,x,ph(re,q,[]),X.revision,[]))}catch{}G=await ua(e)}return G},[e]),k=M.useCallback(async({migrate:q=!1}={})=>{const G=await Nh(e,[]),P=ji.test(String(G.instanceId||""))?G.instanceId:"";if(!P)throw new Error("instanceId locale non disponibile");R.current=P,b(P);const[J,L]=await Promise.all([q?ee(P):ua(e),Fp(e,[]).catch(()=>({nodes:[]}))]),x={instanceId:P,route:[],label:"Local"},X=J.decks.map(se=>Jr(se,x,L.nodes,!0,!0)),re=E.current;return await Promise.all(N.current.map(async se=>{if(se.status!=="up"){X.push(...re.filter(ae=>!ae.local&&ae.ownerId===se.instanceId).map(ae=>({...ae,ownerRoute:[...se.route],ownerLabel:se.label,available:!1})));return}try{const[ae,de]=await Promise.all([ua(e,se.route),Fp(e,se.route).catch(()=>({nodes:[]}))]);X.push(...ae.decks.map(ve=>Jr(ve,se,de.nodes,!1,!0)))}catch{X.push(...re.filter(de=>!de.local&&de.ownerId===se.instanceId).map(de=>({...de,ownerRoute:[...se.route],ownerLabel:se.label,available:!1})))}})),X.sort((se,ae)=>se.local===ae.local?se.ownerLabel.localeCompare(ae.ownerLabel)||(se.name==="main"?-1:ae.name==="main"?1:se.name.localeCompare(ae.name)):se.local?-1:1),X},[e,ee,V]);M.useEffect(()=>{if(!e)return;let q=!1;const G=A.current!==e;return A.current=e,k({migrate:G}).then(P=>{if(q)return;const J=E.current.find(X=>X.id===O.current),L=P.find(X=>X.id===O.current),x=L&&(!J||L.revision>J.revision||J.available!==L.available||ku(J.ownerRoute)!==ku(L.ownerRoute));ie(P,G||!!x&&!B.current),p(!0),L&&v("")}).catch(P=>{q||(p(!0),v(String(P.message||P)))}),()=>{q=!0}},[ie,k,V,e]);const D=M.useCallback(async(q=O.current)=>{if(!d||!B.current)return!0;const G=E.current.find(P=>P.id===q);if(!G)return v(`deck inesistente: ${q}`),!1;if(G.available===!1)return v(`nodo owner offline: ${G.ownerLabel}`),!1;y("saving");try{const P=eg(nn(z.current),G.ownerId,G.ownerTopology),J=await ha(e,G.name,P,G.revision,G.ownerRoute),L=Jr(J,Os(G),G.ownerTopology,G.local,!0);return ie(E.current.map(x=>x.id===q?L:x),!1),B.current=!1,y("saved"),v(""),setTimeout(()=>y("idle"),1500),!0}catch(P){if(y("error"),v(String(P.message||P)),P.status===409&&P.data&&P.data.current){const J=E.current.find(x=>x.id===q),L=Jr(P.data.current,Os(J),J.ownerTopology,J.local,!0);ie(E.current.map(x=>x.id===q?L:x),!1)}return!1}},[d,e,ie]);return M.useEffect(()=>{if(!d)return;if(W.current){W.current=!1;return}B.current=!0,y("saving");const q=setTimeout(D,650);return()=>clearTimeout(q)},[r,d,D]),M.useEffect(()=>{if(!d)return;const q=setInterval(async()=>{try{const G=await k(),P=E.current.find(x=>x.id===O.current),J=G.find(x=>x.id===O.current),L=J&&(!P||J.revision>P.revision||P.available!==J.available);ie(G,L&&!B.current)}catch{}},5e3);return()=>clearInterval(q)},[d,k,ie]),{decks:l,records:l,localNodeId:_,ready:d,saveState:m,error:w,setError:v,saveNow:D,select:async q=>{if(B.current&&!await D(O.current))throw new Error("salvataggio del deck corrente fallito: cambio annullato");const G=E.current.find(P=>P.id===q);if(!G)throw new Error(`deck inesistente: ${q}`);return B.current=!1,W.current=!0,U(G)},add:async(q,G=null)=>{const P=G?E.current.find(x=>x.ownerId===G):E.current.find(x=>x.id===O.current)||E.current.find(x=>x.local);if(!P||P.available===!1)throw new Error("nodo owner non disponibile");const J=await Wp(e,q,P.ownerRoute),L=Jr(J,Os(P),P.ownerTopology,P.local,!0);return ie([...E.current,L],!1),L},rename:async(q,G)=>{const P=E.current.find(X=>X.id===q);if(!P)throw new Error("deck inesistente");if(q===O.current&&B.current&&!await D(q))throw new Error(`salvataggio di "${P.name}" fallito: rinomina annullata`);const J=E.current.find(X=>X.id===q);if(!J)throw new Error("deck inesistente");const L=await iw(e,J.name,G,J.revision,J.ownerRoute),x=Jr(L,Os(J),J.ownerTopology,J.local,!0);return ie(E.current.map(X=>X.id===q?x:X),!1),x},remove:async q=>{const G=E.current.find(P=>P.id===q);if(!G)throw new Error("deck inesistente");q===O.current&&(B.current=!1),await rw(e,G.name,G.revision,G.ownerRoute),ie(E.current.filter(P=>P.id!==q),!1)},addTileTo:async(q,G)=>{const P=E.current.find(se=>se.id===q);if(!P)throw new Error("deck inesistente");if(P.available===!1)throw new Error(`nodo owner offline: ${P.ownerLabel}`);const J=uv(G,R.current,N.current);if(!J)throw new Error("riferimento sessione non valido");const L=U(P),x=eg(av(L,J),P.ownerId,P.ownerTopology),X=await ha(e,P.name,x,P.revision,P.ownerRoute),re=Jr(X,Os(P),P.ownerTopology,P.local,!0);return ie(E.current.map(se=>se.id===q?re:se),!1),re},localMainId:Fn(null,"main"),parseDeckId:cv}}const Ux="/sw.js",vh="nc-sw-update";let yh=null,Sh=!1,wh=null,Ev=Object.freeze({needed:!1,kind:null,version:""}),Nv=!1;function Rv(){typeof window<"u"&&window.dispatchEvent(new Event(vh))}function Pv(){const e=wh||(Sh?{kind:"reload",version:""}:null);Ev=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function Hg(){return Ev}function qx(e){return typeof window>"u"?()=>{}:(window.addEventListener(vh,e),()=>window.removeEventListener(vh,e))}function Kh(e){Sh!==e&&(Sh=e,Pv(),Rv())}function Kx(e,t,r){let s=null;e&&t&&e!==t?s={kind:"install",version:e}:t&&r&&t!==r&&(s={kind:"reload",version:t});const o=JSON.stringify(s)===JSON.stringify(wh);wh=s,Pv(),o||Rv()}function Vx(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Kh(!0)})}function Yx(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Nv&&location.reload()}),navigator.serviceWorker.register(Ux).then(e=>{yh=e,e.waiting&&Kh(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&Vx(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function Xx(){Nv=!0,Kh(!1);const e=yh&&yh.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function Gx({hash:e="",origin:t="",pathname:r="",search:s=""}={}){const o=String(e||"").replace(/^#/,""),l=`${r||""}${s||""}`;if(!o)return{token:"",pair:"",nextUrl:l};const u=new URLSearchParams(o),d=u.get("token")||"",p=u.get("pair")||"",m=p?`${t||""}${r||""}#pair=${p}`:"";return{token:d,pair:m,nextUrl:l}}const Dv=9,Lv=24,Mv="nc_side_w",$g="nc_side_min",Qx=240,Wg="(min-width:1024px) and (pointer:fine)";function Jx(){const e=Number(localStorage.getItem(Mv));return e>=180&&e<=480?e:Qx}function Zx(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Dv&&e<=Lv?e:13}function ek(){const e={token:"",pair:""};try{const{token:t,pair:r,nextUrl:s}=Gx({hash:location.hash,origin:location.origin,pathname:location.pathname,search:location.search});if(t){e.token=t;try{localStorage.setItem("nc_token",t)}catch{}}if(r){e.pair=r;try{sessionStorage.setItem("nc_pair",r)}catch{}}if(location.hash)try{history.replaceState(null,"",s)}catch{}}catch{}if(e.token||(e.token=sessionStorage.getItem("nc_token")||localStorage.getItem("nc_token")||""),!e.pair){const t=sessionStorage.getItem("nc_pair");t&&(e.pair=t)}return e}function tk(e){try{return nn(gh(e))}catch{return zn()}}function Ug(e){if(!e)return"";const t=Math.floor(Date.now()/1e3)-e;return t<0||t<60?"ora":t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}g`}function ik(){const[e,t]=M.useState(()=>window.matchMedia(Wg).matches);return M.useEffect(()=>{const r=window.matchMedia(Wg),s=o=>t(o.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),e}function qg({session:e,node:t,token:r,readonly:s=!1,onBack:o}){pi();const[l,u]=M.useState(!1),[d,p]=M.useState(()=>window.matchMedia("(pointer: coarse)").matches),[m,y]=M.useState(null),[w,v]=M.useState(Zx),[_,b]=M.useState(""),E=U=>v(ie=>{const ee=Math.max(Dv,Math.min(Lv,ie+U));return localStorage.setItem("nc_fontsize",String(ee)),ee}),N=M.useRef(()=>{}),R=M.useRef(()=>!1),O=M.useRef(()=>{}),z=M.useRef(!1),[B,W]=M.useState(!1),[A,I]=M.useState(!1),V=()=>{z.current=!z.current,W(z.current)};return M.useEffect(()=>{let U=!0;const ie=t?t.split("/"):[],ee=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function k(){let j=null,Y=null;try{const $=await(await Nt(`${ee}/sessions`,r)).json();Array.isArray($.sessions)&&(j=$.sessions.find(q=>q.name===e))}catch{}try{const Q=await an(r,ie);Q.available&&Array.isArray(Q.cells)&&(Y=Q.cells.find($=>$.tmuxSession===e))}catch{}if(!U)return;let F="";Y?F=`${Y.engine}${Y.key?`·${Y.key}`:""}`:j&&(F=j.attached?`attached · ${Ug(j.activity)}`:j.activity?Ug(j.activity):""),b(F)}k();const D=setInterval(k,4e3);return()=>{U=!1,clearInterval(D)}},[e,t,r]),h.jsxs("div",{className:"nc-app",children:[h.jsxs("header",{className:"nc-bar nc-bar-single",children:[h.jsxs("button",{onClick:o,title:S("sessions"),children:[h.jsx(He,{name:"chevronLeft",size:18}),h.jsx("span",{className:"nc-bar-label",children:S("sessions")})]}),h.jsxs("span",{className:"nc-bar-center",children:[h.jsx("b",{children:t?`${t}:${e}`:e}),_&&h.jsx("small",{className:"nc-bar-sub",children:_})]}),h.jsxs("span",{className:"nc-bar-right",children:[h.jsx("button",{onClick:()=>E(-1),title:S("zoom-out"),children:h.jsx(He,{name:"zoomOut",size:18})}),h.jsx("button",{onClick:()=>E(1),title:S("zoom-in"),children:h.jsx(He,{name:"zoomIn",size:18})}),h.jsx("button",{onClick:()=>p(U=>!U),title:S("composer"),children:h.jsx(He,{name:"keyboard",size:20})}),h.jsx("button",{onClick:()=>u(U=>!U),title:S("files"),children:h.jsx(He,{name:"folder",size:20})})]})]}),h.jsx("div",{className:"nc-termwrap",children:h.jsx(Z_,{session:e,node:t,token:r,readonly:s,takeSize:!0,sendRef:N,composerRef:R,actionRef:O,ctrlRef:z,setCtrlArmed:W,onFiles:y,fontSize:w,selectionMode:A,onSelectionModeChange:I})}),h.jsx(Ib,{onKeyboard:()=>p(U=>!U),send:U=>N.current(U),action:U=>O.current(U),ctrlArmed:B,onCtrl:V,selectionMode:A,onSelectionMode:I}),d&&h.jsx(tv,{submitText:U=>R.current(U),token:r,session:e,node:t}),l&&h.jsx(ev,{session:e,node:t,token:r,filesEvent:m,onClose:()=>u(!1)})]})}function rk(){pi();const[e]=M.useState(ek),[t,r]=M.useState(e.token),[s,o]=M.useState(e.pair||""),l=M.useCallback(()=>{o("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[u,d]=M.useState(!1),p=ik(),[m]=M.useState(()=>hC(typeof location<"u"?location.pathname:"/")),[y,w]=M.useState(m.id),v=y===Fn(null,hi),[_,b]=M.useState(null),E=le=>b(Tr(le)),[N,R]=M.useState([]),[O,z]=M.useState([]),[B,W]=M.useState(()=>m.ownerId?zn():tk(m.name)),[A,I]=M.useState(null),[V,U]=M.useState(null),ie=le=>U(Tr(le)),ee=Dh(t,p),k=M.useMemo(()=>(ee||[]).filter(le=>le.instanceId).map(le=>({instanceId:le.instanceId,route:le.route,label:le.label,status:le.status})),[ee]),D=Wx(t,y,B,W,k),j=D.decks,Y=j.find(le=>le.id===y)||null;M.useEffect(()=>{const le=new Map;for(const xe of ee||[]){const Le=(xe.route||[xe.name]).join("/"),Pt=new Set((xe.sessions||[]).map(ri=>ri.name));for(const ri of xe.cells||[])!ri.cell||!ri.tmuxSession||ri.cell===ri.tmuxSession||Pt.has(ri.cell)||le.set(`${Le}:${ri.cell}`,`${Le}:${ri.tmuxSession}`)}W(xe=>Qb(xe,le))},[ee]),M.useEffect(()=>{D.localNodeId&&W(le=>{const xe=mh(le,D.localNodeId,k);return JSON.stringify(xe)===JSON.stringify(le)?le:xe})},[k,D.localNodeId]);const[F,Q]=M.useState(null),[$,q]=M.useState(!1),[G,P]=M.useState(Jx),[J,L]=M.useState(!v),[x,X]=M.useState(()=>v?localStorage.getItem($g)==="1":!0),[re,se]=M.useState(!1),[ae,de]=M.useState("nodes"),[ve,Oe]=M.useState(!1),[oe,pe]=M.useState(""),De=(le="nodes",xe=!1,Le="")=>{de(le),Oe(xe),pe(Le),se(!0)},[Xe,ot]=M.useState(!1),[zt,at]=M.useState(!1);M.useEffect(()=>{try{localStorage.setItem(Mv,String(G))}catch{}},[G]),M.useEffect(()=>{try{localStorage.setItem($g,x?"1":"")}catch{}},[x]),M.useEffect(()=>{if(!t)return;let le=!1;return Promise.all([Jg(t),Nt("/api/config",t).then(xe=>xe.json())]).then(([xe,Le])=>{le||(at(!!Le.readonlyDefault),(xe.firstRun===!0&&!Le.readonlyDefault||s)&&ot(!0))}).catch(()=>{}),()=>{le=!0}},[t,s]);const ht=M.useCallback(async()=>{try{const xe=await(await Nt("/api/sessions",t)).json();xe.error||R(xe.sessions||[])}catch{}try{const le=await an(t);z(le.available?le.cells||[]:[])}catch{z([])}},[t]);M.useEffect(()=>{if(!p)return;ht();const le=setInterval(ht,4e3);return()=>clearInterval(le)},[p,ht]),M.useEffect(()=>{let le=!1;return Nt("/api/config",t).then(xe=>xe.json()).then(xe=>{le||Kx(xe.version,xe.uiVersion,"0.8.11")}).catch(()=>{}),()=>{le=!0}},[t]);const Ge=new Set([...N.map(le=>le.name),...ee.flatMap(le=>le.sessions.map(xe=>xe.key))]),ki=Ki(B),ei=le=>W(xe=>{const Le=uv(le,D.localNodeId,k)||le,Pt=av(xe,Le);return Pt===xe&&Ki(xe).length>=9&&D.setError(S("grid-full")),Pt}),jr=async(le,xe=[])=>{try{await Eh(t,le,xe)}catch{return}const Le=xe.length?`${xe.join("/")}:${le}`:le;W(Pt=>za(Pt,Le)),ht()},Br=async le=>{if(!F)return;const{cell:xe}=F,Le=Array.isArray(F.route)?F.route:[];le.action==="up"?await xh(t,{cell:xe,boot:!!le.boot,...le.engine?{engine:le.engine}:{},...le.model!==void 0?{model:le.model}:{},...le.permissionPolicy?{permissionPolicy:le.permissionPolicy}:{}},Le):await Pa(t,{cell:xe,boot:!!le.boot},Le),ht()},Ir=async le=>{if(!(!(le!=null&&le.direct)||$)){q(!0);try{await Rh(t,le.name,le.tunnelStatus==="up"?"down":"up")}finally{q(!1)}}},Ar=le=>{const xe=j.find(Le=>Le.id===le);if(!xe)return!1;try{const Le=window.open(eu(xe,t),"_blank");return Le&&(Le.opener=null),!!Le}catch{return!1}},Ft=async le=>{if(!le||le===y)return;const xe=await D.select(le),Le=D.records.find(Pt=>Pt.id===le);w(le),W(xe),I(null),U(null);try{history.replaceState(null,"",eu(Le||le,null))}catch{}},ti=async le=>{const xe=await D.add(le,Y&&Y.ownerId);await Ft(xe.id)},Yi=async(le,xe)=>{const Le=await D.rename(le,xe);if(le===y){w(Le.id),W(mh(Le.layout,D.localNodeId,k)),I(null),U(null);try{history.replaceState(null,"",eu(Le,null))}catch{}}},ii=async le=>{await D.remove(le),le===y&&await Ft(D.localMainId)},me=async(le,xe)=>{!xe||xe===y||(await D.addTileTo(xe,le),W(Le=>za(Le,le)))};if(!t)return h.jsxs("div",{className:"nc-auth",children:[h.jsx("p",{children:S("auth-prompt")}),h.jsx("input",{onChange:le=>r(le.target.value.trim()),placeholder:"token"}),h.jsxs("label",{children:[h.jsx("input",{type:"checkbox",checked:u,onChange:le=>d(le.target.checked)})," ",S("remember-device")]}),h.jsx("button",{onClick:()=>{(u?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const Ie=h.jsxs(h.Fragment,{children:[re&&h.jsx(jx,{token:t,initialTab:ae,initialLocation:oe,startNewCell:ve,onClose:()=>{se(!1),Oe(!1),pe("")}}),Xe&&h.jsx(Bx,{token:t,initialPair:s,onPairDone:l,onDone:()=>ot(!1)}),h.jsx(Hx,{token:t})]});if(!p)return _?h.jsxs(h.Fragment,{children:[h.jsx(qg,{session:_.session,node:_.node,token:t,readonly:zt,onBack:()=>b(null)}),Ie]}):h.jsxs(h.Fragment,{children:[h.jsx(hw,{onPick:E,token:t,onSettings:De}),Ie]});const $e=v||!J;return h.jsxs("div",{className:"nc-workspace",children:[$e&&h.jsx(qb,{sessions:N,cells:O,activeSessions:ki,nodeGroups:ee,onPick:ie,onAddTile:ei,onPower:Q,onNodePower:Ir,onKill:jr,onNew:()=>De("fleet",!0),onSettings:De,width:G,collapsed:x,onResize:P,onToggleCollapse:()=>X(le=>!le)}),h.jsxs("div",{className:"nc-workspace-main",children:[h.jsx(mC,{decks:j,currentDeck:y,onCreate:ti,onRename:Yi,onDelete:ii,onOpenWindow:Ar,onNavigate:Ft,saveState:D.saveState,error:D.error,sidebarVisible:$e,onToggleSidebar:v?null:()=>L(le=>!le)}),h.jsx(sC,{layout:B,onLayoutChange:W,token:t,readonly:zt,sessionsAlive:Ge,focusSession:A,onFocus:I,onOpenSingle:ie,decks:j,currentDeck:y,onSendToDeck:me})]}),V&&h.jsx("div",{className:"nc-single-overlay",children:h.jsx(qg,{session:V.session,node:V.node,token:t,readonly:zt,onBack:()=>U(null)})}),F&&h.jsx(Da,{cell:F,token:t,route:Array.isArray(F.route)?F.route:[],onConfirm:Br,onClose:()=>Q(null)}),Ie]})}function nk(){pi();const e=M.useSyncExternalStore(qx,Hg,Hg);if(!e.needed)return null;const t=e.kind==="install"?S("install-version-mismatch").replace("{v}",e.version):S("update-available").replace("{v}",e.version).replace(" "," ").trim();return h.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[h.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&h.jsx("button",{className:"nc-update-btn",onClick:Xx,children:S("reload")})]})}Yx();AS.createRoot(document.getElementById("root")).render(h.jsxs(DS.StrictMode,{children:[h.jsx(rk,{}),h.jsx(nk,{})]}));