herdr-remote-relay 0.3.21 → 0.3.22
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.
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var vx=Object.defineProperty;var xx=(a,n,l)=>n in a?vx(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l;var q=(a,n,l)=>xx(a,typeof n!="symbol"?n+"":n,l);import{r as db,g as fb,a as hb}from"./vendor-react-CYSfZuHu.js";import{r as wx,a as Sx}from"./vendor-xterm-BhCxil_4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function l(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(r){if(r.ep)return;r.ep=!0;const u=l(r);fetch(r.href,u)}})();var Uu={exports:{}},is={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Yp;function Cx(){if(Yp)return is;Yp=1;var a=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function l(o,r,u){var h=null;if(u!==void 0&&(h=""+u),r.key!==void 0&&(h=""+r.key),"key"in r){u={};for(var p in r)p!=="key"&&(u[p]=r[p])}else u=r;return r=u.ref,{$$typeof:a,type:o,key:h,ref:r!==void 0?r:null,props:u}}return is.Fragment=n,is.jsx=l,is.jsxs=l,is}var Pp;function Tx(){return Pp||(Pp=1,Uu.exports=Cx()),Uu.exports}var f=Tx(),T=db();const Qn=fb(T);var Ku={exports:{}},as={},Iu={exports:{}},Fu={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* scheduler.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var $p;function Mx(){return $p||($p=1,(function(a){function n(A,I){var J=A.length;A.push(I);e:for(;0<J;){var le=J-1>>>1,Z=A[le];if(0<r(Z,I))A[le]=I,A[J]=Z,J=le;else break e}}function l(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var I=A[0],J=A.pop();if(J!==I){A[0]=J;e:for(var le=0,Z=A.length,ye=Z>>>1;le<ye;){var xe=2*(le+1)-1,ce=A[xe],Te=xe+1,ue=A[Te];if(0>r(ce,J))Te<Z&&0>r(ue,ce)?(A[le]=ue,A[Te]=J,le=Te):(A[le]=ce,A[xe]=J,le=xe);else if(Te<Z&&0>r(ue,J))A[le]=ue,A[Te]=J,le=Te;else break e}}return I}function r(A,I){var J=A.sortIndex-I.sortIndex;return J!==0?J:A.id-I.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;a.unstable_now=function(){return u.now()}}else{var h=Date,p=h.now();a.unstable_now=function(){return h.now()-p}}var m=[],g=[],y=1,v=null,w=3,x=!1,S=!1,M=!1,E=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function H(A){for(var I=l(g);I!==null;){if(I.callback===null)o(g);else if(I.startTime<=A)o(g),I.sortIndex=I.expirationTime,n(m,I);else break;I=l(g)}}function j(A){if(M=!1,H(A),!S)if(l(m)!==null)S=!0,D||(D=!0,W());else{var I=l(g);I!==null&&P(j,I.startTime-A)}}var D=!1,_=-1,z=5,K=-1;function V(){return E?!0:!(a.unstable_now()-K<z)}function ne(){if(E=!1,D){var A=a.unstable_now();K=A;var I=!0;try{e:{S=!1,M&&(M=!1,N(_),_=-1),x=!0;var J=w;try{t:{for(H(A),v=l(m);v!==null&&!(v.expirationTime>A&&V());){var le=v.callback;if(typeof le=="function"){v.callback=null,w=v.priorityLevel;var Z=le(v.expirationTime<=A);if(A=a.unstable_now(),typeof Z=="function"){v.callback=Z,H(A),I=!0;break t}v===l(m)&&o(m),H(A)}else o(m);v=l(m)}if(v!==null)I=!0;else{var ye=l(g);ye!==null&&P(j,ye.startTime-A),I=!1}}break e}finally{v=null,w=J,x=!1}I=void 0}}finally{I?W():D=!1}}}var W;if(typeof R=="function")W=function(){R(ne)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,oe=ie.port2;ie.port1.onmessage=ne,W=function(){oe.postMessage(null)}}else W=function(){k(ne,0)};function P(A,I){_=k(function(){A(a.unstable_now())},I)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(A){A.callback=null},a.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<A?Math.floor(1e3/A):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(A){switch(w){case 1:case 2:case 3:var I=3;break;default:I=w}var J=w;w=I;try{return A()}finally{w=J}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function(A,I){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var J=w;w=A;try{return I()}finally{w=J}},a.unstable_scheduleCallback=function(A,I,J){var le=a.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?le+J:le):J=le,A){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=J+Z,A={id:y++,callback:I,priorityLevel:A,startTime:J,expirationTime:Z,sortIndex:-1},J>le?(A.sortIndex=J,n(g,A),l(m)===null&&A===l(g)&&(M?(N(_),_=-1):M=!0,P(j,J-le))):(A.sortIndex=Z,n(m,A),S||x||(S=!0,D||(D=!0,W()))),A},a.unstable_shouldYield=V,a.unstable_wrapCallback=function(A){var I=w;return function(){var J=w;w=I;try{return A.apply(this,arguments)}finally{w=J}}}})(Fu)),Fu}var qp;function Ax(){return qp||(qp=1,Iu.exports=Mx()),Iu.exports}/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react-dom-client.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var Vp;function Ex(){if(Vp)return as;Vp=1;var a=Ax(),n=db(),l=hb();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(u(e)!==e)throw Error(o(188))}function g(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(o(188));return t!==e?null:e}for(var i=e,s=t;;){var c=i.return;if(c===null)break;var d=c.alternate;if(d===null){if(s=c.return,s!==null){i=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===i)return m(c),e;if(d===s)return m(c),t;d=d.sibling}throw Error(o(188))}if(i.return!==s.return)i=c,s=d;else{for(var b=!1,C=c.child;C;){if(C===i){b=!0,i=c,s=d;break}if(C===s){b=!0,s=c,i=d;break}C=C.sibling}if(!b){for(C=d.child;C;){if(C===i){b=!0,i=d,s=c;break}if(C===s){b=!0,s=d,i=c;break}C=C.sibling}if(!b)throw Error(o(189))}}if(i.alternate!==s)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),R=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case k:return"Profiler";case E:return"StrictMode";case j:return"Suspense";case D:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case R:return e.displayName||"Context";case N:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var P=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},le=[],Z=-1;function ye(e){return{current:e}}function xe(e){0>Z||(e.current=le[Z],le[Z]=null,Z--)}function ce(e,t){Z++,le[Z]=e.current,e.current=t}var Te=ye(null),ue=ye(null),de=ye(null),se=ye(null);function ve(e,t){switch(ce(de,t),ce(ue,e),ce(Te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hp(t),e=mp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}xe(Te),ce(Te,e)}function ae(){xe(Te),xe(ue),xe(de)}function we(e){e.memoizedState!==null&&ce(se,e);var t=Te.current,i=mp(t,e.type);t!==i&&(ce(ue,e),ce(Te,i))}function Ae(e){ue.current===e&&(xe(Te),xe(ue)),se.current===e&&(xe(se),Jl._currentValue=J)}var De,rt;function tt(e){if(De===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||"",rt=-1<i.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+De+e+rt}var fe=!1;function Re(e,t){if(!e||fe)return"";fe=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch($){var Y=$}Reflect.construct(e,[],ee)}else{try{ee.call()}catch($){Y=$}e.call(ee.prototype)}}else{try{throw Error()}catch($){Y=$}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch($){if($&&Y&&typeof $.stack=="string")return[$.stack,Y.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),b=d[0],C=d[1];if(b&&C){var L=b.split(`
|
|
28
|
+
`),G=C.split(`
|
|
29
|
+
`);for(c=s=0;s<L.length&&!L[s].includes("DetermineComponentFrameRoot");)s++;for(;c<G.length&&!G[c].includes("DetermineComponentFrameRoot");)c++;if(s===L.length||c===G.length)for(s=L.length-1,c=G.length-1;1<=s&&0<=c&&L[s]!==G[c];)c--;for(;1<=s&&0<=c;s--,c--)if(L[s]!==G[c]){if(s!==1||c!==1)do if(s--,c--,0>c||L[s]!==G[c]){var X=`
|
|
30
|
+
`+L[s].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=s&&0<=c);break}}}finally{fe=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?tt(i):""}function Xe(e,t){switch(e.tag){case 26:case 27:case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return e.child!==t&&t!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return Re(e.type,!1);case 11:return Re(e.type.render,!1);case 1:return Re(e.type,!0);case 31:return tt("Activity");default:return""}}function gt(e){try{var t="",i=null;do t+=Xe(e,i),i=e,e=e.return;while(e);return t}catch(s){return`
|
|
31
|
+
Error generating stack: `+s.message+`
|
|
32
|
+
`+s.stack}}var ht=Object.prototype.hasOwnProperty,An=a.unstable_scheduleCallback,gn=a.unstable_cancelCallback,kt=a.unstable_shouldYield,Jn=a.unstable_requestPaint,Mt=a.unstable_now,As=a.unstable_getCurrentPriorityLevel,cl=a.unstable_ImmediatePriority,ul=a.unstable_UserBlockingPriority,Oi=a.unstable_NormalPriority,Es=a.unstable_LowPriority,dl=a.unstable_IdlePriority,Ns=a.log,ks=a.unstable_setDisableYieldValue,ei=null,Lt=null;function bn(e){if(typeof Ns=="function"&&ks(e),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(ei,e)}catch{}}var At=Math.clz32?Math.clz32:Xt,ge=Math.log,Ve=Math.LN2;function Xt(e){return e>>>=0,e===0?32:31-(ge(e)/Ve|0)|0}var Zt=256,ra=262144,ca=4194304;function En(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Di(e,t,i){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var C=s&134217727;return C!==0?(s=C&~d,s!==0?c=En(s):(b&=C,b!==0?c=En(b):i||(i=C&~e,i!==0&&(c=En(i))))):(C=s&~d,C!==0?c=En(C):b!==0?c=En(b):i||(i=s&~e,i!==0&&(c=En(i)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,i=t&-t,d>=i||d===32&&(i&4194048)!==0)?t:c}function fl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function s0(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qd(){var e=ca;return ca<<=1,(ca&62914560)===0&&(ca=4194304),e}function Er(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function hl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function o0(e,t,i,s,c,d){var b=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var C=e.entanglements,L=e.expirationTimes,G=e.hiddenUpdates;for(i=b&~i;0<i;){var X=31-At(i),ee=1<<X;C[X]=0,L[X]=-1;var Y=G[X];if(Y!==null)for(G[X]=null,X=0;X<Y.length;X++){var $=Y[X];$!==null&&($.lane&=-536870913)}i&=~ee}s!==0&&Vd(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Vd(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-At(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function Xd(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-At(i),c=1<<s;c&t|e[s]&t&&(e[s]|=t),i&=~c}}function Zd(e,t){var i=t&-t;return i=(i&42)!==0?1:Nr(i),(i&(e.suspendedLanes|t))!==0?0:i}function Nr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function kr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qd(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:Hp(e.type))}function Wd(e,t){var i=I.p;try{return I.p=e,t()}finally{I.p=i}}var ti=Math.random().toString(36).slice(2),xt="__reactFiber$"+ti,jt="__reactProps$"+ti,ua="__reactContainer$"+ti,Lr="__reactEvents$"+ti,r0="__reactListeners$"+ti,c0="__reactHandles$"+ti,Jd="__reactResources$"+ti,ml="__reactMarker$"+ti;function _r(e){delete e[xt],delete e[jt],delete e[Lr],delete e[r0],delete e[c0]}function da(e){var t=e[xt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[ua]||i[xt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=wp(e);e!==null;){if(i=e[xt])return i;e=wp(e)}return t}e=i,i=e.parentNode}return null}function fa(e){if(e=e[xt]||e[ua]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function pl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ha(e){var t=e[Jd];return t||(t=e[Jd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function bt(e){e[ml]=!0}var ef=new Set,tf={};function zi(e,t){ma(e,t),ma(e+"Capture",t)}function ma(e,t){for(tf[e]=t,e=0;e<t.length;e++)ef.add(t[e])}var u0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),nf={},af={};function d0(e){return ht.call(af,e)?!0:ht.call(nf,e)?!1:u0.test(e)?af[e]=!0:(nf[e]=!0,!1)}function Ls(e,t,i){if(d0(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function _s(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Nn(e,t,i,s){if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+s)}}function Qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function f0(e,t,i){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){i=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(b){i=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rr(e){if(!e._valueTracker){var t=lf(e)?"checked":"value";e._valueTracker=f0(e,t,""+e[t])}}function sf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=lf(e)?e.checked?"true":"false":e.value),e=s,e!==i?(t.setValue(e),!0):!1}function Rs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var h0=/[\n"\\]/g;function Wt(e){return e.replace(h0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function jr(e,t,i,s,c,d,b,C){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Qt(t)):e.value!==""+Qt(t)&&(e.value=""+Qt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Or(e,b,Qt(t)):i!=null?Or(e,b,Qt(i)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+Qt(C):e.removeAttribute("name")}function of(e,t,i,s,c,d,b,C){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||i!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){Rr(e);return}i=i!=null?""+Qt(i):"",t=t!=null?""+Qt(t):i,C||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=C?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),Rr(e)}function Or(e,t,i){t==="number"&&Rs(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function pa(e,t,i,s){if(e=e.options,t){t={};for(var c=0;c<i.length;c++)t["$"+i[c]]=!0;for(i=0;i<e.length;i++)c=t.hasOwnProperty("$"+e[i].value),e[i].selected!==c&&(e[i].selected=c),c&&s&&(e[i].defaultSelected=!0)}else{for(i=""+Qt(i),t=null,c=0;c<e.length;c++){if(e[c].value===i){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function rf(e,t,i){if(t!=null&&(t=""+Qt(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Qt(i):""}function cf(e,t,i,s){if(t==null){if(s!=null){if(i!=null)throw Error(o(92));if(P(s)){if(1<s.length)throw Error(o(93));s=s[0]}i=s}i==null&&(i=""),t=i}i=Qt(t),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),Rr(e)}function ga(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var m0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function uf(e,t,i){var s=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,i):typeof i!="number"||i===0||m0.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function df(e,t,i){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,i!=null){for(var s in i)!i.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&i[c]!==s&&uf(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&uf(e,d,t[d])}function Dr(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var p0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),g0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function js(e){return g0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function kn(){}var zr=null;function Hr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ba=null,ya=null;function ff(e){var t=fa(e);if(t&&(e=t.stateNode)){var i=e[jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(jr(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Wt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var s=i[t];if(s!==e&&s.form===e.form){var c=s[jt]||null;if(!c)throw Error(o(90));jr(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<i.length;t++)s=i[t],s.form===e.form&&sf(s)}break e;case"textarea":rf(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&pa(e,!!i.multiple,t,!1)}}}var Br=!1;function hf(e,t,i){if(Br)return e(t,i);Br=!0;try{var s=e(t);return s}finally{if(Br=!1,(ba!==null||ya!==null)&&(wo(),ba&&(t=ba,e=ya,ya=ba=null,ff(t),e)))for(t=0;t<e.length;t++)ff(e[t])}}function gl(e,t){var i=e.stateNode;if(i===null)return null;var s=i[jt]||null;if(s===null)return null;i=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(o(231,t,typeof i));return i}var Ln=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ur=!1;if(Ln)try{var bl={};Object.defineProperty(bl,"passive",{get:function(){Ur=!0}}),window.addEventListener("test",bl,bl),window.removeEventListener("test",bl,bl)}catch{Ur=!1}var ni=null,Kr=null,Os=null;function mf(){if(Os)return Os;var e,t=Kr,i=t.length,s,c="value"in ni?ni.value:ni.textContent,d=c.length;for(e=0;e<i&&t[e]===c[e];e++);var b=i-e;for(s=1;s<=b&&t[i-s]===c[d-s];s++);return Os=c.slice(e,1<s?1-s:void 0)}function Ds(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function zs(){return!0}function pf(){return!1}function Ot(e){function t(i,s,c,d,b){this._reactName=i,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(i=e[C],this[C]=i?i(d):d[C]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?zs:pf,this.isPropagationStopped=pf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=zs)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=zs)},persist:function(){},isPersistent:zs}),t}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hs=Ot(Hi),yl=v({},Hi,{view:0,detail:0}),b0=Ot(yl),Ir,Fr,vl,Bs=v({},yl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==vl&&(vl&&e.type==="mousemove"?(Ir=e.screenX-vl.screenX,Fr=e.screenY-vl.screenY):Fr=Ir=0,vl=e),Ir)},movementY:function(e){return"movementY"in e?e.movementY:Fr}}),gf=Ot(Bs),y0=v({},Bs,{dataTransfer:0}),v0=Ot(y0),x0=v({},yl,{relatedTarget:0}),Gr=Ot(x0),w0=v({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),S0=Ot(w0),C0=v({},Hi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),T0=Ot(C0),M0=v({},Hi,{data:0}),bf=Ot(M0),A0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E0={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"},N0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function k0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=N0[e])?!!t[e]:!1}function Yr(){return k0}var L0=v({},yl,{key:function(e){if(e.key){var t=A0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ds(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?E0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yr,charCode:function(e){return e.type==="keypress"?Ds(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ds(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),_0=Ot(L0),R0=v({},Bs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yf=Ot(R0),j0=v({},yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yr}),O0=Ot(j0),D0=v({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),z0=Ot(D0),H0=v({},Bs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),B0=Ot(H0),U0=v({},Hi,{newState:0,oldState:0}),K0=Ot(U0),I0=[9,13,27,32],Pr=Ln&&"CompositionEvent"in window,xl=null;Ln&&"documentMode"in document&&(xl=document.documentMode);var F0=Ln&&"TextEvent"in window&&!xl,vf=Ln&&(!Pr||xl&&8<xl&&11>=xl),xf=" ",wf=!1;function Sf(e,t){switch(e){case"keyup":return I0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var va=!1;function G0(e,t){switch(e){case"compositionend":return Cf(t);case"keypress":return t.which!==32?null:(wf=!0,xf);case"textInput":return e=t.data,e===xf&&wf?null:e;default:return null}}function Y0(e,t){if(va)return e==="compositionend"||!Pr&&Sf(e,t)?(e=mf(),Os=Kr=ni=null,va=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return vf&&t.locale!=="ko"?null:t.data;default:return null}}var P0={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 Tf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!P0[e.type]:t==="textarea"}function Mf(e,t,i,s){ba?ya?ya.push(s):ya=[s]:ba=s,t=No(t,"onChange"),0<t.length&&(i=new Hs("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var wl=null,Sl=null;function $0(e){op(e,0)}function Us(e){var t=pl(e);if(sf(t))return e}function Af(e,t){if(e==="change")return t}var Ef=!1;if(Ln){var $r;if(Ln){var qr="oninput"in document;if(!qr){var Nf=document.createElement("div");Nf.setAttribute("oninput","return;"),qr=typeof Nf.oninput=="function"}$r=qr}else $r=!1;Ef=$r&&(!document.documentMode||9<document.documentMode)}function kf(){wl&&(wl.detachEvent("onpropertychange",Lf),Sl=wl=null)}function Lf(e){if(e.propertyName==="value"&&Us(Sl)){var t=[];Mf(t,Sl,e,Hr(e)),hf($0,t)}}function q0(e,t,i){e==="focusin"?(kf(),wl=t,Sl=i,wl.attachEvent("onpropertychange",Lf)):e==="focusout"&&kf()}function V0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Us(Sl)}function X0(e,t){if(e==="click")return Us(t)}function Z0(e,t){if(e==="input"||e==="change")return Us(t)}function Q0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var It=typeof Object.is=="function"?Object.is:Q0;function Cl(e,t){if(It(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var c=i[s];if(!ht.call(t,c)||!It(e[c],t[c]))return!1}return!0}function _f(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Rf(e,t){var i=_f(e);e=0;for(var s;i;){if(i.nodeType===3){if(s=e+i.textContent.length,e<=t&&s>=t)return{node:i,offset:t-e};e=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=_f(i)}}function jf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Of(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rs(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=Rs(e.document)}return t}function Vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var W0=Ln&&"documentMode"in document&&11>=document.documentMode,xa=null,Xr=null,Tl=null,Zr=!1;function Df(e,t,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Zr||xa==null||xa!==Rs(s)||(s=xa,"selectionStart"in s&&Vr(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Tl&&Cl(Tl,s)||(Tl=s,s=No(Xr,"onSelect"),0<s.length&&(t=new Hs("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=xa)))}function Bi(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var wa={animationend:Bi("Animation","AnimationEnd"),animationiteration:Bi("Animation","AnimationIteration"),animationstart:Bi("Animation","AnimationStart"),transitionrun:Bi("Transition","TransitionRun"),transitionstart:Bi("Transition","TransitionStart"),transitioncancel:Bi("Transition","TransitionCancel"),transitionend:Bi("Transition","TransitionEnd")},Qr={},zf={};Ln&&(zf=document.createElement("div").style,"AnimationEvent"in window||(delete wa.animationend.animation,delete wa.animationiteration.animation,delete wa.animationstart.animation),"TransitionEvent"in window||delete wa.transitionend.transition);function Ui(e){if(Qr[e])return Qr[e];if(!wa[e])return e;var t=wa[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in zf)return Qr[e]=t[i];return e}var Hf=Ui("animationend"),Bf=Ui("animationiteration"),Uf=Ui("animationstart"),J0=Ui("transitionrun"),ev=Ui("transitionstart"),tv=Ui("transitioncancel"),Kf=Ui("transitionend"),If=new Map,Wr="abort auxClick beforeToggle 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(" ");Wr.push("scrollEnd");function fn(e,t){If.set(e,t),zi(t,[e])}var Ks=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Jt=[],Sa=0,Jr=0;function Is(){for(var e=Sa,t=Jr=Sa=0;t<e;){var i=Jt[t];Jt[t++]=null;var s=Jt[t];Jt[t++]=null;var c=Jt[t];Jt[t++]=null;var d=Jt[t];if(Jt[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}d!==0&&Ff(i,c,d)}}function Fs(e,t,i,s){Jt[Sa++]=e,Jt[Sa++]=t,Jt[Sa++]=i,Jt[Sa++]=s,Jr|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function ec(e,t,i,s){return Fs(e,t,i,s),Gs(e)}function Ki(e,t){return Fs(e,null,null,t),Gs(e)}function Ff(e,t,i){e.lanes|=i;var s=e.alternate;s!==null&&(s.lanes|=i);for(var c=!1,d=e.return;d!==null;)d.childLanes|=i,s=d.alternate,s!==null&&(s.childLanes|=i),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-At(i),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=i|536870912),d):null}function Gs(e){if(50<$l)throw $l=0,cu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ca={};function nv(e,t,i,s){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ft(e,t,i,s){return new nv(e,t,i,s)}function tc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,t){var i=e.alternate;return i===null?(i=Ft(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Gf(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ys(e,t,i,s,c,d){var b=0;if(s=e,typeof e=="function")tc(e)&&(b=1);else if(typeof e=="string")b=ox(e,i,Te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Ft(31,i,t,c),e.elementType=K,e.lanes=d,e;case M:return Ii(i.children,c,d,t);case E:b=8,c|=24;break;case k:return e=Ft(12,i,t,c|2),e.elementType=k,e.lanes=d,e;case j:return e=Ft(13,i,t,c),e.elementType=j,e.lanes=d,e;case D:return e=Ft(19,i,t,c),e.elementType=D,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case R:b=10;break e;case N:b=9;break e;case H:b=11;break e;case _:b=14;break e;case z:b=16,s=null;break e}b=29,i=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=Ft(b,i,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function Ii(e,t,i,s){return e=Ft(7,e,s,t),e.lanes=i,e}function nc(e,t,i){return e=Ft(6,e,null,t),e.lanes=i,e}function Yf(e){var t=Ft(18,null,null,0);return t.stateNode=e,t}function ic(e,t,i){return t=Ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Pf=new WeakMap;function en(e,t){if(typeof e=="object"&&e!==null){var i=Pf.get(e);return i!==void 0?i:(t={value:e,source:t,stack:gt(t)},Pf.set(e,t),t)}return{value:e,source:t,stack:gt(t)}}var Ta=[],Ma=0,Ps=null,Ml=0,tn=[],nn=0,ii=null,yn=1,vn="";function Rn(e,t){Ta[Ma++]=Ml,Ta[Ma++]=Ps,Ps=e,Ml=t}function $f(e,t,i){tn[nn++]=yn,tn[nn++]=vn,tn[nn++]=ii,ii=e;var s=yn;e=vn;var c=32-At(s)-1;s&=~(1<<c),i+=1;var d=32-At(t)+c;if(30<d){var b=c-c%5;d=(s&(1<<b)-1).toString(32),s>>=b,c-=b,yn=1<<32-At(t)+c|i<<c|s,vn=d+e}else yn=1<<d|i<<c|s,vn=e}function ac(e){e.return!==null&&(Rn(e,1),$f(e,1,0))}function lc(e){for(;e===Ps;)Ps=Ta[--Ma],Ta[Ma]=null,Ml=Ta[--Ma],Ta[Ma]=null;for(;e===ii;)ii=tn[--nn],tn[nn]=null,vn=tn[--nn],tn[nn]=null,yn=tn[--nn],tn[nn]=null}function qf(e,t){tn[nn++]=yn,tn[nn++]=vn,tn[nn++]=ii,yn=t.id,vn=t.overflow,ii=e}var wt=null,Ze=null,Be=!1,ai=null,an=!1,sc=Error(o(519));function li(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Al(en(t,e)),sc}function Vf(e){var t=e.stateNode,i=e.type,s=e.memoizedProps;switch(t[xt]=e,t[jt]=s,i){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(i=0;i<Vl.length;i++)Oe(Vl[i],t);break;case"source":Oe("error",t);break;case"img":case"image":case"link":Oe("error",t),Oe("load",t);break;case"details":Oe("toggle",t);break;case"input":Oe("invalid",t),of(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),cf(t,s.value,s.defaultValue,s.children)}i=s.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||s.suppressHydrationWarning===!0||dp(t.textContent,i)?(s.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),s.onScroll!=null&&Oe("scroll",t),s.onScrollEnd!=null&&Oe("scrollend",t),s.onClick!=null&&(t.onclick=kn),t=!0):t=!1,t||li(e,!0)}function Xf(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:an=!1;return;case 27:case 3:an=!0;return;default:wt=wt.return}}function Aa(e){if(e!==wt)return!1;if(!Be)return Xf(e),Be=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Tu(e.type,e.memoizedProps)),i=!i),i&&Ze&&li(e),Xf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=xp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=xp(e)}else t===27?(t=Ze,vi(e.type)?(e=ku,ku=null,Ze=e):Ze=t):Ze=wt?sn(e.stateNode.nextSibling):null;return!0}function Fi(){Ze=wt=null,Be=!1}function oc(){var e=ai;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),ai=null),e}function Al(e){ai===null?ai=[e]:ai.push(e)}var rc=ye(null),Gi=null,jn=null;function si(e,t,i){ce(rc,t._currentValue),t._currentValue=i}function On(e){e._currentValue=rc.current,xe(rc)}function cc(e,t,i){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===i)break;e=e.return}}function uc(e,t,i,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var b=c.child;d=d.firstContext;e:for(;d!==null;){var C=d;d=c;for(var L=0;L<t.length;L++)if(C.context===t[L]){d.lanes|=i,C=d.alternate,C!==null&&(C.lanes|=i),cc(d.return,i,e),s||(b=null);break e}d=C.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=i,d=b.alternate,d!==null&&(d.lanes|=i),cc(b,i,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Ea(e,t,i,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var C=c.type;It(c.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(c===se.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(Jl):e=[Jl])}c=c.return}e!==null&&uc(t,e,i,s),t.flags|=262144}function $s(e){for(e=e.firstContext;e!==null;){if(!It(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Gi=e,jn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return Zf(Gi,e)}function qs(e,t){return Gi===null&&Yi(e),Zf(e,t)}function Zf(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},jn===null){if(e===null)throw Error(o(308));jn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else jn=jn.next=t;return i}var iv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},av=a.unstable_scheduleCallback,lv=a.unstable_NormalPriority,ct={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function dc(){return{controller:new iv,data:new Map,refCount:0}}function El(e){e.refCount--,e.refCount===0&&av(lv,function(){e.controller.abort()})}var Nl=null,fc=0,Na=0,ka=null;function sv(e,t){if(Nl===null){var i=Nl=[];fc=0,Na=pu(),ka={status:"pending",value:void 0,then:function(s){i.push(s)}}}return fc++,t.then(Qf,Qf),t}function Qf(){if(--fc===0&&Nl!==null){ka!==null&&(ka.status="fulfilled");var e=Nl;Nl=null,Na=0,ka=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ov(e,t){var i=[],s={status:"pending",value:null,reason:null,then:function(c){i.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<i.length;c++)(0,i[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<i.length;c++)(0,i[c])(void 0)}),s}var Wf=A.S;A.S=function(e,t){Dm=Mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&sv(e,t),Wf!==null&&Wf(e,t)};var Pi=ye(null);function hc(){var e=Pi.current;return e!==null?e:qe.pooledCache}function Vs(e,t){t===null?ce(Pi,Pi.current):ce(Pi,t.pool)}function Jf(){var e=hc();return e===null?null:{parent:ct._currentValue,pool:e}}var La=Error(o(460)),mc=Error(o(474)),Xs=Error(o(542)),Zs={then:function(){}};function eh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function th(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(kn,kn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ih(e),e;default:if(typeof t.status=="string")t.then(kn,kn);else{if(e=qe,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ih(e),e}throw qi=t,La}}function $i(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(qi=i,La):i}}var qi=null;function nh(){if(qi===null)throw Error(o(459));var e=qi;return qi=null,e}function ih(e){if(e===La||e===Xs)throw Error(o(483))}var _a=null,kl=0;function Qs(e){var t=kl;return kl+=1,_a===null&&(_a=[]),th(_a,e,t)}function Ll(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ws(e,t){throw t.$$typeof===w?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function ah(e){function t(U,O){if(e){var F=U.deletions;F===null?(U.deletions=[O],U.flags|=16):F.push(O)}}function i(U,O){if(!e)return null;for(;O!==null;)t(U,O),O=O.sibling;return null}function s(U){for(var O=new Map;U!==null;)U.key!==null?O.set(U.key,U):O.set(U.index,U),U=U.sibling;return O}function c(U,O){return U=_n(U,O),U.index=0,U.sibling=null,U}function d(U,O,F){return U.index=F,e?(F=U.alternate,F!==null?(F=F.index,F<O?(U.flags|=67108866,O):F):(U.flags|=67108866,O)):(U.flags|=1048576,O)}function b(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function C(U,O,F,Q){return O===null||O.tag!==6?(O=nc(F,U.mode,Q),O.return=U,O):(O=c(O,F),O.return=U,O)}function L(U,O,F,Q){var Se=F.type;return Se===M?X(U,O,F.props.children,Q,F.key):O!==null&&(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===z&&$i(Se)===O.type)?(O=c(O,F.props),Ll(O,F),O.return=U,O):(O=Ys(F.type,F.key,F.props,null,U.mode,Q),Ll(O,F),O.return=U,O)}function G(U,O,F,Q){return O===null||O.tag!==4||O.stateNode.containerInfo!==F.containerInfo||O.stateNode.implementation!==F.implementation?(O=ic(F,U.mode,Q),O.return=U,O):(O=c(O,F.children||[]),O.return=U,O)}function X(U,O,F,Q,Se){return O===null||O.tag!==7?(O=Ii(F,U.mode,Q,Se),O.return=U,O):(O=c(O,F),O.return=U,O)}function ee(U,O,F){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=nc(""+O,U.mode,F),O.return=U,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case x:return F=Ys(O.type,O.key,O.props,null,U.mode,F),Ll(F,O),F.return=U,F;case S:return O=ic(O,U.mode,F),O.return=U,O;case z:return O=$i(O),ee(U,O,F)}if(P(O)||W(O))return O=Ii(O,U.mode,F,null),O.return=U,O;if(typeof O.then=="function")return ee(U,Qs(O),F);if(O.$$typeof===R)return ee(U,qs(U,O),F);Ws(U,O)}return null}function Y(U,O,F,Q){var Se=O!==null?O.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Se!==null?null:C(U,O,""+F,Q);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case x:return F.key===Se?L(U,O,F,Q):null;case S:return F.key===Se?G(U,O,F,Q):null;case z:return F=$i(F),Y(U,O,F,Q)}if(P(F)||W(F))return Se!==null?null:X(U,O,F,Q,null);if(typeof F.then=="function")return Y(U,O,Qs(F),Q);if(F.$$typeof===R)return Y(U,O,qs(U,F),Q);Ws(U,F)}return null}function $(U,O,F,Q,Se){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return U=U.get(F)||null,C(O,U,""+Q,Se);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case x:return U=U.get(Q.key===null?F:Q.key)||null,L(O,U,Q,Se);case S:return U=U.get(Q.key===null?F:Q.key)||null,G(O,U,Q,Se);case z:return Q=$i(Q),$(U,O,F,Q,Se)}if(P(Q)||W(Q))return U=U.get(F)||null,X(O,U,Q,Se,null);if(typeof Q.then=="function")return $(U,O,F,Qs(Q),Se);if(Q.$$typeof===R)return $(U,O,F,qs(O,Q),Se);Ws(O,Q)}return null}function pe(U,O,F,Q){for(var Se=null,Ue=null,be=O,Le=O=0,He=null;be!==null&&Le<F.length;Le++){be.index>Le?(He=be,be=null):He=be.sibling;var Ke=Y(U,be,F[Le],Q);if(Ke===null){be===null&&(be=He);break}e&&be&&Ke.alternate===null&&t(U,be),O=d(Ke,O,Le),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke,be=He}if(Le===F.length)return i(U,be),Be&&Rn(U,Le),Se;if(be===null){for(;Le<F.length;Le++)be=ee(U,F[Le],Q),be!==null&&(O=d(be,O,Le),Ue===null?Se=be:Ue.sibling=be,Ue=be);return Be&&Rn(U,Le),Se}for(be=s(be);Le<F.length;Le++)He=$(be,U,Le,F[Le],Q),He!==null&&(e&&He.alternate!==null&&be.delete(He.key===null?Le:He.key),O=d(He,O,Le),Ue===null?Se=He:Ue.sibling=He,Ue=He);return e&&be.forEach(function(Ti){return t(U,Ti)}),Be&&Rn(U,Le),Se}function Ce(U,O,F,Q){if(F==null)throw Error(o(151));for(var Se=null,Ue=null,be=O,Le=O=0,He=null,Ke=F.next();be!==null&&!Ke.done;Le++,Ke=F.next()){be.index>Le?(He=be,be=null):He=be.sibling;var Ti=Y(U,be,Ke.value,Q);if(Ti===null){be===null&&(be=He);break}e&&be&&Ti.alternate===null&&t(U,be),O=d(Ti,O,Le),Ue===null?Se=Ti:Ue.sibling=Ti,Ue=Ti,be=He}if(Ke.done)return i(U,be),Be&&Rn(U,Le),Se;if(be===null){for(;!Ke.done;Le++,Ke=F.next())Ke=ee(U,Ke.value,Q),Ke!==null&&(O=d(Ke,O,Le),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke);return Be&&Rn(U,Le),Se}for(be=s(be);!Ke.done;Le++,Ke=F.next())Ke=$(be,U,Le,Ke.value,Q),Ke!==null&&(e&&Ke.alternate!==null&&be.delete(Ke.key===null?Le:Ke.key),O=d(Ke,O,Le),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke);return e&&be.forEach(function(yx){return t(U,yx)}),Be&&Rn(U,Le),Se}function $e(U,O,F,Q){if(typeof F=="object"&&F!==null&&F.type===M&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case x:e:{for(var Se=F.key;O!==null;){if(O.key===Se){if(Se=F.type,Se===M){if(O.tag===7){i(U,O.sibling),Q=c(O,F.props.children),Q.return=U,U=Q;break e}}else if(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===z&&$i(Se)===O.type){i(U,O.sibling),Q=c(O,F.props),Ll(Q,F),Q.return=U,U=Q;break e}i(U,O);break}else t(U,O);O=O.sibling}F.type===M?(Q=Ii(F.props.children,U.mode,Q,F.key),Q.return=U,U=Q):(Q=Ys(F.type,F.key,F.props,null,U.mode,Q),Ll(Q,F),Q.return=U,U=Q)}return b(U);case S:e:{for(Se=F.key;O!==null;){if(O.key===Se)if(O.tag===4&&O.stateNode.containerInfo===F.containerInfo&&O.stateNode.implementation===F.implementation){i(U,O.sibling),Q=c(O,F.children||[]),Q.return=U,U=Q;break e}else{i(U,O);break}else t(U,O);O=O.sibling}Q=ic(F,U.mode,Q),Q.return=U,U=Q}return b(U);case z:return F=$i(F),$e(U,O,F,Q)}if(P(F))return pe(U,O,F,Q);if(W(F)){if(Se=W(F),typeof Se!="function")throw Error(o(150));return F=Se.call(F),Ce(U,O,F,Q)}if(typeof F.then=="function")return $e(U,O,Qs(F),Q);if(F.$$typeof===R)return $e(U,O,qs(U,F),Q);Ws(U,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,O!==null&&O.tag===6?(i(U,O.sibling),Q=c(O,F),Q.return=U,U=Q):(i(U,O),Q=nc(F,U.mode,Q),Q.return=U,U=Q),b(U)):i(U,O)}return function(U,O,F,Q){try{kl=0;var Se=$e(U,O,F,Q);return _a=null,Se}catch(be){if(be===La||be===Xs)throw be;var Ue=Ft(29,be,null,U.mode);return Ue.lanes=Q,Ue.return=U,Ue}finally{}}}var Vi=ah(!0),lh=ah(!1),oi=!1;function pc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ri(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ci(e,t,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Gs(e),Ff(e,null,i),t}return Fs(e,s,t,i),Gs(e)}function _l(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Xd(e,i)}}function bc(e,t){var i=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var c=null,d=null;if(i=i.firstBaseUpdate,i!==null){do{var b={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};d===null?c=d=b:d=d.next=b,i=i.next}while(i!==null);d===null?c=d=t:d=d.next=t}else c=d=t;i={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:s.shared,callbacks:s.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var yc=!1;function Rl(){if(yc){var e=ka;if(e!==null)throw e}}function jl(e,t,i,s){yc=!1;var c=e.updateQueue;oi=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var L=C,G=L.next;L.next=null,b===null?d=G:b.next=G,b=L;var X=e.alternate;X!==null&&(X=X.updateQueue,C=X.lastBaseUpdate,C!==b&&(C===null?X.firstBaseUpdate=G:C.next=G,X.lastBaseUpdate=L))}if(d!==null){var ee=c.baseState;b=0,X=G=L=null,C=d;do{var Y=C.lane&-536870913,$=Y!==C.lane;if($?(ze&Y)===Y:(s&Y)===Y){Y!==0&&Y===Na&&(yc=!0),X!==null&&(X=X.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var pe=e,Ce=C;Y=t;var $e=i;switch(Ce.tag){case 1:if(pe=Ce.payload,typeof pe=="function"){ee=pe.call($e,ee,Y);break e}ee=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=Ce.payload,Y=typeof pe=="function"?pe.call($e,ee,Y):pe,Y==null)break e;ee=v({},ee,Y);break e;case 2:oi=!0}}Y=C.callback,Y!==null&&(e.flags|=64,$&&(e.flags|=8192),$=c.callbacks,$===null?c.callbacks=[Y]:$.push(Y))}else $={lane:Y,tag:C.tag,payload:C.payload,callback:C.callback,next:null},X===null?(G=X=$,L=ee):X=X.next=$,b|=Y;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;$=C,C=$.next,$.next=null,c.lastBaseUpdate=$,c.shared.pending=null}}while(!0);X===null&&(L=ee),c.baseState=L,c.firstBaseUpdate=G,c.lastBaseUpdate=X,d===null&&(c.shared.lanes=0),mi|=b,e.lanes=b,e.memoizedState=ee}}function sh(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function oh(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)sh(i[e],t)}var Ra=ye(null),Js=ye(0);function rh(e,t){e=Gn,ce(Js,e),ce(Ra,t),Gn=e|t.baseLanes}function vc(){ce(Js,Gn),ce(Ra,Ra.current)}function xc(){Gn=Js.current,xe(Ra),xe(Js)}var Gt=ye(null),ln=null;function ui(e){var t=e.alternate;ce(lt,lt.current&1),ce(Gt,e),ln===null&&(t===null||Ra.current!==null||t.memoizedState!==null)&&(ln=e)}function wc(e){ce(lt,lt.current),ce(Gt,e),ln===null&&(ln=e)}function ch(e){e.tag===22?(ce(lt,lt.current),ce(Gt,e),ln===null&&(ln=e)):di()}function di(){ce(lt,lt.current),ce(Gt,Gt.current)}function Yt(e){xe(Gt),ln===e&&(ln=null),xe(lt)}var lt=ye(0);function eo(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Eu(i)||Nu(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Dn=0,ke=null,Ye=null,ut=null,to=!1,ja=!1,Xi=!1,no=0,Ol=0,Oa=null,rv=0;function it(){throw Error(o(321))}function Sc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!It(e[i],t[i]))return!1;return!0}function Cc(e,t,i,s,c,d){return Dn=d,ke=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?$h:Bc,Xi=!1,d=i(s,c),Xi=!1,ja&&(d=dh(t,i,s,c)),uh(e),d}function uh(e){A.H=Hl;var t=Ye!==null&&Ye.next!==null;if(Dn=0,ut=Ye=ke=null,to=!1,Ol=0,Oa=null,t)throw Error(o(300));e===null||dt||(e=e.dependencies,e!==null&&$s(e)&&(dt=!0))}function dh(e,t,i,s){ke=e;var c=0;do{if(ja&&(Oa=null),Ol=0,ja=!1,25<=c)throw Error(o(301));if(c+=1,ut=Ye=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}A.H=qh,d=t(i,s)}while(ja);return d}function cv(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?Dl(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(ke.flags|=1024),t}function Tc(){var e=no!==0;return no=0,e}function Mc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Ac(e){if(to){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}to=!1}Dn=0,ut=Ye=ke=null,ja=!1,Ol=no=0,Oa=null}function _t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?ke.memoizedState=ut=e:ut=ut.next=e,ut}function st(){if(Ye===null){var e=ke.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=ut===null?ke.memoizedState:ut.next;if(t!==null)ut=t,Ye=e;else{if(e===null)throw ke.alternate===null?Error(o(467)):Error(o(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},ut===null?ke.memoizedState=ut=e:ut=ut.next=e}return ut}function io(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dl(e){var t=Ol;return Ol+=1,Oa===null&&(Oa=[]),e=th(Oa,e,t),t=ke,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?$h:Bc),e}function ao(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Dl(e);if(e.$$typeof===R)return St(e)}throw Error(o(438,String(e)))}function Ec(e){var t=null,i=ke.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var s=ke.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=io(),ke.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),s=0;s<e;s++)i[s]=V;return t.index++,i}function zn(e,t){return typeof t=="function"?t(e):t}function lo(e){var t=st();return Nc(t,Ye,e)}function Nc(e,t,i){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=i;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var b=c.next;c.next=d.next,d.next=b}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var C=b=null,L=null,G=t,X=!1;do{var ee=G.lane&-536870913;if(ee!==G.lane?(ze&ee)===ee:(Dn&ee)===ee){var Y=G.revertLane;if(Y===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ee===Na&&(X=!0);else if((Dn&Y)===Y){G=G.next,Y===Na&&(X=!0);continue}else ee={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},L===null?(C=L=ee,b=d):L=L.next=ee,ke.lanes|=Y,mi|=Y;ee=G.action,Xi&&i(d,ee),d=G.hasEagerState?G.eagerState:i(d,ee)}else Y={lane:ee,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},L===null?(C=L=Y,b=d):L=L.next=Y,ke.lanes|=ee,mi|=ee;G=G.next}while(G!==null&&G!==t);if(L===null?b=d:L.next=C,!It(d,e.memoizedState)&&(dt=!0,X&&(i=ka,i!==null)))throw i;e.memoizedState=d,e.baseState=b,e.baseQueue=L,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function kc(e){var t=st(),i=t.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=e;var s=i.dispatch,c=i.pending,d=t.memoizedState;if(c!==null){i.pending=null;var b=c=c.next;do d=e(d,b.action),b=b.next;while(b!==c);It(d,t.memoizedState)||(dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),i.lastRenderedState=d}return[d,s]}function fh(e,t,i){var s=ke,c=st(),d=Be;if(d){if(i===void 0)throw Error(o(407));i=i()}else i=t();var b=!It((Ye||c).memoizedState,i);if(b&&(c.memoizedState=i,dt=!0),c=c.queue,Rc(ph.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||ut!==null&&ut.memoizedState.tag&1){if(s.flags|=2048,Da(9,{destroy:void 0},mh.bind(null,s,c,i,t),null),qe===null)throw Error(o(349));d||(Dn&127)!==0||hh(s,t,i)}return i}function hh(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=ke.updateQueue,t===null?(t=io(),ke.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function mh(e,t,i,s){t.value=i,t.getSnapshot=s,gh(t)&&bh(e)}function ph(e,t,i){return i(function(){gh(t)&&bh(e)})}function gh(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!It(e,i)}catch{return!0}}function bh(e){var t=Ki(e,2);t!==null&&Ut(t,e,2)}function Lc(e){var t=_t();if(typeof e=="function"){var i=e;if(e=i(),Xi){bn(!0);try{i()}finally{bn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zn,lastRenderedState:e},t}function yh(e,t,i,s){return e.baseState=i,Nc(e,Ye,typeof s=="function"?s:zn)}function uv(e,t,i,s,c){if(ro(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};A.T!==null?i(!0):d.isTransition=!1,s(d),i=t.pending,i===null?(d.next=t.pending=d,vh(t,d)):(d.next=i.next,t.pending=i.next=d)}}function vh(e,t){var i=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=A.T,b={};A.T=b;try{var C=i(c,s),L=A.S;L!==null&&L(b,C),xh(e,t,C)}catch(G){_c(e,t,G)}finally{d!==null&&b.types!==null&&(d.types=b.types),A.T=d}}else try{d=i(c,s),xh(e,t,d)}catch(G){_c(e,t,G)}}function xh(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){wh(e,t,s)},function(s){return _c(e,t,s)}):wh(e,t,i)}function wh(e,t,i){t.status="fulfilled",t.value=i,Sh(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,vh(e,i)))}function _c(e,t,i){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=i,Sh(t),t=t.next;while(t!==s)}e.action=null}function Sh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ch(e,t){return t}function Th(e,t){if(Be){var i=qe.formState;if(i!==null){e:{var s=ke;if(Be){if(Ze){t:{for(var c=Ze,d=an;c.nodeType!==8;){if(!d){c=null;break t}if(c=sn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Ze=sn(c.nextSibling),s=c.data==="F!";break e}}li(s)}s=!1}s&&(t=i[0])}}return i=_t(),i.memoizedState=i.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ch,lastRenderedState:t},i.queue=s,i=Gh.bind(null,ke,s),s.dispatch=i,s=Lc(!1),d=Hc.bind(null,ke,!1,s.queue),s=_t(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,i=uv.bind(null,ke,c,d,i),c.dispatch=i,s.memoizedState=e,[t,i,!1]}function Mh(e){var t=st();return Ah(t,Ye,e)}function Ah(e,t,i){if(t=Nc(e,t,Ch)[0],e=lo(zn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Dl(t)}catch(b){throw b===La?Xs:b}else s=t;t=st();var c=t.queue,d=c.dispatch;return i!==t.memoizedState&&(ke.flags|=2048,Da(9,{destroy:void 0},dv.bind(null,c,i),null)),[s,d,e]}function dv(e,t){e.action=t}function Eh(e){var t=st(),i=Ye;if(i!==null)return Ah(t,i,e);st(),t=t.memoizedState,i=st();var s=i.queue.dispatch;return i.memoizedState=e,[t,s,!1]}function Da(e,t,i,s){return e={tag:e,create:i,deps:s,inst:t,next:null},t=ke.updateQueue,t===null&&(t=io(),ke.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e),e}function Nh(){return st().memoizedState}function so(e,t,i,s){var c=_t();ke.flags|=e,c.memoizedState=Da(1|t,{destroy:void 0},i,s===void 0?null:s)}function oo(e,t,i,s){var c=st();s=s===void 0?null:s;var d=c.memoizedState.inst;Ye!==null&&s!==null&&Sc(s,Ye.memoizedState.deps)?c.memoizedState=Da(t,d,i,s):(ke.flags|=e,c.memoizedState=Da(1|t,d,i,s))}function kh(e,t){so(8390656,8,e,t)}function Rc(e,t){oo(2048,8,e,t)}function fv(e){ke.flags|=4;var t=ke.updateQueue;if(t===null)t=io(),ke.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Lh(e){var t=st().memoizedState;return fv({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function _h(e,t){return oo(4,2,e,t)}function Rh(e,t){return oo(4,4,e,t)}function jh(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Oh(e,t,i){i=i!=null?i.concat([e]):null,oo(4,4,jh.bind(null,t,e),i)}function jc(){}function Dh(e,t){var i=st();t=t===void 0?null:t;var s=i.memoizedState;return t!==null&&Sc(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function zh(e,t){var i=st();t=t===void 0?null:t;var s=i.memoizedState;if(t!==null&&Sc(t,s[1]))return s[0];if(s=e(),Xi){bn(!0);try{e()}finally{bn(!1)}}return i.memoizedState=[s,t],s}function Oc(e,t,i){return i===void 0||(Dn&1073741824)!==0&&(ze&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Hm(),ke.lanes|=e,mi|=e,i)}function Hh(e,t,i,s){return It(i,t)?i:Ra.current!==null?(e=Oc(e,i,s),It(e,t)||(dt=!0),e):(Dn&42)===0||(Dn&1073741824)!==0&&(ze&261930)===0?(dt=!0,e.memoizedState=i):(e=Hm(),ke.lanes|=e,mi|=e,t)}function Bh(e,t,i,s,c){var d=I.p;I.p=d!==0&&8>d?d:8;var b=A.T,C={};A.T=C,Hc(e,!1,t,i);try{var L=c(),G=A.S;if(G!==null&&G(C,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var X=ov(L,s);zl(e,t,X,qt(e))}else zl(e,t,s,qt(e))}catch(ee){zl(e,t,{then:function(){},status:"rejected",reason:ee},qt())}finally{I.p=d,b!==null&&C.types!==null&&(b.types=C.types),A.T=b}}function hv(){}function Dc(e,t,i,s){if(e.tag!==5)throw Error(o(476));var c=Uh(e).queue;Bh(e,c,t,J,i===null?hv:function(){return Kh(e),i(s)})}function Uh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zn,lastRenderedState:J},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Kh(e){var t=Uh(e);t.next===null&&(t=e.alternate.memoizedState),zl(e,t.next.queue,{},qt())}function zc(){return St(Jl)}function Ih(){return st().memoizedState}function Fh(){return st().memoizedState}function mv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=qt();e=ri(i);var s=ci(t,e,i);s!==null&&(Ut(s,t,i),_l(s,t,i)),t={cache:dc()},e.payload=t;return}t=t.return}}function pv(e,t,i){var s=qt();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},ro(e)?Yh(t,i):(i=ec(e,t,i,s),i!==null&&(Ut(i,e,s),Ph(i,t,s)))}function Gh(e,t,i){var s=qt();zl(e,t,i,s)}function zl(e,t,i,s){var c={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(ro(e))Yh(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,C=d(b,i);if(c.hasEagerState=!0,c.eagerState=C,It(C,b))return Fs(e,t,c,0),qe===null&&Is(),!1}catch{}finally{}if(i=ec(e,t,c,s),i!==null)return Ut(i,e,s),Ph(i,t,s),!0}return!1}function Hc(e,t,i,s){if(s={lane:2,revertLane:pu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ro(e)){if(t)throw Error(o(479))}else t=ec(e,i,s,2),t!==null&&Ut(t,e,2)}function ro(e){var t=e.alternate;return e===ke||t!==null&&t===ke}function Yh(e,t){ja=to=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Ph(e,t,i){if((i&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Xd(e,i)}}var Hl={readContext:St,use:ao,useCallback:it,useContext:it,useEffect:it,useImperativeHandle:it,useLayoutEffect:it,useInsertionEffect:it,useMemo:it,useReducer:it,useRef:it,useState:it,useDebugValue:it,useDeferredValue:it,useTransition:it,useSyncExternalStore:it,useId:it,useHostTransitionStatus:it,useFormState:it,useActionState:it,useOptimistic:it,useMemoCache:it,useCacheRefresh:it};Hl.useEffectEvent=it;var $h={readContext:St,use:ao,useCallback:function(e,t){return _t().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:kh,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,so(4194308,4,jh.bind(null,t,e),i)},useLayoutEffect:function(e,t){return so(4194308,4,e,t)},useInsertionEffect:function(e,t){so(4,2,e,t)},useMemo:function(e,t){var i=_t();t=t===void 0?null:t;var s=e();if(Xi){bn(!0);try{e()}finally{bn(!1)}}return i.memoizedState=[s,t],s},useReducer:function(e,t,i){var s=_t();if(i!==void 0){var c=i(t);if(Xi){bn(!0);try{i(t)}finally{bn(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=pv.bind(null,ke,e),[s.memoizedState,e]},useRef:function(e){var t=_t();return e={current:e},t.memoizedState=e},useState:function(e){e=Lc(e);var t=e.queue,i=Gh.bind(null,ke,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:jc,useDeferredValue:function(e,t){var i=_t();return Oc(i,e,t)},useTransition:function(){var e=Lc(!1);return e=Bh.bind(null,ke,e.queue,!0,!1),_t().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var s=ke,c=_t();if(Be){if(i===void 0)throw Error(o(407));i=i()}else{if(i=t(),qe===null)throw Error(o(349));(ze&127)!==0||hh(s,t,i)}c.memoizedState=i;var d={value:i,getSnapshot:t};return c.queue=d,kh(ph.bind(null,s,d,e),[e]),s.flags|=2048,Da(9,{destroy:void 0},mh.bind(null,s,d,i,t),null),i},useId:function(){var e=_t(),t=qe.identifierPrefix;if(Be){var i=vn,s=yn;i=(s&~(1<<32-At(s)-1)).toString(32)+i,t="_"+t+"R_"+i,i=no++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=rv++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zc,useFormState:Th,useActionState:Th,useOptimistic:function(e){var t=_t();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=Hc.bind(null,ke,!0,i),i.dispatch=t,[e,t]},useMemoCache:Ec,useCacheRefresh:function(){return _t().memoizedState=mv.bind(null,ke)},useEffectEvent:function(e){var t=_t(),i={impl:e};return t.memoizedState=i,function(){if((Ie&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Bc={readContext:St,use:ao,useCallback:Dh,useContext:St,useEffect:Rc,useImperativeHandle:Oh,useInsertionEffect:_h,useLayoutEffect:Rh,useMemo:zh,useReducer:lo,useRef:Nh,useState:function(){return lo(zn)},useDebugValue:jc,useDeferredValue:function(e,t){var i=st();return Hh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=lo(zn)[0],t=st().memoizedState;return[typeof e=="boolean"?e:Dl(e),t]},useSyncExternalStore:fh,useId:Ih,useHostTransitionStatus:zc,useFormState:Mh,useActionState:Mh,useOptimistic:function(e,t){var i=st();return yh(i,Ye,e,t)},useMemoCache:Ec,useCacheRefresh:Fh};Bc.useEffectEvent=Lh;var qh={readContext:St,use:ao,useCallback:Dh,useContext:St,useEffect:Rc,useImperativeHandle:Oh,useInsertionEffect:_h,useLayoutEffect:Rh,useMemo:zh,useReducer:kc,useRef:Nh,useState:function(){return kc(zn)},useDebugValue:jc,useDeferredValue:function(e,t){var i=st();return Ye===null?Oc(i,e,t):Hh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=kc(zn)[0],t=st().memoizedState;return[typeof e=="boolean"?e:Dl(e),t]},useSyncExternalStore:fh,useId:Ih,useHostTransitionStatus:zc,useFormState:Eh,useActionState:Eh,useOptimistic:function(e,t){var i=st();return Ye!==null?yh(i,Ye,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Ec,useCacheRefresh:Fh};qh.useEffectEvent=Lh;function Uc(e,t,i,s){t=e.memoizedState,i=i(s,t),i=i==null?t:v({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Kc={enqueueSetState:function(e,t,i){e=e._reactInternals;var s=qt(),c=ri(s);c.payload=t,i!=null&&(c.callback=i),t=ci(e,c,s),t!==null&&(Ut(t,e,s),_l(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=qt(),c=ri(s);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=ci(e,c,s),t!==null&&(Ut(t,e,s),_l(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=qt(),s=ri(i);s.tag=2,t!=null&&(s.callback=t),t=ci(e,s,i),t!==null&&(Ut(t,e,i),_l(t,e,i))}};function Vh(e,t,i,s,c,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!Cl(i,s)||!Cl(c,d):!0}function Xh(e,t,i,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&Kc.enqueueReplaceState(t,t.state,null)}function Zi(e,t){var i=t;if("ref"in t){i={};for(var s in t)s!=="ref"&&(i[s]=t[s])}if(e=e.defaultProps){i===t&&(i=v({},i));for(var c in e)i[c]===void 0&&(i[c]=e[c])}return i}function Zh(e){Ks(e)}function Qh(e){console.error(e)}function Wh(e){Ks(e)}function co(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Jh(e,t,i){try{var s=e.onCaughtError;s(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Ic(e,t,i){return i=ri(i),i.tag=3,i.payload={element:null},i.callback=function(){co(e,t)},i}function em(e){return e=ri(e),e.tag=3,e}function tm(e,t,i,s){var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Jh(t,i,s)}}var b=i.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Jh(t,i,s),typeof c!="function"&&(pi===null?pi=new Set([this]):pi.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function gv(e,t,i,s,c){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=i.alternate,t!==null&&Ea(t,i,c,!0),i=Gt.current,i!==null){switch(i.tag){case 31:case 13:return ln===null?So():i.alternate===null&&at===0&&(at=3),i.flags&=-257,i.flags|=65536,i.lanes=c,s===Zs?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([s]):t.add(s),fu(e,s,c)),!1;case 22:return i.flags|=65536,s===Zs?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([s]):i.add(s)),fu(e,s,c)),!1}throw Error(o(435,i.tag))}return fu(e,s,c),So(),!1}if(Be)return t=Gt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==sc&&(e=Error(o(422),{cause:s}),Al(en(e,i)))):(s!==sc&&(t=Error(o(423),{cause:s}),Al(en(t,i))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=en(s,i),c=Ic(e.stateNode,s,c),bc(e,c),at!==4&&(at=2)),!1;var d=Error(o(520),{cause:s});if(d=en(d,i),Pl===null?Pl=[d]:Pl.push(d),at!==4&&(at=2),t===null)return!0;s=en(s,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=c&-c,i.lanes|=e,e=Ic(i.stateNode,s,e),bc(i,e),!1;case 1:if(t=i.type,d=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(pi===null||!pi.has(d))))return i.flags|=65536,c&=-c,i.lanes|=c,c=em(c),tm(c,e,i,s),bc(i,c),!1}i=i.return}while(i!==null);return!1}var Fc=Error(o(461)),dt=!1;function Ct(e,t,i,s){t.child=e===null?lh(t,null,i,s):Vi(t,e.child,i,s)}function nm(e,t,i,s,c){i=i.render;var d=t.ref;if("ref"in s){var b={};for(var C in s)C!=="ref"&&(b[C]=s[C])}else b=s;return Yi(t),s=Cc(e,t,i,b,d,c),C=Tc(),e!==null&&!dt?(Mc(e,t,c),Hn(e,t,c)):(Be&&C&&ac(t),t.flags|=1,Ct(e,t,s,c),t.child)}function im(e,t,i,s,c){if(e===null){var d=i.type;return typeof d=="function"&&!tc(d)&&d.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=d,am(e,t,d,s,c)):(e=Ys(i.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!Zc(e,c)){var b=d.memoizedProps;if(i=i.compare,i=i!==null?i:Cl,i(b,s)&&e.ref===t.ref)return Hn(e,t,c)}return t.flags|=1,e=_n(d,s),e.ref=t.ref,e.return=t,t.child=e}function am(e,t,i,s,c){if(e!==null){var d=e.memoizedProps;if(Cl(d,s)&&e.ref===t.ref)if(dt=!1,t.pendingProps=s=d,Zc(e,c))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,Hn(e,t,c)}return Gc(e,t,i,s,c)}function lm(e,t,i,s){var c=s.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|i:i,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~d}else s=0,t.child=null;return sm(e,t,d,i,s)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Vs(t,d!==null?d.cachePool:null),d!==null?rh(t,d):vc(),ch(t);else return s=t.lanes=536870912,sm(e,t,d!==null?d.baseLanes|i:i,i,s)}else d!==null?(Vs(t,d.cachePool),rh(t,d),di(),t.memoizedState=null):(e!==null&&Vs(t,null),vc(),di());return Ct(e,t,c,i),t.child}function Bl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sm(e,t,i,s,c){var d=hc();return d=d===null?null:{parent:ct._currentValue,pool:d},t.memoizedState={baseLanes:i,cachePool:d},e!==null&&Vs(t,null),vc(),ch(t),e!==null&&Ea(e,t,s,!0),t.childLanes=c,null}function uo(e,t){return t=ho({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function om(e,t,i){return Vi(t,e.child,null,i),e=uo(t,t.pendingProps),e.flags|=2,Yt(t),t.memoizedState=null,e}function bv(e,t,i){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Be){if(s.mode==="hidden")return e=uo(t,s),t.lanes=536870912,Bl(null,e);if(wc(t),(e=Ze)?(e=vp(e,an),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ii!==null?{id:yn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},i=Yf(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw li(t);return t.lanes=536870912,null}return uo(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(wc(t),c)if(t.flags&256)t.flags&=-257,t=om(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(dt||Ea(e,t,i,!1),c=(i&e.childLanes)!==0,dt||c){if(s=qe,s!==null&&(b=Zd(s,i),b!==0&&b!==d.retryLane))throw d.retryLane=b,Ki(e,b),Ut(s,e,b),Fc;So(),t=om(e,t,i)}else e=d.treeContext,Ze=sn(b.nextSibling),wt=t,Be=!0,ai=null,an=!1,e!==null&&qf(t,e),t=uo(t,s),t.flags|=4096;return t}return e=_n(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fo(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function Gc(e,t,i,s,c){return Yi(t),i=Cc(e,t,i,s,void 0,c),s=Tc(),e!==null&&!dt?(Mc(e,t,c),Hn(e,t,c)):(Be&&s&&ac(t),t.flags|=1,Ct(e,t,i,c),t.child)}function rm(e,t,i,s,c,d){return Yi(t),t.updateQueue=null,i=dh(t,s,i,c),uh(e),s=Tc(),e!==null&&!dt?(Mc(e,t,d),Hn(e,t,d)):(Be&&s&&ac(t),t.flags|=1,Ct(e,t,i,d),t.child)}function cm(e,t,i,s,c){if(Yi(t),t.stateNode===null){var d=Ca,b=i.contextType;typeof b=="object"&&b!==null&&(d=St(b)),d=new i(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Kc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},pc(t),b=i.contextType,d.context=typeof b=="object"&&b!==null?St(b):Ca,d.state=t.memoizedState,b=i.getDerivedStateFromProps,typeof b=="function"&&(Uc(t,i,b,s),d.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Kc.enqueueReplaceState(d,d.state,null),jl(t,s,d,c),Rl(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var C=t.memoizedProps,L=Zi(i,C);d.props=L;var G=d.context,X=i.contextType;b=Ca,typeof X=="object"&&X!==null&&(b=St(X));var ee=i.getDerivedStateFromProps;X=typeof ee=="function"||typeof d.getSnapshotBeforeUpdate=="function",C=t.pendingProps!==C,X||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(C||G!==b)&&Xh(t,d,s,b),oi=!1;var Y=t.memoizedState;d.state=Y,jl(t,s,d,c),Rl(),G=t.memoizedState,C||Y!==G||oi?(typeof ee=="function"&&(Uc(t,i,ee,s),G=t.memoizedState),(L=oi||Vh(t,i,L,s,Y,G,b))?(X||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=G),d.props=s,d.state=G,d.context=b,s=L):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,gc(e,t),b=t.memoizedProps,X=Zi(i,b),d.props=X,ee=t.pendingProps,Y=d.context,G=i.contextType,L=Ca,typeof G=="object"&&G!==null&&(L=St(G)),C=i.getDerivedStateFromProps,(G=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==ee||Y!==L)&&Xh(t,d,s,L),oi=!1,Y=t.memoizedState,d.state=Y,jl(t,s,d,c),Rl();var $=t.memoizedState;b!==ee||Y!==$||oi||e!==null&&e.dependencies!==null&&$s(e.dependencies)?(typeof C=="function"&&(Uc(t,i,C,s),$=t.memoizedState),(X=oi||Vh(t,i,X,s,Y,$,L)||e!==null&&e.dependencies!==null&&$s(e.dependencies))?(G||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,$,L),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,$,L)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=$),d.props=s,d.state=$,d.context=L,s=X):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,fo(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,i=s&&typeof i.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=Vi(t,e.child,null,c),t.child=Vi(t,null,i,c)):Ct(e,t,i,c),t.memoizedState=d.state,e=t.child):e=Hn(e,t,c),e}function um(e,t,i,s){return Fi(),t.flags|=256,Ct(e,t,i,s),t.child}var Yc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pc(e){return{baseLanes:e,cachePool:Jf()}}function $c(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=$t),e}function dm(e,t,i){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(lt.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Be){if(c?ui(t):di(),(e=Ze)?(e=vp(e,an),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ii!==null?{id:yn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},i=Yf(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw li(t);return Nu(e)?t.lanes=32:t.lanes=536870912,null}var C=s.children;return s=s.fallback,c?(di(),c=t.mode,C=ho({mode:"hidden",children:C},c),s=Ii(s,c,i,null),C.return=t,s.return=t,C.sibling=s,t.child=C,s=t.child,s.memoizedState=Pc(i),s.childLanes=$c(e,b,i),t.memoizedState=Yc,Bl(null,s)):(ui(t),qc(t,C))}var L=e.memoizedState;if(L!==null&&(C=L.dehydrated,C!==null)){if(d)t.flags&256?(ui(t),t.flags&=-257,t=Vc(e,t,i)):t.memoizedState!==null?(di(),t.child=e.child,t.flags|=128,t=null):(di(),C=s.fallback,c=t.mode,s=ho({mode:"visible",children:s.children},c),C=Ii(C,c,i,null),C.flags|=2,s.return=t,C.return=t,s.sibling=C,t.child=s,Vi(t,e.child,null,i),s=t.child,s.memoizedState=Pc(i),s.childLanes=$c(e,b,i),t.memoizedState=Yc,t=Bl(null,s));else if(ui(t),Nu(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var G=b.dgst;b=G,s=Error(o(419)),s.stack="",s.digest=b,Al({value:s,source:null,stack:null}),t=Vc(e,t,i)}else if(dt||Ea(e,t,i,!1),b=(i&e.childLanes)!==0,dt||b){if(b=qe,b!==null&&(s=Zd(b,i),s!==0&&s!==L.retryLane))throw L.retryLane=s,Ki(e,s),Ut(b,e,s),Fc;Eu(C)||So(),t=Vc(e,t,i)}else Eu(C)?(t.flags|=192,t.child=e.child,t=null):(e=L.treeContext,Ze=sn(C.nextSibling),wt=t,Be=!0,ai=null,an=!1,e!==null&&qf(t,e),t=qc(t,s.children),t.flags|=4096);return t}return c?(di(),C=s.fallback,c=t.mode,L=e.child,G=L.sibling,s=_n(L,{mode:"hidden",children:s.children}),s.subtreeFlags=L.subtreeFlags&65011712,G!==null?C=_n(G,C):(C=Ii(C,c,i,null),C.flags|=2),C.return=t,s.return=t,s.sibling=C,t.child=s,Bl(null,s),s=t.child,C=e.child.memoizedState,C===null?C=Pc(i):(c=C.cachePool,c!==null?(L=ct._currentValue,c=c.parent!==L?{parent:L,pool:L}:c):c=Jf(),C={baseLanes:C.baseLanes|i,cachePool:c}),s.memoizedState=C,s.childLanes=$c(e,b,i),t.memoizedState=Yc,Bl(e.child,s)):(ui(t),i=e.child,e=i.sibling,i=_n(i,{mode:"visible",children:s.children}),i.return=t,i.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=i,t.memoizedState=null,i)}function qc(e,t){return t=ho({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ho(e,t){return e=Ft(22,e,null,t),e.lanes=0,e}function Vc(e,t,i){return Vi(t,e.child,null,i),e=qc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fm(e,t,i){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),cc(e.return,t,i)}function Xc(e,t,i,s,c,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:c,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=i,b.tailMode=c,b.treeForkCount=d)}function hm(e,t,i){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var b=lt.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,ce(lt,b),Ct(e,t,s,i),s=Be?Ml:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fm(e,i,t);else if(e.tag===19)fm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(i=t.child,c=null;i!==null;)e=i.alternate,e!==null&&eo(e)===null&&(c=i),i=i.sibling;i=c,i===null?(c=t.child,t.child=null):(c=i.sibling,i.sibling=null),Xc(t,!1,c,i,d,s);break;case"backwards":case"unstable_legacy-backwards":for(i=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&eo(e)===null){t.child=c;break}e=c.sibling,c.sibling=i,i=c,c=e}Xc(t,!0,i,null,d,s);break;case"together":Xc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Hn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),mi|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Ea(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,i=_n(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=_n(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Zc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&$s(e)))}function yv(e,t,i){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),si(t,ct,e.memoizedState.cache),Fi();break;case 27:case 5:we(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:si(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,wc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ui(t),t.flags|=128,null):(i&t.child.childLanes)!==0?dm(e,t,i):(ui(t),e=Hn(e,t,i),e!==null?e.sibling:null);ui(t);break;case 19:var c=(e.flags&128)!==0;if(s=(i&t.childLanes)!==0,s||(Ea(e,t,i,!1),s=(i&t.childLanes)!==0),c){if(s)return hm(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ce(lt,lt.current),s)break;return null;case 22:return t.lanes=0,lm(e,t,i,t.pendingProps);case 24:si(t,ct,e.memoizedState.cache)}return Hn(e,t,i)}function mm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!Zc(e,i)&&(t.flags&128)===0)return dt=!1,yv(e,t,i);dt=(e.flags&131072)!==0}else dt=!1,Be&&(t.flags&1048576)!==0&&$f(t,Ml,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=$i(t.elementType),t.type=e,typeof e=="function")tc(e)?(s=Zi(e,s),t.tag=1,t=cm(null,t,e,s,i)):(t.tag=0,t=Gc(null,t,e,s,i));else{if(e!=null){var c=e.$$typeof;if(c===H){t.tag=11,t=nm(null,t,e,s,i);break e}else if(c===_){t.tag=14,t=im(null,t,e,s,i);break e}}throw t=oe(e)||e,Error(o(306,t,""))}}return t;case 0:return Gc(e,t,t.type,t.pendingProps,i);case 1:return s=t.type,c=Zi(s,t.pendingProps),cm(e,t,s,c,i);case 3:e:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,gc(e,t),jl(t,s,null,i);var b=t.memoizedState;if(s=b.cache,si(t,ct,s),s!==d.cache&&uc(t,[ct],i,!0),Rl(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=um(e,t,s,i);break e}else if(s!==c){c=en(Error(o(424)),t),Al(c),t=um(e,t,s,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=sn(e.firstChild),wt=t,Be=!0,ai=null,an=!0,i=lh(t,null,s,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Fi(),s===c){t=Hn(e,t,i);break e}Ct(e,t,s,i)}t=t.child}return t;case 26:return fo(e,t),e===null?(i=Mp(t.type,null,t.pendingProps,null))?t.memoizedState=i:Be||(i=t.type,e=t.pendingProps,s=ko(de.current).createElement(i),s[xt]=t,s[jt]=e,Tt(s,i,e),bt(s),t.stateNode=s):t.memoizedState=Mp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return we(t),e===null&&Be&&(s=t.stateNode=Sp(t.type,t.pendingProps,de.current),wt=t,an=!0,c=Ze,vi(t.type)?(ku=c,Ze=sn(s.firstChild)):Ze=c),Ct(e,t,t.pendingProps.children,i),fo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Be&&((c=s=Ze)&&(s=Vv(s,t.type,t.pendingProps,an),s!==null?(t.stateNode=s,wt=t,Ze=sn(s.firstChild),an=!1,c=!0):c=!1),c||li(t)),we(t),c=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,Tu(c,d)?s=null:b!==null&&Tu(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=Cc(e,t,cv,null,null,i),Jl._currentValue=c),fo(e,t),Ct(e,t,s,i),t.child;case 6:return e===null&&Be&&((e=i=Ze)&&(i=Xv(i,t.pendingProps,an),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||li(t)),null;case 13:return dm(e,t,i);case 4:return ve(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Vi(t,null,s,i):Ct(e,t,s,i),t.child;case 11:return nm(e,t,t.type,t.pendingProps,i);case 7:return Ct(e,t,t.pendingProps,i),t.child;case 8:return Ct(e,t,t.pendingProps.children,i),t.child;case 12:return Ct(e,t,t.pendingProps.children,i),t.child;case 10:return s=t.pendingProps,si(t,t.type,s.value),Ct(e,t,s.children,i),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,Yi(t),c=St(c),s=s(c),t.flags|=1,Ct(e,t,s,i),t.child;case 14:return im(e,t,t.type,t.pendingProps,i);case 15:return am(e,t,t.type,t.pendingProps,i);case 19:return hm(e,t,i);case 31:return bv(e,t,i);case 22:return lm(e,t,i,t.pendingProps);case 24:return Yi(t),s=St(ct),e===null?(c=hc(),c===null&&(c=qe,d=dc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=i),c=d),t.memoizedState={parent:s,cache:c},pc(t),si(t,ct,c)):((e.lanes&i)!==0&&(gc(e,t),jl(t,null,null,i),Rl()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),si(t,ct,s)):(s=d.cache,si(t,ct,s),s!==c.cache&&uc(t,[ct],i,!0))),Ct(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Bn(e){e.flags|=4}function Qc(e,t,i,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Im())e.flags|=8192;else throw qi=Zs,mc}else e.flags&=-16777217}function pm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Lp(t))if(Im())e.flags|=8192;else throw qi=Zs,mc}function mo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?qd():536870912,e.lanes|=t,Ua|=t)}function Ul(e,t){if(!Be)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,s=0;if(t)for(var c=e.child;c!==null;)i|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)i|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function vv(e,t,i){var s=t.pendingProps;switch(lc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return i=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),On(ct),ae(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Aa(t)?Bn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,oc())),Qe(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(Bn(t),d!==null?(Qe(t),pm(t,d)):(Qe(t),Qc(t,c,null,s,i))):d?d!==e.memoizedState?(Bn(t),Qe(t),pm(t,d)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Bn(t),Qe(t),Qc(t,c,e,s,i)),null;case 27:if(Ae(t),i=de.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Bn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}e=Te.current,Aa(t)?Vf(t):(e=Sp(c,s,i),t.stateNode=e,Bn(t))}return Qe(t),null;case 5:if(Ae(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Bn(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return Qe(t),null}if(d=Te.current,Aa(t))Vf(t);else{var b=ko(de.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}d[xt]=t,d[jt]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Tt(d,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Bn(t)}}return Qe(t),Qc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Bn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=de.current,Aa(t)){if(e=t.stateNode,i=t.memoizedProps,s=null,c=wt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[xt]=t,e=!!(e.nodeValue===i||s!==null&&s.suppressHydrationWarning===!0||dp(e.nodeValue,i)),e||li(t,!0)}else e=ko(e).createTextNode(s),e[xt]=t,t.stateNode=e}return Qe(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(s=Aa(t),i!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[xt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else i=oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Yt(t),t):(Yt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Aa(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[xt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),c=!1}else c=oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Yt(t),t):(Yt(t),null)}return Yt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=s!==null,e=e!==null&&e.memoizedState!==null,i&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),mo(t,t.updateQueue),Qe(t),null);case 4:return ae(),e===null&&vu(t.stateNode.containerInfo),Qe(t),null;case 10:return On(t.type),Qe(t),null;case 19:if(xe(lt),s=t.memoizedState,s===null)return Qe(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Ul(s,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=eo(e),d!==null){for(t.flags|=128,Ul(s,!1),e=d.updateQueue,t.updateQueue=e,mo(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Gf(i,e),i=i.sibling;return ce(lt,lt.current&1|2),Be&&Rn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Mt()>vo&&(t.flags|=128,c=!0,Ul(s,!1),t.lanes=4194304)}else{if(!c)if(e=eo(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,mo(t,e),Ul(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!Be)return Qe(t),null}else 2*Mt()-s.renderingStartTime>vo&&i!==536870912&&(t.flags|=128,c=!0,Ul(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Mt(),e.sibling=null,i=lt.current,ce(lt,c?i&1|2:i&1),Be&&Rn(t,s.treeForkCount),e):(Qe(t),null);case 22:case 23:return Yt(t),xc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(i&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),i=t.updateQueue,i!==null&&mo(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==i&&(t.flags|=2048),e!==null&&xe(Pi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),On(ct),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function xv(e,t){switch(lc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return On(ct),ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ae(t),null;case 31:if(t.memoizedState!==null){if(Yt(t),t.alternate===null)throw Error(o(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Yt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xe(lt),null;case 4:return ae(),null;case 10:return On(t.type),null;case 22:case 23:return Yt(t),xc(),e!==null&&xe(Pi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return On(ct),null;case 25:return null;default:return null}}function gm(e,t){switch(lc(t),t.tag){case 3:On(ct),ae();break;case 26:case 27:case 5:Ae(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&Yt(t);break;case 13:Yt(t);break;case 19:xe(lt);break;case 10:On(t.type);break;case 22:case 23:Yt(t),xc(),e!==null&&xe(Pi);break;case 24:On(ct)}}function Kl(e,t){try{var i=t.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var c=s.next;i=c;do{if((i.tag&e)===e){s=void 0;var d=i.create,b=i.inst;s=d(),b.destroy=s}i=i.next}while(i!==c)}}catch(C){Ge(t,t.return,C)}}function fi(e,t,i){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var b=s.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,c=t;var L=i,G=C;try{G()}catch(X){Ge(c,L,X)}}}s=s.next}while(s!==d)}}catch(X){Ge(t,t.return,X)}}function bm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{oh(t,i)}catch(s){Ge(e,e.return,s)}}}function ym(e,t,i){i.props=Zi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){Ge(e,t,s)}}function Il(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof i=="function"?e.refCleanup=i(s):i.current=s}}catch(c){Ge(e,t,c)}}function xn(e,t){var i=e.ref,s=e.refCleanup;if(i!==null)if(typeof s=="function")try{s()}catch(c){Ge(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(c){Ge(e,t,c)}else i.current=null}function vm(e){var t=e.type,i=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&s.focus();break e;case"img":i.src?s.src=i.src:i.srcSet&&(s.srcset=i.srcSet)}}catch(c){Ge(e,e.return,c)}}function Wc(e,t,i){try{var s=e.stateNode;Fv(s,e.type,i,t),s[jt]=t}catch(c){Ge(e,e.return,c)}}function xm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vi(e.type)||e.tag===4}function Jc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&vi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function eu(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=kn));else if(s!==4&&(s===27&&vi(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(eu(e,t,i),e=e.sibling;e!==null;)eu(e,t,i),e=e.sibling}function po(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(s!==4&&(s===27&&vi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(po(e,t,i),e=e.sibling;e!==null;)po(e,t,i),e=e.sibling}function wm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Tt(t,s,i),t[xt]=e,t[jt]=i}catch(d){Ge(e,e.return,d)}}var Un=!1,ft=!1,tu=!1,Sm=typeof WeakSet=="function"?WeakSet:Set,yt=null;function wv(e,t){if(e=e.containerInfo,Su=zo,e=Of(e),Vr(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var s=i.getSelection&&i.getSelection();if(s&&s.rangeCount!==0){i=s.anchorNode;var c=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{i.nodeType,d.nodeType}catch{i=null;break e}var b=0,C=-1,L=-1,G=0,X=0,ee=e,Y=null;t:for(;;){for(var $;ee!==i||c!==0&&ee.nodeType!==3||(C=b+c),ee!==d||s!==0&&ee.nodeType!==3||(L=b+s),ee.nodeType===3&&(b+=ee.nodeValue.length),($=ee.firstChild)!==null;)Y=ee,ee=$;for(;;){if(ee===e)break t;if(Y===i&&++G===c&&(C=b),Y===d&&++X===s&&(L=b),($=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=$}i=C===-1||L===-1?null:{start:C,end:L}}else i=null}i=i||{start:0,end:0}}else i=null;for(Cu={focusedElem:e,selectionRange:i},zo=!1,yt=t;yt!==null;)if(t=yt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,yt=e;else for(;yt!==null;){switch(t=yt,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)c=e[i],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,i=t,c=d.memoizedProps,d=d.memoizedState,s=i.stateNode;try{var pe=Zi(i.type,c);e=s.getSnapshotBeforeUpdate(pe,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){Ge(i,i.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Au(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Au(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,yt=e;break}yt=t.return}}function Cm(e,t,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:In(e,i),s&4&&Kl(5,i);break;case 1:if(In(e,i),s&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(b){Ge(i,i.return,b)}else{var c=Zi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Ge(i,i.return,b)}}s&64&&bm(i),s&512&&Il(i,i.return);break;case 3:if(In(e,i),s&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{oh(e,t)}catch(b){Ge(i,i.return,b)}}break;case 27:t===null&&s&4&&wm(i);case 26:case 5:In(e,i),t===null&&s&4&&vm(i),s&512&&Il(i,i.return);break;case 12:In(e,i);break;case 31:In(e,i),s&4&&Am(e,i);break;case 13:In(e,i),s&4&&Em(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Lv.bind(null,i),Zv(e,i))));break;case 22:if(s=i.memoizedState!==null||Un,!s){t=t!==null&&t.memoizedState!==null||ft,c=Un;var d=ft;Un=s,(ft=t)&&!d?Fn(e,i,(i.subtreeFlags&8772)!==0):In(e,i),Un=c,ft=d}break;case 30:break;default:In(e,i)}}function Tm(e){var t=e.alternate;t!==null&&(e.alternate=null,Tm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_r(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nt=null,Dt=!1;function Kn(e,t,i){for(i=i.child;i!==null;)Mm(e,t,i),i=i.sibling}function Mm(e,t,i){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(ei,i)}catch{}switch(i.tag){case 26:ft||xn(i,t),Kn(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:ft||xn(i,t);var s=nt,c=Dt;vi(i.type)&&(nt=i.stateNode,Dt=!1),Kn(e,t,i),Zl(i.stateNode),nt=s,Dt=c;break;case 5:ft||xn(i,t);case 6:if(s=nt,c=Dt,nt=null,Kn(e,t,i),nt=s,Dt=c,nt!==null)if(Dt)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(i.stateNode)}catch(d){Ge(i,t,d)}else try{nt.removeChild(i.stateNode)}catch(d){Ge(i,t,d)}break;case 18:nt!==null&&(Dt?(e=nt,bp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),qa(e)):bp(nt,i.stateNode));break;case 4:s=nt,c=Dt,nt=i.stateNode.containerInfo,Dt=!0,Kn(e,t,i),nt=s,Dt=c;break;case 0:case 11:case 14:case 15:fi(2,i,t),ft||fi(4,i,t),Kn(e,t,i);break;case 1:ft||(xn(i,t),s=i.stateNode,typeof s.componentWillUnmount=="function"&&ym(i,t,s)),Kn(e,t,i);break;case 21:Kn(e,t,i);break;case 22:ft=(s=ft)||i.memoizedState!==null,Kn(e,t,i),ft=s;break;default:Kn(e,t,i)}}function Am(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qa(e)}catch(i){Ge(t,t.return,i)}}}function Em(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{qa(e)}catch(i){Ge(t,t.return,i)}}function Sv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Sm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Sm),t;default:throw Error(o(435,e.tag))}}function go(e,t){var i=Sv(e);t.forEach(function(s){if(!i.has(s)){i.add(s);var c=_v.bind(null,e,s);s.then(c,c)}})}function zt(e,t){var i=t.deletions;if(i!==null)for(var s=0;s<i.length;s++){var c=i[s],d=e,b=t,C=b;e:for(;C!==null;){switch(C.tag){case 27:if(vi(C.type)){nt=C.stateNode,Dt=!1;break e}break;case 5:nt=C.stateNode,Dt=!1;break e;case 3:case 4:nt=C.stateNode.containerInfo,Dt=!0;break e}C=C.return}if(nt===null)throw Error(o(160));Mm(d,b,c),nt=null,Dt=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Nm(t,e),t=t.sibling}var hn=null;function Nm(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zt(t,e),Ht(e),s&4&&(fi(3,e,e.return),Kl(3,e),fi(5,e,e.return));break;case 1:zt(t,e),Ht(e),s&512&&(ft||i===null||xn(i,i.return)),s&64&&Un&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?s:i.concat(s))));break;case 26:var c=hn;if(zt(t,e),Ht(e),s&512&&(ft||i===null||xn(i,i.return)),s&4){var d=i!==null?i.memoizedState:null;if(s=e.memoizedState,i===null)if(s===null)if(e.stateNode===null){e:{s=e.type,i=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":d=c.getElementsByTagName("title")[0],(!d||d[ml]||d[xt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),Tt(d,s,i),d[xt]=e,bt(d),s=d;break e;case"link":var b=Np("link","href",c).get(s+(i.href||""));if(b){for(var C=0;C<b.length;C++)if(d=b[C],d.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&d.getAttribute("rel")===(i.rel==null?null:i.rel)&&d.getAttribute("title")===(i.title==null?null:i.title)&&d.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){b.splice(C,1);break t}}d=c.createElement(s),Tt(d,s,i),c.head.appendChild(d);break;case"meta":if(b=Np("meta","content",c).get(s+(i.content||""))){for(C=0;C<b.length;C++)if(d=b[C],d.getAttribute("content")===(i.content==null?null:""+i.content)&&d.getAttribute("name")===(i.name==null?null:i.name)&&d.getAttribute("property")===(i.property==null?null:i.property)&&d.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&d.getAttribute("charset")===(i.charSet==null?null:i.charSet)){b.splice(C,1);break t}}d=c.createElement(s),Tt(d,s,i),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[xt]=e,bt(d),s=d}e.stateNode=s}else kp(c,e.type,e.stateNode);else e.stateNode=Ep(c,s,e.memoizedProps);else d!==s?(d===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):d.count--,s===null?kp(c,e.type,e.stateNode):Ep(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,i.memoizedProps)}break;case 27:zt(t,e),Ht(e),s&512&&(ft||i===null||xn(i,i.return)),i!==null&&s&4&&Wc(e,e.memoizedProps,i.memoizedProps);break;case 5:if(zt(t,e),Ht(e),s&512&&(ft||i===null||xn(i,i.return)),e.flags&32){c=e.stateNode;try{ga(c,"")}catch(pe){Ge(e,e.return,pe)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Wc(e,c,i!==null?i.memoizedProps:c)),s&1024&&(tu=!0);break;case 6:if(zt(t,e),Ht(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,i=e.stateNode;try{i.nodeValue=s}catch(pe){Ge(e,e.return,pe)}}break;case 3:if(Ro=null,c=hn,hn=Lo(t.containerInfo),zt(t,e),hn=c,Ht(e),s&4&&i!==null&&i.memoizedState.isDehydrated)try{qa(t.containerInfo)}catch(pe){Ge(e,e.return,pe)}tu&&(tu=!1,km(e));break;case 4:s=hn,hn=Lo(e.stateNode.containerInfo),zt(t,e),Ht(e),hn=s;break;case 12:zt(t,e),Ht(e);break;case 31:zt(t,e),Ht(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,go(e,s)));break;case 13:zt(t,e),Ht(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(yo=Mt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,go(e,s)));break;case 22:c=e.memoizedState!==null;var L=i!==null&&i.memoizedState!==null,G=Un,X=ft;if(Un=G||c,ft=X||L,zt(t,e),ft=X,Un=G,Ht(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||L||Un||ft||Qi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){L=i=t;try{if(d=L.stateNode,c)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{C=L.stateNode;var ee=L.memoizedProps.style,Y=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;C.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(pe){Ge(L,L.return,pe)}}}else if(t.tag===6){if(i===null){L=t;try{L.stateNode.nodeValue=c?"":L.memoizedProps}catch(pe){Ge(L,L.return,pe)}}}else if(t.tag===18){if(i===null){L=t;try{var $=L.stateNode;c?yp($,!0):yp(L.stateNode,!1)}catch(pe){Ge(L,L.return,pe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(i=s.retryQueue,i!==null&&(s.retryQueue=null,go(e,i))));break;case 19:zt(t,e),Ht(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,go(e,s)));break;case 30:break;case 21:break;default:zt(t,e),Ht(e)}}function Ht(e){var t=e.flags;if(t&2){try{for(var i,s=e.return;s!==null;){if(xm(s)){i=s;break}s=s.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var c=i.stateNode,d=Jc(e);po(e,d,c);break;case 5:var b=i.stateNode;i.flags&32&&(ga(b,""),i.flags&=-33);var C=Jc(e);po(e,C,b);break;case 3:case 4:var L=i.stateNode.containerInfo,G=Jc(e);eu(e,G,L);break;default:throw Error(o(161))}}catch(X){Ge(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function km(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;km(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function In(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Cm(e,t.alternate,t),t=t.sibling}function Qi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:fi(4,t,t.return),Qi(t);break;case 1:xn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&ym(t,t.return,i),Qi(t);break;case 27:Zl(t.stateNode);case 26:case 5:xn(t,t.return),Qi(t);break;case 22:t.memoizedState===null&&Qi(t);break;case 30:Qi(t);break;default:Qi(t)}e=e.sibling}}function Fn(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:Fn(c,d,i),Kl(4,d);break;case 1:if(Fn(c,d,i),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(G){Ge(s,s.return,G)}if(s=d,c=s.updateQueue,c!==null){var C=s.stateNode;try{var L=c.shared.hiddenCallbacks;if(L!==null)for(c.shared.hiddenCallbacks=null,c=0;c<L.length;c++)sh(L[c],C)}catch(G){Ge(s,s.return,G)}}i&&b&64&&bm(d),Il(d,d.return);break;case 27:wm(d);case 26:case 5:Fn(c,d,i),i&&s===null&&b&4&&vm(d),Il(d,d.return);break;case 12:Fn(c,d,i);break;case 31:Fn(c,d,i),i&&b&4&&Am(c,d);break;case 13:Fn(c,d,i),i&&b&4&&Em(c,d);break;case 22:d.memoizedState===null&&Fn(c,d,i),Il(d,d.return);break;case 30:break;default:Fn(c,d,i)}t=t.sibling}}function nu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&El(i))}function iu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&El(e))}function mn(e,t,i,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Lm(e,t,i,s),t=t.sibling}function Lm(e,t,i,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,i,s),c&2048&&Kl(9,t);break;case 1:mn(e,t,i,s);break;case 3:mn(e,t,i,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&El(e)));break;case 12:if(c&2048){mn(e,t,i,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,C=d.onPostCommit;typeof C=="function"&&C(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){Ge(t,t.return,L)}}else mn(e,t,i,s);break;case 31:mn(e,t,i,s);break;case 13:mn(e,t,i,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?mn(e,t,i,s):Fl(e,t):d._visibility&2?mn(e,t,i,s):(d._visibility|=2,za(e,t,i,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&nu(b,t);break;case 24:mn(e,t,i,s),c&2048&&iu(t.alternate,t);break;default:mn(e,t,i,s)}}function za(e,t,i,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,C=i,L=s,G=b.flags;switch(b.tag){case 0:case 11:case 15:za(d,b,C,L,c),Kl(8,b);break;case 23:break;case 22:var X=b.stateNode;b.memoizedState!==null?X._visibility&2?za(d,b,C,L,c):Fl(d,b):(X._visibility|=2,za(d,b,C,L,c)),c&&G&2048&&nu(b.alternate,b);break;case 24:za(d,b,C,L,c),c&&G&2048&&iu(b.alternate,b);break;default:za(d,b,C,L,c)}t=t.sibling}}function Fl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,s=t,c=s.flags;switch(s.tag){case 22:Fl(i,s),c&2048&&nu(s.alternate,s);break;case 24:Fl(i,s),c&2048&&iu(s.alternate,s);break;default:Fl(i,s)}t=t.sibling}}var Gl=8192;function Ha(e,t,i){if(e.subtreeFlags&Gl)for(e=e.child;e!==null;)_m(e,t,i),e=e.sibling}function _m(e,t,i){switch(e.tag){case 26:Ha(e,t,i),e.flags&Gl&&e.memoizedState!==null&&rx(i,hn,e.memoizedState,e.memoizedProps);break;case 5:Ha(e,t,i);break;case 3:case 4:var s=hn;hn=Lo(e.stateNode.containerInfo),Ha(e,t,i),hn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Gl,Gl=16777216,Ha(e,t,i),Gl=s):Ha(e,t,i));break;default:Ha(e,t,i)}}function Rm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Yl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];yt=s,Om(s,e)}Rm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jm(e),e=e.sibling}function jm(e){switch(e.tag){case 0:case 11:case 15:Yl(e),e.flags&2048&&fi(9,e,e.return);break;case 3:Yl(e);break;case 12:Yl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,bo(e)):Yl(e);break;default:Yl(e)}}function bo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];yt=s,Om(s,e)}Rm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:fi(8,t,t.return),bo(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,bo(t));break;default:bo(t)}e=e.sibling}}function Om(e,t){for(;yt!==null;){var i=yt;switch(i.tag){case 0:case 11:case 15:fi(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var s=i.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:El(i.memoizedState.cache)}if(s=i.child,s!==null)s.return=i,yt=s;else e:for(i=e;yt!==null;){s=yt;var c=s.sibling,d=s.return;if(Tm(s),s===i){yt=null;break e}if(c!==null){c.return=d,yt=c;break e}yt=d}}}var Cv={getCacheForType:function(e){var t=St(ct),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return St(ct).controller.signal}},Tv=typeof WeakMap=="function"?WeakMap:Map,Ie=0,qe=null,je=null,ze=0,Fe=0,Pt=null,hi=!1,Ba=!1,au=!1,Gn=0,at=0,mi=0,Wi=0,lu=0,$t=0,Ua=0,Pl=null,Bt=null,su=!1,yo=0,Dm=0,vo=1/0,xo=null,pi=null,mt=0,gi=null,Ka=null,Yn=0,ou=0,ru=null,zm=null,$l=0,cu=null;function qt(){return(Ie&2)!==0&&ze!==0?ze&-ze:A.T!==null?pu():Qd()}function Hm(){if($t===0)if((ze&536870912)===0||Be){var e=ra;ra<<=1,(ra&3932160)===0&&(ra=262144),$t=e}else $t=536870912;return e=Gt.current,e!==null&&(e.flags|=32),$t}function Ut(e,t,i){(e===qe&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Ia(e,0),bi(e,ze,$t,!1)),hl(e,i),((Ie&2)===0||e!==qe)&&(e===qe&&((Ie&2)===0&&(Wi|=i),at===4&&bi(e,ze,$t,!1)),wn(e))}function Bm(e,t,i){if((Ie&6)!==0)throw Error(o(327));var s=!i&&(t&127)===0&&(t&e.expiredLanes)===0||fl(e,t),c=s?Ev(e,t):du(e,t,!0),d=s;do{if(c===0){Ba&&!s&&bi(e,t,0,!1);break}else{if(i=e.current.alternate,d&&!Mv(i)){c=du(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var C=e;c=Pl;var L=C.current.memoizedState.isDehydrated;if(L&&(Ia(C,b).flags|=256),b=du(C,b,!1),b!==2){if(au&&!L){C.errorRecoveryDisabledLanes|=d,Wi|=d,c=4;break e}d=Bt,Bt=c,d!==null&&(Bt===null?Bt=d:Bt.push.apply(Bt,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){Ia(e,0),bi(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:bi(s,t,$t,!hi);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=yo+300-Mt(),10<c)){if(bi(s,t,$t,!hi),Di(s,0,!0)!==0)break e;Yn=t,s.timeoutHandle=pp(Um.bind(null,s,i,Bt,xo,su,t,$t,Wi,Ua,hi,d,"Throttled",-0,0),c);break e}Um(s,i,Bt,xo,su,t,$t,Wi,Ua,hi,d,null,-0,0)}}break}while(!0);wn(e)}function Um(e,t,i,s,c,d,b,C,L,G,X,ee,Y,$){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:kn},_m(t,d,ee);var pe=(d&62914560)===d?yo-Mt():(d&4194048)===d?Dm-Mt():0;if(pe=cx(ee,pe),pe!==null){Yn=d,e.cancelPendingCommit=pe(qm.bind(null,e,t,d,i,s,c,b,C,L,X,ee,null,Y,$)),bi(e,d,b,!G);return}}qm(e,t,d,i,s,c,b,C,L)}function Mv(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var s=0;s<i.length;s++){var c=i[s],d=c.getSnapshot;c=c.value;try{if(!It(d(),c))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bi(e,t,i,s){t&=~lu,t&=~Wi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-At(c),b=1<<d;s[d]=-1,c&=~b}i!==0&&Vd(e,i,t)}function wo(){return(Ie&6)===0?(ql(0),!1):!0}function uu(){if(je!==null){if(Fe===0)var e=je.return;else e=je,jn=Gi=null,Ac(e),_a=null,kl=0,e=je;for(;e!==null;)gm(e.alternate,e),e=e.return;je=null}}function Ia(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Pv(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Yn=0,uu(),qe=e,je=i=_n(e.current,null),ze=t,Fe=0,Pt=null,hi=!1,Ba=fl(e,t),au=!1,Ua=$t=lu=Wi=mi=at=0,Bt=Pl=null,su=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-At(s),d=1<<c;t|=e[c],s&=~d}return Gn=t,Is(),i}function Km(e,t){ke=null,A.H=Hl,t===La||t===Xs?(t=nh(),Fe=3):t===mc?(t=nh(),Fe=4):Fe=t===Fc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,je===null&&(at=1,co(e,en(t,e.current)))}function Im(){var e=Gt.current;return e===null?!0:(ze&4194048)===ze?ln===null:(ze&62914560)===ze||(ze&536870912)!==0?e===ln:!1}function Fm(){var e=A.H;return A.H=Hl,e===null?Hl:e}function Gm(){var e=A.A;return A.A=Cv,e}function So(){at=4,hi||(ze&4194048)!==ze&&Gt.current!==null||(Ba=!0),(mi&134217727)===0&&(Wi&134217727)===0||qe===null||bi(qe,ze,$t,!1)}function du(e,t,i){var s=Ie;Ie|=2;var c=Fm(),d=Gm();(qe!==e||ze!==t)&&(xo=null,Ia(e,t)),t=!1;var b=at;e:do try{if(Fe!==0&&je!==null){var C=je,L=Pt;switch(Fe){case 8:uu(),b=6;break e;case 3:case 2:case 9:case 6:Gt.current===null&&(t=!0);var G=Fe;if(Fe=0,Pt=null,Fa(e,C,L,G),i&&Ba){b=0;break e}break;default:G=Fe,Fe=0,Pt=null,Fa(e,C,L,G)}}Av(),b=at;break}catch(X){Km(e,X)}while(!0);return t&&e.shellSuspendCounter++,jn=Gi=null,Ie=s,A.H=c,A.A=d,je===null&&(qe=null,ze=0,Is()),b}function Av(){for(;je!==null;)Ym(je)}function Ev(e,t){var i=Ie;Ie|=2;var s=Fm(),c=Gm();qe!==e||ze!==t?(xo=null,vo=Mt()+500,Ia(e,t)):Ba=fl(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=Pt;t:switch(Fe){case 1:Fe=0,Pt=null,Fa(e,t,d,1);break;case 2:case 9:if(eh(d)){Fe=0,Pt=null,Pm(t);break}t=function(){Fe!==2&&Fe!==9||qe!==e||(Fe=7),wn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:eh(d)?(Fe=0,Pt=null,Pm(t)):(Fe=0,Pt=null,Fa(e,t,d,7));break;case 5:var b=null;switch(je.tag){case 26:b=je.memoizedState;case 5:case 27:var C=je;if(b?Lp(b):C.stateNode.complete){Fe=0,Pt=null;var L=C.sibling;if(L!==null)je=L;else{var G=C.return;G!==null?(je=G,Co(G)):je=null}break t}}Fe=0,Pt=null,Fa(e,t,d,5);break;case 6:Fe=0,Pt=null,Fa(e,t,d,6);break;case 8:uu(),at=6;break e;default:throw Error(o(462))}}Nv();break}catch(X){Km(e,X)}while(!0);return jn=Gi=null,A.H=s,A.A=c,Ie=i,je!==null?0:(qe=null,ze=0,Is(),at)}function Nv(){for(;je!==null&&!kt();)Ym(je)}function Ym(e){var t=mm(e.alternate,e,Gn);e.memoizedProps=e.pendingProps,t===null?Co(e):je=t}function Pm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=rm(i,t,t.pendingProps,t.type,void 0,ze);break;case 11:t=rm(i,t,t.pendingProps,t.type.render,t.ref,ze);break;case 5:Ac(t);default:gm(i,t),t=je=Gf(t,Gn),t=mm(i,t,Gn)}e.memoizedProps=e.pendingProps,t===null?Co(e):je=t}function Fa(e,t,i,s){jn=Gi=null,Ac(t),_a=null,kl=0;var c=t.return;try{if(gv(e,c,t,i,ze)){at=1,co(e,en(i,e.current)),je=null;return}}catch(d){if(c!==null)throw je=c,d;at=1,co(e,en(i,e.current)),je=null;return}t.flags&32768?(Be||s===1?e=!0:Ba||(ze&536870912)!==0?e=!1:(hi=e=!0,(s===2||s===9||s===3||s===6)&&(s=Gt.current,s!==null&&s.tag===13&&(s.flags|=16384))),$m(t,e)):Co(t)}function Co(e){var t=e;do{if((t.flags&32768)!==0){$m(t,hi);return}e=t.return;var i=vv(t.alternate,t,Gn);if(i!==null){je=i;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);at===0&&(at=5)}function $m(e,t){do{var i=xv(e.alternate,e);if(i!==null){i.flags&=32767,je=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=i}while(e!==null);at=6,je=null}function qm(e,t,i,s,c,d,b,C,L){e.cancelPendingCommit=null;do To();while(mt!==0);if((Ie&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Jr,o0(e,i,d,b,C,L),e===qe&&(je=qe=null,ze=0),Ka=t,gi=e,Yn=i,ou=d,ru=c,zm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Rv(Oi,function(){return Wm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=A.T,A.T=null,c=I.p,I.p=2,b=Ie,Ie|=4;try{wv(e,t,i)}finally{Ie=b,I.p=c,A.T=s}}mt=1,Vm(),Xm(),Zm()}}function Vm(){if(mt===1){mt=0;var e=gi,t=Ka,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=A.T,A.T=null;var s=I.p;I.p=2;var c=Ie;Ie|=4;try{Nm(t,e);var d=Cu,b=Of(e.containerInfo),C=d.focusedElem,L=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&jf(C.ownerDocument.documentElement,C)){if(L!==null&&Vr(C)){var G=L.start,X=L.end;if(X===void 0&&(X=G),"selectionStart"in C)C.selectionStart=G,C.selectionEnd=Math.min(X,C.value.length);else{var ee=C.ownerDocument||document,Y=ee&&ee.defaultView||window;if(Y.getSelection){var $=Y.getSelection(),pe=C.textContent.length,Ce=Math.min(L.start,pe),$e=L.end===void 0?Ce:Math.min(L.end,pe);!$.extend&&Ce>$e&&(b=$e,$e=Ce,Ce=b);var U=Rf(C,Ce),O=Rf(C,$e);if(U&&O&&($.rangeCount!==1||$.anchorNode!==U.node||$.anchorOffset!==U.offset||$.focusNode!==O.node||$.focusOffset!==O.offset)){var F=ee.createRange();F.setStart(U.node,U.offset),$.removeAllRanges(),Ce>$e?($.addRange(F),$.extend(O.node,O.offset)):(F.setEnd(O.node,O.offset),$.addRange(F))}}}}for(ee=[],$=C;$=$.parentNode;)$.nodeType===1&&ee.push({element:$,left:$.scrollLeft,top:$.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ee.length;C++){var Q=ee[C];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}zo=!!Su,Cu=Su=null}finally{Ie=c,I.p=s,A.T=i}}e.current=t,mt=2}}function Xm(){if(mt===2){mt=0;var e=gi,t=Ka,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=A.T,A.T=null;var s=I.p;I.p=2;var c=Ie;Ie|=4;try{Cm(e,t.alternate,t)}finally{Ie=c,I.p=s,A.T=i}}mt=3}}function Zm(){if(mt===4||mt===3){mt=0,Jn();var e=gi,t=Ka,i=Yn,s=zm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?mt=5:(mt=0,Ka=gi=null,Qm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(pi=null),kr(i),t=t.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(ei,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=A.T,c=I.p,I.p=2,A.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var C=s[b];d(C.value,{componentStack:C.stack})}}finally{A.T=t,I.p=c}}(Yn&3)!==0&&To(),wn(e),c=e.pendingLanes,(i&261930)!==0&&(c&42)!==0?e===cu?$l++:($l=0,cu=e):$l=0,ql(0)}}function Qm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,El(t)))}function To(){return Vm(),Xm(),Zm(),Wm()}function Wm(){if(mt!==5)return!1;var e=gi,t=ou;ou=0;var i=kr(Yn),s=A.T,c=I.p;try{I.p=32>i?32:i,A.T=null,i=ru,ru=null;var d=gi,b=Yn;if(mt=0,Ka=gi=null,Yn=0,(Ie&6)!==0)throw Error(o(331));var C=Ie;if(Ie|=4,jm(d.current),Lm(d,d.current,b,i),Ie=C,ql(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(ei,d)}catch{}return!0}finally{I.p=c,A.T=s,Qm(e,t)}}function Jm(e,t,i){t=en(i,t),t=Ic(e.stateNode,t,2),e=ci(e,t,2),e!==null&&(hl(e,2),wn(e))}function Ge(e,t,i){if(e.tag===3)Jm(e,e,i);else for(;t!==null;){if(t.tag===3){Jm(t,e,i);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(pi===null||!pi.has(s))){e=en(i,e),i=em(2),s=ci(t,i,2),s!==null&&(tm(i,s,t,e),hl(s,2),wn(s));break}}t=t.return}}function fu(e,t,i){var s=e.pingCache;if(s===null){s=e.pingCache=new Tv;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(i)||(au=!0,c.add(i),e=kv.bind(null,e,t,i),t.then(e,e))}function kv(e,t,i){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,qe===e&&(ze&i)===i&&(at===4||at===3&&(ze&62914560)===ze&&300>Mt()-yo?(Ie&2)===0&&Ia(e,0):lu|=i,Ua===ze&&(Ua=0)),wn(e)}function ep(e,t){t===0&&(t=qd()),e=Ki(e,t),e!==null&&(hl(e,t),wn(e))}function Lv(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),ep(e,i)}function _v(e,t){var i=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(i=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),ep(e,i)}function Rv(e,t){return An(e,t)}var Mo=null,Ga=null,hu=!1,Ao=!1,mu=!1,yi=0;function wn(e){e!==Ga&&e.next===null&&(Ga===null?Mo=Ga=e:Ga=Ga.next=e),Ao=!0,hu||(hu=!0,Ov())}function ql(e,t){if(!mu&&Ao){mu=!0;do for(var i=!1,s=Mo;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var b=s.suspendedLanes,C=s.pingedLanes;d=(1<<31-At(42|e)+1)-1,d&=c&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(i=!0,ap(s,d))}else d=ze,d=Di(s,s===qe?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||fl(s,d)||(i=!0,ap(s,d));s=s.next}while(i);mu=!1}}function jv(){tp()}function tp(){Ao=hu=!1;var e=0;yi!==0&&Yv()&&(e=yi);for(var t=Mt(),i=null,s=Mo;s!==null;){var c=s.next,d=np(s,t);d===0?(s.next=null,i===null?Mo=c:i.next=c,c===null&&(Ga=i)):(i=s,(e!==0||(d&3)!==0)&&(Ao=!0)),s=c}mt!==0&&mt!==5||ql(e),yi!==0&&(yi=0)}function np(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-At(d),C=1<<b,L=c[b];L===-1?((C&i)===0||(C&s)!==0)&&(c[b]=s0(C,t)):L<=t&&(e.expiredLanes|=C),d&=~C}if(t=qe,i=ze,i=Di(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,i===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&gn(s),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||fl(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(s!==null&&gn(s),kr(i)){case 2:case 8:i=ul;break;case 32:i=Oi;break;case 268435456:i=dl;break;default:i=Oi}return s=ip.bind(null,e),i=An(i,s),e.callbackPriority=t,e.callbackNode=i,t}return s!==null&&s!==null&&gn(s),e.callbackPriority=2,e.callbackNode=null,2}function ip(e,t){if(mt!==0&&mt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(To()&&e.callbackNode!==i)return null;var s=ze;return s=Di(e,e===qe?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Bm(e,s,t),np(e,Mt()),e.callbackNode!=null&&e.callbackNode===i?ip.bind(null,e):null)}function ap(e,t){if(To())return null;Bm(e,t,!0)}function Ov(){$v(function(){(Ie&6)!==0?An(cl,jv):tp()})}function pu(){if(yi===0){var e=Na;e===0&&(e=Zt,Zt<<=1,(Zt&261888)===0&&(Zt=256)),yi=e}return yi}function lp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:js(""+e)}function sp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Dv(e,t,i,s,c){if(t==="submit"&&i&&i.stateNode===c){var d=lp((c[jt]||null).action),b=s.submitter;b&&(t=(t=b[jt]||null)?lp(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new Hs("action","action",null,s,c);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(yi!==0){var L=b?sp(c,b):new FormData(c);Dc(i,{pending:!0,data:L,method:c.method,action:d},null,L)}}else typeof d=="function"&&(C.preventDefault(),L=b?sp(c,b):new FormData(c),Dc(i,{pending:!0,data:L,method:c.method,action:d},d,L))},currentTarget:c}]})}}for(var gu=0;gu<Wr.length;gu++){var bu=Wr[gu],zv=bu.toLowerCase(),Hv=bu[0].toUpperCase()+bu.slice(1);fn(zv,"on"+Hv)}fn(Hf,"onAnimationEnd"),fn(Bf,"onAnimationIteration"),fn(Uf,"onAnimationStart"),fn("dblclick","onDoubleClick"),fn("focusin","onFocus"),fn("focusout","onBlur"),fn(J0,"onTransitionRun"),fn(ev,"onTransitionStart"),fn(tv,"onTransitionCancel"),fn(Kf,"onTransitionEnd"),ma("onMouseEnter",["mouseout","mouseover"]),ma("onMouseLeave",["mouseout","mouseover"]),ma("onPointerEnter",["pointerout","pointerover"]),ma("onPointerLeave",["pointerout","pointerover"]),zi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zi("onBeforeInput",["compositionend","keypress","textInput","paste"]),zi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vl="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(" "),Bv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vl));function op(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var s=e[i],c=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var C=s[b],L=C.instance,G=C.currentTarget;if(C=C.listener,L!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=G;try{d(c)}catch(X){Ks(X)}c.currentTarget=null,d=L}else for(b=0;b<s.length;b++){if(C=s[b],L=C.instance,G=C.currentTarget,C=C.listener,L!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=G;try{d(c)}catch(X){Ks(X)}c.currentTarget=null,d=L}}}}function Oe(e,t){var i=t[Lr];i===void 0&&(i=t[Lr]=new Set);var s=e+"__bubble";i.has(s)||(rp(t,e,2,!1),i.add(s))}function yu(e,t,i){var s=0;t&&(s|=4),rp(i,e,s,t)}var Eo="_reactListening"+Math.random().toString(36).slice(2);function vu(e){if(!e[Eo]){e[Eo]=!0,ef.forEach(function(i){i!=="selectionchange"&&(Bv.has(i)||yu(i,!1,e),yu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Eo]||(t[Eo]=!0,yu("selectionchange",!1,t))}}function rp(e,t,i,s){switch(Hp(t)){case 2:var c=fx;break;case 8:c=hx;break;default:c=Ou}i=c.bind(null,t,i,e),c=void 0,!Ur||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,i,{capture:!0,passive:c}):e.addEventListener(t,i,!0):c!==void 0?e.addEventListener(t,i,{passive:c}):e.addEventListener(t,i,!1)}function xu(e,t,i,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var C=s.stateNode.containerInfo;if(C===c)break;if(b===4)for(b=s.return;b!==null;){var L=b.tag;if((L===3||L===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;C!==null;){if(b=da(C),b===null)return;if(L=b.tag,L===5||L===6||L===26||L===27){s=d=b;continue e}C=C.parentNode}}s=s.return}hf(function(){var G=d,X=Hr(i),ee=[];e:{var Y=If.get(e);if(Y!==void 0){var $=Hs,pe=e;switch(e){case"keypress":if(Ds(i)===0)break e;case"keydown":case"keyup":$=_0;break;case"focusin":pe="focus",$=Gr;break;case"focusout":pe="blur",$=Gr;break;case"beforeblur":case"afterblur":$=Gr;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$=gf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$=v0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$=O0;break;case Hf:case Bf:case Uf:$=S0;break;case Kf:$=z0;break;case"scroll":case"scrollend":$=b0;break;case"wheel":$=B0;break;case"copy":case"cut":case"paste":$=T0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$=yf;break;case"toggle":case"beforetoggle":$=K0}var Ce=(t&4)!==0,$e=!Ce&&(e==="scroll"||e==="scrollend"),U=Ce?Y!==null?Y+"Capture":null:Y;Ce=[];for(var O=G,F;O!==null;){var Q=O;if(F=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||F===null||U===null||(Q=gl(O,U),Q!=null&&Ce.push(Xl(O,Q,F))),$e)break;O=O.return}0<Ce.length&&(Y=new $(Y,pe,null,i,X),ee.push({event:Y,listeners:Ce}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",$=e==="mouseout"||e==="pointerout",Y&&i!==zr&&(pe=i.relatedTarget||i.fromElement)&&(da(pe)||pe[ua]))break e;if(($||Y)&&(Y=X.window===X?X:(Y=X.ownerDocument)?Y.defaultView||Y.parentWindow:window,$?(pe=i.relatedTarget||i.toElement,$=G,pe=pe?da(pe):null,pe!==null&&($e=u(pe),Ce=pe.tag,pe!==$e||Ce!==5&&Ce!==27&&Ce!==6)&&(pe=null)):($=null,pe=G),$!==pe)){if(Ce=gf,Q="onMouseLeave",U="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=yf,Q="onPointerLeave",U="onPointerEnter",O="pointer"),$e=$==null?Y:pl($),F=pe==null?Y:pl(pe),Y=new Ce(Q,O+"leave",$,i,X),Y.target=$e,Y.relatedTarget=F,Q=null,da(X)===G&&(Ce=new Ce(U,O+"enter",pe,i,X),Ce.target=F,Ce.relatedTarget=$e,Q=Ce),$e=Q,$&&pe)t:{for(Ce=Uv,U=$,O=pe,F=0,Q=U;Q;Q=Ce(Q))F++;Q=0;for(var Se=O;Se;Se=Ce(Se))Q++;for(;0<F-Q;)U=Ce(U),F--;for(;0<Q-F;)O=Ce(O),Q--;for(;F--;){if(U===O||O!==null&&U===O.alternate){Ce=U;break t}U=Ce(U),O=Ce(O)}Ce=null}else Ce=null;$!==null&&cp(ee,Y,$,Ce,!1),pe!==null&&$e!==null&&cp(ee,$e,pe,Ce,!0)}}e:{if(Y=G?pl(G):window,$=Y.nodeName&&Y.nodeName.toLowerCase(),$==="select"||$==="input"&&Y.type==="file")var Ue=Af;else if(Tf(Y))if(Ef)Ue=Z0;else{Ue=V0;var be=q0}else $=Y.nodeName,!$||$.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?G&&Dr(G.elementType)&&(Ue=Af):Ue=X0;if(Ue&&(Ue=Ue(e,G))){Mf(ee,Ue,i,X);break e}be&&be(e,Y,G),e==="focusout"&&G&&Y.type==="number"&&G.memoizedProps.value!=null&&Or(Y,"number",Y.value)}switch(be=G?pl(G):window,e){case"focusin":(Tf(be)||be.contentEditable==="true")&&(xa=be,Xr=G,Tl=null);break;case"focusout":Tl=Xr=xa=null;break;case"mousedown":Zr=!0;break;case"contextmenu":case"mouseup":case"dragend":Zr=!1,Df(ee,i,X);break;case"selectionchange":if(W0)break;case"keydown":case"keyup":Df(ee,i,X)}var Le;if(Pr)e:{switch(e){case"compositionstart":var He="onCompositionStart";break e;case"compositionend":He="onCompositionEnd";break e;case"compositionupdate":He="onCompositionUpdate";break e}He=void 0}else va?Sf(e,i)&&(He="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(He="onCompositionStart");He&&(vf&&i.locale!=="ko"&&(va||He!=="onCompositionStart"?He==="onCompositionEnd"&&va&&(Le=mf()):(ni=X,Kr="value"in ni?ni.value:ni.textContent,va=!0)),be=No(G,He),0<be.length&&(He=new bf(He,e,null,i,X),ee.push({event:He,listeners:be}),Le?He.data=Le:(Le=Cf(i),Le!==null&&(He.data=Le)))),(Le=F0?G0(e,i):Y0(e,i))&&(He=No(G,"onBeforeInput"),0<He.length&&(be=new bf("onBeforeInput","beforeinput",null,i,X),ee.push({event:be,listeners:He}),be.data=Le)),Dv(ee,e,G,i,X)}op(ee,t)})}function Xl(e,t,i){return{instance:e,listener:t,currentTarget:i}}function No(e,t){for(var i=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=gl(e,i),c!=null&&s.unshift(Xl(e,c,d)),c=gl(e,t),c!=null&&s.push(Xl(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Uv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function cp(e,t,i,s,c){for(var d=t._reactName,b=[];i!==null&&i!==s;){var C=i,L=C.alternate,G=C.stateNode;if(C=C.tag,L!==null&&L===s)break;C!==5&&C!==26&&C!==27||G===null||(L=G,c?(G=gl(i,d),G!=null&&b.unshift(Xl(i,G,L))):c||(G=gl(i,d),G!=null&&b.push(Xl(i,G,L)))),i=i.return}b.length!==0&&e.push({event:t,listeners:b})}var Kv=/\r\n?/g,Iv=/\u0000|\uFFFD/g;function up(e){return(typeof e=="string"?e:""+e).replace(Kv,`
|
|
33
|
+
`).replace(Iv,"")}function dp(e,t){return t=up(t),up(e)===t}function Pe(e,t,i,s,c,d){switch(i){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||ga(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&ga(e,""+s);break;case"className":_s(e,"class",s);break;case"tabIndex":_s(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":_s(e,i,s);break;case"style":df(e,s,d);break;case"data":if(t!=="object"){_s(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=js(""+s),e.setAttribute(i,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(i==="formAction"?(t!=="input"&&Pe(e,t,"name",c.name,c,null),Pe(e,t,"formEncType",c.formEncType,c,null),Pe(e,t,"formMethod",c.formMethod,c,null),Pe(e,t,"formTarget",c.formTarget,c,null)):(Pe(e,t,"encType",c.encType,c,null),Pe(e,t,"method",c.method,c,null),Pe(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=js(""+s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=kn);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(i=s.__html,i!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=i}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}i=js(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""+s):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":s===!0?e.setAttribute(i,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,s):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(i,s):e.removeAttribute(i);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(i):e.setAttribute(i,s);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Ls(e,"popover",s);break;case"xlinkActuate":Nn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Nn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Nn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Nn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Nn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Nn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Nn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Nn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Nn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ls(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=p0.get(i)||i,Ls(e,i,s))}}function wu(e,t,i,s,c,d){switch(i){case"style":df(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(i=s.__html,i!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=i}}break;case"children":typeof s=="string"?ga(e,s):(typeof s=="number"||typeof s=="bigint")&&ga(e,""+s);break;case"onScroll":s!=null&&Oe("scroll",e);break;case"onScrollEnd":s!=null&&Oe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=kn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tf.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(c=i.endsWith("Capture"),t=i.slice(2,c?i.length-7:void 0),d=e[jt]||null,d=d!=null?d[i]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,s,c);break e}i in e?e[i]=s:s===!0?e.setAttribute(i,""):Ls(e,i,s)}}}function Tt(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",e),Oe("load",e);var s=!1,c=!1,d;for(d in i)if(i.hasOwnProperty(d)){var b=i[d];if(b!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Pe(e,t,d,b,i,null)}}c&&Pe(e,t,"srcSet",i.srcSet,i,null),s&&Pe(e,t,"src",i.src,i,null);return;case"input":Oe("invalid",e);var C=d=b=c=null,L=null,G=null;for(s in i)if(i.hasOwnProperty(s)){var X=i[s];if(X!=null)switch(s){case"name":c=X;break;case"type":b=X;break;case"checked":L=X;break;case"defaultChecked":G=X;break;case"value":d=X;break;case"defaultValue":C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:Pe(e,t,s,X,i,null)}}of(e,d,C,L,G,b,c,!1);return;case"select":Oe("invalid",e),s=b=d=null;for(c in i)if(i.hasOwnProperty(c)&&(C=i[c],C!=null))switch(c){case"value":d=C;break;case"defaultValue":b=C;break;case"multiple":s=C;default:Pe(e,t,c,C,i,null)}t=d,i=b,e.multiple=!!s,t!=null?pa(e,!!s,t,!1):i!=null&&pa(e,!!s,i,!0);return;case"textarea":Oe("invalid",e),d=c=s=null;for(b in i)if(i.hasOwnProperty(b)&&(C=i[b],C!=null))switch(b){case"value":s=C;break;case"defaultValue":c=C;break;case"children":d=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(o(91));break;default:Pe(e,t,b,C,i,null)}cf(e,s,c,d);return;case"option":for(L in i)if(i.hasOwnProperty(L)&&(s=i[L],s!=null))switch(L){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Pe(e,t,L,s,i,null)}return;case"dialog":Oe("beforetoggle",e),Oe("toggle",e),Oe("cancel",e),Oe("close",e);break;case"iframe":case"object":Oe("load",e);break;case"video":case"audio":for(s=0;s<Vl.length;s++)Oe(Vl[s],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in i)if(i.hasOwnProperty(G)&&(s=i[G],s!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Pe(e,t,G,s,i,null)}return;default:if(Dr(t)){for(X in i)i.hasOwnProperty(X)&&(s=i[X],s!==void 0&&wu(e,t,X,s,i,void 0));return}}for(C in i)i.hasOwnProperty(C)&&(s=i[C],s!=null&&Pe(e,t,C,s,i,null))}function Fv(e,t,i,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,b=null,C=null,L=null,G=null,X=null;for($ in i){var ee=i[$];if(i.hasOwnProperty($)&&ee!=null)switch($){case"checked":break;case"value":break;case"defaultValue":L=ee;default:s.hasOwnProperty($)||Pe(e,t,$,null,s,ee)}}for(var Y in s){var $=s[Y];if(ee=i[Y],s.hasOwnProperty(Y)&&($!=null||ee!=null))switch(Y){case"type":d=$;break;case"name":c=$;break;case"checked":G=$;break;case"defaultChecked":X=$;break;case"value":b=$;break;case"defaultValue":C=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(o(137,t));break;default:$!==ee&&Pe(e,t,Y,$,s,ee)}}jr(e,b,C,L,G,X,d,c);return;case"select":$=b=C=Y=null;for(d in i)if(L=i[d],i.hasOwnProperty(d)&&L!=null)switch(d){case"value":break;case"multiple":$=L;default:s.hasOwnProperty(d)||Pe(e,t,d,null,s,L)}for(c in s)if(d=s[c],L=i[c],s.hasOwnProperty(c)&&(d!=null||L!=null))switch(c){case"value":Y=d;break;case"defaultValue":C=d;break;case"multiple":b=d;default:d!==L&&Pe(e,t,c,d,s,L)}t=C,i=b,s=$,Y!=null?pa(e,!!i,Y,!1):!!s!=!!i&&(t!=null?pa(e,!!i,t,!0):pa(e,!!i,i?[]:"",!1));return;case"textarea":$=Y=null;for(C in i)if(c=i[C],i.hasOwnProperty(C)&&c!=null&&!s.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Pe(e,t,C,null,s,c)}for(b in s)if(c=s[b],d=i[b],s.hasOwnProperty(b)&&(c!=null||d!=null))switch(b){case"value":Y=c;break;case"defaultValue":$=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&Pe(e,t,b,c,s,d)}rf(e,Y,$);return;case"option":for(var pe in i)if(Y=i[pe],i.hasOwnProperty(pe)&&Y!=null&&!s.hasOwnProperty(pe))switch(pe){case"selected":e.selected=!1;break;default:Pe(e,t,pe,null,s,Y)}for(L in s)if(Y=s[L],$=i[L],s.hasOwnProperty(L)&&Y!==$&&(Y!=null||$!=null))switch(L){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Pe(e,t,L,Y,s,$)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in i)Y=i[Ce],i.hasOwnProperty(Ce)&&Y!=null&&!s.hasOwnProperty(Ce)&&Pe(e,t,Ce,null,s,Y);for(G in s)if(Y=s[G],$=i[G],s.hasOwnProperty(G)&&Y!==$&&(Y!=null||$!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:Pe(e,t,G,Y,s,$)}return;default:if(Dr(t)){for(var $e in i)Y=i[$e],i.hasOwnProperty($e)&&Y!==void 0&&!s.hasOwnProperty($e)&&wu(e,t,$e,void 0,s,Y);for(X in s)Y=s[X],$=i[X],!s.hasOwnProperty(X)||Y===$||Y===void 0&&$===void 0||wu(e,t,X,Y,s,$);return}}for(var U in i)Y=i[U],i.hasOwnProperty(U)&&Y!=null&&!s.hasOwnProperty(U)&&Pe(e,t,U,null,s,Y);for(ee in s)Y=s[ee],$=i[ee],!s.hasOwnProperty(ee)||Y===$||Y==null&&$==null||Pe(e,t,ee,Y,s,$)}function fp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Gv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),s=0;s<i.length;s++){var c=i[s],d=c.transferSize,b=c.initiatorType,C=c.duration;if(d&&C&&fp(b)){for(b=0,C=c.responseEnd,s+=1;s<i.length;s++){var L=i[s],G=L.startTime;if(G>C)break;var X=L.transferSize,ee=L.initiatorType;X&&fp(ee)&&(L=L.responseEnd,b+=X*(L<C?1:(C-G)/(L-G)))}if(--s,t+=8*(d+b)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Su=null,Cu=null;function ko(e){return e.nodeType===9?e:e.ownerDocument}function hp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function mp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Tu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Mu=null;function Yv(){var e=window.event;return e&&e.type==="popstate"?e===Mu?!1:(Mu=e,!0):(Mu=null,!1)}var pp=typeof setTimeout=="function"?setTimeout:void 0,Pv=typeof clearTimeout=="function"?clearTimeout:void 0,gp=typeof Promise=="function"?Promise:void 0,$v=typeof queueMicrotask=="function"?queueMicrotask:typeof gp<"u"?function(e){return gp.resolve(null).then(e).catch(qv)}:pp;function qv(e){setTimeout(function(){throw e})}function vi(e){return e==="head"}function bp(e,t){var i=t,s=0;do{var c=i.nextSibling;if(e.removeChild(i),c&&c.nodeType===8)if(i=c.data,i==="/$"||i==="/&"){if(s===0){e.removeChild(c),qa(t);return}s--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")s++;else if(i==="html")Zl(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Zl(i);for(var d=i.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[ml]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||i.removeChild(d),d=b}}else i==="body"&&Zl(e.ownerDocument.body);i=c}while(i);qa(t)}function yp(e,t){var i=e;e=0;do{var s=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=s}while(i)}function Au(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Au(i),_r(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Vv(e,t,i,s){for(;e.nodeType===1;){var c=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ml])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=sn(e.nextSibling),e===null)break}return null}function Xv(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=sn(e.nextSibling),e===null))return null;return e}function vp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sn(e.nextSibling),e===null))return null;return e}function Eu(e){return e.data==="$?"||e.data==="$~"}function Nu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Zv(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var s=function(){t(),i.removeEventListener("DOMContentLoaded",s)};i.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function sn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var ku=null;function xp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return sn(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function wp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Sp(e,t,i){switch(t=ko(i),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Zl(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_r(e)}var on=new Map,Cp=new Set;function Lo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Pn=I.d;I.d={f:Qv,r:Wv,D:Jv,C:ex,L:tx,m:nx,X:ax,S:ix,M:lx};function Qv(){var e=Pn.f(),t=wo();return e||t}function Wv(e){var t=fa(e);t!==null&&t.tag===5&&t.type==="form"?Kh(t):Pn.r(e)}var Ya=typeof document>"u"?null:document;function Tp(e,t,i){var s=Ya;if(s&&typeof t=="string"&&t){var c=Wt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),Cp.has(c)||(Cp.add(c),e={rel:e,crossOrigin:i,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Tt(t,"link",e),bt(t),s.head.appendChild(t)))}}function Jv(e){Pn.D(e),Tp("dns-prefetch",e,null)}function ex(e,t){Pn.C(e,t),Tp("preconnect",e,t)}function tx(e,t,i){Pn.L(e,t,i);var s=Ya;if(s&&e&&t){var c='link[rel="preload"][as="'+Wt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+Wt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+Wt(i.imageSizes)+'"]')):c+='[href="'+Wt(e)+'"]';var d=c;switch(t){case"style":d=Pa(e);break;case"script":d=$a(e)}on.has(d)||(e=v({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),on.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(Ql(d))||t==="script"&&s.querySelector(Wl(d))||(t=s.createElement("link"),Tt(t,"link",e),bt(t),s.head.appendChild(t)))}}function nx(e,t){Pn.m(e,t);var i=Ya;if(i&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Wt(s)+'"][href="'+Wt(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=$a(e)}if(!on.has(d)&&(e=v({rel:"modulepreload",href:e},t),on.set(d,e),i.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Wl(d)))return}s=i.createElement("link"),Tt(s,"link",e),bt(s),i.head.appendChild(s)}}}function ix(e,t,i){Pn.S(e,t,i);var s=Ya;if(s&&e){var c=ha(s).hoistableStyles,d=Pa(e);t=t||"default";var b=c.get(d);if(!b){var C={loading:0,preload:null};if(b=s.querySelector(Ql(d)))C.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},i),(i=on.get(d))&&Lu(e,i);var L=b=s.createElement("link");bt(L),Tt(L,"link",e),L._p=new Promise(function(G,X){L.onload=G,L.onerror=X}),L.addEventListener("load",function(){C.loading|=1}),L.addEventListener("error",function(){C.loading|=2}),C.loading|=4,_o(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:C},c.set(d,b)}}}function ax(e,t){Pn.X(e,t);var i=Ya;if(i&&e){var s=ha(i).hoistableScripts,c=$a(e),d=s.get(c);d||(d=i.querySelector(Wl(c)),d||(e=v({src:e,async:!0},t),(t=on.get(c))&&_u(e,t),d=i.createElement("script"),bt(d),Tt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function lx(e,t){Pn.M(e,t);var i=Ya;if(i&&e){var s=ha(i).hoistableScripts,c=$a(e),d=s.get(c);d||(d=i.querySelector(Wl(c)),d||(e=v({src:e,async:!0,type:"module"},t),(t=on.get(c))&&_u(e,t),d=i.createElement("script"),bt(d),Tt(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function Mp(e,t,i,s){var c=(c=de.current)?Lo(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=Pa(i.href),i=ha(c).hoistableStyles,s=i.get(t),s||(s={type:"style",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Pa(i.href);var d=ha(c).hoistableStyles,b=d.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=c.querySelector(Ql(e)))&&!d._p&&(b.instance=d,b.state.loading=5),on.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},on.set(e,i),d||sx(c,e,i,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$a(i),i=ha(c).hoistableScripts,s=i.get(t),s||(s={type:"script",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Pa(e){return'href="'+Wt(e)+'"'}function Ql(e){return'link[rel="stylesheet"]['+e+"]"}function Ap(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function sx(e,t,i,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Tt(t,"link",i),bt(t),e.head.appendChild(t))}function $a(e){return'[src="'+Wt(e)+'"]'}function Wl(e){return"script[async]"+e}function Ep(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Wt(i.href)+'"]');if(s)return t.instance=s,bt(s),s;var c=v({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),bt(s),Tt(s,"style",c),_o(s,i.precedence,e),t.instance=s;case"stylesheet":c=Pa(i.href);var d=e.querySelector(Ql(c));if(d)return t.state.loading|=4,t.instance=d,bt(d),d;s=Ap(i),(c=on.get(c))&&Lu(s,c),d=(e.ownerDocument||e).createElement("link"),bt(d);var b=d;return b._p=new Promise(function(C,L){b.onload=C,b.onerror=L}),Tt(d,"link",s),t.state.loading|=4,_o(d,i.precedence,e),t.instance=d;case"script":return d=$a(i.src),(c=e.querySelector(Wl(d)))?(t.instance=c,bt(c),c):(s=i,(c=on.get(d))&&(s=v({},i),_u(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),bt(c),Tt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,_o(s,i.precedence,e));return t.instance}function _o(e,t,i){for(var s=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,b=0;b<s.length;b++){var C=s[b];if(C.dataset.precedence===t)d=C;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Lu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function _u(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ro=null;function Np(e,t,i){if(Ro===null){var s=new Map,c=Ro=new Map;c.set(i,s)}else c=Ro,s=c.get(i),s||(s=new Map,c.set(i,s));if(s.has(e))return s;for(s.set(e,null),i=i.getElementsByTagName(e),c=0;c<i.length;c++){var d=i[c];if(!(d[ml]||d[xt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var C=s.get(b);C?C.push(d):s.set(b,[d])}}return s}function kp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function ox(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Lp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function rx(e,t,i,s){if(i.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var c=Pa(s.href),d=t.querySelector(Ql(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=jo.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=d,bt(d);return}d=t.ownerDocument||t,s=Ap(s),(c=on.get(c))&&Lu(s,c),d=d.createElement("link"),bt(d);var b=d;b._p=new Promise(function(C,L){b.onload=C,b.onerror=L}),Tt(d,"link",s),i.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=jo.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Ru=0;function cx(e,t){return e.stylesheets&&e.count===0&&Do(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&Do(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Ru===0&&(Ru=62500*Gv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Do(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Ru?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function jo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Do(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Oo=null;function Do(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Oo=new Map,t.forEach(ux,e),Oo=null,jo.call(e))}function ux(e,t){if(!(t.state.loading&4)){var i=Oo.get(e);if(i)var s=i.get(null);else{i=new Map,Oo.set(e,i);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var b=c[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(i.set(b.dataset.precedence,b),s=b)}s&&i.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),d=i.get(b)||s,d===s&&i.set(null,c),i.set(b,c),this.count++,s=jo.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var Jl={$$typeof:R,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function dx(e,t,i,s,c,d,b,C,L){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Er(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Er(0),this.hiddenUpdates=Er(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function _p(e,t,i,s,c,d,b,C,L,G,X,ee){return e=new dx(e,t,i,b,L,G,X,ee,C),t=1,d===!0&&(t|=24),d=Ft(3,null,null,t),e.current=d,d.stateNode=e,t=dc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:i,cache:t},pc(d),e}function Rp(e){return e?(e=Ca,e):Ca}function jp(e,t,i,s,c,d){c=Rp(c),s.context===null?s.context=c:s.pendingContext=c,s=ri(t),s.payload={element:i},d=d===void 0?null:d,d!==null&&(s.callback=d),i=ci(e,s,t),i!==null&&(Ut(i,e,t),_l(i,e,t))}function Op(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function ju(e,t){Op(e,t),(e=e.alternate)&&Op(e,t)}function Dp(e){if(e.tag===13||e.tag===31){var t=Ki(e,67108864);t!==null&&Ut(t,e,67108864),ju(e,67108864)}}function zp(e){if(e.tag===13||e.tag===31){var t=qt();t=Nr(t);var i=Ki(e,t);i!==null&&Ut(i,e,t),ju(e,t)}}var zo=!0;function fx(e,t,i,s){var c=A.T;A.T=null;var d=I.p;try{I.p=2,Ou(e,t,i,s)}finally{I.p=d,A.T=c}}function hx(e,t,i,s){var c=A.T;A.T=null;var d=I.p;try{I.p=8,Ou(e,t,i,s)}finally{I.p=d,A.T=c}}function Ou(e,t,i,s){if(zo){var c=Du(s);if(c===null)xu(e,t,s,Ho,i),Bp(e,s);else if(px(c,e,t,i,s))s.stopPropagation();else if(Bp(e,s),t&4&&-1<mx.indexOf(e)){for(;c!==null;){var d=fa(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=En(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var L=1<<31-At(b);C.entanglements[1]|=L,b&=~L}wn(d),(Ie&6)===0&&(vo=Mt()+500,ql(0))}}break;case 31:case 13:C=Ki(d,2),C!==null&&Ut(C,d,2),wo(),ju(d,2)}if(d=Du(s),d===null&&xu(e,t,s,Ho,i),d===c)break;c=d}c!==null&&s.stopPropagation()}else xu(e,t,s,null,i)}}function Du(e){return e=Hr(e),zu(e)}var Ho=null;function zu(e){if(Ho=null,e=da(e),e!==null){var t=u(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=p(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ho=e,null}function Hp(e){switch(e){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(As()){case cl:return 2;case ul:return 8;case Oi:case Es:return 32;case dl:return 268435456;default:return 32}default:return 32}}var Hu=!1,xi=null,wi=null,Si=null,es=new Map,ts=new Map,Ci=[],mx="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".split(" ");function Bp(e,t){switch(e){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":wi=null;break;case"mouseover":case"mouseout":Si=null;break;case"pointerover":case"pointerout":es.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ts.delete(t.pointerId)}}function ns(e,t,i,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=fa(t),t!==null&&Dp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function px(e,t,i,s,c){switch(t){case"focusin":return xi=ns(xi,e,t,i,s,c),!0;case"dragenter":return wi=ns(wi,e,t,i,s,c),!0;case"mouseover":return Si=ns(Si,e,t,i,s,c),!0;case"pointerover":var d=c.pointerId;return es.set(d,ns(es.get(d)||null,e,t,i,s,c)),!0;case"gotpointercapture":return d=c.pointerId,ts.set(d,ns(ts.get(d)||null,e,t,i,s,c)),!0}return!1}function Up(e){var t=da(e.target);if(t!==null){var i=u(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Wd(e.priority,function(){zp(i)});return}}else if(t===31){if(t=p(i),t!==null){e.blockedOn=t,Wd(e.priority,function(){zp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Bo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=Du(e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);zr=s,i.target.dispatchEvent(s),zr=null}else return t=fa(i),t!==null&&Dp(t),e.blockedOn=i,!1;t.shift()}return!0}function Kp(e,t,i){Bo(e)&&i.delete(t)}function gx(){Hu=!1,xi!==null&&Bo(xi)&&(xi=null),wi!==null&&Bo(wi)&&(wi=null),Si!==null&&Bo(Si)&&(Si=null),es.forEach(Kp),ts.forEach(Kp)}function Uo(e,t){e.blockedOn===t&&(e.blockedOn=null,Hu||(Hu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,gx)))}var Ko=null;function Ip(e){Ko!==e&&(Ko=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Ko===e&&(Ko=null);for(var t=0;t<e.length;t+=3){var i=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(zu(s||i)===null)continue;break}var d=fa(i);d!==null&&(e.splice(t,3),t-=3,Dc(d,{pending:!0,data:c,method:i.method,action:s},s,c))}}))}function qa(e){function t(L){return Uo(L,e)}xi!==null&&Uo(xi,e),wi!==null&&Uo(wi,e),Si!==null&&Uo(Si,e),es.forEach(t),ts.forEach(t);for(var i=0;i<Ci.length;i++){var s=Ci[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ci.length&&(i=Ci[0],i.blockedOn===null);)Up(i),i.blockedOn===null&&Ci.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(s=0;s<i.length;s+=3){var c=i[s],d=i[s+1],b=c[jt]||null;if(typeof d=="function")b||Ip(i);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[jt]||null)C=b.formAction;else if(zu(c)!==null)continue}else C=b.action;typeof C=="function"?i[s+1]=C:(i.splice(s,3),s-=3),Ip(i)}}}function Fp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(i,20)}function i(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Bu(e){this._internalRoot=e}Io.prototype.render=Bu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var i=t.current,s=qt();jp(i,s,e,t,null,null)},Io.prototype.unmount=Bu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;jp(e.current,2,null,e,null,null),wo(),t[ua]=null}};function Io(e){this._internalRoot=e}Io.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qd();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ci.length&&t!==0&&t<Ci[i].priority;i++);Ci.splice(i,0,e),i===0&&Up(e)}};var Gp=n.version;if(Gp!=="19.2.8")throw Error(o(527,Gp,"19.2.8"));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var bx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fo.isDisabled&&Fo.supportsFiber)try{ei=Fo.inject(bx),Lt=Fo}catch{}}return as.createRoot=function(e,t){if(!r(e))throw Error(o(299));var i=!1,s="",c=Zh,d=Qh,b=Wh;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=_p(e,1,!1,null,null,i,s,null,c,d,b,Fp),e[ua]=t.current,vu(e),new Bu(t)},as.hydrateRoot=function(e,t,i){if(!r(e))throw Error(o(299));var s=!1,c="",d=Zh,b=Qh,C=Wh,L=null;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onUncaughtError!==void 0&&(d=i.onUncaughtError),i.onCaughtError!==void 0&&(b=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError),i.formState!==void 0&&(L=i.formState)),t=_p(e,1,!0,t,i??null,s,c,L,d,b,C,Fp),t.context=Rp(null),i=t.current,s=qt(),s=Nr(s),c=ri(s),c.callback=null,ci(i,c,s),i=s,t.current.lanes=i,hl(t,i),wn(t),e[ua]=t.current,vu(e),new Io(t)},as.version="19.2.8",as}var Xp;function Nx(){if(Xp)return Ku.exports;Xp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(n){console.error(n)}}return a(),Ku.exports=Ex(),Ku.exports}var kx=Nx();const Lx=fb(kx),Rt="/ws/client",mb={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",controlActive:"Full Control",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedWindows:"{count} windows",modeLabel:"Input mode",controlHint:"Keys, paste and clicks go to the terminal",observerHint:"Watch only: input is held back, scrolling still works",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",addSubtitle:"A pairing code is all it takes",advancedTitle:"Advanced",advancedHint:"another relay, or a device token",pairAndConnect:"Pair & Connect",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",subtitleInstance:"Only for {name}",tabGeneral:"General",sectionInterface:"Interface",sectionFont:"Font",sectionInput:"Input",sectionAdmin:"Administration",toggleOn:"On",toggleOff:"Off",hostFontLabel:"Workstation font",adminEntry:"Relay dashboard",adminEntryHint:"Hosts, devices and traffic; needs the admin token",adminEntryOpen:"Open",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeHint:"This window only",fontSizeLabel:"Terminal Text Size ({size}px)",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Show typing before the echo returns on slow links",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Modifier and arrow keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count waiting and finished agents in the tab title",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent waits or finishes (page on screen)",agentAlertSound:"Chime",agentAlertSoundDesc:"In the background; works after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"In the background (HTTPS only)",languageLabel:"Language",languageHint:"Shared by every instance",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",listGroup:"{profile} shortcuts",genericGroup:"General",profileRowLabel:"Agent to edit",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown); base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",customizeBarShort:"Edit",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",helperTitle:"Quick Commands",closeHelper:"Close Helper",placeholder:"Type command and press Enter...",sendButton:"Send",clearInput:"Clear Input",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",keyEnter:"Enter",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",image:"Image",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",pairingAria:"Connection & pairing",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control",newAdminTerminal:"Open an administrator PowerShell tab in Herdr",adminShort:"Admin",adminTerminalSetup:"On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access. Approve the one-time Windows prompt under the same account as Herdr Remote.",adminTerminalUpdate:"Update the relay and Windows host connector before opening an administrator terminal."},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto refresh",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic ↓in / ↑out",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:"This window is in viewer mode. Switch to Full control to type.",clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready.",admin_broker_unavailable:"The administrator terminal broker is not running. On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access, then tap Admin again.",admin_terminal_unsupported:"This relay or Windows host connector cannot open administrator terminals. Upgrade both, then try again.",admin_tab_failed:"Could not open the administrator tab in Herdr. The host connector log has the details."},fontPresets:{host:"Workstation font (default)",system:"System monospace"},hostFont:{title:"Workstation terminal font",body:"The terminal on {host} uses {family}{detail}. This device does not have it.",bodyGlyphsOnly:"The terminal on {host} draws Chinese with {family}. This device does not have it.",glyphs:"Chinese in {family}: about 2 MB of common characters first; any other character loads the first time it appears.",glyphsAll:"{family} is too large to send whole: about 2 MB of common characters first; any other character loads the first time it appears.",detail:" ({detail})",detailSeparator:", ",download:"Load {count} font file(s), {size} in total. Downloaded once, then kept in this browser.",load:"Load font",decline:"Use this device’s fonts",loading:"Loading {received} of {total}",failed:"The font could not be loaded: {reason}",loaded:"Workstation font loaded",reasons:{host_font_unavailable:"the font changed on the workstation. Sync it again from Settings",host_font_timeout:"the workstation stopped answering",disconnected:"the connection dropped",font_api_unavailable:"this browser cannot load fonts",other:"the browser could not read the font file"}},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},_x={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",controlActive:"控制端",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedWindows:"{count} 个窗口",modeLabel:"输入模式",controlHint:"按键、粘贴和点击都会发送到终端",observerHint:"只看不动:输入被拦下,仍可滚动",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",addSubtitle:"只需输入配对码",advancedTitle:"高级选项",advancedHint:"其他 Relay 或已有设备 Token",pairAndConnect:"配对并连接",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",subtitleInstance:"仅对 {name} 生效",tabGeneral:"通用",sectionInterface:"界面",sectionFont:"字体",sectionInput:"输入",sectionAdmin:"管理",toggleOn:"开",toggleOff:"关",hostFontLabel:"宿主机字体",adminEntry:"Relay 管理面板",adminEntryHint:"主机、设备与流量;需要管理员令牌",adminEntryOpen:"打开",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeHint:"只影响当前窗口",fontSizeLabel:"终端字号 ({size}px)",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时先显示输入,回显到达后校正",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"修饰键与方向键",touchHaptics:"触控振动反馈",touchHapticsDesc:"按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"标签页标题显示等待与完成数",agentAlertVibrate:"震动",agentAlertVibrateDesc:"等待确认或完成时(页面在前台)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放,下次点击后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时通知(仅 HTTPS)",languageLabel:"显示语言",languageHint:"所有实例共用",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",listGroup:"{profile} 快捷键",genericGroup:"通用",profileRowLabel:"编辑的智能体",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在按键栏显示的 {profile} 快捷键(已显示 {count} 个);ESC、方向键在「虚拟按键」页。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",customizeBarShort:"自定义",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",helperTitle:"快捷命令",closeHelper:"关闭命令助手",placeholder:"输入终端命令并回车...",sendButton:"发送",clearInput:"清除输入内容",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",keyEnter:"回车",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",image:"图片",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权",newAdminTerminal:"在 Herdr 中新建管理员 PowerShell 标签页",adminShort:"管理员",adminTerminalSetup:"请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,再使用运行 Herdr Remote 的同一账户批准一次 Windows 提权提示。",adminTerminalUpdate:"请先升级 relay 和 Windows 主机连接器,再新建管理员终端。"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"切换 Ctrl 锁定",alt:"切换 Alt 锁定",shift:"切换 Shift 锁定",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"概览",tabClients:"客户端 ({count})",tabPtys:"PTY ({count})",tabDevices:"设备 ({count})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接于",colTraffic:"流量 ↓入 / ↑出",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"本窗口处于观察者模式,切到「完全控制」才能输入",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。",admin_broker_unavailable:"管理员终端 broker 尚未运行。请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,然后再点一次「管理员」。",admin_terminal_unsupported:"当前 relay 或 Windows 主机连接器不支持管理员终端。请升级两端后再试。",admin_tab_failed:"无法在 Herdr 中打开管理员标签页,详情见主机连接器日志。"},fontPresets:{host:"宿主机终端字体(默认)",system:"系统等宽字体"},hostFont:{title:"宿主机终端字体",body:"{host} 的终端使用 {family}{detail}。这台设备没有安装该字体。",bodyGlyphsOnly:"{host} 的终端显示中文用 {family},这台设备没有安装该字体。",glyphs:"中文使用 {family}:先下载常用字约 2 MB,其余的字第一次出现时再补。",glyphsAll:"{family} 太大,不整包传输:先下载常用字符约 2 MB,其余字符第一次出现时再补。",detail:"({detail})",detailSeparator:",",download:"加载 {count} 个字体文件,共 {size}。只下载一次,之后保存在本浏览器。",load:"加载字体",decline:"使用本机字体",loading:"正在加载 {received} / {total}",failed:"字体加载失败:{reason}",loaded:"宿主机字体已加载",reasons:{host_font_unavailable:"宿主机上的字体已变化,请在设置里重新同步",host_font_timeout:"宿主机没有响应",disconnected:"连接已断开",font_api_unavailable:"此浏览器不支持加载字体",other:"浏览器无法解析该字体文件"}},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},Gu={en:mb,zh:_x};function Ld(a,n,l){const o=Gu[a]||Gu.en,r=n.split(".");let u=o;for(const h of r)if(u&&typeof u=="object"&&h in u)u=u[h];else{let p=Gu.en;for(const m of r)if(p&&typeof p=="object"&&m in p)p=p[m];else return n;u=p;break}if(typeof u!="string")return n;if(l){let h=u;for(const[p,m]of Object.entries(l))h=h.replaceAll(`{${p}}`,String(m));return h}return u}function Yu(a){return typeof a=="string"&&Object.hasOwn(mb.serverErrors,a)}const re={ESC:"\x1B",TAB:" ",SHIFT_TAB:"\x1B[Z",ENTER:"\r",BACKSPACE:"",UP:"\x1B[A",DOWN:"\x1B[B",RIGHT:"\x1B[C",LEFT:"\x1B[D",HOME:"\x1B[H",END:"\x1B[F",PAGE_UP:"\x1B[5~",PAGE_DOWN:"\x1B[6~",INSERT:"\x1B[2~",DELETE:"\x1B[3~",CTRL_C:"",CTRL_D:"",CTRL_Z:"",CTRL_L:"\f",CTRL_A:"",CTRL_E:"",CTRL_K:"\v",CTRL_R:"",CTRL_W:"",CTRL_U:"",CTRL_X:"",CTRL_N:"",CTRL_P:"",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},Rx=new TextEncoder;function _d(a){return Rx.encode(a)}function pb(a){if(!a||a.length===0)return"";const l=a.toUpperCase().charCodeAt(0);return l>=65&&l<=90?String.fromCharCode(l-64):a==="@"||a===" "?"\0":a==="["?"\x1B":a==="\\"?"":a==="]"?"":a==="^"?"":a==="_"?"":a==="?"?"":a}function jx(a){return`\x1B${a}`}function Zp({ctrl:a,alt:n,shift:l}){return 1+(l?1:0)+(n?2:0)+(a?4:0)}const gb=/^\x1b[[O]([ABCDHF])$/,bb=/^\x1bO([PQRS])$/,yb=/^\x1b\[(\d+)~$/;function cr(a,n){const{ctrl:l=!1,alt:o=!1,shift:r=!1}=n;if(!l&&!o&&!r)return a;const u=Zp(n),h=o&&!l&&!r,p=gb.exec(a);if(p)return`\x1B[1;${u}${p[1]}`;const m=bb.exec(a);if(m)return`\x1B[1;${u}${m[1]}`;const g=yb.exec(a);if(g)return`\x1B[${g[1]};${u}~`;switch(a){case re.TAB:return r&&!l&&!o?re.SHIFT_TAB:h?`\x1B${a}`:`\x1B[9;${u}u`;case re.SHIFT_TAB:return!l&&!o?a:`\x1B[9;${Zp({...n,shift:!0})}u`;case re.ENTER:return h?`\x1B${a}`:`\x1B[13;${u}u`;case re.BACKSPACE:return l&&!o&&!r?"\b":h?`\x1B${a}`:`\x1B[127;${u}u`;case re.ESC:return h?`\x1B${a}`:`\x1B[27;${u}u`}let y=a;return r&&a.length===1&&!l&&(y=a.toUpperCase()),l&&(y=pb(y)),o&&(y=jx(y)),y}function Ox(a){return[...a].length===1?!0:gb.test(a)||bb.test(a)||yb.test(a)||a===re.SHIFT_TAB}class Cn extends Error{constructor(l,o={}){super(l);q(this,"code");q(this,"params");this.name="KeyComboError",this.code=l,this.params=o}}const Dx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},Qp={esc:re.ESC,tab:re.TAB,enter:re.ENTER,backspace:re.BACKSPACE,delete:re.DELETE,left:re.LEFT,right:re.RIGHT,up:re.UP,down:re.DOWN,home:re.HOME,end:re.END,pageup:re.PAGE_UP,pagedown:re.PAGE_DOWN,insert:re.INSERT,space:" ","+":"+"},zx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Hx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function vb(a,n){const l=a.toLowerCase().split("+");if(l.some(m=>!m))throw new Cn("invalidStepSyntax",{step:n+1});const o={};let r;for(const m of l)if(m==="ctrl"||m==="control"){if(o.ctrl)throw new Cn("duplicateModifier",{step:n+1,modifier:"Ctrl"});o.ctrl=!0}else if(m==="alt"||m==="option"){if(o.alt)throw new Cn("duplicateModifier",{step:n+1,modifier:"Alt"});o.alt=!0}else if(m==="shift"){if(o.shift)throw new Cn("duplicateModifier",{step:n+1,modifier:"Shift"});o.shift=!0}else if(r===void 0)r=m;else throw new Cn("multipleKeys",{step:n+1});if(!r)throw new Cn("missingKey",{step:n+1});const u=Dx[r]||r,h=/^f(?:[1-9]|1[0-2])$/.exec(u);let p;if(h)p=re[u.toUpperCase()];else if(Object.hasOwn(Qp,u))p=Qp[u];else if([...u].length===1&&/^[\x21-\x7e]$/.test(u))p=u;else throw new Cn("unsupportedKey",{step:n+1,key:u});return{key:p,keyName:u,modifiers:o,sequence:Ux(p,u,o)}}function Bx(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function Wp(a,n){const l=[...a][0].codePointAt(0);return l===void 0?"":`\x1B[${l};${Bx(n)}u`}function Ux(a,n,l){if(!l.ctrl)return cr(a,l);if(n.length===1&&/^[\x20-\x7e]$/.test(n)){const o=n.toLowerCase();if(l.alt||l.shift||o==="m"||o==="i")return Wp(o,l);if(o==="-"||o==="/"||o==="_")return"";const r=pb(o);return r!==o?r:Wp(o,l)}return cr(a,l)}function Tn(a){if(typeof a!="string"||!a.trim())throw new Cn("empty");const n=a.trim().split(/\s+/);if(n.length>8)throw new Cn("tooManySteps",{count:8});return n.map((l,o)=>vb(l,o).sequence)}function cs(a){const n=a.trim().split(/\s+/);return n.length>1&&n.every(l=>["esc","escape"].includes(l.toLowerCase()))?`ESC${Hx[n.length]||` ×${n.length}`}`:n.map((l,o)=>{const{keyName:r,modifiers:u}=vb(l,o),h=zx[r]||(/^f\d+$/.test(r),r.toUpperCase());return u.ctrl&&u.alt&&u.shift?`Ctrl+Alt+⇧${h}`:u.ctrl&&u.alt?`Ctrl+Alt+${h}`:u.ctrl&&u.shift?`^⇧${h}`:u.ctrl?`^${h}`:u.alt&&u.shift?`Alt+⇧${h}`:u.alt?`Alt+${h}`:u.shift?`⇧${h}`:h}).join(" ")}const B=(a,n,l,o=!0)=>({id:a,labelKey:n,combo:l,verified:o}),xb={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[B("mode","mode","shift+tab"),B("rewind","rewind","esc esc"),B("details","details","ctrl+o"),B("model","model","alt+p"),B("thinking","thinking","alt+t"),B("todos","todos","ctrl+t"),B("background","background","ctrl+b"),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("stash","stash","ctrl+s"),B("pasteImage","pasteImage","ctrl+v"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[B("mode","mode","shift+tab"),B("editPrevious","editPrevious","esc esc"),B("details","details","ctrl+t"),B("queue","queue","tab"),B("history","history","ctrl+r"),B("copy","copy","ctrl+o"),B("editor","editor","ctrl+g"),B("newline","newline","ctrl+j"),B("clear","clear","ctrl+l"),B("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[B("mode","mode","shift+tab"),B("yolo","yolo","ctrl+y"),B("rewind","rewind","esc esc"),B("todos","todos","ctrl+t"),B("expand","expand","ctrl+o"),B("background","background","ctrl+b"),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("undo","undo","ctrl+z"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","esc"),B("history","history","ctrl+r"),B("newline","newline","ctrl+j"),B("todos","todos","ctrl+t",!1),B("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[B("agent","agent","tab"),B("agentBack","agentBack","shift+tab"),B("interrupt","interrupt","esc"),B("palette","palette","ctrl+p"),B("model","model","ctrl+x m"),B("recentModel","recentModel","f2"),B("variant","variant","ctrl+t"),B("newSession","newSession","ctrl+x n"),B("sessions","sessions","ctrl+x l"),B("undo","undo","ctrl+x u"),B("editor","editor","ctrl+x e"),B("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[B("agent","agent","tab",!1),B("agentBack","agentBack","shift+tab",!1),B("interrupt","interrupt","esc"),B("palette","palette","ctrl+p"),B("model","model","ctrl+x m"),B("recentModel","recentModel","f2"),B("variant","variant","ctrl+t"),B("newSession","newSession","ctrl+x n"),B("sessions","sessions","ctrl+x l"),B("undo","undo","ctrl+x u"),B("editor","editor","ctrl+x e"),B("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[B("thinkingMode","thinkingMode","shift+tab"),B("interrupt","interrupt","esc"),B("nextModel","nextModel","ctrl+p"),B("modelPicker","modelPicker","ctrl+l"),B("tools","tools","ctrl+o"),B("thinkingBlocks","thinkingBlocks","ctrl+t"),B("editor","editor","ctrl+g"),B("followup","followup","alt+enter"),B("dequeue","dequeue","alt+up"),B("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[B("thinkingMode","thinkingMode","shift+tab"),B("plan","plan","alt+shift+p"),B("model","model","alt+m"),B("temporaryModel","temporaryModel","alt+p"),B("nextModel","nextModel","ctrl+p"),B("tools","tools","ctrl+o"),B("thinking","thinking","ctrl+t"),B("history","history","ctrl+r"),B("editor","editor","ctrl+g"),B("followup","followup","ctrl+enter"),B("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","esc"),B("expand","expand","ctrl+o"),B("expandAll","expandAll","ctrl+e"),B("reasoning","reasoning","ctrl+t"),B("editor","editor","ctrl+g"),B("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[B("mode","mode","shift+tab"),B("review","review","ctrl+r"),B("newline","newline","ctrl+j"),B("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[B("specMode","specMode","shift+tab"),B("autonomy","autonomy","ctrl+l"),B("details","details","ctrl+o",!1),B("queue","queue","ctrl+enter"),B("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[B("plan","plan","shift+tab"),B("interrupt","interrupt","esc"),B("undoPicker","undoPicker","esc esc"),B("expand","expand","ctrl+o"),B("editor","editor","ctrl+g"),B("steer","steer","ctrl+s"),B("undo","undo","ctrl+-"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[B("palette","palette","ctrl+o"),B("reasoning","reasoning","alt+d"),B("mode","mode","ctrl+s",!1),B("editor","editor","ctrl+g"),B("history","history","ctrl+r"),B("sidebar","sidebar","ctrl+backslash"),B("pasteImage","pasteImage","ctrl+v"),B("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[B("interrupt","interrupt","ctrl+c"),B("newline","newline","ctrl+j"),B("editor","editor","ctrl+g"),B("agents","agents","ctrl+t"),B("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[B("permissionMode","permissionMode","shift+tab"),B("bypass","bypass","ctrl+y"),B("tasks","tasks","ctrl+t"),B("editor","editor","ctrl+x"),B("history","history","ctrl+r"),B("queue","queue","ctrl+enter"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","alt+v"),B("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("thinking","thinking","alt+t"),B("newline","newline","ctrl+j"),B("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("rewind","rewind","esc esc"),B("interject","interject","ctrl+enter"),B("multiline","multiline","ctrl+m"),B("newline","newline","alt+enter"),B("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[B("mode","mode","shift+tab"),B("interrupt","interrupt","ctrl+c"),B("background","background","ctrl+b"),B("approve","approve","ctrl+k"),B("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[B("interrupt","interrupt","ctrl+c"),B("thinking","thinking","ctrl+t"),B("expand","expand","ctrl+e"),B("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[B("permissionMode","permissionMode","shift+tab"),B("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[B("agentSwap","agentSwap","shift+tab"),B("interrupt","interrupt","esc"),B("details","details","ctrl+t"),B("steer","steer","ctrl+s"),B("expand","expand","ctrl+o"),B("activity","activity","ctrl+x"),B("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[B("planAct","planAct","tab"),B("autoApprove","autoApprove","shift+tab"),B("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[B("rewind","rewind","esc esc"),B("search","search","ctrl+f"),B("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[B("interrupt","interrupt","esc"),B("queue","queue","alt+enter"),B("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},na=xb,Kx=Object.keys(xb),Jp={pi:"pi",claude:"claude","claude-code":"claude",codex:"codex",gemini:"gemini",cursor:"cursor","cursor-agent":"cursor",devin:"devin","devin-cli":"devin","devin cli":"devin",agy:"agy",antigravity:"agy","antigravity-cli":"agy",cline:"cline",".cline":"cline",omp:"omp",mastracode:"mastracode","mastra-code":"mastracode","mastra code":"mastracode",opencode:"opencode",opencode2:"opencode","open-code":"opencode",copilot:"copilot","github-copilot":"copilot",ghcs:"copilot",kimi:"kimi","kimi-code":"kimi","kimi code":"kimi",kiro:"kiro","kiro-cli":"kiro",droid:"droid",amp:"amp","amp-local":"amp",grok:"grok","grok-build":"grok",hermes:"hermes","hermes-agent":"hermes",kilo:"kilo","kilo-code":"kilo","kilo code":"kilo",qodercli:"qodercli",qoderclicn:"qodercli",qoder:"qodercli",qodercn:"qodercli",qwen:"qwen","qwen-code":"qwen","qwen code":"qwen",letta:"letta","letta-code":"letta","letta code":"letta",maki:"maki",muse:"muse","muse-code":"muse","muse-cli":"muse",shell:"shell"};function Ix(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function eg(a){const n=Ix(a);return Jp[n]?Jp[n]:/^muse-bin-\d/.test(n)?"muse":null}function Fx(a,n="auto"){return n&&n!=="auto"?eg(n)||"shell":eg(a)||"shell"}const ms=[B("genericCtrlC","interrupt","ctrl+c"),B("genericCtrlD","eof","ctrl+d"),B("genericCtrlZ","suspend","ctrl+z"),B("genericCtrlL","clear","ctrl+l"),B("genericCtrlR","history","ctrl+r"),B("genericCtrlA","startOfLine","ctrl+a"),B("genericCtrlE","endOfLine","ctrl+e"),B("genericCtrlK","killToEnd","ctrl+k")],tg=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Gx=["genericCtrlC"],Yx=ms.filter(({id:a})=>a!=="genericCtrlD"&&a!=="genericCtrlZ"),Px=ms.filter(({id:a})=>a==="genericCtrlC"||a==="genericCtrlZ").map(a=>a.id==="genericCtrlZ"?{...a,labelKey:"eof"}:a),$x={posix:ms,"git-bash":ms,cmd:Px,powershell:Yx},qx={posix:tg,"git-bash":tg,cmd:["genericCtrlC","genericCtrlZ"],powershell:["genericCtrlC","genericCtrlL","genericCtrlR"]};function Vx(a,n){var r,u;const l=a.map(h=>{var g;const p=(g=n==null?void 0:n.actions)==null?void 0:g[h.id];let m=typeof(p==null?void 0:p.keys)=="string"?p.keys:h.combo;try{Tn(m)}catch{m=h.combo}return{...h,defaultCombo:h.combo,combo:m,hidden:typeof(p==null?void 0:p.hidden)=="boolean"?p.hidden:h.defaultHidden===!0,custom:!1}}),o=new Set(l.map(h=>h.id));for(const h of(n==null?void 0:n.custom)||[]){if(!h||typeof h.id!="string"||o.has(h.id))continue;const p=h.keys;try{Tn(p)}catch{continue}l.push({id:h.id,labelKey:"custom",defaultCombo:p,combo:p,verified:!0,hidden:((u=(r=n==null?void 0:n.actions)==null?void 0:r[h.id])==null?void 0:u.hidden)===!0,custom:!0,customLabel:h.label}),o.add(h.id)}if(Array.isArray(n==null?void 0:n.order)){const h=new Map(n.order.map((p,m)=>[p,m]));l.sort((p,m)=>(h.get(p.id)??Number.MAX_SAFE_INTEGER)-(h.get(m.id)??Number.MAX_SAFE_INTEGER))}return l}function Xx(a,n){const l=new Set(a.map(o=>o.combo.trim().toLowerCase()));return n.filter(o=>!l.has(o.combo.trim().toLowerCase()))}const fs=a=>a.id.startsWith("generic");function wb(a,n,l="posix"){const o=na[a],r=a==="shell"?$x[l]:ms,u=new Set([...o.bar||[],...a==="shell"?qx[l]:Gx]),h=[...o.actions,...r].map(p=>({...p,defaultHidden:!u.has(p.id)}));return Vx(h,n)}function Sb(a,n,l="posix"){const o=wb(a,n,l),r=o.filter(h=>!fs(h)),u=new Set(Xx(r,o.filter(fs)));return o.filter(h=>!fs(h)||u.has(h))}function Zx(a,n,l="posix"){const o=Sb(a,n,l).filter(r=>!r.hidden);return{agentActions:o.filter(r=>!fs(r)),genericActions:o.filter(fs)}}function Qx(a){const n={};for(const[l,o]of Object.entries(a.actions||{})){const r={...o};delete r.hidden,Object.keys(r).length>0&&(n[l]=r)}return{...a,actions:n}}function Cb(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const n=Object.create(null);for(const[l,o]of Object.entries(a).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(l)||["__proto__","constructor","prototype"].includes(l)||!o||typeof o!="object"||Array.isArray(o))continue;const r=o,u={};if(Array.isArray(r.order)&&(u.order=[...new Set(r.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),r.actions&&typeof r.actions=="object"&&!Array.isArray(r.actions)){const h=Object.create(null);for(const[p,m]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(p)||!m||typeof m!="object"||Array.isArray(m))continue;const g=m,y={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{Tn(v),y.keys=v}catch{}}typeof g.hidden=="boolean"&&(y.hidden=g.hidden),Object.keys(y).length>0&&(h[p]=y)}u.actions=h}if(Array.isArray(r.custom)){const h=new Set;u.custom=r.custom.slice(0,64).flatMap(p=>{if(!p||typeof p!="object"||Array.isArray(p))return[];const m=p;if(typeof m.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(m.id)||["__proto__","constructor","prototype"].includes(m.id)||h.has(m.id))return[];if(typeof m.label!="string"||!m.label.trim()||typeof m.keys!="string"||!m.keys.trim())return[];const g=m.keys.trim().slice(0,80);try{Tn(g)}catch{return[]}return h.add(m.id),[{id:m.id,label:m.label.trim().slice(0,64),keys:g}]})}n[l]=u}return n}const Wx=10,Jx=24,ps=15,ur=13,Rd=640;function ew(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&(window.matchMedia("(pointer: coarse)").matches||window.matchMedia("(hover: none)").matches))return!0}catch{}return nl()<Rd}function nl(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function cd(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function il(a,n=ps){const l=typeof a=="number"?a:Number(a);return!Number.isFinite(l)||l<=0?n:Math.min(Jx,Math.max(Wx,Math.round(l)))}function ng(a,n=nl()){if(n<Rd){const o=il(a,ur);return Math.min(15,Math.max(12,o))}return il(a,ps)}const ig="#11111b",tw=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],dr=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],ud=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:dr},{id:"jetbrains-mono",name:"JetBrains Mono",faces:['"JetBrains Mono"','"Herdr JetBrains Mono"']},{id:"fira-code",name:"Fira Code",faces:['"Fira Code"','"Herdr Fira Code"']},{id:"cascadia-code",name:"Cascadia Code",faces:['"Cascadia Code"','"Herdr Cascadia Code"']},{id:"source-code-pro",name:"Source Code Pro",faces:['"Source Code Pro"','"Herdr Source Code Pro"']},{id:"ibm-plex-mono",name:"IBM Plex Mono",faces:['"IBM Plex Mono"','"Herdr IBM Plex Mono"']}],Tb="host",nw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',iw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',aw="JetBrains Mono, Menlo, Monaco, Consolas, monospace",lw={[nw]:"host",[iw]:"host",[aw]:"host",'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace':"system",'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace':"system",'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace':"system",'"Courier New", Courier, "Symbols Nerd Font Mono", monospace':"system",'"Fira Code", "Symbols Nerd Font Mono", monospace':"fira-code"};function Pu(a){return typeof a!="string"||!a.trim()?Tb:lw[a]??a}const sw=[[/^jetbrains\s*mono/i,'"Herdr JetBrains Mono"'],[/^fira\s*code/i,'"Herdr Fira Code"'],[/^(cascadia\s*(code|mono)|caskaydia\s*(cove|mono))/i,'"Herdr Cascadia Code"'],[/^(source\s*code\s*pro|sauce\s*code\s*pro)/i,'"Herdr Source Code Pro"'],[/^(ibm\s*plex\s*mono|blex\s*mono)/i,'"Herdr IBM Plex Mono"']];function ow(a){const n=sw.find(([l])=>l.test(a.trim()));return n?n[1]:null}function ls(a){return`"${a.replace(/["\\]/g,"")}"`}function dd(a){return[...new Set([...a,...tw])].join(", ")}const rw=dd(dr);function cw(a,n){const l=typeof a=="string"?a.trim():"";if(!l||l==="host"){if(!(n!=null&&n.family))return rw;const u=[],h=n.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&u.push(ls(h.alias)),n.alias&&u.push(ls(n.alias)),u.push(ls(n.family));const p=ow(n.family);return p&&u.push(p),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&u.push(ls(h.alias)),u.push(ls(h.family))),dd([...u,...dr])}const o=ud.find(u=>u.id===l);if(o)return dd([...o.faces,...dr]);if(l.includes("Symbols Nerd Font"))return l;if(/^['"]?monospace['"]?$/i.test(l))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(l)?l.replace(r,', "Symbols Nerd Font Mono", monospace'):`${l}, "Symbols Nerd Font Mono", monospace`}function uw(a){if(!a)return null;const n={};return a.background&&(n.background=a.background,n.cursorAccent=a.background),a.foreground&&(n.foreground=a.foreground),a.cursor&&(n.cursor=a.cursor),a.ansi&&Object.assign(n,a.ansi),Object.keys(n).length===0?null:n}function Mb(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",ig),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=ig}const Et={settings:"herdr_remote_settings_v1",sessionView:"herdr_remote_session_view_v1",ignoredUpdate:"herdr_remote_ignored_update_v1",hostFontConsent:"herdr_remote_host_font_consent_v1",rendererProbe:"herdr_remote_renderer_probe_v3"},fd={local:{},session:{}};function gs(a,n){if(typeof window>"u")return fd[a][n]||null;try{return(a==="local"?window.localStorage:window.sessionStorage).getItem(n)}catch{return fd[a][n]||null}}function Li(a,n,l){if(fd[a][n]=l,!(typeof window>"u"))try{(a==="local"?window.localStorage:window.sessionStorage).setItem(n,l)}catch(o){console.warn(`Failed to write to ${a}Storage:`,o)}}const ag=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),$u=256*1024,dw=2,fw={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Ji(a){return a?[a.family,...a.faces.map(n=>n.sha256),...(a.subsets||[]).map(n=>n.sha256)].join("|"):null}function lg(a){const n=a==null?void 0:a.faces.find(l=>l.style==="regular");return n?`Herdr Host ${n.sha256.slice(0,12)}`:null}function sg(a){return a?a.faces.reduce((n,l)=>n+l.bytes,0):0}function qu(a){return a>=1024*1024?`${(a/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(a/1024))} KB`}function hw(a){if(typeof document>"u")return!1;let n=null;try{n=document.createElement("canvas").getContext("2d")}catch{return!1}if(!n)return!1;const l="mmmmmmmmmmlli10OQ@#WWww";for(const o of["serif","sans-serif"]){n.font=`72px ${o}`;const r=n.measureText(l).width;if(n.font=`72px "${a}", ${o}`,n.measureText(l).width!==r)return!0}return!1}const mw="herdr-remote-fonts",al="faces",ll="subsets",Ab=new Map,hd=new Map;function wr(){return new Promise(a=>{if(typeof indexedDB>"u"){a(null);return}try{const n=indexedDB.open(mw,2);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(al)||n.result.createObjectStore(al),n.result.objectStoreNames.contains(ll)||n.result.createObjectStore(ll)},n.onsuccess=()=>a(n.result),n.onerror=()=>a(null),n.onblocked=()=>a(null)}catch{a(null)}})}async function pw(a){const n=Ab.get(a);if(n)return n;const l=await wr();return l?new Promise(o=>{try{const r=l.transaction(al,"readonly").objectStore(al).get(a);r.onsuccess=()=>{const u=r.result;o(u instanceof ArrayBuffer?u:null)},r.onerror=()=>o(null)}catch{o(null)}finally{l.close()}}):null}async function gw(a,n){Ab.set(a,n);const l=await wr();l&&await new Promise(o=>{try{const r=l.transaction(al,"readwrite");r.objectStore(al).put(n,a),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}async function bw(a){const n=await wr();return n?new Promise(l=>{try{const o=IDBKeyRange.bound(`${a}:`,`${a}:`),r=n.transaction(ll,"readonly").objectStore(ll).getAll(o);r.onsuccess=()=>{const u=Array.isArray(r.result)?r.result:[];l(u.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},r.onerror=()=>l([])}catch{l([])}finally{n.close()}}):hd.get(a)??[]}async function yw(a,n){hd.set(a,[...hd.get(a)??[],n]);const l=await wr();l&&await new Promise(o=>{try{const r=l.transaction(ll,"readwrite");r.objectStore(ll).put(n,`${a}:${n.subsetSha}`),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}function Vu(a){return a?`Herdr Glyphs ${a.sha256.slice(0,12)}`:null}function vw(a){return a>=11904&&a<=12255||a>=12288&&a<=13311||a>=13312&&a<=19903||a>=19968&&a<=40959||a>=44032&&a<=55215||a>=63744&&a<=64255||a>=65072&&a<=65103||a>=65280&&a<=65519||a>=131072&&a<=201551}function Eb(a,n){return n<32||n>=127&&n<160||n>=9472&&n<=9631?!1:a==="all"||vw(n)}function xw(a){const n=[...new Set(a)].sort((o,r)=>o-r),l=[];for(let o=0;o<n.length;o+=1){const r=n[o];let u=r;for(;o+1<n.length&&n[o+1]===u+1;)u=n[o+1],o+=1;const h=p=>p.toString(16).toUpperCase();l.push(r===u?`U+${h(r)}`:`U+${h(r)}-${h(u)}`)}return l.join(", ")}async function ww(a,n){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const l=new FontFace(a,n.data,{weight:"400",style:"normal",unicodeRange:xw(n.codepoints)});document.fonts.add(await l.load())}const md=new Set;function Sw(a){return!!(a&&md.has(a))}async function Cw(a,n){if(md.has(a))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const l=await Promise.all(n.map(({face:o,data:r})=>new FontFace(a,r,fw[o.style]).load()));for(const o of l)document.fonts.add(o);md.add(a)}function og(a){const n=atob(a),l=new Uint8Array(n.length);for(let o=0;o<n.length;o+=1)l[o]=n.charCodeAt(o);return l}async function Nb(a,n,l){const o=Math.ceil(a.bytes/$u),r=new Uint8Array(a.bytes);let u=0;const h=async()=>{for(;u<o;){const p=u;u+=1;const m=await n(a.sha256,p),g=p*$u,y=Math.min($u,a.bytes-g);if(m.length!==y)throw new Error("host_font_corrupt");r.set(m,g),l(m.length)}};return await Promise.all(Array.from({length:Math.min(dw,o)},h)),r.buffer}function kb(){try{const a=JSON.parse(gs("local",Et.hostFontConsent)||"{}");return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function rg(a,n){const l=kb()[a];return l&&l.fingerprint===n?l.decision:null}function cg(a,n,l){const o=kb();o[a]={fingerprint:n,decision:l},Li("local",Et.hostFontConsent,JSON.stringify(o))}const Lb={source:null,status:"none",alias:null,covered:0},Xu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:Lb,interactive:!1,glyphRevision:0},Tw=String.fromCodePoint(...Array.from({length:95},(a,n)=>32+n),...Array.from({length:96},(a,n)=>160+n),...Array.from({length:112},(a,n)=>8192+n));function ug(a){const n=(a==null?void 0:a.subsets)??[];return n.find(l=>l.scope==="all")??n.find(l=>l.scope==="cjk")??null}function Mw(a,n){const l=new Set;for(const o of a){const r=o.codePointAt(0);Eb(n,r)&&l.add(r)}return[...l]}const dg=3e4;function Aw(a){const n=T.useRef(new Map),l=T.useRef(new Map),o=T.useRef(new Map),r=T.useCallback(p=>{for(const m of[n.current,l.current]){for(const g of m.values())clearTimeout(g.timer),g.reject(new Error(p));m.clear()}},[]),u=T.useCallback((p,m)=>new Promise((g,y)=>{if(!a){y(new Error("disconnected"));return}const v=`${p}:${m}`,w=setTimeout(()=>{n.current.delete(v),y(new Error("host_font_timeout"))},dg);n.current.set(v,{resolve:g,reject:y,timer:w}),a.sendHostFontChunkRequest(p,m)}),[a]),h=T.useCallback((p,m,g)=>new Promise((y,v)=>{if(!a){v(new Error("disconnected"));return}const w=Math.random().toString(36).slice(2,12),x=setTimeout(()=>{l.current.delete(w),v(new Error("host_font_timeout"))},dg);l.current.set(w,{resolve:S=>y({...S,codepoints:m}),reject:v,timer:x}),o.current.set(w,g),a.sendHostFontSubsetRequest(p.sha256,String.fromCodePoint(...m),w)}),[a]);return T.useEffect(()=>{if(!a)return;const p=n.current,m=l.current,g=a.on("hostFontChunk",x=>{const S=`${x.sha256}:${x.index}`,M=p.get(S);if(M){p.delete(S),clearTimeout(M.timer);try{M.resolve(og(x.dataBase64))}catch{M.reject(new Error("host_font_corrupt"))}}}),y=a.on("hostFontSubset",x=>{const S=m.get(x.requestId);if(!S)return;m.delete(x.requestId),clearTimeout(S.timer);const M=o.current.get(x.requestId)??(()=>{});if(o.current.delete(x.requestId),x.dataBase64!==void 0){try{const k=og(x.dataBase64);M(k.length,k.length),S.resolve({subsetSha:x.subsetSha,data:k.buffer,codepoints:[]})}catch{S.reject(new Error("host_font_corrupt"))}return}M(0,x.bytes);const E={bytes:x.bytes,sha256:x.subsetSha};Nb(E,u,k=>M(k,x.bytes)).then(k=>S.resolve({subsetSha:x.subsetSha,data:k,codepoints:[]})).catch(k=>S.reject(k instanceof Error?k:new Error("host_font_failed")))}),v=a.on("error",x=>{(x.code==="host_font_unavailable"||x.code==="host_font_subset_failed")&&r(String(x.code))}),w=a.on("stateChange",x=>{x!=="connected"&&r("disconnected")});return()=>{g(),y(),v(),w(),r("disconnected")}},[a,r,u]),{requestChunk:u,requestSubset:h,rejectPending:r}}const Ew=15e3,Nw=80,kw=2e3;function Lw(a,n={}){const[l,o]=T.useState(Xu),r=T.useRef(l);r.current=l;const u=T.useRef(n);u.current=n;const h=T.useRef(0),p=T.useRef(0),m=T.useRef(new Set),g=T.useRef(new Set),y=T.useRef(new Set),v=T.useRef(null),{requestChunk:w,requestSubset:x,rejectPending:S}=Aw(a),M=T.useCallback(()=>({isInstalled:u.current.isInstalled??hw,readCached:u.current.readCached??pw,writeCached:u.current.writeCached??gw,register:u.current.register??Cw,isRegistered:u.current.isRegistered??Sw,readSubsets:u.current.readSubsets??bw,writeSubset:u.current.writeSubset??yw,registerGlyphs:u.current.registerGlyphs??ww}),[]),E=T.useCallback(()=>(a==null?void 0:a.getHostId())||"default",[a]),k=T.useCallback((K,V)=>{K===h.current&&o(ne=>({...ne,glyphs:{...ne.glyphs,...V}}))},[]),N=T.useCallback(async(K,V,ne)=>{const{registerGlyphs:W}=M();for(const ie of ne){if(await W(V,ie),K!==h.current)return;for(const oe of ie.codepoints)m.current.add(oe)}K!==h.current||!ne.length||o(ie=>({...ie,glyphs:{...ie.glyphs,alias:V,covered:m.current.size},glyphRevision:ie.glyphRevision+1}))},[M]),R=T.useCallback(async(K,V,ne)=>{const W=Vu(V),ie=V.scope==="all"?Tw+ag:ag,oe=Mw(ie,V.scope).filter(A=>!m.current.has(A));if(!oe.length)return;for(const A of oe)g.current.add(A);const P=await x(V,oe,ne);K===h.current&&(await M().writeSubset(V.sha256,P),await N(K,W,[P]))},[x,M,N]),H=T.useCallback(async(K,{interactive:V=!0}={})=>{const ne=K??r.current.font,W=Ji(ne);if(!ne||!W)return;const ie=r.current,oe=Ji(ie.font)===W;if(oe&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const P=h.current,{isInstalled:A,isRegistered:I,readCached:J,writeCached:le,register:Z}=M();cg(E(),W,"accepted");const ye=lg(ne),xe=ug(ne),ce=!!(ye&&!I(ye)&&!A(ne.family)),Te=oe?ie.glyphs:{...Lb,source:xe},ue=!!(xe&&!["installed","ready","none"].includes(Te.status));let de=ce?sg(ne):0,se=0;const ve=()=>{P===h.current&&o(ae=>({...ae,receivedBytes:se,totalBytes:de}))};if(o(ae=>({...ae,font:ne,interactive:V,receivedBytes:0,totalBytes:de,error:null,status:ce?"loading":ae.status,glyphs:ue?{...Te,status:"loading"}:Te})),ce&&ye)try{const ae=[];for(const we of ne.faces){let Ae=await J(we.sha256);if(Ae?(se+=we.bytes,ve()):(Ae=await Nb(we,w,De=>{se+=De,ve()}),await le(we.sha256,Ae)),P!==h.current)return;ae.push({face:we,data:Ae})}if(await Z(ye,ae),P!==h.current)return;o(we=>({...we,status:"loaded",alias:ye}))}catch(ae){if(P!==h.current)return;const we=ae instanceof Error&&ae.message?ae.message:"host_font_failed";o(Ae=>({...Ae,status:"failed",alias:null,error:we}))}if(ue&&xe){let ae=0;try{await R(P,xe,(we,Ae)=>{Ae&&!ae&&(ae=Ae,de+=Ae),se+=we,ve()}),k(P,{status:"ready"})}catch(we){if(P!==h.current)return;const Ae=we instanceof Error&&we.message?we.message:"host_font_failed";o(De=>({...De,error:De.error??Ae,glyphs:{...De.glyphs,status:"failed"}}))}}},[w,R,M,E,k]),j=T.useCallback(async K=>{const V=Ji(K)!==Ji(r.current.font);V&&(S("superseded"),m.current=new Set,g.current=new Set,y.current=new Set);const ne=++h.current;if(!K){o(Xu);return}const{isInstalled:W,readCached:ie,register:oe,isRegistered:P,readSubsets:A}=M(),I=lg(K),J=Ji(K),le=ug(K);let Z="checking";I&&P(I)?Z="loaded":W(K.family)?Z="installed":I||(Z="unavailable");let ye="checking";if(le?(le.scope==="cjk"?W(le.family):Z==="installed")&&(ye="installed"):ye="none",o(ue=>({...Xu,font:K,status:Z==="checking"?"checking":Z,alias:Z==="loaded"?I:null,totalBytes:sg(K),glyphs:{source:le,status:ye,alias:V?null:ue.glyphs.alias,covered:m.current.size},glyphRevision:ue.glyphRevision})),Z==="checking"&&I){const ue=await Promise.all(K.faces.map(de=>ie(de.sha256)));if(ne!==h.current)return;if(Z="needs",ue.every(Boolean))try{if(await oe(I,K.faces.map((de,se)=>({face:de,data:ue[se]}))),ne!==h.current)return;Z="loaded",o(de=>({...de,status:"loaded",alias:I}))}catch{}}if(ye==="checking"&&le){const ue=await A(le.sha256);if(ne!==h.current)return;if(ue.length)try{await N(ne,Vu(le),ue),ye="cached"}catch{ye="needs"}else ye="needs";if(ne!==h.current)return}const xe=rg(E(),J),ce=xe==="accepted"||ye==="cached"||Date.now()<p.current;if(ye==="cached"&&(ye="ready",k(ne,{status:"ready"}),R(ne,le,()=>{}).catch(()=>{})),Z!=="needs"&&ye!=="needs")return;if(ce){H(K,{interactive:!1});return}const Te=xe==="declined"?"declined":"available";o(ue=>({...ue,status:Z==="needs"?Te:ue.status,glyphs:ye==="needs"?{...ue.glyphs,status:Te}:ue.glyphs}))},[H,S,E,k,R,M,N]),D=T.useCallback(()=>{const K=Ji(r.current.font);K&&cg(E(),K,"declined"),o(V=>({...V,interactive:!1,status:["available","failed"].includes(V.status)?"declined":V.status,glyphs:["available","failed"].includes(V.glyphs.status)?{...V.glyphs,status:"declined"}:V.glyphs}))},[E]),_=T.useCallback(()=>{p.current=Date.now()+Ew,a==null||a.sendHostFontRefresh();const K=r.current,V=["available","declined","failed"];K.font&&(V.includes(K.status)||V.includes(K.glyphs.status))&&H(K.font,{interactive:!1})},[a,H]),z=T.useCallback(K=>{const{glyphs:V}=r.current;if(V.status!=="ready"||!V.source)return;const ne=V.source;for(const W of K){const ie=W.codePointAt(0);ie<128&&ne.scope!=="all"||Eb(ne.scope,ie)&&(m.current.has(ie)||g.current.has(ie)||y.current.add(ie))}!y.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const W=h.current,ie=[...y.current].slice(0,kw);for(const oe of ie)y.current.delete(oe),g.current.add(oe);(async()=>{const oe=await x(ne,ie,()=>{});W===h.current&&(await M().writeSubset(ne.sha256,oe),await N(W,Vu(ne),[oe]))})().catch(()=>{})},Nw))},[x,M,N]);return T.useEffect(()=>{if(!a)return;const K=a.on("terminalFont",V=>{j(V)});return()=>{K(),v.current&&clearTimeout(v.current),v.current=null}},[a,j]),T.useEffect(()=>{const K=V=>{if(V.key!==Et.hostFontConsent)return;const ne=r.current,W=Ji(ne.font),ie=ne.status==="available"||ne.glyphs.status==="available";if(!W||!ie)return;const oe=rg(E(),W);oe==="accepted"?H(ne.font,{interactive:!1}):oe==="declined"&&D()};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[H,D,E]),{hostFont:l,loadHostFont:H,declineHostFont:D,syncHostFont:_,ensureHostGlyphs:z}}function _w(a,n=window,l=document){const o=g=>{var y;((y=n.navigator)==null?void 0:y.onLine)!==!1&&a.wake(g)},r=()=>{l.visibilityState==="visible"&&o("visible")},u=()=>o("pageshow"),h=()=>o("online"),p=()=>o("focus"),m=()=>o("resume");return l.addEventListener("visibilitychange",r),l.addEventListener("resume",m),n.addEventListener("pageshow",u),n.addEventListener("online",h),n.addEventListener("focus",p),()=>{l.removeEventListener("visibilitychange",r),l.removeEventListener("resume",m),n.removeEventListener("pageshow",u),n.removeEventListener("online",h),n.removeEventListener("focus",p)}}function Go(a){return{wsUrl:a.wsUrl,token:a.token||void 0,pairCode:a.pairCode||void 0,clientId:a.clientId,autoReconnect:a.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}function fg(a,n){return n||(a==="win32"?"powershell":"posix")}function Rw(a,n){if(n!=="win32")return n?"posix":null;for(const l of a.slice(-8).reverse()){if(/\b(?:MINGW32|MINGW64|MSYS)\b/i.test(l))return"git-bash";if(/^\s*PS\s+[a-z]:\\[^>]*>/i.test(l))return"powershell";if(/^\s*(?:[a-z]:\\[^>]*|\\\\[^\\]+\\[^>]+)>/i.test(l))return"cmd"}return null}function jw(a){return a==="cmd"?["dir","cls","git status","cd","tasklist","exit","type"]:a==="powershell"?["Get-ChildItem","Clear-Host","git status","Get-Location","Get-Process","exit","Get-Content"]:["ls -la","clear","git status","pwd","top","exit","cat"]}const Ow={connectionState:"disconnected",role:"viewer",shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},hg={role:"viewer",controllerId:void 0,hostname:void 0,platform:void 0,adminTerminalSupported:void 0,shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1};function Dw(a,n){switch(n.type){case"stateChange":return{...a,connectionState:n.state,stateCode:n.code,stateDetail:n.detail,agentStatus:n.state==="connected"?a.agentStatus:null};case"ready":{const{message:l}=n;return{...a,terminalResetVersion:a.terminalResetVersion+(n.resetTerminal?1:0),role:l.role,controllerId:l.controllerId,hostId:l.hostId,hostname:l.hostname,platform:l.platform,adminTerminalSupported:l.adminTerminalSupported,shellProfile:fg(l.platform,l.shellProfile),assignedClientId:l.clientId||a.assignedClientId,hostPalette:l.terminalPalette||null}}case"hostReconnecting":return{...a,...hg,stateCode:n.code,stateDetail:n.detail};case"sessionRestarted":return{...a,hostname:n.hostname,platform:n.platform,adminTerminalSupported:n.adminTerminalSupported,shellProfile:fg(n.platform,n.shellProfile),hostPalette:n.palette||null,terminalResetVersion:a.terminalResetVersion+1};case"roleChange":return{...a,role:n.role,controllerId:n.controllerId,hostId:n.hostId||a.hostId,assignedClientId:n.assignedClientId||a.assignedClientId};case"controlGranted":return{...a,role:"controller"};case"paired":return{...a,lastPairedAt:n.at};case"rtt":return{...a,rttMs:n.rttMs};case"peerCount":return{...a,sharedWindowCount:Math.max(1,n.count)};case"sessionReady":return{...a,connectionState:"connected"};case"agentStatus":return{...a,agentStatus:n.status};case"shellProfile":return a.shellProfile===n.profile?a:{...a,shellProfile:n.profile};case"reset":return{...a,...hg,hostId:void 0,platform:void 0,assignedClientId:void 0,terminalResetVersion:a.terminalResetVersion+(n.resetTerminal?1:0)}}}const zw=3e4;function Hw(a,n){const[l,o]=T.useState(null),r=T.useRef(null),u=T.useRef(null),h=T.useCallback(y=>{(y==null?void 0:y.phase)!=="starting"&&u.current&&(clearTimeout(u.current),u.current=null),r.current=y,o(y)},[]),p=T.useCallback(()=>{const y=a.current;y&&(h({phase:"starting"}),y.sendHerdrStart(),u.current=setTimeout(()=>{var v;u.current=null,((v=r.current)==null?void 0:v.phase)==="starting"&&h({phase:"failed",message:n.current("herdrLaunch.timeout")})},zw))},[a,n,h]),m=T.useCallback(y=>{var v;return y.code==="herdr_not_running"?(((v=r.current)==null?void 0:v.phase)!=="starting"&&h({phase:"stopped"}),!0):y.code==="herdr_start_failed"&&r.current?(h({phase:"failed",message:y.message||""}),!0):!1},[h]),g=T.useCallback(()=>h(null),[h]);return T.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),{herdrLaunch:l,startHerdr:p,handleLaunchError:m,forgetHerdrLaunch:g}}class Bw{constructor(){q(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set,updateStatus:new Set,terminalFont:new Set,hostFontChunk:new Set,hostFontSubset:new Set})}on(n,l){return this.listeners[n].add(l),()=>{this.listeners[n].delete(l)}}emit(n,...l){this.listeners[n].forEach(r=>{try{r(...l)}catch(u){console.error(`Error in event listener for ${n}:`,u)}})}}const _b=27,Rb=91,Uw=60,mg=59,jb=77,Ob=48,Kw=57,Iw=64,Fw=-30,Zu=32,pg=255;function Db(a){return Number.isInteger(a)&&(a&Fw)===Iw}function Gw(a){return a>=Ob&&a<=Kw}function Qu(a,n){let l=n,o=0;for(;l<a.length&&Gw(a[l]);){if(o=o*10+(a[l]-Ob),o>65535)return null;l+=1}return l===n?null:{value:o,next:l}}function Yw(a,n){if(a[n]!==_b||a[n+1]!==Rb||a[n+2]!==Uw)return-1;const l=Qu(a,n+3);if(!l||!Db(l.value)||a[l.next]!==mg)return-1;const o=Qu(a,l.next+1);if(!o||a[o.next]!==mg)return-1;const r=Qu(a,o.next+1);return!r||a[r.next]!==jb?-1:r.next+1}function Pw(a,n){if(a[n]!==_b||a[n+1]!==Rb||a[n+2]!==jb||n+6>a.length)return-1;const l=a[n+3]-Zu,o=a[n+4],r=a[n+5];return!Db(l)||o<Zu||o>pg||r<Zu||r>pg?-1:n+6}function fr(a){if(!a)return!1;const n=a instanceof Uint8Array?a:new Uint8Array(a);if(n.length===0)return!1;let l=0;for(;l<n.length;){const o=Yw(n,l);if(o>l){l=o;continue}const r=Pw(n,l);if(r>l){l=r;continue}return!1}return!0}class $w{constructor(n){q(this,"segments",[]);q(this,"flushScheduled",!1);this.getSocket=n}push(n){const l=n instanceof Uint8Array?n:new Uint8Array(n);l.length!==0&&(this.segments.push(l),this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flush())))}flush(){if(this.flushScheduled=!1,this.segments.length===0)return;let n=this.segments;this.segments=[];const l=this.getSocket();if(l&&(l.bufferedAmount??0)>256*1024&&(n=n.filter(r=>!fr(r))),n.length===0)return;let o;if(n.length===1)o=n[0];else{let r=0;for(let h=0;h<n.length;h++)r+=n[h].byteLength;o=new Uint8Array(r);let u=0;for(let h=0;h<n.length;h++)o.set(n[h],u),u+=n[h].byteLength}l&&l.readyState===WebSocket.OPEN&&l.send(o)}clear(){this.segments=[],this.flushScheduled=!1}}const qw=3e3,Vw=1e4,Xw=1500;class Zw extends Bw{constructor(l){super();q(this,"ws",null);q(this,"config");q(this,"state","disconnected");q(this,"reconnectAttempts",0);q(this,"reconnectTimer",null);q(this,"pingTimer",null);q(this,"pingTimestamp",null);q(this,"lastInboundAt",0);q(this,"pingSentAt",null);q(this,"connectStartedAt",0);q(this,"lastWakeConnectAt",0);q(this,"probeTimer",null);q(this,"rejectedByRelay",!1);q(this,"isManuallyClosed",!1);q(this,"authFailureDetail",null);q(this,"authFailureCode",null);q(this,"temporaryFailureCode",null);q(this,"input",new $w(()=>this.ws));q(this,"terminalCols",80);q(this,"terminalRows",24);this.config={...l}}updateConfig(l){this.config={...this.config,...l}}getConfig(){return{...this.config}}getState(){return this.state}setState(l,o,r){this.state!==l&&(this.state=l,this.emit("stateChange",l,o,r))}connect(l){if(l&&(this.terminalCols=l.cols,this.terminalRows=l.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.rejectedByRelay=!1,this.clearTimers(),this.setState("connecting");try{const o=Qw(this.config.wsUrl),r=new WebSocket(o);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=u=>{this.isStaleSocket(r)||this.handleMessage(u)},r.onerror=u=>{this.isStaleSocket(r)||this.handleError(u)},r.onclose=u=>{this.isStaleSocket(r)||this.handleClose(u)}}catch(o){this.setState("error",o instanceof Error?o.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(l){return this.ws!==l}teardownSocket(l=1e3,o="Client closed the connection"){this.input.clear();const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(l,o)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(l){this.updateConfig(l),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}wake(l){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const o=Date.now(),r=this.ws;if(!r){if(o-this.lastWakeConnectAt<Xw)return;this.lastWakeConnectAt=o,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){o-this.connectStartedAt>Vw&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&o-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const l=this.ws;if(!l||l.readyState!==WebSocket.OPEN||this.probeTimer)return;const o=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===l&&this.lastInboundAt<o&&this.dropStaleSocket("connection_stale")},qw)}dropStaleSocket(l){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",l),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(l){if(this.lastInboundAt=Date.now(),typeof l.data=="string")try{const o=JSON.parse(l.data);o.type==="pong"?this.handlePong():this.handleServerMessage(o)}catch(o){console.warn("Received unparseable text frame from server:",o)}else if(l.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(l.data));else if(typeof Blob<"u"&&l.data instanceof Blob)try{const o=await l.data.arrayBuffer();this.emit("binaryData",new Uint8Array(o))}catch(o){console.error("Failed to convert Blob to ArrayBuffer:",o)}}handlePong(){if(this.pingTimestamp){const l=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(l))}}handleError(l){console.error("WebSocket error:",l),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(l){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(l.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",l.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(l.code===1008){this.rejectedByRelay=!0,this.setState("error",l.reason||"The relay rejected the connection",String(l.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${l.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${l.reason||l.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const l=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(l*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const l=this.pingIntervalMs();this.pingSentAt=null,this.pingTimer=setInterval(()=>{if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN)){if(this.pingSentAt!==null&&this.lastInboundAt<this.pingSentAt&&Date.now()-this.pingSentAt>=l){this.probeLiveness();return}this.sendPing()}},l)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.probeTimer&&(clearTimeout(this.probeTimer),this.probeTimer=null)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const l={type:"ping"};this.sendJson(l)}sendJson(l){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(l))}sendInput(l){this.input.push(l)}flushInput(){this.input.flush()}sendBinary(l){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(l)}sendText(l){const o=_d(l);this.sendInput(o)}}function Qw(a){if(/^wss?:\/\//i.test(a))return a;if(/^https?:\/\//i.test(a)){const n=new URL(a);return n.protocol=n.protocol==="https:"?"wss:":"ws:",(!n.pathname||n.pathname==="/")&&(n.pathname=Rt),n.toString()}if(typeof window<"u"&&window.location){const l=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,r=a.startsWith("/")?a:`/${a}`;return`${l}//${o}${r}`}return"ws://127.0.0.1:8787/ws/client"}class Ww extends Zw{constructor(){super(...arguments);q(this,"currentRole","viewer");q(this,"controllerId");q(this,"hostId");q(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(l){switch(l.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=l.role,this.controllerId=l.controllerId,this.hostId=l.hostId,this.assignedClientId=l.clientId,this.emit("ready",l),this.emit("roleChange",l.role,l.controllerId,l.hostId,l.clientId),typeof l.clientCount=="number"&&this.emit("peerCount",l.clientCount),this.emit("terminalFont",l.terminalFont??null);break}case"paired":{this.emit("paired",{token:l.token,deviceId:l.deviceId,hostId:l.hostId,expiresAt:l.expiresAt});break}case"control_state":{this.currentRole=l.role,this.controllerId=l.controllerId,this.emit("controlState",l.role,l.controllerId),this.emit("roleChange",l.role,l.controllerId,this.hostId,this.assignedClientId),typeof l.clientCount=="number"&&this.emit("peerCount",l.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",l.code||"host_reconnecting"),this.emit("hostReconnecting",l.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",l.cols,l.rows,l.terminalPalette,l.hostname,l.platform,l.shellProfile,l.adminTerminalSupported),this.emit("terminalFont",l.terminalFont??null);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",l);break}case"exit":{this.emit("exit",l.code,l.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"error":{l.code==="host_offline"||l.code==="host_reconnecting"||l.code==="host_reconnect_timeout"||l.code==="rate_limited"?(this.temporaryFailureCode=String(l.code),this.setState("reconnecting",l.message,String(l.code))):(l.code==="auth_required"||l.code==="unauthorized"||l.code==="device_revoked"||l.code==="invalid_handshake"||l.code==="too_many_hosts"||l.code===401||l.code===403)&&(this.authFailureDetail=l.message,this.authFailureCode=String(l.code),this.setState("error",l.message,this.authFailureCode)),this.emit("error",{code:l.code,message:l.message});break}case"paste_file_ready":{this.emit("pasteFileReady",l.path);break}case"agent_status":{this.emit("agentStatus",l);break}case"update_status":{this.emit("updateStatus",l);break}case"terminal_font":{this.emit("terminalFont",l.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",l);break}case"host_font_subset_ready":{this.emit("hostFontSubset",l);break}}}sendHello(){const l={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(l.token=this.config.token),this.config.pairCode&&(l.pairCode=this.config.pairCode),this.sendJson(l)}claimControl(l=!1){const o={type:"claim_control",...l?{force:!0}:{}};this.sendJson(o)}releaseControl(){const l={type:"release_control"};this.sendJson(l)}sendResize(l,o){this.terminalCols=l,this.terminalRows=o;const r={type:"resize",cols:l,rows:o};this.sendJson(r)}sendPasteFile(l,o){this.sendJson({type:"paste_file",mime:l,dataBase64:o})}sendHostFontChunkRequest(l,o){this.sendJson({type:"host_font_chunk_request",sha256:l,index:o})}sendHostFontSubsetRequest(l,o,r){this.sendJson({type:"host_font_subset_request",sha256:l,text:o,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendAdminTabOpen(){this.sendJson({type:"admin_tab_open"})}}function Jw(a,n,l){const o=T.useRef(l);if(o.current=l,!a.current){const r=new Ww(n());for(const u of Object.keys(l)){const h=(...p)=>{var m,g;return(g=(m=o.current)[u])==null?void 0:g.call(m,...p)};r.on(u,h)}a.current=r}return a.current}const e1=3*1024*1024,zb=1568,t1=[.85,.7,.55,.4],Yo={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function n1(a,n,l=zb){if(a<=0||n<=0)return{width:Math.max(1,a),height:Math.max(1,n)};const o=Math.max(a,n);if(o<=l)return{width:a,height:n};const r=l/o;return{width:Math.max(1,Math.round(a*r)),height:Math.max(1,Math.round(n*r))}}function i1(a){if(typeof a!="string"||a.length===0)return 0;const n=a.length;let l=0;a.endsWith("==")?l=2:a.endsWith("=")&&(l=1);const o=Math.floor(n*3/4)-l;return Number.isFinite(o)&&o>0?o:0}function a1(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function l1(a){if(typeof createImageBitmap=="function")try{const n=await createImageBitmap(a,{imageOrientation:"from-image"});return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{try{const n=await createImageBitmap(a);return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{}}return new Promise((n,l)=>{if(typeof Image>"u")return l(new Error("Image decoding not supported in this environment"));const o=new Image,r=URL.createObjectURL(a);o.onload=()=>{n({source:o,width:o.naturalWidth||o.width,height:o.naturalHeight||o.height,cleanup:()=>{try{URL.revokeObjectURL(r)}catch{}}})},o.onerror=()=>{try{URL.revokeObjectURL(r)}catch{}l(new Error("Failed to decode image source"))},o.src=r})}async function Hb(a,n=zb,l=e1){var r;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let o;try{o=await l1(a)}catch(u){return console.warn("Failed to decode image for paste:",u),null}try{const{width:u,height:h}=n1(o.width,o.height,n),p=document.createElement("canvas");p.width=u,p.height=h;const m=p.getContext("2d");if(!m)return null;m.drawImage(o.source,0,0,u,h);let g="image/webp";try{p.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const y of t1){let v;try{v=p.toDataURL(g,y)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const w=v.indexOf(","),x=w!==-1?v.slice(w+1):"",S=i1(x);if(S<=l)return{mime:g,dataBase64:x,dataUrl:v,byteLength:S,width:u,height:h}}return null}finally{(r=o.cleanup)==null||r.call(o)}}const s1=3e4,o1=1200;function r1({adapterRef:a,role:n,connectionState:l,warnViewerMode:o,addToast:r,t:u,sendPasteFile:h}){const[p,m]=T.useState(Yo),g=T.useRef(null),y=T.useRef(0),v=T.useRef(null),w=T.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),x=T.useCallback(()=>{w(),g.current=null,m(Yo)},[w]),S=T.useCallback(()=>{g.current!==null&&x()},[x]),M=T.useCallback(()=>{const k=g.current;k!==null&&(w(),m({active:!0,phase:"completed",ratio:1,percent:100,statusText:u("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===k&&(g.current=null,m(Yo))},o1))},[w,u]);T.useEffect(()=>{l!=="connected"&&S()},[l,S]),T.useEffect(()=>w,[w]);const E=T.useCallback(async k=>{if(n!=="controller")return o(),!1;if(!a.current||l!=="connected")return r("error",u("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const N=++y.current;g.current=N,w();const R=j=>(j&&r("error",j),g.current=null,m(Yo),!1),H="dataBase64"in k&&typeof k.dataBase64=="string";try{let j;if(H)j=k;else{const _=k;if(m({active:!0,phase:"reading",ratio:.1,percent:10,statusText:u("virtualKeyboard.uploadProgressReading")}),!_||_.size===0)return R(u("clipboard.fileEmpty"));if(_.type&&!_.type.startsWith("image/"))return R(u("clipboard.unsupportedType"));m({active:!0,phase:"processing",ratio:.35,percent:35,statusText:u("virtualKeyboard.uploadProgressProcessing")});const z=await Hb(_);if(g.current!==N)return!1;if(!z)return R(u("clipboard.imageTooLarge"));j=z,m({active:!0,phase:"processing",ratio:.6,percent:60,statusText:u("virtualKeyboard.uploadProgressProcessing")})}m({active:!0,phase:"sending",ratio:.75,percent:75,statusText:u("virtualKeyboard.uploadProgressSending")});const D=h(j.mime,j.dataBase64);return g.current!==N?!1:D?(m({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:u("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===N&&R(u("serverErrors.paste_file_write_failed"))},s1),!0):R()}catch(j){return console.error("Failed to process/upload image:",j),g.current===N&&R(u("clipboard.imageTooLarge")),!1}},[a,n,l,o,r,u,h,w]);return{uploadProgress:p,uploadImage:E,resetUploadProgress:x,abortUpload:S,completeUpload:M}}const c1=4096,u1=8*1024*1024;function d1(){const a=T.useRef(null),n=T.useRef([]),l=T.useRef(0),o=T.useCallback(m=>{for(n.current.push(m),l.current+=m.byteLength;n.current.length>c1||l.current>u1;){const g=n.current.shift();if(!g)break;l.current-=g.byteLength}},[]),r=T.useCallback(m=>{const g=a.current;if(g)try{g(m);return}catch(y){console.debug("Terminal output sink threw, buffering chunk instead:",y)}o(m)},[o]),u=T.useCallback(m=>{a.current=m;const g=n.current;n.current=[],l.current=0;for(let y=0;y<g.length;y++)try{m(g[y])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let w=y;w<g.length;w++)o(g[w]);break}return()=>{a.current===m&&(a.current=null)}},[o]),h=T.useCallback(()=>n.current.length,[]),p=T.useCallback(()=>{n.current=[],l.current=0},[]);return{receiveOutput:r,subscribeToOutput:u,getPendingOutputChunkCount:h,clearPendingOutput:p}}const gg=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify"],f1=["agentKeymaps"],h1=64;function m1(a,n){const l=a,o={};for(const r of n)l[r]!==void 0&&(o[r]=l[r]);return o}function tl(a,n){return m1(a,n==="local"?[...gg,...f1]:gg)}function hr(a,n,l){const o=Object.create(null);if(!a||typeof a!="object"||Array.isArray(a))return o;for(const[r,u]of Object.entries(a).slice(0,h1))(r===""?n.length>0:!n.includes(r))||!u||typeof u!="object"||Array.isArray(u)||(o[r]=tl(u,l));return o}const Bb=64,bs=4096;function jd(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function p1(a,n){return(typeof a=="string"?a.trim().slice(0,Bb):"")||n}function mr(a,n){if(!a||typeof a!="object"||Array.isArray(a))return null;const l=a,o=typeof l.wsUrl=="string"?l.wsUrl.trim().slice(0,2048):"",r=typeof l.token=="string"?l.token.slice(0,bs):"",u=typeof l.pairCode=="string"?l.pairCode.trim().toUpperCase().slice(0,32):"";if(!o||!o.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(o)||!r&&!u)return null;const h=Date.now(),p=typeof l.id=="string"&&l.id.length>0?l.id.slice(0,128):jd(),m=typeof l.hostname=="string"&&l.hostname.trim()?l.hostname.trim().slice(0,Bb):`Herdr ${n+1}`;return{id:p,displayName:p1(l.displayName,m),wsUrl:o,token:r,...u?{pairCode:u}:{},...typeof l.hostId=="string"&&l.hostId.trim()?{hostId:l.hostId.trim().slice(0,128)}:{},...typeof l.hostname=="string"&&l.hostname.trim()?{hostname:l.hostname.trim().slice(0,128)}:{},...typeof l.deviceId=="string"&&l.deviceId.trim()?{deviceId:l.deviceId.trim().slice(0,128)}:{},autoReconnect:l.autoReconnect!==!1,createdAt:Number.isFinite(l.createdAt)?Number(l.createdAt):h,lastUsedAt:Number.isFinite(l.lastUsedAt)?Number(l.lastUsedAt):h}}function bg(a,n=0){const l=mr({...a,id:a.id||jd()},n);if(!l)throw new Error("a connection profile requires a relay URL and token or pairing code");return l}function yg(a){let n=a.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const l=new URL(a.wsUrl,window.location.origin);l.protocol=l.protocol==="wss:"?"https:":"http:",l.pathname=l.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",l.search="",l.hash="",n=l.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${n}::${a.hostId||""}`}function Ub(a){var u;const n=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((h,p)=>{const m=mr(h,p);m&&!n.some(g=>g.id===m.id)&&n.push(m)}),n.length===0&&(typeof a.token=="string"&&a.token||typeof a.pairCode=="string"&&a.pairCode)){const h=mr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof a.wsUrl=="string"&&a.wsUrl.trim()?a.wsUrl:Rt,token:a.token||"",pairCode:a.pairCode||"",autoReconnect:a.autoReconnect!==!1},0);h&&n.push(h)}const o=typeof a.activeProfileId=="string"?a.activeProfileId:"",r=n.some(h=>h.id===o)?o:((u=n[0])==null?void 0:u.id)||"";return{profiles:n,activeProfileId:r}}const Kb=[{id:"esc",label:"ESC",code:re.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:re.TAB,type:"key",enabled:!0,title:"Tab"},{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"left",label:"←",code:re.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:re.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:re.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:re.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"enter",label:"Enter",code:re.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],g1=[{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"shift",label:"SHIFT",code:"",type:"modifier",enabled:!0,modifierType:"shift",title:"Toggle Shift modifier latch"},{id:"meta",label:"META",code:"\x1B",type:"modifier",enabled:!0,modifierType:"meta",title:"Meta / Cmd key"},{id:"esc",label:"ESC",code:re.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:re.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:re.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:re.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:re.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:re.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:re.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:re.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:re.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:re.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:re.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:re.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:re.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:re.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:re.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:re.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:re.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:re.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:re.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:re.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:re.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:re.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:re.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:re.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:re.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:re.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:re.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:re.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:re.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:re.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:re.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:re.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:re.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:re.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:re.F12,type:"fn",enabled:!0,title:"F12"},{id:"drawer_chords",label:"^C",code:"",type:"drawer",enabled:!0,drawerType:"chords",title:"Quick Ctrl Chords"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"sym_pipe",label:"|",code:"|",type:"symbol",enabled:!0,isPlainChar:!0,title:"Pipe (|)"},{id:"sym_tilde",label:"~",code:"~",type:"symbol",enabled:!0,isPlainChar:!0,title:"Tilde (~)"},{id:"sym_slash",label:"/",code:"/",type:"symbol",enabled:!0,isPlainChar:!0,title:"Slash (/)"},{id:"sym_backslash",label:"\\",code:"\\",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backslash (\\)"},{id:"sym_dash",label:"-",code:"-",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dash (-)"},{id:"sym_underscore",label:"_",code:"_",type:"symbol",enabled:!0,isPlainChar:!0,title:"Underscore (_)"},{id:"sym_dollar",label:"$",code:"$",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dollar ($)"},{id:"sym_ampersand",label:"&",code:"&",type:"symbol",enabled:!0,isPlainChar:!0,title:"Ampersand (&)"},{id:"sym_quote",label:'"',code:'"',type:"symbol",enabled:!0,isPlainChar:!0,title:'Double Quote (")'},{id:"sym_backtick",label:"`",code:"`",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backtick (`)"}];function ys(){return JSON.parse(JSON.stringify(Kb))}const b1=[["esc","tab","shift_tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"],["esc","tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","drawer_agent","drawer_symbols","drawer_fn","enter"]];function y1(a){return b1.some(n=>a.length===n.length&&a.every((l,o)=>l.id===n[o]&&l.enabled!==!1))}function v1(a){if(!Array.isArray(a)||a.length===0)return ys();const n=a.filter(l=>typeof l=="object"&&l!==null&&typeof l.id=="string"&&typeof l.label=="string"&&typeof l.code=="string");return y1(n)?ys():n.filter(l=>l.id!=="drawer_agent")}function pd(a,n){if(n){const l=`keyTitles.${a.id}`,o=n(l);if(o&&o!==l)return o}return a.title||a.label}const vg="herdr-remote.ignoredUpdate";function x1(){const a=gs("local",Et.ignoredUpdate);if(a!==null)return a;const n=gs("local",vg);if(n===null)return null;Ib(n);try{window.localStorage.removeItem(vg)}catch{}return n}function Ib(a){Li("local",Et.ignoredUpdate,a)}function w1(){return`client-${Math.random().toString(36).substring(2,8)}`}function Fb(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Gb(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:Rt,token:"",pairCode:"",clientId:w1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?ur:ps,fontSizeFollowsHost:!0,fontFamily:Tb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Fb(),virtualKeys:ys(),agentKeymaps:{},observerMode:!1,adminToken:"",adminTokens:{}}}const S1=["wsUrl","token","pairCode","clientId","autoReconnect","language"],C1=["wsUrl","token","pairCode","autoReconnect"],xg=["theme","colorMode"];function Yb(a){const n=a;if(!xg.some(r=>n[r]!==void 0))return{data:a,changed:!1};const o={...n};for(const r of xg)delete o[r];return{data:o,changed:!0}}function Pb(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const n={};for(const[l,o]of Object.entries(a).slice(0,32))typeof o!="string"||o.length===0||(n[l.slice(0,512)]=o.slice(0,bs));return n}function pr(a,n){const l=gs(a,n);if(!l)return{};try{const o=JSON.parse(l);return o&&typeof o=="object"&&!Array.isArray(o)?o:{}}catch(o){return console.warn(`Failed to parse ${a}Storage settings:`,o),{}}}function gr(){const a=Gb();if(typeof window>"u")return a;let n=pr("local",Et.settings);const l=Yb(n);l.changed&&(n=l.data,Li("local",Et.settings,JSON.stringify(n)));const o=pr("session",Et.sessionView),r=Ub(n),u=r.profiles.map(ne=>ne.id),h=typeof o.activeProfileId=="string"&&u.includes(o.activeProfileId)?o.activeProfileId:r.activeProfileId,p=r.profiles.find(ne=>ne.id===h),m={...tl(n,"local"),...hr(n.instances,u,"local")[h]},g=hr(o.instances,u,"session");let y=g[h];y||(y=tl({...m,...tl(o,"session")},"session"),g[h]=y,Li("session",Et.sessionView,JSON.stringify({activeProfileId:h,instances:g,observerMode:o.observerMode,adminToken:o.adminToken,adminTokens:o.adminTokens})));const v={...m,...y},w=Pu(v.fontFamily??a.fontFamily),x=window.innerWidth<640?ur:ps,S=v.fontSize??a.fontSize,M=il(S,x),E=v.fontSizeFollowsHost,k=typeof E=="boolean"?E:M===ps||M===ur,N=v1(v.virtualKeys??a.virtualKeys),R=n.language??a.language,H=R==="zh"||R==="en"?R:Fb(),j=ne=>{const W=v[ne];return typeof W=="boolean"?W:a[ne]},D=v.predictiveEcho??a.predictiveEcho,_=D==="always"||D==="off"||D==="auto"?D:"auto",z=typeof o.adminToken=="string"?o.adminToken.slice(0,bs):typeof n.adminToken=="string"?n.adminToken.slice(0,bs):a.adminToken,K=Pb(o.adminTokens),V={...a,wsUrl:(p==null?void 0:p.wsUrl)||(typeof n.wsUrl=="string"?n.wsUrl:a.wsUrl),token:(p==null?void 0:p.token)||"",pairCode:(p==null?void 0:p.pairCode)||"",autoReconnect:(p==null?void 0:p.autoReconnect)??a.autoReconnect,profiles:r.profiles,activeProfileId:h,clientId:typeof n.clientId=="string"&&n.clientId.trim()?n.clientId.trim().slice(0,128):a.clientId,fontFamily:w,fontSize:M,fontSizeFollowsHost:k,toolbarVisible:v.toolbarVisible??a.toolbarVisible,toolbarPosition:v.toolbarPosition??a.toolbarPosition,vibrateOnKeyPress:v.vibrateOnKeyPress??a.vibrateOnKeyPress,predictiveEcho:_,virtualKeys:N,agentKeymaps:Cb(v.agentKeymaps),agentAlertBadge:j("agentAlertBadge"),agentAlertSound:j("agentAlertSound"),agentAlertVibrate:j("agentAlertVibrate"),agentAlertNotify:j("agentAlertNotify"),language:H,observerMode:o.observerMode===!0,adminToken:z,adminTokens:K};return typeof n.fontFamily=="string"&&Pu(n.fontFamily)!==n.fontFamily&&(n.fontFamily=Pu(n.fontFamily),Li("local",Et.settings,JSON.stringify(n))),V}function Mi(a){var M;const n=gr(),l={...n,...a};l.agentKeymaps=Cb(l.agentKeymaps),l.adminTokens=Pb(l.adminTokens),typeof l.adminToken=="string"&&(l.adminToken=l.adminToken.slice(0,bs)),a.fontSize!==void 0&&(l.fontSize=il(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?l.predictiveEcho=a.predictiveEcho:l.predictiveEcho="auto");const o=Ub(l);let r=o.profiles,u=o.activeProfileId;if(C1.some(E=>a[E]!==void 0)){const E=r.findIndex(R=>R.id===u),k=E>=0?{...r[E]}:{id:jd(),displayName:`Herdr ${r.length+1}`,wsUrl:l.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};k.wsUrl=l.wsUrl,k.token=l.token,k.pairCode=l.pairCode||void 0,k.autoReconnect=l.autoReconnect,k.lastUsedAt=Date.now();const N=mr(k,Math.max(E,0));N?E>=0?r[E]=N:(r.push(N),u=N.id):E>=0&&(r=r.filter(R=>R.id!==u),u=((M=r[0])==null?void 0:M.id)||"")}r.length>0&&!r.some(E=>E.id===u)&&(u=r[0].id);const p=r.find(E=>E.id===u);l.wsUrl=(p==null?void 0:p.wsUrl)||l.wsUrl||Rt,l.token=(p==null?void 0:p.token)||"",l.pairCode=(p==null?void 0:p.pairCode)||"",l.autoReconnect=(p==null?void 0:p.autoReconnect)??l.autoReconnect;const m=r.map(E=>E.id),g=Yb(pr("local",Et.settings)).data,y=pr("session",Et.sessionView),v=hr(g.instances,m,"local"),w=hr(y.instances,m,"session"),S=u===n.activeProfileId||!n.activeProfileId?l:a;v[u]={...v[u],...tl(S,"local")},w[u]={...w[u],...tl(S,"session")};for(const E of S1)l[E]!==void 0&&(g[E]=l[E]);return g.profiles=r,g.instances=v,(u!==n.activeProfileId||!m.includes(g.activeProfileId??""))&&(g.activeProfileId=u),Li("local",Et.settings,JSON.stringify(g)),Li("session",Et.sessionView,JSON.stringify({activeProfileId:u,instances:w,observerMode:l.observerMode===!0,adminToken:l.adminToken,adminTokens:l.adminTokens})),gr()}function T1(a){const[n,l]=T.useState(gr),o=T.useRef(n);o.current=n;const r=T.useRef(a);r.current=a;const u=T.useCallback(x=>{const S=Mi(x);o.current=S,l(S)},[]),h=T.useCallback(x=>{o.current=x,l(x)},[]),p=T.useCallback(x=>{const S=o.current,M=bg({...x,wsUrl:x.wsUrl||Rt,token:x.token||"",displayName:x.displayName||`Herdr ${S.profiles.length+1}`,autoReconnect:x.autoReconnect!==!1},S.profiles.length),E=Mi({profiles:[...S.profiles,M],activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect});h(E),r.current(E)},[h]),m=T.useCallback(x=>{const S=o.current,M=S.profiles.find(k=>k.id===x);if(!M||M.id===S.activeProfileId)return;const E=Mi({activeProfileId:M.id,wsUrl:M.wsUrl,token:M.token,pairCode:M.pairCode||"",autoReconnect:M.autoReconnect,profiles:S.profiles.map(k=>k.id===M.id?{...k,lastUsedAt:Date.now()}:k)});h(E),r.current(E)},[h]),g=T.useCallback((x,S)=>{const M=o.current;if(!M.profiles.find(R=>R.id===x))return;const k=S.trim().slice(0,64);if(!k)return;const N=Mi({profiles:M.profiles.map(R=>R.id===x?{...R,displayName:k}:R)});h(N)},[h]),y=T.useCallback(x=>{const S=o.current;if(!S.profiles.some(N=>N.id===x))return;const M=S.profiles.filter(N=>N.id!==x),E=M.find(N=>N.id===S.activeProfileId)||M[0],k=Mi(E?{profiles:M,activeProfileId:E.id,wsUrl:E.wsUrl,token:E.token,pairCode:E.pairCode||"",autoReconnect:E.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:Rt,token:"",pairCode:""});h(k),x===S.activeProfileId&&r.current(k)},[h]),v=T.useCallback(x=>{const S=o.current,M=S.profiles.find(z=>z.id===S.activeProfileId),E=x.hostId?yg({wsUrl:S.wsUrl,hostId:x.hostId}):null,k=E?S.profiles.findIndex(z=>yg(z)===E):-1,N=k>=0?k:Math.max(0,S.profiles.findIndex(z=>z.id===S.activeProfileId)),H={...S.profiles[N]||M||bg({wsUrl:S.wsUrl||Rt,token:"",pairCode:S.pairCode||"PENDING",displayName:`Herdr ${S.profiles.length+1}`},S.profiles.length),token:x.token,pairCode:void 0,...x.hostId?{hostId:x.hostId}:{},...x.deviceId?{deviceId:x.deviceId}:{},lastUsedAt:Date.now()};let j=[...S.profiles];N>=0&&N<j.length?j[N]=H:j.push(H);const D=M==null?void 0:M.id;j=j.filter((z,K)=>K===N||z.id===H.id?!0:!(k>=0&&D&&z.id===D));const _=Mi({profiles:j,activeProfileId:H.id,wsUrl:H.wsUrl,token:H.token,pairCode:"",autoReconnect:H.autoReconnect});return h(_),_},[h]),w=T.useCallback(x=>{const S=o.current,M=S.profiles.find(R=>R.id===S.activeProfileId);if(!M||!x.hostId&&!x.hostname)return;const E=/^Herdr \d+$/.test(M.displayName),k={...M,...x.hostId?{hostId:x.hostId}:{},...x.hostname?{hostname:x.hostname}:{},...x.hostname&&E?{displayName:x.hostname}:{}},N=Mi({profiles:S.profiles.map(R=>R.id===M.id?k:R)});h(N)},[h]);return{settings:n,updateSettings:u,addProfileAndConnect:p,switchProfile:m,renameProfile:g,removeProfile:y,savePairedProfile:v,noteReadyProfile:w}}const Po={ctrl:!1,alt:!1,shift:!1};function M1({adapterRef:a,role:n,addToast:l,tRef:o}){const[r,u]=T.useState({cols:80,rows:24}),h=T.useRef(r);h.current=r;const p=T.useRef(new Set),m=T.useRef(new Set),g=T.useRef(!0);T.useEffect(()=>{n==="controller"&&(g.current=!0)},[n]);const y=T.useCallback(()=>{g.current&&(g.current=!1,l("warning",o.current("toasts.viewerModeWarning")))},[l,o]),v=T.useCallback(_=>{if(n!=="controller"){y();return}const z=a.current;if(!z)return;const K=_d(_);for(const V of m.current)try{V(K)}catch(ne){console.debug("Key input observer threw:",ne)}z.sendInput(K)},[a,n,y]),w=T.useCallback(_=>(m.current.add(_),()=>{m.current.delete(_)}),[]),[x,S]=T.useState(Po),M=T.useRef(Po),E=T.useCallback(_=>{const z={...M.current,[_]:!M.current[_]};M.current=z,S(z)},[]),k=T.useCallback(()=>{const _=M.current;return!_.ctrl&&!_.alt&&!_.shift?null:(M.current=Po,S(Po),_)},[]),N=T.useCallback(_=>{var z;n!=="controller"&&!fr(_)||(z=a.current)==null||z.sendInput(_)},[a,n]),R=T.useCallback((_,z)=>{var K;h.current={cols:_,rows:z},u({cols:_,rows:z}),(K=a.current)==null||K.sendResize(_,z)},[a]),H=T.useCallback((_,z)=>n!=="controller"?(y(),!1):a.current?(a.current.sendPasteFile(_,z),!0):!1,[a,n,y]),j=T.useCallback(_=>(p.current.add(_),()=>{p.current.delete(_)}),[]),D=T.useCallback(_=>{for(const z of p.current)try{z(_)}catch(K){console.error("Error in pasteFileReady listener:",K)}},[]);return{terminalDimensions:r,dimensionsRef:h,warnViewerMode:y,sendKey:v,observeKeyInput:w,modifierLatch:x,toggleModifierLatch:E,consumeModifierLatch:k,sendBinary:N,sendResize:R,sendPasteFile:H,subscribeToPasteFileReady:j,notifyPasteFileReady:D}}const A1=4e3,E1=3;function N1(){const[a,n]=T.useState([]),l=T.useRef([]),o=T.useRef(new Map),r=T.useCallback(p=>{l.current=p,n(p)},[]),u=T.useCallback(p=>{const m=o.current.get(p);m&&(clearTimeout(m),o.current.delete(p)),r(l.current.filter(g=>g.id!==p))},[r]),h=T.useCallback((p,m)=>{const g=Date.now(),y=l.current,v=y.find(M=>M.type===p&&M.message===m),w=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let x;if(v)x=y.map(M=>M.id===w?{...M,count:M.count+1,timestamp:g}:M);else for(x=[...y,{id:w,type:p,message:m,timestamp:g,count:1}];x.length>E1;){const[M,...E]=x,k=o.current.get(M.id);k&&(clearTimeout(k),o.current.delete(M.id)),x=E}r(x);const S=o.current.get(w);S&&clearTimeout(S),o.current.set(w,setTimeout(()=>u(w),A1))},[r,u]);return T.useEffect(()=>{const p=o.current;return()=>{for(const m of p.values())clearTimeout(m);p.clear()}},[]),{toasts:a,addToast:h,removeToast:u}}function k1(a,n){const[l,o]=T.useState(null),[r,u]=T.useState(x1),h=T.useRef(r),p=T.useRef(new Set),m=T.useCallback(v=>{h.current=v,u(v),Ib(v)},[]),g=T.useCallback(v=>{if(o(v),!v.updateAvailable||h.current===v.latest)return;const w=`${v.latest}:${v.restartPending?"restart":"update"}`;p.current.has(w)||(p.current.add(w),a("info",v.restartPending?n.current("update.toastRestart",{version:v.latest}):n.current("update.toast",{version:v.latest})))},[a,n]),y=T.useCallback(()=>o(null),[]);return{updateStatus:l,ignoredUpdate:r,ignoreUpdate:m,receiveUpdateStatus:g,forgetUpdateStatus:y}}const $b=T.createContext(null),qb=T.createContext(null),Vb=T.createContext(null),Xb=T.createContext(null),Zb=T.createContext(null),L1=({children:a})=>{var At;const[n,l]=T.useReducer(Dw,Ow),o=T.useRef(null),r=T.useRef(!1);T.useEffect(()=>{Mb()},[]);const{receiveOutput:u,subscribeToOutput:h,getPendingOutputChunkCount:p,clearPendingOutput:m}=d1(),{toasts:g,addToast:y,removeToast:v}=N1(),w=T.useCallback(()=>{m(),l({type:"reset",resetTerminal:!0})},[m]),{settings:x,updateSettings:S,addProfileAndConnect:M,switchProfile:E,renameProfile:k,removeProfile:N,savePairedProfile:R,noteReadyProfile:H}=T1(ge=>{var Ve;w(),(Ve=o.current)==null||Ve.reconnectWith(Go(ge))}),j=T.useCallback((ge,Ve)=>Ld(x.language,ge,Ve),[x.language]),D=T.useRef(j);D.current=j;const{herdrLaunch:_,startHerdr:z,handleLaunchError:K,forgetHerdrLaunch:V}=Hw(o,D),{updateStatus:ne,ignoredUpdate:W,ignoreUpdate:ie,receiveUpdateStatus:oe,forgetUpdateStatus:P}=k1(y,D),A=x.observerMode?"viewer":n.role,I=M1({adapterRef:o,role:A,addToast:y,tRef:D}),{uploadProgress:J,uploadImage:le,resetUploadProgress:Z,abortUpload:ye,completeUpload:xe}=r1({adapterRef:o,role:A,connectionState:n.connectionState,warnViewerMode:I.warnViewerMode,addToast:y,t:j,sendPasteFile:I.sendPasteFile}),ce=Jw(o,()=>Go(x),{stateChange:(ge,Ve,Xt)=>{const Zt=Yu(Xt)?j(`serverErrors.${Xt}`):Ve;l({type:"stateChange",state:ge,detail:Zt,code:Xt}),ge==="connected"?y("success",j("toasts.connected")):ge==="error"&&y("error",Zt||j("toasts.connectionError")),ge!=="connected"&&V()},ready:ge=>{const Ve=r.current;Ve&&m(),r.current=!0,V(),P(),l({type:"ready",message:ge,resetTerminal:Ve}),H(ge)},hostReconnecting:ge=>{l({type:"hostReconnecting",code:ge||"host_reconnecting",detail:j(`serverErrors.${Yu(ge)?ge:"host_reconnecting"}`)}),m()},sessionRestarted:(ge,Ve,Xt,Zt,ra,ca,En)=>{var Di;m(),l({type:"sessionRestarted",hostname:Zt,palette:Xt,platform:ra,shellProfile:ca,adminTerminalSupported:En}),H({hostId:(Di=o.current)==null?void 0:Di.getHostId(),hostname:Zt})},roleChange:(ge,Ve,Xt,Zt)=>{l({type:"roleChange",role:ge,controllerId:Ve,hostId:Xt,assignedClientId:Zt})},controlGranted:()=>{l({type:"controlGranted"}),y("success",j("toasts.controlGranted"))},paired:ge=>{var Xt;const Ve=R(ge);y("success",j("toasts.pairedSuccess")),l({type:"paired",at:Date.now()}),(Xt=o.current)==null||Xt.reconnectWith(Go(Ve))},exit:(ge,Ve)=>{y("info",`${j("toasts.sessionEnded")}${Ve?`: ${Ve}`:""}${ge!=null?` (${ge})`:""}`)},error:ge=>{if(K(ge)||ge.code==="host_font_unavailable")return;ye();const Ve=Yu(ge.code)?j(`serverErrors.${ge.code}`):ge.message||`[${ge.code}]`;y("error",Ve)},pasteFileReady:ge=>{xe(),I.notifyPasteFileReady(ge)},rttUpdate:ge=>l({type:"rtt",rttMs:ge}),peerCount:ge=>l({type:"peerCount",count:ge}),sessionReady:()=>{l({type:"sessionReady"}),V()},agentStatus:ge=>l({type:"agentStatus",status:ge}),updateStatus:oe,binaryData:u}),{activeProfileId:Te}=x,ue=x.profiles.find(ge=>ge.id===Te),{hostFont:de,loadHostFont:se,declineHostFont:ve,syncHostFont:ae,ensureHostGlyphs:we}=Lw(ce),Ae=T.useCallback(()=>{se()},[se]),De=cw(x.fontFamily,de.font?{family:de.font.family,alias:de.status==="loaded"?de.alias:null,glyphs:de.glyphs.source?{family:de.glyphs.source.family,scope:de.glyphs.source.scope,alias:de.glyphs.alias}:null}:null),rt=x.fontSizeFollowsHost&&((At=de.font)!=null&&At.sizePx)?il(de.font.sizePx,x.fontSize):x.fontSize;T.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",De)},[De]),T.useEffect(()=>{var ge;(ge=o.current)==null||ge.updateConfig(Go(x))},[x]),T.useEffect(()=>{const ge=o.current;return ge?_w(ge):void 0},[]);const{dimensionsRef:tt}=I,fe=T.useCallback(ge=>{o.current&&(ge&&o.current.updateConfig(ge),o.current.connect(tt.current))},[tt]),Re=T.useCallback(()=>{var ge;(ge=o.current)==null||ge.disconnect()},[]),Xe=T.useCallback((ge=!1)=>{var Ve;(Ve=o.current)==null||Ve.claimControl(ge)},[]),gt=T.useCallback(()=>{var ge;(ge=o.current)==null||ge.releaseControl()},[]),ht=T.useCallback(ge=>S({language:ge}),[S]),An=T.useMemo(()=>({settings:x,updateSettings:S,language:x.language,setLanguage:ht,t:j,profiles:x.profiles,activeProfileId:Te,activeProfile:ue,switchProfile:E,addProfileAndConnect:M,renameProfile:k,removeProfile:N,hostFont:de,loadHostFont:Ae,declineHostFont:ve,syncHostFont:ae,ensureHostGlyphs:we,terminalFontFamily:De,terminalFontSize:rt}),[x,S,ht,j,Te,ue,E,M,k,N,de,Ae,ve,ae,we,De,rt]),gn=T.useMemo(()=>{var ge;return{...n,role:A,isController:A==="controller",agentProfile:Fx((ge=n.agentStatus)==null?void 0:ge.focusedAgent,"auto"),reportShellProfile:Ve=>l({type:"shellProfile",profile:Ve}),adapter:ce,connect:fe,disconnect:Re,claimControl:Xe,releaseControl:gt,herdrLaunch:_,startHerdr:z,updateStatus:ne,ignoredUpdate:W,ignoreUpdate:ie}},[n,A,ce,fe,Re,Xe,gt,_,z,ne,W,ie]),kt=T.useMemo(()=>({toasts:g,addToast:y,removeToast:v}),[g,y,v]),{terminalDimensions:Jn,sendKey:Mt,observeKeyInput:As,modifierLatch:cl,toggleModifierLatch:ul,consumeModifierLatch:Oi,sendBinary:Es,sendResize:dl,warnViewerMode:Ns,sendPasteFile:ks,subscribeToPasteFileReady:ei}=I,Lt=T.useMemo(()=>({terminalDimensions:Jn,sendKey:Mt,observeKeyInput:As,modifierLatch:cl,toggleModifierLatch:ul,consumeModifierLatch:Oi,sendBinary:Es,sendResize:dl,warnViewerMode:Ns,sendPasteFile:ks,subscribeToPasteFileReady:ei,subscribeToOutput:h,getPendingOutputChunkCount:p}),[Jn,Mt,As,cl,ul,Oi,Es,dl,Ns,ks,ei,h,p]),bn=T.useMemo(()=>({uploadProgress:J,uploadImage:le,resetUploadProgress:Z}),[J,le,Z]);return f.jsx($b.Provider,{value:An,children:f.jsx(qb.Provider,{value:gn,children:f.jsx(Vb.Provider,{value:kt,children:f.jsx(Xb.Provider,{value:Lt,children:f.jsx(Zb.Provider,{value:bn,children:a})})})})})};function Ss(a,n){const l=T.useContext(a);if(!l)throw new Error(`${n} must be used within a TerminalProvider`);return l}const Ne=()=>Ss($b,"useSettings"),et=()=>Ss(qb,"useConnection"),Vt=()=>Ss(Vb,"useToasts"),Cs=()=>Ss(Xb,"useTerminalIO"),Sr=()=>Ss(Zb,"useUpload");function vs(a){var n,l;return a?{blocked:((n=a.counts)==null?void 0:n.blocked)??0,done:((l=a.counts)==null?void 0:l.done)??0}:null}function _1(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function R1(a){if(!a)return"";const n=[];return a.blocked>0&&n.push(`${a.blocked}⚠`),a.done>0&&n.push(`${a.done}✓`),n.length>0?`(${n.join(" ")})`:""}function j1(a,n){if(!a||!n)return null;const l=new Map(a.agents.map(h=>[h.paneId,h.status]));let o=null;for(const h of n.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&l.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";o="done"}const r=vs(a),u=vs(n);return u.blocked>r.blocked?"blocked":(!o&&u.done>r.done&&(o="done"),o)}const O1={blocked:"%23f9e2af",done:"%23a6e3a1"};function D1(a){return`<circle cx='19' cy='5' r='4.5' fill='${O1[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function z1(a,n){return!n||!a.includes("</svg>")?a:a.replace("</svg>",`${D1(n)}</svg>`)}function wg(a,n=document){const l=n.querySelector('link[rel~="icon"]');if(!l)return;l.dataset.baseHref===void 0&&(l.dataset.baseHref=l.getAttribute("href")??"");const o=z1(l.dataset.baseHref,a);l.getAttribute("href")!==o&&l.setAttribute("href",o)}let rn=null;function H1(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function Qb(){const a=H1();if(a)try{rn=rn??new a,rn.state==="suspended"&&rn.resume()}catch{rn=null}}function B1(a=window){const n=()=>{Qb(),l()},l=()=>{a.removeEventListener("pointerdown",n),a.removeEventListener("keydown",n)};return a.addEventListener("pointerdown",n),a.addEventListener("keydown",n),l}const U1={blocked:[880,660],done:[660,880]};function Wb(a){if((rn==null?void 0:rn.state)==="running")try{const n=rn.currentTime;U1[a].forEach((l,o)=>{const r=rn.createOscillator(),u=rn.createGain(),h=n+o*.11;r.type="sine",r.frequency.value=l,u.gain.setValueAtTime(1e-4,h),u.gain.exponentialRampToValueAtTime(.06,h+.01),u.gain.exponentialRampToValueAtTime(1e-4,h+.09),r.connect(u),u.connect(rn.destination),r.start(h),r.stop(h+.1)})}catch{}}const K1=15e3,I1={blocked:[70,50,70],done:[40]};function F1(){const{settings:a,t:n}=Ne(),{agentStatus:l}=et(),o=T.useRef(a);o.current=a;const r=T.useRef(n);r.current=n;const u=T.useRef(null),h=T.useRef(Number.NEGATIVE_INFINITY);T.useEffect(()=>{wg(a.agentAlertBadge?_1(vs(l)):null)},[l,a.agentAlertBadge]),T.useEffect(()=>()=>wg(null),[]),T.useEffect(()=>{if(!(!a.agentAlertSound||typeof window>"u"))return B1(window)},[a.agentAlertSound]),T.useEffect(()=>{const p=u.current;u.current=l;const m=j1(p,l);if(!m)return;const g=Date.now();if(g-h.current<K1)return;h.current=g;const y=o.current,v=typeof document<"u"&&document.visibilityState==="hidden",w=v||typeof document<"u"&&!document.hasFocus();if(y.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(I1[m])}catch{}if(y.agentAlertSound&&w&&Wb(m),y.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const x=vs(l),S=m==="blocked"?r.current("agents.notifyBlocked",{count:x.blocked}):r.current("agents.notifyDone",{count:x.done});try{new Notification("Herdr Remote",{body:S,tag:"herdr-agents"})}catch{}}},[l])}function Jb(a){var n,l,o="";if(typeof a=="string"||typeof a=="number")o+=a;else if(typeof a=="object")if(Array.isArray(a)){var r=a.length;for(n=0;n<r;n++)a[n]&&(l=Jb(a[n]))&&(o&&(o+=" "),o+=l)}else for(l in a)a[l]&&(o&&(o+=" "),o+=l);return o}function G1(){for(var a,n,l=0,o="",r=arguments.length;l<r;l++)(a=arguments[l])&&(n=Jb(a))&&(o&&(o+=" "),o+=n);return o}const Y1=(a,n)=>{const l=new Array(a.length+n.length);for(let o=0;o<a.length;o++)l[o]=a[o];for(let o=0;o<n.length;o++)l[a.length+o]=n[o];return l},P1=(a,n)=>({classGroupId:a,validator:n}),ey=(a=new Map,n=null,l)=>({nextPart:a,validators:n,classGroupId:l}),br="-",Sg=[],$1="arbitrary..",q1=a=>{const n=X1(a),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=a;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return V1(h);const p=h.split(br),m=p[0]===""&&p.length>1?1:0;return ty(p,m,n)},getConflictingClassGroupIds:(h,p)=>{if(p){const m=o[h],g=l[h];return m?g?Y1(g,m):m:g||Sg}return l[h]||Sg}}},ty=(a,n,l)=>{if(a.length-n===0)return l.classGroupId;const r=a[n],u=l.nextPart.get(r);if(u){const g=ty(a,n+1,u);if(g)return g}const h=l.validators;if(h===null)return;const p=n===0?a.join(br):a.slice(n).join(br),m=h.length;for(let g=0;g<m;g++){const y=h[g];if(y.validator(p))return y.classGroupId}},V1=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=a.slice(1,-1),l=n.indexOf(":"),o=n.slice(0,l);return o?$1+o:void 0})(),X1=a=>{const{theme:n,classGroups:l}=a;return Z1(l,n)},Z1=(a,n)=>{const l=ey();for(const o in a){const r=a[o];Od(r,l,o,n)}return l},Od=(a,n,l,o)=>{const r=a.length;for(let u=0;u<r;u++){const h=a[u];Q1(h,n,l,o)}},Q1=(a,n,l,o)=>{if(typeof a=="string"){W1(a,n,l);return}if(typeof a=="function"){J1(a,n,l,o);return}eS(a,n,l,o)},W1=(a,n,l)=>{const o=a===""?n:ny(n,a);o.classGroupId=l},J1=(a,n,l,o)=>{if(tS(a)){Od(a(o),n,l,o);return}n.validators===null&&(n.validators=[]),n.validators.push(P1(l,a))},eS=(a,n,l,o)=>{const r=Object.entries(a),u=r.length;for(let h=0;h<u;h++){const[p,m]=r[h];Od(m,ny(n,p),l,o)}},ny=(a,n)=>{let l=a;const o=n.split(br),r=o.length;for(let u=0;u<r;u++){const h=o[u];let p=l.nextPart.get(h);p||(p=ey(),l.nextPart.set(h,p)),l=p}return l},tS=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,nS=a=>{if(a<1)return{get:()=>{},set:()=>{}};let n=0,l=Object.create(null),o=Object.create(null);const r=(u,h)=>{l[u]=h,n++,n>a&&(n=0,o=l,l=Object.create(null))};return{get(u){let h=l[u];if(h!==void 0)return h;if((h=o[u])!==void 0)return r(u,h),h},set(u,h){u in l?l[u]=h:r(u,h)}}},gd="!",Cg=":",iS=[],Tg=(a,n,l,o,r)=>({modifiers:a,hasImportantModifier:n,baseClassName:l,maybePostfixModifierPosition:o,isExternal:r}),aS=a=>{const{prefix:n,experimentalParseClassName:l}=a;let o=r=>{const u=[];let h=0,p=0,m=0,g;const y=r.length;for(let M=0;M<y;M++){const E=r[M];if(h===0&&p===0){if(E===Cg){u.push(r.slice(m,M)),m=M+1;continue}if(E==="/"){g=M;continue}}E==="["?h++:E==="]"?h--:E==="("?p++:E===")"&&p--}const v=u.length===0?r:r.slice(m);let w=v,x=!1;v.endsWith(gd)?(w=v.slice(0,-1),x=!0):v.startsWith(gd)&&(w=v.slice(1),x=!0);const S=g&&g>m?g-m:void 0;return Tg(u,x,w,S)};if(n){const r=n+Cg,u=o;o=h=>h.startsWith(r)?u(h.slice(r.length)):Tg(iS,!1,h,void 0,!0)}if(l){const r=o;o=u=>l({className:u,parseClassName:r})}return o},lS=a=>{const n=new Map;return a.orderSensitiveModifiers.forEach((l,o)=>{n.set(l,1e6+o)}),l=>{const o=[];let r=[];for(let u=0;u<l.length;u++){const h=l[u],p=h[0]==="[",m=n.has(h);p||m?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(h)):r.push(h)}return r.length>0&&(r.sort(),o.push(...r)),o}},sS=a=>({cache:nS(a.cacheSize),parseClassName:aS(a),sortModifiers:lS(a),postfixLookupClassGroupIds:oS(a),...q1(a)}),oS=a=>{const n=Object.create(null),l=a.postfixLookupClassGroups;if(l)for(let o=0;o<l.length;o++)n[l[o]]=!0;return n},rS=/\s+/,cS=(a,n)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:u,postfixLookupClassGroupIds:h}=n,p=[],m=a.trim().split(rS);let g="";for(let y=m.length-1;y>=0;y-=1){const v=m[y],{isExternal:w,modifiers:x,hasImportantModifier:S,baseClassName:M,maybePostfixModifierPosition:E}=l(v);if(w){g=v+(g.length>0?" "+g:g);continue}let k=!!E,N;if(k){const _=M.substring(0,E);N=o(_);const z=N&&h[N]?o(M):void 0;z&&z!==N&&(N=z,k=!1)}else N=o(M);if(!N){if(!k){g=v+(g.length>0?" "+g:g);continue}if(N=o(M),!N){g=v+(g.length>0?" "+g:g);continue}k=!1}const R=x.length===0?"":x.length===1?x[0]:u(x).join(":"),H=S?R+gd:R,j=H+N;if(p.indexOf(j)>-1)continue;p.push(j);const D=r(N,k);for(let _=0;_<D.length;++_){const z=D[_];p.push(H+z)}g=v+(g.length>0?" "+g:g)}return g},uS=(...a)=>{let n=0,l,o,r="";for(;n<a.length;)(l=a[n++])&&(o=iy(l))&&(r&&(r+=" "),r+=o);return r},iy=a=>{if(typeof a=="string")return a;let n,l="";for(let o=0;o<a.length;o++)a[o]&&(n=iy(a[o]))&&(l&&(l+=" "),l+=n);return l},Mg=(a,...n)=>{let l,o,r,u;const h=m=>{const g=n.reduce((y,v)=>v(y),a());return l=sS(g),o=l.cache.get,r=l.cache.set,u=p,p(m)},p=m=>{const g=o(m);if(g)return g;const y=cS(m,l);return r(m,y),y};return u=h,(...m)=>u(uS(...m))},dS=[],pt=a=>{const n=l=>l[a]||dS;return n.isThemeGetter=!0,n},ay=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ly=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,hS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ai=a=>fS.test(a),_e=a=>!!a&&!Number.isNaN(Number(a)),Sn=a=>!!a&&Number.isInteger(Number(a)),Wu=a=>a.endsWith("%")&&_e(a.slice(0,-1)),$n=a=>hS.test(a),sy=()=>!0,yS=a=>mS.test(a)&&!pS.test(a),Dd=()=>!1,vS=a=>gS.test(a),xS=a=>bS.test(a),wS=a=>!he(a)&&!me(a),SS=a=>a.startsWith("@container")&&(a[10]==="/"&&a[11]!==void 0||a[11]==="s"&&a[16]!==void 0&&a.startsWith("-size/",10)||a[11]==="n"&&a[18]!==void 0&&a.startsWith("-normal/",10)),CS=a=>ji(a,cy,Dd),he=a=>ay.test(a),ea=a=>ji(a,uy,yS),Ag=a=>ji(a,_S,_e),TS=a=>ji(a,fy,sy),MS=a=>ji(a,dy,Dd),Eg=a=>ji(a,oy,Dd),AS=a=>ji(a,ry,xS),$o=a=>ji(a,hy,vS),me=a=>ly.test(a),ss=a=>oa(a,uy),ES=a=>oa(a,dy),Ng=a=>oa(a,oy),NS=a=>oa(a,cy),kS=a=>oa(a,ry),qo=a=>oa(a,hy,!0),LS=a=>oa(a,fy,!0),ji=(a,n,l)=>{const o=ay.exec(a);return o?o[1]?n(o[1]):l(o[2]):!1},oa=(a,n,l=!1)=>{const o=ly.exec(a);return o?o[1]?n(o[1]):l:!1},oy=a=>a==="position"||a==="percentage",ry=a=>a==="image"||a==="url",cy=a=>a==="length"||a==="size"||a==="bg-size",uy=a=>a==="length",_S=a=>a==="number",dy=a=>a==="family-name",fy=a=>a==="number"||a==="weight",hy=a=>a==="shadow",kg=()=>{const a=pt("color"),n=pt("font"),l=pt("text"),o=pt("font-weight"),r=pt("tracking"),u=pt("leading"),h=pt("breakpoint"),p=pt("container"),m=pt("spacing"),g=pt("radius"),y=pt("shadow"),v=pt("inset-shadow"),w=pt("text-shadow"),x=pt("drop-shadow"),S=pt("blur"),M=pt("perspective"),E=pt("aspect"),k=pt("ease"),N=pt("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...H(),me,he],D=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],z=()=>[me,he,m],K=()=>[Ai,"full","auto",...z()],V=()=>[Sn,"none","subgrid",me,he],ne=()=>["auto",{span:["full",Sn,me,he]},Sn,me,he],W=()=>[Sn,"auto",me,he],ie=()=>["auto","min","max","fr",me,he],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...z()],I=()=>[Ai,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],J=()=>[Ai,"screen","full","dvw","lvw","svw","min","max","fit",...z()],le=()=>[Ai,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],Z=()=>[a,me,he],ye=()=>[...H(),Ng,Eg,{position:[me,he]}],xe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ce=()=>["auto","cover","contain",NS,CS,{size:[me,he]}],Te=()=>[Wu,ss,ea],ue=()=>["","none","full",g,me,he],de=()=>["",_e,ss,ea],se=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[_e,Wu,Ng,Eg],we=()=>["","none",S,me,he],Ae=()=>["none",_e,me,he],De=()=>["none",_e,me,he],rt=()=>[_e,me,he],tt=()=>[Ai,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$n],breakpoint:[$n],color:[sy],container:[$n],"drop-shadow":[$n],ease:["in","out","in-out"],font:[wS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$n],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$n],shadow:[$n],spacing:["px",_e],text:[$n],"text-shadow":[$n],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ai,he,me,E]}],container:["container"],"container-type":[{"@container":["","normal","size",me,he]}],"container-named":[SS],columns:[{columns:[_e,he,me,p]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[Sn,"auto",me,he]}],basis:[{basis:[Ai,"full","auto",p,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,Ai,"auto","initial","none",he]}],grow:[{grow:["",_e,me,he]}],shrink:[{shrink:["",_e,me,he]}],order:[{order:[Sn,"first","last","none",me,he]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:ne()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:ne()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[p,"screen",...I()]}],"min-w":[{"min-w":[p,"screen","none",...I()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[h]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",l,ss,ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,LS,TS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wu,he]}],"font-family":[{font:[ES,MS,n]}],"font-features":[{"font-features":[he]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,me,he]}],"line-clamp":[{"line-clamp":[_e,"none",me,Ag]}],leading:[{leading:[u,...z()]}],"list-image":[{"list-image":["none",me,he]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",me,he]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",me,ea]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[_e,"auto",me,he]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"tab-size":[{tab:[Sn,me,he]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",me,he]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",me,he]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ye()}],"bg-repeat":[{bg:xe()}],"bg-size":[{bg:ce()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sn,me,he],radial:["",me,he],conic:[Sn,me,he]},kS,AS]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:Te()}],"gradient-via-pos":[{via:Te()}],"gradient-to-pos":[{to:Te()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,me,he]}],"outline-w":[{outline:["",_e,ss,ea]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",y,qo,$o]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",v,qo,$o]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[_e,ea]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",w,qo,$o]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[_e,me,he]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[me,he]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":H()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ye()}],"mask-repeat":[{mask:xe()}],"mask-size":[{mask:ce()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",me,he]}],filter:[{filter:["","none",me,he]}],blur:[{blur:we()}],brightness:[{brightness:[_e,me,he]}],contrast:[{contrast:[_e,me,he]}],"drop-shadow":[{"drop-shadow":["","none",x,qo,$o]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",_e,me,he]}],"hue-rotate":[{"hue-rotate":[_e,me,he]}],invert:[{invert:["",_e,me,he]}],saturate:[{saturate:[_e,me,he]}],sepia:[{sepia:["",_e,me,he]}],"backdrop-filter":[{"backdrop-filter":["","none",me,he]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[_e,me,he]}],"backdrop-contrast":[{"backdrop-contrast":[_e,me,he]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,me,he]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,me,he]}],"backdrop-invert":[{"backdrop-invert":["",_e,me,he]}],"backdrop-opacity":[{"backdrop-opacity":[_e,me,he]}],"backdrop-saturate":[{"backdrop-saturate":[_e,me,he]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,me,he]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",me,he]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",me,he]}],ease:[{ease:["linear","initial",k,me,he]}],delay:[{delay:[_e,me,he]}],animate:[{animate:["none",N,me,he]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,me,he]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Ae()}],"rotate-x":[{"rotate-x":Ae()}],"rotate-y":[{"rotate-y":Ae()}],"rotate-z":[{"rotate-z":Ae()}],scale:[{scale:De()}],"scale-x":[{"scale-x":De()}],"scale-y":[{"scale-y":De()}],"scale-z":[{"scale-z":De()}],"scale-3d":["scale-3d"],skew:[{skew:rt()}],"skew-x":[{"skew-x":rt()}],"skew-y":[{"skew-y":rt()}],transform:[{transform:[me,he,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:tt()}],"translate-x":[{"translate-x":tt()}],"translate-y":[{"translate-y":tt()}],"translate-z":[{"translate-z":tt()}],"translate-none":["translate-none"],zoom:[{zoom:[Sn,me,he]}],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",me,he]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":Z()}],"scrollbar-track-color":[{"scrollbar-track":Z()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",me,he]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[_e,ss,ea,Ag]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},RS=(a,{cacheSize:n,prefix:l,experimentalParseClassName:o,extend:r={},override:u={}})=>(Qa(a,"cacheSize",n),Qa(a,"prefix",l),Qa(a,"experimentalParseClassName",o),Vo(a.theme,u.theme),Vo(a.classGroups,u.classGroups),Vo(a.conflictingClassGroups,u.conflictingClassGroups),Vo(a.conflictingClassGroupModifiers,u.conflictingClassGroupModifiers),Qa(a,"postfixLookupClassGroups",u.postfixLookupClassGroups),Qa(a,"orderSensitiveModifiers",u.orderSensitiveModifiers),Xo(a.theme,r.theme),Xo(a.classGroups,r.classGroups),Xo(a.conflictingClassGroups,r.conflictingClassGroups),Xo(a.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),bd(a,r,"postfixLookupClassGroups"),bd(a,r,"orderSensitiveModifiers"),a),Qa=(a,n,l)=>{l!==void 0&&(a[n]=l)},Vo=(a,n)=>{if(n)for(const l in n)Qa(a,l,n[l])},Xo=(a,n)=>{if(n)for(const l in n)bd(a,n,l)},bd=(a,n,l)=>{const o=n[l];o!==void 0&&(a[l]=a[l]?a[l].concat(o):o)},jS=(a,...n)=>typeof a=="function"?Mg(kg,a,...n):Mg(()=>RS(kg(),a),...n),OS=jS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function te(...a){return OS(G1(a))}const Ee={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},cn={ok:{text:"text-tui-ok",edgeL:"border-l-tui-ok",edgeB:"border-b-tui-ok"},warn:{text:"text-tui-warn",edgeL:"border-l-tui-warn",edgeB:"border-b-tui-warn"},bad:{text:"text-tui-bad",edgeL:"border-l-tui-bad",edgeB:"border-b-tui-bad"},idle:{text:"text-tui-faint",edgeL:"border-l-tui-border",edgeB:"border-b-tui-border"},accent:{text:"text-tui-accent",edgeL:"border-l-tui-accent",edgeB:"border-b-tui-accent"},alt:{text:"text-tui-alt",edgeL:"border-l-tui-alt",edgeB:"border-b-tui-alt"},info:{text:"text-tui-info",edgeL:"border-l-tui-info",edgeB:"border-b-tui-info"}},rl={ok:cn.ok.text,warn:cn.warn.text,bad:cn.bad.text,idle:cn.idle.text,accent:cn.accent.text,alt:cn.alt.text,info:cn.info.text},dn=({level:a,className:n})=>f.jsx("span",{"aria-hidden":"true",className:te("select-none leading-none",rl[a],n),children:a==="idle"?Ee.off:Ee.on}),zd=({className:a})=>f.jsx("span",{"aria-hidden":"true",className:te("select-none text-tui-faint",a),children:Ee.dot}),my={ok:"bg-tui-ok",warn:"bg-tui-warn",bad:"bg-tui-bad",idle:"bg-tui-border",accent:"bg-tui-accent",alt:"bg-tui-alt",info:"bg-tui-info"},Nt=({title:a,aside:n,tone:l="accent",className:o,bodyClassName:r,children:u,...h})=>f.jsxs("fieldset",{className:te("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",a?"px-3 pb-3 pt-1":"p-3",o),...h,children:[a?f.jsx("legend",{className:te("flex items-center gap-2 text-tui font-bold",rl[l]),children:f.jsx("span",{children:a})}):null,n?f.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:n}):null,f.jsx("div",{className:te("min-w-0",r),children:u})]}),Ni=({label:a,labelWidth:n=16,className:l,children:o})=>f.jsxs("div",{className:te("flex items-baseline gap-2 text-tui",l),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${n}ch`},title:typeof a=="string"?a:void 0,children:a}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:o})]}),DS=({className:a,label:n})=>n?f.jsxs("div",{className:te("flex items-center gap-2",a),children:[f.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),f.jsx("span",{className:"text-tui-sm text-tui-faint",children:n}),f.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):f.jsx("div",{className:te("h-px w-full bg-tui-border-dim",a),"aria-hidden":"true"}),_i=({tone:a="accent",className:n,children:l,action:o})=>{const r=a==="ok"?Ee.check:a==="bad"?Ee.cross:a==="warn"?Ee.warn:"›",u=cn[a].edgeL;return f.jsxs("div",{className:te("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",u,n),children:[f.jsx("span",{"aria-hidden":"true",className:te("shrink-0 font-bold",rl[a]),children:r}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:l}),o?f.jsx("div",{className:"shrink-0",children:o}):null]})},zS={default:"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",primary:"border-tui-accent text-tui-accent hover:bg-tui-accent hover:text-tui-crust active:bg-tui-accent-dim",danger:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust active:bg-tui-bad",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust active:bg-tui-warn",ghost:"border-transparent text-tui-muted hover:text-tui-accent hover:border-tui-border active:bg-tui-selection disabled:border-transparent"},Me=({variant:a="default",brackets:n=!0,glyph:l,block:o=!1,className:r,children:u,type:h="button",...p})=>f.jsxs("button",{type:h,className:te("tui-focusable inline-flex select-none items-center justify-center gap-1.5 border bg-transparent px-2 py-0.5 text-tui font-medium transition-colors","disabled:cursor-not-allowed disabled:border-tui-border-dim disabled:text-tui-faint disabled:hover:bg-transparent",zS[a],o&&"w-full",r),...p,children:[n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,l?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:l}):null,f.jsx("span",{className:"truncate",children:u}),n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),py=({tone:a="accent",dot:n=!1,className:l,children:o})=>f.jsxs("span",{className:te("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",rl[a],l),children:[n?f.jsx(dn,{level:a}):null,o]}),Hd=({tabs:a,activeId:n,onSelect:l,ariaLabel:o,className:r,labelClassName:u})=>f.jsx("nav",{className:te("flex items-center gap-2",r),"aria-label":o,children:a.map((h,p)=>{const m=h.id===n;return f.jsxs(Qn.Fragment,{children:[p>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ee.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>l(h.id),"aria-current":m?"page":void 0,"aria-label":h.ariaLabel??h.label,title:h.title,className:te("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",m?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[h.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:te("text-tui-faint",m&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:te("ml-1",u),children:h.label})]})]},h.id)})}),gy=({hints:a,className:n})=>f.jsx("div",{className:te("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",n),children:a.map(l=>f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:l.keys}),f.jsx("span",{children:l.action})]},`${l.keys} ${l.action}`))}),by=({active:a=!1,className:n,children:l})=>f.jsx("span",{className:te("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",a?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",n),children:l}),un=({htmlFor:a,hint:n,className:l,children:o})=>f.jsxs("label",{htmlFor:a,className:te("block text-tui-sm font-bold text-tui-muted",l),children:[o,n?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:n}):null]}),vt=Qn.forwardRef(({className:a,...n},l)=>f.jsx("input",{ref:l,className:te("tui-input w-full px-2 py-1 text-tui",a),...n}));vt.displayName="Input";const Cr=Qn.forwardRef(({className:a,children:n,...l},o)=>f.jsx("select",{ref:o,className:te("tui-input w-full px-2 py-1 text-tui",a),...l,children:n}));Cr.displayName="Select";const HS=({checked:a,onChange:n,disabled:l=!1,label:o,description:r,className:u,id:h})=>f.jsxs("label",{className:te("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",l&&"cursor-not-allowed opacity-60",u),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:a,disabled:l,onChange:p=>n(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:te("mt-px shrink-0 font-bold leading-tight",a?"text-tui-ok":"text-tui-faint",!l&&"group-hover:text-tui-accent"),children:a?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:te("block",a?"text-tui-text":"text-tui-muted"),children:o}),r?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:r}):null]})]}),Tr="h-8",pn=({title:a,aside:n,className:l,children:o})=>f.jsxs("section",{className:te("min-w-0",l),children:[f.jsxs("div",{className:"flex min-h-[var(--tui-row)] items-center gap-2 border-b border-tui-border pb-1",children:[f.jsx("h3",{className:"text-tui font-bold text-tui-accent",children:a}),n?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:n}):null]}),f.jsx("div",{className:"divide-y divide-tui-border-dim",children:o})]}),Kt=({label:a,hint:n,htmlFor:l,control:o,className:r})=>f.jsxs("div",{className:te("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",r),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[l?f.jsx("label",{htmlFor:l,className:"block text-tui text-tui-text",children:a}):f.jsx("span",{className:"block text-tui text-tui-text",children:a}),n?f.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:n}):null]}),f.jsx("div",{className:"w-full shrink-0 sm:w-[20rem]",children:o})]}),yd="flex min-w-0 cursor-pointer select-none items-center justify-center px-1 text-tui transition-colors has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-tui-text",vd="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function xd({name:a,value:n,options:l,onChange:o,tone:r="accent",size:u="md",className:h,"aria-label":p}){return f.jsx("div",{role:"radiogroup","aria-label":p,className:te("grid w-full border border-tui-border bg-tui-mantle",Tr,h),style:{gridTemplateColumns:`repeat(${l.length}, minmax(max-content, 1fr))`},children:l.map((m,g)=>{const y=m.value===n;return f.jsxs("label",{className:te(yd,u==="sm"&&"px-1.5 text-tui-sm",g>0&&"border-l border-tui-border",y?te(my[r],"font-bold text-tui-crust"):vd),children:[f.jsx("input",{type:"radio",name:a,value:m.value,className:"sr-only",checked:y,onChange:()=>o(m.value)}),f.jsx("span",{className:"whitespace-nowrap",children:m.label})]},m.value)})})}const Ei=({checked:a,onChange:n,label:l,offLabel:o,onLabel:r,disabled:u=!1,className:h})=>{const p=m=>g=>{g.preventDefault(),!(u||m===a)&&n(m)};return f.jsxs("label",{className:te("grid w-full grid-cols-2 border border-tui-border bg-tui-mantle has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-tui-accent",Tr,u&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":l,checked:a,disabled:u,onChange:m=>n(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:p(!1),className:te(yd,a?vd:"bg-tui-selection font-bold text-tui-text"),children:o}),f.jsx("span",{"aria-hidden":"true",onClick:p(!0),className:te(yd,"border-l border-tui-border",a?"bg-tui-ok font-bold text-tui-crust":vd),children:r})]})},aa=({variant:a="neutral",className:n,type:l="button",children:o,...r})=>f.jsx("button",{type:l,className:te("tui-focusable inline-flex h-7 w-7 shrink-0 select-none items-center justify-center border border-transparent text-tui transition-colors","disabled:cursor-not-allowed disabled:text-tui-border disabled:hover:border-transparent disabled:hover:bg-transparent",a==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",n),...r,children:o}),BS=({value:a,width:n=20,tone:l="accent",className:o})=>{const r=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,u=Math.round(r*n);return f.jsxs("span",{className:te("inline-flex select-none whitespace-pre font-mono leading-none",o),role:"presentation",children:[f.jsx("span",{className:rl[l],children:Ee.meterFull.repeat(u)}),f.jsx("span",{className:"text-tui-border",children:Ee.meterEmpty.repeat(Math.max(0,n-u))})]})},US=({ratio:a,label:n,tone:l="accent",className:o,...r})=>{const u=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0;return f.jsxs("div",{className:te("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",o),role:"progressbar","aria-valuenow":Math.round(u*100),"aria-valuemin":0,"aria-valuemax":100,...r,children:[f.jsx("div",{className:te("absolute inset-y-0 left-0",my[l]),style:{width:`${u*100}%`},"aria-hidden":"true"}),n!==void 0?f.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:n}):null]})},Va=({label:a,value:n,sub:l,tone:o,title:r,className:u})=>f.jsxs("div",{className:te("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",u),title:r,children:[f.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:a}),f.jsx("div",{className:te("truncate text-tui-lg font-bold",o?rl[o]:"text-tui-text"),children:n}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:l||" "})]}),Lg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],la=({className:a,label:n})=>{const[l,o]=Qn.useState(0);return Qn.useEffect(()=>{const r=setInterval(()=>o(u=>(u+1)%Lg.length),90);return()=>clearInterval(r)},[]),f.jsxs("span",{className:te("inline-flex items-center gap-1.5",a),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Lg[l]}),n?f.jsx("span",{children:n}):null]})};function Bd({columns:a,items:n,rowKey:l,empty:o,className:r}){return n.length===0?f.jsx("div",{className:te("px-1 py-4 text-center text-tui text-tui-faint",r),children:o}):f.jsx("div",{className:te("w-full overflow-x-auto",r),children:f.jsxs("table",{className:"w-full border-collapse text-tui",children:[f.jsx("thead",{children:f.jsx("tr",{className:"border-b border-tui-border",children:a.map(u=>f.jsx("th",{scope:"col",style:u.width?{width:`${u.width}ch`}:void 0,className:te("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",u.align==="right"?"text-right":"text-left",u.className),children:u.header},u.key))})}),f.jsx("tbody",{children:n.map((u,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:a.map(p=>f.jsx("td",{className:te("px-2 py-1 align-top text-tui-text",p.align==="right"?"text-right":"text-left",p.className),children:p.render(u,h)},p.key))},l(u,h)))})]})})}var KS=hb();const Ts=({isOpen:a,onClose:n,title:l,subtitle:o,closeLabel:r,footer:u,hints:h,size:p="md",fixedHeight:m=!1,className:g,children:y})=>{if(!a)return null;const v=p==="sm"?"max-w-md":p==="lg"?"max-w-3xl":"max-w-xl",w=`tui-modal-${l.replace(/\s+/g,"-").toLowerCase()}`,x=f.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":w,onMouseDown:S=>{S.target===S.currentTarget&&n()},children:f.jsxs("div",{className:te("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,m&&"h-[46rem]",g),children:[f.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[f.jsx("h2",{id:w,className:"break-words text-tui font-bold text-tui-accent",children:l}),o?f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:o}):null]}),f.jsx(Me,{variant:"ghost",onClick:n,"aria-label":r,title:r,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),u||h?f.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[h?f.jsx(gy,{hints:h}):f.jsx("span",{}),u?f.jsx("div",{className:"flex items-center gap-2",children:u}):null]}):null]})});return typeof document>"u"?x:KS.createPortal(x,document.body)},wd=({items:a,className:n})=>{const l=a.filter(Boolean);return f.jsx("span",{className:te("flex min-w-0 items-center gap-1.5",n),children:l.map((o,r)=>f.jsxs(Qn.Fragment,{children:[r>0?f.jsx(zd,{className:"shrink-0"}):null,o]},r))})},yy=({left:a,right:n,className:l})=>f.jsxs("footer",{className:te("relative flex h-[var(--tui-row)] w-full shrink-0 items-center justify-between gap-3 overflow-visible border-t border-tui-border bg-tui-mantle px-2 text-tui-sm",l),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:a}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:n})]}),IS=({name:a,tagline:n,aside:l,tabs:o,activeTabId:r,onSelectTab:u,tabsAriaLabel:h,toolbarStart:p,toolbarAside:m,hints:g,footerAside:y,bodyClassName:v,className:w,children:x})=>{const S=!!(o&&o.length>0&&r!==void 0&&u);return f.jsxs("div",{className:te("flex h-full min-h-0 w-full flex-col bg-tui-crust",w),children:[a?f.jsxs("div",{className:"flex h-[var(--tui-row)] shrink-0 items-center justify-between gap-3 overflow-hidden border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[f.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:a}),n?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:n}):null]}),l?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:l}):null]}):null,S||p||m?f.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[p?f.jsx("div",{className:"flex shrink-0 items-center",children:p}):null,S?f.jsx("div",{className:"scrollbar-none order-last min-w-0 basis-full overflow-x-auto sm:order-none sm:basis-auto",children:f.jsx(Hd,{tabs:o,activeId:r,onSelect:u,ariaLabel:h,className:"gap-3"})}):null,m?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:m}):null]}):null,f.jsx("div",{className:te("min-h-0 flex-1 overflow-y-auto p-2",v),children:x}),g||y?f.jsx(yy,{left:g?f.jsx(gy,{hints:g}):null,right:y}):null]})},Zo="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Qo="text-tui-muted hover:border-tui-border hover:text-tui-accent",FS="border-tui-accent bg-tui-accent text-tui-crust",GS=({currentView:a,onNavigate:n,onOpenPairing:l,onOpenSettings:o,onToggleVirtualKeyboard:r,isVirtualKeyboardOpen:u})=>{const{language:h,setLanguage:p,t:m}=Ne(),{addToast:g}=Vt(),y=()=>{const w=h==="zh"?"en":"zh";p(w),g("info",Ld(w,"toasts.switchedLanguage",{lang:w==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:m("header.terminalTab"),index:1,ariaLabel:m("header.terminalTab")},...a==="admin"?[{id:"admin",label:m("header.adminTab"),index:2,ariaLabel:m("header.adminTab")}]:[]];return f.jsx("header",{className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:f.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[f.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[f.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:m("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(Hd,{tabs:v,activeId:a,onSelect:w=>n(w),ariaLabel:m("header.mainNavigationAria"),className:"shrink-0 gap-3"}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[f.jsx("button",{type:"button",onClick:y,className:te(Zo,Qo),title:m("header.languageToggleTitle"),"aria-label":m("header.languageToggleTitle"),children:m("header.languageShort")}),a==="terminal"&&f.jsx("button",{type:"button",onClick:r,className:te(Zo,u?FS:Qo),title:m("header.virtualKeyboardTitle"),"aria-label":m("header.virtualKeyboardTitle"),children:m("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:l,className:te(Zo,Qo),title:m("header.pairingTitle"),"aria-label":m("header.pairingTitle"),children:m("header.actionPairing")}),f.jsx("button",{type:"button",onClick:o,className:te(Zo,Qo),title:m("header.settingsTitle"),"aria-label":m("header.settingsTitle"),children:m("header.actionSettings")})]})]})})},Wo=({tone:a,glyph:n,message:l,assertive:o=!1,action:r})=>f.jsxs("aside",{className:te("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",cn[a].edgeB),"aria-live":o?"assertive":"polite",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("span",{"aria-hidden":"true",className:te("shrink-0",cn[a].text),children:n}),f.jsx("span",{className:"truncate text-tui-text",children:l})]}),r]}),YS=()=>{const{settings:a,t:n}=Ne(),{connectionState:l,stateDetail:o,connect:r}=et();return l==="connected"||!a.token&&!a.pairCode&&l==="disconnected"?null:l==="connecting"?f.jsx(Wo,{tone:"accent",glyph:f.jsx(la,{}),message:n("statusBanner.connecting")}):l==="reconnecting"?f.jsx(Wo,{tone:"warn",glyph:f.jsx(la,{}),assertive:!0,message:o||n("statusBanner.reconnectingDefault"),action:f.jsx(Me,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:n("statusBanner.reconnectNow")})}):l==="error"?f.jsx(Wo,{tone:"bad",glyph:Ee.cross,assertive:!0,message:o||n("statusBanner.errorDefault"),action:f.jsx(Me,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:n("common.retry")})}):l==="disconnected"?f.jsx(Wo,{tone:"idle",glyph:Ee.off,message:n("statusBanner.disconnected"),action:f.jsx(Me,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:n("common.connect")})}):null},Ju="Herdr Remote",_g=80,PS=/[\u0000-\u001F\u007F-\u009F]/g;function Sd(a){if(typeof a!="string")return"";const n=a.replace(PS," ").replace(/\s+/g," ").trim();return n.length<=_g?n:`${n.slice(0,_g-1).trimEnd()}…`}function $S(a,n,l){const o=R1(l??null),r=o?`${o} `:"",u=Sd(a);if(u)return`${r}${u} · ${Ju}`;const h=Sd(n);return h?`${r}${h} · ${Ju}`:`${r}${Ju}`}function qS(a,n,l){const o=$S(a,n,l);return typeof document<"u"&&(document.title=o),o}const VS=new Set(["http:","https:","mailto:"]),ed=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,XS=/[.,;:!?'"]+$/,Rg=8;function Ud(a){return/^www\./i.test(a)?`https://${a}`:a}function ZS(a){const n=(r,u)=>r.split(u).length-1;let l=a.replace(XS,"");const o=[["(",")"],["[","]"],["{","}"]];for(const[r,u]of o)for(;l.endsWith(u)&&n(l,u)>n(l,r);)l=l.slice(0,-1);return l}function vy(a){if(typeof a!="string"||a.length===0)return!1;try{return VS.has(new URL(Ud(a)).protocol)}catch{return!1}}function QS(a,n){if(typeof a!="string"||n<0)return null;ed.lastIndex=0;for(let l=ed.exec(a);l;l=ed.exec(a)){const o=ZS(l[0]);if(!o)continue;const r=l.index,u=r+o.length;if(n>=r&&n<u&&vy(o))return o}return null}function WS(a,n,l){var p;const o=(p=a==null?void 0:a.buffer)==null?void 0:p.active;if(!o||typeof o.getLine!="function"||!o.getLine(l))return null;let r=l;for(let m=0;m<Rg;m+=1){const g=o.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let u="",h=-1;for(let m=r;m<r+Rg;m+=1){const g=o.getLine(m);if(!g||m>r&&!g.isWrapped)break;m===l&&(h=u.length+n),u+=g.translateToString(!1)}return h<0?null:{text:u,index:h}}function JS(a,n,l){const o=WS(a,n,l);return o?QS(o.text,o.index):null}function eC(a){try{const n=new URL(Ud(a));return n.host||n.pathname}catch{return""}}function Cd(a){return!vy(a)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Ud(a),"_blank","noopener,noreferrer"),!0)}async function Kd(a){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(a),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let n=null,l=null,o=null;try{if(n=document.createElement("textarea"),n.style.userSelect="text",n.style.webkitUserSelect="text",n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="1px",n.style.height="1px",n.style.padding="0",n.style.border="none",n.style.outline="none",n.style.boxShadow="none",n.style.background="transparent",n.style.opacity="0",n.style.fontSize="16px",n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.value=a,typeof window<"u"&&typeof window.getSelection=="function"&&(o=window.getSelection(),o&&o.rangeCount>0&&(l=o.getRangeAt(0))),document.body.appendChild(n),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const h=document.createRange();h.selectNodeContents(n),o&&(o.removeAllRanges(),o.addRange(h)),n.setSelectionRange(0,a.length)}else n.focus({preventScroll:!0}),n.select();if(document.execCommand("copy"))return"exec"}catch{}finally{n!=null&&n.parentNode&&n.parentNode.removeChild(n),o&&(o.removeAllRanges(),l&&o.addRange(l))}}return"failed"}async function tC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.readText();return!n||n.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:n}}catch(n){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(n==null?void 0:n.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function nC(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const n=await navigator.clipboard.read();if(!n||n.length===0)return{ok:!1,reason:"empty"};for(const l of n){const o=l.types.find(r=>r.startsWith("image/"));if(o){const r=await l.getType(o);if(r&&r.size>0)return{ok:!0,blob:r}}}return{ok:!1,reason:"empty"}}catch(n){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const l=n==null?void 0:n.name;return l==="SecurityError"?{ok:!1,reason:"insecure"}:l==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function xy(a){const n=a.clipboardData;if(!n)return null;if(n.files&&n.files.length>0)for(let l=0;l<n.files.length;l++){const o=n.files[l];if(o!=null&&o.type.startsWith("image/"))return o}if(n.items&&n.items.length>0)for(let l=0;l<n.items.length;l++){const o=n.items[l];if(o!=null&&o.type.startsWith("image/")){const r=o.getAsFile();if(r)return r}}return null}function iC(a){if(!a||a.length===0)return null;for(let n=0;n<a.length;n++){const l=a[n];if(l&&(l.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(l.name)))return l}return null}const aC=({isOpen:a,onClose:n,onSend:l,onSendImage:o})=>{const{t:r}=Ne(),{addToast:u}=Vt(),[h,p]=T.useState(""),[m,g]=T.useState(null),[y,v]=T.useState(!1),w=T.useRef(null),x=T.useRef(null),S=T.useRef(null);T.useEffect(()=>{a&&(p(""),g(null),v(!1),w.current&&(w.current.value=""),x.current&&(x.current.value=""))},[a]);const M=async D=>{if(D.size===0){u("error",r("clipboard.fileEmpty"));return}v(!0);try{const _=await Hb(D);_?(g(_),p("")):u("error",r("clipboard.imageTooLarge"))}catch(_){console.error("Failed to process image:",_),u("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},E=async D=>{const _=xy(D);_&&(D.preventDefault(),await M(_))},k=async D=>{const _=iC(D.target.files);D.target.value="",_&&await M(_)},N=D=>{const _=D.target.value;p(_),_&&m&&g(null)},R=()=>{g(null),w.current&&(w.current.value=""),x.current&&(x.current.value="")},H=()=>{m?(o==null||o(m),n()):h.trim()&&(l(h),n())},j=!!(h.trim()||m);return f.jsx(Ts,{isOpen:a,onClose:n,title:r("clipboard.pasteTitle"),closeLabel:r("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(Me,{variant:"ghost",onClick:n,children:r("clipboard.cancel")}),f.jsx(Me,{variant:"primary",onClick:H,disabled:!j||y,children:r("clipboard.pasteSend")})]}),children:f.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:r("clipboard.pasteHint")}),f.jsx("textarea",{ref:S,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:r("clipboard.pasteHint"),value:h,onChange:N,onPaste:E,disabled:!!m||y,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),f.jsxs("div",{className:"relative my-1",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-tui-border"})}),f.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:f.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:r("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("input",{ref:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:k}),f.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:k}),m?f.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[f.jsx("img",{src:m.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),f.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[f.jsx("span",{children:r("clipboard.imageCompressedSize",{size:a1(m.byteLength)})}),f.jsx(Me,{variant:"ghost",onClick:R,"aria-label":r("clipboard.removeImage"),children:r("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=w.current)==null?void 0:D.click()},disabled:y||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.chooseImage"),children:r("clipboard.chooseImage")}),f.jsx(Me,{variant:"default",onClick:()=>{var D;return(D=x.current)==null?void 0:D.click()},disabled:y||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.takePhoto"),children:r("clipboard.takePhoto")})]}),y&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:r("clipboard.imageCompressing")})})]})]})})},Xa="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Za="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",lC=({anchorPoint:a,hasSelection:n,isController:l,vibrateOnKeyPress:o=!1,linkUrl:r=null,onOpenLink:u,onCopySelection:h,onCopyLine:p,onCopyScreen:m,onPaste:g,onClose:y})=>{const{t:v}=Ne(),w=T.useRef(null),[x,S]=T.useState(null);T.useEffect(()=>{if(o&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o]),T.useLayoutEffect(()=>{const N=w.current;if(!(N!=null&&N.parentElement))return;const R=N.parentElement.getBoundingClientRect(),H=N.getBoundingClientRect(),j=H.width||208,D=H.height||220,_=R.width,z=R.height;let K=a.x-j/2;K=Math.max(8,Math.min(Math.max(8,_-j-8),K));let V=a.y-D-8;V<8&&(V=a.y+8),V=Math.max(8,Math.min(Math.max(8,z-D-8),V)),S({x:K,y:V})},[a.x,a.y,n,l,r]);const M=Math.max(8,a.x-104),E=Math.max(8,a.y-200),k={position:"absolute",left:`${x?x.x:M}px`,top:`${x?x.y:E}px`,visibility:x?"visible":"hidden"};return f.jsx("div",{ref:w,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:k,onMouseDown:N=>N.stopPropagation(),onTouchStart:N=>N.stopPropagation(),onPointerDown:N=>N.stopPropagation(),children:f.jsxs(Nt,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[r&&u&&f.jsxs("button",{type:"button",role:"menuitem",className:te(Xa,Za),onClick:()=>{u(r),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ee.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:eC(r)})]}),n&&f.jsxs("button",{type:"button",role:"menuitem",className:te(Xa,Za),onClick:()=>{h(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ee.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:te(Xa,Za),onClick:()=>{p(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ee.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:te(Xa,Za),onClick:()=>{m(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ee.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),l&&f.jsxs("button",{type:"button",role:"menuitem",className:te(Xa,Za),onClick:()=>{g(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ee.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:te(Xa,Za),onClick:y,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ee.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},sC={state:"idle",deltaY:0,lines:0,viewportY:null,scrollTop:null,scrollHeight:null,clientHeight:null,moved:!1,focused:!1,bufferType:null,baseY:null,cursorY:null,hasScrollback:null,mouseTracking:!1,scrollMode:"none",scrollCalls:0,lastScrollLines:null,lastInputEvent:"",pointerEvents:0,touchEvents:0};function oC(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function rC(a){const n=T.useRef([]),[l,o]=T.useState({framesPerSec:0,bytesPerSec:0}),r=T.useCallback(h=>{const p=h-1e3,m=n.current;for(;m.length>0&&m[0].time<p;)m.shift()},[]);T.useEffect(()=>{if(!a)return;const h=setInterval(()=>{r(performance.now());let p=0;for(const m of n.current)p+=m.bytes;o({framesPerSec:n.current.length,bytesPerSec:p})},1e3);return()=>clearInterval(h)},[a,r]);const u=T.useCallback(h=>{const p=performance.now();n.current.push({time:p,bytes:h}),r(p)},[r]);return{metrics:l,record:u}}function cC(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function uC(a){var o;const n=(o=a==null?void 0:a.canvas)==null?void 0:o.stats;if(!n)return`paint: ${(a==null?void 0:a.kind)??"-"} renderer
|
|
34
|
+
`;const l=n.lastInputToPaintMs!==null?`${n.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${n.lastPaintMs.toFixed(2)}ms cells: ${n.lastCells} frames: ${n.frames} held: ${n.heldFrames} key→paint: ${l}
|
|
35
|
+
`}function dC(a){const n=(a==null?void 0:a.getTrace())??[];return n.length===0?"trace: -":`trace:
|
|
36
|
+
${n.slice(-6).map(l=>` ${l.event}${l.count>1?` ×${l.count}`:""}`).join(`
|
|
37
|
+
`)}`}const fC=({debug:a,rttMs:n,metrics:l,rendererKind:o,predictiveEcho:r,predictor:u,field:h,renderer:p})=>{const m=u==null?void 0:u.getEchoSrttMs();return f.jsxs("pre",{"data-testid":"terminal-touch-debug",className:"pointer-events-none absolute left-1 top-1 z-50 border border-tui-border bg-tui-crust/90 px-2 py-1 font-mono text-tui-sm leading-relaxed text-tui-muted","aria-hidden":"true",children:[`gesture: ${a.state}
|
|
38
|
+
`,`deltaY: ${a.deltaY} lines: ${a.lines}
|
|
39
|
+
`,`viewportY: ${a.viewportY??"-"} focus: ${a.focused}
|
|
40
|
+
`,`buffer: ${a.bufferType??"-"} base: ${a.baseY??"-"} cursor: ${a.cursorY??"-"} scrollback: ${a.hasScrollback??"-"}
|
|
41
|
+
`,`scroll: ${a.scrollTop??"-"} / ${a.scrollHeight??"-"} (h ${a.clientHeight??"-"}) moved: ${a.moved}
|
|
42
|
+
`,`mode: ${a.scrollMode} calls: ${a.scrollCalls} lines: ${a.lastScrollLines??"-"} mouse: ${a.mouseTracking}
|
|
43
|
+
`,`event: ${a.lastInputEvent||"-"} pointer: ${a.pointerEvents} touch: ${a.touchEvents}
|
|
44
|
+
`,`rtt: ${n!==null?`${n}ms`:"-"} frames/s: ${l.framesPerSec} bytes/s: ${l.bytesPerSec} renderer: ${o??"-"}
|
|
45
|
+
`,`prediction: ${(u==null?void 0:u.getState())??"-"} mode: ${r} pending: ${(u==null?void 0:u.getVisiblePredictions().length)??0} srtt: ${m!=null?`${Math.round(m)}ms`:"-"}
|
|
46
|
+
`,`field: ${cC(h)} mismatches: ${(u==null?void 0:u.getMismatchCount())??0}
|
|
47
|
+
`,uC(p),dC(u)]})};function Xn(a){const n=T.useRef(a);return n.current=a,n}function hC(a){const n=Xn(a),{termRef:l,subscribeToPasteFileReady:o}=a,[r,u]=T.useState(!1),h=T.useCallback((v,w)=>{n.current.onPaste(),v.paste(w),n.current.addToast("success",n.current.t("clipboard.pasted"))},[n]),p=T.useCallback(()=>{const v=l.current;return v?n.current.isController?v:(n.current.warnViewerMode(),null):null},[l,n]),m=T.useCallback(async()=>{const v=p();if(v){try{const w=await nC();if(w.ok){await n.current.uploadImage(w.blob);return}}catch{}try{const w=await tC();if(w.ok){h(v,w.text);return}else if(w.reason==="empty"){n.current.addToast("info",n.current.t("clipboard.pasteUnavailable"));return}}catch{}u(!0)}},[p,h,n]),g=T.useCallback(v=>{const w=p();w&&h(w,v)},[p,h]),y=T.useCallback(v=>{p()&&n.current.uploadImage(v)},[p,n]);return T.useEffect(()=>o(v=>{const w=l.current;w&&h(w,v)}),[o,l,h]),{isPasteFallbackOpen:r,closePasteFallback:()=>u(!1),handlePaste:m,handleFallbackPasteSend:g,handleFallbackImageSend:y}}const lr=new Set(["│","┃","║","▐","▕","▏","▌"]),yr=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),mC=new Set(["╭","┌","┏","╔"]),pC=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),gC=new Set(["╮","┐","┓","╗"]),bC=new Set(["╰","└","┗","╚"]),yC=new Set(["╯","┘","┛","╝"]),td=new Set(["─","━","═","╌","┄"]),wy=new Set(["❯","›",">","!"]),jg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function Mn(a){return a===""||a===" "||a===" "}class vC{constructor(n){q(this,"cell");q(this,"top");q(this,"bottom");var l;this.screen=n,this.cell=(l=n.getNullCell)==null?void 0:l.call(n),this.top=n.baseY,this.bottom=n.baseY+n.rows-1}get cols(){return this.screen.cols}at(n,l){var o;if(!(n<this.top||n>this.bottom||l<0||l>=this.screen.cols))return(o=this.screen.getLine(n))==null?void 0:o.getCell(l,this.cell)}char(n,l){var o;return((o=this.at(n,l))==null?void 0:o.getChars())??""}dim(n,l){var o,r;return!!((r=(o=this.at(n,l))==null?void 0:o.isDim)!=null&&r.call(o))}text(n,l,o){var r;return n<this.top||n>this.bottom?"":((r=this.screen.getLine(n))==null?void 0:r.translateToString(!0,l,o))??""}isEdge(n,l){if(!lr.has(this.char(n,l)))return!1;const o=this.char(n-1,l),r=this.char(n+1,l);return lr.has(o)||yr.has(o)||lr.has(r)||yr.has(r)}blankOrDim(n,l,o){var r;for(let u=l;u<o;u++){const h=this.at(n,u);if(h&&!Mn(h.getChars())&&!((r=h.isDim)!=null&&r.call(h)))return!1}return!0}}function xC(a,n,l){if(a.isEdge(n,l))return null;let o=0;for(let u=l-1;u>=0;u--)if(a.isEdge(n,u)){o=u+1;break}let r=a.cols;for(let u=l+1;u<a.cols;u++)if(a.isEdge(n,u)){r=u;break}return o<r?{start:o,end:r}:null}const Td=8,wC=12,Md=2,Og=1,SC=4,CC=3,TC=20,Dg=/-- INSERT --/,MC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,AC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,EC=/^\s*\d+[.)]\s/;function zg(a,n,l){if(!td.has(a.char(n,l.start))||!td.has(a.char(n,l.end-1))||yr.has(a.char(n,l.start-1)))return!1;const o=l.end-l.start;let r=0;for(let u=l.start;u<l.end;u++)if(td.has(a.char(n,u)))r++;else if(u-l.start-r>o*.1)return!1;return r>=o*.9}function sl(a){return`${a.start}-${a.end}`}function Sy(a,n,l){if(l.start===0)return a.top;for(let o=n-1;o>=a.top;o--)if(pC.has(a.char(o,l.start-1)))return o;return a.top}function NC(a,n,l){const o=l.start-1,r=l.end,{row:u}=n;if(o<0||r>=a.cols)return null;const h=a.char(u,o);if(!lr.has(h)||a.char(u,r)!==h)return null;let p=u-1;for(;p>=a.top&&a.char(p,o)===h;)p--;let m=u+1;for(;m<=a.bottom&&a.char(m,o)===h;)m++;if(m-p-1>Td||!mC.has(a.char(p,o))||!gC.has(a.char(p,r))||!bC.has(a.char(m,o))||!yC.has(a.char(m,r))||a.dim(u,o))return null;const g=l.start+Og,y=l.end-Og;return n.col<g||n.col>=y?null:{kind:"frame",key:`frame:${sl(l)}`,region:sl(l),layout:`${p}`,row:u,caretCol:n.col,startCol:g,endCol:y,empty:p+2===m&&n.col===g&&a.blankOrDim(u,g,y),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function kC(a,n,l){const{row:o}=n;let r=-1;for(let y=o-1;y>=Math.max(a.top,o-Td);y--)if(zg(a,y,l)){r=y;break}if(r<0)return null;let u=-1;for(let y=o+1;y<=Math.min(a.bottom,o+Td);y++)if(zg(a,y,l)){u=y;break}if(u<0)return null;const h=r+1;let p=-1;for(let y=l.start;y<Math.min(l.end,l.start+3);y++){const v=a.char(h,y);if(!Mn(v)){wy.has(v)&&Mn(a.char(h,y+1))&&(p=y);break}}if(p<0||a.dim(h,p)||EC.test(a.text(h,p+1,l.end)))return null;for(let y=h+1;y<u;y++)for(let v=l.start;v<l.start+Md;v++)if(!Mn(a.char(y,v)))return null;let m="";for(let y=u+1;y<=Math.min(a.bottom,u+wC)&&!yr.has(a.char(y,l.start-1));y++)m+=`${a.text(y,l.start,l.end)}
|
|
48
|
+
`;if(AC.test(m)||MC.test(m))return null;const g=o===h?p+2:l.start+Md;return n.col<g||n.col>=l.end?null:{kind:"rule",key:`rule:${sl(l)}:${Sy(a,r,l)}`,region:sl(l),layout:`${r}`,row:o,caretCol:n.col,startCol:g,endCol:l.end,empty:u-r===2&&n.col===g&&a.blankOrDim(o,g,l.end),agentLike:!0,vimInsert:Dg.test(m),modal:Dg.test(m),midWord:!1}}function LC(a,n,l){if(n.hidden)return null;const{row:o,col:r}=n,u=_C(a,n,l);if(u!==void 0)return u;for(let h=r-1;h>=l.start;h--){if(a.char(o,h)!==">")continue;const p=a.text(o,l.start,h+1).trimStart();if(/^(?:[a-z]:\\.*|\\\\[^\\]+\\[^\\]+.*|PS\s+[a-z]:\\.*)>$/i.test(p))return sr(a,n,l,o,h+1,!1)}for(let h=r-2;h>=l.start;h--)if(!(!jg.has(a.char(o,h))||!Mn(a.char(o,h+1))))return a.dim(o,h)?null:sr(a,n,l,o,h+2,h===l.start);for(let h=o-1;h>=Math.max(a.top,o-CC);h--){let p=l.end-1;for(;p>=l.start&&Mn(a.char(h,p));)p--;if(p>=l.end-1-SC&&jg.has(a.char(h,p)))return a.dim(h,p)?null:sr(a,n,l,h,l.start,!1);if(p<l.end-1)return null}return null}function _C(a,n,l){const{row:o}=n,r=l.start+Md,u=h=>Mn(a.char(h,l.start))&&Mn(a.char(h,l.start+1));if(u(o))for(let h=o-1;h>=Math.max(a.top,o-TC);h--){if(wy.has(a.char(h,l.start))&&Mn(a.char(h,l.start+1)))return a.dim(h,l.start)?null:sr(a,n,l,h,r,!0,r);if(!u(h)||a.blankOrDim(h,r,l.end))return}}function sr(a,n,l,o,r,u,h=l.start){const p=n.row===o?r:h;if(n.col<p||n.col>=l.end)return null;const m=l.end-2,g=n.row>o&&h>l.start&&n.col===p&&!Mn(a.char(n.row-1,m));return{kind:"prompt",key:`prompt:${sl(l)}:${Sy(a,o,l)}`,region:sl(l),layout:`${o}`,row:n.row,caretCol:n.col,startCol:p,endCol:l.end,empty:n.row===o&&n.col===p&&a.blankOrDim(n.row,p,l.end),agentLike:u,vimInsert:null,modal:!1,midWord:g}}function RC(a,n){const l=new vC(a);if(n.row<l.top||n.row>l.bottom||n.col<0||n.col>=a.cols)return null;const o=xC(l,n.row,n.col);return o?NC(l,n,o)??kC(l,n,o)??LC(l,n,o):null}class jC{constructor(){q(this,"insertSeen",new Set)}detect(n,l){const o=RC(n,l);return!o||o.vimInsert===null?o:o.vimInsert?(this.insertSeen.add(o.region),o):this.insertSeen.has(o.region)?null:o}reset(){this.insertSeen.clear()}}class OC{constructor(n){q(this,"tracker",new jC);q(this,"cached");q(this,"lastComplete",null);q(this,"detect",()=>{var n,l;if((l=(n=this.options).isSynchronizing)!=null&&l.call(n))return this.lastComplete;if(this.cached===void 0){const o=this.options.getScreen(),r=this.options.getCursor();this.cached=o&&r?this.tracker.detect(o,r):null,this.lastComplete=this.cached}return this.cached});this.options=n}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const Wa=4294967295;var We=(a=>(a[a.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",a[a.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",a[a.WIDTH_SHIFT=22]="WIDTH_SHIFT",a))(We||{}),Je=(a=>(a[a.PCOLOR_MASK=255]="PCOLOR_MASK",a[a.CM_MASK=50331648]="CM_MASK",a[a.CM_DEFAULT=0]="CM_DEFAULT",a[a.CM_P16=16777216]="CM_P16",a[a.CM_P256=33554432]="CM_P256",a[a.CM_RGB=50331648]="CM_RGB",a[a.RGB_MASK=16777215]="RGB_MASK",a))(Je||{}),ot=(a=>(a[a.INVERSE=67108864]="INVERSE",a[a.BOLD=134217728]="BOLD",a[a.UNDERLINE=268435456]="UNDERLINE",a[a.BLINK=536870912]="BLINK",a[a.INVISIBLE=1073741824]="INVISIBLE",a[a.STRIKETHROUGH=2147483648]="STRIKETHROUGH",a))(ot||{}),Ri=(a=>(a[a.ITALIC=67108864]="ITALIC",a[a.DIM=134217728]="DIM",a[a.HAS_EXTENDED=268435456]="HAS_EXTENDED",a[a.PROTECTED=536870912]="PROTECTED",a[a.OVERLINE=1073741824]="OVERLINE",a))(Ri||{}),Ja=(a=>(a[a.NONE=0]="NONE",a[a.SINGLE=1]="SINGLE",a[a.DOUBLE=2]="DOUBLE",a[a.CURLY=3]="CURLY",a[a.DOTTED=4]="DOTTED",a[a.DASHED=5]="DASHED",a))(Ja||{});function DC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const Cy={fg:0,bg:0,ext:0};function Ty(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function zC(a){return a>>>26&7}function HC(a){return a&67108863}function BC(a,n){const l=a.codePointAt(0)??0;return a.length>0&&String.fromCodePoint(l).length===a.length?{content:l|n<<22,combinedData:""}:{content:2097152|n<<22,combinedData:a}}function My(a){const n=a;return!n||typeof n.fg!="number"||typeof n.bg!="number"?null:{fg:n.fg>>>0,bg:n.bg>>>0,ext:Ty(n)}}class UC{constructor(n){q(this,"items",[]);q(this,"target",null);q(this,"provider",()=>this.paint());this.options=n}attach(n){var l;this.target!==n&&((l=this.target)==null||l.setOverlayProvider(null),this.target=n,n==null||n.setOverlayProvider(this.provider))}sync(n){var l;n.length===0&&this.items.length===0||(this.items=n,(l=this.target)==null||l.invalidateOverlay())}clear(){var n;this.items.length!==0&&(this.items=[],(n=this.target)==null||n.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){var w,x;const n=this.options.getTerminal(),l=n==null?void 0:n.buffer.active;if(!n||!l)return null;const o=this.options.isCursorHidden(),r=l.baseY+l.cursorY,u=l.cursorX,h=Ad(n,r,u),p=o&&!!h&&Ay(h);if(this.items.length===0){if(!p)return null;const S=((x=(w=l.getLine(r))==null?void 0:w.getCell(u))==null?void 0:x.getChars())??"";return{cells:[],paintedCaret:Hg(r,u,S,h)}}const m=[];let g,y;for(const S of this.items)switch(S.kind){case"char":m.push({row:S.row,col:S.col,chars:S.char,width:S.width,style:S.style??IC(n,S.row,S.col)});break;case"erase":m.push({row:S.row,col:S.col,chars:" ",width:S.width,style:KC(S.style??Ad(n,S.row,S.col)??Cy)});break;case"mask":p&&S.row===r&&S.col===u&&m.push({row:S.row,col:S.col,chars:S.char,width:1,style:S.style??Ey(h)});break;case"caret":o?p&&(m.push({row:S.row,col:S.col,chars:S.char,width:1,style:h}),y=Hg(S.row,S.col,S.char,h)):g={row:S.row,col:S.col};break}const v={cells:m};return g!==void 0&&(v.cursor=g),y&&(v.paintedCaret=y),v}}function Hg(a,n,l,o){return{row:a,col:n,style:o,plain:{row:a,col:n,chars:l||" ",width:1,style:Ey(o)}}}function Ad(a,n,l){var o;return l<0||l>=a.cols?null:My((o=a.buffer.active.getLine(n))==null?void 0:o.getCell(l))}function Ay(a){return(a.fg&ot.INVERSE)!==0||(a.bg&Je.CM_MASK)!==Je.CM_DEFAULT}function Ey(a){return{fg:a.fg&~ot.INVERSE,bg:a.bg&~(Je.CM_MASK|Je.RGB_MASK),ext:a.ext}}function KC(a){return{fg:a.fg&ot.INVERSE?a.fg&(ot.INVERSE|Je.CM_MASK|Je.RGB_MASK):0,bg:a.bg&(Je.CM_MASK|Je.RGB_MASK),ext:0}}function IC(a,n,l){const o=Ad(a,n,l-1);return o&&!Ay(o)&&!(o.bg&Ri.DIM)?o:Cy}const Ny="\x1B",FC=/^\x1b\[[IO]/,ky=/^\x1b\[<(\d+);\d+;\d+[Mm]/,GC=/^\x1b\[M[\s\S]{3}/,YC=[/^\x1b\[\?[\d;]*c/,/^\x1b\[>[\d;]*c/,/^\x1b\[\d+;\d+R/,/^\x1b\[\?\d+;\d+R/,/^\x1b\[\d+n/,/^\x1b\[\?[\d;]*\$y/,/^\x1b\[[\d;]*t/,/^\x1b\[\?\d+u/,/^\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/,/^\x1bP[\s\S]*?\x1b\\/],PC=/^\x1b\[1;[2-8]R/;function Bg(a){if(PC.test(a))return 0;const n=FC.exec(a);if(n)return n[0].length;const l=ky.exec(a);if(l){const o=Number(l[1]);return(o&32)!==0&&(o&3)===3&&(o&64)===0?l[0].length:0}for(const o of YC){const r=o.exec(a);if(r)return r[0].length}return 0}function Ly(a){if(!a.startsWith(Ny))return"keys";if(ky.test(a)||GC.test(a)){let l=a;for(;l.length>0;){const o=Bg(l);if(o===0)return"pointer";l=l.slice(o)}return"passive"}let n=a;for(;n.length>0;){const l=Bg(n);if(l===0)return"keys";n=n.slice(l)}return"passive"}function $C(a){return a===Ny}function Zn(a){return a===""||a===" "?" ":a}function qC(a,n,l,o=64){var h;const r=a.buffer.active.getLine(n),u=[];for(let p=l-1;p>=0&&u.length<o;p--){const m=r==null?void 0:r.getCell(p);if(!m)break;((h=m.getWidth)==null?void 0:h.call(m))!==0&&u.unshift(Zn(m.getChars()))}return u}function VC(a,n){for(let l=Math.min(a.length,n.length);l>0;l--){let o=!0;for(let r=0;r<l&&o;r++)o=n[n.length-l+r]===Zn(a[r]);if(o)return l}return 0}function XC(a){const n=a.buffer.active;return{key:"legacy",row:n.baseY+n.cursorY,caretCol:n.cursorX,startCol:n.cursorX,endCol:a.cols,empty:!1,agentLike:!1}}function ZC(a,{style:n,predictedCursor:l,field:o,runStartedEmpty:r,active:u}){var x,S,M,E,k;const h=a.map(N=>{const R={row:N.row,col:N.col,char:N.cancelled?" ":N.char,width:N.width,kind:N.cancelled?"erase":N.kind};return n&&(R.style=n),R}),p=a[a.length-1],m=l??{row:p.row,col:p.kind==="erase"||p.cancelled?p.col:p.col+p.width},g=(N,R)=>h.some(H=>H.row===N&&H.col<=R&&R<H.col+H.width),y=a.some(N=>N.kind==="char"&&!N.cancelled);if(u&&o&&r&&y&&o.agentLike&&m.row===o.row){const N=u.getLine(m.row);for(let R=m.col;R<o.endCol;R++){if(g(m.row,R)||Zn(((x=N==null?void 0:N.getCell(R))==null?void 0:x.getChars())??"")===" ")continue;const H={row:m.row,col:R,char:" ",width:1,kind:"erase"};n&&(H.style=n),h.push(H)}}if(u){const N={row:u.baseY+u.cursorY,col:u.cursorX};if(!g(N.row,N.col)&&(N.row!==m.row||N.col!==m.col)){const R=((M=(S=u.getLine(N.row))==null?void 0:S.getCell(N.col))==null?void 0:M.getChars())??"",H={row:N.row,col:N.col,char:Zn(R),width:1,kind:"mask"};n&&(H.style=n),h.push(H)}}const v=h.find(N=>N.row===m.row&&N.col===m.col&&N.kind!=="mask"),w=v?v.char:Zn(((k=(E=u==null?void 0:u.getLine(m.row))==null?void 0:E.getCell(m.col))==null?void 0:k.getChars())??"");return h.push({row:m.row,col:m.col,char:w,width:1,kind:"caret"}),h}const QC=[[12288,12329],[12334,12335],[12337,12348],[12350,12350],[12353,12438],[12443,12543],[13312,19903],[19968,40959],[44032,55203],[63744,64255],[65281,65376],[65504,65510],[131072,196605],[196608,262141]];function _y(a){if(a>=32&&a<=126)return 1;if(a<12288)return 0;for(const[n,l]of QC){if(a<n)return 0;if(a<=l)return 2}return 0}const Ug=8,WC=1500,JC=4e3,eT=20;class tT{constructor(n){q(this,"getTerminal");q(this,"getFieldOption");q(this,"charWidth");q(this,"now");q(this,"textDecoder",new TextDecoder("utf-8"));q(this,"confidentKeys",new Set);q(this,"fieldStyles",new Map);q(this,"field",null);q(this,"runStartedEmpty",!1);q(this,"predictions",[]);q(this,"predictedCursor",null);q(this,"srtt",null);q(this,"isSuppressed",!1);q(this,"suppressCursor",null);q(this,"suppressSentAt",0);q(this,"inFlight",[]);q(this,"inFlightUnknown",!1);q(this,"runInFlight",[]);q(this,"probationRun",!1);q(this,"runSent",[]);q(this,"lastSentUndrawn",!1);q(this,"awaitingPrefixCommand",!1);q(this,"mismatches",0);q(this,"trace",[]);this.getTerminal=n.getTerminal,this.getFieldOption=n.getField,this.charWidth=n.charWidth,this.now=n.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}updateSuppression(n){if(!this.isSuppressed)return;if(this.predictions.some(o=>o.frozenFrom)){this.suppressSentAt=this.now();return}!!n&&!!this.suppressCursor&&(n.row!==this.suppressCursor.row||n.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}reset(n,l){var u;this.predictions=[],this.predictedCursor=null;const o=typeof l=="boolean"?l:(l==null?void 0:l.suppress)??!0,r=typeof l=="object"&&(l==null?void 0:l.demote)===!0;if(this.note(`reset: ${n??"unspecified"}`),r){const h=this.field??((u=this.getFieldOption)==null?void 0:u.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),o){this.isSuppressed=!0,this.suppressSentAt=this.now();const h=this.getTerminal();h?this.suppressCursor={row:h.buffer.active.baseY+h.buffer.active.cursorY,col:h.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getTrace(){return this.trace}visiblePredictions(){const n=this.getState()==="confident";return this.predictions.filter(l=>l.frozenFrom?l.shownWhenFrozen:n&&!l.probation)}freeze(n,l={}){var m;const o=this.getTerminal(),r=o?{row:o.buffer.active.baseY+o.buffer.active.cursorY,col:o.buffer.active.cursorX}:null,u=this.getState()==="confident";this.predictions=this.predictions.filter(g=>!g.cancelled);for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=r??{row:g.row,col:g.col},g.shownWhenFrozen=u&&!g.probation);const h=this.predictedCursor?{...this.predictedCursor}:r,p=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${n}${l.demote?" (demote)":""}`),l.demote){const g=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=p}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(JC,Math.max(WC,(this.srtt??0)*4))}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.liftSuppression(),!1):!0:!1}liftSuppression(){this.isSuppressed=!1,this.suppressCursor=null}assumedWidth(n){var o;const l=(o=this.charWidth)==null?void 0:o.call(this,n);return l===0||l===1||l===2?l:1}coveredByPrediction(n,l){return this.predictions.some(o=>(o.echoed||o.cancelled||o.kind==="erase"&&!o.frozenFrom)&&o.row===n&&o.col<=l&&l<o.col+o.width)}ensureField(n){if(this.predictedCursor&&this.field)return this.field;const l=this.getFieldOption?this.getFieldOption():XC(n);if(!l)return null;let o=l.caretCol,r=[],u=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(VC(this.inFlight,qC(n,l.row,o)));for(const h of r){const p=h.codePointAt(0)??0;o+=_y(p)||this.assumedWidth(p)}u=r.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=l,this.runStartedEmpty=l.empty&&r.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:l.row,col:o},this.runInFlight=r,this.probationRun=u,this.runSent=[],l}confirm(n,l){if(this.updateSrtt(Math.max(0,this.now()-n.sentAt)),l&&!n.frozenFrom&&this.markConfident(l.key),n.probation&&n.kind==="char"){for(const o of this.predictions)o.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(n,l){const o=My(l);if(o)for(this.fieldStyles.delete(n),this.fieldStyles.set(n,o);this.fieldStyles.size>Ug;){const r=this.fieldStyles.keys().next().value;if(r===void 0)break;this.fieldStyles.delete(r)}}markConfident(n){for(this.confidentKeys.delete(n),this.confidentKeys.add(n);this.confidentKeys.size>Ug;){const l=this.confidentKeys.values().next().value;if(l===void 0)break;this.confidentKeys.delete(l)}}mismatch(n){this.mismatches++,this.note(`mismatch: ${n}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(n){const l=this.trace[this.trace.length-1];if(l&&l.event===n){l.count++,l.at=this.now();return}this.trace.push({at:this.now(),event:n,count:1}),this.trace.length>eT&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const n=this.now(),l=this.predictionTimeout(),o=this.predictions.filter(r=>n-r.sentAt<=l);o.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=o,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(n){this.srtt===null?this.srtt=n:this.srtt=this.srtt*.8+n*.2}}const nT="?!#";class iT extends tT{handlePrintable(n,l,o){var S;const r=this.ensureField(o);if(!r||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const u=this.predictedCursor,h=this.predictions.every(M=>M.frozenFrom||M.cancelled)&&u.col===r.caretCol;if(r.agentLike&&r.empty&&h&&nT.includes(n))return this.freeze("agent mode switch"),!1;if(r.midWord&&h)return this.freeze("the word above may move down"),!1;if(u.col+l>r.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const p=(S=o.buffer.active.getLine(u.row))==null?void 0:S.getCell(u.col),m=[Zn(p?p.getChars():"")],g=this.predictions.findIndex(M=>M.kind==="erase"&&!M.frozenFrom&&M.row===u.row&&M.col===u.col);let y;g>=0&&([y]=this.predictions.splice(g,1),m.push(...y.before," "));for(const M of this.predictions)M.cancelled&&M.row===u.row&&M.col===u.col&&m.push(M.char);const v=o.buffer.active,w=v.baseY+v.cursorY,x=w>u.row||w===u.row&&v.cursorX>u.col;return this.predictions.push({row:u.row,col:u.col,char:n,width:l,kind:"char",before:m,sentAt:this.now(),replaces:y,probation:this.probationRun||void 0,behindCaret:x||void 0}),this.probationRun&&this.runSent.push(n),this.lastSentUndrawn=!1,u.col+=l,!0}skipUnpredictable(n,l,o){const r=this.ensureField(o),u=this.predictedCursor;if(!r||!u)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(l);return u.col+h>r.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(n),this.lastSentUndrawn=!0,u.col+=h,this.note("width unknown: guessing"),!0)}handleBackspace(n){var o,r,u;let l;for(let h=this.predictions.length-1;h>=0&&!l;h--)this.predictions[h].cancelled||(l=this.predictions[h]);if(this.predictedCursor&&l&&!l.frozenFrom&&!l.echoed&&l.kind==="char"&&l.row===this.predictedCursor.row&&l.col+l.width===this.predictedCursor.col)return l.cancelled=!0,l.probation&&this.runSent.pop(),this.predictedCursor.col=l.col,l.replaces&&(this.predictions.splice(this.predictions.indexOf(l),0,l.replaces),l.replaces=void 0),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(n),p=this.predictedCursor;if(h&&p){const m=n.buffer.active.getLine(p.row),g=m==null?void 0:m.getCell(p.col-1),y=g&&((o=g.getWidth)==null?void 0:o.call(g))===0?2:1,v=p.col-y;let w=!0;for(let S=p.col;S<h.endCol&&w;S++)w=this.coveredByPrediction(p.row,S)||Zn(((r=m==null?void 0:m.getCell(S))==null?void 0:r.getChars())??"")===" ";const x=Zn(((u=m==null?void 0:m.getCell(v))==null?void 0:u.getChars())??"");if(v>h.startCol&&w&&x!==" ")return this.predictions=this.predictions.filter(S=>!(S.echoed&&S.row===p.row&&S.col+S.width>v)),this.predictions.push({row:p.row,col:v,char:" ",width:y,kind:"erase",before:[x],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,p.col=v,!0}}return this.freeze("backspace into server content"),!1}}const aT=2;class lT extends iT{handleUserInput(n){var h;if(this.pruneExpired(),n.length===0)return;const l=this.textDecoder.decode(n,{stream:!1});if(!l)return;const o=Ly(l);if(o==="passive")return;if(o==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if($C(l)){const p=this.field??((h=this.getFieldOption)==null?void 0:h.call(this))??null;this.freeze("escape",{demote:(p==null?void 0:p.modal)!==!1});return}const r=this.getTerminal();if(!r){this.reset("terminal unavailable",!0);return}const u=Array.from(l);for(let p=0;p<u.length;p++){const m=u[p],g=m.codePointAt(0);if(g===void 0)continue;if(g===aT){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(g===27||g===9||g===10||g===13||g<32&&g!==8){this.freeze("control or escape sequence");return}if(g===8||g===127){if(!this.handleBackspace(r)){p<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(m),this.note("refused: waiting for the caret to move");continue}const y=_y(g);if(y===0){if(!this.skipUnpredictable(m,g,r)){p<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(m,y,r)){p<u.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const n=this.getTerminal(),l=n?{row:n.buffer.active.baseY+n.buffer.active.cursorY,col:n.buffer.active.cursorX}:null;this.pruneExpired(),n&&l&&this.predictions.length>0&&this.settle(n,l),this.updateSuppression(l)}settle(n,l){var h,p;const o=this.field;if(this.getFieldOption){const m=this.getFieldOption();if(!m||m.key!==(o==null?void 0:o.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(m.layout!==o.layout){this.predictions=[],this.predictedCursor=null,this.field=m,this.note("layout changed");return}}let r=[],u=!1;for(const m of this.predictions){if(m.cancelled){if(!u){const M=l.row>m.row||l.row===m.row&&l.col>=m.col+m.width;if(M||(m.behindCaret=void 0),m.passed&&!M)continue;M&&!m.behindCaret&&(m.passed=!0)}r.push(m),u=!0;continue}const g=(h=n.buffer.active.getLine(m.row))==null?void 0:h.getCell(m.col),y=Zn(g?g.getChars():""),v=m.kind==="char"?y===m.char&&(m.width===1||(((p=g==null?void 0:g.getWidth)==null?void 0:p.call(g))??2)===2):y===" ",w=m.before.includes(y);m.behindCaret&&(l.row<m.row||l.row===m.row&&l.col<=m.col)&&(m.behindCaret=void 0);const x=m.kind==="char"?(l.row>m.row||l.row===m.row&&l.col>=m.col+m.width)&&!(m.behindCaret&&w):l.row<m.row||l.row===m.row&&l.col<=m.col,S=m.kind==="char"&&y===m.char&&!v;if(u&&!m.frozenFrom){if(!v||w){r.push(m);continue}r=r.filter(M=>!M.cancelled),u=!1}if(!(m.echoed&&!v))if(v&&(x||!w)){if(m.echoed||this.confirm(m,o),x){m.kind==="char"&&o&&!m.frozenFrom&&this.learnStyle(o.key,g);continue}m.echoed=!0,r.push(m)}else if(m.frozenFrom){const M=m.frozenFrom,E=m.kind==="erase"||l.col>=M.col;!x&&l.row===M.row&&E?r.push(m):x&&m.probation&&(this.inFlightUnknown=!0)}else if(!x&&!S)r.push(m);else if(m.probation){this.note("probation guess dropped"),this.predictions.some(M=>!M.frozenFrom&&M.kind==="erase")&&(this.inFlightUnknown=!0),this.inFlight=[...this.runInFlight,...this.runSent,...this.inFlight],this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.predictions=this.predictions.filter(M=>M.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(y)} for ${JSON.stringify(m.char)}`);return}}this.predictions=r,r.length===0&&(this.predictedCursor=null,this.probationRun&&(this.inFlightUnknown=!0))}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(n=>!n.echoed&&!n.cancelled).map(n=>({row:n.row,col:n.col,char:n.char}))}getOverlayItems(){var l;this.pruneExpired();const n=this.visiblePredictions();return n.length===0?[]:ZC(n,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(l=this.getTerminal())==null?void 0:l.buffer.active})}}const sT=25,oT=2026,rT=1e3;function cT(a,n=()=>performance.now()){let l=!1,o=null;const r=new Set,u=y=>(r.add(y),{dispose:()=>void r.delete(y)}),h=()=>{l=!1,o=null},p=a.parser;if(!p||typeof p.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:u,reset:h,dispose:()=>{}};const m=y=>v=>{for(const w of v.flat())if(w===sT&&(l=!y),w===oT){const x=!y&&o!==null;if(o=y?n():null,x)for(const S of[...r])S()}return!1},g=[p.registerCsiHandler({prefix:"?",final:"h"},m(!0)),p.registerCsiHandler({prefix:"?",final:"l"},m(!1)),p.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof p.registerEscHandler=="function"&&g.push(p.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>l,isSynchronizing:()=>o!==null&&n()-o<rT,onSyncEnd:u,reset:h,dispose:()=>{for(const y of g)y.dispose();r.clear()}}}const uT=40;function dT(a,n){return a==="off"?!1:a==="always"?!0:n!==null&&n>uT}function fT(a,n){var p;const l=cT(a),o=new OC({getScreen:()=>{const m=n();if(!m)return null;const g=m.buffer.active;return{cols:m.cols,rows:m.rows,baseY:g.baseY,getLine:y=>g.getLine(y),getNullCell:typeof g.getNullCell=="function"?()=>g.getNullCell():void 0}},getCursor:()=>{var g;const m=(g=n())==null?void 0:g.buffer.active;return m?{row:m.baseY+m.cursorY,col:m.cursorX,hidden:l.isCursorHidden()}:null},isSynchronizing:l.isSynchronizing}),r=(p=a._core)==null?void 0:p.unicodeService,u=new lT({getTerminal:n,getField:o.detect,charWidth:typeof(r==null?void 0:r.wcwidth)=="function"?m=>r.wcwidth(m):void 0}),h=new UC({getTerminal:n,isCursorHidden:()=>l.isCursorHidden()});return{screenState:l,fieldProbe:o,predictor:u,overlay:h}}function hT({termRef:a,rendererRef:n,mode:l,connectionState:o,observeKeyInput:r}){const u=T.useRef(null),h=T.useRef(null),p=T.useRef(null),m=Xn(l),g=T.useCallback(()=>{const M=u.current,E=h.current;if(!(!M||!E)){if(!dT(m.current,M.getEchoSrttMs())){E.clear();return}E.sync(M.getOverlayItems())}},[m]),y=T.useCallback(M=>{var E,k,N,R;(E=u.current)==null||E.reset(M),(k=u.current)==null||k.forgetConfidence(),(N=p.current)==null||N.reset(),(R=h.current)==null||R.clear()},[]),v=T.useCallback(M=>{var E,k;(E=u.current)==null||E.reset(M),(k=h.current)==null||k.clear()},[]),w=T.useCallback(M=>{var E,k,N;(E=u.current)==null||E.handleUserInput(M),g(),(N=(k=n.current)==null?void 0:k.canvas)==null||N.markInput()},[g,n]),x=T.useCallback(M=>{const E=fT(M,()=>a.current);return p.current=E.fieldProbe,u.current=E.predictor,h.current=E.overlay,E},[a]),S=T.useCallback(()=>{var M;(M=h.current)==null||M.dispose(),h.current=null,u.current=null,p.current=null},[]);return T.useEffect(()=>r(w),[r,w]),T.useEffect(()=>{g()},[l,g]),T.useEffect(()=>{y("connectionState")},[o,y]),{predictorRef:u,overlayRef:h,fieldProbeRef:p,attach:x,detach:S,sync:g,forget:y,discard:v,onUserInput:w}}const mT=20,pT=6,gT=500,bT=300,ol=13,Ry=.602,jy=1.3;function Vn(a,n){return Number.isFinite(a)&&a>0?a:n}function Kg(a,n,l){return Math.min(l,Math.max(n,a))}function Oy(a){const{width:n,height:l,cellWidth:o,cellHeight:r,minCols:u=mT,minRows:h=pT,maxCols:p=gT,maxRows:m=bT}=a,g=Vn(o,ol*Ry),y=Vn(r,ol*jy);return{cols:Kg(Math.floor(Vn(n,0)/g),u,p),rows:Kg(Math.floor(Vn(l,0)/y),h,m)}}function sa(a,n=ol){var o,r,u;if(a)try{const h=a._core,p=(u=(r=(o=h==null?void 0:h._renderService)==null?void 0:o.dimensions)==null?void 0:r.css)==null?void 0:u.cell;if(p!=null&&p.width&&p.width>0&&p.height&&p.height>0)return{cellWidth:p.width,cellHeight:p.height,measured:!0}}catch{}const l=Vn(n,ol);return{cellWidth:Math.round(l*Ry*100)/100,cellHeight:Math.round(l*jy*100)/100,measured:!1}}function yT(a){var o;const n=(o=a==null?void 0:a.querySelector)==null?void 0:o.call(a,".xterm-viewport");if(!n)return 0;const l=(n.offsetWidth||0)-(n.clientWidth||0);return Number.isFinite(l)&&l>0?l:0}function Ed(a,n,l){if(!a)return{width:n,height:l};let o=0,r=0;if(typeof a.getBoundingClientRect=="function"){const u=a.getBoundingClientRect();o=(u==null?void 0:u.width)||0,r=(u==null?void 0:u.height)||0}return{width:Vn(o,Vn(a.clientWidth,n)),height:Vn(r,Vn(a.clientHeight,l))}}function Dy(a,n,l,o){const r=Number.isFinite(o)&&o>.01?o:1;return{clientX:l.left+(a-l.left)/r,clientY:l.top+(n-l.top)/r}}function Ig(a,n){const l=typeof window<"u"?window:void 0,o=l&&typeof l.devicePixelRatio=="number"&&l.devicePixelRatio>0?l.devicePixelRatio:1,r=l!=null&&l.visualViewport&&typeof l.visualViewport.scale=="number"&&l.visualViewport.scale>0?l.visualViewport.scale:1,u=Math.max(0,a.width),h=Math.max(0,a.height),p=Math.round(u*o*100)/100,m=Math.round(h*o*100)/100;return{dpr:o,scale:r,cssWidth:u,cssHeight:h,physicalWidth:p,physicalHeight:m}}function vT(a){const{lastSnapshot:n,currentSnapshot:l,physicalTolerancePx:o=6}=a;if(!n)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const r=Math.abs(l.scale-n.scale)>.01,u=Math.abs(l.scale-1)>.01;if(r||u)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(l.dpr-n.dpr)>.01){const g=Math.abs(l.physicalWidth-n.physicalWidth),y=Math.abs(l.physicalHeight-n.physicalHeight);if(g<=o&&y<=o)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const p=Math.abs(l.cssWidth-n.cssWidth),m=Math.abs(l.cssHeight-n.cssHeight);return p<1&&m<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const xT=250;function wT({termRef:a,containerRef:n,frameRef:l,surfaceRef:o,currentScaleRef:r,rendererRef:u,initialBannerWrittenRef:h,isActiveRef:p,sendResize:m,onResized:g}){const y=Xn(m),v=Xn(g),w=T.useRef({cols:0,rows:0}),x=T.useRef(null),S=T.useRef(null),M=T.useRef(null),E=T.useRef(null),k=T.useRef({width:0,height:0}),N=T.useRef(null),R=T.useRef(!1),H=T.useCallback(()=>{const ie=x.current;x.current=null,ie&&(ie.cols===w.current.cols&&ie.rows===w.current.rows||(w.current=ie,y.current(ie.cols,ie.rows),v.current()))},[y,v]),j=T.useCallback((ie,oe,P=!1)=>{if(!(!Number.isFinite(ie)||!Number.isFinite(oe)||ie<=0||oe<=0)&&!(ie===w.current.cols&&oe===w.current.rows)){if(x.current={cols:ie,rows:oe},P){S.current&&clearTimeout(S.current),S.current=null,H();return}S.current||(S.current=setTimeout(()=>{S.current=null,H()},xT))}},[H]),D=T.useCallback((ie=!1,oe=!1)=>{var de;const P=a.current,A=n.current,I=o.current,J=l.current;if(!P||!A||!I||!J)return;const le=Ed(A,nl(),cd());if(le.width<=0||le.height<=0)return;J.style.width="100%",J.style.height="100%",I.style.width="100%",I.style.height="100%",I.style.transform="none",I.style.transformOrigin="top left",r.current=1;const Z=Ig(le),ye=vT({lastSnapshot:N.current,currentSnapshot:Z});if(ye.isVisualZoom&&!ie){N.current=Z;try{P.refresh(0,Math.max(0,P.rows-1))}catch{}return}if(ye.shouldIgnore&&!ie)return;N.current=Z;const xe=sa(P,ol),ce=Oy({width:le.width-yT(I),height:le.height,cellWidth:xe.cellWidth,cellHeight:xe.cellHeight}),Te=Math.abs(le.width-k.current.width)>1||Math.abs(le.height-k.current.height)>1;if(P.cols!==ce.cols||P.rows!==ce.rows)try{P.resize(ce.cols,ce.rows)}catch(se){console.debug("Error resizing terminal grid:",se)}h.current&&!R.current&&(Te||P.cols!==ce.cols||P.rows!==ce.rows)&&(R.current=!0,(de=u.current)==null||de.verify());const ue=ce.cols!==w.current.cols||ce.rows!==w.current.rows;p.current&&(Te||ie||ue)&&(k.current={width:le.width,height:le.height},j(ce.cols,ce.rows,oe));try{P.refresh(0,Math.max(0,P.rows-1))}catch{}},[a,n,o,l,r,u,h,p,j]),_=T.useRef(D);_.current=D;const z=T.useCallback(()=>{if(M.current===null){if(typeof requestAnimationFrame!="function"){_.current();return}M.current=requestAnimationFrame(()=>{M.current=null,_.current()})}},[]),K=T.useCallback((ie=30)=>{E.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(E.current),E.current=null);let oe=0;const P=()=>{E.current=null,oe++;const A=oe>=ie;_.current(!0),!A&&oe<2&&typeof requestAnimationFrame=="function"&&(E.current=requestAnimationFrame(P))};typeof requestAnimationFrame=="function"?E.current=requestAnimationFrame(P):P()},[]),V=T.useCallback(()=>_.current(!0,!0),[]),ne=T.useCallback(ie=>{k.current={width:ie.width,height:ie.height},N.current=Ig(ie)},[]),W=T.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),M.current!==null&&(cancelAnimationFrame(M.current),M.current=null),E.current!==null&&(cancelAnimationFrame(E.current),E.current=null)},[]);return{requestFit:z,scheduleBoundedFit:K,fitNow:V,seedFit:ne,cancelPendingFits:W}}const ST=" ()[]{}'\"\\`";function CT(a,n,l,o=1){var E,k;if(!((E=n==null?void 0:n.buffer)!=null&&E.active)||n.cols<=0||n.rows<=0)return null;const r=l||((k=n.element)==null?void 0:k.querySelector(".xterm-screen"))||n.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=Dy(a.clientX,a.clientY,u,o),p=sa(n);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,u.width||n.cols*p.cellWidth),g=Math.max(1,u.height||n.rows*p.cellHeight),y=Math.max(0,Math.min(m-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(n.cols-1,Math.floor(y/p.cellWidth))),x=Math.max(0,Math.min(n.rows-1,Math.floor(v/p.cellHeight))),M=(n.buffer.active.viewportY??0)+x;return{col:w,bufferRow:M}}function TT(a,n){if(!a||a.length===0||a==="\0")return!0;for(const l of a)if(l==="\0"||/\s/.test(l)||n.includes(l))return!0;return!1}function MT(a,n,l){var w,x;if(!((w=a==null?void 0:a.buffer)!=null&&w.active)||n<0||n>=a.cols)return null;const o=a.buffer.active.getLine(l);if(!o)return null;const r=((x=a.options)==null?void 0:x.wordSeparator)??ST,u=new Array(a.cols).fill(null),h=Math.min(a.cols,o.length);let p=0;for(;p<h;){const S=o.getCell(p);if(!S){u[p]={startCol:p,endCol:p+1,isSeparator:!0},p++;continue}const M=S.getWidth();if(M===0){u[p]||(u[p]={startCol:p,endCol:p+1,isSeparator:!0}),p++;continue}const E=S.getChars(),k=TT(E,r),N=Math.min(a.cols,p+M),R={startCol:p,endCol:N,isSeparator:k};for(let H=p;H<N;H++)u[H]=R;p+=Math.max(1,M)}for(let S=h;S<a.cols;S++)u[S]||(u[S]={startCol:S,endCol:S+1,isSeparator:!0});const m=u[n];if(!m||m.isSeparator)return null;let g=m.startCol;for(;g>0;){const S=u[g-1];if(S&&!S.isSeparator)g=S.startCol;else break}let y=m.endCol;for(;y<a.cols;){const S=u[y];if(S&&!S.isSeparator)y=S.endCol;else break}const v=y-g;return v<=0?null:{startCol:g,length:v}}function AT(a){var u;if(!((u=a==null?void 0:a.buffer)!=null&&u.active))return"";const n=a.buffer.active,l=n.viewportY??0,o=a.rows,r=[];for(let h=0;h<o;h++){const p=n.getLine(l+h);r.push(p?p.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
|
|
49
|
+
`)}const Fg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),ET=.6,NT=new Set(["─","━","═","┄","┅","┈","┉","-"]),kT=.8;function nd(a,n){if(!a)return!1;let l=0;const o=Math.min(n,a.length);for(let r=0;r<o;r++){const u=a.getCell(r);if(u){const h=u.getChars();h&&NT.has(h)&&l++}}return l>=Math.max(5,Math.min(n*.25,10))}function id(a,n,l){var x;if(!((x=a==null?void 0:a.buffer)!=null&&x.active)||a.cols<=0)return{startCol:0,endCol:0};const o=a.buffer.active,r=a.cols,u=Math.max(0,Math.min(r-1,n)),h=o.viewportY??0,p=a.rows>0?a.rows:1,m=new Int32Array(r);let g=0;for(let S=0;S<p;S++){const M=o.getLine(h+S);if(g++,!M)continue;const E=Math.min(r,M.length);for(let k=0;k<E;k++){const N=M.getCell(k);if(N){const R=N.getChars();R&&Fg.has(R)&&m[k]++}}}if(g===0)return{startCol:0,endCol:r-1};const y=g*ET,v=S=>m[S]>=y;let w=!1;for(let S=0;S<r;S++)if(v(S)){w=!0;break}if(w){if(v(u))return{startCol:u,endCol:u};let S=-1;for(let E=u-1;E>=0;E--)if(v(E)){S=E;break}let M=r;for(let E=u+1;E<r;E++)if(v(E)){M=E;break}return{startCol:S+1,endCol:M-1}}if(l!==void 0){const S=Math.max(h,Math.min(h+p-1,l)),M=o.getLine(S);if(!nd(M,r)){let E=h;for(let R=S-1;R>=h;R--)if(nd(o.getLine(R),r)){E=R+1;break}let k=h+p-1;for(let R=S+1;R<=h+p-1;R++)if(nd(o.getLine(R),r)){k=R-1;break}const N=k-E+1;if(N>=2){const R=new Int32Array(r);for(let _=E;_<=k;_++){const z=o.getLine(_);if(!z)continue;const K=Math.min(r,z.length);for(let V=0;V<K;V++){const ne=z.getCell(V);if(ne){const W=ne.getChars();W&&Fg.has(W)&&R[V]++}}}const H=N*kT,j=_=>R[_]>=H;let D=!1;for(let _=0;_<r;_++)if(j(_)){D=!0;break}if(D){if(j(u))return{startCol:u,endCol:u};let _=-1;for(let K=u-1;K>=0;K--)if(j(K)){_=K;break}let z=r;for(let K=u+1;K<r;K++)if(j(K)){z=K;break}return{startCol:_+1,endCol:z-1}}}}}return{startCol:0,endCol:r-1}}function Gg(a,n){const l=Math.min(a.startCol,a.endCol),o=Math.max(a.startCol,a.endCol),r=Math.min(a.startRow,a.endRow),u=Math.max(a.startRow,a.endRow);return{startCol:Math.max(n.startCol,Math.min(n.endCol,l)),endCol:Math.max(n.startCol,Math.min(n.endCol,o)),startRow:r,endRow:u}}function Yg(a,n){var g;if(!((g=a==null?void 0:a.buffer)!=null&&g.active)||a.cols<=0)return"";const l=a.buffer.active,o=a.cols,r=Math.min(n.startRow,n.endRow),u=Math.max(n.startRow,n.endRow),h=Math.max(0,Math.min(n.startCol,n.endCol)),p=Math.min(o-1,Math.max(n.startCol,n.endCol));if(h>p||r>u)return"";const m=[];for(let y=r;y<=u;y++){const v=l.getLine(y);if(!v){m.push("");continue}const w=v.translateToString(!0,h,p+1);m.push(w.trimEnd())}return m.join(`
|
|
50
|
+
`)}function LT({termRef:a,surfaceRef:n,mainRef:l,currentScaleRef:o,addToast:r,t:u}){const h=Xn(r),p=Xn(u),[m,g]=T.useState(null),y=T.useRef(null);y.current=m;const[v,w]=T.useState(null),x=T.useRef(null);x.current=v;const[S,M]=T.useState(""),E=T.useRef("");E.current=S;const[k,N]=T.useState(!1),R=T.useRef(!1);R.current=k;const H=T.useRef(!1),[j,D]=T.useState(0),_=T.useRef(0),z=T.useRef(null),K=T.useRef(null),V=T.useRef(null),ne=T.useRef(null),W=T.useCallback(se=>{var we;const ve=a.current;if(!ve)return null;const ae=((we=n.current)==null?void 0:we.querySelector(".xterm-screen"))||n.current;return CT(se,ve,ae,o.current)},[a,n,o]),ie=T.useCallback(se=>{const ve=a.current,ae=W(se);return!ve||!ae?null:JS(ve,ae.col,ae.bufferRow)},[a,W]),oe=T.useCallback((se,ve)=>{w(ve),M(Yg(se,ve)),N(!0)},[]),P=T.useCallback(()=>{w(null),M(""),N(!1),V.current=null,ne.current=null},[]),A=T.useCallback(()=>{g(null),y.current=null,w(null),x.current=null,M(""),E.current="",N(!1),z.current=null,K.current=null},[]),I=T.useCallback(se=>{const ve=a.current;if(!ve)return;const ae=W(se),we=ae?MT(ve,ae.col,ae.bufferRow):null;if(ae&&we){V.current=ae;const Ae=id(ve,ae.col,ae.bufferRow);ne.current=Ae;const De={startCol:we.startCol,endCol:we.startCol+we.length-1,startRow:ae.bufferRow,endRow:ae.bufferRow};oe(ve,Gg(De,Ae))}else P();z.current=se,K.current=null},[a,W,oe,P]),J=T.useCallback(se=>{const ve=a.current,ae=V.current;if(!ve||!ae)return;K.current=se;const we=W(se);if(!we)return;const Ae=ne.current??id(ve,ae.col,ae.bufferRow),De={startCol:Math.min(ae.col,we.col),endCol:Math.max(ae.col,we.col),startRow:Math.min(ae.bufferRow,we.bufferRow),endRow:Math.max(ae.bufferRow,we.bufferRow)};oe(ve,Gg(De,Ae))},[a,W,oe]),le=T.useCallback(()=>{const se=K.current??z.current;if(!se||!l.current)return;const ve=l.current.getBoundingClientRect(),ae=se.clientX-ve.left,we=se.clientY-ve.top,Ae=ie(se);g({x:ae,y:we,link:Ae}),y.current={x:ae,y:we,link:Ae}},[l,ie]),Z=T.useCallback(async se=>{await Kd(se)==="failed"?h.current("error",p.current("clipboard.copyFailed")):h.current("success",p.current("clipboard.copied"))},[h,p]),ye=T.useCallback(async()=>{const se=E.current;se&&await Z(se)},[Z]),xe=T.useCallback(async()=>{var Ae,De,rt,tt;const se=a.current,ve=(Ae=se==null?void 0:se.buffer)==null?void 0:Ae.active;if(!se||!ve)return;const ae=((De=x.current)==null?void 0:De.startRow)??((rt=V.current)==null?void 0:rt.bufferRow)??ve.viewportY,we=ne.current??id(se,((tt=V.current)==null?void 0:tt.col)??0,ae);await Z(Yg(se,{startCol:we.startCol,endCol:we.endCol,startRow:ae,endRow:ae}))},[a,Z]),ce=T.useCallback(async()=>{const se=a.current;se&&await Z(AT(se))},[a,Z]),Te=T.useCallback((se,ve,ae)=>{const we=se.buffer.active.viewportY??0;we!==_.current&&(_.current=we,D(we));const Ae=x.current;if(Ae&&R.current){const De=Ae.startRow-we,rt=Ae.endRow-we;H.current&&ve<=rt&&ae>=De&&(N(!1),H.current=!1)}else H.current=!1},[]),ue=T.useCallback(se=>{const ve=se.buffer.active.viewportY??0;_.current=ve,D(ve)},[]),de=T.useCallback(()=>{H.current=!0},[]);return{selectionMenu:m,selectionRect:v,selectionSnapshot:S,isHighlightVisible:k,viewportY:j,hasOpenMenu:()=>y.current!==null,clearSelection:A,handleLongPress:I,handleSelectionExtend:J,openMenuAtGesture:le,handleCopySelection:ye,handleCopyLine:xe,handleCopyScreen:ce,onTerminalRender:Te,onTerminalScroll:ue,onTerminalContentChanged:de}}const _T=({term:a,surface:n,main:l,rect:o,viewportY:r})=>{if(!a||!l)return null;const u=sa(a);if(u.cellWidth<=0||u.cellHeight<=0)return null;const h=(n==null?void 0:n.querySelector(".xterm-screen"))||n;if(!h)return null;const p=h.getBoundingClientRect(),m=l.getBoundingClientRect(),g=o.startRow-r;if(o.endRow-r<0||g>=a.rows)return null;const v=p.top-m.top+g*u.cellHeight,w=p.left-m.left+o.startCol*u.cellWidth,x=(o.endCol-o.startCol+1)*u.cellWidth,S=(o.endRow-o.startRow+1)*u.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${v}px`,left:`${w}px`,width:`${x}px`,height:`${S}px`}})},Jo=new Map;function zy(a){let n=Jo.get(a);return n===void 0&&(n=`#${(a&Je.RGB_MASK).toString(16).padStart(6,"0")}`,Jo.size>4096&&Jo.clear(),Jo.set(a,n)),n}function Hy(a,n,l){var o;switch(a&Je.CM_MASK){case Je.CM_P16:case Je.CM_P256:return((o=n.ansi[a&Je.PCOLOR_MASK])==null?void 0:o.css)??l;case Je.CM_RGB:return zy(a&Je.RGB_MASK);default:return l}}function or(a,n,l,o){var v;const r=(a&ot.INVERSE)!==0,u=r?n:a,h=r?a:n;let p;const m=u&Je.CM_MASK;if(m===Je.CM_P16||m===Je.CM_P256){let w=u&Je.PCOLOR_MASK;o&&a&ot.BOLD&&w<8&&(w+=8),p=((v=l.ansi[w])==null?void 0:v.css)??l.foreground.css}else m===Je.CM_RGB?p=zy(u&Je.RGB_MASK):p=r?l.background.css:l.foreground.css;const g=h&Je.CM_MASK,y=g===Je.CM_DEFAULT?r?l.foreground.css:l.background.css:Hy(h,l,l.background.css);return{fg:p,bg:y,bgIsDefault:!r&&g===Je.CM_DEFAULT}}function hs(a){return(a&ot.BOLD)!==0}function rr(a){return(a&Ri.ITALIC)!==0}function vr(a){return(a&Ri.DIM)!==0}function us(a){return(a&ot.INVISIBLE)!==0}const RT=600;var qn=(a=>(a[a.NONE=0]="NONE",a[a.BLOCK=1]="BLOCK",a[a.BAR=2]="BAR",a[a.UNDERLINE=3]="UNDERLINE",a[a.OUTLINE=4]="OUTLINE",a))(qn||{});function Pg(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function By(a,n,l,o,r,u,{css:h,dpr:p,cursorWidth:m}){switch(a.save(),a.fillStyle=h,a.strokeStyle=h,u){case 2:a.fillRect(l,o,Math.max(1,Math.round(m*p)),n.cell.height);break;case 3:a.fillRect(l,o+n.cell.height-Math.max(1,Math.round(p))-1,r,Math.max(1,Math.round(p)));break;case 4:{const g=Math.max(1,Math.round(p));a.lineWidth=g,a.strokeRect(l+g/2,o+g/2,r-g,n.cell.height-g);break}}a.restore()}function jT(a,n,l,o,r){let u,h;if(l&&l.cursor!==void 0){if(l.cursor===null)return null;u=l.cursor.row,h=l.cursor.col}else{if(!a.coreService.isCursorInitialized||a.coreService.isCursorHidden)return null;u=n.ybase+n.y,h=n.x}const p=u-n.ydisp;if(p<0||p>=o.rows)return null;const m=Math.min(Math.max(0,h),o.cols-1),g=a.optionsService.rawOptions;let y;if(a._coreBrowserService.isFocused)r?y=0:y=Pg(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";y=v==="none"?0:Pg(v)}return y===0?null:{x:m,y:p,shape:y}}class OT{constructor(n){q(this,"timer",null);q(this,"visible",!0);this.onToggle=n}get running(){return this.timer!==null}get hidden(){return this.timer!==null&&!this.visible}start(){this.stop(),this.timer=setInterval(()=>{this.visible=!this.visible,this.onToggle()},RT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}const $g=80,DT=16;class zT{constructor(){q(this,"last",null);q(this,"fromX",0);q(this,"toX",0);q(this,"start",0);q(this,"sliding",!1)}update(n,l,o){const r=this.last;if(this.last=n&&{x:n.x,y:n.y},!n)return this.sliding=!1,null;if(!r||r.x!==n.x||r.y!==n.y){const u=r!==null&&r.y===n.y&&n.y===l&&Math.abs(n.x-r.x)<=DT;this.fromX=!u||!r?n.x:this.sliding?this.x(o):r.x,this.toX=n.x,this.start=o,this.sliding=u}return this.sliding?o-this.start>=$g?(this.sliding=!1,null):{x:this.x(o),y:n.y,shape:n.shape,css:n.css}:null}x(n){const l=Math.min(1,Math.max(0,(n-this.start)/$g));return this.fromX+(this.toX-this.fromX)*(1-(1-l)**3)}}function HT(a,n,l,o){if(a)return{x:a.x,y:a.y,shape:a.shape,css:o.cursor.css};const r=n==null?void 0:n.paintedCaret;if(!r)return null;const{bg:u}=or(r.style.fg,r.style.bg,o,!0);return{x:r.col,y:r.row-l,shape:qn.BLOCK,css:u,plain:r.plain}}const BT=120,UT=16,KT=96,IT=32,FT=64;function os(a,n){const l=a.content[n];if(!(l>>>We.WIDTH_SHIFT)||us(a.fg[n]))return!1;if(l&We.IS_COMBINED_MASK)return a.combined[n]!=="";const o=l&We.CODEPOINT_MASK;return o!==0&&o!==32}function qg(a,n){return{content:a.content[n],fg:a.fg[n],bg:a.bg[n],combined:a.combined[n]}}class GT{constructor(){q(this,"fades",new Map)}get size(){return this.fades.size}clear(){this.fades.clear()}rows(n){const l=new Set;for(const o of this.fades.keys())l.add(Math.floor(o/n));return l}begin(n,l,o,r,u,h){const p=n*l,m=Math.max(0,o.start),g=Math.min(l,o.end);let y=0;for(let w=m;w<g;w++){const x=p+w;if(r.content[x]===Wa)return;const S=os(r,x),M=os(u,w);if(S&&M){if(r.content[x]!==u.content[w]||r.combined[x]!==u.combined[w])return}else(S||M)&&y++}if(y===0||y>IT)return;let v=0;for(let w=m;w<g;w++){const x=p+w,S=os(r,x),M=os(u,w);if(M&&!S){const E=Math.min(v++*UT,KT);this.fades.set(x,{...qg(u,w),start:h+E,out:!1})}else S&&!M&&this.fades.set(x,{...qg(r,x),start:h,out:!0})}}at(n,l,o,r){const u=this.fades.get(n);if(!u)return null;const h=u.out?!os(o,l):o.content[l]===u.content&&o.combined[l]===u.combined,p=(r-u.start)/BT;if(!h||p>=1)return this.fades.delete(n),null;const m=Math.max(0,p);return u.out?{alpha:(1-m)**2,gone:u}:{alpha:1-(1-m)**3}}}function YT(a,n,{gone:l,alpha:o},r,u){if(!l)return;const h=l.content&We.IS_COMBINED_MASK?l.combined:String.fromCodePoint(l.content&We.CODEPOINT_MASK),p=n.get({chars:h,bold:hs(l.fg),italic:rr(l.bg),dim:vr(l.bg),fg:r.fg,bg:r.bg,cells:u.cells});p&&(a.globalAlpha=o,a.drawImage(p.source,p.x,p.y,p.width,p.height,u.px,u.py,u.width,u.height),a.globalAlpha=1)}/**
|
|
51
|
+
* Box drawing, block element and Powerline glyphs, drawn as shapes rather than
|
|
52
|
+
* taken from the font.
|
|
53
|
+
*
|
|
54
|
+
* Vendored verbatim from @xterm/xterm 5.5.0,
|
|
55
|
+
* src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
|
|
56
|
+
* helper it imported, inlined below, and underscores on parameters the strict
|
|
57
|
+
* compiler flags as unused.
|
|
58
|
+
*
|
|
59
|
+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
|
|
60
|
+
* @license MIT
|
|
61
|
+
*/function Vg(a){if(!a)throw new Error("value must not be falsy");return a}const PT={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},$T={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},qT={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(a,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"║":{1:(a,n)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,n)=>`M.5,1 L.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╓":{1:(a,n)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,n)=>`M1,${.5-n} L${.5-a},${.5-n} L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1`},"╕":{1:(a,n)=>`M0,${.5-n} L.5,${.5-n} L.5,1 M0,${.5+n} L.5,${.5+n}`},"╖":{1:(a,n)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,n)=>`M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M0,${.5-n} L${.5+a},${.5-n} L${.5+a},1`},"╘":{1:(a,n)=>`M.5,0 L.5,${.5+n} L1,${.5+n} M.5,${.5-n} L1,${.5-n}`},"╙":{1:(a,n)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,n)=>`M1,${.5-n} L${.5+a},${.5-n} L${.5+a},0 M1,${.5+n} L${.5-a},${.5+n} L${.5-a},0`},"╛":{1:(a,n)=>`M0,${.5+n} L.5,${.5+n} L.5,0 M0,${.5-n} L.5,${.5-n}`},"╜":{1:(a,n)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,n)=>`M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0 M0,${.5+n} L${.5+a},${.5+n} L${.5+a},0`},"╞":{1:(a,n)=>`M.5,0 L.5,1 M.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╟":{1:(a,n)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,n)=>`M${.5-a},0 L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1 M1,${.5-n} L${.5+a},${.5-n} L${.5+a},0`},"╡":{1:(a,n)=>`M.5,0 L.5,1 M0,${.5-n} L.5,${.5-n} M0,${.5+n} L.5,${.5+n}`},"╢":{1:(a,n)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,n)=>`M${.5+a},0 L${.5+a},1 M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0`},"╤":{1:(a,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n} M.5,${.5+n} L.5,1`},"╥":{1:(a,n)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1`},"╧":{1:(a,n)=>`M.5,0 L.5,${.5-n} M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╨":{1:(a,n)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,n)=>`M0,${.5+n} L1,${.5+n} M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0 M1,${.5-n} L${.5+a},${.5-n} L${.5+a},0`},"╪":{1:(a,n)=>`M.5,0 L.5,1 M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╫":{1:(a,n)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,n)=>`M0,${.5+n} L${.5-a},${.5+n} L${.5-a},1 M1,${.5+n} L${.5+a},${.5+n} L${.5+a},1 M0,${.5-n} L${.5-a},${.5-n} L${.5-a},0 M1,${.5-n} L${.5+a},${.5-n} L${.5+a},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(a,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,1,.5`},"╮":{1:(a,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,0,.5`},"╯":{1:(a,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,0,.5`},"╰":{1:(a,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,1,.5`}},xs={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};xs[""]=xs[""];xs[""]=xs[""];function VT(a,n,l,o,r,u,h,p){const m=PT[n];if(m)return XT(a,m,l,o,r,u),!0;const g=$T[n];if(g)return ZT(a,g,l,o,r,u),!0;const y=qT[n];if(y)return QT(a,y,l,o,r,u,p),!0;const v=xs[n];return v?(WT(a,v,l,o,r,u,h,p),!0):!1}function XT(a,n,l,o,r,u){for(let h=0;h<n.length;h++){const p=n[h],m=r/8,g=u/8;a.fillRect(l+p.x*m,o+p.y*g,p.w*m,p.h*g)}}const Xg=new Map;function ZT(a,n,l,o,r,u){let h=Xg.get(n);h||(h=new Map,Xg.set(n,h));const p=a.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let m=h.get(p);if(!m){const g=n[0].length,y=n.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=y;const w=Vg(v.getContext("2d")),x=new ImageData(g,y);let S,M,E,k;if(p.startsWith("#"))S=parseInt(p.slice(1,3),16),M=parseInt(p.slice(3,5),16),E=parseInt(p.slice(5,7),16),k=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[S,M,E,k]=p.substring(5,p.length-1).split(",").map(N=>parseFloat(N));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let N=0;N<y;N++)for(let R=0;R<g;R++)x.data[(N*g+R)*4]=S,x.data[(N*g+R)*4+1]=M,x.data[(N*g+R)*4+2]=E,x.data[(N*g+R)*4+3]=n[N][R]*(k*255);w.putImageData(x,0,0),m=Vg(a.createPattern(v,null)),h.set(p,m)}a.fillStyle=m,a.fillRect(l,o,r,u)}function QT(a,n,l,o,r,u,h){a.strokeStyle=a.fillStyle;for(const[p,m]of Object.entries(n)){a.beginPath(),a.lineWidth=h*Number.parseInt(p,10);let g;if(typeof m=="function"){const v=.15/u*r;g=m(.15,v)}else g=m;for(const y of g.split(" ")){const v=y[0],w=Uy[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=y.substring(1).split(",");!x[0]||!x[1]||w(a,Ky(x,r,u,l,o,!0,h))}a.stroke(),a.closePath()}}function WT(a,n,l,o,r,u,h,p){const m=new Path2D;m.rect(l,o,r,u),a.clip(m),a.beginPath();const g=h/12;a.lineWidth=p*g;for(const y of n.d.split(" ")){const v=y[0],w=Uy[v];if(!w){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=y.substring(1).split(",");!x[0]||!x[1]||w(a,Ky(x,r,u,l,o,!1,p,(n.leftPadding??0)*(g/2),(n.rightPadding??0)*(g/2)))}n.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function Zg(a,n,l=0){return Math.max(Math.min(a,n),l)}const Uy={C:(a,n)=>a.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]),L:(a,n)=>a.lineTo(n[0],n[1]),M:(a,n)=>a.moveTo(n[0],n[1])};function Ky(a,n,l,o,r,u,h,p=0,m=0){const g=a.map(y=>parseFloat(y)||parseInt(y,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<g.length;y+=2)g[y]*=n-p*h-m*h,u&&g[y]!==0&&(g[y]=Zg(Math.round(g[y]+.5)-.5,n,0)),g[y]+=o+p*h;for(let y=1;y<g.length;y+=2)g[y]*=l,u&&g[y]!==0&&(g[y]=Zg(Math.round(g[y]+.5)-.5,l,0)),g[y]+=r;return g}const Id=.5,JT=1024,e5=6;function t5(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class n5{constructor(n,l=typeof navigator<"u"?navigator.userAgent:""){q(this,"pages",[]);q(this,"slots",new Map);q(this,"inkCache",new Map);q(this,"metrics",null);q(this,"font",null);q(this,"baseline");q(this,"generation",0);q(this,"scratch");this.document=n,this.baseline=t5(l)}configure(n,l){const o=this.metrics&&this.font&&this.metrics.cellWidth===n.cellWidth&&this.metrics.cellHeight===n.cellHeight&&this.metrics.charWidth===n.charWidth&&this.metrics.charHeight===n.charHeight&&this.metrics.charLeft===n.charLeft&&this.metrics.charTop===n.charTop&&this.metrics.dpr===n.dpr&&this.font.fontFamily===l.fontFamily&&this.font.fontSize===l.fontSize&&this.font.fontWeight===l.fontWeight&&this.font.fontWeightBold===l.fontWeightBold&&this.font.customGlyphs===l.customGlyphs;this.metrics={...n},this.font={...l},o||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.shelfX=0,n.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const n of this.pages)n.canvas.width=0,n.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(n,l){const o=this.font,r=n?o.fontWeightBold:o.fontWeight;return`${l?"italic ":""}${r} ${o.fontSize*this.metrics.dpr}px ${o.fontFamily}`}overflow(n,l,o){if(!this.metrics||!this.font||n.length===1&&n.charCodeAt(0)<128)return 0;const r=`${l?1:0}${o?1:0}${n}`,u=this.inkCache.get(r);if(u!==void 0)return u;let h=0;const p=this.scratchContext();if(p&&!(this.font.customGlyphs&&Iy(n))){p.font=this.fontString(l,o),p.textBaseline=this.baseline;const m=p.measureText(n),g=typeof m.actualBoundingBoxRight=="number"?m.actualBoundingBoxRight:m.width;h=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(r,h),h}get(n){const l=this.metrics,o=this.font;if(!l||!o||l.cellWidth<=0||l.cellHeight<=0)return null;const r=`${n.cells}${n.bold?1:0}${n.italic?1:0}${n.dim?1:0}${n.fg}\0${n.bg}\0${n.chars}`,u=this.slots.get(r);if(u)return u;const h=l.cellWidth*n.cells,p=l.cellHeight,m=this.allocate(h,p);if(!m)return null;const{page:g,x:y,y:v}=m,w=g.ctx;w.save(),w.beginPath(),w.rect(y,v,h,p),w.clip(),w.globalAlpha=1,w.fillStyle=n.bg,w.fillRect(y,v,h,p),w.fillStyle=n.fg,n.dim&&(w.globalAlpha=Id);let x=!1;o.customGlyphs&&(x=VT(w,n.chars,y,v,l.cellWidth,l.cellHeight,o.fontSize,l.dpr)),x||(w.font=this.fontString(n.bold,n.italic),w.textBaseline=this.baseline,w.fillText(n.chars,y+l.charLeft,v+l.charTop+l.charHeight)),w.restore();const S={source:g.canvas,x:y,y:v,width:h,height:p};return this.slots.set(r,S),S}allocate(n,l){for(const o of this.pages){const r=this.fit(o,n,l);if(r)return r}if(this.pages.length<e5){const o=this.createPage(Math.max(JT,n,l));return o?(this.pages.push(o),this.fit(o,n,l)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],n,l):null}fit(n,l,o){if(n.shelfX+l>n.canvas.width&&(n.shelfX=0,n.shelfY+=o),n.shelfY+o>n.canvas.height||l>n.canvas.width)return null;const r={page:n,x:n.shelfX,y:n.shelfY};return n.shelfX+=l,r}createPage(n){const l=this.document.createElement("canvas");l.width=n,l.height=n;const o=l.getContext("2d",{alpha:!1});return o?{canvas:l,ctx:o,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const n=this.document.createElement("canvas");n.width=1,n.height=1,this.scratch=n.getContext("2d")}return this.scratch}}function Iy(a){if(a.length!==1)return!1;const n=a.charCodeAt(0);return n>=9472&&n<=9631||n>=57504&&n<=57558}function i5(a,n){return(a&(ot.UNDERLINE|ot.STRIKETHROUGH))!==0||(n&Ri.OVERLINE)!==0}function a5(a,n,{px:l,py:o,cells:r,fgWord:u,bgWord:h,ext:p,fgCss:m},{fontSize:g,dpr:y,colors:v,boldBright:w}){const x=(u&ot.UNDERLINE)!==0,S=(u&ot.STRIKETHROUGH)!==0,M=(h&Ri.OVERLINE)!==0,E=r*n.cell.width;a.save(),a.beginPath(),a.rect(l,o,E,n.cell.height),a.clip(),vr(h)&&(a.globalAlpha=Id);const k=Math.max(1,Math.floor(g*y/15)),N=k%2===1?.5:0;if(x){const R=HC(p);let H=m;if(R){let _=R;w&&hs(u)&&(_&50331648)!==50331648&&(_&255)<8&&(_+=8),H=Hy(_,v,m)}a.strokeStyle=H,a.lineWidth=k;const j=o+n.char.top+Math.ceil(n.char.height)-N-k*2,D=p?zC(p):Ja.SINGLE;switch(a.beginPath(),D){case Ja.DOUBLE:a.moveTo(l,j),a.lineTo(l+E,j),a.moveTo(l,j+k*2),a.lineTo(l+E,j+k*2);break;case Ja.CURLY:{const _=j+k,z=Math.max(1,k);for(let K=0;K<r;K++){const V=l+K*n.cell.width,ne=V+n.cell.width/2,W=V+n.cell.width;a.moveTo(V,_),a.bezierCurveTo(V,_-z,ne,_-z,ne,_),a.bezierCurveTo(ne,_+z,W,_+z,W,_)}break}case Ja.DOTTED:a.setLineDash([k,k]),a.moveTo(l,j),a.lineTo(l+E,j);break;case Ja.DASHED:{const _=Math.floor(.6*n.cell.width),z=Math.floor(.3*n.cell.width);a.setLineDash([_,z,n.cell.width-_-z]),a.moveTo(l,j),a.lineTo(l+E,j);break}default:a.moveTo(l,j),a.lineTo(l+E,j)}a.stroke(),a.setLineDash([])}if(M&&(a.strokeStyle=m,a.lineWidth=k,a.beginPath(),a.moveTo(l,o+n.char.top+N),a.lineTo(l+E,o+n.char.top+N),a.stroke()),S){const R=Math.max(1,Math.floor(g*y/10)),H=o+n.char.top+Math.floor(n.char.height/2)-(R%2===1?.5:0);a.strokeStyle=m,a.lineWidth=R,a.beginPath(),a.moveTo(l,H),a.lineTo(l+E,H),a.stroke()}a.restore()}const ad=4,l5=3;class s5{constructor(n,l,o,r){q(this,"atlas");q(this,"fades",new GT);q(this,"cols",0);q(this,"rows",0);q(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});q(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});q(this,"work",DC());this.ctx=n,this.core=o,this.dimensions=r,this.atlas=new n5(l)}resize(n,l){this.cols=n,this.rows=l,this.fades.clear();const o=n*l;this.painted={content:new Uint32Array(o).fill(Wa),fg:new Uint32Array(o),bg:new Uint32Array(o),ext:new Uint32Array(o),meta:new Uint32Array(o).fill(Wa),combined:new Array(o).fill("")},this.row={content:new Uint32Array(n),fg:new Uint32Array(n),bg:new Uint32Array(n),ext:new Uint32Array(n),combined:new Array(n).fill("")}}invalidate(){this.painted.content.fill(Wa),this.painted.meta.fill(Wa),this.fades.clear()}hasPaintedInk(n,l){const o=this.dimensions.device;if(!o.cell.width||!o.cell.height)return!1;const r=Math.min(this.cols,Math.floor(n/o.cell.width)),u=Math.min(this.rows,Math.floor(l/o.cell.height)),h=this.painted;for(let p=0;p<u;p++)for(let m=0;m<r;m++){const g=p*this.cols+m,y=h.content[g];if(y===Wa||h.meta[g]===ad||us(h.fg[g]))continue;const v=y&We.CODEPOINT_MASK;if(y&We.IS_COMBINED_MASK?h.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(n,l){const{content:o,fg:r,bg:u,ext:h,combined:p}=this.row,m=this.work;for(let g=0;g<this.cols;g++)n&&g<n.length?(n.loadCell(g,m),o[g]=m.content,r[g]=m.fg,u[g]=m.bg,h[g]=Ty(m),p[g]=m.content&We.IS_COMBINED_MASK?m.combinedData:""):(o[g]=1<<We.WIDTH_SHIFT,r[g]=0,u[g]=0,h[g]=0,p[g]="");if(l)for(const g of l){const y=g.col;if(y<0||y+g.width>this.cols)continue;y>0&&!(o[y]>>>We.WIDTH_SHIFT)&&this.blankAt(y-1);const v=y+g.width;v<this.cols&&!(o[v]>>>We.WIDTH_SHIFT)&&o[v-1]>>>We.WIDTH_SHIFT===2&&this.blankAt(v);const w=BC(g.chars,g.width);o[y]=w.content,p[y]=w.combinedData,r[y]=g.style.fg,u[y]=g.style.bg,h[y]=g.style.ext,g.width===2&&(o[y+1]=0,p[y+1]="",r[y+1]=g.style.fg,u[y+1]=g.style.bg,h[y+1]=g.style.ext)}}blankAt(n){this.row.content[n]=32|1<<We.WIDTH_SHIFT,this.row.combined[n]=""}paintRow(n,l,o=null,r=0){const u=this.cols,{content:h,fg:p,bg:m,ext:g,combined:y}=this.row,v=this.painted,w=n*u;o&&this.fades.begin(n,u,o,v,this.row,r);let x=0,S=-1,M=-1,E="";const k=()=>{S<0||(this.fillCells(S,n,M-S,E),S=-1)};let N=0;for(;N<u;){let H=h[N]>>>We.WIDTH_SHIFT;H===0&&(H=1),N+H>u&&(H=u-N),H===1&&N+1<u&&this.overflowsInto(N)&&(H=2);const j=l&&l.y===n&&l.x>=N&&l.x<N+H?l.shape:qn.NONE,D=H|j<<l5,_=this.fades.size>0?this.fades.at(w+N,N,this.row,r):null;let z=_!==null||this.differs(w+N,N,D);for(let K=1;K<H;K++)this.differs(w+N+K,N+K,ad)&&(z=!0);if(z){for(let V=0;V<H;V++){const ne=w+N+V;v.content[ne]=h[N+V],v.fg[ne]=p[N+V],v.bg[ne]=m[N+V],v.ext[ne]=g[N+V],v.meta[ne]=V===0?_?D|FT:D:ad,v.combined[ne]=y[N+V]}x+=H;const K=_?null:this.plainFill(N,j);K!==null?S>=0&&M===N&&E===K?M=N+H:(k(),S=N,M=N+H,E=K):(k(),this.paintCell(N,n,H,j,_))}N+=H}return k(),x}differs(n,l,o){const r=this.painted,u=this.row;return r.meta[n]!==o||r.content[n]!==u.content[l]||r.fg[n]!==u.fg[l]||r.bg[n]!==u.bg[l]||r.ext[n]!==u.ext[l]||r.combined[n]!==u.combined[l]}overflowsInto(n){const{content:l,fg:o,bg:r,ext:u}=this.row,h=l[n];if((h&We.CODEPOINT_MASK)<128&&!(h&We.IS_COMBINED_MASK)||h>>>We.WIDTH_SHIFT!==1||us(o[n]))return!1;const m=l[n+1],g=m&We.CODEPOINT_MASK;if(m>>>We.WIDTH_SHIFT!==1||m&We.IS_COMBINED_MASK||g!==0&&g!==32||r[n]!==r[n+1]||u[n+1]!==0||(o[n]&ot.INVERSE)!==(o[n+1]&ot.INVERSE)||o[n]&ot.INVERSE&&o[n]!==o[n+1]||o[n+1]&(ot.UNDERLINE|ot.STRIKETHROUGH)||r[n+1]&Ri.OVERLINE)return!1;const y=this.charsAt(n);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Iy(y)?!1:this.atlas.overflow(y,hs(o[n]),rr(r[n]))>0}charsAt(n){const l=this.row.content[n];if(l&We.IS_COMBINED_MASK)return this.row.combined[n];const o=l&We.CODEPOINT_MASK;return o?String.fromCodePoint(o):""}plainFill(n,l){if(l!==qn.NONE)return null;const{content:o,fg:r,bg:u}=this.row,h=o[n],p=h&We.CODEPOINT_MASK,m=!(h&We.IS_COMBINED_MASK)&&(p===0||p===32),g=us(r[n]);return!m&&!g||(r[n]&(ot.UNDERLINE|ot.STRIKETHROUGH)||u[n]&Ri.OVERLINE)&&!g?null:or(r[n],u[n],this.colors(),this.boldBright()).bg}paintCell(n,l,o,r,u=null){const h=this.ctx,p=this.dimensions.device,m=this.colors(),g=this.row.fg[n],y=this.row.bg[n],v=this.row.ext[n],w=or(g,y,m,this.boldBright());let x=w.fg,S=w.bg;r===qn.BLOCK&&(S=m.cursor.css,x=m.cursorAccent.css);const M=us(g),E=this.charsAt(n),k=n*p.cell.width,N=l*p.cell.height,R=o*p.cell.width,H=p.cell.height,j=M||E===""||E===" ",D=j?null:this.atlas.get({chars:E,bold:hs(g),italic:rr(y),dim:vr(y),fg:x,bg:S,cells:o}),_=u&&!u.gone?u.alpha:1;if(D&&_===1?h.drawImage(D.source,D.x,D.y,D.width,D.height,k,N,R,H):(h.fillStyle=S,h.fillRect(k,N,R,H),D?(h.globalAlpha=_,h.drawImage(D.source,D.x,D.y,D.width,D.height,k,N,R,H),h.globalAlpha=1):j||(h.save(),h.beginPath(),h.rect(k,N,R,H),h.clip(),h.fillStyle=x,h.globalAlpha=(vr(y)?Id:1)*_,h.font=this.atlas.fontString(hs(g),rr(y)),h.fillText(E,k+p.char.left,N+p.char.top+p.char.height),h.restore())),u!=null&&u.gone){const K=r===qn.BLOCK||(g&ot.INVERSE)!==0?x:or(u.gone.fg,u.gone.bg,m,this.boldBright()).fg;YT(h,this.atlas,u,{fg:K,bg:S},{px:k,py:N,width:R,height:H,cells:o})}!M&&i5(g,y)&&a5(h,p,{px:k,py:N,cells:o,fgWord:g,bgWord:y,ext:v,fgCss:x},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:m,boldBright:this.boldBright()}),r!==qn.NONE&&r!==qn.BLOCK&&By(h,p,k,N,R,r,{css:m.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(n,l,o,r){const u=this.dimensions.device;this.ctx.fillStyle=r,this.ctx.fillRect(n*u.cell.width,l*u.cell.height,o*u.cell.width,u.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}configureAtlas(){const n=this.dimensions.device,l=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:n.cell.width,cellHeight:n.cell.height,charWidth:n.char.width,charHeight:n.char.height,charLeft:n.char.left,charTop:n.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:l.fontWeight,fontWeightBold:l.fontWeightBold,customGlyphs:l.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}function o5(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}function r5(a,n,l,o){const r=n._charSizeService;if(!r.hasValidSize)return!1;const u=n._coreBrowserService.dpr,h=n.optionsService.rawOptions;return a.device.char.width=Math.floor(r.width*u),a.device.char.height=Math.ceil(r.height*u),a.device.cell.height=Math.floor(a.device.char.height*h.lineHeight),a.device.char.top=h.lineHeight===1?0:Math.round((a.device.cell.height-a.device.char.height)/2),a.device.cell.width=a.device.char.width+Math.round(h.letterSpacing),a.device.char.left=Math.floor(h.letterSpacing/2),a.device.canvas.height=o*a.device.cell.height,a.device.canvas.width=l*a.device.cell.width,a.css.canvas.height=Math.round(a.device.canvas.height/u),a.css.canvas.width=Math.round(a.device.canvas.width/u),a.css.cell.height=a.css.canvas.height/o,a.css.cell.width=a.css.canvas.width/l,!0}function c5(a,n,l){if(!a||typeof a.ResizeObserver!="function")return null;let o=new a.ResizeObserver(r=>{var m;const u=r.find(g=>g.target===n);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((m=u.devicePixelContentBoxSize)!=null&&m[0])){o==null||o.disconnect(),o=null;return}const h=u.devicePixelContentBoxSize[0].inlineSize,p=u.devicePixelContentBoxSize[0].blockSize;h<=0||p<=0||h===n.width&&p===n.height||l(h,p)});try{o.observe(n,{box:"device-pixel-content-box"})}catch{o.disconnect(),o=null}return{dispose:()=>o==null?void 0:o.disconnect()}}function u5(a){if(!a)return[];const n=a.cells.map(l=>l.row);return a.cursor&&n.push(a.cursor.row),n}function d5(a){const n=new Map;for(const l of(a==null?void 0:a.cells)??[]){const o=n.get(l.row);o?o.push(l):n.set(l.row,[l])}return n}class f5{constructor(n){q(this,"canvas");q(this,"ctx");q(this,"selection",null);q(this,"link",null);this.canvas=n.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const l=this.canvas.getContext("2d");if(!l)throw new Error("2D canvas unavailable");this.ctx=l}setSelection(n,l,o){this.selection=n&&l&&!(n[0]===l[0]&&n[1]===l[1])?{start:[n[0],n[1]],end:[l[0],l[1]],columnSelectMode:o}:null}paint({dims:n,rows:l,cols:o,ydisp:r,colors:u,focused:h,dpr:p,cursorWidth:m,caret:g}){var S;const y=this.ctx;if(y.clearRect(0,0,this.canvas.width,this.canvas.height),!n.cell.width||!l)return;const{selection:v,link:w}=this,x=(M,E,k,N)=>y.fillRect(M*n.cell.width,E*n.cell.height,k*n.cell.width,N*n.cell.height);if(v){const M=v.start[1]-r,E=v.end[1]-r,k=Math.max(M,0),N=Math.min(E,l-1);if(k<l&&N>=0)if(y.fillStyle=(h?u.selectionBackgroundTransparent:u.selectionInactiveBackgroundTransparent).css,v.columnSelectMode)x(v.start[0],k,v.end[0]-v.start[0],N-k+1);else{const R=M===k?v.start[0]:0,H=k===E?v.end[0]:o;x(R,k,H-R,1),x(0,k+1,o,Math.max(N-k-1,0)),k!==N&&x(0,N,E===N?v.end[0]:o,1)}}if(w){y.fillStyle=w.fg===257?u.background.css:w.fg!==void 0&&w.fg<256?((S=u.ansi[w.fg])==null?void 0:S.css)??u.foreground.css:u.foreground.css;const M=(E,k,N)=>y.fillRect(E*n.cell.width,(k+1)*n.cell.height-p-1,N*n.cell.width,p);if(w.y1===w.y2)M(w.x1,w.y1,w.x2-w.x1);else{M(w.x1,w.y1,w.cols-w.x1);for(let E=w.y1+1;E<w.y2;E++)M(0,E,w.cols);M(0,w.y2,w.x2)}}if(g){const M=Math.round(g.x*n.cell.width),E=g.y*n.cell.height;g.shape===qn.BLOCK?(y.fillStyle=g.css,y.fillRect(M,E,n.cell.width,n.cell.height)):By(y,n,M,E,n.cell.width,g.shape,{css:g.css,dpr:p,cursorWidth:m})}}}class h5{constructor(n,l){q(this,"text");q(this,"textContext");q(this,"decor");this.screen=l,this.text=n.createElement("canvas"),this.text.classList.add("xterm-text-layer"),this.text.style.zIndex="0";const o=this.text.getContext("2d",{alpha:!1});if(!o)throw new Error("2D canvas unavailable");this.textContext=o,this.decor=new f5(n),l.appendChild(this.text),l.appendChild(this.decor.canvas)}size(n){for(const l of[this.text,this.decor.canvas])l.width=n.device.canvas.width,l.height=n.device.canvas.height,l.style.width=`${n.css.canvas.width}px`,l.style.height=`${n.css.canvas.height}px`;this.screen.style.width=`${n.css.canvas.width}px`,this.screen.style.height=`${n.css.canvas.height}px`}watchDevicePixels(n,l,o,r){return c5(n,this.text,(u,h)=>{const p=l.css.canvas;if(!(Math.abs(u-p.width*o())>2||Math.abs(h-p.height*o())>2)){l.device.canvas.width=u,l.device.canvas.height=h;for(const m of[this.text,this.decor.canvas])m.width=u,m.height=h;r()}})}remove(){this.text.remove(),this.decor.canvas.remove()}}function m5(a,n){const l=a.fonts;return!l||typeof l.addEventListener!="function"?null:(l.addEventListener("loadingdone",n),{dispose:()=>l.removeEventListener("loadingdone",n)})}class p5{constructor(n,l,o){q(this,"startedAt",null);q(this,"held",null);q(this,"timer",null);this.now=n,this.maxHoldMs=l,this.onExpire=o}get pending(){return this.held}hold(n,l){const o=this.now();return this.startedAt===null&&(this.startedAt=o),o-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,n),end:Math.max(this.held.end,l)}:{start:n,end:l},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(n,l){return this.held&&(n=Math.min(n,this.held.start),l=Math.max(l,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:n,end:l}}dispose(){this.timer&&clearTimeout(this.timer)}}function g5(a){var l,o,r,u;const n=a._core;return!(n!=null&&n.screenElement)||!n.coreService||!((l=n.optionsService)!=null&&l.rawOptions)||!((o=n._bufferService)!=null&&o.buffer)||!n._charSizeService||!n._coreBrowserService||!((r=n._themeService)!=null&&r.colors)||typeof((u=n._renderService)==null?void 0:u.setRenderer)!="function"?null:n}class b5{constructor(){q(this,"listeners",new Set);q(this,"event",n=>(this.listeners.add(n),{dispose:()=>this.listeners.delete(n)}))}fire(n){for(const l of[...this.listeners])l(n)}dispose(){this.listeners.clear()}}const y5=150;class Fd{constructor(n,l){q(this,"dimensions",o5());q(this,"redraw",new b5);q(this,"onRequestRedraw",this.redraw.event);q(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});q(this,"surface");q(this,"cells");q(this,"disposables",[]);q(this,"now");q(this,"syncHold");q(this,"cols",0);q(this,"rows",0);q(this,"overlayProvider",null);q(this,"typingZoneProvider",null);q(this,"reducedMotion");q(this,"paintedOverlayRows",new Set);q(this,"paintedCursorRow",-1);q(this,"lastYdisp",0);q(this,"inputAt",null);q(this,"blink",new OT(()=>this.requestCursorRow()));q(this,"glide",new zT);q(this,"slidingCaret",null);q(this,"disposed",!1);q(this,"isSynchronizing");q(this,"dprUsed",0);var h,p;this.core=n,this.now=l.now??(()=>performance.now()),this.syncHold=new p5(this.now,l.maxSyncHoldMs??y5,()=>this.flushHeld()),this.isSynchronizing=l.isSynchronizing??(()=>!1),this.reducedMotion=(p=(h=n._coreBrowserService.window).matchMedia)==null?void 0:p.call(h,"(prefers-reduced-motion: reduce)");const o=n._coreBrowserService.mainDocument;this.surface=new h5(o,n.screenElement),this.cells=new s5(this.surface.textContext,o,n,this.dimensions),this.disposables.push(n._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),n.optionsService.onOptionChange(m=>{(m==="cursorBlink"||m==="cursorStyle")&&this.restartBlink()})),n.linkifier&&this.disposables.push(n.linkifier.onShowLinkUnderline(m=>{this.surface.decor.link=m,this.redrawDecor()}),n.linkifier.onHideLinkUnderline(()=>{this.surface.decor.link=null,this.redrawDecor()}));const r=this.surface.watchDevicePixels(n._coreBrowserService.window,this.dimensions,()=>n._coreBrowserService.dpr,()=>{this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})});r&&this.disposables.push(r);const u=m5(o,()=>this.clearTextureAtlas());u&&this.disposables.push(u),this.restartBlink()}static install(n,l={}){const o=g5(n);if(!o)return null;const r=new Fd(o,l);return o._renderService.setRenderer(r),o._renderService.handleResize(o._bufferService.cols,o._bufferService.rows),r}setOverlayProvider(n){this.overlayProvider=n,this.invalidateOverlay()}setTypingZoneProvider(n){this.typingZoneProvider=n}invalidateOverlay(){var o;const n=((o=this.overlayProvider)==null?void 0:o.call(this))??null,l=new Set(this.paintedOverlayRows);for(const r of u5(n))l.add(r);this.paintedCursorRow>=0&&l.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(l)}markInput(){this.inputAt=this.now()}flushHeld(){const n=this.syncHold.pending;n&&this.redraw.fire({start:n.start,end:n.end})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(n,l){r5(this.dimensions,this.core,n,l)&&(this.dprUsed=this.core._coreBrowserService.dpr),this.surface.size(this.dimensions),this.cols=n,this.rows=l,this.cells.resize(n,l),this.paintedOverlayRows.clear(),this.paintedCursorRow=-1,this.cells.configureAtlas(),this.cells.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.blink.stop(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(n,l,o){this.surface.decor.setSelection(n,l,o),this.redrawDecor()}handleCursorMove(){this.blink.running&&this.restartBlink()}clear(){this.invalidateAll(),this.cells.fillBackground()}clearTextureAtlas(){this.cells.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(n,l){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(n,l)){this.stats.heldFrames++;return}const o=this.syncHold.release(n,l);this.paint(Math.max(0,o.start),Math.min(this.rows-1,o.end))}dispose(){if(!this.disposed){this.disposed=!0,this.blink.stop(),this.syncHold.dispose();for(const n of this.disposables)n.dispose();this.disposables.length=0,this.redraw.dispose(),this.cells.atlas.dispose(),this.surface.remove()}}uninstall(){const n=this.core._createRenderer;typeof n=="function"&&(this.core._renderService.setRenderer(n.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.surface.text}hasPaintedInk(n,l){return this.cells.hasPaintedInk(n,l)}paint(n,l){var k,N,R;const o=this.now(),r=this.buffer(),u=r.ydisp;u!==this.lastYdisp&&(this.lastYdisp=u,this.cells.fades.clear(),this.redrawDecor());const h=(k=this.reducedMotion)!=null&&k.matches?null:((N=this.typingZoneProvider)==null?void 0:N.call(this))??null,p=h?h.row-u:-1,m=((R=this.overlayProvider)==null?void 0:R.call(this))??null,g=d5(m),y=this.cursorState(m),v=HT(y,m,u,this.colors()),w=this.glide.update(v,p,o),x=w?null:y,S=w&&(v==null?void 0:v.plain);S&&g.set(S.row,[...g.get(S.row)??[],S]);const M=new Set;for(let H=n;H<=l;H++)M.add(H);for(const H of this.paintedOverlayRows)rs(M,H-u,this.rows);for(const H of g.keys())rs(M,H-u,this.rows);this.paintedCursorRow>=0&&rs(M,this.paintedCursorRow,this.rows),x&&rs(M,x.y,this.rows);for(const H of this.cells.fades.rows(this.cols))rs(M,H,this.rows);let E=0;for(const H of M){this.cells.loadRow(r.lines.get(u+H),g.get(H+u));const j=H===p?{start:h.startCol,end:h.endCol}:null;E+=this.cells.paintRow(H,x,j,o)}this.cells.fades.size>0&&this.requestAbsoluteRows([...this.cells.fades.rows(this.cols)].map(H=>H+u)),(w||this.slidingCaret)&&(this.slidingCaret=w,this.redrawDecor(),w&&this.requestAbsoluteRows([w.y+u])),this.paintedOverlayRows=new Set(g.keys()),this.paintedCursorRow=x?x.y:-1,this.stats.frames++,this.stats.lastCells=E,this.stats.lastPaintMs=this.now()-o,this.inputAt!==null&&E>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(n){return jT(this.core,this.buffer(),n,{rows:this.rows,cols:this.cols},this.blink.hidden)}restartBlink(){if(this.blink.stop(),this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blink.start(),this.requestCursorRow()}requestCursorRow(){if(!this.rows)return;const n=this.buffer(),l=new Set;l.add(n.ybase+n.y),this.paintedCursorRow>=0&&l.add(this.paintedCursorRow+n.ydisp),this.requestAbsoluteRows(l)}redrawDecor(){this.surface.decor.paint({dims:this.dimensions.device,rows:this.rows,cols:this.cols,ydisp:this.buffer().ydisp,colors:this.colors(),focused:this.core._coreBrowserService.isFocused,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth,caret:this.slidingCaret})}invalidateAll(){this.cells.invalidate(),this.paintedCursorRow=-1}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}requestAbsoluteRows(n){if(!this.rows)return;const l=this.buffer().ydisp;let o=1/0,r=-1/0;for(const u of n){const h=u-l;h<0||h>=this.rows||(o=Math.min(o,h),r=Math.max(r,h))}o<=r&&this.redraw.fire({start:o,end:r})}}function rs(a,n,l){n>=0&&n<l&&a.add(n)}const v5=30,Fy=640,Gy=240,er=1,x5=720*60*60*1e3;function Yy(){const a=gs("local",Et.rendererProbe);if(!a)return{v:er,ua:{}};try{const n=JSON.parse(a);return typeof n=="object"&&n!==null&&n.v===er&&typeof n.ua=="object"&&n.ua!==null?n:{v:er,ua:{}}}catch{return{v:er,ua:{}}}}function w5(a,n=Date.now()){const l=Yy();l.ua[a]={failedAt:n},Li("local",Et.rendererProbe,JSON.stringify(l))}function S5(a,n=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";if(!l)return!1;const r=Yy().ua[l];return!(!r||typeof r.failedAt!="number"||n-r.failedAt>x5)}function Qg(a,n=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";l&&w5(l,n)}function C5(a){if(a.length<4)return!0;const n=a[0],l=a[1],o=a[2],r=a[3];for(let u=4;u<a.length;u+=4)if(a[u]!==n||a[u+1]!==l||a[u+2]!==o||a[u+3]!==r)return!1;return!0}function T5(a){if(!a||a.width<=0||a.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let n=null;try{n=a.getContext("2d",{willReadFrequently:!0})||a.getContext("2d")}catch(r){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",r),"inconclusive"}if(!n)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const l=Math.min(a.width,Fy),o=Math.min(a.height,Gy);if(l<=0||o<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const r=n.getImageData(0,0,l,o);return C5(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function Wg(a=2){return new Promise(n=>{if(typeof requestAnimationFrame!="function"){setTimeout(n,32);return}let l=a;const o=()=>{l--,l<=0?n():requestAnimationFrame(o)};requestAnimationFrame(o)})}const ld={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function M5(a,n={}){if(S5())return ld;let l;try{l=Fd.install(a,{isSynchronizing:n.isSynchronizing})}catch(p){return console.debug("Canvas renderer unavailable, using the DOM renderer:",p),Qg(),ld}if(!l)return ld;let o=l,r=null;const u=()=>{var m;if(!o)return;Qg();const p=o;o=null;try{p.uninstall()}catch{}(m=n.onRendererSwapped)==null||m.call(n,"dom")};return{get kind(){return o?"canvas":"dom"},get canvas(){return o},dispose:()=>{const p=o;o=null;try{p==null||p.dispose()}catch{}},verify:async()=>{if(o)return r||(r=(async()=>{try{const p=o.stats.frames;await Wg(2);for(let g=0;g<v5&&o&&o.stats.frames===p;g++)await Wg(1);if(!o)return;const m=T5(o.textCanvas);m==="blank"&&o.hasPaintedInk(Fy,Gy)?u():m==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):m==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(p){console.debug("Canvas probe inconclusive: unexpected error during verify():",p)}finally{r=null}})(),r)}}}function A5(a,n,l){a.writeln(" ___ ___ .___ "),a.writeln(` / | \\ ____ _______| _/______ \x1B[1m${n}\x1B[0m`),a.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${l}\x1B[0m`),a.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),a.writeln(" \\___|_ / \\___ >|__| /___/____ >"),a.writeln(" \\/ \\/ \\/ "),a.writeln("")}var E5=wx(),sd={exports:{}},Jg;function N5(){return Jg||(Jg=1,(function(a,n){(function(l,o){a.exports=o()})(self,(()=>(()=>{var l={6:(h,p)=>{function m(y){try{const v=new URL(y),w=v.password&&v.username?`${v.protocol}//${v.username}:${v.password}@${v.host}`:v.username?`${v.protocol}//${v.username}@${v.host}`:`${v.protocol}//${v.host}`;return y.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(p,"__esModule",{value:!0}),p.LinkComputer=p.WebLinkProvider=void 0,p.WebLinkProvider=class{constructor(y,v,w,x={}){this._terminal=y,this._regex=v,this._handler=w,this._options=x}provideLinks(y,v){const w=g.computeLink(y,this._regex,this._terminal,this._handler);v(this._addCallbacks(w))}_addCallbacks(y){return y.map((v=>(v.leave=this._options.leave,v.hover=(w,x)=>{if(this._options.hover){const{range:S}=v;this._options.hover(w,x,S)}},v)))}};class g{static computeLink(v,w,x,S){const M=new RegExp(w.source,(w.flags||"")+"g"),[E,k]=g._getWindowedLineStrings(v-1,x),N=E.join("");let R;const H=[];for(;R=M.exec(N);){const j=R[0];if(!m(j))continue;const[D,_]=g._mapStrIdx(x,k,0,R.index),[z,K]=g._mapStrIdx(x,D,_,j.length);if(D===-1||_===-1||z===-1||K===-1)continue;const V={start:{x:_+1,y:D+1},end:{x:K,y:z+1}};H.push({range:V,text:j,activate:S})}return H}static _getWindowedLineStrings(v,w){let x,S=v,M=v,E=0,k="";const N=[];if(x=w.buffer.active.getLine(v)){const R=x.translateToString(!0);if(x.isWrapped&&R[0]!==" "){for(E=0;(x=w.buffer.active.getLine(--S))&&E<2048&&(k=x.translateToString(!0),E+=k.length,N.push(k),x.isWrapped&&k.indexOf(" ")===-1););N.reverse()}for(N.push(R),E=0;(x=w.buffer.active.getLine(++M))&&x.isWrapped&&E<2048&&(k=x.translateToString(!0),E+=k.length,N.push(k),k.indexOf(" ")===-1););}return[N,S]}static _mapStrIdx(v,w,x,S){const M=v.buffer.active,E=M.getNullCell();let k=x;for(;S;){const N=M.getLine(w);if(!N)return[-1,-1];for(let R=k;R<N.length;++R){N.getCell(R,E);const H=E.getChars();if(E.getWidth()&&(S-=H.length||1,R===N.length-1&&H==="")){const j=M.getLine(w+1);j&&j.isWrapped&&(j.getCell(0,E),E.getWidth()===2&&(S+=1))}if(S<0)return[w,R]}w++,k=0}return[w,k]}}p.LinkComputer=g}},o={};function r(h){var p=o[h];if(p!==void 0)return p.exports;var m=o[h]={exports:{}};return l[h](m,m.exports,r),m.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const p=r(6),m=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(y,v){const w=window.open();if(w){try{w.opener=null}catch{}w.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(y=g,v={}){this._handler=y,this._options=v}activate(y){this._terminal=y;const v=this._options,w=v.urlRegex||m;this._linkProvider=this._terminal.registerLinkProvider(new p.WebLinkProvider(this._terminal,w,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),u})()))})(sd)),sd.exports}var k5=N5(),L5=Sx();function _5({fontSize:a,fontFamily:n,theme:l,cols:o,rows:r}){const u=new L5.Terminal({fontSize:a,fontFamily:n,lineHeight:1.15,...l?{theme:{...l}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:o,rows:r,screenReaderMode:!1,linkHandler:{activate:(h,p)=>{Cd(p)}}});try{const h=new E5.Unicode11Addon;u.loadAddon(h),u.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{u.loadAddon(new k5.WebLinksAddon((h,p)=>{Cd(p)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return u}function ds(a){var n,l;if(!a)return!1;try{const o=a.modes;if(o&&typeof o.mouseTrackingMode=="string"&&o.mouseTrackingMode!=="none")return!0;const r=a._core;if((n=r==null?void 0:r._coreMouseService)!=null&&n.areMouseEventsActive||(l=r==null?void 0:r.coreMouseService)!=null&&l.areMouseEventsActive||r!=null&&r.mouseMode&&r.mouseMode!=="none")return!0}catch{}return!1}function R5(a,n){const l=n.button??0,o=n.buttons??(a==="mouseup"?0:1);return new MouseEvent(a,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,screenX:n.clientX,screenY:n.clientY,button:l,buttons:o})}function Py(a,n,l){const o=R5(n,l);return a.dispatchEvent(o)}function $y(a){var n;try{return((n=a.buffer)==null?void 0:n.active)||null}catch{return null}}function od(a){var l;const n=(l=$y(a))==null?void 0:l.viewportY;return typeof n=="number"&&Number.isFinite(n)?n:null}function j5(a){var n;try{(n=a.blur)==null||n.call(a)}catch{}}function eb(a){var l,o;const n=a;return n.coreMouseService||((l=n._core)==null?void 0:l.coreMouseService)||((o=n._core)==null?void 0:o._coreMouseService)||null}function O5(a){var l;const n=a;return n.coreService||((l=n._core)==null?void 0:l.coreService)||null}class D5{constructor(n){this.options=n}getLogicalCoordinates(n,l){const o=this.options.getScale?this.options.getScale():1,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(o!==1&&r&&typeof r.getBoundingClientRect=="function"){const u=r.getBoundingClientRect();return Dy(n,l,u,o)}return{clientX:n,clientY:l}}getViewportElement(n){var r;const l=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(l==null?void 0:l.querySelector(".xterm-viewport"))||((r=n.element)==null?void 0:r.querySelector(".xterm-viewport"))||null}isInputLineHit(n,l){var N;const o=(N=l.buffer)==null?void 0:N.active,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||l.element||r,h=sa(l);if(!u||typeof u.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const p=u.getBoundingClientRect(),m=this.getLogicalCoordinates(n.clientX,n.clientY),g=p.width>0&&p.height>0;if(![o==null?void 0:o.cursorY,o==null?void 0:o.viewportY,o==null?void 0:o.baseY].every(R=>typeof R=="number"&&Number.isFinite(R)))return!1;const v=o==null?void 0:o.cursorY,w=o==null?void 0:o.viewportY,S=(o==null?void 0:o.baseY)+v-w,M=p.top+S*h.cellHeight,E=M+h.cellHeight,k=Number(l.rows);return S>=0&&(!Number.isFinite(k)||S<k)&&m.clientY>=M-2&&m.clientY<=E+2&&(!g||m.clientX>=p.left&&m.clientX<=p.right)}resolveDispatchTarget(n,l){var p;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||l.querySelector(".xterm-screen")||null,u=((p=r==null?void 0:r.closest)==null?void 0:p.call(r,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(n.clientX,n.clientY)),h&&u&&(h===u||u.contains(h))?h:r||o||l}getMouseReport(n,l){const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||l.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const u=r.getBoundingClientRect(),h=this.getLogicalCoordinates(n.clientX,n.clientY),p=sa(l);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,u.width||l.cols*p.cellWidth),g=Math.max(1,u.height||l.rows*p.cellHeight),y=Math.max(0,Math.min(m-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),w=Math.max(0,Math.min(l.cols-1,Math.floor(y/p.cellWidth))),x=Math.max(0,Math.min(l.rows-1,Math.floor(v/p.cellHeight)));return{col:w,row:x,x:Math.floor(y),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(n){const l=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(l==null?void 0:l.querySelector(".xterm"))||n.element||null}dispatchWheel(n,l,o,r){const u=this.getWheelDispatchTarget(o);if(!u||typeof WheelEvent>"u"||l===0)return!1;const h=this.getLogicalCoordinates(n.clientX,n.clientY),p=l<0?-1:1;let m=0;for(let g=0;g<Math.abs(l);g+=1)try{const y=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:p,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});u.dispatchEvent(y),m+=1}catch{return m>0}return m>0}emitWheel(n,l,o,r){if(l===0)return!1;if(this.dispatchWheel(n,l,o,r))return!0;const u=eb(o);if(!(u!=null&&u.triggerMouseEvent))return!1;let h=0;for(let p=0;p<Math.abs(l);p+=1){const m=this.getMouseReport(n,o);m&&(m.button=4,m.action=l<0?0:1,m.ctrl=!!(r!=null&&r.ctrlKey),m.alt=!!(r!=null&&r.altKey),m.shift=!!(r!=null&&r.shiftKey),u.triggerMouseEvent(m)&&(h+=1))}return h>0}scrollAlternateBuffer(n,l,o,r){var h;if(l===0)return"none";const u=ds(o);if(!u&&!this.options.getIsController())return"none";if(this.emitWheel(n,l,o,r))return u?"application-mouse":"application-keys";if(!u){const p=O5(o);if(!(p!=null&&p.triggerDataEvent))return"none";const g=`\x1B${!!((h=p.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${l<0?"A":"B"}`;return p.triggerDataEvent(g.repeat(Math.abs(l)),!0),"application-keys"}return"none"}emitMouse(n,l,o,r){const u=this.options.getTerminal();if(!u)return;const h=eb(u);if(h!=null&&h.triggerMouseEvent){const m=this.getMouseReport(l,u);m&&(m.action=n==="mousedown"?1:n==="mouseup"?0:32,m.ctrl=!!(o!=null&&o.ctrlKey),m.alt=!!(o!=null&&o.altKey),m.shift=!!(o!=null&&o.shiftKey),h.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const p=this.getLogicalCoordinates(l.clientX,l.clientY);Py(r,n,{clientX:p.clientX,clientY:p.clientY,button:0,buttons:n==="mouseup"?0:1})}}class z5{constructor(n){q(this,"options");q(this,"state","idle");q(this,"startX",0);q(this,"startY",0);q(this,"lastX",0);q(this,"lastY",0);q(this,"activeTarget",null);q(this,"longPressTimer",null);q(this,"capturedPointerId",null);q(this,"captureElement",null);q(this,"scrollRemainderY",0);q(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...n},this.delivery=new D5(this.options)}getState(){return this.state}setGestureState(n){var l,o;this.state!==n&&(this.state=n,(o=(l=this.options).onGestureStateChange)==null||o.call(l,n))}beginGesture(n,l){this.startX=n.clientX,this.startY=n.clientY,this.lastX=n.clientX,this.lastY=n.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.delivery.resolveDispatchTarget(n,l),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var o,r;this.state==="pending"&&(this.setGestureState("longpress"),(r=(o=this.options).onLongPress)==null||r.call(o,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(n,l){var g,y,v,w;if(this.state==="longpress"){(y=(g=this.options).onSelectionExtend)==null||y.call(g,{clientX:n.clientX,clientY:n.clientY}),l!=null&&l.cancelable&&((v=l.preventDefault)==null||v.call(l));return}if(this.state==="idle")return;const o=n.clientX-this.startX,r=n.clientY-this.startY,u=Math.hypot(o,r);if(this.state==="scrolling"){this.scrollGesture(n,l);return}const h=this.options.getTerminal(),p=this.options.getIsController(),m=ds(h);if(!(u<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(o)||!m||!p){this.setGestureState("scrolling"),h&&j5(h),this.lastX=n.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(n,l);return}if(m&&p){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},l,this.activeTarget)),this.state==="dragging"&&(this.lastX=n.clientX,this.lastY=n.clientY,this.delivery.emitMouse("mousemove",n,l,this.activeTarget),l!=null&&l.cancelable&&((w=l.preventDefault)==null||w.call(l)));return}this.lastX=n.clientX,this.lastY=n.clientY}}scrollGesture(n,l){var S,M,E;const o=this.options.getTerminal();if(!o)return;const r=n.clientY-this.lastY;this.lastX=n.clientX,this.lastY=n.clientY;const u=sa(o),h=u.measured?u.cellHeight:this.options.scrollLineHeightPx||u.cellHeight||18;this.scrollRemainderY+=r;const p=Math.trunc(this.scrollRemainderY/h),m=-p;let g=!1,y="none";const v=$y(o),w=ds(o);if(m!==0){if((v==null?void 0:v.type)==="alternate")y=this.delivery.scrollAlternateBuffer(n,m,o,l),g=y!=="none";else{const k=od(o);o.scrollLines(m);const N=od(o);y="buffer",g=k===null||N===null||k!==N}this.scrollRemainderY-=p*h}const x=this.delivery.getViewportElement(o);(M=(S=this.options).onGestureScroll)==null||M.call(S,{deltaY:r,lines:m,viewportY:od(o),scrollTop:(x==null?void 0:x.scrollTop)??null,scrollHeight:(x==null?void 0:x.scrollHeight)??null,clientHeight:(x==null?void 0:x.clientHeight)??null,moved:g,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:w,scrollMode:y}),l!=null&&l.cancelable&&((E=l.preventDefault)==null||E.call(l))}endGesture(n,l){var h,p,m;this.clearLongPressTimer();const o=this.options.getTerminal(),r=this.options.getIsController(),u=ds(o);if(this.state==="pending"){if(u&&r){const y={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",y,l,this.activeTarget),this.delivery.emitMouse("mouseup",y,l,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};r&&o&&this.delivery.isInputLineHit(g,o)&&((p=(h=this.options).onFocus)==null||p.call(h))}else if(this.state==="dragging"&&u&&r){const g=n??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,l,this.activeTarget),l!=null&&l.cancelable&&((m=l.preventDefault)==null||m.call(l))}this.reset()}handlePointerDown(n,l){if(n.pointerType==="mouse")return!1;if(!n.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(n.cancelable&&n.preventDefault(),this.beginGesture(n,l),n.pointerType!=="touch")try{typeof l.setPointerCapture=="function"&&(l.setPointerCapture(n.pointerId),this.capturedPointerId=n.pointerId,this.captureElement=l)}catch{}return!0}handlePointerMove(n){n.pointerType==="mouse"||this.state==="idle"||this.moveGesture(n,n)}handlePointerUp(n){n.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(n,n))}handlePointerCancel(n){n&&n.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(n,l){if(n.touches.length!==1){this.reset();return}n.cancelable&&n.preventDefault(),this.beginGesture(n.touches[0],l)}handleTouchMove(n){n.touches.length===1&&this.moveGesture(n.touches[0],n)}handleTouchEnd(n){n.cancelable&&n.preventDefault(),this.endGesture(null,n)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const n=this.options.getTerminal(),l=this.options.getIsController(),o=ds(n);if(this.state==="dragging"&&o&&l&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);Py(this.activeTarget,"mouseup",{clientX:r.clientX,clientY:r.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const n=this.captureElement,l=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!n||l===null))try{typeof n.releasePointerCapture=="function"&&(typeof n.hasPointerCapture!="function"||n.hasPointerCapture(l))&&n.releasePointerCapture(l)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function H5({container:a,term:n,isTouchDevice:l,debug:o,getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:p,getSelection:m,onFocus:g}){const y=new z5({getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:p,allowSyntheticMouseFallback:!1,onFocus:()=>{try{n.focus()}catch{}o==null||o(j=>({...j,focused:document.activeElement===n.textarea})),g()},onGestureStateChange:j=>{o==null||o(D=>({...D,state:j}))},onGestureScroll:({deltaY:j,lines:D,viewportY:_,scrollTop:z,scrollHeight:K,clientHeight:V,moved:ne,bufferType:W,baseY:ie,cursorY:oe,hasScrollback:P,mouseTracking:A,scrollMode:I})=>{o==null||o(J=>({...J,deltaY:j,lines:D,viewportY:_,scrollTop:z,scrollHeight:K,clientHeight:V,moved:ne,focused:document.activeElement===n.textarea,bufferType:W,baseY:ie,cursorY:oe,hasScrollback:P,mouseTracking:A,scrollMode:I,scrollCalls:J.scrollCalls+(D!==0?1:0),lastScrollLines:D}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:l?j=>m().handleLongPress(j):void 0,onSelectionExtend:l?j=>m().handleSelectionExtend(j):void 0}),v=typeof window<"u"&&"PointerEvent"in window,w=typeof TouchEvent<"u",x=[],S={passive:!1,capture:!0},M=(j,D)=>{document.addEventListener(j,D,S),x.push(()=>document.removeEventListener(j,D,S))},E=(j,D=!1)=>{const _=j.target;return _ instanceof Node&&a.contains(_)||D&&y.getState()!=="idle"},k=(j,D)=>{o==null||o(_=>({..._,[j]:_[j]+1,lastInputEvent:D}))},N=j=>{const D=m();return D.hasOpenMenu()?(D.clearSelection(),j.cancelable&&j.preventDefault(),j.stopPropagation(),!0):!1},R=()=>{y.getState()==="longpress"&&m().openMenuAtGesture()};if(v){if(M("pointerdown",j=>{if(!E(j)||(k("pointerEvents","pointerdown"),N(j)))return;y.handlePointerDown(j,a)&&j.stopPropagation()}),M("pointermove",j=>{E(j,!0)&&(k("pointerEvents","pointermove"),y.handlePointerMove(j),j.pointerType!=="mouse"&&j.stopPropagation())}),M("pointerup",j=>{E(j,!0)&&(k("pointerEvents","pointerup"),R(),y.handlePointerUp(j),j.pointerType!=="mouse"&&j.stopPropagation())}),M("pointercancel",j=>{E(j,!0)&&(k("pointerEvents","pointercancel"),m().clearSelection(),y.handlePointerCancel(j),j.pointerType!=="mouse"&&j.stopPropagation())}),w){const j=D=>{E(D,!0)&&(o==null||o(_=>({..._,touchEvents:_.touchEvents+1})),D.cancelable&&D.preventDefault(),D.stopPropagation())};for(const D of["touchstart","touchmove","touchend","touchcancel"])M(D,j)}}else M("touchstart",j=>{E(j)&&(k("touchEvents","touchstart"),!N(j)&&(j.touches.length===1&&j.stopPropagation(),y.handleTouchStart(j,a)))}),M("touchmove",j=>{E(j,!0)&&(k("touchEvents","touchmove"),j.touches.length===1&&j.stopPropagation(),y.handleTouchMove(j))}),M("touchend",j=>{E(j,!0)&&(k("touchEvents","touchend"),R(),j.stopPropagation(),y.handleTouchEnd(j))}),M("touchcancel",j=>{E(j,!0)&&(k("touchEvents","touchcancel"),m().clearSelection(),j.stopPropagation(),y.handleTouchCancel())});const H=j=>{j.preventDefault()};return a.addEventListener("contextmenu",H),x.push(()=>a.removeEventListener("contextmenu",H)),()=>{y.handlePointerCancel();for(const j of x)j()}}function B5(a,{requestFit:n,onPageVisible:l}){const o=new ResizeObserver(()=>{n()});o.observe(a);const r=()=>{n()},u=()=>{document.visibilityState==="visible"&&l()};window.addEventListener("resize",r),window.addEventListener("orientationchange",r),document.addEventListener("visibilitychange",u),window.addEventListener("pageshow",u);const h=()=>{n()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",h),window.visualViewport.addEventListener("scroll",h)),()=>{o.disconnect(),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),document.removeEventListener("visibilitychange",u),window.removeEventListener("pageshow",u),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",h),window.visualViewport.removeEventListener("scroll",h))}}function ta(a){if(a)try{a.refresh(0,Math.max(0,a.rows-1))}catch{}}function U5({containerRef:a,surfaceRef:n,termRef:l,rendererRef:o,currentScaleRef:r,initialBannerWrittenRef:u,live:h,selection:p,prediction:m,fit:g,isTouchDevice:y,debug:v,terminalFontSize:w,terminalFontFamily:x,hostTheme:S,glyphRevision:M,terminalResetVersion:E,isActive:k,subscribeToOutput:N,onOutput:R,onTitle:H,onRendererKind:j}){const{requestFit:D,scheduleBoundedFit:_,fitNow:z,seedFit:K,cancelPendingFits:V}=g;T.useEffect(()=>{var rt,tt;if(!a.current||!n.current)return;const W=a.current,ie=Ed(W,nl(),cd()),oe=sa(null,ol),P=Oy({width:ie.width,height:ie.height,cellWidth:oe.cellWidth,cellHeight:oe.cellHeight});h.current.sendResize(P.cols,P.rows),K(ie);const A=_5({fontSize:ng(w,ie.width),fontFamily:x,theme:h.current.hostTheme,cols:P.cols,rows:P.rows});A.open(n.current),l.current=A;const I=A.onTitleChange(fe=>{H(Sd(fe)||null)}),{screenState:J,fieldProbe:le,overlay:Z}=m.attach(A);y&&A.textarea&&(A.textarea.readOnly=!1,A.textarea.tabIndex=0,A.textarea.inputMode="text");let ye=()=>{};if(v&&A.textarea){const fe=()=>{v(Re=>({...Re,focused:document.activeElement===A.textarea}))};A.textarea.addEventListener("focus",fe),A.textarea.addEventListener("blur",fe),ye=()=>{var Re,Xe;(Re=A.textarea)==null||Re.removeEventListener("focus",fe),(Xe=A.textarea)==null||Xe.removeEventListener("blur",fe)},fe()}const xe=async fe=>{m.discard("paste");const Re=xy(fe);if(Re){if(fe.preventDefault(),fe.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Re)}};(rt=A.textarea)==null||rt.addEventListener("paste",xe),W.addEventListener("paste",xe);const ce=M5(A,{isSynchronizing:J.isSynchronizing,onRendererSwapped:fe=>{var Re;W.dataset.renderer=fe,j(fe),(Re=m.overlayRef.current)==null||Re.attach(null),ta(A)}});Z.attach(ce.canvas),(tt=ce.canvas)==null||tt.setTypingZoneProvider(()=>{const fe=le.detect();return fe&&{row:fe.row,startCol:fe.startCol,endCol:fe.endCol}});const Te=J.onSyncEnd(()=>{var fe,Re;return(Re=(fe=o.current)==null?void 0:fe.canvas)==null?void 0:Re.flushHeld()});if(o.current=ce,W.dataset.renderer=ce.kind,j(ce.kind),A5(A,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),u.current=!0,A.write("",()=>void ce.verify()),!y)try{A.focus()}catch{}const ue=typeof document<"u"?document.fonts:void 0;typeof(ue==null?void 0:ue.load)=="function"&&ue.load('13px "Symbols Nerd Font Mono"').then(()=>{l.current&&(ta(l.current),_(5))}).catch(()=>{});const de=A.onData(fe=>{const{isController:Re}=h.current;let Xe=fe;if(Re&&Ly(fe)==="keys"&&Ox(fe)){const ht=h.current.consumeModifierLatch();ht&&(Xe=cr(fe,ht))}const gt=_d(Xe);if(!Re&&!fr(gt)){h.current.warnViewerMode();return}m.onUserInput(gt),h.current.sendBinary(gt)}),se=A.onBinary(fe=>{const Re=new Uint8Array(fe.length);for(let Xe=0;Xe<fe.length;Xe++)Re[Xe]=fe.charCodeAt(Xe)&255;!h.current.isController&&!fr(Re)||h.current.sendBinary(Re)}),ve=typeof A.onWriteParsed=="function"?A.onWriteParsed(()=>{var ht;if(p.current.onTerminalContentChanged(),le.invalidate(),J.isSynchronizing())return;const fe=A.buffer.active,Re=fe.baseY+fe.cursorY,Xe=Array.from({length:8},(An,gn)=>{var kt;return((kt=fe.getLine(Re-7+gn))==null?void 0:kt.translateToString(!0))??""}),gt=Rw(Xe,h.current.platform);gt&&h.current.reportShellProfile(gt),(ht=m.predictorRef.current)==null||ht.onServerOutput(),m.sync()}):{dispose:()=>{}},ae=typeof A.onRender=="function"?A.onRender(fe=>{var Re;if(h.current.glyphScan){const Xe=A.buffer.active.viewportY??0;let gt="";for(let ht=fe.start;ht<=fe.end;ht+=1)gt+=((Re=A.buffer.active.getLine(Xe+ht))==null?void 0:Re.translateToString(!0))??"";/[^\x00-\x7f]/.test(gt)&&h.current.ensureHostGlyphs(gt)}p.current.onTerminalRender(A,fe.start,fe.end)}):{dispose:()=>{}},we=typeof A.onScroll=="function"?A.onScroll(()=>{p.current.onTerminalScroll(A),m.discard("scroll")}):{dispose:()=>{}},Ae=H5({container:W,term:A,isTouchDevice:y,debug:v,getTerminal:()=>l.current,getIsController:()=>h.current.isController,getScale:()=>r.current,getSurfaceElement:()=>n.current,getSelection:()=>p.current,onFocus:()=>{var fe,Re;return(Re=(fe=h.current).onTerminalFocus)==null?void 0:Re.call(fe)}}),De=B5(W,{requestFit:D,onPageVisible:()=>{_(10),ta(l.current)}});return()=>{var fe;de.dispose(),se.dispose(),ae.dispose(),we.dispose(),ve.dispose(),I.dispose(),Te.dispose(),m.detach(),J.dispose(),Ae(),De(),V(),ye(),(fe=A.textarea)==null||fe.removeEventListener("paste",xe),W.removeEventListener("paste",xe),ce.dispose(),o.current=null,A.dispose(),l.current=null}},[]),T.useEffect(()=>{const W=l.current;if(!W)return;const ie=Ed(a.current,nl(),cd()),oe=ng(w,ie.width),P=W.options.fontSize!==oe||W.options.fontFamily!==x;W.options.fontSize=oe,W.options.fontFamily=x,ta(W),P&&z(),_(10)},[w,x]),T.useEffect(()=>{var ie,oe;const W=l.current;!W||!M||((oe=(ie=o.current)==null?void 0:ie.canvas)==null||oe.clearTextureAtlas(),ta(W))},[M]);const ne=T.useRef(E);T.useEffect(()=>{var ie;if(ne.current===E)return;ne.current=E,m.forget("resetVersion");const W=l.current;if(W)try{(ie=W.reset)==null||ie.call(W),W.clear(),W.refresh(0,Math.max(0,W.rows-1))}catch{}},[E]),T.useEffect(()=>{const W=l.current;!W||!S||(W.options.theme={...S},ta(W))},[S]),T.useEffect(()=>N(ie=>{const oe=l.current;if(!oe)throw new Error("terminal not ready");oe.write(ie),R==null||R(ie.byteLength)}),[N,l,R]),T.useEffect(()=>{if(!k)return;_(10);const W=l.current;if(W&&(ta(W),!y))try{W.focus()}catch{}},[k,y,_,l])}const K5=({onTerminalFocus:a,isActive:n=!0})=>{var gn;const l=T.useRef(null),o=T.useRef(null),r=T.useRef(null),u=T.useRef(null),h=T.useRef(null),p=T.useRef(1),m=T.useRef(null),g=T.useRef(!1),y=ew(),v=y||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,w=oC(),[x,S]=T.useState(sC),{metrics:M,record:E}=rC(w),[k,N]=T.useState(null),{settings:R,terminalFontFamily:H,terminalFontSize:j,hostFont:D,ensureHostGlyphs:_,profiles:z,activeProfileId:K,t:V}=Ne(),{isController:ne,connectionState:W,hostPalette:ie,terminalResetVersion:oe,agentStatus:P,platform:A,reportShellProfile:I,connect:J,rttMs:le}=et(),{addToast:Z}=Vt(),{sendResize:ye,sendBinary:xe,observeKeyInput:ce,consumeModifierLatch:Te,warnViewerMode:ue,subscribeToOutput:de,subscribeToPasteFileReady:se}=Cs(),{uploadImage:ve}=Sr(),ae=Qn.useMemo(()=>uw(ie),[ie]),we=Xn({isController:ne,sendBinary:xe,sendResize:ye,warnViewerMode:ue,uploadImage:ve,t:V,consumeModifierLatch:Te,hostTheme:ae,onTerminalFocus:a,ensureHostGlyphs:_,glyphScan:D.glyphs.status==="ready",platform:A,reportShellProfile:I}),Ae=Xn(n),De=hT({termRef:h,rendererRef:m,mode:R.predictiveEcho,connectionState:W,observeKeyInput:ce}),[rt,tt]=T.useState(null),fe=LT({termRef:h,surfaceRef:r,mainRef:u,currentScaleRef:p,addToast:Z,t:V}),Re=Xn(fe),Xe=hC({termRef:h,isController:ne,warnViewerMode:ue,uploadImage:ve,addToast:Z,t:V,onPaste:()=>De.discard("paste"),subscribeToPasteFileReady:se}),gt=wT({termRef:h,containerRef:l,frameRef:o,surfaceRef:r,currentScaleRef:p,rendererRef:m,initialBannerWrittenRef:g,isActiveRef:Ae,sendResize:ye,onResized:()=>De.forget("resize")});U5({containerRef:l,surfaceRef:r,termRef:h,rendererRef:m,currentScaleRef:p,initialBannerWrittenRef:g,live:we,selection:Re,prediction:De,fit:gt,isTouchDevice:y,debug:w?S:null,terminalFontSize:j,terminalFontFamily:H,hostTheme:ae,glyphRevision:D.glyphRevision,terminalResetVersion:oe,isActive:n,subscribeToOutput:de,onOutput:w?E:null,onTitle:tt,onRendererKind:N});const ht=Qn.useMemo(()=>{var kt;return((kt=z.find(Jn=>Jn.id===K))==null?void 0:kt.displayName)??null},[z,K]);T.useEffect(()=>{W!=="connected"&&tt(null)},[W]),T.useEffect(()=>{const kt=n&&W==="connected",Jn=R.agentAlertBadge?vs(P):null;qS(kt?rt:null,ht,Jn)},[n,W,rt,ht,P,R.agentAlertBadge]),T.useEffect(()=>{W==="disconnected"&&J()},[]);const An=kt=>{kt.preventDefault()};return f.jsxs("main",{ref:u,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:An,"aria-label":V("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:l,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:An,"aria-label":V("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:o,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:r,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),w&&f.jsx(fC,{debug:x,rttMs:le,metrics:M,rendererKind:k,predictiveEcho:R.predictiveEcho,predictor:De.predictorRef.current,field:((gn=De.fieldProbeRef.current)==null?void 0:gn.detect())??null,renderer:m.current}),y&&fe.selectionRect&&fe.isHighlightVisible&&f.jsx(_T,{term:h.current,surface:r.current,main:u.current,rect:fe.selectionRect,viewportY:fe.viewportY}),y&&fe.selectionMenu&&f.jsx(lC,{anchorPoint:fe.selectionMenu,hasSelection:!!fe.selectionSnapshot,isController:ne,vibrateOnKeyPress:R.vibrateOnKeyPress,linkUrl:fe.selectionMenu.link??null,onOpenLink:kt=>{Cd(kt)||Z("warning",V("clipboard.openLinkFailed"))},onCopySelection:fe.handleCopySelection,onCopyLine:fe.handleCopyLine,onCopyScreen:fe.handleCopyScreen,onPaste:Xe.handlePaste,onClose:fe.clearSelection}),y&&f.jsx(aC,{isOpen:Xe.isPasteFallbackOpen,onClose:Xe.closePasteFallback,onSend:Xe.handleFallbackPasteSend,onSendImage:Xe.handleFallbackImageSend})]})},I5=2e3;function Mr(){const{t:a}=Ne(),{addToast:n}=Vt(),[l,o]=T.useState(null),r=T.useRef(null);T.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const u=T.useCallback((h,p,m="success")=>{Kd(h).then(g=>{if(g==="failed"){n("error",a("clipboard.copyFailed"));return}o(h),n(m,p),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>o(null),I5)})},[n,a]);return{copied:l,copy:u}}const ia="herdr-remote pair",tb="herdr-remote",F5=({onPairedSuccess:a})=>{const{settings:n,updateSettings:l,t:o}=Ne(),{connect:r,connectionState:u,stateDetail:h}=et(),{addToast:p}=Vt(),[m,g]=T.useState(""),{copied:y,copy:v}=Mr(),[w,x]=T.useState(!1),[S,M]=T.useState(n.wsUrl||Rt),[E,k]=T.useState(n.token||""),[N,R]=T.useState(n.clientId||""),H=z=>v(z,o("toasts.commandCopied")),j=z=>{z.preventDefault();const K=m.trim().toUpperCase();if(!K&&!E.trim()){p("warning",o("toasts.connectionError"));return}const V={pairCode:K,wsUrl:S.trim()||Rt,clientId:N.trim()||n.clientId};E.trim()&&(V.token=E.trim()),l(V),r({pairCode:K||void 0,token:E.trim()||void 0,wsUrl:S.trim()||Rt,clientId:N.trim()||n.clientId}),a&&a()},D=u==="connecting"||u==="reconnecting",_=({n:z})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",z,"]"]});return f.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:f.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[f.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("h1",{className:"text-tui font-bold text-tui-text",children:o("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:o("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:o("onboarding.description")})]}),u==="error"&&f.jsxs(_i,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:()=>r(),children:o("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:o("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:h||o("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:j,className:"grid gap-3",children:[f.jsx(Nt,{title:o("onboarding.step1Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[f.jsx(_,{n:1}),f.jsx("span",{className:"leading-snug",children:o("onboarding.step1Desc")})]}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:ia}),f.jsx(Me,{onClick:()=>H(ia),glyph:y===ia?Ee.check:"⧉",className:te("shrink-0",y===ia&&"border-tui-ok text-tui-ok"),children:o(y===ia?"common.copied":"common.copy")})]}),f.jsx("div",{className:"space-y-0.5 text-tui-sm",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:o("onboarding.step1TuiNote")}),f.jsx("button",{type:"button",onClick:()=>H(tb),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:o("common.clickToCopy"),children:f.jsx("code",{children:tb})})]})})]})}),f.jsx(Nt,{title:o("onboarding.step2Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(_,{n:2}),f.jsx(vt,{type:"text",value:m,onChange:z=>g(z.target.value.toUpperCase()),placeholder:o("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":o("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:o("onboarding.step2Note")})]})}),f.jsx(Me,{variant:"primary",type:"submit",block:!0,disabled:D,className:"py-1.5",children:D?f.jsx(la,{label:o("onboarding.connectingAndPairing")}):o("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>x(!w),"aria-expanded":w,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:w?Ee.chevronDown:Ee.chevronRight}),f.jsx("span",{className:"uppercase",children:o("onboarding.advancedTitle")})]}),w&&f.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-token",children:o("onboarding.manualTokenLabel")}),f.jsx(vt,{id:"onboarding-token",type:"password",value:E,onChange:z=>k(z.target.value),placeholder:o("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-ws",children:o("onboarding.wsEndpointLabel")}),f.jsx(vt,{id:"onboarding-ws",type:"text",value:S,onChange:z=>M(z.target.value),placeholder:o("onboarding.wsEndpointPlaceholder")})]}),f.jsx(DS,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"onboarding-client-id",children:o("onboarding.clientIdLabel")}),f.jsx(vt,{id:"onboarding-client-id",type:"text",value:N,onChange:z=>R(z.target.value)})]})]})]})]})]})})},Wn="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Ms="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",G5="border-tui-accent bg-tui-accent text-tui-crust font-bold",Y5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",qy={default:Ms,bad:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust"};function P5(a){return{capHeight:a?"h-8":"h-7",keyClass:a?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:a?"h-8 w-8":"h-7 w-7",drawerToggleClass:a?"h-8 px-1.5":"h-7 px-1.5"}}function $5({capHeight:a,onCustomize:n,sendCombo:l}){const{settings:o,t:r}=Ne(),{agentProfile:u,shellProfile:h}=et(),p=Zx(u,o.agentKeymaps[u],h),m=y=>{let v="";try{v=cs(y.combo)}catch{}const w=y.custom?y.customLabel||"":r(`agentActions.${y.labelKey}`),x=y.labelKey==="interrupt"&&y.combo.trim().toLowerCase()==="ctrl+c"?"bad":y.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${y.id}`,onClick:()=>l(y.combo),className:te(Wn,a,"max-w-[10rem] gap-1 px-1.5",qy[x]),title:`${v} ${w}`.trim(),"aria-label":`${v} ${w}`.trim(),children:[f.jsx("span",{className:"font-bold",children:v}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:w})]},y.id)},g=[...p.agentActions,...p.genericActions];return g.length===0&&!n?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${na[u].name} ${r("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),g.map(m),n&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:n,className:te(Wn,a,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:r("agentKeymaps.customizeBar"),"aria-label":r("agentKeymaps.customizeBar"),children:r("agentKeymaps.customizeBarShort")})]})}const Vy="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function q5({capHeight:a,onKey:n}){return f.jsx("div",{className:"grid grid-cols-6 gap-1 border-b border-tui-border-dim bg-tui-crust p-1.5 sm:grid-cols-12",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(l=>{const o=`F${l}`;return f.jsxs("button",{type:"button",onClick:()=>n(re[o]),className:te(Wn,Ms,a),children:["F",l]},o)})})}const V5=[{code:re.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:re.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:re.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:re.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:re.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:re.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:re.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:re.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function X5({capHeight:a,onKey:n}){const{t:l}=Ne();return f.jsx("div",{className:Vy,children:V5.map(o=>f.jsxs("button",{type:"button",onClick:()=>n(o.code,!1),className:te(Wn,a,"gap-1.5 px-2",qy[o.tone??"default"]),title:l(o.title),children:[f.jsx("span",{className:"font-bold",children:o.caption}),f.jsx("span",{className:"text-tui-sm opacity-70",children:l(o.badge)})]},o.caption))})}const Z5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function Q5({squareKeyClass:a,onKey:n}){return f.jsx("div",{className:Vy,children:Z5.map(l=>f.jsx("button",{type:"button",onClick:()=>n(l,!0),className:te(Wn,Ms,a,"font-bold"),children:l},l))})}const nb="image/png,image/jpeg,image/webp,image/gif,image/*";function ib({fileInputRef:a}){const{uploadImage:n}=Sr(),l=o=>{var u;const r=(u=o.target.files)==null?void 0:u[0];o.target.value="",r&&n(r)};return f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:a,type:"file",accept:nb,className:"hidden","data-testid":"key-toolbar-file-input",onChange:l}),f.jsx("input",{type:"file",accept:nb,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:l})]})}function ab({collapsed:a}){const{uploadProgress:n}=Sr();return n.active?f.jsx("div",{"data-testid":a?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:f.jsx(US,{ratio:n.ratio,label:n.statusText,tone:n.phase==="completed"?"ok":n.phase==="error"?"bad":"accent","aria-label":n.statusText})}):null}function W5({fileInputRef:a,keyClass:n,vibrate:l}){const{t:o}=Ne(),{isController:r}=et(),{warnViewerMode:u}=Cs(),{uploadProgress:h}=Sr(),p=h.active,m=()=>{var g;if(l(),!r){u();return}p||(g=a.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:m,disabled:p,className:te(Wn,n,p?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Ms),title:p?h.statusText:o("virtualKeyboard.uploadImageTitle"),"aria-label":o("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:p?`${h.percent}%`:o("virtualKeyboard.image")})})}function J5(){const{settings:a}=Ne(),{isController:n}=et(),{sendKey:l,warnViewerMode:o,consumeModifierLatch:r}=Cs(),u=T.useRef([]);T.useEffect(()=>()=>{for(const g of u.current)clearTimeout(g);u.current=[]},[]);const h=T.useCallback(()=>{if(a.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[a.vibrateOnKeyPress]),p=T.useCallback((g,y=!0)=>{if(h(),!n){o();return}const v=r();l(y&&v?cr(g,v):g)},[n,l,o,h,r]),m=T.useCallback(g=>{if(h(),!n){o();return}let y;try{y=Tn(g)}catch{return}if(r(),y.length===1){l(y[0]);return}y.forEach((v,w)=>{const x=setTimeout(()=>{u.current=u.current.filter(S=>S!==x),l(v)},w*120);u.current.push(x)})},[r,n,l,h,o]);return{vibrate:h,pressKey:p,sendCombo:m}}function eM({capHeight:a}){const{platform:n,adminTerminalSupported:l,adapter:o}=et(),{t:r}=Ne();if(n!=="win32")return null;const u=l!==!1;return f.jsxs("button",{type:"button","data-testid":"new-admin-terminal",onClick:()=>o==null?void 0:o.sendAdminTabOpen(),disabled:!u,className:te(Wn,a,"shrink-0 gap-1 border-amber-500/50 bg-amber-500/10 px-2 text-amber-200 hover:border-amber-400 hover:bg-amber-500/20 disabled:cursor-not-allowed disabled:opacity-50"),title:r(u?"terminal.adminTerminalSetup":"terminal.adminTerminalUpdate"),"aria-label":r("terminal.newAdminTerminal"),children:[f.jsx("span",{"aria-hidden":"true",children:"⬆"}),f.jsx("span",{children:r("terminal.adminShort")})]})}const tM=({compact:a=!1,onCustomize:n})=>{const{settings:l,updateSettings:o,t:r}=Ne(),{modifierLatch:u,toggleModifierLatch:h}=Cs(),{vibrate:p,pressKey:m,sendCombo:g}=J5(),{capHeight:y,keyClass:v,squareKeyClass:w,drawerToggleClass:x}=P5(a),S=T.useRef(null),[M,E]=T.useState(!1),[k,N]=T.useState(!1),[R,H]=T.useState(!1),j=T.useRef(null),[D,_]=T.useState(!1),z=T.useCallback(()=>{const P=j.current;_(!!P&&P.scrollLeft+P.clientWidth<P.scrollWidth-1)},[]);if(T.useEffect(z),T.useEffect(()=>{const P=j.current;if(!P||typeof ResizeObserver!="function")return;const A=new ResizeObserver(z);return A.observe(P),()=>A.disconnect()},[z,l.toolbarVisible]),!l.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[f.jsx(ib,{fileInputRef:S}),f.jsx(ab,{collapsed:!0}),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>o({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:r("virtualKeyboard.expandToolbar"),"aria-label":r("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:r("common.keyBar")})]})})]});const K=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys.filter(P=>P.enabled):Kb,V=P=>P.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):P.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):P.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):P.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):P.id==="enter"?f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",children:"⏎"}),f.jsx("span",{className:"hidden sm:inline",children:r("virtualKeyboard.keyEnter")})]}):P.id==="drawer_chords"?f.jsx("span",{children:"^C"}):P.id==="drawer_fn"?f.jsxs("span",{className:"flex items-center gap-0.5",children:[f.jsx("span",{children:"Fn"}),f.jsx("span",{"aria-hidden":"true",children:M?"▾":"▴"})]}):f.jsx("span",{children:P.label}),ne=P=>{if(p(),P.type==="modifier"){P.modifierType==="ctrl"||P.modifierType==="alt"||P.modifierType==="shift"?h(P.modifierType):P.modifierType==="meta"&&m(re.ESC);return}if(P.type==="drawer"){P.drawerType==="fn"?(E(!M),N(!1),H(!1)):P.drawerType==="chords"?(H(!R),E(!1),N(!1)):P.drawerType==="symbols"&&(N(!k),E(!1),H(!1));return}m(P.code,P.type!=="chord")},W=P=>{if(P.type==="modifier"){if(P.modifierType==="ctrl")return u.ctrl;if(P.modifierType==="alt")return u.alt;if(P.modifierType==="shift")return u.shift}if(P.type==="drawer"){if(P.drawerType==="fn")return M;if(P.drawerType==="chords")return R;if(P.drawerType==="symbols")return k}return!1},ie=P=>{const A=W(P),I=["left","up","down","right"].includes(P.id),J=P.type==="drawer",le=pd(P,r);return f.jsx("button",{type:"button",onClick:()=>ne(P),className:te(Wn,I?w:J?x:v,P.id==="enter"?Y5:A?G5:Ms),title:le,"aria-label":le,"aria-pressed":A,children:V(P)},P.id)},oe=K.find(P=>P.id==="enter");return f.jsxs("div",{"data-testid":"key-toolbar",className:te("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",a?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":r("virtualKeyboard.touchKeyboardShortcuts"),children:[f.jsx(ib,{fileInputRef:S}),f.jsx(ab,{collapsed:!1}),M&&f.jsx(q5,{capHeight:y,onKey:m}),R&&f.jsx(X5,{capHeight:y,onKey:m}),k&&f.jsx(Q5,{squareKeyClass:w,onKey:m}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:te("flex flex-nowrap items-center justify-start gap-1",a?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:j,"data-testid":"key-toolbar-scroll",onScroll:z,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[f.jsx("button",{type:"button",onClick:()=>o({toolbarVisible:!1}),className:te(Wn,w,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:r("virtualKeyboard.collapseToolbar"),"aria-label":r("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),K.filter(P=>P.id!=="enter").map(ie),f.jsx(eM,{capHeight:y}),f.jsx($5,{capHeight:y,onCustomize:n,sendCombo:g}),f.jsx(W5,{fileInputRef:S,keyClass:v,vibrate:p})]}),D&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),oe&&ie(oe)]})]})},nM=({isOpen:a,onClose:n})=>{const{t:l}=Ne(),{isController:o,shellProfile:r}=et(),{sendKey:u,warnViewerMode:h}=Cs(),[p,m]=T.useState("");if(!a)return null;const g=jw(r),y=w=>{if(w&&w.preventDefault(),!o){h();return}p.length>0?(u(`${p}\r`),m("")):u("\r")},v=w=>{if(!o){h();return}u(`${w}\r`)};return f.jsxs("section",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2","aria-label":l("virtualKeyboard.helperTitle"),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:l("virtualKeyboard.helperTitle")}),f.jsx(Me,{variant:"ghost",onClick:n,"aria-label":l("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:g.map(w=>f.jsx("button",{type:"button",onClick:()=>v(w),className:"tui-focusable shrink-0 select-none border border-tui-border bg-tui-surface px-2 py-0.5 text-tui-sm text-tui-muted transition-colors hover:border-tui-accent hover:text-tui-accent",children:w},w))}),f.jsxs("form",{onSubmit:y,className:"flex items-center gap-1.5",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),f.jsxs("div",{className:"relative flex-1",children:[f.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:l("virtualKeyboard.placeholder")}),f.jsx(vt,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:p,onChange:w=>m(w.target.value),placeholder:l("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),p.length>0&&f.jsx("button",{type:"button",onClick:()=>m(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":l("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:Ee.cross})})]}),f.jsx(Me,{variant:"primary",type:"submit",title:l("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:l("virtualKeyboard.sendButton")})})]})]})};function Ar(a,n){const l=(o,r)=>n?n(o):r;switch(a){case"connected":return{label:l("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:l("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:l("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:l("connection.reconnectNow","Reconnect now")};case"error":return{label:l("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:l("connection.retry","Retry")};default:return{label:l("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:l("connection.connect","Connect")}}}const iM={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},aM=({isOpen:a,onClose:n})=>{const{settings:l,updateSettings:o,t:r,activeProfile:u,activeProfileId:h,renameProfile:p}=Ne(),{connect:m,disconnect:g,connectionState:y,hostId:v}=et(),{addToast:w}=Vt(),[x,S]=T.useState(l.wsUrl),[M,E]=T.useState(l.token),[k,N]=T.useState(l.pairCode),[R,H]=T.useState(l.clientId),[j,D]=T.useState((u==null?void 0:u.displayName)||""),[_,z]=T.useState(l.autoReconnect),{copied:K,copy:V}=Mr(),ne=K!==null;if(T.useEffect(()=>{a&&(S(l.wsUrl),E(l.token),N(l.pairCode),H(l.clientId),D((u==null?void 0:u.displayName)||""),z(l.autoReconnect))},[a,l,u]),!a)return null;const W=A=>{A.preventDefault();const I={wsUrl:x.trim()||Rt,token:M.trim(),pairCode:k.trim().toUpperCase(),clientId:R.trim()||l.clientId,autoReconnect:_};if(!I.token&&!I.pairCode){w("warning",r("pairing.credentialsRequired"));return}o(I),h&&j.trim()&&p(h,j),g(),m({wsUrl:I.wsUrl,token:I.token||void 0,pairCode:I.pairCode||void 0,clientId:I.clientId,autoReconnect:_}),n()},ie=()=>{const A=`client-${Math.random().toString(36).substring(2,8)}`;H(A)},oe=()=>{const A=new URL(window.location.href);A.search="",k.trim()&&A.searchParams.set("pairCode",k.trim().toUpperCase()),V(A.toString(),r("toasts.pairingLinkCopied"))},P=iM[y]??"idle";return f.jsxs(Ts,{isOpen:a,onClose:n,title:r("pairing.title"),subtitle:r("pairing.subtitle"),closeLabel:r("common.closeDialog"),hints:[{keys:"esc",action:r("common.close")},{keys:"⏎",action:r("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[y==="connected"&&f.jsx(Me,{variant:"danger",onClick:()=>{g(),n()},children:r("common.disconnect")}),f.jsx(Me,{variant:"primary",type:"submit",form:"pairing-form",children:r("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(dn,{level:P}),f.jsx("span",{className:"text-tui-muted",children:r("common.status")}),f.jsx("span",{className:te(P==="ok"?"text-tui-ok":P==="bad"?"text-tui-bad":P==="warn"?"text-tui-warn":"text-tui-faint"),children:Ar(y,r).label})]}),v&&f.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[r("common.host")," ",f.jsx("span",{className:"text-tui-text",children:v})]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:W,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-name",children:r("pairing.displayNameLabel")}),f.jsx(vt,{id:"pairing-name",type:"text",value:j,onChange:A=>D(A.target.value),placeholder:r("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:r("pairing.displayNameHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-code",hint:r("pairing.pairCodeNote"),children:r("pairing.pairCodeLabel")}),f.jsx(vt,{id:"pairing-code",type:"text",value:k,onChange:A=>N(A.target.value.toUpperCase()),placeholder:r("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:r("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-token",hint:r("pairing.tokenNote"),children:r("pairing.tokenLabel")}),f.jsx(vt,{id:"pairing-token",type:"password",value:M,onChange:A=>E(A.target.value),placeholder:r("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-ws",children:r("pairing.wsUrlLabel")}),f.jsx(vt,{id:"pairing-ws",type:"text",value:x,onChange:A=>S(A.target.value),placeholder:r("pairing.wsUrlPlaceholder")}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:r("pairing.wsUrlDefaultNote")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-client-id",children:r("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(vt,{id:"pairing-client-id",type:"text",value:R,onChange:A=>H(A.target.value),className:"flex-1"}),f.jsx(Me,{onClick:ie,title:r("pairing.regenerateClientIdTitle"),className:"shrink-0",children:r("pairing.newIdButton")})]})]}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(HS,{checked:_,onChange:z,label:r("pairing.autoReconnectLabel"),description:r("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(Me,{onClick:oe,block:!0,glyph:ne?Ee.check:"⧉",className:te(ne&&"border-tui-ok text-tui-ok"),children:r("pairing.copyDirectLink")})})]})]})},lM=({isOpen:a,onClose:n})=>{const{t:l,addProfileAndConnect:o}=Ne(),{addToast:r}=Vt(),[u,h]=T.useState(""),[p,m]=T.useState(!1),[g,y]=T.useState(Rt),[v,w]=T.useState("");T.useEffect(()=>{a&&(h(""),m(!1),y(Rt),w(""))},[a]);const x=S=>{S.preventDefault();const M=u.trim().toUpperCase();if(!M&&!v.trim()){r("warning",l("pairing.credentialsRequired"));return}o({wsUrl:g.trim()||Rt,pairCode:M,token:v.trim()}),n()};return f.jsx(Ts,{isOpen:a,onClose:n,title:l("pairing.addTitle"),subtitle:l("pairing.addSubtitle"),closeLabel:l("common.closeDialog"),size:"sm",hints:[{keys:"esc",action:l("common.close")},{keys:"⏎",action:l("pairing.pairAndConnect")}],footer:f.jsx(Me,{variant:"primary",type:"submit",form:"add-host-form",children:l("pairing.pairAndConnect")}),children:f.jsxs("form",{id:"add-host-form",onSubmit:x,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-code",hint:l("pairing.pairCodeNote"),children:l("pairing.pairCodeLabel")}),f.jsx(vt,{id:"add-host-code",type:"text",value:u,onChange:S=>h(S.target.value.toUpperCase()),placeholder:l("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",autoFocus:!0,className:"font-bold uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:l("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"border border-tui-border-dim",children:[f.jsxs("button",{type:"button",onClick:()=>m(!p),"aria-expanded":p,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:p?Ee.chevronDown:Ee.chevronRight}),f.jsx("span",{children:l("pairing.advancedTitle")}),f.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint",children:l("pairing.advancedHint")})]}),p&&f.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-ws",children:l("pairing.wsUrlLabel")}),f.jsx(vt,{id:"add-host-ws",type:"text",value:g,onChange:S=>y(S.target.value),placeholder:l("onboarding.wsEndpointPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"add-host-token",hint:l("pairing.tokenNote"),children:l("pairing.tokenLabel")}),f.jsx(vt,{id:"add-host-token",type:"password",value:v,onChange:S=>w(S.target.value),placeholder:l("onboarding.manualTokenPlaceholder")})]})]})]})]})})},ki=te(Tr,"py-0"),sM="h-7 py-0",Nd="h-7 py-0 px-1.5",xr="text-tui-bad hover:border-tui-bad hover:text-tui-bad",oM=["grid items-center gap-x-2 gap-y-1 py-1","grid-cols-[4rem_minmax(0,1fr)_9rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[4rem_minmax(0,1fr)_9rem_9rem_7rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" ");function Xy(a){return{offLabel:a("settings.toggleOff"),onLabel:a("settings.toggleOn")}}const rM=({profile:a,onProfileChange:n})=>{const{settings:l,updateSettings:o,t:r}=Ne(),{agentProfile:u}=et(),[h,p]=T.useState({}),m=T.useRef({}),[g,y]=T.useState(""),[v,w]=T.useState(""),x=a||u,S=l.agentKeymaps[x]||{},M=wb(x,S),E=Sb(x,S),k=E.filter(A=>!A.hidden).length,N=A=>A.custom?A.customLabel||"":r(`agentActions.${A.labelKey}`),R=A=>{try{return cs(A.combo)}catch{return A.combo}},H=A=>{o({agentKeymaps:{...l.agentKeymaps,[x]:A}})},j=(A,I)=>{var J;H({...S,actions:{...S.actions,[A]:{...(J=S.actions)==null?void 0:J[A],...I}}})},D=A=>{j(A.id,{keys:A.defaultCombo})},_=(A,I)=>{const J=A+(I==="up"?-1:1);if(J<0||J>=M.length)return;const le=M.map(Z=>Z.id);[le[A],le[J]]=[le[J],le[A]],H({...S,order:le})},z=A=>{var I;H({...S,custom:(S.custom||[]).filter(J=>J.id!==A),order:(I=S.order)==null?void 0:I.filter(J=>J!==A)})},K=()=>H(Qx(S)),V=()=>{const A={...l.agentKeymaps};delete A[x],o({agentKeymaps:A})},ne=()=>{const A=g.trim();if(!A)return;try{Tn(v)}catch{return}const I=`custom-${Date.now().toString(36)}`;H({...S,custom:[...S.custom||[],{id:I,label:A,keys:v.trim()}],order:[...M.map(J=>J.id),I]}),y(""),w("")},W=A=>A instanceof Cn?r(`agentKeymaps.errors.${A.code}`,A.params):String(A),ie=(A,I)=>`${A}:${I}`,oe=(A,I)=>{const J=ie(x,A);m.current={...m.current,[J]:I},p(m.current);try{Tn(I),j(A,{keys:I})}catch{}},P=A=>{const I=ie(x,A),J=m.current[I];if(J!==void 0){delete m.current[I],p({...m.current});try{Tn(J),j(A,{keys:J})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(pn,{title:r("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Me,{variant:"ghost",onClick:V,className:te(xr,Nd),children:r("agentKeymaps.restoreProfile")}),children:f.jsx(Kt,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:na[x].configHint?r("agentKeymaps.configHint",{path:na[x].configHint}):void 0,control:f.jsx(Cr,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:x,onChange:A=>n(A.target.value),className:ki,children:Kx.map(A=>f.jsx("option",{value:A,children:na[A].name},A))})})}),f.jsx(pn,{title:r("agentKeymaps.barGroup"),aside:f.jsx(Me,{variant:"ghost",onClick:K,className:te(xr,Nd),children:r("agentKeymaps.restoreBar")}),children:f.jsxs("div",{className:"space-y-2 py-1.5",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("agentKeymaps.barHint",{profile:na[x].name,count:k})}),f.jsx("div",{role:"group","aria-label":r("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:E.map(A=>{const I=N(A),J=R(A),le=!A.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${A.id}`,"aria-pressed":le,onClick:()=>j(A.id,{hidden:le}),title:`${J} ${I}`.trim(),className:te("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",le?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold",children:le?Ee.check:"+"}),f.jsx("span",{className:"font-bold",children:J}),f.jsx("span",{className:le?void 0:"opacity-80",children:I})]},A.id)})})]})}),f.jsx(pn,{title:r("agentKeymaps.listGroup",{profile:na[x].name}),children:M.map((A,I)=>{var ue,de;const J=N(A),le=r("agentKeymaps.defaultCombo",{combo:cs(A.defaultCombo)}),Z=((de=(ue=S.actions)==null?void 0:ue[A.id])==null?void 0:de.keys)??A.combo,ye=ie(x,A.id),xe=h[ye]??Z;let ce="",Te=null;try{Tn(xe),ce=cs(xe)}catch(se){Te=W(se)}return f.jsxs("div",{"data-testid":`agent-setting-row-${A.id}`,className:oM,children:[f.jsx(by,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:ce||"—"}),f.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:J,children:[J,!A.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${A.id}`,children:[r("agentKeymaps.shortcutLabel")," ",J]}),f.jsx(vt,{id:`agent-combo-${A.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${J}`,value:xe,onChange:se=>oe(A.id,se.target.value),onBlur:()=>P(A.id),onKeyDown:se=>{se.key==="Enter"&&se.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Te,className:te("w-full min-w-0 [grid-area:combo]",sM)}),f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:le,children:le}),f.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[f.jsx(aa,{onClick:()=>D(A),title:r("agentKeymaps.resetAction"),"aria-label":`${r("agentKeymaps.resetAction")} ${J}`,children:"↺"}),f.jsx(aa,{disabled:I===0,onClick:()=>_(I,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${J}`,children:"↑"}),f.jsx(aa,{disabled:I===M.length-1,onClick:()=>_(I,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${J}`,children:"↓"}),A.custom?f.jsx(aa,{variant:"danger",onClick:()=>z(A.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${J}`,children:Ee.cross}):f.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),Te&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:r("agentKeymaps.invalidCombo",{error:Te})})]},A.id)})}),f.jsx(pn,{title:r("agentKeymaps.addCustom"),children:f.jsxs("div",{className:"space-y-1 py-1.5",children:[f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customLabel")}),f.jsx(vt,{value:g,onChange:A=>y(A.target.value),className:ki})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:r("agentKeymaps.customCombo")}),f.jsx(vt,{value:v,onChange:A=>w(A.target.value),placeholder:r("agentKeymaps.comboPlaceholder"),className:ki})]}),f.jsx(Me,{variant:"primary",glyph:"+",onClick:ne,disabled:!g.trim()||!v.trim(),className:ki,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return Tn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:cs(v)})}catch(A){const I=W(A);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:I})}})()]})})]})},Zy={"gnome-terminal":"GNOME Terminal",ptyxis:"Ptyxis",tilix:"Tilix",konsole:"Konsole","xfce4-terminal":"Xfce Terminal",kitty:"kitty",alacritty:"Alacritty",ghostty:"Ghostty",wezterm:"WezTerm",foot:"foot",vscode:"VS Code",iterm2:"iTerm2","apple-terminal":"Terminal",xterm:"xterm",urxvt:"urxvt"},cM=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],uM=()=>{const{hostFont:a,loadHostFont:n,declineHostFont:l,settings:o,activeProfile:r,t:u}=Ne(),{herdrLaunch:h,hostname:p}=et(),{addToast:m}=Vt(),{font:g,status:y,glyphs:v}=a,w=y==="loading"||v.status==="loading",x=y==="failed"||v.status==="failed",S=T.useRef(!1);T.useEffect(()=>{S.current&&!w&&!x&&a.interactive&&m("success",u("hostFont.loaded")),S.current=w&&a.interactive},[w,x,a.interactive,m,u]);const M=y==="available"||v.status==="available",E=a.interactive&&(w||x);if(!(g&&o.fontFamily==="host"&&!h&&(M||E)))return null;const N=y==="available"||a.interactive&&(y==="loading"||y==="failed"),R=v.source&&(v.status==="available"||a.interactive&&(v.status==="loading"||v.status==="failed")),H=p||(r==null?void 0:r.displayName)||u("herdrLaunch.thisHost"),j=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?Zy[g.source]||g.source:null].filter(Boolean).join(u("hostFont.detailSeparator")),D=a.error&&cM.includes(a.error)?a.error:"other",_=a.totalBytes?a.receivedBytes/a.totalBytes:0;return f.jsx("div",{"data-testid":"host-font-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsxs(Nt,{title:u("hostFont.title"),tone:y==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":u("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:N||!v.source?u("hostFont.body",{host:H,family:g.family,detail:j?u("hostFont.detail",{detail:j}):""}):u("hostFont.bodyGlyphsOnly",{host:H,family:v.source.family})}),w?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(BS,{value:_,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:u("hostFont.loading",{received:qu(a.receivedBytes),total:qu(a.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[x?f.jsx(_i,{tone:"bad",children:u("hostFont.failed",{reason:u(`hostFont.reasons.${D}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[N&&g.faces.length?f.jsx("p",{children:u("hostFont.download",{count:g.faces.length,size:qu(a.totalBytes)})}):null,R&&v.source?f.jsx("p",{children:u(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),f.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[f.jsx(Me,{onClick:l,children:u("hostFont.decline")}),f.jsx(Me,{variant:"primary",onClick:n,autoFocus:!0,children:u(x?"common.retry":"hostFont.load")})]})]})]})})},dM=({onOpenAdmin:a})=>{var j;const{settings:n,updateSettings:l,language:o,setLanguage:r,t:u,hostFont:h,syncHostFont:p,terminalFontFamily:m,terminalFontSize:g}=Ne(),{connectionState:y}=et(),v=ud.find(D=>D.id===n.fontFamily),w=(D,_)=>D==="host"||D==="system"?u(`fontPresets.${D}`):_,x=(()=>{const{font:D,status:_}=h,z=h.totalBytes?Math.round(h.receivedBytes/h.totalBytes*100):0,K=u(`settings.hostFontStatus.${_}`,{percent:z});return D?[D.family,D.sizePx?`${Math.round(D.sizePx)}px`:null,D.source?Zy[D.source]||D.source:null,K].filter(Boolean).join(" · "):K})(),S=(j=h.font)!=null&&j.sizePx?il(h.font.sizePx):null,M=h.glyphs.source&&h.glyphs.status!=="none"?u("settings.hostGlyphLine",{family:h.glyphs.source.family,status:u(`settings.hostGlyphStatus.${h.glyphs.status}`,{count:h.glyphs.covered.toLocaleString()})}):null,E=typeof window<"u"&&window.isSecureContext&&"Notification"in window,k=10,N=24,R=Xy(u),H=S?u("settings.fontSizeFollowHost",{size:S}):u("settings.fontSizeFollowHostUnknown");return f.jsxs("div",{className:"space-y-4",children:[f.jsx(pn,{title:u("settings.sectionInterface"),children:f.jsx(Kt,{label:u("settings.languageLabel"),hint:u("settings.languageHint"),control:f.jsx(xd,{name:"ui-language","aria-label":u("settings.languageLabel"),value:o,onChange:r,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),f.jsxs(pn,{title:u("settings.sectionFont"),children:[f.jsx(Kt,{label:u("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(Cr,{id:"terminal-font-select",value:n.fontFamily,onChange:D=>l({fontFamily:D.target.value}),"aria-label":u("settings.fontFamilyLabel"),className:ki,children:[!v&&f.jsx("option",{value:n.fontFamily,children:n.fontFamily}),ud.map(D=>f.jsx("option",{value:D.id,children:w(D.id,D.name)},D.id))]})}),n.fontFamily==="host"&&f.jsx(Kt,{label:u("settings.hostFontLabel"),hint:f.jsxs(f.Fragment,{children:[f.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:x}),M?f.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:M}):null]}),control:f.jsx(Me,{block:!0,onClick:p,disabled:y!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:ki,children:u("settings.hostFontSync")})}),f.jsx(Kt,{label:u("settings.fontSizeLabel",{size:g}),hint:u("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:te("flex items-center",Tr),children:f.jsx("input",{id:"terminal-font-size",type:"range",min:k,max:N,step:1,value:g,onChange:D=>l({fontSize:Number(D.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),f.jsx(Kt,{label:H,control:f.jsx(Ei,{label:H,...R,checked:n.fontSizeFollowsHost,onChange:D=>l(D?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),f.jsx("div",{className:"py-1.5",children:f.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:m,fontSize:`${g}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),f.jsxs(pn,{title:u("settings.sectionInput"),children:[f.jsx(Kt,{label:u("settings.predictiveEchoLabel"),hint:u("settings.predictiveEchoDesc"),control:f.jsx(xd,{name:"predictive-echo","aria-label":u("settings.predictiveEchoLabel"),value:n.predictiveEcho,onChange:D=>l({predictiveEcho:D}),options:[{value:"auto",label:u("settings.predictiveEchoAuto")},{value:"always",label:u("settings.predictiveEchoAlways")},{value:"off",label:u("settings.predictiveEchoOff")}]})}),f.jsx(Kt,{label:u("settings.touchKeyToolbar"),hint:u("settings.touchKeyToolbarDesc"),control:f.jsx(Ei,{label:u("settings.touchKeyToolbar"),...R,checked:n.toolbarVisible,onChange:D=>l({toolbarVisible:D})})}),f.jsx(Kt,{label:u("settings.touchHaptics"),hint:u("settings.touchHapticsDesc"),control:f.jsx(Ei,{label:u("settings.touchHaptics"),...R,checked:n.vibrateOnKeyPress,onChange:D=>l({vibrateOnKeyPress:D})})})]}),f.jsxs(pn,{title:u("settings.agentAlertsLabel"),children:[f.jsx(Kt,{label:u("settings.agentAlertBadge"),hint:u("settings.agentAlertBadgeDesc"),control:f.jsx(Ei,{label:u("settings.agentAlertBadge"),...R,checked:n.agentAlertBadge,onChange:D=>l({agentAlertBadge:D})})}),f.jsx(Kt,{label:u("settings.agentAlertVibrate"),hint:u("settings.agentAlertVibrateDesc"),control:f.jsx(Ei,{label:u("settings.agentAlertVibrate"),...R,checked:n.agentAlertVibrate,onChange:D=>l({agentAlertVibrate:D})})}),f.jsx(Kt,{label:u("settings.agentAlertSound"),hint:u("settings.agentAlertSoundDesc"),control:f.jsx(Ei,{label:u("settings.agentAlertSound"),...R,checked:n.agentAlertSound,onChange:D=>{l({agentAlertSound:D}),D&&(Qb(),Wb("done"))}})}),E&&f.jsx(Kt,{label:u("settings.agentAlertNotify"),hint:u("settings.agentAlertNotifyDesc"),control:f.jsx(Ei,{label:u("settings.agentAlertNotify"),...R,checked:n.agentAlertNotify,onChange:D=>{if(D&&Notification.permission!=="granted"){Notification.requestPermission().then(_=>l({agentAlertNotify:_==="granted"}));return}l({agentAlertNotify:D})}})})]}),a&&f.jsx(pn,{title:u("settings.sectionAdmin"),children:f.jsx(Kt,{label:u("settings.adminEntry"),hint:u("settings.adminEntryHint"),control:f.jsx(Me,{block:!0,variant:"primary",glyph:Ee.arrowRight,onClick:a,className:ki,children:u("settings.adminEntryOpen")})})})]})},fM=()=>{const{settings:a,updateSettings:n,t:l}=Ne(),{addToast:o}=Vt(),[r,u]=T.useState(!1),h=Xy(l),p=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys:ys(),m=x=>{const S=p.map(M=>M.id===x?{...M,enabled:!M.enabled}:M);n({virtualKeys:S})},g=(x,S)=>{const M=S==="up"?x-1:x+1;if(M<0||M>=p.length)return;const E=[...p],k=E[x];E[x]=E[M],E[M]=k,n({virtualKeys:E})},y=x=>{if(p.some(M=>M.id===x.id)){const M=p.map(E=>E.id===x.id?{...E,enabled:!0}:E);n({virtualKeys:M})}else{const M=[...p,{...x,enabled:!0}];n({virtualKeys:M})}u(!1)},v=x=>{const S=p.filter(M=>M.id!==x);n({virtualKeys:S})},w=()=>{n({virtualKeys:ys()}),o("info",l("toasts.keyLayoutReset"))};return f.jsxs("div",{className:"space-y-3",children:[f.jsx(pn,{title:l("virtualKeyboard.customizeTitle"),aside:f.jsx(Me,{variant:"ghost",onClick:w,className:te(xr,Nd),children:l("virtualKeyboard.resetLayout")}),children:p.map((x,S)=>{const M=pd(x,l);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(by,{className:te("w-16 shrink-0 truncate",!x.enabled&&"opacity-50"),children:x.label}),f.jsx("span",{className:te("min-w-0 flex-1 break-words text-tui",x.enabled?"text-tui-text":"text-tui-faint"),children:M}),f.jsx(Ei,{label:`${l("virtualKeyboard.enableKey")} ${x.label}`,...h,checked:x.enabled,onChange:()=>m(x.id),className:"h-7 w-24 shrink-0"}),f.jsx(aa,{disabled:S===0,onClick:()=>g(S,"up"),title:l("virtualKeyboard.moveUp"),"aria-label":l("virtualKeyboard.moveUp"),children:"↑"}),f.jsx(aa,{disabled:S===p.length-1,onClick:()=>g(S,"down"),title:l("virtualKeyboard.moveDown"),"aria-label":l("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(aa,{variant:"danger",onClick:()=>v(x.id),title:l("virtualKeyboard.deleteKeyTitle"),"aria-label":l("virtualKeyboard.deleteKeyTitle"),children:Ee.cross})]},x.id)})}),f.jsx(Me,{block:!0,glyph:"+",onClick:()=>u(!r),className:te("border-dashed",ki),children:l("virtualKeyboard.addKey")}),r&&f.jsx(pn,{title:l("virtualKeyboard.availableKeys"),children:f.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:g1.map(x=>{const S=p.some(M=>M.id===x.id);return f.jsxs("button",{type:"button",onClick:()=>y(x),title:pd(x,l),className:te("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",S?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{children:x.label}),f.jsx("span",{"aria-hidden":"true",className:S?"text-tui-ok":"text-tui-accent",children:S?Ee.check:"+"})]},x.id)})})})]})},hM=({isOpen:a,onClose:n,initialTab:l,onOpenAdmin:o})=>{const{updateSettings:r,t:u,activeProfile:h}=Ne(),{addToast:p}=Vt(),[m,g]=T.useState("general"),[y,v]=T.useState(null);if(T.useEffect(()=>{!a||!l||(g(l),v(null))},[a,l]),!a)return null;const w=()=>{const x=Gb();r({fontSize:x.fontSize,fontSizeFollowsHost:x.fontSizeFollowsHost,fontFamily:x.fontFamily,toolbarVisible:x.toolbarVisible,vibrateOnKeyPress:x.vibrateOnKeyPress,predictiveEcho:x.predictiveEcho,agentAlertBadge:x.agentAlertBadge,agentAlertSound:x.agentAlertSound,agentAlertVibrate:x.agentAlertVibrate,agentAlertNotify:x.agentAlertNotify,virtualKeys:x.virtualKeys}),p("info",u("settings.resetDefaultsToast"))};return f.jsxs(Ts,{isOpen:a,onClose:n,title:u("settings.title"),subtitle:h?u("settings.subtitleInstance",{name:h.displayName}):u("settings.subtitle"),closeLabel:u("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:u("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:w,className:xr,children:u("settings.resetDefaults")}),f.jsx(Me,{variant:"primary",onClick:n,children:u("common.done")})]}),children:[f.jsx(Hd,{tabs:[{id:"general",label:u("settings.tabGeneral"),index:1},{id:"virtualKeys",label:u("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:u("settings.tabAgentKeymaps"),index:3}],activeId:m,onSelect:x=>g(x),className:"mb-3 border-b border-tui-border-dim pb-1"}),m==="general"&&f.jsx(dM,{onOpenAdmin:o}),m==="virtualKeys"&&f.jsx(fM,{}),m==="agentKeymaps"&&f.jsx(rM,{profile:y,onProfileChange:v})]})},mM={success:"ok",warning:"warn",error:"bad",info:"accent"},pM={success:Ee.check,warning:Ee.warn,error:Ee.cross,info:"›"},gM=()=>{const{t:a}=Ne(),{toasts:n,removeToast:l}=Vt();return n.length===0?null:f.jsx("div",{className:"pointer-events-none fixed right-2 top-12 z-50 flex w-[calc(100vw-16px)] max-w-sm flex-col gap-1","aria-live":"polite","aria-atomic":"true",children:n.map(o=>{const r=mM[o.type];return f.jsxs("div",{className:te("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",cn[r].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:te("shrink-0 font-bold",cn[r].text),children:pM[o.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:o.message}),o.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",o.count]}),f.jsx("button",{type:"button",onClick:()=>l(o.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":a("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:Ee.cross})})]},o.id)})})},Qy=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function bM(a){return a?a.total>0||Qy.some(({status:n})=>{var l;return(((l=a.counts)==null?void 0:l[n])??0)>0}):!1}const Wy=({className:a,compact:n=!1})=>{const{t:l}=Ne(),{agentStatus:o}=et();if(!o)return null;const r=Qy.map(({status:h,level:p})=>{var m;return{status:h,level:p,count:((m=o.counts)==null?void 0:m[h])??0}}).filter(h=>h.count>0),u=n?r.slice(0,1):r;return u.length===0?o.total===0?null:f.jsxs("span",{"data-testid":"agent-status-chip",className:te("flex shrink-0 items-center gap-1 px-1 text-tui-muted",a),title:l("agents.title"),children:[f.jsx(dn,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:l("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:te("flex shrink-0 items-center gap-2 px-1",a),title:l("agents.title"),children:u.map(({status:h,level:p,count:m})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(dn,{level:p}),f.jsx("span",{className:"text-tui-text",children:m}),f.jsx("span",{className:"text-tui-faint",children:l(`agents.${h}`)})]},h))})},Gd=({onAddProfile:a,mobile:n=!1,statusBar:l=!1})=>{const{profiles:o,activeProfileId:r,activeProfile:u,switchProfile:h,renameProfile:p,removeProfile:m,t:g}=Ne(),{connectionState:y}=et(),[v,w]=T.useState(!1),[x,S]=T.useState(null),[M,E]=T.useState(""),k=T.useRef(null);T.useEffect(()=>{if(!v)return;const _=z=>{k.current&&!k.current.contains(z.target)&&w(!1)};return document.addEventListener("pointerdown",_),()=>document.removeEventListener("pointerdown",_)},[v]);const N=(_,z)=>{S(_),E(z)},R=_=>{const z=M.trim();z&&p(_,z),S(null)},H=_=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(m(_),S(null))},j=(u==null?void 0:u.displayName)||g("profiles.addHost"),D=y==="connected"?"ok":y==="connecting"||y==="reconnecting"?"warn":y==="error"?"bad":"idle";return f.jsxs("div",{ref:k,className:te("relative min-w-0",n&&"w-full",l&&"flex-1",!n&&!l&&"h-full"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>w(_=>!_),className:te("tui-focusable flex min-w-0 items-center gap-1.5 border border-transparent text-left text-tui-muted transition-colors hover:border-tui-border hover:text-tui-accent",l?"min-h-11 w-full max-w-none px-2":n?"min-h-11 w-full px-2":"h-full max-w-[18rem] px-1"),children:[f.jsx(dn,{level:D}),f.jsx("span",{className:te("truncate text-tui-text",l&&"min-w-0 flex-1"),children:j}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?Ee.chevronDown:Ee.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":g("profiles.switcherLabel"),className:te("absolute bottom-full left-0 z-[100] mb-1 max-h-[min(70vh,24rem)] overflow-y-auto border border-tui-border bg-tui-base p-1 shadow-lg",l?"w-80 max-w-[calc(100vw-1rem)]":n?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[f.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:g("profiles.title")}),o.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):o.map(_=>{const z=_.id===r,K=_.id===x;return f.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("button",{type:"button",role:"menuitem","aria-current":z?"true":void 0,onClick:()=>{h(_.id),w(!1)},className:te("tui-focusable flex min-h-11 min-w-0 flex-1 items-center gap-2 px-2 text-left text-tui transition-colors hover:bg-tui-selection",z?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:z?Ee.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:_.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:_.hostname||_.hostId,children:_.hostname||_.hostId||_.wsUrl})]}),z&&f.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:g("profiles.current")})]}),f.jsx("button",{type:"button",role:"menuitem","aria-label":g("profiles.rename"),title:g("profiles.rename"),onClick:()=>N(_.id,_.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Ee.ellipsis})]}),K&&f.jsxs("div",{className:"grid grid-cols-2 gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:M,maxLength:64,onChange:V=>E(V.target.value),onKeyDown:V=>{V.key==="Enter"&&R(_.id),V.key==="Escape"&&S(null)},"aria-label":g("profiles.rename"),className:"tui-input col-span-2 h-11 min-w-0 px-2 py-1 text-tui"}),f.jsx(Me,{onClick:()=>R(_.id),variant:"primary",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("common.save")}),f.jsx(Me,{onClick:()=>H(_.id),variant:"danger",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("profiles.remove")})]})]},_.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{w(!1),a()},className:"tui-focusable flex min-h-11 w-full items-center gap-2 px-2 text-left text-tui-accent hover:bg-tui-selection",children:[f.jsx("span",{"aria-hidden":"true",children:"+"}),f.jsx("span",{children:g("profiles.addHost")})]})]})]})},Jy=({compact:a=!1,className:n})=>{const{settings:l,updateSettings:o,t:r}=Ne(),{connectionState:u,sharedWindowCount:h,assignedClientId:p}=et(),m=l.observerMode,g=f.jsx(xd,{name:"control-mode","aria-label":r("role.modeLabel"),value:m?"observe":"control",onChange:y=>o({observerMode:y==="observe"}),tone:m?"warn":"ok",size:a?"sm":"md",options:[{value:"control",label:r("role.sharedControl")},{value:"observe",label:r("common.viewer")}],className:n});return a?g:f.jsxs("div",{className:"flex w-full flex-col gap-1",children:[g,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r(m?"role.observerHint":"role.controlHint")}),u==="connected"&&h>1?f.jsx("p",{className:"text-tui-sm text-tui-muted",children:r("role.sharedWindows",{count:h})}):null,p?f.jsx(Ni,{label:r("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:p})}):null]})};function e0(){const{updateStatus:a,ignoredUpdate:n}=et();return!!(a!=null&&a.updateAvailable)&&n!==(a==null?void 0:a.latest)}const t0=({compact:a=!1,className:n})=>{const{t:l}=Ne(),{updateStatus:o}=et(),r=e0(),[u,h]=T.useState(!1);if(!r||!o)return null;const{latest:p,restartPending:m}=o,g=m?l("update.chipRestart",{version:p}):a?l("update.chipCompact",{version:p}):l("update.chip",{version:p});return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:l("update.title"),className:te("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",n),children:g}),f.jsx(yM,{isOpen:u,onClose:()=>h(!1)})]})},tr=({command:a})=>{const{t:n}=Ne(),{addToast:l}=Vt();return f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:a}),f.jsx(Me,{glyph:"⧉",className:"shrink-0",onClick:()=>{Kd(a).then(o=>{l(o==="failed"?"error":"success",n(o==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:n("common.copy")})]})},yM=({isOpen:a,onClose:n})=>{const{t:l}=Ne(),{updateStatus:o,ignoreUpdate:r,hostname:u,hostId:h}=et();if(!o)return null;const{current:p,installed:m,latest:g,restartPending:y,updateCommand:v}=o;return f.jsx(Ts,{isOpen:a,onClose:n,title:l("update.title"),closeLabel:l("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(Me,{variant:"ghost",onClick:()=>{r(g),n()},children:l("update.ignore")}),f.jsx(Me,{variant:"primary",onClick:n,children:l("common.done")})]}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(Ni,{label:l("common.host"),labelWidth:10,children:u||h||"—"}),f.jsx(Ni,{label:l("update.running"),labelWidth:10,children:p}),m!==p?f.jsx(Ni,{label:l("update.installed"),labelWidth:10,children:m}):null,f.jsx(Ni,{label:l("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:g})})]}),y?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:l("update.restartPending",{version:m})}),f.jsx(tr,{command:"herdr-remote restart"})]}):f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"leading-snug text-tui-text",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:Ee.arrowRight}),l("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:l("update.stepCli")}),v?f.jsx(tr,{command:"herdr-remote update"}):f.jsxs(f.Fragment,{children:[f.jsx(tr,{command:`npm install -g herdr-remote@${g} --prefer-online`}),f.jsx(tr,{command:"herdr-remote restart"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:l("update.restartNote")})]})]})})},vM=({onAddProfile:a=()=>{}})=>{const{settings:n,t:l}=Ne(),{connectionState:o,hostId:r,assignedClientId:u,sharedWindowCount:h,rttMs:p,agentStatus:m}=et(),g=Ar(o,l),y=o==="connected",v=e0();return f.jsx(yy,{left:f.jsxs(f.Fragment,{children:[f.jsx(Gd,{onAddProfile:a}),f.jsx(wd,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(dn,{level:g.level}),f.jsx("span",{className:"text-tui-text",children:g.label})]},"status"),y?f.jsx(Jy,{compact:!0,className:"h-full w-auto"},"role"):null,y&&h>1?f.jsx("span",{className:"text-tui-muted",children:l("role.sharedWindows",{count:h})},"windows"):null,r?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[l("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:r})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:l("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:u||n.clientId})]},"client")]})]}),right:f.jsx(wd,{items:[v?f.jsx(t0,{},"update"):null,y&&bM(m)?f.jsx(Wy,{},"agents"):null,p!==null?f.jsxs("span",{className:"text-tui-muted",children:[l("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[p,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:l("header.tagline")},"mode")]})})},xM=({wsUrl:a,adminUrl:n,onOpenRemoteAdmin:l,onSignIn:o})=>{const{t:r}=Ne();return f.jsxs(Nt,{title:r("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:r("admin.remoteRelayNotice")}),f.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx(Ni,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:a})}),f.jsx(Ni,{label:r("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:n})})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Me,{variant:"primary",onClick:l,glyph:Ee.arrowRight,children:r("admin.openRemoteAdminBtn")}),f.jsx(Me,{onClick:o,children:r("admin.relayAdminLoginBtn")})]})]})},wM=({adminConfigured:a,isAuthError:n,tokenInput:l,onTokenInput:o,onSubmit:r,isSameOriginRelay:u,onBackToTerminal:h,showBack:p,onCancel:m})=>{const{t:g}=Ne();return f.jsxs(Nt,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[a===!1?f.jsx(_i,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):n?f.jsx(_i,{tone:"bad",children:g("admin.relayAdminAuthError")}):f.jsx(_i,{tone:"accent",children:g("admin.relayAdminPrompt")}),f.jsxs("form",{onSubmit:r,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),f.jsx(vt,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:l,onChange:y=>o(y.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Me,{variant:"primary",type:"submit",disabled:!l.trim(),children:g("admin.relayAdminLoginBtn")}),u?h&&!p?f.jsx(Me,{variant:"ghost",onClick:h,children:g("admin.returnToTerminal")}):null:f.jsx(Me,{variant:"ghost",onClick:m,children:g("common.cancel")})]})]})]})},SM=({onOpenPairing:a,onRetry:n})=>{const{t:l}=Ne(),{copied:o,copy:r}=Mr(),u=o!==null,h=()=>r(ia,l("toasts.commandCopied"));return f.jsxs(Nt,{title:l("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(_i,{tone:"bad",children:l("admin.unauthorizedDesc")}),f.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:l("admin.pairingStepsTitle")}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:ia}),f.jsx(Me,{onClick:h,glyph:u?Ee.check:"⧉",className:te("shrink-0",u&&"border-tui-ok text-tui-ok"),children:l(u?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:l("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[a&&f.jsx(Me,{variant:"primary",onClick:a,children:l("admin.enterPairCodeBtn")}),f.jsx(Me,{onClick:n,children:l("admin.retryFetchBtn")})]})]})},CM=[[/\biPhone\b/i,"iPhone"],[/\biPad\b/i,"iPad"],[/\biPod\b/i,"iPod"],[/\bAndroid\b/i,"Android"],[/\bCrOS\b/i,"ChromeOS"],[/\bWindows NT\b/i,"Windows"],[/\bMac OS X\b|\bMacintosh\b/i,"macOS"],[/\bLinux\b/i,"Linux"]],TM=[[/\bEdgA?\/|\bEdge\//i,"Edge"],[/\bOPR\/|\bOpera\//i,"Opera"],[/\bSamsungBrowser\//i,"Samsung Internet"],[/\bFirefox\/|\bFxiOS\//i,"Firefox"],[/\bCriOS\//i,"Chrome"],[/\bChrome\//i,"Chrome"],[/\bSafari\//i,"Safari"]];function lb(a,n){for(const[l,o]of a)if(l.test(n))return o;return null}function Yd(a){const n=typeof a=="string"?a.trim():"";if(!n)return{label:"",raw:""};const l=lb(CM,n),o=lb(TM,n);return l&&o?{label:`${l} · ${o}`,raw:n}:l?{label:l,raw:n}:o?{label:o,raw:n}:{label:n.length>32?`${n.slice(0,32)}…`:n,raw:n}}function el(a){if(!a||a<=0)return"0 B";const n=1024,l=["B","KB","MB","GB","TB"],o=Math.min(l.length-1,Math.floor(Math.log(a)/Math.log(n)));return`${(a/n**o).toFixed(1)} ${l[o]}`}function sb(a,n,l=!1){const o=Math.max(0,Math.floor(a)),r=Math.floor(o/86400),u=Math.floor(o%86400/3600),h=Math.floor(o%3600/60),p=o%60,m=(y,v)=>`${y}${n(`admin.unit${v}`)}`,g=r>0?[m(r,"Day"),m(u,"Hour"),m(h,"Minute")]:u>0?[m(u,"Hour"),m(h,"Minute"),m(p,"Second")]:[m(h,"Minute"),m(p,"Second")];return(l?g.slice(0,2):g).join(" ")}function Pd(a,n,l=Date.now()){if(!a)return"—";const o=new Date(a).getTime();if(Number.isNaN(o))return"—";const r=Math.max(0,Math.floor((l-o)/1e3));return r<60?n("admin.relJustNow"):r<3600?n("admin.relMinutes",{count:Math.floor(r/60)}):r<86400?n("admin.relHours",{count:Math.floor(r/3600)}):n("admin.relDays",{count:Math.floor(r/86400)})}function $d(a){if(!a)return"";const n=new Date(a);return Number.isNaN(n.getTime())?"":n.toLocaleString()}function n0(a=[]){const n=new Map;for(const l of a)l.deviceId&&n.set(l.deviceId,(n.get(l.deviceId)||0)+1);return n}const MM=({clients:a})=>{const{t:n}=Ne(),l=a.some(r=>r.hostId),o=[{key:"id",header:n("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(dn,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},...l?[{key:"host",header:n("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId||"—"})}]:[],{key:"role",header:n("admin.colRole"),width:10,render:r=>{const u=r.role==="controller";return f.jsx(py,{tone:u?"ok":"warn",className:"text-tui-sm",children:n(u?"common.controller":"common.viewer")})}},{key:"device",header:n("admin.colDevice"),render:r=>{const u=Yd(r.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:u.label?"text-tui-text":"text-tui-faint",title:u.raw,children:u.label||n("admin.unknownDevice")}),r.deviceId?f.jsx("code",{className:"text-tui-sm text-tui-faint",children:r.deviceId}):null]})}},{key:"ip",header:n("admin.colIp"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:n("admin.colConnectedAt"),render:r=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:$d(r.connectedAt),children:r.connectedAt?Pd(r.connectedAt,n):n("admin.startedRecently")})},{key:"traffic",header:n("admin.colTraffic"),align:"right",render:r=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsxs("span",{className:"text-tui-accent",children:["↓",el(r.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",el(r.bytesSent||0)]})]})}];return f.jsx(Nt,{title:n("admin.connectedClientsTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Bd,{columns:o,items:a,rowKey:r=>r.id,empty:n("admin.noClients")})})},AM=({devices:a,clients:n,onRevoke:l})=>{const{t:o}=Ne(),[r,u]=T.useState(null),[h,p]=T.useState(null),m=n0(n),g=[...a].sort((w,x)=>{const S=+!!m.get(x.deviceId)-+!!m.get(w.deviceId);return S||(Date.parse(x.lastSeenAt)||0)-(Date.parse(w.lastSeenAt)||0)}),y=async w=>{if(r!==w){u(w);return}p(w);try{await l(w)}finally{p(null),u(null)}},v=[{key:"status",header:o("admin.colStatus"),width:12,render:w=>{const x=m.get(w.deviceId)||0;return f.jsxs("span",{className:te("flex items-center gap-1.5 whitespace-nowrap",x?"text-tui-ok":"text-tui-faint"),children:[f.jsx(dn,{level:x?"ok":"idle"}),o(x?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:o("admin.colDevice"),render:w=>{const x=Yd(w.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:"text-tui-text",title:x.raw,children:x.label||o("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:w.deviceId})]})}},{key:"host",header:o("admin.colHost"),render:w=>f.jsx("span",{className:"text-tui-text",children:w.hostId||"—"})},{key:"ip",header:o("admin.colIp"),render:w=>f.jsx("span",{className:"text-tui-muted",children:w.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:w=>{const x=m.get(w.deviceId)||0;return f.jsx("span",{className:te("whitespace-nowrap",x?"text-tui-ok":"text-tui-muted"),title:$d(w.lastSeenAt),children:x?o("admin.deviceWindows",{count:x}):Pd(w.lastSeenAt,o)})}},{key:"actions",header:o("admin.colActions"),align:"right",render:w=>{const x=r===w.deviceId,S=h===w.deviceId;return f.jsx(Me,{variant:"danger",disabled:S,onClick:()=>void y(w.deviceId),onBlur:()=>u(M=>M===w.deviceId?null:M),"aria-label":o("admin.revokeDevice"),className:te("h-6 py-0 text-tui-sm",x&&"bg-tui-bad text-tui-crust"),children:S?f.jsx(la,{}):o(x?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(Nt,{title:o("admin.pairedDevicesTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Bd,{columns:v,items:g,rowKey:w=>w.deviceId,empty:o("admin.noDevices")})})},ob={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function EM(a=[],n=[]){const l=new Map;for(const u of n){if(!(u!=null&&u.hostId))continue;const h=l.get(u.hostId);h?h.push(u):l.set(u.hostId,[u])}const o=a.map(u=>{const h=l.get(u.id)||[];return{id:u.id,hostname:u.hostname||u.id,status:u.status||"online",connectedDeviceCount:u.connectedDeviceCount??0,pairedDeviceCount:u.pairedDeviceCount??h.length,activePtyCount:u.activePtyCount??0,devices:h,fromRosterOnly:!1}}),r=new Set(o.map(u=>u.id));for(const[u,h]of l)r.has(u)||o.push({id:u,hostname:u,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,activePtyCount:0,devices:h,fromRosterOnly:!0});return o.sort((u,h)=>u.fromRosterOnly!==h.fromRosterOnly?u.fromRosterOnly?1:-1:u.hostname.localeCompare(h.hostname))}const NM=({hosts:a,devices:n,clients:l})=>{const{t:o}=Ne(),r=EM(a,n),u=n0(l),h={online:o("admin.hostStatusOnline"),busy:o("admin.hostStatusBusy"),reconnecting:o("admin.hostStatusReconnecting"),offline:o("admin.hostStatusOffline")};return f.jsx(Nt,{title:o("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:o("admin.noHosts")}):r.map(p=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[f.jsxs("span",{className:"flex min-w-0 flex-auto items-center gap-1.5 text-tui",children:[f.jsx(dn,{level:ob[p.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:p.hostname}),p.hostname!==p.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:p.id}):null,f.jsx(py,{tone:ob[p.status],className:"ml-1 text-tui-sm",children:h[p.status]})]}),f.jsx(wd,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:p.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:o("admin.hostConnectedDevices",{count:p.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:o("admin.hostPairedDevices",{count:p.pairedDeviceCount})},"paired"),p.fromRosterOnly?null:f.jsx("span",{className:p.activePtyCount?"text-tui-info":"text-tui-faint",children:o("admin.hostPtys",{count:p.activePtyCount})},"ptys")]})]}),p.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:p.devices.map(m=>{const g=Yd(m.userAgent),y=u.get(m.deviceId)||0;return f.jsxs("li",{className:"grid grid-cols-[1ch_minmax(0,1fr)_auto] items-baseline gap-x-2 px-2 py-0.5 text-tui sm:grid-cols-[1ch_minmax(0,18ch)_minmax(0,1fr)_16ch_16ch]",children:[f.jsx(dn,{level:y?"ok":"idle"}),f.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||o("admin.unknownDevice")}),f.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:m.deviceId}),f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:m.lastIp||"—"}),f.jsx("span",{className:te("whitespace-nowrap text-right text-tui-sm",y?"text-tui-ok":"text-tui-faint"),title:$d(m.lastSeenAt),children:y?o("admin.deviceWindows",{count:y}):Pd(m.lastSeenAt,o)})]},m.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:p.pairedDeviceCount>0?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},p.id))})},kM=({data:a})=>{var r,u,h,p,m,g,y,v,w,x;const{t:n}=Ne(),l=a.activeUserCount??((r=a.clients)==null?void 0:r.length)??0,o=new Set((a.devices||[]).map(S=>S.hostId).filter(S=>S&&!(a.hosts||[]).some(M=>M.id===S))).size;return f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[f.jsx(Va,{label:n("admin.connectedHosts"),value:((u=a.hosts)==null?void 0:u.length)||0,sub:o?n("admin.hostsOfflineSub",{count:o}):void 0,tone:(h=a.hosts)!=null&&h.length?"ok":"idle"}),f.jsx(Va,{label:n("admin.activeUsers"),value:l,sub:n("admin.acrossWindows",{count:((p=a.clients)==null?void 0:p.length)||0}),tone:l?"accent":"idle"}),f.jsx(Va,{label:n("admin.activePtys"),value:((m=a.ptys)==null?void 0:m.length)||0,sub:n("admin.terminalShells"),tone:(g=a.ptys)!=null&&g.length?"info":"idle"}),f.jsx(Va,{label:n("admin.statInbound"),value:n("admin.perSecond",{value:el(((y=a.throughput)==null?void 0:y.bytesInPerSec)||0)}),sub:n("admin.statTotal",{value:el(((v=a.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(Va,{label:n("admin.statOutbound"),value:n("admin.perSecond",{value:el(((w=a.throughput)==null?void 0:w.bytesOutPerSec)||0)}),sub:n("admin.statTotal",{value:el(((x=a.throughput)==null?void 0:x.bytesOut)||0)}),tone:"ok"}),f.jsx(Va,{label:n("admin.uptime"),value:sb(a.uptimeSeconds||0,n,!0),title:sb(a.uptimeSeconds||0,n),sub:a.startTime?n("admin.startedAt",{time:new Date(a.startTime).toLocaleTimeString()}):n("admin.startedRecently")})]}),f.jsx(NM,{hosts:a.hosts||[],devices:a.devices,clients:a.clients||[]})]})},LM=({ptys:a})=>{const{t:n}=Ne(),l=a.some(r=>r.hostId),o=[{key:"id",header:n("admin.colPtyId"),render:r=>f.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},...l?[{key:"host",header:n("admin.colHost"),render:r=>f.jsx("span",{className:"text-tui-text",children:r.hostId})}]:[],{key:"pid",header:n("admin.colPid"),width:9,render:r=>f.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:n("admin.colCommand"),render:r=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:n("admin.colGrid"),width:11,render:r=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:n("admin.colCwd"),className:"max-w-xs truncate",render:r=>f.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:n("admin.colViewers"),align:"right",width:9,render:r=>f.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return f.jsx(Nt,{title:n("admin.activePtysTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Bd,{columns:o,items:a,rowKey:r=>r.id,empty:n("admin.noPtys")})})};function kd(a){if(typeof window>"u"||!a||a.startsWith("/"))return"";try{const n=new URL(a.replace(/^ws/,"http")),l=n.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return n.origin===window.location.origin&&!l?"":`${n.origin}${l}`}catch{return""}}function ws(a,n){const l=kd(a);return l?`${l}${n.startsWith("/")?n:`/${n}`}`:n}async function _M(a){try{const l=await fetch(ws(a,"/api/info"),{headers:{Accept:"application/json"}});if(l.ok)return await l.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(a&&!a.startsWith("/")&&!a.includes("localhost")&&!a.includes("127.0.0.1")&&typeof window<"u"&&!a.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function rb(a,n){const l=await fetch(a,{headers:{Accept:"application/json",...n}});if(l.status===401||l.status===403)return{kind:"denied",status:l.status};if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);return{kind:"ok",data:await l.json()}}async function RM(a,n,l){return(await fetch(ws(a,`/api/admin/devices/${encodeURIComponent(l)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":n}})).ok}function jM(a,n,l){return a!=null&&a.adminPath?a.publicUrl?`${a.publicUrl.replace(/\/$/,"")}${a.adminPath}`:ws(l,a.adminPath):n!=null&&n.remoteAdminUrl?n.remoteAdminUrl:l?ws(l,"/admin"):"/admin"}function OM({wsUrl:a,deviceToken:n,adminToken:l,relayOrigin:o,refreshInterval:r,t:u}){const[h,p]=T.useState(null),[m,g]=T.useState(null),[y,v]=T.useState(!1),[w,x]=T.useState(!0),[S,M]=T.useState(null),[E,k]=T.useState(!1),[N,R]=T.useState(null);T.useEffect(()=>{p(null),g(null),v(!1)},[o]),T.useEffect(()=>{let K=!0;return x(!0),_M(a).then(V=>{K&&(g(V),v(!0))}),()=>{K=!1}},[a,o]);const H=(m==null?void 0:m.relayMode)==="remote",j=T.useCallback((K,V)=>{if(K.kind==="denied"){k(!0),M(V),p(null);return}p(K.data),M(null),k(!1),R(new Date)},[]),D=T.useCallback((K,V)=>{k(!1),M(K instanceof Error?K.message:V),p(null)},[]),_=T.useCallback(async()=>{if(y){if(H){if(!l){p(null),x(!1),M(null),k(!1);return}try{x(!0);const K=await rb(ws(a,(m==null?void 0:m.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":l});j(K,u("admin.relayAdminAuthError"))}catch(K){console.warn("GET /api/admin/status request failed:",K),D(K,"Failed to fetch remote admin status")}finally{x(!1)}return}try{x(!0);const K=await rb("/api/status",n?{Authorization:`Bearer ${n}`}:{});j(K,K.kind==="denied"?`Authentication failed (HTTP ${K.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(K){console.warn("GET /api/status request failed:",K),D(K,"Failed to fetch status")}finally{x(!1)}}},[y,H,l,m,n,a,o,u]),z=T.useCallback(async K=>{try{if(!await RM(a,l,K)){M(u("admin.revokeFailed"));return}await _()}catch{M(u("admin.revokeFailed"))}},[l,_,a,u]);return T.useEffect(()=>{if(!y)return;_();let K=null;const V=()=>{r>0&&!K&&(K=setInterval(()=>{document.visibilityState==="visible"&&_()},r))},ne=()=>{K&&(clearInterval(K),K=null)},W=()=>{document.visibilityState==="visible"?(_(),V()):ne()};return V(),document.addEventListener("visibilitychange",W),()=>{ne(),document.removeEventListener("visibilitychange",W)}},[y,_,r]),{data:h,relayInfo:m,infoLoaded:y,isRemoteRelay:H,loading:w,error:S,isAuthError:E,lastUpdated:N,fetchStatus:_,revokeDevice:z}}const rd="h-7 py-0",DM=({onBackToTerminal:a,onOpenPairing:n,showBack:l=!1})=>{var xe,ce,Te;const{settings:o,updateSettings:r,t:u}=Ne(),h=kd(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),p=((xe=o.adminTokens)==null?void 0:xe[h])||(h===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[m,g]=T.useState(3e3),[y,v]=T.useState("overview"),[w,x]=T.useState(p),[S,M]=T.useState(p),[E,k]=T.useState(!!p),N=!kd(o.wsUrl);T.useEffect(()=>{x(p),M(p),k(!!p)},[h]);const{data:R,relayInfo:H,infoLoaded:j,isRemoteRelay:D,loading:_,error:z,isAuthError:K,lastUpdated:V,fetchStatus:ne,revokeDevice:W}=OM({wsUrl:o.wsUrl,deviceToken:o.token,adminToken:S,relayOrigin:h,refreshInterval:m,t:u}),ie=ue=>{ue.preventDefault();const de=w.trim();r({adminToken:de,adminTokens:{...o.adminTokens||{},[h]:de}}),M(de),k(!!de)},oe=jM(H,R,o.wsUrl),P=R?[{id:"overview",label:u("admin.tabOverview"),index:1},{id:"clients",label:u("admin.tabClients",{count:((ce=R.clients)==null?void 0:ce.length)||0}),index:2},{id:"ptys",label:u("admin.tabPtys",{count:((Te=R.ptys)==null?void 0:Te.length)||0}),index:3},...R.devices?[{id:"devices",label:u("admin.tabDevices",{count:R.devices.length}),index:4}]:[]]:[],A=P.map(ue=>ue.id).join("|");T.useEffect(()=>{const ue=A?A.split("|"):[],de=se=>{if(se.ctrlKey||se.altKey||se.metaKey)return;const ve=se.target;if(ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve instanceof HTMLSelectElement||ve!=null&&ve.isContentEditable||document.querySelector('[role="dialog"]'))return;if(se.key==="Escape"&&a){se.preventDefault(),a();return}if(se.key.toLowerCase()==="r"){se.preventDefault(),ne();return}const ae=Number.parseInt(se.key,10)-1;Number.isInteger(ae)&&ae>=0&&ae<ue.length&&(se.preventDefault(),v(ue[ae]))};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[ne,a,A]);const I=(H==null?void 0:H.version)||(R==null?void 0:R.version)||"0.1.0",J=l&&a?f.jsx(Me,{variant:"ghost",onClick:a,title:u("admin.returnToTerminal"),"aria-label":u("admin.returnToTerminal"),glyph:Ee.arrowLeft,brackets:!1,className:rd,children:f.jsx("span",{className:"sr-only",children:u("admin.returnToTerminal")})}):null,le=f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:"hidden items-center gap-1.5 whitespace-nowrap text-tui-sm sm:flex",children:[f.jsxs("span",{className:"text-tui-faint",children:["v",I]}),f.jsx(zd,{}),f.jsx("span",{className:D?"text-tui-alt":"text-tui-ok",children:u(D?"admin.modeRemote":"admin.localWorkstationBadge")})]}),R?f.jsxs(f.Fragment,{children:[f.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[f.jsx("span",{children:u("admin.autoRefresh")}),f.jsxs(Cr,{value:m,onChange:ue=>g(Number(ue.target.value)),"aria-label":u("admin.autoRefresh"),className:te("w-auto",rd),children:[f.jsx("option",{value:0,children:u("admin.paused")}),f.jsx("option",{value:1e3,children:"1s"}),f.jsx("option",{value:3e3,children:"3s"}),f.jsx("option",{value:5e3,children:"5s"}),f.jsx("option",{value:1e4,children:"10s"})]})]}),f.jsx(Me,{variant:"primary",onClick:ne,disabled:_,title:u("admin.refreshNow"),className:rd,children:_?f.jsx(la,{}):u("admin.refreshNow")})]}):null]}),Z=j&&D&&!E&&!N,ye=j&&D&&(E||N)&&!R;return f.jsxs(IS,{tabs:P,activeTabId:y,onSelectTab:ue=>v(ue),tabsAriaLabel:u("header.mainNavigationAria"),toolbarStart:J,toolbarAside:le,hints:[...R?[{keys:"1–4",action:u("admin.hintTabs")},{keys:"r",action:u("admin.hintRefresh")}]:[],...a?[{keys:"esc",action:u("admin.hintBack")}]:[]],footerAside:V?f.jsx("span",{className:"text-tui-faint",children:u("admin.updatedAt",{time:V.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!j&&f.jsx("div",{className:"flex items-center justify-center gap-2 border border-tui-border bg-tui-base px-3 py-8 text-tui text-tui-muted",children:f.jsx(la,{label:u("admin.loadingStatus")})}),Z&&f.jsx(xM,{wsUrl:o.wsUrl,adminUrl:oe,onOpenRemoteAdmin:()=>window.open(oe,"_blank","noopener,noreferrer"),onSignIn:()=>k(!0)}),ye&&f.jsx(wM,{adminConfigured:H==null?void 0:H.adminConfigured,isAuthError:K,tokenInput:w,onTokenInput:x,onSubmit:ie,isSameOriginRelay:N,onBackToTerminal:a,showBack:l,onCancel:()=>k(!1)}),j&&!D&&K&&f.jsx(SM,{onOpenPairing:n,onRetry:ne}),j&&z&&!K&&f.jsx(_i,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:ne,children:u("common.retry")}),children:u("admin.errorConnecting",{error:z})}),R&&f.jsxs(f.Fragment,{children:[y==="overview"&&f.jsx(kM,{data:R}),y==="clients"&&f.jsx(MM,{clients:R.clients||[]}),y==="ptys"&&f.jsx(LM,{ptys:R.ptys||[]}),y==="devices"&&f.jsx(AM,{devices:R.devices||[],clients:R.clients||[],onRevoke:W})]})]})},nr="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",ir="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",zM="border-tui-accent bg-tui-selection text-tui-accent",ar=({active:a=!1})=>f.jsx("span",{"aria-hidden":"true",className:te("shrink-0",a?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ee.cursor}),HM=({onClose:a,onOpenPairing:n,onOpenSettings:l,onAddProfile:o=()=>{}})=>{const{settings:r,updateSettings:u,language:h,setLanguage:p,t:m}=Ne(),{connectionState:g,stateDetail:y,rttMs:v,hostId:w,connect:x}=et(),{addToast:S}=Vt(),{copied:M,copy:E}=Mr(),k=M!==null,N=Ar(g,m),R=D=>()=>{var z;const _=document.activeElement;(z=_==null?void 0:_.blur)==null||z.call(_),D()},H=()=>E(r.clientId,m("toasts.clientIdCopied",{id:r.clientId}),"info"),j=()=>{const D=h==="zh"?"en":"zh";p(D),S("info",Ld(D,"toasts.switchedLanguage",{lang:D==="zh"?"简体中文":"English"}))};return f.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[f.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:m("mobile.sessionControls")}),f.jsx(Me,{variant:"ghost",onClick:a,"aria-label":m("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(Nt,{title:m("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(Gd,{mobile:!0,onAddProfile:o})}),f.jsxs(Nt,{title:m("common.status"),tone:N.level==="ok"?"ok":N.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(dn,{level:N.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:N.label}),g==="connected"&&v!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[v,"ms"]})]}),N.actionLabel&&f.jsx(Me,{variant:"primary",onClick:()=>x(),className:"shrink-0",children:N.actionLabel})]}),N.needsAttention&&y&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:y}),w&&f.jsx(Ni,{label:m("common.host"),labelWidth:9,children:w}),f.jsxs("button",{type:"button",onClick:H,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:m("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:m("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:r.clientId}),f.jsx("span",{"aria-hidden":"true",className:te("shrink-0",k?"text-tui-ok":"text-tui-faint"),children:k?Ee.check:"⧉"})]})]}),f.jsx(Nt,{title:m("mobile.inputControl"),tone:"accent","aria-label":m("mobile.terminalControlAria"),children:f.jsx(Jy,{className:"h-11"})}),f.jsxs(Nt,{title:m("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:j,className:te(nr,ir),"aria-label":m("header.languageToggleTitle"),children:[f.jsx(ar,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:R(l),className:te(nr,ir),"aria-label":m("mobile.settingsAria"),children:[f.jsx(ar,{}),f.jsx("span",{className:"truncate",children:m("common.settings")})]}),f.jsxs("button",{type:"button",onClick:R(n),className:te(nr,ir),"aria-label":m("mobile.pairingAria"),children:[f.jsx(ar,{}),f.jsx("span",{className:"truncate",children:m("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>u({toolbarVisible:!r.toolbarVisible}),className:te(nr,r.toolbarVisible?zM:ir),"aria-label":m("mobile.keybarAria"),"aria-pressed":r.toolbarVisible,children:[f.jsx(ar,{active:r.toolbarVisible}),f.jsx("span",{className:"truncate",children:m("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:r.toolbarVisible?"[x]":"[ ]"})]})]})]})},BM=({onAddProfile:a})=>{const{t:n}=Ne(),{rttMs:l}=et();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":n("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[f.jsx(Gd,{statusBar:!0,onAddProfile:a}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(Wy,{compact:!0}),f.jsx(t0,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:n("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:te(l===null?"text-tui-faint":"text-tui-text"),children:l===null?"—":`${l}ms`})]})]})},UM=({onOpenPairing:a,onOpenSettings:n,onAddProfile:l=()=>{}})=>{const{t:o}=Ne(),{connectionState:r,isController:u}=et(),[h,p]=T.useState(!1),m=T.useRef(null),g=T.useCallback(()=>p(!1),[]);T.useEffect(()=>{if(!h)return;const v=w=>{if(!(w.ctrlKey||w.altKey||w.metaKey)&&w.key==="Escape"){const x=w.target;x&&typeof x.closest=="function"&&!!x.closest("#terminal-container")||(w.stopPropagation(),w.preventDefault(),g())}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,g]),T.useEffect(()=>{var v;h&&((v=m.current)==null||v.focus({preventScroll:!0}))},[h]);const y=Ar(r,o);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":o("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),f.jsx(zd,{className:"shrink-0"}),f.jsx(dn,{level:y.level}),f.jsx("span",{className:"truncate uppercase",children:y.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>p(!0),"aria-label":o("mobile.sessionControls"),"aria-expanded":h,"aria-haspopup":"dialog",className:te("tui-focusable pointer-events-auto flex h-9 shrink-0 select-none items-center gap-1.5 border px-2 text-tui uppercase transition-colors",y.needsAttention?"border-tui-warn text-tui-warn":u?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!u&&!y.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:o("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Ee.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:o("mobile.menu")})]})]}),h&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:g,"aria-hidden":"true"}),f.jsx("div",{ref:m,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":o("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:f.jsx(HM,{onClose:g,onOpenPairing:()=>{g(),a()},onOpenSettings:()=>{g(),n()},onAddProfile:()=>{g(),l()}})})]}),f.jsx(BM,{onAddProfile:l})]})},KM=()=>{const{activeProfile:a,t:n}=Ne(),{herdrLaunch:l,startHerdr:o,hostname:r}=et();if(!l)return null;const u=r||(a==null?void 0:a.displayName)||n("herdrLaunch.thisHost"),h=l.phase==="failed";return f.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsx(Nt,{title:n(h?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:h?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":n("herdrLaunch.title"),children:l.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(la,{}),f.jsx("span",{children:n("herdrLaunch.starting",{host:u})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:n("herdrLaunch.body",{host:u})}),h&&l.message?f.jsx(_i,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:l.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:n("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(Me,{variant:"primary",onClick:o,autoFocus:!0,children:n(h?"common.retry":"herdrLaunch.start")})})]})})})},i0="--app-height",a0="--keyboard-inset",IM=80;function FM(){if(typeof window>"u")return{height:768,keyboardInset:0};const a=window.innerHeight||768,n=window.visualViewport;if(n&&typeof n.height=="number"&&n.height>0){const l=a-n.height-(n.offsetTop||0),o=l>=IM?Math.round(l):0;return{height:Math.round(n.height),keyboardInset:o}}return{height:a,keyboardInset:0}}function cb(a,n=FM()){return a.style.setProperty(i0,`${n.height}px`),a.style.setProperty(a0,`${n.keyboardInset}px`),n}function GM(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let n=null;const l=()=>{n=null,cb(a)},o=()=>{if(n===null){if(typeof requestAnimationFrame!="function"){l();return}n=requestAnimationFrame(l)}};cb(a);const r=window.visualViewport;return r==null||r.addEventListener("resize",o),r==null||r.addEventListener("scroll",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),()=>{n!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(n),n=null),r==null||r.removeEventListener("resize",o),r==null||r.removeEventListener("scroll",o),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),a.style.removeProperty(i0),a.style.removeProperty(a0)}}const YM=900;function ub(){if(typeof window>"u")return!1;const a=nl();return a<Rd?!0:a<=YM}function PM(){const[a,n]=T.useState(ub);return T.useEffect(()=>{var r,u;const l=()=>{const h=ub();n(p=>p===h?p:h)};l();let o=null;try{o=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{o=null}return(r=o==null?void 0:o.addEventListener)==null||r.call(o,"change",l),window.addEventListener("resize",l),window.addEventListener("orientationchange",l),(u=window.visualViewport)==null||u.addEventListener("resize",l),()=>{var h,p;(h=o==null?void 0:o.removeEventListener)==null||h.call(o,"change",l),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),(p=window.visualViewport)==null||p.removeEventListener("resize",l)}},[]),a}function $M(a){const n=a.target;if(!n)return!1;if(n.id==="terminal-container"||n.id==="terminal-frame"||n.id==="terminal-surface"||n.classList.contains("xterm-helper-textarea")||n.classList.contains("xterm")||n.closest("#terminal-container")||n.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const l=document.activeElement;if(l.id==="terminal-container"||l.classList.contains("xterm-helper-textarea")||l.closest("#terminal-container")||l.closest(".xterm"))return!0}return!1}function qM(a,n={}){if(typeof window>"u")return()=>{};const l=o=>{var r;o.ctrlKey||o.altKey||o.metaKey||o.key==="Escape"&&(n.isModalOpen||n.isSheetOpen)&&($M(o)||(o.preventDefault(),o.stopPropagation(),(r=a.onCloseModals)==null||r.call(a)))};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}}function VM(){const[a,n]=T.useState("terminal"),[l,o]=T.useState(!1),[r,u]=T.useState(!1),[h,p]=T.useState(!1),[m,g]=T.useState(void 0),y=P=>{g(P),p(!0)},[v,w]=T.useState(!1),{updateSettings:x,addProfileAndConnect:S,settings:M}=Ne(),{connectionState:E,stateDetail:k,stateCode:N,lastPairedAt:R}=et();F1();const H=PM();T.useEffect(()=>GM(),[]),T.useEffect(()=>{Mb()},[]),T.useEffect(()=>{const P=l||r||h||v;if(P)return qM({onCloseModals:()=>{o(!1),u(!1),p(!1),w(!1)}},{isModalOpen:P})},[l,r,h,v]),T.useEffect(()=>{var A;const P=()=>{const I=window.location.pathname,J=window.location.hash;n(I==="/admin"||J==="#admin"?"admin":"terminal")};P(),window.addEventListener("popstate",P),window.addEventListener("hashchange",P);try{const I=new URL(window.location.href),J=(A=I.searchParams.get("pairCode"))==null?void 0:A.toUpperCase();J&&gr().token?S({wsUrl:Rt,pairCode:J}):J&&x({pairCode:J});let le=!1;if(I.searchParams.has("token")&&(I.searchParams.delete("token"),le=!0),I.searchParams.has("pairCode")&&(I.searchParams.delete("pairCode"),le=!0),le){const Z=I.searchParams.toString(),ye=I.pathname+(Z?`?${Z}`:"")+I.hash;window.history.replaceState({},"",ye)}}catch(I){console.warn("Failed to parse URL query params:",I)}return()=>{window.removeEventListener("popstate",P),window.removeEventListener("hashchange",P)}},[x,S]);const j=()=>o(!0),D=()=>u(!0),_=P=>{n(P),P==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},z=!M.token&&!M.pairCode&&E!=="connected",K=E==="error"&&(["auth_required","unauthorized","device_revoked"].includes(N||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(k||"")),V=z||K,[ne,W]=T.useState(!V);T.useEffect(()=>{V||W(!0)},[V]),T.useEffect(()=>{R&&(o(!1),u(!1),W(!0),n("terminal"))},[R]);const ie=a==="terminal"&&!V,oe=P=>({visibility:P?"visible":"hidden",opacity:P?1:0,pointerEvents:P?"auto":"none",zIndex:P?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:H?{paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"}:void 0,className:"flex h-full w-full select-none flex-col overflow-hidden bg-tui-crust font-mono text-tui text-tui-text",onContextMenu:P=>{P.preventDefault(),P.stopPropagation()},children:[!H&&f.jsx(GS,{currentView:a,onNavigate:_,onOpenPairing:j,onOpenSettings:()=>y(),onToggleVirtualKeyboard:()=>w(!v),isVirtualKeyboardOpen:v}),!H&&!V&&f.jsx(YS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[ne&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${H?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:oe(ie),"aria-hidden":!ie,children:[f.jsx(K5,{isActive:ie}),!H&&f.jsx(nM,{isOpen:v,onClose:()=>w(!1)}),f.jsx(tM,{compact:H,onCustomize:()=>y("agentKeymaps")}),f.jsx(KM,{}),f.jsx(uM,{})]}),a==="terminal"&&V&&f.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:f.jsx(F5,{onPairedSuccess:()=>{}})}),a==="admin"&&f.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:f.jsx(DM,{onBackToTerminal:()=>_("terminal"),onOpenPairing:j,showBack:H})}),H&&ie&&f.jsx(UM,{onOpenPairing:j,onOpenSettings:()=>y(),onAddProfile:D})]}),!H&&a!=="admin"&&f.jsx(vM,{onAddProfile:D}),f.jsx(aM,{isOpen:l,onClose:()=>o(!1)}),f.jsx(lM,{isOpen:r,onClose:()=>u(!1)}),f.jsx(hM,{isOpen:h,initialTab:m,onClose:()=>p(!1),onOpenAdmin:()=>{p(!1),_("admin")}}),f.jsx(gM,{})]})}function XM(){return f.jsx(L1,{children:f.jsx(VM,{})})}const l0=document.getElementById("root");if(!l0)throw new Error("Root element not found");Lx.createRoot(l0).render(f.jsx(Qn.StrictMode,{children:f.jsx(XM,{})}));
|