@mmmbuto/nexuscrew 0.8.44 → 0.8.46

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
  `+g[j].replace(" at new "," at ");return i.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",i.displayName)),Q}while(1<=j&&0<=K);break}}}finally{Z=!1,Error.prepareStackTrace=l}return(i=i?i.displayName||i.name:"")?U(i):""}function de(i){switch(i.tag){case 5:return U(i.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return i=oe(i.type,!1),i;case 11:return i=oe(i.type.render,!1),i;case 1:return i=oe(i.type,!0),i;default:return""}}function fe(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 z:return"Fragment";case Y:return"Portal";case H:return"Profiler";case ne:return"StrictMode";case N:return"Suspense";case M:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case I:return(i.displayName||"Context")+".Consumer";case X:return(i._context.displayName||"Context")+".Provider";case A:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case L:return r=i.displayName||null,r!==null?r:fe(i.type)||"Memo";case P:r=i._payload,i=i._init;try{return fe(i(r))}catch{}}return null}function J(i){var r=i.type;switch(i.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=r.render,i=i.displayName||i.name||"",r.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(r);case 8:return r===ne?"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 r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function ee(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function pe(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Se(i){var r=pe(i)?"checked":"value",l=Object.getOwnPropertyDescriptor(i.constructor.prototype,r),d=""+i[r];if(!i.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var g=l.get,_=l.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return g.call(this)},set:function(j){d=""+j,_.call(this,j)}}),Object.defineProperty(i,r,{enumerable:l.enumerable}),{getValue:function(){return d},setValue:function(j){d=""+j},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function Ze(i){i._valueTracker||(i._valueTracker=Se(i))}function $e(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var l=r.getValue(),d="";return i&&(d=pe(i)?i.checked?"true":"false":i.value),i=d,i!==l?(r.setValue(i),!0):!1}function He(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 vt(i,r){var l=r.checked;return B({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??i._wrapperState.initialChecked})}function Xe(i,r){var l=r.defaultValue==null?"":r.defaultValue,d=r.checked!=null?r.checked:r.defaultChecked;l=ee(r.value!=null?r.value:l),i._wrapperState={initialChecked:d,initialValue:l,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function St(i,r){r=r.checked,r!=null&&$(i,"checked",r,!1)}function Et(i,r){St(i,r);var l=ee(r.value),d=r.type;if(l!=null)d==="number"?(l===0&&i.value===""||i.value!=l)&&(i.value=""+l):i.value!==""+l&&(i.value=""+l);else if(d==="submit"||d==="reset"){i.removeAttribute("value");return}r.hasOwnProperty("value")?ct(i,r.type,l):r.hasOwnProperty("defaultValue")&&ct(i,r.type,ee(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(i.defaultChecked=!!r.defaultChecked)}function rt(i,r,l){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var d=r.type;if(!(d!=="submit"&&d!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+i._wrapperState.initialValue,l||r===i.value||(i.value=r),i.defaultValue=r}l=i.name,l!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,l!==""&&(i.name=l)}function ct(i,r,l){(r!=="number"||He(i.ownerDocument)!==i)&&(l==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+l&&(i.defaultValue=""+l))}var ot=Array.isArray;function ut(i,r,l,d){if(i=i.options,r){r={};for(var g=0;g<l.length;g++)r["$"+l[g]]=!0;for(l=0;l<i.length;l++)g=r.hasOwnProperty("$"+i[l].value),i[l].selected!==g&&(i[l].selected=g),g&&d&&(i[l].defaultSelected=!0)}else{for(l=""+ee(l),r=null,g=0;g<i.length;g++){if(i[g].value===l){i[g].selected=!0,d&&(i[g].defaultSelected=!0);return}r!==null||i[g].disabled||(r=i[g])}r!==null&&(r.selected=!0)}}function dt(i,r){if(r.dangerouslySetInnerHTML!=null)throw Error(n(91));return B({},r,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function le(i,r){var l=r.value;if(l==null){if(l=r.children,r=r.defaultValue,l!=null){if(r!=null)throw Error(n(92));if(ot(l)){if(1<l.length)throw Error(n(93));l=l[0]}r=l}r==null&&(r=""),l=r}i._wrapperState={initialValue:ee(l)}}function xe(i,r){var l=ee(r.value),d=ee(r.defaultValue);l!=null&&(l=""+l,l!==i.value&&(i.value=l),r.defaultValue==null&&i.defaultValue!==l&&(i.defaultValue=l)),d!=null&&(i.defaultValue=""+d)}function ze(i){var r=i.textContent;r===i._wrapperState.initialValue&&r!==""&&r!==null&&(i.value=r)}function Ie(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 ue(i,r){return i==null||i==="http://www.w3.org/1999/xhtml"?Ie(r):i==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var G,ie=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,l,d,g){MSApp.execUnsafeLocalFunction(function(){return i(r,l,d,g)})}:i})(function(i,r){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=r;else{for(G=G||document.createElement("div"),G.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=G.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;r.firstChild;)i.appendChild(r.firstChild)}});function W(i,r){if(r){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=r;return}}i.textContent=r}var se={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},ve=["Webkit","ms","Moz","O"];Object.keys(se).forEach(function(i){ve.forEach(function(r){r=r+i.charAt(0).toUpperCase()+i.substring(1),se[r]=se[i]})});function ke(i,r,l){return r==null||typeof r=="boolean"||r===""?"":l||typeof r!="number"||r===0||se.hasOwnProperty(i)&&se[i]?(""+r).trim():r+"px"}function Re(i,r){i=i.style;for(var l in r)if(r.hasOwnProperty(l)){var d=l.indexOf("--")===0,g=ke(l,r[l],d);l==="float"&&(l="cssFloat"),d?i.setProperty(l,g):i[l]=g}}var we=B({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 je(i,r){if(r){if(we[i]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(n(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(n(61))}if(r.style!=null&&typeof r.style!="object")throw Error(n(62))}}function st(i,r){if(i.indexOf("-")===-1)return typeof r.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 It=null;function Oe(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var _n=null,bt=null,Ye=null;function Gt(i){if(i=io(i)){if(typeof _n!="function")throw Error(n(280));var r=i.stateNode;r&&(r=va(r),_n(i.stateNode,i.type,r))}}function Hn(i){bt?Ye?Ye.push(i):Ye=[i]:bt=i}function li(){if(bt){var i=bt,r=Ye;if(Ye=bt=null,Gt(i),r)for(i=0;i<r.length;i++)Gt(r[i])}}function he(i,r){return i(r)}function Ne(){}var Ke=!1;function Nt(i,r,l){if(Ke)return i(r,l);Ke=!0;try{return he(i,r,l)}finally{Ke=!1,(bt!==null||Ye!==null)&&(Ne(),li())}}function pt(i,r){var l=i.stateNode;if(l===null)return null;var d=va(l);if(d===null)return null;l=d[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(i=i.type,d=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!d;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(n(231,r,typeof l));return l}var Wn=!1;if(h)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){Wn=!0}}),window.addEventListener("test",hn,hn),window.removeEventListener("test",hn,hn)}catch{Wn=!1}function Or(i,r,l,d,g,_,j,K,Q){var ce=Array.prototype.slice.call(arguments,3);try{r.apply(l,ce)}catch(ye){this.onError(ye)}}var Oi=!1,Xt=null,ys=!1,zi=null,ws={onError:function(i){Oi=!0,Xt=i}};function Xo(i,r,l,d,g,_,j,K,Q){Oi=!1,Xt=null,Or.apply(ws,arguments)}function me(i,r,l,d,g,_,j,K,Q){if(Xo.apply(this,arguments),Oi){if(Oi){var ce=Xt;Oi=!1,Xt=null}else throw Error(n(198));ys||(ys=!0,zi=ce)}}function Fe(i){var r=i,l=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(l=r.return),i=r.return;while(i)}return r.tag===3?l:null}function Ge(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function Je(i){if(Fe(i)!==i)throw Error(n(188))}function xt(i){var r=i.alternate;if(!r){if(r=Fe(i),r===null)throw Error(n(188));return r!==i?null:i}for(var l=i,d=r;;){var g=l.return;if(g===null)break;var _=g.alternate;if(_===null){if(d=g.return,d!==null){l=d;continue}break}if(g.child===_.child){for(_=g.child;_;){if(_===l)return Je(g),i;if(_===d)return Je(g),r;_=_.sibling}throw Error(n(188))}if(l.return!==d.return)l=g,d=_;else{for(var j=!1,K=g.child;K;){if(K===l){j=!0,l=g,d=_;break}if(K===d){j=!0,d=g,l=_;break}K=K.sibling}if(!j){for(K=_.child;K;){if(K===l){j=!0,l=_,d=g;break}if(K===d){j=!0,d=_,l=g;break}K=K.sibling}if(!j)throw Error(n(189))}}if(l.alternate!==d)throw Error(n(190))}if(l.tag!==3)throw Error(n(188));return l.stateNode.current===l?i:r}function Rt(i){return i=xt(i),i!==null?an(i):null}function an(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var r=an(i);if(r!==null)return r;i=i.sibling}return null}var Fi=t.unstable_scheduleCallback,Ys=t.unstable_cancelCallback,nS=t.unstable_shouldYield,iS=t.unstable_requestPaint,Bt=t.unstable_now,sS=t.unstable_getCurrentPriorityLevel,ec=t.unstable_ImmediatePriority,Ef=t.unstable_UserBlockingPriority,Jo=t.unstable_NormalPriority,rS=t.unstable_LowPriority,Nf=t.unstable_IdlePriority,Qo=null,ci=null;function oS(i){if(ci&&typeof ci.onCommitFiberRoot=="function")try{ci.onCommitFiberRoot(Qo,i,void 0,(i.current.flags&128)===128)}catch{}}var ei=Math.clz32?Math.clz32:cS,aS=Math.log,lS=Math.LN2;function cS(i){return i>>>=0,i===0?32:31-(aS(i)/lS|0)|0}var Zo=64,ea=4194304;function zr(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 ta(i,r){var l=i.pendingLanes;if(l===0)return 0;var d=0,g=i.suspendedLanes,_=i.pingedLanes,j=l&268435455;if(j!==0){var K=j&~g;K!==0?d=zr(K):(_&=j,_!==0&&(d=zr(_)))}else j=l&~g,j!==0?d=zr(j):_!==0&&(d=zr(_));if(d===0)return 0;if(r!==0&&r!==d&&(r&g)===0&&(g=d&-d,_=r&-r,g>=_||g===16&&(_&4194240)!==0))return r;if((d&4)!==0&&(d|=l&16),r=i.entangledLanes,r!==0)for(i=i.entanglements,r&=d;0<r;)l=31-ei(r),g=1<<l,d|=i[l],r&=~g;return d}function uS(i,r){switch(i){case 1:case 2:case 4:return r+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 r+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 dS(i,r){for(var l=i.suspendedLanes,d=i.pingedLanes,g=i.expirationTimes,_=i.pendingLanes;0<_;){var j=31-ei(_),K=1<<j,Q=g[j];Q===-1?((K&l)===0||(K&d)!==0)&&(g[j]=uS(K,r)):Q<=r&&(i.expiredLanes|=K),_&=~K}}function tc(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Rf(){var i=Zo;return Zo<<=1,(Zo&4194240)===0&&(Zo=64),i}function nc(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function Fr(i,r,l){i.pendingLanes|=r,r!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,r=31-ei(r),i[r]=l}function hS(i,r){var l=i.pendingLanes&~r;i.pendingLanes=r,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=r,i.mutableReadLanes&=r,i.entangledLanes&=r,r=i.entanglements;var d=i.eventTimes;for(i=i.expirationTimes;0<l;){var g=31-ei(l),_=1<<g;r[g]=0,d[g]=-1,i[g]=-1,l&=~_}}function ic(i,r){var l=i.entangledLanes|=r;for(i=i.entanglements;l;){var d=31-ei(l),g=1<<d;g&r|i[d]&r&&(i[d]|=r),l&=~g}}var ht=0;function jf(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Pf,sc,Lf,Tf,Df,rc=!1,na=[],$i=null,Hi=null,Wi=null,$r=new Map,Hr=new Map,Ui=[],fS="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 Mf(i,r){switch(i){case"focusin":case"focusout":$i=null;break;case"dragenter":case"dragleave":Hi=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":$r.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hr.delete(r.pointerId)}}function Wr(i,r,l,d,g,_){return i===null||i.nativeEvent!==_?(i={blockedOn:r,domEventName:l,eventSystemFlags:d,nativeEvent:_,targetContainers:[g]},r!==null&&(r=io(r),r!==null&&sc(r)),i):(i.eventSystemFlags|=d,r=i.targetContainers,g!==null&&r.indexOf(g)===-1&&r.push(g),i)}function pS(i,r,l,d,g){switch(r){case"focusin":return $i=Wr($i,i,r,l,d,g),!0;case"dragenter":return Hi=Wr(Hi,i,r,l,d,g),!0;case"mouseover":return Wi=Wr(Wi,i,r,l,d,g),!0;case"pointerover":var _=g.pointerId;return $r.set(_,Wr($r.get(_)||null,i,r,l,d,g)),!0;case"gotpointercapture":return _=g.pointerId,Hr.set(_,Wr(Hr.get(_)||null,i,r,l,d,g)),!0}return!1}function Af(i){var r=Ss(i.target);if(r!==null){var l=Fe(r);if(l!==null){if(r=l.tag,r===13){if(r=Ge(l),r!==null){i.blockedOn=r,Df(i.priority,function(){Lf(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function ia(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=ac(i.domEventName,i.eventSystemFlags,r[0],i.nativeEvent);if(l===null){l=i.nativeEvent;var d=new l.constructor(l.type,l);It=d,l.target.dispatchEvent(d),It=null}else return r=io(l),r!==null&&sc(r),i.blockedOn=l,!1;r.shift()}return!0}function If(i,r,l){ia(i)&&l.delete(r)}function mS(){rc=!1,$i!==null&&ia($i)&&($i=null),Hi!==null&&ia(Hi)&&(Hi=null),Wi!==null&&ia(Wi)&&(Wi=null),$r.forEach(If),Hr.forEach(If)}function Ur(i,r){i.blockedOn===r&&(i.blockedOn=null,rc||(rc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mS)))}function Kr(i){function r(g){return Ur(g,i)}if(0<na.length){Ur(na[0],i);for(var l=1;l<na.length;l++){var d=na[l];d.blockedOn===i&&(d.blockedOn=null)}}for($i!==null&&Ur($i,i),Hi!==null&&Ur(Hi,i),Wi!==null&&Ur(Wi,i),$r.forEach(r),Hr.forEach(r),l=0;l<Ui.length;l++)d=Ui[l],d.blockedOn===i&&(d.blockedOn=null);for(;0<Ui.length&&(l=Ui[0],l.blockedOn===null);)Af(l),l.blockedOn===null&&Ui.shift()}var Gs=O.ReactCurrentBatchConfig,sa=!0;function gS(i,r,l,d){var g=ht,_=Gs.transition;Gs.transition=null;try{ht=1,oc(i,r,l,d)}finally{ht=g,Gs.transition=_}}function vS(i,r,l,d){var g=ht,_=Gs.transition;Gs.transition=null;try{ht=4,oc(i,r,l,d)}finally{ht=g,Gs.transition=_}}function oc(i,r,l,d){if(sa){var g=ac(i,r,l,d);if(g===null)kc(i,r,d,ra,l),Mf(i,d);else if(pS(g,i,r,l,d))d.stopPropagation();else if(Mf(i,d),r&4&&-1<fS.indexOf(i)){for(;g!==null;){var _=io(g);if(_!==null&&Pf(_),_=ac(i,r,l,d),_===null&&kc(i,r,d,ra,l),_===g)break;g=_}g!==null&&d.stopPropagation()}else kc(i,r,d,null,l)}}var ra=null;function ac(i,r,l,d){if(ra=null,i=Oe(d),i=Ss(i),i!==null)if(r=Fe(i),r===null)i=null;else if(l=r.tag,l===13){if(i=Ge(r),i!==null)return i;i=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null);return ra=i,null}function Bf(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(sS()){case ec:return 1;case Ef:return 4;case Jo:case rS:return 16;case Nf:return 536870912;default:return 16}default:return 16}}var Ki=null,lc=null,oa=null;function Of(){if(oa)return oa;var i,r=lc,l=r.length,d,g="value"in Ki?Ki.value:Ki.textContent,_=g.length;for(i=0;i<l&&r[i]===g[i];i++);var j=l-i;for(d=1;d<=j&&r[l-d]===g[_-d];d++);return oa=g.slice(i,1<d?1-d:void 0)}function aa(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function la(){return!0}function zf(){return!1}function Tn(i){function r(l,d,g,_,j){this._reactName=l,this._targetInst=g,this.type=d,this.nativeEvent=_,this.target=j,this.currentTarget=null;for(var K in i)i.hasOwnProperty(K)&&(l=i[K],this[K]=l?l(_):_[K]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?la:zf,this.isPropagationStopped=zf,this}return B(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=la)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=la)},persist:function(){},isPersistent:la}),r}var Xs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cc=Tn(Xs),qr=B({},Xs,{view:0,detail:0}),_S=Tn(qr),uc,dc,Vr,ca=B({},qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,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!==Vr&&(Vr&&i.type==="mousemove"?(uc=i.screenX-Vr.screenX,dc=i.screenY-Vr.screenY):dc=uc=0,Vr=i),uc)},movementY:function(i){return"movementY"in i?i.movementY:dc}}),Ff=Tn(ca),yS=B({},ca,{dataTransfer:0}),wS=Tn(yS),SS=B({},qr,{relatedTarget:0}),hc=Tn(SS),bS=B({},Xs,{animationName:0,elapsedTime:0,pseudoElement:0}),xS=Tn(bS),kS=B({},Xs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),CS=Tn(kS),ES=B({},Xs,{data:0}),$f=Tn(ES),NS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},RS={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"},jS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function PS(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=jS[i])?!!r[i]:!1}function fc(){return PS}var LS=B({},qr,{key:function(i){if(i.key){var r=NS[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=aa(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?RS[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(i){return i.type==="keypress"?aa(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?aa(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),TS=Tn(LS),DS=B({},ca,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hf=Tn(DS),MS=B({},qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),AS=Tn(MS),IS=B({},Xs,{propertyName:0,elapsedTime:0,pseudoElement:0}),BS=Tn(IS),OS=B({},ca,{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}),zS=Tn(OS),FS=[9,13,27,32],pc=h&&"CompositionEvent"in window,Yr=null;h&&"documentMode"in document&&(Yr=document.documentMode);var $S=h&&"TextEvent"in window&&!Yr,Wf=h&&(!pc||Yr&&8<Yr&&11>=Yr),Uf=" ",Kf=!1;function qf(i,r){switch(i){case"keyup":return FS.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Js=!1;function HS(i,r){switch(i){case"compositionend":return Vf(r);case"keypress":return r.which!==32?null:(Kf=!0,Uf);case"textInput":return i=r.data,i===Uf&&Kf?null:i;default:return null}}function WS(i,r){if(Js)return i==="compositionend"||!pc&&qf(i,r)?(i=Of(),oa=lc=Ki=null,Js=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Wf&&r.locale!=="ko"?null:r.data;default:return null}}var US={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 Yf(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!US[i.type]:r==="textarea"}function Gf(i,r,l,d){Hn(d),r=pa(r,"onChange"),0<r.length&&(l=new cc("onChange","change",null,l,d),i.push({event:l,listeners:r}))}var Gr=null,Xr=null;function KS(i){fp(i,0)}function ua(i){var r=nr(i);if($e(r))return i}function qS(i,r){if(i==="change")return r}var Xf=!1;if(h){var mc;if(h){var gc="oninput"in document;if(!gc){var Jf=document.createElement("div");Jf.setAttribute("oninput","return;"),gc=typeof Jf.oninput=="function"}mc=gc}else mc=!1;Xf=mc&&(!document.documentMode||9<document.documentMode)}function Qf(){Gr&&(Gr.detachEvent("onpropertychange",Zf),Xr=Gr=null)}function Zf(i){if(i.propertyName==="value"&&ua(Xr)){var r=[];Gf(r,Xr,i,Oe(i)),Nt(KS,r)}}function VS(i,r,l){i==="focusin"?(Qf(),Gr=r,Xr=l,Gr.attachEvent("onpropertychange",Zf)):i==="focusout"&&Qf()}function YS(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return ua(Xr)}function GS(i,r){if(i==="click")return ua(r)}function XS(i,r){if(i==="input"||i==="change")return ua(r)}function JS(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var ti=typeof Object.is=="function"?Object.is:JS;function Jr(i,r){if(ti(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var l=Object.keys(i),d=Object.keys(r);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var g=l[d];if(!f.call(r,g)||!ti(i[g],r[g]))return!1}return!0}function ep(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function tp(i,r){var l=ep(i);i=0;for(var d;l;){if(l.nodeType===3){if(d=i+l.textContent.length,i<=r&&d>=r)return{node:l,offset:r-i};i=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=ep(l)}}function np(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?np(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function ip(){for(var i=window,r=He();r instanceof i.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)i=r.contentWindow;else break;r=He(i.document)}return r}function vc(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}function QS(i){var r=ip(),l=i.focusedElem,d=i.selectionRange;if(r!==l&&l&&l.ownerDocument&&np(l.ownerDocument.documentElement,l)){if(d!==null&&vc(l)){if(r=d.start,i=d.end,i===void 0&&(i=r),"selectionStart"in l)l.selectionStart=r,l.selectionEnd=Math.min(i,l.value.length);else if(i=(r=l.ownerDocument||document)&&r.defaultView||window,i.getSelection){i=i.getSelection();var g=l.textContent.length,_=Math.min(d.start,g);d=d.end===void 0?_:Math.min(d.end,g),!i.extend&&_>d&&(g=d,d=_,_=g),g=tp(l,_);var j=tp(l,d);g&&j&&(i.rangeCount!==1||i.anchorNode!==g.node||i.anchorOffset!==g.offset||i.focusNode!==j.node||i.focusOffset!==j.offset)&&(r=r.createRange(),r.setStart(g.node,g.offset),i.removeAllRanges(),_>d?(i.addRange(r),i.extend(j.node,j.offset)):(r.setEnd(j.node,j.offset),i.addRange(r)))}}for(r=[],i=l;i=i.parentNode;)i.nodeType===1&&r.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<r.length;l++)i=r[l],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var ZS=h&&"documentMode"in document&&11>=document.documentMode,Qs=null,_c=null,Qr=null,yc=!1;function sp(i,r,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;yc||Qs==null||Qs!==He(d)||(d=Qs,"selectionStart"in d&&vc(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Qr&&Jr(Qr,d)||(Qr=d,d=pa(_c,"onSelect"),0<d.length&&(r=new cc("onSelect","select",null,r,l),i.push({event:r,listeners:d}),r.target=Qs)))}function da(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var Zs={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionend:da("Transition","TransitionEnd")},wc={},rp={};h&&(rp=document.createElement("div").style,"AnimationEvent"in window||(delete Zs.animationend.animation,delete Zs.animationiteration.animation,delete Zs.animationstart.animation),"TransitionEvent"in window||delete Zs.transitionend.transition);function ha(i){if(wc[i])return wc[i];if(!Zs[i])return i;var r=Zs[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in rp)return wc[i]=r[l];return i}var op=ha("animationend"),ap=ha("animationiteration"),lp=ha("animationstart"),cp=ha("transitionend"),up=new Map,dp="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 qi(i,r){up.set(i,r),a(r,[i])}for(var Sc=0;Sc<dp.length;Sc++){var bc=dp[Sc],eb=bc.toLowerCase(),tb=bc[0].toUpperCase()+bc.slice(1);qi(eb,"on"+tb)}qi(op,"onAnimationEnd"),qi(ap,"onAnimationIteration"),qi(lp,"onAnimationStart"),qi("dblclick","onDoubleClick"),qi("focusin","onFocus"),qi("focusout","onBlur"),qi(cp,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zr="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(" "),nb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zr));function hp(i,r,l){var d=i.type||"unknown-event";i.currentTarget=l,me(d,r,void 0,i),i.currentTarget=null}function fp(i,r){r=(r&4)!==0;for(var l=0;l<i.length;l++){var d=i[l],g=d.event;d=d.listeners;e:{var _=void 0;if(r)for(var j=d.length-1;0<=j;j--){var K=d[j],Q=K.instance,ce=K.currentTarget;if(K=K.listener,Q!==_&&g.isPropagationStopped())break e;hp(g,K,ce),_=Q}else for(j=0;j<d.length;j++){if(K=d[j],Q=K.instance,ce=K.currentTarget,K=K.listener,Q!==_&&g.isPropagationStopped())break e;hp(g,K,ce),_=Q}}}if(ys)throw i=zi,ys=!1,zi=null,i}function _t(i,r){var l=r[Pc];l===void 0&&(l=r[Pc]=new Set);var d=i+"__bubble";l.has(d)||(pp(r,i,2,!1),l.add(d))}function xc(i,r,l){var d=0;r&&(d|=4),pp(l,i,d,r)}var fa="_reactListening"+Math.random().toString(36).slice(2);function eo(i){if(!i[fa]){i[fa]=!0,s.forEach(function(l){l!=="selectionchange"&&(nb.has(l)||xc(l,!1,i),xc(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[fa]||(r[fa]=!0,xc("selectionchange",!1,r))}}function pp(i,r,l,d){switch(Bf(r)){case 1:var g=gS;break;case 4:g=vS;break;default:g=oc}l=g.bind(null,r,l,i),g=void 0,!Wn||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(g=!0),d?g!==void 0?i.addEventListener(r,l,{capture:!0,passive:g}):i.addEventListener(r,l,!0):g!==void 0?i.addEventListener(r,l,{passive:g}):i.addEventListener(r,l,!1)}function kc(i,r,l,d,g){var _=d;if((r&1)===0&&(r&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var K=d.stateNode.containerInfo;if(K===g||K.nodeType===8&&K.parentNode===g)break;if(j===4)for(j=d.return;j!==null;){var Q=j.tag;if((Q===3||Q===4)&&(Q=j.stateNode.containerInfo,Q===g||Q.nodeType===8&&Q.parentNode===g))return;j=j.return}for(;K!==null;){if(j=Ss(K),j===null)return;if(Q=j.tag,Q===5||Q===6){d=_=j;continue e}K=K.parentNode}}d=d.return}Nt(function(){var ce=_,ye=Oe(l),be=[];e:{var _e=up.get(i);if(_e!==void 0){var Le=cc,De=i;switch(i){case"keypress":if(aa(l)===0)break e;case"keydown":case"keyup":Le=TS;break;case"focusin":De="focus",Le=hc;break;case"focusout":De="blur",Le=hc;break;case"beforeblur":case"afterblur":Le=hc;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Le=Ff;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Le=wS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Le=AS;break;case op:case ap:case lp:Le=xS;break;case cp:Le=BS;break;case"scroll":Le=_S;break;case"wheel":Le=zS;break;case"copy":case"cut":case"paste":Le=CS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Le=Hf}var Me=(r&4)!==0,Ot=!Me&&i==="scroll",re=Me?_e!==null?_e+"Capture":null:_e;Me=[];for(var te=ce,ae;te!==null;){ae=te;var Ce=ae.stateNode;if(ae.tag===5&&Ce!==null&&(ae=Ce,re!==null&&(Ce=pt(te,re),Ce!=null&&Me.push(to(te,Ce,ae)))),Ot)break;te=te.return}0<Me.length&&(_e=new Le(_e,De,null,l,ye),be.push({event:_e,listeners:Me}))}}if((r&7)===0){e:{if(_e=i==="mouseover"||i==="pointerover",Le=i==="mouseout"||i==="pointerout",_e&&l!==It&&(De=l.relatedTarget||l.fromElement)&&(Ss(De)||De[ki]))break e;if((Le||_e)&&(_e=ye.window===ye?ye:(_e=ye.ownerDocument)?_e.defaultView||_e.parentWindow:window,Le?(De=l.relatedTarget||l.toElement,Le=ce,De=De?Ss(De):null,De!==null&&(Ot=Fe(De),De!==Ot||De.tag!==5&&De.tag!==6)&&(De=null)):(Le=null,De=ce),Le!==De)){if(Me=Ff,Ce="onMouseLeave",re="onMouseEnter",te="mouse",(i==="pointerout"||i==="pointerover")&&(Me=Hf,Ce="onPointerLeave",re="onPointerEnter",te="pointer"),Ot=Le==null?_e:nr(Le),ae=De==null?_e:nr(De),_e=new Me(Ce,te+"leave",Le,l,ye),_e.target=Ot,_e.relatedTarget=ae,Ce=null,Ss(ye)===ce&&(Me=new Me(re,te+"enter",De,l,ye),Me.target=ae,Me.relatedTarget=Ot,Ce=Me),Ot=Ce,Le&&De)t:{for(Me=Le,re=De,te=0,ae=Me;ae;ae=er(ae))te++;for(ae=0,Ce=re;Ce;Ce=er(Ce))ae++;for(;0<te-ae;)Me=er(Me),te--;for(;0<ae-te;)re=er(re),ae--;for(;te--;){if(Me===re||re!==null&&Me===re.alternate)break t;Me=er(Me),re=er(re)}Me=null}else Me=null;Le!==null&&mp(be,_e,Le,Me,!1),De!==null&&Ot!==null&&mp(be,Ot,De,Me,!0)}}e:{if(_e=ce?nr(ce):window,Le=_e.nodeName&&_e.nodeName.toLowerCase(),Le==="select"||Le==="input"&&_e.type==="file")var Be=qS;else if(Yf(_e))if(Xf)Be=XS;else{Be=YS;var We=VS}else(Le=_e.nodeName)&&Le.toLowerCase()==="input"&&(_e.type==="checkbox"||_e.type==="radio")&&(Be=GS);if(Be&&(Be=Be(i,ce))){Gf(be,Be,l,ye);break e}We&&We(i,_e,ce),i==="focusout"&&(We=_e._wrapperState)&&We.controlled&&_e.type==="number"&&ct(_e,"number",_e.value)}switch(We=ce?nr(ce):window,i){case"focusin":(Yf(We)||We.contentEditable==="true")&&(Qs=We,_c=ce,Qr=null);break;case"focusout":Qr=_c=Qs=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,sp(be,l,ye);break;case"selectionchange":if(ZS)break;case"keydown":case"keyup":sp(be,l,ye)}var Ue;if(pc)e:{switch(i){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Js?qf(i,l)&&(qe="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(qe="onCompositionStart");qe&&(Wf&&l.locale!=="ko"&&(Js||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Js&&(Ue=Of()):(Ki=ye,lc="value"in Ki?Ki.value:Ki.textContent,Js=!0)),We=pa(ce,qe),0<We.length&&(qe=new $f(qe,i,null,l,ye),be.push({event:qe,listeners:We}),Ue?qe.data=Ue:(Ue=Vf(l),Ue!==null&&(qe.data=Ue)))),(Ue=$S?HS(i,l):WS(i,l))&&(ce=pa(ce,"onBeforeInput"),0<ce.length&&(ye=new $f("onBeforeInput","beforeinput",null,l,ye),be.push({event:ye,listeners:ce}),ye.data=Ue))}fp(be,r)})}function to(i,r,l){return{instance:i,listener:r,currentTarget:l}}function pa(i,r){for(var l=r+"Capture",d=[];i!==null;){var g=i,_=g.stateNode;g.tag===5&&_!==null&&(g=_,_=pt(i,l),_!=null&&d.unshift(to(i,_,g)),_=pt(i,r),_!=null&&d.push(to(i,_,g))),i=i.return}return d}function er(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function mp(i,r,l,d,g){for(var _=r._reactName,j=[];l!==null&&l!==d;){var K=l,Q=K.alternate,ce=K.stateNode;if(Q!==null&&Q===d)break;K.tag===5&&ce!==null&&(K=ce,g?(Q=pt(l,_),Q!=null&&j.unshift(to(l,Q,K))):g||(Q=pt(l,_),Q!=null&&j.push(to(l,Q,K)))),l=l.return}j.length!==0&&i.push({event:r,listeners:j})}var ib=/\r\n?/g,sb=/\u0000|\uFFFD/g;function gp(i){return(typeof i=="string"?i:""+i).replace(ib,`
38
38
  `).replace(sb,"")}function ma(i,r,l){if(r=gp(r),gp(i)!==r&&l)throw Error(n(425))}function ga(){}var Cc=null,Ec=null;function Nc(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Rc=typeof setTimeout=="function"?setTimeout:void 0,rb=typeof clearTimeout=="function"?clearTimeout:void 0,vp=typeof Promise=="function"?Promise:void 0,ob=typeof queueMicrotask=="function"?queueMicrotask:typeof vp<"u"?function(i){return vp.resolve(null).then(i).catch(ab)}:Rc;function ab(i){setTimeout(function(){throw i})}function jc(i,r){var l=r,d=0;do{var g=l.nextSibling;if(i.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"){if(d===0){i.removeChild(g),Kr(r);return}d--}else l!=="$"&&l!=="$?"&&l!=="$!"||d++;l=g}while(l);Kr(r)}function Vi(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return i}function _p(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"){if(r===0)return i;r--}else l==="/$"&&r++}i=i.previousSibling}return null}var tr=Math.random().toString(36).slice(2),ui="__reactFiber$"+tr,no="__reactProps$"+tr,ki="__reactContainer$"+tr,Pc="__reactEvents$"+tr,lb="__reactListeners$"+tr,cb="__reactHandles$"+tr;function Ss(i){var r=i[ui];if(r)return r;for(var l=i.parentNode;l;){if(r=l[ki]||l[ui]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=_p(i);i!==null;){if(l=i[ui])return l;i=_p(i)}return r}i=l,l=i.parentNode}return null}function io(i){return i=i[ui]||i[ki],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function nr(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(n(33))}function va(i){return i[no]||null}var Lc=[],ir=-1;function Yi(i){return{current:i}}function yt(i){0>ir||(i.current=Lc[ir],Lc[ir]=null,ir--)}function mt(i,r){ir++,Lc[ir]=i.current,i.current=r}var Gi={},fn=Yi(Gi),Cn=Yi(!1),bs=Gi;function sr(i,r){var l=i.type.contextTypes;if(!l)return Gi;var d=i.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===r)return d.__reactInternalMemoizedMaskedChildContext;var g={},_;for(_ in l)g[_]=r[_];return d&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=r,i.__reactInternalMemoizedMaskedChildContext=g),g}function En(i){return i=i.childContextTypes,i!=null}function _a(){yt(Cn),yt(fn)}function yp(i,r,l){if(fn.current!==Gi)throw Error(n(168));mt(fn,r),mt(Cn,l)}function wp(i,r,l){var d=i.stateNode;if(r=r.childContextTypes,typeof d.getChildContext!="function")return l;d=d.getChildContext();for(var g in d)if(!(g in r))throw Error(n(108,J(i)||"Unknown",g));return B({},l,d)}function ya(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Gi,bs=fn.current,mt(fn,i),mt(Cn,Cn.current),!0}function Sp(i,r,l){var d=i.stateNode;if(!d)throw Error(n(169));l?(i=wp(i,r,bs),d.__reactInternalMemoizedMergedChildContext=i,yt(Cn),yt(fn),mt(fn,i)):yt(Cn),mt(Cn,l)}var Ci=null,wa=!1,Tc=!1;function bp(i){Ci===null?Ci=[i]:Ci.push(i)}function ub(i){wa=!0,bp(i)}function Xi(){if(!Tc&&Ci!==null){Tc=!0;var i=0,r=ht;try{var l=Ci;for(ht=1;i<l.length;i++){var d=l[i];do d=d(!0);while(d!==null)}Ci=null,wa=!1}catch(g){throw Ci!==null&&(Ci=Ci.slice(i+1)),Fi(ec,Xi),g}finally{ht=r,Tc=!1}}return null}var rr=[],or=0,Sa=null,ba=0,Un=[],Kn=0,xs=null,Ei=1,Ni="";function ks(i,r){rr[or++]=ba,rr[or++]=Sa,Sa=i,ba=r}function xp(i,r,l){Un[Kn++]=Ei,Un[Kn++]=Ni,Un[Kn++]=xs,xs=i;var d=Ei;i=Ni;var g=32-ei(d)-1;d&=~(1<<g),l+=1;var _=32-ei(r)+g;if(30<_){var j=g-g%5;_=(d&(1<<j)-1).toString(32),d>>=j,g-=j,Ei=1<<32-ei(r)+g|l<<g|d,Ni=_+i}else Ei=1<<_|l<<g|d,Ni=i}function Dc(i){i.return!==null&&(ks(i,1),xp(i,1,0))}function Mc(i){for(;i===Sa;)Sa=rr[--or],rr[or]=null,ba=rr[--or],rr[or]=null;for(;i===xs;)xs=Un[--Kn],Un[Kn]=null,Ni=Un[--Kn],Un[Kn]=null,Ei=Un[--Kn],Un[Kn]=null}var Dn=null,Mn=null,kt=!1,ni=null;function kp(i,r){var l=Gn(5,null,null,0);l.elementType="DELETED",l.stateNode=r,l.return=i,r=i.deletions,r===null?(i.deletions=[l],i.flags|=16):r.push(l)}function Cp(i,r){switch(i.tag){case 5:var l=i.type;return r=r.nodeType!==1||l.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(i.stateNode=r,Dn=i,Mn=Vi(r.firstChild),!0):!1;case 6:return r=i.pendingProps===""||r.nodeType!==3?null:r,r!==null?(i.stateNode=r,Dn=i,Mn=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(l=xs!==null?{id:Ei,overflow:Ni}:null,i.memoizedState={dehydrated:r,treeContext:l,retryLane:1073741824},l=Gn(18,null,null,0),l.stateNode=r,l.return=i,i.child=l,Dn=i,Mn=null,!0):!1;default:return!1}}function Ac(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Ic(i){if(kt){var r=Mn;if(r){var l=r;if(!Cp(i,r)){if(Ac(i))throw Error(n(418));r=Vi(l.nextSibling);var d=Dn;r&&Cp(i,r)?kp(d,l):(i.flags=i.flags&-4097|2,kt=!1,Dn=i)}}else{if(Ac(i))throw Error(n(418));i.flags=i.flags&-4097|2,kt=!1,Dn=i}}}function Ep(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Dn=i}function xa(i){if(i!==Dn)return!1;if(!kt)return Ep(i),kt=!0,!1;var r;if((r=i.tag!==3)&&!(r=i.tag!==5)&&(r=i.type,r=r!=="head"&&r!=="body"&&!Nc(i.type,i.memoizedProps)),r&&(r=Mn)){if(Ac(i))throw Np(),Error(n(418));for(;r;)kp(i,r),r=Vi(r.nextSibling)}if(Ep(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));e:{for(i=i.nextSibling,r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"){if(r===0){Mn=Vi(i.nextSibling);break e}r--}else l!=="$"&&l!=="$!"&&l!=="$?"||r++}i=i.nextSibling}Mn=null}}else Mn=Dn?Vi(i.stateNode.nextSibling):null;return!0}function Np(){for(var i=Mn;i;)i=Vi(i.nextSibling)}function ar(){Mn=Dn=null,kt=!1}function Bc(i){ni===null?ni=[i]:ni.push(i)}var db=O.ReactCurrentBatchConfig;function so(i,r,l){if(i=l.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(n(309));var d=l.stateNode}if(!d)throw Error(n(147,i));var g=d,_=""+i;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===_?r.ref:(r=function(j){var K=g.refs;j===null?delete K[_]:K[_]=j},r._stringRef=_,r)}if(typeof i!="string")throw Error(n(284));if(!l._owner)throw Error(n(290,i))}return i}function ka(i,r){throw i=Object.prototype.toString.call(r),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i))}function Rp(i){var r=i._init;return r(i._payload)}function jp(i){function r(re,te){if(i){var ae=re.deletions;ae===null?(re.deletions=[te],re.flags|=16):ae.push(te)}}function l(re,te){if(!i)return null;for(;te!==null;)r(re,te),te=te.sibling;return null}function d(re,te){for(re=new Map;te!==null;)te.key!==null?re.set(te.key,te):re.set(te.index,te),te=te.sibling;return re}function g(re,te){return re=ss(re,te),re.index=0,re.sibling=null,re}function _(re,te,ae){return re.index=ae,i?(ae=re.alternate,ae!==null?(ae=ae.index,ae<te?(re.flags|=2,te):ae):(re.flags|=2,te)):(re.flags|=1048576,te)}function j(re){return i&&re.alternate===null&&(re.flags|=2),re}function K(re,te,ae,Ce){return te===null||te.tag!==6?(te=Ru(ae,re.mode,Ce),te.return=re,te):(te=g(te,ae),te.return=re,te)}function Q(re,te,ae,Ce){var Be=ae.type;return Be===z?ye(re,te,ae.props.children,Ce,ae.key):te!==null&&(te.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===P&&Rp(Be)===te.type)?(Ce=g(te,ae.props),Ce.ref=so(re,te,ae),Ce.return=re,Ce):(Ce=Ya(ae.type,ae.key,ae.props,null,re.mode,Ce),Ce.ref=so(re,te,ae),Ce.return=re,Ce)}function ce(re,te,ae,Ce){return te===null||te.tag!==4||te.stateNode.containerInfo!==ae.containerInfo||te.stateNode.implementation!==ae.implementation?(te=ju(ae,re.mode,Ce),te.return=re,te):(te=g(te,ae.children||[]),te.return=re,te)}function ye(re,te,ae,Ce,Be){return te===null||te.tag!==7?(te=Ts(ae,re.mode,Ce,Be),te.return=re,te):(te=g(te,ae),te.return=re,te)}function be(re,te,ae){if(typeof te=="string"&&te!==""||typeof te=="number")return te=Ru(""+te,re.mode,ae),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case V:return ae=Ya(te.type,te.key,te.props,null,re.mode,ae),ae.ref=so(re,null,te),ae.return=re,ae;case Y:return te=ju(te,re.mode,ae),te.return=re,te;case P:var Ce=te._init;return be(re,Ce(te._payload),ae)}if(ot(te)||q(te))return te=Ts(te,re.mode,ae,null),te.return=re,te;ka(re,te)}return null}function _e(re,te,ae,Ce){var Be=te!==null?te.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Be!==null?null:K(re,te,""+ae,Ce);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case V:return ae.key===Be?Q(re,te,ae,Ce):null;case Y:return ae.key===Be?ce(re,te,ae,Ce):null;case P:return Be=ae._init,_e(re,te,Be(ae._payload),Ce)}if(ot(ae)||q(ae))return Be!==null?null:ye(re,te,ae,Ce,null);ka(re,ae)}return null}function Le(re,te,ae,Ce,Be){if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number")return re=re.get(ae)||null,K(te,re,""+Ce,Be);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case V:return re=re.get(Ce.key===null?ae:Ce.key)||null,Q(te,re,Ce,Be);case Y:return re=re.get(Ce.key===null?ae:Ce.key)||null,ce(te,re,Ce,Be);case P:var We=Ce._init;return Le(re,te,ae,We(Ce._payload),Be)}if(ot(Ce)||q(Ce))return re=re.get(ae)||null,ye(te,re,Ce,Be,null);ka(te,Ce)}return null}function De(re,te,ae,Ce){for(var Be=null,We=null,Ue=te,qe=te=0,Zt=null;Ue!==null&&qe<ae.length;qe++){Ue.index>qe?(Zt=Ue,Ue=null):Zt=Ue.sibling;var lt=_e(re,Ue,ae[qe],Ce);if(lt===null){Ue===null&&(Ue=Zt);break}i&&Ue&&lt.alternate===null&&r(re,Ue),te=_(lt,te,qe),We===null?Be=lt:We.sibling=lt,We=lt,Ue=Zt}if(qe===ae.length)return l(re,Ue),kt&&ks(re,qe),Be;if(Ue===null){for(;qe<ae.length;qe++)Ue=be(re,ae[qe],Ce),Ue!==null&&(te=_(Ue,te,qe),We===null?Be=Ue:We.sibling=Ue,We=Ue);return kt&&ks(re,qe),Be}for(Ue=d(re,Ue);qe<ae.length;qe++)Zt=Le(Ue,re,qe,ae[qe],Ce),Zt!==null&&(i&&Zt.alternate!==null&&Ue.delete(Zt.key===null?qe:Zt.key),te=_(Zt,te,qe),We===null?Be=Zt:We.sibling=Zt,We=Zt);return i&&Ue.forEach(function(rs){return r(re,rs)}),kt&&ks(re,qe),Be}function Me(re,te,ae,Ce){var Be=q(ae);if(typeof Be!="function")throw Error(n(150));if(ae=Be.call(ae),ae==null)throw Error(n(151));for(var We=Be=null,Ue=te,qe=te=0,Zt=null,lt=ae.next();Ue!==null&&!lt.done;qe++,lt=ae.next()){Ue.index>qe?(Zt=Ue,Ue=null):Zt=Ue.sibling;var rs=_e(re,Ue,lt.value,Ce);if(rs===null){Ue===null&&(Ue=Zt);break}i&&Ue&&rs.alternate===null&&r(re,Ue),te=_(rs,te,qe),We===null?Be=rs:We.sibling=rs,We=rs,Ue=Zt}if(lt.done)return l(re,Ue),kt&&ks(re,qe),Be;if(Ue===null){for(;!lt.done;qe++,lt=ae.next())lt=be(re,lt.value,Ce),lt!==null&&(te=_(lt,te,qe),We===null?Be=lt:We.sibling=lt,We=lt);return kt&&ks(re,qe),Be}for(Ue=d(re,Ue);!lt.done;qe++,lt=ae.next())lt=Le(Ue,re,qe,lt.value,Ce),lt!==null&&(i&&lt.alternate!==null&&Ue.delete(lt.key===null?qe:lt.key),te=_(lt,te,qe),We===null?Be=lt:We.sibling=lt,We=lt);return i&&Ue.forEach(function(Ub){return r(re,Ub)}),kt&&ks(re,qe),Be}function Ot(re,te,ae,Ce){if(typeof ae=="object"&&ae!==null&&ae.type===z&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case V:e:{for(var Be=ae.key,We=te;We!==null;){if(We.key===Be){if(Be=ae.type,Be===z){if(We.tag===7){l(re,We.sibling),te=g(We,ae.props.children),te.return=re,re=te;break e}}else if(We.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===P&&Rp(Be)===We.type){l(re,We.sibling),te=g(We,ae.props),te.ref=so(re,We,ae),te.return=re,re=te;break e}l(re,We);break}else r(re,We);We=We.sibling}ae.type===z?(te=Ts(ae.props.children,re.mode,Ce,ae.key),te.return=re,re=te):(Ce=Ya(ae.type,ae.key,ae.props,null,re.mode,Ce),Ce.ref=so(re,te,ae),Ce.return=re,re=Ce)}return j(re);case Y:e:{for(We=ae.key;te!==null;){if(te.key===We)if(te.tag===4&&te.stateNode.containerInfo===ae.containerInfo&&te.stateNode.implementation===ae.implementation){l(re,te.sibling),te=g(te,ae.children||[]),te.return=re,re=te;break e}else{l(re,te);break}else r(re,te);te=te.sibling}te=ju(ae,re.mode,Ce),te.return=re,re=te}return j(re);case P:return We=ae._init,Ot(re,te,We(ae._payload),Ce)}if(ot(ae))return De(re,te,ae,Ce);if(q(ae))return Me(re,te,ae,Ce);ka(re,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,te!==null&&te.tag===6?(l(re,te.sibling),te=g(te,ae),te.return=re,re=te):(l(re,te),te=Ru(ae,re.mode,Ce),te.return=re,re=te),j(re)):l(re,te)}return Ot}var lr=jp(!0),Pp=jp(!1),Ca=Yi(null),Ea=null,cr=null,Oc=null;function zc(){Oc=cr=Ea=null}function Fc(i){var r=Ca.current;yt(Ca),i._currentValue=r}function $c(i,r,l){for(;i!==null;){var d=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,d!==null&&(d.childLanes|=r)):d!==null&&(d.childLanes&r)!==r&&(d.childLanes|=r),i===l)break;i=i.return}}function ur(i,r){Ea=i,Oc=cr=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&r)!==0&&(Nn=!0),i.firstContext=null)}function qn(i){var r=i._currentValue;if(Oc!==i)if(i={context:i,memoizedValue:r,next:null},cr===null){if(Ea===null)throw Error(n(308));cr=i,Ea.dependencies={lanes:0,firstContext:i}}else cr=cr.next=i;return r}var Cs=null;function Hc(i){Cs===null?Cs=[i]:Cs.push(i)}function Lp(i,r,l,d){var g=r.interleaved;return g===null?(l.next=l,Hc(r)):(l.next=g.next,g.next=l),r.interleaved=l,Ri(i,d)}function Ri(i,r){i.lanes|=r;var l=i.alternate;for(l!==null&&(l.lanes|=r),l=i,i=i.return;i!==null;)i.childLanes|=r,l=i.alternate,l!==null&&(l.childLanes|=r),l=i,i=i.return;return l.tag===3?l.stateNode:null}var Ji=!1;function Wc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tp(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function ji(i,r){return{eventTime:i,lane:r,tag:0,payload:null,callback:null,next:null}}function Qi(i,r,l){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(at&2)!==0){var g=d.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),d.pending=r,Ri(i,l)}return g=d.interleaved,g===null?(r.next=r,Hc(d)):(r.next=g.next,g.next=r),d.interleaved=r,Ri(i,l)}function Na(i,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194240)!==0)){var d=r.lanes;d&=i.pendingLanes,l|=d,r.lanes=l,ic(i,l)}}function Dp(i,r){var l=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var g=null,_=null;if(l=l.firstBaseUpdate,l!==null){do{var j={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};_===null?g=_=j:_=_.next=j,l=l.next}while(l!==null);_===null?g=_=r:_=_.next=r}else g=_=r;l={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:_,shared:d.shared,effects:d.effects},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=r:i.next=r,l.lastBaseUpdate=r}function Ra(i,r,l,d){var g=i.updateQueue;Ji=!1;var _=g.firstBaseUpdate,j=g.lastBaseUpdate,K=g.shared.pending;if(K!==null){g.shared.pending=null;var Q=K,ce=Q.next;Q.next=null,j===null?_=ce:j.next=ce,j=Q;var ye=i.alternate;ye!==null&&(ye=ye.updateQueue,K=ye.lastBaseUpdate,K!==j&&(K===null?ye.firstBaseUpdate=ce:K.next=ce,ye.lastBaseUpdate=Q))}if(_!==null){var be=g.baseState;j=0,ye=ce=Q=null,K=_;do{var _e=K.lane,Le=K.eventTime;if((d&_e)===_e){ye!==null&&(ye=ye.next={eventTime:Le,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var De=i,Me=K;switch(_e=r,Le=l,Me.tag){case 1:if(De=Me.payload,typeof De=="function"){be=De.call(Le,be,_e);break e}be=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Me.payload,_e=typeof De=="function"?De.call(Le,be,_e):De,_e==null)break e;be=B({},be,_e);break e;case 2:Ji=!0}}K.callback!==null&&K.lane!==0&&(i.flags|=64,_e=g.effects,_e===null?g.effects=[K]:_e.push(K))}else Le={eventTime:Le,lane:_e,tag:K.tag,payload:K.payload,callback:K.callback,next:null},ye===null?(ce=ye=Le,Q=be):ye=ye.next=Le,j|=_e;if(K=K.next,K===null){if(K=g.shared.pending,K===null)break;_e=K,K=_e.next,_e.next=null,g.lastBaseUpdate=_e,g.shared.pending=null}}while(!0);if(ye===null&&(Q=be),g.baseState=Q,g.firstBaseUpdate=ce,g.lastBaseUpdate=ye,r=g.shared.interleaved,r!==null){g=r;do j|=g.lane,g=g.next;while(g!==r)}else _===null&&(g.shared.lanes=0);Rs|=j,i.lanes=j,i.memoizedState=be}}function Mp(i,r,l){if(i=r.effects,r.effects=null,i!==null)for(r=0;r<i.length;r++){var d=i[r],g=d.callback;if(g!==null){if(d.callback=null,d=l,typeof g!="function")throw Error(n(191,g));g.call(d)}}}var ro={},di=Yi(ro),oo=Yi(ro),ao=Yi(ro);function Es(i){if(i===ro)throw Error(n(174));return i}function Uc(i,r){switch(mt(ao,r),mt(oo,i),mt(di,ro),i=r.nodeType,i){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:ue(null,"");break;default:i=i===8?r.parentNode:r,r=i.namespaceURI||null,i=i.tagName,r=ue(r,i)}yt(di),mt(di,r)}function dr(){yt(di),yt(oo),yt(ao)}function Ap(i){Es(ao.current);var r=Es(di.current),l=ue(r,i.type);r!==l&&(mt(oo,i),mt(di,l))}function Kc(i){oo.current===i&&(yt(di),yt(oo))}var jt=Yi(0);function ja(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var qc=[];function Vc(){for(var i=0;i<qc.length;i++)qc[i]._workInProgressVersionPrimary=null;qc.length=0}var Pa=O.ReactCurrentDispatcher,Yc=O.ReactCurrentBatchConfig,Ns=0,Pt=null,Wt=null,Jt=null,La=!1,lo=!1,co=0,hb=0;function pn(){throw Error(n(321))}function Gc(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!ti(i[l],r[l]))return!1;return!0}function Xc(i,r,l,d,g,_){if(Ns=_,Pt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Pa.current=i===null||i.memoizedState===null?gb:vb,i=l(d,g),lo){_=0;do{if(lo=!1,co=0,25<=_)throw Error(n(301));_+=1,Jt=Wt=null,r.updateQueue=null,Pa.current=_b,i=l(d,g)}while(lo)}if(Pa.current=Ma,r=Wt!==null&&Wt.next!==null,Ns=0,Jt=Wt=Pt=null,La=!1,r)throw Error(n(300));return i}function Jc(){var i=co!==0;return co=0,i}function hi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?Pt.memoizedState=Jt=i:Jt=Jt.next=i,Jt}function Vn(){if(Wt===null){var i=Pt.alternate;i=i!==null?i.memoizedState:null}else i=Wt.next;var r=Jt===null?Pt.memoizedState:Jt.next;if(r!==null)Jt=r,Wt=i;else{if(i===null)throw Error(n(310));Wt=i,i={memoizedState:Wt.memoizedState,baseState:Wt.baseState,baseQueue:Wt.baseQueue,queue:Wt.queue,next:null},Jt===null?Pt.memoizedState=Jt=i:Jt=Jt.next=i}return Jt}function uo(i,r){return typeof r=="function"?r(i):r}function Qc(i){var r=Vn(),l=r.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=i;var d=Wt,g=d.baseQueue,_=l.pending;if(_!==null){if(g!==null){var j=g.next;g.next=_.next,_.next=j}d.baseQueue=g=_,l.pending=null}if(g!==null){_=g.next,d=d.baseState;var K=j=null,Q=null,ce=_;do{var ye=ce.lane;if((Ns&ye)===ye)Q!==null&&(Q=Q.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),d=ce.hasEagerState?ce.eagerState:i(d,ce.action);else{var be={lane:ye,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};Q===null?(K=Q=be,j=d):Q=Q.next=be,Pt.lanes|=ye,Rs|=ye}ce=ce.next}while(ce!==null&&ce!==_);Q===null?j=d:Q.next=K,ti(d,r.memoizedState)||(Nn=!0),r.memoizedState=d,r.baseState=j,r.baseQueue=Q,l.lastRenderedState=d}if(i=l.interleaved,i!==null){g=i;do _=g.lane,Pt.lanes|=_,Rs|=_,g=g.next;while(g!==i)}else g===null&&(l.lanes=0);return[r.memoizedState,l.dispatch]}function Zc(i){var r=Vn(),l=r.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=i;var d=l.dispatch,g=l.pending,_=r.memoizedState;if(g!==null){l.pending=null;var j=g=g.next;do _=i(_,j.action),j=j.next;while(j!==g);ti(_,r.memoizedState)||(Nn=!0),r.memoizedState=_,r.baseQueue===null&&(r.baseState=_),l.lastRenderedState=_}return[_,d]}function Ip(){}function Bp(i,r){var l=Pt,d=Vn(),g=r(),_=!ti(d.memoizedState,g);if(_&&(d.memoizedState=g,Nn=!0),d=d.queue,eu(Fp.bind(null,l,d,i),[i]),d.getSnapshot!==r||_||Jt!==null&&Jt.memoizedState.tag&1){if(l.flags|=2048,ho(9,zp.bind(null,l,d,g,r),void 0,null),Qt===null)throw Error(n(349));(Ns&30)!==0||Op(l,r,g)}return g}function Op(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=Pt.updateQueue,r===null?(r={lastEffect:null,stores:null},Pt.updateQueue=r,r.stores=[i]):(l=r.stores,l===null?r.stores=[i]:l.push(i))}function zp(i,r,l,d){r.value=l,r.getSnapshot=d,$p(r)&&Hp(i)}function Fp(i,r,l){return l(function(){$p(r)&&Hp(i)})}function $p(i){var r=i.getSnapshot;i=i.value;try{var l=r();return!ti(i,l)}catch{return!0}}function Hp(i){var r=Ri(i,1);r!==null&&oi(r,i,1,-1)}function Wp(i){var r=hi();return typeof i=="function"&&(i=i()),r.memoizedState=r.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:uo,lastRenderedState:i},r.queue=i,i=i.dispatch=mb.bind(null,Pt,i),[r.memoizedState,i]}function ho(i,r,l,d){return i={tag:i,create:r,destroy:l,deps:d,next:null},r=Pt.updateQueue,r===null?(r={lastEffect:null,stores:null},Pt.updateQueue=r,r.lastEffect=i.next=i):(l=r.lastEffect,l===null?r.lastEffect=i.next=i:(d=l.next,l.next=i,i.next=d,r.lastEffect=i)),i}function Up(){return Vn().memoizedState}function Ta(i,r,l,d){var g=hi();Pt.flags|=i,g.memoizedState=ho(1|r,l,void 0,d===void 0?null:d)}function Da(i,r,l,d){var g=Vn();d=d===void 0?null:d;var _=void 0;if(Wt!==null){var j=Wt.memoizedState;if(_=j.destroy,d!==null&&Gc(d,j.deps)){g.memoizedState=ho(r,l,_,d);return}}Pt.flags|=i,g.memoizedState=ho(1|r,l,_,d)}function Kp(i,r){return Ta(8390656,8,i,r)}function eu(i,r){return Da(2048,8,i,r)}function qp(i,r){return Da(4,2,i,r)}function Vp(i,r){return Da(4,4,i,r)}function Yp(i,r){if(typeof r=="function")return i=i(),r(i),function(){r(null)};if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function Gp(i,r,l){return l=l!=null?l.concat([i]):null,Da(4,4,Yp.bind(null,r,i),l)}function tu(){}function Xp(i,r){var l=Vn();r=r===void 0?null:r;var d=l.memoizedState;return d!==null&&r!==null&&Gc(r,d[1])?d[0]:(l.memoizedState=[i,r],i)}function Jp(i,r){var l=Vn();r=r===void 0?null:r;var d=l.memoizedState;return d!==null&&r!==null&&Gc(r,d[1])?d[0]:(i=i(),l.memoizedState=[i,r],i)}function Qp(i,r,l){return(Ns&21)===0?(i.baseState&&(i.baseState=!1,Nn=!0),i.memoizedState=l):(ti(l,r)||(l=Rf(),Pt.lanes|=l,Rs|=l,i.baseState=!0),r)}function fb(i,r){var l=ht;ht=l!==0&&4>l?l:4,i(!0);var d=Yc.transition;Yc.transition={};try{i(!1),r()}finally{ht=l,Yc.transition=d}}function Zp(){return Vn().memoizedState}function pb(i,r,l){var d=ns(i);if(l={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null},em(i))tm(r,l);else if(l=Lp(i,r,l,d),l!==null){var g=wn();oi(l,i,d,g),nm(l,r,d)}}function mb(i,r,l){var d=ns(i),g={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null};if(em(i))tm(r,g);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=r.lastRenderedReducer,_!==null))try{var j=r.lastRenderedState,K=_(j,l);if(g.hasEagerState=!0,g.eagerState=K,ti(K,j)){var Q=r.interleaved;Q===null?(g.next=g,Hc(r)):(g.next=Q.next,Q.next=g),r.interleaved=g;return}}catch{}finally{}l=Lp(i,r,g,d),l!==null&&(g=wn(),oi(l,i,d,g),nm(l,r,d))}}function em(i){var r=i.alternate;return i===Pt||r!==null&&r===Pt}function tm(i,r){lo=La=!0;var l=i.pending;l===null?r.next=r:(r.next=l.next,l.next=r),i.pending=r}function nm(i,r,l){if((l&4194240)!==0){var d=r.lanes;d&=i.pendingLanes,l|=d,r.lanes=l,ic(i,l)}}var Ma={readContext:qn,useCallback:pn,useContext:pn,useEffect:pn,useImperativeHandle:pn,useInsertionEffect:pn,useLayoutEffect:pn,useMemo:pn,useReducer:pn,useRef:pn,useState:pn,useDebugValue:pn,useDeferredValue:pn,useTransition:pn,useMutableSource:pn,useSyncExternalStore:pn,useId:pn,unstable_isNewReconciler:!1},gb={readContext:qn,useCallback:function(i,r){return hi().memoizedState=[i,r===void 0?null:r],i},useContext:qn,useEffect:Kp,useImperativeHandle:function(i,r,l){return l=l!=null?l.concat([i]):null,Ta(4194308,4,Yp.bind(null,r,i),l)},useLayoutEffect:function(i,r){return Ta(4194308,4,i,r)},useInsertionEffect:function(i,r){return Ta(4,2,i,r)},useMemo:function(i,r){var l=hi();return r=r===void 0?null:r,i=i(),l.memoizedState=[i,r],i},useReducer:function(i,r,l){var d=hi();return r=l!==void 0?l(r):r,d.memoizedState=d.baseState=r,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:r},d.queue=i,i=i.dispatch=pb.bind(null,Pt,i),[d.memoizedState,i]},useRef:function(i){var r=hi();return i={current:i},r.memoizedState=i},useState:Wp,useDebugValue:tu,useDeferredValue:function(i){return hi().memoizedState=i},useTransition:function(){var i=Wp(!1),r=i[0];return i=fb.bind(null,i[1]),hi().memoizedState=i,[r,i]},useMutableSource:function(){},useSyncExternalStore:function(i,r,l){var d=Pt,g=hi();if(kt){if(l===void 0)throw Error(n(407));l=l()}else{if(l=r(),Qt===null)throw Error(n(349));(Ns&30)!==0||Op(d,r,l)}g.memoizedState=l;var _={value:l,getSnapshot:r};return g.queue=_,Kp(Fp.bind(null,d,_,i),[i]),d.flags|=2048,ho(9,zp.bind(null,d,_,l,r),void 0,null),l},useId:function(){var i=hi(),r=Qt.identifierPrefix;if(kt){var l=Ni,d=Ei;l=(d&~(1<<32-ei(d)-1)).toString(32)+l,r=":"+r+"R"+l,l=co++,0<l&&(r+="H"+l.toString(32)),r+=":"}else l=hb++,r=":"+r+"r"+l.toString(32)+":";return i.memoizedState=r},unstable_isNewReconciler:!1},vb={readContext:qn,useCallback:Xp,useContext:qn,useEffect:eu,useImperativeHandle:Gp,useInsertionEffect:qp,useLayoutEffect:Vp,useMemo:Jp,useReducer:Qc,useRef:Up,useState:function(){return Qc(uo)},useDebugValue:tu,useDeferredValue:function(i){var r=Vn();return Qp(r,Wt.memoizedState,i)},useTransition:function(){var i=Qc(uo)[0],r=Vn().memoizedState;return[i,r]},useMutableSource:Ip,useSyncExternalStore:Bp,useId:Zp,unstable_isNewReconciler:!1},_b={readContext:qn,useCallback:Xp,useContext:qn,useEffect:eu,useImperativeHandle:Gp,useInsertionEffect:qp,useLayoutEffect:Vp,useMemo:Jp,useReducer:Zc,useRef:Up,useState:function(){return Zc(uo)},useDebugValue:tu,useDeferredValue:function(i){var r=Vn();return Wt===null?r.memoizedState=i:Qp(r,Wt.memoizedState,i)},useTransition:function(){var i=Zc(uo)[0],r=Vn().memoizedState;return[i,r]},useMutableSource:Ip,useSyncExternalStore:Bp,useId:Zp,unstable_isNewReconciler:!1};function ii(i,r){if(i&&i.defaultProps){r=B({},r),i=i.defaultProps;for(var l in i)r[l]===void 0&&(r[l]=i[l]);return r}return r}function nu(i,r,l,d){r=i.memoizedState,l=l(d,r),l=l==null?r:B({},r,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var Aa={isMounted:function(i){return(i=i._reactInternals)?Fe(i)===i:!1},enqueueSetState:function(i,r,l){i=i._reactInternals;var d=wn(),g=ns(i),_=ji(d,g);_.payload=r,l!=null&&(_.callback=l),r=Qi(i,_,g),r!==null&&(oi(r,i,g,d),Na(r,i,g))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var d=wn(),g=ns(i),_=ji(d,g);_.tag=1,_.payload=r,l!=null&&(_.callback=l),r=Qi(i,_,g),r!==null&&(oi(r,i,g,d),Na(r,i,g))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=wn(),d=ns(i),g=ji(l,d);g.tag=2,r!=null&&(g.callback=r),r=Qi(i,g,d),r!==null&&(oi(r,i,d,l),Na(r,i,d))}};function im(i,r,l,d,g,_,j){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(d,_,j):r.prototype&&r.prototype.isPureReactComponent?!Jr(l,d)||!Jr(g,_):!0}function sm(i,r,l){var d=!1,g=Gi,_=r.contextType;return typeof _=="object"&&_!==null?_=qn(_):(g=En(r)?bs:fn.current,d=r.contextTypes,_=(d=d!=null)?sr(i,g):Gi),r=new r(l,_),i.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Aa,i.stateNode=r,r._reactInternals=i,d&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=g,i.__reactInternalMemoizedMaskedChildContext=_),r}function rm(i,r,l,d){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,d),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,d),r.state!==i&&Aa.enqueueReplaceState(r,r.state,null)}function iu(i,r,l,d){var g=i.stateNode;g.props=l,g.state=i.memoizedState,g.refs={},Wc(i);var _=r.contextType;typeof _=="object"&&_!==null?g.context=qn(_):(_=En(r)?bs:fn.current,g.context=sr(i,_)),g.state=i.memoizedState,_=r.getDerivedStateFromProps,typeof _=="function"&&(nu(i,r,_,l),g.state=i.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(r=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),r!==g.state&&Aa.enqueueReplaceState(g,g.state,null),Ra(i,l,g,d),g.state=i.memoizedState),typeof g.componentDidMount=="function"&&(i.flags|=4194308)}function hr(i,r){try{var l="",d=r;do l+=de(d),d=d.return;while(d);var g=l}catch(_){g=`
39
39
  Error generating stack: `+_.message+`
40
- `+_.stack}return{value:i,source:r,stack:g,digest:null}}function su(i,r,l){return{value:i,source:null,stack:l??null,digest:r??null}}function ru(i,r){try{console.error(r.value)}catch(l){setTimeout(function(){throw l})}}var yb=typeof WeakMap=="function"?WeakMap:Map;function om(i,r,l){l=ji(-1,l),l.tag=3,l.payload={element:null};var d=r.value;return l.callback=function(){Ha||(Ha=!0,wu=d),ru(i,r)},l}function am(i,r,l){l=ji(-1,l),l.tag=3;var d=i.type.getDerivedStateFromError;if(typeof d=="function"){var g=r.value;l.payload=function(){return d(g)},l.callback=function(){ru(i,r)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(l.callback=function(){ru(i,r),typeof d!="function"&&(es===null?es=new Set([this]):es.add(this));var j=r.stack;this.componentDidCatch(r.value,{componentStack:j!==null?j:""})}),l}function lm(i,r,l){var d=i.pingCache;if(d===null){d=i.pingCache=new yb;var g=new Set;d.set(r,g)}else g=d.get(r),g===void 0&&(g=new Set,d.set(r,g));g.has(l)||(g.add(l),i=Db.bind(null,i,r,l),r.then(i,i))}function cm(i){do{var r;if((r=i.tag===13)&&(r=i.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return i;i=i.return}while(i!==null);return null}function um(i,r,l,d,g){return(i.mode&1)===0?(i===r?i.flags|=65536:(i.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(r=ji(-1,1),r.tag=2,Qi(l,r,1))),l.lanes|=1),i):(i.flags|=65536,i.lanes=g,i)}var wb=O.ReactCurrentOwner,Nn=!1;function yn(i,r,l,d){r.child=i===null?Pp(r,null,l,d):lr(r,i.child,l,d)}function dm(i,r,l,d,g){l=l.render;var _=r.ref;return ur(r,g),d=Xc(i,r,l,d,_,g),l=Jc(),i!==null&&!Nn?(r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~g,Pi(i,r,g)):(kt&&l&&Dc(r),r.flags|=1,yn(i,r,d,g),r.child)}function hm(i,r,l,d,g){if(i===null){var _=l.type;return typeof _=="function"&&!Nu(_)&&_.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(r.tag=15,r.type=_,fm(i,r,_,d,g)):(i=Ya(l.type,null,d,r,r.mode,g),i.ref=r.ref,i.return=r,r.child=i)}if(_=i.child,(i.lanes&g)===0){var j=_.memoizedProps;if(l=l.compare,l=l!==null?l:Jr,l(j,d)&&i.ref===r.ref)return Pi(i,r,g)}return r.flags|=1,i=ss(_,d),i.ref=r.ref,i.return=r,r.child=i}function fm(i,r,l,d,g){if(i!==null){var _=i.memoizedProps;if(Jr(_,d)&&i.ref===r.ref)if(Nn=!1,r.pendingProps=d=_,(i.lanes&g)!==0)(i.flags&131072)!==0&&(Nn=!0);else return r.lanes=i.lanes,Pi(i,r,g)}return ou(i,r,l,d,g)}function pm(i,r,l){var d=r.pendingProps,g=d.children,_=i!==null?i.memoizedState:null;if(d.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},mt(pr,An),An|=l;else{if((l&1073741824)===0)return i=_!==null?_.baseLanes|l:l,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:i,cachePool:null,transitions:null},r.updateQueue=null,mt(pr,An),An|=i,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=_!==null?_.baseLanes:l,mt(pr,An),An|=d}else _!==null?(d=_.baseLanes|l,r.memoizedState=null):d=l,mt(pr,An),An|=d;return yn(i,r,g,l),r.child}function mm(i,r){var l=r.ref;(i===null&&l!==null||i!==null&&i.ref!==l)&&(r.flags|=512,r.flags|=2097152)}function ou(i,r,l,d,g){var _=En(l)?bs:fn.current;return _=sr(r,_),ur(r,g),l=Xc(i,r,l,d,_,g),d=Jc(),i!==null&&!Nn?(r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~g,Pi(i,r,g)):(kt&&d&&Dc(r),r.flags|=1,yn(i,r,l,g),r.child)}function gm(i,r,l,d,g){if(En(l)){var _=!0;ya(r)}else _=!1;if(ur(r,g),r.stateNode===null)Ba(i,r),sm(r,l,d),iu(r,l,d,g),d=!0;else if(i===null){var j=r.stateNode,K=r.memoizedProps;j.props=K;var Q=j.context,ce=l.contextType;typeof ce=="object"&&ce!==null?ce=qn(ce):(ce=En(l)?bs:fn.current,ce=sr(r,ce));var ye=l.getDerivedStateFromProps,be=typeof ye=="function"||typeof j.getSnapshotBeforeUpdate=="function";be||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(K!==d||Q!==ce)&&rm(r,j,d,ce),Ji=!1;var _e=r.memoizedState;j.state=_e,Ra(r,d,j,g),Q=r.memoizedState,K!==d||_e!==Q||Cn.current||Ji?(typeof ye=="function"&&(nu(r,l,ye,d),Q=r.memoizedState),(K=Ji||im(r,l,K,d,_e,Q,ce))?(be||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(r.flags|=4194308)):(typeof j.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=Q),j.props=d,j.state=Q,j.context=ce,d=K):(typeof j.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{j=r.stateNode,Tp(i,r),K=r.memoizedProps,ce=r.type===r.elementType?K:ii(r.type,K),j.props=ce,be=r.pendingProps,_e=j.context,Q=l.contextType,typeof Q=="object"&&Q!==null?Q=qn(Q):(Q=En(l)?bs:fn.current,Q=sr(r,Q));var Le=l.getDerivedStateFromProps;(ye=typeof Le=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(K!==be||_e!==Q)&&rm(r,j,d,Q),Ji=!1,_e=r.memoizedState,j.state=_e,Ra(r,d,j,g);var De=r.memoizedState;K!==be||_e!==De||Cn.current||Ji?(typeof Le=="function"&&(nu(r,l,Le,d),De=r.memoizedState),(ce=Ji||im(r,l,ce,d,_e,De,Q)||!1)?(ye||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,De,Q),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,De,Q)),typeof j.componentDidUpdate=="function"&&(r.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof j.componentDidUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=De),j.props=d,j.state=De,j.context=Q,d=ce):(typeof j.componentDidUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=1024),d=!1)}return au(i,r,l,d,_,g)}function au(i,r,l,d,g,_){mm(i,r);var j=(r.flags&128)!==0;if(!d&&!j)return g&&Sp(r,l,!1),Pi(i,r,_);d=r.stateNode,wb.current=r;var K=j&&typeof l.getDerivedStateFromError!="function"?null:d.render();return r.flags|=1,i!==null&&j?(r.child=lr(r,i.child,null,_),r.child=lr(r,null,K,_)):yn(i,r,K,_),r.memoizedState=d.state,g&&Sp(r,l,!0),r.child}function vm(i){var r=i.stateNode;r.pendingContext?yp(i,r.pendingContext,r.pendingContext!==r.context):r.context&&yp(i,r.context,!1),Uc(i,r.containerInfo)}function _m(i,r,l,d,g){return ar(),Bc(g),r.flags|=256,yn(i,r,l,d),r.child}var lu={dehydrated:null,treeContext:null,retryLane:0};function cu(i){return{baseLanes:i,cachePool:null,transitions:null}}function ym(i,r,l){var d=r.pendingProps,g=jt.current,_=!1,j=(r.flags&128)!==0,K;if((K=j)||(K=i!==null&&i.memoizedState===null?!1:(g&2)!==0),K?(_=!0,r.flags&=-129):(i===null||i.memoizedState!==null)&&(g|=1),mt(jt,g&1),i===null)return Ic(r),i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((r.mode&1)===0?r.lanes=1:i.data==="$!"?r.lanes=8:r.lanes=1073741824,null):(j=d.children,i=d.fallback,_?(d=r.mode,_=r.child,j={mode:"hidden",children:j},(d&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=j):_=Ga(j,d,0,null),i=Ts(i,d,l,null),_.return=r,i.return=r,_.sibling=i,r.child=_,r.child.memoizedState=cu(l),r.memoizedState=lu,i):uu(r,j));if(g=i.memoizedState,g!==null&&(K=g.dehydrated,K!==null))return Sb(i,r,j,d,K,g,l);if(_){_=d.fallback,j=r.mode,g=i.child,K=g.sibling;var Q={mode:"hidden",children:d.children};return(j&1)===0&&r.child!==g?(d=r.child,d.childLanes=0,d.pendingProps=Q,r.deletions=null):(d=ss(g,Q),d.subtreeFlags=g.subtreeFlags&14680064),K!==null?_=ss(K,_):(_=Ts(_,j,l,null),_.flags|=2),_.return=r,d.return=r,d.sibling=_,r.child=d,d=_,_=r.child,j=i.child.memoizedState,j=j===null?cu(l):{baseLanes:j.baseLanes|l,cachePool:null,transitions:j.transitions},_.memoizedState=j,_.childLanes=i.childLanes&~l,r.memoizedState=lu,d}return _=i.child,i=_.sibling,d=ss(_,{mode:"visible",children:d.children}),(r.mode&1)===0&&(d.lanes=l),d.return=r,d.sibling=null,i!==null&&(l=r.deletions,l===null?(r.deletions=[i],r.flags|=16):l.push(i)),r.child=d,r.memoizedState=null,d}function uu(i,r){return r=Ga({mode:"visible",children:r},i.mode,0,null),r.return=i,i.child=r}function Ia(i,r,l,d){return d!==null&&Bc(d),lr(r,i.child,null,l),i=uu(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function Sb(i,r,l,d,g,_,j){if(l)return r.flags&256?(r.flags&=-257,d=su(Error(n(422))),Ia(i,r,j,d)):r.memoizedState!==null?(r.child=i.child,r.flags|=128,null):(_=d.fallback,g=r.mode,d=Ga({mode:"visible",children:d.children},g,0,null),_=Ts(_,g,j,null),_.flags|=2,d.return=r,_.return=r,d.sibling=_,r.child=d,(r.mode&1)!==0&&lr(r,i.child,null,j),r.child.memoizedState=cu(j),r.memoizedState=lu,_);if((r.mode&1)===0)return Ia(i,r,j,null);if(g.data==="$!"){if(d=g.nextSibling&&g.nextSibling.dataset,d)var K=d.dgst;return d=K,_=Error(n(419)),d=su(_,d,void 0),Ia(i,r,j,d)}if(K=(j&i.childLanes)!==0,Nn||K){if(d=Qt,d!==null){switch(j&-j){case 4:g=2;break;case 16:g=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:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(d.suspendedLanes|j))!==0?0:g,g!==0&&g!==_.retryLane&&(_.retryLane=g,Ri(i,g),oi(d,i,g,-1))}return Eu(),d=su(Error(n(421))),Ia(i,r,j,d)}return g.data==="$?"?(r.flags|=128,r.child=i.child,r=Mb.bind(null,i),g._reactRetry=r,null):(i=_.treeContext,Mn=Vi(g.nextSibling),Dn=r,kt=!0,ni=null,i!==null&&(Un[Kn++]=Ei,Un[Kn++]=Ni,Un[Kn++]=xs,Ei=i.id,Ni=i.overflow,xs=r),r=uu(r,d.children),r.flags|=4096,r)}function wm(i,r,l){i.lanes|=r;var d=i.alternate;d!==null&&(d.lanes|=r),$c(i.return,r,l)}function du(i,r,l,d,g){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=d,_.tail=l,_.tailMode=g)}function Sm(i,r,l){var d=r.pendingProps,g=d.revealOrder,_=d.tail;if(yn(i,r,d.children,l),d=jt.current,(d&2)!==0)d=d&1|2,r.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&wm(i,l,r);else if(i.tag===19)wm(i,l,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}d&=1}if(mt(jt,d),(r.mode&1)===0)r.memoizedState=null;else switch(g){case"forwards":for(l=r.child,g=null;l!==null;)i=l.alternate,i!==null&&ja(i)===null&&(g=l),l=l.sibling;l=g,l===null?(g=r.child,r.child=null):(g=l.sibling,l.sibling=null),du(r,!1,g,l,_);break;case"backwards":for(l=null,g=r.child,r.child=null;g!==null;){if(i=g.alternate,i!==null&&ja(i)===null){r.child=g;break}i=g.sibling,g.sibling=l,l=g,g=i}du(r,!0,l,null,_);break;case"together":du(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function Ba(i,r){(r.mode&1)===0&&i!==null&&(i.alternate=null,r.alternate=null,r.flags|=2)}function Pi(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),Rs|=r.lanes,(l&r.childLanes)===0)return null;if(i!==null&&r.child!==i.child)throw Error(n(153));if(r.child!==null){for(i=r.child,l=ss(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=ss(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function bb(i,r,l){switch(r.tag){case 3:vm(r),ar();break;case 5:Ap(r);break;case 1:En(r.type)&&ya(r);break;case 4:Uc(r,r.stateNode.containerInfo);break;case 10:var d=r.type._context,g=r.memoizedProps.value;mt(Ca,d._currentValue),d._currentValue=g;break;case 13:if(d=r.memoizedState,d!==null)return d.dehydrated!==null?(mt(jt,jt.current&1),r.flags|=128,null):(l&r.child.childLanes)!==0?ym(i,r,l):(mt(jt,jt.current&1),i=Pi(i,r,l),i!==null?i.sibling:null);mt(jt,jt.current&1);break;case 19:if(d=(l&r.childLanes)!==0,(i.flags&128)!==0){if(d)return Sm(i,r,l);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),mt(jt,jt.current),d)break;return null;case 22:case 23:return r.lanes=0,pm(i,r,l)}return Pi(i,r,l)}var bm,hu,xm,km;bm=function(i,r){for(var l=r.child;l!==null;){if(l.tag===5||l.tag===6)i.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},hu=function(){},xm=function(i,r,l,d){var g=i.memoizedProps;if(g!==d){i=r.stateNode,Es(di.current);var _=null;switch(l){case"input":g=vt(i,g),d=vt(i,d),_=[];break;case"select":g=B({},g,{value:void 0}),d=B({},d,{value:void 0}),_=[];break;case"textarea":g=dt(i,g),d=dt(i,d),_=[];break;default:typeof g.onClick!="function"&&typeof d.onClick=="function"&&(i.onclick=ga)}je(l,d);var j;l=null;for(ce in g)if(!d.hasOwnProperty(ce)&&g.hasOwnProperty(ce)&&g[ce]!=null)if(ce==="style"){var K=g[ce];for(j in K)K.hasOwnProperty(j)&&(l||(l={}),l[j]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(o.hasOwnProperty(ce)?_||(_=[]):(_=_||[]).push(ce,null));for(ce in d){var Q=d[ce];if(K=g!=null?g[ce]:void 0,d.hasOwnProperty(ce)&&Q!==K&&(Q!=null||K!=null))if(ce==="style")if(K){for(j in K)!K.hasOwnProperty(j)||Q&&Q.hasOwnProperty(j)||(l||(l={}),l[j]="");for(j in Q)Q.hasOwnProperty(j)&&K[j]!==Q[j]&&(l||(l={}),l[j]=Q[j])}else l||(_||(_=[]),_.push(ce,l)),l=Q;else ce==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,K=K?K.__html:void 0,Q!=null&&K!==Q&&(_=_||[]).push(ce,Q)):ce==="children"?typeof Q!="string"&&typeof Q!="number"||(_=_||[]).push(ce,""+Q):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(o.hasOwnProperty(ce)?(Q!=null&&ce==="onScroll"&&_t("scroll",i),_||K===Q||(_=[])):(_=_||[]).push(ce,Q))}l&&(_=_||[]).push("style",l);var ce=_;(r.updateQueue=ce)&&(r.flags|=4)}},km=function(i,r,l,d){l!==d&&(r.flags|=4)};function fo(i,r){if(!kt)switch(i.tailMode){case"hidden":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function mn(i){var r=i.alternate!==null&&i.alternate.child===i.child,l=0,d=0;if(r)for(var g=i.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags&14680064,d|=g.flags&14680064,g.return=i,g=g.sibling;else for(g=i.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=i,g=g.sibling;return i.subtreeFlags|=d,i.childLanes=l,r}function xb(i,r,l){var d=r.pendingProps;switch(Mc(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(r),null;case 1:return En(r.type)&&_a(),mn(r),null;case 3:return d=r.stateNode,dr(),yt(Cn),yt(fn),Vc(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(xa(r)?r.flags|=4:i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,ni!==null&&(xu(ni),ni=null))),hu(i,r),mn(r),null;case 5:Kc(r);var g=Es(ao.current);if(l=r.type,i!==null&&r.stateNode!=null)xm(i,r,l,d,g),i.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!d){if(r.stateNode===null)throw Error(n(166));return mn(r),null}if(i=Es(di.current),xa(r)){d=r.stateNode,l=r.type;var _=r.memoizedProps;switch(d[ui]=r,d[no]=_,i=(r.mode&1)!==0,l){case"dialog":_t("cancel",d),_t("close",d);break;case"iframe":case"object":case"embed":_t("load",d);break;case"video":case"audio":for(g=0;g<Zr.length;g++)_t(Zr[g],d);break;case"source":_t("error",d);break;case"img":case"image":case"link":_t("error",d),_t("load",d);break;case"details":_t("toggle",d);break;case"input":Xe(d,_),_t("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!_.multiple},_t("invalid",d);break;case"textarea":le(d,_),_t("invalid",d)}je(l,_),g=null;for(var j in _)if(_.hasOwnProperty(j)){var K=_[j];j==="children"?typeof K=="string"?d.textContent!==K&&(_.suppressHydrationWarning!==!0&&ma(d.textContent,K,i),g=["children",K]):typeof K=="number"&&d.textContent!==""+K&&(_.suppressHydrationWarning!==!0&&ma(d.textContent,K,i),g=["children",""+K]):o.hasOwnProperty(j)&&K!=null&&j==="onScroll"&&_t("scroll",d)}switch(l){case"input":Ze(d),rt(d,_,!0);break;case"textarea":Ze(d),ze(d);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(d.onclick=ga)}d=g,r.updateQueue=d,d!==null&&(r.flags|=4)}else{j=g.nodeType===9?g:g.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ie(l)),i==="http://www.w3.org/1999/xhtml"?l==="script"?(i=j.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof d.is=="string"?i=j.createElement(l,{is:d.is}):(i=j.createElement(l),l==="select"&&(j=i,d.multiple?j.multiple=!0:d.size&&(j.size=d.size))):i=j.createElementNS(i,l),i[ui]=r,i[no]=d,bm(i,r,!1,!1),r.stateNode=i;e:{switch(j=st(l,d),l){case"dialog":_t("cancel",i),_t("close",i),g=d;break;case"iframe":case"object":case"embed":_t("load",i),g=d;break;case"video":case"audio":for(g=0;g<Zr.length;g++)_t(Zr[g],i);g=d;break;case"source":_t("error",i),g=d;break;case"img":case"image":case"link":_t("error",i),_t("load",i),g=d;break;case"details":_t("toggle",i),g=d;break;case"input":Xe(i,d),g=vt(i,d),_t("invalid",i);break;case"option":g=d;break;case"select":i._wrapperState={wasMultiple:!!d.multiple},g=B({},d,{value:void 0}),_t("invalid",i);break;case"textarea":le(i,d),g=dt(i,d),_t("invalid",i);break;default:g=d}je(l,g),K=g;for(_ in K)if(K.hasOwnProperty(_)){var Q=K[_];_==="style"?Re(i,Q):_==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&ie(i,Q)):_==="children"?typeof Q=="string"?(l!=="textarea"||Q!=="")&&W(i,Q):typeof Q=="number"&&W(i,""+Q):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(o.hasOwnProperty(_)?Q!=null&&_==="onScroll"&&_t("scroll",i):Q!=null&&$(i,_,Q,j))}switch(l){case"input":Ze(i),rt(i,d,!1);break;case"textarea":Ze(i),ze(i);break;case"option":d.value!=null&&i.setAttribute("value",""+ee(d.value));break;case"select":i.multiple=!!d.multiple,_=d.value,_!=null?ut(i,!!d.multiple,_,!1):d.defaultValue!=null&&ut(i,!!d.multiple,d.defaultValue,!0);break;default:typeof g.onClick=="function"&&(i.onclick=ga)}switch(l){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}}d&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return mn(r),null;case 6:if(i&&r.stateNode!=null)km(i,r,i.memoizedProps,d);else{if(typeof d!="string"&&r.stateNode===null)throw Error(n(166));if(l=Es(ao.current),Es(di.current),xa(r)){if(d=r.stateNode,l=r.memoizedProps,d[ui]=r,(_=d.nodeValue!==l)&&(i=Dn,i!==null))switch(i.tag){case 3:ma(d.nodeValue,l,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&ma(d.nodeValue,l,(i.mode&1)!==0)}_&&(r.flags|=4)}else d=(l.nodeType===9?l:l.ownerDocument).createTextNode(d),d[ui]=r,r.stateNode=d}return mn(r),null;case 13:if(yt(jt),d=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(kt&&Mn!==null&&(r.mode&1)!==0&&(r.flags&128)===0)Np(),ar(),r.flags|=98560,_=!1;else if(_=xa(r),d!==null&&d.dehydrated!==null){if(i===null){if(!_)throw Error(n(318));if(_=r.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[ui]=r}else ar(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mn(r),_=!1}else ni!==null&&(xu(ni),ni=null),_=!0;if(!_)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=l,r):(d=d!==null,d!==(i!==null&&i.memoizedState!==null)&&d&&(r.child.flags|=8192,(r.mode&1)!==0&&(i===null||(jt.current&1)!==0?Ut===0&&(Ut=3):Eu())),r.updateQueue!==null&&(r.flags|=4),mn(r),null);case 4:return dr(),hu(i,r),i===null&&eo(r.stateNode.containerInfo),mn(r),null;case 10:return Fc(r.type._context),mn(r),null;case 17:return En(r.type)&&_a(),mn(r),null;case 19:if(yt(jt),_=r.memoizedState,_===null)return mn(r),null;if(d=(r.flags&128)!==0,j=_.rendering,j===null)if(d)fo(_,!1);else{if(Ut!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(j=ja(i),j!==null){for(r.flags|=128,fo(_,!1),d=j.updateQueue,d!==null&&(r.updateQueue=d,r.flags|=4),r.subtreeFlags=0,d=l,l=r.child;l!==null;)_=l,i=d,_.flags&=14680066,j=_.alternate,j===null?(_.childLanes=0,_.lanes=i,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=j.childLanes,_.lanes=j.lanes,_.child=j.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=j.memoizedProps,_.memoizedState=j.memoizedState,_.updateQueue=j.updateQueue,_.type=j.type,i=j.dependencies,_.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),l=l.sibling;return mt(jt,jt.current&1|2),r.child}i=i.sibling}_.tail!==null&&Bt()>mr&&(r.flags|=128,d=!0,fo(_,!1),r.lanes=4194304)}else{if(!d)if(i=ja(j),i!==null){if(r.flags|=128,d=!0,l=i.updateQueue,l!==null&&(r.updateQueue=l,r.flags|=4),fo(_,!0),_.tail===null&&_.tailMode==="hidden"&&!j.alternate&&!kt)return mn(r),null}else 2*Bt()-_.renderingStartTime>mr&&l!==1073741824&&(r.flags|=128,d=!0,fo(_,!1),r.lanes=4194304);_.isBackwards?(j.sibling=r.child,r.child=j):(l=_.last,l!==null?l.sibling=j:r.child=j,_.last=j)}return _.tail!==null?(r=_.tail,_.rendering=r,_.tail=r.sibling,_.renderingStartTime=Bt(),r.sibling=null,l=jt.current,mt(jt,d?l&1|2:l&1),r):(mn(r),null);case 22:case 23:return Cu(),d=r.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(r.flags|=8192),d&&(r.mode&1)!==0?(An&1073741824)!==0&&(mn(r),r.subtreeFlags&6&&(r.flags|=8192)):mn(r),null;case 24:return null;case 25:return null}throw Error(n(156,r.tag))}function kb(i,r){switch(Mc(r),r.tag){case 1:return En(r.type)&&_a(),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return dr(),yt(Cn),yt(fn),Vc(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 5:return Kc(r),null;case 13:if(yt(jt),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(n(340));ar()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return yt(jt),null;case 4:return dr(),null;case 10:return Fc(r.type._context),null;case 22:case 23:return Cu(),null;case 24:return null;default:return null}}var Oa=!1,gn=!1,Cb=typeof WeakSet=="function"?WeakSet:Set,Te=null;function fr(i,r){var l=i.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(d){Dt(i,r,d)}else l.current=null}function fu(i,r,l){try{l()}catch(d){Dt(i,r,d)}}var Cm=!1;function Eb(i,r){if(Cc=sa,i=ip(),vc(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var g=d.anchorOffset,_=d.focusNode;d=d.focusOffset;try{l.nodeType,_.nodeType}catch{l=null;break e}var j=0,K=-1,Q=-1,ce=0,ye=0,be=i,_e=null;t:for(;;){for(var Le;be!==l||g!==0&&be.nodeType!==3||(K=j+g),be!==_||d!==0&&be.nodeType!==3||(Q=j+d),be.nodeType===3&&(j+=be.nodeValue.length),(Le=be.firstChild)!==null;)_e=be,be=Le;for(;;){if(be===i)break t;if(_e===l&&++ce===g&&(K=j),_e===_&&++ye===d&&(Q=j),(Le=be.nextSibling)!==null)break;be=_e,_e=be.parentNode}be=Le}l=K===-1||Q===-1?null:{start:K,end:Q}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ec={focusedElem:i,selectionRange:l},sa=!1,Te=r;Te!==null;)if(r=Te,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Te=i;else for(;Te!==null;){r=Te;try{var De=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(De!==null){var Me=De.memoizedProps,Ot=De.memoizedState,re=r.stateNode,te=re.getSnapshotBeforeUpdate(r.elementType===r.type?Me:ii(r.type,Me),Ot);re.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var ae=r.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ce){Dt(r,r.return,Ce)}if(i=r.sibling,i!==null){i.return=r.return,Te=i;break}Te=r.return}return De=Cm,Cm=!1,De}function po(i,r,l){var d=r.updateQueue;if(d=d!==null?d.lastEffect:null,d!==null){var g=d=d.next;do{if((g.tag&i)===i){var _=g.destroy;g.destroy=void 0,_!==void 0&&fu(r,l,_)}g=g.next}while(g!==d)}}function za(i,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&i)===i){var d=l.create;l.destroy=d()}l=l.next}while(l!==r)}}function pu(i){var r=i.ref;if(r!==null){var l=i.stateNode;switch(i.tag){case 5:i=l;break;default:i=l}typeof r=="function"?r(i):r.current=i}}function Em(i){var r=i.alternate;r!==null&&(i.alternate=null,Em(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&(delete r[ui],delete r[no],delete r[Pc],delete r[lb],delete r[cb])),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 Nm(i){return i.tag===5||i.tag===3||i.tag===4}function Rm(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Nm(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 mu(i,r,l){var d=i.tag;if(d===5||d===6)i=i.stateNode,r?l.nodeType===8?l.parentNode.insertBefore(i,r):l.insertBefore(i,r):(l.nodeType===8?(r=l.parentNode,r.insertBefore(i,l)):(r=l,r.appendChild(i)),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=ga));else if(d!==4&&(i=i.child,i!==null))for(mu(i,r,l),i=i.sibling;i!==null;)mu(i,r,l),i=i.sibling}function gu(i,r,l){var d=i.tag;if(d===5||d===6)i=i.stateNode,r?l.insertBefore(i,r):l.appendChild(i);else if(d!==4&&(i=i.child,i!==null))for(gu(i,r,l),i=i.sibling;i!==null;)gu(i,r,l),i=i.sibling}var ln=null,si=!1;function Zi(i,r,l){for(l=l.child;l!==null;)jm(i,r,l),l=l.sibling}function jm(i,r,l){if(ci&&typeof ci.onCommitFiberUnmount=="function")try{ci.onCommitFiberUnmount(Qo,l)}catch{}switch(l.tag){case 5:gn||fr(l,r);case 6:var d=ln,g=si;ln=null,Zi(i,r,l),ln=d,si=g,ln!==null&&(si?(i=ln,l=l.stateNode,i.nodeType===8?i.parentNode.removeChild(l):i.removeChild(l)):ln.removeChild(l.stateNode));break;case 18:ln!==null&&(si?(i=ln,l=l.stateNode,i.nodeType===8?jc(i.parentNode,l):i.nodeType===1&&jc(i,l),Kr(i)):jc(ln,l.stateNode));break;case 4:d=ln,g=si,ln=l.stateNode.containerInfo,si=!0,Zi(i,r,l),ln=d,si=g;break;case 0:case 11:case 14:case 15:if(!gn&&(d=l.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){g=d=d.next;do{var _=g,j=_.destroy;_=_.tag,j!==void 0&&((_&2)!==0||(_&4)!==0)&&fu(l,r,j),g=g.next}while(g!==d)}Zi(i,r,l);break;case 1:if(!gn&&(fr(l,r),d=l.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=l.memoizedProps,d.state=l.memoizedState,d.componentWillUnmount()}catch(K){Dt(l,r,K)}Zi(i,r,l);break;case 21:Zi(i,r,l);break;case 22:l.mode&1?(gn=(d=gn)||l.memoizedState!==null,Zi(i,r,l),gn=d):Zi(i,r,l);break;default:Zi(i,r,l)}}function Pm(i){var r=i.updateQueue;if(r!==null){i.updateQueue=null;var l=i.stateNode;l===null&&(l=i.stateNode=new Cb),r.forEach(function(d){var g=Ab.bind(null,i,d);l.has(d)||(l.add(d),d.then(g,g))})}}function ri(i,r){var l=r.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d];try{var _=i,j=r,K=j;e:for(;K!==null;){switch(K.tag){case 5:ln=K.stateNode,si=!1;break e;case 3:ln=K.stateNode.containerInfo,si=!0;break e;case 4:ln=K.stateNode.containerInfo,si=!0;break e}K=K.return}if(ln===null)throw Error(n(160));jm(_,j,g),ln=null,si=!1;var Q=g.alternate;Q!==null&&(Q.return=null),g.return=null}catch(ce){Dt(g,r,ce)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)Lm(r,i),r=r.sibling}function Lm(i,r){var l=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(ri(r,i),fi(i),d&4){try{po(3,i,i.return),za(3,i)}catch(Me){Dt(i,i.return,Me)}try{po(5,i,i.return)}catch(Me){Dt(i,i.return,Me)}}break;case 1:ri(r,i),fi(i),d&512&&l!==null&&fr(l,l.return);break;case 5:if(ri(r,i),fi(i),d&512&&l!==null&&fr(l,l.return),i.flags&32){var g=i.stateNode;try{W(g,"")}catch(Me){Dt(i,i.return,Me)}}if(d&4&&(g=i.stateNode,g!=null)){var _=i.memoizedProps,j=l!==null?l.memoizedProps:_,K=i.type,Q=i.updateQueue;if(i.updateQueue=null,Q!==null)try{K==="input"&&_.type==="radio"&&_.name!=null&&St(g,_),st(K,j);var ce=st(K,_);for(j=0;j<Q.length;j+=2){var ye=Q[j],be=Q[j+1];ye==="style"?Re(g,be):ye==="dangerouslySetInnerHTML"?ie(g,be):ye==="children"?W(g,be):$(g,ye,be,ce)}switch(K){case"input":Et(g,_);break;case"textarea":xe(g,_);break;case"select":var _e=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!_.multiple;var Le=_.value;Le!=null?ut(g,!!_.multiple,Le,!1):_e!==!!_.multiple&&(_.defaultValue!=null?ut(g,!!_.multiple,_.defaultValue,!0):ut(g,!!_.multiple,_.multiple?[]:"",!1))}g[no]=_}catch(Me){Dt(i,i.return,Me)}}break;case 6:if(ri(r,i),fi(i),d&4){if(i.stateNode===null)throw Error(n(162));g=i.stateNode,_=i.memoizedProps;try{g.nodeValue=_}catch(Me){Dt(i,i.return,Me)}}break;case 3:if(ri(r,i),fi(i),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Kr(r.containerInfo)}catch(Me){Dt(i,i.return,Me)}break;case 4:ri(r,i),fi(i);break;case 13:ri(r,i),fi(i),g=i.child,g.flags&8192&&(_=g.memoizedState!==null,g.stateNode.isHidden=_,!_||g.alternate!==null&&g.alternate.memoizedState!==null||(yu=Bt())),d&4&&Pm(i);break;case 22:if(ye=l!==null&&l.memoizedState!==null,i.mode&1?(gn=(ce=gn)||ye,ri(r,i),gn=ce):ri(r,i),fi(i),d&8192){if(ce=i.memoizedState!==null,(i.stateNode.isHidden=ce)&&!ye&&(i.mode&1)!==0)for(Te=i,ye=i.child;ye!==null;){for(be=Te=ye;Te!==null;){switch(_e=Te,Le=_e.child,_e.tag){case 0:case 11:case 14:case 15:po(4,_e,_e.return);break;case 1:fr(_e,_e.return);var De=_e.stateNode;if(typeof De.componentWillUnmount=="function"){d=_e,l=_e.return;try{r=d,De.props=r.memoizedProps,De.state=r.memoizedState,De.componentWillUnmount()}catch(Me){Dt(d,l,Me)}}break;case 5:fr(_e,_e.return);break;case 22:if(_e.memoizedState!==null){Mm(be);continue}}Le!==null?(Le.return=_e,Te=Le):Mm(be)}ye=ye.sibling}e:for(ye=null,be=i;;){if(be.tag===5){if(ye===null){ye=be;try{g=be.stateNode,ce?(_=g.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(K=be.stateNode,Q=be.memoizedProps.style,j=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,K.style.display=ke("display",j))}catch(Me){Dt(i,i.return,Me)}}}else if(be.tag===6){if(ye===null)try{be.stateNode.nodeValue=ce?"":be.memoizedProps}catch(Me){Dt(i,i.return,Me)}}else if((be.tag!==22&&be.tag!==23||be.memoizedState===null||be===i)&&be.child!==null){be.child.return=be,be=be.child;continue}if(be===i)break e;for(;be.sibling===null;){if(be.return===null||be.return===i)break e;ye===be&&(ye=null),be=be.return}ye===be&&(ye=null),be.sibling.return=be.return,be=be.sibling}}break;case 19:ri(r,i),fi(i),d&4&&Pm(i);break;case 21:break;default:ri(r,i),fi(i)}}function fi(i){var r=i.flags;if(r&2){try{e:{for(var l=i.return;l!==null;){if(Nm(l)){var d=l;break e}l=l.return}throw Error(n(160))}switch(d.tag){case 5:var g=d.stateNode;d.flags&32&&(W(g,""),d.flags&=-33);var _=Rm(i);gu(i,_,g);break;case 3:case 4:var j=d.stateNode.containerInfo,K=Rm(i);mu(i,K,j);break;default:throw Error(n(161))}}catch(Q){Dt(i,i.return,Q)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function Nb(i,r,l){Te=i,Tm(i)}function Tm(i,r,l){for(var d=(i.mode&1)!==0;Te!==null;){var g=Te,_=g.child;if(g.tag===22&&d){var j=g.memoizedState!==null||Oa;if(!j){var K=g.alternate,Q=K!==null&&K.memoizedState!==null||gn;K=Oa;var ce=gn;if(Oa=j,(gn=Q)&&!ce)for(Te=g;Te!==null;)j=Te,Q=j.child,j.tag===22&&j.memoizedState!==null?Am(g):Q!==null?(Q.return=j,Te=Q):Am(g);for(;_!==null;)Te=_,Tm(_),_=_.sibling;Te=g,Oa=K,gn=ce}Dm(i)}else(g.subtreeFlags&8772)!==0&&_!==null?(_.return=g,Te=_):Dm(i)}}function Dm(i){for(;Te!==null;){var r=Te;if((r.flags&8772)!==0){var l=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:gn||za(5,r);break;case 1:var d=r.stateNode;if(r.flags&4&&!gn)if(l===null)d.componentDidMount();else{var g=r.elementType===r.type?l.memoizedProps:ii(r.type,l.memoizedProps);d.componentDidUpdate(g,l.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var _=r.updateQueue;_!==null&&Mp(r,_,d);break;case 3:var j=r.updateQueue;if(j!==null){if(l=null,r.child!==null)switch(r.child.tag){case 5:l=r.child.stateNode;break;case 1:l=r.child.stateNode}Mp(r,j,l)}break;case 5:var K=r.stateNode;if(l===null&&r.flags&4){l=K;var Q=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&l.focus();break;case"img":Q.src&&(l.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var ce=r.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var be=ye.dehydrated;be!==null&&Kr(be)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}gn||r.flags&512&&pu(r)}catch(_e){Dt(r,r.return,_e)}}if(r===i){Te=null;break}if(l=r.sibling,l!==null){l.return=r.return,Te=l;break}Te=r.return}}function Mm(i){for(;Te!==null;){var r=Te;if(r===i){Te=null;break}var l=r.sibling;if(l!==null){l.return=r.return,Te=l;break}Te=r.return}}function Am(i){for(;Te!==null;){var r=Te;try{switch(r.tag){case 0:case 11:case 15:var l=r.return;try{za(4,r)}catch(Q){Dt(r,l,Q)}break;case 1:var d=r.stateNode;if(typeof d.componentDidMount=="function"){var g=r.return;try{d.componentDidMount()}catch(Q){Dt(r,g,Q)}}var _=r.return;try{pu(r)}catch(Q){Dt(r,_,Q)}break;case 5:var j=r.return;try{pu(r)}catch(Q){Dt(r,j,Q)}}}catch(Q){Dt(r,r.return,Q)}if(r===i){Te=null;break}var K=r.sibling;if(K!==null){K.return=r.return,Te=K;break}Te=r.return}}var Rb=Math.ceil,Fa=O.ReactCurrentDispatcher,vu=O.ReactCurrentOwner,Yn=O.ReactCurrentBatchConfig,at=0,Qt=null,Ft=null,cn=0,An=0,pr=Yi(0),Ut=0,mo=null,Rs=0,$a=0,_u=0,go=null,Rn=null,yu=0,mr=1/0,Li=null,Ha=!1,wu=null,es=null,Wa=!1,ts=null,Ua=0,vo=0,Su=null,Ka=-1,qa=0;function wn(){return(at&6)!==0?Bt():Ka!==-1?Ka:Ka=Bt()}function ns(i){return(i.mode&1)===0?1:(at&2)!==0&&cn!==0?cn&-cn:db.transition!==null?(qa===0&&(qa=Rf()),qa):(i=ht,i!==0||(i=window.event,i=i===void 0?16:Bf(i.type)),i)}function oi(i,r,l,d){if(50<vo)throw vo=0,Su=null,Error(n(185));Fr(i,l,d),((at&2)===0||i!==Qt)&&(i===Qt&&((at&2)===0&&($a|=l),Ut===4&&is(i,cn)),jn(i,d),l===1&&at===0&&(r.mode&1)===0&&(mr=Bt()+500,wa&&Xi()))}function jn(i,r){var l=i.callbackNode;dS(i,r);var d=ta(i,i===Qt?cn:0);if(d===0)l!==null&&Ys(l),i.callbackNode=null,i.callbackPriority=0;else if(r=d&-d,i.callbackPriority!==r){if(l!=null&&Ys(l),r===1)i.tag===0?ub(Bm.bind(null,i)):bp(Bm.bind(null,i)),ob(function(){(at&6)===0&&Xi()}),l=null;else{switch(jf(d)){case 1:l=ec;break;case 4:l=Ef;break;case 16:l=Jo;break;case 536870912:l=Nf;break;default:l=Jo}l=Km(l,Im.bind(null,i))}i.callbackPriority=r,i.callbackNode=l}}function Im(i,r){if(Ka=-1,qa=0,(at&6)!==0)throw Error(n(327));var l=i.callbackNode;if(gr()&&i.callbackNode!==l)return null;var d=ta(i,i===Qt?cn:0);if(d===0)return null;if((d&30)!==0||(d&i.expiredLanes)!==0||r)r=Va(i,d);else{r=d;var g=at;at|=2;var _=zm();(Qt!==i||cn!==r)&&(Li=null,mr=Bt()+500,Ps(i,r));do try{Lb();break}catch(K){Om(i,K)}while(!0);zc(),Fa.current=_,at=g,Ft!==null?r=0:(Qt=null,cn=0,r=Ut)}if(r!==0){if(r===2&&(g=tc(i),g!==0&&(d=g,r=bu(i,g))),r===1)throw l=mo,Ps(i,0),is(i,d),jn(i,Bt()),l;if(r===6)is(i,d);else{if(g=i.current.alternate,(d&30)===0&&!jb(g)&&(r=Va(i,d),r===2&&(_=tc(i),_!==0&&(d=_,r=bu(i,_))),r===1))throw l=mo,Ps(i,0),is(i,d),jn(i,Bt()),l;switch(i.finishedWork=g,i.finishedLanes=d,r){case 0:case 1:throw Error(n(345));case 2:Ls(i,Rn,Li);break;case 3:if(is(i,d),(d&130023424)===d&&(r=yu+500-Bt(),10<r)){if(ta(i,0)!==0)break;if(g=i.suspendedLanes,(g&d)!==d){wn(),i.pingedLanes|=i.suspendedLanes&g;break}i.timeoutHandle=Rc(Ls.bind(null,i,Rn,Li),r);break}Ls(i,Rn,Li);break;case 4:if(is(i,d),(d&4194240)===d)break;for(r=i.eventTimes,g=-1;0<d;){var j=31-ei(d);_=1<<j,j=r[j],j>g&&(g=j),d&=~_}if(d=g,d=Bt()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*Rb(d/1960))-d,10<d){i.timeoutHandle=Rc(Ls.bind(null,i,Rn,Li),d);break}Ls(i,Rn,Li);break;case 5:Ls(i,Rn,Li);break;default:throw Error(n(329))}}}return jn(i,Bt()),i.callbackNode===l?Im.bind(null,i):null}function bu(i,r){var l=go;return i.current.memoizedState.isDehydrated&&(Ps(i,r).flags|=256),i=Va(i,r),i!==2&&(r=Rn,Rn=l,r!==null&&xu(r)),i}function xu(i){Rn===null?Rn=i:Rn.push.apply(Rn,i)}function jb(i){for(var r=i;;){if(r.flags&16384){var l=r.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var d=0;d<l.length;d++){var g=l[d],_=g.getSnapshot;g=g.value;try{if(!ti(_(),g))return!1}catch{return!1}}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function is(i,r){for(r&=~_u,r&=~$a,i.suspendedLanes|=r,i.pingedLanes&=~r,i=i.expirationTimes;0<r;){var l=31-ei(r),d=1<<l;i[l]=-1,r&=~d}}function Bm(i){if((at&6)!==0)throw Error(n(327));gr();var r=ta(i,0);if((r&1)===0)return jn(i,Bt()),null;var l=Va(i,r);if(i.tag!==0&&l===2){var d=tc(i);d!==0&&(r=d,l=bu(i,d))}if(l===1)throw l=mo,Ps(i,0),is(i,r),jn(i,Bt()),l;if(l===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=r,Ls(i,Rn,Li),jn(i,Bt()),null}function ku(i,r){var l=at;at|=1;try{return i(r)}finally{at=l,at===0&&(mr=Bt()+500,wa&&Xi())}}function js(i){ts!==null&&ts.tag===0&&(at&6)===0&&gr();var r=at;at|=1;var l=Yn.transition,d=ht;try{if(Yn.transition=null,ht=1,i)return i()}finally{ht=d,Yn.transition=l,at=r,(at&6)===0&&Xi()}}function Cu(){An=pr.current,yt(pr)}function Ps(i,r){i.finishedWork=null,i.finishedLanes=0;var l=i.timeoutHandle;if(l!==-1&&(i.timeoutHandle=-1,rb(l)),Ft!==null)for(l=Ft.return;l!==null;){var d=l;switch(Mc(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&_a();break;case 3:dr(),yt(Cn),yt(fn),Vc();break;case 5:Kc(d);break;case 4:dr();break;case 13:yt(jt);break;case 19:yt(jt);break;case 10:Fc(d.type._context);break;case 22:case 23:Cu()}l=l.return}if(Qt=i,Ft=i=ss(i.current,null),cn=An=r,Ut=0,mo=null,_u=$a=Rs=0,Rn=go=null,Cs!==null){for(r=0;r<Cs.length;r++)if(l=Cs[r],d=l.interleaved,d!==null){l.interleaved=null;var g=d.next,_=l.pending;if(_!==null){var j=_.next;_.next=g,d.next=j}l.pending=d}Cs=null}return i}function Om(i,r){do{var l=Ft;try{if(zc(),Pa.current=Ma,La){for(var d=Pt.memoizedState;d!==null;){var g=d.queue;g!==null&&(g.pending=null),d=d.next}La=!1}if(Ns=0,Jt=Wt=Pt=null,lo=!1,co=0,vu.current=null,l===null||l.return===null){Ut=1,mo=r,Ft=null;break}e:{var _=i,j=l.return,K=l,Q=r;if(r=cn,K.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ce=Q,ye=K,be=ye.tag;if((ye.mode&1)===0&&(be===0||be===11||be===15)){var _e=ye.alternate;_e?(ye.updateQueue=_e.updateQueue,ye.memoizedState=_e.memoizedState,ye.lanes=_e.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Le=cm(j);if(Le!==null){Le.flags&=-257,um(Le,j,K,_,r),Le.mode&1&&lm(_,ce,r),r=Le,Q=ce;var De=r.updateQueue;if(De===null){var Me=new Set;Me.add(Q),r.updateQueue=Me}else De.add(Q);break e}else{if((r&1)===0){lm(_,ce,r),Eu();break e}Q=Error(n(426))}}else if(kt&&K.mode&1){var Ot=cm(j);if(Ot!==null){(Ot.flags&65536)===0&&(Ot.flags|=256),um(Ot,j,K,_,r),Bc(hr(Q,K));break e}}_=Q=hr(Q,K),Ut!==4&&(Ut=2),go===null?go=[_]:go.push(_),_=j;do{switch(_.tag){case 3:_.flags|=65536,r&=-r,_.lanes|=r;var re=om(_,Q,r);Dp(_,re);break e;case 1:K=Q;var te=_.type,ae=_.stateNode;if((_.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(es===null||!es.has(ae)))){_.flags|=65536,r&=-r,_.lanes|=r;var Ce=am(_,K,r);Dp(_,Ce);break e}}_=_.return}while(_!==null)}$m(l)}catch(Be){r=Be,Ft===l&&l!==null&&(Ft=l=l.return);continue}break}while(!0)}function zm(){var i=Fa.current;return Fa.current=Ma,i===null?Ma:i}function Eu(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Qt===null||(Rs&268435455)===0&&($a&268435455)===0||is(Qt,cn)}function Va(i,r){var l=at;at|=2;var d=zm();(Qt!==i||cn!==r)&&(Li=null,Ps(i,r));do try{Pb();break}catch(g){Om(i,g)}while(!0);if(zc(),at=l,Fa.current=d,Ft!==null)throw Error(n(261));return Qt=null,cn=0,Ut}function Pb(){for(;Ft!==null;)Fm(Ft)}function Lb(){for(;Ft!==null&&!nS();)Fm(Ft)}function Fm(i){var r=Um(i.alternate,i,An);i.memoizedProps=i.pendingProps,r===null?$m(i):Ft=r,vu.current=null}function $m(i){var r=i;do{var l=r.alternate;if(i=r.return,(r.flags&32768)===0){if(l=xb(l,r,An),l!==null){Ft=l;return}}else{if(l=kb(l,r),l!==null){l.flags&=32767,Ft=l;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{Ut=6,Ft=null;return}}if(r=r.sibling,r!==null){Ft=r;return}Ft=r=i}while(r!==null);Ut===0&&(Ut=5)}function Ls(i,r,l){var d=ht,g=Yn.transition;try{Yn.transition=null,ht=1,Tb(i,r,l,d)}finally{Yn.transition=g,ht=d}return null}function Tb(i,r,l,d){do gr();while(ts!==null);if((at&6)!==0)throw Error(n(327));l=i.finishedWork;var g=i.finishedLanes;if(l===null)return null;if(i.finishedWork=null,i.finishedLanes=0,l===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var _=l.lanes|l.childLanes;if(hS(i,_),i===Qt&&(Ft=Qt=null,cn=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Wa||(Wa=!0,Km(Jo,function(){return gr(),null})),_=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||_){_=Yn.transition,Yn.transition=null;var j=ht;ht=1;var K=at;at|=4,vu.current=null,Eb(i,l),Lm(l,i),QS(Ec),sa=!!Cc,Ec=Cc=null,i.current=l,Nb(l),iS(),at=K,ht=j,Yn.transition=_}else i.current=l;if(Wa&&(Wa=!1,ts=i,Ua=g),_=i.pendingLanes,_===0&&(es=null),oS(l.stateNode),jn(i,Bt()),r!==null)for(d=i.onRecoverableError,l=0;l<r.length;l++)g=r[l],d(g.value,{componentStack:g.stack,digest:g.digest});if(Ha)throw Ha=!1,i=wu,wu=null,i;return(Ua&1)!==0&&i.tag!==0&&gr(),_=i.pendingLanes,(_&1)!==0?i===Su?vo++:(vo=0,Su=i):vo=0,Xi(),null}function gr(){if(ts!==null){var i=jf(Ua),r=Yn.transition,l=ht;try{if(Yn.transition=null,ht=16>i?16:i,ts===null)var d=!1;else{if(i=ts,ts=null,Ua=0,(at&6)!==0)throw Error(n(331));var g=at;for(at|=4,Te=i.current;Te!==null;){var _=Te,j=_.child;if((Te.flags&16)!==0){var K=_.deletions;if(K!==null){for(var Q=0;Q<K.length;Q++){var ce=K[Q];for(Te=ce;Te!==null;){var ye=Te;switch(ye.tag){case 0:case 11:case 15:po(8,ye,_)}var be=ye.child;if(be!==null)be.return=ye,Te=be;else for(;Te!==null;){ye=Te;var _e=ye.sibling,Le=ye.return;if(Em(ye),ye===ce){Te=null;break}if(_e!==null){_e.return=Le,Te=_e;break}Te=Le}}}var De=_.alternate;if(De!==null){var Me=De.child;if(Me!==null){De.child=null;do{var Ot=Me.sibling;Me.sibling=null,Me=Ot}while(Me!==null)}}Te=_}}if((_.subtreeFlags&2064)!==0&&j!==null)j.return=_,Te=j;else e:for(;Te!==null;){if(_=Te,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:po(9,_,_.return)}var re=_.sibling;if(re!==null){re.return=_.return,Te=re;break e}Te=_.return}}var te=i.current;for(Te=te;Te!==null;){j=Te;var ae=j.child;if((j.subtreeFlags&2064)!==0&&ae!==null)ae.return=j,Te=ae;else e:for(j=te;Te!==null;){if(K=Te,(K.flags&2048)!==0)try{switch(K.tag){case 0:case 11:case 15:za(9,K)}}catch(Be){Dt(K,K.return,Be)}if(K===j){Te=null;break e}var Ce=K.sibling;if(Ce!==null){Ce.return=K.return,Te=Ce;break e}Te=K.return}}if(at=g,Xi(),ci&&typeof ci.onPostCommitFiberRoot=="function")try{ci.onPostCommitFiberRoot(Qo,i)}catch{}d=!0}return d}finally{ht=l,Yn.transition=r}}return!1}function Hm(i,r,l){r=hr(l,r),r=om(i,r,1),i=Qi(i,r,1),r=wn(),i!==null&&(Fr(i,1,r),jn(i,r))}function Dt(i,r,l){if(i.tag===3)Hm(i,i,l);else for(;r!==null;){if(r.tag===3){Hm(r,i,l);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(es===null||!es.has(d))){i=hr(l,i),i=am(r,i,1),r=Qi(r,i,1),i=wn(),r!==null&&(Fr(r,1,i),jn(r,i));break}}r=r.return}}function Db(i,r,l){var d=i.pingCache;d!==null&&d.delete(r),r=wn(),i.pingedLanes|=i.suspendedLanes&l,Qt===i&&(cn&l)===l&&(Ut===4||Ut===3&&(cn&130023424)===cn&&500>Bt()-yu?Ps(i,0):_u|=l),jn(i,r)}function Wm(i,r){r===0&&((i.mode&1)===0?r=1:(r=ea,ea<<=1,(ea&130023424)===0&&(ea=4194304)));var l=wn();i=Ri(i,r),i!==null&&(Fr(i,r,l),jn(i,l))}function Mb(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),Wm(i,l)}function Ab(i,r){var l=0;switch(i.tag){case 13:var d=i.stateNode,g=i.memoizedState;g!==null&&(l=g.retryLane);break;case 19:d=i.stateNode;break;default:throw Error(n(314))}d!==null&&d.delete(r),Wm(i,l)}var Um;Um=function(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps||Cn.current)Nn=!0;else{if((i.lanes&l)===0&&(r.flags&128)===0)return Nn=!1,bb(i,r,l);Nn=(i.flags&131072)!==0}else Nn=!1,kt&&(r.flags&1048576)!==0&&xp(r,ba,r.index);switch(r.lanes=0,r.tag){case 2:var d=r.type;Ba(i,r),i=r.pendingProps;var g=sr(r,fn.current);ur(r,l),g=Xc(null,r,d,i,g,l);var _=Jc();return r.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,En(d)?(_=!0,ya(r)):_=!1,r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Wc(r),g.updater=Aa,r.stateNode=g,g._reactInternals=r,iu(r,d,i,l),r=au(null,r,d,!0,_,l)):(r.tag=0,kt&&_&&Dc(r),yn(null,r,g,l),r=r.child),r;case 16:d=r.elementType;e:{switch(Ba(i,r),i=r.pendingProps,g=d._init,d=g(d._payload),r.type=d,g=r.tag=Bb(d),i=ii(d,i),g){case 0:r=ou(null,r,d,i,l);break e;case 1:r=gm(null,r,d,i,l);break e;case 11:r=dm(null,r,d,i,l);break e;case 14:r=hm(null,r,d,ii(d.type,i),l);break e}throw Error(n(306,d,""))}return r;case 0:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),ou(i,r,d,g,l);case 1:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),gm(i,r,d,g,l);case 3:e:{if(vm(r),i===null)throw Error(n(387));d=r.pendingProps,_=r.memoizedState,g=_.element,Tp(i,r),Ra(r,d,null,l);var j=r.memoizedState;if(d=j.element,_.isDehydrated)if(_={element:d,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},r.updateQueue.baseState=_,r.memoizedState=_,r.flags&256){g=hr(Error(n(423)),r),r=_m(i,r,d,l,g);break e}else if(d!==g){g=hr(Error(n(424)),r),r=_m(i,r,d,l,g);break e}else for(Mn=Vi(r.stateNode.containerInfo.firstChild),Dn=r,kt=!0,ni=null,l=Pp(r,null,d,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(ar(),d===g){r=Pi(i,r,l);break e}yn(i,r,d,l)}r=r.child}return r;case 5:return Ap(r),i===null&&Ic(r),d=r.type,g=r.pendingProps,_=i!==null?i.memoizedProps:null,j=g.children,Nc(d,g)?j=null:_!==null&&Nc(d,_)&&(r.flags|=32),mm(i,r),yn(i,r,j,l),r.child;case 6:return i===null&&Ic(r),null;case 13:return ym(i,r,l);case 4:return Uc(r,r.stateNode.containerInfo),d=r.pendingProps,i===null?r.child=lr(r,null,d,l):yn(i,r,d,l),r.child;case 11:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),dm(i,r,d,g,l);case 7:return yn(i,r,r.pendingProps,l),r.child;case 8:return yn(i,r,r.pendingProps.children,l),r.child;case 12:return yn(i,r,r.pendingProps.children,l),r.child;case 10:e:{if(d=r.type._context,g=r.pendingProps,_=r.memoizedProps,j=g.value,mt(Ca,d._currentValue),d._currentValue=j,_!==null)if(ti(_.value,j)){if(_.children===g.children&&!Cn.current){r=Pi(i,r,l);break e}}else for(_=r.child,_!==null&&(_.return=r);_!==null;){var K=_.dependencies;if(K!==null){j=_.child;for(var Q=K.firstContext;Q!==null;){if(Q.context===d){if(_.tag===1){Q=ji(-1,l&-l),Q.tag=2;var ce=_.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?Q.next=Q:(Q.next=ye.next,ye.next=Q),ce.pending=Q}}_.lanes|=l,Q=_.alternate,Q!==null&&(Q.lanes|=l),$c(_.return,l,r),K.lanes|=l;break}Q=Q.next}}else if(_.tag===10)j=_.type===r.type?null:_.child;else if(_.tag===18){if(j=_.return,j===null)throw Error(n(341));j.lanes|=l,K=j.alternate,K!==null&&(K.lanes|=l),$c(j,l,r),j=_.sibling}else j=_.child;if(j!==null)j.return=_;else for(j=_;j!==null;){if(j===r){j=null;break}if(_=j.sibling,_!==null){_.return=j.return,j=_;break}j=j.return}_=j}yn(i,r,g.children,l),r=r.child}return r;case 9:return g=r.type,d=r.pendingProps.children,ur(r,l),g=qn(g),d=d(g),r.flags|=1,yn(i,r,d,l),r.child;case 14:return d=r.type,g=ii(d,r.pendingProps),g=ii(d.type,g),hm(i,r,d,g,l);case 15:return fm(i,r,r.type,r.pendingProps,l);case 17:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),Ba(i,r),r.tag=1,En(d)?(i=!0,ya(r)):i=!1,ur(r,l),sm(r,d,g),iu(r,d,g,l),au(null,r,d,!0,i,l);case 19:return Sm(i,r,l);case 22:return pm(i,r,l)}throw Error(n(156,r.tag))};function Km(i,r){return Fi(i,r)}function Ib(i,r,l,d){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(i,r,l,d){return new Ib(i,r,l,d)}function Nu(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Bb(i){if(typeof i=="function")return Nu(i)?1:0;if(i!=null){if(i=i.$$typeof,i===A)return 11;if(i===L)return 14}return 2}function ss(i,r){var l=i.alternate;return l===null?(l=Gn(i.tag,r,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=r,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&14680064,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,r=i.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l}function Ya(i,r,l,d,g,_){var j=2;if(d=i,typeof i=="function")Nu(i)&&(j=1);else if(typeof i=="string")j=5;else e:switch(i){case z:return Ts(l.children,g,_,r);case ne:j=8,g|=8;break;case H:return i=Gn(12,l,r,g|2),i.elementType=H,i.lanes=_,i;case N:return i=Gn(13,l,r,g),i.elementType=N,i.lanes=_,i;case M:return i=Gn(19,l,r,g),i.elementType=M,i.lanes=_,i;case F:return Ga(l,g,_,r);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case X:j=10;break e;case I:j=9;break e;case A:j=11;break e;case L:j=14;break e;case P:j=16,d=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return r=Gn(j,l,r,g),r.elementType=i,r.type=d,r.lanes=_,r}function Ts(i,r,l,d){return i=Gn(7,i,d,r),i.lanes=l,i}function Ga(i,r,l,d){return i=Gn(22,i,d,r),i.elementType=F,i.lanes=l,i.stateNode={isHidden:!1},i}function Ru(i,r,l){return i=Gn(6,i,null,r),i.lanes=l,i}function ju(i,r,l){return r=Gn(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}function Ob(i,r,l,d,g){this.tag=r,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=nc(0),this.expirationTimes=nc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nc(0),this.identifierPrefix=d,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Pu(i,r,l,d,g,_,j,K,Q){return i=new Ob(i,r,l,K,Q),r===1?(r=1,_===!0&&(r|=8)):r=0,_=Gn(3,null,null,r),i.current=_,_.stateNode=i,_.memoizedState={element:d,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wc(_),i}function zb(i,r,l){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Y,key:d==null?null:""+d,children:i,containerInfo:r,implementation:l}}function qm(i){if(!i)return Gi;i=i._reactInternals;e:{if(Fe(i)!==i||i.tag!==1)throw Error(n(170));var r=i;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(En(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(n(171))}if(i.tag===1){var l=i.type;if(En(l))return wp(i,l,r)}return r}function Vm(i,r,l,d,g,_,j,K,Q){return i=Pu(l,d,!0,i,g,_,j,K,Q),i.context=qm(null),l=i.current,d=wn(),g=ns(l),_=ji(d,g),_.callback=r??null,Qi(l,_,g),i.current.lanes=g,Fr(i,g,d),jn(i,d),i}function Xa(i,r,l,d){var g=r.current,_=wn(),j=ns(g);return l=qm(l),r.context===null?r.context=l:r.pendingContext=l,r=ji(_,j),r.payload={element:i},d=d===void 0?null:d,d!==null&&(r.callback=d),i=Qi(g,r,j),i!==null&&(oi(i,g,j,_),Na(i,g,j)),j}function Ja(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 Ym(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Lu(i,r){Ym(i,r),(i=i.alternate)&&Ym(i,r)}function Fb(){return null}var Gm=typeof reportError=="function"?reportError:function(i){console.error(i)};function Tu(i){this._internalRoot=i}Qa.prototype.render=Tu.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(n(409));Xa(i,r,null,null)},Qa.prototype.unmount=Tu.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;js(function(){Xa(null,i,null,null)}),r[ki]=null}};function Qa(i){this._internalRoot=i}Qa.prototype.unstable_scheduleHydration=function(i){if(i){var r=Tf();i={blockedOn:null,target:i,priority:r};for(var l=0;l<Ui.length&&r!==0&&r<Ui[l].priority;l++);Ui.splice(l,0,i),l===0&&Af(i)}};function Du(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Za(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Xm(){}function $b(i,r,l,d,g){if(g){if(typeof d=="function"){var _=d;d=function(){var ce=Ja(j);_.call(ce)}}var j=Vm(r,d,i,0,null,!1,!1,"",Xm);return i._reactRootContainer=j,i[ki]=j.current,eo(i.nodeType===8?i.parentNode:i),js(),j}for(;g=i.lastChild;)i.removeChild(g);if(typeof d=="function"){var K=d;d=function(){var ce=Ja(Q);K.call(ce)}}var Q=Pu(i,0,!1,null,null,!1,!1,"",Xm);return i._reactRootContainer=Q,i[ki]=Q.current,eo(i.nodeType===8?i.parentNode:i),js(function(){Xa(r,Q,l,d)}),Q}function el(i,r,l,d,g){var _=l._reactRootContainer;if(_){var j=_;if(typeof g=="function"){var K=g;g=function(){var Q=Ja(j);K.call(Q)}}Xa(r,j,i,g)}else j=$b(l,r,i,g,d);return Ja(j)}Pf=function(i){switch(i.tag){case 3:var r=i.stateNode;if(r.current.memoizedState.isDehydrated){var l=zr(r.pendingLanes);l!==0&&(ic(r,l|1),jn(r,Bt()),(at&6)===0&&(mr=Bt()+500,Xi()))}break;case 13:js(function(){var d=Ri(i,1);if(d!==null){var g=wn();oi(d,i,1,g)}}),Lu(i,1)}},sc=function(i){if(i.tag===13){var r=Ri(i,134217728);if(r!==null){var l=wn();oi(r,i,134217728,l)}Lu(i,134217728)}},Lf=function(i){if(i.tag===13){var r=ns(i),l=Ri(i,r);if(l!==null){var d=wn();oi(l,i,r,d)}Lu(i,r)}},Tf=function(){return ht},Df=function(i,r){var l=ht;try{return ht=i,r()}finally{ht=l}},_n=function(i,r,l){switch(r){case"input":if(Et(i,l),r=l.name,l.type==="radio"&&r!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<l.length;r++){var d=l[r];if(d!==i&&d.form===i.form){var g=va(d);if(!g)throw Error(n(90));$e(d),Et(d,g)}}}break;case"textarea":xe(i,l);break;case"select":r=l.value,r!=null&&ut(i,!!l.multiple,r,!1)}},he=ku,Ne=js;var Hb={usingClientEntryPoint:!1,Events:[io,nr,va,Hn,li,ku]},_o={findFiberByHostInstance:Ss,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Wb={bundleType:_o.bundleType,version:_o.version,rendererPackageName:_o.rendererPackageName,rendererConfig:_o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:O.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Rt(i),i===null?null:i.stateNode},findFiberByHostInstance:_o.findFiberByHostInstance||Fb,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 tl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tl.isDisabled&&tl.supportsFiber)try{Qo=tl.inject(Wb),ci=tl}catch{}}return Pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hb,Pn.createPortal=function(i,r){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Du(r))throw Error(n(200));return zb(i,r,null,l)},Pn.createRoot=function(i,r){if(!Du(i))throw Error(n(299));var l=!1,d="",g=Gm;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onRecoverableError!==void 0&&(g=r.onRecoverableError)),r=Pu(i,1,!1,null,null,l,!1,d,g),i[ki]=r.current,eo(i.nodeType===8?i.parentNode:i),new Tu(r)},Pn.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=Rt(r),i=i===null?null:i.stateNode,i},Pn.flushSync=function(i){return js(i)},Pn.hydrate=function(i,r,l){if(!Za(r))throw Error(n(200));return el(null,i,r,!0,l)},Pn.hydrateRoot=function(i,r,l){if(!Du(i))throw Error(n(405));var d=l!=null&&l.hydratedSources||null,g=!1,_="",j=Gm;if(l!=null&&(l.unstable_strictMode===!0&&(g=!0),l.identifierPrefix!==void 0&&(_=l.identifierPrefix),l.onRecoverableError!==void 0&&(j=l.onRecoverableError)),r=Vm(r,null,i,1,l??null,g,!1,_,j),i[ki]=r.current,eo(i),d)for(i=0;i<d.length;i++)l=d[i],g=l._getVersion,g=g(l._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[l,g]:r.mutableSourceEagerHydrationData.push(l,g);return new Qa(r)},Pn.render=function(i,r,l){if(!Za(r))throw Error(n(200));return el(null,i,r,!1,l)},Pn.unmountComponentAtNode=function(i){if(!Za(i))throw Error(n(40));return i._reactRootContainer?(js(function(){el(null,null,i,!1,function(){i._reactRootContainer=null,i[ki]=null})}),!0):!1},Pn.unstable_batchedUpdates=ku,Pn.unstable_renderSubtreeIntoContainer=function(i,r,l,d){if(!Za(l))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return el(i,r,l,!1,d)},Pn.version="18.3.1-next-f1338f8080-20240426",Pn}var sg;function Qb(){if(sg)return Iu.exports;sg=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(),Iu.exports=Jb(),Iu.exports}var rg;function Zb(){if(rg)return nl;rg=1;var e=Qb();return nl.createRoot=e.createRoot,nl.hydrateRoot=e.hydrateRoot,nl}var e0=Zb();const t0=Dh(e0);function Vt(e,t,n={}){return fetch(e,{...n,headers:{...n.headers||{},Authorization:`Bearer ${t}`}})}const B_=e=>`nc_seen_${e}`;async function Ae(e,t,n={}){const s=await Vt(e,t,{method:n.method||"GET",headers:{"content-type":"application/json"},body:n.body?JSON.stringify(n.body):void 0}),o=await s.json().catch(()=>({}));if(!s.ok){const a=new Error(o.error||`HTTP ${s.status}`);throw a.status=s.status,a.data=o,a}return o}const bn=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",rn=(e,t)=>`${bn(e)}/fleet/${t}`,_s=(e,t)=>Ae(rn(t,"status"),e),Ah=(e,t,n)=>Ae(rn(n,"up"),e,{method:"POST",body:t}),Cl=(e,t,n)=>Ae(rn(n,"down"),e,{method:"POST",body:t}),O_=(e,t,n)=>Ae(rn(n,"boot"),e,{method:"POST",body:t}),jo=(e,t,n)=>Ae(rn(n,"restart"),e,{method:"POST",body:{cell:t}}),Ih=(e,t)=>Ae(rn(t,"definitions"),e),n0=(e,t)=>Ae(rn(t,"credentials/status"),e),og=(e,t,n,s)=>Ae(rn(s,"credentials/set"),e,{method:"POST",body:{envKey:t,value:n}}),i0=(e,t,n)=>Ae(rn(n,"credentials/remove"),e,{method:"POST",body:{envKey:t}}),s0=(e,t,n)=>Ae(rn(n,"define-engine"),e,{method:"POST",body:{def:t}}),r0=(e,t,n,s,o)=>Ae(rn(o,"edit-engine"),e,{method:"POST",body:{id:t,patch:n,envChanges:s}}),o0=(e,t,n)=>Ae(rn(n,"remove-engine"),e,{method:"POST",body:{id:t}}),a0=(e,t,n)=>Ae(rn(n,"define-cell"),e,{method:"POST",body:{def:t}}),z_=(e,t,n,s)=>Ae(rn(s,"edit-cell"),e,{method:"POST",body:{id:t,patch:n}}),F_=(e,t,n=!1,s)=>Ae(rn(s,"remove-cell"),e,{method:"POST",body:{id:t,stop:n}}),l0=(e,t,n)=>Ae(rn(n,"import-cell"),e,{method:"POST",body:t}),c0=(e,t,n)=>Ae(rn(n,"restore-cells"),e,{method:"POST",body:{cells:t}}),u0=(e,t,n,s)=>Ae(rn(s,"restore-engines"),e,{method:"POST",body:{engines:t,overwrite:!!n}}),Bh=(e,t,n)=>Ae(`${bn(n)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),$_=(e,t,n,s)=>Ae(`${bn(s)}/sessions/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{technical:!!n}}),Oh=(e,t,n)=>Ae(`${bn(n)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),H_=e=>Ae("/api/settings",e),d0=e=>Ae("/api/nodes",e),h0=e=>Ae("/api/peers",e),f0=e=>Ae("/api/topology",e),zh=(e,t)=>Ae(`${bn(t)}/sessions`,e),Fh=(e,t)=>Ae(`${bn(t)}/config`,e),ag=(e,t)=>Ae(`${bn(t)}/topology`,e),Ld=(e,t)=>Ae("/api/settings/config",e,{method:"POST",body:t}),p0=e=>Ae("/api/settings/token/rotate",e,{method:"POST"}),m0=(e,t)=>Ae("/api/settings/nodes/pair",e,{method:"POST",body:t}),lg=(e,t,n=[])=>Ae(`${bn(n)}/settings/peering/invite`,e,{method:"POST",body:t||{}}),W_=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:n}}),g0=e=>Ae("/api/settings/node-aliases",e),v0=(e,t,n)=>Ae(`/api/settings/node-aliases/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{alias:n}}),cg=(e,t)=>Ae(`/api/settings/node-aliases/${encodeURIComponent(t)}`,e,{method:"DELETE"}),_0=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"PATCH",body:n}),y0=(e,t)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),$h=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/${n}`,e,{method:"POST"}),w0=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/share`,e,{method:"PATCH",body:{shared:n}}),ug=(e,t,n,s=[])=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:n,selected:s}}),S0=e=>Ae("/api/settings/audio",e),b0=(e,t)=>Ae("/api/settings/audio/consent",e,{method:"PATCH",body:{consent:t}}),x0=e=>Ae("/api/settings/audio/test",e,{method:"POST",body:{}}),k0=e=>Ae("/api/settings/audio/stop",e,{method:"POST",body:{}}),C0=e=>Ae("/api/settings/audio/groups",e),E0=(e,t,n)=>Ae(`/api/settings/audio/groups/${encodeURIComponent(t)}`,e,{method:"PUT",body:n}),N0=(e,t)=>Ae(`/api/settings/audio/groups/${encodeURIComponent(t)}`,e,{method:"DELETE"}),R0=e=>Ae("/api/settings/service/regenerate",e,{method:"POST"}),j0=e=>Ae("/api/settings/update/check",e,{method:"POST"}),P0=e=>Ae("/api/settings/update/apply",e,{method:"POST"}),Hl=(e,t)=>`${bn(e)}/diagnostics/${t}`,L0=(e,t=[])=>Ae(Hl(t,"status"),e),T0=(e,{after:t=0,limit:n=200}={},s=[])=>Ae(`${Hl(s,"logs")}?after=${encodeURIComponent(t)}&limit=${encodeURIComponent(n)}`,e),dg=(e,t,n,s=[])=>Ae(Hl(s,"verbose"),e,{method:"PATCH",body:{enabled:t,durationSeconds:n}}),D0=(e,t=[])=>Ae(Hl(t,"logs"),e,{method:"DELETE"}),M0=(e,t=!0)=>Ae(`/api/asks${t?"?open=1":""}`,e),A0=(e,t,n)=>Ae(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:n}}),il=(e,t=[])=>Ae(`${bn(t)}/decks`,e),hg=(e,t,n=[])=>Ae(`${bn(n)}/decks`,e,{method:"POST",body:{name:t}}),sl=(e,t,n,s,o=[])=>Ae(`${bn(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:n,expectedRevision:s}}),I0=(e,t,n,s,o=[])=>Ae(`${bn(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:n,expectedRevision:s}}),B0=(e,t,n,s=[])=>Ae(`${bn(s)}/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:n}}),O0={power:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 3v8"}),c.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),c.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),c.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),c.jsx("path",{d:"M12 18v3"})]}),enter:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),c.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),c.jsx("path",{d:"M22 2 11 13"})]}),trash:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 7h16"}),c.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),c.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),c.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:c.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),c.jsx("polyline",{points:"21 3 21 8 16 8"})]}),boot:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"4",width:"18",height:"13",rx:"2"}),c.jsx("path",{d:"M8 21h8M12 17v4M12 12V7"}),c.jsx("polyline",{points:"9 10 12 7 15 10"})]}),upload:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 16V5"}),c.jsx("polyline",{points:"8 9 12 5 16 9"}),c.jsx("path",{d:"M5 20h14"})]}),chevronLeft:c.jsx("polyline",{points:"14 6 8 12 14 18"}),chevronUp:c.jsx("polyline",{points:"6 14 12 8 18 14"}),chevronDown:c.jsx("polyline",{points:"6 10 12 16 18 10"}),history:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),c.jsx("polyline",{points:"3 3 3 8 8 8"}),c.jsx("path",{d:"M12 7v5l3 2"})]}),attach:c.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:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),c.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:c.jsxs(c.Fragment,{children:[c.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"}),c.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),c.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),c.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.35-4.35"}),c.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.35-4.35"}),c.jsx("path",{d:"M8 11h6"})]}),gear:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"12",cy:"12",r:"3"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function it({name:e,size:t=20}){return c.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:O0[e]||null})}const z0=["all","pinned","active","off","technical"],U_="nc_sidebar_views_v1",K_="nc_sidebar_order_v1";function q_(e){return z0.includes(e)?e:"all"}function F0(e,t=[],n="all"){const s=q_(n);return s==="technical"?e.technical===!0:e.technical===!0?!1:s==="pinned"?t.includes(e.key):s==="active"?!!e.live:s==="off"?!e.live:!0}function $0(e,t,n=[],s=[]){const o=n.indexOf(e.key),a=n.indexOf(t.key),u=o===-1?Number.MAX_SAFE_INTEGER:o,h=a===-1?Number.MAX_SAFE_INTEGER:a,f=s.indexOf(e.key),p=s.indexOf(t.key),v=f===-1?Number.MAX_SAFE_INTEGER:f,b=p===-1?Number.MAX_SAFE_INTEGER:p;return u-h||v-b||+!!t.live-+!!e.live||+!!t.fresh-+!!e.fresh||Number(t.activity||0)-Number(e.activity||0)||String(e.label||"").localeCompare(String(t.label||""))||String(e.key||"").localeCompare(String(t.key||""))}function H0(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(K_));if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[s,o]of Object.entries(t).slice(0,64)){if(typeof s!="string"||!s||s.length>160||!Array.isArray(o))continue;const a=[...new Set(o.filter(u=>typeof u=="string"&&u&&u.length<=256))].slice(0,128);a.length&&(n[s]=a)}return n}catch{return{}}}function Ai(e,t){return Array.isArray(e==null?void 0:e[t])?e[t]:[]}function W0(e,t=globalThis.localStorage){try{t.setItem(K_,JSON.stringify(e))}catch{}return e}function U0(e,t,n,s,o=[]){if(typeof t!="string"||!t||n===s)return e;const a=[...new Set(o.filter(w=>typeof w=="string"&&w))];if(!a.includes(n)||!a.includes(s))return e;const u=Ai(e,t).filter(w=>a.includes(w)),h=[...u,...a.filter(w=>!u.includes(w))],f=h.indexOf(n),p=h.indexOf(s);h.splice(f,1);const v=h.indexOf(s),b=f<p?v+1:v;return h.splice(b,0,n),{...e,[t]:h}}function K0(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(U_));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function fg(e,t){var n,s;return{open:((n=e==null?void 0:e[t])==null?void 0:n.open)!==!1,filter:q_((s=e==null?void 0:e[t])==null?void 0:s.filter)}}function q0(e,t=globalThis.localStorage){try{t.setItem(U_,JSON.stringify(e))}catch{}return e}function pg(e,t=""){const n=String(t||"").trim().toLocaleLowerCase();return n?[e.label,e.key,e.searchText].filter(Boolean).join(" ").toLocaleLowerCase().includes(n):!0}function ps(e=[],t=[],n="all",s=[]){return[...e].filter(o=>F0(o,t,n)).sort((o,a)=>$0(o,a,t,s))}const Hh=["it","en","es"];function V0(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Hh.includes(t)?t:"en"}catch{return"en"}}const vl=V0(),V_="nc_lang",Td="nc-lang";function Y_(){return typeof localStorage<"u"?localStorage:null}const rl={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",reorder:"riordina","reorder-help":"trascina la maniglia; frecce su/giu da tastiera","rename-node":"rinomina nodo","rename-node-prompt":"Nuovo nome del nodo in NexusCrew","rename-node-invalid":"Nome non valido: massimo 64 caratteri, senza a capo.","reorder-deck-help":"trascina il deck; frecce sinistra/destra da tastiera",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","view-technical":"tecniche","mark-technical":"nascondi come sessione tecnica","mark-normal":"mostra come sessione normale","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-working":"al lavoro","cell-idle":"in attesa","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","boot-enable":"attiva al boot","boot-disable":"disattiva al boot","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…","composer-history-tools":"cronologia e dimensione input","composer-history":"cronologia della cella","composer-history-empty":"nessun input inviato","composer-history-clear":"cancella cronologia di questa cella","composer-expand":"espandi input","composer-collapse":"riduci input","composer-clear-data":"cancella bozze e cronologia","composer-clear-data-help":"Rimuove da questo browser tutte le bozze e la cronologia input delle celle.","composer-clear-confirm":"Cancellare tutte le bozze e la cronologia input salvate in questo browser?","composer-clear-done":"Bozze e cronologia cancellate.","composer-clear-failed":"Impossibile cancellare i dati del composer in questo browser.",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","expand-owner":"espandi i deck di {owner}","collapse-owner":"comprimi i deck di {owner}","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} deck","dot-working":"in uso (finestra attiva)","dot-on":"aperta in background","dot-neutral":"non aperta","dot-warn":"nodo offline","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","tab-audio":"audio","system-general":"generale","system-diagnostics":"diagnostica","system-this-node":"questo nodo","system-updates":"aggiornamenti","system-security":"sicurezza","system-local-data":"dati locali del browser","system-terminal":"terminale","alternate-screen":"schermo alternato","alternate-screen-help":"Mantiene il comportamento tmux standard per le nuove sessioni NexusCrew; il trascinamento nel terminale web non scorre i TUI a schermo intero. Non modifica le celle già attive.","tab-input":"input","tab-diagnostics":"diagnostica","input-settings-local":"Preferenze locali di questo browser. Si applicano subito a vista singola e deck, senza modificare il nodo remoto.","terminal-keyboard-gesture":"Apertura tastiera virtuale dal terminale","terminal-keyboard-double-tap":"Doppio tap (predefinito)","terminal-keyboard-single-tap":"Tap singolo","terminal-keyboard-never":"Mai dal terminale","terminal-keyboard-gesture-help":"Il tastierino e STT seguono i controlli separati sotto. Mouse e tastiera fisica restano utilizzabili.","keybar-ime-lock":"Tastierino: mantieni chiusa la tastiera virtuale","keybar-ime-lock-help":"ESC, frecce, PgUp/PgDn, Enter e menu inviano direttamente al PTY senza dare focus a un campo di testo.","voice-ime-lock":"Microfono STT: mantieni chiusa la tastiera virtuale","voice-ime-lock-help":"Il tap sul microfono avvia o ferma la voce senza focalizzare il composer.","keybar-enter-show":"Mostra Enter verticale nel tastierino","keybar-enter-show-help":"Enter resta a destra di PgUp/PgDn ed è alto quanto entrambe le righe.","keybar-layout":"Layout tastierino","keybar-layout-full":"Esteso (predefinito)","keybar-layout-compact":"Compatto","keybar-layout-help":"Compatto: una riga con expand ⊞ per accedere al set completo senza cambiare la preferenza.","input-settings-reset":"ripristina predefiniti input","diagnostics-local":"Questo nodo","diagnostics-target":"Nodo da diagnosticare","diagnostics-verbose":"Log verbosi temporanei","diagnostics-duration":"Durata verbose","diagnostics-expires":"Verbose attivo fino alle {time}","diagnostics-off":"Verbose spento; warning ed errori operativi restano disponibili.","diagnostics-level":"Livello","diagnostics-all-levels":"tutti i livelli","diagnostics-component":"componente","diagnostics-pause":"pausa","diagnostics-autoscroll":"scorrimento automatico","diagnostics-log":"Log diagnostico sanitizzato","diagnostics-empty":"Nessun evento diagnostico.","diagnostics-export":"esporta JSON","diagnostics-export-failed":"Esportazione non disponibile in questo browser.","diagnostics-clear":"svuota","diagnostics-clear-confirm":"Svuotare il buffer diagnostico di questo nodo?","diagnostics-unsupported":"Questo peer è offline o non supporta la diagnostica strutturata.","fleet-editor-loading":"Caricamento dell'editor Fleet…","fleet-editor-load-error":"Impossibile caricare l'editor Fleet.","fleet-editor-unavailable":"Editor Fleet non disponibile in questa posizione.","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-shell-engine-help":"Shell locale risolta sul dispositivo al momento dell’avvio; nessun percorso viene salvato nel backup.","fleet-shell-command-placeholder":"comando opzionale, es. npm test","fleet-shell-command-help":"Esecuzione tramite shell login interattiva (-lic), con PATH e alias utente. La cella si ferma quando il comando termina; gli errori immediati vengono segnalati.","fleet-shell-command-metachar":"Pipe, redirect, variabili e altri metacaratteri vengono interpretati dalla shell del dispositivo.","fleet-shell-interactive":"Vuoto: apre una shell interattiva locale e mantiene la cella attiva.","fleet-shell-launch-help":"Il comando Shell si configura nella cella da Impostazioni → Flotta.","fleet-credential-title":"API key su questo dispositivo","fleet-credential-help":"La key resta solo sul nodo selezionato, non viene mostrata, esportata o condivisa con la rete.","fleet-credential-set":"imposta key","fleet-credential-change":"cambia key","fleet-credential-forget":"dimentica","fleet-credential-saved":"Key salvata localmente.","fleet-credential-removed":"Key locale rimossa.","fleet-credential-remove-confirm":"Rimuovere la key locale {key}?","fleet-credential-source-environment":"ambiente","fleet-credential-source-local":"store locale","fleet-credential-source-compatibility":"config compatibile","fleet-credential-source-missing":"mancante","fleet-credential-source-policy":"origine credenziale","fleet-credential-source-policy-auto":"auto (precedenza legacy)","fleet-credential-source-policy-nexuscrew-store":"solo store NexusCrew","fleet-credential-source-policy-environment":"solo ambiente","fleet-key-section":"KEY","fleet-key-variable":"Variabile","fleet-key-value":"Valore per {key}","fleet-key-used-by":"Usata da: {engines}","fleet-key-used-by-none":"Non ancora usata da engine configurati su questo nodo.","fleet-key-shared-impact":"Sostituire o rimuovere {key} interessa tutti gli engine elencati: {engines}.","fleet-key-enter":"inserisci la key","fleet-key-blank-keeps":"vuoto = mantieni la fonte attuale","fleet-key-reveal":"mostra","fleet-key-hide":"nascondi","fleet-key-local-help":"Il valore resta write-only sul nodo selezionato e non entra in engine, backup o federazione.","fleet-key-create-missing":"Crea esplicitamente l’engine senza key (resterà “key richiesta”).","fleet-key-partial-create":"Engine creato; la key non è stata salvata. Puoi riprovare senza creare duplicati.","fleet-key-partial-edit":"Engine aggiornato; la key non è stata salvata. Le modifiche all’engine restano applicate.","fleet-provider-notice-claude-openrouter":"Claude Code è ottimizzato per modelli Anthropic: altri provider potrebbero non funzionare correttamente. Fast mode richiede il provider Anthropic first-party.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses è beta e stateless; Codex-VL non usa fallback Chat Completions.","fleet-provider-notice-claude-kimi-code":"Kimi Code usa una configurazione Claude isolata con onboarding e fast mode dedicati; la configurazione Claude nativa non viene modificata.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal usa solo ALIBABA_CODE_API_KEY dal credential layer locale; qwen3.8-max-preview è il modello predefinito e non viene usato alcun fallback OpenAI/PAYG.","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 engine, 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-backup-invalid-engine":"il backup contiene un engine non valido","fleet-backup-duplicate-engine":"il backup contiene ID engine duplicati","fleet-backup-confirm-engine-overwrite":"Sovrascrivere questi engine? I valori ambiente già configurati sul target restano invariati. {engines}","fleet-backup-env-names":"nomi ambiente","fleet-backup-env-values-required":"i valori ambiente vanno configurati sul dispositivo","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.',"fleet-cwd-needs-repair":"cartella da riparare","fleet-cwd-repair":"ripara","fleet-cwd-repair-title":"Ripara cartella cella {id}","fleet-cwd-repair-help":"La cartella attuale non è portabile su questo dispositivo: appartiene a un altro dispositivo o non esiste sotto la home. Scegli una cartella home-relative (~) sul dispositivo target; il backend ricalcolerà il percorso assoluto.","fleet-cwd-repair-no-source-path":"Il percorso originale non viene mostrato: è specifico del dispositivo di origine.","fleet-cwd-repair-placeholder":"es. Dev","fleet-cwd-repair-preview":"Nuova cartella: {path}","fleet-cwd-repair-browse":"sfoglia sotto ~","fleet-cwd-repair-fs-empty":"nessuna sottocartella","fleet-cwd-repair-use-current":"usa questa cartella","fleet-cwd-repair-invalid":'percorso non valido: niente assoluto, "..", barra rovesciata o lettera disco',"fleet-cwd-repair-confirm":"Impostare la cartella della cella {id} su {path}? Verrà ricalcolata sul dispositivo target.","fleet-cwd-repair-unportable":"Il percorso scelto non è portabile su questo dispositivo: deve esistere sotto la home.","fleet-cwd-repair-suggestion":"Suggerimento dal dispositivo:","fleet-cwd-repair-use-suggestion":"usa {path}","fleet-cwd-repaired":"Cartella della cella riparata.","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","pair-ssh-local-label":"Host o alias SSH su questo dispositivo","node-ssh-local-help":"Puoi sostituire l’indirizzo del link con lo stesso alias che funziona usando ssh su questo dispositivo. Alias, agent e chiavi restano locali e non viaggiano nel link.","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-remove-warning":"Elimina associazione, credenziali e tunnel locale. Non spegne il dispositivo remoto.","peer-inventory-title":"Nodi collegati al hub","peer-group-hubs":"Hub diretti","peer-group-clients":"Client collegati","peer-group-routed":"Nodi raggiungibili tramite la rete","peer-routed":"instradato","peer-routed-stale":"instradato, non raggiungibile","peer-visibility":"Visibilità nella rete","node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","share-node":"Condividi questo nodo","share-local-heading":"Condivisione di questo dispositivo","share-local-hub":"Hub di condivisione","share-local-through":"Condividi {device} tramite {hub}","share-local-active":"Condiviso e raggiungibile dalla rete collegata all’hub.","share-local-pending":"Condivisione richiesta, ma il tunnel è giù: questo dispositivo non è ancora raggiungibile.","share-local-private":"Privato: solo questo dispositivo può usare il collegamento all’hub.","share-local-private-down":"Privato, ma il collegamento all’hub è giù. Riconnetti per applicare e verificare la modalità privata.","share-local-reconnect":"Riconnetti e riconcilia","share-off-hub-reconcile-pending":"Stato privato salvato; la revoca sull’hub è ancora in attesa.","share-off-local-reconcile-pending":"Revoca confermata dall’hub; il tunnel locale deve ancora riconciliarsi.","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-local-name":"nome locale non valido: usa uno slug univoco, non “localhost”","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","notification-speech-enable":"leggi le notifiche ad alta voce","notification-speech-help":"Usa la voce del browser solo per nuove notifiche mentre questa PWA è visibile e in primo piano. Con l’app chiusa resta la notifica di sistema.","notification-speech-test":"prova voce","notification-speech-testing":"prova in corso…","notification-speech-preview":"NexusCrew. Notifiche vocali attive.","notification-speech-preview-ok":"Prova vocale completata.","notification-speech-preview-failed":"Il browser non ha avviato la prova vocale. Interagisci con la pagina e riprova.","notification-speech-needs-test":"Per questa sessione dell’app, premi “prova voce” prima di ricevere annunci vocali.","notification-speech-unsupported":"Sintesi vocale non supportata in questo browser.","audio-title":"Audio nativo del nodo","audio-help":"Consenso e controlli valgono solo per questo dispositivo. Share e visibilità non autorizzano suoni.","audio-consent":"consenti TTS su questo nodo","audio-consent-help":"Permette a celle autorizzate, locali o remote, di consegnare un comando vocale. Puoi revocarlo in ogni momento.","audio-capability":"Capability locale","audio-loading":"leggo lo stato audio locale…","audio-adapter":"adapter","audio-adapter-none":"nessuno","audio-installed":"installato","audio-installed-yes":"sì","audio-installed-no":"no","audio-liveness":"disponibilità","audio-liveness-ready":"pronto ad accettare","audio-liveness-unavailable":"non disponibile","audio-languages":"lingue dichiarate","audio-limits":"limiti","audio-test":"prova audio locale","audio-testing":"prova in corso…","audio-stop":"ferma audio locale","audio-stopping":"stop in corso…","audio-test-needs-consent":"Attiva il consenso locale prima di provare la voce.","audio-unavailable":"Nessun adapter TTS nativo disponibile su questo nodo.","audio-test-accepted":"Il nodo ha accettato la prova. Non dimostra che qualcuno l’abbia udita.","audio-test-refused":"Il nodo ha rifiutato la prova.","audio-test-unknown":"Esito della prova sconosciuto: il nodo non può confermare l’avvio.","audio-stop-stopped":"Audio locale fermato.","audio-stop-idle":"Nessun enunciato locale da fermare.","audio-groups-title":"Gruppi audio condivisi","audio-groups-help":"Decide su quali dispositivi si sente la voce quando una cella parla. Il gruppo è una preferenza locale di consegna, non un consenso. Ogni nodo conserva consenso, ACL, disponibilità e Stop locale.","audio-groups-empty":"Nessun gruppo: la voce esce solo su questo nodo.","audio-group-name":"nome gruppo","audio-group-mode":"modalità consegna","audio-group-primary":"primo disponibile (in ordine)","audio-group-fanout":"tutti i nodi elencati","audio-group-targets":"nodi target esatti","audio-group-local":"questo nodo","audio-group-unavailable-target":"non rilevato ora","audio-group-no-targets":"Nessun nodo con instanceId disponibile. Il gruppo non può usare nomi, wildcard o “tutti”.","audio-group-new":"nuovo gruppo","audio-group-edit":"modifica","audio-group-delete":"elimina","audio-group-save":"salva gruppo","audio-group-cancel":"annulla","audio-group-invalid":"Il gruppo richiede un nome valido e almeno un nodeId esatto.","audio-group-save-failed":"Salvataggio gruppo audio non riuscito.","node-display-label":"Nome (etichetta)","routed-node-aliases":"Alias nodi instradati","routed-node-aliases-help":"Visibili solo su questo dispositivo; route e nome remoto non cambiano.","node-local-alias":"Alias su questo dispositivo","alias-on-device":"Alias su questo dispositivo","reset-alias":"Ripristina nome remoto","node-slug-hint":"routing su slug: {slug}","device-name-label":"Nome dispositivo","device-name-hint":"come ti vedono i peer (modificabile)","local-route-name-label":"Nome locale / route","local-route-name-hint":"handle tecnico stabile: label leggibile + suffisso del nodeId; modificabile prima della connessione","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","cell-switcher-refreshing":"aggiorno le celle…","cell-switcher-empty-active":"nessuna cella attiva verificata","cell-switcher-not-confirmed":"stato non confermato","cell-switcher-not-active":"questa cella non è più attiva","cell-switcher-select":"seleziona una cella","cell-switcher-open":"apri cella","cell-switcher-show-all":"tutte","cell-switcher-show-active":"attive","cell-switcher-close":"chiudi selettore celle","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-unavailable-hint":"Configurazione engine non disponibile su questo nodo.","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",reorder:"reorder","reorder-help":"drag the handle; keyboard up/down arrows","rename-node":"rename node","rename-node-prompt":"New node name in NexusCrew","rename-node-invalid":"Invalid name: maximum 64 characters, no line breaks.","reorder-deck-help":"drag the deck; keyboard left/right arrows",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","view-technical":"technical","mark-technical":"hide as technical session","mark-normal":"show as normal session","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-working":"working","cell-idle":"idle","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","boot-enable":"enable at boot","boot-disable":"disable at boot","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…","composer-history-tools":"input history and size","composer-history":"cell history","composer-history-empty":"no submitted input","composer-history-clear":"clear this cell history","composer-expand":"expand input","composer-collapse":"collapse input","composer-clear-data":"clear drafts and history","composer-clear-data-help":"Removes every saved cell draft and input-history entry from this browser.","composer-clear-confirm":"Clear every saved draft and input-history entry from this browser?","composer-clear-done":"Drafts and history cleared.","composer-clear-failed":"Could not clear composer data in this browser.",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","expand-owner":"expand {owner} decks","collapse-owner":"collapse {owner} decks","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} decks","dot-working":"in use (active window)","dot-on":"open in background","dot-neutral":"not open","dot-warn":"owner offline","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","tab-audio":"audio","system-general":"general","system-diagnostics":"diagnostics","system-this-node":"this node","system-updates":"updates","system-security":"security","system-local-data":"local browser data","system-terminal":"terminal","alternate-screen":"alternate screen","alternate-screen-help":"Keeps standard tmux behavior for new NexusCrew sessions; dragging in the web terminal does not scroll full-screen TUIs. It does not change cells already running.","tab-input":"input","tab-diagnostics":"diagnostics","input-settings-local":"Local preferences for this browser. They apply immediately to single view and decks without changing the remote node.","terminal-keyboard-gesture":"Open the virtual keyboard from the terminal","terminal-keyboard-double-tap":"Double tap (default)","terminal-keyboard-single-tap":"Single tap","terminal-keyboard-never":"Never from terminal","terminal-keyboard-gesture-help":"The keypad and STT use the separate controls below. Mouse and physical keyboard remain available.","keybar-ime-lock":"Keypad: keep the virtual keyboard closed","keybar-ime-lock-help":"ESC, arrows, PgUp/PgDn, Enter and menu send directly to the PTY without focusing a text field.","voice-ime-lock":"STT microphone: keep the virtual keyboard closed","voice-ime-lock-help":"Tapping the microphone starts or stops voice without focusing the composer.","keybar-enter-show":"Show the tall Enter keypad key","keybar-enter-show-help":"Enter stays to the right of PgUp/PgDn and spans both rows.","keybar-layout":"Keypad layout","keybar-layout-full":"Full (default)","keybar-layout-compact":"Compact","keybar-layout-help":"Compact: one row with an expand toggle that reaches the full key set without changing the preference.","input-settings-reset":"restore input defaults","diagnostics-local":"This node","diagnostics-target":"Node to diagnose","diagnostics-verbose":"Temporary verbose logs","diagnostics-duration":"Verbose duration","diagnostics-expires":"Verbose enabled until {time}","diagnostics-off":"Verbose is off; operational warnings and errors remain available.","diagnostics-level":"Level","diagnostics-all-levels":"all levels","diagnostics-component":"component","diagnostics-pause":"pause","diagnostics-autoscroll":"autoscroll","diagnostics-log":"Sanitized diagnostic log","diagnostics-empty":"No diagnostic events.","diagnostics-export":"export JSON","diagnostics-export-failed":"Export is not available in this browser.","diagnostics-clear":"clear","diagnostics-clear-confirm":"Clear this node diagnostic buffer?","diagnostics-unsupported":"This peer is offline or does not support structured diagnostics.","fleet-editor-loading":"Loading the Fleet editor…","fleet-editor-load-error":"Unable to load the Fleet editor.","fleet-editor-unavailable":"The Fleet editor is unavailable at this location.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-shell-engine-help":"The local shell is resolved on the device at launch time; no executable path is stored in backups.","fleet-shell-command-placeholder":"optional command, e.g. npm test","fleet-shell-command-help":"Runs through an interactive login shell (-lic), with the user PATH and aliases. The cell stops when the command finishes; immediate failures are reported.","fleet-shell-command-metachar":"Pipes, redirects, variables, and other metacharacters are interpreted by the device shell.","fleet-shell-interactive":"Empty: opens a local interactive shell and keeps the cell active.","fleet-shell-launch-help":"Configure the Shell command on the cell in Settings → Fleet.","fleet-credential-title":"API key on this device","fleet-credential-help":"The key stays only on the selected node and is never displayed, exported or shared with the network.","fleet-credential-set":"set key","fleet-credential-change":"change key","fleet-credential-forget":"forget","fleet-credential-saved":"Key saved locally.","fleet-credential-removed":"Local key removed.","fleet-credential-remove-confirm":"Remove the local {key} key?","fleet-credential-source-environment":"environment","fleet-credential-source-local":"local store","fleet-credential-source-compatibility":"compatible config","fleet-credential-source-missing":"missing","fleet-credential-source-policy":"credential source","fleet-credential-source-policy-auto":"auto (legacy precedence)","fleet-credential-source-policy-nexuscrew-store":"NexusCrew store only","fleet-credential-source-policy-environment":"environment only","fleet-key-section":"KEY","fleet-key-variable":"Variable","fleet-key-value":"Value for {key}","fleet-key-used-by":"Used by: {engines}","fleet-key-used-by-none":"Not yet used by configured engines on this node.","fleet-key-shared-impact":"Replacing or removing {key} affects every listed engine: {engines}.","fleet-key-enter":"enter the key","fleet-key-blank-keeps":"blank = keep the current source","fleet-key-reveal":"reveal","fleet-key-hide":"hide","fleet-key-local-help":"The value stays write-only on the selected node and never enters engines, backups or federation.","fleet-key-create-missing":"Explicitly create the engine without a key (it will remain “key required”).","fleet-key-partial-create":"Engine created; the key was not saved. Retry without creating a duplicate.","fleet-key-partial-edit":"Engine updated; the key was not saved. The engine changes remain applied.","fleet-provider-notice-claude-openrouter":"Claude Code is optimized for Anthropic models; other providers may not work correctly. Fast mode requires the first-party Anthropic provider.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses is beta and stateless; Codex-VL has no Chat Completions fallback.","fleet-provider-notice-claude-kimi-code":"Kimi Code uses isolated Claude configuration with dedicated onboarding and fast-mode flags; native Claude configuration is not modified.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal uses only ALIBABA_CODE_API_KEY from the local credential layer; qwen3.8-max-preview is the default and no OpenAI/PAYG fallback is used.","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 engines, 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-backup-invalid-engine":"the backup contains an invalid engine","fleet-backup-duplicate-engine":"the backup contains duplicate engine IDs","fleet-backup-confirm-engine-overwrite":"Overwrite these engines? Environment values already configured on the target stay unchanged. {engines}","fleet-backup-env-names":"environment names","fleet-backup-env-values-required":"environment values must be configured on this device","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.',"fleet-cwd-needs-repair":"folder needs repair","fleet-cwd-repair":"repair","fleet-cwd-repair-title":"Repair cell folder {id}","fleet-cwd-repair-help":"The current folder is not portable on this device: it belongs to another device or does not exist under the home directory. Choose a home-relative (~) folder on the target device; the backend will recompute the absolute path.","fleet-cwd-repair-no-source-path":"The original path is not shown: it is specific to the source device.","fleet-cwd-repair-placeholder":"e.g. Dev","fleet-cwd-repair-preview":"New folder: {path}","fleet-cwd-repair-browse":"browse under ~","fleet-cwd-repair-fs-empty":"no subfolders","fleet-cwd-repair-use-current":"use this folder","fleet-cwd-repair-invalid":'invalid path: no absolute path, "..", backslash or drive letter',"fleet-cwd-repair-confirm":"Set the folder of cell {id} to {path}? It will be recomputed on the target device.","fleet-cwd-repair-unportable":"The chosen path is not portable on this device: it must exist under the home directory.","fleet-cwd-repair-suggestion":"Suggestion from device:","fleet-cwd-repair-use-suggestion":"use {path}","fleet-cwd-repaired":"Cell folder repaired.","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","pair-ssh-local-label":"SSH host or alias on this device","node-ssh-local-help":"You may replace the link address with the same alias that works with ssh on this device. Aliases, agents and private keys stay local and are never carried in the link.","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-remove-warning":"Deletes the pairing, credentials and local tunnel. It does not power off the remote device.","peer-inventory-title":"Nodes connected to the hub","peer-group-hubs":"Direct hubs","peer-group-clients":"Connected clients","peer-group-routed":"Nodes reachable through the network","peer-routed":"routed","peer-routed-stale":"routed, unreachable","peer-visibility":"Network visibility","node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","share-node":"Share this node","share-local-heading":"Share this device","share-local-hub":"Sharing hub","share-local-through":"Share {device} through {hub}","share-local-active":"Shared and reachable by the network connected to the hub.","share-local-pending":"Sharing is requested, but the tunnel is down: this device is not reachable yet.","share-local-private":"Private: only this device can use its hub connection.","share-local-private-down":"Private, but the hub connection is down. Reconnect to apply and verify private mode.","share-local-reconnect":"Reconnect and reconcile","share-off-hub-reconcile-pending":"Private state saved; hub revocation is still pending.","share-off-local-reconcile-pending":"Hub revocation confirmed; the local tunnel still needs reconciliation.","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-local-name":"invalid local name: use a unique slug, not “localhost”","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","notification-speech-enable":"read notifications aloud","notification-speech-help":"Uses the browser voice only for new notifications while this PWA is visible and in the foreground. When the app is closed, the system notification remains available.","notification-speech-test":"test voice","notification-speech-testing":"testing voice…","notification-speech-preview":"NexusCrew. Spoken notifications are active.","notification-speech-preview-ok":"Voice test completed.","notification-speech-preview-failed":"The browser did not start the voice test. Interact with the page and try again.","notification-speech-needs-test":"For this app session, select “test voice” before spoken alerts can play.","notification-speech-unsupported":"Speech synthesis is not supported in this browser.","audio-title":"Native node audio","audio-help":"Consent and controls apply only to this device. Share and visibility do not authorize sounds.","audio-consent":"allow TTS on this node","audio-consent-help":"Allows authorized local or remote cells to deliver a voice command. You can revoke it at any time.","audio-capability":"Local capability","audio-loading":"reading local audio state…","audio-adapter":"adapter","audio-adapter-none":"none","audio-installed":"installed","audio-installed-yes":"yes","audio-installed-no":"no","audio-liveness":"availability","audio-liveness-ready":"ready to accept","audio-liveness-unavailable":"unavailable","audio-languages":"declared languages","audio-limits":"limits","audio-test":"test local audio","audio-testing":"testing audio…","audio-stop":"stop local audio","audio-stopping":"stopping audio…","audio-test-needs-consent":"Enable local consent before testing the voice.","audio-unavailable":"No native TTS adapter is available on this node.","audio-test-accepted":"The node accepted the test. It does not prove that anyone heard it.","audio-test-refused":"The node refused the test.","audio-test-unknown":"Test outcome unknown: the node could not confirm startup.","audio-stop-stopped":"Local audio stopped.","audio-stop-idle":"No local utterance to stop.","audio-groups-title":"Shared audio groups","audio-groups-help":"Chooses which devices play the voice when a cell speaks. A group is a local delivery preference, not consent. Each node keeps its own consent, ACL, availability and local Stop.","audio-groups-empty":"No group: voice plays only on this node.","audio-group-name":"group name","audio-group-mode":"delivery mode","audio-group-primary":"first available (in order)","audio-group-fanout":"all listed nodes","audio-group-targets":"exact target nodes","audio-group-local":"this node","audio-group-unavailable-target":"not currently discovered","audio-group-no-targets":"No node with an available instanceId. A group cannot use names, wildcards, or “all”.","audio-group-new":"new group","audio-group-edit":"edit","audio-group-delete":"delete","audio-group-save":"save group","audio-group-cancel":"cancel","audio-group-invalid":"A group needs a valid name and at least one exact nodeId.","audio-group-save-failed":"Could not save audio group.","node-display-label":"Name (label)","routed-node-aliases":"Routed node aliases","routed-node-aliases-help":"Visible only on this device; the route and remote name do not change.","node-local-alias":"Alias on this device","alias-on-device":"Alias on this device","reset-alias":"Reset remote name","node-slug-hint":"routing on slug: {slug}","device-name-label":"Device name","device-name-hint":"how peers see you (editable)","local-route-name-label":"Local / route name","local-route-name-hint":"stable technical handle: readable label + nodeId suffix; editable before connecting","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","cell-switcher-refreshing":"refreshing cells…","cell-switcher-empty-active":"no verified active cells","cell-switcher-not-confirmed":"status not confirmed","cell-switcher-not-active":"this cell is no longer active","cell-switcher-select":"select a cell","cell-switcher-open":"open cell","cell-switcher-show-all":"all","cell-switcher-show-active":"active","cell-switcher-close":"close cell switcher","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-unavailable-hint":"Engine configuration is unavailable on this node.","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",reorder:"reordenar","reorder-help":"arrastra el control; flechas arriba/abajo","rename-node":"renombrar nodo","rename-node-prompt":"Nuevo nombre del nodo en NexusCrew","rename-node-invalid":"Nombre no válido: máximo 64 caracteres, sin saltos de línea.","reorder-deck-help":"arrastra el deck; flechas izquierda/derecha",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","view-technical":"técnicas","mark-technical":"ocultar como sesión técnica","mark-normal":"mostrar como sesión normal","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-working":"trabajando","cell-idle":"en espera","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","boot-enable":"activar al iniciar","boot-disable":"desactivar al iniciar","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…","composer-history-tools":"historial y tamaño de entrada","composer-history":"historial de la celda","composer-history-empty":"ninguna entrada enviada","composer-history-clear":"borrar historial de esta celda","composer-expand":"ampliar entrada","composer-collapse":"reducir entrada","composer-clear-data":"borrar borradores e historial","composer-clear-data-help":"Elimina de este navegador todos los borradores y el historial de entrada de las celdas.","composer-clear-confirm":"¿Borrar todos los borradores y el historial de entrada guardados en este navegador?","composer-clear-done":"Borradores e historial eliminados.","composer-clear-failed":"No se pudieron borrar los datos del composer en este navegador.",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í","expand-owner":"expandir decks de {owner}","collapse-owner":"comprimir decks de {owner}","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} decks","dot-working":"en uso (ventana activa)","dot-on":"abierta en segundo plano","dot-neutral":"no abierta","dot-warn":"nodo sin conexión","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","tab-audio":"audio","system-general":"general","system-diagnostics":"diagnóstico","system-this-node":"este nodo","system-updates":"actualizaciones","system-security":"seguridad","system-local-data":"datos locales del navegador","system-terminal":"terminal","alternate-screen":"pantalla alternativa","alternate-screen-help":"Mantiene el comportamiento estándar de tmux para las nuevas sesiones NexusCrew; arrastrar en el terminal web no desplaza los TUI a pantalla completa. No modifica las celdas ya activas.","tab-input":"entrada","tab-diagnostics":"diagnóstico","input-settings-local":"Preferencias locales de este navegador. Se aplican de inmediato a la vista única y a los decks sin cambiar el nodo remoto.","terminal-keyboard-gesture":"Abrir el teclado virtual desde el terminal","terminal-keyboard-double-tap":"Doble toque (predeterminado)","terminal-keyboard-single-tap":"Toque único","terminal-keyboard-never":"Nunca desde el terminal","terminal-keyboard-gesture-help":"El teclado auxiliar y STT usan los controles separados de abajo. El ratón y el teclado físico siguen disponibles.","keybar-ime-lock":"Teclado auxiliar: mantener cerrado el teclado virtual","keybar-ime-lock-help":"ESC, flechas, PgUp/PgDn, Enter y menú envían directamente al PTY sin enfocar un campo de texto.","voice-ime-lock":"Micrófono STT: mantener cerrado el teclado virtual","voice-ime-lock-help":"Tocar el micrófono inicia o detiene la voz sin enfocar el compositor.","keybar-enter-show":"Mostrar Enter vertical en el teclado auxiliar","keybar-enter-show-help":"Enter queda a la derecha de PgUp/PgDn y ocupa las dos filas.","keybar-layout":"Distribución del teclado auxiliar","keybar-layout-full":"Completo (predeterminado)","keybar-layout-compact":"Compacto","keybar-layout-help":"Compacto: una fila con un botón expandir que alcanza el conjunto completo sin cambiar la preferencia.","input-settings-reset":"restaurar valores de entrada","diagnostics-local":"Este nodo","diagnostics-target":"Nodo a diagnosticar","diagnostics-verbose":"Logs detallados temporales","diagnostics-duration":"Duración detallada","diagnostics-expires":"Log detallado activo hasta las {time}","diagnostics-off":"El log detallado está apagado; los avisos y errores operativos siguen disponibles.","diagnostics-level":"Nivel","diagnostics-all-levels":"todos los niveles","diagnostics-component":"componente","diagnostics-pause":"pausa","diagnostics-autoscroll":"desplazamiento automático","diagnostics-log":"Log de diagnóstico sanitizado","diagnostics-empty":"No hay eventos de diagnóstico.","diagnostics-export":"exportar JSON","diagnostics-export-failed":"La exportación no está disponible en este navegador.","diagnostics-clear":"vaciar","diagnostics-clear-confirm":"¿Vaciar el búfer de diagnóstico de este nodo?","diagnostics-unsupported":"Este par está desconectado o no admite diagnósticos estructurados.","fleet-editor-loading":"Cargando el editor de Fleet…","fleet-editor-load-error":"No se puede cargar el editor de Fleet.","fleet-editor-unavailable":"El editor de Fleet no está disponible en esta ubicación.","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-shell-engine-help":"La shell local se resuelve en el dispositivo al iniciar; no se guarda ninguna ruta ejecutable en las copias.","fleet-shell-command-placeholder":"comando opcional, p. ej. npm test","fleet-shell-command-help":"Se ejecuta mediante una shell de inicio interactiva (-lic), con PATH y alias del usuario. La celda se detiene al terminar; los fallos inmediatos se notifican.","fleet-shell-command-metachar":"Pipes, redirecciones, variables y otros metacaracteres son interpretados por la shell del dispositivo.","fleet-shell-interactive":"Vacío: abre una shell local interactiva y mantiene la celda activa.","fleet-shell-launch-help":"Configura el comando Shell de la celda en Ajustes → Flota.","fleet-credential-title":"Clave API en este dispositivo","fleet-credential-help":"La clave permanece solo en el nodo seleccionado y nunca se muestra, exporta ni comparte con la red.","fleet-credential-set":"poner clave","fleet-credential-change":"cambiar clave","fleet-credential-forget":"olvidar","fleet-credential-saved":"Clave guardada localmente.","fleet-credential-removed":"Clave local eliminada.","fleet-credential-remove-confirm":"¿Eliminar la clave local {key}?","fleet-credential-source-environment":"entorno","fleet-credential-source-local":"almacén local","fleet-credential-source-compatibility":"config compatible","fleet-credential-source-missing":"ausente","fleet-credential-source-policy":"origen de credencial","fleet-credential-source-policy-auto":"auto (precedencia legacy)","fleet-credential-source-policy-nexuscrew-store":"solo almacén NexusCrew","fleet-credential-source-policy-environment":"solo entorno","fleet-key-section":"KEY","fleet-key-variable":"Variable","fleet-key-value":"Valor para {key}","fleet-key-used-by":"Usada por: {engines}","fleet-key-used-by-none":"Aún no la usa ningún motor configurado en este nodo.","fleet-key-shared-impact":"Sustituir o eliminar {key} afecta a todos los motores listados: {engines}.","fleet-key-enter":"introduce la clave","fleet-key-blank-keeps":"vacío = mantener la fuente actual","fleet-key-reveal":"mostrar","fleet-key-hide":"ocultar","fleet-key-local-help":"El valor permanece write-only en el nodo seleccionado y nunca entra en motores, copias ni federación.","fleet-key-create-missing":"Crear explícitamente el motor sin clave (seguirá como “clave requerida”).","fleet-key-partial-create":"Motor creado; la clave no se guardó. Puedes reintentar sin crear un duplicado.","fleet-key-partial-edit":"Motor actualizado; la clave no se guardó. Los cambios del motor siguen aplicados.","fleet-provider-notice-claude-openrouter":"Claude Code está optimizado para modelos Anthropic; otros proveedores podrían no funcionar correctamente. Fast mode requiere el proveedor Anthropic first-party.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses es beta y stateless; Codex-VL no usa fallback de Chat Completions.","fleet-provider-notice-claude-kimi-code":"Kimi Code usa una configuración Claude aislada con onboarding y fast mode dedicados; la configuración Claude nativa no se modifica.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal usa solo ALIBABA_CODE_API_KEY de la capa local de credenciales; qwen3.8-max-preview es el modelo predeterminado y no se usa fallback OpenAI/PAYG.","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 motores, 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-backup-invalid-engine":"la copia contiene un motor no válido","fleet-backup-duplicate-engine":"la copia contiene IDs de motor duplicados","fleet-backup-confirm-engine-overwrite":"¿Sobrescribir estos motores? Los valores de entorno ya configurados en el destino no cambian. {engines}","fleet-backup-env-names":"nombres de entorno","fleet-backup-env-values-required":"los valores de entorno deben configurarse en este dispositivo","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.',"fleet-cwd-needs-repair":"carpeta a reparar","fleet-cwd-repair":"reparar","fleet-cwd-repair-title":"Reparar carpeta de celda {id}","fleet-cwd-repair-help":"La carpeta actual no es portátil en este dispositivo: pertenece a otro dispositivo o no existe bajo el directorio home. Elige una carpeta relativa a home (~) en el dispositivo destino; el backend recalculará la ruta absoluta.","fleet-cwd-repair-no-source-path":"La ruta original no se muestra: es específica del dispositivo de origen.","fleet-cwd-repair-placeholder":"p. ej. Dev","fleet-cwd-repair-preview":"Nueva carpeta: {path}","fleet-cwd-repair-browse":"examinar bajo ~","fleet-cwd-repair-fs-empty":"sin subcarpetas","fleet-cwd-repair-use-current":"usar esta carpeta","fleet-cwd-repair-invalid":'ruta no válida: nada de ruta absoluta, "..", barra invertida ni letra de unidad',"fleet-cwd-repair-confirm":"¿Establecer la carpeta de la celda {id} a {path}? Se recalculará en el dispositivo destino.","fleet-cwd-repair-unportable":"La ruta elegida no es portátil en este dispositivo: debe existir bajo el directorio home.","fleet-cwd-repair-suggestion":"Sugerencia del dispositivo:","fleet-cwd-repair-use-suggestion":"usar {path}","fleet-cwd-repaired":"Carpeta de la celda reparada.","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","pair-ssh-local-label":"Host o alias SSH en este dispositivo","node-ssh-local-help":"Puedes sustituir la dirección del enlace por el mismo alias que funciona con ssh en este dispositivo. Los alias, agentes y claves permanecen locales y nunca viajan en el enlace.","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-remove-warning":"Elimina el emparejamiento, las credenciales y el túnel local. No apaga el dispositivo remoto.","peer-inventory-title":"Nodos conectados al hub","peer-group-hubs":"Hubs directos","peer-group-clients":"Clientes conectados","peer-group-routed":"Nodos accesibles a través de la red","peer-routed":"enrutado","peer-routed-stale":"enrutado, no accesible","peer-visibility":"Visibilidad en la red","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","share-node":"Compartir este nodo","share-local-heading":"Compartir este dispositivo","share-local-hub":"Hub para compartir","share-local-through":"Compartir {device} mediante {hub}","share-local-active":"Compartido y accesible para la red conectada al hub.","share-local-pending":"Se solicitó compartir, pero el túnel está caído: este dispositivo aún no es accesible.","share-local-private":"Privado: solo este dispositivo puede usar la conexión al hub.","share-local-private-down":"Privado, pero la conexión al hub está caída. Reconecta para aplicar y verificar el modo privado.","share-local-reconnect":"Reconectar y reconciliar","share-off-hub-reconcile-pending":"Estado privado guardado; la revocación en el hub sigue pendiente.","share-off-local-reconcile-pending":"Revocación confirmada por el hub; el túnel local aún debe reconciliarse.","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-local-name":"nombre local inválido: usa un slug único, no “localhost”","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","notification-speech-enable":"leer las notificaciones en voz alta","notification-speech-help":"Usa la voz del navegador solo para notificaciones nuevas mientras esta PWA está visible y en primer plano. Con la aplicación cerrada permanece la notificación del sistema.","notification-speech-test":"probar voz","notification-speech-testing":"probando voz…","notification-speech-preview":"NexusCrew. Las notificaciones por voz están activas.","notification-speech-preview-ok":"Prueba de voz completada.","notification-speech-preview-failed":"El navegador no inició la prueba de voz. Interactúa con la página y vuelve a intentarlo.","notification-speech-needs-test":"Para esta sesión de la aplicación, pulsa “probar voz” antes de recibir avisos hablados.","notification-speech-unsupported":"La síntesis de voz no está disponible en este navegador.","audio-title":"Audio nativo del nodo","audio-help":"El consentimiento y los controles valen solo para este dispositivo. Compartir y visibilidad no autorizan sonidos.","audio-consent":"permitir TTS en este nodo","audio-consent-help":"Permite que celdas autorizadas, locales o remotas, entreguen un comando de voz. Puedes revocarlo en cualquier momento.","audio-capability":"Capacidad local","audio-loading":"leyendo el estado de audio local…","audio-adapter":"adaptador","audio-adapter-none":"ninguno","audio-installed":"instalado","audio-installed-yes":"sí","audio-installed-no":"no","audio-liveness":"disponibilidad","audio-liveness-ready":"listo para aceptar","audio-liveness-unavailable":"no disponible","audio-languages":"idiomas declarados","audio-limits":"límites","audio-test":"probar audio local","audio-testing":"probando audio…","audio-stop":"detener audio local","audio-stopping":"deteniendo audio…","audio-test-needs-consent":"Activa el consentimiento local antes de probar la voz.","audio-unavailable":"No hay un adaptador TTS nativo disponible en este nodo.","audio-test-accepted":"El nodo aceptó la prueba. No demuestra que alguien la haya oído.","audio-test-refused":"El nodo rechazó la prueba.","audio-test-unknown":"Resultado de prueba desconocido: el nodo no pudo confirmar el inicio.","audio-stop-stopped":"Audio local detenido.","audio-stop-idle":"No hay enunciado local que detener.","audio-groups-title":"Grupos de audio compartido","audio-groups-help":"Decide en qué dispositivos se oye la voz cuando habla una celda. Un grupo es una preferencia local de entrega, no un consentimiento. Cada nodo conserva su consentimiento, ACL, disponibilidad y Stop local.","audio-groups-empty":"Sin grupos: la voz sale solo por este nodo.","audio-group-name":"nombre del grupo","audio-group-mode":"modo de entrega","audio-group-primary":"primero disponible (en orden)","audio-group-fanout":"todos los nodos enumerados","audio-group-targets":"nodos destino exactos","audio-group-local":"este nodo","audio-group-unavailable-target":"no detectado ahora","audio-group-no-targets":"No hay ningún nodo con instanceId disponible. Un grupo no puede usar nombres, comodines ni “todos”.","audio-group-new":"nuevo grupo","audio-group-edit":"editar","audio-group-delete":"eliminar","audio-group-save":"guardar grupo","audio-group-cancel":"cancelar","audio-group-invalid":"El grupo necesita un nombre válido y al menos un nodeId exacto.","audio-group-save-failed":"No se pudo guardar el grupo de audio.","node-display-label":"Nombre (etiqueta)","routed-node-aliases":"Alias de nodos enrutados","routed-node-aliases-help":"Visibles solo en este dispositivo; la ruta y el nombre remoto no cambian.","node-local-alias":"Alias en este dispositivo","alias-on-device":"Alias en este dispositivo","reset-alias":"Restablecer nombre remoto","node-slug-hint":"enrutado por slug: {slug}","device-name-label":"Nombre del dispositivo","device-name-hint":"cómo te ven los pares (editable)","local-route-name-label":"Nombre local / ruta","local-route-name-hint":"identificador técnico estable: etiqueta legible + sufijo del nodeId; editable antes de conectar","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","cell-switcher-refreshing":"actualizando celdas…","cell-switcher-empty-active":"no hay celdas activas verificadas","cell-switcher-not-confirmed":"estado sin confirmar","cell-switcher-not-active":"esta celda ya no está activa","cell-switcher-select":"selecciona una celda","cell-switcher-open":"abrir celda","cell-switcher-show-all":"todas","cell-switcher-show-active":"activas","cell-switcher-close":"cerrar selector de celdas","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-unavailable-hint":"La configuración del motor no está disponible en este nodo.","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 El(){const e=Y_(),t=e?e.getItem(V_):null;return Hh.includes(t)?t:vl}function Y0(e){const t=Y_();if(t)try{t.setItem(V_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Td))}function m(e){const t=El(),n=rl[t]||rl[vl];return Object.prototype.hasOwnProperty.call(n,e)?n[e]:Object.prototype.hasOwnProperty.call(rl[vl],e)?rl[vl][e]:e}function G0(e){return typeof window>"u"?()=>{}:(window.addEventListener(Td,e),()=>window.removeEventListener(Td,e))}const G_=Hh;function $n(){return[E.useSyncExternalStore(G0,El,El),Y0]}function Nl({cell:e,token:t,route:n=[],onConfirm:s,onClose:o}){var P,F;$n();const a=!!(e&&e.active),u=Array.isArray(n)?n.join("/"):"",[h,f]=E.useState([]),[p,v]=E.useState(!1);E.useEffect(()=>{let T=!0;return(async()=>{if(t)try{const q=await _s(t,u?u.split("/"):[]);if(!T)return;if(v(q.provider==="builtin"&&(q.capabilities||[]).includes("edit")),q.provider==="builtin"&&(q.capabilities||[]).includes("definitions")){const B=await Ih(t,u?u.split("/"):[]);if(!T)return;const D=new Map((q.engines||[]).map(U=>[U.id,U]));f((B.engines||[]).map(U=>{var Z,oe,de,fe,J,ee,pe;return{id:U.id,label:U.label||U.id,client:((Z=U.managed)==null?void 0:Z.client)||"",models:[...new Set([...((oe=D.get(U.id))==null?void 0:oe.models)||[],...((de=U.managedInfo)==null?void 0:de.models)||[]])].filter(Boolean),defaultModel:((fe=U.managed)==null?void 0:fe.model)||((J=U.managedInfo)==null?void 0:J.defaultModel)||"",policyDefault:((ee=U.managed)==null?void 0:ee.permissionPolicy)||((pe=U.managed)!=null&&pe.client&&U.managed.client==="claude"?"unsafe":"standard")}}))}}catch{}})(),()=>{T=!1}},[t,u]);const b=(e==null?void 0:e.engine)||((P=h[0])==null?void 0:P.id)||"",w=T=>(e==null?void 0:e.models)&&e.models[T]||"",S=T=>{const q=(e==null?void 0:e.permissionPolicies)&&e.permissionPolicies[T];if(q==="standard"||q==="unsafe")return q;const B=h.find(D=>D.id===T);return B?B.policyDefault:"standard"},[y,x]=E.useState(b),[C,R]=E.useState((e==null?void 0:e.model)||""),k=(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])||"",[$,O]=E.useState(k),[V,Y]=E.useState((e==null?void 0:e.boot)??!0),[z,ne]=E.useState(!1),[H,X]=E.useState(null);E.useEffect(()=>{h.length&&(x(T=>T||b),R(T=>T||w((e==null?void 0:e.engine)||b)||""),O(T=>T==="standard"||T==="unsafe"?T:S((e==null?void 0:e.engine)||b)))},[h.length]);const I=E.useMemo(()=>h.find(T=>T.id===y)||null,[h,y]),A=!!(I&&["claude","codex","codex-vl","agy"].includes(I.client)),N=(I==null?void 0:I.client)==="shell";function M(T){x(T);const q=h.find(B=>B.id===T);R(w(T)||(q==null?void 0:q.defaultModel)||""),O(S(T))}async function L(T){T.preventDefault(),ne(!0),X(null);try{if(a)await s({action:"down",boot:V});else{const q=$==="standard"||$==="unsafe"?$:(I==null?void 0:I.policyDefault)||"standard";await s({action:"up",...p?{engine:y,model:C||"",...A?{permissionPolicy:q}:(I==null?void 0:I.client)==="pi"?{permissionPolicy:"standard"}:{}}:{},boot:V})}o()}catch(q){X(String(q&&q.message||q)),ne(!1)}}return c.jsx("div",{className:"nc-sheet-overlay nc-launch-overlay",onClick:o,children:c.jsxs("form",{className:"nc-sheet nc-power-sheet nc-launch-sheet",onClick:T=>T.stopPropagation(),onSubmit:L,children:[c.jsxs("div",{className:"nc-sheet-head",children:[c.jsx("b",{children:e==null?void 0:e.cell}),c.jsx("span",{className:"nc-sheet-state",children:m(a?"state-on":"state-off")})]}),a?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-power-config",children:[c.jsx("span",{children:m("engine")}),c.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&c.jsxs("small",{children:[m("model"),": ",e.model]}),c.jsx("small",{children:m("power-on-hint")})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:V,onChange:T=>Y(T.target.checked)}),m("remove-boot")]})]}):c.jsxs(c.Fragment,{children:[p&&h.length>0?c.jsxs("div",{className:"nc-launch-fields",children:[c.jsxs("label",{className:"nc-field",children:[m("engine"),c.jsx("select",{value:y,onChange:T=>M(T.target.value),children:h.map(T=>c.jsx("option",{value:T.id,children:T.label},T.id))})]}),!N&&c.jsxs("label",{className:"nc-field",children:[m("model"),c.jsx("input",{value:C,list:"nc-launch-models",placeholder:m("model-default"),onChange:T=>R(T.target.value)}),c.jsx("datalist",{id:"nc-launch-models",children:((I==null?void 0:I.models)||[]).map(T=>c.jsx("option",{value:T},T))})]}),A?c.jsxs("label",{className:"nc-field",children:[m("permissions"),c.jsxs("select",{value:$,onChange:T=>O(T.target.value),children:[c.jsx("option",{value:"standard",children:m("fleet-standard-permissions")}),c.jsx("option",{value:"unsafe",children:m("fleet-unsafe-permissions")})]})]}):c.jsx("small",{className:"nc-note",children:m("fleet-standard-permissions")}),A&&$==="unsafe"&&c.jsx("small",{className:"nc-err",children:m("fleet-unsafe-warning")}),c.jsx("small",{className:"nc-note",children:m(N?"fleet-shell-launch-help":"launch-engine-help")})]}):c.jsxs("div",{className:"nc-power-config",children:[c.jsx("span",{children:m("engine")}),c.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&c.jsxs("small",{children:[m("model"),": ",e.model]}),c.jsx("small",{children:m("launch-unavailable-hint")})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:V,onChange:T=>Y(T.target.checked)}),m("boot-persist")]})]}),H&&c.jsx("div",{className:"nc-err",children:H}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:o,disabled:z,children:m("cancel")}),c.jsx("button",{type:"submit",className:"nc-btn primary",disabled:z,children:m(a?"power-off":"save-and-start")})]})]})})}const mg=/^[a-z0-9-]{1,32}$/;function Bo(e,t){const n=Array.isArray(e)?e:[];return n.length?`${n.map(encodeURIComponent).join("/")}:${t}`:String(t)}function X0(e,t,n){const s={};for(const o of Array.isArray(t)?t:[]){const a=Array.isArray(o==null?void 0:o.route)?o.route:typeof(o==null?void 0:o.name)=="string"?[o.name]:[];if(!a.length)continue;const u=a.join("/"),h=o.status==="up"||o.tunnel&&o.tunnel.status==="up",f=o.status==="passive"||o.tunnel&&o.tunnel.status==="passive";!h&&!f&&(s[u]=e&&e[u]||n)}return s}function gg(e,t,n){return!e||!Array.isArray(e.cells)?[]:e.cells.map(s=>({...s,route:t,key:`${n}:${s.tmuxSession||s.cell}`}))}function vg({nodes:e,topology:t,remote:n,down:s,fleet:o,aliases:a}={}){var p,v,b,w;const u=[],h=new Set,f=new Set;for(const S of Array.isArray(e)?e:[]){if(!S||typeof S.name!="string"||!mg.test(S.name)||S.direction==="inbound"&&S.shared!==!0)continue;const y=[S.name],x=S.name;h.add(x);const C=((p=S.tunnel)==null?void 0:p.status)||"unknown",R=C==="up",k={name:S.name,label:S.label||S.name,originalLabel:S.label||S.name,alias:null,route:y,direct:!0,instanceId:S.nodeId||null,shared:S.shared===!0,tunnelStatus:C,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:S.health||null,direction:S.direction||"outbound",roles:S.roles||null,rolesKnown:S.rolesKnown===!0};if(S.nodeId&&f.add(S.nodeId),!S.nodeId&&S.paired===!1){u.push({...k,status:"needs-repair",downSince:s&&s[x]||null});continue}if(((v=S.health)==null?void 0:v.auth)==="failed"||C==="degraded"&&((b=S.health)==null?void 0:b.status)==="degraded"){u.push({...k,status:"needs-repair",downSince:s&&s[x]||null});continue}if(C==="passive"||((w=S.health)==null?void 0:w.status)==="passive"){u.push({...k,status:"passive",downSince:null});continue}if(!R){u.push({...k,status:"down",downSince:s&&s[x]||null});continue}const $=n&&(n[x]||n[S.name])||null,O=o&&(o[x]||o[S.name]),V=!!($&&!$.error&&Array.isArray($.sessions)),Y=!!(O&&O.available===!0&&Array.isArray(O.cells));if(!V&&!Y){u.push({...k,status:"unreachable"});continue}const z=(V?$.sessions:[]).filter(X=>X&&typeof X.name=="string"&&X.name).map(X=>({...X,node:x,route:y,key:`${x}:${X.name}`})),ne=gg(O,y,x),H=new Set(ne.map(X=>X.tmuxSession).filter(Boolean));u.push({...k,status:"up",sessions:z,cells:ne,unmanaged:z.filter(X=>!H.has(X.name)),fleetAvailable:!!(O&&O.available),capabilities:O&&O.capabilities||[],engines:O&&O.engines||[],fleetProvider:O&&O.provider||null,sessionsAvailable:V,inventoryPartial:!V})}for(const S of Array.isArray(t)?t:[]){if(!S||!Array.isArray(S.route)||S.route.length<1||S.route.some(H=>!mg.test(H)))continue;const y=S.route.join("/");if(h.has(y)||S.instanceId&&f.has(S.instanceId))continue;S.instanceId&&f.add(S.instanceId);const x=S.label||S.route.join(" › "),C=S.instanceId&&a&&typeof a[S.instanceId]=="string"?a[S.instanceId]:null,R={name:S.name,label:C||x,originalLabel:x,alias:C,route:[...S.route],direct:!1,instanceId:S.instanceId||null,shared:!0,tunnelStatus:null,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:S.health||null,lastSeen:S.lastSeen||null};if(S.stale){u.push({...R,status:"offline",downSince:s&&s[y]||S.lastSeen||null});continue}const k=n&&n[y]||null,$=o&&o[y],O=!!(k&&!k.error&&Array.isArray(k.sessions)),V=!!($&&$.available===!0&&Array.isArray($.cells));if(!O&&!V){u.push({...R,status:"unreachable",downSince:s&&s[y]||null});continue}const Y=(O?k.sessions:[]).filter(H=>H&&typeof H.name=="string"&&H.name).map(H=>({...H,node:y,route:S.route,key:`${y}:${H.name}`})),z=gg($,S.route,y),ne=new Set(z.map(H=>H.tmuxSession).filter(Boolean));u.push({...R,status:"up",sessions:Y,cells:z,unmanaged:Y.filter(H=>!ne.has(H.name)),fleetAvailable:!!($&&$.available),capabilities:$&&$.capabilities||[],engines:$&&$.engines||[],fleetProvider:$&&$.provider||null,lastSeen:S.lastSeen||null,sessionsAvailable:O,inventoryPartial:!O})}return u.sort((S,y)=>S.label.localeCompare(y.label))}const J0=4e3;function Wh(e,t=!0,n=0){const[s,o]=E.useState([]),a=E.useRef({});return E.useEffect(()=>{if(!t||!e){o([]);return}let u=!0;async function h(){var R;let p=[],v=[],b={};if(await Promise.all([d0(e).then(k=>{p=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{}),f0(e).then(k=>{v=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{}),g0(e).then(k=>{b=k&&typeof k.aliasesByInstanceId=="object"?k.aliasesByInstanceId:{}}).catch(()=>{})]),!u)return;const w={},S={},y=new Set(p.map(k=>k.name)),x=[];for(const k of p)((R=k.tunnel)==null?void 0:R.status)==="up"&&(k.nodeId||k.paired!==!1)&&(k.direction!=="inbound"||k.shared===!0)&&x.push([k.name]);for(const k of v)!k.stale&&Array.isArray(k.route)&&!(k.route.length===1&&y.has(k.route[0]))&&x.push(k.route);if(await Promise.all(x.map(async k=>{const $=k.join("/");try{w[$]=await zh(e,k)}catch{w[$]={error:"unreachable"}}try{S[$]=await _s(e,k)}catch{S[$]={available:!1}}})),!u)return;const C=vg({nodes:p,topology:v,remote:w,fleet:S,aliases:b,down:a.current});a.current=X0(a.current,C,Math.floor(Date.now()/1e3)),o(vg({nodes:p,topology:v,remote:w,fleet:S,aliases:b,down:a.current}))}h();const f=setInterval(h,J0);return()=>{u=!1,clearInterval(f)}},[e,t,n]),s}const _g=52,yg=14;function Di({position:e,itemKey:t,label:n,onMove:s,onStep:o,canMove:a=()=>!0,scope:u="roster"}){const h=E.useRef(null),f=E.useRef(0),[p,v]=E.useState(!1),b=()=>{var R,k,$,O;const C=h.current;(k=(R=C==null?void 0:C.over)==null?void 0:R.classList)==null||k.remove("nc-roster-over"),(O=($=C==null?void 0:C.source)==null?void 0:$.classList)==null||O.remove("nc-roster-dragging"),f.current&&cancelAnimationFrame(f.current),f.current=0},w=(C=!1)=>{const R=h.current;if(!R)return;const k=R.target;b(),h.current=null,v(!1);try{R.handle.releasePointerCapture(R.pointerId)}catch{}C&&k&&k!==t&&a(t,k)&&s(t,k)},S=(C,R)=>{var ne,H,X,I,A,N,M,L,P;const k=h.current;if(!k)return;k.x=C,k.y=R;const $=u==="node"?"[data-node-order-key]":"[data-roster-key][data-position]",O=(H=(ne=document.elementFromPoint(C,R))==null?void 0:ne.closest)==null?void 0:H.call(ne,$),V=u==="node"?(X=O==null?void 0:O.dataset)==null?void 0:X.nodeOrderKey:(I=O==null?void 0:O.dataset)==null?void 0:I.rosterKey,z=(u==="node"||((A=O==null?void 0:O.dataset)==null?void 0:A.position)===e)&&V&&V!==t&&a(t,V);k.over!==(z?O:null)&&((M=(N=k.over)==null?void 0:N.classList)==null||M.remove("nc-roster-over"),k.over=z?O:null,(P=(L=k.over)==null?void 0:L.classList)==null||P.add("nc-roster-over")),k.target=z?V:null},y=()=>{const C=h.current;if(!C){f.current=0;return}const R=C.container;if(R){const k=R.getBoundingClientRect(),$=C.y<k.top+_g?-yg:C.y>k.bottom-_g?yg:0;$&&(R.scrollTop+=$,S(C.x,C.y))}f.current=requestAnimationFrame(y)};E.useEffect(()=>{const C=k=>{k.key==="Escape"&&h.current&&(k.preventDefault(),w(!1))},R=()=>w(!1);return window.addEventListener("keydown",C),window.addEventListener("blur",R),()=>{window.removeEventListener("keydown",C),window.removeEventListener("blur",R),b(),h.current=null}},[t,e,u]);const x=C=>{var O;if(C.pointerType==="mouse"&&C.button!==0)return;C.preventDefault(),C.stopPropagation(),C.currentTarget.focus({preventScroll:!0});const R=u==="node"?"[data-node-order-key]":"[data-roster-key][data-position]",k=C.currentTarget.closest(R),$=C.currentTarget.closest(".nc-side-scroll, .nc-home-scroll, .nc-cell-switcher-list");h.current={pointerId:C.pointerId,handle:C.currentTarget,source:k,container:$,target:null,over:null,x:C.clientX,y:C.clientY},(O=k==null?void 0:k.classList)==null||O.add("nc-roster-dragging");try{C.currentTarget.setPointerCapture(C.pointerId)}catch{}v(!0),f.current=requestAnimationFrame(y)};return c.jsx("button",{type:"button",className:`nc-roster-handle${p?" active":""}`,"aria-label":`${m("reorder")} ${n}`,"aria-keyshortcuts":"ArrowUp ArrowDown",title:m("reorder-help"),onClick:C=>{C.preventDefault(),C.stopPropagation()},onDragStart:C=>C.preventDefault(),onKeyDown:C=>{C.key!=="ArrowUp"&&C.key!=="ArrowDown"||(C.preventDefault(),C.stopPropagation(),o(C.key==="ArrowUp"?-1:1))},onPointerDown:x,onPointerMove:C=>{!h.current||C.pointerId!==h.current.pointerId||(C.preventDefault(),C.stopPropagation(),S(C.clientX,C.clientY))},onPointerUp:C=>{!h.current||C.pointerId!==h.current.pointerId||(C.preventDefault(),C.stopPropagation(),w(!0))},onPointerCancel:()=>w(!1),onLostPointerCapture:()=>{h.current&&w(!1)},children:"↕"})}const Uh="nc_pins";function Q0(){try{const e=JSON.parse(localStorage.getItem(Uh));return Array.isArray(e)?e:[]}catch{return[]}}function Z0(e,t){const n=e.includes(t)?e.filter(s=>s!==t):[...e,t];try{localStorage.setItem(Uh,JSON.stringify(n))}catch{}return n}function e1(e,t,n){if(!e.includes(t)||!e.includes(n)||t===n)return e;const s=[...e],o=s.indexOf(t),a=s.indexOf(n);s.splice(o,1);const u=s.indexOf(n);s.splice(o<a?u+1:u,0,t);try{localStorage.setItem(Uh,JSON.stringify(s))}catch{}return s}function t1(e,t,n){const s=e.indexOf(t);return[s===-1?1e9:s,-(n||0)]}function n1(e,t){return e[0]-t[0]||e[1]-t[1]}function Kh(){const[e,t]=E.useState(Q0),[n,s]=E.useState(K0),[o,a]=E.useState(H0),u=w=>t(S=>Z0(S,w)),h=w=>fg(n,w),f=(w,S)=>s(y=>{const x={...y,[w]:{...fg(y,w),...S}};return q0(x)}),p=(w,S)=>e.includes(w)===e.includes(S);function v(w,S,y,x){const C=e.includes(S),R=e.includes(y);if(C===R){if(C){t(k=>e1(k,S,y));return}a(k=>{var V;const $=((V=x.find(Y=>Y.key===S))==null?void 0:V.technical)===!0,O=ps(x,e,$?"technical":"all",Ai(k,w)).map(Y=>Y.key);return W0(U0(k,w,S,y,O))})}}function b(w,S,y,x){var V;const C=((V=x.find(Y=>Y.key===S))==null?void 0:V.technical)===!0,R=e.includes(S),k=ps(x,e,C?"technical":"all",Ai(o,w)).map(Y=>Y.key).filter(Y=>e.includes(Y)===R),$=k.indexOf(S),O=k[$+y];$>=0&&O&&v(w,S,O,x)}return{pins:e,views:n,orders:o,togglePin:u,viewFor:h,updateView:f,canMoveRoster:p,moveRoster:v,stepRoster:b}}const X_="nc_node_order_v1",i1=/^[a-f0-9]{16,64}$/;function zs(e){if(i1.test(String((e==null?void 0:e.instanceId)||"")))return`id:${e.instanceId}`;const t=Array.isArray(e==null?void 0:e.route)?e.route.filter(n=>typeof n=="string"&&n):[];return t.length?`route:${t.map(encodeURIComponent).join("/")}`:typeof(e==null?void 0:e.name)=="string"&&e.name?`name:${encodeURIComponent(e.name)}`:""}function wg(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(X_));return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"&&n&&n.length<=192))].slice(0,128):[]}catch{return[]}}function s1(e,t=globalThis.localStorage){try{t.setItem(X_,JSON.stringify(e))}catch{}return e}function Sg(e=[],t=[]){const n=new Map(t.map((s,o)=>[s,o]));return e.map((s,o)=>({group:s,index:o})).sort((s,o)=>{const a=n.has(zs(s.group))?n.get(zs(s.group)):Number.MAX_SAFE_INTEGER,u=n.has(zs(o.group))?n.get(zs(o.group)):Number.MAX_SAFE_INTEGER;return a-u||s.index-o.index}).map(({group:s})=>s)}function r1(e,t,n,s=[]){if(!t||!n||t===n)return e;const o=s.map(zs).filter(Boolean);if(!o.includes(t)||!o.includes(n))return e;const a=[...e.filter(p=>o.includes(p)),...o.filter(p=>!e.includes(p))],u=a.indexOf(t),h=a.indexOf(n);a.splice(u,1);const f=a.indexOf(n);return a.splice(u<h?f+1:f,0,t),a}const Dd="nexuscrew-node-preferences";function o1(){try{window.dispatchEvent(new Event(Dd))}catch{}}function J_(){const[e,t]=E.useState(wg);E.useEffect(()=>{const a=()=>t(wg());return window.addEventListener("storage",a),window.addEventListener(Dd,a),()=>{window.removeEventListener("storage",a),window.removeEventListener(Dd,a)}},[]);const n=a=>Sg(a,e),s=(a,u,h)=>t(f=>{const p=r1(f,a,u,h);return s1(p),o1(),p});return{order:e,groupsFor:n,moveNode:s,stepNode:(a,u,h)=>{const f=Sg(h,e).map(zs),p=f.indexOf(a),v=f[p+u];p>=0&&v&&s(a,v,h)},nodeKey:zs}}function Nr(e,t=Math.floor(Date.now()/1e3)){if(!e)return"";const n=t-e;return n<0||n<60?"ora":n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}g`}function xr(e){return e.status==="passive"?m("node-passive"):e.status==="down"?e.downSince?m("tunnel-down-since").replace("{t}",Nr(e.downSince)):m("tunnel-down"):e.status==="unreachable"?m("node-unreachable"):e.status==="offline"?e.lastSeen?m("node-offline-seen").replace("{t}",Nr(e.lastSeen)):m("node-offline"):e.status==="needs-repair"?m("node-needs-repair"):""}function Q_(e,{passive:t=null}={}){return e?e.status==="passive"?t:e.status==="healthy"?"on":"warn":null}function Rl(e){return e&&(e.detail||e.status)||""}function jl(e,t,n=globalThis.localStorage){if(!(e!=null&&e.outbox)||e.outbox.count<1)return!1;const s=Number(n.getItem(B_(t))||0);return e.outbox.latest>s}function qh(e,t={}){const n=e||{};if(!n.tmux){const s=`${n.engine||""}${n.key?`·${n.key}`:""}`,o=[s,n.model&&n.model!==s?n.model:""].filter(Boolean).join(" · ");return{working:!1,subtitle:String(o||m("cell-off")).trim()}}if(t.working===!0){const s=m("cell-working"),o=String(t.status||"").trim();return{working:!0,subtitle:!o||/^working(?:\.{3}|…)?$/i.test(o)?s:`${s} · ${o}`}}return t.working===!1?{working:!1,subtitle:m("cell-idle")}:{working:!1,subtitle:String(t.preview||n.preview||m("cell-on")).trim()}}function Z_(e,t){return[...new Set([e.engine,e.model,e.key,t.preview,e.preview,t.status].filter(Boolean).map(String))].join(" ")}function Vh(e,t,n,s=globalThis.localStorage){return[...(Array.isArray(e)?e:[]).map(o=>{const a=n.get(o.tmuxSession)||{},u=Bo([],o.tmuxSession),h=qh(o,a);return{type:"cell",value:o,key:u,label:o.cell,live:!!o.tmux,fresh:jl(a,u,s),activity:a.activity||0,working:h.working,subtitle:h.subtitle,searchText:Z_(o,a)}}),...(Array.isArray(t)?t:[]).map(o=>{const a=Bo([],o.name);return{type:"session",value:o,key:a,label:o.name,live:!0,technical:o.technical===!0,fresh:jl(o,a,s),activity:o.activity||0,searchText:`${o.preview||""} ${o.cmd||""}`}})]}function Pl(e,t=globalThis.localStorage){const n=e||{},s=Array.isArray(n.route)?n.route:[],o=new Map((n.sessions||[]).map(u=>[u.name,u])),a=[...(n.cells||[]).map(u=>{const h=o.get(u.tmuxSession)||{},f=Bo(s,u.tmuxSession||u.cell),p=qh(u,h);return{type:"cell",value:u,key:f,label:u.cell,live:!!u.tmux,fresh:jl(h,f,t),activity:h.activity||u.activity||0,working:p.working,subtitle:p.subtitle,searchText:Z_(u,h)}}),...(n.unmanaged||[]).map(u=>{const h=Bo(s,u.name);return{type:"session",value:u,key:h,label:u.name,live:!0,technical:u.technical===!0,fresh:jl(u,h,t),activity:u.activity||0,searchText:`${u.preview||""} ${u.cmd||""}`}})];return{route:s,rawItems:a}}const Yh=9,Ll=.2,a1=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,Rr=/^[a-f0-9]{16,64}$/,Md=e=>a1.test(e)&&new Set(e.split("/")).size===e.split("/").length;function vs(e){if(typeof e=="string"&&e){const t=e.indexOf(":");if(t<0)return{session:e};const n=e.slice(0,t),s=e.slice(t+1);return!Md(n)||!s?null:{session:s,node:n}}if(e&&typeof e=="object"&&typeof e.session=="string"&&e.session){const t=e.ownerId===void 0?void 0:typeof e.ownerId=="string"&&Rr.test(e.ownerId)?e.ownerId:null;return t===null?null:e.node===void 0||e.node===null||e.node===""?{session:e.session,...t?{ownerId:t}:{}}:typeof e.node=="string"&&Md(e.node)?{session:e.session,node:e.node,...t?{ownerId:t}:{}}:null}return null}function On(e){const t=vs(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const ey=9,ty=24,Wo=11,l1=e=>{const t=Number(e);return t>=ey&&t<=ty?t:Wo};function kr(){return{columns:[]}}function wi(e){return e.columns.flatMap(t=>t.tiles.map(n=>On(n)))}function c1(e){const t=[],n=Math.max(0,...e.columns.map(s=>s.tiles.length));for(let s=0;s<n;s+=1)for(const o of e.columns)o.tiles[s]&&t.push(On(o.tiles[s]));return t}const Dr=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(n=>({...n}))}))});function Gh(e,t,n,s){const o=vs(t);if(!o||wi(e).includes(On(o))||wi(e).length>=Yh)return e;const a=Dr(e),u={session:o.session,height:1,fontSize:Wo,...s||{}};if(o.node&&(u.node=o.node),o.ownerId&&(u.ownerId=o.ownerId),n==="end")return a.columns.push({width:1,tiles:[u]}),a;if(n&&typeof n.col=="number"&&typeof n.row=="number"&&a.columns[n.col])return a.columns[n.col].tiles.splice(n.row,0,u),a;if(n&&typeof n.col=="number"){const h=Math.max(0,Math.min(a.columns.length,n.col));return a.columns.splice(h,0,{width:1,tiles:[u]}),a}return a.columns.push({width:1,tiles:[u]}),a}function ny(e,t){const n=On(t);if(!n||wi(e).includes(n)||wi(e).length>=Yh)return e;const s=wi(e).length+1,o=Math.ceil(Math.sqrt(s));if(e.columns.length>=o){let v=0;for(let b=1;b<e.columns.length;b+=1)e.columns[b].tiles.length<e.columns[v].tiles.length&&(v=b);return Gh(e,t,{col:v,row:e.columns[v].tiles.length})}const a=[...c1(e),n],u=new Map(e.columns.flatMap(v=>v.tiles.map(b=>[On(b),b]))),h=vs(t),f=e.columns.length?e.columns.reduce((v,b)=>v+(Number(b.width)||1),0)/e.columns.length:1,p=Array.from({length:o},(v,b)=>{var w;return{width:((w=e.columns[b])==null?void 0:w.width)||f,tiles:[]}});return a.forEach((v,b)=>{const w=vs(v);if(!w)return;const S=u.get(v)||(v===n?h:{})||{},y={session:w.session,height:S.height||1,fontSize:S.fontSize||Wo};w.node&&(y.node=w.node),S.ownerId&&(y.ownerId=S.ownerId),S.unavailable===!0&&(y.unavailable=!0),p[b%o].tiles.push(y)}),{columns:p.filter(v=>v.tiles.length)}}function Tl(e,t){const n=On(t),s=Dr(e);for(const o of s.columns)o.tiles=o.tiles.filter(a=>On(a)!==n);return s.columns=s.columns.filter(o=>o.tiles.length>0),s}function u1(e,t,n){const s=On(t);if(!wi(e).includes(s))return e;const o=e.columns.flatMap(a=>a.tiles).find(a=>On(a)===s);return Gh(Tl(e,s),s,n,{fontSize:o.fontSize,height:o.height,...o.ownerId?{ownerId:o.ownerId}:{},...o.unavailable===!0?{unavailable:!0}:{}})}function d1(e,t){if(!(t instanceof Map)||t.size===0)return e;let n=!1;const s=Dr(e);for(const o of s.columns)for(const a of o.tiles){const u=t.get(On(a));if(!u)continue;const h=vs(u);h&&(a.session=h.session,h.node?a.node=h.node:delete a.node,h.ownerId&&(a.ownerId=h.ownerId),n=!0)}return n?$s(s):e}function h1(e,t,n){const s=Dr(e);return s.columns[t]&&(s.columns[t].width=Math.max(Ll,Number(n)||1)),s}function f1(e,t,n,s){const o=Dr(e),a=o.columns[t]&&o.columns[t].tiles[n];return a&&(a.height=Math.max(Ll,Number(s)||1)),o}function p1(e,t,n,s){if(!(e.columns[t]&&e.columns[t].tiles[n]))return e;const a=Dr(e),u=a.columns[t].tiles[n],h=Number(u.fontSize)||Wo;return u.fontSize=Math.max(ey,Math.min(ty,h+(Number(s)||0))),a}function m1(e,t,n,s){const o=e.columns[t];if(!o||!o.tiles[n])return null;switch(s){case"left":return{col:t};case"right":return{col:t+1};case"top":return{col:t,row:n};case"bottom":return{col:t,row:n+1};default:return null}}function bg(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function $s(e){if(!e||!Array.isArray(e.columns))return kr();const t=e.columns.map(s=>({width:Math.max(Ll,Number(s&&s.width)||1),tiles:(Array.isArray(s&&s.tiles)?s.tiles:[]).filter(o=>o&&typeof o.session=="string"&&o.session).filter(o=>o.node==null||typeof o.node=="string"&&Md(o.node)).filter(o=>o.ownerId==null||typeof o.ownerId=="string"&&Rr.test(o.ownerId)).map(o=>{const a={session:o.session,height:Math.max(Ll,Number(o.height)||1),fontSize:l1(o.fontSize)};return o.node!=null&&(a.node=o.node),o.ownerId!=null&&(a.ownerId=o.ownerId),o.unavailable===!0&&(a.unavailable=!0),a})})).filter(s=>s.tiles.length>0),n=new Set;for(const s of t)s.tiles=s.tiles.filter(o=>!n.has(On(o))&&n.add(On(o))&&n.size<=Yh);return{columns:t.filter(s=>s.tiles.length>0)}}const iy=/^[a-z0-9-]{1,32}$/,g1=/^[A-Za-z0-9._-]{1,32}$/,v1=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/,_1=320;function Ad(e){return typeof e=="string"&&iy.test(e)}const y1=64;function jr(e){if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&t.length<=y1&&!/[\x00-\x1f\x7f]/.test(t)}function ms(e){return String(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/g,"")||"node"}function sy(e){if(typeof e!="string"||!e||e.length>_1||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:g1.test(e.slice(0,t))&&v1.test(e.slice(t+1))}function xg(e){if(e===""||e===null||e===void 0)return null;const t=String(e).trim();if(!/^[0-9]{1,5}$/.test(t))return;const n=Number(t);return Number.isInteger(n)&&n>=1&&n<=65535?n:void 0}function kg({name:e,ssh:t,sshPort:n,remotePort:s}={}){const o=typeof e=="string"?e.trim():e,a=typeof t=="string"?t.trim():t;if(!Ad(o))return{ok:!1,error:"err-node-name"};if(!sy(a))return{ok:!1,error:"err-ssh"};const u=xg(n);if(u===void 0)return{ok:!1,error:"err-ssh-port"};const h=xg(s);if(h===void 0)return{ok:!1,error:"err-node-port"};const f={name:o,ssh:a};return u!==null&&(f.sshPort=u),h!==null&&(f.remotePort=h),{ok:!0,value:f}}function w1(e,t){if(!e||!t||t<e)return null;const n=Math.floor((t-e)/1e3);return n<60?"ora":n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}g`}function Cg(e,t){const n=!!(e&&e.status==="up"),s=!!(e&&e.status==="passive");return{up:n,...s?{passive:!0}:{},label:n?"tunnel-up":s?"node-passive":"tunnel-down",since:n?w1(e.since,t):null}}const S1=new Set(["v","instanceId","port","label","invite"]),b1=new Set(["v","instanceId","port","label","invite","name","ssh","sshPort"]);function x1(e){const t=String(e).replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),s=typeof atob=="function"?atob(n):Buffer.from(n,"base64").toString("binary"),o=Uint8Array.from(s,a=>a.charCodeAt(0));return typeof TextDecoder<"u"?new TextDecoder().decode(o):Buffer.from(o).toString("utf8")}function k1(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 n;try{n=JSON.parse(x1(t))}catch{return{ok:!1}}if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1};const s=n.v===1?S1:n.v===2?b1:null;if(!s)return{ok:!1};for(const u of Object.keys(n))if(!s.has(u))return{ok:!1};if(!/^[a-f0-9]{16,64}$/.test(String(n.instanceId)))return{ok:!1};const o=Number(n.port);if(!Number.isInteger(o)||o<1||o>65535)return{ok:!1};if(typeof n.label!="string")return{ok:!1};if(typeof n.invite!="string"||!n.invite)return{ok:!1};const a={ok:!0,version:n.v,label:n.label,invite:n.invite,instanceId:n.instanceId,port:o};if(n.v===2){if(n.name!==void 0){if(typeof n.name!="string"||!iy.test(n.name))return{ok:!1};a.name=n.name}if(n.ssh!==void 0){if(!sy(n.ssh))return{ok:!1};a.ssh=String(n.ssh).trim()}if(n.sshPort!==void 0){const u=Number(n.sshPort);if(!Number.isInteger(u)||u<1||u>65535)return{ok:!1};a.sshPort=u}}return a}function C1(e,t,n=new Set){if(!t||!t.ok)return e;const s={...e},o=(a,u)=>{u==null||u===""||n.has(a)||(s[a]=u)};return o("label",t.label),t.version===2&&(o("name",t.name||(t.ssh?ms(t.label):"")),o("ssh",t.ssh),t.sshPort!==void 0&&o("sshPort",String(t.sshPort))),s}let Id={sessions:[],cells:[],nodeGroups:[],localNodeId:"",localFresh:!1,refreshedAt:0};function Eg(){return Id}function ry(e={}){return Id={sessions:Array.isArray(e.sessions)?e.sessions:[],cells:Array.isArray(e.cells)?e.cells:[],nodeGroups:Array.isArray(e.nodeGroups)?e.nodeGroups:[],localNodeId:typeof e.localNodeId=="string"?e.localNodeId:"",localFresh:e.localFresh===!0,refreshedAt:Number.isFinite(e.refreshedAt)?e.refreshedAt:0},Id}const vr=(e,t=[])=>`${t.length?t.join("/"):"local"}:${e}`;function E1({onPick:e,token:t,onSettings:n}){const[s,o]=$n(),a=Wh(t),[u,h]=E.useState(null),[f,p]=E.useState(null),[v,b]=E.useState(""),[w,S]=E.useState(""),[y,x]=E.useState({bind:"127.0.0.1",port:""}),[C,R]=E.useState(""),[k,$]=E.useState([]),[O,V]=E.useState([]),[Y,z]=E.useState({}),[ne,H]=E.useState(new Set),[X,I]=E.useState(null),[A,N]=E.useState(null),{pins:M,orders:L,togglePin:P,viewFor:F,updateView:T,canMoveRoster:q,moveRoster:B,stepRoster:D}=Kh(),{groupsFor:U,moveNode:Z,stepNode:oe,nodeKey:de}=J_(),fe=U(a);E.useEffect(()=>{ry({sessions:u||[],cells:k,nodeGroups:a,localNodeId:C})},[u,k,a,C]),E.useEffect(()=>{const W=new Map;for(const se of k)W.set(vr(se.cell),!!se.boot);for(const se of a){const ve=se.route||[se.name];for(const ke of se.cells||[])W.set(vr(ke.cell,ve),!!ke.boot)}z(se=>{let ve=!1;const ke={...se};for(const[Re,we]of Object.entries(se))W.has(Re)&&W.get(Re)===we&&(delete ke[Re],ve=!0);return ve?ke:se})},[k,a]);async function J(){try{const se=await(await Vt("/api/sessions",t)).json();se.error?(p(se.error),h([])):(p(null),h(se.sessions||[]))}catch(W){p(String(W)),h([])}try{const W=await _s(t);$(W.available?W.cells||[]:[]),V(W.available?W.capabilities||[]:[])}catch{$([]),V([])}}E.useEffect(()=>{J(),Vt("/api/config",t).then(se=>se.json()).then(se=>{S(se.version||""),x({bind:se.bind||"127.0.0.1",port:se.port||""}),R(Rr.test(String(se.instanceId||""))?se.instanceId:"")}).catch(()=>{});const W=setInterval(J,4e3);return()=>clearInterval(W)},[]);async function ee(){if(!y.port)return;const W=`http://${y.bind}:${y.port}/#token=${t}`;try{await navigator.clipboard.writeText(W)}catch{}}function pe(W,se,ve){const ke=vr(W,se);z(Re=>({...Re,[ke]:!!ve}))}function Se(W,se=[]){const ve=vr(W.cell,se);return Object.prototype.hasOwnProperty.call(Y,ve)?Y[ve]:!!W.boot}async function Ze(W,se,ve=[]){W.stopPropagation();const ke=vr(se.cell,ve),Re=!Se(se,ve);pe(se.cell,ve,Re),H(we=>new Set(we).add(ke));try{await O_(t,{cell:se.cell,enabled:Re},ve),ve.length||$(we=>we.map(je=>je.cell===se.cell?{...je,boot:Re}:je))}catch(we){z(je=>{const st={...je};return delete st[ke],st}),p(String((we==null?void 0:we.message)||we))}finally{H(we=>{const je=new Set(we);return je.delete(ke),je})}}async function $e(W){if(!X)return;const{cell:se}=X,ve=Array.isArray(X.route)?X.route:[];W.action==="up"?(await Ah(t,{cell:se,boot:!!W.boot,...W.engine?{engine:W.engine}:{},...W.model!==void 0?{model:W.model}:{},...W.permissionPolicy?{permissionPolicy:W.permissionPolicy}:{}},ve),pe(se,ve,!!W.boot)):(await Cl(t,{cell:se,boot:!!W.boot},ve),W.boot&&pe(se,ve,!1)),J()}async function He(W,se=[]){try{await Bh(t,W,se)}catch{return}J()}async function vt(W,se,ve=[]){try{await $_(t,W,se,ve)}catch{return}J()}async function Xe(W){if(!(!(W!=null&&W.direct)||A)){N(W.name);try{await $h(t,W.name,W.tunnelStatus==="up"?"down":"up")}catch{}N(null)}}async function St(W){if(!(W!=null&&W.direct))return;const se=window.prompt(m("rename-node-prompt"),W.label||W.name);if(se===null)return;const ve=String(se).trim();if(!jr(ve)){window.alert(m("rename-node-invalid"));return}try{await W_(t,W.name,ve)}catch(ke){window.alert(String((ke==null?void 0:ke.message)||ke))}}const Et=E.useMemo(()=>new Map((u||[]).map(W=>[W.name,W])),[u]),rt=E.useMemo(()=>new Set(k.map(W=>W.tmuxSession)),[k]),ct=E.useMemo(()=>(u||[]).filter(W=>!rt.has(W.name)),[u,rt]),ot=E.useMemo(()=>Vh(k,ct,Et),[k,ct,Et]),ut=F("local"),dt=E.useMemo(()=>ps(ot,M,ut.filter,Ai(L,"local")).filter(W=>pg(W,v)),[ot,M,ut.filter,v,L]),le=fe.reduce((W,se)=>W+(se.cells||[]).length+(se.unmanaged||[]).filter(ve=>!ve.technical).length,0),xe=ps(ot,M,"all",Ai(L,"local")).length+le,ze=ot.filter(W=>W.live).length+fe.reduce((W,se)=>W+Pl(se).rawItems.filter(ve=>ve.live).length,0),Ie=(u||[]).filter(W=>W.attached).length+fe.reduce((W,se)=>W+(se.sessions||[]).filter(ve=>ve.attached).length,0),ue=Math.min(Ie,ze),G=y.port?`${y.bind}:${y.port}`:y.bind;function ie(W,se=null,ve=ot){var _n,bt;const ke=Array.isArray(se==null?void 0:se.route)?se.route:[],Re=ke.join("/"),we=Re||"local",je=ke.length?se==null?void 0:se.instanceId:C,st=(Ye,Gt)=>e({session:Ye,...Re?{node:Re}:{},...Rr.test(String(je||""))?{ownerId:je}:{},...typeof Gt=="string"&&Gt?{cellName:Gt}:{}}),It=q;if(W.type==="cell"){const Ye=W.value,Gt=ke.length?((se==null?void 0:se.sessions)||[]).find(pt=>pt.name===Ye.tmuxSession):Et.get(Ye.tmuxSession),Hn=Ye.degraded?m("cell-degraded"):W.working?W.subtitle:Ye.tmux?m("cell-idle"):m("cell-off"),li=ke.length===0||((se==null?void 0:se.capabilities)||[]).includes(Ye.active?"down":"up"),he=ke.length===0?O.includes("boot"):((se==null?void 0:se.capabilities)||[]).includes("boot"),Ne=Se(Ye,ke),Ke=vr(Ye.cell,ke),Nt=`${m(Ne?"boot-disable":"boot-enable")} ${Ye.cell}`;return c.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,"data-position":we,children:[c.jsx(Di,{position:we,itemKey:W.key,label:Ye.cell,canMove:It,onMove:(pt,Wn)=>B(we,pt,Wn,ve),onStep:pt=>D(we,W.key,pt,ve)}),c.jsxs("button",{className:"nc-mcard-main",onClick:()=>Ye.tmux&&st(Ye.tmuxSession,Ye.cell),title:Hn,"aria-label":`${Ye.cell}, ${Hn}`,children:[c.jsx("span",{className:`dot ${Ye.degraded?"warn":Ye.tmux?`on${W.working?" working":""}`:""}`}),c.jsxs("span",{className:"nc-mcard-text",children:[c.jsx("b",{children:Ye.cell}),c.jsx("small",{title:W.subtitle,children:W.subtitle})]})]}),W.activity?c.jsx("span",{className:"nc-rel",children:Nr(W.activity)}):null,W.fresh&&((_n=Gt==null?void 0:Gt.outbox)==null?void 0:_n.count)>0&&c.jsx("span",{className:"nc-badge",title:m("new-files-outbox"),children:Gt.outbox.count}),c.jsx("button",{className:`nc-act pin${M.includes(W.key)?" on":""}`,"aria-label":`${m("pin")} ${Ye.cell}`,title:m("pin"),onClick:()=>P(W.key),children:M.includes(W.key)?"★":"☆"}),he&&c.jsx("button",{className:`nc-act boot${Ne?" on":""}`,disabled:ne.has(Ke),onClick:pt=>Ze(pt,Ye,ke),title:Nt,"aria-label":Nt,children:c.jsx(it,{name:"boot",size:16})}),li&&c.jsx("button",{className:`nc-act power${Ye.tmux?" on":""}${Ye.degraded?" warn":""}`,onClick:()=>I(ke.length?{...Ye,boot:Ne,route:ke,availableEngines:(se==null?void 0:se.engines)||[]}:{...Ye,boot:Ne}),title:Ye.active?m("power-off"):m("power-on"),"aria-label":`${Ye.active?m("power-off"):m("power-on")} ${Ye.cell}`,children:c.jsx(it,{name:"power",size:16})})]},W.key)}const Oe=W.value;return c.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,"data-position":we,children:[c.jsx(Di,{position:we,itemKey:W.key,label:Oe.name,canMove:It,onMove:(Ye,Gt)=>B(we,Ye,Gt,ve),onStep:Ye=>D(we,W.key,Ye,ve)}),c.jsxs("button",{className:"nc-mcard-main",onClick:()=>st(Oe.name),children:[c.jsx("span",{className:Oe.attached?"dot on":"dot"}),c.jsxs("span",{className:"nc-mcard-text",children:[c.jsx("b",{children:Oe.name}),c.jsx("small",{children:Oe.preview?Oe.preview:Oe.cmd?Oe.cmd:m("windows").replace("{n}",String(Oe.windows||0))})]})]}),W.activity?c.jsx("span",{className:"nc-rel",children:Nr(W.activity)}):null,W.fresh&&((bt=Oe.outbox)==null?void 0:bt.count)>0&&c.jsx("span",{className:"nc-badge",title:m("new-files-outbox"),children:Oe.outbox.count}),c.jsx("button",{className:`nc-act pin${M.includes(W.key)?" on":""}`,"aria-label":`${m("pin")} ${Oe.name}`,title:m("pin"),onClick:()=>P(W.key),children:M.includes(W.key)?"★":"☆"}),c.jsx("button",{className:`nc-act technical${Oe.technical?" on":""}`,title:Oe.technical?m("mark-normal"):m("mark-technical"),"aria-label":`${Oe.technical?m("mark-normal"):m("mark-technical")} ${Oe.name}`,onClick:()=>vt(Oe.name,!Oe.technical,ke),children:"T"}),c.jsx("button",{className:"nc-menu",title:m("terminate"),"aria-label":`${m("terminate")} ${Oe.name}`,onClick:()=>{window.confirm(m("terminate-confirm").replace("{name}",Oe.name))&&He(Oe.name,ke)},children:"⋯"})]},W.key)}return c.jsxs("div",{className:"nc-home",children:[c.jsxs("header",{className:"nc-home-head",children:[c.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",c.jsx("span",{className:"nc-cursor"})]}),c.jsxs("div",{className:"nc-home-sub",children:[m("fleet-tmux")," · ",ze," ",m("sessions"),ue>0&&` · ${ue} attached`]}),c.jsxs("span",{className:"nc-head-actions",children:[c.jsx("button",{className:"nc-refresh",onClick:()=>n("nodes",!1),title:m("settings"),children:c.jsx(it,{name:"gear",size:18})}),c.jsx("button",{className:"nc-refresh",onClick:J,title:m("refresh"),children:c.jsx(it,{name:"refresh",size:18})})]})]}),c.jsxs("main",{className:"nc-home-scroll",children:[xe>8&&c.jsx("input",{className:"nc-filter",type:"search",placeholder:m("filter-placeholder"),"aria-label":m("filter-placeholder"),value:v,onChange:W=>b(W.target.value)}),f&&c.jsx("div",{className:"nc-err",children:f}),c.jsxs("section",{className:"nc-group","data-position":"local",children:[c.jsx(Ng,{label:m("position-local"),count:dt.length,state:ut,dotClass:"on",onToggle:()=>T("local",{open:!ut.open}),onFilter:W=>T("local",{filter:W})}),ut.open&&dt.map(W=>ie(W,null,ot)),ut.open&&u===null&&c.jsx("div",{className:"nc-empty",children:m("loading-fleet")}),ut.open&&u!==null&&dt.length===0&&!f&&c.jsx("div",{className:"nc-empty",children:v?m("no-match").replace("{q}",v):m("no-sessions-short")})]}),fe.map(W=>{const ve=Q_(W.health,{passive:"warn"})||(W.status==="up"?"on":W.status==="passive"?"":"warn"),ke=W.health?Rl(W.health):W.status==="up"?"":xr(W),we=(W.route||[W.name]).join("/"),je=F(we),{rawItems:st}=Pl(W),It=ps(st,M,je.filter,Ai(L,we)).filter(bt=>pg(bt,v)),Oe=W.direct&&W.health&&W.health.managed!==!1?c.jsx("button",{type:"button",className:`nc-act power${W.tunnelStatus==="up"?" on":""}`,disabled:A===W.name,title:W.tunnelStatus==="up"?m("power-off"):m("power-on"),"aria-label":`${W.tunnelStatus==="up"?m("power-off"):m("power-on")} ${W.label||W.name}`,onClick:()=>Xe(W),children:c.jsx(it,{name:"power",size:15})}):null,_n=c.jsxs("span",{className:"nc-node-actions",children:[c.jsx(Di,{scope:"node",position:"nodes",itemKey:de(W),label:W.label||W.name,onMove:(bt,Ye)=>Z(bt,Ye,a),onStep:bt=>oe(de(W),bt,a)}),W.direct&&c.jsx("button",{type:"button",className:"nc-node-rename",title:m("rename-node"),"aria-label":`${m("rename-node")} ${W.label||W.name}`,onClick:()=>St(W),children:"✎"}),Oe]});return c.jsxs("section",{className:"nc-group nc-node-order-wrap","data-position":we,"data-node-order-key":de(W),children:[c.jsx(Ng,{label:W.label||W.name,count:It.length,state:je,dotClass:ve,dotTitle:ke,detail:W.status==="up"?"":W.health&&Rl(W.health)||xr(W),onToggle:()=>T(we,{open:!je.open}),onFilter:bt=>T(we,{filter:bt}),onRename:W.direct?()=>St(W):null,action:_n}),W.status==="up"&&je.open&&It.map(bt=>ie(bt,W,st)),W.status==="up"&&je.open&&It.length===0&&c.jsx("div",{className:"nc-empty",children:v?m("no-match").replace("{q}",v):m("no-sessions-short")})]},`nodo-${we}`)}),c.jsxs("footer",{className:"nc-home-foot",onClick:ee,title:m("copy-url"),children:[c.jsxs("span",{className:"nc-home-meta",children:[w&&c.jsxs("span",{className:"nc-home-version",children:["v",w]}),c.jsxs("span",{className:"nc-home-endpoint",children:[G," · ",m("ssh-only")]})]}),c.jsx("span",{className:"nc-lang",onClick:W=>W.stopPropagation(),children:G_.map((W,se)=>c.jsxs("span",{children:[se>0&&" · ",c.jsx("button",{className:`nc-lang-btn${s===W?" on":""}`,onClick:()=>o(W),title:W,children:W.toUpperCase()})]},W))})]})]}),c.jsx("button",{className:"nc-fab",onClick:()=>n("fleet",!0),title:m("fleet-new-cell"),"aria-label":m("fleet-new-cell"),children:"+"}),X&&c.jsx(Nl,{cell:X,token:t,route:Array.isArray(X.route)?X.route:[],onConfirm:$e,onClose:()=>I(null)})]})}function Ng({label:e,count:t,state:n,dotClass:s="",dotTitle:o="",detail:a="",onToggle:u,onFilter:h,onRename:f=null,action:p=null}){return c.jsxs("div",{className:"nc-mobile-position-head",onContextMenu:f?v=>{v.preventDefault(),f()}:void 0,children:[c.jsxs("button",{type:"button",className:"nc-mobile-position-toggle",onClick:u,"aria-expanded":n.open,"aria-label":`${e} · ${m("node-sessions").replace("{n}",String(t))}`,children:[c.jsx("span",{className:"nc-mobile-chevron","aria-hidden":"true",children:n.open?"⌄":"›"}),c.jsx("span",{className:`dot ${s}`,title:o}),c.jsxs("span",{className:"nc-mobile-position-copy",children:[c.jsx("b",{children:e}),c.jsx("small",{children:a||m("node-sessions").replace("{n}",String(t))})]})]}),c.jsxs("select",{className:"nc-mobile-position-filter",value:n.filter,"aria-label":`${e} · ${m("filter-placeholder")}`,title:m(`view-${n.filter}`),onChange:v=>h(v.target.value),children:[c.jsx("option",{value:"all",children:m("view-all")}),c.jsx("option",{value:"pinned",children:m("view-pinned")}),c.jsx("option",{value:"active",children:m("view-active")}),c.jsx("option",{value:"off",children:m("view-off")}),c.jsx("option",{value:"technical",children:m("view-technical")})]}),p]})}/**
40
+ `+_.stack}return{value:i,source:r,stack:g,digest:null}}function su(i,r,l){return{value:i,source:null,stack:l??null,digest:r??null}}function ru(i,r){try{console.error(r.value)}catch(l){setTimeout(function(){throw l})}}var yb=typeof WeakMap=="function"?WeakMap:Map;function om(i,r,l){l=ji(-1,l),l.tag=3,l.payload={element:null};var d=r.value;return l.callback=function(){Ha||(Ha=!0,wu=d),ru(i,r)},l}function am(i,r,l){l=ji(-1,l),l.tag=3;var d=i.type.getDerivedStateFromError;if(typeof d=="function"){var g=r.value;l.payload=function(){return d(g)},l.callback=function(){ru(i,r)}}var _=i.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(l.callback=function(){ru(i,r),typeof d!="function"&&(es===null?es=new Set([this]):es.add(this));var j=r.stack;this.componentDidCatch(r.value,{componentStack:j!==null?j:""})}),l}function lm(i,r,l){var d=i.pingCache;if(d===null){d=i.pingCache=new yb;var g=new Set;d.set(r,g)}else g=d.get(r),g===void 0&&(g=new Set,d.set(r,g));g.has(l)||(g.add(l),i=Db.bind(null,i,r,l),r.then(i,i))}function cm(i){do{var r;if((r=i.tag===13)&&(r=i.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return i;i=i.return}while(i!==null);return null}function um(i,r,l,d,g){return(i.mode&1)===0?(i===r?i.flags|=65536:(i.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(r=ji(-1,1),r.tag=2,Qi(l,r,1))),l.lanes|=1),i):(i.flags|=65536,i.lanes=g,i)}var wb=O.ReactCurrentOwner,Nn=!1;function yn(i,r,l,d){r.child=i===null?Pp(r,null,l,d):lr(r,i.child,l,d)}function dm(i,r,l,d,g){l=l.render;var _=r.ref;return ur(r,g),d=Xc(i,r,l,d,_,g),l=Jc(),i!==null&&!Nn?(r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~g,Pi(i,r,g)):(kt&&l&&Dc(r),r.flags|=1,yn(i,r,d,g),r.child)}function hm(i,r,l,d,g){if(i===null){var _=l.type;return typeof _=="function"&&!Nu(_)&&_.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(r.tag=15,r.type=_,fm(i,r,_,d,g)):(i=Ya(l.type,null,d,r,r.mode,g),i.ref=r.ref,i.return=r,r.child=i)}if(_=i.child,(i.lanes&g)===0){var j=_.memoizedProps;if(l=l.compare,l=l!==null?l:Jr,l(j,d)&&i.ref===r.ref)return Pi(i,r,g)}return r.flags|=1,i=ss(_,d),i.ref=r.ref,i.return=r,r.child=i}function fm(i,r,l,d,g){if(i!==null){var _=i.memoizedProps;if(Jr(_,d)&&i.ref===r.ref)if(Nn=!1,r.pendingProps=d=_,(i.lanes&g)!==0)(i.flags&131072)!==0&&(Nn=!0);else return r.lanes=i.lanes,Pi(i,r,g)}return ou(i,r,l,d,g)}function pm(i,r,l){var d=r.pendingProps,g=d.children,_=i!==null?i.memoizedState:null;if(d.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},mt(pr,An),An|=l;else{if((l&1073741824)===0)return i=_!==null?_.baseLanes|l:l,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:i,cachePool:null,transitions:null},r.updateQueue=null,mt(pr,An),An|=i,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=_!==null?_.baseLanes:l,mt(pr,An),An|=d}else _!==null?(d=_.baseLanes|l,r.memoizedState=null):d=l,mt(pr,An),An|=d;return yn(i,r,g,l),r.child}function mm(i,r){var l=r.ref;(i===null&&l!==null||i!==null&&i.ref!==l)&&(r.flags|=512,r.flags|=2097152)}function ou(i,r,l,d,g){var _=En(l)?bs:fn.current;return _=sr(r,_),ur(r,g),l=Xc(i,r,l,d,_,g),d=Jc(),i!==null&&!Nn?(r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~g,Pi(i,r,g)):(kt&&d&&Dc(r),r.flags|=1,yn(i,r,l,g),r.child)}function gm(i,r,l,d,g){if(En(l)){var _=!0;ya(r)}else _=!1;if(ur(r,g),r.stateNode===null)Ba(i,r),sm(r,l,d),iu(r,l,d,g),d=!0;else if(i===null){var j=r.stateNode,K=r.memoizedProps;j.props=K;var Q=j.context,ce=l.contextType;typeof ce=="object"&&ce!==null?ce=qn(ce):(ce=En(l)?bs:fn.current,ce=sr(r,ce));var ye=l.getDerivedStateFromProps,be=typeof ye=="function"||typeof j.getSnapshotBeforeUpdate=="function";be||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(K!==d||Q!==ce)&&rm(r,j,d,ce),Ji=!1;var _e=r.memoizedState;j.state=_e,Ra(r,d,j,g),Q=r.memoizedState,K!==d||_e!==Q||Cn.current||Ji?(typeof ye=="function"&&(nu(r,l,ye,d),Q=r.memoizedState),(K=Ji||im(r,l,K,d,_e,Q,ce))?(be||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(r.flags|=4194308)):(typeof j.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=Q),j.props=d,j.state=Q,j.context=ce,d=K):(typeof j.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{j=r.stateNode,Tp(i,r),K=r.memoizedProps,ce=r.type===r.elementType?K:ii(r.type,K),j.props=ce,be=r.pendingProps,_e=j.context,Q=l.contextType,typeof Q=="object"&&Q!==null?Q=qn(Q):(Q=En(l)?bs:fn.current,Q=sr(r,Q));var Le=l.getDerivedStateFromProps;(ye=typeof Le=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(K!==be||_e!==Q)&&rm(r,j,d,Q),Ji=!1,_e=r.memoizedState,j.state=_e,Ra(r,d,j,g);var De=r.memoizedState;K!==be||_e!==De||Cn.current||Ji?(typeof Le=="function"&&(nu(r,l,Le,d),De=r.memoizedState),(ce=Ji||im(r,l,ce,d,_e,De,Q)||!1)?(ye||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,De,Q),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,De,Q)),typeof j.componentDidUpdate=="function"&&(r.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof j.componentDidUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=De),j.props=d,j.state=De,j.context=Q,d=ce):(typeof j.componentDidUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||K===i.memoizedProps&&_e===i.memoizedState||(r.flags|=1024),d=!1)}return au(i,r,l,d,_,g)}function au(i,r,l,d,g,_){mm(i,r);var j=(r.flags&128)!==0;if(!d&&!j)return g&&Sp(r,l,!1),Pi(i,r,_);d=r.stateNode,wb.current=r;var K=j&&typeof l.getDerivedStateFromError!="function"?null:d.render();return r.flags|=1,i!==null&&j?(r.child=lr(r,i.child,null,_),r.child=lr(r,null,K,_)):yn(i,r,K,_),r.memoizedState=d.state,g&&Sp(r,l,!0),r.child}function vm(i){var r=i.stateNode;r.pendingContext?yp(i,r.pendingContext,r.pendingContext!==r.context):r.context&&yp(i,r.context,!1),Uc(i,r.containerInfo)}function _m(i,r,l,d,g){return ar(),Bc(g),r.flags|=256,yn(i,r,l,d),r.child}var lu={dehydrated:null,treeContext:null,retryLane:0};function cu(i){return{baseLanes:i,cachePool:null,transitions:null}}function ym(i,r,l){var d=r.pendingProps,g=jt.current,_=!1,j=(r.flags&128)!==0,K;if((K=j)||(K=i!==null&&i.memoizedState===null?!1:(g&2)!==0),K?(_=!0,r.flags&=-129):(i===null||i.memoizedState!==null)&&(g|=1),mt(jt,g&1),i===null)return Ic(r),i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((r.mode&1)===0?r.lanes=1:i.data==="$!"?r.lanes=8:r.lanes=1073741824,null):(j=d.children,i=d.fallback,_?(d=r.mode,_=r.child,j={mode:"hidden",children:j},(d&1)===0&&_!==null?(_.childLanes=0,_.pendingProps=j):_=Ga(j,d,0,null),i=Ts(i,d,l,null),_.return=r,i.return=r,_.sibling=i,r.child=_,r.child.memoizedState=cu(l),r.memoizedState=lu,i):uu(r,j));if(g=i.memoizedState,g!==null&&(K=g.dehydrated,K!==null))return Sb(i,r,j,d,K,g,l);if(_){_=d.fallback,j=r.mode,g=i.child,K=g.sibling;var Q={mode:"hidden",children:d.children};return(j&1)===0&&r.child!==g?(d=r.child,d.childLanes=0,d.pendingProps=Q,r.deletions=null):(d=ss(g,Q),d.subtreeFlags=g.subtreeFlags&14680064),K!==null?_=ss(K,_):(_=Ts(_,j,l,null),_.flags|=2),_.return=r,d.return=r,d.sibling=_,r.child=d,d=_,_=r.child,j=i.child.memoizedState,j=j===null?cu(l):{baseLanes:j.baseLanes|l,cachePool:null,transitions:j.transitions},_.memoizedState=j,_.childLanes=i.childLanes&~l,r.memoizedState=lu,d}return _=i.child,i=_.sibling,d=ss(_,{mode:"visible",children:d.children}),(r.mode&1)===0&&(d.lanes=l),d.return=r,d.sibling=null,i!==null&&(l=r.deletions,l===null?(r.deletions=[i],r.flags|=16):l.push(i)),r.child=d,r.memoizedState=null,d}function uu(i,r){return r=Ga({mode:"visible",children:r},i.mode,0,null),r.return=i,i.child=r}function Ia(i,r,l,d){return d!==null&&Bc(d),lr(r,i.child,null,l),i=uu(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function Sb(i,r,l,d,g,_,j){if(l)return r.flags&256?(r.flags&=-257,d=su(Error(n(422))),Ia(i,r,j,d)):r.memoizedState!==null?(r.child=i.child,r.flags|=128,null):(_=d.fallback,g=r.mode,d=Ga({mode:"visible",children:d.children},g,0,null),_=Ts(_,g,j,null),_.flags|=2,d.return=r,_.return=r,d.sibling=_,r.child=d,(r.mode&1)!==0&&lr(r,i.child,null,j),r.child.memoizedState=cu(j),r.memoizedState=lu,_);if((r.mode&1)===0)return Ia(i,r,j,null);if(g.data==="$!"){if(d=g.nextSibling&&g.nextSibling.dataset,d)var K=d.dgst;return d=K,_=Error(n(419)),d=su(_,d,void 0),Ia(i,r,j,d)}if(K=(j&i.childLanes)!==0,Nn||K){if(d=Qt,d!==null){switch(j&-j){case 4:g=2;break;case 16:g=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:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(d.suspendedLanes|j))!==0?0:g,g!==0&&g!==_.retryLane&&(_.retryLane=g,Ri(i,g),oi(d,i,g,-1))}return Eu(),d=su(Error(n(421))),Ia(i,r,j,d)}return g.data==="$?"?(r.flags|=128,r.child=i.child,r=Mb.bind(null,i),g._reactRetry=r,null):(i=_.treeContext,Mn=Vi(g.nextSibling),Dn=r,kt=!0,ni=null,i!==null&&(Un[Kn++]=Ei,Un[Kn++]=Ni,Un[Kn++]=xs,Ei=i.id,Ni=i.overflow,xs=r),r=uu(r,d.children),r.flags|=4096,r)}function wm(i,r,l){i.lanes|=r;var d=i.alternate;d!==null&&(d.lanes|=r),$c(i.return,r,l)}function du(i,r,l,d,g){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=d,_.tail=l,_.tailMode=g)}function Sm(i,r,l){var d=r.pendingProps,g=d.revealOrder,_=d.tail;if(yn(i,r,d.children,l),d=jt.current,(d&2)!==0)d=d&1|2,r.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&wm(i,l,r);else if(i.tag===19)wm(i,l,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}d&=1}if(mt(jt,d),(r.mode&1)===0)r.memoizedState=null;else switch(g){case"forwards":for(l=r.child,g=null;l!==null;)i=l.alternate,i!==null&&ja(i)===null&&(g=l),l=l.sibling;l=g,l===null?(g=r.child,r.child=null):(g=l.sibling,l.sibling=null),du(r,!1,g,l,_);break;case"backwards":for(l=null,g=r.child,r.child=null;g!==null;){if(i=g.alternate,i!==null&&ja(i)===null){r.child=g;break}i=g.sibling,g.sibling=l,l=g,g=i}du(r,!0,l,null,_);break;case"together":du(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function Ba(i,r){(r.mode&1)===0&&i!==null&&(i.alternate=null,r.alternate=null,r.flags|=2)}function Pi(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),Rs|=r.lanes,(l&r.childLanes)===0)return null;if(i!==null&&r.child!==i.child)throw Error(n(153));if(r.child!==null){for(i=r.child,l=ss(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=ss(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function bb(i,r,l){switch(r.tag){case 3:vm(r),ar();break;case 5:Ap(r);break;case 1:En(r.type)&&ya(r);break;case 4:Uc(r,r.stateNode.containerInfo);break;case 10:var d=r.type._context,g=r.memoizedProps.value;mt(Ca,d._currentValue),d._currentValue=g;break;case 13:if(d=r.memoizedState,d!==null)return d.dehydrated!==null?(mt(jt,jt.current&1),r.flags|=128,null):(l&r.child.childLanes)!==0?ym(i,r,l):(mt(jt,jt.current&1),i=Pi(i,r,l),i!==null?i.sibling:null);mt(jt,jt.current&1);break;case 19:if(d=(l&r.childLanes)!==0,(i.flags&128)!==0){if(d)return Sm(i,r,l);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),mt(jt,jt.current),d)break;return null;case 22:case 23:return r.lanes=0,pm(i,r,l)}return Pi(i,r,l)}var bm,hu,xm,km;bm=function(i,r){for(var l=r.child;l!==null;){if(l.tag===5||l.tag===6)i.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===r)break;for(;l.sibling===null;){if(l.return===null||l.return===r)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},hu=function(){},xm=function(i,r,l,d){var g=i.memoizedProps;if(g!==d){i=r.stateNode,Es(di.current);var _=null;switch(l){case"input":g=vt(i,g),d=vt(i,d),_=[];break;case"select":g=B({},g,{value:void 0}),d=B({},d,{value:void 0}),_=[];break;case"textarea":g=dt(i,g),d=dt(i,d),_=[];break;default:typeof g.onClick!="function"&&typeof d.onClick=="function"&&(i.onclick=ga)}je(l,d);var j;l=null;for(ce in g)if(!d.hasOwnProperty(ce)&&g.hasOwnProperty(ce)&&g[ce]!=null)if(ce==="style"){var K=g[ce];for(j in K)K.hasOwnProperty(j)&&(l||(l={}),l[j]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(o.hasOwnProperty(ce)?_||(_=[]):(_=_||[]).push(ce,null));for(ce in d){var Q=d[ce];if(K=g!=null?g[ce]:void 0,d.hasOwnProperty(ce)&&Q!==K&&(Q!=null||K!=null))if(ce==="style")if(K){for(j in K)!K.hasOwnProperty(j)||Q&&Q.hasOwnProperty(j)||(l||(l={}),l[j]="");for(j in Q)Q.hasOwnProperty(j)&&K[j]!==Q[j]&&(l||(l={}),l[j]=Q[j])}else l||(_||(_=[]),_.push(ce,l)),l=Q;else ce==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,K=K?K.__html:void 0,Q!=null&&K!==Q&&(_=_||[]).push(ce,Q)):ce==="children"?typeof Q!="string"&&typeof Q!="number"||(_=_||[]).push(ce,""+Q):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(o.hasOwnProperty(ce)?(Q!=null&&ce==="onScroll"&&_t("scroll",i),_||K===Q||(_=[])):(_=_||[]).push(ce,Q))}l&&(_=_||[]).push("style",l);var ce=_;(r.updateQueue=ce)&&(r.flags|=4)}},km=function(i,r,l,d){l!==d&&(r.flags|=4)};function fo(i,r){if(!kt)switch(i.tailMode){case"hidden":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function mn(i){var r=i.alternate!==null&&i.alternate.child===i.child,l=0,d=0;if(r)for(var g=i.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags&14680064,d|=g.flags&14680064,g.return=i,g=g.sibling;else for(g=i.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=i,g=g.sibling;return i.subtreeFlags|=d,i.childLanes=l,r}function xb(i,r,l){var d=r.pendingProps;switch(Mc(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(r),null;case 1:return En(r.type)&&_a(),mn(r),null;case 3:return d=r.stateNode,dr(),yt(Cn),yt(fn),Vc(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(xa(r)?r.flags|=4:i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,ni!==null&&(xu(ni),ni=null))),hu(i,r),mn(r),null;case 5:Kc(r);var g=Es(ao.current);if(l=r.type,i!==null&&r.stateNode!=null)xm(i,r,l,d,g),i.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!d){if(r.stateNode===null)throw Error(n(166));return mn(r),null}if(i=Es(di.current),xa(r)){d=r.stateNode,l=r.type;var _=r.memoizedProps;switch(d[ui]=r,d[no]=_,i=(r.mode&1)!==0,l){case"dialog":_t("cancel",d),_t("close",d);break;case"iframe":case"object":case"embed":_t("load",d);break;case"video":case"audio":for(g=0;g<Zr.length;g++)_t(Zr[g],d);break;case"source":_t("error",d);break;case"img":case"image":case"link":_t("error",d),_t("load",d);break;case"details":_t("toggle",d);break;case"input":Xe(d,_),_t("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!_.multiple},_t("invalid",d);break;case"textarea":le(d,_),_t("invalid",d)}je(l,_),g=null;for(var j in _)if(_.hasOwnProperty(j)){var K=_[j];j==="children"?typeof K=="string"?d.textContent!==K&&(_.suppressHydrationWarning!==!0&&ma(d.textContent,K,i),g=["children",K]):typeof K=="number"&&d.textContent!==""+K&&(_.suppressHydrationWarning!==!0&&ma(d.textContent,K,i),g=["children",""+K]):o.hasOwnProperty(j)&&K!=null&&j==="onScroll"&&_t("scroll",d)}switch(l){case"input":Ze(d),rt(d,_,!0);break;case"textarea":Ze(d),ze(d);break;case"select":case"option":break;default:typeof _.onClick=="function"&&(d.onclick=ga)}d=g,r.updateQueue=d,d!==null&&(r.flags|=4)}else{j=g.nodeType===9?g:g.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ie(l)),i==="http://www.w3.org/1999/xhtml"?l==="script"?(i=j.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof d.is=="string"?i=j.createElement(l,{is:d.is}):(i=j.createElement(l),l==="select"&&(j=i,d.multiple?j.multiple=!0:d.size&&(j.size=d.size))):i=j.createElementNS(i,l),i[ui]=r,i[no]=d,bm(i,r,!1,!1),r.stateNode=i;e:{switch(j=st(l,d),l){case"dialog":_t("cancel",i),_t("close",i),g=d;break;case"iframe":case"object":case"embed":_t("load",i),g=d;break;case"video":case"audio":for(g=0;g<Zr.length;g++)_t(Zr[g],i);g=d;break;case"source":_t("error",i),g=d;break;case"img":case"image":case"link":_t("error",i),_t("load",i),g=d;break;case"details":_t("toggle",i),g=d;break;case"input":Xe(i,d),g=vt(i,d),_t("invalid",i);break;case"option":g=d;break;case"select":i._wrapperState={wasMultiple:!!d.multiple},g=B({},d,{value:void 0}),_t("invalid",i);break;case"textarea":le(i,d),g=dt(i,d),_t("invalid",i);break;default:g=d}je(l,g),K=g;for(_ in K)if(K.hasOwnProperty(_)){var Q=K[_];_==="style"?Re(i,Q):_==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&ie(i,Q)):_==="children"?typeof Q=="string"?(l!=="textarea"||Q!=="")&&W(i,Q):typeof Q=="number"&&W(i,""+Q):_!=="suppressContentEditableWarning"&&_!=="suppressHydrationWarning"&&_!=="autoFocus"&&(o.hasOwnProperty(_)?Q!=null&&_==="onScroll"&&_t("scroll",i):Q!=null&&$(i,_,Q,j))}switch(l){case"input":Ze(i),rt(i,d,!1);break;case"textarea":Ze(i),ze(i);break;case"option":d.value!=null&&i.setAttribute("value",""+ee(d.value));break;case"select":i.multiple=!!d.multiple,_=d.value,_!=null?ut(i,!!d.multiple,_,!1):d.defaultValue!=null&&ut(i,!!d.multiple,d.defaultValue,!0);break;default:typeof g.onClick=="function"&&(i.onclick=ga)}switch(l){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}}d&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return mn(r),null;case 6:if(i&&r.stateNode!=null)km(i,r,i.memoizedProps,d);else{if(typeof d!="string"&&r.stateNode===null)throw Error(n(166));if(l=Es(ao.current),Es(di.current),xa(r)){if(d=r.stateNode,l=r.memoizedProps,d[ui]=r,(_=d.nodeValue!==l)&&(i=Dn,i!==null))switch(i.tag){case 3:ma(d.nodeValue,l,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&ma(d.nodeValue,l,(i.mode&1)!==0)}_&&(r.flags|=4)}else d=(l.nodeType===9?l:l.ownerDocument).createTextNode(d),d[ui]=r,r.stateNode=d}return mn(r),null;case 13:if(yt(jt),d=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(kt&&Mn!==null&&(r.mode&1)!==0&&(r.flags&128)===0)Np(),ar(),r.flags|=98560,_=!1;else if(_=xa(r),d!==null&&d.dehydrated!==null){if(i===null){if(!_)throw Error(n(318));if(_=r.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(n(317));_[ui]=r}else ar(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mn(r),_=!1}else ni!==null&&(xu(ni),ni=null),_=!0;if(!_)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=l,r):(d=d!==null,d!==(i!==null&&i.memoizedState!==null)&&d&&(r.child.flags|=8192,(r.mode&1)!==0&&(i===null||(jt.current&1)!==0?Ut===0&&(Ut=3):Eu())),r.updateQueue!==null&&(r.flags|=4),mn(r),null);case 4:return dr(),hu(i,r),i===null&&eo(r.stateNode.containerInfo),mn(r),null;case 10:return Fc(r.type._context),mn(r),null;case 17:return En(r.type)&&_a(),mn(r),null;case 19:if(yt(jt),_=r.memoizedState,_===null)return mn(r),null;if(d=(r.flags&128)!==0,j=_.rendering,j===null)if(d)fo(_,!1);else{if(Ut!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(j=ja(i),j!==null){for(r.flags|=128,fo(_,!1),d=j.updateQueue,d!==null&&(r.updateQueue=d,r.flags|=4),r.subtreeFlags=0,d=l,l=r.child;l!==null;)_=l,i=d,_.flags&=14680066,j=_.alternate,j===null?(_.childLanes=0,_.lanes=i,_.child=null,_.subtreeFlags=0,_.memoizedProps=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null,_.stateNode=null):(_.childLanes=j.childLanes,_.lanes=j.lanes,_.child=j.child,_.subtreeFlags=0,_.deletions=null,_.memoizedProps=j.memoizedProps,_.memoizedState=j.memoizedState,_.updateQueue=j.updateQueue,_.type=j.type,i=j.dependencies,_.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),l=l.sibling;return mt(jt,jt.current&1|2),r.child}i=i.sibling}_.tail!==null&&Bt()>mr&&(r.flags|=128,d=!0,fo(_,!1),r.lanes=4194304)}else{if(!d)if(i=ja(j),i!==null){if(r.flags|=128,d=!0,l=i.updateQueue,l!==null&&(r.updateQueue=l,r.flags|=4),fo(_,!0),_.tail===null&&_.tailMode==="hidden"&&!j.alternate&&!kt)return mn(r),null}else 2*Bt()-_.renderingStartTime>mr&&l!==1073741824&&(r.flags|=128,d=!0,fo(_,!1),r.lanes=4194304);_.isBackwards?(j.sibling=r.child,r.child=j):(l=_.last,l!==null?l.sibling=j:r.child=j,_.last=j)}return _.tail!==null?(r=_.tail,_.rendering=r,_.tail=r.sibling,_.renderingStartTime=Bt(),r.sibling=null,l=jt.current,mt(jt,d?l&1|2:l&1),r):(mn(r),null);case 22:case 23:return Cu(),d=r.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(r.flags|=8192),d&&(r.mode&1)!==0?(An&1073741824)!==0&&(mn(r),r.subtreeFlags&6&&(r.flags|=8192)):mn(r),null;case 24:return null;case 25:return null}throw Error(n(156,r.tag))}function kb(i,r){switch(Mc(r),r.tag){case 1:return En(r.type)&&_a(),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return dr(),yt(Cn),yt(fn),Vc(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 5:return Kc(r),null;case 13:if(yt(jt),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(n(340));ar()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return yt(jt),null;case 4:return dr(),null;case 10:return Fc(r.type._context),null;case 22:case 23:return Cu(),null;case 24:return null;default:return null}}var Oa=!1,gn=!1,Cb=typeof WeakSet=="function"?WeakSet:Set,Te=null;function fr(i,r){var l=i.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(d){Dt(i,r,d)}else l.current=null}function fu(i,r,l){try{l()}catch(d){Dt(i,r,d)}}var Cm=!1;function Eb(i,r){if(Cc=sa,i=ip(),vc(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var g=d.anchorOffset,_=d.focusNode;d=d.focusOffset;try{l.nodeType,_.nodeType}catch{l=null;break e}var j=0,K=-1,Q=-1,ce=0,ye=0,be=i,_e=null;t:for(;;){for(var Le;be!==l||g!==0&&be.nodeType!==3||(K=j+g),be!==_||d!==0&&be.nodeType!==3||(Q=j+d),be.nodeType===3&&(j+=be.nodeValue.length),(Le=be.firstChild)!==null;)_e=be,be=Le;for(;;){if(be===i)break t;if(_e===l&&++ce===g&&(K=j),_e===_&&++ye===d&&(Q=j),(Le=be.nextSibling)!==null)break;be=_e,_e=be.parentNode}be=Le}l=K===-1||Q===-1?null:{start:K,end:Q}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ec={focusedElem:i,selectionRange:l},sa=!1,Te=r;Te!==null;)if(r=Te,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Te=i;else for(;Te!==null;){r=Te;try{var De=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(De!==null){var Me=De.memoizedProps,Ot=De.memoizedState,re=r.stateNode,te=re.getSnapshotBeforeUpdate(r.elementType===r.type?Me:ii(r.type,Me),Ot);re.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var ae=r.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ce){Dt(r,r.return,Ce)}if(i=r.sibling,i!==null){i.return=r.return,Te=i;break}Te=r.return}return De=Cm,Cm=!1,De}function po(i,r,l){var d=r.updateQueue;if(d=d!==null?d.lastEffect:null,d!==null){var g=d=d.next;do{if((g.tag&i)===i){var _=g.destroy;g.destroy=void 0,_!==void 0&&fu(r,l,_)}g=g.next}while(g!==d)}}function za(i,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&i)===i){var d=l.create;l.destroy=d()}l=l.next}while(l!==r)}}function pu(i){var r=i.ref;if(r!==null){var l=i.stateNode;switch(i.tag){case 5:i=l;break;default:i=l}typeof r=="function"?r(i):r.current=i}}function Em(i){var r=i.alternate;r!==null&&(i.alternate=null,Em(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&(delete r[ui],delete r[no],delete r[Pc],delete r[lb],delete r[cb])),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 Nm(i){return i.tag===5||i.tag===3||i.tag===4}function Rm(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Nm(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 mu(i,r,l){var d=i.tag;if(d===5||d===6)i=i.stateNode,r?l.nodeType===8?l.parentNode.insertBefore(i,r):l.insertBefore(i,r):(l.nodeType===8?(r=l.parentNode,r.insertBefore(i,l)):(r=l,r.appendChild(i)),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=ga));else if(d!==4&&(i=i.child,i!==null))for(mu(i,r,l),i=i.sibling;i!==null;)mu(i,r,l),i=i.sibling}function gu(i,r,l){var d=i.tag;if(d===5||d===6)i=i.stateNode,r?l.insertBefore(i,r):l.appendChild(i);else if(d!==4&&(i=i.child,i!==null))for(gu(i,r,l),i=i.sibling;i!==null;)gu(i,r,l),i=i.sibling}var ln=null,si=!1;function Zi(i,r,l){for(l=l.child;l!==null;)jm(i,r,l),l=l.sibling}function jm(i,r,l){if(ci&&typeof ci.onCommitFiberUnmount=="function")try{ci.onCommitFiberUnmount(Qo,l)}catch{}switch(l.tag){case 5:gn||fr(l,r);case 6:var d=ln,g=si;ln=null,Zi(i,r,l),ln=d,si=g,ln!==null&&(si?(i=ln,l=l.stateNode,i.nodeType===8?i.parentNode.removeChild(l):i.removeChild(l)):ln.removeChild(l.stateNode));break;case 18:ln!==null&&(si?(i=ln,l=l.stateNode,i.nodeType===8?jc(i.parentNode,l):i.nodeType===1&&jc(i,l),Kr(i)):jc(ln,l.stateNode));break;case 4:d=ln,g=si,ln=l.stateNode.containerInfo,si=!0,Zi(i,r,l),ln=d,si=g;break;case 0:case 11:case 14:case 15:if(!gn&&(d=l.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){g=d=d.next;do{var _=g,j=_.destroy;_=_.tag,j!==void 0&&((_&2)!==0||(_&4)!==0)&&fu(l,r,j),g=g.next}while(g!==d)}Zi(i,r,l);break;case 1:if(!gn&&(fr(l,r),d=l.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=l.memoizedProps,d.state=l.memoizedState,d.componentWillUnmount()}catch(K){Dt(l,r,K)}Zi(i,r,l);break;case 21:Zi(i,r,l);break;case 22:l.mode&1?(gn=(d=gn)||l.memoizedState!==null,Zi(i,r,l),gn=d):Zi(i,r,l);break;default:Zi(i,r,l)}}function Pm(i){var r=i.updateQueue;if(r!==null){i.updateQueue=null;var l=i.stateNode;l===null&&(l=i.stateNode=new Cb),r.forEach(function(d){var g=Ab.bind(null,i,d);l.has(d)||(l.add(d),d.then(g,g))})}}function ri(i,r){var l=r.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d];try{var _=i,j=r,K=j;e:for(;K!==null;){switch(K.tag){case 5:ln=K.stateNode,si=!1;break e;case 3:ln=K.stateNode.containerInfo,si=!0;break e;case 4:ln=K.stateNode.containerInfo,si=!0;break e}K=K.return}if(ln===null)throw Error(n(160));jm(_,j,g),ln=null,si=!1;var Q=g.alternate;Q!==null&&(Q.return=null),g.return=null}catch(ce){Dt(g,r,ce)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)Lm(r,i),r=r.sibling}function Lm(i,r){var l=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(ri(r,i),fi(i),d&4){try{po(3,i,i.return),za(3,i)}catch(Me){Dt(i,i.return,Me)}try{po(5,i,i.return)}catch(Me){Dt(i,i.return,Me)}}break;case 1:ri(r,i),fi(i),d&512&&l!==null&&fr(l,l.return);break;case 5:if(ri(r,i),fi(i),d&512&&l!==null&&fr(l,l.return),i.flags&32){var g=i.stateNode;try{W(g,"")}catch(Me){Dt(i,i.return,Me)}}if(d&4&&(g=i.stateNode,g!=null)){var _=i.memoizedProps,j=l!==null?l.memoizedProps:_,K=i.type,Q=i.updateQueue;if(i.updateQueue=null,Q!==null)try{K==="input"&&_.type==="radio"&&_.name!=null&&St(g,_),st(K,j);var ce=st(K,_);for(j=0;j<Q.length;j+=2){var ye=Q[j],be=Q[j+1];ye==="style"?Re(g,be):ye==="dangerouslySetInnerHTML"?ie(g,be):ye==="children"?W(g,be):$(g,ye,be,ce)}switch(K){case"input":Et(g,_);break;case"textarea":xe(g,_);break;case"select":var _e=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!_.multiple;var Le=_.value;Le!=null?ut(g,!!_.multiple,Le,!1):_e!==!!_.multiple&&(_.defaultValue!=null?ut(g,!!_.multiple,_.defaultValue,!0):ut(g,!!_.multiple,_.multiple?[]:"",!1))}g[no]=_}catch(Me){Dt(i,i.return,Me)}}break;case 6:if(ri(r,i),fi(i),d&4){if(i.stateNode===null)throw Error(n(162));g=i.stateNode,_=i.memoizedProps;try{g.nodeValue=_}catch(Me){Dt(i,i.return,Me)}}break;case 3:if(ri(r,i),fi(i),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Kr(r.containerInfo)}catch(Me){Dt(i,i.return,Me)}break;case 4:ri(r,i),fi(i);break;case 13:ri(r,i),fi(i),g=i.child,g.flags&8192&&(_=g.memoizedState!==null,g.stateNode.isHidden=_,!_||g.alternate!==null&&g.alternate.memoizedState!==null||(yu=Bt())),d&4&&Pm(i);break;case 22:if(ye=l!==null&&l.memoizedState!==null,i.mode&1?(gn=(ce=gn)||ye,ri(r,i),gn=ce):ri(r,i),fi(i),d&8192){if(ce=i.memoizedState!==null,(i.stateNode.isHidden=ce)&&!ye&&(i.mode&1)!==0)for(Te=i,ye=i.child;ye!==null;){for(be=Te=ye;Te!==null;){switch(_e=Te,Le=_e.child,_e.tag){case 0:case 11:case 14:case 15:po(4,_e,_e.return);break;case 1:fr(_e,_e.return);var De=_e.stateNode;if(typeof De.componentWillUnmount=="function"){d=_e,l=_e.return;try{r=d,De.props=r.memoizedProps,De.state=r.memoizedState,De.componentWillUnmount()}catch(Me){Dt(d,l,Me)}}break;case 5:fr(_e,_e.return);break;case 22:if(_e.memoizedState!==null){Mm(be);continue}}Le!==null?(Le.return=_e,Te=Le):Mm(be)}ye=ye.sibling}e:for(ye=null,be=i;;){if(be.tag===5){if(ye===null){ye=be;try{g=be.stateNode,ce?(_=g.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none"):(K=be.stateNode,Q=be.memoizedProps.style,j=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,K.style.display=ke("display",j))}catch(Me){Dt(i,i.return,Me)}}}else if(be.tag===6){if(ye===null)try{be.stateNode.nodeValue=ce?"":be.memoizedProps}catch(Me){Dt(i,i.return,Me)}}else if((be.tag!==22&&be.tag!==23||be.memoizedState===null||be===i)&&be.child!==null){be.child.return=be,be=be.child;continue}if(be===i)break e;for(;be.sibling===null;){if(be.return===null||be.return===i)break e;ye===be&&(ye=null),be=be.return}ye===be&&(ye=null),be.sibling.return=be.return,be=be.sibling}}break;case 19:ri(r,i),fi(i),d&4&&Pm(i);break;case 21:break;default:ri(r,i),fi(i)}}function fi(i){var r=i.flags;if(r&2){try{e:{for(var l=i.return;l!==null;){if(Nm(l)){var d=l;break e}l=l.return}throw Error(n(160))}switch(d.tag){case 5:var g=d.stateNode;d.flags&32&&(W(g,""),d.flags&=-33);var _=Rm(i);gu(i,_,g);break;case 3:case 4:var j=d.stateNode.containerInfo,K=Rm(i);mu(i,K,j);break;default:throw Error(n(161))}}catch(Q){Dt(i,i.return,Q)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function Nb(i,r,l){Te=i,Tm(i)}function Tm(i,r,l){for(var d=(i.mode&1)!==0;Te!==null;){var g=Te,_=g.child;if(g.tag===22&&d){var j=g.memoizedState!==null||Oa;if(!j){var K=g.alternate,Q=K!==null&&K.memoizedState!==null||gn;K=Oa;var ce=gn;if(Oa=j,(gn=Q)&&!ce)for(Te=g;Te!==null;)j=Te,Q=j.child,j.tag===22&&j.memoizedState!==null?Am(g):Q!==null?(Q.return=j,Te=Q):Am(g);for(;_!==null;)Te=_,Tm(_),_=_.sibling;Te=g,Oa=K,gn=ce}Dm(i)}else(g.subtreeFlags&8772)!==0&&_!==null?(_.return=g,Te=_):Dm(i)}}function Dm(i){for(;Te!==null;){var r=Te;if((r.flags&8772)!==0){var l=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:gn||za(5,r);break;case 1:var d=r.stateNode;if(r.flags&4&&!gn)if(l===null)d.componentDidMount();else{var g=r.elementType===r.type?l.memoizedProps:ii(r.type,l.memoizedProps);d.componentDidUpdate(g,l.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var _=r.updateQueue;_!==null&&Mp(r,_,d);break;case 3:var j=r.updateQueue;if(j!==null){if(l=null,r.child!==null)switch(r.child.tag){case 5:l=r.child.stateNode;break;case 1:l=r.child.stateNode}Mp(r,j,l)}break;case 5:var K=r.stateNode;if(l===null&&r.flags&4){l=K;var Q=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&l.focus();break;case"img":Q.src&&(l.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var ce=r.alternate;if(ce!==null){var ye=ce.memoizedState;if(ye!==null){var be=ye.dehydrated;be!==null&&Kr(be)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}gn||r.flags&512&&pu(r)}catch(_e){Dt(r,r.return,_e)}}if(r===i){Te=null;break}if(l=r.sibling,l!==null){l.return=r.return,Te=l;break}Te=r.return}}function Mm(i){for(;Te!==null;){var r=Te;if(r===i){Te=null;break}var l=r.sibling;if(l!==null){l.return=r.return,Te=l;break}Te=r.return}}function Am(i){for(;Te!==null;){var r=Te;try{switch(r.tag){case 0:case 11:case 15:var l=r.return;try{za(4,r)}catch(Q){Dt(r,l,Q)}break;case 1:var d=r.stateNode;if(typeof d.componentDidMount=="function"){var g=r.return;try{d.componentDidMount()}catch(Q){Dt(r,g,Q)}}var _=r.return;try{pu(r)}catch(Q){Dt(r,_,Q)}break;case 5:var j=r.return;try{pu(r)}catch(Q){Dt(r,j,Q)}}}catch(Q){Dt(r,r.return,Q)}if(r===i){Te=null;break}var K=r.sibling;if(K!==null){K.return=r.return,Te=K;break}Te=r.return}}var Rb=Math.ceil,Fa=O.ReactCurrentDispatcher,vu=O.ReactCurrentOwner,Yn=O.ReactCurrentBatchConfig,at=0,Qt=null,Ft=null,cn=0,An=0,pr=Yi(0),Ut=0,mo=null,Rs=0,$a=0,_u=0,go=null,Rn=null,yu=0,mr=1/0,Li=null,Ha=!1,wu=null,es=null,Wa=!1,ts=null,Ua=0,vo=0,Su=null,Ka=-1,qa=0;function wn(){return(at&6)!==0?Bt():Ka!==-1?Ka:Ka=Bt()}function ns(i){return(i.mode&1)===0?1:(at&2)!==0&&cn!==0?cn&-cn:db.transition!==null?(qa===0&&(qa=Rf()),qa):(i=ht,i!==0||(i=window.event,i=i===void 0?16:Bf(i.type)),i)}function oi(i,r,l,d){if(50<vo)throw vo=0,Su=null,Error(n(185));Fr(i,l,d),((at&2)===0||i!==Qt)&&(i===Qt&&((at&2)===0&&($a|=l),Ut===4&&is(i,cn)),jn(i,d),l===1&&at===0&&(r.mode&1)===0&&(mr=Bt()+500,wa&&Xi()))}function jn(i,r){var l=i.callbackNode;dS(i,r);var d=ta(i,i===Qt?cn:0);if(d===0)l!==null&&Ys(l),i.callbackNode=null,i.callbackPriority=0;else if(r=d&-d,i.callbackPriority!==r){if(l!=null&&Ys(l),r===1)i.tag===0?ub(Bm.bind(null,i)):bp(Bm.bind(null,i)),ob(function(){(at&6)===0&&Xi()}),l=null;else{switch(jf(d)){case 1:l=ec;break;case 4:l=Ef;break;case 16:l=Jo;break;case 536870912:l=Nf;break;default:l=Jo}l=Km(l,Im.bind(null,i))}i.callbackPriority=r,i.callbackNode=l}}function Im(i,r){if(Ka=-1,qa=0,(at&6)!==0)throw Error(n(327));var l=i.callbackNode;if(gr()&&i.callbackNode!==l)return null;var d=ta(i,i===Qt?cn:0);if(d===0)return null;if((d&30)!==0||(d&i.expiredLanes)!==0||r)r=Va(i,d);else{r=d;var g=at;at|=2;var _=zm();(Qt!==i||cn!==r)&&(Li=null,mr=Bt()+500,Ps(i,r));do try{Lb();break}catch(K){Om(i,K)}while(!0);zc(),Fa.current=_,at=g,Ft!==null?r=0:(Qt=null,cn=0,r=Ut)}if(r!==0){if(r===2&&(g=tc(i),g!==0&&(d=g,r=bu(i,g))),r===1)throw l=mo,Ps(i,0),is(i,d),jn(i,Bt()),l;if(r===6)is(i,d);else{if(g=i.current.alternate,(d&30)===0&&!jb(g)&&(r=Va(i,d),r===2&&(_=tc(i),_!==0&&(d=_,r=bu(i,_))),r===1))throw l=mo,Ps(i,0),is(i,d),jn(i,Bt()),l;switch(i.finishedWork=g,i.finishedLanes=d,r){case 0:case 1:throw Error(n(345));case 2:Ls(i,Rn,Li);break;case 3:if(is(i,d),(d&130023424)===d&&(r=yu+500-Bt(),10<r)){if(ta(i,0)!==0)break;if(g=i.suspendedLanes,(g&d)!==d){wn(),i.pingedLanes|=i.suspendedLanes&g;break}i.timeoutHandle=Rc(Ls.bind(null,i,Rn,Li),r);break}Ls(i,Rn,Li);break;case 4:if(is(i,d),(d&4194240)===d)break;for(r=i.eventTimes,g=-1;0<d;){var j=31-ei(d);_=1<<j,j=r[j],j>g&&(g=j),d&=~_}if(d=g,d=Bt()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*Rb(d/1960))-d,10<d){i.timeoutHandle=Rc(Ls.bind(null,i,Rn,Li),d);break}Ls(i,Rn,Li);break;case 5:Ls(i,Rn,Li);break;default:throw Error(n(329))}}}return jn(i,Bt()),i.callbackNode===l?Im.bind(null,i):null}function bu(i,r){var l=go;return i.current.memoizedState.isDehydrated&&(Ps(i,r).flags|=256),i=Va(i,r),i!==2&&(r=Rn,Rn=l,r!==null&&xu(r)),i}function xu(i){Rn===null?Rn=i:Rn.push.apply(Rn,i)}function jb(i){for(var r=i;;){if(r.flags&16384){var l=r.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var d=0;d<l.length;d++){var g=l[d],_=g.getSnapshot;g=g.value;try{if(!ti(_(),g))return!1}catch{return!1}}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function is(i,r){for(r&=~_u,r&=~$a,i.suspendedLanes|=r,i.pingedLanes&=~r,i=i.expirationTimes;0<r;){var l=31-ei(r),d=1<<l;i[l]=-1,r&=~d}}function Bm(i){if((at&6)!==0)throw Error(n(327));gr();var r=ta(i,0);if((r&1)===0)return jn(i,Bt()),null;var l=Va(i,r);if(i.tag!==0&&l===2){var d=tc(i);d!==0&&(r=d,l=bu(i,d))}if(l===1)throw l=mo,Ps(i,0),is(i,r),jn(i,Bt()),l;if(l===6)throw Error(n(345));return i.finishedWork=i.current.alternate,i.finishedLanes=r,Ls(i,Rn,Li),jn(i,Bt()),null}function ku(i,r){var l=at;at|=1;try{return i(r)}finally{at=l,at===0&&(mr=Bt()+500,wa&&Xi())}}function js(i){ts!==null&&ts.tag===0&&(at&6)===0&&gr();var r=at;at|=1;var l=Yn.transition,d=ht;try{if(Yn.transition=null,ht=1,i)return i()}finally{ht=d,Yn.transition=l,at=r,(at&6)===0&&Xi()}}function Cu(){An=pr.current,yt(pr)}function Ps(i,r){i.finishedWork=null,i.finishedLanes=0;var l=i.timeoutHandle;if(l!==-1&&(i.timeoutHandle=-1,rb(l)),Ft!==null)for(l=Ft.return;l!==null;){var d=l;switch(Mc(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&_a();break;case 3:dr(),yt(Cn),yt(fn),Vc();break;case 5:Kc(d);break;case 4:dr();break;case 13:yt(jt);break;case 19:yt(jt);break;case 10:Fc(d.type._context);break;case 22:case 23:Cu()}l=l.return}if(Qt=i,Ft=i=ss(i.current,null),cn=An=r,Ut=0,mo=null,_u=$a=Rs=0,Rn=go=null,Cs!==null){for(r=0;r<Cs.length;r++)if(l=Cs[r],d=l.interleaved,d!==null){l.interleaved=null;var g=d.next,_=l.pending;if(_!==null){var j=_.next;_.next=g,d.next=j}l.pending=d}Cs=null}return i}function Om(i,r){do{var l=Ft;try{if(zc(),Pa.current=Ma,La){for(var d=Pt.memoizedState;d!==null;){var g=d.queue;g!==null&&(g.pending=null),d=d.next}La=!1}if(Ns=0,Jt=Wt=Pt=null,lo=!1,co=0,vu.current=null,l===null||l.return===null){Ut=1,mo=r,Ft=null;break}e:{var _=i,j=l.return,K=l,Q=r;if(r=cn,K.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ce=Q,ye=K,be=ye.tag;if((ye.mode&1)===0&&(be===0||be===11||be===15)){var _e=ye.alternate;_e?(ye.updateQueue=_e.updateQueue,ye.memoizedState=_e.memoizedState,ye.lanes=_e.lanes):(ye.updateQueue=null,ye.memoizedState=null)}var Le=cm(j);if(Le!==null){Le.flags&=-257,um(Le,j,K,_,r),Le.mode&1&&lm(_,ce,r),r=Le,Q=ce;var De=r.updateQueue;if(De===null){var Me=new Set;Me.add(Q),r.updateQueue=Me}else De.add(Q);break e}else{if((r&1)===0){lm(_,ce,r),Eu();break e}Q=Error(n(426))}}else if(kt&&K.mode&1){var Ot=cm(j);if(Ot!==null){(Ot.flags&65536)===0&&(Ot.flags|=256),um(Ot,j,K,_,r),Bc(hr(Q,K));break e}}_=Q=hr(Q,K),Ut!==4&&(Ut=2),go===null?go=[_]:go.push(_),_=j;do{switch(_.tag){case 3:_.flags|=65536,r&=-r,_.lanes|=r;var re=om(_,Q,r);Dp(_,re);break e;case 1:K=Q;var te=_.type,ae=_.stateNode;if((_.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(es===null||!es.has(ae)))){_.flags|=65536,r&=-r,_.lanes|=r;var Ce=am(_,K,r);Dp(_,Ce);break e}}_=_.return}while(_!==null)}$m(l)}catch(Be){r=Be,Ft===l&&l!==null&&(Ft=l=l.return);continue}break}while(!0)}function zm(){var i=Fa.current;return Fa.current=Ma,i===null?Ma:i}function Eu(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Qt===null||(Rs&268435455)===0&&($a&268435455)===0||is(Qt,cn)}function Va(i,r){var l=at;at|=2;var d=zm();(Qt!==i||cn!==r)&&(Li=null,Ps(i,r));do try{Pb();break}catch(g){Om(i,g)}while(!0);if(zc(),at=l,Fa.current=d,Ft!==null)throw Error(n(261));return Qt=null,cn=0,Ut}function Pb(){for(;Ft!==null;)Fm(Ft)}function Lb(){for(;Ft!==null&&!nS();)Fm(Ft)}function Fm(i){var r=Um(i.alternate,i,An);i.memoizedProps=i.pendingProps,r===null?$m(i):Ft=r,vu.current=null}function $m(i){var r=i;do{var l=r.alternate;if(i=r.return,(r.flags&32768)===0){if(l=xb(l,r,An),l!==null){Ft=l;return}}else{if(l=kb(l,r),l!==null){l.flags&=32767,Ft=l;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{Ut=6,Ft=null;return}}if(r=r.sibling,r!==null){Ft=r;return}Ft=r=i}while(r!==null);Ut===0&&(Ut=5)}function Ls(i,r,l){var d=ht,g=Yn.transition;try{Yn.transition=null,ht=1,Tb(i,r,l,d)}finally{Yn.transition=g,ht=d}return null}function Tb(i,r,l,d){do gr();while(ts!==null);if((at&6)!==0)throw Error(n(327));l=i.finishedWork;var g=i.finishedLanes;if(l===null)return null;if(i.finishedWork=null,i.finishedLanes=0,l===i.current)throw Error(n(177));i.callbackNode=null,i.callbackPriority=0;var _=l.lanes|l.childLanes;if(hS(i,_),i===Qt&&(Ft=Qt=null,cn=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Wa||(Wa=!0,Km(Jo,function(){return gr(),null})),_=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||_){_=Yn.transition,Yn.transition=null;var j=ht;ht=1;var K=at;at|=4,vu.current=null,Eb(i,l),Lm(l,i),QS(Ec),sa=!!Cc,Ec=Cc=null,i.current=l,Nb(l),iS(),at=K,ht=j,Yn.transition=_}else i.current=l;if(Wa&&(Wa=!1,ts=i,Ua=g),_=i.pendingLanes,_===0&&(es=null),oS(l.stateNode),jn(i,Bt()),r!==null)for(d=i.onRecoverableError,l=0;l<r.length;l++)g=r[l],d(g.value,{componentStack:g.stack,digest:g.digest});if(Ha)throw Ha=!1,i=wu,wu=null,i;return(Ua&1)!==0&&i.tag!==0&&gr(),_=i.pendingLanes,(_&1)!==0?i===Su?vo++:(vo=0,Su=i):vo=0,Xi(),null}function gr(){if(ts!==null){var i=jf(Ua),r=Yn.transition,l=ht;try{if(Yn.transition=null,ht=16>i?16:i,ts===null)var d=!1;else{if(i=ts,ts=null,Ua=0,(at&6)!==0)throw Error(n(331));var g=at;for(at|=4,Te=i.current;Te!==null;){var _=Te,j=_.child;if((Te.flags&16)!==0){var K=_.deletions;if(K!==null){for(var Q=0;Q<K.length;Q++){var ce=K[Q];for(Te=ce;Te!==null;){var ye=Te;switch(ye.tag){case 0:case 11:case 15:po(8,ye,_)}var be=ye.child;if(be!==null)be.return=ye,Te=be;else for(;Te!==null;){ye=Te;var _e=ye.sibling,Le=ye.return;if(Em(ye),ye===ce){Te=null;break}if(_e!==null){_e.return=Le,Te=_e;break}Te=Le}}}var De=_.alternate;if(De!==null){var Me=De.child;if(Me!==null){De.child=null;do{var Ot=Me.sibling;Me.sibling=null,Me=Ot}while(Me!==null)}}Te=_}}if((_.subtreeFlags&2064)!==0&&j!==null)j.return=_,Te=j;else e:for(;Te!==null;){if(_=Te,(_.flags&2048)!==0)switch(_.tag){case 0:case 11:case 15:po(9,_,_.return)}var re=_.sibling;if(re!==null){re.return=_.return,Te=re;break e}Te=_.return}}var te=i.current;for(Te=te;Te!==null;){j=Te;var ae=j.child;if((j.subtreeFlags&2064)!==0&&ae!==null)ae.return=j,Te=ae;else e:for(j=te;Te!==null;){if(K=Te,(K.flags&2048)!==0)try{switch(K.tag){case 0:case 11:case 15:za(9,K)}}catch(Be){Dt(K,K.return,Be)}if(K===j){Te=null;break e}var Ce=K.sibling;if(Ce!==null){Ce.return=K.return,Te=Ce;break e}Te=K.return}}if(at=g,Xi(),ci&&typeof ci.onPostCommitFiberRoot=="function")try{ci.onPostCommitFiberRoot(Qo,i)}catch{}d=!0}return d}finally{ht=l,Yn.transition=r}}return!1}function Hm(i,r,l){r=hr(l,r),r=om(i,r,1),i=Qi(i,r,1),r=wn(),i!==null&&(Fr(i,1,r),jn(i,r))}function Dt(i,r,l){if(i.tag===3)Hm(i,i,l);else for(;r!==null;){if(r.tag===3){Hm(r,i,l);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(es===null||!es.has(d))){i=hr(l,i),i=am(r,i,1),r=Qi(r,i,1),i=wn(),r!==null&&(Fr(r,1,i),jn(r,i));break}}r=r.return}}function Db(i,r,l){var d=i.pingCache;d!==null&&d.delete(r),r=wn(),i.pingedLanes|=i.suspendedLanes&l,Qt===i&&(cn&l)===l&&(Ut===4||Ut===3&&(cn&130023424)===cn&&500>Bt()-yu?Ps(i,0):_u|=l),jn(i,r)}function Wm(i,r){r===0&&((i.mode&1)===0?r=1:(r=ea,ea<<=1,(ea&130023424)===0&&(ea=4194304)));var l=wn();i=Ri(i,r),i!==null&&(Fr(i,r,l),jn(i,l))}function Mb(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),Wm(i,l)}function Ab(i,r){var l=0;switch(i.tag){case 13:var d=i.stateNode,g=i.memoizedState;g!==null&&(l=g.retryLane);break;case 19:d=i.stateNode;break;default:throw Error(n(314))}d!==null&&d.delete(r),Wm(i,l)}var Um;Um=function(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps||Cn.current)Nn=!0;else{if((i.lanes&l)===0&&(r.flags&128)===0)return Nn=!1,bb(i,r,l);Nn=(i.flags&131072)!==0}else Nn=!1,kt&&(r.flags&1048576)!==0&&xp(r,ba,r.index);switch(r.lanes=0,r.tag){case 2:var d=r.type;Ba(i,r),i=r.pendingProps;var g=sr(r,fn.current);ur(r,l),g=Xc(null,r,d,i,g,l);var _=Jc();return r.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,En(d)?(_=!0,ya(r)):_=!1,r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Wc(r),g.updater=Aa,r.stateNode=g,g._reactInternals=r,iu(r,d,i,l),r=au(null,r,d,!0,_,l)):(r.tag=0,kt&&_&&Dc(r),yn(null,r,g,l),r=r.child),r;case 16:d=r.elementType;e:{switch(Ba(i,r),i=r.pendingProps,g=d._init,d=g(d._payload),r.type=d,g=r.tag=Bb(d),i=ii(d,i),g){case 0:r=ou(null,r,d,i,l);break e;case 1:r=gm(null,r,d,i,l);break e;case 11:r=dm(null,r,d,i,l);break e;case 14:r=hm(null,r,d,ii(d.type,i),l);break e}throw Error(n(306,d,""))}return r;case 0:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),ou(i,r,d,g,l);case 1:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),gm(i,r,d,g,l);case 3:e:{if(vm(r),i===null)throw Error(n(387));d=r.pendingProps,_=r.memoizedState,g=_.element,Tp(i,r),Ra(r,d,null,l);var j=r.memoizedState;if(d=j.element,_.isDehydrated)if(_={element:d,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},r.updateQueue.baseState=_,r.memoizedState=_,r.flags&256){g=hr(Error(n(423)),r),r=_m(i,r,d,l,g);break e}else if(d!==g){g=hr(Error(n(424)),r),r=_m(i,r,d,l,g);break e}else for(Mn=Vi(r.stateNode.containerInfo.firstChild),Dn=r,kt=!0,ni=null,l=Pp(r,null,d,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(ar(),d===g){r=Pi(i,r,l);break e}yn(i,r,d,l)}r=r.child}return r;case 5:return Ap(r),i===null&&Ic(r),d=r.type,g=r.pendingProps,_=i!==null?i.memoizedProps:null,j=g.children,Nc(d,g)?j=null:_!==null&&Nc(d,_)&&(r.flags|=32),mm(i,r),yn(i,r,j,l),r.child;case 6:return i===null&&Ic(r),null;case 13:return ym(i,r,l);case 4:return Uc(r,r.stateNode.containerInfo),d=r.pendingProps,i===null?r.child=lr(r,null,d,l):yn(i,r,d,l),r.child;case 11:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),dm(i,r,d,g,l);case 7:return yn(i,r,r.pendingProps,l),r.child;case 8:return yn(i,r,r.pendingProps.children,l),r.child;case 12:return yn(i,r,r.pendingProps.children,l),r.child;case 10:e:{if(d=r.type._context,g=r.pendingProps,_=r.memoizedProps,j=g.value,mt(Ca,d._currentValue),d._currentValue=j,_!==null)if(ti(_.value,j)){if(_.children===g.children&&!Cn.current){r=Pi(i,r,l);break e}}else for(_=r.child,_!==null&&(_.return=r);_!==null;){var K=_.dependencies;if(K!==null){j=_.child;for(var Q=K.firstContext;Q!==null;){if(Q.context===d){if(_.tag===1){Q=ji(-1,l&-l),Q.tag=2;var ce=_.updateQueue;if(ce!==null){ce=ce.shared;var ye=ce.pending;ye===null?Q.next=Q:(Q.next=ye.next,ye.next=Q),ce.pending=Q}}_.lanes|=l,Q=_.alternate,Q!==null&&(Q.lanes|=l),$c(_.return,l,r),K.lanes|=l;break}Q=Q.next}}else if(_.tag===10)j=_.type===r.type?null:_.child;else if(_.tag===18){if(j=_.return,j===null)throw Error(n(341));j.lanes|=l,K=j.alternate,K!==null&&(K.lanes|=l),$c(j,l,r),j=_.sibling}else j=_.child;if(j!==null)j.return=_;else for(j=_;j!==null;){if(j===r){j=null;break}if(_=j.sibling,_!==null){_.return=j.return,j=_;break}j=j.return}_=j}yn(i,r,g.children,l),r=r.child}return r;case 9:return g=r.type,d=r.pendingProps.children,ur(r,l),g=qn(g),d=d(g),r.flags|=1,yn(i,r,d,l),r.child;case 14:return d=r.type,g=ii(d,r.pendingProps),g=ii(d.type,g),hm(i,r,d,g,l);case 15:return fm(i,r,r.type,r.pendingProps,l);case 17:return d=r.type,g=r.pendingProps,g=r.elementType===d?g:ii(d,g),Ba(i,r),r.tag=1,En(d)?(i=!0,ya(r)):i=!1,ur(r,l),sm(r,d,g),iu(r,d,g,l),au(null,r,d,!0,i,l);case 19:return Sm(i,r,l);case 22:return pm(i,r,l)}throw Error(n(156,r.tag))};function Km(i,r){return Fi(i,r)}function Ib(i,r,l,d){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(i,r,l,d){return new Ib(i,r,l,d)}function Nu(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Bb(i){if(typeof i=="function")return Nu(i)?1:0;if(i!=null){if(i=i.$$typeof,i===A)return 11;if(i===L)return 14}return 2}function ss(i,r){var l=i.alternate;return l===null?(l=Gn(i.tag,r,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=r,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&14680064,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,r=i.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l}function Ya(i,r,l,d,g,_){var j=2;if(d=i,typeof i=="function")Nu(i)&&(j=1);else if(typeof i=="string")j=5;else e:switch(i){case z:return Ts(l.children,g,_,r);case ne:j=8,g|=8;break;case H:return i=Gn(12,l,r,g|2),i.elementType=H,i.lanes=_,i;case N:return i=Gn(13,l,r,g),i.elementType=N,i.lanes=_,i;case M:return i=Gn(19,l,r,g),i.elementType=M,i.lanes=_,i;case F:return Ga(l,g,_,r);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case X:j=10;break e;case I:j=9;break e;case A:j=11;break e;case L:j=14;break e;case P:j=16,d=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return r=Gn(j,l,r,g),r.elementType=i,r.type=d,r.lanes=_,r}function Ts(i,r,l,d){return i=Gn(7,i,d,r),i.lanes=l,i}function Ga(i,r,l,d){return i=Gn(22,i,d,r),i.elementType=F,i.lanes=l,i.stateNode={isHidden:!1},i}function Ru(i,r,l){return i=Gn(6,i,null,r),i.lanes=l,i}function ju(i,r,l){return r=Gn(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}function Ob(i,r,l,d,g){this.tag=r,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=nc(0),this.expirationTimes=nc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nc(0),this.identifierPrefix=d,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Pu(i,r,l,d,g,_,j,K,Q){return i=new Ob(i,r,l,K,Q),r===1?(r=1,_===!0&&(r|=8)):r=0,_=Gn(3,null,null,r),i.current=_,_.stateNode=i,_.memoizedState={element:d,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wc(_),i}function zb(i,r,l){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Y,key:d==null?null:""+d,children:i,containerInfo:r,implementation:l}}function qm(i){if(!i)return Gi;i=i._reactInternals;e:{if(Fe(i)!==i||i.tag!==1)throw Error(n(170));var r=i;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(En(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(n(171))}if(i.tag===1){var l=i.type;if(En(l))return wp(i,l,r)}return r}function Vm(i,r,l,d,g,_,j,K,Q){return i=Pu(l,d,!0,i,g,_,j,K,Q),i.context=qm(null),l=i.current,d=wn(),g=ns(l),_=ji(d,g),_.callback=r??null,Qi(l,_,g),i.current.lanes=g,Fr(i,g,d),jn(i,d),i}function Xa(i,r,l,d){var g=r.current,_=wn(),j=ns(g);return l=qm(l),r.context===null?r.context=l:r.pendingContext=l,r=ji(_,j),r.payload={element:i},d=d===void 0?null:d,d!==null&&(r.callback=d),i=Qi(g,r,j),i!==null&&(oi(i,g,j,_),Na(i,g,j)),j}function Ja(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 Ym(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Lu(i,r){Ym(i,r),(i=i.alternate)&&Ym(i,r)}function Fb(){return null}var Gm=typeof reportError=="function"?reportError:function(i){console.error(i)};function Tu(i){this._internalRoot=i}Qa.prototype.render=Tu.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(n(409));Xa(i,r,null,null)},Qa.prototype.unmount=Tu.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;js(function(){Xa(null,i,null,null)}),r[ki]=null}};function Qa(i){this._internalRoot=i}Qa.prototype.unstable_scheduleHydration=function(i){if(i){var r=Tf();i={blockedOn:null,target:i,priority:r};for(var l=0;l<Ui.length&&r!==0&&r<Ui[l].priority;l++);Ui.splice(l,0,i),l===0&&Af(i)}};function Du(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Za(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Xm(){}function $b(i,r,l,d,g){if(g){if(typeof d=="function"){var _=d;d=function(){var ce=Ja(j);_.call(ce)}}var j=Vm(r,d,i,0,null,!1,!1,"",Xm);return i._reactRootContainer=j,i[ki]=j.current,eo(i.nodeType===8?i.parentNode:i),js(),j}for(;g=i.lastChild;)i.removeChild(g);if(typeof d=="function"){var K=d;d=function(){var ce=Ja(Q);K.call(ce)}}var Q=Pu(i,0,!1,null,null,!1,!1,"",Xm);return i._reactRootContainer=Q,i[ki]=Q.current,eo(i.nodeType===8?i.parentNode:i),js(function(){Xa(r,Q,l,d)}),Q}function el(i,r,l,d,g){var _=l._reactRootContainer;if(_){var j=_;if(typeof g=="function"){var K=g;g=function(){var Q=Ja(j);K.call(Q)}}Xa(r,j,i,g)}else j=$b(l,r,i,g,d);return Ja(j)}Pf=function(i){switch(i.tag){case 3:var r=i.stateNode;if(r.current.memoizedState.isDehydrated){var l=zr(r.pendingLanes);l!==0&&(ic(r,l|1),jn(r,Bt()),(at&6)===0&&(mr=Bt()+500,Xi()))}break;case 13:js(function(){var d=Ri(i,1);if(d!==null){var g=wn();oi(d,i,1,g)}}),Lu(i,1)}},sc=function(i){if(i.tag===13){var r=Ri(i,134217728);if(r!==null){var l=wn();oi(r,i,134217728,l)}Lu(i,134217728)}},Lf=function(i){if(i.tag===13){var r=ns(i),l=Ri(i,r);if(l!==null){var d=wn();oi(l,i,r,d)}Lu(i,r)}},Tf=function(){return ht},Df=function(i,r){var l=ht;try{return ht=i,r()}finally{ht=l}},_n=function(i,r,l){switch(r){case"input":if(Et(i,l),r=l.name,l.type==="radio"&&r!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<l.length;r++){var d=l[r];if(d!==i&&d.form===i.form){var g=va(d);if(!g)throw Error(n(90));$e(d),Et(d,g)}}}break;case"textarea":xe(i,l);break;case"select":r=l.value,r!=null&&ut(i,!!l.multiple,r,!1)}},he=ku,Ne=js;var Hb={usingClientEntryPoint:!1,Events:[io,nr,va,Hn,li,ku]},_o={findFiberByHostInstance:Ss,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Wb={bundleType:_o.bundleType,version:_o.version,rendererPackageName:_o.rendererPackageName,rendererConfig:_o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:O.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Rt(i),i===null?null:i.stateNode},findFiberByHostInstance:_o.findFiberByHostInstance||Fb,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 tl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tl.isDisabled&&tl.supportsFiber)try{Qo=tl.inject(Wb),ci=tl}catch{}}return Pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hb,Pn.createPortal=function(i,r){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Du(r))throw Error(n(200));return zb(i,r,null,l)},Pn.createRoot=function(i,r){if(!Du(i))throw Error(n(299));var l=!1,d="",g=Gm;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onRecoverableError!==void 0&&(g=r.onRecoverableError)),r=Pu(i,1,!1,null,null,l,!1,d,g),i[ki]=r.current,eo(i.nodeType===8?i.parentNode:i),new Tu(r)},Pn.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=Rt(r),i=i===null?null:i.stateNode,i},Pn.flushSync=function(i){return js(i)},Pn.hydrate=function(i,r,l){if(!Za(r))throw Error(n(200));return el(null,i,r,!0,l)},Pn.hydrateRoot=function(i,r,l){if(!Du(i))throw Error(n(405));var d=l!=null&&l.hydratedSources||null,g=!1,_="",j=Gm;if(l!=null&&(l.unstable_strictMode===!0&&(g=!0),l.identifierPrefix!==void 0&&(_=l.identifierPrefix),l.onRecoverableError!==void 0&&(j=l.onRecoverableError)),r=Vm(r,null,i,1,l??null,g,!1,_,j),i[ki]=r.current,eo(i),d)for(i=0;i<d.length;i++)l=d[i],g=l._getVersion,g=g(l._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[l,g]:r.mutableSourceEagerHydrationData.push(l,g);return new Qa(r)},Pn.render=function(i,r,l){if(!Za(r))throw Error(n(200));return el(null,i,r,!1,l)},Pn.unmountComponentAtNode=function(i){if(!Za(i))throw Error(n(40));return i._reactRootContainer?(js(function(){el(null,null,i,!1,function(){i._reactRootContainer=null,i[ki]=null})}),!0):!1},Pn.unstable_batchedUpdates=ku,Pn.unstable_renderSubtreeIntoContainer=function(i,r,l,d){if(!Za(l))throw Error(n(200));if(i==null||i._reactInternals===void 0)throw Error(n(38));return el(i,r,l,!1,d)},Pn.version="18.3.1-next-f1338f8080-20240426",Pn}var sg;function Qb(){if(sg)return Iu.exports;sg=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(),Iu.exports=Jb(),Iu.exports}var rg;function Zb(){if(rg)return nl;rg=1;var e=Qb();return nl.createRoot=e.createRoot,nl.hydrateRoot=e.hydrateRoot,nl}var e0=Zb();const t0=Dh(e0);function Vt(e,t,n={}){return fetch(e,{...n,headers:{...n.headers||{},Authorization:`Bearer ${t}`}})}const B_=e=>`nc_seen_${e}`;async function Ae(e,t,n={}){const s=await Vt(e,t,{method:n.method||"GET",headers:{"content-type":"application/json"},body:n.body?JSON.stringify(n.body):void 0}),o=await s.json().catch(()=>({}));if(!s.ok){const a=new Error(o.error||`HTTP ${s.status}`);throw a.status=s.status,a.data=o,a}return o}const bn=e=>Array.isArray(e)&&e.length?`/api/route/${e.map(encodeURIComponent).join("/")}/_`:"/api",rn=(e,t)=>`${bn(e)}/fleet/${t}`,_s=(e,t)=>Ae(rn(t,"status"),e),Ah=(e,t,n)=>Ae(rn(n,"up"),e,{method:"POST",body:t}),Cl=(e,t,n)=>Ae(rn(n,"down"),e,{method:"POST",body:t}),O_=(e,t,n)=>Ae(rn(n,"boot"),e,{method:"POST",body:t}),jo=(e,t,n)=>Ae(rn(n,"restart"),e,{method:"POST",body:{cell:t}}),Ih=(e,t)=>Ae(rn(t,"definitions"),e),n0=(e,t)=>Ae(rn(t,"credentials/status"),e),og=(e,t,n,s)=>Ae(rn(s,"credentials/set"),e,{method:"POST",body:{envKey:t,value:n}}),i0=(e,t,n)=>Ae(rn(n,"credentials/remove"),e,{method:"POST",body:{envKey:t}}),s0=(e,t,n)=>Ae(rn(n,"define-engine"),e,{method:"POST",body:{def:t}}),r0=(e,t,n,s,o)=>Ae(rn(o,"edit-engine"),e,{method:"POST",body:{id:t,patch:n,envChanges:s}}),o0=(e,t,n)=>Ae(rn(n,"remove-engine"),e,{method:"POST",body:{id:t}}),a0=(e,t,n)=>Ae(rn(n,"define-cell"),e,{method:"POST",body:{def:t}}),z_=(e,t,n,s)=>Ae(rn(s,"edit-cell"),e,{method:"POST",body:{id:t,patch:n}}),F_=(e,t,n=!1,s)=>Ae(rn(s,"remove-cell"),e,{method:"POST",body:{id:t,stop:n}}),l0=(e,t,n)=>Ae(rn(n,"import-cell"),e,{method:"POST",body:t}),c0=(e,t,n)=>Ae(rn(n,"restore-cells"),e,{method:"POST",body:{cells:t}}),u0=(e,t,n,s)=>Ae(rn(s,"restore-engines"),e,{method:"POST",body:{engines:t,overwrite:!!n}}),Bh=(e,t,n)=>Ae(`${bn(n)}/sessions/${encodeURIComponent(t)}`,e,{method:"DELETE"}),$_=(e,t,n,s)=>Ae(`${bn(s)}/sessions/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{technical:!!n}}),Oh=(e,t,n)=>Ae(`${bn(n)}/fs/dirs${t?`?path=${encodeURIComponent(t)}`:""}`,e),H_=e=>Ae("/api/settings",e),d0=e=>Ae("/api/nodes",e),h0=e=>Ae("/api/peers",e),f0=e=>Ae("/api/topology",e),zh=(e,t)=>Ae(`${bn(t)}/sessions`,e),Fh=(e,t)=>Ae(`${bn(t)}/config`,e),ag=(e,t)=>Ae(`${bn(t)}/topology`,e),Ld=(e,t)=>Ae("/api/settings/config",e,{method:"POST",body:t}),p0=e=>Ae("/api/settings/token/rotate",e,{method:"POST"}),m0=(e,t)=>Ae("/api/settings/nodes/pair",e,{method:"POST",body:t}),lg=(e,t,n=[])=>Ae(`${bn(n)}/settings/peering/invite`,e,{method:"POST",body:t||{}}),W_=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/label`,e,{method:"PATCH",body:{label:n}}),g0=e=>Ae("/api/settings/node-aliases",e),v0=(e,t,n)=>Ae(`/api/settings/node-aliases/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{alias:n}}),cg=(e,t)=>Ae(`/api/settings/node-aliases/${encodeURIComponent(t)}`,e,{method:"DELETE"}),_0=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"PATCH",body:n}),y0=(e,t)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}`,e,{method:"DELETE"}),$h=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/${n}`,e,{method:"POST"}),w0=(e,t,n)=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/share`,e,{method:"PATCH",body:{shared:n}}),ug=(e,t,n,s=[])=>Ae(`/api/settings/nodes/${encodeURIComponent(t)}/visibility`,e,{method:"PATCH",body:{visibility:n,selected:s}}),S0=e=>Ae("/api/settings/audio",e),b0=(e,t)=>Ae("/api/settings/audio/consent",e,{method:"PATCH",body:{consent:t}}),x0=e=>Ae("/api/settings/audio/test",e,{method:"POST",body:{}}),k0=e=>Ae("/api/settings/audio/stop",e,{method:"POST",body:{}}),C0=e=>Ae("/api/settings/audio/groups",e),E0=(e,t,n)=>Ae(`/api/settings/audio/groups/${encodeURIComponent(t)}`,e,{method:"PUT",body:n}),N0=(e,t)=>Ae(`/api/settings/audio/groups/${encodeURIComponent(t)}`,e,{method:"DELETE"}),R0=e=>Ae("/api/settings/service/regenerate",e,{method:"POST"}),j0=e=>Ae("/api/settings/update/check",e,{method:"POST"}),P0=e=>Ae("/api/settings/update/apply",e,{method:"POST"}),Hl=(e,t)=>`${bn(e)}/diagnostics/${t}`,L0=(e,t=[])=>Ae(Hl(t,"status"),e),T0=(e,{after:t=0,limit:n=200}={},s=[])=>Ae(`${Hl(s,"logs")}?after=${encodeURIComponent(t)}&limit=${encodeURIComponent(n)}`,e),dg=(e,t,n,s=[])=>Ae(Hl(s,"verbose"),e,{method:"PATCH",body:{enabled:t,durationSeconds:n}}),D0=(e,t=[])=>Ae(Hl(t,"logs"),e,{method:"DELETE"}),M0=(e,t=!0)=>Ae(`/api/asks${t?"?open=1":""}`,e),A0=(e,t,n)=>Ae(`/api/asks/${encodeURIComponent(t)}/answer`,e,{method:"POST",body:{text:n}}),il=(e,t=[])=>Ae(`${bn(t)}/decks`,e),hg=(e,t,n=[])=>Ae(`${bn(n)}/decks`,e,{method:"POST",body:{name:t}}),sl=(e,t,n,s,o=[])=>Ae(`${bn(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PUT",body:{layout:n,expectedRevision:s}}),I0=(e,t,n,s,o=[])=>Ae(`${bn(o)}/decks/${encodeURIComponent(t)}`,e,{method:"PATCH",body:{name:n,expectedRevision:s}}),B0=(e,t,n,s=[])=>Ae(`${bn(s)}/decks/${encodeURIComponent(t)}`,e,{method:"DELETE",body:{expectedRevision:n}}),O0={power:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 3v8"}),c.jsx("path",{d:"M6.6 6.6a8 8 0 1 0 10.8 0"})]}),folder:c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"6",width:"18",height:"12",rx:"2"}),c.jsx("path",{d:"M7 10h.01M11 10h.01M15 10h.01M17 14h.01M7 14h7"})]}),mic:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),c.jsx("path",{d:"M5 11a7 7 0 0 0 14 0"}),c.jsx("path",{d:"M12 18v3"})]}),enter:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M20 5v6a2 2 0 0 1-2 2H5"}),c.jsx("polyline",{points:"9 9 5 13 9 17"})]}),send:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M22 2 15 22 11 13 2 9Z"}),c.jsx("path",{d:"M22 2 11 13"})]}),trash:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 7h16"}),c.jsx("path",{d:"M9 7V5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"}),c.jsx("path",{d:"M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12"}),c.jsx("path",{d:"M10 11v6M14 11v6"})]}),x:c.jsx("path",{d:"M6 6l12 12M18 6 6 18"}),refresh:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36L21 8"}),c.jsx("polyline",{points:"21 3 21 8 16 8"})]}),boot:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"4",width:"18",height:"13",rx:"2"}),c.jsx("path",{d:"M8 21h8M12 17v4M12 12V7"}),c.jsx("polyline",{points:"9 10 12 7 15 10"})]}),upload:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 16V5"}),c.jsx("polyline",{points:"8 9 12 5 16 9"}),c.jsx("path",{d:"M5 20h14"})]}),chevronLeft:c.jsx("polyline",{points:"14 6 8 12 14 18"}),chevronUp:c.jsx("polyline",{points:"6 14 12 8 18 14"}),chevronDown:c.jsx("polyline",{points:"6 10 12 16 18 10"}),history:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),c.jsx("polyline",{points:"3 3 3 8 8 8"}),c.jsx("path",{d:"M12 7v5l3 2"})]}),attach:c.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:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),c.jsx("polyline",{points:"14 2 14 8 20 8"})]}),camera:c.jsxs(c.Fragment,{children:[c.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"}),c.jsx("circle",{cx:"12",cy:"13",r:"3.5"})]}),image:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),c.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),c.jsx("path",{d:"M21 15l-5-5L5 21"})]}),zoomIn:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.35-4.35"}),c.jsx("path",{d:"M8 11h6M11 8v6"})]}),zoomOut:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"11",cy:"11",r:"7"}),c.jsx("path",{d:"M21 21l-4.35-4.35"}),c.jsx("path",{d:"M8 11h6"})]}),gear:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"12",cy:"12",r:"3"}),c.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:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})};function it({name:e,size:t=20}){return c.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:O0[e]||null})}const z0=["all","pinned","active","off","technical"],U_="nc_sidebar_views_v1",K_="nc_sidebar_order_v1";function q_(e){return z0.includes(e)?e:"all"}function F0(e,t=[],n="all"){const s=q_(n);return s==="technical"?e.technical===!0:e.technical===!0?!1:s==="pinned"?t.includes(e.key):s==="active"?!!e.live:s==="off"?!e.live:!0}function $0(e,t,n=[],s=[]){const o=n.indexOf(e.key),a=n.indexOf(t.key),u=o===-1?Number.MAX_SAFE_INTEGER:o,h=a===-1?Number.MAX_SAFE_INTEGER:a,f=s.indexOf(e.key),p=s.indexOf(t.key),v=f===-1?Number.MAX_SAFE_INTEGER:f,b=p===-1?Number.MAX_SAFE_INTEGER:p;return u-h||v-b||+!!t.live-+!!e.live||+!!t.fresh-+!!e.fresh||Number(t.activity||0)-Number(e.activity||0)||String(e.label||"").localeCompare(String(t.label||""))||String(e.key||"").localeCompare(String(t.key||""))}function H0(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(K_));if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[s,o]of Object.entries(t).slice(0,64)){if(typeof s!="string"||!s||s.length>160||!Array.isArray(o))continue;const a=[...new Set(o.filter(u=>typeof u=="string"&&u&&u.length<=256))].slice(0,128);a.length&&(n[s]=a)}return n}catch{return{}}}function Ai(e,t){return Array.isArray(e==null?void 0:e[t])?e[t]:[]}function W0(e,t=globalThis.localStorage){try{t.setItem(K_,JSON.stringify(e))}catch{}return e}function U0(e,t,n,s,o=[]){if(typeof t!="string"||!t||n===s)return e;const a=[...new Set(o.filter(w=>typeof w=="string"&&w))];if(!a.includes(n)||!a.includes(s))return e;const u=Ai(e,t).filter(w=>a.includes(w)),h=[...u,...a.filter(w=>!u.includes(w))],f=h.indexOf(n),p=h.indexOf(s);h.splice(f,1);const v=h.indexOf(s),b=f<p?v+1:v;return h.splice(b,0,n),{...e,[t]:h}}function K0(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(U_));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function fg(e,t){var n,s;return{open:((n=e==null?void 0:e[t])==null?void 0:n.open)!==!1,filter:q_((s=e==null?void 0:e[t])==null?void 0:s.filter)}}function q0(e,t=globalThis.localStorage){try{t.setItem(U_,JSON.stringify(e))}catch{}return e}function pg(e,t=""){const n=String(t||"").trim().toLocaleLowerCase();return n?[e.label,e.key,e.searchText].filter(Boolean).join(" ").toLocaleLowerCase().includes(n):!0}function ps(e=[],t=[],n="all",s=[]){return[...e].filter(o=>F0(o,t,n)).sort((o,a)=>$0(o,a,t,s))}const Hh=["it","en","es"];function V0(){try{const e=typeof navigator<"u"&&navigator.language||"",t=String(e).slice(0,2).toLowerCase();return Hh.includes(t)?t:"en"}catch{return"en"}}const vl=V0(),V_="nc_lang",Td="nc-lang";function Y_(){return typeof localStorage<"u"?localStorage:null}const rl={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",reorder:"riordina","reorder-help":"trascina la maniglia; frecce su/giu da tastiera","rename-node":"rinomina nodo","rename-node-prompt":"Nuovo nome del nodo in NexusCrew","rename-node-invalid":"Nome non valido: massimo 64 caratteri, senza a capo.","reorder-deck-help":"trascina il deck; frecce sinistra/destra da tastiera",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","view-technical":"tecniche","mark-technical":"nascondi come sessione tecnica","mark-normal":"mostra come sessione normale","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-working":"al lavoro","cell-idle":"in attesa","cell-degraded":"degradata: unit attiva, tmux morto","power-on":"accendi","power-off":"spegni","boot-enable":"attiva al boot","boot-disable":"disattiva al boot","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…","composer-history-tools":"cronologia e dimensione input","composer-history":"cronologia della cella","composer-history-empty":"nessun input inviato","composer-history-clear":"cancella cronologia di questa cella","composer-expand":"espandi input","composer-collapse":"riduci input","composer-clear-data":"cancella bozze e cronologia","composer-clear-data-help":"Rimuove da questo browser tutte le bozze e la cronologia input delle celle.","composer-clear-confirm":"Cancellare tutte le bozze e la cronologia input salvate in questo browser?","composer-clear-done":"Bozze e cronologia cancellate.","composer-clear-failed":"Impossibile cancellare i dati del composer in questo browser.",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","expand-owner":"espandi i deck di {owner}","collapse-owner":"comprimi i deck di {owner}","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} deck","dot-working":"in uso (finestra attiva)","dot-on":"aperta in background","dot-neutral":"non aperta","dot-warn":"nodo offline","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","tab-audio":"audio","system-general":"generale","system-diagnostics":"diagnostica","system-this-node":"questo nodo","system-updates":"aggiornamenti","system-security":"sicurezza","system-local-data":"dati locali del browser","system-terminal":"terminale","alternate-screen":"schermo alternato","alternate-screen-help":"Mantiene il comportamento tmux standard per le nuove sessioni NexusCrew; il trascinamento nel terminale web non scorre i TUI a schermo intero. Non modifica le celle già attive.","tab-input":"input","tab-diagnostics":"diagnostica","input-settings-local":"Preferenze locali di questo browser. Si applicano subito a vista singola e deck, senza modificare il nodo remoto.","terminal-keyboard-gesture":"Apertura tastiera virtuale dal terminale","terminal-keyboard-double-tap":"Doppio tap (predefinito)","terminal-keyboard-single-tap":"Tap singolo","terminal-keyboard-never":"Mai dal terminale","terminal-keyboard-gesture-help":"Il tastierino e STT seguono i controlli separati sotto. Mouse e tastiera fisica restano utilizzabili.","keybar-ime-lock":"Tastierino: mantieni chiusa la tastiera virtuale","keybar-ime-lock-help":"ESC, frecce, PgUp/PgDn, Enter e menu inviano direttamente al PTY senza dare focus a un campo di testo.","voice-ime-lock":"Microfono STT: mantieni chiusa la tastiera virtuale","voice-ime-lock-help":"Il tap sul microfono avvia o ferma la voce senza focalizzare il composer.","keybar-enter-show":"Mostra Enter verticale nel tastierino","keybar-enter-show-help":"Enter resta a destra di PgUp/PgDn ed è alto quanto entrambe le righe.","keybar-layout":"Layout tastierino","keybar-layout-full":"Esteso (predefinito)","keybar-layout-compact":"Compatto","keybar-layout-help":"Compatto: una riga con expand ⊞ per accedere al set completo senza cambiare la preferenza.","input-settings-reset":"ripristina predefiniti input","diagnostics-local":"Questo nodo","diagnostics-target":"Nodo da diagnosticare","diagnostics-verbose":"Log verbosi temporanei","diagnostics-duration":"Durata verbose","diagnostics-expires":"Verbose attivo fino alle {time}","diagnostics-off":"Verbose spento; warning ed errori operativi restano disponibili.","diagnostics-level":"Livello","diagnostics-all-levels":"tutti i livelli","diagnostics-component":"componente","diagnostics-pause":"pausa","diagnostics-autoscroll":"scorrimento automatico","diagnostics-log":"Log diagnostico sanitizzato","diagnostics-empty":"Nessun evento diagnostico.","diagnostics-export":"esporta JSON","diagnostics-export-failed":"Esportazione non disponibile in questo browser.","diagnostics-clear":"svuota","diagnostics-clear-confirm":"Svuotare il buffer diagnostico di questo nodo?","diagnostics-unsupported":"Questo peer è offline o non supporta la diagnostica strutturata.","fleet-editor-loading":"Caricamento dell'editor Fleet…","fleet-editor-load-error":"Impossibile caricare l'editor Fleet.","fleet-editor-unavailable":"Editor Fleet non disponibile in questa posizione.","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-shell-engine-help":"Shell locale risolta sul dispositivo al momento dell’avvio; nessun percorso viene salvato nel backup.","fleet-shell-command-placeholder":"comando opzionale, es. npm test","fleet-shell-command-help":"Esecuzione tramite shell login interattiva (-lic), con PATH e alias utente. La cella si ferma quando il comando termina; gli errori immediati vengono segnalati.","fleet-shell-command-metachar":"Pipe, redirect, variabili e altri metacaratteri vengono interpretati dalla shell del dispositivo.","fleet-shell-interactive":"Vuoto: apre una shell interattiva locale e mantiene la cella attiva.","fleet-shell-launch-help":"Il comando Shell si configura nella cella da Impostazioni → Flotta.","fleet-credential-title":"API key su questo dispositivo","fleet-credential-help":"La key resta solo sul nodo selezionato, non viene mostrata, esportata o condivisa con la rete.","fleet-credential-set":"imposta key","fleet-credential-change":"cambia key","fleet-credential-forget":"dimentica","fleet-credential-saved":"Key salvata localmente.","fleet-credential-removed":"Key locale rimossa.","fleet-credential-remove-confirm":"Rimuovere la key locale {key}?","fleet-credential-source-environment":"ambiente","fleet-credential-source-local":"store locale","fleet-credential-source-compatibility":"config compatibile","fleet-credential-source-missing":"mancante","fleet-credential-source-policy":"origine credenziale","fleet-credential-source-policy-auto":"auto (precedenza legacy)","fleet-credential-source-policy-nexuscrew-store":"solo store NexusCrew","fleet-credential-source-policy-environment":"solo ambiente","fleet-key-section":"KEY","fleet-key-variable":"Variabile","fleet-key-value":"Valore per {key}","fleet-key-used-by":"Usata da: {engines}","fleet-key-used-by-none":"Non ancora usata da engine configurati su questo nodo.","fleet-key-shared-impact":"Sostituire o rimuovere {key} interessa tutti gli engine elencati: {engines}.","fleet-key-enter":"inserisci la key","fleet-key-blank-keeps":"vuoto = mantieni la fonte attuale","fleet-key-reveal":"mostra","fleet-key-hide":"nascondi","fleet-key-local-help":"Il valore resta write-only sul nodo selezionato e non entra in engine, backup o federazione.","fleet-key-create-missing":"Crea esplicitamente l’engine senza key (resterà “key richiesta”).","fleet-key-partial-create":"Engine creato; la key non è stata salvata. Puoi riprovare senza creare duplicati.","fleet-key-partial-edit":"Engine aggiornato; la key non è stata salvata. Le modifiche all’engine restano applicate.","fleet-provider-notice-claude-openrouter":"Claude Code è ottimizzato per modelli Anthropic: altri provider potrebbero non funzionare correttamente. Fast mode richiede il provider Anthropic first-party.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses è beta e stateless; Codex-VL non usa fallback Chat Completions.","fleet-provider-notice-claude-kimi-code":"Kimi Code usa una configurazione Claude isolata con onboarding e fast mode dedicati; la configurazione Claude nativa non viene modificata.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal usa solo ALIBABA_CODE_API_KEY dal credential layer locale; qwen3.8-max-preview è il modello predefinito e non viene usato alcun fallback OpenAI/PAYG.","fleet-provider-notice-kimi-native":'Kimi Code CLI nativo usa il login del CLI (device-code) e la propria configurazione: NexusCrew non legge né copia credenziali. Distinto dal provider "Kimi Code" di Claude Code, che resta il percorso K3 gestito.',"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 engine, 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-backup-invalid-engine":"il backup contiene un engine non valido","fleet-backup-duplicate-engine":"il backup contiene ID engine duplicati","fleet-backup-confirm-engine-overwrite":"Sovrascrivere questi engine? I valori ambiente già configurati sul target restano invariati. {engines}","fleet-backup-env-names":"nomi ambiente","fleet-backup-env-values-required":"i valori ambiente vanno configurati sul dispositivo","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.',"fleet-cwd-needs-repair":"cartella da riparare","fleet-cwd-repair":"ripara","fleet-cwd-repair-title":"Ripara cartella cella {id}","fleet-cwd-repair-help":"La cartella attuale non è portabile su questo dispositivo: appartiene a un altro dispositivo o non esiste sotto la home. Scegli una cartella home-relative (~) sul dispositivo target; il backend ricalcolerà il percorso assoluto.","fleet-cwd-repair-no-source-path":"Il percorso originale non viene mostrato: è specifico del dispositivo di origine.","fleet-cwd-repair-placeholder":"es. Dev","fleet-cwd-repair-preview":"Nuova cartella: {path}","fleet-cwd-repair-browse":"sfoglia sotto ~","fleet-cwd-repair-fs-empty":"nessuna sottocartella","fleet-cwd-repair-use-current":"usa questa cartella","fleet-cwd-repair-invalid":'percorso non valido: niente assoluto, "..", barra rovesciata o lettera disco',"fleet-cwd-repair-confirm":"Impostare la cartella della cella {id} su {path}? Verrà ricalcolata sul dispositivo target.","fleet-cwd-repair-unportable":"Il percorso scelto non è portabile su questo dispositivo: deve esistere sotto la home.","fleet-cwd-repair-suggestion":"Suggerimento dal dispositivo:","fleet-cwd-repair-use-suggestion":"usa {path}","fleet-cwd-repaired":"Cartella della cella riparata.","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","pair-ssh-local-label":"Host o alias SSH su questo dispositivo","node-ssh-local-help":"Puoi sostituire l’indirizzo del link con lo stesso alias che funziona usando ssh su questo dispositivo. Alias, agent e chiavi restano locali e non viaggiano nel link.","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-remove-warning":"Elimina associazione, credenziali e tunnel locale. Non spegne il dispositivo remoto.","peer-inventory-title":"Nodi collegati al hub","peer-group-hubs":"Hub diretti","peer-group-clients":"Client collegati","peer-group-routed":"Nodi raggiungibili tramite la rete","peer-routed":"instradato","peer-routed-stale":"instradato, non raggiungibile","peer-visibility":"Visibilità nella rete","node-test":"test","tunnel-start":"avvia tunnel","tunnel-stop":"ferma tunnel","tunnel-restart":"riavvia tunnel","share-node":"Condividi questo nodo","share-local-heading":"Condivisione di questo dispositivo","share-local-hub":"Hub di condivisione","share-local-through":"Condividi {device} tramite {hub}","share-local-active":"Condiviso e raggiungibile dalla rete collegata all’hub.","share-local-pending":"Condivisione richiesta, ma il tunnel è giù: questo dispositivo non è ancora raggiungibile.","share-local-private":"Privato: solo questo dispositivo può usare il collegamento all’hub.","share-local-private-down":"Privato, ma il collegamento all’hub è giù. Riconnetti per applicare e verificare la modalità privata.","share-local-reconnect":"Riconnetti e riconcilia","share-off-hub-reconcile-pending":"Stato privato salvato; la revoca sull’hub è ancora in attesa.","share-off-local-reconcile-pending":"Revoca confermata dall’hub; il tunnel locale deve ancora riconciliarsi.","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-local-name":"nome locale non valido: usa uno slug univoco, non “localhost”","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","notification-speech-enable":"leggi le notifiche ad alta voce","notification-speech-help":"Usa la voce del browser solo per nuove notifiche mentre questa PWA è visibile e in primo piano. Con l’app chiusa resta la notifica di sistema.","notification-speech-test":"prova voce","notification-speech-testing":"prova in corso…","notification-speech-preview":"NexusCrew. Notifiche vocali attive.","notification-speech-preview-ok":"Prova vocale completata.","notification-speech-preview-failed":"Il browser non ha avviato la prova vocale. Interagisci con la pagina e riprova.","notification-speech-needs-test":"Per questa sessione dell’app, premi “prova voce” prima di ricevere annunci vocali.","notification-speech-unsupported":"Sintesi vocale non supportata in questo browser.","audio-title":"Audio nativo del nodo","audio-help":"Consenso e controlli valgono solo per questo dispositivo. Share e visibilità non autorizzano suoni.","audio-consent":"consenti TTS su questo nodo","audio-consent-help":"Permette a celle autorizzate, locali o remote, di consegnare un comando vocale. Puoi revocarlo in ogni momento.","audio-capability":"Capability locale","audio-loading":"leggo lo stato audio locale…","audio-adapter":"adapter","audio-adapter-none":"nessuno","audio-installed":"installato","audio-installed-yes":"sì","audio-installed-no":"no","audio-liveness":"disponibilità","audio-liveness-ready":"pronto ad accettare","audio-liveness-unavailable":"non disponibile","audio-languages":"lingue dichiarate","audio-limits":"limiti","audio-test":"prova audio locale","audio-testing":"prova in corso…","audio-stop":"ferma audio locale","audio-stopping":"stop in corso…","audio-test-needs-consent":"Attiva il consenso locale prima di provare la voce.","audio-unavailable":"Nessun adapter TTS nativo disponibile su questo nodo.","audio-test-accepted":"Il nodo ha accettato la prova. Non dimostra che qualcuno l’abbia udita.","audio-test-refused":"Il nodo ha rifiutato la prova.","audio-test-unknown":"Esito della prova sconosciuto: il nodo non può confermare l’avvio.","audio-stop-stopped":"Audio locale fermato.","audio-stop-idle":"Nessun enunciato locale da fermare.","audio-groups-title":"Gruppi audio condivisi","audio-groups-help":"Decide su quali dispositivi si sente la voce quando una cella parla. Il gruppo è una preferenza locale di consegna, non un consenso. Ogni nodo conserva consenso, ACL, disponibilità e Stop locale.","audio-groups-empty":"Nessun gruppo: la voce esce solo su questo nodo.","audio-group-name":"nome gruppo","audio-group-mode":"modalità consegna","audio-group-primary":"primo disponibile (in ordine)","audio-group-fanout":"tutti i nodi elencati","audio-group-targets":"nodi target esatti","audio-group-local":"questo nodo","audio-group-unavailable-target":"non rilevato ora","audio-group-no-targets":"Nessun nodo con instanceId disponibile. Il gruppo non può usare nomi, wildcard o “tutti”.","audio-group-new":"nuovo gruppo","audio-group-edit":"modifica","audio-group-delete":"elimina","audio-group-save":"salva gruppo","audio-group-cancel":"annulla","audio-group-invalid":"Il gruppo richiede un nome valido e almeno un nodeId esatto.","audio-group-save-failed":"Salvataggio gruppo audio non riuscito.","node-display-label":"Nome (etichetta)","routed-node-aliases":"Alias nodi instradati","routed-node-aliases-help":"Visibili solo su questo dispositivo; route e nome remoto non cambiano.","node-local-alias":"Alias su questo dispositivo","alias-on-device":"Alias su questo dispositivo","reset-alias":"Ripristina nome remoto","node-slug-hint":"routing su slug: {slug}","device-name-label":"Nome dispositivo","device-name-hint":"come ti vedono i peer (modificabile)","local-route-name-label":"Nome locale / route","local-route-name-hint":"handle tecnico stabile: label leggibile + suffisso del nodeId; modificabile prima della connessione","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","cell-switcher-refreshing":"aggiorno le celle…","cell-switcher-empty-active":"nessuna cella attiva verificata","cell-switcher-not-confirmed":"stato non confermato","cell-switcher-not-active":"questa cella non è più attiva","cell-switcher-select":"seleziona una cella","cell-switcher-open":"apri cella","cell-switcher-show-all":"tutte","cell-switcher-show-active":"attive","cell-switcher-close":"chiudi selettore celle","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-unavailable-hint":"Configurazione engine non disponibile su questo nodo.","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",reorder:"reorder","reorder-help":"drag the handle; keyboard up/down arrows","rename-node":"rename node","rename-node-prompt":"New node name in NexusCrew","rename-node-invalid":"Invalid name: maximum 64 characters, no line breaks.","reorder-deck-help":"drag the deck; keyboard left/right arrows",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","view-technical":"technical","mark-technical":"hide as technical session","mark-normal":"show as normal session","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-working":"working","cell-idle":"idle","cell-degraded":"degraded: unit active, tmux dead","power-on":"power on","power-off":"power off","boot-enable":"enable at boot","boot-disable":"disable at boot","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…","composer-history-tools":"input history and size","composer-history":"cell history","composer-history-empty":"no submitted input","composer-history-clear":"clear this cell history","composer-expand":"expand input","composer-collapse":"collapse input","composer-clear-data":"clear drafts and history","composer-clear-data-help":"Removes every saved cell draft and input-history entry from this browser.","composer-clear-confirm":"Clear every saved draft and input-history entry from this browser?","composer-clear-done":"Drafts and history cleared.","composer-clear-failed":"Could not clear composer data in this browser.",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","expand-owner":"expand {owner} decks","collapse-owner":"collapse {owner} decks","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} decks","dot-working":"in use (active window)","dot-on":"open in background","dot-neutral":"not open","dot-warn":"owner offline","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","tab-audio":"audio","system-general":"general","system-diagnostics":"diagnostics","system-this-node":"this node","system-updates":"updates","system-security":"security","system-local-data":"local browser data","system-terminal":"terminal","alternate-screen":"alternate screen","alternate-screen-help":"Keeps standard tmux behavior for new NexusCrew sessions; dragging in the web terminal does not scroll full-screen TUIs. It does not change cells already running.","tab-input":"input","tab-diagnostics":"diagnostics","input-settings-local":"Local preferences for this browser. They apply immediately to single view and decks without changing the remote node.","terminal-keyboard-gesture":"Open the virtual keyboard from the terminal","terminal-keyboard-double-tap":"Double tap (default)","terminal-keyboard-single-tap":"Single tap","terminal-keyboard-never":"Never from terminal","terminal-keyboard-gesture-help":"The keypad and STT use the separate controls below. Mouse and physical keyboard remain available.","keybar-ime-lock":"Keypad: keep the virtual keyboard closed","keybar-ime-lock-help":"ESC, arrows, PgUp/PgDn, Enter and menu send directly to the PTY without focusing a text field.","voice-ime-lock":"STT microphone: keep the virtual keyboard closed","voice-ime-lock-help":"Tapping the microphone starts or stops voice without focusing the composer.","keybar-enter-show":"Show the tall Enter keypad key","keybar-enter-show-help":"Enter stays to the right of PgUp/PgDn and spans both rows.","keybar-layout":"Keypad layout","keybar-layout-full":"Full (default)","keybar-layout-compact":"Compact","keybar-layout-help":"Compact: one row with an expand toggle that reaches the full key set without changing the preference.","input-settings-reset":"restore input defaults","diagnostics-local":"This node","diagnostics-target":"Node to diagnose","diagnostics-verbose":"Temporary verbose logs","diagnostics-duration":"Verbose duration","diagnostics-expires":"Verbose enabled until {time}","diagnostics-off":"Verbose is off; operational warnings and errors remain available.","diagnostics-level":"Level","diagnostics-all-levels":"all levels","diagnostics-component":"component","diagnostics-pause":"pause","diagnostics-autoscroll":"autoscroll","diagnostics-log":"Sanitized diagnostic log","diagnostics-empty":"No diagnostic events.","diagnostics-export":"export JSON","diagnostics-export-failed":"Export is not available in this browser.","diagnostics-clear":"clear","diagnostics-clear-confirm":"Clear this node diagnostic buffer?","diagnostics-unsupported":"This peer is offline or does not support structured diagnostics.","fleet-editor-loading":"Loading the Fleet editor…","fleet-editor-load-error":"Unable to load the Fleet editor.","fleet-editor-unavailable":"The Fleet editor is unavailable at this location.","fleet-managed":"managed by NexusCrew","fleet-custom":"custom command","fleet-managed-help":"Client, provider and launch are managed internally; secrets are never displayed.","fleet-shell-engine-help":"The local shell is resolved on the device at launch time; no executable path is stored in backups.","fleet-shell-command-placeholder":"optional command, e.g. npm test","fleet-shell-command-help":"Runs through an interactive login shell (-lic), with the user PATH and aliases. The cell stops when the command finishes; immediate failures are reported.","fleet-shell-command-metachar":"Pipes, redirects, variables, and other metacharacters are interpreted by the device shell.","fleet-shell-interactive":"Empty: opens a local interactive shell and keeps the cell active.","fleet-shell-launch-help":"Configure the Shell command on the cell in Settings → Fleet.","fleet-credential-title":"API key on this device","fleet-credential-help":"The key stays only on the selected node and is never displayed, exported or shared with the network.","fleet-credential-set":"set key","fleet-credential-change":"change key","fleet-credential-forget":"forget","fleet-credential-saved":"Key saved locally.","fleet-credential-removed":"Local key removed.","fleet-credential-remove-confirm":"Remove the local {key} key?","fleet-credential-source-environment":"environment","fleet-credential-source-local":"local store","fleet-credential-source-compatibility":"compatible config","fleet-credential-source-missing":"missing","fleet-credential-source-policy":"credential source","fleet-credential-source-policy-auto":"auto (legacy precedence)","fleet-credential-source-policy-nexuscrew-store":"NexusCrew store only","fleet-credential-source-policy-environment":"environment only","fleet-key-section":"KEY","fleet-key-variable":"Variable","fleet-key-value":"Value for {key}","fleet-key-used-by":"Used by: {engines}","fleet-key-used-by-none":"Not yet used by configured engines on this node.","fleet-key-shared-impact":"Replacing or removing {key} affects every listed engine: {engines}.","fleet-key-enter":"enter the key","fleet-key-blank-keeps":"blank = keep the current source","fleet-key-reveal":"reveal","fleet-key-hide":"hide","fleet-key-local-help":"The value stays write-only on the selected node and never enters engines, backups or federation.","fleet-key-create-missing":"Explicitly create the engine without a key (it will remain “key required”).","fleet-key-partial-create":"Engine created; the key was not saved. Retry without creating a duplicate.","fleet-key-partial-edit":"Engine updated; the key was not saved. The engine changes remain applied.","fleet-provider-notice-claude-openrouter":"Claude Code is optimized for Anthropic models; other providers may not work correctly. Fast mode requires the first-party Anthropic provider.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses is beta and stateless; Codex-VL has no Chat Completions fallback.","fleet-provider-notice-claude-kimi-code":"Kimi Code uses isolated Claude configuration with dedicated onboarding and fast-mode flags; native Claude configuration is not modified.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal uses only ALIBABA_CODE_API_KEY from the local credential layer; qwen3.8-max-preview is the default and no OpenAI/PAYG fallback is used.","fleet-provider-notice-kimi-native":'Native Kimi Code CLI uses the CLI login (device code) and its own configuration: NexusCrew never reads or copies credentials. Distinct from the Claude Code "Kimi Code" provider, which remains the managed K3 path.',"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 engines, 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-backup-invalid-engine":"the backup contains an invalid engine","fleet-backup-duplicate-engine":"the backup contains duplicate engine IDs","fleet-backup-confirm-engine-overwrite":"Overwrite these engines? Environment values already configured on the target stay unchanged. {engines}","fleet-backup-env-names":"environment names","fleet-backup-env-values-required":"environment values must be configured on this device","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.',"fleet-cwd-needs-repair":"folder needs repair","fleet-cwd-repair":"repair","fleet-cwd-repair-title":"Repair cell folder {id}","fleet-cwd-repair-help":"The current folder is not portable on this device: it belongs to another device or does not exist under the home directory. Choose a home-relative (~) folder on the target device; the backend will recompute the absolute path.","fleet-cwd-repair-no-source-path":"The original path is not shown: it is specific to the source device.","fleet-cwd-repair-placeholder":"e.g. Dev","fleet-cwd-repair-preview":"New folder: {path}","fleet-cwd-repair-browse":"browse under ~","fleet-cwd-repair-fs-empty":"no subfolders","fleet-cwd-repair-use-current":"use this folder","fleet-cwd-repair-invalid":'invalid path: no absolute path, "..", backslash or drive letter',"fleet-cwd-repair-confirm":"Set the folder of cell {id} to {path}? It will be recomputed on the target device.","fleet-cwd-repair-unportable":"The chosen path is not portable on this device: it must exist under the home directory.","fleet-cwd-repair-suggestion":"Suggestion from device:","fleet-cwd-repair-use-suggestion":"use {path}","fleet-cwd-repaired":"Cell folder repaired.","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","pair-ssh-local-label":"SSH host or alias on this device","node-ssh-local-help":"You may replace the link address with the same alias that works with ssh on this device. Aliases, agents and private keys stay local and are never carried in the link.","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-remove-warning":"Deletes the pairing, credentials and local tunnel. It does not power off the remote device.","peer-inventory-title":"Nodes connected to the hub","peer-group-hubs":"Direct hubs","peer-group-clients":"Connected clients","peer-group-routed":"Nodes reachable through the network","peer-routed":"routed","peer-routed-stale":"routed, unreachable","peer-visibility":"Network visibility","node-test":"test","tunnel-start":"start tunnel","tunnel-stop":"stop tunnel","tunnel-restart":"restart tunnel","share-node":"Share this node","share-local-heading":"Share this device","share-local-hub":"Sharing hub","share-local-through":"Share {device} through {hub}","share-local-active":"Shared and reachable by the network connected to the hub.","share-local-pending":"Sharing is requested, but the tunnel is down: this device is not reachable yet.","share-local-private":"Private: only this device can use its hub connection.","share-local-private-down":"Private, but the hub connection is down. Reconnect to apply and verify private mode.","share-local-reconnect":"Reconnect and reconcile","share-off-hub-reconcile-pending":"Private state saved; hub revocation is still pending.","share-off-local-reconcile-pending":"Hub revocation confirmed; the local tunnel still needs reconciliation.","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-local-name":"invalid local name: use a unique slug, not “localhost”","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","notification-speech-enable":"read notifications aloud","notification-speech-help":"Uses the browser voice only for new notifications while this PWA is visible and in the foreground. When the app is closed, the system notification remains available.","notification-speech-test":"test voice","notification-speech-testing":"testing voice…","notification-speech-preview":"NexusCrew. Spoken notifications are active.","notification-speech-preview-ok":"Voice test completed.","notification-speech-preview-failed":"The browser did not start the voice test. Interact with the page and try again.","notification-speech-needs-test":"For this app session, select “test voice” before spoken alerts can play.","notification-speech-unsupported":"Speech synthesis is not supported in this browser.","audio-title":"Native node audio","audio-help":"Consent and controls apply only to this device. Share and visibility do not authorize sounds.","audio-consent":"allow TTS on this node","audio-consent-help":"Allows authorized local or remote cells to deliver a voice command. You can revoke it at any time.","audio-capability":"Local capability","audio-loading":"reading local audio state…","audio-adapter":"adapter","audio-adapter-none":"none","audio-installed":"installed","audio-installed-yes":"yes","audio-installed-no":"no","audio-liveness":"availability","audio-liveness-ready":"ready to accept","audio-liveness-unavailable":"unavailable","audio-languages":"declared languages","audio-limits":"limits","audio-test":"test local audio","audio-testing":"testing audio…","audio-stop":"stop local audio","audio-stopping":"stopping audio…","audio-test-needs-consent":"Enable local consent before testing the voice.","audio-unavailable":"No native TTS adapter is available on this node.","audio-test-accepted":"The node accepted the test. It does not prove that anyone heard it.","audio-test-refused":"The node refused the test.","audio-test-unknown":"Test outcome unknown: the node could not confirm startup.","audio-stop-stopped":"Local audio stopped.","audio-stop-idle":"No local utterance to stop.","audio-groups-title":"Shared audio groups","audio-groups-help":"Chooses which devices play the voice when a cell speaks. A group is a local delivery preference, not consent. Each node keeps its own consent, ACL, availability and local Stop.","audio-groups-empty":"No group: voice plays only on this node.","audio-group-name":"group name","audio-group-mode":"delivery mode","audio-group-primary":"first available (in order)","audio-group-fanout":"all listed nodes","audio-group-targets":"exact target nodes","audio-group-local":"this node","audio-group-unavailable-target":"not currently discovered","audio-group-no-targets":"No node with an available instanceId. A group cannot use names, wildcards, or “all”.","audio-group-new":"new group","audio-group-edit":"edit","audio-group-delete":"delete","audio-group-save":"save group","audio-group-cancel":"cancel","audio-group-invalid":"A group needs a valid name and at least one exact nodeId.","audio-group-save-failed":"Could not save audio group.","node-display-label":"Name (label)","routed-node-aliases":"Routed node aliases","routed-node-aliases-help":"Visible only on this device; the route and remote name do not change.","node-local-alias":"Alias on this device","alias-on-device":"Alias on this device","reset-alias":"Reset remote name","node-slug-hint":"routing on slug: {slug}","device-name-label":"Device name","device-name-hint":"how peers see you (editable)","local-route-name-label":"Local / route name","local-route-name-hint":"stable technical handle: readable label + nodeId suffix; editable before connecting","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","cell-switcher-refreshing":"refreshing cells…","cell-switcher-empty-active":"no verified active cells","cell-switcher-not-confirmed":"status not confirmed","cell-switcher-not-active":"this cell is no longer active","cell-switcher-select":"select a cell","cell-switcher-open":"open cell","cell-switcher-show-all":"all","cell-switcher-show-active":"active","cell-switcher-close":"close cell switcher","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-unavailable-hint":"Engine configuration is unavailable on this node.","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",reorder:"reordenar","reorder-help":"arrastra el control; flechas arriba/abajo","rename-node":"renombrar nodo","rename-node-prompt":"Nuevo nombre del nodo en NexusCrew","rename-node-invalid":"Nombre no válido: máximo 64 caracteres, sin saltos de línea.","reorder-deck-help":"arrastra el deck; flechas izquierda/derecha",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","view-technical":"técnicas","mark-technical":"ocultar como sesión técnica","mark-normal":"mostrar como sesión normal","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-working":"trabajando","cell-idle":"en espera","cell-degraded":"degradada: unit activa, tmux muerto","power-on":"encender","power-off":"apagar","boot-enable":"activar al iniciar","boot-disable":"desactivar al iniciar","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…","composer-history-tools":"historial y tamaño de entrada","composer-history":"historial de la celda","composer-history-empty":"ninguna entrada enviada","composer-history-clear":"borrar historial de esta celda","composer-expand":"ampliar entrada","composer-collapse":"reducir entrada","composer-clear-data":"borrar borradores e historial","composer-clear-data-help":"Elimina de este navegador todos los borradores y el historial de entrada de las celdas.","composer-clear-confirm":"¿Borrar todos los borradores y el historial de entrada guardados en este navegador?","composer-clear-done":"Borradores e historial eliminados.","composer-clear-failed":"No se pudieron borrar los datos del composer en este navegador.",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í","expand-owner":"expandir decks de {owner}","collapse-owner":"comprimir decks de {owner}","owner-deck-count-one":"{count} deck","owner-deck-count-many":"{count} decks","dot-working":"en uso (ventana activa)","dot-on":"abierta en segundo plano","dot-neutral":"no abierta","dot-warn":"nodo sin conexión","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","tab-audio":"audio","system-general":"general","system-diagnostics":"diagnóstico","system-this-node":"este nodo","system-updates":"actualizaciones","system-security":"seguridad","system-local-data":"datos locales del navegador","system-terminal":"terminal","alternate-screen":"pantalla alternativa","alternate-screen-help":"Mantiene el comportamiento estándar de tmux para las nuevas sesiones NexusCrew; arrastrar en el terminal web no desplaza los TUI a pantalla completa. No modifica las celdas ya activas.","tab-input":"entrada","tab-diagnostics":"diagnóstico","input-settings-local":"Preferencias locales de este navegador. Se aplican de inmediato a la vista única y a los decks sin cambiar el nodo remoto.","terminal-keyboard-gesture":"Abrir el teclado virtual desde el terminal","terminal-keyboard-double-tap":"Doble toque (predeterminado)","terminal-keyboard-single-tap":"Toque único","terminal-keyboard-never":"Nunca desde el terminal","terminal-keyboard-gesture-help":"El teclado auxiliar y STT usan los controles separados de abajo. El ratón y el teclado físico siguen disponibles.","keybar-ime-lock":"Teclado auxiliar: mantener cerrado el teclado virtual","keybar-ime-lock-help":"ESC, flechas, PgUp/PgDn, Enter y menú envían directamente al PTY sin enfocar un campo de texto.","voice-ime-lock":"Micrófono STT: mantener cerrado el teclado virtual","voice-ime-lock-help":"Tocar el micrófono inicia o detiene la voz sin enfocar el compositor.","keybar-enter-show":"Mostrar Enter vertical en el teclado auxiliar","keybar-enter-show-help":"Enter queda a la derecha de PgUp/PgDn y ocupa las dos filas.","keybar-layout":"Distribución del teclado auxiliar","keybar-layout-full":"Completo (predeterminado)","keybar-layout-compact":"Compacto","keybar-layout-help":"Compacto: una fila con un botón expandir que alcanza el conjunto completo sin cambiar la preferencia.","input-settings-reset":"restaurar valores de entrada","diagnostics-local":"Este nodo","diagnostics-target":"Nodo a diagnosticar","diagnostics-verbose":"Logs detallados temporales","diagnostics-duration":"Duración detallada","diagnostics-expires":"Log detallado activo hasta las {time}","diagnostics-off":"El log detallado está apagado; los avisos y errores operativos siguen disponibles.","diagnostics-level":"Nivel","diagnostics-all-levels":"todos los niveles","diagnostics-component":"componente","diagnostics-pause":"pausa","diagnostics-autoscroll":"desplazamiento automático","diagnostics-log":"Log de diagnóstico sanitizado","diagnostics-empty":"No hay eventos de diagnóstico.","diagnostics-export":"exportar JSON","diagnostics-export-failed":"La exportación no está disponible en este navegador.","diagnostics-clear":"vaciar","diagnostics-clear-confirm":"¿Vaciar el búfer de diagnóstico de este nodo?","diagnostics-unsupported":"Este par está desconectado o no admite diagnósticos estructurados.","fleet-editor-loading":"Cargando el editor de Fleet…","fleet-editor-load-error":"No se puede cargar el editor de Fleet.","fleet-editor-unavailable":"El editor de Fleet no está disponible en esta ubicación.","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-shell-engine-help":"La shell local se resuelve en el dispositivo al iniciar; no se guarda ninguna ruta ejecutable en las copias.","fleet-shell-command-placeholder":"comando opcional, p. ej. npm test","fleet-shell-command-help":"Se ejecuta mediante una shell de inicio interactiva (-lic), con PATH y alias del usuario. La celda se detiene al terminar; los fallos inmediatos se notifican.","fleet-shell-command-metachar":"Pipes, redirecciones, variables y otros metacaracteres son interpretados por la shell del dispositivo.","fleet-shell-interactive":"Vacío: abre una shell local interactiva y mantiene la celda activa.","fleet-shell-launch-help":"Configura el comando Shell de la celda en Ajustes → Flota.","fleet-credential-title":"Clave API en este dispositivo","fleet-credential-help":"La clave permanece solo en el nodo seleccionado y nunca se muestra, exporta ni comparte con la red.","fleet-credential-set":"poner clave","fleet-credential-change":"cambiar clave","fleet-credential-forget":"olvidar","fleet-credential-saved":"Clave guardada localmente.","fleet-credential-removed":"Clave local eliminada.","fleet-credential-remove-confirm":"¿Eliminar la clave local {key}?","fleet-credential-source-environment":"entorno","fleet-credential-source-local":"almacén local","fleet-credential-source-compatibility":"config compatible","fleet-credential-source-missing":"ausente","fleet-credential-source-policy":"origen de credencial","fleet-credential-source-policy-auto":"auto (precedencia legacy)","fleet-credential-source-policy-nexuscrew-store":"solo almacén NexusCrew","fleet-credential-source-policy-environment":"solo entorno","fleet-key-section":"KEY","fleet-key-variable":"Variable","fleet-key-value":"Valor para {key}","fleet-key-used-by":"Usada por: {engines}","fleet-key-used-by-none":"Aún no la usa ningún motor configurado en este nodo.","fleet-key-shared-impact":"Sustituir o eliminar {key} afecta a todos los motores listados: {engines}.","fleet-key-enter":"introduce la clave","fleet-key-blank-keeps":"vacío = mantener la fuente actual","fleet-key-reveal":"mostrar","fleet-key-hide":"ocultar","fleet-key-local-help":"El valor permanece write-only en el nodo seleccionado y nunca entra en motores, copias ni federación.","fleet-key-create-missing":"Crear explícitamente el motor sin clave (seguirá como “clave requerida”).","fleet-key-partial-create":"Motor creado; la clave no se guardó. Puedes reintentar sin crear un duplicado.","fleet-key-partial-edit":"Motor actualizado; la clave no se guardó. Los cambios del motor siguen aplicados.","fleet-provider-notice-claude-openrouter":"Claude Code está optimizado para modelos Anthropic; otros proveedores podrían no funcionar correctamente. Fast mode requiere el proveedor Anthropic first-party.","fleet-provider-notice-codex-openrouter":"OpenRouter Responses es beta y stateless; Codex-VL no usa fallback de Chat Completions.","fleet-provider-notice-claude-kimi-code":"Kimi Code usa una configuración Claude aislada con onboarding y fast mode dedicados; la configuración Claude nativa no se modifica.","fleet-provider-notice-alibaba-token-plan":"Token Plan Personal usa solo ALIBABA_CODE_API_KEY de la capa local de credenciales; qwen3.8-max-preview es el modelo predeterminado y no se usa fallback OpenAI/PAYG.","fleet-provider-notice-kimi-native":'Kimi Code CLI nativo usa el login del CLI (device-code) y su propia configuración: NexusCrew no lee ni copia credenciales. Distinto del proveedor "Kimi Code" de Claude Code, que sigue siendo la ruta K3 gestionada.',"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 motores, 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-backup-invalid-engine":"la copia contiene un motor no válido","fleet-backup-duplicate-engine":"la copia contiene IDs de motor duplicados","fleet-backup-confirm-engine-overwrite":"¿Sobrescribir estos motores? Los valores de entorno ya configurados en el destino no cambian. {engines}","fleet-backup-env-names":"nombres de entorno","fleet-backup-env-values-required":"los valores de entorno deben configurarse en este dispositivo","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.',"fleet-cwd-needs-repair":"carpeta a reparar","fleet-cwd-repair":"reparar","fleet-cwd-repair-title":"Reparar carpeta de celda {id}","fleet-cwd-repair-help":"La carpeta actual no es portátil en este dispositivo: pertenece a otro dispositivo o no existe bajo el directorio home. Elige una carpeta relativa a home (~) en el dispositivo destino; el backend recalculará la ruta absoluta.","fleet-cwd-repair-no-source-path":"La ruta original no se muestra: es específica del dispositivo de origen.","fleet-cwd-repair-placeholder":"p. ej. Dev","fleet-cwd-repair-preview":"Nueva carpeta: {path}","fleet-cwd-repair-browse":"examinar bajo ~","fleet-cwd-repair-fs-empty":"sin subcarpetas","fleet-cwd-repair-use-current":"usar esta carpeta","fleet-cwd-repair-invalid":'ruta no válida: nada de ruta absoluta, "..", barra invertida ni letra de unidad',"fleet-cwd-repair-confirm":"¿Establecer la carpeta de la celda {id} a {path}? Se recalculará en el dispositivo destino.","fleet-cwd-repair-unportable":"La ruta elegida no es portátil en este dispositivo: debe existir bajo el directorio home.","fleet-cwd-repair-suggestion":"Sugerencia del dispositivo:","fleet-cwd-repair-use-suggestion":"usar {path}","fleet-cwd-repaired":"Carpeta de la celda reparada.","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","pair-ssh-local-label":"Host o alias SSH en este dispositivo","node-ssh-local-help":"Puedes sustituir la dirección del enlace por el mismo alias que funciona con ssh en este dispositivo. Los alias, agentes y claves permanecen locales y nunca viajan en el enlace.","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-remove-warning":"Elimina el emparejamiento, las credenciales y el túnel local. No apaga el dispositivo remoto.","peer-inventory-title":"Nodos conectados al hub","peer-group-hubs":"Hubs directos","peer-group-clients":"Clientes conectados","peer-group-routed":"Nodos accesibles a través de la red","peer-routed":"enrutado","peer-routed-stale":"enrutado, no accesible","peer-visibility":"Visibilidad en la red","node-test":"test","tunnel-start":"iniciar túnel","tunnel-stop":"detener túnel","tunnel-restart":"reiniciar túnel","share-node":"Compartir este nodo","share-local-heading":"Compartir este dispositivo","share-local-hub":"Hub para compartir","share-local-through":"Compartir {device} mediante {hub}","share-local-active":"Compartido y accesible para la red conectada al hub.","share-local-pending":"Se solicitó compartir, pero el túnel está caído: este dispositivo aún no es accesible.","share-local-private":"Privado: solo este dispositivo puede usar la conexión al hub.","share-local-private-down":"Privado, pero la conexión al hub está caída. Reconecta para aplicar y verificar el modo privado.","share-local-reconnect":"Reconectar y reconciliar","share-off-hub-reconcile-pending":"Estado privado guardado; la revocación en el hub sigue pendiente.","share-off-local-reconcile-pending":"Revocación confirmada por el hub; el túnel local aún debe reconciliarse.","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-local-name":"nombre local inválido: usa un slug único, no “localhost”","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","notification-speech-enable":"leer las notificaciones en voz alta","notification-speech-help":"Usa la voz del navegador solo para notificaciones nuevas mientras esta PWA está visible y en primer plano. Con la aplicación cerrada permanece la notificación del sistema.","notification-speech-test":"probar voz","notification-speech-testing":"probando voz…","notification-speech-preview":"NexusCrew. Las notificaciones por voz están activas.","notification-speech-preview-ok":"Prueba de voz completada.","notification-speech-preview-failed":"El navegador no inició la prueba de voz. Interactúa con la página y vuelve a intentarlo.","notification-speech-needs-test":"Para esta sesión de la aplicación, pulsa “probar voz” antes de recibir avisos hablados.","notification-speech-unsupported":"La síntesis de voz no está disponible en este navegador.","audio-title":"Audio nativo del nodo","audio-help":"El consentimiento y los controles valen solo para este dispositivo. Compartir y visibilidad no autorizan sonidos.","audio-consent":"permitir TTS en este nodo","audio-consent-help":"Permite que celdas autorizadas, locales o remotas, entreguen un comando de voz. Puedes revocarlo en cualquier momento.","audio-capability":"Capacidad local","audio-loading":"leyendo el estado de audio local…","audio-adapter":"adaptador","audio-adapter-none":"ninguno","audio-installed":"instalado","audio-installed-yes":"sí","audio-installed-no":"no","audio-liveness":"disponibilidad","audio-liveness-ready":"listo para aceptar","audio-liveness-unavailable":"no disponible","audio-languages":"idiomas declarados","audio-limits":"límites","audio-test":"probar audio local","audio-testing":"probando audio…","audio-stop":"detener audio local","audio-stopping":"deteniendo audio…","audio-test-needs-consent":"Activa el consentimiento local antes de probar la voz.","audio-unavailable":"No hay un adaptador TTS nativo disponible en este nodo.","audio-test-accepted":"El nodo aceptó la prueba. No demuestra que alguien la haya oído.","audio-test-refused":"El nodo rechazó la prueba.","audio-test-unknown":"Resultado de prueba desconocido: el nodo no pudo confirmar el inicio.","audio-stop-stopped":"Audio local detenido.","audio-stop-idle":"No hay enunciado local que detener.","audio-groups-title":"Grupos de audio compartido","audio-groups-help":"Decide en qué dispositivos se oye la voz cuando habla una celda. Un grupo es una preferencia local de entrega, no un consentimiento. Cada nodo conserva su consentimiento, ACL, disponibilidad y Stop local.","audio-groups-empty":"Sin grupos: la voz sale solo por este nodo.","audio-group-name":"nombre del grupo","audio-group-mode":"modo de entrega","audio-group-primary":"primero disponible (en orden)","audio-group-fanout":"todos los nodos enumerados","audio-group-targets":"nodos destino exactos","audio-group-local":"este nodo","audio-group-unavailable-target":"no detectado ahora","audio-group-no-targets":"No hay ningún nodo con instanceId disponible. Un grupo no puede usar nombres, comodines ni “todos”.","audio-group-new":"nuevo grupo","audio-group-edit":"editar","audio-group-delete":"eliminar","audio-group-save":"guardar grupo","audio-group-cancel":"cancelar","audio-group-invalid":"El grupo necesita un nombre válido y al menos un nodeId exacto.","audio-group-save-failed":"No se pudo guardar el grupo de audio.","node-display-label":"Nombre (etiqueta)","routed-node-aliases":"Alias de nodos enrutados","routed-node-aliases-help":"Visibles solo en este dispositivo; la ruta y el nombre remoto no cambian.","node-local-alias":"Alias en este dispositivo","alias-on-device":"Alias en este dispositivo","reset-alias":"Restablecer nombre remoto","node-slug-hint":"enrutado por slug: {slug}","device-name-label":"Nombre del dispositivo","device-name-hint":"cómo te ven los pares (editable)","local-route-name-label":"Nombre local / ruta","local-route-name-hint":"identificador técnico estable: etiqueta legible + sufijo del nodeId; editable antes de conectar","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","cell-switcher-refreshing":"actualizando celdas…","cell-switcher-empty-active":"no hay celdas activas verificadas","cell-switcher-not-confirmed":"estado sin confirmar","cell-switcher-not-active":"esta celda ya no está activa","cell-switcher-select":"selecciona una celda","cell-switcher-open":"abrir celda","cell-switcher-show-all":"todas","cell-switcher-show-active":"activas","cell-switcher-close":"cerrar selector de celdas","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-unavailable-hint":"La configuración del motor no está disponible en este nodo.","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 El(){const e=Y_(),t=e?e.getItem(V_):null;return Hh.includes(t)?t:vl}function Y0(e){const t=Y_();if(t)try{t.setItem(V_,e)}catch{}typeof window<"u"&&window.dispatchEvent(new Event(Td))}function m(e){const t=El(),n=rl[t]||rl[vl];return Object.prototype.hasOwnProperty.call(n,e)?n[e]:Object.prototype.hasOwnProperty.call(rl[vl],e)?rl[vl][e]:e}function G0(e){return typeof window>"u"?()=>{}:(window.addEventListener(Td,e),()=>window.removeEventListener(Td,e))}const G_=Hh;function $n(){return[E.useSyncExternalStore(G0,El,El),Y0]}function Nl({cell:e,token:t,route:n=[],onConfirm:s,onClose:o}){var P,F;$n();const a=!!(e&&e.active),u=Array.isArray(n)?n.join("/"):"",[h,f]=E.useState([]),[p,v]=E.useState(!1);E.useEffect(()=>{let T=!0;return(async()=>{if(t)try{const q=await _s(t,u?u.split("/"):[]);if(!T)return;if(v(q.provider==="builtin"&&(q.capabilities||[]).includes("edit")),q.provider==="builtin"&&(q.capabilities||[]).includes("definitions")){const B=await Ih(t,u?u.split("/"):[]);if(!T)return;const D=new Map((q.engines||[]).map(U=>[U.id,U]));f((B.engines||[]).map(U=>{var Z,oe,de,fe,J,ee,pe;return{id:U.id,label:U.label||U.id,client:((Z=U.managed)==null?void 0:Z.client)||"",models:[...new Set([...((oe=D.get(U.id))==null?void 0:oe.models)||[],...((de=U.managedInfo)==null?void 0:de.models)||[]])].filter(Boolean),defaultModel:((fe=U.managed)==null?void 0:fe.model)||((J=U.managedInfo)==null?void 0:J.defaultModel)||"",policyDefault:((ee=U.managed)==null?void 0:ee.permissionPolicy)||((pe=U.managed)!=null&&pe.client&&U.managed.client==="claude"?"unsafe":"standard")}}))}}catch{}})(),()=>{T=!1}},[t,u]);const b=(e==null?void 0:e.engine)||((P=h[0])==null?void 0:P.id)||"",w=T=>(e==null?void 0:e.models)&&e.models[T]||"",S=T=>{const q=(e==null?void 0:e.permissionPolicies)&&e.permissionPolicies[T];if(q==="standard"||q==="unsafe")return q;const B=h.find(D=>D.id===T);return B?B.policyDefault:"standard"},[y,x]=E.useState(b),[C,R]=E.useState((e==null?void 0:e.model)||""),k=(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])||"",[$,O]=E.useState(k),[V,Y]=E.useState((e==null?void 0:e.boot)??!0),[z,ne]=E.useState(!1),[H,X]=E.useState(null);E.useEffect(()=>{h.length&&(x(T=>T||b),R(T=>T||w((e==null?void 0:e.engine)||b)||""),O(T=>T==="standard"||T==="unsafe"?T:S((e==null?void 0:e.engine)||b)))},[h.length]);const I=E.useMemo(()=>h.find(T=>T.id===y)||null,[h,y]),A=!!(I&&["claude","codex","codex-vl","agy","kimi"].includes(I.client)),N=(I==null?void 0:I.client)==="shell";function M(T){x(T);const q=h.find(B=>B.id===T);R(w(T)||(q==null?void 0:q.defaultModel)||""),O(S(T))}async function L(T){T.preventDefault(),ne(!0),X(null);try{if(a)await s({action:"down",boot:V});else{const q=$==="standard"||$==="unsafe"?$:(I==null?void 0:I.policyDefault)||"standard";await s({action:"up",...p?{engine:y,model:C||"",...A?{permissionPolicy:q}:(I==null?void 0:I.client)==="pi"?{permissionPolicy:"standard"}:{}}:{},boot:V})}o()}catch(q){X(String(q&&q.message||q)),ne(!1)}}return c.jsx("div",{className:"nc-sheet-overlay nc-launch-overlay",onClick:o,children:c.jsxs("form",{className:"nc-sheet nc-power-sheet nc-launch-sheet",onClick:T=>T.stopPropagation(),onSubmit:L,children:[c.jsxs("div",{className:"nc-sheet-head",children:[c.jsx("b",{children:e==null?void 0:e.cell}),c.jsx("span",{className:"nc-sheet-state",children:m(a?"state-on":"state-off")})]}),a?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-power-config",children:[c.jsx("span",{children:m("engine")}),c.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&c.jsxs("small",{children:[m("model"),": ",e.model]}),c.jsx("small",{children:m("power-on-hint")})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:V,onChange:T=>Y(T.target.checked)}),m("remove-boot")]})]}):c.jsxs(c.Fragment,{children:[p&&h.length>0?c.jsxs("div",{className:"nc-launch-fields",children:[c.jsxs("label",{className:"nc-field",children:[m("engine"),c.jsx("select",{value:y,onChange:T=>M(T.target.value),children:h.map(T=>c.jsx("option",{value:T.id,children:T.label},T.id))})]}),!N&&c.jsxs("label",{className:"nc-field",children:[m("model"),c.jsx("input",{value:C,list:"nc-launch-models",placeholder:m("model-default"),onChange:T=>R(T.target.value)}),c.jsx("datalist",{id:"nc-launch-models",children:((I==null?void 0:I.models)||[]).map(T=>c.jsx("option",{value:T},T))})]}),A?c.jsxs("label",{className:"nc-field",children:[m("permissions"),c.jsxs("select",{value:$,onChange:T=>O(T.target.value),children:[c.jsx("option",{value:"standard",children:m("fleet-standard-permissions")}),c.jsx("option",{value:"unsafe",children:m("fleet-unsafe-permissions")})]})]}):c.jsx("small",{className:"nc-note",children:m("fleet-standard-permissions")}),A&&$==="unsafe"&&c.jsx("small",{className:"nc-err",children:m("fleet-unsafe-warning")}),c.jsx("small",{className:"nc-note",children:m(N?"fleet-shell-launch-help":"launch-engine-help")})]}):c.jsxs("div",{className:"nc-power-config",children:[c.jsx("span",{children:m("engine")}),c.jsx("b",{children:(e==null?void 0:e.engine)||"—"}),(e==null?void 0:e.model)&&c.jsxs("small",{children:[m("model"),": ",e.model]}),c.jsx("small",{children:m("launch-unavailable-hint")})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:V,onChange:T=>Y(T.target.checked)}),m("boot-persist")]})]}),H&&c.jsx("div",{className:"nc-err",children:H}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:o,disabled:z,children:m("cancel")}),c.jsx("button",{type:"submit",className:"nc-btn primary",disabled:z,children:m(a?"power-off":"save-and-start")})]})]})})}const mg=/^[a-z0-9-]{1,32}$/;function Bo(e,t){const n=Array.isArray(e)?e:[];return n.length?`${n.map(encodeURIComponent).join("/")}:${t}`:String(t)}function X0(e,t,n){const s={};for(const o of Array.isArray(t)?t:[]){const a=Array.isArray(o==null?void 0:o.route)?o.route:typeof(o==null?void 0:o.name)=="string"?[o.name]:[];if(!a.length)continue;const u=a.join("/"),h=o.status==="up"||o.tunnel&&o.tunnel.status==="up",f=o.status==="passive"||o.tunnel&&o.tunnel.status==="passive";!h&&!f&&(s[u]=e&&e[u]||n)}return s}function gg(e,t,n){return!e||!Array.isArray(e.cells)?[]:e.cells.map(s=>({...s,route:t,key:`${n}:${s.tmuxSession||s.cell}`}))}function vg({nodes:e,topology:t,remote:n,down:s,fleet:o,aliases:a}={}){var p,v,b,w;const u=[],h=new Set,f=new Set;for(const S of Array.isArray(e)?e:[]){if(!S||typeof S.name!="string"||!mg.test(S.name)||S.direction==="inbound"&&S.shared!==!0)continue;const y=[S.name],x=S.name;h.add(x);const C=((p=S.tunnel)==null?void 0:p.status)||"unknown",R=C==="up",k={name:S.name,label:S.label||S.name,originalLabel:S.label||S.name,alias:null,route:y,direct:!0,instanceId:S.nodeId||null,shared:S.shared===!0,tunnelStatus:C,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:S.health||null,direction:S.direction||"outbound",roles:S.roles||null,rolesKnown:S.rolesKnown===!0};if(S.nodeId&&f.add(S.nodeId),!S.nodeId&&S.paired===!1){u.push({...k,status:"needs-repair",downSince:s&&s[x]||null});continue}if(((v=S.health)==null?void 0:v.auth)==="failed"||C==="degraded"&&((b=S.health)==null?void 0:b.status)==="degraded"){u.push({...k,status:"needs-repair",downSince:s&&s[x]||null});continue}if(C==="passive"||((w=S.health)==null?void 0:w.status)==="passive"){u.push({...k,status:"passive",downSince:null});continue}if(!R){u.push({...k,status:"down",downSince:s&&s[x]||null});continue}const $=n&&(n[x]||n[S.name])||null,O=o&&(o[x]||o[S.name]),V=!!($&&!$.error&&Array.isArray($.sessions)),Y=!!(O&&O.available===!0&&Array.isArray(O.cells));if(!V&&!Y){u.push({...k,status:"unreachable"});continue}const z=(V?$.sessions:[]).filter(X=>X&&typeof X.name=="string"&&X.name).map(X=>({...X,node:x,route:y,key:`${x}:${X.name}`})),ne=gg(O,y,x),H=new Set(ne.map(X=>X.tmuxSession).filter(Boolean));u.push({...k,status:"up",sessions:z,cells:ne,unmanaged:z.filter(X=>!H.has(X.name)),fleetAvailable:!!(O&&O.available),capabilities:O&&O.capabilities||[],engines:O&&O.engines||[],fleetProvider:O&&O.provider||null,sessionsAvailable:V,inventoryPartial:!V})}for(const S of Array.isArray(t)?t:[]){if(!S||!Array.isArray(S.route)||S.route.length<1||S.route.some(H=>!mg.test(H)))continue;const y=S.route.join("/");if(h.has(y)||S.instanceId&&f.has(S.instanceId))continue;S.instanceId&&f.add(S.instanceId);const x=S.label||S.route.join(" › "),C=S.instanceId&&a&&typeof a[S.instanceId]=="string"?a[S.instanceId]:null,R={name:S.name,label:C||x,originalLabel:x,alias:C,route:[...S.route],direct:!1,instanceId:S.instanceId||null,shared:!0,tunnelStatus:null,sessions:[],cells:[],unmanaged:[],fleetAvailable:!1,capabilities:[],engines:[],health:S.health||null,lastSeen:S.lastSeen||null};if(S.stale){u.push({...R,status:"offline",downSince:s&&s[y]||S.lastSeen||null});continue}const k=n&&n[y]||null,$=o&&o[y],O=!!(k&&!k.error&&Array.isArray(k.sessions)),V=!!($&&$.available===!0&&Array.isArray($.cells));if(!O&&!V){u.push({...R,status:"unreachable",downSince:s&&s[y]||null});continue}const Y=(O?k.sessions:[]).filter(H=>H&&typeof H.name=="string"&&H.name).map(H=>({...H,node:y,route:S.route,key:`${y}:${H.name}`})),z=gg($,S.route,y),ne=new Set(z.map(H=>H.tmuxSession).filter(Boolean));u.push({...R,status:"up",sessions:Y,cells:z,unmanaged:Y.filter(H=>!ne.has(H.name)),fleetAvailable:!!($&&$.available),capabilities:$&&$.capabilities||[],engines:$&&$.engines||[],fleetProvider:$&&$.provider||null,lastSeen:S.lastSeen||null,sessionsAvailable:O,inventoryPartial:!O})}return u.sort((S,y)=>S.label.localeCompare(y.label))}const J0=4e3;function Wh(e,t=!0,n=0){const[s,o]=E.useState([]),a=E.useRef({});return E.useEffect(()=>{if(!t||!e){o([]);return}let u=!0;async function h(){var R;let p=[],v=[],b={};if(await Promise.all([d0(e).then(k=>{p=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{}),f0(e).then(k=>{v=Array.isArray(k.nodes)?k.nodes:[]}).catch(()=>{}),g0(e).then(k=>{b=k&&typeof k.aliasesByInstanceId=="object"?k.aliasesByInstanceId:{}}).catch(()=>{})]),!u)return;const w={},S={},y=new Set(p.map(k=>k.name)),x=[];for(const k of p)((R=k.tunnel)==null?void 0:R.status)==="up"&&(k.nodeId||k.paired!==!1)&&(k.direction!=="inbound"||k.shared===!0)&&x.push([k.name]);for(const k of v)!k.stale&&Array.isArray(k.route)&&!(k.route.length===1&&y.has(k.route[0]))&&x.push(k.route);if(await Promise.all(x.map(async k=>{const $=k.join("/");try{w[$]=await zh(e,k)}catch{w[$]={error:"unreachable"}}try{S[$]=await _s(e,k)}catch{S[$]={available:!1}}})),!u)return;const C=vg({nodes:p,topology:v,remote:w,fleet:S,aliases:b,down:a.current});a.current=X0(a.current,C,Math.floor(Date.now()/1e3)),o(vg({nodes:p,topology:v,remote:w,fleet:S,aliases:b,down:a.current}))}h();const f=setInterval(h,J0);return()=>{u=!1,clearInterval(f)}},[e,t,n]),s}const _g=52,yg=14;function Di({position:e,itemKey:t,label:n,onMove:s,onStep:o,canMove:a=()=>!0,scope:u="roster"}){const h=E.useRef(null),f=E.useRef(0),[p,v]=E.useState(!1),b=()=>{var R,k,$,O;const C=h.current;(k=(R=C==null?void 0:C.over)==null?void 0:R.classList)==null||k.remove("nc-roster-over"),(O=($=C==null?void 0:C.source)==null?void 0:$.classList)==null||O.remove("nc-roster-dragging"),f.current&&cancelAnimationFrame(f.current),f.current=0},w=(C=!1)=>{const R=h.current;if(!R)return;const k=R.target;b(),h.current=null,v(!1);try{R.handle.releasePointerCapture(R.pointerId)}catch{}C&&k&&k!==t&&a(t,k)&&s(t,k)},S=(C,R)=>{var ne,H,X,I,A,N,M,L,P;const k=h.current;if(!k)return;k.x=C,k.y=R;const $=u==="node"?"[data-node-order-key]":"[data-roster-key][data-position]",O=(H=(ne=document.elementFromPoint(C,R))==null?void 0:ne.closest)==null?void 0:H.call(ne,$),V=u==="node"?(X=O==null?void 0:O.dataset)==null?void 0:X.nodeOrderKey:(I=O==null?void 0:O.dataset)==null?void 0:I.rosterKey,z=(u==="node"||((A=O==null?void 0:O.dataset)==null?void 0:A.position)===e)&&V&&V!==t&&a(t,V);k.over!==(z?O:null)&&((M=(N=k.over)==null?void 0:N.classList)==null||M.remove("nc-roster-over"),k.over=z?O:null,(P=(L=k.over)==null?void 0:L.classList)==null||P.add("nc-roster-over")),k.target=z?V:null},y=()=>{const C=h.current;if(!C){f.current=0;return}const R=C.container;if(R){const k=R.getBoundingClientRect(),$=C.y<k.top+_g?-yg:C.y>k.bottom-_g?yg:0;$&&(R.scrollTop+=$,S(C.x,C.y))}f.current=requestAnimationFrame(y)};E.useEffect(()=>{const C=k=>{k.key==="Escape"&&h.current&&(k.preventDefault(),w(!1))},R=()=>w(!1);return window.addEventListener("keydown",C),window.addEventListener("blur",R),()=>{window.removeEventListener("keydown",C),window.removeEventListener("blur",R),b(),h.current=null}},[t,e,u]);const x=C=>{var O;if(C.pointerType==="mouse"&&C.button!==0)return;C.preventDefault(),C.stopPropagation(),C.currentTarget.focus({preventScroll:!0});const R=u==="node"?"[data-node-order-key]":"[data-roster-key][data-position]",k=C.currentTarget.closest(R),$=C.currentTarget.closest(".nc-side-scroll, .nc-home-scroll, .nc-cell-switcher-list");h.current={pointerId:C.pointerId,handle:C.currentTarget,source:k,container:$,target:null,over:null,x:C.clientX,y:C.clientY},(O=k==null?void 0:k.classList)==null||O.add("nc-roster-dragging");try{C.currentTarget.setPointerCapture(C.pointerId)}catch{}v(!0),f.current=requestAnimationFrame(y)};return c.jsx("button",{type:"button",className:`nc-roster-handle${p?" active":""}`,"aria-label":`${m("reorder")} ${n}`,"aria-keyshortcuts":"ArrowUp ArrowDown",title:m("reorder-help"),onClick:C=>{C.preventDefault(),C.stopPropagation()},onDragStart:C=>C.preventDefault(),onKeyDown:C=>{C.key!=="ArrowUp"&&C.key!=="ArrowDown"||(C.preventDefault(),C.stopPropagation(),o(C.key==="ArrowUp"?-1:1))},onPointerDown:x,onPointerMove:C=>{!h.current||C.pointerId!==h.current.pointerId||(C.preventDefault(),C.stopPropagation(),S(C.clientX,C.clientY))},onPointerUp:C=>{!h.current||C.pointerId!==h.current.pointerId||(C.preventDefault(),C.stopPropagation(),w(!0))},onPointerCancel:()=>w(!1),onLostPointerCapture:()=>{h.current&&w(!1)},children:"↕"})}const Uh="nc_pins";function Q0(){try{const e=JSON.parse(localStorage.getItem(Uh));return Array.isArray(e)?e:[]}catch{return[]}}function Z0(e,t){const n=e.includes(t)?e.filter(s=>s!==t):[...e,t];try{localStorage.setItem(Uh,JSON.stringify(n))}catch{}return n}function e1(e,t,n){if(!e.includes(t)||!e.includes(n)||t===n)return e;const s=[...e],o=s.indexOf(t),a=s.indexOf(n);s.splice(o,1);const u=s.indexOf(n);s.splice(o<a?u+1:u,0,t);try{localStorage.setItem(Uh,JSON.stringify(s))}catch{}return s}function t1(e,t,n){const s=e.indexOf(t);return[s===-1?1e9:s,-(n||0)]}function n1(e,t){return e[0]-t[0]||e[1]-t[1]}function Kh(){const[e,t]=E.useState(Q0),[n,s]=E.useState(K0),[o,a]=E.useState(H0),u=w=>t(S=>Z0(S,w)),h=w=>fg(n,w),f=(w,S)=>s(y=>{const x={...y,[w]:{...fg(y,w),...S}};return q0(x)}),p=(w,S)=>e.includes(w)===e.includes(S);function v(w,S,y,x){const C=e.includes(S),R=e.includes(y);if(C===R){if(C){t(k=>e1(k,S,y));return}a(k=>{var V;const $=((V=x.find(Y=>Y.key===S))==null?void 0:V.technical)===!0,O=ps(x,e,$?"technical":"all",Ai(k,w)).map(Y=>Y.key);return W0(U0(k,w,S,y,O))})}}function b(w,S,y,x){var V;const C=((V=x.find(Y=>Y.key===S))==null?void 0:V.technical)===!0,R=e.includes(S),k=ps(x,e,C?"technical":"all",Ai(o,w)).map(Y=>Y.key).filter(Y=>e.includes(Y)===R),$=k.indexOf(S),O=k[$+y];$>=0&&O&&v(w,S,O,x)}return{pins:e,views:n,orders:o,togglePin:u,viewFor:h,updateView:f,canMoveRoster:p,moveRoster:v,stepRoster:b}}const X_="nc_node_order_v1",i1=/^[a-f0-9]{16,64}$/;function zs(e){if(i1.test(String((e==null?void 0:e.instanceId)||"")))return`id:${e.instanceId}`;const t=Array.isArray(e==null?void 0:e.route)?e.route.filter(n=>typeof n=="string"&&n):[];return t.length?`route:${t.map(encodeURIComponent).join("/")}`:typeof(e==null?void 0:e.name)=="string"&&e.name?`name:${encodeURIComponent(e.name)}`:""}function wg(e=globalThis.localStorage){try{const t=JSON.parse(e.getItem(X_));return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"&&n&&n.length<=192))].slice(0,128):[]}catch{return[]}}function s1(e,t=globalThis.localStorage){try{t.setItem(X_,JSON.stringify(e))}catch{}return e}function Sg(e=[],t=[]){const n=new Map(t.map((s,o)=>[s,o]));return e.map((s,o)=>({group:s,index:o})).sort((s,o)=>{const a=n.has(zs(s.group))?n.get(zs(s.group)):Number.MAX_SAFE_INTEGER,u=n.has(zs(o.group))?n.get(zs(o.group)):Number.MAX_SAFE_INTEGER;return a-u||s.index-o.index}).map(({group:s})=>s)}function r1(e,t,n,s=[]){if(!t||!n||t===n)return e;const o=s.map(zs).filter(Boolean);if(!o.includes(t)||!o.includes(n))return e;const a=[...e.filter(p=>o.includes(p)),...o.filter(p=>!e.includes(p))],u=a.indexOf(t),h=a.indexOf(n);a.splice(u,1);const f=a.indexOf(n);return a.splice(u<h?f+1:f,0,t),a}const Dd="nexuscrew-node-preferences";function o1(){try{window.dispatchEvent(new Event(Dd))}catch{}}function J_(){const[e,t]=E.useState(wg);E.useEffect(()=>{const a=()=>t(wg());return window.addEventListener("storage",a),window.addEventListener(Dd,a),()=>{window.removeEventListener("storage",a),window.removeEventListener(Dd,a)}},[]);const n=a=>Sg(a,e),s=(a,u,h)=>t(f=>{const p=r1(f,a,u,h);return s1(p),o1(),p});return{order:e,groupsFor:n,moveNode:s,stepNode:(a,u,h)=>{const f=Sg(h,e).map(zs),p=f.indexOf(a),v=f[p+u];p>=0&&v&&s(a,v,h)},nodeKey:zs}}function Nr(e,t=Math.floor(Date.now()/1e3)){if(!e)return"";const n=t-e;return n<0||n<60?"ora":n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}g`}function xr(e){return e.status==="passive"?m("node-passive"):e.status==="down"?e.downSince?m("tunnel-down-since").replace("{t}",Nr(e.downSince)):m("tunnel-down"):e.status==="unreachable"?m("node-unreachable"):e.status==="offline"?e.lastSeen?m("node-offline-seen").replace("{t}",Nr(e.lastSeen)):m("node-offline"):e.status==="needs-repair"?m("node-needs-repair"):""}function Q_(e,{passive:t=null}={}){return e?e.status==="passive"?t:e.status==="healthy"?"on":"warn":null}function Rl(e){return e&&(e.detail||e.status)||""}function jl(e,t,n=globalThis.localStorage){if(!(e!=null&&e.outbox)||e.outbox.count<1)return!1;const s=Number(n.getItem(B_(t))||0);return e.outbox.latest>s}function qh(e,t={}){const n=e||{};if(!n.tmux){const s=`${n.engine||""}${n.key?`·${n.key}`:""}`,o=[s,n.model&&n.model!==s?n.model:""].filter(Boolean).join(" · ");return{working:!1,subtitle:String(o||m("cell-off")).trim()}}if(t.working===!0){const s=m("cell-working"),o=String(t.status||"").trim();return{working:!0,subtitle:!o||/^working(?:\.{3}|…)?$/i.test(o)?s:`${s} · ${o}`}}return t.working===!1?{working:!1,subtitle:m("cell-idle")}:{working:!1,subtitle:String(t.preview||n.preview||m("cell-on")).trim()}}function Z_(e,t){return[...new Set([e.engine,e.model,e.key,t.preview,e.preview,t.status].filter(Boolean).map(String))].join(" ")}function Vh(e,t,n,s=globalThis.localStorage){return[...(Array.isArray(e)?e:[]).map(o=>{const a=n.get(o.tmuxSession)||{},u=Bo([],o.tmuxSession),h=qh(o,a);return{type:"cell",value:o,key:u,label:o.cell,live:!!o.tmux,fresh:jl(a,u,s),activity:a.activity||0,working:h.working,subtitle:h.subtitle,searchText:Z_(o,a)}}),...(Array.isArray(t)?t:[]).map(o=>{const a=Bo([],o.name);return{type:"session",value:o,key:a,label:o.name,live:!0,technical:o.technical===!0,fresh:jl(o,a,s),activity:o.activity||0,searchText:`${o.preview||""} ${o.cmd||""}`}})]}function Pl(e,t=globalThis.localStorage){const n=e||{},s=Array.isArray(n.route)?n.route:[],o=new Map((n.sessions||[]).map(u=>[u.name,u])),a=[...(n.cells||[]).map(u=>{const h=o.get(u.tmuxSession)||{},f=Bo(s,u.tmuxSession||u.cell),p=qh(u,h);return{type:"cell",value:u,key:f,label:u.cell,live:!!u.tmux,fresh:jl(h,f,t),activity:h.activity||u.activity||0,working:p.working,subtitle:p.subtitle,searchText:Z_(u,h)}}),...(n.unmanaged||[]).map(u=>{const h=Bo(s,u.name);return{type:"session",value:u,key:h,label:u.name,live:!0,technical:u.technical===!0,fresh:jl(u,h,t),activity:u.activity||0,searchText:`${u.preview||""} ${u.cmd||""}`}})];return{route:s,rawItems:a}}const Yh=9,Ll=.2,a1=/^[a-z0-9-]{1,32}(?:\/[a-z0-9-]{1,32}){0,3}$/,Rr=/^[a-f0-9]{16,64}$/,Md=e=>a1.test(e)&&new Set(e.split("/")).size===e.split("/").length;function vs(e){if(typeof e=="string"&&e){const t=e.indexOf(":");if(t<0)return{session:e};const n=e.slice(0,t),s=e.slice(t+1);return!Md(n)||!s?null:{session:s,node:n}}if(e&&typeof e=="object"&&typeof e.session=="string"&&e.session){const t=e.ownerId===void 0?void 0:typeof e.ownerId=="string"&&Rr.test(e.ownerId)?e.ownerId:null;return t===null?null:e.node===void 0||e.node===null||e.node===""?{session:e.session,...t?{ownerId:t}:{}}:typeof e.node=="string"&&Md(e.node)?{session:e.session,node:e.node,...t?{ownerId:t}:{}}:null}return null}function On(e){const t=vs(e);return t?t.node?`${t.node}:${t.session}`:t.session:""}const ey=9,ty=24,Wo=11,l1=e=>{const t=Number(e);return t>=ey&&t<=ty?t:Wo};function kr(){return{columns:[]}}function wi(e){return e.columns.flatMap(t=>t.tiles.map(n=>On(n)))}function c1(e){const t=[],n=Math.max(0,...e.columns.map(s=>s.tiles.length));for(let s=0;s<n;s+=1)for(const o of e.columns)o.tiles[s]&&t.push(On(o.tiles[s]));return t}const Dr=e=>({columns:e.columns.map(t=>({width:t.width,tiles:t.tiles.map(n=>({...n}))}))});function Gh(e,t,n,s){const o=vs(t);if(!o||wi(e).includes(On(o))||wi(e).length>=Yh)return e;const a=Dr(e),u={session:o.session,height:1,fontSize:Wo,...s||{}};if(o.node&&(u.node=o.node),o.ownerId&&(u.ownerId=o.ownerId),n==="end")return a.columns.push({width:1,tiles:[u]}),a;if(n&&typeof n.col=="number"&&typeof n.row=="number"&&a.columns[n.col])return a.columns[n.col].tiles.splice(n.row,0,u),a;if(n&&typeof n.col=="number"){const h=Math.max(0,Math.min(a.columns.length,n.col));return a.columns.splice(h,0,{width:1,tiles:[u]}),a}return a.columns.push({width:1,tiles:[u]}),a}function ny(e,t){const n=On(t);if(!n||wi(e).includes(n)||wi(e).length>=Yh)return e;const s=wi(e).length+1,o=Math.ceil(Math.sqrt(s));if(e.columns.length>=o){let v=0;for(let b=1;b<e.columns.length;b+=1)e.columns[b].tiles.length<e.columns[v].tiles.length&&(v=b);return Gh(e,t,{col:v,row:e.columns[v].tiles.length})}const a=[...c1(e),n],u=new Map(e.columns.flatMap(v=>v.tiles.map(b=>[On(b),b]))),h=vs(t),f=e.columns.length?e.columns.reduce((v,b)=>v+(Number(b.width)||1),0)/e.columns.length:1,p=Array.from({length:o},(v,b)=>{var w;return{width:((w=e.columns[b])==null?void 0:w.width)||f,tiles:[]}});return a.forEach((v,b)=>{const w=vs(v);if(!w)return;const S=u.get(v)||(v===n?h:{})||{},y={session:w.session,height:S.height||1,fontSize:S.fontSize||Wo};w.node&&(y.node=w.node),S.ownerId&&(y.ownerId=S.ownerId),S.unavailable===!0&&(y.unavailable=!0),p[b%o].tiles.push(y)}),{columns:p.filter(v=>v.tiles.length)}}function Tl(e,t){const n=On(t),s=Dr(e);for(const o of s.columns)o.tiles=o.tiles.filter(a=>On(a)!==n);return s.columns=s.columns.filter(o=>o.tiles.length>0),s}function u1(e,t,n){const s=On(t);if(!wi(e).includes(s))return e;const o=e.columns.flatMap(a=>a.tiles).find(a=>On(a)===s);return Gh(Tl(e,s),s,n,{fontSize:o.fontSize,height:o.height,...o.ownerId?{ownerId:o.ownerId}:{},...o.unavailable===!0?{unavailable:!0}:{}})}function d1(e,t){if(!(t instanceof Map)||t.size===0)return e;let n=!1;const s=Dr(e);for(const o of s.columns)for(const a of o.tiles){const u=t.get(On(a));if(!u)continue;const h=vs(u);h&&(a.session=h.session,h.node?a.node=h.node:delete a.node,h.ownerId&&(a.ownerId=h.ownerId),n=!0)}return n?$s(s):e}function h1(e,t,n){const s=Dr(e);return s.columns[t]&&(s.columns[t].width=Math.max(Ll,Number(n)||1)),s}function f1(e,t,n,s){const o=Dr(e),a=o.columns[t]&&o.columns[t].tiles[n];return a&&(a.height=Math.max(Ll,Number(s)||1)),o}function p1(e,t,n,s){if(!(e.columns[t]&&e.columns[t].tiles[n]))return e;const a=Dr(e),u=a.columns[t].tiles[n],h=Number(u.fontSize)||Wo;return u.fontSize=Math.max(ey,Math.min(ty,h+(Number(s)||0))),a}function m1(e,t,n,s){const o=e.columns[t];if(!o||!o.tiles[n])return null;switch(s){case"left":return{col:t};case"right":return{col:t+1};case"top":return{col:t,row:n};case"bottom":return{col:t,row:n+1};default:return null}}function bg(e){for(const t of[.25,.5,.75])if(Math.abs(e-t)<=.03)return t;return e}function $s(e){if(!e||!Array.isArray(e.columns))return kr();const t=e.columns.map(s=>({width:Math.max(Ll,Number(s&&s.width)||1),tiles:(Array.isArray(s&&s.tiles)?s.tiles:[]).filter(o=>o&&typeof o.session=="string"&&o.session).filter(o=>o.node==null||typeof o.node=="string"&&Md(o.node)).filter(o=>o.ownerId==null||typeof o.ownerId=="string"&&Rr.test(o.ownerId)).map(o=>{const a={session:o.session,height:Math.max(Ll,Number(o.height)||1),fontSize:l1(o.fontSize)};return o.node!=null&&(a.node=o.node),o.ownerId!=null&&(a.ownerId=o.ownerId),o.unavailable===!0&&(a.unavailable=!0),a})})).filter(s=>s.tiles.length>0),n=new Set;for(const s of t)s.tiles=s.tiles.filter(o=>!n.has(On(o))&&n.add(On(o))&&n.size<=Yh);return{columns:t.filter(s=>s.tiles.length>0)}}const iy=/^[a-z0-9-]{1,32}$/,g1=/^[A-Za-z0-9._-]{1,32}$/,v1=/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/,_1=320;function Ad(e){return typeof e=="string"&&iy.test(e)}const y1=64;function jr(e){if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&t.length<=y1&&!/[\x00-\x1f\x7f]/.test(t)}function ms(e){return String(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32).replace(/-+$/g,"")||"node"}function sy(e){if(typeof e!="string"||!e||e.length>_1||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:g1.test(e.slice(0,t))&&v1.test(e.slice(t+1))}function xg(e){if(e===""||e===null||e===void 0)return null;const t=String(e).trim();if(!/^[0-9]{1,5}$/.test(t))return;const n=Number(t);return Number.isInteger(n)&&n>=1&&n<=65535?n:void 0}function kg({name:e,ssh:t,sshPort:n,remotePort:s}={}){const o=typeof e=="string"?e.trim():e,a=typeof t=="string"?t.trim():t;if(!Ad(o))return{ok:!1,error:"err-node-name"};if(!sy(a))return{ok:!1,error:"err-ssh"};const u=xg(n);if(u===void 0)return{ok:!1,error:"err-ssh-port"};const h=xg(s);if(h===void 0)return{ok:!1,error:"err-node-port"};const f={name:o,ssh:a};return u!==null&&(f.sshPort=u),h!==null&&(f.remotePort=h),{ok:!0,value:f}}function w1(e,t){if(!e||!t||t<e)return null;const n=Math.floor((t-e)/1e3);return n<60?"ora":n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:`${Math.floor(n/86400)}g`}function Cg(e,t){const n=!!(e&&e.status==="up"),s=!!(e&&e.status==="passive");return{up:n,...s?{passive:!0}:{},label:n?"tunnel-up":s?"node-passive":"tunnel-down",since:n?w1(e.since,t):null}}const S1=new Set(["v","instanceId","port","label","invite"]),b1=new Set(["v","instanceId","port","label","invite","name","ssh","sshPort"]);function x1(e){const t=String(e).replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),s=typeof atob=="function"?atob(n):Buffer.from(n,"base64").toString("binary"),o=Uint8Array.from(s,a=>a.charCodeAt(0));return typeof TextDecoder<"u"?new TextDecoder().decode(o):Buffer.from(o).toString("utf8")}function k1(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 n;try{n=JSON.parse(x1(t))}catch{return{ok:!1}}if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1};const s=n.v===1?S1:n.v===2?b1:null;if(!s)return{ok:!1};for(const u of Object.keys(n))if(!s.has(u))return{ok:!1};if(!/^[a-f0-9]{16,64}$/.test(String(n.instanceId)))return{ok:!1};const o=Number(n.port);if(!Number.isInteger(o)||o<1||o>65535)return{ok:!1};if(typeof n.label!="string")return{ok:!1};if(typeof n.invite!="string"||!n.invite)return{ok:!1};const a={ok:!0,version:n.v,label:n.label,invite:n.invite,instanceId:n.instanceId,port:o};if(n.v===2){if(n.name!==void 0){if(typeof n.name!="string"||!iy.test(n.name))return{ok:!1};a.name=n.name}if(n.ssh!==void 0){if(!sy(n.ssh))return{ok:!1};a.ssh=String(n.ssh).trim()}if(n.sshPort!==void 0){const u=Number(n.sshPort);if(!Number.isInteger(u)||u<1||u>65535)return{ok:!1};a.sshPort=u}}return a}function C1(e,t,n=new Set){if(!t||!t.ok)return e;const s={...e},o=(a,u)=>{u==null||u===""||n.has(a)||(s[a]=u)};return o("label",t.label),t.version===2&&(o("name",t.name||(t.ssh?ms(t.label):"")),o("ssh",t.ssh),t.sshPort!==void 0&&o("sshPort",String(t.sshPort))),s}let Id={sessions:[],cells:[],nodeGroups:[],localNodeId:"",localFresh:!1,refreshedAt:0};function Eg(){return Id}function ry(e={}){return Id={sessions:Array.isArray(e.sessions)?e.sessions:[],cells:Array.isArray(e.cells)?e.cells:[],nodeGroups:Array.isArray(e.nodeGroups)?e.nodeGroups:[],localNodeId:typeof e.localNodeId=="string"?e.localNodeId:"",localFresh:e.localFresh===!0,refreshedAt:Number.isFinite(e.refreshedAt)?e.refreshedAt:0},Id}const vr=(e,t=[])=>`${t.length?t.join("/"):"local"}:${e}`;function E1({onPick:e,token:t,onSettings:n}){const[s,o]=$n(),a=Wh(t),[u,h]=E.useState(null),[f,p]=E.useState(null),[v,b]=E.useState(""),[w,S]=E.useState(""),[y,x]=E.useState({bind:"127.0.0.1",port:""}),[C,R]=E.useState(""),[k,$]=E.useState([]),[O,V]=E.useState([]),[Y,z]=E.useState({}),[ne,H]=E.useState(new Set),[X,I]=E.useState(null),[A,N]=E.useState(null),{pins:M,orders:L,togglePin:P,viewFor:F,updateView:T,canMoveRoster:q,moveRoster:B,stepRoster:D}=Kh(),{groupsFor:U,moveNode:Z,stepNode:oe,nodeKey:de}=J_(),fe=U(a);E.useEffect(()=>{ry({sessions:u||[],cells:k,nodeGroups:a,localNodeId:C})},[u,k,a,C]),E.useEffect(()=>{const W=new Map;for(const se of k)W.set(vr(se.cell),!!se.boot);for(const se of a){const ve=se.route||[se.name];for(const ke of se.cells||[])W.set(vr(ke.cell,ve),!!ke.boot)}z(se=>{let ve=!1;const ke={...se};for(const[Re,we]of Object.entries(se))W.has(Re)&&W.get(Re)===we&&(delete ke[Re],ve=!0);return ve?ke:se})},[k,a]);async function J(){try{const se=await(await Vt("/api/sessions",t)).json();se.error?(p(se.error),h([])):(p(null),h(se.sessions||[]))}catch(W){p(String(W)),h([])}try{const W=await _s(t);$(W.available?W.cells||[]:[]),V(W.available?W.capabilities||[]:[])}catch{$([]),V([])}}E.useEffect(()=>{J(),Vt("/api/config",t).then(se=>se.json()).then(se=>{S(se.version||""),x({bind:se.bind||"127.0.0.1",port:se.port||""}),R(Rr.test(String(se.instanceId||""))?se.instanceId:"")}).catch(()=>{});const W=setInterval(J,4e3);return()=>clearInterval(W)},[]);async function ee(){if(!y.port)return;const W=`http://${y.bind}:${y.port}/#token=${t}`;try{await navigator.clipboard.writeText(W)}catch{}}function pe(W,se,ve){const ke=vr(W,se);z(Re=>({...Re,[ke]:!!ve}))}function Se(W,se=[]){const ve=vr(W.cell,se);return Object.prototype.hasOwnProperty.call(Y,ve)?Y[ve]:!!W.boot}async function Ze(W,se,ve=[]){W.stopPropagation();const ke=vr(se.cell,ve),Re=!Se(se,ve);pe(se.cell,ve,Re),H(we=>new Set(we).add(ke));try{await O_(t,{cell:se.cell,enabled:Re},ve),ve.length||$(we=>we.map(je=>je.cell===se.cell?{...je,boot:Re}:je))}catch(we){z(je=>{const st={...je};return delete st[ke],st}),p(String((we==null?void 0:we.message)||we))}finally{H(we=>{const je=new Set(we);return je.delete(ke),je})}}async function $e(W){if(!X)return;const{cell:se}=X,ve=Array.isArray(X.route)?X.route:[];W.action==="up"?(await Ah(t,{cell:se,boot:!!W.boot,...W.engine?{engine:W.engine}:{},...W.model!==void 0?{model:W.model}:{},...W.permissionPolicy?{permissionPolicy:W.permissionPolicy}:{}},ve),pe(se,ve,!!W.boot)):(await Cl(t,{cell:se,boot:!!W.boot},ve),W.boot&&pe(se,ve,!1)),J()}async function He(W,se=[]){try{await Bh(t,W,se)}catch{return}J()}async function vt(W,se,ve=[]){try{await $_(t,W,se,ve)}catch{return}J()}async function Xe(W){if(!(!(W!=null&&W.direct)||A)){N(W.name);try{await $h(t,W.name,W.tunnelStatus==="up"?"down":"up")}catch{}N(null)}}async function St(W){if(!(W!=null&&W.direct))return;const se=window.prompt(m("rename-node-prompt"),W.label||W.name);if(se===null)return;const ve=String(se).trim();if(!jr(ve)){window.alert(m("rename-node-invalid"));return}try{await W_(t,W.name,ve)}catch(ke){window.alert(String((ke==null?void 0:ke.message)||ke))}}const Et=E.useMemo(()=>new Map((u||[]).map(W=>[W.name,W])),[u]),rt=E.useMemo(()=>new Set(k.map(W=>W.tmuxSession)),[k]),ct=E.useMemo(()=>(u||[]).filter(W=>!rt.has(W.name)),[u,rt]),ot=E.useMemo(()=>Vh(k,ct,Et),[k,ct,Et]),ut=F("local"),dt=E.useMemo(()=>ps(ot,M,ut.filter,Ai(L,"local")).filter(W=>pg(W,v)),[ot,M,ut.filter,v,L]),le=fe.reduce((W,se)=>W+(se.cells||[]).length+(se.unmanaged||[]).filter(ve=>!ve.technical).length,0),xe=ps(ot,M,"all",Ai(L,"local")).length+le,ze=ot.filter(W=>W.live).length+fe.reduce((W,se)=>W+Pl(se).rawItems.filter(ve=>ve.live).length,0),Ie=(u||[]).filter(W=>W.attached).length+fe.reduce((W,se)=>W+(se.sessions||[]).filter(ve=>ve.attached).length,0),ue=Math.min(Ie,ze),G=y.port?`${y.bind}:${y.port}`:y.bind;function ie(W,se=null,ve=ot){var _n,bt;const ke=Array.isArray(se==null?void 0:se.route)?se.route:[],Re=ke.join("/"),we=Re||"local",je=ke.length?se==null?void 0:se.instanceId:C,st=(Ye,Gt)=>e({session:Ye,...Re?{node:Re}:{},...Rr.test(String(je||""))?{ownerId:je}:{},...typeof Gt=="string"&&Gt?{cellName:Gt}:{}}),It=q;if(W.type==="cell"){const Ye=W.value,Gt=ke.length?((se==null?void 0:se.sessions)||[]).find(pt=>pt.name===Ye.tmuxSession):Et.get(Ye.tmuxSession),Hn=Ye.degraded?m("cell-degraded"):W.working?W.subtitle:Ye.tmux?m("cell-idle"):m("cell-off"),li=ke.length===0||((se==null?void 0:se.capabilities)||[]).includes(Ye.active?"down":"up"),he=ke.length===0?O.includes("boot"):((se==null?void 0:se.capabilities)||[]).includes("boot"),Ne=Se(Ye,ke),Ke=vr(Ye.cell,ke),Nt=`${m(Ne?"boot-disable":"boot-enable")} ${Ye.cell}`;return c.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,"data-position":we,children:[c.jsx(Di,{position:we,itemKey:W.key,label:Ye.cell,canMove:It,onMove:(pt,Wn)=>B(we,pt,Wn,ve),onStep:pt=>D(we,W.key,pt,ve)}),c.jsxs("button",{className:"nc-mcard-main",onClick:()=>Ye.tmux&&st(Ye.tmuxSession,Ye.cell),title:Hn,"aria-label":`${Ye.cell}, ${Hn}`,children:[c.jsx("span",{className:`dot ${Ye.degraded?"warn":Ye.tmux?`on${W.working?" working":""}`:""}`}),c.jsxs("span",{className:"nc-mcard-text",children:[c.jsx("b",{children:Ye.cell}),c.jsx("small",{title:W.subtitle,children:W.subtitle})]})]}),W.activity?c.jsx("span",{className:"nc-rel",children:Nr(W.activity)}):null,W.fresh&&((_n=Gt==null?void 0:Gt.outbox)==null?void 0:_n.count)>0&&c.jsx("span",{className:"nc-badge",title:m("new-files-outbox"),children:Gt.outbox.count}),c.jsx("button",{className:`nc-act pin${M.includes(W.key)?" on":""}`,"aria-label":`${m("pin")} ${Ye.cell}`,title:m("pin"),onClick:()=>P(W.key),children:M.includes(W.key)?"★":"☆"}),he&&c.jsx("button",{className:`nc-act boot${Ne?" on":""}`,disabled:ne.has(Ke),onClick:pt=>Ze(pt,Ye,ke),title:Nt,"aria-label":Nt,children:c.jsx(it,{name:"boot",size:16})}),li&&c.jsx("button",{className:`nc-act power${Ye.tmux?" on":""}${Ye.degraded?" warn":""}`,onClick:()=>I(ke.length?{...Ye,boot:Ne,route:ke,availableEngines:(se==null?void 0:se.engines)||[]}:{...Ye,boot:Ne}),title:Ye.active?m("power-off"):m("power-on"),"aria-label":`${Ye.active?m("power-off"):m("power-on")} ${Ye.cell}`,children:c.jsx(it,{name:"power",size:16})})]},W.key)}const Oe=W.value;return c.jsxs("div",{className:"nc-mcard","data-roster-key":W.key,"data-position":we,children:[c.jsx(Di,{position:we,itemKey:W.key,label:Oe.name,canMove:It,onMove:(Ye,Gt)=>B(we,Ye,Gt,ve),onStep:Ye=>D(we,W.key,Ye,ve)}),c.jsxs("button",{className:"nc-mcard-main",onClick:()=>st(Oe.name),children:[c.jsx("span",{className:Oe.attached?"dot on":"dot"}),c.jsxs("span",{className:"nc-mcard-text",children:[c.jsx("b",{children:Oe.name}),c.jsx("small",{children:Oe.preview?Oe.preview:Oe.cmd?Oe.cmd:m("windows").replace("{n}",String(Oe.windows||0))})]})]}),W.activity?c.jsx("span",{className:"nc-rel",children:Nr(W.activity)}):null,W.fresh&&((bt=Oe.outbox)==null?void 0:bt.count)>0&&c.jsx("span",{className:"nc-badge",title:m("new-files-outbox"),children:Oe.outbox.count}),c.jsx("button",{className:`nc-act pin${M.includes(W.key)?" on":""}`,"aria-label":`${m("pin")} ${Oe.name}`,title:m("pin"),onClick:()=>P(W.key),children:M.includes(W.key)?"★":"☆"}),c.jsx("button",{className:`nc-act technical${Oe.technical?" on":""}`,title:Oe.technical?m("mark-normal"):m("mark-technical"),"aria-label":`${Oe.technical?m("mark-normal"):m("mark-technical")} ${Oe.name}`,onClick:()=>vt(Oe.name,!Oe.technical,ke),children:"T"}),c.jsx("button",{className:"nc-menu",title:m("terminate"),"aria-label":`${m("terminate")} ${Oe.name}`,onClick:()=>{window.confirm(m("terminate-confirm").replace("{name}",Oe.name))&&He(Oe.name,ke)},children:"⋯"})]},W.key)}return c.jsxs("div",{className:"nc-home",children:[c.jsxs("header",{className:"nc-home-head",children:[c.jsxs("div",{className:"nc-wordmark",children:["NexusCrew",c.jsx("span",{className:"nc-cursor"})]}),c.jsxs("div",{className:"nc-home-sub",children:[m("fleet-tmux")," · ",ze," ",m("sessions"),ue>0&&` · ${ue} attached`]}),c.jsxs("span",{className:"nc-head-actions",children:[c.jsx("button",{className:"nc-refresh",onClick:()=>n("nodes",!1),title:m("settings"),children:c.jsx(it,{name:"gear",size:18})}),c.jsx("button",{className:"nc-refresh",onClick:J,title:m("refresh"),children:c.jsx(it,{name:"refresh",size:18})})]})]}),c.jsxs("main",{className:"nc-home-scroll",children:[xe>8&&c.jsx("input",{className:"nc-filter",type:"search",placeholder:m("filter-placeholder"),"aria-label":m("filter-placeholder"),value:v,onChange:W=>b(W.target.value)}),f&&c.jsx("div",{className:"nc-err",children:f}),c.jsxs("section",{className:"nc-group","data-position":"local",children:[c.jsx(Ng,{label:m("position-local"),count:dt.length,state:ut,dotClass:"on",onToggle:()=>T("local",{open:!ut.open}),onFilter:W=>T("local",{filter:W})}),ut.open&&dt.map(W=>ie(W,null,ot)),ut.open&&u===null&&c.jsx("div",{className:"nc-empty",children:m("loading-fleet")}),ut.open&&u!==null&&dt.length===0&&!f&&c.jsx("div",{className:"nc-empty",children:v?m("no-match").replace("{q}",v):m("no-sessions-short")})]}),fe.map(W=>{const ve=Q_(W.health,{passive:"warn"})||(W.status==="up"?"on":W.status==="passive"?"":"warn"),ke=W.health?Rl(W.health):W.status==="up"?"":xr(W),we=(W.route||[W.name]).join("/"),je=F(we),{rawItems:st}=Pl(W),It=ps(st,M,je.filter,Ai(L,we)).filter(bt=>pg(bt,v)),Oe=W.direct&&W.health&&W.health.managed!==!1?c.jsx("button",{type:"button",className:`nc-act power${W.tunnelStatus==="up"?" on":""}`,disabled:A===W.name,title:W.tunnelStatus==="up"?m("power-off"):m("power-on"),"aria-label":`${W.tunnelStatus==="up"?m("power-off"):m("power-on")} ${W.label||W.name}`,onClick:()=>Xe(W),children:c.jsx(it,{name:"power",size:15})}):null,_n=c.jsxs("span",{className:"nc-node-actions",children:[c.jsx(Di,{scope:"node",position:"nodes",itemKey:de(W),label:W.label||W.name,onMove:(bt,Ye)=>Z(bt,Ye,a),onStep:bt=>oe(de(W),bt,a)}),W.direct&&c.jsx("button",{type:"button",className:"nc-node-rename",title:m("rename-node"),"aria-label":`${m("rename-node")} ${W.label||W.name}`,onClick:()=>St(W),children:"✎"}),Oe]});return c.jsxs("section",{className:"nc-group nc-node-order-wrap","data-position":we,"data-node-order-key":de(W),children:[c.jsx(Ng,{label:W.label||W.name,count:It.length,state:je,dotClass:ve,dotTitle:ke,detail:W.status==="up"?"":W.health&&Rl(W.health)||xr(W),onToggle:()=>T(we,{open:!je.open}),onFilter:bt=>T(we,{filter:bt}),onRename:W.direct?()=>St(W):null,action:_n}),W.status==="up"&&je.open&&It.map(bt=>ie(bt,W,st)),W.status==="up"&&je.open&&It.length===0&&c.jsx("div",{className:"nc-empty",children:v?m("no-match").replace("{q}",v):m("no-sessions-short")})]},`nodo-${we}`)}),c.jsxs("footer",{className:"nc-home-foot",onClick:ee,title:m("copy-url"),children:[c.jsxs("span",{className:"nc-home-meta",children:[w&&c.jsxs("span",{className:"nc-home-version",children:["v",w]}),c.jsxs("span",{className:"nc-home-endpoint",children:[G," · ",m("ssh-only")]})]}),c.jsx("span",{className:"nc-lang",onClick:W=>W.stopPropagation(),children:G_.map((W,se)=>c.jsxs("span",{children:[se>0&&" · ",c.jsx("button",{className:`nc-lang-btn${s===W?" on":""}`,onClick:()=>o(W),title:W,children:W.toUpperCase()})]},W))})]})]}),c.jsx("button",{className:"nc-fab",onClick:()=>n("fleet",!0),title:m("fleet-new-cell"),"aria-label":m("fleet-new-cell"),children:"+"}),X&&c.jsx(Nl,{cell:X,token:t,route:Array.isArray(X.route)?X.route:[],onConfirm:$e,onClose:()=>I(null)})]})}function Ng({label:e,count:t,state:n,dotClass:s="",dotTitle:o="",detail:a="",onToggle:u,onFilter:h,onRename:f=null,action:p=null}){return c.jsxs("div",{className:"nc-mobile-position-head",onContextMenu:f?v=>{v.preventDefault(),f()}:void 0,children:[c.jsxs("button",{type:"button",className:"nc-mobile-position-toggle",onClick:u,"aria-expanded":n.open,"aria-label":`${e} · ${m("node-sessions").replace("{n}",String(t))}`,children:[c.jsx("span",{className:"nc-mobile-chevron","aria-hidden":"true",children:n.open?"⌄":"›"}),c.jsx("span",{className:`dot ${s}`,title:o}),c.jsxs("span",{className:"nc-mobile-position-copy",children:[c.jsx("b",{children:e}),c.jsx("small",{children:a||m("node-sessions").replace("{n}",String(t))})]})]}),c.jsxs("select",{className:"nc-mobile-position-filter",value:n.filter,"aria-label":`${e} · ${m("filter-placeholder")}`,title:m(`view-${n.filter}`),onChange:v=>h(v.target.value),children:[c.jsx("option",{value:"all",children:m("view-all")}),c.jsx("option",{value:"pinned",children:m("view-pinned")}),c.jsx("option",{value:"active",children:m("view-active")}),c.jsx("option",{value:"off",children:m("view-off")}),c.jsx("option",{value:"technical",children:m("view-technical")})]}),p]})}/**
41
41
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
42
42
  * @license MIT
43
43
  *
@@ -88,6 +88,6 @@ Minimum version required to store current data is: `+I+`.
88
88
  `;return typeof h=="function"&&h(null,C),C},Ed}var y_;function T2(){if(y_)return Sr;y_=1;const e=h2(),t=j2(),n=P2(),s=L2();function o(a,u,h,f,p){const v=[].slice.call(arguments,1),b=v.length,w=typeof v[b-1]=="function";if(!w&&!e())throw new Error("Callback required as last argument");if(w){if(b<2)throw new Error("Too few arguments provided");b===2?(p=h,h=u,u=f=void 0):b===3&&(u.getContext&&typeof p>"u"?(p=f,f=void 0):(p=f,f=h,h=u,u=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(h=u,u=f=void 0):b===2&&!u.getContext&&(f=h,h=u,u=void 0),new Promise(function(S,y){try{const x=t.create(h,f);S(a(x,u,f))}catch(x){y(x)}})}try{const S=t.create(h,f);p(null,a(S,u,f))}catch(S){p(S)}}return Sr.create=t.create,Sr.toCanvas=o.bind(null,n.render),Sr.toDataURL=o.bind(null,n.renderToDataURL),Sr.toString=o.bind(null,function(a,u,h){return s.render(a,h)}),Sr}var D2=T2();const M2=Dh(D2);function w_(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.data=="string"?e.data.trim():""}function A2(e){const t=String(e||"").trim();if(!t)return{kind:"empty"};const n=k1(t);if(!n||!n.ok)return{kind:"invalid"};const s=[];return n.ssh||s.push("ssh"),n.name||s.push("name"),s.length?{kind:"partial",decoded:n,missing:s}:{kind:"complete",decoded:n}}function I2(e,t,n=new Set,s=!1){if(!t||!t.ok)return e;const o=C1(e,t,n);return t.version===2&&t.name&&!n.has("name")&&!s&&(o.name=t.name),!n.has("label")&&!o.label&&t.label&&(o.label=t.label),o}function S_(e,t,n=new Set,s=!1){const o=String(t||"").trim(),a=A2(o);let u={...e,pairingUrl:o};return(a.kind==="complete"||a.kind==="partial")&&(u={...I2(u,a.decoded,n,s),pairingUrl:o}),{classification:a,form:u}}function kl(e,t){const n=String(t||"").toLowerCase();if(!/^[a-f0-9]{16,64}$/.test(n))return"";const s=String(e||"NexusCrew").replace(/([a-z0-9])([A-Z])/g,"$1 $2");let o=ms(s);(o==="localhost"||o==="node")&&(o="nexuscrew");const a=n.slice(0,4),u=Math.max(1,32-a.length-1);return`${o.slice(0,u).replace(/-+$/g,"")||"n"}-${a}`}function B2(e,{deviceDefault:t="",localNodeId:n="",localNameDefault:s=""}={}){const o={name:e.name,ssh:e.ssh,pairingUrl:e.pairingUrl,...e.label?{label:e.label}:{},...e.sshPort?{sshPort:Number(e.sshPort)}:{}},a=e.localLabel||t;a&&(o.localLabel=a);const u=String(e.localName||kl(a,n)||s||"").trim();return u&&(o.localName=u),o}function O2(){const e=new Set;let t=!1;return{canAuto(n){return!t&&!e.has(String(n||""))},start(n){return t?!1:(t=!0,e.add(String(n||"")),!0)},finish(){t=!1},reset(n){e.delete(String(n||""))},isBusy(){return t}}}const z2=["validation","conflict","ssh-start","ssh-ready","join","tunnel-final","confirm","health"];function F2(e){const t=e&&e.data||{},n=typeof t.stage=="string"&&t.stage?t.stage:"",s=typeof t.detail=="string"&&t.detail?t.detail:"";return{stage:n,code:typeof t.code=="string"?t.code:"",detail:s,hint:typeof t.hint=="string"?t.hint:"",suggestedName:typeof t.suggestedName=="string"?t.suggestedName:"",retryable:typeof t.retryable=="boolean"?t.retryable:!n,message:s||String(e&&e.message||e)}}const $2="modulepreload",H2=function(e){return"/"+e},b_={},W2=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=u(n.map(p=>{if(p=H2(p),p in b_)return;b_[p]=!0;const v=p.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${b}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":$2,v||(w.as="script"),w.crossOrigin="",w.href=p,f&&w.setAttribute("nonce",f),document.head.appendChild(w),v)return new Promise((S,y)=>{w.addEventListener("load",S),w.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return o.then(u=>{for(const h of u||[])h.status==="rejected"&&a(h.reason);return t().catch(a)})};class Qe{constructor(t,n,s,o,a){this._legacyCanvasSize=Qe.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=n:(console.warn(s||o||a?"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=n),n=typeof s=="object"?s:{},this._onDecodeError=n.onDecodeError||(typeof s=="function"?s:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||a||this._preferredCamera,this._legacyCanvasSize=typeof s=="number"?s:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.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,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),a=this.$overlay.style,a.position="absolute",a.display="none",a.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.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)}n.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 h=window.getComputedStyle(t);h.display==="none"&&(t.style.setProperty("display","block","important"),u=!0),h.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=Qe.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 Qe.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),s;try{t&&(await n()).every(o=>!o.label)&&(s=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,a)=>({id:o.deviceId,label:o.label||(a===0?"Default Camera":`Camera ${a+1}`)}))}finally{s&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),Qe._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"),Qe._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(),Qe._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:n}=await this._getCameraStream();!this._active||this._paused?Qe._stopVideoStream(t):(this._setVideoMirror(n),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 n=()=>{this.$video.srcObject instanceof MediaStream&&(Qe._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(s=>setTimeout(s,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,s,o,a=!1,u=!1){let h,f=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(h=n.scanRegion,s=n.qrEngine,o=n.canvas,a=n.disallowCanvasResizing||!1,u=n.alsoTryWithoutScanRegion||!1,f=!0):console.warn(n||s||o||a||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."),n=!!s;try{let p,v;[s,p]=await Promise.all([s||Qe.createQrEngine(),Qe._loadImage(t)]),[o,v]=Qe._drawToCanvas(p,h,o,a);let b;if(s instanceof Worker){let w=s;n||Qe._postWorkerMessageSync(w,"inversionMode","both"),b=await new Promise((S,y)=>{let x,C,R,k=-1;C=O=>{O.data.id===k&&(w.removeEventListener("message",C),w.removeEventListener("error",R),clearTimeout(x),O.data.data!==null?S({data:O.data.data,cornerPoints:Qe._convertPoints(O.data.cornerPoints,h)}):y(Qe.NO_QR_CODE_FOUND))},R=O=>{w.removeEventListener("message",C),w.removeEventListener("error",R),clearTimeout(x),y("Scanner error: "+(O?O.message||O:"Unknown Error"))},w.addEventListener("message",C),w.addEventListener("error",R),x=setTimeout(()=>R("timeout"),1e4);let $=v.getImageData(0,0,o.width,o.height);k=Qe._postWorkerMessageSync(w,"decode",$,[$.data.buffer])})}else b=await Promise.race([new Promise((w,S)=>window.setTimeout(()=>S("Scanner error: timeout"),1e4)),(async()=>{try{var[w]=await s.detect(o);if(!w)throw Qe.NO_QR_CODE_FOUND;return{data:w.rawValue,cornerPoints:Qe._convertPoints(w.cornerPoints,h)}}catch(S){if(w=S.message||S,/not implemented|service unavailable/.test(w))return Qe._disableBarcodeDetector=!0,Qe.scanImage(t,{scanRegion:h,canvas:o,disallowCanvasResizing:a,alsoTryWithoutScanRegion:u});throw`Scanner error: ${w}`}})()]);return f?b:b.data}catch(p){if(!h||!u)throw p;let v=await Qe.scanImage(t,{qrEngine:s,canvas:o,disallowCanvasResizing:a});return f?v:v.data}finally{n||Qe._postWorkerMessage(s,"close")}}setGrayscaleWeights(t,n,s,o=!0){Qe._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:s,useIntegerApproximation:o})}setInversionMode(t){Qe._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=()=>W2(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(s=>s.createWorker()),!(!Qe._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:s})=>/Chromium/i.test(s))&&/mac ?OS/i.test(n.platform)&&await n.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 n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,s=t.videoHeight,o=t.offsetWidth,a=t.offsetHeight,u=t.offsetLeft,h=t.offsetTop,f=window.getComputedStyle(t),p=f.objectFit,v=n/s,b=o/a;switch(p){case"none":var w=n,S=s;break;case"fill":w=o,S=a;break;default:(p==="cover"?v>b:v<b)?(S=a,w=S*v):(w=o,S=w/v),p==="scale-down"&&(w=Math.min(w,n),S=Math.min(S,s))}var[y,x]=f.objectPosition.split(" ").map((R,k)=>{const $=parseFloat(R);return R.endsWith("%")?(k?a-S:o-w)*$/100:$});f=this._scanRegion.width||n,b=this._scanRegion.height||s,p=this._scanRegion.x||0;var C=this._scanRegion.y||0;v=this.$overlay.style,v.width=`${f/n*w}px`,v.height=`${b/s*S}px`,v.top=`${h+x+C/s*S}px`,s=/scaleX\(-1\)/.test(t.style.transform),v.left=`${u+(s?o-y-w:y)+(s?n-p-f:p)/n*w}px`,v.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let s=n.x||0,o=n.y||0,a=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let u of t)u.x=u.x*a+s,u.y=u.y*n+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,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var s=await Qe.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!Qe._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Qe.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:a})=>`${o},${a}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==Qe.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",n=[{width:{min:1024}},{width:{min:768}},{}],s=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...s,...n])try{let a=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),u=this._getFacingMode(a)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:a,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 n of t.getTracks())n.stop(),t.removeTrack(n)}_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,n,s,o=!1){s=s||document.createElement("canvas");let a=n&&n.x?n.x:0,u=n&&n.y?n.y:0,h=n&&n.width?n.width:t.videoWidth||t.width,f=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:h,n=n&&n.downScaledHeight?n.downScaledHeight:f,s.width!==o&&(s.width=o),s.height!==n&&(s.height=n)),n=s.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,a,u,h,f,0,0,s.width,s.height),[s,n]}static async _loadImage(t){if(t instanceof Image)return await Qe._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 n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await Qe._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,s)=>{let o=a=>{t.removeEventListener("load",o),t.removeEventListener("error",o),a instanceof ErrorEvent?s("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,s,o){return Qe._postWorkerMessageSync(await t,n,s,o)}static _postWorkerMessageSync(t,n,s,o){if(!(t instanceof Worker))return-1;let a=Qe._workerMessageId++;return t.postMessage({id:a,type:n,data:s},o),a}}Qe.DEFAULT_CANVAS_SIZE=400;Qe.NO_QR_CODE_FOUND="No QR code found";Qe._disableBarcodeDetector=!1;Qe._workerMessageId=0;function U2({onResult:e,onClose:t}){const n=E.useRef(null),s=E.useRef(null),o=E.useRef(!1),[a,u]=E.useState("");E.useEffect(()=>{let f=!1;const p=n.current,v=b=>{f||o.current||(o.current=!0,e(b))};return(async()=>{if(typeof navigator>"u"||!navigator.mediaDevices||typeof navigator.mediaDevices.getUserMedia!="function"){u(m("qr-unsupported"));return}let b=!1;try{b=await Qe.hasCamera()}catch{b=!1}if(!b){u(m("qr-no-camera"));return}if(f||!p)return;const w=new Qe(p,S=>{const y=w_(S);y&&v(y)},{returnDetailedScanResult:!0,preferredCamera:"environment",calculateScanRegion:S=>{const y=S.videoWidth||640,x=S.videoHeight||480,C=Math.max(1,Math.round(Math.min(y,x)*.92));return{x:Math.round((y-C)/2),y:Math.round((x-C)/2),width:C,height:C,downScaledWidth:600,downScaledHeight:600}},highlightScanRegion:!0,highlightCodeOutline:!0});s.current=w;try{await w.start()}catch(S){if(f)return;const y=S&&S.name||"";u(m(y==="NotAllowedError"||y==="SecurityError"?"qr-permission":y==="NotFoundError"||y==="OverconstrainedError"||y==="NotReadableError"?"qr-no-camera":"qr-unsupported"))}})(),()=>{f=!0;const b=s.current;if(b){try{b.stop()}catch{}try{b.destroy()}catch{}s.current=null}const w=p,S=w&&w.srcObject;if(S&&typeof S.getTracks=="function"){for(const y of S.getTracks())try{y.stop()}catch{}try{w.srcObject=null}catch{}}}},[]);const h=async f=>{const p=f.target.files&&f.target.files[0];if(f.target.value="",!!p)try{const v=await Qe.scanImage(p,{returnDetailedScanResult:!0}),b=w_(v);if(!b)throw new Error("empty");o.current||(o.current=!0,e(b))}catch{u(m("pairing-qr-invalid"))}};return c.jsx("div",{className:"nc-sheet-overlay nc-qr-overlay",onClick:t,children:c.jsxs("div",{className:"nc-sheet nc-qr-modal",onClick:f=>f.stopPropagation(),children:[c.jsx("div",{className:"nc-sheet-head",children:c.jsx("b",{children:m("scan-qr")})}),c.jsx("video",{ref:n,className:"nc-qr-video",playsInline:!0,muted:!0}),a&&c.jsx("div",{className:"nc-err",role:"alert",children:a}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsxs("label",{className:"nc-btn ghost nc-qr-upload",children:[m("qr-upload"),c.jsx("input",{type:"file",accept:"image/*",hidden:!0,onChange:h})]}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:t,children:m("cancel")})]})]})})}const x_=()=>({name:"",label:"",ssh:"",sshPort:"",pairingUrl:"",localLabel:"",localName:""});function Tw({token:e,initial:t="",autoStart:n=!1,deviceDefault:s="",localNodeId:o="",localNameDefault:a="",readonly:u=!1,onSuccess:h,onBusyChange:f}){const[p,v]=E.useState(x_),[b,w]=E.useState(!1),[S,y]=E.useState(!1),[x,C]=E.useState("idle"),[R,k]=E.useState(null),[$,O]=E.useState(""),[V,Y]=E.useState(!1),[z,ne]=E.useState(!1),H=E.useRef(O2()),X=E.useRef(new Set),I=x==="busy",A=kl(p.localLabel||s,o)||a,N=z?p.localName:A;E.useEffect(()=>(f&&f(I),()=>{f&&f(!1)}),[I,f]);const M=async B=>{const D=String(B.pairingUrl||"").trim();if(H.current.start(D)){C("busy"),k(null),O("");try{await m0(e,B2({...B,localName:z?B.localName:kl(B.localLabel||s,o)||a},{deviceDefault:s,localNodeId:o,localNameDefault:a})),C("ok"),w(!1),v(x_()),X.current=new Set,Y(!1),ne(!1),H.current.finish(),h&&await h()}catch(U){const Z=F2(U);k(Z),C("idle"),H.current.finish(),Z.code==="peer-name-conflict"&&Ad(Z.suggestedName)&&(ne(!0),X.current.add("localName"),v(oe=>({...oe,localName:Z.suggestedName}))),(Z.stage==="validation"||Z.stage==="conflict"||Z.stage==="ssh-start"||Z.stage==="ssh-ready"||String(Z.code||"").startsWith("ssh-"))&&w(!0)}}},L=(B,D=!0)=>{const{classification:U,form:Z}=S_(p,B,X.current,V),oe=Z.pairingUrl;if(k(null),O(""),x==="ok"&&C("idle"),v(Z),U.kind==="invalid"){k({stage:"validation",code:"bad-link",message:m("pair-invalid-link"),hint:m("pair-invalid-hint"),retryable:!0});return}if(U.kind==="partial"){w(!0),O(U.missing.includes("ssh")?m("pair-missing-ssh"):m("pair-missing-name"));return}U.kind==="complete"&&D&&!u&&H.current.canAuto(oe)&&M(Z)};E.useEffect(()=>{t&&L(t,n)},[]);const P=()=>{const B=String(p.pairingUrl||"").trim(),{classification:D,form:U}=S_(p,B,X.current,V);if(v(U),O(""),k(null),D.kind==="empty"){k({stage:"validation",message:m("pairing-required"),retryable:!0});return}if(D.kind==="invalid"){k({stage:"validation",code:"bad-link",message:m("pair-invalid-link"),hint:m("pair-invalid-hint"),retryable:!0});return}if(!U.ssh||!U.name){w(!0),O(U.ssh?m("pair-missing-name"):m("pair-missing-ssh"));return}if(U.label&&!jr(U.label)){k({stage:"validation",message:m("err-label"),retryable:!0});return}if(U.localLabel&&!jr(U.localLabel)){k({stage:"validation",message:m("err-label"),retryable:!0});return}const Z=z?U.localName:kl(U.localLabel||s,o)||a;if(!Ad(Z)||Z==="localhost"){w(!0),k({stage:"validation",code:"bad-local-name",message:m("err-local-name"),retryable:!0});return}H.current.reset(B),M(U)},F=async()=>{try{if(!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error("unsupported");const B=await navigator.clipboard.readText();B&&B.trim()?L(B):O(m("pair-clipboard-empty"))}catch{O(m("pair-clipboard-denied"))}},T=(B,D)=>{X.current.add(B),v(U=>({...U,[B]:D}))},q=R&&R.stage&&(z2.includes(R.stage)||R.stage==="internal")?m(`pair-stage-${R.stage}`):m("pair-stage-generic");return c.jsxs("div",{className:"nc-set-form nc-pair-card",children:[c.jsx("div",{className:"nc-sheet-label",children:m("pair-card-title")}),c.jsx("div",{className:"nc-set-info",children:m("pair-card-help")}),c.jsx("input",{className:"nc-pair-input",placeholder:m("pair-paste-ph"),value:p.pairingUrl,disabled:u||I,onChange:B=>{v({...p,pairingUrl:B.target.value}),k(null),O("")},onPaste:B=>{const D=B.clipboardData&&B.clipboardData.getData("text")||"";D.trim()&&(B.preventDefault(),L(D))},onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),P())}}),c.jsxs("div",{className:"nc-pair-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:u||I,onClick:F,children:m("pair-paste-btn")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:u||I,onClick:()=>y(!0),children:m("scan-qr")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:u||I,title:u?m("settings-readonly"):"",onClick:P,children:m("test-and-connect")})]}),c.jsxs("div",{className:"nc-pair-status","aria-live":"polite",children:[I&&c.jsx("div",{className:"nc-pair-progress",children:m("pair-progress")}),x==="ok"&&c.jsx("div",{className:"nc-set-test ok",children:m("node-connected")}),$&&c.jsx("div",{className:"nc-set-hint nc-pair-notice",children:$}),R&&c.jsxs("div",{className:"nc-err",role:"alert",children:[c.jsx("b",{children:q})," — ",R.message,R.hint&&c.jsx("div",{className:"nc-pair-hint",children:R.hint}),R.retryable&&c.jsx("div",{children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:u||I,onClick:P,children:m("pair-retry")})})]})]}),c.jsxs("button",{type:"button",className:"nc-btn ghost nc-pair-advanced-toggle",disabled:I,onClick:()=>w(B=>!B),children:[b?"▾":"▸"," ",m("pair-advanced")]}),b&&c.jsxs("div",{className:"nc-pair-advanced",children:[c.jsxs("label",{className:"nc-field",children:[m("node-display-label"),c.jsx("input",{placeholder:"Home Relay",value:p.label,disabled:u||I,onChange:B=>{X.current.add("label"),v(D=>({...D,label:B.target.value,name:V?D.name:ms(B.target.value)}))}})]}),c.jsxs("label",{className:"nc-field",children:[m("node-name-label"),c.jsx("input",{placeholder:m("node-name-ph"),value:p.name,disabled:u||I,onChange:B=>{Y(!0),X.current.add("name"),v(D=>({...D,name:B.target.value?ms(B.target.value):""}))}})]}),c.jsx("small",{className:"nc-set-hint",children:m("node-slug-hint").replace("{slug}",p.name||"home-relay")}),c.jsxs("label",{className:"nc-field",children:[m("pair-ssh-local-label"),c.jsx("input",{placeholder:"my-relay",value:p.ssh,disabled:u||I,onChange:B=>{X.current.add("ssh"),T("ssh",B.target.value)}}),c.jsx("small",{className:"nc-set-hint",children:m("node-ssh-local-help")})]}),c.jsxs("label",{className:"nc-field",children:[m("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",placeholder:m("node-ssh-port-help"),value:p.sshPort,disabled:u||I,onChange:B=>T("sshPort",B.target.value.replace(/[^0-9]/g,"").slice(0,5))})]}),c.jsxs("label",{className:"nc-field",children:[m("device-name-label"),c.jsx("input",{placeholder:s||"NexusCrew",value:p.localLabel,disabled:u||I,onChange:B=>T("localLabel",B.target.value)}),c.jsx("small",{className:"nc-set-hint",children:m("device-name-hint")})]}),c.jsxs("label",{className:"nc-field",children:[m("local-route-name-label"),c.jsx("input",{placeholder:A||"nexuscrew-5bd6",value:N,disabled:u||I,onChange:B=>{ne(!0),X.current.add("localName"),v(D=>({...D,localName:B.target.value?ms(B.target.value):""}))}}),c.jsx("small",{className:"nc-set-hint",children:m("local-route-name-hint")})]})]}),S&&c.jsx(U2,{onResult:B=>{y(!1),L(B)},onClose:()=>y(!1)})]})}function wf(){return typeof navigator<"u"&&"serviceWorker"in navigator&&typeof window<"u"&&"PushManager"in window&&typeof Notification<"u"}function K2(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=atob(n),o=new Uint8Array(s.length);for(let a=0;a<s.length;a+=1)o[a]=s.charCodeAt(a);return o}async function q2(){if(!wf())return"unsupported";if(Notification.permission==="denied")return"denied";try{return await(await navigator.serviceWorker.ready).pushManager.getSubscription()?"subscribed":"idle"}catch{return"idle"}}async function V2(e){if(!wf())throw new Error("push-unsupported");if(await Notification.requestPermission()!=="granted")throw new Error("push-denied");const n=await Vt("/api/push/vapid",e),{publicKey:s}=await n.json();if(!s)throw new Error("vapid non disponibile");const a=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:K2(s)}),u=await Vt("/api/push/subscribe",e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({subscription:a.toJSON()})});if(!u.ok){try{await a.unsubscribe()}catch{}const h=await u.json().catch(()=>({}));throw new Error(h.error||`HTTP ${u.status}`)}return!0}async function Y2(e){if(!wf())return!1;const n=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!n)return!1;const s=n.endpoint;try{await n.unsubscribe()}catch{}try{await Vt("/api/push/subscribe",e,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:s})})}catch{}return!0}const Eh="nexuscrew.fleet",Dw=3,G2="nexuscrew.cells",Mw=/^[A-Za-z0-9._-]{1,32}$/,Ql=/^[a-z0-9._-]{1,32}$/,Aw=/^[A-Za-z_][A-Za-z0-9_]{0,63}$/,Iw=new Set(["standard","unsafe"]),X2=4096,J2=4096,$l=256,Bw=8192,Q2=4096,Z2=32,eN=24,tN=new Set(["format","version","exportedAt","cells","engines"]),nN=new Set(["id","cwdRel","engine","boot","model","models","permissionPolicies","commands","systemPrompt","prompt"]),iN=new Set(["id","cwd","engine","boot","model","models","permissionPolicies","systemPrompt","prompt"]);function Os(e){if(typeof e!="string"||e.length>J2)return null;for(let n=0;n<e.length;n+=1){const s=e.charCodeAt(n);if(s<=31||s===127||s===92)return null}if(e==="")return"";if(e.charAt(0)==="/"||/^[A-Za-z]:/.test(e))return null;const t=[];for(const n of e.split("/"))if(!(n===""||n===".")){if(n==="..")return null;t.push(n)}return t.join("/")}const sN=new Set(["id","label","rc","managed","command","args","envKeys","model","promptMode","promptFlag"]),rN=new Set(["client","provider","credentialProfile","model","permissionPolicy","displayName","protocol","baseUrl","envKey","providerId"]);function ds(e,t){return typeof e=="string"&&e.length<=t&&!/[\x00-\x1f\x7f]/.test(e)}function Sf(e){const t=String(e||"");return/(?:bearer\s+|authorization\s*[:=]|(?:api[_-]?key|secret|token)\s*[:=])/i.test(t)||/^-{1,2}(?:api[-_]?key|access[-_]?key|auth(?:orization)?[-_]?token|token|secret|password|credential)(?:$|=)/i.test(t)||/\b(?:sk|fw|fpk|hf|zai)[-_][A-Za-z0-9._-]{8,}\b/i.test(t)||/https?:\/\/[^\s/@:]+:[^\s/@]+@/i.test(t)}function Io(e,t){if(e===void 0)return{};if(!e||typeof e!="object"||Array.isArray(e))return null;const n=Object.entries(e);if(n.length>128)return null;const s={};for(const[o,a]of n){if(!Ql.test(o)||!t(a))return null;s[o]=a}return s}function Ow(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(h=>!nN.has(h))||!Mw.test(String(e.id||""))||typeof e.cwdRel!="string")return null;const t=Os(e.cwdRel);if(t===null||!Ql.test(String(e.engine||""))||e.boot!==void 0&&typeof e.boot!="boolean"||e.model!==void 0&&(typeof e.model!="string"||e.model.length>$l)||e.systemPrompt!==void 0&&e.prompt!==void 0&&e.systemPrompt!==e.prompt)return null;const n=e.systemPrompt===void 0?e.prompt===void 0?"":e.prompt:e.systemPrompt;if(typeof n!="string"||n.length>Bw)return null;const s=Io(e.models,h=>typeof h=="string"&&!!h&&h.length<=$l),o=Io(e.permissionPolicies,h=>Iw.has(h)),a=Io(e.commands,h=>ds(h,Q2)&&!Sf(h));if(s===null||o===null||a===null)return null;const u={id:e.id,cwdRel:t,engine:e.engine,boot:e.boot===!0,systemPrompt:n};return e.model&&(u.model=e.model),Object.keys(s).length&&(u.models=s),Object.keys(o).length&&(u.permissionPolicies=o),Object.keys(a).length&&(u.commands=a),u}function oN(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(a=>!iN.has(a))||!Mw.test(String(e.id||""))||typeof e.cwd!="string"||!e.cwd||e.cwd.length>X2||!Ql.test(String(e.engine||""))||e.boot!==void 0&&typeof e.boot!="boolean"||e.model!==void 0&&(typeof e.model!="string"||e.model.length>$l)||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>Bw)return null;const n=Io(e.models,a=>typeof a=="string"&&!!a&&a.length<=$l),s=Io(e.permissionPolicies,a=>Iw.has(a));if(n===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(n).length&&(o.models=n),Object.keys(s).length&&(o.permissionPolicies=s),o}function aN(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(n=>!rN.has(n)))return null;const t={};for(const[n,s]of Object.entries(e)){if(typeof s!="string"||!ds(s,n==="baseUrl"?512:128)||Sf(s))return null;t[n]=s}return!t.client||!t.provider||t.envKey&&!Aw.test(t.envKey)?null:t}function zw(e){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(s=>!sN.has(s))||!Ql.test(String(e.id||""))||!ds(e.label||e.id,64)||e.rc!==void 0&&typeof e.rc!="boolean")return null;const t={id:e.id,label:e.label||e.id,rc:e.rc===!0};if(e.managed!==void 0){const s=aN(e.managed);return!s||["command","args","envKeys","model","promptMode","promptFlag"].some(o=>e[o]!==void 0)?null:(t.managed=s,t)}if(!ds(e.command,512)||!e.command.startsWith("/")||!Array.isArray(e.args)||e.args.length>32||e.args.some(s=>!ds(s,1024)||Sf(s))||e.promptMode!=="flag"&&e.promptMode!=="send-keys"||e.promptMode==="flag"&&(!ds(e.promptFlag,32)||/\s/.test(e.promptFlag)))return null;if(e.model!==void 0){if(!e.model||typeof e.model!="object"||Array.isArray(e.model)||Object.keys(e.model).some(s=>s!=="flag"&&s!=="value")||!ds(e.model.flag,32)||/\s/.test(e.model.flag)||!ds(e.model.value||"",128))return null;t.model={flag:e.model.flag,value:e.model.value||""}}const n=e.envKeys===void 0?[]:e.envKeys;return!Array.isArray(n)||n.length>32||n.some(s=>!Aw.test(s))?null:(Object.assign(t,{command:e.command,args:[...e.args],envKeys:[...new Set(n)].sort(),promptMode:e.promptMode}),e.promptMode==="flag"&&(t.promptFlag=e.promptFlag),t)}function Fw(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.managed?{id:e.id,label:e.label,rc:e.rc,managed:e.managed}:{id:e.id,label:e.label,rc:e.rc,command:e.command,args:e.args,envKeys:e.envKeys,model:e.model,promptMode:e.promptMode,promptFlag:e.promptFlag},n=zw(t);return n||null}function lN(e,t,n=[],s=[],o=new Date){n instanceof Date&&(o=n,n=[],s=[]);const a=t instanceof Set?t:new Set(t||[]),u=s instanceof Set?s:new Set(s||[]),h=[];for(const p of Array.isArray(e)?e:[]){if(!a.has(p.id))continue;const v=Ow({id:p.id,cwdRel:p.cwdRel,engine:p.engine,boot:p.boot===!0,...p.model?{model:p.model}:{},...p.models?{models:p.models}:{},...p.permissionPolicies?{permissionPolicies:p.permissionPolicies}:{},systemPrompt:p.prompt||"",...p.commands?{commands:p.commands}:{}});if(!v)return{ok:!1,error:"invalid-cell",invalidCellIds:[p.id]};h.push(v)}const f=[];for(const p of Array.isArray(n)?n:[]){if(!u.has(p.id))continue;const v=Fw(p);v&&f.push(v)}return{format:Eh,version:Dw,exportedAt:o.toISOString(),cells:h,engines:f}}function cN(e){let t;try{t=JSON.parse(String(e||""))}catch{return{ok:!1,error:"invalid-json",cells:[],engines:[]}}const n=(t==null?void 0:t.format)===G2&&(t==null?void 0:t.version)===1,s=(t==null?void 0:t.format)===Eh&&(t==null?void 0:t.version)===2,o=(t==null?void 0:t.format)===Eh&&(t==null?void 0:t.version)===Dw,a=n||s,u=s||o;if(!t||typeof t!="object"||Array.isArray(t)||Object.keys(t).some(b=>!tN.has(b))||!n&&!s&&!o||!Array.isArray(t.cells)||t.cells.length>Z2||u&&(!Array.isArray(t.engines)||t.engines.length>eN))return{ok:!1,error:"invalid-format",cells:[],engines:[]};const h=[],f=new Set;for(const b of t.cells){const w=a?oN(b):Ow(b);if(!w)return{ok:!1,error:"invalid-cell",cells:[],engines:[]};if(f.has(w.id))return{ok:!1,error:"duplicate-cell",cells:[],engines:[]};f.add(w.id),h.push(w)}const p=[],v=new Set;for(const b of u?t.engines:[]){const w=zw(b);if(!w)return{ok:!1,error:"invalid-engine",cells:[],engines:[]};if(v.has(w.id))return{ok:!1,error:"duplicate-engine",cells:[],engines:[]};v.add(w.id),p.push(w)}return{ok:!0,cells:h,engines:p,legacy:a,exportedAt:typeof t.exportedAt=="string"?t.exportedAt:""}}function uN(e,t,n){const s=new Set(n||[]);if(!s.has(t))return null;const o=p=>Object.fromEntries(Object.entries(p||{}).filter(([v])=>s.has(v))),a={id:e.id,engine:t,boot:e.boot===!0,prompt:e.systemPrompt||""};typeof e.cwdRel=="string"?a.cwdRel=e.cwdRel:typeof e.cwd=="string"&&e.cwd&&(a.cwd=e.cwd),t===e.engine&&e.model?a.model=e.model:e.models&&e.models[t]&&(a.model=e.models[t]);const u=o(e.models),h=o(e.permissionPolicies),f=o(e.commands);return Object.keys(u).length&&(a.models=u),Object.keys(h).length&&(a.permissionPolicies=h),Object.keys(f).length&&(a.commands=f),a}const dN=()=>({kind:"managed",id:"claude.native",label:"",client:"claude",provider:"native",credentialProfile:"",managedModel:"",permissionPolicy:"unsafe",credentialSourcePolicy:"auto",displayName:"",protocol:"anthropic_messages",baseUrl:"",envKey:"",providerId:"nexuscrew-custom",command:"",argsText:"",rc:!0,promptMode:"send-keys",promptFlag:"",modelFlag:"",modelValue:"",envRows:[],credentialValue:"",credentialReveal:!1,allowMissingCredential:!1}),k_=(e="")=>({id:"",cwd:"",engine:e,boot:!1,model:"",prompt:"",commands:{},command:""}),$w=e=>e==="claude"?"unsafe":"standard",$o=(e,t)=>e.find(n=>n.client===t.client&&n.provider===t.provider&&(n.credentialProfile||"")===(t.credentialProfile||"")),hN=(e,t)=>{var n;return((n=$o(e,t))==null?void 0:n.label)||`${t.client} · ${t.provider}`};function fN(e){var t,n,s,o,a,u,h,f,p,v,b,w,S,y,x;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:((n=e.managed)==null?void 0:n.provider)||"native",credentialProfile:((s=e.managed)==null?void 0:s.credentialProfile)||"",managedModel:((o=e.managed)==null?void 0:o.model)||"",permissionPolicy:((a=e.managed)==null?void 0:a.permissionPolicy)||$w((u=e.managed)==null?void 0:u.client),credentialSourcePolicy:((h=e.managed)==null?void 0:h.credentialSourcePolicy)||"auto",displayName:((f=e.managed)==null?void 0:f.displayName)||"",protocol:((p=e.managed)==null?void 0:p.protocol)||"",baseUrl:((v=e.managed)==null?void 0:v.baseUrl)||"",envKey:((b=e.managed)==null?void 0:b.envKey)||"",providerId:((w=e.managed)==null?void 0:w.providerId)||"nexuscrew-custom",modelOptions:e.availableModels||((S=e.managedInfo)==null?void 0:S.models)||[],promptMode:e.promptMode||"send-keys",promptFlag:e.promptFlag||"",modelFlag:((y=e.model)==null?void 0:y.flag)||"",modelValue:((x=e.model)==null?void 0:x.value)||"",envRows:(e.envKeys||[]).map(C=>({key:C,value:"",configured:!0,remove:!1})),credentialValue:"",credentialReveal:!1,allowMissingCredential:!1}}function pN(e,t,n=[]){if(e.kind==="managed"){const o={client:e.client,provider:e.provider,model:e.client==="shell"?"":e.managedModel||"",permissionPolicy:e.client==="shell"?"standard":e.permissionPolicy||$w(e.client)};e.credentialProfile&&(o.credentialProfile=e.credentialProfile),e.credentialSourcePolicy&&e.credentialSourcePolicy!=="auto"&&(o.credentialSourcePolicy=e.credentialSourcePolicy);const a=$o(n,e);return(a==null?void 0:a.credentialEnv)===!0&&(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||hN(n,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 Ms({children:e,onClose:t,label:n,error:s=""}){const o=E.useRef(null),a=E.useRef(null),u=E.useRef(t);return u.current=t,E.useEffect(()=>{const h=document.activeElement,f=o.current,p=()=>Array.from((f==null?void 0:f.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))||[]).filter(w=>w.offsetParent!==null),v=requestAnimationFrame(()=>{var w;return(w=p()[0]||f)==null?void 0:w.focus({preventScroll:!0})}),b=w=>{var C;if(w.key==="Escape"){w.preventDefault(),(C=u.current)==null||C.call(u);return}if(w.key!=="Tab")return;const S=p();if(!S.length){w.preventDefault(),f==null||f.focus();return}const y=S[0],x=S[S.length-1];w.shiftKey&&document.activeElement===y?(w.preventDefault(),x.focus()):!w.shiftKey&&document.activeElement===x&&(w.preventDefault(),y.focus())};return document.addEventListener("keydown",b),()=>{cancelAnimationFrame(v),document.removeEventListener("keydown",b),h&&h.isConnected&&typeof h.focus=="function"&&h.focus({preventScroll:!0})}},[]),E.useEffect(()=>{s&&requestAnimationFrame(()=>{var h;return(h=a.current)==null?void 0:h.scrollIntoView({block:"nearest"})})},[s]),c.jsx("div",{className:"nc-fleet-modal",role:"presentation",onMouseDown:h=>{h.target===h.currentTarget&&t()},children:c.jsxs("div",{ref:o,className:"nc-fleet-modal-dialog",role:"dialog","aria-modal":"true","aria-label":n||m("settings"),tabIndex:-1,children:[e,s&&c.jsx("div",{ref:a,className:"nc-err nc-fleet-modal-error",role:"alert","aria-live":"assertive",children:s})]})})}function Nd({token:e,targets:t=[],readonly:n=!1,onPower:s,onImport:o}){const[a,u]=E.useState([]),[h,f]=E.useState(0);E.useEffect(()=>{let C=!0;async function R(){const $=[{route:[],label:m("local")}].concat((t||[]).map(V=>({route:Array.isArray(V.route)?V.route:[],label:V.label||(V.route||[]).join(" › ")}))),O=await Promise.all($.map(async V=>{const Y={...V,available:!1,readonly:!1,capabilities:[],provider:null,cells:[],unmanaged:[],err:""};try{const z=await _s(e,V.route);Y.available=!!z.available,Y.capabilities=z.capabilities||[],Y.provider=z.provider||null,Y.cells=(z.cells||[]).map(ne=>({...ne,route:V.route}));try{Y.readonly=!!(await Fh(e,V.route)).readonlyDefault}catch{}try{const ne=await zh(e,V.route),H=new Set(Y.cells.map(X=>X.tmuxSession).filter(Boolean));Y.unmanaged=(ne.sessions||[]).filter(X=>X&&!H.has(X.name))}catch{}}catch(z){Y.err=String(z&&z.message||z)}return Y}));C&&u(O)}R();const k=setInterval(R,6e3);return()=>{C=!1,clearInterval(k)}},[e,t,h]);const p=(C,R)=>Array.isArray(C.capabilities)&&C.capabilities.includes(R)&&!n&&!C.readonly,v=()=>f(C=>C+1),b=(C,R)=>{s&&s({...C,route:R})},w=(C,R)=>{s&&s({...C,route:R})},S=async(C,R)=>{try{await jo(e,C.cell,R)}catch{}v()},y=async(C,R)=>{if(window.confirm(m("fleet-remove-cell").replace("{id}",C.cell))){try{await F_(e,C.cell,!0,R)}catch{}v()}},x=async(C,R)=>{if(window.confirm(m("terminate-confirm").replace("{name}",C.name))){try{await Bh(e,C.name,R)}catch{}v()}};return c.jsxs("div",{className:"nc-fleet-inventory",children:[c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:m("fleet-inventory")}),c.jsx("small",{children:m("fleet-inventory-help")})]}),a.map(C=>{const R=C.route.length?C.route.join("/"):"local";return c.jsxs("div",{className:"nc-fleet-pos",children:[c.jsxs("div",{className:"nc-fleet-pos-title",children:[c.jsx("span",{className:`dot ${C.available?"on":"warn"}`}),c.jsx("b",{children:C.label}),c.jsx("small",{children:C.available?`${C.cells.length} ${m("fleet-cells")} · ${C.unmanaged.length} ${m("fleet-tmux")}`:C.err||m("fleet-not-available")})]}),C.cells.map(k=>c.jsxs("div",{className:"nc-fleet-item nc-fleet-cell",children:[c.jsxs("span",{children:[c.jsx("b",{children:k.cell}),c.jsx("small",{children:`${k.engine||""}${k.key?`·${k.key}`:""}${k.active?"":` · ${m("cell-off")}`}`})]}),c.jsxs("span",{className:"nc-fleet-cell-actions",children:[k.active&&p(C,"down")&&c.jsx("button",{className:"nc-btn ghost",title:m("power-off"),onClick:()=>w(k,C.route),children:m("stop")}),!k.active&&p(C,"up")&&c.jsx("button",{className:"nc-btn ghost",title:m("power-on"),onClick:()=>b(k,C.route),children:m("start")}),p(C,"restart")&&k.active&&c.jsx("button",{className:"nc-btn ghost",title:m("restart"),onClick:()=>S(k,C.route),children:m("restart")}),p(C,"remove")&&c.jsx("button",{className:"nc-btn danger",title:m("delete"),onClick:()=>y(k,C.route),children:"×"})]})]},`${R}:${k.cell}`)),C.unmanaged.map(k=>c.jsxs("div",{className:"nc-fleet-item nc-fleet-unmanaged",children:[c.jsxs("span",{children:[c.jsx("b",{children:k.name}),c.jsx("small",{children:m("fleet-tmux")})]}),c.jsxs("span",{className:"nc-fleet-cell-actions",children:[p(C,"import")&&o&&c.jsx("button",{className:"nc-btn ghost",title:m("import-as-cell"),onClick:()=>o(k,C.route),children:m("import-as-cell")}),c.jsx("button",{className:"nc-btn danger",title:m("terminate"),onClick:()=>x(k,C.route),children:"×"})]})]},`${R}:u:${k.name}`)),C.available&&C.cells.length===0&&C.unmanaged.length===0&&c.jsx("div",{className:"nc-empty",children:m("fleet-inventory-empty")})]},R)})]})}function mN({cells:e=[],engines:t=[],busy:n,canRestore:s=!1,onRestore:o,onClose:a}){const[u,h]=E.useState("export"),[f,p]=E.useState(()=>new Set(e.map(N=>N.id))),[v,b]=E.useState(()=>new Set(t.map(N=>N.id))),[w,S]=E.useState([]),[y,x]=E.useState([]),[C,R]=E.useState(""),k=new Set(t.map(N=>N.id)),$=new Set(e.map(N=>N.id)),O=(N,M)=>N(L=>{const P=new Set(L);return P.has(M)?P.delete(M):P.add(M),P}),V=()=>{const N=lN(e,f,t,v);if(N.ok===!1){R(m(`fleet-backup-${N.error}`));return}const M=e.filter(q=>f.has(q.id)).length,L=t.filter(q=>v.has(q.id)).length;if(N.cells.length!==M){R(m("fleet-backup-invalid-cell"));return}if(N.engines.length!==L){R(m("fleet-backup-invalid-engine"));return}if(!N.cells.length&&!N.engines.length){R(m("fleet-backup-select-one"));return}const P=new Blob([`${JSON.stringify(N,null,2)}
91
- `],{type:"application/json"}),F=URL.createObjectURL(P),T=document.createElement("a");T.href=F,T.download=`nexuscrew-fleet-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(T),T.click(),T.remove(),setTimeout(()=>URL.revokeObjectURL(F),0),R("")},Y=async N=>{if(R(""),S([]),x([]),!!N){if(N.size>1024*1024){R(m("fleet-backup-too-large"));return}try{const M=cN(await N.text());if(!M.ok){R(m(`fleet-backup-${M.error}`));return}const L=new Set(M.engines.map(P=>P.id));x(M.engines.map(P=>({engine:P,exists:k.has(P.id),selected:!k.has(P.id)}))),S(M.cells.map(P=>{const F=k.has(P.engine)||L.has(P.engine),T=$.has(P.id);return{cell:P,engine:F?P.engine:"",selected:F&&!T,exists:T}}))}catch(M){R(String(M.message||M))}}},z=(N,M)=>S(L=>L.map((P,F)=>F===N?{...P,...M}:P)),ne=(N,M)=>x(L=>L.map((P,F)=>F===N?{...P,...M}:P)),H=new Set([...k,...y.filter(N=>N.selected).map(N=>N.engine.id)]),X=w.filter(N=>N.selected&&N.engine&&H.has(N.engine)),I=y.filter(N=>N.selected),A=[...new Map([...t.map(N=>[N.id,N.label||N.id]),...y.filter(N=>N.selected).map(N=>[N.engine.id,N.engine.label||N.engine.id])]).entries()];return c.jsxs("div",{className:"nc-set-form nc-fleet-form nc-backup-dialog",children:[c.jsx("b",{children:m("fleet-backup")}),c.jsx("small",{children:m("fleet-backup-help")}),c.jsxs("div",{className:"nc-set-tabs nc-backup-tabs",children:[c.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="export"?" on":""}`,onClick:()=>{h("export"),R("")},children:m("fleet-backup-export")}),c.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="import"?" on":""}`,disabled:!s,title:s?"":m("fleet-backup-restore-unavailable"),onClick:()=>{h("import"),R("")},children:m("fleet-backup-import")})]}),u==="export"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{p(new Set(e.map(N=>N.id))),b(new Set(t.map(N=>N.id)))},children:m("select-all")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{p(new Set),b(new Set)},children:m("select-none")})]}),c.jsxs("div",{className:"nc-backup-list",children:[c.jsx("b",{children:m("fleet-engines")}),t.map(N=>{var M;return c.jsxs("label",{className:"nc-check nc-backup-row",children:[c.jsx("input",{type:"checkbox",checked:v.has(N.id),onChange:()=>O(b,N.id)}),c.jsxs("span",{children:[c.jsx("b",{children:N.label||N.id}),c.jsxs("small",{children:[N.id,(M=N.envKeys)!=null&&M.length?` · ${N.envKeys.length} ${m("fleet-backup-env-names")}`:""]})]})]},N.id)}),c.jsx("b",{children:m("fleet-cells")}),e.map(N=>c.jsxs("label",{className:"nc-check nc-backup-row",children:[c.jsx("input",{type:"checkbox",checked:f.has(N.id),onChange:()=>O(p,N.id)}),c.jsxs("span",{children:[c.jsx("b",{children:N.id}),c.jsxs("small",{children:[N.engine," · ",m("fleet-system-prompt")," ",(N.prompt||"").length," ",m("characters")]})]})]},N.id)),!e.length&&!t.length&&c.jsx("div",{className:"nc-empty",children:m("fleet-backup-empty")})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:!f.size&&!v.size,onClick:V,children:m("fleet-backup-download")})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"file",accept:"application/json,.json",disabled:n,onChange:N=>Y(N.target.files&&N.target.files[0])}),c.jsx("small",{children:m("fleet-backup-import-help")}),!!(w.length||y.length)&&c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{x(N=>N.map(M=>({...M,selected:!0}))),S(N=>N.map(M=>({...M,selected:!!M.engine})))},children:m("select-all")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{x(N=>N.map(M=>({...M,selected:!1}))),S(N=>N.map(M=>({...M,selected:!1})))},children:m("select-none")})]}),c.jsxs("div",{className:"nc-backup-list",children:[!!y.length&&c.jsx("b",{children:m("fleet-engines")}),y.map((N,M)=>{var L;return c.jsx("div",{className:"nc-backup-import-row",children:c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:N.selected,onChange:P=>ne(M,{selected:P.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:N.engine.label||N.engine.id}),c.jsxs("small",{children:[N.engine.id," · ",N.exists?m("fleet-backup-overwrite"):m("fleet-backup-new"),(L=N.engine.envKeys)!=null&&L.length?` · ${m("fleet-backup-env-values-required")}`:""]})]})]})},N.engine.id)}),!!w.length&&c.jsx("b",{children:m("fleet-cells")}),w.map((N,M)=>c.jsxs("div",{className:"nc-backup-import-row",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:N.selected,disabled:!N.engine||!H.has(N.engine),onChange:L=>z(M,{selected:L.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:N.cell.id}),c.jsxs("small",{children:[N.exists?m("fleet-backup-overwrite"):m("fleet-backup-new")," · ",m("fleet-system-prompt")," ",N.cell.systemPrompt.length," ",m("characters")]})]})]}),c.jsxs("select",{value:N.engine,onChange:L=>z(M,{engine:L.target.value,selected:!!L.target.value}),children:[c.jsx("option",{value:"",children:m("fleet-backup-engine-missing")}),A.map(([L,P])=>c.jsx("option",{value:L,children:P},L))]})]},N.cell.id))]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||!X.length&&!I.length,onClick:()=>o({engineRows:y,cellRows:w}),children:m("fleet-backup-restore")})]})]}),C&&c.jsx("div",{className:"nc-err",children:C})]})}function gN({state:e,setState:t,busy:n,onSave:s,catalog:o}){var R;const a=e.form,u=k=>t({...e,form:{...a,...k}}),h=a.envRows||[],f=[...new Map(o.map(k=>[k.client,k.clientLabel||k.client])).entries()],p=o.filter(k=>k.client===a.client),v=$o(o,a),b=typeof(v==null?void 0:v.credentialEnv)=="string"?v.credentialEnv:"",w=Array.isArray(v==null?void 0:v.credentialUsedBy)?v.credentialUsedBy:[],S=(v==null?void 0:v.credentialSource)||"missing",y=!!(v!=null&&v.credentialEnv)||a.credentialProfile==="a"||a.credentialProfile==="p",x=!!b&&e.mode==="new"&&(v==null?void 0:v.authConfigured)!==!0&&!a.credentialValue&&!a.allowMissingCredential,C=k=>{k&&u({client:k.client,provider:k.provider,credentialProfile:k.credentialProfile||"",managedModel:k.model||"",protocol:k.protocol||"",permissionPolicy:k.permissionPolicyDefault||"standard",credentialSourcePolicy:"auto",rc:!!k.rc,displayName:k.custom?m("fleet-custom-provider-default"):"",baseUrl:k.custom?"":k.endpoint||"",envKey:k.defaultEnvKey||"",providerId:"nexuscrew-custom",credentialValue:"",credentialReveal:!1,allowMissingCredential:!1,...e.mode==="new"?{id:k.id,label:""}:{}})};return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsx("b",{children:e.mode==="new"?m("fleet-new-engine"):`${m("edit")} ${a.id}`}),c.jsx("input",{value:a.id,disabled:e.mode!=="new",placeholder:"id",onChange:k=>u({id:k.target.value})}),c.jsx("input",{value:a.label,placeholder:m("label"),onChange:k=>u({label:k.target.value})}),c.jsxs("select",{value:a.kind,disabled:e.mode!=="new",onChange:k=>u({kind:k.target.value}),children:[c.jsx("option",{value:"managed",children:m("fleet-managed")}),c.jsx("option",{value:"custom",children:m("fleet-custom")})]}),a.kind==="managed"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("select",{value:a.client,disabled:e.mode!=="new",onChange:k=>C(o.find($=>$.client===k.target.value&&$.default)||o.find($=>$.client===k.target.value)),children:f.map(([k,$])=>c.jsx("option",{value:k,children:$},k))}),c.jsx("select",{value:((R=$o(o,a))==null?void 0:R.id)||"",disabled:e.mode!=="new",onChange:k=>C(o.find($=>$.id===k.target.value)),children:p.map(k=>c.jsx("option",{value:k.id,children:k.label},k.id))})]}),a.client!=="shell"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.managedModel,list:"nc-managed-models",placeholder:m(v!=null&&v.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:k=>u({managedModel:k.target.value})}),c.jsx("datalist",{id:"nc-managed-models",children:[...(v==null?void 0:v.models)||[],...a.modelOptions||[]].filter((k,$,O)=>k&&O.indexOf(k)===$).map(k=>c.jsx("option",{value:k},k))})]}),v!=null&&v.supportsUnsafe?c.jsxs("select",{value:a.permissionPolicy,onChange:k=>u({permissionPolicy:k.target.value}),children:[c.jsx("option",{value:"standard",children:m("fleet-standard-permissions")}),c.jsx("option",{value:"unsafe",children:m("fleet-unsafe-permissions")})]}):c.jsx("small",{children:m("fleet-standard-permissions")}),(v==null?void 0:v.supportsUnsafe)&&a.permissionPolicy==="unsafe"&&c.jsx("small",{className:"nc-err",children:m("fleet-unsafe-warning")}),y&&c.jsxs("select",{"aria-label":m("fleet-credential-source-policy"),value:a.credentialSourcePolicy||"auto",onChange:k=>u({credentialSourcePolicy:k.target.value}),children:[c.jsx("option",{value:"auto",children:m("fleet-credential-source-policy-auto")}),c.jsx("option",{value:"nexuscrew-store",children:m("fleet-credential-source-policy-nexuscrew-store")}),c.jsx("option",{value:"environment",children:m("fleet-credential-source-policy-environment")})]}),(v==null?void 0:v.credentialEnv)===!0&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.envKey,placeholder:m("fleet-api-key-env"),onChange:k=>u({envKey:k.target.value})}),c.jsx("small",{children:m("fleet-custom-secret-help")})]}),b&&c.jsxs("section",{className:"nc-fleet-key","aria-label":m("fleet-key-section"),children:[c.jsxs("div",{className:"nc-fleet-key-head",children:[c.jsx("b",{children:m("fleet-key-section")}),c.jsx("span",{children:m(`fleet-credential-source-${S}`)})]}),c.jsxs("label",{className:"nc-field",children:[m("fleet-key-variable"),c.jsx("input",{value:b,readOnly:!0,"aria-label":m("fleet-key-variable")})]}),c.jsx("small",{children:w.length?m("fleet-key-used-by").replace("{engines}",w.join(", ")):m("fleet-key-used-by-none")}),w.length>0&&c.jsx("small",{children:m("fleet-key-shared-impact").replace("{key}",b).replace("{engines}",w.join(", "))}),c.jsxs("div",{className:"nc-fleet-key-input",children:[c.jsx("input",{type:a.credentialReveal?"text":"password",value:a.credentialValue||"","aria-label":m("fleet-key-value").replace("{key}",b),autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",placeholder:v!=null&&v.authConfigured||e.mode==="edit"?m("fleet-key-blank-keeps"):m("fleet-key-enter"),onChange:k=>u({credentialValue:k.target.value,allowMissingCredential:k.target.value?!1:a.allowMissingCredential})}),c.jsx("button",{type:"button",className:"nc-btn ghost","aria-label":m(a.credentialReveal?"fleet-key-hide":"fleet-key-reveal"),onClick:()=>u({credentialReveal:!a.credentialReveal}),children:m(a.credentialReveal?"fleet-key-hide":"fleet-key-reveal")})]}),c.jsx("small",{children:m("fleet-key-local-help")}),e.mode==="new"&&(v==null?void 0:v.authConfigured)!==!0&&!a.credentialValue&&c.jsxs("label",{className:"nc-check nc-fleet-key-missing",children:[c.jsx("input",{type:"checkbox",checked:!!a.allowMissingCredential,onChange:k=>u({allowMissingCredential:k.target.checked})}),m("fleet-key-create-missing")]}),(v==null?void 0:v.notice)&&c.jsx("small",{className:"nc-fleet-provider-notice",children:m(`fleet-provider-notice-${v.notice}`)})]}),a.provider==="custom"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.displayName,placeholder:m("fleet-provider-display"),onChange:k=>u({displayName:k.target.value})}),c.jsx("input",{value:a.baseUrl,placeholder:"https://api.example.com/v1",onChange:k=>u({baseUrl:k.target.value})}),((v==null?void 0:v.protocols)||[]).length>1&&c.jsx("select",{value:a.protocol,onChange:k=>u({protocol:k.target.value}),children:v.protocols.map(k=>c.jsx("option",{value:k,children:k},k))}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:a.envKey,placeholder:m("fleet-api-key-env"),onChange:k=>u({envKey:k.target.value})}),c.jsx("input",{value:a.providerId,placeholder:m("fleet-provider-id"),onChange:k=>u({providerId:k.target.value})})]}),c.jsxs("small",{children:[a.protocol," · ",m("fleet-custom-secret-help")]})]}),c.jsx("small",{children:m(a.client==="shell"?"fleet-shell-engine-help":"fleet-managed-help")})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.command,placeholder:m("command-path"),onChange:k=>u({command:k.target.value})}),c.jsx("textarea",{value:a.argsText,placeholder:m("args-lines"),onChange:k=>u({argsText:k.target.value})}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:a.rc,onChange:k=>u({rc:k.target.checked})})," remote control"]}),c.jsxs("select",{value:a.promptMode,onChange:k=>u({promptMode:k.target.value}),children:[c.jsx("option",{value:"send-keys",children:"send-keys"}),c.jsx("option",{value:"flag",children:"flag"})]}),a.promptMode==="flag"&&c.jsx("input",{value:a.promptFlag,placeholder:"prompt flag",onChange:k=>u({promptFlag:k.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:a.modelFlag,placeholder:"model flag",onChange:k=>u({modelFlag:k.target.value})}),c.jsx("input",{value:a.modelValue,placeholder:"model default",onChange:k=>u({modelValue:k.target.value})})]}),c.jsx("small",{children:m("env-write-only")}),h.map((k,$)=>c.jsxs("div",{className:"nc-fleet-env",children:[c.jsx("input",{value:k.key,disabled:k.configured,placeholder:"ENV_KEY",onChange:O=>{const V=h.slice();V[$]={...k,key:O.target.value},u({envRows:V})}}),c.jsx("input",{type:"password",value:k.value,placeholder:k.configured?"•••••• (unchanged)":"value",onChange:O=>{const V=h.slice();V[$]={...k,value:O.target.value},u({envRows:V})}}),c.jsx("button",{className:"nc-btn danger",onClick:()=>u({envRows:h.filter((O,V)=>V!==$)}),children:"×"})]},`${k.key}-${$}`)),c.jsx("button",{className:"nc-btn ghost",onClick:()=>u({envRows:[...h,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:n||!a.id||x||a.kind==="custom"&&!a.command||a.kind==="managed"&&(v==null?void 0:v.requiresModel)&&!a.managedModel||a.kind==="managed"&&(v==null?void 0:v.credentialEnv)===!0&&!a.envKey||a.kind==="managed"&&a.provider==="custom"&&(!a.displayName||!a.baseUrl||!a.envKey||!a.providerId),onClick:s,children:m("save")})]})]})}function vN({token:e,route:t,targets:n=[],location:s,setLocation:o,state:a,setState:u,engines:h,busy:f,onSave:p}){var Y;const[v,b]=E.useState(null),[w,S]=E.useState(""),y=a.form,x=z=>u({...a,form:{...y,...z}}),C=h.find(z=>z.id===y.engine),R=((Y=C==null?void 0:C.managed)==null?void 0:Y.client)==="shell",k=z=>{var X,I,A,N;const ne=h.find(M=>M.id===z),H={...y.commands||{}};((X=C==null?void 0:C.managed)==null?void 0:X.client)==="shell"&&(y.command?H[y.engine]=y.command:delete H[y.engine]),x({engine:z,model:((I=y.models)==null?void 0:I[z])||((A=ne==null?void 0:ne.managed)==null?void 0:A.model)||((N=ne==null?void 0:ne.model)==null?void 0:N.value)||"",commands:H,command:H[z]||""})},$=z=>{const ne={...y.commands||{}};z?ne[y.engine]=z:delete ne[y.engine],x({command:z,commands:ne})},O=R&&/[|&;<>()`$*?{}\[\]~]/.test(y.command||""),V=async z=>{try{const ne=await Oh(e,z,t);b(ne),x({cwd:ne.path}),S("")}catch(ne){S(String(ne.message||ne))}};return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsx("b",{children:a.mode==="new"?m("fleet-new-cell"):`${m("edit")} ${y.id}`}),a.mode==="new"&&c.jsxs("label",{className:"nc-field",children:[m("location"),c.jsx("span",{className:"nc-req",children:" *"}),c.jsxs("select",{value:s,onChange:z=>{o(z.target.value),x({engine:""})},children:[c.jsx("option",{value:"",children:m("local")}),n.map(z=>c.jsxs("option",{value:z.route.join("/"),disabled:z.status&&z.status!=="up",children:[z.label,z.status&&z.status!=="up"?` · ${m("node-offline")}`:""]},z.route.join("/")))]})]}),c.jsx("input",{value:y.id,disabled:a.mode!=="new",placeholder:"id",onChange:z=>x({id:z.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:y.cwd,placeholder:m("cwd"),onChange:z=>x({cwd:z.target.value})}),c.jsx("button",{className:"nc-btn ghost",onClick:()=>v?b(null):V(y.cwd),children:m("browse")})]}),v&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:v.path}),c.jsxs("div",{className:"nc-fs-list",children:[v.parent&&c.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>V(v.parent),children:["↑ ",m("fs-parent")]}),(v.dirs||[]).map(z=>c.jsxs("button",{className:"nc-fs-item",onClick:()=>V(`${v.path.replace(/\/$/,"")}/${z}`),children:["📁 ",z]},z))]})]}),w&&c.jsx("div",{className:"nc-err",children:w}),c.jsx("select",{value:y.engine,onChange:z=>k(z.target.value),children:h.map(z=>c.jsx("option",{value:z.id,children:z.label},z.id))}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:!!y.boot,onChange:z=>x({boot:z.target.checked})})," boot"]}),R?c.jsxs(c.Fragment,{children:[c.jsx("input",{value:y.command||"",maxLength:4096,placeholder:m("fleet-shell-command-placeholder"),onChange:z=>$(z.target.value)}),c.jsx("small",{children:y.command?m("fleet-shell-command-help"):m("fleet-shell-interactive")}),O&&c.jsx("small",{className:"nc-note",children:m("fleet-shell-command-metachar")})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{value:y.model||"",list:"nc-cell-models",placeholder:m("fleet-model-override"),onChange:z=>x({model:z.target.value})}),c.jsx("datalist",{id:"nc-cell-models",children:((C==null?void 0:C.availableModels)||[]).map(z=>c.jsx("option",{value:z},z))}),c.jsx("textarea",{value:y.prompt||"",placeholder:"prompt",onChange:z=>x({prompt:z.target.value})})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>u(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:f||!y.id||!y.cwd||!y.engine,onClick:p,children:m("save")})]})]})}function C_({token:e,route:t=[],state:n,setState:s,busy:o,onSave:a}){const[u,h]=E.useState(null),[f,p]=E.useState([]),[v,b]=E.useState(""),w=Array.isArray(t)?t.join("/"):"";E.useEffect(()=>{let R=!0;return Ih(e,w?w.split("/"):[]).then(k=>{R&&(p(k.engines||[]),b(""))}).catch(k=>{R&&(p([]),b(String(k.message||k)))}),()=>{R=!1}},[e,w]);const S=n.form,y=R=>s({...n,form:{...S,...R}}),x=async R=>{try{const k=await Oh(e,R,t);h(k),y({cwd:k.path})}catch{}},C=!S.id&&S.tmuxSession?S.tmuxSession.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32):S.id;return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsxs("b",{children:[m("import-as-cell")," · ",S.tmuxSession]}),c.jsx("small",{children:m("import-help")}),c.jsx("input",{value:S.tmuxSession,disabled:!0,placeholder:"tmux session",readOnly:!0}),c.jsx("input",{value:S.id,placeholder:m("name"),onChange:R=>y({id:R.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:S.cwd,placeholder:m("cwd"),onChange:R=>y({cwd:R.target.value})}),c.jsx("button",{className:"nc-btn ghost",type:"button",onClick:()=>u?h(null):x(S.cwd),children:m("browse")})]}),u&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:u.path}),c.jsxs("div",{className:"nc-fs-list",children:[u.parent&&c.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>x(u.parent),children:["↑ ",m("fs-parent")]}),(u.dirs||[]).map(R=>c.jsxs("button",{className:"nc-fs-item",onClick:()=>x(`${u.path.replace(/\/$/,"")}/${R}`),children:["📁 ",R]},R))]})]}),c.jsxs("select",{value:S.engine,onChange:R=>y({engine:R.target.value}),children:[c.jsx("option",{value:"",children:m("import-engine-required")}),f.map(R=>c.jsx("option",{value:R.id,children:R.label},R.id))]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:!!S.boot,onChange:R=>y({boot:R.target.checked})})," boot"]}),(n.err||v)&&c.jsx("div",{className:"nc-err",children:n.err||v}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>s(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:o||!S.tmuxSession||!S.engine||!f.length,onClick:a,children:m(C?"import-as-cell":"save")})]})]})}function ml(e){const t=Os(e);return t===null?`~/${e}`:t?`~/${t}`:"~"}function _N(e){if(!e||typeof e.path!="string"||typeof e.home!="string")return"";const{path:t,home:n}=e;return!n||t===n||!t.startsWith(n+"/")?"":t.slice(n.length+1).replace(/\/+$/,"")}function yN({token:e,route:t,cell:n,busy:s=!1,onSaved:o,onClose:a}){const[u,h]=E.useState(""),[f,p]=E.useState(null),[v,b]=E.useState(!1),[w,S]=E.useState(""),y=typeof(n==null?void 0:n.cwdSuggestion)=="string"&&Os(n.cwdSuggestion)!==null?Os(n.cwdSuggestion):null,[x,C]=E.useState(y),R=n==null?void 0:n.id,k=s||v,$=async H=>{const X=Os(H);if(X===null){p({rel:"",dirs:[],loading:!1,err:m("fleet-cwd-repair-invalid")});return}p({rel:X,dirs:[],loading:!0,err:""});try{const I=await Oh(e,X,t),A=_N(I);p({rel:A,dirs:Array.isArray(I.dirs)?I.dirs:[],loading:!1,err:""})}catch(I){p({rel:X,dirs:[],loading:!1,err:String(I&&I.message||I)})}},O=H=>{if(!f)return;const X=f.rel?`${f.rel}/${H}`:H;$(X)},V=()=>{f!=null&&f.rel&&$(f.rel.split("/").slice(0,-1).join("/"))},Y=()=>{f&&(h(f.rel||""),p(null),S(""),C(null))},z=()=>{x!==null&&(h(x),C(null),S(""))},ne=async()=>{if(k)return;const H=Os(u);if(H===null){S(m("fleet-cwd-repair-invalid"));return}const X=ml(H);let I=!0;try{I=window.confirm(m("fleet-cwd-repair-confirm").replace("{id}",String(R||"")).replace("{path}",X))}catch{I=!1}if(I){b(!0),S(""),C(null);try{const A=await z_(e,R,{cwdRel:H},t);o==null||o(A)}catch(A){const N=A&&A.data||{};if(N.code==="unportable-cwd"){S(m("fleet-cwd-repair-unportable"));const M=Array.isArray(N.cells)?N.cells.find(P=>P&&P.id===R):null,L=M&&typeof M.suggestion=="string"?M.suggestion:null;L!==null&&Os(L)!==null&&C(L)}else S(String(A&&A.message||A))}finally{b(!1)}}};return c.jsxs("div",{className:"nc-set-form nc-fleet-form nc-cwd-repair",children:[c.jsx("b",{children:m("fleet-cwd-repair-title").replace("{id}",String(R||""))}),c.jsx("small",{className:"nc-set-info",children:m("fleet-cwd-repair-help")}),c.jsx("small",{className:"nc-cwd-no-source",children:m("fleet-cwd-repair-no-source-path")}),c.jsxs("label",{className:"nc-field",children:[m("cwd"),c.jsxs("div",{className:"nc-cwd-rel-row",children:[c.jsx("span",{className:"nc-cwd-rel-prefix",children:"~/"}),c.jsx("input",{value:u,placeholder:m("fleet-cwd-repair-placeholder"),autoComplete:"off",spellCheck:"false",autoCapitalize:"none",onChange:H=>h(H.target.value)}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:k,onClick:()=>f?p(null):$(""),children:m(f?"close":"fleet-cwd-repair-browse")})]})]}),c.jsx("div",{className:"nc-cwd-preview",children:m("fleet-cwd-repair-preview").replace("{path}",ml(u))}),f&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:ml(f.rel)}),c.jsxs("div",{className:"nc-fs-list",children:[f.rel&&c.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:V,children:["↑ ",m("fs-parent")]}),f.loading&&c.jsx("div",{className:"nc-fs-empty",children:"…"}),!f.loading&&f.dirs.length===0&&c.jsx("div",{className:"nc-fs-empty",children:m("fleet-cwd-repair-fs-empty")}),!f.loading&&f.dirs.map(H=>c.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>O(H),children:["📁 ",H]},H))]}),f.err&&c.jsx("div",{className:"nc-err",children:f.err}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{type:"button",className:"nc-btn primary",disabled:k||f.loading||!!f.err,onClick:Y,children:m("fleet-cwd-repair-use-current")})})]}),w&&c.jsx("div",{className:"nc-err",role:"alert",children:w}),x!==null&&c.jsxs("div",{className:"nc-cwd-suggestion",role:"status",children:[c.jsx("span",{children:m("fleet-cwd-repair-suggestion")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:z,children:m("fleet-cwd-repair-use-suggestion").replace("{path}",ml(x))})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:v,onClick:a,children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:k,onClick:ne,children:v?"…":m("save")})]})]})}function wN({token:e,readonly:t,targets:n=[],startNewCell:s=!1,initialLocation:o=""}){const[a,u]=E.useState({engines:[],cells:[],managedCatalog:[]}),[h,f]=E.useState({available:!1,capabilities:[]}),[p,v]=E.useState(!1),[b,w]=E.useState(null),[S,y]=E.useState(null),[x,C]=E.useState(!1),[R,k]=E.useState(""),[$,O]=E.useState(""),[V,Y]=E.useState(o),[z,ne]=E.useState(!1),[H,X]=E.useState(null),[I,A]=E.useState(null),[N,M]=E.useState(null),[L,P]=E.useState(!1),[F,T]=E.useState([]),[q,B]=E.useState(null),[D,U]=E.useState("manage"),Z=E.useRef(!1),oe=V?V.split("/"):[],de=E.useCallback(async()=>{try{const le=await _s(e,oe);f(le);try{const xe=await Fh(e,oe);ne(!!xe.readonlyDefault)}catch{ne(!1)}if(le.provider==="builtin"&&(le.capabilities||[]).includes("definitions")){const xe=await Ih(e,oe),ze=new Map((le.engines||[]).map(Ie=>[Ie.id,Ie]));if(xe.engines=(xe.engines||[]).map(Ie=>{var ue;return{...Ie,availableModels:((ue=ze.get(Ie.id))==null?void 0:ue.models)||[]}}),u(xe),(le.capabilities||[]).includes("credentials"))try{T((await n0(e,oe)).credentials||[])}catch{T([])}else T([])}k("")}catch(le){k(String(le.message||le))}finally{v(!0)}},[e,V]);E.useEffect(()=>{de();const le=setInterval(de,5e3);return()=>clearInterval(le)},[de]);const fe=new Set((h.cells||[]).filter(le=>le.active).map(le=>le.cell)),J=h.provider==="builtin"&&(h.capabilities||[]).includes("edit"),ee=(h.capabilities||[]).includes("restore");E.useEffect(()=>{!s||Z.current||!J||!a.engines.length||(Z.current=!0,y({mode:"new",form:k_(a.engines[0].id)}))},[s,J,a.engines]);const pe=async le=>{C(!0),k(""),O("");try{await le(),await de()}catch(xe){k(String(xe.message||xe))}C(!1)},Se=()=>pe(async()=>{var Re;const le=b.mode==="new",xe=b.form,ze=a.managedCatalog||[],Ie=xe.kind==="managed"?$o(ze,xe):null,ue=typeof(Ie==null?void 0:Ie.credentialEnv)=="string"?Ie.credentialEnv:"",G=ue&&xe.credentialValue||"",ie=pN(xe,le,ze);!le&&b.form.kind==="custom"&&!b.form.modelFlag&&(ie.model=null),!le&&b.form.kind==="custom"&&b.form.promptMode!=="flag"&&(ie.promptFlag=null);let W;if(le)W=await s0(e,ie,oe);else{const we=b.original,je=new Set(b.form.envRows.filter(Oe=>!Oe.remove).map(Oe=>Oe.key)),st=(we.envKeys||[]).filter(Oe=>!je.has(Oe)),It=Object.fromEntries(b.form.envRows.filter(Oe=>!Oe.remove&&Oe.key&&(!Oe.configured||Oe.value!=="")).map(Oe=>[Oe.key,Oe.value]));W=await r0(e,we.id,ie,b.form.kind==="custom"?{set:It,remove:st}:void 0,oe)}let se=null;if(ue&&G)try{se=await og(e,ue,G,oe),T(se.credentials||[])}catch{throw await de(),le&&w({mode:"edit",original:{...ie,id:xe.id},form:{...xe,credentialReveal:!1}}),new Error(m(le?"fleet-key-partial-create":"fleet-key-partial-edit"))}await de(),w(null),O(m("fleet-saved"));const ve=((Re=((se==null?void 0:se.credentials)||[]).find(we=>we.envKey===ue))==null?void 0:Re.activeCells)||[],ke=[...new Set([...(W==null?void 0:W.activeCells)||[],...ve])];if(ke.length&&window.confirm(m("fleet-restart-confirm").replace("{cells}",ke.join(", "))))for(const we of ke)await jo(e,we,oe)}),Ze=()=>pe(async()=>{var W,se,ve,ke,Re,we;const le=S.mode==="new",xe=S.form,ze={...le?{id:xe.id}:{},cwd:xe.cwd,engine:xe.engine,boot:!!xe.boot},Ie={...xe.commands||{}},ue=a.engines.find(je=>je.id===xe.engine);((W=ue==null?void 0:ue.managed)==null?void 0:W.client)==="shell"&&typeof xe.command=="string"&&xe.command.length?Ie[xe.engine]=xe.command:((se=ue==null?void 0:ue.managed)==null?void 0:se.client)==="shell"&&delete Ie[xe.engine],(Object.keys(Ie).length||!le)&&(ze.commands=Ie),le?(((ve=ue==null?void 0:ue.managed)==null?void 0:ve.client)!=="shell"&&xe.model&&(ze.model=xe.model),((ke=ue==null?void 0:ue.managed)==null?void 0:ke.client)!=="shell"&&xe.prompt&&(ze.prompt=xe.prompt)):(ze.model=((Re=ue==null?void 0:ue.managed)==null?void 0:Re.client)==="shell"?null:xe.model||null,((we=ue==null?void 0:ue.managed)==null?void 0:we.client)!=="shell"&&(ze.prompt=xe.prompt||null));const G=le?await a0(e,ze,oe):await z_(e,S.original.id,ze,oe),ie=le?xe.id:S.original.id;y(null),O(m("fleet-saved")),!le&&(G!=null&&G.active)&&window.confirm(m("fleet-restart-confirm").replace("{cells}",ie))&&await jo(e,ie,oe)}),$e=t||z,He=le=>F.find(xe=>{var ze;return(ze=xe.engines)==null?void 0:ze.includes(le.id)})||null,vt=()=>pe(async()=>{var ze;const le=await og(e,q.envKey,q.value,oe);T(le.credentials||[]),B(null),O(m("fleet-credential-saved"));const xe=((ze=(le.credentials||[]).find(Ie=>Ie.envKey===q.envKey))==null?void 0:ze.activeCells)||[];if(xe.length&&window.confirm(m("fleet-restart-confirm").replace("{cells}",xe.join(", "))))for(const Ie of xe)await jo(e,Ie,oe)}),Xe=le=>pe(async()=>{if(!window.confirm(m("fleet-credential-remove-confirm").replace("{key}",le.envKey)))return;const xe=await i0(e,le.envKey,oe);T(xe.credentials||[]),O(m("fleet-credential-removed"))}),St=le=>X({...le,route:Array.isArray(le==null?void 0:le.route)?le.route:oe}),Et=async le=>{if(!H)return;const xe=H.cell||H.id,ze=Array.isArray(H.route)?H.route:oe;le.action==="up"?await Ah(e,{cell:xe,boot:!!le.boot,...le.engine?{engine:le.engine}:{},...le.model!==void 0?{model:le.model}:{},...le.permissionPolicy?{permissionPolicy:le.permissionPolicy}:{}},ze):await Cl(e,{cell:xe,boot:!!le.boot},ze)},rt=(le,xe)=>{k(""),A({mode:"new",route:Array.isArray(xe)?xe:oe,form:{tmuxSession:le.name,id:"",engine:"",cwd:"",boot:!1},err:""})},ct=()=>pe(async()=>{const le=I.form;if(!le.engine){A({...I,err:m("import-engine-required")});return}await l0(e,{tmuxSession:le.tmuxSession,id:le.id||void 0,engine:le.engine,cwd:le.cwd||void 0,boot:!!le.boot},le.route||oe),A(null),O(m("fleet-saved"))}),ot=({engineRows:le=[],cellRows:xe=[]})=>pe(async()=>{const ze=le.filter(Re=>Re.selected),Ie=ze.map(Re=>Fw(Re.engine));if(Ie.some(Re=>!Re))throw new Error(m("fleet-backup-invalid-engine"));const ue=ze.filter(Re=>Re.exists).map(Re=>Re.engine.id);if(ue.length&&!window.confirm(m("fleet-backup-confirm-engine-overwrite").replace("{engines}",ue.join(", "))))return;const G=[...new Set([...a.engines.map(Re=>Re.id),...Ie.map(Re=>Re.id)])],ie=[];for(const Re of xe.filter(we=>we.selected)){const we=uN(Re.cell,Re.engine,G);if(!we)throw new Error(`${Re.cell.id}: ${m("fleet-backup-engine-missing")}`);ie.push(we)}const W=xe.filter(Re=>Re.selected&&Re.exists).map(Re=>Re.cell.id);if(W.length&&!window.confirm(m("fleet-backup-confirm-overwrite").replace("{cells}",W.join(", "))))return;const se=Ie.length?await u0(e,Ie,ue.length>0,oe):{needsRestart:[]},ve=ie.length?await c0(e,ie,oe):{needsRestart:[]},ke=[...new Set([...se.needsRestart||[],...ve.needsRestart||[]])];P(!1),O(`${m("fleet-backup-restored").replace("{n}",String(ie.length))}${Ie.length?` · ${Ie.length} ${m("fleet-engines").toLowerCase()}`:""}${ke.length?` · ${m("fleet-backup-needs-restart").replace("{cells}",ke.join(", "))}`:""}`)}),ut=c.jsxs("label",{className:"nc-field",children:[m("location"),c.jsxs("select",{value:V,onChange:le=>{Y(le.target.value),w(null),y(null),k(""),O(""),ne(!1),v(!1),f({available:!1,capabilities:[]}),u({engines:[],cells:[],managedCatalog:[]}),T([]),B(null)},children:[c.jsx("option",{value:"",children:m("local")}),n.map(le=>c.jsxs("option",{value:le.route.join("/"),disabled:le.status&&le.status!=="up",children:[le.label,le.status&&le.status!=="up"?` · ${m("node-offline")}`:""]},le.route.join("/")))]})]}),dt=c.jsxs("div",{className:"nc-fleet-view-tabs",role:"tablist","aria-label":m("tab-fleet"),children:[c.jsx("button",{type:"button",role:"tab","aria-selected":D==="manage",className:`nc-set-tabbtn${D==="manage"?" on":""}`,onClick:()=>U("manage"),children:m("fleet-manage-location")}),c.jsx("button",{type:"button",role:"tab","aria-selected":D==="overview",className:`nc-set-tabbtn${D==="overview"?" on":""}`,onClick:()=>U("overview"),children:m("fleet-network-overview")})]});return p?J?c.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[dt,D==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-overview-help")}),c.jsx(Nd,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-manage-help")}),ut,c.jsxs("div",{className:"nc-set-row nc-fleet-backup-actions",children:[c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),P(!0)},children:m("fleet-backup")}),c.jsx("small",{children:m("fleet-backup-help")})]}),c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:m("fleet-cells")}),c.jsx("span",{className:"nc-fleet-head-actions",children:c.jsxs("button",{className:"nc-btn primary",disabled:$e||x||!a.engines.length,onClick:()=>{var le;k(""),y({mode:"new",form:k_((le=a.engines[0])==null?void 0:le.id)})},children:["+ ",m("add")]})})]}),a.cells.map(le=>{const xe=fe.has(le.id),ze=h.capabilities||[],Ie=le.needsRepair===!0;return c.jsxs("div",{className:"nc-fleet-item",children:[c.jsxs("span",{children:[c.jsx("b",{children:le.id}),c.jsxs("small",{children:[le.engine," · ",Ie?c.jsx("span",{className:"nc-fleet-tag nc-fleet-tag-warn",children:m("fleet-cwd-needs-repair")}):le.cwd,xe?` · ${m("service-active")}`:` · ${m("cell-off")}`]})]}),c.jsxs("span",{children:[xe&&ze.includes("down")&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>pe(()=>Cl(e,{cell:le.id},oe)),children:m("stop")}),!xe&&ze.includes("up")&&c.jsx("button",{className:"nc-btn primary",disabled:$e||x,onClick:()=>St({cell:le.id,id:le.id,engine:le.engine,model:le.model,models:le.models,permissionPolicies:le.permissionPolicies,active:!1,boot:le.boot}),children:m("start")}),xe&&ze.includes("restart")&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>pe(()=>jo(e,le.id,oe)),children:m("restart")}),Ie?c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),M(le)},children:m("fleet-cwd-repair")}):c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{var ue;k(""),y({mode:"edit",original:le,form:{...le,commands:{...le.commands||{}},command:((ue=le.commands)==null?void 0:ue[le.engine])||""}})},children:m("edit")}),c.jsx("button",{className:"nc-btn danger",disabled:$e||x,onClick:()=>pe(async()=>{window.confirm(m("fleet-remove-cell").replace("{id}",le.id))&&await F_(e,le.id,!0,oe)}),children:"×"})]})]},le.id)}),c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:m("fleet-engines")}),c.jsxs("button",{className:"nc-btn primary",disabled:$e||x,onClick:()=>{k(""),w({mode:"new",form:dN()})},children:["+ ",m("add")]})]}),a.engines.map(le=>{var ze,Ie;const xe=He(le);return c.jsxs("div",{className:"nc-fleet-item",children:[c.jsxs("span",{children:[c.jsx("b",{children:le.label}),c.jsx("small",{children:le.managed?`${le.id} · ${le.managed.client} / ${le.managed.provider} · ${(ze=le.managedInfo)!=null&&ze.configured?m("fleet-ready"):((Ie=le.managedInfo)==null?void 0:Ie.reason)||m("fleet-not-ready")}`:`${le.id} · ${le.command}`}),xe&&c.jsxs("small",{children:[xe.envKey," · ",m(`fleet-credential-source-${xe.source||"missing"}`)]})]}),c.jsxs("span",{children:[xe&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),B({envKey:xe.envKey,value:""})},children:xe.configured?m("fleet-credential-change"):m("fleet-credential-set")}),(xe==null?void 0:xe.source)==="local"&&c.jsx("button",{className:"nc-btn danger",disabled:$e||x,onClick:()=>Xe(xe),children:m("fleet-credential-forget")}),c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),w({mode:"edit",original:le,form:fN(le)})},children:m("edit")}),c.jsx("button",{className:"nc-btn danger",disabled:$e||x,onClick:()=>pe(async()=>{window.confirm(m("fleet-remove-engine").replace("{id}",le.id))&&await o0(e,le.id,oe)}),children:"×"})]})]},le.id)})]}),b&&c.jsx(Ms,{onClose:()=>w(null),label:m("fleet-new-engine"),error:R,children:c.jsx(gN,{state:b,setState:w,busy:x,onSave:Se,catalog:a.managedCatalog||[]})}),S&&c.jsx(Ms,{onClose:()=>y(null),label:m("fleet-new-cell"),error:R,children:c.jsx(vN,{token:e,route:oe,targets:n,location:V,setLocation:Y,state:S,setState:y,engines:a.engines,busy:x,onSave:Ze})}),N&&c.jsx(Ms,{onClose:()=>M(null),label:m("fleet-cwd-repair-title").replace("{id}",N.id),error:"",children:c.jsx(yN,{token:e,route:oe,cell:N,busy:x,onSaved:async()=>{M(null),O(m("fleet-cwd-repaired")),await de()},onClose:()=>M(null)})}),$&&c.jsx("div",{className:"nc-set-note",children:$}),R&&c.jsx("div",{className:"nc-err",children:R}),L&&c.jsx(Ms,{onClose:()=>P(!1),label:m("fleet-backup"),error:R,children:c.jsx(mN,{cells:a.cells,engines:a.engines,busy:x,canRestore:ee,onRestore:ot,onClose:()=>P(!1)})}),q&&c.jsx(Ms,{onClose:()=>B(null),label:m("fleet-credential-title"),error:R,children:c.jsxs("div",{className:"nc-fleet-form nc-credential-form",children:[c.jsx("b",{children:m("fleet-credential-title")}),c.jsx("small",{children:m("fleet-credential-help")}),c.jsxs("label",{className:"nc-field",children:[q.envKey,c.jsx("input",{type:"password",autoComplete:"off",spellCheck:"false",autoCapitalize:"none",value:q.value,onChange:le=>B({...q,value:le.target.value})})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>B(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:x||!q.value,onClick:vt,children:m("save")})]})]})}),I&&c.jsx(Ms,{onClose:()=>A(null),label:m("import-as-cell"),error:R,children:c.jsx(C_,{token:e,route:I.route||oe,state:I,setState:A,busy:x,onSave:ct})}),H&&c.jsx(Nl,{cell:H,token:e,route:Array.isArray(H.route)?H.route:oe,onConfirm:async le=>{try{await Et(le)}finally{await de()}},onClose:()=>X(null)})]}):c.jsxs("div",{className:"nc-set-tab",children:[dt,D==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-overview-help")}),c.jsx(Nd,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[ut,c.jsxs("div",{className:"nc-set-info",children:[m(R?"fleet-editor-load-error":"fleet-editor-unavailable"),!R&&h.reason?` ${h.reason}`:""]})]}),R&&c.jsx("div",{className:"nc-err",children:R}),I&&c.jsx(Ms,{onClose:()=>A(null),label:m("import-as-cell"),error:R,children:c.jsx(C_,{token:e,route:I.route||oe,state:I,setState:A,busy:x,onSave:ct})}),H&&c.jsx(Nl,{cell:H,token:e,route:Array.isArray(H.route)?H.route:oe,onConfirm:async le=>{try{await Et(le)}finally{await de()}},onClose:()=>X(null)})]}):c.jsxs("div",{className:"nc-set-tab",children:[dt,D==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-overview-help")}),c.jsx(Nd,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[ut,c.jsx("div",{className:"nc-set-info",children:m("fleet-editor-loading")})]})]})}const bf="nc_notification_speech_v1",gl="nc-notification-speech",Nh="nc-notification-speech-preview",SN=320,bN=2,xN=3e4,kN=1e4,CN=6e4,EN=64,E_=Object.freeze({enabled:!1}),NN=Object.freeze({it:"it-IT",en:"en-US",es:"es-ES"}),RN=Object.freeze({it:new Set(["che","con","correzione","della","delle","difetto","il","lavoro","nessun","non","per","pronto","pubblicata","pubblicato","rilascio","sono","stato","tutti","verificata","verificato","versione","completata","completato","riepilogo"]),en:new Set(["all","and","completed","fix","for","issue","no","published","ready","release","summary","the","verified","version","with","work"]),es:new Set(["con","correccion","defecto","el","esta","para","publicada","publicado","resumen","sin","todos","trabajo","verificada","verificado","version","y"])}),xf=new WeakSet;function kf(e){return{enabled:(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).enabled===!0}}function Hw(){try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function N_(e=Hw()){if(!e)return{...E_};try{return kf(JSON.parse(e.getItem(bf)||"null"))}catch{return{...E_}}}function jN(e,t=Hw()){const n=kf(e);if(t)try{t.setItem(bf,JSON.stringify(n))}catch{}return n}function Br(){try{return typeof window<"u"?window:null}catch{return null}}function Ho(e=Br()){try{return!!(e&&e.speechSynthesis&&typeof e.speechSynthesis.speak=="function"&&typeof e.SpeechSynthesisUtterance=="function")}catch{return!1}}function Ww(e=Br()){return!!(e&&(typeof e=="object"||typeof e=="function")&&xf.has(e))}function Rh(e=Br()){e&&(typeof e=="object"||typeof e=="function")&&xf.delete(e)}function Er(e){const t=String(e||"").trim().toLowerCase().split("-")[0];return NN[t]||""}function Zl(e){return String(e||"").normalize("NFC").replace(/[\p{Cc}\p{Cf}]+/gu," ").replace(/\s+/g," ").trim()}function PN(e){const t=Zl(e).normalize("NFD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase(),n=new Set(t.match(new RegExp("\\p{L}+","gu"))||[]);if(n.size<4)return"";const s=Object.entries(RN).map(([o,a])=>({lang:o,score:[...n].reduce((u,h)=>u+(a.has(h)?1:0),0)})).sort((o,a)=>a.score-o.score);return s[0].score>=3&&s[0].score-s[1].score>=2?s[0].lang:""}function LN(e,t){const n=Er(e&&e.lang);return n||Er(PN(e&&e.body))||Er(t)}function Uw(e){try{const t=e&&e.speechSynthesis&&e.speechSynthesis.getVoices;return typeof t=="function"?Array.from(t.call(e.speechSynthesis)||[]).filter(Boolean):[]}catch{return[]}}function Kw(e,t){const n=Er(t);if(!n)return null;const s=Array.from(e||[]).filter(h=>h&&typeof h.lang=="string"&&h.lang.trim()),o=s.filter(h=>h.lang.trim().toLowerCase()===n.toLowerCase()),a=n.slice(0,2).toLowerCase(),u=s.filter(h=>h.lang.trim().toLowerCase().split("-")[0]===a);return o.find(h=>h.default===!0)||o[0]||u.find(h=>h.default===!0)||u[0]||null}function R_(e){return Zl(e).replace(/\bBearer\s+\S+/gi,"Bearer [redacted]").replace(/\b(?:sk|hf|zai|xox[baprs]|gh[pousr]|npm)[_-][A-Za-z0-9._-]{8,}\b/gi,"[redacted]").replace(/\b(?:token|password|secret|credential|api[_-]?key)\s*[=:]\s*(?:"[^"]*"|'[^']*'|\S+)/gi,"[redacted]").replace(/\b[A-Z][A-Z0-9_]{2,}\s*=\s*(?:"[^"]*"|'[^']*'|\S+)/g,"[redacted]").replace(/(?:\/home\/[^/\s]+|\/Users\/[^/\s]+|\/data\/(?:data|user\/\d+)\/[^/\s]+)(?:\/[^\s]*)?/g,"[private path]").replace(/\b[A-Za-z]:\\Users\\[^\\\s]+(?:\\[^\s]*)?/g,"[private path]")}function TN(e,t=SN){const n=R_(e&&e.title),s=R_(e&&e.body),o=[n,s&&s!==n?s:""].filter(Boolean).join(". "),a=Array.from(o);return a.length<=t?o:`${a.slice(0,Math.max(0,t-1)).join("").trimEnd()}…`}function DN(e){try{return!!(e&&e.visibilityState==="visible"&&typeof e.hasFocus=="function"&&e.hasFocus())}catch{return!1}}function qw(e=Br()){if(!Ho(e))return!1;try{return e.speechSynthesis.cancel(),!0}catch{return!1}}function MN(e){try{e&&typeof e.dispatchEvent=="function"&&typeof e.Event=="function"&&e.dispatchEvent(new e.Event(Nh))}catch{}}function AN(e,t,n=Br(),s={}){var p;if(Rh(n),!Ho(n))return Promise.resolve(!1);const o=Zl(e);if(!o||(p=s.signal)!=null&&p.aborted)return Promise.resolve(!1);const a=Number.isFinite(s.timeoutMs)&&s.timeoutMs>0?s.timeoutMs:kN,u=s.setTimer||((v,b)=>setTimeout(v,b)),h=s.clearTimer||(v=>clearTimeout(v)),f=s.signal;return MN(n),new Promise(v=>{let b=!1,w=!1,S=null,y=null;const x=C=>{if(!b){if(b=!0,f&&y&&f.removeEventListener("abort",y),S!==null&&h(S),C)xf.add(n);else try{n.speechSynthesis.cancel()}catch{}v(C)}};y=()=>x(!1),f&&f.addEventListener("abort",y,{once:!0});try{n.speechSynthesis.cancel();const C=new n.SpeechSynthesisUtterance(o);C.lang=Er(t);const R=Kw(Uw(n),C.lang);R&&(C.voice=R),C.onstart=()=>{w=!0},C.onend=()=>x(w),C.onerror=()=>x(!1),S=u(()=>x(!1),a),n.speechSynthesis.speak(C)}catch{x(!1)}})}function IN(e={}){const t=e.scope||Br(),n=e.document||t&&t.document,s=Number.isInteger(e.maxPending)&&e.maxPending>=0?e.maxPending:bN,o=Number.isFinite(e.watchdogMs)&&e.watchdogMs>0?e.watchdogMs:xN,a=Number.isFinite(e.dedupWindowMs)&&e.dedupWindowMs>0?e.dedupWindowMs:CN,u=Number.isInteger(e.maxDedup)&&e.maxDedup>0?e.maxDedup:EN,h=e.now||Date.now,f=e.setTimer||((I,A)=>setTimeout(I,A)),p=e.clearTimer||(I=>clearTimeout(I)),v=e.isPrimed||(()=>Ww(t)),b=t&&t.speechSynthesis;let w=null,S=null,y=[],x=[],C=()=>{};const R=new Map,k=()=>{x=Uw(t)};if(k(),b&&typeof b.addEventListener=="function")b.addEventListener("voiceschanged",k),C=()=>b.removeEventListener("voiceschanged",k);else if(b&&"onvoiceschanged"in b){const I=b.onvoiceschanged,A=(...N)=>{k(),typeof I=="function"&&I.apply(b,N)};b.onvoiceschanged=A,C=()=>{b.onvoiceschanged===A&&(b.onvoiceschanged=I)}}const $=I=>{if(I&&typeof I.id=="string"&&I.id)return`id:${I.id}`;const A=Number(I&&I.ts),N=Zl(I&&I.title);return Number.isFinite(A)&&N?`frame:${A}:${N}`:""},O=I=>{if(!I)return!0;const A=h();for(const[N,M]of R)A-M>=a&&R.delete(N);if(R.has(I))return!1;for(R.set(I,A);R.size>u;)R.delete(R.keys().next().value);return!0},V=()=>{S!==null&&p(S),S=null},Y=()=>{V(),w&&(w.onend=null,w.onerror=null,w=null),qw(t)},z=I=>{if(!Ho(t))return y=[],"unsupported";let A;try{A=new t.SpeechSynthesisUtterance(I.text),A.lang=Er(I.lang);const M=Kw(x,A.lang);M&&(A.voice=M)}catch{return y=[],"error"}w=A;const N=()=>{if(w!==A)return;V(),w=null,A.onend=null,A.onerror=null;const M=y.shift();M&&z(M)};A.onend=N,A.onerror=N;try{return S=f(()=>{if(w!==A)return;w=null,A.onend=null,A.onerror=null;try{t.speechSynthesis.cancel()}catch{}V();const M=y.shift();M&&z(M)},o),t.speechSynthesis.speak(A),"speaking"}catch{return N(),"error"}},ne=(I,A)=>{if(!Ho(t))return"unsupported";const N=TN(I);if(!N)return"empty";if(!O($(I)))return"duplicate";if(!DN(n))return"inactive";if(!v())return"unprimed";const M={text:N,lang:A};return I&&I.urgency==="high"?(y=[],Y(),z(M)):w?s===0?"dropped":(y.length>=s&&y.shift(),y.push(M),"queued"):z(M)},H=()=>{y=[],Y()};return{enqueue:ne,stop:H,dispose:()=>{H(),C(),C=()=>{}}}}function Vw(){const[e,t]=E.useState(N_);E.useEffect(()=>{const s=o=>{if((o==null?void 0:o.type)==="storage"&&o.key!==bf&&o.key!==null)return;const a=(o==null?void 0:o.type)===gl?kf(o.detail):N_();t(a)};return window.addEventListener(gl,s),window.addEventListener("storage",s),()=>{window.removeEventListener(gl,s),window.removeEventListener("storage",s)}},[]);const n=E.useCallback(s=>{const o=jN({enabled:s===!0});return t(o),window.dispatchEvent(new CustomEvent(gl,{detail:o})),o.enabled},[]);return[e.enabled,n]}function BN({text:e}){const[t,n]=E.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return c.jsxs("div",{className:"nc-set-copyline",children:[c.jsx("code",{children:e}),c.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:s,children:[c.jsx(it,{name:"copy",size:14})," ",m(t?"copied":"copy")]})]})}function ON({value:e}){const[t,n]=E.useState("");return E.useEffect(()=>{let s=!0;return M2.toDataURL(e,{margin:1,width:220}).then(o=>{s&&n(o)}).catch(()=>{}),()=>{s=!1}},[e]),t?c.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function zN({token:e,nodes:t,roster:n,settings:s,readonly:o,refresh:a,refreshAliases:u}){const[h,f]=E.useState(null),[p,v]=E.useState(null),[b,w]=E.useState({}),[S,y]=E.useState(null),[x,C]=E.useState({ssh:"",sshPort:"",name:""}),[R,k]=E.useState(""),[$,O]=E.useState(""),[V,Y]=E.useState(""),[z,ne]=E.useState(!1),[H,X]=E.useState(null),[I,A]=E.useState(null),N=Date.now(),M=s&&s.deviceName||"",L=(t||[]).filter(J=>J&&J.direction==="outbound"&&J.name&&J.ssh),P=L.find(J=>J.name===R)||L[0]||null,F=L.find(J=>J.name===$)||L[0]||null,T=F?Cg(F.tunnel,N):null,q=F!=null&&F.shared?T!=null&&T.up?"share-local-active":"share-local-pending":T!=null&&T.up?"share-local-private":"share-local-private-down",B=[{key:"peer-group-hubs",rows:(t||[]).filter(J=>J.kind!=="transitive"&&J.relation!=="client")},{key:"peer-group-clients",rows:(t||[]).filter(J=>J.kind!=="transitive"&&J.relation==="client")},{key:"peer-group-routed",rows:(t||[]).filter(J=>J.kind==="transitive")}],D=async(J,ee)=>{f(null),v(`${J}:${ee}`);try{const pe=await $h(e,J,ee);ee==="test"&&w(Se=>({...Se,[J]:pe})),await a()}catch(pe){f(`${J}: ${String(pe.message||pe)}`)}v(null)},U=async J=>{f(null),v(`${J}:remove`);try{await y0(e,J),A(null),await a()}catch(ee){f(`${J}: ${String(ee.message||ee)}`)}v(null)},Z=J=>X({name:J.name,direction:J.direction,label:J.label||J.name,ssh:J.ssh||"",sshPort:J.sshPort?String(J.sshPort):"",autostart:J.autostart===!0,visibility:J.visibility||"network",selected:[...J.selected||[]]}),oe=async()=>{if(!H||!jr(H.label)){f(m("err-label"));return}const J=H.direction==="inbound"?{label:H.label,visibility:H.visibility,selected:H.visibility==="selected"?H.selected:[]}:{label:H.label,ssh:H.ssh,autostart:H.autostart,...H.sshPort?{sshPort:Number(H.sshPort)}:{}};f(null),v(`${H.name}:edit`);try{await _0(e,H.name,J),X(null),await a()}catch(ee){f(`${H.name}: ${String(ee.message||ee)}`)}v(null)},de=async J=>{if(F){f(null),v(`${F.name}:share`);try{await w0(e,F.name,J),await a()}catch(ee){const pe=ee!=null&&ee.data&&ee.data.shared===!1?ee.data:null;if(pe)try{await a()}catch{}const Se=ee!=null&&ee.data&&typeof ee.data.hint=="string"?ee.data.hint:"",Ze=(pe==null?void 0:pe.revoked)===!0&&(pe==null?void 0:pe.localReconcilePending)===!0?m("share-off-local-reconcile-pending"):(pe==null?void 0:pe.revoked)===!1&&(pe==null?void 0:pe.reconcilePending)===!0?m("share-off-hub-reconcile-pending"):"";f(`${F.name}: ${String(ee.message||ee)}${Se?` — ${Se}`:""}${Ze?` — ${Ze}`:""}`)}v(null)}},fe=async()=>{if(f(null),P){const pe=kg({name:P.name,ssh:P.ssh,sshPort:P.sshPort||""});if(!pe.ok){f(m(pe.error));return}v("invite");try{y(await lg(e,{ssh:pe.value.ssh,...pe.value.sshPort?{sshPort:pe.value.sshPort}:{}},[P.name]))}catch(Se){f(String(Se.message||Se))}v(null);return}const J=ms(x.name||V||M||"NexusCrew"),ee=kg({name:J,ssh:x.ssh,sshPort:x.sshPort});if(!ee.ok){f(m(ee.error));return}v("invite");try{y(await lg(e,{...V||M?{label:V||M}:{},name:J,ssh:ee.value.ssh,...ee.value.sshPort?{sshPort:ee.value.sshPort}:{}}))}catch(pe){f(String(pe.message||pe))}v(null)};return c.jsxs("div",{className:"nc-set-tab",children:[c.jsx("div",{className:"nc-sheet-label",children:m("peer-inventory-title")}),(t||[]).length===0&&c.jsx("div",{className:"nc-empty",children:m("no-nodes")}),B.map(J=>J.rows.length>0&&c.jsxs("div",{className:"nc-peer-group",children:[c.jsxs("div",{className:"nc-peer-group-title",children:[m(J.key)," ",c.jsx("span",{children:J.rows.length})]}),J.rows.map(ee=>{var He,vt;const pe=ee.kind==="transitive",Se=pe?{up:ee.stale!==!0,label:ee.stale===!0?"peer-routed-stale":"peer-routed"}:Cg(ee.tunnel,N),Ze=b[ee.name],$e=ee.actions||{};return c.jsxs("div",{className:`nc-set-node${pe?" routed":""}`,children:[c.jsxs("div",{className:"nc-set-node-head",children:[c.jsx("span",{className:`nc-dot ${Se.up?"on":""}`}),c.jsx("b",{children:ee.label||ee.name}),c.jsxs("small",{children:[ee.name,pe?` · ${ee.route.join(" → ")}`:ee.direction==="outbound"?` · SSH ${ee.ssh||""}`:` · ${m("node-connected-client")}`,(He=ee.tunnel)!=null&&He.transport?` · ${ee.tunnel.transport} ${m("transport-used")}`:""]}),c.jsxs("span",{className:`nc-set-tunnel${Se.up?" up":""}`,children:[m(Se.label),Se.since?` · ${Se.since}`:""]})]}),!pe&&ee.direction==="inbound"&&c.jsx("div",{className:"nc-set-info",children:m(ee.shared?"peer-shared":"peer-private")}),$e.visibility&&ee.shared&&c.jsxs(c.Fragment,{children:[c.jsxs("select",{value:ee.visibility||"network",disabled:o||!!p,onChange:async Xe=>{v(`${ee.name}:visibility`);try{await ug(e,ee.name,Xe.target.value),await a()}catch(St){f(String(St.message||St))}v(null)},children:[c.jsx("option",{value:"network",children:m("visibility-network")}),c.jsx("option",{value:"relay-only",children:m("visibility-relay")}),c.jsx("option",{value:"selected",children:m("visibility-selected")})]}),ee.visibility==="selected"&&c.jsx("div",{className:"nc-set-row",children:(t||[]).filter(Xe=>Xe.name!==ee.name&&Xe.nodeId).map(Xe=>{const St=(ee.selected||[]).includes(Xe.nodeId);return c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:St,disabled:o||!!p,onChange:async Et=>{const rt=Et.target.checked?[...ee.selected||[],Xe.nodeId]:(ee.selected||[]).filter(ct=>ct!==Xe.nodeId);v(`${ee.name}:visibility`);try{await ug(e,ee.name,"selected",rt),await a()}catch(ct){f(String(ct.message||ct))}v(null)}})," ",Xe.label||Xe.name]},Xe.nodeId)})})]}),c.jsxs("div",{className:"nc-set-node-actions",children:[$e.edit&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>Z(ee),children:m("edit")}),$e.test&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>D(ee.name,"test"),children:m("node-test")}),$e.disconnect&&Se.up&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>D(ee.name,"down"),children:m("tunnel-stop")}),$e.connect&&!Se.up&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>D(ee.name,"up"),children:m("tunnel-start")}),$e.restart&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>D(ee.name,"restart"),children:m("tunnel-restart")}),$e.remove&&c.jsxs("button",{type:"button",className:"nc-btn danger",disabled:o||!!p,title:m(o?"settings-readonly":"delete"),onClick:()=>A(ee.name),children:[c.jsx(it,{name:"trash",size:14})," ",m("delete")]})]}),(H==null?void 0:H.name)===ee.name&&c.jsxs("div",{className:"nc-set-form nc-node-editor",children:[c.jsxs("label",{className:"nc-field",children:[m("node-display-label"),c.jsx("input",{value:H.label,disabled:!!p,onChange:Xe=>X({...H,label:Xe.target.value})})]}),H.direction==="outbound"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"nc-field",children:[m("node-ssh-label"),c.jsx("input",{value:H.ssh,disabled:!!p,onChange:Xe=>X({...H,ssh:Xe.target.value})})]}),c.jsxs("label",{className:"nc-field",children:[m("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",value:H.sshPort,disabled:!!p,onChange:Xe=>X({...H,sshPort:Xe.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:H.autostart,disabled:!!p,onChange:Xe=>X({...H,autostart:Xe.target.checked})})," ",m("boot-persist")]})]}):c.jsxs("label",{className:"nc-field",children:[m("peer-visibility"),c.jsxs("select",{value:H.visibility,disabled:!!p,onChange:Xe=>X({...H,visibility:Xe.target.value}),children:[c.jsx("option",{value:"network",children:m("visibility-network")}),c.jsx("option",{value:"relay-only",children:m("visibility-relay")}),c.jsx("option",{value:"selected",children:m("visibility-selected")})]})]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:!!p,onClick:oe,children:m("save")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>X(null),children:m("cancel")})]})]}),I===ee.name&&c.jsxs("div",{className:"nc-set-confirm",children:[c.jsx("b",{children:m("node-remove-confirm").replace("{name}",ee.label||ee.name)}),c.jsx("small",{children:m("node-remove-warning")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn danger",disabled:!!p,onClick:()=>U(ee.name),children:m("delete")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>A(null),children:m("cancel")})]})]}),((vt=ee.health)==null?void 0:vt.detail)&&c.jsx("div",{className:`nc-set-test${ee.health.status==="healthy"?" ok":ee.health.status==="passive"?"":" ko"}`,children:ee.health.detail}),Ze&&c.jsxs("div",{className:`nc-set-test${Ze.ok?" ok":" ko"}`,children:[Ze.result,Ze.detail?` — ${Ze.detail}`:""]})]},`${ee.kind||"direct"}:${ee.nodeId||ee.name}`)})]},J.key)),(n||[]).some(J=>!J.direct&&J.instanceId)&&c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("routed-node-aliases")}),c.jsx("small",{className:"nc-set-hint",children:m("routed-node-aliases-help")}),(n||[]).filter(J=>!J.direct&&J.instanceId).map(J=>c.jsxs("div",{className:"nc-set-node",children:[c.jsxs("div",{className:"nc-set-node-head",children:[c.jsx("span",{className:`nc-dot ${J.status==="up"?"on":""}`}),c.jsx("b",{children:J.label||J.name}),c.jsx("small",{children:(J.route||[]).join(" › ")})]}),c.jsxs("div",{className:"nc-set-node-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:async()=>{const ee=window.prompt(m("node-local-alias"),J.alias||"");if(ee!=null){if(ee.trim()&&!jr(ee.normalize("NFC"))){f(m("err-label"));return}v(`${J.instanceId}:alias`),f(null);try{ee.trim()?await v0(e,J.instanceId,ee):await cg(e,J.instanceId),u()}catch(pe){f(String(pe.message||pe))}v(null)}},children:m("alias-on-device")}),J.alias&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:async()=>{v(`${J.instanceId}:alias-reset`),f(null);try{await cg(e,J.instanceId),u()}catch(ee){f(String(ee.message||ee))}v(null)},children:m("reset-alias")})]})]},J.instanceId))]}),F&&c.jsxs("div",{className:"nc-set-form nc-local-share",children:[c.jsx("div",{className:"nc-sheet-label",children:m("share-local-heading")}),L.length>1&&c.jsxs("label",{className:"nc-field",children:[m("share-local-hub"),c.jsx("select",{value:F.name,disabled:o||!!p,onChange:J=>O(J.target.value),children:L.map(J=>c.jsx("option",{value:J.name,children:J.label||J.name},J.name))})]}),c.jsxs("label",{className:"nc-check nc-node-share",children:[c.jsx("input",{type:"checkbox",checked:F.shared===!0,disabled:o||!!p,onChange:J=>de(J.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("share-local-through").replace("{device}",M||m("local")).replace("{hub}",F.label||F.name)}),c.jsx("small",{children:m(F.shared?"share-node-on-desc":"share-node-off-desc")})]})]}),c.jsx("div",{className:`nc-set-test${F.shared&&(T!=null&&T.up)?" ok":T!=null&&T.up?"":" ko"}`,children:m(q)}),!(T!=null&&T.up)&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>de(F.shared===!0),children:m("share-local-reconnect")})]}),c.jsx(Tw,{token:e,deviceDefault:M,localNodeId:s&&s.nodeId||"",localNameDefault:s&&s.localName||"",readonly:o,onSuccess:a}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("invite-node")}),c.jsx("small",{className:"nc-set-hint",children:m(P?"invite-network-hint":"invite-v2-hint")}),P?c.jsxs(c.Fragment,{children:[L.length>1&&c.jsxs("label",{className:"nc-field",children:[m("invite-network-label"),c.jsx("select",{value:P.name,disabled:o||!!p,onChange:J=>{k(J.target.value),y(null)},children:L.map(J=>c.jsx("option",{value:J.name,children:J.label||J.name},J.name))})]}),c.jsxs("div",{className:"nc-set-info nc-invite-endpoint",children:[m("invite-network-via"),": ",c.jsx("b",{children:P.label||P.name})," · ",P.ssh,P.sshPort?`:${P.sshPort}`:""]}),c.jsx("small",{className:"nc-set-hint",children:m("invite-network-route")})]}):c.jsxs("label",{className:"nc-field",children:[m("invite-endpoint-label"),c.jsx("input",{placeholder:"user@host",value:x.ssh,disabled:o,onChange:J=>C({...x,ssh:J.target.value})}),c.jsx("small",{className:"nc-set-hint",children:m("invite-endpoint-needed")})]}),!P&&z&&c.jsxs("div",{className:"nc-invite-advanced",children:[c.jsxs("label",{className:"nc-field",children:[m("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",placeholder:"22",value:x.sshPort,disabled:o,onChange:J=>C({...x,sshPort:J.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),c.jsxs("label",{className:"nc-field",children:[m("device-name-label"),c.jsx("input",{placeholder:M||"NexusCrew",value:V,disabled:o,onChange:J=>Y(J.target.value)}),c.jsx("small",{className:"nc-set-hint",children:m("device-name-hint")})]}),c.jsxs("label",{className:"nc-field",children:[m("node-name-label"),c.jsx("input",{placeholder:ms(V||M||m("node-name-ph")),value:x.name,disabled:o,onChange:J=>C({...x,name:J.target.value?ms(J.target.value):""})})]})]}),c.jsxs("div",{className:"nc-set-row nc-invite-actions",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:o||!!p||!P&&!x.ssh.trim(),onClick:fe,children:m("create-pairing-link")}),!P&&c.jsxs("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>ne(J=>!J),children:[z?"▾":"▸"," ",m("pair-advanced")]})]}),S&&c.jsxs(c.Fragment,{children:[c.jsx(ON,{value:S.pairingUrl}),c.jsx(BN,{text:S.pairingUrl}),c.jsx("div",{className:"nc-set-info",children:m("invite-next-steps")})]})]}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function FN({token:e,readonly:t}){const[n,s]=E.useState("idle"),[o,a]=E.useState(!1),[u,h]=E.useState(null);E.useEffect(()=>{let p=!1;return q2().then(v=>{p||s(v)}),()=>{p=!0}},[]);const f=async()=>{h(null),a(!0);try{n==="subscribed"?(await Y2(e),s("idle")):(await V2(e),s("subscribed"))}catch(p){const v=String(p.message||p);v==="push-denied"?(s("denied"),h(m("push-denied"))):v==="push-unsupported"?(s("unsupported"),h(m("push-unsupported"))):h(v)}a(!1)};return n==="unsupported"?c.jsx("div",{className:"nc-set-info",children:m("push-unsupported")}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||o||n==="denied",title:t?m("settings-readonly"):"",onClick:f,children:m(n==="subscribed"?"push-disable":"push-enable")}),c.jsx("span",{className:"nc-set-info",children:m(n==="subscribed"?"push-on":n==="denied"?"push-denied":"push-off")})]}),u&&c.jsx("div",{className:"nc-err",children:u})]})}function $N(){const[e,t]=Vw(),[n,s]=E.useState(""),[o,a]=E.useState(""),[u,h]=E.useState(!1),[f,p]=E.useState(Ww),v=E.useRef(0),b=E.useRef(!1),w=E.useRef(null),S=Ho();E.useEffect(()=>()=>{var C;v.current+=1,b.current&&((C=w.current)==null||C.abort(),w.current=null,b.current=!1,Rh())},[]);const y=async()=>{const C=v.current+=1,R=typeof AbortController=="function"?new AbortController:null;s(""),a(""),h(!0),p(!1),b.current=!0,w.current=R;const k=await AN(m("notification-speech-preview"),El(),void 0,R?{signal:R.signal}:{});return C!==v.current||(w.current=null,b.current=!1,h(!1),p(k),k?a(m("notification-speech-preview-ok")):s(m("notification-speech-preview-failed"))),k},x=C=>{var R;if(t(C),s(""),a(""),C)y();else{v.current+=1;const k=b.current;(R=w.current)==null||R.abort(),w.current=null,b.current=!1,h(!1),p(!1),Rh(),k||qw()}};return c.jsxs("div",{className:"nc-set-form",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":m("notification-speech-enable"),checked:e,disabled:!S,onChange:C=>x(C.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("notification-speech-enable")}),c.jsx("small",{children:m("notification-speech-help")})]})]}),S?c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!e||u,onClick:()=>{y()},children:m(u?"notification-speech-testing":"notification-speech-test")})}):c.jsx("div",{className:"nc-set-info",children:m("notification-speech-unsupported")}),e&&!f&&!u&&!n&&c.jsx("div",{className:"nc-set-info",children:m("notification-speech-needs-test")}),o&&c.jsx("div",{className:"nc-set-info",role:"status",children:o}),n&&c.jsx("div",{className:"nc-err",children:n})]})}function HN({token:e,readonly:t,nodes:n=[],settings:s=null}){const[o,a]=E.useState(null),[u,h]=E.useState([]),[f,p]=E.useState({name:"",mode:"primary-failover",targets:[]}),[v,b]=E.useState(null),[w,S]=E.useState(!1),[y,x]=E.useState(null),[C,R]=E.useState(""),k=E.useCallback(async()=>{try{const[F,T]=await Promise.all([S0(e),C0(e)]);a(F),h(Array.isArray(T==null?void 0:T.groups)?T.groups:[]),R("")}catch(F){R(String(F.message||F))}},[e]);E.useEffect(()=>{k()},[k]);const $=async F=>{S(!0),x(null),R("");try{a(await b0(e,F))}catch(T){R(String(T.message||T))}S(!1)},O=async()=>{S(!0),x(null),R("");try{x({kind:"test",...await x0(e)})}catch(F){R(String(F.message||F))}S(!1)},V=async()=>{S(!0),x(null),R("");try{x({kind:"stop",...await k0(e)})}catch(F){R(String(F.message||F))}S(!1)},Y=[],z=new Set,ne=(F,T)=>{const q=typeof F=="string"?F.toLowerCase():"";!/^[a-f0-9]{32}$/.test(q)||z.has(q)||(z.add(q),Y.push({id:q,label:T||q}))};ne(s==null?void 0:s.nodeId,m("audio-group-local"));for(const F of n||[])ne((F==null?void 0:F.nodeId)||(F==null?void 0:F.instanceId),(F==null?void 0:F.label)||(F==null?void 0:F.name)||(F==null?void 0:F.nodeId));for(const F of f.targets)ne(F,`${F} (${m("audio-group-unavailable-target")})`);const H=(F=null)=>{R(""),F?(b(F.name),p({name:F.name,mode:F.mode,targets:[...F.targets||[]]})):(b(null),p({name:"",mode:"primary-failover",targets:[]}))},X=(F,T)=>p(q=>({...q,targets:T?[...new Set([...q.targets,F])]:q.targets.filter(B=>B!==F)})),I=async()=>{const F=f.name.trim().toLowerCase();if(!/^[a-z0-9][a-z0-9-]{0,31}$/.test(F)||f.targets.length<1){R(m("audio-group-invalid"));return}S(!0),R("");try{const T=await E0(e,F,{targets:f.targets,mode:f.mode}),q=T==null?void 0:T.group;if(!q||!q.name)throw new Error(m("audio-group-save-failed"));h(B=>[...B.filter(D=>D.name!==q.name),q].sort((D,U)=>D.name.localeCompare(U.name))),H(null)}catch(T){R(String(T.message||T))}S(!1)},A=async F=>{S(!0),R("");try{await N0(e,F),h(T=>T.filter(q=>q.name!==F)),v===F&&H(null)}catch(T){R(String(T.message||T))}S(!1)},N=(o==null?void 0:o.installed)===!0,M=(o==null?void 0:o.liveness)==="ready",L=(o==null?void 0:o.consent)===!0&&N&&M,P=y?y.kind==="stop"?m(y.stopped?"audio-stop-stopped":"audio-stop-idle"):y.status==="accepted"||y.status==="spoken"?m("audio-test-accepted"):y.status==="unknown"?m("audio-test-unknown"):`${m("audio-test-refused")}${y.reason?` (${y.reason})`:""}`:"";return c.jsxs("div",{className:"nc-set-tab nc-audio-settings",children:[c.jsxs("div",{className:"nc-set-info",children:[c.jsx("b",{children:m("audio-title")}),c.jsx("br",{}),m("audio-help")]}),o?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":m("audio-consent"),checked:o.consent===!0,disabled:t||w,onChange:F=>{$(F.target.checked)}}),c.jsxs("span",{children:[c.jsx("b",{children:m("audio-consent")}),c.jsx("small",{children:m("audio-consent-help")})]})]}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("audio-capability")}),c.jsxs("div",{className:"nc-set-info",children:[m("audio-adapter"),": ",o.adapter||m("audio-adapter-none"),c.jsx("br",{}),m("audio-installed"),": ",m(N?"audio-installed-yes":"audio-installed-no"),c.jsx("br",{}),m("audio-liveness"),": ",m(M?"audio-liveness-ready":"audio-liveness-unavailable"),Array.isArray(o.languages)&&o.languages.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("br",{}),m("audio-languages"),": ",o.languages.join(", ")]})]}),o.limits&&c.jsxs("small",{className:"nc-set-hint",children:[m("audio-limits"),": ",o.limits]})]}),!o.consent&&c.jsx("div",{className:"nc-set-info",children:m("audio-test-needs-consent")}),!N&&c.jsx("div",{className:"nc-set-info",children:m("audio-unavailable")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:t||w||!L,title:t?m("settings-readonly"):"",onClick:()=>{O()},children:m(w?"audio-testing":"audio-test")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>{V()},children:m(w?"audio-stopping":"audio-stop")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>{k()},children:m("refresh")})]}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("audio-groups-title")}),c.jsx("small",{className:"nc-set-hint",children:m("audio-groups-help")}),u.length===0&&c.jsx("div",{className:"nc-set-info",children:m("audio-groups-empty")}),u.map(F=>{var T;return c.jsxs("div",{className:"nc-set-row",children:[c.jsxs("span",{children:[c.jsx("b",{children:F.name})," ",c.jsxs("small",{children:["· ",F.mode==="fanout"?m("audio-group-fanout"):m("audio-group-primary")," · ",((T=F.targets)==null?void 0:T.length)||0]})]}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>H(F),children:m("audio-group-edit")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>{A(F.name)},children:m("audio-group-delete")})]},F.name)}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>H(null),children:m("audio-group-new")})}),c.jsxs("label",{className:"nc-field",children:[m("audio-group-name"),c.jsx("input",{"aria-label":m("audio-group-name"),value:f.name,maxLength:"32",disabled:t||w,onChange:F=>p(T=>({...T,name:F.target.value}))})]}),c.jsxs("label",{className:"nc-field",children:[m("audio-group-mode"),c.jsxs("select",{"aria-label":m("audio-group-mode"),value:f.mode,disabled:t||w,onChange:F=>p(T=>({...T,mode:F.target.value})),children:[c.jsx("option",{value:"primary-failover",children:m("audio-group-primary")}),c.jsx("option",{value:"fanout",children:m("audio-group-fanout")})]})]}),c.jsx("div",{className:"nc-set-info",children:m("audio-group-targets")}),Y.length===0?c.jsx("small",{className:"nc-set-hint",children:m("audio-group-no-targets")}):Y.map(F=>c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:f.targets.includes(F.id),disabled:t||w,onChange:T=>X(F.id,T.target.checked)}),c.jsxs("span",{children:[F.label,c.jsx("small",{children:F.id})]})]},F.id)),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:t||w,onClick:()=>{I()},children:m("audio-group-save")}),v&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>H(null),children:m("audio-group-cancel")})]})]})]}):c.jsx("div",{className:"nc-set-info",children:m("audio-loading")}),P&&c.jsx("div",{className:"nc-set-note",role:"status",children:P}),C&&c.jsx("div",{className:"nc-err",children:C})]})}function WN(){const[e,t]=uf();return c.jsxs("div",{className:"nc-set-tab nc-input-settings",children:[c.jsx("div",{className:"nc-set-info",children:m("input-settings-local")}),c.jsxs("div",{className:"nc-set-form",children:[c.jsxs("label",{className:"nc-field",children:[m("terminal-keyboard-gesture"),c.jsx("select",{"aria-label":m("terminal-keyboard-gesture"),value:e.terminalKeyboardGesture,onChange:n=>t({terminalKeyboardGesture:n.target.value}),children:uw.map(n=>c.jsx("option",{value:n,children:m(`terminal-keyboard-${n}`)},n))}),c.jsx("small",{children:m("terminal-keyboard-gesture-help")})]}),c.jsxs("label",{className:"nc-field",children:[m("keybar-layout"),c.jsx("select",{"aria-label":m("keybar-layout"),value:e.keybarLayout,onChange:n=>t({keybarLayout:n.target.value}),children:dw.map(n=>c.jsx("option",{value:n,children:m(`keybar-layout-${n}`)},n))}),c.jsx("small",{children:m("keybar-layout-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.keybarKeepsKeyboardClosed,onChange:n=>t({keybarKeepsKeyboardClosed:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:m("keybar-ime-lock")}),c.jsx("small",{children:m("keybar-ime-lock-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.voiceKeepsKeyboardClosed,onChange:n=>t({voiceKeepsKeyboardClosed:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:m("voice-ime-lock")}),c.jsx("small",{children:m("voice-ime-lock-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.showKeybarEnter,onChange:n=>t({showKeybarEnter:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:m("keybar-enter-show")}),c.jsx("small",{children:m("keybar-enter-show-help")})]})]}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>t(hs),children:m("input-settings-reset")})})]})}function UN({token:e,roster:t=[],readonly:n}){const s=[{key:"local",route:[],label:m("diagnostics-local"),status:"up"},...t.filter(L=>Array.isArray(L.route)&&L.route.length).map(L=>({key:L.route.join("/"),route:L.route,label:L.label||L.name,status:L.status}))],[o,a]=E.useState("local"),u=s.find(L=>L.key===o)||s[0],[h,f]=E.useState(null),[p,v]=E.useState([]),[b,w]=E.useState(""),[S,y]=E.useState(!1),[x,C]=E.useState(!0),[R,k]=E.useState(900),[$,O]=E.useState("all"),[V,Y]=E.useState(""),z=E.useRef(0),ne=E.useRef(null),H=E.useCallback(async()=>{try{const L=await L0(e,u.route);if(f(L),w(""),!S){const P=await T0(e,{after:z.current,limit:200},u.route);Array.isArray(P.records)&&P.records.length&&(z.current=P.cursor,v(F=>[...F,...P.records].slice(-500)))}}catch(L){w(L&&L.status===404?m("diagnostics-unsupported"):String(L.message||L))}},[e,u.key,S]);E.useEffect(()=>{z.current=0,v([]),f(null),w("")},[u.key]),E.useEffect(()=>{let L=null,P=!0;const F=()=>{!P||document.visibilityState==="hidden"||H()},T=()=>{L&&clearInterval(L),L=document.visibilityState==="hidden"?null:setInterval(F,2e3),document.visibilityState!=="hidden"&&F()};return document.addEventListener("visibilitychange",T),T(),()=>{P=!1,L&&clearInterval(L),document.removeEventListener("visibilitychange",T)}},[H]),E.useEffect(()=>{x&&ne.current&&(ne.current.scrollTop=ne.current.scrollHeight)},[p,x]);const X=p.filter(L=>($==="all"||L.level===$)&&(!V||String(L.component||"").toLowerCase().includes(V.toLowerCase()))),I=X.map(L=>`${L.ts} ${L.level.toUpperCase()} ${L.component} ${L.code} ${L.message}${Object.keys(L.meta||{}).length?` ${JSON.stringify(L.meta)}`:""}`).join(`
91
+ `],{type:"application/json"}),F=URL.createObjectURL(P),T=document.createElement("a");T.href=F,T.download=`nexuscrew-fleet-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(T),T.click(),T.remove(),setTimeout(()=>URL.revokeObjectURL(F),0),R("")},Y=async N=>{if(R(""),S([]),x([]),!!N){if(N.size>1024*1024){R(m("fleet-backup-too-large"));return}try{const M=cN(await N.text());if(!M.ok){R(m(`fleet-backup-${M.error}`));return}const L=new Set(M.engines.map(P=>P.id));x(M.engines.map(P=>({engine:P,exists:k.has(P.id),selected:!k.has(P.id)}))),S(M.cells.map(P=>{const F=k.has(P.engine)||L.has(P.engine),T=$.has(P.id);return{cell:P,engine:F?P.engine:"",selected:F&&!T,exists:T}}))}catch(M){R(String(M.message||M))}}},z=(N,M)=>S(L=>L.map((P,F)=>F===N?{...P,...M}:P)),ne=(N,M)=>x(L=>L.map((P,F)=>F===N?{...P,...M}:P)),H=new Set([...k,...y.filter(N=>N.selected).map(N=>N.engine.id)]),X=w.filter(N=>N.selected&&N.engine&&H.has(N.engine)),I=y.filter(N=>N.selected),A=[...new Map([...t.map(N=>[N.id,N.label||N.id]),...y.filter(N=>N.selected).map(N=>[N.engine.id,N.engine.label||N.engine.id])]).entries()];return c.jsxs("div",{className:"nc-set-form nc-fleet-form nc-backup-dialog",children:[c.jsx("b",{children:m("fleet-backup")}),c.jsx("small",{children:m("fleet-backup-help")}),c.jsxs("div",{className:"nc-set-tabs nc-backup-tabs",children:[c.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="export"?" on":""}`,onClick:()=>{h("export"),R("")},children:m("fleet-backup-export")}),c.jsx("button",{type:"button",className:`nc-set-tabbtn${u==="import"?" on":""}`,disabled:!s,title:s?"":m("fleet-backup-restore-unavailable"),onClick:()=>{h("import"),R("")},children:m("fleet-backup-import")})]}),u==="export"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{p(new Set(e.map(N=>N.id))),b(new Set(t.map(N=>N.id)))},children:m("select-all")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{p(new Set),b(new Set)},children:m("select-none")})]}),c.jsxs("div",{className:"nc-backup-list",children:[c.jsx("b",{children:m("fleet-engines")}),t.map(N=>{var M;return c.jsxs("label",{className:"nc-check nc-backup-row",children:[c.jsx("input",{type:"checkbox",checked:v.has(N.id),onChange:()=>O(b,N.id)}),c.jsxs("span",{children:[c.jsx("b",{children:N.label||N.id}),c.jsxs("small",{children:[N.id,(M=N.envKeys)!=null&&M.length?` · ${N.envKeys.length} ${m("fleet-backup-env-names")}`:""]})]})]},N.id)}),c.jsx("b",{children:m("fleet-cells")}),e.map(N=>c.jsxs("label",{className:"nc-check nc-backup-row",children:[c.jsx("input",{type:"checkbox",checked:f.has(N.id),onChange:()=>O(p,N.id)}),c.jsxs("span",{children:[c.jsx("b",{children:N.id}),c.jsxs("small",{children:[N.engine," · ",m("fleet-system-prompt")," ",(N.prompt||"").length," ",m("characters")]})]})]},N.id)),!e.length&&!t.length&&c.jsx("div",{className:"nc-empty",children:m("fleet-backup-empty")})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:!f.size&&!v.size,onClick:V,children:m("fleet-backup-download")})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"file",accept:"application/json,.json",disabled:n,onChange:N=>Y(N.target.files&&N.target.files[0])}),c.jsx("small",{children:m("fleet-backup-import-help")}),!!(w.length||y.length)&&c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{x(N=>N.map(M=>({...M,selected:!0}))),S(N=>N.map(M=>({...M,selected:!!M.engine})))},children:m("select-all")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>{x(N=>N.map(M=>({...M,selected:!1}))),S(N=>N.map(M=>({...M,selected:!1})))},children:m("select-none")})]}),c.jsxs("div",{className:"nc-backup-list",children:[!!y.length&&c.jsx("b",{children:m("fleet-engines")}),y.map((N,M)=>{var L;return c.jsx("div",{className:"nc-backup-import-row",children:c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:N.selected,onChange:P=>ne(M,{selected:P.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:N.engine.label||N.engine.id}),c.jsxs("small",{children:[N.engine.id," · ",N.exists?m("fleet-backup-overwrite"):m("fleet-backup-new"),(L=N.engine.envKeys)!=null&&L.length?` · ${m("fleet-backup-env-values-required")}`:""]})]})]})},N.engine.id)}),!!w.length&&c.jsx("b",{children:m("fleet-cells")}),w.map((N,M)=>c.jsxs("div",{className:"nc-backup-import-row",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:N.selected,disabled:!N.engine||!H.has(N.engine),onChange:L=>z(M,{selected:L.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:N.cell.id}),c.jsxs("small",{children:[N.exists?m("fleet-backup-overwrite"):m("fleet-backup-new")," · ",m("fleet-system-prompt")," ",N.cell.systemPrompt.length," ",m("characters")]})]})]}),c.jsxs("select",{value:N.engine,onChange:L=>z(M,{engine:L.target.value,selected:!!L.target.value}),children:[c.jsx("option",{value:"",children:m("fleet-backup-engine-missing")}),A.map(([L,P])=>c.jsx("option",{value:L,children:P},L))]})]},N.cell.id))]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:a,children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||!X.length&&!I.length,onClick:()=>o({engineRows:y,cellRows:w}),children:m("fleet-backup-restore")})]})]}),C&&c.jsx("div",{className:"nc-err",children:C})]})}function gN({state:e,setState:t,busy:n,onSave:s,catalog:o}){var R;const a=e.form,u=k=>t({...e,form:{...a,...k}}),h=a.envRows||[],f=[...new Map(o.map(k=>[k.client,k.clientLabel||k.client])).entries()],p=o.filter(k=>k.client===a.client),v=$o(o,a),b=typeof(v==null?void 0:v.credentialEnv)=="string"?v.credentialEnv:"",w=Array.isArray(v==null?void 0:v.credentialUsedBy)?v.credentialUsedBy:[],S=(v==null?void 0:v.credentialSource)||"missing",y=!!(v!=null&&v.credentialEnv)||a.credentialProfile==="a"||a.credentialProfile==="p",x=!!b&&e.mode==="new"&&(v==null?void 0:v.authConfigured)!==!0&&!a.credentialValue&&!a.allowMissingCredential,C=k=>{k&&u({client:k.client,provider:k.provider,credentialProfile:k.credentialProfile||"",managedModel:k.model||"",protocol:k.protocol||"",permissionPolicy:k.permissionPolicyDefault||"standard",credentialSourcePolicy:"auto",rc:!!k.rc,displayName:k.custom?m("fleet-custom-provider-default"):"",baseUrl:k.custom?"":k.endpoint||"",envKey:k.defaultEnvKey||"",providerId:"nexuscrew-custom",credentialValue:"",credentialReveal:!1,allowMissingCredential:!1,...e.mode==="new"?{id:k.id,label:""}:{}})};return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsx("b",{children:e.mode==="new"?m("fleet-new-engine"):`${m("edit")} ${a.id}`}),c.jsx("input",{value:a.id,disabled:e.mode!=="new",placeholder:"id",onChange:k=>u({id:k.target.value})}),c.jsx("input",{value:a.label,placeholder:m("label"),onChange:k=>u({label:k.target.value})}),c.jsxs("select",{value:a.kind,disabled:e.mode!=="new",onChange:k=>u({kind:k.target.value}),children:[c.jsx("option",{value:"managed",children:m("fleet-managed")}),c.jsx("option",{value:"custom",children:m("fleet-custom")})]}),a.kind==="managed"?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("select",{value:a.client,disabled:e.mode!=="new",onChange:k=>C(o.find($=>$.client===k.target.value&&$.default)||o.find($=>$.client===k.target.value)),children:f.map(([k,$])=>c.jsx("option",{value:k,children:$},k))}),c.jsx("select",{value:((R=$o(o,a))==null?void 0:R.id)||"",disabled:e.mode!=="new",onChange:k=>C(o.find($=>$.id===k.target.value)),children:p.map(k=>c.jsx("option",{value:k.id,children:k.label},k.id))})]}),a.client!=="shell"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.managedModel,list:"nc-managed-models",placeholder:m(v!=null&&v.requiresModel?"fleet-model-required":"fleet-model-default"),onChange:k=>u({managedModel:k.target.value})}),c.jsx("datalist",{id:"nc-managed-models",children:[...(v==null?void 0:v.models)||[],...a.modelOptions||[]].filter((k,$,O)=>k&&O.indexOf(k)===$).map(k=>c.jsx("option",{value:k},k))})]}),v!=null&&v.supportsUnsafe?c.jsxs("select",{value:a.permissionPolicy,onChange:k=>u({permissionPolicy:k.target.value}),children:[c.jsx("option",{value:"standard",children:m("fleet-standard-permissions")}),c.jsx("option",{value:"unsafe",children:m("fleet-unsafe-permissions")})]}):c.jsx("small",{children:m("fleet-standard-permissions")}),(v==null?void 0:v.supportsUnsafe)&&a.permissionPolicy==="unsafe"&&c.jsx("small",{className:"nc-err",children:m("fleet-unsafe-warning")}),y&&c.jsxs("select",{"aria-label":m("fleet-credential-source-policy"),value:a.credentialSourcePolicy||"auto",onChange:k=>u({credentialSourcePolicy:k.target.value}),children:[c.jsx("option",{value:"auto",children:m("fleet-credential-source-policy-auto")}),c.jsx("option",{value:"nexuscrew-store",children:m("fleet-credential-source-policy-nexuscrew-store")}),c.jsx("option",{value:"environment",children:m("fleet-credential-source-policy-environment")})]}),(v==null?void 0:v.credentialEnv)===!0&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.envKey,placeholder:m("fleet-api-key-env"),onChange:k=>u({envKey:k.target.value})}),c.jsx("small",{children:m("fleet-custom-secret-help")})]}),b&&c.jsxs("section",{className:"nc-fleet-key","aria-label":m("fleet-key-section"),children:[c.jsxs("div",{className:"nc-fleet-key-head",children:[c.jsx("b",{children:m("fleet-key-section")}),c.jsx("span",{children:m(`fleet-credential-source-${S}`)})]}),c.jsxs("label",{className:"nc-field",children:[m("fleet-key-variable"),c.jsx("input",{value:b,readOnly:!0,"aria-label":m("fleet-key-variable")})]}),c.jsx("small",{children:w.length?m("fleet-key-used-by").replace("{engines}",w.join(", ")):m("fleet-key-used-by-none")}),w.length>0&&c.jsx("small",{children:m("fleet-key-shared-impact").replace("{key}",b).replace("{engines}",w.join(", "))}),c.jsxs("div",{className:"nc-fleet-key-input",children:[c.jsx("input",{type:a.credentialReveal?"text":"password",value:a.credentialValue||"","aria-label":m("fleet-key-value").replace("{key}",b),autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",placeholder:v!=null&&v.authConfigured||e.mode==="edit"?m("fleet-key-blank-keeps"):m("fleet-key-enter"),onChange:k=>u({credentialValue:k.target.value,allowMissingCredential:k.target.value?!1:a.allowMissingCredential})}),c.jsx("button",{type:"button",className:"nc-btn ghost","aria-label":m(a.credentialReveal?"fleet-key-hide":"fleet-key-reveal"),onClick:()=>u({credentialReveal:!a.credentialReveal}),children:m(a.credentialReveal?"fleet-key-hide":"fleet-key-reveal")})]}),c.jsx("small",{children:m("fleet-key-local-help")}),e.mode==="new"&&(v==null?void 0:v.authConfigured)!==!0&&!a.credentialValue&&c.jsxs("label",{className:"nc-check nc-fleet-key-missing",children:[c.jsx("input",{type:"checkbox",checked:!!a.allowMissingCredential,onChange:k=>u({allowMissingCredential:k.target.checked})}),m("fleet-key-create-missing")]}),(v==null?void 0:v.notice)&&c.jsx("small",{className:"nc-fleet-provider-notice",children:m(`fleet-provider-notice-${v.notice}`)})]}),(v==null?void 0:v.notice)&&!b&&c.jsx("small",{className:"nc-fleet-provider-notice",children:m(`fleet-provider-notice-${v.notice}`)}),a.provider==="custom"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.displayName,placeholder:m("fleet-provider-display"),onChange:k=>u({displayName:k.target.value})}),c.jsx("input",{value:a.baseUrl,placeholder:"https://api.example.com/v1",onChange:k=>u({baseUrl:k.target.value})}),((v==null?void 0:v.protocols)||[]).length>1&&c.jsx("select",{value:a.protocol,onChange:k=>u({protocol:k.target.value}),children:v.protocols.map(k=>c.jsx("option",{value:k,children:k},k))}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:a.envKey,placeholder:m("fleet-api-key-env"),onChange:k=>u({envKey:k.target.value})}),c.jsx("input",{value:a.providerId,placeholder:m("fleet-provider-id"),onChange:k=>u({providerId:k.target.value})})]}),c.jsxs("small",{children:[a.protocol," · ",m("fleet-custom-secret-help")]})]}),c.jsx("small",{children:m(a.client==="shell"?"fleet-shell-engine-help":"fleet-managed-help")})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{value:a.command,placeholder:m("command-path"),onChange:k=>u({command:k.target.value})}),c.jsx("textarea",{value:a.argsText,placeholder:m("args-lines"),onChange:k=>u({argsText:k.target.value})}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:a.rc,onChange:k=>u({rc:k.target.checked})})," remote control"]}),c.jsxs("select",{value:a.promptMode,onChange:k=>u({promptMode:k.target.value}),children:[c.jsx("option",{value:"send-keys",children:"send-keys"}),c.jsx("option",{value:"flag",children:"flag"})]}),a.promptMode==="flag"&&c.jsx("input",{value:a.promptFlag,placeholder:"prompt flag",onChange:k=>u({promptFlag:k.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:a.modelFlag,placeholder:"model flag",onChange:k=>u({modelFlag:k.target.value})}),c.jsx("input",{value:a.modelValue,placeholder:"model default",onChange:k=>u({modelValue:k.target.value})})]}),c.jsx("small",{children:m("env-write-only")}),h.map((k,$)=>c.jsxs("div",{className:"nc-fleet-env",children:[c.jsx("input",{value:k.key,disabled:k.configured,placeholder:"ENV_KEY",onChange:O=>{const V=h.slice();V[$]={...k,key:O.target.value},u({envRows:V})}}),c.jsx("input",{type:"password",value:k.value,placeholder:k.configured?"•••••• (unchanged)":"value",onChange:O=>{const V=h.slice();V[$]={...k,value:O.target.value},u({envRows:V})}}),c.jsx("button",{className:"nc-btn danger",onClick:()=>u({envRows:h.filter((O,V)=>V!==$)}),children:"×"})]},`${k.key}-${$}`)),c.jsx("button",{className:"nc-btn ghost",onClick:()=>u({envRows:[...h,{key:"",value:"",configured:!1}]}),children:"+ env"})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>t(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:n||!a.id||x||a.kind==="custom"&&!a.command||a.kind==="managed"&&(v==null?void 0:v.requiresModel)&&!a.managedModel||a.kind==="managed"&&(v==null?void 0:v.credentialEnv)===!0&&!a.envKey||a.kind==="managed"&&a.provider==="custom"&&(!a.displayName||!a.baseUrl||!a.envKey||!a.providerId),onClick:s,children:m("save")})]})]})}function vN({token:e,route:t,targets:n=[],location:s,setLocation:o,state:a,setState:u,engines:h,busy:f,onSave:p}){var Y;const[v,b]=E.useState(null),[w,S]=E.useState(""),y=a.form,x=z=>u({...a,form:{...y,...z}}),C=h.find(z=>z.id===y.engine),R=((Y=C==null?void 0:C.managed)==null?void 0:Y.client)==="shell",k=z=>{var X,I,A,N;const ne=h.find(M=>M.id===z),H={...y.commands||{}};((X=C==null?void 0:C.managed)==null?void 0:X.client)==="shell"&&(y.command?H[y.engine]=y.command:delete H[y.engine]),x({engine:z,model:((I=y.models)==null?void 0:I[z])||((A=ne==null?void 0:ne.managed)==null?void 0:A.model)||((N=ne==null?void 0:ne.model)==null?void 0:N.value)||"",commands:H,command:H[z]||""})},$=z=>{const ne={...y.commands||{}};z?ne[y.engine]=z:delete ne[y.engine],x({command:z,commands:ne})},O=R&&/[|&;<>()`$*?{}\[\]~]/.test(y.command||""),V=async z=>{try{const ne=await Oh(e,z,t);b(ne),x({cwd:ne.path}),S("")}catch(ne){S(String(ne.message||ne))}};return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsx("b",{children:a.mode==="new"?m("fleet-new-cell"):`${m("edit")} ${y.id}`}),a.mode==="new"&&c.jsxs("label",{className:"nc-field",children:[m("location"),c.jsx("span",{className:"nc-req",children:" *"}),c.jsxs("select",{value:s,onChange:z=>{o(z.target.value),x({engine:""})},children:[c.jsx("option",{value:"",children:m("local")}),n.map(z=>c.jsxs("option",{value:z.route.join("/"),disabled:z.status&&z.status!=="up",children:[z.label,z.status&&z.status!=="up"?` · ${m("node-offline")}`:""]},z.route.join("/")))]})]}),c.jsx("input",{value:y.id,disabled:a.mode!=="new",placeholder:"id",onChange:z=>x({id:z.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:y.cwd,placeholder:m("cwd"),onChange:z=>x({cwd:z.target.value})}),c.jsx("button",{className:"nc-btn ghost",onClick:()=>v?b(null):V(y.cwd),children:m("browse")})]}),v&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:v.path}),c.jsxs("div",{className:"nc-fs-list",children:[v.parent&&c.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>V(v.parent),children:["↑ ",m("fs-parent")]}),(v.dirs||[]).map(z=>c.jsxs("button",{className:"nc-fs-item",onClick:()=>V(`${v.path.replace(/\/$/,"")}/${z}`),children:["📁 ",z]},z))]})]}),w&&c.jsx("div",{className:"nc-err",children:w}),c.jsx("select",{value:y.engine,onChange:z=>k(z.target.value),children:h.map(z=>c.jsx("option",{value:z.id,children:z.label},z.id))}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:!!y.boot,onChange:z=>x({boot:z.target.checked})})," boot"]}),R?c.jsxs(c.Fragment,{children:[c.jsx("input",{value:y.command||"",maxLength:4096,placeholder:m("fleet-shell-command-placeholder"),onChange:z=>$(z.target.value)}),c.jsx("small",{children:y.command?m("fleet-shell-command-help"):m("fleet-shell-interactive")}),O&&c.jsx("small",{className:"nc-note",children:m("fleet-shell-command-metachar")})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{value:y.model||"",list:"nc-cell-models",placeholder:m("fleet-model-override"),onChange:z=>x({model:z.target.value})}),c.jsx("datalist",{id:"nc-cell-models",children:((C==null?void 0:C.availableModels)||[]).map(z=>c.jsx("option",{value:z},z))}),c.jsx("textarea",{value:y.prompt||"",placeholder:"prompt",onChange:z=>x({prompt:z.target.value})})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>u(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:f||!y.id||!y.cwd||!y.engine,onClick:p,children:m("save")})]})]})}function C_({token:e,route:t=[],state:n,setState:s,busy:o,onSave:a}){const[u,h]=E.useState(null),[f,p]=E.useState([]),[v,b]=E.useState(""),w=Array.isArray(t)?t.join("/"):"";E.useEffect(()=>{let R=!0;return Ih(e,w?w.split("/"):[]).then(k=>{R&&(p(k.engines||[]),b(""))}).catch(k=>{R&&(p([]),b(String(k.message||k)))}),()=>{R=!1}},[e,w]);const S=n.form,y=R=>s({...n,form:{...S,...R}}),x=async R=>{try{const k=await Oh(e,R,t);h(k),y({cwd:k.path})}catch{}},C=!S.id&&S.tmuxSession?S.tmuxSession.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32):S.id;return c.jsxs("div",{className:"nc-set-form nc-fleet-form",children:[c.jsxs("b",{children:[m("import-as-cell")," · ",S.tmuxSession]}),c.jsx("small",{children:m("import-help")}),c.jsx("input",{value:S.tmuxSession,disabled:!0,placeholder:"tmux session",readOnly:!0}),c.jsx("input",{value:S.id,placeholder:m("name"),onChange:R=>y({id:R.target.value})}),c.jsxs("div",{className:"nc-fleet-pair",children:[c.jsx("input",{value:S.cwd,placeholder:m("cwd"),onChange:R=>y({cwd:R.target.value})}),c.jsx("button",{className:"nc-btn ghost",type:"button",onClick:()=>u?h(null):x(S.cwd),children:m("browse")})]}),u&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:u.path}),c.jsxs("div",{className:"nc-fs-list",children:[u.parent&&c.jsxs("button",{className:"nc-fs-item nc-fs-nav",onClick:()=>x(u.parent),children:["↑ ",m("fs-parent")]}),(u.dirs||[]).map(R=>c.jsxs("button",{className:"nc-fs-item",onClick:()=>x(`${u.path.replace(/\/$/,"")}/${R}`),children:["📁 ",R]},R))]})]}),c.jsxs("select",{value:S.engine,onChange:R=>y({engine:R.target.value}),children:[c.jsx("option",{value:"",children:m("import-engine-required")}),f.map(R=>c.jsx("option",{value:R.id,children:R.label},R.id))]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:!!S.boot,onChange:R=>y({boot:R.target.checked})})," boot"]}),(n.err||v)&&c.jsx("div",{className:"nc-err",children:n.err||v}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>s(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:o||!S.tmuxSession||!S.engine||!f.length,onClick:a,children:m(C?"import-as-cell":"save")})]})]})}function ml(e){const t=Os(e);return t===null?`~/${e}`:t?`~/${t}`:"~"}function _N(e){if(!e||typeof e.path!="string"||typeof e.home!="string")return"";const{path:t,home:n}=e;return!n||t===n||!t.startsWith(n+"/")?"":t.slice(n.length+1).replace(/\/+$/,"")}function yN({token:e,route:t,cell:n,busy:s=!1,onSaved:o,onClose:a}){const[u,h]=E.useState(""),[f,p]=E.useState(null),[v,b]=E.useState(!1),[w,S]=E.useState(""),y=typeof(n==null?void 0:n.cwdSuggestion)=="string"&&Os(n.cwdSuggestion)!==null?Os(n.cwdSuggestion):null,[x,C]=E.useState(y),R=n==null?void 0:n.id,k=s||v,$=async H=>{const X=Os(H);if(X===null){p({rel:"",dirs:[],loading:!1,err:m("fleet-cwd-repair-invalid")});return}p({rel:X,dirs:[],loading:!0,err:""});try{const I=await Oh(e,X,t),A=_N(I);p({rel:A,dirs:Array.isArray(I.dirs)?I.dirs:[],loading:!1,err:""})}catch(I){p({rel:X,dirs:[],loading:!1,err:String(I&&I.message||I)})}},O=H=>{if(!f)return;const X=f.rel?`${f.rel}/${H}`:H;$(X)},V=()=>{f!=null&&f.rel&&$(f.rel.split("/").slice(0,-1).join("/"))},Y=()=>{f&&(h(f.rel||""),p(null),S(""),C(null))},z=()=>{x!==null&&(h(x),C(null),S(""))},ne=async()=>{if(k)return;const H=Os(u);if(H===null){S(m("fleet-cwd-repair-invalid"));return}const X=ml(H);let I=!0;try{I=window.confirm(m("fleet-cwd-repair-confirm").replace("{id}",String(R||"")).replace("{path}",X))}catch{I=!1}if(I){b(!0),S(""),C(null);try{const A=await z_(e,R,{cwdRel:H},t);o==null||o(A)}catch(A){const N=A&&A.data||{};if(N.code==="unportable-cwd"){S(m("fleet-cwd-repair-unportable"));const M=Array.isArray(N.cells)?N.cells.find(P=>P&&P.id===R):null,L=M&&typeof M.suggestion=="string"?M.suggestion:null;L!==null&&Os(L)!==null&&C(L)}else S(String(A&&A.message||A))}finally{b(!1)}}};return c.jsxs("div",{className:"nc-set-form nc-fleet-form nc-cwd-repair",children:[c.jsx("b",{children:m("fleet-cwd-repair-title").replace("{id}",String(R||""))}),c.jsx("small",{className:"nc-set-info",children:m("fleet-cwd-repair-help")}),c.jsx("small",{className:"nc-cwd-no-source",children:m("fleet-cwd-repair-no-source-path")}),c.jsxs("label",{className:"nc-field",children:[m("cwd"),c.jsxs("div",{className:"nc-cwd-rel-row",children:[c.jsx("span",{className:"nc-cwd-rel-prefix",children:"~/"}),c.jsx("input",{value:u,placeholder:m("fleet-cwd-repair-placeholder"),autoComplete:"off",spellCheck:"false",autoCapitalize:"none",onChange:H=>h(H.target.value)}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:k,onClick:()=>f?p(null):$(""),children:m(f?"close":"fleet-cwd-repair-browse")})]})]}),c.jsx("div",{className:"nc-cwd-preview",children:m("fleet-cwd-repair-preview").replace("{path}",ml(u))}),f&&c.jsxs("div",{className:"nc-fs",children:[c.jsx("div",{className:"nc-fs-path",children:ml(f.rel)}),c.jsxs("div",{className:"nc-fs-list",children:[f.rel&&c.jsxs("button",{type:"button",className:"nc-fs-item nc-fs-nav",onClick:V,children:["↑ ",m("fs-parent")]}),f.loading&&c.jsx("div",{className:"nc-fs-empty",children:"…"}),!f.loading&&f.dirs.length===0&&c.jsx("div",{className:"nc-fs-empty",children:m("fleet-cwd-repair-fs-empty")}),!f.loading&&f.dirs.map(H=>c.jsxs("button",{type:"button",className:"nc-fs-item",onClick:()=>O(H),children:["📁 ",H]},H))]}),f.err&&c.jsx("div",{className:"nc-err",children:f.err}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{type:"button",className:"nc-btn primary",disabled:k||f.loading||!!f.err,onClick:Y,children:m("fleet-cwd-repair-use-current")})})]}),w&&c.jsx("div",{className:"nc-err",role:"alert",children:w}),x!==null&&c.jsxs("div",{className:"nc-cwd-suggestion",role:"status",children:[c.jsx("span",{children:m("fleet-cwd-repair-suggestion")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:z,children:m("fleet-cwd-repair-use-suggestion").replace("{path}",ml(x))})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:v,onClick:a,children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:k,onClick:ne,children:v?"…":m("save")})]})]})}function wN({token:e,readonly:t,targets:n=[],startNewCell:s=!1,initialLocation:o=""}){const[a,u]=E.useState({engines:[],cells:[],managedCatalog:[]}),[h,f]=E.useState({available:!1,capabilities:[]}),[p,v]=E.useState(!1),[b,w]=E.useState(null),[S,y]=E.useState(null),[x,C]=E.useState(!1),[R,k]=E.useState(""),[$,O]=E.useState(""),[V,Y]=E.useState(o),[z,ne]=E.useState(!1),[H,X]=E.useState(null),[I,A]=E.useState(null),[N,M]=E.useState(null),[L,P]=E.useState(!1),[F,T]=E.useState([]),[q,B]=E.useState(null),[D,U]=E.useState("manage"),Z=E.useRef(!1),oe=V?V.split("/"):[],de=E.useCallback(async()=>{try{const le=await _s(e,oe);f(le);try{const xe=await Fh(e,oe);ne(!!xe.readonlyDefault)}catch{ne(!1)}if(le.provider==="builtin"&&(le.capabilities||[]).includes("definitions")){const xe=await Ih(e,oe),ze=new Map((le.engines||[]).map(Ie=>[Ie.id,Ie]));if(xe.engines=(xe.engines||[]).map(Ie=>{var ue;return{...Ie,availableModels:((ue=ze.get(Ie.id))==null?void 0:ue.models)||[]}}),u(xe),(le.capabilities||[]).includes("credentials"))try{T((await n0(e,oe)).credentials||[])}catch{T([])}else T([])}k("")}catch(le){k(String(le.message||le))}finally{v(!0)}},[e,V]);E.useEffect(()=>{de();const le=setInterval(de,5e3);return()=>clearInterval(le)},[de]);const fe=new Set((h.cells||[]).filter(le=>le.active).map(le=>le.cell)),J=h.provider==="builtin"&&(h.capabilities||[]).includes("edit"),ee=(h.capabilities||[]).includes("restore");E.useEffect(()=>{!s||Z.current||!J||!a.engines.length||(Z.current=!0,y({mode:"new",form:k_(a.engines[0].id)}))},[s,J,a.engines]);const pe=async le=>{C(!0),k(""),O("");try{await le(),await de()}catch(xe){k(String(xe.message||xe))}C(!1)},Se=()=>pe(async()=>{var Re;const le=b.mode==="new",xe=b.form,ze=a.managedCatalog||[],Ie=xe.kind==="managed"?$o(ze,xe):null,ue=typeof(Ie==null?void 0:Ie.credentialEnv)=="string"?Ie.credentialEnv:"",G=ue&&xe.credentialValue||"",ie=pN(xe,le,ze);!le&&b.form.kind==="custom"&&!b.form.modelFlag&&(ie.model=null),!le&&b.form.kind==="custom"&&b.form.promptMode!=="flag"&&(ie.promptFlag=null);let W;if(le)W=await s0(e,ie,oe);else{const we=b.original,je=new Set(b.form.envRows.filter(Oe=>!Oe.remove).map(Oe=>Oe.key)),st=(we.envKeys||[]).filter(Oe=>!je.has(Oe)),It=Object.fromEntries(b.form.envRows.filter(Oe=>!Oe.remove&&Oe.key&&(!Oe.configured||Oe.value!=="")).map(Oe=>[Oe.key,Oe.value]));W=await r0(e,we.id,ie,b.form.kind==="custom"?{set:It,remove:st}:void 0,oe)}let se=null;if(ue&&G)try{se=await og(e,ue,G,oe),T(se.credentials||[])}catch{throw await de(),le&&w({mode:"edit",original:{...ie,id:xe.id},form:{...xe,credentialReveal:!1}}),new Error(m(le?"fleet-key-partial-create":"fleet-key-partial-edit"))}await de(),w(null),O(m("fleet-saved"));const ve=((Re=((se==null?void 0:se.credentials)||[]).find(we=>we.envKey===ue))==null?void 0:Re.activeCells)||[],ke=[...new Set([...(W==null?void 0:W.activeCells)||[],...ve])];if(ke.length&&window.confirm(m("fleet-restart-confirm").replace("{cells}",ke.join(", "))))for(const we of ke)await jo(e,we,oe)}),Ze=()=>pe(async()=>{var W,se,ve,ke,Re,we;const le=S.mode==="new",xe=S.form,ze={...le?{id:xe.id}:{},cwd:xe.cwd,engine:xe.engine,boot:!!xe.boot},Ie={...xe.commands||{}},ue=a.engines.find(je=>je.id===xe.engine);((W=ue==null?void 0:ue.managed)==null?void 0:W.client)==="shell"&&typeof xe.command=="string"&&xe.command.length?Ie[xe.engine]=xe.command:((se=ue==null?void 0:ue.managed)==null?void 0:se.client)==="shell"&&delete Ie[xe.engine],(Object.keys(Ie).length||!le)&&(ze.commands=Ie),le?(((ve=ue==null?void 0:ue.managed)==null?void 0:ve.client)!=="shell"&&xe.model&&(ze.model=xe.model),((ke=ue==null?void 0:ue.managed)==null?void 0:ke.client)!=="shell"&&xe.prompt&&(ze.prompt=xe.prompt)):(ze.model=((Re=ue==null?void 0:ue.managed)==null?void 0:Re.client)==="shell"?null:xe.model||null,((we=ue==null?void 0:ue.managed)==null?void 0:we.client)!=="shell"&&(ze.prompt=xe.prompt||null));const G=le?await a0(e,ze,oe):await z_(e,S.original.id,ze,oe),ie=le?xe.id:S.original.id;y(null),O(m("fleet-saved")),!le&&(G!=null&&G.active)&&window.confirm(m("fleet-restart-confirm").replace("{cells}",ie))&&await jo(e,ie,oe)}),$e=t||z,He=le=>F.find(xe=>{var ze;return(ze=xe.engines)==null?void 0:ze.includes(le.id)})||null,vt=()=>pe(async()=>{var ze;const le=await og(e,q.envKey,q.value,oe);T(le.credentials||[]),B(null),O(m("fleet-credential-saved"));const xe=((ze=(le.credentials||[]).find(Ie=>Ie.envKey===q.envKey))==null?void 0:ze.activeCells)||[];if(xe.length&&window.confirm(m("fleet-restart-confirm").replace("{cells}",xe.join(", "))))for(const Ie of xe)await jo(e,Ie,oe)}),Xe=le=>pe(async()=>{if(!window.confirm(m("fleet-credential-remove-confirm").replace("{key}",le.envKey)))return;const xe=await i0(e,le.envKey,oe);T(xe.credentials||[]),O(m("fleet-credential-removed"))}),St=le=>X({...le,route:Array.isArray(le==null?void 0:le.route)?le.route:oe}),Et=async le=>{if(!H)return;const xe=H.cell||H.id,ze=Array.isArray(H.route)?H.route:oe;le.action==="up"?await Ah(e,{cell:xe,boot:!!le.boot,...le.engine?{engine:le.engine}:{},...le.model!==void 0?{model:le.model}:{},...le.permissionPolicy?{permissionPolicy:le.permissionPolicy}:{}},ze):await Cl(e,{cell:xe,boot:!!le.boot},ze)},rt=(le,xe)=>{k(""),A({mode:"new",route:Array.isArray(xe)?xe:oe,form:{tmuxSession:le.name,id:"",engine:"",cwd:"",boot:!1},err:""})},ct=()=>pe(async()=>{const le=I.form;if(!le.engine){A({...I,err:m("import-engine-required")});return}await l0(e,{tmuxSession:le.tmuxSession,id:le.id||void 0,engine:le.engine,cwd:le.cwd||void 0,boot:!!le.boot},le.route||oe),A(null),O(m("fleet-saved"))}),ot=({engineRows:le=[],cellRows:xe=[]})=>pe(async()=>{const ze=le.filter(Re=>Re.selected),Ie=ze.map(Re=>Fw(Re.engine));if(Ie.some(Re=>!Re))throw new Error(m("fleet-backup-invalid-engine"));const ue=ze.filter(Re=>Re.exists).map(Re=>Re.engine.id);if(ue.length&&!window.confirm(m("fleet-backup-confirm-engine-overwrite").replace("{engines}",ue.join(", "))))return;const G=[...new Set([...a.engines.map(Re=>Re.id),...Ie.map(Re=>Re.id)])],ie=[];for(const Re of xe.filter(we=>we.selected)){const we=uN(Re.cell,Re.engine,G);if(!we)throw new Error(`${Re.cell.id}: ${m("fleet-backup-engine-missing")}`);ie.push(we)}const W=xe.filter(Re=>Re.selected&&Re.exists).map(Re=>Re.cell.id);if(W.length&&!window.confirm(m("fleet-backup-confirm-overwrite").replace("{cells}",W.join(", "))))return;const se=Ie.length?await u0(e,Ie,ue.length>0,oe):{needsRestart:[]},ve=ie.length?await c0(e,ie,oe):{needsRestart:[]},ke=[...new Set([...se.needsRestart||[],...ve.needsRestart||[]])];P(!1),O(`${m("fleet-backup-restored").replace("{n}",String(ie.length))}${Ie.length?` · ${Ie.length} ${m("fleet-engines").toLowerCase()}`:""}${ke.length?` · ${m("fleet-backup-needs-restart").replace("{cells}",ke.join(", "))}`:""}`)}),ut=c.jsxs("label",{className:"nc-field",children:[m("location"),c.jsxs("select",{value:V,onChange:le=>{Y(le.target.value),w(null),y(null),k(""),O(""),ne(!1),v(!1),f({available:!1,capabilities:[]}),u({engines:[],cells:[],managedCatalog:[]}),T([]),B(null)},children:[c.jsx("option",{value:"",children:m("local")}),n.map(le=>c.jsxs("option",{value:le.route.join("/"),disabled:le.status&&le.status!=="up",children:[le.label,le.status&&le.status!=="up"?` · ${m("node-offline")}`:""]},le.route.join("/")))]})]}),dt=c.jsxs("div",{className:"nc-fleet-view-tabs",role:"tablist","aria-label":m("tab-fleet"),children:[c.jsx("button",{type:"button",role:"tab","aria-selected":D==="manage",className:`nc-set-tabbtn${D==="manage"?" on":""}`,onClick:()=>U("manage"),children:m("fleet-manage-location")}),c.jsx("button",{type:"button",role:"tab","aria-selected":D==="overview",className:`nc-set-tabbtn${D==="overview"?" on":""}`,onClick:()=>U("overview"),children:m("fleet-network-overview")})]});return p?J?c.jsxs("div",{className:"nc-set-tab nc-fleet-editor",children:[dt,D==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-overview-help")}),c.jsx(Nd,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-manage-help")}),ut,c.jsxs("div",{className:"nc-set-row nc-fleet-backup-actions",children:[c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),P(!0)},children:m("fleet-backup")}),c.jsx("small",{children:m("fleet-backup-help")})]}),c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:m("fleet-cells")}),c.jsx("span",{className:"nc-fleet-head-actions",children:c.jsxs("button",{className:"nc-btn primary",disabled:$e||x||!a.engines.length,onClick:()=>{var le;k(""),y({mode:"new",form:k_((le=a.engines[0])==null?void 0:le.id)})},children:["+ ",m("add")]})})]}),a.cells.map(le=>{const xe=fe.has(le.id),ze=h.capabilities||[],Ie=le.needsRepair===!0;return c.jsxs("div",{className:"nc-fleet-item",children:[c.jsxs("span",{children:[c.jsx("b",{children:le.id}),c.jsxs("small",{children:[le.engine," · ",Ie?c.jsx("span",{className:"nc-fleet-tag nc-fleet-tag-warn",children:m("fleet-cwd-needs-repair")}):le.cwd,xe?` · ${m("service-active")}`:` · ${m("cell-off")}`]})]}),c.jsxs("span",{children:[xe&&ze.includes("down")&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>pe(()=>Cl(e,{cell:le.id},oe)),children:m("stop")}),!xe&&ze.includes("up")&&c.jsx("button",{className:"nc-btn primary",disabled:$e||x,onClick:()=>St({cell:le.id,id:le.id,engine:le.engine,model:le.model,models:le.models,permissionPolicies:le.permissionPolicies,active:!1,boot:le.boot}),children:m("start")}),xe&&ze.includes("restart")&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>pe(()=>jo(e,le.id,oe)),children:m("restart")}),Ie?c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),M(le)},children:m("fleet-cwd-repair")}):c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{var ue;k(""),y({mode:"edit",original:le,form:{...le,commands:{...le.commands||{}},command:((ue=le.commands)==null?void 0:ue[le.engine])||""}})},children:m("edit")}),c.jsx("button",{className:"nc-btn danger",disabled:$e||x,onClick:()=>pe(async()=>{window.confirm(m("fleet-remove-cell").replace("{id}",le.id))&&await F_(e,le.id,!0,oe)}),children:"×"})]})]},le.id)}),c.jsxs("div",{className:"nc-fleet-section-head",children:[c.jsx("b",{children:m("fleet-engines")}),c.jsxs("button",{className:"nc-btn primary",disabled:$e||x,onClick:()=>{k(""),w({mode:"new",form:dN()})},children:["+ ",m("add")]})]}),a.engines.map(le=>{var ze,Ie;const xe=He(le);return c.jsxs("div",{className:"nc-fleet-item",children:[c.jsxs("span",{children:[c.jsx("b",{children:le.label}),c.jsx("small",{children:le.managed?`${le.id} · ${le.managed.client} / ${le.managed.provider} · ${(ze=le.managedInfo)!=null&&ze.configured?m("fleet-ready"):((Ie=le.managedInfo)==null?void 0:Ie.reason)||m("fleet-not-ready")}`:`${le.id} · ${le.command}`}),xe&&c.jsxs("small",{children:[xe.envKey," · ",m(`fleet-credential-source-${xe.source||"missing"}`)]})]}),c.jsxs("span",{children:[xe&&c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),B({envKey:xe.envKey,value:""})},children:xe.configured?m("fleet-credential-change"):m("fleet-credential-set")}),(xe==null?void 0:xe.source)==="local"&&c.jsx("button",{className:"nc-btn danger",disabled:$e||x,onClick:()=>Xe(xe),children:m("fleet-credential-forget")}),c.jsx("button",{className:"nc-btn ghost",disabled:$e||x,onClick:()=>{k(""),w({mode:"edit",original:le,form:fN(le)})},children:m("edit")}),c.jsx("button",{className:"nc-btn danger",disabled:$e||x,onClick:()=>pe(async()=>{window.confirm(m("fleet-remove-engine").replace("{id}",le.id))&&await o0(e,le.id,oe)}),children:"×"})]})]},le.id)})]}),b&&c.jsx(Ms,{onClose:()=>w(null),label:m("fleet-new-engine"),error:R,children:c.jsx(gN,{state:b,setState:w,busy:x,onSave:Se,catalog:a.managedCatalog||[]})}),S&&c.jsx(Ms,{onClose:()=>y(null),label:m("fleet-new-cell"),error:R,children:c.jsx(vN,{token:e,route:oe,targets:n,location:V,setLocation:Y,state:S,setState:y,engines:a.engines,busy:x,onSave:Ze})}),N&&c.jsx(Ms,{onClose:()=>M(null),label:m("fleet-cwd-repair-title").replace("{id}",N.id),error:"",children:c.jsx(yN,{token:e,route:oe,cell:N,busy:x,onSaved:async()=>{M(null),O(m("fleet-cwd-repaired")),await de()},onClose:()=>M(null)})}),$&&c.jsx("div",{className:"nc-set-note",children:$}),R&&c.jsx("div",{className:"nc-err",children:R}),L&&c.jsx(Ms,{onClose:()=>P(!1),label:m("fleet-backup"),error:R,children:c.jsx(mN,{cells:a.cells,engines:a.engines,busy:x,canRestore:ee,onRestore:ot,onClose:()=>P(!1)})}),q&&c.jsx(Ms,{onClose:()=>B(null),label:m("fleet-credential-title"),error:R,children:c.jsxs("div",{className:"nc-fleet-form nc-credential-form",children:[c.jsx("b",{children:m("fleet-credential-title")}),c.jsx("small",{children:m("fleet-credential-help")}),c.jsxs("label",{className:"nc-field",children:[q.envKey,c.jsx("input",{type:"password",autoComplete:"off",spellCheck:"false",autoCapitalize:"none",value:q.value,onChange:le=>B({...q,value:le.target.value})})]}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",onClick:()=>B(null),children:m("cancel")}),c.jsx("button",{className:"nc-btn primary",disabled:x||!q.value,onClick:vt,children:m("save")})]})]})}),I&&c.jsx(Ms,{onClose:()=>A(null),label:m("import-as-cell"),error:R,children:c.jsx(C_,{token:e,route:I.route||oe,state:I,setState:A,busy:x,onSave:ct})}),H&&c.jsx(Nl,{cell:H,token:e,route:Array.isArray(H.route)?H.route:oe,onConfirm:async le=>{try{await Et(le)}finally{await de()}},onClose:()=>X(null)})]}):c.jsxs("div",{className:"nc-set-tab",children:[dt,D==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-overview-help")}),c.jsx(Nd,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[ut,c.jsxs("div",{className:"nc-set-info",children:[m(R?"fleet-editor-load-error":"fleet-editor-unavailable"),!R&&h.reason?` ${h.reason}`:""]})]}),R&&c.jsx("div",{className:"nc-err",children:R}),I&&c.jsx(Ms,{onClose:()=>A(null),label:m("import-as-cell"),error:R,children:c.jsx(C_,{token:e,route:I.route||oe,state:I,setState:A,busy:x,onSave:ct})}),H&&c.jsx(Nl,{cell:H,token:e,route:Array.isArray(H.route)?H.route:oe,onConfirm:async le=>{try{await Et(le)}finally{await de()}},onClose:()=>X(null)})]}):c.jsxs("div",{className:"nc-set-tab",children:[dt,D==="overview"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"nc-set-info",children:m("fleet-overview-help")}),c.jsx(Nd,{token:e,targets:n,readonly:t,onPower:St,onImport:rt})]}):c.jsxs(c.Fragment,{children:[ut,c.jsx("div",{className:"nc-set-info",children:m("fleet-editor-loading")})]})]})}const bf="nc_notification_speech_v1",gl="nc-notification-speech",Nh="nc-notification-speech-preview",SN=320,bN=2,xN=3e4,kN=1e4,CN=6e4,EN=64,E_=Object.freeze({enabled:!1}),NN=Object.freeze({it:"it-IT",en:"en-US",es:"es-ES"}),RN=Object.freeze({it:new Set(["che","con","correzione","della","delle","difetto","il","lavoro","nessun","non","per","pronto","pubblicata","pubblicato","rilascio","sono","stato","tutti","verificata","verificato","versione","completata","completato","riepilogo"]),en:new Set(["all","and","completed","fix","for","issue","no","published","ready","release","summary","the","verified","version","with","work"]),es:new Set(["con","correccion","defecto","el","esta","para","publicada","publicado","resumen","sin","todos","trabajo","verificada","verificado","version","y"])}),xf=new WeakSet;function kf(e){return{enabled:(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).enabled===!0}}function Hw(){try{return typeof localStorage<"u"?localStorage:null}catch{return null}}function N_(e=Hw()){if(!e)return{...E_};try{return kf(JSON.parse(e.getItem(bf)||"null"))}catch{return{...E_}}}function jN(e,t=Hw()){const n=kf(e);if(t)try{t.setItem(bf,JSON.stringify(n))}catch{}return n}function Br(){try{return typeof window<"u"?window:null}catch{return null}}function Ho(e=Br()){try{return!!(e&&e.speechSynthesis&&typeof e.speechSynthesis.speak=="function"&&typeof e.SpeechSynthesisUtterance=="function")}catch{return!1}}function Ww(e=Br()){return!!(e&&(typeof e=="object"||typeof e=="function")&&xf.has(e))}function Rh(e=Br()){e&&(typeof e=="object"||typeof e=="function")&&xf.delete(e)}function Er(e){const t=String(e||"").trim().toLowerCase().split("-")[0];return NN[t]||""}function Zl(e){return String(e||"").normalize("NFC").replace(/[\p{Cc}\p{Cf}]+/gu," ").replace(/\s+/g," ").trim()}function PN(e){const t=Zl(e).normalize("NFD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase(),n=new Set(t.match(new RegExp("\\p{L}+","gu"))||[]);if(n.size<4)return"";const s=Object.entries(RN).map(([o,a])=>({lang:o,score:[...n].reduce((u,h)=>u+(a.has(h)?1:0),0)})).sort((o,a)=>a.score-o.score);return s[0].score>=3&&s[0].score-s[1].score>=2?s[0].lang:""}function LN(e,t){const n=Er(e&&e.lang);return n||Er(PN(e&&e.body))||Er(t)}function Uw(e){try{const t=e&&e.speechSynthesis&&e.speechSynthesis.getVoices;return typeof t=="function"?Array.from(t.call(e.speechSynthesis)||[]).filter(Boolean):[]}catch{return[]}}function Kw(e,t){const n=Er(t);if(!n)return null;const s=Array.from(e||[]).filter(h=>h&&typeof h.lang=="string"&&h.lang.trim()),o=s.filter(h=>h.lang.trim().toLowerCase()===n.toLowerCase()),a=n.slice(0,2).toLowerCase(),u=s.filter(h=>h.lang.trim().toLowerCase().split("-")[0]===a);return o.find(h=>h.default===!0)||o[0]||u.find(h=>h.default===!0)||u[0]||null}function R_(e){return Zl(e).replace(/\bBearer\s+\S+/gi,"Bearer [redacted]").replace(/\b(?:sk|hf|zai|xox[baprs]|gh[pousr]|npm)[_-][A-Za-z0-9._-]{8,}\b/gi,"[redacted]").replace(/\b(?:token|password|secret|credential|api[_-]?key)\s*[=:]\s*(?:"[^"]*"|'[^']*'|\S+)/gi,"[redacted]").replace(/\b[A-Z][A-Z0-9_]{2,}\s*=\s*(?:"[^"]*"|'[^']*'|\S+)/g,"[redacted]").replace(/(?:\/home\/[^/\s]+|\/Users\/[^/\s]+|\/data\/(?:data|user\/\d+)\/[^/\s]+)(?:\/[^\s]*)?/g,"[private path]").replace(/\b[A-Za-z]:\\Users\\[^\\\s]+(?:\\[^\s]*)?/g,"[private path]")}function TN(e,t=SN){const n=R_(e&&e.title),s=R_(e&&e.body),o=[n,s&&s!==n?s:""].filter(Boolean).join(". "),a=Array.from(o);return a.length<=t?o:`${a.slice(0,Math.max(0,t-1)).join("").trimEnd()}…`}function DN(e){try{return!!(e&&e.visibilityState==="visible"&&typeof e.hasFocus=="function"&&e.hasFocus())}catch{return!1}}function qw(e=Br()){if(!Ho(e))return!1;try{return e.speechSynthesis.cancel(),!0}catch{return!1}}function MN(e){try{e&&typeof e.dispatchEvent=="function"&&typeof e.Event=="function"&&e.dispatchEvent(new e.Event(Nh))}catch{}}function AN(e,t,n=Br(),s={}){var p;if(Rh(n),!Ho(n))return Promise.resolve(!1);const o=Zl(e);if(!o||(p=s.signal)!=null&&p.aborted)return Promise.resolve(!1);const a=Number.isFinite(s.timeoutMs)&&s.timeoutMs>0?s.timeoutMs:kN,u=s.setTimer||((v,b)=>setTimeout(v,b)),h=s.clearTimer||(v=>clearTimeout(v)),f=s.signal;return MN(n),new Promise(v=>{let b=!1,w=!1,S=null,y=null;const x=C=>{if(!b){if(b=!0,f&&y&&f.removeEventListener("abort",y),S!==null&&h(S),C)xf.add(n);else try{n.speechSynthesis.cancel()}catch{}v(C)}};y=()=>x(!1),f&&f.addEventListener("abort",y,{once:!0});try{n.speechSynthesis.cancel();const C=new n.SpeechSynthesisUtterance(o);C.lang=Er(t);const R=Kw(Uw(n),C.lang);R&&(C.voice=R),C.onstart=()=>{w=!0},C.onend=()=>x(w),C.onerror=()=>x(!1),S=u(()=>x(!1),a),n.speechSynthesis.speak(C)}catch{x(!1)}})}function IN(e={}){const t=e.scope||Br(),n=e.document||t&&t.document,s=Number.isInteger(e.maxPending)&&e.maxPending>=0?e.maxPending:bN,o=Number.isFinite(e.watchdogMs)&&e.watchdogMs>0?e.watchdogMs:xN,a=Number.isFinite(e.dedupWindowMs)&&e.dedupWindowMs>0?e.dedupWindowMs:CN,u=Number.isInteger(e.maxDedup)&&e.maxDedup>0?e.maxDedup:EN,h=e.now||Date.now,f=e.setTimer||((I,A)=>setTimeout(I,A)),p=e.clearTimer||(I=>clearTimeout(I)),v=e.isPrimed||(()=>Ww(t)),b=t&&t.speechSynthesis;let w=null,S=null,y=[],x=[],C=()=>{};const R=new Map,k=()=>{x=Uw(t)};if(k(),b&&typeof b.addEventListener=="function")b.addEventListener("voiceschanged",k),C=()=>b.removeEventListener("voiceschanged",k);else if(b&&"onvoiceschanged"in b){const I=b.onvoiceschanged,A=(...N)=>{k(),typeof I=="function"&&I.apply(b,N)};b.onvoiceschanged=A,C=()=>{b.onvoiceschanged===A&&(b.onvoiceschanged=I)}}const $=I=>{if(I&&typeof I.id=="string"&&I.id)return`id:${I.id}`;const A=Number(I&&I.ts),N=Zl(I&&I.title);return Number.isFinite(A)&&N?`frame:${A}:${N}`:""},O=I=>{if(!I)return!0;const A=h();for(const[N,M]of R)A-M>=a&&R.delete(N);if(R.has(I))return!1;for(R.set(I,A);R.size>u;)R.delete(R.keys().next().value);return!0},V=()=>{S!==null&&p(S),S=null},Y=()=>{V(),w&&(w.onend=null,w.onerror=null,w=null),qw(t)},z=I=>{if(!Ho(t))return y=[],"unsupported";let A;try{A=new t.SpeechSynthesisUtterance(I.text),A.lang=Er(I.lang);const M=Kw(x,A.lang);M&&(A.voice=M)}catch{return y=[],"error"}w=A;const N=()=>{if(w!==A)return;V(),w=null,A.onend=null,A.onerror=null;const M=y.shift();M&&z(M)};A.onend=N,A.onerror=N;try{return S=f(()=>{if(w!==A)return;w=null,A.onend=null,A.onerror=null;try{t.speechSynthesis.cancel()}catch{}V();const M=y.shift();M&&z(M)},o),t.speechSynthesis.speak(A),"speaking"}catch{return N(),"error"}},ne=(I,A)=>{if(!Ho(t))return"unsupported";const N=TN(I);if(!N)return"empty";if(!O($(I)))return"duplicate";if(!DN(n))return"inactive";if(!v())return"unprimed";const M={text:N,lang:A};return I&&I.urgency==="high"?(y=[],Y(),z(M)):w?s===0?"dropped":(y.length>=s&&y.shift(),y.push(M),"queued"):z(M)},H=()=>{y=[],Y()};return{enqueue:ne,stop:H,dispose:()=>{H(),C(),C=()=>{}}}}function Vw(){const[e,t]=E.useState(N_);E.useEffect(()=>{const s=o=>{if((o==null?void 0:o.type)==="storage"&&o.key!==bf&&o.key!==null)return;const a=(o==null?void 0:o.type)===gl?kf(o.detail):N_();t(a)};return window.addEventListener(gl,s),window.addEventListener("storage",s),()=>{window.removeEventListener(gl,s),window.removeEventListener("storage",s)}},[]);const n=E.useCallback(s=>{const o=jN({enabled:s===!0});return t(o),window.dispatchEvent(new CustomEvent(gl,{detail:o})),o.enabled},[]);return[e.enabled,n]}function BN({text:e}){const[t,n]=E.useState(!1),s=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return c.jsxs("div",{className:"nc-set-copyline",children:[c.jsx("code",{children:e}),c.jsxs("button",{type:"button",className:"nc-btn ghost",onClick:s,children:[c.jsx(it,{name:"copy",size:14})," ",m(t?"copied":"copy")]})]})}function ON({value:e}){const[t,n]=E.useState("");return E.useEffect(()=>{let s=!0;return M2.toDataURL(e,{margin:1,width:220}).then(o=>{s&&n(o)}).catch(()=>{}),()=>{s=!1}},[e]),t?c.jsx("img",{src:t,width:"220",height:"220",alt:"NexusCrew pairing QR"}):null}function zN({token:e,nodes:t,roster:n,settings:s,readonly:o,refresh:a,refreshAliases:u}){const[h,f]=E.useState(null),[p,v]=E.useState(null),[b,w]=E.useState({}),[S,y]=E.useState(null),[x,C]=E.useState({ssh:"",sshPort:"",name:""}),[R,k]=E.useState(""),[$,O]=E.useState(""),[V,Y]=E.useState(""),[z,ne]=E.useState(!1),[H,X]=E.useState(null),[I,A]=E.useState(null),N=Date.now(),M=s&&s.deviceName||"",L=(t||[]).filter(J=>J&&J.direction==="outbound"&&J.name&&J.ssh),P=L.find(J=>J.name===R)||L[0]||null,F=L.find(J=>J.name===$)||L[0]||null,T=F?Cg(F.tunnel,N):null,q=F!=null&&F.shared?T!=null&&T.up?"share-local-active":"share-local-pending":T!=null&&T.up?"share-local-private":"share-local-private-down",B=[{key:"peer-group-hubs",rows:(t||[]).filter(J=>J.kind!=="transitive"&&J.relation!=="client")},{key:"peer-group-clients",rows:(t||[]).filter(J=>J.kind!=="transitive"&&J.relation==="client")},{key:"peer-group-routed",rows:(t||[]).filter(J=>J.kind==="transitive")}],D=async(J,ee)=>{f(null),v(`${J}:${ee}`);try{const pe=await $h(e,J,ee);ee==="test"&&w(Se=>({...Se,[J]:pe})),await a()}catch(pe){f(`${J}: ${String(pe.message||pe)}`)}v(null)},U=async J=>{f(null),v(`${J}:remove`);try{await y0(e,J),A(null),await a()}catch(ee){f(`${J}: ${String(ee.message||ee)}`)}v(null)},Z=J=>X({name:J.name,direction:J.direction,label:J.label||J.name,ssh:J.ssh||"",sshPort:J.sshPort?String(J.sshPort):"",autostart:J.autostart===!0,visibility:J.visibility||"network",selected:[...J.selected||[]]}),oe=async()=>{if(!H||!jr(H.label)){f(m("err-label"));return}const J=H.direction==="inbound"?{label:H.label,visibility:H.visibility,selected:H.visibility==="selected"?H.selected:[]}:{label:H.label,ssh:H.ssh,autostart:H.autostart,...H.sshPort?{sshPort:Number(H.sshPort)}:{}};f(null),v(`${H.name}:edit`);try{await _0(e,H.name,J),X(null),await a()}catch(ee){f(`${H.name}: ${String(ee.message||ee)}`)}v(null)},de=async J=>{if(F){f(null),v(`${F.name}:share`);try{await w0(e,F.name,J),await a()}catch(ee){const pe=ee!=null&&ee.data&&ee.data.shared===!1?ee.data:null;if(pe)try{await a()}catch{}const Se=ee!=null&&ee.data&&typeof ee.data.hint=="string"?ee.data.hint:"",Ze=(pe==null?void 0:pe.revoked)===!0&&(pe==null?void 0:pe.localReconcilePending)===!0?m("share-off-local-reconcile-pending"):(pe==null?void 0:pe.revoked)===!1&&(pe==null?void 0:pe.reconcilePending)===!0?m("share-off-hub-reconcile-pending"):"";f(`${F.name}: ${String(ee.message||ee)}${Se?` — ${Se}`:""}${Ze?` — ${Ze}`:""}`)}v(null)}},fe=async()=>{if(f(null),P){const pe=kg({name:P.name,ssh:P.ssh,sshPort:P.sshPort||""});if(!pe.ok){f(m(pe.error));return}v("invite");try{y(await lg(e,{ssh:pe.value.ssh,...pe.value.sshPort?{sshPort:pe.value.sshPort}:{}},[P.name]))}catch(Se){f(String(Se.message||Se))}v(null);return}const J=ms(x.name||V||M||"NexusCrew"),ee=kg({name:J,ssh:x.ssh,sshPort:x.sshPort});if(!ee.ok){f(m(ee.error));return}v("invite");try{y(await lg(e,{...V||M?{label:V||M}:{},name:J,ssh:ee.value.ssh,...ee.value.sshPort?{sshPort:ee.value.sshPort}:{}}))}catch(pe){f(String(pe.message||pe))}v(null)};return c.jsxs("div",{className:"nc-set-tab",children:[c.jsx("div",{className:"nc-sheet-label",children:m("peer-inventory-title")}),(t||[]).length===0&&c.jsx("div",{className:"nc-empty",children:m("no-nodes")}),B.map(J=>J.rows.length>0&&c.jsxs("div",{className:"nc-peer-group",children:[c.jsxs("div",{className:"nc-peer-group-title",children:[m(J.key)," ",c.jsx("span",{children:J.rows.length})]}),J.rows.map(ee=>{var He,vt;const pe=ee.kind==="transitive",Se=pe?{up:ee.stale!==!0,label:ee.stale===!0?"peer-routed-stale":"peer-routed"}:Cg(ee.tunnel,N),Ze=b[ee.name],$e=ee.actions||{};return c.jsxs("div",{className:`nc-set-node${pe?" routed":""}`,children:[c.jsxs("div",{className:"nc-set-node-head",children:[c.jsx("span",{className:`nc-dot ${Se.up?"on":""}`}),c.jsx("b",{children:ee.label||ee.name}),c.jsxs("small",{children:[ee.name,pe?` · ${ee.route.join(" → ")}`:ee.direction==="outbound"?` · SSH ${ee.ssh||""}`:` · ${m("node-connected-client")}`,(He=ee.tunnel)!=null&&He.transport?` · ${ee.tunnel.transport} ${m("transport-used")}`:""]}),c.jsxs("span",{className:`nc-set-tunnel${Se.up?" up":""}`,children:[m(Se.label),Se.since?` · ${Se.since}`:""]})]}),!pe&&ee.direction==="inbound"&&c.jsx("div",{className:"nc-set-info",children:m(ee.shared?"peer-shared":"peer-private")}),$e.visibility&&ee.shared&&c.jsxs(c.Fragment,{children:[c.jsxs("select",{value:ee.visibility||"network",disabled:o||!!p,onChange:async Xe=>{v(`${ee.name}:visibility`);try{await ug(e,ee.name,Xe.target.value),await a()}catch(St){f(String(St.message||St))}v(null)},children:[c.jsx("option",{value:"network",children:m("visibility-network")}),c.jsx("option",{value:"relay-only",children:m("visibility-relay")}),c.jsx("option",{value:"selected",children:m("visibility-selected")})]}),ee.visibility==="selected"&&c.jsx("div",{className:"nc-set-row",children:(t||[]).filter(Xe=>Xe.name!==ee.name&&Xe.nodeId).map(Xe=>{const St=(ee.selected||[]).includes(Xe.nodeId);return c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:St,disabled:o||!!p,onChange:async Et=>{const rt=Et.target.checked?[...ee.selected||[],Xe.nodeId]:(ee.selected||[]).filter(ct=>ct!==Xe.nodeId);v(`${ee.name}:visibility`);try{await ug(e,ee.name,"selected",rt),await a()}catch(ct){f(String(ct.message||ct))}v(null)}})," ",Xe.label||Xe.name]},Xe.nodeId)})})]}),c.jsxs("div",{className:"nc-set-node-actions",children:[$e.edit&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>Z(ee),children:m("edit")}),$e.test&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>D(ee.name,"test"),children:m("node-test")}),$e.disconnect&&Se.up&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>D(ee.name,"down"),children:m("tunnel-stop")}),$e.connect&&!Se.up&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>D(ee.name,"up"),children:m("tunnel-start")}),$e.restart&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>D(ee.name,"restart"),children:m("tunnel-restart")}),$e.remove&&c.jsxs("button",{type:"button",className:"nc-btn danger",disabled:o||!!p,title:m(o?"settings-readonly":"delete"),onClick:()=>A(ee.name),children:[c.jsx(it,{name:"trash",size:14})," ",m("delete")]})]}),(H==null?void 0:H.name)===ee.name&&c.jsxs("div",{className:"nc-set-form nc-node-editor",children:[c.jsxs("label",{className:"nc-field",children:[m("node-display-label"),c.jsx("input",{value:H.label,disabled:!!p,onChange:Xe=>X({...H,label:Xe.target.value})})]}),H.direction==="outbound"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"nc-field",children:[m("node-ssh-label"),c.jsx("input",{value:H.ssh,disabled:!!p,onChange:Xe=>X({...H,ssh:Xe.target.value})})]}),c.jsxs("label",{className:"nc-field",children:[m("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",value:H.sshPort,disabled:!!p,onChange:Xe=>X({...H,sshPort:Xe.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:H.autostart,disabled:!!p,onChange:Xe=>X({...H,autostart:Xe.target.checked})})," ",m("boot-persist")]})]}):c.jsxs("label",{className:"nc-field",children:[m("peer-visibility"),c.jsxs("select",{value:H.visibility,disabled:!!p,onChange:Xe=>X({...H,visibility:Xe.target.value}),children:[c.jsx("option",{value:"network",children:m("visibility-network")}),c.jsx("option",{value:"relay-only",children:m("visibility-relay")}),c.jsx("option",{value:"selected",children:m("visibility-selected")})]})]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:!!p,onClick:oe,children:m("save")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>X(null),children:m("cancel")})]})]}),I===ee.name&&c.jsxs("div",{className:"nc-set-confirm",children:[c.jsx("b",{children:m("node-remove-confirm").replace("{name}",ee.label||ee.name)}),c.jsx("small",{children:m("node-remove-warning")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn danger",disabled:!!p,onClick:()=>U(ee.name),children:m("delete")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>A(null),children:m("cancel")})]})]}),((vt=ee.health)==null?void 0:vt.detail)&&c.jsx("div",{className:`nc-set-test${ee.health.status==="healthy"?" ok":ee.health.status==="passive"?"":" ko"}`,children:ee.health.detail}),Ze&&c.jsxs("div",{className:`nc-set-test${Ze.ok?" ok":" ko"}`,children:[Ze.result,Ze.detail?` — ${Ze.detail}`:""]})]},`${ee.kind||"direct"}:${ee.nodeId||ee.name}`)})]},J.key)),(n||[]).some(J=>!J.direct&&J.instanceId)&&c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("routed-node-aliases")}),c.jsx("small",{className:"nc-set-hint",children:m("routed-node-aliases-help")}),(n||[]).filter(J=>!J.direct&&J.instanceId).map(J=>c.jsxs("div",{className:"nc-set-node",children:[c.jsxs("div",{className:"nc-set-node-head",children:[c.jsx("span",{className:`nc-dot ${J.status==="up"?"on":""}`}),c.jsx("b",{children:J.label||J.name}),c.jsx("small",{children:(J.route||[]).join(" › ")})]}),c.jsxs("div",{className:"nc-set-node-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:async()=>{const ee=window.prompt(m("node-local-alias"),J.alias||"");if(ee!=null){if(ee.trim()&&!jr(ee.normalize("NFC"))){f(m("err-label"));return}v(`${J.instanceId}:alias`),f(null);try{ee.trim()?await v0(e,J.instanceId,ee):await cg(e,J.instanceId),u()}catch(pe){f(String(pe.message||pe))}v(null)}},children:m("alias-on-device")}),J.alias&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:async()=>{v(`${J.instanceId}:alias-reset`),f(null);try{await cg(e,J.instanceId),u()}catch(ee){f(String(ee.message||ee))}v(null)},children:m("reset-alias")})]})]},J.instanceId))]}),F&&c.jsxs("div",{className:"nc-set-form nc-local-share",children:[c.jsx("div",{className:"nc-sheet-label",children:m("share-local-heading")}),L.length>1&&c.jsxs("label",{className:"nc-field",children:[m("share-local-hub"),c.jsx("select",{value:F.name,disabled:o||!!p,onChange:J=>O(J.target.value),children:L.map(J=>c.jsx("option",{value:J.name,children:J.label||J.name},J.name))})]}),c.jsxs("label",{className:"nc-check nc-node-share",children:[c.jsx("input",{type:"checkbox",checked:F.shared===!0,disabled:o||!!p,onChange:J=>de(J.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("share-local-through").replace("{device}",M||m("local")).replace("{hub}",F.label||F.name)}),c.jsx("small",{children:m(F.shared?"share-node-on-desc":"share-node-off-desc")})]})]}),c.jsx("div",{className:`nc-set-test${F.shared&&(T!=null&&T.up)?" ok":T!=null&&T.up?"":" ko"}`,children:m(q)}),!(T!=null&&T.up)&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:o||!!p,onClick:()=>de(F.shared===!0),children:m("share-local-reconnect")})]}),c.jsx(Tw,{token:e,deviceDefault:M,localNodeId:s&&s.nodeId||"",localNameDefault:s&&s.localName||"",readonly:o,onSuccess:a}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("invite-node")}),c.jsx("small",{className:"nc-set-hint",children:m(P?"invite-network-hint":"invite-v2-hint")}),P?c.jsxs(c.Fragment,{children:[L.length>1&&c.jsxs("label",{className:"nc-field",children:[m("invite-network-label"),c.jsx("select",{value:P.name,disabled:o||!!p,onChange:J=>{k(J.target.value),y(null)},children:L.map(J=>c.jsx("option",{value:J.name,children:J.label||J.name},J.name))})]}),c.jsxs("div",{className:"nc-set-info nc-invite-endpoint",children:[m("invite-network-via"),": ",c.jsx("b",{children:P.label||P.name})," · ",P.ssh,P.sshPort?`:${P.sshPort}`:""]}),c.jsx("small",{className:"nc-set-hint",children:m("invite-network-route")})]}):c.jsxs("label",{className:"nc-field",children:[m("invite-endpoint-label"),c.jsx("input",{placeholder:"user@host",value:x.ssh,disabled:o,onChange:J=>C({...x,ssh:J.target.value})}),c.jsx("small",{className:"nc-set-hint",children:m("invite-endpoint-needed")})]}),!P&&z&&c.jsxs("div",{className:"nc-invite-advanced",children:[c.jsxs("label",{className:"nc-field",children:[m("node-ssh-port-label"),c.jsx("input",{inputMode:"numeric",placeholder:"22",value:x.sshPort,disabled:o,onChange:J=>C({...x,sshPort:J.target.value.replace(/[^0-9]/g,"").slice(0,5)})})]}),c.jsxs("label",{className:"nc-field",children:[m("device-name-label"),c.jsx("input",{placeholder:M||"NexusCrew",value:V,disabled:o,onChange:J=>Y(J.target.value)}),c.jsx("small",{className:"nc-set-hint",children:m("device-name-hint")})]}),c.jsxs("label",{className:"nc-field",children:[m("node-name-label"),c.jsx("input",{placeholder:ms(V||M||m("node-name-ph")),value:x.name,disabled:o,onChange:J=>C({...x,name:J.target.value?ms(J.target.value):""})})]})]}),c.jsxs("div",{className:"nc-set-row nc-invite-actions",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:o||!!p||!P&&!x.ssh.trim(),onClick:fe,children:m("create-pairing-link")}),!P&&c.jsxs("button",{type:"button",className:"nc-btn ghost",disabled:!!p,onClick:()=>ne(J=>!J),children:[z?"▾":"▸"," ",m("pair-advanced")]})]}),S&&c.jsxs(c.Fragment,{children:[c.jsx(ON,{value:S.pairingUrl}),c.jsx(BN,{text:S.pairingUrl}),c.jsx("div",{className:"nc-set-info",children:m("invite-next-steps")})]})]}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function FN({token:e,readonly:t}){const[n,s]=E.useState("idle"),[o,a]=E.useState(!1),[u,h]=E.useState(null);E.useEffect(()=>{let p=!1;return q2().then(v=>{p||s(v)}),()=>{p=!0}},[]);const f=async()=>{h(null),a(!0);try{n==="subscribed"?(await Y2(e),s("idle")):(await V2(e),s("subscribed"))}catch(p){const v=String(p.message||p);v==="push-denied"?(s("denied"),h(m("push-denied"))):v==="push-unsupported"?(s("unsupported"),h(m("push-unsupported"))):h(v)}a(!1)};return n==="unsupported"?c.jsx("div",{className:"nc-set-info",children:m("push-unsupported")}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||o||n==="denied",title:t?m("settings-readonly"):"",onClick:f,children:m(n==="subscribed"?"push-disable":"push-enable")}),c.jsx("span",{className:"nc-set-info",children:m(n==="subscribed"?"push-on":n==="denied"?"push-denied":"push-off")})]}),u&&c.jsx("div",{className:"nc-err",children:u})]})}function $N(){const[e,t]=Vw(),[n,s]=E.useState(""),[o,a]=E.useState(""),[u,h]=E.useState(!1),[f,p]=E.useState(Ww),v=E.useRef(0),b=E.useRef(!1),w=E.useRef(null),S=Ho();E.useEffect(()=>()=>{var C;v.current+=1,b.current&&((C=w.current)==null||C.abort(),w.current=null,b.current=!1,Rh())},[]);const y=async()=>{const C=v.current+=1,R=typeof AbortController=="function"?new AbortController:null;s(""),a(""),h(!0),p(!1),b.current=!0,w.current=R;const k=await AN(m("notification-speech-preview"),El(),void 0,R?{signal:R.signal}:{});return C!==v.current||(w.current=null,b.current=!1,h(!1),p(k),k?a(m("notification-speech-preview-ok")):s(m("notification-speech-preview-failed"))),k},x=C=>{var R;if(t(C),s(""),a(""),C)y();else{v.current+=1;const k=b.current;(R=w.current)==null||R.abort(),w.current=null,b.current=!1,h(!1),p(!1),Rh(),k||qw()}};return c.jsxs("div",{className:"nc-set-form",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":m("notification-speech-enable"),checked:e,disabled:!S,onChange:C=>x(C.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("notification-speech-enable")}),c.jsx("small",{children:m("notification-speech-help")})]})]}),S?c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:!e||u,onClick:()=>{y()},children:m(u?"notification-speech-testing":"notification-speech-test")})}):c.jsx("div",{className:"nc-set-info",children:m("notification-speech-unsupported")}),e&&!f&&!u&&!n&&c.jsx("div",{className:"nc-set-info",children:m("notification-speech-needs-test")}),o&&c.jsx("div",{className:"nc-set-info",role:"status",children:o}),n&&c.jsx("div",{className:"nc-err",children:n})]})}function HN({token:e,readonly:t,nodes:n=[],settings:s=null}){const[o,a]=E.useState(null),[u,h]=E.useState([]),[f,p]=E.useState({name:"",mode:"primary-failover",targets:[]}),[v,b]=E.useState(null),[w,S]=E.useState(!1),[y,x]=E.useState(null),[C,R]=E.useState(""),k=E.useCallback(async()=>{try{const[F,T]=await Promise.all([S0(e),C0(e)]);a(F),h(Array.isArray(T==null?void 0:T.groups)?T.groups:[]),R("")}catch(F){R(String(F.message||F))}},[e]);E.useEffect(()=>{k()},[k]);const $=async F=>{S(!0),x(null),R("");try{a(await b0(e,F))}catch(T){R(String(T.message||T))}S(!1)},O=async()=>{S(!0),x(null),R("");try{x({kind:"test",...await x0(e)})}catch(F){R(String(F.message||F))}S(!1)},V=async()=>{S(!0),x(null),R("");try{x({kind:"stop",...await k0(e)})}catch(F){R(String(F.message||F))}S(!1)},Y=[],z=new Set,ne=(F,T)=>{const q=typeof F=="string"?F.toLowerCase():"";!/^[a-f0-9]{32}$/.test(q)||z.has(q)||(z.add(q),Y.push({id:q,label:T||q}))};ne(s==null?void 0:s.nodeId,m("audio-group-local"));for(const F of n||[])ne((F==null?void 0:F.nodeId)||(F==null?void 0:F.instanceId),(F==null?void 0:F.label)||(F==null?void 0:F.name)||(F==null?void 0:F.nodeId));for(const F of f.targets)ne(F,`${F} (${m("audio-group-unavailable-target")})`);const H=(F=null)=>{R(""),F?(b(F.name),p({name:F.name,mode:F.mode,targets:[...F.targets||[]]})):(b(null),p({name:"",mode:"primary-failover",targets:[]}))},X=(F,T)=>p(q=>({...q,targets:T?[...new Set([...q.targets,F])]:q.targets.filter(B=>B!==F)})),I=async()=>{const F=f.name.trim().toLowerCase();if(!/^[a-z0-9][a-z0-9-]{0,31}$/.test(F)||f.targets.length<1){R(m("audio-group-invalid"));return}S(!0),R("");try{const T=await E0(e,F,{targets:f.targets,mode:f.mode}),q=T==null?void 0:T.group;if(!q||!q.name)throw new Error(m("audio-group-save-failed"));h(B=>[...B.filter(D=>D.name!==q.name),q].sort((D,U)=>D.name.localeCompare(U.name))),H(null)}catch(T){R(String(T.message||T))}S(!1)},A=async F=>{S(!0),R("");try{await N0(e,F),h(T=>T.filter(q=>q.name!==F)),v===F&&H(null)}catch(T){R(String(T.message||T))}S(!1)},N=(o==null?void 0:o.installed)===!0,M=(o==null?void 0:o.liveness)==="ready",L=(o==null?void 0:o.consent)===!0&&N&&M,P=y?y.kind==="stop"?m(y.stopped?"audio-stop-stopped":"audio-stop-idle"):y.status==="accepted"||y.status==="spoken"?m("audio-test-accepted"):y.status==="unknown"?m("audio-test-unknown"):`${m("audio-test-refused")}${y.reason?` (${y.reason})`:""}`:"";return c.jsxs("div",{className:"nc-set-tab nc-audio-settings",children:[c.jsxs("div",{className:"nc-set-info",children:[c.jsx("b",{children:m("audio-title")}),c.jsx("br",{}),m("audio-help")]}),o?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":m("audio-consent"),checked:o.consent===!0,disabled:t||w,onChange:F=>{$(F.target.checked)}}),c.jsxs("span",{children:[c.jsx("b",{children:m("audio-consent")}),c.jsx("small",{children:m("audio-consent-help")})]})]}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("audio-capability")}),c.jsxs("div",{className:"nc-set-info",children:[m("audio-adapter"),": ",o.adapter||m("audio-adapter-none"),c.jsx("br",{}),m("audio-installed"),": ",m(N?"audio-installed-yes":"audio-installed-no"),c.jsx("br",{}),m("audio-liveness"),": ",m(M?"audio-liveness-ready":"audio-liveness-unavailable"),Array.isArray(o.languages)&&o.languages.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("br",{}),m("audio-languages"),": ",o.languages.join(", ")]})]}),o.limits&&c.jsxs("small",{className:"nc-set-hint",children:[m("audio-limits"),": ",o.limits]})]}),!o.consent&&c.jsx("div",{className:"nc-set-info",children:m("audio-test-needs-consent")}),!N&&c.jsx("div",{className:"nc-set-info",children:m("audio-unavailable")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:t||w||!L,title:t?m("settings-readonly"):"",onClick:()=>{O()},children:m(w?"audio-testing":"audio-test")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>{V()},children:m(w?"audio-stopping":"audio-stop")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>{k()},children:m("refresh")})]}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("audio-groups-title")}),c.jsx("small",{className:"nc-set-hint",children:m("audio-groups-help")}),u.length===0&&c.jsx("div",{className:"nc-set-info",children:m("audio-groups-empty")}),u.map(F=>{var T;return c.jsxs("div",{className:"nc-set-row",children:[c.jsxs("span",{children:[c.jsx("b",{children:F.name})," ",c.jsxs("small",{children:["· ",F.mode==="fanout"?m("audio-group-fanout"):m("audio-group-primary")," · ",((T=F.targets)==null?void 0:T.length)||0]})]}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>H(F),children:m("audio-group-edit")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>{A(F.name)},children:m("audio-group-delete")})]},F.name)}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:t||w,onClick:()=>H(null),children:m("audio-group-new")})}),c.jsxs("label",{className:"nc-field",children:[m("audio-group-name"),c.jsx("input",{"aria-label":m("audio-group-name"),value:f.name,maxLength:"32",disabled:t||w,onChange:F=>p(T=>({...T,name:F.target.value}))})]}),c.jsxs("label",{className:"nc-field",children:[m("audio-group-mode"),c.jsxs("select",{"aria-label":m("audio-group-mode"),value:f.mode,disabled:t||w,onChange:F=>p(T=>({...T,mode:F.target.value})),children:[c.jsx("option",{value:"primary-failover",children:m("audio-group-primary")}),c.jsx("option",{value:"fanout",children:m("audio-group-fanout")})]})]}),c.jsx("div",{className:"nc-set-info",children:m("audio-group-targets")}),Y.length===0?c.jsx("small",{className:"nc-set-hint",children:m("audio-group-no-targets")}):Y.map(F=>c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:f.targets.includes(F.id),disabled:t||w,onChange:T=>X(F.id,T.target.checked)}),c.jsxs("span",{children:[F.label,c.jsx("small",{children:F.id})]})]},F.id)),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn primary",disabled:t||w,onClick:()=>{I()},children:m("audio-group-save")}),v&&c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:w,onClick:()=>H(null),children:m("audio-group-cancel")})]})]})]}):c.jsx("div",{className:"nc-set-info",children:m("audio-loading")}),P&&c.jsx("div",{className:"nc-set-note",role:"status",children:P}),C&&c.jsx("div",{className:"nc-err",children:C})]})}function WN(){const[e,t]=uf();return c.jsxs("div",{className:"nc-set-tab nc-input-settings",children:[c.jsx("div",{className:"nc-set-info",children:m("input-settings-local")}),c.jsxs("div",{className:"nc-set-form",children:[c.jsxs("label",{className:"nc-field",children:[m("terminal-keyboard-gesture"),c.jsx("select",{"aria-label":m("terminal-keyboard-gesture"),value:e.terminalKeyboardGesture,onChange:n=>t({terminalKeyboardGesture:n.target.value}),children:uw.map(n=>c.jsx("option",{value:n,children:m(`terminal-keyboard-${n}`)},n))}),c.jsx("small",{children:m("terminal-keyboard-gesture-help")})]}),c.jsxs("label",{className:"nc-field",children:[m("keybar-layout"),c.jsx("select",{"aria-label":m("keybar-layout"),value:e.keybarLayout,onChange:n=>t({keybarLayout:n.target.value}),children:dw.map(n=>c.jsx("option",{value:n,children:m(`keybar-layout-${n}`)},n))}),c.jsx("small",{children:m("keybar-layout-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.keybarKeepsKeyboardClosed,onChange:n=>t({keybarKeepsKeyboardClosed:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:m("keybar-ime-lock")}),c.jsx("small",{children:m("keybar-ime-lock-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.voiceKeepsKeyboardClosed,onChange:n=>t({voiceKeepsKeyboardClosed:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:m("voice-ime-lock")}),c.jsx("small",{children:m("voice-ime-lock-help")})]})]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:e.showKeybarEnter,onChange:n=>t({showKeybarEnter:n.target.checked})}),c.jsxs("span",{children:[c.jsx("b",{children:m("keybar-enter-show")}),c.jsx("small",{children:m("keybar-enter-show-help")})]})]}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:()=>t(hs),children:m("input-settings-reset")})})]})}function UN({token:e,roster:t=[],readonly:n}){const s=[{key:"local",route:[],label:m("diagnostics-local"),status:"up"},...t.filter(L=>Array.isArray(L.route)&&L.route.length).map(L=>({key:L.route.join("/"),route:L.route,label:L.label||L.name,status:L.status}))],[o,a]=E.useState("local"),u=s.find(L=>L.key===o)||s[0],[h,f]=E.useState(null),[p,v]=E.useState([]),[b,w]=E.useState(""),[S,y]=E.useState(!1),[x,C]=E.useState(!0),[R,k]=E.useState(900),[$,O]=E.useState("all"),[V,Y]=E.useState(""),z=E.useRef(0),ne=E.useRef(null),H=E.useCallback(async()=>{try{const L=await L0(e,u.route);if(f(L),w(""),!S){const P=await T0(e,{after:z.current,limit:200},u.route);Array.isArray(P.records)&&P.records.length&&(z.current=P.cursor,v(F=>[...F,...P.records].slice(-500)))}}catch(L){w(L&&L.status===404?m("diagnostics-unsupported"):String(L.message||L))}},[e,u.key,S]);E.useEffect(()=>{z.current=0,v([]),f(null),w("")},[u.key]),E.useEffect(()=>{let L=null,P=!0;const F=()=>{!P||document.visibilityState==="hidden"||H()},T=()=>{L&&clearInterval(L),L=document.visibilityState==="hidden"?null:setInterval(F,2e3),document.visibilityState!=="hidden"&&F()};return document.addEventListener("visibilitychange",T),T(),()=>{P=!1,L&&clearInterval(L),document.removeEventListener("visibilitychange",T)}},[H]),E.useEffect(()=>{x&&ne.current&&(ne.current.scrollTop=ne.current.scrollHeight)},[p,x]);const X=p.filter(L=>($==="all"||L.level===$)&&(!V||String(L.component||"").toLowerCase().includes(V.toLowerCase()))),I=X.map(L=>`${L.ts} ${L.level.toUpperCase()} ${L.component} ${L.code} ${L.message}${Object.keys(L.meta||{}).length?` ${JSON.stringify(L.meta)}`:""}`).join(`
92
92
  `),A=async L=>{w("");try{const P=await L();f(P),await H()}catch(P){w(String(P.message||P))}},N=async()=>{try{await navigator.clipboard.writeText(I)}catch{w(m("copy-manual"))}},M=()=>{try{const L=new Blob([`${JSON.stringify(X,null,2)}
93
- `],{type:"application/json"}),P=URL.createObjectURL(L),F=document.createElement("a");F.href=P,F.download="nexuscrew-diagnostics.json",F.click(),URL.revokeObjectURL(P)}catch{w(m("diagnostics-export-failed"))}};return c.jsxs("div",{className:"nc-set-tab nc-diagnostics",children:[c.jsxs("label",{className:"nc-field",children:[m("diagnostics-target"),c.jsx("select",{value:u.key,onChange:L=>a(L.target.value),children:s.map(L=>c.jsxs("option",{value:L.key,children:[L.label,L.status!=="up"?` · ${L.status}`:""]},L.key))})]}),c.jsxs("div",{className:"nc-set-form nc-diag-controls",children:[c.jsx("div",{className:"nc-sheet-label",children:m("diagnostics-verbose")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("select",{"aria-label":m("diagnostics-duration"),value:R,onChange:L=>k(Number(L.target.value)),disabled:n,children:[300,900,1800,3600].map(L=>c.jsxs("option",{value:L,children:[L/60," min"]},L))}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||(h==null?void 0:h.verbose)===!0,onClick:()=>A(()=>dg(e,!0,R,u.route)),children:m("enable")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||(h==null?void 0:h.verbose)!==!0,onClick:()=>A(()=>dg(e,!1,R,u.route)),children:m("stop")})]}),c.jsx("small",{className:"nc-set-hint",children:h!=null&&h.verbose?m("diagnostics-expires").replace("{time}",new Date(h.expiresAt).toLocaleTimeString()):m("diagnostics-off")})]}),c.jsxs("div",{className:"nc-diag-filters",children:[c.jsxs("select",{"aria-label":m("diagnostics-level"),value:$,onChange:L=>O(L.target.value),children:[c.jsx("option",{value:"all",children:m("diagnostics-all-levels")}),["debug","info","warn","error"].map(L=>c.jsx("option",{value:L,children:L},L))]}),c.jsx("input",{"aria-label":m("diagnostics-component"),placeholder:m("diagnostics-component"),value:V,onChange:L=>Y(L.target.value)})]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:S,onChange:L=>y(L.target.checked)})," ",m("diagnostics-pause")]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:x,onChange:L=>C(L.target.checked)})," ",m("diagnostics-autoscroll")]})]}),c.jsx("pre",{ref:ne,className:"nc-diag-log","aria-label":m("diagnostics-log"),children:I||m("diagnostics-empty")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:N,children:m("copy")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:M,children:m("diagnostics-export")}),c.jsx("button",{type:"button",className:"nc-btn danger",disabled:n,onClick:()=>{window.confirm(m("diagnostics-clear-confirm"))&&A(async()=>{const L=await D0(e,u.route);return z.current=0,v([]),L})},children:m("diagnostics-clear")})]}),b&&c.jsx("div",{className:"nc-err",children:b})]})}function KN({token:e,settings:t,readonly:n,refresh:s,roster:o,section:a,setSection:u}){const[h,f]=E.useState(null),[p,v]=E.useState(null),[b,w]=E.useState(!1),[S,y]=E.useState(!1),[x,C]=E.useState(null),[R,k]=E.useState(!0),[$,O]=E.useState(!1);E.useEffect(()=>{C(t&&t.update||null),k(!t||t.autoUpdate!==!1),O(!!(t&&t.alternateScreen))},[t]);const V=async()=>{f(null),v(null),y(!0);try{const N=await p0(e);v(N.note||"ok"),w(!1)}catch(N){f(String(N.message||N))}y(!1)},Y=async()=>{f(null),v(null),y(!0);try{const N=await R0(e);v(`${N.note||"ok"}${N.target?` (${N.target})`:""}`)}catch(N){f(String(N.message||N))}y(!1)},z=async N=>{f(null),v(null),y(!0);try{await Ld(e,{autoUpdate:N}),k(N),s&&await s()}catch(M){f(String(M.message||M))}y(!1)},ne=async N=>{f(null),v(null),y(!0);try{await Ld(e,{alternateScreen:N}),O(N),s&&await s()}catch(M){f(String(M.message||M))}y(!1)},H=async()=>{f(null),v(null),y(!0);try{C(await j0(e))}catch(N){f(String(N.message||N))}y(!1)},X=async()=>{f(null),v(null),y(!0);try{const N=await P0(e);C(N),v(m("npm-update-restarting"))}catch(N){f(String(N.message||N))}y(!1)},I=()=>{window.confirm(m("composer-clear-confirm"))&&(f(null),xE()?(window.dispatchEvent(new Event(Sh)),v(m("composer-clear-done"))):f(m("composer-clear-failed")))},A=t&&t.service;return c.jsxs("div",{className:"nc-set-tab",children:[c.jsx("div",{className:"nc-system-tabs",role:"tablist","aria-label":m("tab-system"),children:["general","diagnostics"].map(N=>c.jsx("button",{type:"button",role:"tab","aria-selected":a===N,className:`nc-set-tabbtn${a===N?" on":""}`,onClick:()=>u(N),children:m(`system-${N}`)},N))}),a==="general"&&c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-this-node")}),t&&c.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,c.jsx("br",{}),A&&A.installed?m("service-installed"):m("service-missing"),A&&A.installed?` · ${A.active?m("service-active"):m("service-inactive")}`:"",A?` · boot ${A.boot?"on":"off"}`:""]}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S,title:n?m("settings-readonly"):"",onClick:Y,children:m("service-regenerate")})}),c.jsx(FN,{token:e,readonly:n}),c.jsx($N,{})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-updates")}),c.jsxs("div",{className:"nc-set-form nc-update-settings",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:R,disabled:n||S||x&&!x.supported,onChange:N=>z(N.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("npm-auto-update")}),c.jsx("small",{children:m("npm-auto-update-help")})]})]}),x&&c.jsxs("div",{className:"nc-set-info",children:[m("npm-update-current")," v",x.current,x.latest?` · ${m("npm-update-latest")} v${x.latest}`:""," · ",m(`npm-update-${x.supported?x.phase:"unsupported"}`)]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S||!x||!x.supported,onClick:H,children:m("npm-update-check")}),x&&x.available&&c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||S||x.phase==="installing",onClick:X,children:m("npm-update-install")})]}),x&&x.lastError&&c.jsx("div",{className:"nc-err",children:x.lastError})]})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-security")}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S,title:n?m("settings-readonly"):"",onClick:()=>{f(null),v(null),w(!0)},children:m("token-rotate")})})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-local-data")}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("composer-clear-data")}),c.jsx("small",{className:"nc-set-hint",children:m("composer-clear-data-help")}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:I,children:m("composer-clear-data")})})]})]})]}),a==="diagnostics"&&c.jsxs("section",{className:"nc-system-group nc-system-diagnostics",children:[c.jsx("h3",{children:m("system-diagnostics")}),c.jsxs("div",{className:"nc-set-form nc-alternate-screen-settings",children:[c.jsx("div",{className:"nc-sheet-label",children:m("system-terminal")}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":m("alternate-screen"),checked:$,disabled:n||S,onChange:N=>ne(N.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("alternate-screen")}),c.jsx("small",{children:m("alternate-screen-help")})]})]})]}),c.jsx(UN,{token:e,roster:o,readonly:n})]}),b&&c.jsxs("div",{className:"nc-set-confirm",children:[c.jsx("div",{children:m("token-rotate-explain")}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:S,onClick:()=>w(!1),children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:S,onClick:V,children:m("confirm")})]})]}),p&&c.jsx("div",{className:"nc-set-note",children:p}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function qN({token:e,onClose:t,initialTab:n="nodes",initialLocation:s="",startNewCell:o=!1}){$n();const a=n==="diagnostics"?"diagnostics":"general",[u,h]=E.useState(n==="diagnostics"?"system":n),f=E.useRef(null),p=E.useRef(null),[v,b]=E.useState({start:!1,end:!1}),[w,S]=E.useState(a),[y,x]=E.useState(null),[C,R]=E.useState([]),[k,$]=E.useState(!1),[O,V]=E.useState(null),[Y,z]=E.useState(0),ne=Wh(e,!0,Y),H=E.useCallback(()=>{const I=f.current;if(!I)return;const A=I.scrollWidth>I.clientWidth+1,N={start:A&&I.scrollLeft>1,end:A&&I.scrollLeft+I.clientWidth<I.scrollWidth-1};b(M=>M.start===N.start&&M.end===N.end?M:N)},[]);E.useEffect(()=>{const I=f.current;if(!I)return;const A=typeof ResizeObserver=="function"?new ResizeObserver(H):null;return A==null||A.observe(I),window.addEventListener("resize",H),H(),()=>{A==null||A.disconnect(),window.removeEventListener("resize",H)}},[H]),E.useEffect(()=>{var A,N;(N=(A=p.current)==null?void 0:A.scrollIntoView)==null||N.call(A,{behavior:"smooth",block:"nearest",inline:"nearest"});const I=window.requestAnimationFrame?window.requestAnimationFrame(H):setTimeout(H,0);return()=>{window.cancelAnimationFrame?window.cancelAnimationFrame(I):clearTimeout(I)}},[u,H]);const X=E.useCallback(async()=>{try{const I=await H_(e);x(I),V(null)}catch(I){V(String(I.message||I))}try{const I=await h0(e);R(I.peers||[])}catch(I){V(String(I.message||I))}},[e]);return E.useEffect(()=>{X();const I=setInterval(X,5e3);return()=>clearInterval(I)},[X]),E.useEffect(()=>{let I=!1;return Vt("/api/config",e).then(A=>A.json()).then(A=>{I||$(!!A.readonlyDefault)}).catch(()=>{}),()=>{I=!0}},[e]),c.jsx("div",{className:"nc-set-overlay",onClick:t,children:c.jsxs("div",{className:"nc-set-panel",onClick:I=>I.stopPropagation(),children:[c.jsxs("div",{className:"nc-set-head",children:[c.jsx(it,{name:"gear",size:18}),c.jsx("b",{children:m("settings")}),c.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:m("close"),children:c.jsx(it,{name:"x",size:18})})]}),k&&c.jsx("div",{className:"nc-set-readonly",children:m("settings-readonly")}),O&&c.jsx("div",{className:"nc-err",children:O}),c.jsx("div",{className:`nc-set-tabs-wrap${v.start?" has-start-overflow":""}${v.end?" has-end-overflow":""}`,children:c.jsx("div",{className:"nc-set-tabs",ref:f,onScroll:H,children:["nodes","fleet","audio","input","system"].map(I=>c.jsx("button",{ref:u===I?p:null,type:"button",className:`nc-set-tabbtn${u===I?" on":""}`,onClick:()=>h(I),children:m(`tab-${I}`)},I))})}),c.jsxs("div",{className:"nc-set-body",children:[u==="nodes"&&c.jsx(zN,{token:e,nodes:C,roster:ne,settings:y,readonly:k,refresh:X,refreshAliases:()=>z(I=>I+1)}),u==="fleet"&&c.jsx(wN,{token:e,readonly:k,startNewCell:o,initialLocation:s,targets:ne.map(I=>({route:I.route,label:I.label||I.name,status:I.status}))}),u==="audio"&&c.jsx(HN,{token:e,readonly:k,nodes:C,settings:y}),u==="input"&&c.jsx(WN,{}),u==="system"&&c.jsx(KN,{token:e,settings:y,readonly:k,refresh:X,roster:ne,section:w,setSection:S})]})]})})}function VN({token:e,initialPair:t,deviceDefault:n="",localNodeId:s="",localNameDefault:o="",onPairDone:a,onDone:u}){$n();const[h,f]=E.useState(t?"pair":"welcome"),[p,v]=E.useState(!1),[b,w]=E.useState(null),S=async()=>{v(!0),w(null);try{await Ld(e,{wizardDone:!0}),a&&a(),u()}catch(y){w(String(y.message||y)),v(!1)}};return c.jsx("div",{className:"nc-wiz-overlay",children:c.jsxs("div",{className:"nc-wiz",children:[c.jsxs("div",{className:"nc-wiz-head",children:[c.jsx("b",{children:m("wizard-title")}),c.jsx("small",{children:m("hydra-simple")})]}),h==="welcome"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx("div",{className:"nc-wiz-done",children:m("local-ready")}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",disabled:p,onClick:S,children:m("local-only")}),c.jsx("button",{className:"nc-btn primary",disabled:p,onClick:()=>f("pair"),children:m("add-node")})]})]}),h==="pair"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx(Tw,{token:e,initial:t||"",autoStart:!!t,deviceDefault:n,localNodeId:s,localNameDefault:o,onBusyChange:v,onSuccess:async()=>{a&&a(),f("done")}}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{className:"nc-btn ghost",disabled:p,onClick:()=>{a&&a(),f("welcome")},children:m("back")})})]}),h==="done"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx("div",{className:"nc-wiz-done",children:m("node-connected")}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{className:"nc-btn primary",disabled:p,onClick:S,children:m("finish")})})]}),b&&c.jsx("div",{className:"nc-err",children:b})]})})}function YN(e,t){if(typeof EventSource>"u"||!e)return()=>{};const n=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return n.onmessage=s=>{try{const o=JSON.parse(s.data);o&&typeof o=="object"&&typeof o.type=="string"&&t(o)}catch{}},()=>{try{n.close()}catch{}}}const GN=6e3,XN=12e3;function JN({n:e,onClose:t}){return c.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[c.jsxs("div",{className:"nc-ntf-toast-txt",children:[c.jsx("b",{children:e.title}),e.body&&c.jsx("small",{children:e.body}),e.session&&c.jsx("span",{className:"nc-ntf-from",children:e.session})]}),c.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:m("close"),children:c.jsx(it,{name:"x",size:14})})]})}function QN({ask:e,token:t,onAnswered:n}){const[s,o]=E.useState(""),[a,u]=E.useState(!1),[h,f]=E.useState(null),p=async v=>{const b=String(v||"").trim();if(!(!b||a)){f(null),u(!0);try{await A0(t,e.id,b),n(e.id)}catch(w){f(String(w.message||w))}u(!1)}};return c.jsxs("div",{className:"nc-ask-card",children:[c.jsxs("div",{className:"nc-ask-head",children:[c.jsx("span",{className:"nc-ntf-from",children:e.session}),c.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),c.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&c.jsx("div",{className:"nc-ask-opts",children:e.options.map(v=>c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:a,onClick:()=>p(v),children:v},v))}),c.jsxs("div",{className:"nc-ask-reply",children:[c.jsx("textarea",{rows:2,placeholder:m("ask-reply-ph"),value:s,disabled:a,onChange:v=>o(v.target.value)}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:a||!s.trim(),onClick:()=>p(s),children:m("send")})]}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function ZN({token:e}){const[t]=$n(),[n]=Vw(),[s,o]=E.useState([]),[a,u]=E.useState([]),[h,f]=E.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),p=E.useRef(0),v=E.useRef(null);v.current||(v.current=IN());const b=E.useRef({enabled:n,lang:t});b.current={enabled:n,lang:t};const w=E.useCallback(x=>{o(C=>C.filter(R=>R.key!==x))},[]),S=E.useCallback(x=>{const C=`t${p.current+=1}`;o(k=>[...k.slice(-3),{...x,key:C}]),setTimeout(()=>w(C),x.urgency==="high"?XN:GN);const R=b.current;if(R.enabled)try{v.current.enqueue(x,LN(x,R.lang))}catch{}},[w]);E.useEffect(()=>{n||v.current.stop()},[n]),E.useEffect(()=>{const x=()=>{(document.visibilityState!=="visible"||!document.hasFocus())&&v.current.stop()},C=()=>v.current.stop();return document.addEventListener("visibilitychange",x),window.addEventListener("blur",x),window.addEventListener(Nh,C),()=>{document.removeEventListener("visibilitychange",x),window.removeEventListener("blur",x),window.removeEventListener(Nh,C),typeof v.current.dispose=="function"?v.current.dispose():v.current.stop()}},[]),E.useEffect(()=>{if(!e)return;let x=!1;M0(e).then(R=>{x||u(R.asks||[])}).catch(()=>{});const C=YN(e,R=>{R.type==="notify"?S(R):R.type==="ask"&&R.ask&&R.ask.id?u(k=>k.some($=>$.id===R.ask.id)?k:[...k,R.ask]):R.type==="ask-answered"&&R.id&&u(k=>k.filter($=>$.id!==R.id))});return()=>{x=!0,C()}},[e,S]);const y=x=>u(C=>C.filter(R=>R.id!==x));return c.jsxs(c.Fragment,{children:[s.length>0&&c.jsx("div",{className:"nc-ntf-toasts",children:s.map(x=>c.jsx(JN,{n:x,onClose:()=>w(x.key)},x.key))}),a.length>0&&!h&&c.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>f(!0),title:m("asks-title"),children:["? ",c.jsx("span",{className:"nc-ask-count",children:a.length})]}),a.length>0&&h&&c.jsxs("div",{className:"nc-ask-panel",children:[c.jsxs("div",{className:"nc-ask-panel-head",children:[c.jsx("b",{children:m("asks-title")}),c.jsx("span",{className:"nc-ask-count",children:a.length}),c.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>f(!1),title:m("close"),children:c.jsx(it,{name:"x",size:16})})]}),c.jsx("div",{className:"nc-ask-panel-body",children:a.map(x=>c.jsx(QN,{ask:x,token:e,onAnswered:y},x.id))})]})]})}const eR=4e3;async function tR(e){const t=await Vt("/api/sessions",e);if((t==null?void 0:t.ok)===!1)throw new Error(`HTTP ${t.status}`);const n=await t.json();if(!Array.isArray(n==null?void 0:n.sessions))throw new Error("invalid sessions payload");return n.sessions}async function Rd(e,t=[]){var h;const[n,s]=await Promise.allSettled([t.length?zh(e,t):tR(e),_s(e,t)]),o=n.status==="fulfilled"&&Array.isArray((h=n.value)==null?void 0:h.sessions)?n.value.sessions:Array.isArray(n.value)?n.value:null,a=s.status==="fulfilled"?s.value:null,u=(a==null?void 0:a.available)===!0&&Array.isArray(a.cells)?a.cells:null;return{sessions:o,cells:u,fresh:Array.isArray(o)&&Array.isArray(u)}}function Yw(e,t,n){return n===!0&&(e==null?void 0:e.degraded)!==!0&&(e==null?void 0:e.active)===!0&&e.tmux!==!1&&!!e.tmuxSession&&(t||[]).some(s=>(s==null?void 0:s.name)===e.tmuxSession)}function nR(e){const t=new Map((e.sessions||[]).map(o=>[o.name,o])),n=[],s=(o,a,u,h=[],f="")=>{const p=new Map((a||[]).map(v=>[v.name,v]));for(const v of o||[]){const b=p.get(v.tmuxSession)||{},w=qh(v,b),S=Yw(v,a,u);n.push({key:Bo(h,v.tmuxSession||v.cell),session:v.tmuxSession,route:h,cellName:v.cell,label:v.cell,node:h.length?h.join("/"):"",nodeLabel:f,live:S,selectable:S,verified:u===!0,working:w.working,degraded:!!v.degraded,activity:b.activity||v.activity||0,subtitle:w.subtitle})}};s(e.cells,[...t.values()],e.localFresh===!0);for(const o of e.nodeGroups||[])s(o.cells,o.sessions,o.switcherFresh===!0,Array.isArray(o.route)?o.route:[],o.label||o.name||"");return n}function iR(e){const t=new Map,n=Array.isArray(e.sessions)?e.sessions:[],s=Array.isArray(e.cells)?e.cells:[],o=new Map(n.map(u=>[u.name,u])),a=new Set(s.map(u=>u.tmuxSession).filter(Boolean));t.set("local",Vh(s,n.filter(u=>!a.has(u.name)),o));for(const u of e.nodeGroups||[]){const h=Array.isArray(u.route)?u.route:[];if(!h.length)continue;const f=Array.isArray(u.cells)?u.cells:[],p=Array.isArray(u.sessions)?u.sessions:[],v=new Set(f.map(b=>b.tmuxSession).filter(Boolean));t.set(h.join("/"),Pl({...u,route:h,cells:f,sessions:p,unmanaged:p.filter(b=>!v.has(b.name))}).rawItems)}return t}function sR(e,t,n,s){return[...new Set(e.map(a=>a.node||"local"))].flatMap(a=>{const u=e.filter(v=>(v.node||"local")===a),h=new Map((t.get(a)||[]).map(v=>[v.key,v])),f=new Map(u.map(v=>[v.key,v])),p=u.map(v=>{const b=h.get(v.key);return{...v,label:(b==null?void 0:b.label)||v.label,live:(b==null?void 0:b.live)??v.live,fresh:(b==null?void 0:b.fresh)===!0,activity:(b==null?void 0:b.activity)??v.activity}});return ps(p,n,"all",Ai(s,a)).map(v=>f.get(v.key))})}function rR({token:e,current:t,onPick:n,onClose:s}){const[o,a]=E.useState(Eg),[u,h]=E.useState(!1),[f,p]=E.useState(!1),[v,b]=E.useState(""),[w,S]=E.useState(""),[y,x]=E.useState(""),C=E.useRef(null),R=E.useRef(null),k=E.useMemo(()=>nR(o),[o]),$=E.useMemo(()=>iR(o),[o]),{pins:O,orders:V,canMoveRoster:Y,moveRoster:z,stepRoster:ne}=Kh(),H=E.useMemo(()=>sR(k,$,O,V),[k,$,O,V]),X=E.useMemo(()=>u?H:H.filter(L=>L.selectable||L.degraded),[H,u]),I=E.useMemo(()=>k.find(L=>L.key===w&&L.selectable),[k,w]);E.useEffect(()=>{var F;const L=document.activeElement;(F=R.current)==null||F.focus();const P=T=>{T.key==="Escape"&&s()};return document.addEventListener("keydown",P),()=>{var T;document.removeEventListener("keydown",P),(T=L==null?void 0:L.focus)==null||T.call(L)}},[s]),E.useEffect(()=>{let L=!0,P=!1;const F=async()=>{if(P)return;P=!0;const q=Eg(),B=Array.isArray(q.nodeGroups)?q.nodeGroups:[],D=Rd(e),U=await Promise.all(B.map(async J=>{const ee=Array.isArray(J.route)?J.route:[];return ee.length?{group:J,result:await Rd(e,ee)}:{group:J,result:{fresh:!1,sessions:null,cells:null}}})),Z=await D;if(!L)return;const oe=new Map(U.map(({group:J,result:ee})=>[JSON.stringify(J.route||[]),ee])),de=B.map(J=>{const ee=oe.get(JSON.stringify(J.route||[]));return ee?{...J,sessions:ee.sessions||J.sessions||[],cells:ee.cells||J.cells||[],switcherFresh:ee.fresh}:{...J,switcherFresh:!1}}),fe=ry({...q,sessions:Z.sessions||q.sessions||[],cells:Z.cells||q.cells||[],localFresh:Z.fresh,nodeGroups:de,refreshedAt:Date.now()});a(fe),p(!0),P=!1};F();const T=setInterval(F,eR);return()=>{L=!1,clearInterval(T)}},[e]);const A=L=>L.degraded?m("cell-degraded"):L.verified?L.selectable?L.working?m("cell-working"):m("cell-idle"):m("cell-off"):m("cell-switcher-not-confirmed"),N=L=>{if(b(""),!L.selectable){b(m("cell-switcher-not-active"));return}S(L.key)},M=async()=>{const L=I;if(!L){b(m("cell-switcher-select"));return}b(""),x(L.key);try{const P=await Rd(e,L.route),F=(P.cells||[]).find(T=>(T==null?void 0:T.cell)===L.cellName&&(T==null?void 0:T.tmuxSession)===L.session);if(!Yw(F,P.sessions,P.fresh)){b(m("cell-switcher-not-active"));return}n({session:L.session,...L.node?{node:L.node}:{},cellName:L.cellName}),s()}catch{b(m("cell-switcher-not-active"))}finally{x("")}};return c.jsx("div",{className:"nc-cell-switcher-backdrop",onClick:s,children:c.jsxs("aside",{ref:C,className:"nc-cell-switcher",role:"dialog","aria-label":m("fleet-cells"),tabIndex:-1,onClick:L=>L.stopPropagation(),children:[c.jsxs("div",{className:"nc-cell-switcher-list",children:[!f&&c.jsx("div",{className:"nc-empty",role:"status",children:m("cell-switcher-refreshing")}),f&&X.length===0&&c.jsx("div",{className:"nc-empty",role:"status",children:m("cell-switcher-empty-active")}),X.map(L=>{const P=(t==null?void 0:t.session)===L.session&&((t==null?void 0:t.node)||"")===L.node,F=w===L.key,T=A(L),q=L.node||"local",B=$.get(q)||k.filter(D=>(D.node||"local")===q);return c.jsxs("div",{className:`nc-cell-switcher-row${P?" current":""}${F?" selected":""}${L.selectable?"":" off"}`,"data-roster-key":L.key,"data-position":q,children:[c.jsx(Di,{position:q,itemKey:L.key,label:L.cellName,canMove:Y,onMove:(D,U)=>z(q,D,U,B),onStep:D=>ne(q,L.key,D,B)}),c.jsxs("button",{type:"button",className:"nc-cell-switcher-row-select","aria-current":P?"true":void 0,"aria-pressed":F,"aria-disabled":!L.selectable,disabled:y===L.key,onClick:()=>N(L),children:[c.jsx("span",{className:`nc-cell-switcher-dot${L.degraded?" warn":L.live?` on${L.working?" working":""}`:""}`}),c.jsxs("span",{className:"nc-cell-switcher-copy",children:[c.jsx("b",{children:L.cellName}),c.jsx("small",{className:"nc-cell-switcher-state",children:T}),c.jsx("small",{children:[L.nodeLabel,L.subtitle].filter(Boolean).join(" · ")})]})]})]},L.key)})]}),v&&c.jsx("div",{className:"nc-cell-switcher-notice",role:"status",children:v}),c.jsx("div",{className:"nc-cell-switcher-actions",children:c.jsx("button",{type:"button",className:"nc-cell-switcher-open",disabled:!I||!!y,onClick:M,children:I?`${m("cell-switcher-open")}: ${I.cellName}`:m("cell-switcher-select")})}),c.jsxs("div",{className:"nc-cell-switcher-controls",children:[c.jsx("b",{children:m("fleet-cells")}),c.jsx("button",{type:"button",className:"nc-cell-switcher-filter","aria-pressed":u,onClick:()=>{b(""),h(L=>!L)},children:m(u?"cell-switcher-show-active":"cell-switcher-show-all")}),c.jsx("button",{ref:R,type:"button",className:"nc-cell-switcher-close","aria-label":m("cell-switcher-close"),title:m("cell-switcher-close"),onClick:s,children:"×"})]})]})})}const jd=e=>wi($s(e)).length===0,Pd=e=>Array.isArray(e)?e.join("/"):"";function oR(e){const t=new Set,n=[];for(const s of Array.isArray(e)?e:[])!s||!zn.test(String(s.instanceId||""))||!Array.isArray(s.route)||!s.route.length||t.has(s.instanceId)||(t.add(s.instanceId),n.push({instanceId:s.instanceId,route:[...s.route],label:String(s.label||s.name||s.route.join(" › ")),status:s.status||"offline"}));return n.sort((s,o)=>s.label.localeCompare(o.label))}function Ro(e){return{instanceId:e.ownerId,route:e.ownerRoute||[],label:e.ownerLabel,status:e.available===!1?"offline":"up"}}function As(e,t,n,s=!1,o=!0){const a=t.instanceId;return{...e,id:Cr(s?null:a,e.name),ownerId:a,ownerRoute:s?[]:[...t.route],ownerLabel:s?"Local":t.label,local:s,available:o,ownerTopology:Array.isArray(n)?n:[],layout:xh(e.layout,a,n)}}function aR(e,t,n,s,o=[]){const[a,u]=E.useState([]),[h,f]=E.useState(!1),[p,v]=E.useState("idle"),[b,w]=E.useState(""),[S,y]=E.useState(""),x=E.useRef([]),C=E.useRef([]),R=E.useRef(""),k=E.useRef(t),$=E.useRef(n),O=E.useRef(!1),V=E.useRef(!0),Y=E.useRef(""),z=E.useMemo(()=>oR(o),[o]),ne=z.map(B=>`${B.instanceId}:${Pd(B.route)}:${B.status}:${B.label}`).join("|");C.current=z,$.current=n,k.current=t,x.current=a;const H=E.useCallback(B=>kh(B.layout,R.current,C.current),[]),X=E.useCallback((B,D=!0,U=k.current)=>{const Z=Ov(B,hl()),oe=x.current.some(fe=>fe.id===U);x.current=Z,u(Z);const de=Z.find(fe=>fe.id===U);if(D&&de){V.current=!0;const fe=H(de);s(fe),de.local&&VE(de.name,fe)}else oe&&!de&&(V.current=!0,s(kr()),w("deck non più condiviso dal nodo owner"));WE(Z.filter(fe=>fe.local).map(fe=>fe.name))},[s,H]),I=E.useCallback(async B=>{let D=await il(e);const U=D.decks.find(Z=>Z.name==="main");if(D.decks.length===1&&U&&U.revision===0&&jd(U.layout)){const Z=HE(),oe=$s(Ch("main")||kr());if(!jd(oe)){const de=xh(oe,B,[]);D.decks[0]=await sl(e,"main",de,0,[])}for(const de of Z.filter(fe=>fe!=="main"))try{let fe=await hg(e,de,[]);const J=$s(Ch(de)||kr());jd(J)||(fe=await sl(e,de,xh(J,B,[]),fe.revision,[]))}catch{}D=await il(e)}return D},[e]),A=E.useCallback(async({migrate:B=!1}={})=>{const D=await Fh(e,[]),U=zn.test(String(D.instanceId||""))?D.instanceId:"";if(!U)throw new Error("instanceId locale non disponibile");R.current=U,y(U);const[Z,oe]=await Promise.all([B?I(U):il(e),ag(e,[]).catch(()=>({nodes:[]}))]),de={instanceId:U,route:[],label:"Local"},fe=Z.decks.map(ee=>As(ee,de,oe.nodes,!0,!0)),J=x.current;return await Promise.all(C.current.map(async ee=>{if(ee.status!=="up"){fe.push(...J.filter(pe=>!pe.local&&pe.ownerId===ee.instanceId).map(pe=>({...pe,ownerRoute:[...ee.route],ownerLabel:ee.label,available:!1})));return}try{const[pe,Se]=await Promise.all([il(e,ee.route),ag(e,ee.route).catch(()=>({nodes:[]}))]);fe.push(...pe.decks.map(Ze=>As(Ze,ee,Se.nodes,!1,!0)))}catch{fe.push(...J.filter(Se=>!Se.local&&Se.ownerId===ee.instanceId).map(Se=>({...Se,ownerRoute:[...ee.route],ownerLabel:ee.label,available:!1})))}})),fe.sort((ee,pe)=>ee.local===pe.local?ee.ownerLabel.localeCompare(pe.ownerLabel)||(ee.name==="main"?-1:pe.name==="main"?1:ee.name.localeCompare(pe.name)):ee.local?-1:1),fe},[e,I,ne]);E.useEffect(()=>{if(!e)return;let B=!1;const D=Y.current!==e;return Y.current=e,A({migrate:D}).then(U=>{if(B)return;const Z=x.current.find(fe=>fe.id===k.current),oe=U.find(fe=>fe.id===k.current),de=oe&&(!Z||oe.revision>Z.revision||Z.available!==oe.available||Pd(Z.ownerRoute)!==Pd(oe.ownerRoute));X(U,D||!!de&&!O.current),f(!0),oe&&w("")}).catch(U=>{B||(f(!0),w(String(U.message||U)))}),()=>{B=!0}},[X,A,ne,e]);const N=E.useCallback(async(B=k.current)=>{if(!h||!O.current)return!0;const D=x.current.find(U=>U.id===B);if(!D)return w(`deck inesistente: ${B}`),!1;if(D.available===!1)return w(`nodo owner offline: ${D.ownerLabel}`),!1;v("saving");try{const U=Iv($s($.current),D.ownerId,D.ownerTopology),Z=await sl(e,D.name,U,D.revision,D.ownerRoute),oe=As(Z,Ro(D),D.ownerTopology,D.local,!0);return X(x.current.map(de=>de.id===B?oe:de),!1),O.current=!1,v("saved"),w(""),setTimeout(()=>v("idle"),1500),!0}catch(U){if(v("error"),w(String(U.message||U)),U.status===409&&U.data&&U.data.current){const Z=x.current.find(de=>de.id===B),oe=As(U.data.current,Ro(Z),Z.ownerTopology,Z.local,!0);X(x.current.map(de=>de.id===B?oe:de),!1)}return!1}},[h,e,X]);return E.useEffect(()=>{if(!h)return;if(V.current){V.current=!1;return}O.current=!0,v("saving");const B=setTimeout(N,650);return()=>clearTimeout(B)},[n,h,N]),E.useEffect(()=>{if(!h)return;const B=setInterval(async()=>{try{const D=await A(),U=x.current.find(de=>de.id===k.current),Z=D.find(de=>de.id===k.current),oe=Z&&(!U||Z.revision>U.revision||U.available!==Z.available);X(D,oe&&!O.current)}catch{}},5e3);return()=>clearInterval(B)},[h,A,X]),{decks:a,records:a,localNodeId:S,ready:h,saveState:p,error:b,setError:w,saveNow:N,select:async B=>{if(O.current&&!await N(k.current))throw new Error("salvataggio del deck corrente fallito: cambio annullato");const D=x.current.find(U=>U.id===B);if(!D)throw new Error(`deck inesistente: ${B}`);return O.current=!1,V.current=!0,H(D)},add:async(B,D=null)=>{const U=D===_i?x.current.find(de=>de.local):D?x.current.find(de=>de.ownerId===D):null;if(!U||U.available===!1)throw new Error("nodo owner non disponibile");const Z=await hg(e,B,U.ownerRoute),oe=As(Z,Ro(U),U.ownerTopology,U.local,!0);return X([...x.current,oe],!1),oe},rename:async(B,D)=>{const U=x.current.find(J=>J.id===B);if(!U)throw new Error("deck inesistente");if(B===k.current&&O.current&&!await N(B))throw new Error(`salvataggio di "${U.name}" fallito: rinomina annullata`);const Z=x.current.find(J=>J.id===B);if(!Z)throw new Error("deck inesistente");const oe=await I0(e,Z.name,D,Z.revision,Z.ownerRoute),de=As(oe,Ro(Z),Z.ownerTopology,Z.local,!0),fe=Z.local?_i:Z.ownerId;return nd(KE(hl(),fe,B,de.id)),X(x.current.map(J=>J.id===B?de:J),!1),de},remove:async B=>{const D=x.current.find(Z=>Z.id===B);if(!D)throw new Error("deck inesistente");B===k.current&&(O.current=!1),await B0(e,D.name,D.revision,D.ownerRoute);const U=D.local?_i:D.ownerId;nd(qE(hl(),U,B)),X(x.current.filter(Z=>Z.id!==B),!1)},reorder:(B,D)=>{const U=x.current.find(ee=>ee.id===B),Z=x.current.find(ee=>ee.id===D);if(!U||!Z)return!1;const oe=U.local?_i:U.ownerId,de=Z.local?_i:Z.ownerId;if(oe!==de)return!1;const fe=x.current.filter(ee=>(ee.local?_i:ee.ownerId)===oe).map(ee=>ee.id),J=nd(UE(hl(),oe,B,D,fe));return X(Ov(x.current,J),!1),!0},addTileTo:async(B,D)=>{const U=x.current.find(ee=>ee.id===B);if(!U)throw new Error("deck inesistente");if(U.available===!1)throw new Error(`nodo owner offline: ${U.ownerLabel}`);const Z=pw(D,R.current,C.current);if(!Z)throw new Error("riferimento sessione non valido");const oe=H(U),de=Iv(ny(oe,Z),U.ownerId,U.ownerTopology),fe=await sl(e,U.name,de,U.revision,U.ownerRoute),J=As(fe,Ro(U),U.ownerTopology,U.local,!0);return X(x.current.map(ee=>ee.id===B?J:ee),!1),J},localMainId:Cr(null,"main"),parseDeckId:Yl}}const lR="/sw.js",jh="nc-sw-update";let Ph=null,Lh=!1,Th=null,Gw=Object.freeze({needed:!1,kind:null,version:""}),Xw=!1;function Jw(){typeof window<"u"&&window.dispatchEvent(new Event(jh))}function Qw(){const e=Th||(Lh?{kind:"reload",version:""}:null);Gw=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function j_(){return Gw}function cR(e){return typeof window>"u"?()=>{}:(window.addEventListener(jh,e),()=>window.removeEventListener(jh,e))}function Cf(e){Lh!==e&&(Lh=e,Qw(),Jw())}function uR(e,t,n){let s=null;e&&t&&e!==t?s={kind:"install",version:e}:t&&n&&t!==n&&(s={kind:"reload",version:t});const o=JSON.stringify(s)===JSON.stringify(Th);Th=s,Qw(),o||Jw()}function dR(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Cf(!0)})}function hR(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Xw&&location.reload()}),navigator.serviceWorker.register(lR).then(e=>{Ph=e,e.waiting&&Cf(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&dR(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function fR(){Xw=!0,Cf(!1);const e=Ph&&Ph.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function pR({hash:e="",origin:t="",pathname:n="",search:s=""}={}){const o=String(e||"").replace(/^#/,""),a=`${n||""}${s||""}`;if(!o)return{token:"",pair:"",nextUrl:a};const u=new URLSearchParams(o),h=u.get("token")||"",f=u.get("pair")||"",p=f?`${t||""}${n||""}#pair=${f}`:"";return{token:h,pair:p,nextUrl:a}}const Zw=9,eS=24,tS="nc_side_w",P_="nc_side_min",mR=240,L_="(min-width:1024px) and (pointer:fine)";function gR(){const e=Number(localStorage.getItem(tS));return e>=180&&e<=480?e:mR}function vR(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Zw&&e<=eS?e:13}function _R(){const e={token:"",pair:""};try{const{token:t,pair:n,nextUrl:s}=pR({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(n){e.pair=n;try{sessionStorage.setItem("nc_pair",n)}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 yR(e){try{return $s(Ch(e))}catch{return kr()}}function T_(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 wR(){const[e,t]=E.useState(()=>window.matchMedia(L_).matches);return E.useEffect(()=>{const n=window.matchMedia(L_),s=o=>t(o.matches);return n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[]),e}function D_({session:e,node:t,ownerId:n,cellName:s,token:o,readonly:a=!1,onBack:u,onCellSwitcher:h,cellSwitcherOpen:f=!1}){$n();const[p]=uf(),[v,b]=E.useState(!1),[w,S]=E.useState(()=>window.matchMedia("(pointer: coarse)").matches),[y,x]=E.useState(null),[C,R]=E.useState(vR),[k,$]=E.useState(s||e),[O,V]=E.useState(""),Y=P=>R(F=>{const T=Math.max(Zw,Math.min(eS,F+P));return localStorage.setItem("nc_fontsize",String(T)),T}),z=E.useRef(()=>{}),ne=E.useRef(()=>!1),H=E.useRef(()=>{}),X=E.useRef(!1),[I,A]=E.useState(!1),[N,M]=E.useState(!1),L=()=>{X.current=!X.current,A(X.current)};return E.useEffect(()=>{$(s||e)},[s,e]),E.useEffect(()=>{let P=!0;const F=t?t.split("/"):[],T=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function q(){let D=null,U=null;try{const de=await(await Vt(`${T}/sessions`,o)).json();Array.isArray(de.sessions)&&(D=de.sessions.find(fe=>fe.name===e))}catch{}try{const oe=await _s(o,F);oe.available&&Array.isArray(oe.cells)&&(U=oe.cells.find(de=>de.tmuxSession===e))}catch{}if(!P)return;$(df({session:e,cell:U||(s?{cell:s}:null)}));let Z="";U?Z=`${U.engine}${U.key?`·${U.key}`:""}`:D&&(Z=D.attached?`attached · ${T_(D.activity)}`:D.activity?T_(D.activity):""),V(Z)}q();const B=setInterval(q,4e3);return()=>{P=!1,clearInterval(B)}},[e,t,o]),c.jsxs("div",{className:"nc-app",children:[c.jsxs("header",{className:"nc-bar nc-bar-single",children:[c.jsxs("button",{onClick:u,title:m("sessions"),children:[c.jsx(it,{name:"chevronLeft",size:18}),c.jsx("span",{className:"nc-bar-label",children:m("sessions")})]}),c.jsxs("span",{className:"nc-bar-center",children:[c.jsx("b",{title:t?`${k} · ${t}`:k,children:k}),O&&c.jsx("small",{className:"nc-bar-sub",children:O})]}),c.jsxs("span",{className:"nc-bar-right",children:[c.jsx("button",{onClick:()=>Y(-1),title:m("zoom-out"),children:c.jsx(it,{name:"zoomOut",size:18})}),c.jsx("button",{onClick:()=>Y(1),title:m("zoom-in"),children:c.jsx(it,{name:"zoomIn",size:18})}),c.jsx("button",{onClick:()=>S(P=>!P),title:m("composer"),children:c.jsx(it,{name:"keyboard",size:20})}),c.jsx("button",{onClick:()=>b(P=>!P),title:m("files"),children:c.jsx(it,{name:"folder",size:20})})]})]}),c.jsx("div",{className:"nc-termwrap",children:c.jsx(Zy,{session:e,node:t,token:o,readonly:a,takeSize:!0,sendRef:z,composerRef:ne,actionRef:H,ctrlRef:X,setCtrlArmed:A,onFiles:x,fontSize:C,selectionMode:N,onSelectionModeChange:M,keyboardGesture:p.terminalKeyboardGesture})}),c.jsx(hE,{onKeyboard:()=>S(P=>!P),onCellSwitcher:h,cellSwitcherOpen:f,send:P=>z.current(P),action:P=>H.current(P),ctrlArmed:I,onCtrl:L,selectionMode:N,onSelectionMode:M,keepKeyboardClosed:p.keybarKeepsKeyboardClosed,showEnter:p.showKeybarEnter,keybarLayout:p.keybarLayout}),w&&c.jsx(cw,{submitText:P=>ne.current(P),token:o,session:e,node:t,ownerId:n,keepKeyboardClosedOnVoice:p.voiceKeepsKeyboardClosed}),v&&c.jsx(ew,{session:e,node:t,token:o,filesEvent:y,onClose:()=>b(!1)})]})}function SR(){$n();const[e]=E.useState(_R),[t,n]=E.useState(e.token),[s,o]=E.useState(e.pair||""),a=E.useCallback(()=>{o("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[u,h]=E.useState(!1),f=wR(),[p]=E.useState(()=>$E(typeof location<"u"?location.pathname:"/")),[v,b]=E.useState(p.id),w=v===Cr(null,Fn),[S,y]=E.useState(null),x=he=>{const Ne=vs(he);y(Ne?{...Ne,...typeof(he==null?void 0:he.cellName)=="string"&&he.cellName?{cellName:he.cellName}:{}}:null)},[C,R]=E.useState([]),[k,$]=E.useState([]),[O,V]=E.useState([]),[Y,z]=E.useState(()=>p.ownerId?kr():yR(p.name)),[ne,H]=E.useState(null),[X,I]=E.useState(null),A=he=>I(vs(he)),N=Wh(t,f),M=E.useMemo(()=>(N||[]).filter(he=>he.instanceId).map(he=>({instanceId:he.instanceId,route:he.route,label:he.label,status:he.status})),[N]),L=aR(t,v,Y,z,M),P=L.decks;E.useEffect(()=>{const he=new Map;for(const Ne of N||[]){const Ke=(Ne.route||[Ne.name]).join("/"),Nt=new Set((Ne.sessions||[]).map(pt=>pt.name));for(const pt of Ne.cells||[])!pt.cell||!pt.tmuxSession||pt.cell===pt.tmuxSession||Nt.has(pt.cell)||he.set(`${Ke}:${pt.cell}`,`${Ke}:${pt.tmuxSession}`)}z(Ne=>d1(Ne,he))},[N]),E.useEffect(()=>{L.localNodeId&&z(he=>{const Ne=kh(he,L.localNodeId,M);return JSON.stringify(Ne)===JSON.stringify(he)?he:Ne})},[M,L.localNodeId]);const[F,T]=E.useState(null),[q,B]=E.useState(null),D=E.useRef(0),[U,Z]=E.useState(!1),[oe,de]=E.useState(gR),[fe,J]=E.useState(!w),[ee,pe]=E.useState(()=>w?localStorage.getItem(P_)==="1":!0),[Se,Ze]=E.useState(!1),[$e,He]=E.useState("nodes"),[vt,Xe]=E.useState(!1),[St,Et]=E.useState(""),[rt,ct]=E.useState(!1),ot=(he="nodes",Ne=!1,Ke="")=>{He(he),Xe(Ne),Et(Ke),Ze(!0)},[ut,dt]=E.useState(!1),[le,xe]=E.useState({deviceDefault:"",localNodeId:"",localNameDefault:""}),[ze,Ie]=E.useState(!1);E.useEffect(()=>{try{localStorage.setItem(tS,String(oe))}catch{}},[oe]),E.useEffect(()=>{try{localStorage.setItem(P_,ee?"1":"")}catch{}},[ee]),E.useEffect(()=>{if(!t)return;let he=!1;return Promise.all([H_(t),Vt("/api/config",t).then(Ne=>Ne.json())]).then(([Ne,Ke])=>{he||(xe({deviceDefault:Ne.deviceName||"",localNodeId:Ne.nodeId||"",localNameDefault:Ne.localName||""}),Ie(!!Ke.readonlyDefault),(Ne.firstRun===!0&&!Ke.readonlyDefault||s)&&dt(!0))}).catch(()=>{}),()=>{he=!0}},[t,s]);const ue=E.useCallback(async()=>{try{const Ne=await(await Vt("/api/sessions",t)).json();Ne.error||R(Ne.sessions||[])}catch{}try{const he=await _s(t);$(he.available?he.cells||[]:[]),V(he.available?he.capabilities||[]:[])}catch{$([]),V([])}},[t]);E.useEffect(()=>{if(!f)return;ue();const he=setInterval(ue,4e3);return()=>clearInterval(he)},[f,ue]),E.useEffect(()=>{let he=!1;return Vt("/api/config",t).then(Ne=>Ne.json()).then(Ne=>{he||uR(Ne.version,Ne.uiVersion,"0.8.44")}).catch(()=>{}),()=>{he=!0}},[t]);const G=new Set([...C.map(he=>he.name),...N.flatMap(he=>he.sessions.map(Ne=>Ne.key))]),ie=wi(Y),W=he=>z(Ne=>{const Ke=pw(he,L.localNodeId,M)||he,Nt=ny(Ne,Ke);return Nt===Ne&&wi(Ne).length>=9&&L.setError(m("grid-full")),Nt}),se=async(he,Ne=[])=>{try{await Bh(t,he,Ne)}catch{return}const Ke=Ne.length?`${Ne.join("/")}:${he}`:he;z(Nt=>Tl(Nt,Ke)),ue()},ve=async(he,Ne,Ke=[])=>{try{await $_(t,he,Ne,Ke)}catch{return}ue()},ke=async(he,Ne,Ke=[])=>{await O_(t,{cell:he,enabled:!!Ne},Ke),ue()},Re=async he=>{if(!F)return;const{cell:Ne}=F,Ke=Array.isArray(F.route)?F.route:[];he.action==="up"?await Ah(t,{cell:Ne,boot:!!he.boot,...he.engine?{engine:he.engine}:{},...he.model!==void 0?{model:he.model}:{},...he.permissionPolicy?{permissionPolicy:he.permissionPolicy}:{}},Ke):await Cl(t,{cell:Ne,boot:!!he.boot},Ke);const Nt=he.action==="up"?!!he.boot:he.boot?!1:!!F.boot;B({id:++D.current,cell:Ne,route:Ke,enabled:Nt}),ue()},we=E.useCallback(he=>{B(Ne=>(Ne==null?void 0:Ne.id)===he?null:Ne)},[]),je=async he=>{if(!(!(he!=null&&he.direct)||U)){Z(!0);try{await $h(t,he.name,he.tunnelStatus==="up"?"down":"up")}finally{Z(!1)}}},st=async(he,Ne)=>{const Ke=String(Ne||"").trim();return!(he!=null&&he.direct)||!jr(Ke)?!1:(await W_(t,he.name,Ke),!0)},It=he=>{const Ne=P.find(Ke=>Ke.id===he);if(!Ne)return!1;try{const Ke=window.open(td(Ne,t),"_blank");return Ke&&(Ke.opener=null),!!Ke}catch{return!1}},Oe=async he=>{if(!he||he===v)return;const Ne=await L.select(he),Ke=L.records.find(Nt=>Nt.id===he);b(he),z(Ne),H(null),I(null);try{history.replaceState(null,"",td(Ke||he,null))}catch{}},_n=async(he,Ne)=>{const Ke=await L.add(he,Ne);await Oe(Ke.id)},bt=async(he,Ne)=>{const Ke=await L.rename(he,Ne);if(he===v){b(Ke.id),z(kh(Ke.layout,L.localNodeId,M)),H(null),I(null);try{history.replaceState(null,"",td(Ke,null))}catch{}}},Ye=async he=>{await L.remove(he),he===v&&await Oe(L.localMainId)},Gt=async(he,Ne)=>{!Ne||Ne===v||(await L.addTileTo(Ne,he),z(Ke=>Tl(Ke,he)))};if(!t)return c.jsxs("div",{className:"nc-auth",children:[c.jsx("p",{children:m("auth-prompt")}),c.jsx("input",{onChange:he=>n(he.target.value.trim()),placeholder:"token"}),c.jsxs("label",{children:[c.jsx("input",{type:"checkbox",checked:u,onChange:he=>h(he.target.checked)})," ",m("remember-device")]}),c.jsx("button",{onClick:()=>{(u?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const Hn=c.jsxs(c.Fragment,{children:[Se&&c.jsx(qN,{token:t,initialTab:$e,initialLocation:St,startNewCell:vt,onClose:()=>{Ze(!1),Xe(!1),Et("")}}),ut&&c.jsx(VN,{token:t,initialPair:s,...le,onPairDone:a,onDone:()=>dt(!1)}),c.jsx(ZN,{token:t})]});if(!f)return S?c.jsxs(c.Fragment,{children:[c.jsx(D_,{session:S.session,node:S.node,ownerId:S.ownerId,cellName:S.cellName,token:t,readonly:ze,onBack:()=>y(null),onCellSwitcher:()=>ct(!0),cellSwitcherOpen:rt}),rt&&c.jsx(rR,{token:t,current:S,onPick:he=>{x(he),ct(!1)},onClose:()=>ct(!1)}),Hn]}):c.jsxs(c.Fragment,{children:[c.jsx(E1,{onPick:x,token:t,onSettings:ot}),Hn]});const li=w||!fe;return c.jsxs("div",{className:"nc-workspace",children:[li&&c.jsx(jE,{sessions:C,cells:k,activeSessions:ie,nodeGroups:N,fleetCapabilities:O,bootSettlement:q,onBootSettlementApplied:we,localNodeId:L.localNodeId,onPick:A,onAddTile:W,onPower:T,onBoot:ke,onBootError:he=>L.setError(String((he==null?void 0:he.message)||he)),onNodePower:je,onNodeRename:st,onKill:se,onVisibility:ve,onNew:()=>ot("fleet",!0),onSettings:ot,width:oe,collapsed:ee,onResize:de,onToggleCollapse:()=>pe(he=>!he)}),c.jsxs("div",{className:"nc-workspace-main",children:[c.jsx(u2,{decks:P,currentDeck:v,onCreate:_n,onRename:bt,onDelete:Ye,onReorder:L.reorder,onOpenWindow:It,onNavigate:Oe,saveState:L.saveState,error:L.error,sidebarVisible:li,onToggleSidebar:w?null:()=>J(he=>!he)}),c.jsx(IE,{layout:Y,onLayoutChange:z,token:t,readonly:ze,sessionsAlive:G,focusSession:ne,onFocus:H,onOpenSingle:A,decks:P,currentDeck:v,onSendToDeck:Gt,cells:k,nodeGroups:N})]}),X&&c.jsx("div",{className:"nc-single-overlay",children:c.jsx(D_,{session:X.session,node:X.node,ownerId:X.ownerId,cellName:df({session:X.session,node:X.node,ownerId:X.ownerId,cells:k,nodeGroups:N}),token:t,readonly:ze,onBack:()=>I(null)})}),F&&c.jsx(Nl,{cell:F,token:t,route:Array.isArray(F.route)?F.route:[],onConfirm:Re,onClose:()=>T(null)}),Hn]})}function bR(){$n();const e=E.useSyncExternalStore(cR,j_,j_);if(!e.needed)return null;const t=e.kind==="install"?m("install-version-mismatch").replace("{v}",e.version):m("update-available").replace("{v}",e.version).replace(" "," ").trim();return c.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[c.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&c.jsx("button",{className:"nc-update-btn",onClick:fR,children:m("reload")})]})}hR();t0.createRoot(document.getElementById("root")).render(c.jsxs(Yb.StrictMode,{children:[c.jsx(SR,{}),c.jsx(bR,{})]}));
93
+ `],{type:"application/json"}),P=URL.createObjectURL(L),F=document.createElement("a");F.href=P,F.download="nexuscrew-diagnostics.json",F.click(),URL.revokeObjectURL(P)}catch{w(m("diagnostics-export-failed"))}};return c.jsxs("div",{className:"nc-set-tab nc-diagnostics",children:[c.jsxs("label",{className:"nc-field",children:[m("diagnostics-target"),c.jsx("select",{value:u.key,onChange:L=>a(L.target.value),children:s.map(L=>c.jsxs("option",{value:L.key,children:[L.label,L.status!=="up"?` · ${L.status}`:""]},L.key))})]}),c.jsxs("div",{className:"nc-set-form nc-diag-controls",children:[c.jsx("div",{className:"nc-sheet-label",children:m("diagnostics-verbose")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("select",{"aria-label":m("diagnostics-duration"),value:R,onChange:L=>k(Number(L.target.value)),disabled:n,children:[300,900,1800,3600].map(L=>c.jsxs("option",{value:L,children:[L/60," min"]},L))}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||(h==null?void 0:h.verbose)===!0,onClick:()=>A(()=>dg(e,!0,R,u.route)),children:m("enable")}),c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||(h==null?void 0:h.verbose)!==!0,onClick:()=>A(()=>dg(e,!1,R,u.route)),children:m("stop")})]}),c.jsx("small",{className:"nc-set-hint",children:h!=null&&h.verbose?m("diagnostics-expires").replace("{time}",new Date(h.expiresAt).toLocaleTimeString()):m("diagnostics-off")})]}),c.jsxs("div",{className:"nc-diag-filters",children:[c.jsxs("select",{"aria-label":m("diagnostics-level"),value:$,onChange:L=>O(L.target.value),children:[c.jsx("option",{value:"all",children:m("diagnostics-all-levels")}),["debug","info","warn","error"].map(L=>c.jsx("option",{value:L,children:L},L))]}),c.jsx("input",{"aria-label":m("diagnostics-component"),placeholder:m("diagnostics-component"),value:V,onChange:L=>Y(L.target.value)})]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:S,onChange:L=>y(L.target.checked)})," ",m("diagnostics-pause")]}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:x,onChange:L=>C(L.target.checked)})," ",m("diagnostics-autoscroll")]})]}),c.jsx("pre",{ref:ne,className:"nc-diag-log","aria-label":m("diagnostics-log"),children:I||m("diagnostics-empty")}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:N,children:m("copy")}),c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:M,children:m("diagnostics-export")}),c.jsx("button",{type:"button",className:"nc-btn danger",disabled:n,onClick:()=>{window.confirm(m("diagnostics-clear-confirm"))&&A(async()=>{const L=await D0(e,u.route);return z.current=0,v([]),L})},children:m("diagnostics-clear")})]}),b&&c.jsx("div",{className:"nc-err",children:b})]})}function KN({token:e,settings:t,readonly:n,refresh:s,roster:o,section:a,setSection:u}){const[h,f]=E.useState(null),[p,v]=E.useState(null),[b,w]=E.useState(!1),[S,y]=E.useState(!1),[x,C]=E.useState(null),[R,k]=E.useState(!0),[$,O]=E.useState(!1);E.useEffect(()=>{C(t&&t.update||null),k(!t||t.autoUpdate!==!1),O(!!(t&&t.alternateScreen))},[t]);const V=async()=>{f(null),v(null),y(!0);try{const N=await p0(e);v(N.note||"ok"),w(!1)}catch(N){f(String(N.message||N))}y(!1)},Y=async()=>{f(null),v(null),y(!0);try{const N=await R0(e);v(`${N.note||"ok"}${N.target?` (${N.target})`:""}`)}catch(N){f(String(N.message||N))}y(!1)},z=async N=>{f(null),v(null),y(!0);try{await Ld(e,{autoUpdate:N}),k(N),s&&await s()}catch(M){f(String(M.message||M))}y(!1)},ne=async N=>{f(null),v(null),y(!0);try{await Ld(e,{alternateScreen:N}),O(N),s&&await s()}catch(M){f(String(M.message||M))}y(!1)},H=async()=>{f(null),v(null),y(!0);try{C(await j0(e))}catch(N){f(String(N.message||N))}y(!1)},X=async()=>{f(null),v(null),y(!0);try{const N=await P0(e);C(N),v(m("npm-update-restarting"))}catch(N){f(String(N.message||N))}y(!1)},I=()=>{window.confirm(m("composer-clear-confirm"))&&(f(null),xE()?(window.dispatchEvent(new Event(Sh)),v(m("composer-clear-done"))):f(m("composer-clear-failed")))},A=t&&t.service;return c.jsxs("div",{className:"nc-set-tab",children:[c.jsx("div",{className:"nc-system-tabs",role:"tablist","aria-label":m("tab-system"),children:["general","diagnostics"].map(N=>c.jsx("button",{type:"button",role:"tab","aria-selected":a===N,className:`nc-set-tabbtn${a===N?" on":""}`,onClick:()=>u(N),children:m(`system-${N}`)},N))}),a==="general"&&c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-this-node")}),t&&c.jsxs("div",{className:"nc-set-info",children:["v",t.version," · ",t.platform," · :",t.port,c.jsx("br",{}),A&&A.installed?m("service-installed"):m("service-missing"),A&&A.installed?` · ${A.active?m("service-active"):m("service-inactive")}`:"",A?` · boot ${A.boot?"on":"off"}`:""]}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S,title:n?m("settings-readonly"):"",onClick:Y,children:m("service-regenerate")})}),c.jsx(FN,{token:e,readonly:n}),c.jsx($N,{})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-updates")}),c.jsxs("div",{className:"nc-set-form nc-update-settings",children:[c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox",checked:R,disabled:n||S||x&&!x.supported,onChange:N=>z(N.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("npm-auto-update")}),c.jsx("small",{children:m("npm-auto-update-help")})]})]}),x&&c.jsxs("div",{className:"nc-set-info",children:[m("npm-update-current")," v",x.current,x.latest?` · ${m("npm-update-latest")} v${x.latest}`:""," · ",m(`npm-update-${x.supported?x.phase:"unsupported"}`)]}),c.jsxs("div",{className:"nc-set-row",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S||!x||!x.supported,onClick:H,children:m("npm-update-check")}),x&&x.available&&c.jsx("button",{type:"button",className:"nc-btn primary",disabled:n||S||x.phase==="installing",onClick:X,children:m("npm-update-install")})]}),x&&x.lastError&&c.jsx("div",{className:"nc-err",children:x.lastError})]})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-security")}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:n||S,title:n?m("settings-readonly"):"",onClick:()=>{f(null),v(null),w(!0)},children:m("token-rotate")})})]}),c.jsxs("section",{className:"nc-system-group",children:[c.jsx("h3",{children:m("system-local-data")}),c.jsxs("div",{className:"nc-set-form",children:[c.jsx("div",{className:"nc-sheet-label",children:m("composer-clear-data")}),c.jsx("small",{className:"nc-set-hint",children:m("composer-clear-data-help")}),c.jsx("div",{className:"nc-set-row",children:c.jsx("button",{type:"button",className:"nc-btn ghost",onClick:I,children:m("composer-clear-data")})})]})]})]}),a==="diagnostics"&&c.jsxs("section",{className:"nc-system-group nc-system-diagnostics",children:[c.jsx("h3",{children:m("system-diagnostics")}),c.jsxs("div",{className:"nc-set-form nc-alternate-screen-settings",children:[c.jsx("div",{className:"nc-sheet-label",children:m("system-terminal")}),c.jsxs("label",{className:"nc-check",children:[c.jsx("input",{type:"checkbox","aria-label":m("alternate-screen"),checked:$,disabled:n||S,onChange:N=>ne(N.target.checked)}),c.jsxs("span",{children:[c.jsx("b",{children:m("alternate-screen")}),c.jsx("small",{children:m("alternate-screen-help")})]})]})]}),c.jsx(UN,{token:e,roster:o,readonly:n})]}),b&&c.jsxs("div",{className:"nc-set-confirm",children:[c.jsx("div",{children:m("token-rotate-explain")}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:S,onClick:()=>w(!1),children:m("cancel")}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:S,onClick:V,children:m("confirm")})]})]}),p&&c.jsx("div",{className:"nc-set-note",children:p}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function qN({token:e,onClose:t,initialTab:n="nodes",initialLocation:s="",startNewCell:o=!1}){$n();const a=n==="diagnostics"?"diagnostics":"general",[u,h]=E.useState(n==="diagnostics"?"system":n),f=E.useRef(null),p=E.useRef(null),[v,b]=E.useState({start:!1,end:!1}),[w,S]=E.useState(a),[y,x]=E.useState(null),[C,R]=E.useState([]),[k,$]=E.useState(!1),[O,V]=E.useState(null),[Y,z]=E.useState(0),ne=Wh(e,!0,Y),H=E.useCallback(()=>{const I=f.current;if(!I)return;const A=I.scrollWidth>I.clientWidth+1,N={start:A&&I.scrollLeft>1,end:A&&I.scrollLeft+I.clientWidth<I.scrollWidth-1};b(M=>M.start===N.start&&M.end===N.end?M:N)},[]);E.useEffect(()=>{const I=f.current;if(!I)return;const A=typeof ResizeObserver=="function"?new ResizeObserver(H):null;return A==null||A.observe(I),window.addEventListener("resize",H),H(),()=>{A==null||A.disconnect(),window.removeEventListener("resize",H)}},[H]),E.useEffect(()=>{var A,N;(N=(A=p.current)==null?void 0:A.scrollIntoView)==null||N.call(A,{behavior:"smooth",block:"nearest",inline:"nearest"});const I=window.requestAnimationFrame?window.requestAnimationFrame(H):setTimeout(H,0);return()=>{window.cancelAnimationFrame?window.cancelAnimationFrame(I):clearTimeout(I)}},[u,H]);const X=E.useCallback(async()=>{try{const I=await H_(e);x(I),V(null)}catch(I){V(String(I.message||I))}try{const I=await h0(e);R(I.peers||[])}catch(I){V(String(I.message||I))}},[e]);return E.useEffect(()=>{X();const I=setInterval(X,5e3);return()=>clearInterval(I)},[X]),E.useEffect(()=>{let I=!1;return Vt("/api/config",e).then(A=>A.json()).then(A=>{I||$(!!A.readonlyDefault)}).catch(()=>{}),()=>{I=!0}},[e]),c.jsx("div",{className:"nc-set-overlay",onClick:t,children:c.jsxs("div",{className:"nc-set-panel",onClick:I=>I.stopPropagation(),children:[c.jsxs("div",{className:"nc-set-head",children:[c.jsx(it,{name:"gear",size:18}),c.jsx("b",{children:m("settings")}),c.jsx("button",{type:"button",className:"nc-set-close",onClick:t,title:m("close"),children:c.jsx(it,{name:"x",size:18})})]}),k&&c.jsx("div",{className:"nc-set-readonly",children:m("settings-readonly")}),O&&c.jsx("div",{className:"nc-err",children:O}),c.jsx("div",{className:`nc-set-tabs-wrap${v.start?" has-start-overflow":""}${v.end?" has-end-overflow":""}`,children:c.jsx("div",{className:"nc-set-tabs",ref:f,onScroll:H,children:["nodes","fleet","audio","input","system"].map(I=>c.jsx("button",{ref:u===I?p:null,type:"button",className:`nc-set-tabbtn${u===I?" on":""}`,onClick:()=>h(I),children:m(`tab-${I}`)},I))})}),c.jsxs("div",{className:"nc-set-body",children:[u==="nodes"&&c.jsx(zN,{token:e,nodes:C,roster:ne,settings:y,readonly:k,refresh:X,refreshAliases:()=>z(I=>I+1)}),u==="fleet"&&c.jsx(wN,{token:e,readonly:k,startNewCell:o,initialLocation:s,targets:ne.map(I=>({route:I.route,label:I.label||I.name,status:I.status}))}),u==="audio"&&c.jsx(HN,{token:e,readonly:k,nodes:C,settings:y}),u==="input"&&c.jsx(WN,{}),u==="system"&&c.jsx(KN,{token:e,settings:y,readonly:k,refresh:X,roster:ne,section:w,setSection:S})]})]})})}function VN({token:e,initialPair:t,deviceDefault:n="",localNodeId:s="",localNameDefault:o="",onPairDone:a,onDone:u}){$n();const[h,f]=E.useState(t?"pair":"welcome"),[p,v]=E.useState(!1),[b,w]=E.useState(null),S=async()=>{v(!0),w(null);try{await Ld(e,{wizardDone:!0}),a&&a(),u()}catch(y){w(String(y.message||y)),v(!1)}};return c.jsx("div",{className:"nc-wiz-overlay",children:c.jsxs("div",{className:"nc-wiz",children:[c.jsxs("div",{className:"nc-wiz-head",children:[c.jsx("b",{children:m("wizard-title")}),c.jsx("small",{children:m("hydra-simple")})]}),h==="welcome"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx("div",{className:"nc-wiz-done",children:m("local-ready")}),c.jsxs("div",{className:"nc-sheet-actions",children:[c.jsx("button",{className:"nc-btn ghost",disabled:p,onClick:S,children:m("local-only")}),c.jsx("button",{className:"nc-btn primary",disabled:p,onClick:()=>f("pair"),children:m("add-node")})]})]}),h==="pair"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx(Tw,{token:e,initial:t||"",autoStart:!!t,deviceDefault:n,localNodeId:s,localNameDefault:o,onBusyChange:v,onSuccess:async()=>{a&&a(),f("done")}}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{className:"nc-btn ghost",disabled:p,onClick:()=>{a&&a(),f("welcome")},children:m("back")})})]}),h==="done"&&c.jsxs("div",{className:"nc-wiz-body",children:[c.jsx("div",{className:"nc-wiz-done",children:m("node-connected")}),c.jsx("div",{className:"nc-sheet-actions",children:c.jsx("button",{className:"nc-btn primary",disabled:p,onClick:S,children:m("finish")})})]}),b&&c.jsx("div",{className:"nc-err",children:b})]})})}function YN(e,t){if(typeof EventSource>"u"||!e)return()=>{};const n=new EventSource(`/api/events?token=${encodeURIComponent(e)}`);return n.onmessage=s=>{try{const o=JSON.parse(s.data);o&&typeof o=="object"&&typeof o.type=="string"&&t(o)}catch{}},()=>{try{n.close()}catch{}}}const GN=6e3,XN=12e3;function JN({n:e,onClose:t}){return c.jsxs("div",{className:`nc-ntf-toast${e.urgency==="high"?" high":""}`,role:"status","aria-live":"polite",children:[c.jsxs("div",{className:"nc-ntf-toast-txt",children:[c.jsx("b",{children:e.title}),e.body&&c.jsx("small",{children:e.body}),e.session&&c.jsx("span",{className:"nc-ntf-from",children:e.session})]}),c.jsx("button",{type:"button",className:"nc-ntf-x",onClick:t,title:m("close"),children:c.jsx(it,{name:"x",size:14})})]})}function QN({ask:e,token:t,onAnswered:n}){const[s,o]=E.useState(""),[a,u]=E.useState(!1),[h,f]=E.useState(null),p=async v=>{const b=String(v||"").trim();if(!(!b||a)){f(null),u(!0);try{await A0(t,e.id,b),n(e.id)}catch(w){f(String(w.message||w))}u(!1)}};return c.jsxs("div",{className:"nc-ask-card",children:[c.jsxs("div",{className:"nc-ask-head",children:[c.jsx("span",{className:"nc-ntf-from",children:e.session}),c.jsxs("code",{className:"nc-ask-id",children:["#",e.id]})]}),c.jsx("div",{className:"nc-ask-q",children:e.question}),Array.isArray(e.options)&&e.options.length>0&&c.jsx("div",{className:"nc-ask-opts",children:e.options.map(v=>c.jsx("button",{type:"button",className:"nc-btn ghost",disabled:a,onClick:()=>p(v),children:v},v))}),c.jsxs("div",{className:"nc-ask-reply",children:[c.jsx("textarea",{rows:2,placeholder:m("ask-reply-ph"),value:s,disabled:a,onChange:v=>o(v.target.value)}),c.jsx("button",{type:"button",className:"nc-btn primary",disabled:a||!s.trim(),onClick:()=>p(s),children:m("send")})]}),h&&c.jsx("div",{className:"nc-err",children:h})]})}function ZN({token:e}){const[t]=$n(),[n]=Vw(),[s,o]=E.useState([]),[a,u]=E.useState([]),[h,f]=E.useState(()=>{try{return/(?:^|[#&])ask=/.test(location.hash)}catch{return!1}}),p=E.useRef(0),v=E.useRef(null);v.current||(v.current=IN());const b=E.useRef({enabled:n,lang:t});b.current={enabled:n,lang:t};const w=E.useCallback(x=>{o(C=>C.filter(R=>R.key!==x))},[]),S=E.useCallback(x=>{const C=`t${p.current+=1}`;o(k=>[...k.slice(-3),{...x,key:C}]),setTimeout(()=>w(C),x.urgency==="high"?XN:GN);const R=b.current;if(R.enabled)try{v.current.enqueue(x,LN(x,R.lang))}catch{}},[w]);E.useEffect(()=>{n||v.current.stop()},[n]),E.useEffect(()=>{const x=()=>{(document.visibilityState!=="visible"||!document.hasFocus())&&v.current.stop()},C=()=>v.current.stop();return document.addEventListener("visibilitychange",x),window.addEventListener("blur",x),window.addEventListener(Nh,C),()=>{document.removeEventListener("visibilitychange",x),window.removeEventListener("blur",x),window.removeEventListener(Nh,C),typeof v.current.dispose=="function"?v.current.dispose():v.current.stop()}},[]),E.useEffect(()=>{if(!e)return;let x=!1;M0(e).then(R=>{x||u(R.asks||[])}).catch(()=>{});const C=YN(e,R=>{R.type==="notify"?S(R):R.type==="ask"&&R.ask&&R.ask.id?u(k=>k.some($=>$.id===R.ask.id)?k:[...k,R.ask]):R.type==="ask-answered"&&R.id&&u(k=>k.filter($=>$.id!==R.id))});return()=>{x=!0,C()}},[e,S]);const y=x=>u(C=>C.filter(R=>R.id!==x));return c.jsxs(c.Fragment,{children:[s.length>0&&c.jsx("div",{className:"nc-ntf-toasts",children:s.map(x=>c.jsx(JN,{n:x,onClose:()=>w(x.key)},x.key))}),a.length>0&&!h&&c.jsxs("button",{type:"button",className:"nc-ask-badge",onClick:()=>f(!0),title:m("asks-title"),children:["? ",c.jsx("span",{className:"nc-ask-count",children:a.length})]}),a.length>0&&h&&c.jsxs("div",{className:"nc-ask-panel",children:[c.jsxs("div",{className:"nc-ask-panel-head",children:[c.jsx("b",{children:m("asks-title")}),c.jsx("span",{className:"nc-ask-count",children:a.length}),c.jsx("button",{type:"button",className:"nc-ntf-x",onClick:()=>f(!1),title:m("close"),children:c.jsx(it,{name:"x",size:16})})]}),c.jsx("div",{className:"nc-ask-panel-body",children:a.map(x=>c.jsx(QN,{ask:x,token:e,onAnswered:y},x.id))})]})]})}const eR=4e3;async function tR(e){const t=await Vt("/api/sessions",e);if((t==null?void 0:t.ok)===!1)throw new Error(`HTTP ${t.status}`);const n=await t.json();if(!Array.isArray(n==null?void 0:n.sessions))throw new Error("invalid sessions payload");return n.sessions}async function Rd(e,t=[]){var h;const[n,s]=await Promise.allSettled([t.length?zh(e,t):tR(e),_s(e,t)]),o=n.status==="fulfilled"&&Array.isArray((h=n.value)==null?void 0:h.sessions)?n.value.sessions:Array.isArray(n.value)?n.value:null,a=s.status==="fulfilled"?s.value:null,u=(a==null?void 0:a.available)===!0&&Array.isArray(a.cells)?a.cells:null;return{sessions:o,cells:u,fresh:Array.isArray(o)&&Array.isArray(u)}}function Yw(e,t,n){return n===!0&&(e==null?void 0:e.degraded)!==!0&&(e==null?void 0:e.active)===!0&&e.tmux!==!1&&!!e.tmuxSession&&(t||[]).some(s=>(s==null?void 0:s.name)===e.tmuxSession)}function nR(e){const t=new Map((e.sessions||[]).map(o=>[o.name,o])),n=[],s=(o,a,u,h=[],f="")=>{const p=new Map((a||[]).map(v=>[v.name,v]));for(const v of o||[]){const b=p.get(v.tmuxSession)||{},w=qh(v,b),S=Yw(v,a,u);n.push({key:Bo(h,v.tmuxSession||v.cell),session:v.tmuxSession,route:h,cellName:v.cell,label:v.cell,node:h.length?h.join("/"):"",nodeLabel:f,live:S,selectable:S,verified:u===!0,working:w.working,degraded:!!v.degraded,activity:b.activity||v.activity||0,subtitle:w.subtitle})}};s(e.cells,[...t.values()],e.localFresh===!0);for(const o of e.nodeGroups||[])s(o.cells,o.sessions,o.switcherFresh===!0,Array.isArray(o.route)?o.route:[],o.label||o.name||"");return n}function iR(e){const t=new Map,n=Array.isArray(e.sessions)?e.sessions:[],s=Array.isArray(e.cells)?e.cells:[],o=new Map(n.map(u=>[u.name,u])),a=new Set(s.map(u=>u.tmuxSession).filter(Boolean));t.set("local",Vh(s,n.filter(u=>!a.has(u.name)),o));for(const u of e.nodeGroups||[]){const h=Array.isArray(u.route)?u.route:[];if(!h.length)continue;const f=Array.isArray(u.cells)?u.cells:[],p=Array.isArray(u.sessions)?u.sessions:[],v=new Set(f.map(b=>b.tmuxSession).filter(Boolean));t.set(h.join("/"),Pl({...u,route:h,cells:f,sessions:p,unmanaged:p.filter(b=>!v.has(b.name))}).rawItems)}return t}function sR(e,t,n,s){return[...new Set(e.map(a=>a.node||"local"))].flatMap(a=>{const u=e.filter(v=>(v.node||"local")===a),h=new Map((t.get(a)||[]).map(v=>[v.key,v])),f=new Map(u.map(v=>[v.key,v])),p=u.map(v=>{const b=h.get(v.key);return{...v,label:(b==null?void 0:b.label)||v.label,live:(b==null?void 0:b.live)??v.live,fresh:(b==null?void 0:b.fresh)===!0,activity:(b==null?void 0:b.activity)??v.activity}});return ps(p,n,"all",Ai(s,a)).map(v=>f.get(v.key))})}function rR({token:e,current:t,onPick:n,onClose:s}){const[o,a]=E.useState(Eg),[u,h]=E.useState(!1),[f,p]=E.useState(!1),[v,b]=E.useState(""),[w,S]=E.useState(""),[y,x]=E.useState(""),C=E.useRef(null),R=E.useRef(null),k=E.useMemo(()=>nR(o),[o]),$=E.useMemo(()=>iR(o),[o]),{pins:O,orders:V,canMoveRoster:Y,moveRoster:z,stepRoster:ne}=Kh(),H=E.useMemo(()=>sR(k,$,O,V),[k,$,O,V]),X=E.useMemo(()=>u?H:H.filter(L=>L.selectable||L.degraded),[H,u]),I=E.useMemo(()=>k.find(L=>L.key===w&&L.selectable),[k,w]);E.useEffect(()=>{var F;const L=document.activeElement;(F=R.current)==null||F.focus();const P=T=>{T.key==="Escape"&&s()};return document.addEventListener("keydown",P),()=>{var T;document.removeEventListener("keydown",P),(T=L==null?void 0:L.focus)==null||T.call(L)}},[s]),E.useEffect(()=>{let L=!0,P=!1;const F=async()=>{if(P)return;P=!0;const q=Eg(),B=Array.isArray(q.nodeGroups)?q.nodeGroups:[],D=Rd(e),U=await Promise.all(B.map(async J=>{const ee=Array.isArray(J.route)?J.route:[];return ee.length?{group:J,result:await Rd(e,ee)}:{group:J,result:{fresh:!1,sessions:null,cells:null}}})),Z=await D;if(!L)return;const oe=new Map(U.map(({group:J,result:ee})=>[JSON.stringify(J.route||[]),ee])),de=B.map(J=>{const ee=oe.get(JSON.stringify(J.route||[]));return ee?{...J,sessions:ee.sessions||J.sessions||[],cells:ee.cells||J.cells||[],switcherFresh:ee.fresh}:{...J,switcherFresh:!1}}),fe=ry({...q,sessions:Z.sessions||q.sessions||[],cells:Z.cells||q.cells||[],localFresh:Z.fresh,nodeGroups:de,refreshedAt:Date.now()});a(fe),p(!0),P=!1};F();const T=setInterval(F,eR);return()=>{L=!1,clearInterval(T)}},[e]);const A=L=>L.degraded?m("cell-degraded"):L.verified?L.selectable?L.working?m("cell-working"):m("cell-idle"):m("cell-off"):m("cell-switcher-not-confirmed"),N=L=>{if(b(""),!L.selectable){b(m("cell-switcher-not-active"));return}S(L.key)},M=async()=>{const L=I;if(!L){b(m("cell-switcher-select"));return}b(""),x(L.key);try{const P=await Rd(e,L.route),F=(P.cells||[]).find(T=>(T==null?void 0:T.cell)===L.cellName&&(T==null?void 0:T.tmuxSession)===L.session);if(!Yw(F,P.sessions,P.fresh)){b(m("cell-switcher-not-active"));return}n({session:L.session,...L.node?{node:L.node}:{},cellName:L.cellName}),s()}catch{b(m("cell-switcher-not-active"))}finally{x("")}};return c.jsx("div",{className:"nc-cell-switcher-backdrop",onClick:s,children:c.jsxs("aside",{ref:C,className:"nc-cell-switcher",role:"dialog","aria-label":m("fleet-cells"),tabIndex:-1,onClick:L=>L.stopPropagation(),children:[c.jsxs("div",{className:"nc-cell-switcher-list",children:[!f&&c.jsx("div",{className:"nc-empty",role:"status",children:m("cell-switcher-refreshing")}),f&&X.length===0&&c.jsx("div",{className:"nc-empty",role:"status",children:m("cell-switcher-empty-active")}),X.map(L=>{const P=(t==null?void 0:t.session)===L.session&&((t==null?void 0:t.node)||"")===L.node,F=w===L.key,T=A(L),q=L.node||"local",B=$.get(q)||k.filter(D=>(D.node||"local")===q);return c.jsxs("div",{className:`nc-cell-switcher-row${P?" current":""}${F?" selected":""}${L.selectable?"":" off"}`,"data-roster-key":L.key,"data-position":q,children:[c.jsx(Di,{position:q,itemKey:L.key,label:L.cellName,canMove:Y,onMove:(D,U)=>z(q,D,U,B),onStep:D=>ne(q,L.key,D,B)}),c.jsxs("button",{type:"button",className:"nc-cell-switcher-row-select","aria-current":P?"true":void 0,"aria-pressed":F,"aria-disabled":!L.selectable,disabled:y===L.key,onClick:()=>N(L),children:[c.jsx("span",{className:`nc-cell-switcher-dot${L.degraded?" warn":L.live?` on${L.working?" working":""}`:""}`}),c.jsxs("span",{className:"nc-cell-switcher-copy",children:[c.jsx("b",{children:L.cellName}),c.jsx("small",{className:"nc-cell-switcher-state",children:T}),c.jsx("small",{children:[L.nodeLabel,L.subtitle].filter(Boolean).join(" · ")})]})]})]},L.key)})]}),v&&c.jsx("div",{className:"nc-cell-switcher-notice",role:"status",children:v}),c.jsx("div",{className:"nc-cell-switcher-actions",children:c.jsx("button",{type:"button",className:"nc-cell-switcher-open",disabled:!I||!!y,onClick:M,children:I?`${m("cell-switcher-open")}: ${I.cellName}`:m("cell-switcher-select")})}),c.jsxs("div",{className:"nc-cell-switcher-controls",children:[c.jsx("b",{children:m("fleet-cells")}),c.jsx("button",{type:"button",className:"nc-cell-switcher-filter","aria-pressed":u,onClick:()=>{b(""),h(L=>!L)},children:m(u?"cell-switcher-show-active":"cell-switcher-show-all")}),c.jsx("button",{ref:R,type:"button",className:"nc-cell-switcher-close","aria-label":m("cell-switcher-close"),title:m("cell-switcher-close"),onClick:s,children:"×"})]})]})})}const jd=e=>wi($s(e)).length===0,Pd=e=>Array.isArray(e)?e.join("/"):"";function oR(e){const t=new Set,n=[];for(const s of Array.isArray(e)?e:[])!s||!zn.test(String(s.instanceId||""))||!Array.isArray(s.route)||!s.route.length||t.has(s.instanceId)||(t.add(s.instanceId),n.push({instanceId:s.instanceId,route:[...s.route],label:String(s.label||s.name||s.route.join(" › ")),status:s.status||"offline"}));return n.sort((s,o)=>s.label.localeCompare(o.label))}function Ro(e){return{instanceId:e.ownerId,route:e.ownerRoute||[],label:e.ownerLabel,status:e.available===!1?"offline":"up"}}function As(e,t,n,s=!1,o=!0){const a=t.instanceId;return{...e,id:Cr(s?null:a,e.name),ownerId:a,ownerRoute:s?[]:[...t.route],ownerLabel:s?"Local":t.label,local:s,available:o,ownerTopology:Array.isArray(n)?n:[],layout:xh(e.layout,a,n)}}function aR(e,t,n,s,o=[]){const[a,u]=E.useState([]),[h,f]=E.useState(!1),[p,v]=E.useState("idle"),[b,w]=E.useState(""),[S,y]=E.useState(""),x=E.useRef([]),C=E.useRef([]),R=E.useRef(""),k=E.useRef(t),$=E.useRef(n),O=E.useRef(!1),V=E.useRef(!0),Y=E.useRef(""),z=E.useMemo(()=>oR(o),[o]),ne=z.map(B=>`${B.instanceId}:${Pd(B.route)}:${B.status}:${B.label}`).join("|");C.current=z,$.current=n,k.current=t,x.current=a;const H=E.useCallback(B=>kh(B.layout,R.current,C.current),[]),X=E.useCallback((B,D=!0,U=k.current)=>{const Z=Ov(B,hl()),oe=x.current.some(fe=>fe.id===U);x.current=Z,u(Z);const de=Z.find(fe=>fe.id===U);if(D&&de){V.current=!0;const fe=H(de);s(fe),de.local&&VE(de.name,fe)}else oe&&!de&&(V.current=!0,s(kr()),w("deck non più condiviso dal nodo owner"));WE(Z.filter(fe=>fe.local).map(fe=>fe.name))},[s,H]),I=E.useCallback(async B=>{let D=await il(e);const U=D.decks.find(Z=>Z.name==="main");if(D.decks.length===1&&U&&U.revision===0&&jd(U.layout)){const Z=HE(),oe=$s(Ch("main")||kr());if(!jd(oe)){const de=xh(oe,B,[]);D.decks[0]=await sl(e,"main",de,0,[])}for(const de of Z.filter(fe=>fe!=="main"))try{let fe=await hg(e,de,[]);const J=$s(Ch(de)||kr());jd(J)||(fe=await sl(e,de,xh(J,B,[]),fe.revision,[]))}catch{}D=await il(e)}return D},[e]),A=E.useCallback(async({migrate:B=!1}={})=>{const D=await Fh(e,[]),U=zn.test(String(D.instanceId||""))?D.instanceId:"";if(!U)throw new Error("instanceId locale non disponibile");R.current=U,y(U);const[Z,oe]=await Promise.all([B?I(U):il(e),ag(e,[]).catch(()=>({nodes:[]}))]),de={instanceId:U,route:[],label:"Local"},fe=Z.decks.map(ee=>As(ee,de,oe.nodes,!0,!0)),J=x.current;return await Promise.all(C.current.map(async ee=>{if(ee.status!=="up"){fe.push(...J.filter(pe=>!pe.local&&pe.ownerId===ee.instanceId).map(pe=>({...pe,ownerRoute:[...ee.route],ownerLabel:ee.label,available:!1})));return}try{const[pe,Se]=await Promise.all([il(e,ee.route),ag(e,ee.route).catch(()=>({nodes:[]}))]);fe.push(...pe.decks.map(Ze=>As(Ze,ee,Se.nodes,!1,!0)))}catch{fe.push(...J.filter(Se=>!Se.local&&Se.ownerId===ee.instanceId).map(Se=>({...Se,ownerRoute:[...ee.route],ownerLabel:ee.label,available:!1})))}})),fe.sort((ee,pe)=>ee.local===pe.local?ee.ownerLabel.localeCompare(pe.ownerLabel)||(ee.name==="main"?-1:pe.name==="main"?1:ee.name.localeCompare(pe.name)):ee.local?-1:1),fe},[e,I,ne]);E.useEffect(()=>{if(!e)return;let B=!1;const D=Y.current!==e;return Y.current=e,A({migrate:D}).then(U=>{if(B)return;const Z=x.current.find(fe=>fe.id===k.current),oe=U.find(fe=>fe.id===k.current),de=oe&&(!Z||oe.revision>Z.revision||Z.available!==oe.available||Pd(Z.ownerRoute)!==Pd(oe.ownerRoute));X(U,D||!!de&&!O.current),f(!0),oe&&w("")}).catch(U=>{B||(f(!0),w(String(U.message||U)))}),()=>{B=!0}},[X,A,ne,e]);const N=E.useCallback(async(B=k.current)=>{if(!h||!O.current)return!0;const D=x.current.find(U=>U.id===B);if(!D)return w(`deck inesistente: ${B}`),!1;if(D.available===!1)return w(`nodo owner offline: ${D.ownerLabel}`),!1;v("saving");try{const U=Iv($s($.current),D.ownerId,D.ownerTopology),Z=await sl(e,D.name,U,D.revision,D.ownerRoute),oe=As(Z,Ro(D),D.ownerTopology,D.local,!0);return X(x.current.map(de=>de.id===B?oe:de),!1),O.current=!1,v("saved"),w(""),setTimeout(()=>v("idle"),1500),!0}catch(U){if(v("error"),w(String(U.message||U)),U.status===409&&U.data&&U.data.current){const Z=x.current.find(de=>de.id===B),oe=As(U.data.current,Ro(Z),Z.ownerTopology,Z.local,!0);X(x.current.map(de=>de.id===B?oe:de),!1)}return!1}},[h,e,X]);return E.useEffect(()=>{if(!h)return;if(V.current){V.current=!1;return}O.current=!0,v("saving");const B=setTimeout(N,650);return()=>clearTimeout(B)},[n,h,N]),E.useEffect(()=>{if(!h)return;const B=setInterval(async()=>{try{const D=await A(),U=x.current.find(de=>de.id===k.current),Z=D.find(de=>de.id===k.current),oe=Z&&(!U||Z.revision>U.revision||U.available!==Z.available);X(D,oe&&!O.current)}catch{}},5e3);return()=>clearInterval(B)},[h,A,X]),{decks:a,records:a,localNodeId:S,ready:h,saveState:p,error:b,setError:w,saveNow:N,select:async B=>{if(O.current&&!await N(k.current))throw new Error("salvataggio del deck corrente fallito: cambio annullato");const D=x.current.find(U=>U.id===B);if(!D)throw new Error(`deck inesistente: ${B}`);return O.current=!1,V.current=!0,H(D)},add:async(B,D=null)=>{const U=D===_i?x.current.find(de=>de.local):D?x.current.find(de=>de.ownerId===D):null;if(!U||U.available===!1)throw new Error("nodo owner non disponibile");const Z=await hg(e,B,U.ownerRoute),oe=As(Z,Ro(U),U.ownerTopology,U.local,!0);return X([...x.current,oe],!1),oe},rename:async(B,D)=>{const U=x.current.find(J=>J.id===B);if(!U)throw new Error("deck inesistente");if(B===k.current&&O.current&&!await N(B))throw new Error(`salvataggio di "${U.name}" fallito: rinomina annullata`);const Z=x.current.find(J=>J.id===B);if(!Z)throw new Error("deck inesistente");const oe=await I0(e,Z.name,D,Z.revision,Z.ownerRoute),de=As(oe,Ro(Z),Z.ownerTopology,Z.local,!0),fe=Z.local?_i:Z.ownerId;return nd(KE(hl(),fe,B,de.id)),X(x.current.map(J=>J.id===B?de:J),!1),de},remove:async B=>{const D=x.current.find(Z=>Z.id===B);if(!D)throw new Error("deck inesistente");B===k.current&&(O.current=!1),await B0(e,D.name,D.revision,D.ownerRoute);const U=D.local?_i:D.ownerId;nd(qE(hl(),U,B)),X(x.current.filter(Z=>Z.id!==B),!1)},reorder:(B,D)=>{const U=x.current.find(ee=>ee.id===B),Z=x.current.find(ee=>ee.id===D);if(!U||!Z)return!1;const oe=U.local?_i:U.ownerId,de=Z.local?_i:Z.ownerId;if(oe!==de)return!1;const fe=x.current.filter(ee=>(ee.local?_i:ee.ownerId)===oe).map(ee=>ee.id),J=nd(UE(hl(),oe,B,D,fe));return X(Ov(x.current,J),!1),!0},addTileTo:async(B,D)=>{const U=x.current.find(ee=>ee.id===B);if(!U)throw new Error("deck inesistente");if(U.available===!1)throw new Error(`nodo owner offline: ${U.ownerLabel}`);const Z=pw(D,R.current,C.current);if(!Z)throw new Error("riferimento sessione non valido");const oe=H(U),de=Iv(ny(oe,Z),U.ownerId,U.ownerTopology),fe=await sl(e,U.name,de,U.revision,U.ownerRoute),J=As(fe,Ro(U),U.ownerTopology,U.local,!0);return X(x.current.map(ee=>ee.id===B?J:ee),!1),J},localMainId:Cr(null,"main"),parseDeckId:Yl}}const lR="/sw.js",jh="nc-sw-update";let Ph=null,Lh=!1,Th=null,Gw=Object.freeze({needed:!1,kind:null,version:""}),Xw=!1;function Jw(){typeof window<"u"&&window.dispatchEvent(new Event(jh))}function Qw(){const e=Th||(Lh?{kind:"reload",version:""}:null);Gw=Object.freeze({needed:!!e,kind:(e==null?void 0:e.kind)||null,version:(e==null?void 0:e.version)||""})}function j_(){return Gw}function cR(e){return typeof window>"u"?()=>{}:(window.addEventListener(jh,e),()=>window.removeEventListener(jh,e))}function Cf(e){Lh!==e&&(Lh=e,Qw(),Jw())}function uR(e,t,n){let s=null;e&&t&&e!==t?s={kind:"install",version:e}:t&&n&&t!==n&&(s={kind:"reload",version:t});const o=JSON.stringify(s)===JSON.stringify(Th);Th=s,Qw(),o||Jw()}function dR(e){e.addEventListener("statechange",()=>{e.state==="installed"&&navigator.serviceWorker.controller&&Cf(!0)})}function hR(){typeof navigator>"u"||!("serviceWorker"in navigator)||(navigator.serviceWorker.addEventListener("controllerchange",()=>{Xw&&location.reload()}),navigator.serviceWorker.register(lR).then(e=>{Ph=e,e.waiting&&Cf(!0),e.addEventListener("updatefound",()=>{const t=e.installing;t&&dR(t)}),setInterval(()=>{e.update().catch(()=>{})},3600*1e3)}).catch(()=>{}))}function fR(){Xw=!0,Cf(!1);const e=Ph&&Ph.waiting;e?(e.postMessage({type:"SKIP_WAITING"}),setTimeout(()=>location.reload(),4e3)):location.reload()}function pR({hash:e="",origin:t="",pathname:n="",search:s=""}={}){const o=String(e||"").replace(/^#/,""),a=`${n||""}${s||""}`;if(!o)return{token:"",pair:"",nextUrl:a};const u=new URLSearchParams(o),h=u.get("token")||"",f=u.get("pair")||"",p=f?`${t||""}${n||""}#pair=${f}`:"";return{token:h,pair:p,nextUrl:a}}const Zw=9,eS=24,tS="nc_side_w",P_="nc_side_min",mR=240,L_="(min-width:1024px) and (pointer:fine)";function gR(){const e=Number(localStorage.getItem(tS));return e>=180&&e<=480?e:mR}function vR(){const e=Number(localStorage.getItem("nc_fontsize"));return e>=Zw&&e<=eS?e:13}function _R(){const e={token:"",pair:""};try{const{token:t,pair:n,nextUrl:s}=pR({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(n){e.pair=n;try{sessionStorage.setItem("nc_pair",n)}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 yR(e){try{return $s(Ch(e))}catch{return kr()}}function T_(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 wR(){const[e,t]=E.useState(()=>window.matchMedia(L_).matches);return E.useEffect(()=>{const n=window.matchMedia(L_),s=o=>t(o.matches);return n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[]),e}function D_({session:e,node:t,ownerId:n,cellName:s,token:o,readonly:a=!1,onBack:u,onCellSwitcher:h,cellSwitcherOpen:f=!1}){$n();const[p]=uf(),[v,b]=E.useState(!1),[w,S]=E.useState(()=>window.matchMedia("(pointer: coarse)").matches),[y,x]=E.useState(null),[C,R]=E.useState(vR),[k,$]=E.useState(s||e),[O,V]=E.useState(""),Y=P=>R(F=>{const T=Math.max(Zw,Math.min(eS,F+P));return localStorage.setItem("nc_fontsize",String(T)),T}),z=E.useRef(()=>{}),ne=E.useRef(()=>!1),H=E.useRef(()=>{}),X=E.useRef(!1),[I,A]=E.useState(!1),[N,M]=E.useState(!1),L=()=>{X.current=!X.current,A(X.current)};return E.useEffect(()=>{$(s||e)},[s,e]),E.useEffect(()=>{let P=!0;const F=t?t.split("/"):[],T=t?`/api/route/${t.split("/").map(encodeURIComponent).join("/")}/_`:"/api";async function q(){let D=null,U=null;try{const de=await(await Vt(`${T}/sessions`,o)).json();Array.isArray(de.sessions)&&(D=de.sessions.find(fe=>fe.name===e))}catch{}try{const oe=await _s(o,F);oe.available&&Array.isArray(oe.cells)&&(U=oe.cells.find(de=>de.tmuxSession===e))}catch{}if(!P)return;$(df({session:e,cell:U||(s?{cell:s}:null)}));let Z="";U?Z=`${U.engine}${U.key?`·${U.key}`:""}`:D&&(Z=D.attached?`attached · ${T_(D.activity)}`:D.activity?T_(D.activity):""),V(Z)}q();const B=setInterval(q,4e3);return()=>{P=!1,clearInterval(B)}},[e,t,o]),c.jsxs("div",{className:"nc-app",children:[c.jsxs("header",{className:"nc-bar nc-bar-single",children:[c.jsxs("button",{onClick:u,title:m("sessions"),children:[c.jsx(it,{name:"chevronLeft",size:18}),c.jsx("span",{className:"nc-bar-label",children:m("sessions")})]}),c.jsxs("span",{className:"nc-bar-center",children:[c.jsx("b",{title:t?`${k} · ${t}`:k,children:k}),O&&c.jsx("small",{className:"nc-bar-sub",children:O})]}),c.jsxs("span",{className:"nc-bar-right",children:[c.jsx("button",{onClick:()=>Y(-1),title:m("zoom-out"),children:c.jsx(it,{name:"zoomOut",size:18})}),c.jsx("button",{onClick:()=>Y(1),title:m("zoom-in"),children:c.jsx(it,{name:"zoomIn",size:18})}),c.jsx("button",{onClick:()=>S(P=>!P),title:m("composer"),children:c.jsx(it,{name:"keyboard",size:20})}),c.jsx("button",{onClick:()=>b(P=>!P),title:m("files"),children:c.jsx(it,{name:"folder",size:20})})]})]}),c.jsx("div",{className:"nc-termwrap",children:c.jsx(Zy,{session:e,node:t,token:o,readonly:a,takeSize:!0,sendRef:z,composerRef:ne,actionRef:H,ctrlRef:X,setCtrlArmed:A,onFiles:x,fontSize:C,selectionMode:N,onSelectionModeChange:M,keyboardGesture:p.terminalKeyboardGesture})}),c.jsx(hE,{onKeyboard:()=>S(P=>!P),onCellSwitcher:h,cellSwitcherOpen:f,send:P=>z.current(P),action:P=>H.current(P),ctrlArmed:I,onCtrl:L,selectionMode:N,onSelectionMode:M,keepKeyboardClosed:p.keybarKeepsKeyboardClosed,showEnter:p.showKeybarEnter,keybarLayout:p.keybarLayout}),w&&c.jsx(cw,{submitText:P=>ne.current(P),token:o,session:e,node:t,ownerId:n,keepKeyboardClosedOnVoice:p.voiceKeepsKeyboardClosed}),v&&c.jsx(ew,{session:e,node:t,token:o,filesEvent:y,onClose:()=>b(!1)})]})}function SR(){$n();const[e]=E.useState(_R),[t,n]=E.useState(e.token),[s,o]=E.useState(e.pair||""),a=E.useCallback(()=>{o("");try{sessionStorage.removeItem("nc_pair")}catch{}},[]),[u,h]=E.useState(!1),f=wR(),[p]=E.useState(()=>$E(typeof location<"u"?location.pathname:"/")),[v,b]=E.useState(p.id),w=v===Cr(null,Fn),[S,y]=E.useState(null),x=he=>{const Ne=vs(he);y(Ne?{...Ne,...typeof(he==null?void 0:he.cellName)=="string"&&he.cellName?{cellName:he.cellName}:{}}:null)},[C,R]=E.useState([]),[k,$]=E.useState([]),[O,V]=E.useState([]),[Y,z]=E.useState(()=>p.ownerId?kr():yR(p.name)),[ne,H]=E.useState(null),[X,I]=E.useState(null),A=he=>I(vs(he)),N=Wh(t,f),M=E.useMemo(()=>(N||[]).filter(he=>he.instanceId).map(he=>({instanceId:he.instanceId,route:he.route,label:he.label,status:he.status})),[N]),L=aR(t,v,Y,z,M),P=L.decks;E.useEffect(()=>{const he=new Map;for(const Ne of N||[]){const Ke=(Ne.route||[Ne.name]).join("/"),Nt=new Set((Ne.sessions||[]).map(pt=>pt.name));for(const pt of Ne.cells||[])!pt.cell||!pt.tmuxSession||pt.cell===pt.tmuxSession||Nt.has(pt.cell)||he.set(`${Ke}:${pt.cell}`,`${Ke}:${pt.tmuxSession}`)}z(Ne=>d1(Ne,he))},[N]),E.useEffect(()=>{L.localNodeId&&z(he=>{const Ne=kh(he,L.localNodeId,M);return JSON.stringify(Ne)===JSON.stringify(he)?he:Ne})},[M,L.localNodeId]);const[F,T]=E.useState(null),[q,B]=E.useState(null),D=E.useRef(0),[U,Z]=E.useState(!1),[oe,de]=E.useState(gR),[fe,J]=E.useState(!w),[ee,pe]=E.useState(()=>w?localStorage.getItem(P_)==="1":!0),[Se,Ze]=E.useState(!1),[$e,He]=E.useState("nodes"),[vt,Xe]=E.useState(!1),[St,Et]=E.useState(""),[rt,ct]=E.useState(!1),ot=(he="nodes",Ne=!1,Ke="")=>{He(he),Xe(Ne),Et(Ke),Ze(!0)},[ut,dt]=E.useState(!1),[le,xe]=E.useState({deviceDefault:"",localNodeId:"",localNameDefault:""}),[ze,Ie]=E.useState(!1);E.useEffect(()=>{try{localStorage.setItem(tS,String(oe))}catch{}},[oe]),E.useEffect(()=>{try{localStorage.setItem(P_,ee?"1":"")}catch{}},[ee]),E.useEffect(()=>{if(!t)return;let he=!1;return Promise.all([H_(t),Vt("/api/config",t).then(Ne=>Ne.json())]).then(([Ne,Ke])=>{he||(xe({deviceDefault:Ne.deviceName||"",localNodeId:Ne.nodeId||"",localNameDefault:Ne.localName||""}),Ie(!!Ke.readonlyDefault),(Ne.firstRun===!0&&!Ke.readonlyDefault||s)&&dt(!0))}).catch(()=>{}),()=>{he=!0}},[t,s]);const ue=E.useCallback(async()=>{try{const Ne=await(await Vt("/api/sessions",t)).json();Ne.error||R(Ne.sessions||[])}catch{}try{const he=await _s(t);$(he.available?he.cells||[]:[]),V(he.available?he.capabilities||[]:[])}catch{$([]),V([])}},[t]);E.useEffect(()=>{if(!f)return;ue();const he=setInterval(ue,4e3);return()=>clearInterval(he)},[f,ue]),E.useEffect(()=>{let he=!1;return Vt("/api/config",t).then(Ne=>Ne.json()).then(Ne=>{he||uR(Ne.version,Ne.uiVersion,"0.8.46")}).catch(()=>{}),()=>{he=!0}},[t]);const G=new Set([...C.map(he=>he.name),...N.flatMap(he=>he.sessions.map(Ne=>Ne.key))]),ie=wi(Y),W=he=>z(Ne=>{const Ke=pw(he,L.localNodeId,M)||he,Nt=ny(Ne,Ke);return Nt===Ne&&wi(Ne).length>=9&&L.setError(m("grid-full")),Nt}),se=async(he,Ne=[])=>{try{await Bh(t,he,Ne)}catch{return}const Ke=Ne.length?`${Ne.join("/")}:${he}`:he;z(Nt=>Tl(Nt,Ke)),ue()},ve=async(he,Ne,Ke=[])=>{try{await $_(t,he,Ne,Ke)}catch{return}ue()},ke=async(he,Ne,Ke=[])=>{await O_(t,{cell:he,enabled:!!Ne},Ke),ue()},Re=async he=>{if(!F)return;const{cell:Ne}=F,Ke=Array.isArray(F.route)?F.route:[];he.action==="up"?await Ah(t,{cell:Ne,boot:!!he.boot,...he.engine?{engine:he.engine}:{},...he.model!==void 0?{model:he.model}:{},...he.permissionPolicy?{permissionPolicy:he.permissionPolicy}:{}},Ke):await Cl(t,{cell:Ne,boot:!!he.boot},Ke);const Nt=he.action==="up"?!!he.boot:he.boot?!1:!!F.boot;B({id:++D.current,cell:Ne,route:Ke,enabled:Nt}),ue()},we=E.useCallback(he=>{B(Ne=>(Ne==null?void 0:Ne.id)===he?null:Ne)},[]),je=async he=>{if(!(!(he!=null&&he.direct)||U)){Z(!0);try{await $h(t,he.name,he.tunnelStatus==="up"?"down":"up")}finally{Z(!1)}}},st=async(he,Ne)=>{const Ke=String(Ne||"").trim();return!(he!=null&&he.direct)||!jr(Ke)?!1:(await W_(t,he.name,Ke),!0)},It=he=>{const Ne=P.find(Ke=>Ke.id===he);if(!Ne)return!1;try{const Ke=window.open(td(Ne,t),"_blank");return Ke&&(Ke.opener=null),!!Ke}catch{return!1}},Oe=async he=>{if(!he||he===v)return;const Ne=await L.select(he),Ke=L.records.find(Nt=>Nt.id===he);b(he),z(Ne),H(null),I(null);try{history.replaceState(null,"",td(Ke||he,null))}catch{}},_n=async(he,Ne)=>{const Ke=await L.add(he,Ne);await Oe(Ke.id)},bt=async(he,Ne)=>{const Ke=await L.rename(he,Ne);if(he===v){b(Ke.id),z(kh(Ke.layout,L.localNodeId,M)),H(null),I(null);try{history.replaceState(null,"",td(Ke,null))}catch{}}},Ye=async he=>{await L.remove(he),he===v&&await Oe(L.localMainId)},Gt=async(he,Ne)=>{!Ne||Ne===v||(await L.addTileTo(Ne,he),z(Ke=>Tl(Ke,he)))};if(!t)return c.jsxs("div",{className:"nc-auth",children:[c.jsx("p",{children:m("auth-prompt")}),c.jsx("input",{onChange:he=>n(he.target.value.trim()),placeholder:"token"}),c.jsxs("label",{children:[c.jsx("input",{type:"checkbox",checked:u,onChange:he=>h(he.target.checked)})," ",m("remember-device")]}),c.jsx("button",{onClick:()=>{(u?localStorage:sessionStorage).setItem("nc_token",t)},children:"ok"})]});const Hn=c.jsxs(c.Fragment,{children:[Se&&c.jsx(qN,{token:t,initialTab:$e,initialLocation:St,startNewCell:vt,onClose:()=>{Ze(!1),Xe(!1),Et("")}}),ut&&c.jsx(VN,{token:t,initialPair:s,...le,onPairDone:a,onDone:()=>dt(!1)}),c.jsx(ZN,{token:t})]});if(!f)return S?c.jsxs(c.Fragment,{children:[c.jsx(D_,{session:S.session,node:S.node,ownerId:S.ownerId,cellName:S.cellName,token:t,readonly:ze,onBack:()=>y(null),onCellSwitcher:()=>ct(!0),cellSwitcherOpen:rt}),rt&&c.jsx(rR,{token:t,current:S,onPick:he=>{x(he),ct(!1)},onClose:()=>ct(!1)}),Hn]}):c.jsxs(c.Fragment,{children:[c.jsx(E1,{onPick:x,token:t,onSettings:ot}),Hn]});const li=w||!fe;return c.jsxs("div",{className:"nc-workspace",children:[li&&c.jsx(jE,{sessions:C,cells:k,activeSessions:ie,nodeGroups:N,fleetCapabilities:O,bootSettlement:q,onBootSettlementApplied:we,localNodeId:L.localNodeId,onPick:A,onAddTile:W,onPower:T,onBoot:ke,onBootError:he=>L.setError(String((he==null?void 0:he.message)||he)),onNodePower:je,onNodeRename:st,onKill:se,onVisibility:ve,onNew:()=>ot("fleet",!0),onSettings:ot,width:oe,collapsed:ee,onResize:de,onToggleCollapse:()=>pe(he=>!he)}),c.jsxs("div",{className:"nc-workspace-main",children:[c.jsx(u2,{decks:P,currentDeck:v,onCreate:_n,onRename:bt,onDelete:Ye,onReorder:L.reorder,onOpenWindow:It,onNavigate:Oe,saveState:L.saveState,error:L.error,sidebarVisible:li,onToggleSidebar:w?null:()=>J(he=>!he)}),c.jsx(IE,{layout:Y,onLayoutChange:z,token:t,readonly:ze,sessionsAlive:G,focusSession:ne,onFocus:H,onOpenSingle:A,decks:P,currentDeck:v,onSendToDeck:Gt,cells:k,nodeGroups:N})]}),X&&c.jsx("div",{className:"nc-single-overlay",children:c.jsx(D_,{session:X.session,node:X.node,ownerId:X.ownerId,cellName:df({session:X.session,node:X.node,ownerId:X.ownerId,cells:k,nodeGroups:N}),token:t,readonly:ze,onBack:()=>I(null)})}),F&&c.jsx(Nl,{cell:F,token:t,route:Array.isArray(F.route)?F.route:[],onConfirm:Re,onClose:()=>T(null)}),Hn]})}function bR(){$n();const e=E.useSyncExternalStore(cR,j_,j_);if(!e.needed)return null;const t=e.kind==="install"?m("install-version-mismatch").replace("{v}",e.version):m("update-available").replace("{v}",e.version).replace(" "," ").trim();return c.jsxs("div",{className:"nc-update",role:"status","aria-live":"polite",children:[c.jsx("span",{className:"nc-update-msg",children:t}),e.kind==="reload"&&c.jsx("button",{className:"nc-update-btn",onClick:fR,children:m("reload")})]})}hR();t0.createRoot(document.getElementById("root")).render(c.jsxs(Yb.StrictMode,{children:[c.jsx(SR,{}),c.jsx(bR,{})]}));