herdr-remote-relay 0.3.21 → 0.3.23
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.
- package/dist/protocol/http.d.ts +4 -0
- package/dist/protocol/messages.d.ts +6 -0
- package/dist/server/client-channel.js +1 -0
- package/dist/server/host-broadcasts.d.ts +2 -0
- package/dist/server/host-broadcasts.js +7 -4
- package/dist/server/host-channel.js +2 -1
- package/dist/server/sessions.js +1 -0
- package/dist/server/status.js +4 -0
- package/dist/server/types.d.ts +2 -0
- package/package.json +1 -1
- package/web/dist/assets/index-Ctj0LjgS.js +61 -0
- package/web/dist/assets/index-XYYRsgSb.css +32 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-C_RZHFCw.js +0 -61
- package/web/dist/assets/index-DOSL54ax.css +0 -32
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var xx=Object.defineProperty;var wx=(a,n,l)=>n in a?xx(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l;var $=(a,n,l)=>wx(a,typeof n!="symbol"?n+"":n,l);import{r as fb,g as hb,a as mb}from"./vendor-react-CYSfZuHu.js";import{r as Sx,a as Cx}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:{}},as={};/**
|
|
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 Pp;function Tx(){if(Pp)return as;Pp=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 m in r)m!=="key"&&(u[m]=r[m])}else u=r;return r=u.ref,{$$typeof:a,type:o,key:h,ref:r!==void 0?r:null,props:u}}return as.Fragment=n,as.jsx=l,as.jsxs=l,as}var Vp;function Mx(){return Vp||(Vp=1,Uu.exports=Tx()),Uu.exports}var f=Mx(),T=fb();const Qn=hb(T);var Ku={exports:{}},ls={},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 Ax(){return $p||($p=1,(function(a){function n(A,G){var Q=A.length;A.push(G);e:for(;0<Q;){var se=Q-1>>>1,W=A[se];if(0<r(W,G))A[se]=G,A[Q]=W,Q=se;else break e}}function l(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var G=A[0],Q=A.pop();if(Q!==G){A[0]=Q;e:for(var se=0,W=A.length,be=W>>>1;se<be;){var xe=2*(se+1)-1,ue=A[xe],Te=xe+1,ce=A[Te];if(0>r(ue,Q))Te<W&&0>r(ce,ue)?(A[se]=ce,A[Te]=Q,se=Te):(A[se]=ue,A[xe]=Q,se=xe);else if(Te<W&&0>r(ce,Q))A[se]=ce,A[Te]=Q,se=Te;else break e}}return G}function r(A,G){var Q=A.sortIndex-G.sortIndex;return Q!==0?Q:A.id-G.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,m=h.now();a.unstable_now=function(){return h.now()-m}}var p=[],g=[],y=1,v=null,x=3,w=!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 G=l(g);G!==null;){if(G.callback===null)o(g);else if(G.startTime<=A)o(g),G.sortIndex=G.expirationTime,n(p,G);else break;G=l(g)}}function j(A){if(M=!1,H(A),!S)if(l(p)!==null)S=!0,D||(D=!0,Z());else{var G=l(g);G!==null&&P(j,G.startTime-A)}}var D=!1,_=-1,z=5,K=-1;function q(){return E?!0:!(a.unstable_now()-K<z)}function te(){if(E=!1,D){var A=a.unstable_now();K=A;var G=!0;try{e:{S=!1,M&&(M=!1,N(_),_=-1),w=!0;var Q=x;try{t:{for(H(A),v=l(p);v!==null&&!(v.expirationTime>A&&q());){var se=v.callback;if(typeof se=="function"){v.callback=null,x=v.priorityLevel;var W=se(v.expirationTime<=A);if(A=a.unstable_now(),typeof W=="function"){v.callback=W,H(A),G=!0;break t}v===l(p)&&o(p),H(A)}else o(p);v=l(p)}if(v!==null)G=!0;else{var be=l(g);be!==null&&P(j,be.startTime-A),G=!1}}break e}finally{v=null,x=Q,w=!1}G=void 0}}finally{G?Z():D=!1}}}var Z;if(typeof R=="function")Z=function(){R(te)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,re=ie.port2;ie.port1.onmessage=te,Z=function(){re.postMessage(null)}}else Z=function(){k(te,0)};function P(A,G){_=k(function(){A(a.unstable_now())},G)}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 x},a.unstable_next=function(A){switch(x){case 1:case 2:case 3:var G=3;break;default:G=x}var Q=x;x=G;try{return A()}finally{x=Q}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function(A,G){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var Q=x;x=A;try{return G()}finally{x=Q}},a.unstable_scheduleCallback=function(A,G,Q){var se=a.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?se+Q:se):Q=se,A){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=Q+W,A={id:y++,callback:G,priorityLevel:A,startTime:Q,expirationTime:W,sortIndex:-1},Q>se?(A.sortIndex=Q,n(g,A),l(p)===null&&A===l(g)&&(M?(N(_),_=-1):M=!0,P(j,Q-se))):(A.sortIndex=W,n(p,A),S||w||(S=!0,D||(D=!0,Z()))),A},a.unstable_shouldYield=q,a.unstable_wrapCallback=function(A){var G=x;return function(){var Q=x;x=G;try{return A.apply(this,arguments)}finally{x=Q}}}})(Fu)),Fu}var qp;function Ex(){return qp||(qp=1,Iu.exports=Ax()),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 Xp;function Nx(){if(Xp)return ls;Xp=1;var a=Ex(),n=fb(),l=mb();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 m(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 p(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 p(c),e;if(d===s)return p(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,x=Symbol.for("react.element"),w=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"),q=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var ie=Symbol.for("react.client.reference");function re(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:re(e.type)||"Memo";case z:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var P=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},se=[],W=-1;function be(e){return{current:e}}function xe(e){0>W||(e.current=se[W],se[W]=null,W--)}function ue(e,t){W++,se[W]=e.current,e.current=t}var Te=be(null),ce=be(null),ye=be(null),ae=be(null);function ve(e,t){switch(ue(ye,t),ue(ce,e),ue(Te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?mp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=mp(t),e=pp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}xe(Te),ue(Te,e)}function le(){xe(Te),xe(ce),xe(ye)}function we(e){e.memoizedState!==null&&ue(ae,e);var t=Te.current,i=pp(t,e.type);t!==i&&(ue(ce,e),ue(Te,i))}function Ee(e){ce.current===e&&(xe(Te),xe(ce)),ae.current===e&&(xe(ae),es._currentValue=Q)}var Be,it;function tt(e){if(Be===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Be=t&&t[1]||"",it=-1<i.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+Be+e+it}var de=!1;function Re(e,t){if(!e||de)return"";de=!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(V){var Y=V}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(V){Y=V}e.call(ee.prototype)}}else{try{throw Error()}catch(V){Y=V}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(V){if(V&&Y&&typeof V.stack=="string")return[V.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
|
+
`),F=C.split(`
|
|
29
|
+
`);for(c=s=0;s<L.length&&!L[s].includes("DetermineComponentFrameRoot");)s++;for(;c<F.length&&!F[c].includes("DetermineComponentFrameRoot");)c++;if(s===L.length||c===F.length)for(s=L.length-1,c=F.length-1;1<=s&&0<=c&&L[s]!==F[c];)c--;for(;1<=s&&0<=c;s--,c--)if(L[s]!==F[c]){if(s!==1||c!==1)do if(s--,c--,0>c||L[s]!==F[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{de=!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,gn=a.unstable_scheduleCallback,bn=a.unstable_cancelCallback,kt=a.unstable_shouldYield,Oi=a.unstable_requestPaint,Mt=a.unstable_now,As=a.unstable_getCurrentPriorityLevel,dl=a.unstable_ImmediatePriority,fl=a.unstable_UserBlockingPriority,Di=a.unstable_NormalPriority,Es=a.unstable_LowPriority,hl=a.unstable_IdlePriority,Ns=a.log,ks=a.unstable_setDisableYieldValue,ei=null,At=null;function yn(e){if(typeof Ns=="function"&&ks(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(ei,e)}catch{}}var Lt=Math.clz32?Math.clz32:qe,Ls=Math.log,fe=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(Ls(e)/fe|0)|0}var _t=256,Ft=262144,ca=4194304;function Nn(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 ua(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=Nn(s):(b&=C,b!==0?c=Nn(b):i||(i=C&~e,i!==0&&(c=Nn(i))))):(C=s&~d,C!==0?c=Nn(C):b!==0?c=Nn(b):i||(i=s&~e,i!==0&&(c=Nn(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 ti(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function _s(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 ml(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function r0(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,F=e.hiddenUpdates;for(i=b&~i;0<i;){var X=31-Lt(i),ee=1<<X;C[X]=0,L[X]=-1;var Y=F[X];if(Y!==null)for(F[X]=null,X=0;X<Y.length;X++){var V=Y[X];V!==null&&(V.lane&=-536870913)}i&=~ee}s!==0&&Xd(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Xd(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Lt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function Zd(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-Lt(i),c=1<<s;c&t|e[s]&t&&(e[s]|=t),i&=~c}}function Wd(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=G.p;return e!==0?e:(e=window.event,e===void 0?32:Bp(e.type))}function Jd(e,t){var i=G.p;try{return G.p=e,t()}finally{G.p=i}}var ni=Math.random().toString(36).slice(2),xt="__reactFiber$"+ni,Ot="__reactProps$"+ni,da="__reactContainer$"+ni,Lr="__reactEvents$"+ni,c0="__reactListeners$"+ni,u0="__reactHandles$"+ni,ef="__reactResources$"+ni,pl="__reactMarker$"+ni;function _r(e){delete e[xt],delete e[Ot],delete e[Lr],delete e[c0],delete e[u0]}function fa(e){var t=e[xt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[da]||i[xt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Sp(e);e!==null;){if(i=e[xt])return i;e=Sp(e)}return t}e=i,i=e.parentNode}return null}function ha(e){if(e=e[xt]||e[da]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ma(e){var t=e[ef];return t||(t=e[ef]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function bt(e){e[pl]=!0}var tf=new Set,nf={};function zi(e,t){pa(e,t),pa(e+"Capture",t)}function pa(e,t){for(nf[e]=t,e=0;e<t.length;e++)tf.add(t[e])}var d0=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]*$"),af={},lf={};function f0(e){return ht.call(lf,e)?!0:ht.call(af,e)?!1:d0.test(e)?lf[e]=!0:(af[e]=!0,!1)}function Rs(e,t,i){if(f0(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 js(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 kn(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 Wt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function sf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function h0(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=sf(e)?"checked":"value";e._valueTracker=h0(e,t,""+e[t])}}function of(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=sf(e)?e.checked?"true":"false":e.value),e=s,e!==i?(t.setValue(e),!0):!1}function Os(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 m0=/[\n"\\]/g;function Qt(e){return e.replace(m0,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=""+Wt(t)):e.value!==""+Wt(t)&&(e.value=""+Wt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Or(e,b,Wt(t)):i!=null?Or(e,b,Wt(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=""+Wt(C):e.removeAttribute("name")}function rf(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?""+Wt(i):"",t=t!=null?""+Wt(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"&&Os(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function ga(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=""+Wt(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 cf(e,t,i){if(t!=null&&(t=""+Wt(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Wt(i):""}function uf(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=Wt(t),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),Rr(e)}function ba(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var p0=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 df(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||p0.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function ff(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&&df(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&df(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 g0=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"]]),b0=/^[\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 Ds(e){return b0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ln(){}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 ya=null,va=null;function hf(e){var t=ha(e);if(t&&(e=t.stateNode)){var i=e[Ot]||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="'+Qt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var s=i[t];if(s!==e&&s.form===e.form){var c=s[Ot]||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&&of(s)}break e;case"textarea":cf(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&ga(e,!!i.multiple,t,!1)}}}var Br=!1;function mf(e,t,i){if(Br)return e(t,i);Br=!0;try{var s=e(t);return s}finally{if(Br=!1,(ya!==null||va!==null)&&(Co(),ya&&(t=ya,e=va,va=ya=null,hf(t),e)))for(t=0;t<e.length;t++)hf(e[t])}}function bl(e,t){var i=e.stateNode;if(i===null)return null;var s=i[Ot]||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 _n=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ur=!1;if(_n)try{var yl={};Object.defineProperty(yl,"passive",{get:function(){Ur=!0}}),window.addEventListener("test",yl,yl),window.removeEventListener("test",yl,yl)}catch{Ur=!1}var ii=null,Kr=null,zs=null;function pf(){if(zs)return zs;var e,t=Kr,i=t.length,s,c="value"in ii?ii.value:ii.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 zs=c.slice(e,1<s?1-s:void 0)}function Hs(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 Bs(){return!0}function gf(){return!1}function Dt(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)?Bs:gf,this.isPropagationStopped=gf,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=Bs)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Bs)},persist:function(){},isPersistent:Bs}),t}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Us=Dt(Hi),vl=v({},Hi,{view:0,detail:0}),y0=Dt(vl),Ir,Fr,xl,Ks=v({},vl,{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!==xl&&(xl&&e.type==="mousemove"?(Ir=e.screenX-xl.screenX,Fr=e.screenY-xl.screenY):Fr=Ir=0,xl=e),Ir)},movementY:function(e){return"movementY"in e?e.movementY:Fr}}),bf=Dt(Ks),v0=v({},Ks,{dataTransfer:0}),x0=Dt(v0),w0=v({},vl,{relatedTarget:0}),Gr=Dt(w0),S0=v({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),C0=Dt(S0),T0=v({},Hi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),M0=Dt(T0),A0=v({},Hi,{data:0}),yf=Dt(A0),E0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N0={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"},k0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function L0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=k0[e])?!!t[e]:!1}function Yr(){return L0}var _0=v({},vl,{key:function(e){if(e.key){var t=E0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?N0[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"?Hs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),R0=Dt(_0),j0=v({},Ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vf=Dt(j0),O0=v({},vl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yr}),D0=Dt(O0),z0=v({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),H0=Dt(z0),B0=v({},Ks,{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}),U0=Dt(B0),K0=v({},Hi,{newState:0,oldState:0}),I0=Dt(K0),F0=[9,13,27,32],Pr=_n&&"CompositionEvent"in window,wl=null;_n&&"documentMode"in document&&(wl=document.documentMode);var G0=_n&&"TextEvent"in window&&!wl,xf=_n&&(!Pr||wl&&8<wl&&11>=wl),wf=" ",Sf=!1;function Cf(e,t){switch(e){case"keyup":return F0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xa=!1;function Y0(e,t){switch(e){case"compositionend":return Tf(t);case"keypress":return t.which!==32?null:(Sf=!0,wf);case"textInput":return e=t.data,e===wf&&Sf?null:e;default:return null}}function P0(e,t){if(xa)return e==="compositionend"||!Pr&&Cf(e,t)?(e=pf(),zs=Kr=ii=null,xa=!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 xf&&t.locale!=="ko"?null:t.data;default:return null}}var V0={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 Mf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!V0[e.type]:t==="textarea"}function Af(e,t,i,s){ya?va?va.push(s):va=[s]:ya=s,t=Lo(t,"onChange"),0<t.length&&(i=new Us("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var Sl=null,Cl=null;function $0(e){rp(e,0)}function Is(e){var t=gl(e);if(of(t))return e}function Ef(e,t){if(e==="change")return t}var Nf=!1;if(_n){var Vr;if(_n){var $r="oninput"in document;if(!$r){var kf=document.createElement("div");kf.setAttribute("oninput","return;"),$r=typeof kf.oninput=="function"}Vr=$r}else Vr=!1;Nf=Vr&&(!document.documentMode||9<document.documentMode)}function Lf(){Sl&&(Sl.detachEvent("onpropertychange",_f),Cl=Sl=null)}function _f(e){if(e.propertyName==="value"&&Is(Cl)){var t=[];Af(t,Cl,e,Hr(e)),mf($0,t)}}function q0(e,t,i){e==="focusin"?(Lf(),Sl=t,Cl=i,Sl.attachEvent("onpropertychange",_f)):e==="focusout"&&Lf()}function X0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Is(Cl)}function Z0(e,t){if(e==="click")return Is(t)}function W0(e,t){if(e==="input"||e==="change")return Is(t)}function Q0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:Q0;function Tl(e,t){if(Gt(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)||!Gt(e[c],t[c]))return!1}return!0}function Rf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jf(e,t){var i=Rf(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=Rf(i)}}function Of(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Of(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Df(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Os(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=Os(e.document)}return t}function qr(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 J0=_n&&"documentMode"in document&&11>=document.documentMode,wa=null,Xr=null,Ml=null,Zr=!1;function zf(e,t,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Zr||wa==null||wa!==Os(s)||(s=wa,"selectionStart"in s&&qr(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}),Ml&&Tl(Ml,s)||(Ml=s,s=Lo(Xr,"onSelect"),0<s.length&&(t=new Us("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=wa)))}function Bi(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Sa={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")},Wr={},Hf={};_n&&(Hf=document.createElement("div").style,"AnimationEvent"in window||(delete Sa.animationend.animation,delete Sa.animationiteration.animation,delete Sa.animationstart.animation),"TransitionEvent"in window||delete Sa.transitionend.transition);function Ui(e){if(Wr[e])return Wr[e];if(!Sa[e])return e;var t=Sa[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Hf)return Wr[e]=t[i];return e}var Bf=Ui("animationend"),Uf=Ui("animationiteration"),Kf=Ui("animationstart"),ev=Ui("transitionrun"),tv=Ui("transitionstart"),nv=Ui("transitioncancel"),If=Ui("transitionend"),Ff=new Map,Qr="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(" ");Qr.push("scrollEnd");function fn(e,t){Ff.set(e,t),zi(t,[e])}var Fs=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=[],Ca=0,Jr=0;function Gs(){for(var e=Ca,t=Jr=Ca=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&&Gf(i,c,d)}}function Ys(e,t,i,s){Jt[Ca++]=e,Jt[Ca++]=t,Jt[Ca++]=i,Jt[Ca++]=s,Jr|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function ec(e,t,i,s){return Ys(e,t,i,s),Ps(e)}function Ki(e,t){return Ys(e,null,null,t),Ps(e)}function Gf(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-Lt(i),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=i|536870912),d):null}function Ps(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 Ta={};function iv(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 Yt(e,t,i,s){return new iv(e,t,i,s)}function tc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Rn(e,t){var i=e.alternate;return i===null?(i=Yt(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 Yf(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 Vs(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=rx(e,i,Te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Yt(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=Yt(12,i,t,c|2),e.elementType=k,e.lanes=d,e;case j:return e=Yt(13,i,t,c),e.elementType=j,e.lanes=d,e;case D:return e=Yt(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=Yt(b,i,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function Ii(e,t,i,s){return e=Yt(7,e,s,t),e.lanes=i,e}function nc(e,t,i){return e=Yt(6,e,null,t),e.lanes=i,e}function Pf(e){var t=Yt(18,null,null,0);return t.stateNode=e,t}function ic(e,t,i){return t=Yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vf=new WeakMap;function en(e,t){if(typeof e=="object"&&e!==null){var i=Vf.get(e);return i!==void 0?i:(t={value:e,source:t,stack:gt(t)},Vf.set(e,t),t)}return{value:e,source:t,stack:gt(t)}}var Ma=[],Aa=0,$s=null,Al=0,tn=[],nn=0,ai=null,vn=1,xn="";function jn(e,t){Ma[Aa++]=Al,Ma[Aa++]=$s,$s=e,Al=t}function $f(e,t,i){tn[nn++]=vn,tn[nn++]=xn,tn[nn++]=ai,ai=e;var s=vn;e=xn;var c=32-Lt(s)-1;s&=~(1<<c),i+=1;var d=32-Lt(t)+c;if(30<d){var b=c-c%5;d=(s&(1<<b)-1).toString(32),s>>=b,c-=b,vn=1<<32-Lt(t)+c|i<<c|s,xn=d+e}else vn=1<<d|i<<c|s,xn=e}function ac(e){e.return!==null&&(jn(e,1),$f(e,1,0))}function lc(e){for(;e===$s;)$s=Ma[--Aa],Ma[Aa]=null,Al=Ma[--Aa],Ma[Aa]=null;for(;e===ai;)ai=tn[--nn],tn[nn]=null,xn=tn[--nn],tn[nn]=null,vn=tn[--nn],tn[nn]=null}function qf(e,t){tn[nn++]=vn,tn[nn++]=xn,tn[nn++]=ai,vn=t.id,xn=t.overflow,ai=e}var wt=null,Ze=null,He=!1,li=null,an=!1,sc=Error(o(519));function si(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw El(en(t,e)),sc}function Xf(e){var t=e.stateNode,i=e.type,s=e.memoizedProps;switch(t[xt]=e,t[Ot]=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<Xl.length;i++)Oe(Xl[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),rf(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),uf(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||fp(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=Ln),t=!0):t=!1,t||si(e,!0)}function Zf(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 Ea(e){if(e!==wt)return!1;if(!He)return Zf(e),He=!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&&si(e),Zf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=wp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));Ze=wp(e)}else t===27?(t=Ze,xi(e.type)?(e=ku,ku=null,Ze=e):Ze=t):Ze=wt?sn(e.stateNode.nextSibling):null;return!0}function Fi(){Ze=wt=null,He=!1}function oc(){var e=li;return e!==null&&(Ut===null?Ut=e:Ut.push.apply(Ut,e),li=null),e}function El(e){li===null?li=[e]:li.push(e)}var rc=be(null),Gi=null,On=null;function oi(e,t,i){ue(rc,t._currentValue),t._currentValue=i}function Dn(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 Na(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;Gt(c.pendingProps.value,b.value)||(e!==null?e.push(C):e=[C])}}else if(c===ae.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(es):e=[es])}c=c.return}e!==null&&uc(t,e,i,s),t.flags|=262144}function qs(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Gi=e,On=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return Wf(Gi,e)}function Xs(e,t){return Gi===null&&Yi(e),Wf(e,t)}function Wf(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},On===null){if(e===null)throw Error(o(308));On=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else On=On.next=t;return i}var av=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()})}},lv=a.unstable_scheduleCallback,sv=a.unstable_NormalPriority,ct={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function dc(){return{controller:new av,data:new Map,refCount:0}}function Nl(e){e.refCount--,e.refCount===0&&lv(sv,function(){e.controller.abort()})}var kl=null,fc=0,ka=0,La=null;function ov(e,t){if(kl===null){var i=kl=[];fc=0,ka=pu(),La={status:"pending",value:void 0,then:function(s){i.push(s)}}}return fc++,t.then(Qf,Qf),t}function Qf(){if(--fc===0&&kl!==null){La!==null&&(La.status="fulfilled");var e=kl;kl=null,ka=0,La=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function rv(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 Jf=A.S;A.S=function(e,t){zm=Mt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ov(e,t),Jf!==null&&Jf(e,t)};var Pi=be(null);function hc(){var e=Pi.current;return e!==null?e:$e.pooledCache}function Zs(e,t){t===null?ue(Pi,Pi.current):ue(Pi,t.pool)}function eh(){var e=hc();return e===null?null:{parent:ct._currentValue,pool:e}}var _a=Error(o(460)),mc=Error(o(474)),Ws=Error(o(542)),Qs={then:function(){}};function th(e){return e=e.status,e==="fulfilled"||e==="rejected"}function nh(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Ln,Ln),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ah(e),e;default:if(typeof t.status=="string")t.then(Ln,Ln);else{if(e=$e,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,ah(e),e}throw $i=t,_a}}function Vi(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?($i=i,_a):i}}var $i=null;function ih(){if($i===null)throw Error(o(459));var e=$i;return $i=null,e}function ah(e){if(e===_a||e===Ws)throw Error(o(483))}var Ra=null,Ll=0;function Js(e){var t=Ll;return Ll+=1,Ra===null&&(Ra=[]),nh(Ra,e,t)}function _l(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function eo(e,t){throw t.$$typeof===x?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function lh(e){function t(U,O){if(e){var I=U.deletions;I===null?(U.deletions=[O],U.flags|=16):I.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=Rn(U,O),U.index=0,U.sibling=null,U}function d(U,O,I){return U.index=I,e?(I=U.alternate,I!==null?(I=I.index,I<O?(U.flags|=67108866,O):I):(U.flags|=67108866,O)):(U.flags|=1048576,O)}function b(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function C(U,O,I,J){return O===null||O.tag!==6?(O=nc(I,U.mode,J),O.return=U,O):(O=c(O,I),O.return=U,O)}function L(U,O,I,J){var Se=I.type;return Se===M?X(U,O,I.props.children,J,I.key):O!==null&&(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===z&&Vi(Se)===O.type)?(O=c(O,I.props),_l(O,I),O.return=U,O):(O=Vs(I.type,I.key,I.props,null,U.mode,J),_l(O,I),O.return=U,O)}function F(U,O,I,J){return O===null||O.tag!==4||O.stateNode.containerInfo!==I.containerInfo||O.stateNode.implementation!==I.implementation?(O=ic(I,U.mode,J),O.return=U,O):(O=c(O,I.children||[]),O.return=U,O)}function X(U,O,I,J,Se){return O===null||O.tag!==7?(O=Ii(I,U.mode,J,Se),O.return=U,O):(O=c(O,I),O.return=U,O)}function ee(U,O,I){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=nc(""+O,U.mode,I),O.return=U,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case w:return I=Vs(O.type,O.key,O.props,null,U.mode,I),_l(I,O),I.return=U,I;case S:return O=ic(O,U.mode,I),O.return=U,O;case z:return O=Vi(O),ee(U,O,I)}if(P(O)||Z(O))return O=Ii(O,U.mode,I,null),O.return=U,O;if(typeof O.then=="function")return ee(U,Js(O),I);if(O.$$typeof===R)return ee(U,Xs(U,O),I);eo(U,O)}return null}function Y(U,O,I,J){var Se=O!==null?O.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return Se!==null?null:C(U,O,""+I,J);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case w:return I.key===Se?L(U,O,I,J):null;case S:return I.key===Se?F(U,O,I,J):null;case z:return I=Vi(I),Y(U,O,I,J)}if(P(I)||Z(I))return Se!==null?null:X(U,O,I,J,null);if(typeof I.then=="function")return Y(U,O,Js(I),J);if(I.$$typeof===R)return Y(U,O,Xs(U,I),J);eo(U,I)}return null}function V(U,O,I,J,Se){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return U=U.get(I)||null,C(O,U,""+J,Se);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return U=U.get(J.key===null?I:J.key)||null,L(O,U,J,Se);case S:return U=U.get(J.key===null?I:J.key)||null,F(O,U,J,Se);case z:return J=Vi(J),V(U,O,I,J,Se)}if(P(J)||Z(J))return U=U.get(I)||null,X(O,U,J,Se,null);if(typeof J.then=="function")return V(U,O,I,Js(J),Se);if(J.$$typeof===R)return V(U,O,I,Xs(O,J),Se);eo(O,J)}return null}function pe(U,O,I,J){for(var Se=null,Ue=null,ge=O,Le=O=0,ze=null;ge!==null&&Le<I.length;Le++){ge.index>Le?(ze=ge,ge=null):ze=ge.sibling;var Ke=Y(U,ge,I[Le],J);if(Ke===null){ge===null&&(ge=ze);break}e&&ge&&Ke.alternate===null&&t(U,ge),O=d(Ke,O,Le),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke,ge=ze}if(Le===I.length)return i(U,ge),He&&jn(U,Le),Se;if(ge===null){for(;Le<I.length;Le++)ge=ee(U,I[Le],J),ge!==null&&(O=d(ge,O,Le),Ue===null?Se=ge:Ue.sibling=ge,Ue=ge);return He&&jn(U,Le),Se}for(ge=s(ge);Le<I.length;Le++)ze=V(ge,U,Le,I[Le],J),ze!==null&&(e&&ze.alternate!==null&&ge.delete(ze.key===null?Le:ze.key),O=d(ze,O,Le),Ue===null?Se=ze:Ue.sibling=ze,Ue=ze);return e&&ge.forEach(function(Mi){return t(U,Mi)}),He&&jn(U,Le),Se}function Ce(U,O,I,J){if(I==null)throw Error(o(151));for(var Se=null,Ue=null,ge=O,Le=O=0,ze=null,Ke=I.next();ge!==null&&!Ke.done;Le++,Ke=I.next()){ge.index>Le?(ze=ge,ge=null):ze=ge.sibling;var Mi=Y(U,ge,Ke.value,J);if(Mi===null){ge===null&&(ge=ze);break}e&&ge&&Mi.alternate===null&&t(U,ge),O=d(Mi,O,Le),Ue===null?Se=Mi:Ue.sibling=Mi,Ue=Mi,ge=ze}if(Ke.done)return i(U,ge),He&&jn(U,Le),Se;if(ge===null){for(;!Ke.done;Le++,Ke=I.next())Ke=ee(U,Ke.value,J),Ke!==null&&(O=d(Ke,O,Le),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke);return He&&jn(U,Le),Se}for(ge=s(ge);!Ke.done;Le++,Ke=I.next())Ke=V(ge,U,Le,Ke.value,J),Ke!==null&&(e&&Ke.alternate!==null&&ge.delete(Ke.key===null?Le:Ke.key),O=d(Ke,O,Le),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke);return e&&ge.forEach(function(vx){return t(U,vx)}),He&&jn(U,Le),Se}function Ve(U,O,I,J){if(typeof I=="object"&&I!==null&&I.type===M&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case w:e:{for(var Se=I.key;O!==null;){if(O.key===Se){if(Se=I.type,Se===M){if(O.tag===7){i(U,O.sibling),J=c(O,I.props.children),J.return=U,U=J;break e}}else if(O.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===z&&Vi(Se)===O.type){i(U,O.sibling),J=c(O,I.props),_l(J,I),J.return=U,U=J;break e}i(U,O);break}else t(U,O);O=O.sibling}I.type===M?(J=Ii(I.props.children,U.mode,J,I.key),J.return=U,U=J):(J=Vs(I.type,I.key,I.props,null,U.mode,J),_l(J,I),J.return=U,U=J)}return b(U);case S:e:{for(Se=I.key;O!==null;){if(O.key===Se)if(O.tag===4&&O.stateNode.containerInfo===I.containerInfo&&O.stateNode.implementation===I.implementation){i(U,O.sibling),J=c(O,I.children||[]),J.return=U,U=J;break e}else{i(U,O);break}else t(U,O);O=O.sibling}J=ic(I,U.mode,J),J.return=U,U=J}return b(U);case z:return I=Vi(I),Ve(U,O,I,J)}if(P(I))return pe(U,O,I,J);if(Z(I)){if(Se=Z(I),typeof Se!="function")throw Error(o(150));return I=Se.call(I),Ce(U,O,I,J)}if(typeof I.then=="function")return Ve(U,O,Js(I),J);if(I.$$typeof===R)return Ve(U,O,Xs(U,I),J);eo(U,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,O!==null&&O.tag===6?(i(U,O.sibling),J=c(O,I),J.return=U,U=J):(i(U,O),J=nc(I,U.mode,J),J.return=U,U=J),b(U)):i(U,O)}return function(U,O,I,J){try{Ll=0;var Se=Ve(U,O,I,J);return Ra=null,Se}catch(ge){if(ge===_a||ge===Ws)throw ge;var Ue=Yt(29,ge,null,U.mode);return Ue.lanes=J,Ue.return=U,Ue}finally{}}}var qi=lh(!0),sh=lh(!1),ri=!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 ci(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ui(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=Ps(e),Gf(e,null,i),t}return Ys(e,s,t,i),Ps(e)}function Rl(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,Zd(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 jl(){if(yc){var e=La;if(e!==null)throw e}}function Ol(e,t,i,s){yc=!1;var c=e.updateQueue;ri=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var L=C,F=L.next;L.next=null,b===null?d=F:b.next=F,b=L;var X=e.alternate;X!==null&&(X=X.updateQueue,C=X.lastBaseUpdate,C!==b&&(C===null?X.firstBaseUpdate=F:C.next=F,X.lastBaseUpdate=L))}if(d!==null){var ee=c.baseState;b=0,X=F=L=null,C=d;do{var Y=C.lane&-536870913,V=Y!==C.lane;if(V?(De&Y)===Y:(s&Y)===Y){Y!==0&&Y===ka&&(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 Ve=i;switch(Ce.tag){case 1:if(pe=Ce.payload,typeof pe=="function"){ee=pe.call(Ve,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(Ve,ee,Y):pe,Y==null)break e;ee=v({},ee,Y);break e;case 2:ri=!0}}Y=C.callback,Y!==null&&(e.flags|=64,V&&(e.flags|=8192),V=c.callbacks,V===null?c.callbacks=[Y]:V.push(Y))}else V={lane:Y,tag:C.tag,payload:C.payload,callback:C.callback,next:null},X===null?(F=X=V,L=ee):X=X.next=V,b|=Y;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;V=C,C=V.next,V.next=null,c.lastBaseUpdate=V,c.shared.pending=null}}while(!0);X===null&&(L=ee),c.baseState=L,c.firstBaseUpdate=F,c.lastBaseUpdate=X,d===null&&(c.shared.lanes=0),pi|=b,e.lanes=b,e.memoizedState=ee}}function oh(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function rh(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)oh(i[e],t)}var ja=be(null),to=be(0);function ch(e,t){e=Yn,ue(to,e),ue(ja,t),Yn=e|t.baseLanes}function vc(){ue(to,Yn),ue(ja,ja.current)}function xc(){Yn=to.current,xe(ja),xe(to)}var Pt=be(null),ln=null;function di(e){var t=e.alternate;ue(st,st.current&1),ue(Pt,e),ln===null&&(t===null||ja.current!==null||t.memoizedState!==null)&&(ln=e)}function wc(e){ue(st,st.current),ue(Pt,e),ln===null&&(ln=e)}function uh(e){e.tag===22?(ue(st,st.current),ue(Pt,e),ln===null&&(ln=e)):fi()}function fi(){ue(st,st.current),ue(Pt,Pt.current)}function Vt(e){xe(Pt),ln===e&&(ln=null),xe(st)}var st=be(0);function no(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 zn=0,ke=null,Ye=null,ut=null,io=!1,Oa=!1,Xi=!1,ao=0,Dl=0,Da=null,cv=0;function at(){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(!Gt(e[i],t[i]))return!1;return!0}function Cc(e,t,i,s,c,d){return zn=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,Oa&&(d=fh(t,i,s,c)),dh(e),d}function dh(e){A.H=Bl;var t=Ye!==null&&Ye.next!==null;if(zn=0,ut=Ye=ke=null,io=!1,Dl=0,Da=null,t)throw Error(o(300));e===null||dt||(e=e.dependencies,e!==null&&qs(e)&&(dt=!0))}function fh(e,t,i,s){ke=e;var c=0;do{if(Oa&&(Da=null),Dl=0,Oa=!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(Oa);return d}function uv(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?zl(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(ke.flags|=1024),t}function Tc(){var e=ao!==0;return ao=0,e}function Mc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Ac(e){if(io){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}io=!1}zn=0,ut=Ye=ke=null,Oa=!1,Dl=ao=0,Da=null}function Rt(){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 ot(){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 lo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zl(e){var t=Dl;return Dl+=1,Da===null&&(Da=[]),e=nh(Da,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 so(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return zl(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=lo(),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]=q;return t.index++,i}function Hn(e,t){return typeof t=="function"?t(e):t}function oo(e){var t=ot();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,F=t,X=!1;do{var ee=F.lane&-536870913;if(ee!==F.lane?(De&ee)===ee:(zn&ee)===ee){var Y=F.revertLane;if(Y===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ee===ka&&(X=!0);else if((zn&Y)===Y){F=F.next,Y===ka&&(X=!0);continue}else ee={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(C=L=ee,b=d):L=L.next=ee,ke.lanes|=Y,pi|=Y;ee=F.action,Xi&&i(d,ee),d=F.hasEagerState?F.eagerState:i(d,ee)}else Y={lane:ee,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},L===null?(C=L=Y,b=d):L=L.next=Y,ke.lanes|=ee,pi|=ee;F=F.next}while(F!==null&&F!==t);if(L===null?b=d:L.next=C,!Gt(d,e.memoizedState)&&(dt=!0,X&&(i=La,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=ot(),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);Gt(d,t.memoizedState)||(dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),i.lastRenderedState=d}return[d,s]}function hh(e,t,i){var s=ke,c=ot(),d=He;if(d){if(i===void 0)throw Error(o(407));i=i()}else i=t();var b=!Gt((Ye||c).memoizedState,i);if(b&&(c.memoizedState=i,dt=!0),c=c.queue,Rc(gh.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||ut!==null&&ut.memoizedState.tag&1){if(s.flags|=2048,za(9,{destroy:void 0},ph.bind(null,s,c,i,t),null),$e===null)throw Error(o(349));d||(zn&127)!==0||mh(s,t,i)}return i}function mh(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=ke.updateQueue,t===null?(t=lo(),ke.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function ph(e,t,i,s){t.value=i,t.getSnapshot=s,bh(t)&&yh(e)}function gh(e,t,i){return i(function(){bh(t)&&yh(e)})}function bh(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Gt(e,i)}catch{return!0}}function yh(e){var t=Ki(e,2);t!==null&&Kt(t,e,2)}function Lc(e){var t=Rt();if(typeof e=="function"){var i=e;if(e=i(),Xi){yn(!0);try{i()}finally{yn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hn,lastRenderedState:e},t}function vh(e,t,i,s){return e.baseState=i,Nc(e,Ye,typeof s=="function"?s:Hn)}function dv(e,t,i,s,c){if(uo(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,xh(t,d)):(d.next=i.next,t.pending=i.next=d)}}function xh(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),wh(e,t,C)}catch(F){_c(e,t,F)}finally{d!==null&&b.types!==null&&(d.types=b.types),A.T=d}}else try{d=i(c,s),wh(e,t,d)}catch(F){_c(e,t,F)}}function wh(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){Sh(e,t,s)},function(s){return _c(e,t,s)}):Sh(e,t,i)}function Sh(e,t,i){t.status="fulfilled",t.value=i,Ch(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,xh(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,Ch(t),t=t.next;while(t!==s)}e.action=null}function Ch(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Th(e,t){return t}function Mh(e,t){if(He){var i=$e.formState;if(i!==null){e:{var s=ke;if(He){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}}si(s)}s=!1}s&&(t=i[0])}}return i=Rt(),i.memoizedState=i.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Th,lastRenderedState:t},i.queue=s,i=Yh.bind(null,ke,s),s.dispatch=i,s=Lc(!1),d=Hc.bind(null,ke,!1,s.queue),s=Rt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,i=dv.bind(null,ke,c,d,i),c.dispatch=i,s.memoizedState=e,[t,i,!1]}function Ah(e){var t=ot();return Eh(t,Ye,e)}function Eh(e,t,i){if(t=Nc(e,t,Th)[0],e=oo(Hn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=zl(t)}catch(b){throw b===_a?Ws:b}else s=t;t=ot();var c=t.queue,d=c.dispatch;return i!==t.memoizedState&&(ke.flags|=2048,za(9,{destroy:void 0},fv.bind(null,c,i),null)),[s,d,e]}function fv(e,t){e.action=t}function Nh(e){var t=ot(),i=Ye;if(i!==null)return Eh(t,i,e);ot(),t=t.memoizedState,i=ot();var s=i.queue.dispatch;return i.memoizedState=e,[t,s,!1]}function za(e,t,i,s){return e={tag:e,create:i,deps:s,inst:t,next:null},t=ke.updateQueue,t===null&&(t=lo(),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 kh(){return ot().memoizedState}function ro(e,t,i,s){var c=Rt();ke.flags|=e,c.memoizedState=za(1|t,{destroy:void 0},i,s===void 0?null:s)}function co(e,t,i,s){var c=ot();s=s===void 0?null:s;var d=c.memoizedState.inst;Ye!==null&&s!==null&&Sc(s,Ye.memoizedState.deps)?c.memoizedState=za(t,d,i,s):(ke.flags|=e,c.memoizedState=za(1|t,d,i,s))}function Lh(e,t){ro(8390656,8,e,t)}function Rc(e,t){co(2048,8,e,t)}function hv(e){ke.flags|=4;var t=ke.updateQueue;if(t===null)t=lo(),ke.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function _h(e){var t=ot().memoizedState;return hv({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Rh(e,t){return co(4,2,e,t)}function jh(e,t){return co(4,4,e,t)}function Oh(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 Dh(e,t,i){i=i!=null?i.concat([e]):null,co(4,4,Oh.bind(null,t,e),i)}function jc(){}function zh(e,t){var i=ot();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 Hh(e,t){var i=ot();t=t===void 0?null:t;var s=i.memoizedState;if(t!==null&&Sc(t,s[1]))return s[0];if(s=e(),Xi){yn(!0);try{e()}finally{yn(!1)}}return i.memoizedState=[s,t],s}function Oc(e,t,i){return i===void 0||(zn&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Bm(),ke.lanes|=e,pi|=e,i)}function Bh(e,t,i,s){return Gt(i,t)?i:ja.current!==null?(e=Oc(e,i,s),Gt(e,t)||(dt=!0),e):(zn&42)===0||(zn&1073741824)!==0&&(De&261930)===0?(dt=!0,e.memoizedState=i):(e=Bm(),ke.lanes|=e,pi|=e,t)}function Uh(e,t,i,s,c){var d=G.p;G.p=d!==0&&8>d?d:8;var b=A.T,C={};A.T=C,Hc(e,!1,t,i);try{var L=c(),F=A.S;if(F!==null&&F(C,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var X=rv(L,s);Hl(e,t,X,Xt(e))}else Hl(e,t,s,Xt(e))}catch(ee){Hl(e,t,{then:function(){},status:"rejected",reason:ee},Xt())}finally{G.p=d,b!==null&&C.types!==null&&(b.types=C.types),A.T=b}}function mv(){}function Dc(e,t,i,s){if(e.tag!==5)throw Error(o(476));var c=Kh(e).queue;Uh(e,c,t,Q,i===null?mv:function(){return Ih(e),i(s)})}function Kh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hn,lastRenderedState:Q},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ih(e){var t=Kh(e);t.next===null&&(t=e.alternate.memoizedState),Hl(e,t.next.queue,{},Xt())}function zc(){return St(es)}function Fh(){return ot().memoizedState}function Gh(){return ot().memoizedState}function pv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Xt();e=ci(i);var s=ui(t,e,i);s!==null&&(Kt(s,t,i),Rl(s,t,i)),t={cache:dc()},e.payload=t;return}t=t.return}}function gv(e,t,i){var s=Xt();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},uo(e)?Ph(t,i):(i=ec(e,t,i,s),i!==null&&(Kt(i,e,s),Vh(i,t,s)))}function Yh(e,t,i){var s=Xt();Hl(e,t,i,s)}function Hl(e,t,i,s){var c={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(uo(e))Ph(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,Gt(C,b))return Ys(e,t,c,0),$e===null&&Gs(),!1}catch{}finally{}if(i=ec(e,t,c,s),i!==null)return Kt(i,e,s),Vh(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},uo(e)){if(t)throw Error(o(479))}else t=ec(e,i,s,2),t!==null&&Kt(t,e,2)}function uo(e){var t=e.alternate;return e===ke||t!==null&&t===ke}function Ph(e,t){Oa=io=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Vh(e,t,i){if((i&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Zd(e,i)}}var Bl={readContext:St,use:so,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};Bl.useEffectEvent=at;var $h={readContext:St,use:so,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Lh,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,ro(4194308,4,Oh.bind(null,t,e),i)},useLayoutEffect:function(e,t){return ro(4194308,4,e,t)},useInsertionEffect:function(e,t){ro(4,2,e,t)},useMemo:function(e,t){var i=Rt();t=t===void 0?null:t;var s=e();if(Xi){yn(!0);try{e()}finally{yn(!1)}}return i.memoizedState=[s,t],s},useReducer:function(e,t,i){var s=Rt();if(i!==void 0){var c=i(t);if(Xi){yn(!0);try{i(t)}finally{yn(!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=gv.bind(null,ke,e),[s.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=Lc(e);var t=e.queue,i=Yh.bind(null,ke,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:jc,useDeferredValue:function(e,t){var i=Rt();return Oc(i,e,t)},useTransition:function(){var e=Lc(!1);return e=Uh.bind(null,ke,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var s=ke,c=Rt();if(He){if(i===void 0)throw Error(o(407));i=i()}else{if(i=t(),$e===null)throw Error(o(349));(De&127)!==0||mh(s,t,i)}c.memoizedState=i;var d={value:i,getSnapshot:t};return c.queue=d,Lh(gh.bind(null,s,d,e),[e]),s.flags|=2048,za(9,{destroy:void 0},ph.bind(null,s,d,i,t),null),i},useId:function(){var e=Rt(),t=$e.identifierPrefix;if(He){var i=xn,s=vn;i=(s&~(1<<32-Lt(s)-1)).toString(32)+i,t="_"+t+"R_"+i,i=ao++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=cv++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zc,useFormState:Mh,useActionState:Mh,useOptimistic:function(e){var t=Rt();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 Rt().memoizedState=pv.bind(null,ke)},useEffectEvent:function(e){var t=Rt(),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:so,useCallback:zh,useContext:St,useEffect:Rc,useImperativeHandle:Dh,useInsertionEffect:Rh,useLayoutEffect:jh,useMemo:Hh,useReducer:oo,useRef:kh,useState:function(){return oo(Hn)},useDebugValue:jc,useDeferredValue:function(e,t){var i=ot();return Bh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=oo(Hn)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:zl(e),t]},useSyncExternalStore:hh,useId:Fh,useHostTransitionStatus:zc,useFormState:Ah,useActionState:Ah,useOptimistic:function(e,t){var i=ot();return vh(i,Ye,e,t)},useMemoCache:Ec,useCacheRefresh:Gh};Bc.useEffectEvent=_h;var qh={readContext:St,use:so,useCallback:zh,useContext:St,useEffect:Rc,useImperativeHandle:Dh,useInsertionEffect:Rh,useLayoutEffect:jh,useMemo:Hh,useReducer:kc,useRef:kh,useState:function(){return kc(Hn)},useDebugValue:jc,useDeferredValue:function(e,t){var i=ot();return Ye===null?Oc(i,e,t):Bh(i,Ye.memoizedState,e,t)},useTransition:function(){var e=kc(Hn)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:zl(e),t]},useSyncExternalStore:hh,useId:Fh,useHostTransitionStatus:zc,useFormState:Nh,useActionState:Nh,useOptimistic:function(e,t){var i=ot();return Ye!==null?vh(i,Ye,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Ec,useCacheRefresh:Gh};qh.useEffectEvent=_h;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=Xt(),c=ci(s);c.payload=t,i!=null&&(c.callback=i),t=ui(e,c,s),t!==null&&(Kt(t,e,s),Rl(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=Xt(),c=ci(s);c.tag=1,c.payload=t,i!=null&&(c.callback=i),t=ui(e,c,s),t!==null&&(Kt(t,e,s),Rl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Xt(),s=ci(i);s.tag=2,t!=null&&(s.callback=t),t=ui(e,s,i),t!==null&&(Kt(t,e,i),Rl(t,e,i))}};function Xh(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?!Tl(i,s)||!Tl(c,d):!0}function Zh(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 Wh(e){Fs(e)}function Qh(e){console.error(e)}function Jh(e){Fs(e)}function fo(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function em(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=ci(i),i.tag=3,i.payload={element:null},i.callback=function(){fo(e,t)},i}function tm(e){return e=ci(e),e.tag=3,e}function nm(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(){em(t,i,s)}}var b=i.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){em(t,i,s),typeof c!="function"&&(gi===null?gi=new Set([this]):gi.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function bv(e,t,i,s,c){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=i.alternate,t!==null&&Na(t,i,c,!0),i=Pt.current,i!==null){switch(i.tag){case 31:case 13:return ln===null?To():i.alternate===null&<===0&&(lt=3),i.flags&=-257,i.flags|=65536,i.lanes=c,s===Qs?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===Qs?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),To(),!1}if(He)return t=Pt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==sc&&(e=Error(o(422),{cause:s}),El(en(e,i)))):(s!==sc&&(t=Error(o(423),{cause:s}),El(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),lt!==4&&(lt=2)),!1;var d=Error(o(520),{cause:s});if(d=en(d,i),Vl===null?Vl=[d]:Vl.push(d),lt!==4&&(lt=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"&&(gi===null||!gi.has(d))))return i.flags|=65536,c&=-c,i.lanes|=c,c=tm(c),nm(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?sh(t,null,i,s):qi(t,e.child,i,s)}function im(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),Bn(e,t,c)):(He&&C&&ac(t),t.flags|=1,Ct(e,t,s,c),t.child)}function am(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,lm(e,t,d,s,c)):(e=Vs(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:Tl,i(b,s)&&e.ref===t.ref)return Bn(e,t,c)}return t.flags|=1,e=Rn(d,s),e.ref=t.ref,e.return=t,t.child=e}function lm(e,t,i,s,c){if(e!==null){var d=e.memoizedProps;if(Tl(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,Bn(e,t,c)}return Gc(e,t,i,s,c)}function sm(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 om(e,t,d,i,s)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Zs(t,d!==null?d.cachePool:null),d!==null?ch(t,d):vc(),uh(t);else return s=t.lanes=536870912,om(e,t,d!==null?d.baseLanes|i:i,i,s)}else d!==null?(Zs(t,d.cachePool),ch(t,d),fi(),t.memoizedState=null):(e!==null&&Zs(t,null),vc(),fi());return Ct(e,t,c,i),t.child}function Ul(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function om(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&&Zs(t,null),vc(),uh(t),e!==null&&Na(e,t,s,!0),t.childLanes=c,null}function ho(e,t){return t=po({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rm(e,t,i){return qi(t,e.child,null,i),e=ho(t,t.pendingProps),e.flags|=2,Vt(t),t.memoizedState=null,e}function yv(e,t,i){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(s.mode==="hidden")return e=ho(t,s),t.lanes=536870912,Ul(null,e);if(wc(t),(e=Ze)?(e=xp(e,an),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ai!==null?{id:vn,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},i=Pf(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw si(t);return t.lanes=536870912,null}return ho(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=rm(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||Na(e,t,i,!1),c=(i&e.childLanes)!==0,dt||c){if(s=$e,s!==null&&(b=Wd(s,i),b!==0&&b!==d.retryLane))throw d.retryLane=b,Ki(e,b),Kt(s,e,b),Fc;To(),t=rm(e,t,i)}else e=d.treeContext,Ze=sn(b.nextSibling),wt=t,He=!0,li=null,an=!1,e!==null&&qf(t,e),t=ho(t,s),t.flags|=4096;return t}return e=Rn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mo(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),Bn(e,t,c)):(He&&s&&ac(t),t.flags|=1,Ct(e,t,i,c),t.child)}function cm(e,t,i,s,c,d){return Yi(t),t.updateQueue=null,i=fh(t,s,i,c),dh(e),s=Tc(),e!==null&&!dt?(Mc(e,t,d),Bn(e,t,d)):(He&&s&&ac(t),t.flags|=1,Ct(e,t,i,d),t.child)}function um(e,t,i,s,c){if(Yi(t),t.stateNode===null){var d=Ta,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):Ta,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),Ol(t,s,d,c),jl(),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 F=d.context,X=i.contextType;b=Ta,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||F!==b)&&Zh(t,d,s,b),ri=!1;var Y=t.memoizedState;d.state=Y,Ol(t,s,d,c),jl(),F=t.memoizedState,C||Y!==F||ri?(typeof ee=="function"&&(Uc(t,i,ee,s),F=t.memoizedState),(L=ri||Xh(t,i,L,s,Y,F,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=F),d.props=s,d.state=F,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,F=i.contextType,L=Ta,typeof F=="object"&&F!==null&&(L=St(F)),C=i.getDerivedStateFromProps,(F=typeof C=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==ee||Y!==L)&&Zh(t,d,s,L),ri=!1,Y=t.memoizedState,d.state=Y,Ol(t,s,d,c),jl();var V=t.memoizedState;b!==ee||Y!==V||ri||e!==null&&e.dependencies!==null&&qs(e.dependencies)?(typeof C=="function"&&(Uc(t,i,C,s),V=t.memoizedState),(X=ri||Xh(t,i,X,s,Y,V,L)||e!==null&&e.dependencies!==null&&qs(e.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,V,L),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,V,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=V),d.props=s,d.state=V,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,mo(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=qi(t,e.child,null,c),t.child=qi(t,null,i,c)):Ct(e,t,i,c),t.memoizedState=d.state,e=t.child):e=Bn(e,t,c),e}function dm(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:eh()}}function Vc(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=qt),e}function fm(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:(st.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(c?di(t):fi(),(e=Ze)?(e=xp(e,an),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ai!==null?{id:vn,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},i=Pf(e),i.return=t,t.child=i,wt=t,Ze=null)):e=null,e===null)throw si(t);return Nu(e)?t.lanes=32:t.lanes=536870912,null}var C=s.children;return s=s.fallback,c?(fi(),c=t.mode,C=po({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=Vc(e,b,i),t.memoizedState=Yc,Ul(null,s)):(di(t),$c(t,C))}var L=e.memoizedState;if(L!==null&&(C=L.dehydrated,C!==null)){if(d)t.flags&256?(di(t),t.flags&=-257,t=qc(e,t,i)):t.memoizedState!==null?(fi(),t.child=e.child,t.flags|=128,t=null):(fi(),C=s.fallback,c=t.mode,s=po({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,qi(t,e.child,null,i),s=t.child,s.memoizedState=Pc(i),s.childLanes=Vc(e,b,i),t.memoizedState=Yc,t=Ul(null,s));else if(di(t),Nu(C)){if(b=C.nextSibling&&C.nextSibling.dataset,b)var F=b.dgst;b=F,s=Error(o(419)),s.stack="",s.digest=b,El({value:s,source:null,stack:null}),t=qc(e,t,i)}else if(dt||Na(e,t,i,!1),b=(i&e.childLanes)!==0,dt||b){if(b=$e,b!==null&&(s=Wd(b,i),s!==0&&s!==L.retryLane))throw L.retryLane=s,Ki(e,s),Kt(b,e,s),Fc;Eu(C)||To(),t=qc(e,t,i)}else Eu(C)?(t.flags|=192,t.child=e.child,t=null):(e=L.treeContext,Ze=sn(C.nextSibling),wt=t,He=!0,li=null,an=!1,e!==null&&qf(t,e),t=$c(t,s.children),t.flags|=4096);return t}return c?(fi(),C=s.fallback,c=t.mode,L=e.child,F=L.sibling,s=Rn(L,{mode:"hidden",children:s.children}),s.subtreeFlags=L.subtreeFlags&65011712,F!==null?C=Rn(F,C):(C=Ii(C,c,i,null),C.flags|=2),C.return=t,s.return=t,s.sibling=C,t.child=s,Ul(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=eh(),C={baseLanes:C.baseLanes|i,cachePool:c}),s.memoizedState=C,s.childLanes=Vc(e,b,i),t.memoizedState=Yc,Ul(e.child,s)):(di(t),i=e.child,e=i.sibling,i=Rn(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 $c(e,t){return t=po({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function po(e,t){return e=Yt(22,e,null,t),e.lanes=0,e}function qc(e,t,i){return qi(t,e.child,null,i),e=$c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function hm(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 mm(e,t,i){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var b=st.current,C=(b&2)!==0;if(C?(b=b&1|2,t.flags|=128):b&=1,ue(st,b),Ct(e,t,s,i),s=He?Al:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hm(e,i,t);else if(e.tag===19)hm(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&&no(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&&no(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 Bn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),pi|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Na(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=Rn(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Rn(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&&qs(e)))}function vv(e,t,i){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),oi(t,ct,e.memoizedState.cache),Fi();break;case 27:case 5:we(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:oi(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?(di(t),t.flags|=128,null):(i&t.child.childLanes)!==0?fm(e,t,i):(di(t),e=Bn(e,t,i),e!==null?e.sibling:null);di(t);break;case 19:var c=(e.flags&128)!==0;if(s=(i&t.childLanes)!==0,s||(Na(e,t,i,!1),s=(i&t.childLanes)!==0),c){if(s)return mm(e,t,i);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ue(st,st.current),s)break;return null;case 22:return t.lanes=0,sm(e,t,i,t.pendingProps);case 24:oi(t,ct,e.memoizedState.cache)}return Bn(e,t,i)}function pm(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,vv(e,t,i);dt=(e.flags&131072)!==0}else dt=!1,He&&(t.flags&1048576)!==0&&$f(t,Al,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Vi(t.elementType),t.type=e,typeof e=="function")tc(e)?(s=Zi(e,s),t.tag=1,t=um(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=im(null,t,e,s,i);break e}else if(c===_){t.tag=14,t=am(null,t,e,s,i);break e}}throw t=re(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),um(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),Ol(t,s,null,i);var b=t.memoizedState;if(s=b.cache,oi(t,ct,s),s!==d.cache&&uc(t,[ct],i,!0),jl(),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=dm(e,t,s,i);break e}else if(s!==c){c=en(Error(o(424)),t),El(c),t=dm(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,He=!0,li=null,an=!0,i=sh(t,null,s,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Fi(),s===c){t=Bn(e,t,i);break e}Ct(e,t,s,i)}t=t.child}return t;case 26:return mo(e,t),e===null?(i=Ap(t.type,null,t.pendingProps,null))?t.memoizedState=i:He||(i=t.type,e=t.pendingProps,s=_o(ye.current).createElement(i),s[xt]=t,s[Ot]=e,Tt(s,i,e),bt(s),t.stateNode=s):t.memoizedState=Ap(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return we(t),e===null&&He&&(s=t.stateNode=Cp(t.type,t.pendingProps,ye.current),wt=t,an=!0,c=Ze,xi(t.type)?(ku=c,Ze=sn(s.firstChild)):Ze=c),Ct(e,t,t.pendingProps.children,i),mo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((c=s=Ze)&&(s=Xv(s,t.type,t.pendingProps,an),s!==null?(t.stateNode=s,wt=t,Ze=sn(s.firstChild),an=!1,c=!0):c=!1),c||si(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,uv,null,null,i),es._currentValue=c),mo(e,t),Ct(e,t,s,i),t.child;case 6:return e===null&&He&&((e=i=Ze)&&(i=Zv(i,t.pendingProps,an),i!==null?(t.stateNode=i,wt=t,Ze=null,e=!0):e=!1),e||si(t)),null;case 13:return fm(e,t,i);case 4:return ve(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=qi(t,null,s,i):Ct(e,t,s,i),t.child;case 11:return im(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,oi(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 am(e,t,t.type,t.pendingProps,i);case 15:return lm(e,t,t.type,t.pendingProps,i);case 19:return mm(e,t,i);case 31:return yv(e,t,i);case 22:return sm(e,t,i,t.pendingProps);case 24:return Yi(t),s=St(ct),e===null?(c=hc(),c===null&&(c=$e,d=dc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=i),c=d),t.memoizedState={parent:s,cache:c},pc(t),oi(t,ct,c)):((e.lanes&i)!==0&&(gc(e,t),Ol(t,null,null,i),jl()),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),oi(t,ct,s)):(s=d.cache,oi(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 Un(e){e.flags|=4}function Wc(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(Fm())e.flags|=8192;else throw $i=Qs,mc}else e.flags&=-16777217}function gm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!_p(t))if(Fm())e.flags|=8192;else throw $i=Qs,mc}function go(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?qd():536870912,e.lanes|=t,Ka|=t)}function Kl(e,t){if(!He)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 We(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 xv(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 We(t),null;case 1:return We(t),null;case 3:return i=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Dn(ct),le(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ea(t)?Un(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,oc())),We(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(Un(t),d!==null?(We(t),gm(t,d)):(We(t),Wc(t,c,null,s,i))):d?d!==e.memoizedState?(Un(t),We(t),gm(t,d)):(We(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Un(t),We(t),Wc(t,c,e,s,i)),null;case 27:if(Ee(t),i=ye.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Un(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return We(t),null}e=Te.current,Ea(t)?Xf(t):(e=Cp(c,s,i),t.stateNode=e,Un(t))}return We(t),null;case 5:if(Ee(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Un(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return We(t),null}if(d=Te.current,Ea(t))Xf(t);else{var b=_o(ye.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[Ot]=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&&Un(t)}}return We(t),Wc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Un(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=ye.current,Ea(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||fp(e.nodeValue,i)),e||si(t,!0)}else e=_o(e).createTextNode(s),e[xt]=t,t.stateNode=e}return We(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(s=Ea(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;We(t),e=!1}else i=oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Vt(t),t):(Vt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return We(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Ea(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;We(t),c=!1}else c=oc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Vt(t),t):(Vt(t),null)}return Vt(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),go(t,t.updateQueue),We(t),null);case 4:return le(),e===null&&vu(t.stateNode.containerInfo),We(t),null;case 10:return Dn(t.type),We(t),null;case 19:if(xe(st),s=t.memoizedState,s===null)return We(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Kl(s,!1);else{if(lt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=no(e),d!==null){for(t.flags|=128,Kl(s,!1),e=d.updateQueue,t.updateQueue=e,go(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Yf(i,e),i=i.sibling;return ue(st,st.current&1|2),He&&jn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Mt()>wo&&(t.flags|=128,c=!0,Kl(s,!1),t.lanes=4194304)}else{if(!c)if(e=no(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,go(t,e),Kl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!He)return We(t),null}else 2*Mt()-s.renderingStartTime>wo&&i!==536870912&&(t.flags|=128,c=!0,Kl(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=st.current,ue(st,c?i&1|2:i&1),He&&jn(t,s.treeForkCount),e):(We(t),null);case 22:case 23:return Vt(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&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),i=t.updateQueue,i!==null&&go(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),Dn(ct),We(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function wv(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 Dn(ct),le(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ee(t),null;case 31:if(t.memoizedState!==null){if(Vt(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(Vt(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(st),null;case 4:return le(),null;case 10:return Dn(t.type),null;case 22:case 23:return Vt(t),xc(),e!==null&&xe(Pi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Dn(ct),null;case 25:return null;default:return null}}function bm(e,t){switch(lc(t),t.tag){case 3:Dn(ct),le();break;case 26:case 27:case 5:Ee(t);break;case 4:le();break;case 31:t.memoizedState!==null&&Vt(t);break;case 13:Vt(t);break;case 19:xe(st);break;case 10:Dn(t.type);break;case 22:case 23:Vt(t),xc(),e!==null&&xe(Pi);break;case 24:Dn(ct)}}function Il(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 hi(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,F=C;try{F()}catch(X){Ge(c,L,X)}}}s=s.next}while(s!==d)}}catch(X){Ge(t,t.return,X)}}function ym(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{rh(t,i)}catch(s){Ge(e,e.return,s)}}}function vm(e,t,i){i.props=Zi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){Ge(e,t,s)}}function Fl(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 wn(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 xm(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 Qc(e,t,i){try{var s=e.stateNode;Gv(s,e.type,i,t),s[Ot]=t}catch(c){Ge(e,e.return,c)}}function wm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&xi(e.type)||e.tag===4}function Jc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wm(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&&xi(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=Ln));else if(s!==4&&(s===27&&xi(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 bo(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&&xi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(bo(e,t,i),e=e.sibling;e!==null;)bo(e,t,i),e=e.sibling}function Sm(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[Ot]=i}catch(d){Ge(e,e.return,d)}}var Kn=!1,ft=!1,tu=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,yt=null;function Sv(e,t){if(e=e.containerInfo,Su=Bo,e=Df(e),qr(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,F=0,X=0,ee=e,Y=null;t:for(;;){for(var V;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),(V=ee.firstChild)!==null;)Y=ee,ee=V;for(;;){if(ee===e)break t;if(Y===i&&++F===c&&(C=b),Y===d&&++X===s&&(L=b),(V=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=V}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},Bo=!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 Tm(e,t,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:Fn(e,i),s&4&&Il(5,i);break;case 1:if(Fn(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&&ym(i),s&512&&Fl(i,i.return);break;case 3:if(Fn(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{rh(e,t)}catch(b){Ge(i,i.return,b)}}break;case 27:t===null&&s&4&&Sm(i);case 26:case 5:Fn(e,i),t===null&&s&4&&xm(i),s&512&&Fl(i,i.return);break;case 12:Fn(e,i);break;case 31:Fn(e,i),s&4&&Em(e,i);break;case 13:Fn(e,i),s&4&&Nm(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=_v.bind(null,i),Wv(e,i))));break;case 22:if(s=i.memoizedState!==null||Kn,!s){t=t!==null&&t.memoizedState!==null||ft,c=Kn;var d=ft;Kn=s,(ft=t)&&!d?Gn(e,i,(i.subtreeFlags&8772)!==0):Fn(e,i),Kn=c,ft=d}break;case 30:break;default:Fn(e,i)}}function Mm(e){var t=e.alternate;t!==null&&(e.alternate=null,Mm(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,zt=!1;function In(e,t,i){for(i=i.child;i!==null;)Am(e,t,i),i=i.sibling}function Am(e,t,i){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(ei,i)}catch{}switch(i.tag){case 26:ft||wn(i,t),In(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:ft||wn(i,t);var s=nt,c=zt;xi(i.type)&&(nt=i.stateNode,zt=!1),In(e,t,i),Wl(i.stateNode),nt=s,zt=c;break;case 5:ft||wn(i,t);case 6:if(s=nt,c=zt,nt=null,In(e,t,i),nt=s,zt=c,nt!==null)if(zt)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&&(zt?(e=nt,yp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),qa(e)):yp(nt,i.stateNode));break;case 4:s=nt,c=zt,nt=i.stateNode.containerInfo,zt=!0,In(e,t,i),nt=s,zt=c;break;case 0:case 11:case 14:case 15:hi(2,i,t),ft||hi(4,i,t),In(e,t,i);break;case 1:ft||(wn(i,t),s=i.stateNode,typeof s.componentWillUnmount=="function"&&vm(i,t,s)),In(e,t,i);break;case 21:In(e,t,i);break;case 22:ft=(s=ft)||i.memoizedState!==null,In(e,t,i),ft=s;break;default:In(e,t,i)}}function Em(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 Nm(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 Cv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Cm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Cm),t;default:throw Error(o(435,e.tag))}}function yo(e,t){var i=Cv(e);t.forEach(function(s){if(!i.has(s)){i.add(s);var c=Rv.bind(null,e,s);s.then(c,c)}})}function Ht(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(xi(C.type)){nt=C.stateNode,zt=!1;break e}break;case 5:nt=C.stateNode,zt=!1;break e;case 3:case 4:nt=C.stateNode.containerInfo,zt=!0;break e}C=C.return}if(nt===null)throw Error(o(160));Am(d,b,c),nt=null,zt=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)km(t,e),t=t.sibling}var hn=null;function km(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ht(t,e),Bt(e),s&4&&(hi(3,e,e.return),Il(3,e),hi(5,e,e.return));break;case 1:Ht(t,e),Bt(e),s&512&&(ft||i===null||wn(i,i.return)),s&64&&Kn&&(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(Ht(t,e),Bt(e),s&512&&(ft||i===null||wn(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[pl]||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=kp("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=kp("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 Lp(c,e.type,e.stateNode);else e.stateNode=Np(c,s,e.memoizedProps);else d!==s?(d===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):d.count--,s===null?Lp(c,e.type,e.stateNode):Np(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Qc(e,e.memoizedProps,i.memoizedProps)}break;case 27:Ht(t,e),Bt(e),s&512&&(ft||i===null||wn(i,i.return)),i!==null&&s&4&&Qc(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Ht(t,e),Bt(e),s&512&&(ft||i===null||wn(i,i.return)),e.flags&32){c=e.stateNode;try{ba(c,"")}catch(pe){Ge(e,e.return,pe)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Qc(e,c,i!==null?i.memoizedProps:c)),s&1024&&(tu=!0);break;case 6:if(Ht(t,e),Bt(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(Oo=null,c=hn,hn=Ro(t.containerInfo),Ht(t,e),hn=c,Bt(e),s&4&&i!==null&&i.memoizedState.isDehydrated)try{qa(t.containerInfo)}catch(pe){Ge(e,e.return,pe)}tu&&(tu=!1,Lm(e));break;case 4:s=hn,hn=Ro(e.stateNode.containerInfo),Ht(t,e),Bt(e),hn=s;break;case 12:Ht(t,e),Bt(e);break;case 31:Ht(t,e),Bt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yo(e,s)));break;case 13:Ht(t,e),Bt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(xo=Mt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yo(e,s)));break;case 22:c=e.memoizedState!==null;var L=i!==null&&i.memoizedState!==null,F=Kn,X=ft;if(Kn=F||c,ft=X||L,Ht(t,e),ft=X,Kn=F,Bt(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(i===null||L||Kn||ft||Wi(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 V=L.stateNode;c?vp(V,!0):vp(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,yo(e,i))));break;case 19:Ht(t,e),Bt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yo(e,s)));break;case 30:break;case 21:break;default:Ht(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{for(var i,s=e.return;s!==null;){if(wm(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);bo(e,d,c);break;case 5:var b=i.stateNode;i.flags&32&&(ba(b,""),i.flags&=-33);var C=Jc(e);bo(e,C,b);break;case 3:case 4:var L=i.stateNode.containerInfo,F=Jc(e);eu(e,F,L);break;default:throw Error(o(161))}}catch(X){Ge(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Lm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Fn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Tm(e,t.alternate,t),t=t.sibling}function Wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:hi(4,t,t.return),Wi(t);break;case 1:wn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&vm(t,t.return,i),Wi(t);break;case 27:Wl(t.stateNode);case 26:case 5:wn(t,t.return),Wi(t);break;case 22:t.memoizedState===null&&Wi(t);break;case 30:Wi(t);break;default:Wi(t)}e=e.sibling}}function Gn(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:Gn(c,d,i),Il(4,d);break;case 1:if(Gn(c,d,i),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(F){Ge(s,s.return,F)}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++)oh(L[c],C)}catch(F){Ge(s,s.return,F)}}i&&b&64&&ym(d),Fl(d,d.return);break;case 27:Sm(d);case 26:case 5:Gn(c,d,i),i&&s===null&&b&4&&xm(d),Fl(d,d.return);break;case 12:Gn(c,d,i);break;case 31:Gn(c,d,i),i&&b&4&&Em(c,d);break;case 13:Gn(c,d,i),i&&b&4&&Nm(c,d);break;case 22:d.memoizedState===null&&Gn(c,d,i),Fl(d,d.return);break;case 30:break;default:Gn(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&&Nl(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&&Nl(e))}function mn(e,t,i,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_m(e,t,i,s),t=t.sibling}function _m(e,t,i,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,i,s),c&2048&&Il(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&&Nl(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):Gl(e,t):d._visibility&2?mn(e,t,i,s):(d._visibility|=2,Ha(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 Ha(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,F=b.flags;switch(b.tag){case 0:case 11:case 15:Ha(d,b,C,L,c),Il(8,b);break;case 23:break;case 22:var X=b.stateNode;b.memoizedState!==null?X._visibility&2?Ha(d,b,C,L,c):Gl(d,b):(X._visibility|=2,Ha(d,b,C,L,c)),c&&F&2048&&nu(b.alternate,b);break;case 24:Ha(d,b,C,L,c),c&&F&2048&&iu(b.alternate,b);break;default:Ha(d,b,C,L,c)}t=t.sibling}}function Gl(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:Gl(i,s),c&2048&&nu(s.alternate,s);break;case 24:Gl(i,s),c&2048&&iu(s.alternate,s);break;default:Gl(i,s)}t=t.sibling}}var Yl=8192;function Ba(e,t,i){if(e.subtreeFlags&Yl)for(e=e.child;e!==null;)Rm(e,t,i),e=e.sibling}function Rm(e,t,i){switch(e.tag){case 26:Ba(e,t,i),e.flags&Yl&&e.memoizedState!==null&&cx(i,hn,e.memoizedState,e.memoizedProps);break;case 5:Ba(e,t,i);break;case 3:case 4:var s=hn;hn=Ro(e.stateNode.containerInfo),Ba(e,t,i),hn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Yl,Yl=16777216,Ba(e,t,i),Yl=s):Ba(e,t,i));break;default:Ba(e,t,i)}}function jm(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 Pl(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,Dm(s,e)}jm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Om(e),e=e.sibling}function Om(e){switch(e.tag){case 0:case 11:case 15:Pl(e),e.flags&2048&&hi(9,e,e.return);break;case 3:Pl(e);break;case 12:Pl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,vo(e)):Pl(e);break;default:Pl(e)}}function vo(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,Dm(s,e)}jm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:hi(8,t,t.return),vo(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,vo(t));break;default:vo(t)}e=e.sibling}}function Dm(e,t){for(;yt!==null;){var i=yt;switch(i.tag){case 0:case 11:case 15:hi(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:Nl(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(Mm(s),s===i){yt=null;break e}if(c!==null){c.return=d,yt=c;break e}yt=d}}}var Tv={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}},Mv=typeof WeakMap=="function"?WeakMap:Map,Ie=0,$e=null,je=null,De=0,Fe=0,$t=null,mi=!1,Ua=!1,au=!1,Yn=0,lt=0,pi=0,Qi=0,lu=0,qt=0,Ka=0,Vl=null,Ut=null,su=!1,xo=0,zm=0,wo=1/0,So=null,gi=null,mt=0,bi=null,Ia=null,Pn=0,ou=0,ru=null,Hm=null,$l=0,cu=null;function Xt(){return(Ie&2)!==0&&De!==0?De&-De:A.T!==null?pu():Qd()}function Bm(){if(qt===0)if((De&536870912)===0||He){var e=Ft;Ft<<=1,(Ft&3932160)===0&&(Ft=262144),qt=e}else qt=536870912;return e=Pt.current,e!==null&&(e.flags|=32),qt}function Kt(e,t,i){(e===$e&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(Fa(e,0),yi(e,De,qt,!1)),ml(e,i),((Ie&2)===0||e!==$e)&&(e===$e&&((Ie&2)===0&&(Qi|=i),lt===4&&yi(e,De,qt,!1)),Sn(e))}function Um(e,t,i){if((Ie&6)!==0)throw Error(o(327));var s=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ti(e,t),c=s?Nv(e,t):du(e,t,!0),d=s;do{if(c===0){Ua&&!s&&yi(e,t,0,!1);break}else{if(i=e.current.alternate,d&&!Av(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=Vl;var L=C.current.memoizedState.isDehydrated;if(L&&(Fa(C,b).flags|=256),b=du(C,b,!1),b!==2){if(au&&!L){C.errorRecoveryDisabledLanes|=d,Qi|=d,c=4;break e}d=Ut,Ut=c,d!==null&&(Ut===null?Ut=d:Ut.push.apply(Ut,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){Fa(e,0),yi(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:yi(s,t,qt,!mi);break e;case 2:Ut=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=xo+300-Mt(),10<c)){if(yi(s,t,qt,!mi),ua(s,0,!0)!==0)break e;Pn=t,s.timeoutHandle=gp(Km.bind(null,s,i,Ut,So,su,t,qt,Qi,Ka,mi,d,"Throttled",-0,0),c);break e}Km(s,i,Ut,So,su,t,qt,Qi,Ka,mi,d,null,-0,0)}}break}while(!0);Sn(e)}function Km(e,t,i,s,c,d,b,C,L,F,X,ee,Y,V){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:Ln},Rm(t,d,ee);var pe=(d&62914560)===d?xo-Mt():(d&4194048)===d?zm-Mt():0;if(pe=ux(ee,pe),pe!==null){Pn=d,e.cancelPendingCommit=pe(qm.bind(null,e,t,d,i,s,c,b,C,L,X,ee,null,Y,V)),yi(e,d,b,!F);return}}qm(e,t,d,i,s,c,b,C,L)}function Av(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(!Gt(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 yi(e,t,i,s){t&=~lu,t&=~Qi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-Lt(c),b=1<<d;s[d]=-1,c&=~b}i!==0&&Xd(e,i,t)}function Co(){return(Ie&6)===0?(ql(0),!1):!0}function uu(){if(je!==null){if(Fe===0)var e=je.return;else e=je,On=Gi=null,Ac(e),Ra=null,Ll=0,e=je;for(;e!==null;)bm(e.alternate,e),e=e.return;je=null}}function Fa(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Vv(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Pn=0,uu(),$e=e,je=i=Rn(e.current,null),De=t,Fe=0,$t=null,mi=!1,Ua=ti(e,t),au=!1,Ka=qt=lu=Qi=pi=lt=0,Ut=Vl=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-Lt(s),d=1<<c;t|=e[c],s&=~d}return Yn=t,Gs(),i}function Im(e,t){ke=null,A.H=Bl,t===_a||t===Ws?(t=ih(),Fe=3):t===mc?(t=ih(),Fe=4):Fe=t===Fc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,$t=t,je===null&&(lt=1,fo(e,en(t,e.current)))}function Fm(){var e=Pt.current;return e===null?!0:(De&4194048)===De?ln===null:(De&62914560)===De||(De&536870912)!==0?e===ln:!1}function Gm(){var e=A.H;return A.H=Bl,e===null?Bl:e}function Ym(){var e=A.A;return A.A=Tv,e}function To(){lt=4,mi||(De&4194048)!==De&&Pt.current!==null||(Ua=!0),(pi&134217727)===0&&(Qi&134217727)===0||$e===null||yi($e,De,qt,!1)}function du(e,t,i){var s=Ie;Ie|=2;var c=Gm(),d=Ym();($e!==e||De!==t)&&(So=null,Fa(e,t)),t=!1;var b=lt;e:do try{if(Fe!==0&&je!==null){var C=je,L=$t;switch(Fe){case 8:uu(),b=6;break e;case 3:case 2:case 9:case 6:Pt.current===null&&(t=!0);var F=Fe;if(Fe=0,$t=null,Ga(e,C,L,F),i&&Ua){b=0;break e}break;default:F=Fe,Fe=0,$t=null,Ga(e,C,L,F)}}Ev(),b=lt;break}catch(X){Im(e,X)}while(!0);return t&&e.shellSuspendCounter++,On=Gi=null,Ie=s,A.H=c,A.A=d,je===null&&($e=null,De=0,Gs()),b}function Ev(){for(;je!==null;)Pm(je)}function Nv(e,t){var i=Ie;Ie|=2;var s=Gm(),c=Ym();$e!==e||De!==t?(So=null,wo=Mt()+500,Fa(e,t)):Ua=ti(e,t);e:do try{if(Fe!==0&&je!==null){t=je;var d=$t;t:switch(Fe){case 1:Fe=0,$t=null,Ga(e,t,d,1);break;case 2:case 9:if(th(d)){Fe=0,$t=null,Vm(t);break}t=function(){Fe!==2&&Fe!==9||$e!==e||(Fe=7),Sn(e)},d.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:th(d)?(Fe=0,$t=null,Vm(t)):(Fe=0,$t=null,Ga(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?_p(b):C.stateNode.complete){Fe=0,$t=null;var L=C.sibling;if(L!==null)je=L;else{var F=C.return;F!==null?(je=F,Mo(F)):je=null}break t}}Fe=0,$t=null,Ga(e,t,d,5);break;case 6:Fe=0,$t=null,Ga(e,t,d,6);break;case 8:uu(),lt=6;break e;default:throw Error(o(462))}}kv();break}catch(X){Im(e,X)}while(!0);return On=Gi=null,A.H=s,A.A=c,Ie=i,je!==null?0:($e=null,De=0,Gs(),lt)}function kv(){for(;je!==null&&!kt();)Pm(je)}function Pm(e){var t=pm(e.alternate,e,Yn);e.memoizedProps=e.pendingProps,t===null?Mo(e):je=t}function Vm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=cm(i,t,t.pendingProps,t.type,void 0,De);break;case 11:t=cm(i,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:Ac(t);default:bm(i,t),t=je=Yf(t,Yn),t=pm(i,t,Yn)}e.memoizedProps=e.pendingProps,t===null?Mo(e):je=t}function Ga(e,t,i,s){On=Gi=null,Ac(t),Ra=null,Ll=0;var c=t.return;try{if(bv(e,c,t,i,De)){lt=1,fo(e,en(i,e.current)),je=null;return}}catch(d){if(c!==null)throw je=c,d;lt=1,fo(e,en(i,e.current)),je=null;return}t.flags&32768?(He||s===1?e=!0:Ua||(De&536870912)!==0?e=!1:(mi=e=!0,(s===2||s===9||s===3||s===6)&&(s=Pt.current,s!==null&&s.tag===13&&(s.flags|=16384))),$m(t,e)):Mo(t)}function Mo(e){var t=e;do{if((t.flags&32768)!==0){$m(t,mi);return}e=t.return;var i=xv(t.alternate,t,Yn);if(i!==null){je=i;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);lt===0&&(lt=5)}function $m(e,t){do{var i=wv(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);lt=6,je=null}function qm(e,t,i,s,c,d,b,C,L){e.cancelPendingCommit=null;do Ao();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,r0(e,i,d,b,C,L),e===$e&&(je=$e=null,De=0),Ia=t,bi=e,Pn=i,ou=d,ru=c,Hm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,jv(Di,function(){return Jm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=A.T,A.T=null,c=G.p,G.p=2,b=Ie,Ie|=4;try{Sv(e,t,i)}finally{Ie=b,G.p=c,A.T=s}}mt=1,Xm(),Zm(),Wm()}}function Xm(){if(mt===1){mt=0;var e=bi,t=Ia,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=A.T,A.T=null;var s=G.p;G.p=2;var c=Ie;Ie|=4;try{km(t,e);var d=Cu,b=Df(e.containerInfo),C=d.focusedElem,L=d.selectionRange;if(b!==C&&C&&C.ownerDocument&&Of(C.ownerDocument.documentElement,C)){if(L!==null&&qr(C)){var F=L.start,X=L.end;if(X===void 0&&(X=F),"selectionStart"in C)C.selectionStart=F,C.selectionEnd=Math.min(X,C.value.length);else{var ee=C.ownerDocument||document,Y=ee&&ee.defaultView||window;if(Y.getSelection){var V=Y.getSelection(),pe=C.textContent.length,Ce=Math.min(L.start,pe),Ve=L.end===void 0?Ce:Math.min(L.end,pe);!V.extend&&Ce>Ve&&(b=Ve,Ve=Ce,Ce=b);var U=jf(C,Ce),O=jf(C,Ve);if(U&&O&&(V.rangeCount!==1||V.anchorNode!==U.node||V.anchorOffset!==U.offset||V.focusNode!==O.node||V.focusOffset!==O.offset)){var I=ee.createRange();I.setStart(U.node,U.offset),V.removeAllRanges(),Ce>Ve?(V.addRange(I),V.extend(O.node,O.offset)):(I.setEnd(O.node,O.offset),V.addRange(I))}}}}for(ee=[],V=C;V=V.parentNode;)V.nodeType===1&&ee.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ee.length;C++){var J=ee[C];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}Bo=!!Su,Cu=Su=null}finally{Ie=c,G.p=s,A.T=i}}e.current=t,mt=2}}function Zm(){if(mt===2){mt=0;var e=bi,t=Ia,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=A.T,A.T=null;var s=G.p;G.p=2;var c=Ie;Ie|=4;try{Tm(e,t.alternate,t)}finally{Ie=c,G.p=s,A.T=i}}mt=3}}function Wm(){if(mt===4||mt===3){mt=0,Oi();var e=bi,t=Ia,i=Pn,s=Hm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?mt=5:(mt=0,Ia=bi=null,Qm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(gi=null),kr(i),t=t.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(ei,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=A.T,c=G.p,G.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,G.p=c}}(Pn&3)!==0&&Ao(),Sn(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,Nl(t)))}function Ao(){return Xm(),Zm(),Wm(),Jm()}function Jm(){if(mt!==5)return!1;var e=bi,t=ou;ou=0;var i=kr(Pn),s=A.T,c=G.p;try{G.p=32>i?32:i,A.T=null,i=ru,ru=null;var d=bi,b=Pn;if(mt=0,Ia=bi=null,Pn=0,(Ie&6)!==0)throw Error(o(331));var C=Ie;if(Ie|=4,Om(d.current),_m(d,d.current,b,i),Ie=C,ql(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(ei,d)}catch{}return!0}finally{G.p=c,A.T=s,Qm(e,t)}}function ep(e,t,i){t=en(i,t),t=Ic(e.stateNode,t,2),e=ui(e,t,2),e!==null&&(ml(e,2),Sn(e))}function Ge(e,t,i){if(e.tag===3)ep(e,e,i);else for(;t!==null;){if(t.tag===3){ep(t,e,i);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(gi===null||!gi.has(s))){e=en(i,e),i=tm(2),s=ui(t,i,2),s!==null&&(nm(i,s,t,e),ml(s,2),Sn(s));break}}t=t.return}}function fu(e,t,i){var s=e.pingCache;if(s===null){s=e.pingCache=new Mv;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=Lv.bind(null,e,t,i),t.then(e,e))}function Lv(e,t,i){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,$e===e&&(De&i)===i&&(lt===4||lt===3&&(De&62914560)===De&&300>Mt()-xo?(Ie&2)===0&&Fa(e,0):lu|=i,Ka===De&&(Ka=0)),Sn(e)}function tp(e,t){t===0&&(t=qd()),e=Ki(e,t),e!==null&&(ml(e,t),Sn(e))}function _v(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),tp(e,i)}function Rv(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),tp(e,i)}function jv(e,t){return gn(e,t)}var Eo=null,Ya=null,hu=!1,No=!1,mu=!1,vi=0;function Sn(e){e!==Ya&&e.next===null&&(Ya===null?Eo=Ya=e:Ya=Ya.next=e),No=!0,hu||(hu=!0,Dv())}function ql(e,t){if(!mu&&No){mu=!0;do for(var i=!1,s=Eo;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-Lt(42|e)+1)-1,d&=c&~(b&~C),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(i=!0,lp(s,d))}else d=De,d=ua(s,s===$e?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||ti(s,d)||(i=!0,lp(s,d));s=s.next}while(i);mu=!1}}function Ov(){np()}function np(){No=hu=!1;var e=0;vi!==0&&Pv()&&(e=vi);for(var t=Mt(),i=null,s=Eo;s!==null;){var c=s.next,d=ip(s,t);d===0?(s.next=null,i===null?Eo=c:i.next=c,c===null&&(Ya=i)):(i=s,(e!==0||(d&3)!==0)&&(No=!0)),s=c}mt!==0&&mt!==5||ql(e),vi!==0&&(vi=0)}function ip(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-Lt(d),C=1<<b,L=c[b];L===-1?((C&i)===0||(C&s)!==0)&&(c[b]=_s(C,t)):L<=t&&(e.expiredLanes|=C),d&=~C}if(t=$e,i=De,i=ua(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&&bn(s),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ti(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(s!==null&&bn(s),kr(i)){case 2:case 8:i=fl;break;case 32:i=Di;break;case 268435456:i=hl;break;default:i=Di}return s=ap.bind(null,e),i=gn(i,s),e.callbackPriority=t,e.callbackNode=i,t}return s!==null&&s!==null&&bn(s),e.callbackPriority=2,e.callbackNode=null,2}function ap(e,t){if(mt!==0&&mt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Ao()&&e.callbackNode!==i)return null;var s=De;return s=ua(e,e===$e?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Um(e,s,t),ip(e,Mt()),e.callbackNode!=null&&e.callbackNode===i?ap.bind(null,e):null)}function lp(e,t){if(Ao())return null;Um(e,t,!0)}function Dv(){$v(function(){(Ie&6)!==0?gn(dl,Ov):np()})}function pu(){if(vi===0){var e=ka;e===0&&(e=_t,_t<<=1,(_t&261888)===0&&(_t=256)),vi=e}return vi}function sp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ds(""+e)}function op(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 zv(e,t,i,s,c){if(t==="submit"&&i&&i.stateNode===c){var d=sp((c[Ot]||null).action),b=s.submitter;b&&(t=(t=b[Ot]||null)?sp(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var C=new Us("action","action",null,s,c);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(vi!==0){var L=b?op(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?op(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<Qr.length;gu++){var bu=Qr[gu],Hv=bu.toLowerCase(),Bv=bu[0].toUpperCase()+bu.slice(1);fn(Hv,"on"+Bv)}fn(Bf,"onAnimationEnd"),fn(Uf,"onAnimationIteration"),fn(Kf,"onAnimationStart"),fn("dblclick","onDoubleClick"),fn("focusin","onFocus"),fn("focusout","onBlur"),fn(ev,"onTransitionRun"),fn(tv,"onTransitionStart"),fn(nv,"onTransitionCancel"),fn(If,"onTransitionEnd"),pa("onMouseEnter",["mouseout","mouseover"]),pa("onMouseLeave",["mouseout","mouseover"]),pa("onPointerEnter",["pointerout","pointerover"]),pa("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 Xl="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(" "),Uv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xl));function rp(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,F=C.currentTarget;if(C=C.listener,L!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=F;try{d(c)}catch(X){Fs(X)}c.currentTarget=null,d=L}else for(b=0;b<s.length;b++){if(C=s[b],L=C.instance,F=C.currentTarget,C=C.listener,L!==d&&c.isPropagationStopped())break e;d=C,c.currentTarget=F;try{d(c)}catch(X){Fs(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)||(cp(t,e,2,!1),i.add(s))}function yu(e,t,i){var s=0;t&&(s|=4),cp(i,e,s,t)}var ko="_reactListening"+Math.random().toString(36).slice(2);function vu(e){if(!e[ko]){e[ko]=!0,tf.forEach(function(i){i!=="selectionchange"&&(Uv.has(i)||yu(i,!1,e),yu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ko]||(t[ko]=!0,yu("selectionchange",!1,t))}}function cp(e,t,i,s){switch(Bp(t)){case 2:var c=hx;break;case 8:c=mx;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=fa(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}mf(function(){var F=d,X=Hr(i),ee=[];e:{var Y=Ff.get(e);if(Y!==void 0){var V=Us,pe=e;switch(e){case"keypress":if(Hs(i)===0)break e;case"keydown":case"keyup":V=R0;break;case"focusin":pe="focus",V=Gr;break;case"focusout":pe="blur",V=Gr;break;case"beforeblur":case"afterblur":V=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":V=bf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=x0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=D0;break;case Bf:case Uf:case Kf:V=C0;break;case If:V=H0;break;case"scroll":case"scrollend":V=y0;break;case"wheel":V=U0;break;case"copy":case"cut":case"paste":V=M0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=vf;break;case"toggle":case"beforetoggle":V=I0}var Ce=(t&4)!==0,Ve=!Ce&&(e==="scroll"||e==="scrollend"),U=Ce?Y!==null?Y+"Capture":null:Y;Ce=[];for(var O=F,I;O!==null;){var J=O;if(I=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||I===null||U===null||(J=bl(O,U),J!=null&&Ce.push(Zl(O,J,I))),Ve)break;O=O.return}0<Ce.length&&(Y=new V(Y,pe,null,i,X),ee.push({event:Y,listeners:Ce}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",V=e==="mouseout"||e==="pointerout",Y&&i!==zr&&(pe=i.relatedTarget||i.fromElement)&&(fa(pe)||pe[da]))break e;if((V||Y)&&(Y=X.window===X?X:(Y=X.ownerDocument)?Y.defaultView||Y.parentWindow:window,V?(pe=i.relatedTarget||i.toElement,V=F,pe=pe?fa(pe):null,pe!==null&&(Ve=u(pe),Ce=pe.tag,pe!==Ve||Ce!==5&&Ce!==27&&Ce!==6)&&(pe=null)):(V=null,pe=F),V!==pe)){if(Ce=bf,J="onMouseLeave",U="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=vf,J="onPointerLeave",U="onPointerEnter",O="pointer"),Ve=V==null?Y:gl(V),I=pe==null?Y:gl(pe),Y=new Ce(J,O+"leave",V,i,X),Y.target=Ve,Y.relatedTarget=I,J=null,fa(X)===F&&(Ce=new Ce(U,O+"enter",pe,i,X),Ce.target=I,Ce.relatedTarget=Ve,J=Ce),Ve=J,V&&pe)t:{for(Ce=Kv,U=V,O=pe,I=0,J=U;J;J=Ce(J))I++;J=0;for(var Se=O;Se;Se=Ce(Se))J++;for(;0<I-J;)U=Ce(U),I--;for(;0<J-I;)O=Ce(O),J--;for(;I--;){if(U===O||O!==null&&U===O.alternate){Ce=U;break t}U=Ce(U),O=Ce(O)}Ce=null}else Ce=null;V!==null&&up(ee,Y,V,Ce,!1),pe!==null&&Ve!==null&&up(ee,Ve,pe,Ce,!0)}}e:{if(Y=F?gl(F):window,V=Y.nodeName&&Y.nodeName.toLowerCase(),V==="select"||V==="input"&&Y.type==="file")var Ue=Ef;else if(Mf(Y))if(Nf)Ue=W0;else{Ue=X0;var ge=q0}else V=Y.nodeName,!V||V.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?F&&Dr(F.elementType)&&(Ue=Ef):Ue=Z0;if(Ue&&(Ue=Ue(e,F))){Af(ee,Ue,i,X);break e}ge&&ge(e,Y,F),e==="focusout"&&F&&Y.type==="number"&&F.memoizedProps.value!=null&&Or(Y,"number",Y.value)}switch(ge=F?gl(F):window,e){case"focusin":(Mf(ge)||ge.contentEditable==="true")&&(wa=ge,Xr=F,Ml=null);break;case"focusout":Ml=Xr=wa=null;break;case"mousedown":Zr=!0;break;case"contextmenu":case"mouseup":case"dragend":Zr=!1,zf(ee,i,X);break;case"selectionchange":if(J0)break;case"keydown":case"keyup":zf(ee,i,X)}var Le;if(Pr)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else xa?Cf(e,i)&&(ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(xf&&i.locale!=="ko"&&(xa||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&xa&&(Le=pf()):(ii=X,Kr="value"in ii?ii.value:ii.textContent,xa=!0)),ge=Lo(F,ze),0<ge.length&&(ze=new yf(ze,e,null,i,X),ee.push({event:ze,listeners:ge}),Le?ze.data=Le:(Le=Tf(i),Le!==null&&(ze.data=Le)))),(Le=G0?Y0(e,i):P0(e,i))&&(ze=Lo(F,"onBeforeInput"),0<ze.length&&(ge=new yf("onBeforeInput","beforeinput",null,i,X),ee.push({event:ge,listeners:ze}),ge.data=Le)),zv(ee,e,F,i,X)}rp(ee,t)})}function Zl(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Lo(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=bl(e,i),c!=null&&s.unshift(Zl(e,c,d)),c=bl(e,t),c!=null&&s.push(Zl(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Kv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function up(e,t,i,s,c){for(var d=t._reactName,b=[];i!==null&&i!==s;){var C=i,L=C.alternate,F=C.stateNode;if(C=C.tag,L!==null&&L===s)break;C!==5&&C!==26&&C!==27||F===null||(L=F,c?(F=bl(i,d),F!=null&&b.unshift(Zl(i,F,L))):c||(F=bl(i,d),F!=null&&b.push(Zl(i,F,L)))),i=i.return}b.length!==0&&e.push({event:t,listeners:b})}var Iv=/\r\n?/g,Fv=/\u0000|\uFFFD/g;function dp(e){return(typeof e=="string"?e:""+e).replace(Iv,`
|
|
33
|
+
`).replace(Fv,"")}function fp(e,t){return t=dp(t),dp(e)===t}function Pe(e,t,i,s,c,d){switch(i){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||ba(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&ba(e,""+s);break;case"className":js(e,"class",s);break;case"tabIndex":js(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":js(e,i,s);break;case"style":ff(e,s,d);break;case"data":if(t!=="object"){js(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=Ds(""+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=Ds(""+s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=Ln);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=Ds(""+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),Rs(e,"popover",s);break;case"xlinkActuate":kn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":kn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":kn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":kn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":kn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":kn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":kn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":kn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":kn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Rs(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=g0.get(i)||i,Rs(e,i,s))}}function wu(e,t,i,s,c,d){switch(i){case"style":ff(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"?ba(e,s):(typeof s=="number"||typeof s=="bigint")&&ba(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=Ln);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!nf.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[Ot]||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,""):Rs(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,F=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":F=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)}}rf(e,d,C,L,F,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?ga(e,!!s,t,!1):i!=null&&ga(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)}uf(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<Xl.length;s++)Oe(Xl[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(F in i)if(i.hasOwnProperty(F)&&(s=i[F],s!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Pe(e,t,F,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 Gv(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,F=null,X=null;for(V in i){var ee=i[V];if(i.hasOwnProperty(V)&&ee!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":L=ee;default:s.hasOwnProperty(V)||Pe(e,t,V,null,s,ee)}}for(var Y in s){var V=s[Y];if(ee=i[Y],s.hasOwnProperty(Y)&&(V!=null||ee!=null))switch(Y){case"type":d=V;break;case"name":c=V;break;case"checked":F=V;break;case"defaultChecked":X=V;break;case"value":b=V;break;case"defaultValue":C=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(o(137,t));break;default:V!==ee&&Pe(e,t,Y,V,s,ee)}}jr(e,b,C,L,F,X,d,c);return;case"select":V=b=C=Y=null;for(d in i)if(L=i[d],i.hasOwnProperty(d)&&L!=null)switch(d){case"value":break;case"multiple":V=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=V,Y!=null?ga(e,!!i,Y,!1):!!s!=!!i&&(t!=null?ga(e,!!i,t,!0):ga(e,!!i,i?[]:"",!1));return;case"textarea":V=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":V=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)}cf(e,Y,V);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],V=i[L],s.hasOwnProperty(L)&&Y!==V&&(Y!=null||V!=null))switch(L){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Pe(e,t,L,Y,s,V)}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(F in s)if(Y=s[F],V=i[F],s.hasOwnProperty(F)&&Y!==V&&(Y!=null||V!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(o(137,t));break;default:Pe(e,t,F,Y,s,V)}return;default:if(Dr(t)){for(var Ve in i)Y=i[Ve],i.hasOwnProperty(Ve)&&Y!==void 0&&!s.hasOwnProperty(Ve)&&wu(e,t,Ve,void 0,s,Y);for(X in s)Y=s[X],V=i[X],!s.hasOwnProperty(X)||Y===V||Y===void 0&&V===void 0||wu(e,t,X,Y,s,V);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],V=i[ee],!s.hasOwnProperty(ee)||Y===V||Y==null&&V==null||Pe(e,t,ee,Y,s,V)}function hp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Yv(){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&&hp(b)){for(b=0,C=c.responseEnd,s+=1;s<i.length;s++){var L=i[s],F=L.startTime;if(F>C)break;var X=L.transferSize,ee=L.initiatorType;X&&hp(ee)&&(L=L.responseEnd,b+=X*(L<C?1:(C-F)/(L-F)))}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 _o(e){return e.nodeType===9?e:e.ownerDocument}function mp(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 pp(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 Pv(){var e=window.event;return e&&e.type==="popstate"?e===Mu?!1:(Mu=e,!0):(Mu=null,!1)}var gp=typeof setTimeout=="function"?setTimeout:void 0,Vv=typeof clearTimeout=="function"?clearTimeout:void 0,bp=typeof Promise=="function"?Promise:void 0,$v=typeof queueMicrotask=="function"?queueMicrotask:typeof bp<"u"?function(e){return bp.resolve(null).then(e).catch(qv)}:gp;function qv(e){setTimeout(function(){throw e})}function xi(e){return e==="head"}function yp(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")Wl(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Wl(i);for(var d=i.firstChild;d;){var b=d.nextSibling,C=d.nodeName;d[pl]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&d.rel.toLowerCase()==="stylesheet"||i.removeChild(d),d=b}}else i==="body"&&Wl(e.ownerDocument.body);i=c}while(i);qa(t)}function vp(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 Xv(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[pl])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 Zv(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 xp(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 Wv(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 wp(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 Sp(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 Cp(e,t,i){switch(t=_o(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 Wl(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_r(e)}var on=new Map,Tp=new Set;function Ro(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Vn=G.d;G.d={f:Qv,r:Jv,D:ex,C:tx,L:nx,m:ix,X:lx,S:ax,M:sx};function Qv(){var e=Vn.f(),t=Co();return e||t}function Jv(e){var t=ha(e);t!==null&&t.tag===5&&t.type==="form"?Ih(t):Vn.r(e)}var Pa=typeof document>"u"?null:document;function Mp(e,t,i){var s=Pa;if(s&&typeof t=="string"&&t){var c=Qt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof i=="string"&&(c+='[crossorigin="'+i+'"]'),Tp.has(c)||(Tp.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 ex(e){Vn.D(e),Mp("dns-prefetch",e,null)}function tx(e,t){Vn.C(e,t),Mp("preconnect",e,t)}function nx(e,t,i){Vn.L(e,t,i);var s=Pa;if(s&&e&&t){var c='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(c+='[imagesrcset="'+Qt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(c+='[imagesizes="'+Qt(i.imageSizes)+'"]')):c+='[href="'+Qt(e)+'"]';var d=c;switch(t){case"style":d=Va(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(Jl(d))||(t=s.createElement("link"),Tt(t,"link",e),bt(t),s.head.appendChild(t)))}}function ix(e,t){Vn.m(e,t);var i=Pa;if(i&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Qt(s)+'"][href="'+Qt(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(Jl(d)))return}s=i.createElement("link"),Tt(s,"link",e),bt(s),i.head.appendChild(s)}}}function ax(e,t,i){Vn.S(e,t,i);var s=Pa;if(s&&e){var c=ma(s).hoistableStyles,d=Va(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(F,X){L.onload=F,L.onerror=X}),L.addEventListener("load",function(){C.loading|=1}),L.addEventListener("error",function(){C.loading|=2}),C.loading|=4,jo(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:C},c.set(d,b)}}}function lx(e,t){Vn.X(e,t);var i=Pa;if(i&&e){var s=ma(i).hoistableScripts,c=$a(e),d=s.get(c);d||(d=i.querySelector(Jl(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 sx(e,t){Vn.M(e,t);var i=Pa;if(i&&e){var s=ma(i).hoistableScripts,c=$a(e),d=s.get(c);d||(d=i.querySelector(Jl(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 Ap(e,t,i,s){var c=(c=ye.current)?Ro(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=Va(i.href),i=ma(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=Va(i.href);var d=ma(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||ox(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=ma(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 Va(e){return'href="'+Qt(e)+'"'}function Ql(e){return'link[rel="stylesheet"]['+e+"]"}function Ep(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function ox(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="'+Qt(e)+'"]'}function Jl(e){return"script[async]"+e}function Np(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Qt(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),jo(s,i.precedence,e),t.instance=s;case"stylesheet":c=Va(i.href);var d=e.querySelector(Ql(c));if(d)return t.state.loading|=4,t.instance=d,bt(d),d;s=Ep(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,jo(d,i.precedence,e),t.instance=d;case"script":return d=$a(i.src),(c=e.querySelector(Jl(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,jo(s,i.precedence,e));return t.instance}function jo(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 Oo=null;function kp(e,t,i){if(Oo===null){var s=new Map,c=Oo=new Map;c.set(i,s)}else c=Oo,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[pl]||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 Lp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function rx(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 _p(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function cx(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=Va(s.href),d=t.querySelector(Ql(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Do.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=d,bt(d);return}d=t.ownerDocument||t,s=Ep(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=Do.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Ru=0;function ux(e,t){return e.stylesheets&&e.count===0&&Ho(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&Ho(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&Ru===0&&(Ru=62500*Yv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ho(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 Do(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ho(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zo=null;function Ho(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zo=new Map,t.forEach(dx,e),zo=null,Do.call(e))}function dx(e,t){if(!(t.state.loading&4)){var i=zo.get(e);if(i)var s=i.get(null);else{i=new Map,zo.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=Do.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 es={$$typeof:R,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function fx(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 Rp(e,t,i,s,c,d,b,C,L,F,X,ee){return e=new fx(e,t,i,b,L,F,X,ee,C),t=1,d===!0&&(t|=24),d=Yt(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 jp(e){return e?(e=Ta,e):Ta}function Op(e,t,i,s,c,d){c=jp(c),s.context===null?s.context=c:s.pendingContext=c,s=ci(t),s.payload={element:i},d=d===void 0?null:d,d!==null&&(s.callback=d),i=ui(e,s,t),i!==null&&(Kt(i,e,t),Rl(i,e,t))}function Dp(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){Dp(e,t),(e=e.alternate)&&Dp(e,t)}function zp(e){if(e.tag===13||e.tag===31){var t=Ki(e,67108864);t!==null&&Kt(t,e,67108864),ju(e,67108864)}}function Hp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Nr(t);var i=Ki(e,t);i!==null&&Kt(i,e,t),ju(e,t)}}var Bo=!0;function hx(e,t,i,s){var c=A.T;A.T=null;var d=G.p;try{G.p=2,Ou(e,t,i,s)}finally{G.p=d,A.T=c}}function mx(e,t,i,s){var c=A.T;A.T=null;var d=G.p;try{G.p=8,Ou(e,t,i,s)}finally{G.p=d,A.T=c}}function Ou(e,t,i,s){if(Bo){var c=Du(s);if(c===null)xu(e,t,s,Uo,i),Up(e,s);else if(gx(c,e,t,i,s))s.stopPropagation();else if(Up(e,s),t&4&&-1<px.indexOf(e)){for(;c!==null;){var d=ha(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Nn(d.pendingLanes);if(b!==0){var C=d;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var L=1<<31-Lt(b);C.entanglements[1]|=L,b&=~L}Sn(d),(Ie&6)===0&&(wo=Mt()+500,ql(0))}}break;case 31:case 13:C=Ki(d,2),C!==null&&Kt(C,d,2),Co(),ju(d,2)}if(d=Du(s),d===null&&xu(e,t,s,Uo,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 Uo=null;function zu(e){if(Uo=null,e=fa(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=m(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 Uo=e,null}function Bp(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 dl:return 2;case fl:return 8;case Di:case Es:return 32;case hl:return 268435456;default:return 32}default:return 32}}var Hu=!1,wi=null,Si=null,Ci=null,ts=new Map,ns=new Map,Ti=[],px="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 Up(e,t){switch(e){case"focusin":case"focusout":wi=null;break;case"dragenter":case"dragleave":Si=null;break;case"mouseover":case"mouseout":Ci=null;break;case"pointerover":case"pointerout":ts.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ns.delete(t.pointerId)}}function is(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=ha(t),t!==null&&zp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function gx(e,t,i,s,c){switch(t){case"focusin":return wi=is(wi,e,t,i,s,c),!0;case"dragenter":return Si=is(Si,e,t,i,s,c),!0;case"mouseover":return Ci=is(Ci,e,t,i,s,c),!0;case"pointerover":var d=c.pointerId;return ts.set(d,is(ts.get(d)||null,e,t,i,s,c)),!0;case"gotpointercapture":return d=c.pointerId,ns.set(d,is(ns.get(d)||null,e,t,i,s,c)),!0}return!1}function Kp(e){var t=fa(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,Jd(e.priority,function(){Hp(i)});return}}else if(t===31){if(t=m(i),t!==null){e.blockedOn=t,Jd(e.priority,function(){Hp(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 Ko(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=ha(i),t!==null&&zp(t),e.blockedOn=i,!1;t.shift()}return!0}function Ip(e,t,i){Ko(e)&&i.delete(t)}function bx(){Hu=!1,wi!==null&&Ko(wi)&&(wi=null),Si!==null&&Ko(Si)&&(Si=null),Ci!==null&&Ko(Ci)&&(Ci=null),ts.forEach(Ip),ns.forEach(Ip)}function Io(e,t){e.blockedOn===t&&(e.blockedOn=null,Hu||(Hu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,bx)))}var Fo=null;function Fp(e){Fo!==e&&(Fo=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Fo===e&&(Fo=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=ha(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 Io(L,e)}wi!==null&&Io(wi,e),Si!==null&&Io(Si,e),Ci!==null&&Io(Ci,e),ts.forEach(t),ns.forEach(t);for(var i=0;i<Ti.length;i++){var s=Ti[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ti.length&&(i=Ti[0],i.blockedOn===null);)Kp(i),i.blockedOn===null&&Ti.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[Ot]||null;if(typeof d=="function")b||Fp(i);else if(b){var C=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[Ot]||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),Fp(i)}}}function Gp(){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}Go.prototype.render=Bu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var i=t.current,s=Xt();Op(i,s,e,t,null,null)},Go.prototype.unmount=Bu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Op(e.current,2,null,e,null,null),Co(),t[da]=null}};function Go(e){this._internalRoot=e}Go.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qd();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Ti.length&&t!==0&&t<Ti[i].priority;i++);Ti.splice(i,0,e),i===0&&Kp(e)}};var Yp=n.version;if(Yp!=="19.2.8")throw Error(o(527,Yp,"19.2.8"));G.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 yx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yo.isDisabled&&Yo.supportsFiber)try{ei=Yo.inject(yx),At=Yo}catch{}}return ls.createRoot=function(e,t){if(!r(e))throw Error(o(299));var i=!1,s="",c=Wh,d=Qh,b=Jh;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=Rp(e,1,!1,null,null,i,s,null,c,d,b,Gp),e[da]=t.current,vu(e),new Bu(t)},ls.hydrateRoot=function(e,t,i){if(!r(e))throw Error(o(299));var s=!1,c="",d=Wh,b=Qh,C=Jh,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=Rp(e,1,!0,t,i??null,s,c,L,d,b,C,Gp),t.context=jp(null),i=t.current,s=Xt(),s=Nr(s),c=ci(s),c.callback=null,ui(i,c,s),i=s,t.current.lanes=i,ml(t,i),Sn(t),e[da]=t.current,vu(e),new Go(t)},ls.version="19.2.8",ls}var Zp;function kx(){if(Zp)return Ku.exports;Zp=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=Nx(),Ku.exports}var Lx=kx();const _x=hb(Lx),jt="/ws/client",pb={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",chipOutdated:"↑ update herdr-remote",toastOutdated:"{host} runs an old herdr-remote; please update it",thisHost:"this workstation",outdatedVersion:"too old to tell",outdated:"This workstation runs a herdr-remote too old to report its version or check for updates, and it lacks recent features and fixes. On the workstation, run:",windowsStop:"On Windows, first stop the running herdr-remote in PowerShell:"},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",credentialsRequired:"Enter a pairing code or device token.",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',repairNote:"(only to pair again)",editAdvancedHint:"relay, token, client ID",tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",autoReconnectLabel:"Auto-reconnect",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",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote too old",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}",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"}},Rx={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:"忽略此版本",chipOutdated:"↑ 升级 herdr-remote",toastOutdated:"{host} 的 herdr-remote 版本过旧,请升级",thisHost:"这台宿主机",outdatedVersion:"过旧,无法获知版本",outdated:"这台宿主机的 herdr-remote 太旧,不会报告版本,也不会检查更新,还缺少近期的功能和修复。在宿主机上执行:",windowsStop:"Windows 上先在 PowerShell 里结束正在运行的 herdr-remote:"},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:"例如:工作电脑",credentialsRequired:"请输入配对码或设备令牌。",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',repairNote:"(重新配对时填写)",editAdvancedHint:"Relay 端点、Token、客户端 ID",tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",clientIdLabel:"客户端标识",newIdButton:"生成新 ID",autoReconnectLabel:"掉线自动重连",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}",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote 过旧",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"本窗口处于观察者模式,切到「完全控制」才能输入",clientIdCopied:"客户端 ID 已复制: {id}",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:pb,zh:Rx};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 m=Gu.en;for(const p of r)if(m&&typeof m=="object"&&p in m)m=m[p];else return n;u=m;break}if(typeof u!="string")return n;if(l){let h=u;for(const[m,p]of Object.entries(l))h=h.replaceAll(`{${m}}`,String(p));return h}return u}function Yu(a){return typeof a=="string"&&Object.hasOwn(pb.serverErrors,a)}const oe={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~"},jx=new TextEncoder;function _d(a){return jx.encode(a)}function gb(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 Ox(a){return`\x1B${a}`}function Wp({ctrl:a,alt:n,shift:l}){return 1+(l?1:0)+(n?2:0)+(a?4:0)}const bb=/^\x1b[[O]([ABCDHF])$/,yb=/^\x1bO([PQRS])$/,vb=/^\x1b\[(\d+)~$/;function ur(a,n){const{ctrl:l=!1,alt:o=!1,shift:r=!1}=n;if(!l&&!o&&!r)return a;const u=Wp(n),h=o&&!l&&!r,m=bb.exec(a);if(m)return`\x1B[1;${u}${m[1]}`;const p=yb.exec(a);if(p)return`\x1B[1;${u}${p[1]}`;const g=vb.exec(a);if(g)return`\x1B[${g[1]};${u}~`;switch(a){case oe.TAB:return r&&!l&&!o?oe.SHIFT_TAB:h?`\x1B${a}`:`\x1B[9;${u}u`;case oe.SHIFT_TAB:return!l&&!o?a:`\x1B[9;${Wp({...n,shift:!0})}u`;case oe.ENTER:return h?`\x1B${a}`:`\x1B[13;${u}u`;case oe.BACKSPACE:return l&&!o&&!r?"\b":h?`\x1B${a}`:`\x1B[127;${u}u`;case oe.ESC:return h?`\x1B${a}`:`\x1B[27;${u}u`}let y=a;return r&&a.length===1&&!l&&(y=a.toUpperCase()),l&&(y=gb(y)),o&&(y=Ox(y)),y}function Dx(a){return[...a].length===1?!0:bb.test(a)||yb.test(a)||vb.test(a)||a===oe.SHIFT_TAB}class Tn extends Error{constructor(l,o={}){super(l);$(this,"code");$(this,"params");this.name="KeyComboError",this.code=l,this.params=o}}const zx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},Qp={esc:oe.ESC,tab:oe.TAB,enter:oe.ENTER,backspace:oe.BACKSPACE,delete:oe.DELETE,left:oe.LEFT,right:oe.RIGHT,up:oe.UP,down:oe.DOWN,home:oe.HOME,end:oe.END,pageup:oe.PAGE_UP,pagedown:oe.PAGE_DOWN,insert:oe.INSERT,space:" ","+":"+"},Hx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Bx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function xb(a,n){const l=a.toLowerCase().split("+");if(l.some(p=>!p))throw new Tn("invalidStepSyntax",{step:n+1});const o={};let r;for(const p of l)if(p==="ctrl"||p==="control"){if(o.ctrl)throw new Tn("duplicateModifier",{step:n+1,modifier:"Ctrl"});o.ctrl=!0}else if(p==="alt"||p==="option"){if(o.alt)throw new Tn("duplicateModifier",{step:n+1,modifier:"Alt"});o.alt=!0}else if(p==="shift"){if(o.shift)throw new Tn("duplicateModifier",{step:n+1,modifier:"Shift"});o.shift=!0}else if(r===void 0)r=p;else throw new Tn("multipleKeys",{step:n+1});if(!r)throw new Tn("missingKey",{step:n+1});const u=zx[r]||r,h=/^f(?:[1-9]|1[0-2])$/.exec(u);let m;if(h)m=oe[u.toUpperCase()];else if(Object.hasOwn(Qp,u))m=Qp[u];else if([...u].length===1&&/^[\x21-\x7e]$/.test(u))m=u;else throw new Tn("unsupportedKey",{step:n+1,key:u});return{key:m,keyName:u,modifiers:o,sequence:Kx(m,u,o)}}function Ux(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function Jp(a,n){const l=[...a][0].codePointAt(0);return l===void 0?"":`\x1B[${l};${Ux(n)}u`}function Kx(a,n,l){if(!l.ctrl)return ur(a,l);if(n.length===1&&/^[\x20-\x7e]$/.test(n)){const o=n.toLowerCase();if(l.alt||l.shift||o==="m"||o==="i")return Jp(o,l);if(o==="-"||o==="/"||o==="_")return"";const r=gb(o);return r!==o?r:Jp(o,l)}return ur(a,l)}function Mn(a){if(typeof a!="string"||!a.trim())throw new Tn("empty");const n=a.trim().split(/\s+/);if(n.length>8)throw new Tn("tooManySteps",{count:8});return n.map((l,o)=>xb(l,o).sequence)}function us(a){const n=a.trim().split(/\s+/);return n.length>1&&n.every(l=>["esc","escape"].includes(l.toLowerCase()))?`ESC${Bx[n.length]||` ×${n.length}`}`:n.map((l,o)=>{const{keyName:r,modifiers:u}=xb(l,o),h=Hx[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}),wb={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=wb,Ix=Object.keys(wb),eg={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 Fx(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function tg(a){const n=Fx(a);return eg[n]?eg[n]:/^muse-bin-\d/.test(n)?"muse":null}function Gx(a,n="auto"){return n&&n!=="auto"?tg(n)||"shell":tg(a)||"shell"}const ps=[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")],ng=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Yx=["genericCtrlC"],Px=ps.filter(({id:a})=>a!=="genericCtrlD"&&a!=="genericCtrlZ"),Vx=ps.filter(({id:a})=>a==="genericCtrlC"||a==="genericCtrlZ").map(a=>a.id==="genericCtrlZ"?{...a,labelKey:"eof"}:a),$x={posix:ps,"git-bash":ps,cmd:Vx,powershell:Px},qx={posix:ng,"git-bash":ng,cmd:["genericCtrlC","genericCtrlZ"],powershell:["genericCtrlC","genericCtrlL","genericCtrlR"]};function Xx(a,n){var r,u;const l=a.map(h=>{var g;const m=(g=n==null?void 0:n.actions)==null?void 0:g[h.id];let p=typeof(m==null?void 0:m.keys)=="string"?m.keys:h.combo;try{Mn(p)}catch{p=h.combo}return{...h,defaultCombo:h.combo,combo:p,hidden:typeof(m==null?void 0:m.hidden)=="boolean"?m.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 m=h.keys;try{Mn(m)}catch{continue}l.push({id:h.id,labelKey:"custom",defaultCombo:m,combo:m,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((m,p)=>[m,p]));l.sort((m,p)=>(h.get(m.id)??Number.MAX_SAFE_INTEGER)-(h.get(p.id)??Number.MAX_SAFE_INTEGER))}return l}function Zx(a,n){const l=new Set(a.map(o=>o.combo.trim().toLowerCase()));return n.filter(o=>!l.has(o.combo.trim().toLowerCase()))}const hs=a=>a.id.startsWith("generic");function Sb(a,n,l="posix"){const o=na[a],r=a==="shell"?$x[l]:ps,u=new Set([...o.bar||[],...a==="shell"?qx[l]:Yx]),h=[...o.actions,...r].map(m=>({...m,defaultHidden:!u.has(m.id)}));return Xx(h,n)}function Cb(a,n,l="posix"){const o=Sb(a,n,l),r=o.filter(h=>!hs(h)),u=new Set(Zx(r,o.filter(hs)));return o.filter(h=>!hs(h)||u.has(h))}function Wx(a,n,l="posix"){const o=Cb(a,n,l).filter(r=>!r.hidden);return{agentActions:o.filter(r=>!hs(r)),genericActions:o.filter(hs)}}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 Tb(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[m,p]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(m)||!p||typeof p!="object"||Array.isArray(p))continue;const g=p,y={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{Mn(v),y.keys=v}catch{}}typeof g.hidden=="boolean"&&(y.hidden=g.hidden),Object.keys(y).length>0&&(h[m]=y)}u.actions=h}if(Array.isArray(r.custom)){const h=new Set;u.custom=r.custom.slice(0,64).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const p=m;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||h.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const g=p.keys.trim().slice(0,80);try{Mn(g)}catch{return[]}return h.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:g}]})}n[l]=u}return n}const Jx=10,ew=24,gs=15,dr=13,Rd=640;function tw(){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 il()<Rd}function il(){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 al(a,n=gs){const l=typeof a=="number"?a:Number(a);return!Number.isFinite(l)||l<=0?n:Math.min(ew,Math.max(Jx,Math.round(l)))}function ig(a,n=il()){if(n<Rd){const o=al(a,dr);return Math.min(15,Math.max(12,o))}return al(a,gs)}const ag="#11111b",nw=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],fr=["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:fr},{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"']}],Mb="host",iw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',aw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',lw="JetBrains Mono, Menlo, Monaco, Consolas, monospace",sw={[iw]:"host",[aw]:"host",[lw]:"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()?Mb:sw[a]??a}const ow=[[/^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 rw(a){const n=ow.find(([l])=>l.test(a.trim()));return n?n[1]:null}function ss(a){return`"${a.replace(/["\\]/g,"")}"`}function dd(a){return[...new Set([...a,...nw])].join(", ")}const cw=dd(fr);function uw(a,n){const l=typeof a=="string"?a.trim():"";if(!l||l==="host"){if(!(n!=null&&n.family))return cw;const u=[],h=n.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&u.push(ss(h.alias)),n.alias&&u.push(ss(n.alias)),u.push(ss(n.family));const m=rw(n.family);return m&&u.push(m),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&u.push(ss(h.alias)),u.push(ss(h.family))),dd([...u,...fr])}const o=ud.find(u=>u.id===l);if(o)return dd([...o.faces,...fr]);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 dw(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 Ab(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",ag),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=ag}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 bs(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 lg=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),Vu=256*1024,fw=2,hw={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 sg(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 og(a){return a?a.faces.reduce((n,l)=>n+l.bytes,0):0}function $u(a){return a>=1024*1024?`${(a/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(a/1024))} KB`}function mw(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 pw="herdr-remote-fonts",ll="faces",sl="subsets",Eb=new Map,hd=new Map;function Sr(){return new Promise(a=>{if(typeof indexedDB>"u"){a(null);return}try{const n=indexedDB.open(pw,2);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(ll)||n.result.createObjectStore(ll),n.result.objectStoreNames.contains(sl)||n.result.createObjectStore(sl)},n.onsuccess=()=>a(n.result),n.onerror=()=>a(null),n.onblocked=()=>a(null)}catch{a(null)}})}async function gw(a){const n=Eb.get(a);if(n)return n;const l=await Sr();return l?new Promise(o=>{try{const r=l.transaction(ll,"readonly").objectStore(ll).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 bw(a,n){Eb.set(a,n);const l=await Sr();l&&await new Promise(o=>{try{const r=l.transaction(ll,"readwrite");r.objectStore(ll).put(n,a),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}async function yw(a){const n=await Sr();return n?new Promise(l=>{try{const o=IDBKeyRange.bound(`${a}:`,`${a}:`),r=n.transaction(sl,"readonly").objectStore(sl).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 vw(a,n){hd.set(a,[...hd.get(a)??[],n]);const l=await Sr();l&&await new Promise(o=>{try{const r=l.transaction(sl,"readwrite");r.objectStore(sl).put(n,`${a}:${n.subsetSha}`),r.oncomplete=()=>o(),r.onerror=()=>o(),r.onabort=()=>o()}catch{o()}finally{l.close()}})}function qu(a){return a?`Herdr Glyphs ${a.sha256.slice(0,12)}`:null}function xw(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 Nb(a,n){return n<32||n>=127&&n<160||n>=9472&&n<=9631?!1:a==="all"||xw(n)}function ww(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=m=>m.toString(16).toUpperCase();l.push(r===u?`U+${h(r)}`:`U+${h(r)}-${h(u)}`)}return l.join(", ")}async function Sw(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:ww(n.codepoints)});document.fonts.add(await l.load())}const md=new Set;function Cw(a){return!!(a&&md.has(a))}async function Tw(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,hw[o.style]).load()));for(const o of l)document.fonts.add(o);md.add(a)}function rg(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 kb(a,n,l){const o=Math.ceil(a.bytes/Vu),r=new Uint8Array(a.bytes);let u=0;const h=async()=>{for(;u<o;){const m=u;u+=1;const p=await n(a.sha256,m),g=m*Vu,y=Math.min(Vu,a.bytes-g);if(p.length!==y)throw new Error("host_font_corrupt");r.set(p,g),l(p.length)}};return await Promise.all(Array.from({length:Math.min(fw,o)},h)),r.buffer}function Lb(){try{const a=JSON.parse(bs("local",Et.hostFontConsent)||"{}");return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function cg(a,n){const l=Lb()[a];return l&&l.fingerprint===n?l.decision:null}function ug(a,n,l){const o=Lb();o[a]={fingerprint:n,decision:l},Li("local",Et.hostFontConsent,JSON.stringify(o))}const _b={source:null,status:"none",alias:null,covered:0},Xu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:_b,interactive:!1,glyphRevision:0},Mw=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 dg(a){const n=(a==null?void 0:a.subsets)??[];return n.find(l=>l.scope==="all")??n.find(l=>l.scope==="cjk")??null}function Aw(a,n){const l=new Set;for(const o of a){const r=o.codePointAt(0);Nb(n,r)&&l.add(r)}return[...l]}const fg=3e4;function Ew(a){const n=T.useRef(new Map),l=T.useRef(new Map),o=T.useRef(new Map),r=T.useCallback(m=>{for(const p of[n.current,l.current]){for(const g of p.values())clearTimeout(g.timer),g.reject(new Error(m));p.clear()}},[]),u=T.useCallback((m,p)=>new Promise((g,y)=>{if(!a){y(new Error("disconnected"));return}const v=`${m}:${p}`,x=setTimeout(()=>{n.current.delete(v),y(new Error("host_font_timeout"))},fg);n.current.set(v,{resolve:g,reject:y,timer:x}),a.sendHostFontChunkRequest(m,p)}),[a]),h=T.useCallback((m,p,g)=>new Promise((y,v)=>{if(!a){v(new Error("disconnected"));return}const x=Math.random().toString(36).slice(2,12),w=setTimeout(()=>{l.current.delete(x),v(new Error("host_font_timeout"))},fg);l.current.set(x,{resolve:S=>y({...S,codepoints:p}),reject:v,timer:w}),o.current.set(x,g),a.sendHostFontSubsetRequest(m.sha256,String.fromCodePoint(...p),x)}),[a]);return T.useEffect(()=>{if(!a)return;const m=n.current,p=l.current,g=a.on("hostFontChunk",w=>{const S=`${w.sha256}:${w.index}`,M=m.get(S);if(M){m.delete(S),clearTimeout(M.timer);try{M.resolve(rg(w.dataBase64))}catch{M.reject(new Error("host_font_corrupt"))}}}),y=a.on("hostFontSubset",w=>{const S=p.get(w.requestId);if(!S)return;p.delete(w.requestId),clearTimeout(S.timer);const M=o.current.get(w.requestId)??(()=>{});if(o.current.delete(w.requestId),w.dataBase64!==void 0){try{const k=rg(w.dataBase64);M(k.length,k.length),S.resolve({subsetSha:w.subsetSha,data:k.buffer,codepoints:[]})}catch{S.reject(new Error("host_font_corrupt"))}return}M(0,w.bytes);const E={bytes:w.bytes,sha256:w.subsetSha};kb(E,u,k=>M(k,w.bytes)).then(k=>S.resolve({subsetSha:w.subsetSha,data:k,codepoints:[]})).catch(k=>S.reject(k instanceof Error?k:new Error("host_font_failed")))}),v=a.on("error",w=>{(w.code==="host_font_unavailable"||w.code==="host_font_subset_failed")&&r(String(w.code))}),x=a.on("stateChange",w=>{w!=="connected"&&r("disconnected")});return()=>{g(),y(),v(),x(),r("disconnected")}},[a,r,u]),{requestChunk:u,requestSubset:h,rejectPending:r}}const Nw=15e3,kw=80,Lw=2e3;function _w(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),m=T.useRef(0),p=T.useRef(new Set),g=T.useRef(new Set),y=T.useRef(new Set),v=T.useRef(null),{requestChunk:x,requestSubset:w,rejectPending:S}=Ew(a),M=T.useCallback(()=>({isInstalled:u.current.isInstalled??mw,readCached:u.current.readCached??gw,writeCached:u.current.writeCached??bw,register:u.current.register??Tw,isRegistered:u.current.isRegistered??Cw,readSubsets:u.current.readSubsets??yw,writeSubset:u.current.writeSubset??vw,registerGlyphs:u.current.registerGlyphs??Sw}),[]),E=T.useCallback(()=>(a==null?void 0:a.getHostId())||"default",[a]),k=T.useCallback((K,q)=>{K===h.current&&o(te=>({...te,glyphs:{...te.glyphs,...q}}))},[]),N=T.useCallback(async(K,q,te)=>{const{registerGlyphs:Z}=M();for(const ie of te){if(await Z(q,ie),K!==h.current)return;for(const re of ie.codepoints)p.current.add(re)}K!==h.current||!te.length||o(ie=>({...ie,glyphs:{...ie.glyphs,alias:q,covered:p.current.size},glyphRevision:ie.glyphRevision+1}))},[M]),R=T.useCallback(async(K,q,te)=>{const Z=qu(q),ie=q.scope==="all"?Mw+lg:lg,re=Aw(ie,q.scope).filter(A=>!p.current.has(A));if(!re.length)return;for(const A of re)g.current.add(A);const P=await w(q,re,te);K===h.current&&(await M().writeSubset(q.sha256,P),await N(K,Z,[P]))},[w,M,N]),H=T.useCallback(async(K,{interactive:q=!0}={})=>{const te=K??r.current.font,Z=Ji(te);if(!te||!Z)return;const ie=r.current,re=Ji(ie.font)===Z;if(re&&(ie.status==="loading"||ie.glyphs.status==="loading"))return;const P=h.current,{isInstalled:A,isRegistered:G,readCached:Q,writeCached:se,register:W}=M();ug(E(),Z,"accepted");const be=sg(te),xe=dg(te),ue=!!(be&&!G(be)&&!A(te.family)),Te=re?ie.glyphs:{..._b,source:xe},ce=!!(xe&&!["installed","ready","none"].includes(Te.status));let ye=ue?og(te):0,ae=0;const ve=()=>{P===h.current&&o(le=>({...le,receivedBytes:ae,totalBytes:ye}))};if(o(le=>({...le,font:te,interactive:q,receivedBytes:0,totalBytes:ye,error:null,status:ue?"loading":le.status,glyphs:ce?{...Te,status:"loading"}:Te})),ue&&be)try{const le=[];for(const we of te.faces){let Ee=await Q(we.sha256);if(Ee?(ae+=we.bytes,ve()):(Ee=await kb(we,x,Be=>{ae+=Be,ve()}),await se(we.sha256,Ee)),P!==h.current)return;le.push({face:we,data:Ee})}if(await W(be,le),P!==h.current)return;o(we=>({...we,status:"loaded",alias:be}))}catch(le){if(P!==h.current)return;const we=le instanceof Error&&le.message?le.message:"host_font_failed";o(Ee=>({...Ee,status:"failed",alias:null,error:we}))}if(ce&&xe){let le=0;try{await R(P,xe,(we,Ee)=>{Ee&&!le&&(le=Ee,ye+=Ee),ae+=we,ve()}),k(P,{status:"ready"})}catch(we){if(P!==h.current)return;const Ee=we instanceof Error&&we.message?we.message:"host_font_failed";o(Be=>({...Be,error:Be.error??Ee,glyphs:{...Be.glyphs,status:"failed"}}))}}},[x,R,M,E,k]),j=T.useCallback(async K=>{const q=Ji(K)!==Ji(r.current.font);q&&(S("superseded"),p.current=new Set,g.current=new Set,y.current=new Set);const te=++h.current;if(!K){o(Xu);return}const{isInstalled:Z,readCached:ie,register:re,isRegistered:P,readSubsets:A}=M(),G=sg(K),Q=Ji(K),se=dg(K);let W="checking";G&&P(G)?W="loaded":Z(K.family)?W="installed":G||(W="unavailable");let be="checking";if(se?(se.scope==="cjk"?Z(se.family):W==="installed")&&(be="installed"):be="none",o(ce=>({...Xu,font:K,status:W==="checking"?"checking":W,alias:W==="loaded"?G:null,totalBytes:og(K),glyphs:{source:se,status:be,alias:q?null:ce.glyphs.alias,covered:p.current.size},glyphRevision:ce.glyphRevision})),W==="checking"&&G){const ce=await Promise.all(K.faces.map(ye=>ie(ye.sha256)));if(te!==h.current)return;if(W="needs",ce.every(Boolean))try{if(await re(G,K.faces.map((ye,ae)=>({face:ye,data:ce[ae]}))),te!==h.current)return;W="loaded",o(ye=>({...ye,status:"loaded",alias:G}))}catch{}}if(be==="checking"&&se){const ce=await A(se.sha256);if(te!==h.current)return;if(ce.length)try{await N(te,qu(se),ce),be="cached"}catch{be="needs"}else be="needs";if(te!==h.current)return}const xe=cg(E(),Q),ue=xe==="accepted"||be==="cached"||Date.now()<m.current;if(be==="cached"&&(be="ready",k(te,{status:"ready"}),R(te,se,()=>{}).catch(()=>{})),W!=="needs"&&be!=="needs")return;if(ue){H(K,{interactive:!1});return}const Te=xe==="declined"?"declined":"available";o(ce=>({...ce,status:W==="needs"?Te:ce.status,glyphs:be==="needs"?{...ce.glyphs,status:Te}:ce.glyphs}))},[H,S,E,k,R,M,N]),D=T.useCallback(()=>{const K=Ji(r.current.font);K&&ug(E(),K,"declined"),o(q=>({...q,interactive:!1,status:["available","failed"].includes(q.status)?"declined":q.status,glyphs:["available","failed"].includes(q.glyphs.status)?{...q.glyphs,status:"declined"}:q.glyphs}))},[E]),_=T.useCallback(()=>{m.current=Date.now()+Nw,a==null||a.sendHostFontRefresh();const K=r.current,q=["available","declined","failed"];K.font&&(q.includes(K.status)||q.includes(K.glyphs.status))&&H(K.font,{interactive:!1})},[a,H]),z=T.useCallback(K=>{const{glyphs:q}=r.current;if(q.status!=="ready"||!q.source)return;const te=q.source;for(const Z of K){const ie=Z.codePointAt(0);ie<128&&te.scope!=="all"||Nb(te.scope,ie)&&(p.current.has(ie)||g.current.has(ie)||y.current.add(ie))}!y.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const Z=h.current,ie=[...y.current].slice(0,Lw);for(const re of ie)y.current.delete(re),g.current.add(re);(async()=>{const re=await w(te,ie,()=>{});Z===h.current&&(await M().writeSubset(te.sha256,re),await N(Z,qu(te),[re]))})().catch(()=>{})},kw))},[w,M,N]);return T.useEffect(()=>{if(!a)return;const K=a.on("terminalFont",q=>{j(q)});return()=>{K(),v.current&&clearTimeout(v.current),v.current=null}},[a,j]),T.useEffect(()=>{const K=q=>{if(q.key!==Et.hostFontConsent)return;const te=r.current,Z=Ji(te.font),ie=te.status==="available"||te.glyphs.status==="available";if(!Z||!ie)return;const re=cg(E(),Z);re==="accepted"?H(te.font,{interactive:!1}):re==="declined"&&D()};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[H,D,E]),{hostFont:l,loadHostFont:H,declineHostFont:D,syncHostFont:_,ensureHostGlyphs:z}}function Rw(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"),m=()=>o("focus"),p=()=>o("resume");return l.addEventListener("visibilitychange",r),l.addEventListener("resume",p),n.addEventListener("pageshow",u),n.addEventListener("online",h),n.addEventListener("focus",m),()=>{l.removeEventListener("visibilitychange",r),l.removeEventListener("resume",p),n.removeEventListener("pageshow",u),n.removeEventListener("online",h),n.removeEventListener("focus",m)}}function Po(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 hg(a,n){return n||(a==="win32"?"powershell":"posix")}function jw(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 Ow(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 Dw={connectionState:"disconnected",role:"viewer",shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},mg={role:"viewer",controllerId:void 0,hostname:void 0,platform:void 0,adminTerminalSupported:void 0,hostVersion:void 0,shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1};function zw(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,hostVersion:l.hostVersion,shellProfile:hg(l.platform,l.shellProfile),assignedClientId:l.clientId||a.assignedClientId,hostPalette:l.terminalPalette||null}}case"hostReconnecting":return{...a,...mg,stateCode:n.code,stateDetail:n.detail};case"sessionRestarted":return{...a,hostname:n.hostname,platform:n.platform,adminTerminalSupported:n.adminTerminalSupported,hostVersion:n.hostVersion,shellProfile:hg(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,...mg,hostId:void 0,platform:void 0,assignedClientId:void 0,terminalResetVersion:a.terminalResetVersion+(n.resetTerminal?1:0)}}}const Hw=3e4;function Bw(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)},[]),m=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")})},Hw))},[a,n,h]),p=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:m,handleLaunchError:p,forgetHerdrLaunch:g}}class Uw{constructor(){$(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 Rb=27,jb=91,Kw=60,pg=59,Ob=77,Db=48,Iw=57,Fw=64,Gw=-30,Zu=32,gg=255;function zb(a){return Number.isInteger(a)&&(a&Gw)===Fw}function Yw(a){return a>=Db&&a<=Iw}function Wu(a,n){let l=n,o=0;for(;l<a.length&&Yw(a[l]);){if(o=o*10+(a[l]-Db),o>65535)return null;l+=1}return l===n?null:{value:o,next:l}}function Pw(a,n){if(a[n]!==Rb||a[n+1]!==jb||a[n+2]!==Kw)return-1;const l=Wu(a,n+3);if(!l||!zb(l.value)||a[l.next]!==pg)return-1;const o=Wu(a,l.next+1);if(!o||a[o.next]!==pg)return-1;const r=Wu(a,o.next+1);return!r||a[r.next]!==Ob?-1:r.next+1}function Vw(a,n){if(a[n]!==Rb||a[n+1]!==jb||a[n+2]!==Ob||n+6>a.length)return-1;const l=a[n+3]-Zu,o=a[n+4],r=a[n+5];return!zb(l)||o<Zu||o>gg||r<Zu||r>gg?-1:n+6}function hr(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=Pw(n,l);if(o>l){l=o;continue}const r=Vw(n,l);if(r>l){l=r;continue}return!1}return!0}class $w{constructor(n){$(this,"segments",[]);$(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=>!hr(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,Xw=1e4,Zw=1500;class Ww extends Uw{constructor(l){super();$(this,"ws",null);$(this,"config");$(this,"state","disconnected");$(this,"reconnectAttempts",0);$(this,"reconnectTimer",null);$(this,"pingTimer",null);$(this,"pingTimestamp",null);$(this,"lastInboundAt",0);$(this,"pingSentAt",null);$(this,"connectStartedAt",0);$(this,"lastWakeConnectAt",0);$(this,"probeTimer",null);$(this,"rejectedByRelay",!1);$(this,"isManuallyClosed",!1);$(this,"authFailureDetail",null);$(this,"authFailureCode",null);$(this,"temporaryFailureCode",null);$(this,"input",new $w(()=>this.ws));$(this,"terminalCols",80);$(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<Zw)return;this.lastWakeConnectAt=o,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){o-this.connectStartedAt>Xw&&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=jt),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 Jw extends Ww{constructor(){super(...arguments);$(this,"currentRole","viewer");$(this,"controllerId");$(this,"hostId");$(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,l.hostVersion),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 e1(a,n,l){const o=T.useRef(l);if(o.current=l,!a.current){const r=new Jw(n());for(const u of Object.keys(l)){const h=(...m)=>{var p,g;return(g=(p=o.current)[u])==null?void 0:g.call(p,...m)};r.on(u,h)}a.current=r}return a.current}const t1=3*1024*1024,Hb=1568,n1=[.85,.7,.55,.4],Vo={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function i1(a,n,l=Hb){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 a1(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 l1(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function s1(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 Bb(a,n=Hb,l=t1){var r;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let o;try{o=await s1(a)}catch(u){return console.warn("Failed to decode image for paste:",u),null}try{const{width:u,height:h}=i1(o.width,o.height,n),m=document.createElement("canvas");m.width=u,m.height=h;const p=m.getContext("2d");if(!p)return null;p.drawImage(o.source,0,0,u,h);let g="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const y of n1){let v;try{v=m.toDataURL(g,y)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const x=v.indexOf(","),w=x!==-1?v.slice(x+1):"",S=a1(w);if(S<=l)return{mime:g,dataBase64:w,dataUrl:v,byteLength:S,width:u,height:h}}return null}finally{(r=o.cleanup)==null||r.call(o)}}const o1=3e4,r1=1200;function c1({adapterRef:a,role:n,connectionState:l,warnViewerMode:o,addToast:r,t:u,sendPasteFile:h}){const[m,p]=T.useState(Vo),g=T.useRef(null),y=T.useRef(0),v=T.useRef(null),x=T.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),w=T.useCallback(()=>{x(),g.current=null,p(Vo)},[x]),S=T.useCallback(()=>{g.current!==null&&w()},[w]),M=T.useCallback(()=>{const k=g.current;k!==null&&(x(),p({active:!0,phase:"completed",ratio:1,percent:100,statusText:u("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===k&&(g.current=null,p(Vo))},r1))},[x,u]);T.useEffect(()=>{l!=="connected"&&S()},[l,S]),T.useEffect(()=>x,[x]);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,x();const R=j=>(j&&r("error",j),g.current=null,p(Vo),!1),H="dataBase64"in k&&typeof k.dataBase64=="string";try{let j;if(H)j=k;else{const _=k;if(p({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"));p({active:!0,phase:"processing",ratio:.35,percent:35,statusText:u("virtualKeyboard.uploadProgressProcessing")});const z=await Bb(_);if(g.current!==N)return!1;if(!z)return R(u("clipboard.imageTooLarge"));j=z,p({active:!0,phase:"processing",ratio:.6,percent:60,statusText:u("virtualKeyboard.uploadProgressProcessing")})}p({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?(p({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"))},o1),!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,x]);return{uploadProgress:m,uploadImage:E,resetUploadProgress:w,abortUpload:S,completeUpload:M}}const u1=4096,d1=8*1024*1024;function f1(){const a=T.useRef(null),n=T.useRef([]),l=T.useRef(0),o=T.useCallback(p=>{for(n.current.push(p),l.current+=p.byteLength;n.current.length>u1||l.current>d1;){const g=n.current.shift();if(!g)break;l.current-=g.byteLength}},[]),r=T.useCallback(p=>{const g=a.current;if(g)try{g(p);return}catch(y){console.debug("Terminal output sink threw, buffering chunk instead:",y)}o(p)},[o]),u=T.useCallback(p=>{a.current=p;const g=n.current;n.current=[],l.current=0;for(let y=0;y<g.length;y++)try{p(g[y])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let x=y;x<g.length;x++)o(g[x]);break}return()=>{a.current===p&&(a.current=null)}},[o]),h=T.useCallback(()=>n.current.length,[]),m=T.useCallback(()=>{n.current=[],l.current=0},[]);return{receiveOutput:r,subscribeToOutput:u,getPendingOutputChunkCount:h,clearPendingOutput:m}}const bg=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify"],h1=["agentKeymaps"],m1=64;function p1(a,n){const l=a,o={};for(const r of n)l[r]!==void 0&&(o[r]=l[r]);return o}function nl(a,n){return p1(a,n==="local"?[...bg,...h1]:bg)}function mr(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,m1))(r===""?n.length>0:!n.includes(r))||!u||typeof u!="object"||Array.isArray(u)||(o[r]=nl(u,l));return o}const Ub=64,ys=4096;function jd(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function g1(a,n){return(typeof a=="string"?a.trim().slice(0,Ub):"")||n}function pr(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,ys):"",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(),m=typeof l.id=="string"&&l.id.length>0?l.id.slice(0,128):jd(),p=typeof l.hostname=="string"&&l.hostname.trim()?l.hostname.trim().slice(0,Ub):`Herdr ${n+1}`;return{id:m,displayName:g1(l.displayName,p),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 yg(a,n=0){const l=pr({...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 vg(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 Kb(a){var u;const n=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((h,m)=>{const p=pr(h,m);p&&!n.some(g=>g.id===p.id)&&n.push(p)}),n.length===0&&(typeof a.token=="string"&&a.token||typeof a.pairCode=="string"&&a.pairCode)){const h=pr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof a.wsUrl=="string"&&a.wsUrl.trim()?a.wsUrl:jt,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 Ib=[{id:"esc",label:"ESC",code:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.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:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.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:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],b1=[{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:oe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:oe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:oe.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:oe.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:oe.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:oe.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:oe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:oe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:oe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:oe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:oe.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:oe.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:oe.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:oe.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:oe.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:oe.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:oe.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:oe.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:oe.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:oe.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:oe.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:oe.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:oe.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:oe.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:oe.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:oe.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:oe.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:oe.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:oe.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:oe.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:oe.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:oe.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:oe.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:oe.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:oe.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 vs(){return JSON.parse(JSON.stringify(Ib))}const y1=[["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 v1(a){return y1.some(n=>a.length===n.length&&a.every((l,o)=>l.id===n[o]&&l.enabled!==!1))}function x1(a){if(!Array.isArray(a)||a.length===0)return vs();const n=a.filter(l=>typeof l=="object"&&l!==null&&typeof l.id=="string"&&typeof l.label=="string"&&typeof l.code=="string");return v1(n)?vs():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 xg="herdr-remote.ignoredUpdate";function w1(){const a=bs("local",Et.ignoredUpdate);if(a!==null)return a;const n=bs("local",xg);if(n===null)return null;Fb(n);try{window.localStorage.removeItem(xg)}catch{}return n}function Fb(a){Li("local",Et.ignoredUpdate,a)}function S1(){return`client-${Math.random().toString(36).substring(2,8)}`}function Gb(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Yb(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:jt,token:"",pairCode:"",clientId:S1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?dr:gs,fontSizeFollowsHost:!0,fontFamily:Mb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Gb(),virtualKeys:vs(),agentKeymaps:{},observerMode:!1,adminToken:"",adminTokens:{}}}const C1=["wsUrl","token","pairCode","clientId","autoReconnect","language"],T1=["wsUrl","token","pairCode","autoReconnect"],wg=["theme","colorMode"];function Pb(a){const n=a;if(!wg.some(r=>n[r]!==void 0))return{data:a,changed:!1};const o={...n};for(const r of wg)delete o[r];return{data:o,changed:!0}}function Vb(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,ys));return n}function gr(a,n){const l=bs(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 br(){const a=Yb();if(typeof window>"u")return a;let n=gr("local",Et.settings);const l=Pb(n);l.changed&&(n=l.data,Li("local",Et.settings,JSON.stringify(n)));const o=gr("session",Et.sessionView),r=Kb(n),u=r.profiles.map(te=>te.id),h=typeof o.activeProfileId=="string"&&u.includes(o.activeProfileId)?o.activeProfileId:r.activeProfileId,m=r.profiles.find(te=>te.id===h),p={...nl(n,"local"),...mr(n.instances,u,"local")[h]},g=mr(o.instances,u,"session");let y=g[h];y||(y=nl({...p,...nl(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={...p,...y},x=Pu(v.fontFamily??a.fontFamily),w=window.innerWidth<640?dr:gs,S=v.fontSize??a.fontSize,M=al(S,w),E=v.fontSizeFollowsHost,k=typeof E=="boolean"?E:M===gs||M===dr,N=x1(v.virtualKeys??a.virtualKeys),R=n.language??a.language,H=R==="zh"||R==="en"?R:Gb(),j=te=>{const Z=v[te];return typeof Z=="boolean"?Z:a[te]},D=v.predictiveEcho??a.predictiveEcho,_=D==="always"||D==="off"||D==="auto"?D:"auto",z=typeof o.adminToken=="string"?o.adminToken.slice(0,ys):typeof n.adminToken=="string"?n.adminToken.slice(0,ys):a.adminToken,K=Vb(o.adminTokens),q={...a,wsUrl:(m==null?void 0:m.wsUrl)||(typeof n.wsUrl=="string"?n.wsUrl:a.wsUrl),token:(m==null?void 0:m.token)||"",pairCode:(m==null?void 0:m.pairCode)||"",autoReconnect:(m==null?void 0:m.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:x,fontSize:M,fontSizeFollowsHost:k,toolbarVisible:v.toolbarVisible??a.toolbarVisible,toolbarPosition:v.toolbarPosition??a.toolbarPosition,vibrateOnKeyPress:v.vibrateOnKeyPress??a.vibrateOnKeyPress,predictiveEcho:_,virtualKeys:N,agentKeymaps:Tb(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))),q}function Ai(a){var M;const n=br(),l={...n,...a};l.agentKeymaps=Tb(l.agentKeymaps),l.adminTokens=Vb(l.adminTokens),typeof l.adminToken=="string"&&(l.adminToken=l.adminToken.slice(0,ys)),a.fontSize!==void 0&&(l.fontSize=al(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?l.predictiveEcho=a.predictiveEcho:l.predictiveEcho="auto");const o=Kb(l);let r=o.profiles,u=o.activeProfileId;if(T1.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=pr(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 m=r.find(E=>E.id===u);l.wsUrl=(m==null?void 0:m.wsUrl)||l.wsUrl||jt,l.token=(m==null?void 0:m.token)||"",l.pairCode=(m==null?void 0:m.pairCode)||"",l.autoReconnect=(m==null?void 0:m.autoReconnect)??l.autoReconnect;const p=r.map(E=>E.id),g=Pb(gr("local",Et.settings)).data,y=gr("session",Et.sessionView),v=mr(g.instances,p,"local"),x=mr(y.instances,p,"session"),S=u===n.activeProfileId||!n.activeProfileId?l:a;v[u]={...v[u],...nl(S,"local")},x[u]={...x[u],...nl(S,"session")};for(const E of C1)l[E]!==void 0&&(g[E]=l[E]);return g.profiles=r,g.instances=v,(u!==n.activeProfileId||!p.includes(g.activeProfileId??""))&&(g.activeProfileId=u),Li("local",Et.settings,JSON.stringify(g)),Li("session",Et.sessionView,JSON.stringify({activeProfileId:u,instances:x,observerMode:l.observerMode===!0,adminToken:l.adminToken,adminTokens:l.adminTokens})),br()}function M1(a){const[n,l]=T.useState(br),o=T.useRef(n);o.current=n;const r=T.useRef(a);r.current=a;const u=T.useCallback(w=>{const S=Ai(w);o.current=S,l(S)},[]),h=T.useCallback(w=>{o.current=w,l(w)},[]),m=T.useCallback(w=>{const S=o.current,M=yg({...w,wsUrl:w.wsUrl||jt,token:w.token||"",displayName:w.displayName||`Herdr ${S.profiles.length+1}`,autoReconnect:w.autoReconnect!==!1},S.profiles.length),E=Ai({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]),p=T.useCallback(w=>{const S=o.current,M=S.profiles.find(k=>k.id===w);if(!M||M.id===S.activeProfileId)return;const E=Ai({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((w,S)=>{const M=o.current;if(!M.profiles.find(R=>R.id===w))return;const k=S.trim().slice(0,64);if(!k)return;const N=Ai({profiles:M.profiles.map(R=>R.id===w?{...R,displayName:k}:R)});h(N)},[h]),y=T.useCallback(w=>{const S=o.current;if(!S.profiles.some(N=>N.id===w))return;const M=S.profiles.filter(N=>N.id!==w),E=M.find(N=>N.id===S.activeProfileId)||M[0],k=Ai(E?{profiles:M,activeProfileId:E.id,wsUrl:E.wsUrl,token:E.token,pairCode:E.pairCode||"",autoReconnect:E.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:jt,token:"",pairCode:""});h(k),w===S.activeProfileId&&r.current(k)},[h]),v=T.useCallback(w=>{const S=o.current,M=S.profiles.find(z=>z.id===S.activeProfileId),E=w.hostId?vg({wsUrl:S.wsUrl,hostId:w.hostId}):null,k=E?S.profiles.findIndex(z=>vg(z)===E):-1,N=k>=0?k:Math.max(0,S.profiles.findIndex(z=>z.id===S.activeProfileId)),H={...S.profiles[N]||M||yg({wsUrl:S.wsUrl||jt,token:"",pairCode:S.pairCode||"PENDING",displayName:`Herdr ${S.profiles.length+1}`},S.profiles.length),token:w.token,pairCode:void 0,...w.hostId?{hostId:w.hostId}:{},...w.deviceId?{deviceId:w.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 _=Ai({profiles:j,activeProfileId:H.id,wsUrl:H.wsUrl,token:H.token,pairCode:"",autoReconnect:H.autoReconnect});return h(_),_},[h]),x=T.useCallback(w=>{const S=o.current,M=S.profiles.find(R=>R.id===S.activeProfileId);if(!M||!w.hostId&&!w.hostname)return;const E=/^Herdr \d+$/.test(M.displayName),k={...M,...w.hostId?{hostId:w.hostId}:{},...w.hostname?{hostname:w.hostname}:{},...w.hostname&&E?{displayName:w.hostname}:{}},N=Ai({profiles:S.profiles.map(R=>R.id===M.id?k:R)});h(N)},[h]);return{settings:n,updateSettings:u,addProfileAndConnect:m,switchProfile:p,renameProfile:g,removeProfile:y,savePairedProfile:v,noteReadyProfile:x}}const $o={ctrl:!1,alt:!1,shift:!1};function A1({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 m=T.useRef(new Set),p=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 q of p.current)try{q(K)}catch(te){console.debug("Key input observer threw:",te)}z.sendInput(K)},[a,n,y]),x=T.useCallback(_=>(p.current.add(_),()=>{p.current.delete(_)}),[]),[w,S]=T.useState($o),M=T.useRef($o),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=$o,S($o),_)},[]),N=T.useCallback(_=>{var z;n!=="controller"&&!hr(_)||(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(_=>(m.current.add(_),()=>{m.current.delete(_)}),[]),D=T.useCallback(_=>{for(const z of m.current)try{z(_)}catch(K){console.error("Error in pasteFileReady listener:",K)}},[]);return{terminalDimensions:r,dimensionsRef:h,warnViewerMode:y,sendKey:v,observeKeyInput:x,modifierLatch:w,toggleModifierLatch:E,consumeModifierLatch:k,sendBinary:N,sendResize:R,sendPasteFile:H,subscribeToPasteFileReady:j,notifyPasteFileReady:D}}const E1=4e3,N1=3;function k1(){const[a,n]=T.useState([]),l=T.useRef([]),o=T.useRef(new Map),r=T.useCallback(m=>{l.current=m,n(m)},[]),u=T.useCallback(m=>{const p=o.current.get(m);p&&(clearTimeout(p),o.current.delete(m)),r(l.current.filter(g=>g.id!==m))},[r]),h=T.useCallback((m,p)=>{const g=Date.now(),y=l.current,v=y.find(M=>M.type===m&&M.message===p),x=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let w;if(v)w=y.map(M=>M.id===x?{...M,count:M.count+1,timestamp:g}:M);else for(w=[...y,{id:x,type:m,message:p,timestamp:g,count:1}];w.length>N1;){const[M,...E]=w,k=o.current.get(M.id);k&&(clearTimeout(k),o.current.delete(M.id)),w=E}r(w);const S=o.current.get(x);S&&clearTimeout(S),o.current.set(x,setTimeout(()=>u(x),E1))},[r,u]);return T.useEffect(()=>{const m=o.current;return()=>{for(const p of m.values())clearTimeout(p);m.clear()}},[]),{toasts:a,addToast:h,removeToast:u}}function L1(a,n){const[l,o]=T.useState(null),[r,u]=T.useState(w1),h=T.useRef(r),m=T.useRef(new Set),p=T.useCallback(x=>{h.current=x,u(x),Fb(x)},[]),g=T.useCallback(x=>{if(o(x),!x.updateAvailable||h.current===x.latest)return;const w=`${x.latest}:${x.restartPending?"restart":"update"}`;m.current.has(w)||(m.current.add(w),a("info",x.restartPending?n.current("update.toastRestart",{version:x.latest}):n.current("update.toast",{version:x.latest})))},[a,n]),y=T.useCallback(()=>o(null),[]),v=T.useCallback((x,w)=>{if(x!==null)return;const S=`outdated:${w||""}`;m.current.has(S)||(m.current.add(S),a("warning",n.current("update.toastOutdated",{host:w||n.current("update.thisHost")})))},[a,n]);return{updateStatus:l,ignoredUpdate:r,ignoreUpdate:p,receiveUpdateStatus:g,forgetUpdateStatus:y,noteHostVersion:v}}const $b=T.createContext(null),qb=T.createContext(null),Xb=T.createContext(null),Zb=T.createContext(null),Wb=T.createContext(null),_1=({children:a})=>{var Ls;const[n,l]=T.useReducer(zw,Dw),o=T.useRef(null),r=T.useRef(!1);T.useEffect(()=>{Ab()},[]);const{receiveOutput:u,subscribeToOutput:h,getPendingOutputChunkCount:m,clearPendingOutput:p}=f1(),{toasts:g,addToast:y,removeToast:v}=k1(),x=T.useCallback(()=>{p(),l({type:"reset",resetTerminal:!0})},[p]),{settings:w,updateSettings:S,addProfileAndConnect:M,switchProfile:E,renameProfile:k,removeProfile:N,savePairedProfile:R,noteReadyProfile:H}=M1(fe=>{var qe;x(),(qe=o.current)==null||qe.reconnectWith(Po(fe))}),j=T.useCallback((fe,qe)=>Ld(w.language,fe,qe),[w.language]),D=T.useRef(j);D.current=j;const{herdrLaunch:_,startHerdr:z,handleLaunchError:K,forgetHerdrLaunch:q}=Bw(o,D),{updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie,receiveUpdateStatus:re,forgetUpdateStatus:P,noteHostVersion:A}=L1(y,D),G=w.observerMode?"viewer":n.role,Q=A1({adapterRef:o,role:G,addToast:y,tRef:D}),{uploadProgress:se,uploadImage:W,resetUploadProgress:be,abortUpload:xe,completeUpload:ue}=c1({adapterRef:o,role:G,connectionState:n.connectionState,warnViewerMode:Q.warnViewerMode,addToast:y,t:j,sendPasteFile:Q.sendPasteFile}),Te=e1(o,()=>Po(w),{stateChange:(fe,qe,_t)=>{const Ft=Yu(_t)?j(`serverErrors.${_t}`):qe;l({type:"stateChange",state:fe,detail:Ft,code:_t}),fe==="connected"?y("success",j("toasts.connected")):fe==="error"&&y("error",Ft||j("toasts.connectionError")),fe!=="connected"&&q()},ready:fe=>{const qe=r.current;qe&&p(),r.current=!0,q(),P(),l({type:"ready",message:fe,resetTerminal:qe}),H(fe),A(fe.hostVersion,fe.hostname||fe.hostId)},hostReconnecting:fe=>{l({type:"hostReconnecting",code:fe||"host_reconnecting",detail:j(`serverErrors.${Yu(fe)?fe:"host_reconnecting"}`)}),p()},sessionRestarted:(fe,qe,_t,Ft,ca,Nn,ua,ti)=>{var _s;p(),l({type:"sessionRestarted",hostname:Ft,palette:_t,platform:ca,shellProfile:Nn,adminTerminalSupported:ua,hostVersion:ti}),A(ti,Ft),H({hostId:(_s=o.current)==null?void 0:_s.getHostId(),hostname:Ft})},roleChange:(fe,qe,_t,Ft)=>{l({type:"roleChange",role:fe,controllerId:qe,hostId:_t,assignedClientId:Ft})},controlGranted:()=>{l({type:"controlGranted"}),y("success",j("toasts.controlGranted"))},paired:fe=>{var _t;const qe=R(fe);y("success",j("toasts.pairedSuccess")),l({type:"paired",at:Date.now()}),(_t=o.current)==null||_t.reconnectWith(Po(qe))},exit:(fe,qe)=>{y("info",`${j("toasts.sessionEnded")}${qe?`: ${qe}`:""}${fe!=null?` (${fe})`:""}`)},error:fe=>{if(K(fe)||fe.code==="host_font_unavailable")return;xe();const qe=Yu(fe.code)?j(`serverErrors.${fe.code}`):fe.message||`[${fe.code}]`;y("error",qe)},pasteFileReady:fe=>{ue(),Q.notifyPasteFileReady(fe)},rttUpdate:fe=>l({type:"rtt",rttMs:fe}),peerCount:fe=>l({type:"peerCount",count:fe}),sessionReady:()=>{l({type:"sessionReady"}),q()},agentStatus:fe=>l({type:"agentStatus",status:fe}),updateStatus:re,binaryData:u}),{activeProfileId:ce}=w,ye=w.profiles.find(fe=>fe.id===ce),{hostFont:ae,loadHostFont:ve,declineHostFont:le,syncHostFont:we,ensureHostGlyphs:Ee}=_w(Te),Be=T.useCallback(()=>{ve()},[ve]),it=uw(w.fontFamily,ae.font?{family:ae.font.family,alias:ae.status==="loaded"?ae.alias:null,glyphs:ae.glyphs.source?{family:ae.glyphs.source.family,scope:ae.glyphs.source.scope,alias:ae.glyphs.alias}:null}:null),tt=w.fontSizeFollowsHost&&((Ls=ae.font)!=null&&Ls.sizePx)?al(ae.font.sizePx,w.fontSize):w.fontSize;T.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",it)},[it]),T.useEffect(()=>{var fe;(fe=o.current)==null||fe.updateConfig(Po(w))},[w]),T.useEffect(()=>{const fe=o.current;return fe?Rw(fe):void 0},[]);const{dimensionsRef:de}=Q,Re=T.useCallback(fe=>{o.current&&(fe&&o.current.updateConfig(fe),o.current.connect(de.current))},[de]),Xe=T.useCallback(()=>{var fe;(fe=o.current)==null||fe.disconnect()},[]),gt=T.useCallback((fe=!1)=>{var qe;(qe=o.current)==null||qe.claimControl(fe)},[]),ht=T.useCallback(()=>{var fe;(fe=o.current)==null||fe.releaseControl()},[]),gn=T.useCallback(fe=>S({language:fe}),[S]),bn=T.useMemo(()=>({settings:w,updateSettings:S,language:w.language,setLanguage:gn,t:j,profiles:w.profiles,activeProfileId:ce,activeProfile:ye,switchProfile:E,addProfileAndConnect:M,renameProfile:k,removeProfile:N,hostFont:ae,loadHostFont:Be,declineHostFont:le,syncHostFont:we,ensureHostGlyphs:Ee,terminalFontFamily:it,terminalFontSize:tt}),[w,S,gn,j,ce,ye,E,M,k,N,ae,Be,le,we,Ee,it,tt]),kt=T.useMemo(()=>{var fe;return{...n,role:G,isController:G==="controller",agentProfile:Gx((fe=n.agentStatus)==null?void 0:fe.focusedAgent,"auto"),reportShellProfile:qe=>l({type:"shellProfile",profile:qe}),adapter:Te,connect:Re,disconnect:Xe,claimControl:gt,releaseControl:ht,herdrLaunch:_,startHerdr:z,updateStatus:te,ignoredUpdate:Z,ignoreUpdate:ie}},[n,G,Te,Re,Xe,gt,ht,_,z,te,Z,ie]),Oi=T.useMemo(()=>({toasts:g,addToast:y,removeToast:v}),[g,y,v]),{terminalDimensions:Mt,sendKey:As,observeKeyInput:dl,modifierLatch:fl,toggleModifierLatch:Di,consumeModifierLatch:Es,sendBinary:hl,sendResize:Ns,warnViewerMode:ks,sendPasteFile:ei,subscribeToPasteFileReady:At}=Q,yn=T.useMemo(()=>({terminalDimensions:Mt,sendKey:As,observeKeyInput:dl,modifierLatch:fl,toggleModifierLatch:Di,consumeModifierLatch:Es,sendBinary:hl,sendResize:Ns,warnViewerMode:ks,sendPasteFile:ei,subscribeToPasteFileReady:At,subscribeToOutput:h,getPendingOutputChunkCount:m}),[Mt,As,dl,fl,Di,Es,hl,Ns,ks,ei,At,h,m]),Lt=T.useMemo(()=>({uploadProgress:se,uploadImage:W,resetUploadProgress:be}),[se,W,be]);return f.jsx($b.Provider,{value:bn,children:f.jsx(qb.Provider,{value:kt,children:f.jsx(Xb.Provider,{value:Oi,children:f.jsx(Zb.Provider,{value:yn,children:f.jsx(Wb.Provider,{value:Lt,children:a})})})})})};function Cs(a,n){const l=T.useContext(a);if(!l)throw new Error(`${n} must be used within a TerminalProvider`);return l}const Ae=()=>Cs($b,"useSettings"),et=()=>Cs(qb,"useConnection"),Zt=()=>Cs(Xb,"useToasts"),Ts=()=>Cs(Zb,"useTerminalIO"),Cr=()=>Cs(Wb,"useUpload");function xs(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 R1(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function j1(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 O1(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=xs(a),u=xs(n);return u.blocked>r.blocked?"blocked":(!o&&u.done>r.done&&(o="done"),o)}const D1={blocked:"%23f9e2af",done:"%23a6e3a1"};function z1(a){return`<circle cx='19' cy='5' r='4.5' fill='${D1[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function H1(a,n){return!n||!a.includes("</svg>")?a:a.replace("</svg>",`${z1(n)}</svg>`)}function Sg(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=H1(l.dataset.baseHref,a);l.getAttribute("href")!==o&&l.setAttribute("href",o)}let rn=null;function B1(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function Qb(){const a=B1();if(a)try{rn=rn??new a,rn.state==="suspended"&&rn.resume()}catch{rn=null}}function U1(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 K1={blocked:[880,660],done:[660,880]};function Jb(a){if((rn==null?void 0:rn.state)==="running")try{const n=rn.currentTime;K1[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 I1=15e3,F1={blocked:[70,50,70],done:[40]};function G1(){const{settings:a,t:n}=Ae(),{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(()=>{Sg(a.agentAlertBadge?R1(xs(l)):null)},[l,a.agentAlertBadge]),T.useEffect(()=>()=>Sg(null),[]),T.useEffect(()=>{if(!(!a.agentAlertSound||typeof window>"u"))return U1(window)},[a.agentAlertSound]),T.useEffect(()=>{const m=u.current;u.current=l;const p=O1(m,l);if(!p)return;const g=Date.now();if(g-h.current<I1)return;h.current=g;const y=o.current,v=typeof document<"u"&&document.visibilityState==="hidden",x=v||typeof document<"u"&&!document.hasFocus();if(y.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(F1[p])}catch{}if(y.agentAlertSound&&x&&Jb(p),y.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const w=xs(l),S=p==="blocked"?r.current("agents.notifyBlocked",{count:w.blocked}):r.current("agents.notifyDone",{count:w.done});try{new Notification("Herdr Remote",{body:S,tag:"herdr-agents"})}catch{}}},[l])}function ey(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=ey(a[n]))&&(o&&(o+=" "),o+=l)}else for(l in a)a[l]&&(o&&(o+=" "),o+=l);return o}function Y1(){for(var a,n,l=0,o="",r=arguments.length;l<r;l++)(a=arguments[l])&&(n=ey(a))&&(o&&(o+=" "),o+=n);return o}const P1=(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},V1=(a,n)=>({classGroupId:a,validator:n}),ty=(a=new Map,n=null,l)=>({nextPart:a,validators:n,classGroupId:l}),yr="-",Cg=[],$1="arbitrary..",q1=a=>{const n=Z1(a),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=a;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return X1(h);const m=h.split(yr),p=m[0]===""&&m.length>1?1:0;return ny(m,p,n)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=o[h],g=l[h];return p?g?P1(g,p):p:g||Cg}return l[h]||Cg}}},ny=(a,n,l)=>{if(a.length-n===0)return l.classGroupId;const r=a[n],u=l.nextPart.get(r);if(u){const g=ny(a,n+1,u);if(g)return g}const h=l.validators;if(h===null)return;const m=n===0?a.join(yr):a.slice(n).join(yr),p=h.length;for(let g=0;g<p;g++){const y=h[g];if(y.validator(m))return y.classGroupId}},X1=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})(),Z1=a=>{const{theme:n,classGroups:l}=a;return W1(l,n)},W1=(a,n)=>{const l=ty();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"){J1(a,n,l);return}if(typeof a=="function"){eS(a,n,l,o);return}tS(a,n,l,o)},J1=(a,n,l)=>{const o=a===""?n:iy(n,a);o.classGroupId=l},eS=(a,n,l,o)=>{if(nS(a)){Od(a(o),n,l,o);return}n.validators===null&&(n.validators=[]),n.validators.push(V1(l,a))},tS=(a,n,l,o)=>{const r=Object.entries(a),u=r.length;for(let h=0;h<u;h++){const[m,p]=r[h];Od(p,iy(n,m),l,o)}},iy=(a,n)=>{let l=a;const o=n.split(yr),r=o.length;for(let u=0;u<r;u++){const h=o[u];let m=l.nextPart.get(h);m||(m=ty(),l.nextPart.set(h,m)),l=m}return l},nS=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,iS=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="!",Tg=":",aS=[],Mg=(a,n,l,o,r)=>({modifiers:a,hasImportantModifier:n,baseClassName:l,maybePostfixModifierPosition:o,isExternal:r}),lS=a=>{const{prefix:n,experimentalParseClassName:l}=a;let o=r=>{const u=[];let h=0,m=0,p=0,g;const y=r.length;for(let M=0;M<y;M++){const E=r[M];if(h===0&&m===0){if(E===Tg){u.push(r.slice(p,M)),p=M+1;continue}if(E==="/"){g=M;continue}}E==="["?h++:E==="]"?h--:E==="("?m++:E===")"&&m--}const v=u.length===0?r:r.slice(p);let x=v,w=!1;v.endsWith(gd)?(x=v.slice(0,-1),w=!0):v.startsWith(gd)&&(x=v.slice(1),w=!0);const S=g&&g>p?g-p:void 0;return Mg(u,w,x,S)};if(n){const r=n+Tg,u=o;o=h=>h.startsWith(r)?u(h.slice(r.length)):Mg(aS,!1,h,void 0,!0)}if(l){const r=o;o=u=>l({className:u,parseClassName:r})}return o},sS=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],m=h[0]==="[",p=n.has(h);m||p?(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}},oS=a=>({cache:iS(a.cacheSize),parseClassName:lS(a),sortModifiers:sS(a),postfixLookupClassGroupIds:rS(a),...q1(a)}),rS=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},cS=/\s+/,uS=(a,n)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:u,postfixLookupClassGroupIds:h}=n,m=[],p=a.trim().split(cS);let g="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:x,modifiers:w,hasImportantModifier:S,baseClassName:M,maybePostfixModifierPosition:E}=l(v);if(x){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=w.length===0?"":w.length===1?w[0]:u(w).join(":"),H=S?R+gd:R,j=H+N;if(m.indexOf(j)>-1)continue;m.push(j);const D=r(N,k);for(let _=0;_<D.length;++_){const z=D[_];m.push(H+z)}g=v+(g.length>0?" "+g:g)}return g},dS=(...a)=>{let n=0,l,o,r="";for(;n<a.length;)(l=a[n++])&&(o=ay(l))&&(r&&(r+=" "),r+=o);return r},ay=a=>{if(typeof a=="string")return a;let n,l="";for(let o=0;o<a.length;o++)a[o]&&(n=ay(a[o]))&&(l&&(l+=" "),l+=n);return l},Ag=(a,...n)=>{let l,o,r,u;const h=p=>{const g=n.reduce((y,v)=>v(y),a());return l=oS(g),o=l.cache.get,r=l.cache.set,u=m,m(p)},m=p=>{const g=o(p);if(g)return g;const y=uS(p,l);return r(p,y),y};return u=h,(...p)=>u(dS(...p))},fS=[],pt=a=>{const n=l=>l[a]||fS;return n.isThemeGetter=!0,n},ly=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,mS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pS=/\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$/,gS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ei=a=>hS.test(a),_e=a=>!!a&&!Number.isNaN(Number(a)),Cn=a=>!!a&&Number.isInteger(Number(a)),Qu=a=>a.endsWith("%")&&_e(a.slice(0,-1)),$n=a=>mS.test(a),oy=()=>!0,vS=a=>pS.test(a)&&!gS.test(a),Dd=()=>!1,xS=a=>bS.test(a),wS=a=>yS.test(a),SS=a=>!he(a)&&!me(a),CS=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)),TS=a=>ji(a,uy,Dd),he=a=>ly.test(a),ea=a=>ji(a,dy,vS),Eg=a=>ji(a,RS,_e),MS=a=>ji(a,hy,oy),AS=a=>ji(a,fy,Dd),Ng=a=>ji(a,ry,Dd),ES=a=>ji(a,cy,wS),qo=a=>ji(a,my,xS),me=a=>sy.test(a),os=a=>ra(a,dy),NS=a=>ra(a,fy),kg=a=>ra(a,ry),kS=a=>ra(a,uy),LS=a=>ra(a,cy),Xo=a=>ra(a,my,!0),_S=a=>ra(a,hy,!0),ji=(a,n,l)=>{const o=ly.exec(a);return o?o[1]?n(o[1]):l(o[2]):!1},ra=(a,n,l=!1)=>{const o=sy.exec(a);return o?o[1]?n(o[1]):l:!1},ry=a=>a==="position"||a==="percentage",cy=a=>a==="image"||a==="url",uy=a=>a==="length"||a==="size"||a==="bg-size",dy=a=>a==="length",RS=a=>a==="number",fy=a=>a==="family-name",hy=a=>a==="number"||a==="weight",my=a=>a==="shadow",Lg=()=>{const a=pt("color"),n=pt("font"),l=pt("text"),o=pt("font-weight"),r=pt("tracking"),u=pt("leading"),h=pt("breakpoint"),m=pt("container"),p=pt("spacing"),g=pt("radius"),y=pt("shadow"),v=pt("inset-shadow"),x=pt("text-shadow"),w=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,p],K=()=>[Ei,"full","auto",...z()],q=()=>[Cn,"none","subgrid",me,he],te=()=>["auto",{span:["full",Cn,me,he]},Cn,me,he],Z=()=>[Cn,"auto",me,he],ie=()=>["auto","min","max","fr",me,he],re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...z()],G=()=>[Ei,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],Q=()=>[Ei,"screen","full","dvw","lvw","svw","min","max","fit",...z()],se=()=>[Ei,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],W=()=>[a,me,he],be=()=>[...H(),kg,Ng,{position:[me,he]}],xe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ue=()=>["auto","cover","contain",kS,TS,{size:[me,he]}],Te=()=>[Qu,os,ea],ce=()=>["","none","full",g,me,he],ye=()=>["",_e,os,ea],ae=()=>["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"],le=()=>[_e,Qu,kg,Ng],we=()=>["","none",S,me,he],Ee=()=>["none",_e,me,he],Be=()=>["none",_e,me,he],it=()=>[_e,me,he],tt=()=>[Ei,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$n],breakpoint:[$n],color:[oy],container:[$n],"drop-shadow":[$n],ease:["in","out","in-out"],font:[SS],"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",Ei,he,me,E]}],container:["container"],"container-type":[{"@container":["","normal","size",me,he]}],"container-named":[CS],columns:[{columns:[_e,he,me,m]}],"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:[Cn,"auto",me,he]}],basis:[{basis:[Ei,"full","auto",m,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,Ei,"auto","initial","none",he]}],grow:[{grow:["",_e,me,he]}],shrink:[{shrink:["",_e,me,he]}],order:[{order:[Cn,"first","last","none",me,he]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"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:[...re(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...re()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":re()}],"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:G()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...se()]}],"min-block-size":[{"min-block":["auto",...se()]}],"max-block-size":[{"max-block":["none",...se()]}],w:[{w:[m,"screen",...G()]}],"min-w":[{"min-w":[m,"screen","none",...G()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",l,os,ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,_S,MS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qu,he]}],"font-family":[{font:[NS,AS,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,Eg]}],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:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",me,ea]}],"text-decoration-color":[{decoration:W()}],"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:[Cn,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:be()}],"bg-repeat":[{bg:xe()}],"bg-size":[{bg:ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Cn,me,he],radial:["",me,he],conic:[Cn,me,he]},LS,ES]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Te()}],"gradient-via-pos":[{via:Te()}],"gradient-to-pos":[{to:Te()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:ye()}],"border-w-x":[{"border-x":ye()}],"border-w-y":[{"border-y":ye()}],"border-w-s":[{"border-s":ye()}],"border-w-e":[{"border-e":ye()}],"border-w-bs":[{"border-bs":ye()}],"border-w-be":[{"border-be":ye()}],"border-w-t":[{"border-t":ye()}],"border-w-r":[{"border-r":ye()}],"border-w-b":[{"border-b":ye()}],"border-w-l":[{"border-l":ye()}],"divide-x":[{"divide-x":ye()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ye()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,me,he]}],"outline-w":[{outline:["",_e,os,ea]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",y,Xo,qo]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",v,Xo,qo]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ye()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[_e,ea]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ye()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",x,Xo,qo]}],"text-shadow-color":[{"text-shadow":W()}],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":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[me,he]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"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":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:be()}],"mask-repeat":[{mask:xe()}],"mask-size":[{mask:ue()}],"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",w,Xo,qo]}],"drop-shadow-color":[{"drop-shadow":W()}],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:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Be()}],"scale-x":[{"scale-x":Be()}],"scale-y":[{"scale-y":Be()}],"scale-z":[{"scale-z":Be()}],"scale-3d":["scale-3d"],skew:[{skew:it()}],"skew-x":[{"skew-x":it()}],"skew-y":[{"skew-y":it()}],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:[Cn,me,he]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"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":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"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",...W()]}],"stroke-w":[{stroke:[_e,os,ea,Eg]}],stroke:[{stroke:["none",...W()]}],"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"]}},jS=(a,{cacheSize:n,prefix:l,experimentalParseClassName:o,extend:r={},override:u={}})=>(Qa(a,"cacheSize",n),Qa(a,"prefix",l),Qa(a,"experimentalParseClassName",o),Zo(a.theme,u.theme),Zo(a.classGroups,u.classGroups),Zo(a.conflictingClassGroups,u.conflictingClassGroups),Zo(a.conflictingClassGroupModifiers,u.conflictingClassGroupModifiers),Qa(a,"postfixLookupClassGroups",u.postfixLookupClassGroups),Qa(a,"orderSensitiveModifiers",u.orderSensitiveModifiers),Wo(a.theme,r.theme),Wo(a.classGroups,r.classGroups),Wo(a.conflictingClassGroups,r.conflictingClassGroups),Wo(a.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),bd(a,r,"postfixLookupClassGroups"),bd(a,r,"orderSensitiveModifiers"),a),Qa=(a,n,l)=>{l!==void 0&&(a[n]=l)},Zo=(a,n)=>{if(n)for(const l in n)Qa(a,l,n[l])},Wo=(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)},OS=(a,...n)=>typeof a=="function"?Ag(Lg,a,...n):Ag(()=>jS(Lg(),a),...n),DS=OS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...a){return DS(Y1(a))}const Ne={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"}},cl={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:ne("select-none leading-none",cl[a],n),children:a==="idle"?Ne.off:Ne.on}),zd=({className:a})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",a),children:Ne.dot}),py={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:ne("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:ne("flex items-center gap-2 text-tui font-bold",cl[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:ne("min-w-0",r),children:u})]}),An=({label:a,labelWidth:n=16,className:l,children:o})=>f.jsxs("div",{className:ne("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})]}),zS=({className:a,label:n})=>n?f.jsxs("div",{className:ne("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:ne("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"?Ne.check:a==="bad"?Ne.cross:a==="warn"?Ne.warn:"›",u=cn[a].edgeL;return f.jsxs("div",{className:ne("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:ne("shrink-0 font-bold",cl[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]})},HS={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",...m})=>f.jsxs("button",{type:h,className:ne("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",HS[a],o&&"w-full",r),...m,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]}),gy=({tone:a="accent",dot:n=!1,className:l,children:o})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",cl[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:ne("flex items-center gap-2",r),"aria-label":o,children:a.map((h,m)=>{const p=h.id===n;return f.jsxs(Qn.Fragment,{children:[m>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ne.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>l(h.id),"aria-current":p?"page":void 0,"aria-label":h.ariaLabel??h.label,title:h.title,className:ne("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",p?"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:ne("text-tui-faint",p&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:ne("ml-1",u),children:h.label})]})]},h.id)})}),by=({hints:a,className:n})=>f.jsx("div",{className:ne("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}`))}),yy=({active:a=!1,className:n,children:l})=>f.jsx("span",{className:ne("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:ne("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:ne("tui-input w-full px-2 py-1 text-tui",a),...n}));vt.displayName="Input";const Tr=Qn.forwardRef(({className:a,children:n,...l},o)=>f.jsx("select",{ref:o,className:ne("tui-input w-full px-2 py-1 text-tui",a),...l,children:n}));Tr.displayName="Select";const BS=({checked:a,onChange:n,disabled:l=!1,label:o,description:r,className:u,id:h})=>f.jsxs("label",{className:ne("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:m=>n(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ne("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:ne("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]})]}),Mr="h-8",pn=({title:a,aside:n,className:l,children:o})=>f.jsxs("section",{className:ne("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})]}),It=({label:a,hint:n,htmlFor:l,control:o,className:r})=>f.jsxs("div",{className:ne("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":m}){return f.jsx("div",{role:"radiogroup","aria-label":m,className:ne("grid w-full border border-tui-border bg-tui-mantle",Mr,h),style:{gridTemplateColumns:`repeat(${l.length}, minmax(max-content, 1fr))`},children:l.map((p,g)=>{const y=p.value===n;return f.jsxs("label",{className:ne(yd,u==="sm"&&"px-1.5 text-tui-sm",g>0&&"border-l border-tui-border",y?ne(py[r],"font-bold text-tui-crust"):vd),children:[f.jsx("input",{type:"radio",name:a,value:p.value,className:"sr-only",checked:y,onChange:()=>o(p.value)}),f.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const Ni=({checked:a,onChange:n,label:l,offLabel:o,onLabel:r,disabled:u=!1,className:h})=>{const m=p=>g=>{g.preventDefault(),!(u||p===a)&&n(p)};return f.jsxs("label",{className:ne("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",Mr,u&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":l,checked:a,disabled:u,onChange:p=>n(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:m(!1),className:ne(yd,a?vd:"bg-tui-selection font-bold text-tui-text"),children:o}),f.jsx("span",{"aria-hidden":"true",onClick:m(!0),className:ne(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:ne("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}),US=({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:ne("inline-flex select-none whitespace-pre font-mono leading-none",o),role:"presentation",children:[f.jsx("span",{className:cl[l],children:Ne.meterFull.repeat(u)}),f.jsx("span",{className:"text-tui-border",children:Ne.meterEmpty.repeat(Math.max(0,n-u))})]})},KS=({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:ne("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:ne("absolute inset-y-0 left-0",py[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]})},Xa=({label:a,value:n,sub:l,tone:o,title:r,className:u})=>f.jsxs("div",{className:ne("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:ne("truncate text-tui-lg font-bold",o?cl[o]:"text-tui-text"),children:n}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:l||" "})]}),_g=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],sa=({className:a,label:n})=>{const[l,o]=Qn.useState(0);return Qn.useEffect(()=>{const r=setInterval(()=>o(u=>(u+1)%_g.length),90);return()=>clearInterval(r)},[]),f.jsxs("span",{className:ne("inline-flex items-center gap-1.5",a),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:_g[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:ne("px-1 py-4 text-center text-tui text-tui-faint",r),children:o}):f.jsx("div",{className:ne("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:ne("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(m=>f.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(u,h)},m.key))},l(u,h)))})]})})}var IS=mb();const ul=({isOpen:a,onClose:n,title:l,subtitle:o,closeLabel:r,footer:u,hints:h,size:m="md",fixedHeight:p=!1,className:g,children:y})=>{if(!a)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",x=`tui-modal-${l.replace(/\s+/g,"-").toLowerCase()}`,w=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":x,onMouseDown:S=>{S.target===S.currentTarget&&n()},children:f.jsxs("div",{className:ne("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,p&&"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:x,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(by,{hints:h}):f.jsx("span",{}),u?f.jsx("div",{className:"flex items-center gap-2",children:u}):null]}):null]})});return typeof document>"u"?w:IS.createPortal(w,document.body)},wd=({items:a,className:n})=>{const l=a.filter(Boolean);return f.jsx("span",{className:ne("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))})},vy=({left:a,right:n,className:l})=>f.jsxs("footer",{className:ne("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})]}),FS=({name:a,tagline:n,aside:l,tabs:o,activeTabId:r,onSelectTab:u,tabsAriaLabel:h,toolbarStart:m,toolbarAside:p,hints:g,footerAside:y,bodyClassName:v,className:x,children:w})=>{const S=!!(o&&o.length>0&&r!==void 0&&u);return f.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",x),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||m||p?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:[m?f.jsx("div",{className:"flex shrink-0 items-center",children:m}):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,p?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:p}):null]}):null,f.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",v),children:w}),g||y?f.jsx(vy,{left:g?f.jsx(by,{hints:g}):null,right:y}):null]})},Qo="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",Jo="text-tui-muted hover:border-tui-border hover:text-tui-accent",GS="border-tui-accent bg-tui-accent text-tui-crust",YS=({currentView:a,onNavigate:n,onOpenPairing:l,onOpenSettings:o,onToggleVirtualKeyboard:r,isVirtualKeyboardOpen:u})=>{const{language:h,setLanguage:m,t:p}=Ae(),{addToast:g}=Zt(),y=()=>{const x=h==="zh"?"en":"zh";m(x),g("info",Ld(x,"toasts.switchedLanguage",{lang:x==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:p("header.terminalTab"),index:1,ariaLabel:p("header.terminalTab")},...a==="admin"?[{id:"admin",label:p("header.adminTab"),index:2,ariaLabel:p("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:p("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:x=>n(x),ariaLabel:p("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:ne(Qo,Jo),title:p("header.languageToggleTitle"),"aria-label":p("header.languageToggleTitle"),children:p("header.languageShort")}),a==="terminal"&&f.jsx("button",{type:"button",onClick:r,className:ne(Qo,u?GS:Jo),title:p("header.virtualKeyboardTitle"),"aria-label":p("header.virtualKeyboardTitle"),children:p("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:l,className:ne(Qo,Jo),title:p("header.pairingTitle"),"aria-label":p("header.pairingTitle"),children:p("header.actionPairing")}),f.jsx("button",{type:"button",onClick:o,className:ne(Qo,Jo),title:p("header.settingsTitle"),"aria-label":p("header.settingsTitle"),children:p("header.actionSettings")})]})]})})},er=({tone:a,glyph:n,message:l,assertive:o=!1,action:r})=>f.jsxs("aside",{className:ne("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:ne("shrink-0",cn[a].text),children:n}),f.jsx("span",{className:"truncate text-tui-text",children:l})]}),r]}),PS=()=>{const{settings:a,t:n}=Ae(),{connectionState:l,stateDetail:o,connect:r}=et();return l==="connected"||!a.token&&!a.pairCode&&l==="disconnected"?null:l==="connecting"?f.jsx(er,{tone:"accent",glyph:f.jsx(sa,{}),message:n("statusBanner.connecting")}):l==="reconnecting"?f.jsx(er,{tone:"warn",glyph:f.jsx(sa,{}),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(er,{tone:"bad",glyph:Ne.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(er,{tone:"idle",glyph:Ne.off,message:n("statusBanner.disconnected"),action:f.jsx(Me,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:n("common.connect")})}):null},Ju="Herdr Remote",Rg=80,VS=/[\u0000-\u001F\u007F-\u009F]/g;function Sd(a){if(typeof a!="string")return"";const n=a.replace(VS," ").replace(/\s+/g," ").trim();return n.length<=Rg?n:`${n.slice(0,Rg-1).trimEnd()}…`}function $S(a,n,l){const o=j1(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 XS=new Set(["http:","https:","mailto:"]),ed=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,ZS=/[.,;:!?'"]+$/,jg=8;function Ud(a){return/^www\./i.test(a)?`https://${a}`:a}function WS(a){const n=(r,u)=>r.split(u).length-1;let l=a.replace(ZS,"");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 xy(a){if(typeof a!="string"||a.length===0)return!1;try{return XS.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=WS(l[0]);if(!o)continue;const r=l.index,u=r+o.length;if(n>=r&&n<u&&xy(o))return o}return null}function JS(a,n,l){var m;const o=(m=a==null?void 0:a.buffer)==null?void 0:m.active;if(!o||typeof o.getLine!="function"||!o.getLine(l))return null;let r=l;for(let p=0;p<jg;p+=1){const g=o.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let u="",h=-1;for(let p=r;p<r+jg;p+=1){const g=o.getLine(p);if(!g||p>r&&!g.isWrapped)break;p===l&&(h=u.length+n),u+=g.translateToString(!1)}return h<0?null:{text:u,index:h}}function eC(a,n,l){const o=JS(a,n,l);return o?QS(o.text,o.index):null}function tC(a){try{const n=new URL(Ud(a));return n.host||n.pathname}catch{return""}}function Cd(a){return!xy(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 nC(){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 iC(){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 wy(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 aC(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 lC=({isOpen:a,onClose:n,onSend:l,onSendImage:o})=>{const{t:r}=Ae(),{addToast:u}=Zt(),[h,m]=T.useState(""),[p,g]=T.useState(null),[y,v]=T.useState(!1),x=T.useRef(null),w=T.useRef(null),S=T.useRef(null);T.useEffect(()=>{a&&(m(""),g(null),v(!1),x.current&&(x.current.value=""),w.current&&(w.current.value=""))},[a]);const M=async D=>{if(D.size===0){u("error",r("clipboard.fileEmpty"));return}v(!0);try{const _=await Bb(D);_?(g(_),m("")):u("error",r("clipboard.imageTooLarge"))}catch(_){console.error("Failed to process image:",_),u("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},E=async D=>{const _=wy(D);_&&(D.preventDefault(),await M(_))},k=async D=>{const _=aC(D.target.files);D.target.value="",_&&await M(_)},N=D=>{const _=D.target.value;m(_),_&&p&&g(null)},R=()=>{g(null),x.current&&(x.current.value=""),w.current&&(w.current.value="")},H=()=>{p?(o==null||o(p),n()):h.trim()&&(l(h),n())},j=!!(h.trim()||p);return f.jsx(ul,{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:!!p||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:x,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:w,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:k}),p?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:p.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:l1(p.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=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.chooseImage"),children:r("clipboard.chooseImage")}),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.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")})})]})]})})},Za="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Wa="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",sC=({anchorPoint:a,hasSelection:n,isController:l,vibrateOnKeyPress:o=!1,linkUrl:r=null,onOpenLink:u,onCopySelection:h,onCopyLine:m,onCopyScreen:p,onPaste:g,onClose:y})=>{const{t:v}=Ae(),x=T.useRef(null),[w,S]=T.useState(null);T.useEffect(()=>{if(o&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[o]),T.useLayoutEffect(()=>{const N=x.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 q=a.y-D-8;q<8&&(q=a.y+8),q=Math.max(8,Math.min(Math.max(8,z-D-8),q)),S({x:K,y:q})},[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:`${w?w.x:M}px`,top:`${w?w.y:E}px`,visibility:w?"visible":"hidden"};return f.jsx("div",{ref:x,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:ne(Za,Wa),onClick:()=>{u(r),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:tC(r)})]}),n&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{h(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{m(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{p(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),l&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:()=>{g(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Za,Wa),onClick:y,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},oC={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 rC(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function cC(a){const n=T.useRef([]),[l,o]=T.useState({framesPerSec:0,bytesPerSec:0}),r=T.useCallback(h=>{const m=h-1e3,p=n.current;for(;p.length>0&&p[0].time<m;)p.shift()},[]);T.useEffect(()=>{if(!a)return;const h=setInterval(()=>{r(performance.now());let m=0;for(const p of n.current)m+=p.bytes;o({framesPerSec:n.current.length,bytesPerSec:m})},1e3);return()=>clearInterval(h)},[a,r]);const u=T.useCallback(h=>{const m=performance.now();n.current.push({time:m,bytes:h}),r(m)},[r]);return{metrics:l,record:u}}function uC(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function dC(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 fC(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 hC=({debug:a,rttMs:n,metrics:l,rendererKind:o,predictiveEcho:r,predictor:u,field:h,renderer:m})=>{const p=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: ${p!=null?`${Math.round(p)}ms`:"-"}
|
|
46
|
+
`,`field: ${uC(h)} mismatches: ${(u==null?void 0:u.getMismatchCount())??0}
|
|
47
|
+
`,dC(m),fC(u)]})};function Zn(a){const n=T.useRef(a);return n.current=a,n}function mC(a){const n=Zn(a),{termRef:l,subscribeToPasteFileReady:o}=a,[r,u]=T.useState(!1),h=T.useCallback((v,x)=>{n.current.onPaste(),v.paste(x),n.current.addToast("success",n.current.t("clipboard.pasted"))},[n]),m=T.useCallback(()=>{const v=l.current;return v?n.current.isController?v:(n.current.warnViewerMode(),null):null},[l,n]),p=T.useCallback(async()=>{const v=m();if(v){try{const x=await iC();if(x.ok){await n.current.uploadImage(x.blob);return}}catch{}try{const x=await nC();if(x.ok){h(v,x.text);return}else if(x.reason==="empty"){n.current.addToast("info",n.current.t("clipboard.pasteUnavailable"));return}}catch{}u(!0)}},[m,h,n]),g=T.useCallback(v=>{const x=m();x&&h(x,v)},[m,h]),y=T.useCallback(v=>{m()&&n.current.uploadImage(v)},[m,n]);return T.useEffect(()=>o(v=>{const x=l.current;x&&h(x,v)}),[o,l,h]),{isPasteFallbackOpen:r,closePasteFallback:()=>u(!1),handlePaste:p,handleFallbackPasteSend:g,handleFallbackImageSend:y}}const sr=new Set(["│","┃","║","▐","▕","▏","▌"]),vr=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),pC=new Set(["╭","┌","┏","╔"]),gC=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),bC=new Set(["╮","┐","┓","╗"]),yC=new Set(["╰","└","┗","╚"]),vC=new Set(["╯","┘","┛","╝"]),td=new Set(["─","━","═","╌","┄"]),Sy=new Set(["❯","›",">","!"]),Og=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function En(a){return a===""||a===" "||a===" "}class xC{constructor(n){$(this,"cell");$(this,"top");$(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(!sr.has(this.char(n,l)))return!1;const o=this.char(n-1,l),r=this.char(n+1,l);return sr.has(o)||vr.has(o)||sr.has(r)||vr.has(r)}blankOrDim(n,l,o){var r;for(let u=l;u<o;u++){const h=this.at(n,u);if(h&&!En(h.getChars())&&!((r=h.isDim)!=null&&r.call(h)))return!1}return!0}}function wC(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,SC=12,Md=2,Dg=1,CC=4,TC=3,MC=20,zg=/-- INSERT --/,AC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,EC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,NC=/^\s*\d+[.)]\s/;function Hg(a,n,l){if(!td.has(a.char(n,l.start))||!td.has(a.char(n,l.end-1))||vr.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 ol(a){return`${a.start}-${a.end}`}function Cy(a,n,l){if(l.start===0)return a.top;for(let o=n-1;o>=a.top;o--)if(gC.has(a.char(o,l.start-1)))return o;return a.top}function kC(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(!sr.has(h)||a.char(u,r)!==h)return null;let m=u-1;for(;m>=a.top&&a.char(m,o)===h;)m--;let p=u+1;for(;p<=a.bottom&&a.char(p,o)===h;)p++;if(p-m-1>Td||!pC.has(a.char(m,o))||!bC.has(a.char(m,r))||!yC.has(a.char(p,o))||!vC.has(a.char(p,r))||a.dim(u,o))return null;const g=l.start+Dg,y=l.end-Dg;return n.col<g||n.col>=y?null:{kind:"frame",key:`frame:${ol(l)}`,region:ol(l),layout:`${m}`,row:u,caretCol:n.col,startCol:g,endCol:y,empty:m+2===p&&n.col===g&&a.blankOrDim(u,g,y),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function LC(a,n,l){const{row:o}=n;let r=-1;for(let y=o-1;y>=Math.max(a.top,o-Td);y--)if(Hg(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(Hg(a,y,l)){u=y;break}if(u<0)return null;const h=r+1;let m=-1;for(let y=l.start;y<Math.min(l.end,l.start+3);y++){const v=a.char(h,y);if(!En(v)){Sy.has(v)&&En(a.char(h,y+1))&&(m=y);break}}if(m<0||a.dim(h,m)||NC.test(a.text(h,m+1,l.end)))return null;for(let y=h+1;y<u;y++)for(let v=l.start;v<l.start+Md;v++)if(!En(a.char(y,v)))return null;let p="";for(let y=u+1;y<=Math.min(a.bottom,u+SC)&&!vr.has(a.char(y,l.start-1));y++)p+=`${a.text(y,l.start,l.end)}
|
|
48
|
+
`;if(EC.test(p)||AC.test(p))return null;const g=o===h?m+2:l.start+Md;return n.col<g||n.col>=l.end?null:{kind:"rule",key:`rule:${ol(l)}:${Cy(a,r,l)}`,region:ol(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:zg.test(p),modal:zg.test(p),midWord:!1}}function _C(a,n,l){if(n.hidden)return null;const{row:o,col:r}=n,u=RC(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 m=a.text(o,l.start,h+1).trimStart();if(/^(?:[a-z]:\\.*|\\\\[^\\]+\\[^\\]+.*|PS\s+[a-z]:\\.*)>$/i.test(m))return or(a,n,l,o,h+1,!1)}for(let h=r-2;h>=l.start;h--)if(!(!Og.has(a.char(o,h))||!En(a.char(o,h+1))))return a.dim(o,h)?null:or(a,n,l,o,h+2,h===l.start);for(let h=o-1;h>=Math.max(a.top,o-TC);h--){let m=l.end-1;for(;m>=l.start&&En(a.char(h,m));)m--;if(m>=l.end-1-CC&&Og.has(a.char(h,m)))return a.dim(h,m)?null:or(a,n,l,h,l.start,!1);if(m<l.end-1)return null}return null}function RC(a,n,l){const{row:o}=n,r=l.start+Md,u=h=>En(a.char(h,l.start))&&En(a.char(h,l.start+1));if(u(o))for(let h=o-1;h>=Math.max(a.top,o-MC);h--){if(Sy.has(a.char(h,l.start))&&En(a.char(h,l.start+1)))return a.dim(h,l.start)?null:or(a,n,l,h,r,!0,r);if(!u(h)||a.blankOrDim(h,r,l.end))return}}function or(a,n,l,o,r,u,h=l.start){const m=n.row===o?r:h;if(n.col<m||n.col>=l.end)return null;const p=l.end-2,g=n.row>o&&h>l.start&&n.col===m&&!En(a.char(n.row-1,p));return{kind:"prompt",key:`prompt:${ol(l)}:${Cy(a,o,l)}`,region:ol(l),layout:`${o}`,row:n.row,caretCol:n.col,startCol:m,endCol:l.end,empty:n.row===o&&n.col===m&&a.blankOrDim(n.row,m,l.end),agentLike:u,vimInsert:null,modal:!1,midWord:g}}function jC(a,n){const l=new xC(a);if(n.row<l.top||n.row>l.bottom||n.col<0||n.col>=a.cols)return null;const o=wC(l,n.row,n.col);return o?kC(l,n,o)??LC(l,n,o)??_C(l,n,o):null}class OC{constructor(){$(this,"insertSeen",new Set)}detect(n,l){const o=jC(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 DC{constructor(n){$(this,"tracker",new OC);$(this,"cached");$(this,"lastComplete",null);$(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 Ja=4294967295;var Qe=(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))(Qe||{}),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||{}),rt=(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))(rt||{}),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||{}),el=(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))(el||{});function zC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const Ty={fg:0,bg:0,ext:0};function My(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function HC(a){return a>>>26&7}function BC(a){return a&67108863}function UC(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 Ay(a){const n=a;return!n||typeof n.fg!="number"||typeof n.bg!="number"?null:{fg:n.fg>>>0,bg:n.bg>>>0,ext:My(n)}}class KC{constructor(n){$(this,"items",[]);$(this,"target",null);$(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 x,w;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),m=o&&!!h&&Ey(h);if(this.items.length===0){if(!m)return null;const S=((w=(x=l.getLine(r))==null?void 0:x.getCell(u))==null?void 0:w.getChars())??"";return{cells:[],paintedCaret:Bg(r,u,S,h)}}const p=[];let g,y;for(const S of this.items)switch(S.kind){case"char":p.push({row:S.row,col:S.col,chars:S.char,width:S.width,style:S.style??FC(n,S.row,S.col)});break;case"erase":p.push({row:S.row,col:S.col,chars:" ",width:S.width,style:IC(S.style??Ad(n,S.row,S.col)??Ty)});break;case"mask":m&&S.row===r&&S.col===u&&p.push({row:S.row,col:S.col,chars:S.char,width:1,style:S.style??Ny(h)});break;case"caret":o?m&&(p.push({row:S.row,col:S.col,chars:S.char,width:1,style:h}),y=Bg(S.row,S.col,S.char,h)):g={row:S.row,col:S.col};break}const v={cells:p};return g!==void 0&&(v.cursor=g),y&&(v.paintedCaret=y),v}}function Bg(a,n,l,o){return{row:a,col:n,style:o,plain:{row:a,col:n,chars:l||" ",width:1,style:Ny(o)}}}function Ad(a,n,l){var o;return l<0||l>=a.cols?null:Ay((o=a.buffer.active.getLine(n))==null?void 0:o.getCell(l))}function Ey(a){return(a.fg&rt.INVERSE)!==0||(a.bg&Je.CM_MASK)!==Je.CM_DEFAULT}function Ny(a){return{fg:a.fg&~rt.INVERSE,bg:a.bg&~(Je.CM_MASK|Je.RGB_MASK),ext:a.ext}}function IC(a){return{fg:a.fg&rt.INVERSE?a.fg&(rt.INVERSE|Je.CM_MASK|Je.RGB_MASK):0,bg:a.bg&(Je.CM_MASK|Je.RGB_MASK),ext:0}}function FC(a,n,l){const o=Ad(a,n,l-1);return o&&!Ey(o)&&!(o.bg&Ri.DIM)?o:Ty}const ky="\x1B",GC=/^\x1b\[[IO]/,Ly=/^\x1b\[<(\d+);\d+;\d+[Mm]/,YC=/^\x1b\[M[\s\S]{3}/,PC=[/^\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\\/],VC=/^\x1b\[1;[2-8]R/;function Ug(a){if(VC.test(a))return 0;const n=GC.exec(a);if(n)return n[0].length;const l=Ly.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 PC){const r=o.exec(a);if(r)return r[0].length}return 0}function _y(a){if(!a.startsWith(ky))return"keys";if(Ly.test(a)||YC.test(a)){let l=a;for(;l.length>0;){const o=Ug(l);if(o===0)return"pointer";l=l.slice(o)}return"passive"}let n=a;for(;n.length>0;){const l=Ug(n);if(l===0)return"keys";n=n.slice(l)}return"passive"}function $C(a){return a===ky}function Wn(a){return a===""||a===" "?" ":a}function qC(a,n,l,o=64){var h;const r=a.buffer.active.getLine(n),u=[];for(let m=l-1;m>=0&&u.length<o;m--){const p=r==null?void 0:r.getCell(m);if(!p)break;((h=p.getWidth)==null?void 0:h.call(p))!==0&&u.unshift(Wn(p.getChars()))}return u}function XC(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]===Wn(a[r]);if(o)return l}return 0}function ZC(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 WC(a,{style:n,predictedCursor:l,field:o,runStartedEmpty:r,active:u}){var w,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}),m=a[a.length-1],p=l??{row:m.row,col:m.kind==="erase"||m.cancelled?m.col:m.col+m.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&&p.row===o.row){const N=u.getLine(p.row);for(let R=p.col;R<o.endCol;R++){if(g(p.row,R)||Wn(((w=N==null?void 0:N.getCell(R))==null?void 0:w.getChars())??"")===" ")continue;const H={row:p.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!==p.row||N.col!==p.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:Wn(R),width:1,kind:"mask"};n&&(H.style=n),h.push(H)}}const v=h.find(N=>N.row===p.row&&N.col===p.col&&N.kind!=="mask"),x=v?v.char:Wn(((k=(E=u==null?void 0:u.getLine(p.row))==null?void 0:E.getCell(p.col))==null?void 0:k.getChars())??"");return h.push({row:p.row,col:p.col,char:x,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 Ry(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 Kg=8,JC=1500,eT=4e3,tT=20;class nT{constructor(n){$(this,"getTerminal");$(this,"getFieldOption");$(this,"charWidth");$(this,"now");$(this,"textDecoder",new TextDecoder("utf-8"));$(this,"confidentKeys",new Set);$(this,"fieldStyles",new Map);$(this,"field",null);$(this,"runStartedEmpty",!1);$(this,"predictions",[]);$(this,"predictedCursor",null);$(this,"srtt",null);$(this,"isSuppressed",!1);$(this,"suppressCursor",null);$(this,"suppressSentAt",0);$(this,"inFlight",[]);$(this,"inFlightUnknown",!1);$(this,"runInFlight",[]);$(this,"probationRun",!1);$(this,"runSent",[]);$(this,"lastSentUndrawn",!1);$(this,"awaitingPrefixCommand",!1);$(this,"mismatches",0);$(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 p;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,m=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??((p=this.getFieldOption)==null?void 0:p.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=m}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(eT,Math.max(JC,(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():ZC(n);if(!l)return null;let o=l.caretCol,r=[],u=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(XC(this.inFlight,qC(n,l.row,o)));for(const h of r){const m=h.codePointAt(0)??0;o+=Ry(m)||this.assumedWidth(m)}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=Ay(l);if(o)for(this.fieldStyles.delete(n),this.fieldStyles.set(n,o);this.fieldStyles.size>Kg;){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>Kg;){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>tT&&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 iT="?!#";class aT extends nT{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&&iT.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 m=(S=o.buffer.active.getLine(u.row))==null?void 0:S.getCell(u.col),p=[Wn(m?m.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),p.push(...y.before," "));for(const M of this.predictions)M.cancelled&&M.row===u.row&&M.col===u.col&&p.push(M.char);const v=o.buffer.active,x=v.baseY+v.cursorY,w=x>u.row||x===u.row&&v.cursorX>u.col;return this.predictions.push({row:u.row,col:u.col,char:n,width:l,kind:"char",before:p,sentAt:this.now(),replaces:y,probation:this.probationRun||void 0,behindCaret:w||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),m=this.predictedCursor;if(h&&m){const p=n.buffer.active.getLine(m.row),g=p==null?void 0:p.getCell(m.col-1),y=g&&((o=g.getWidth)==null?void 0:o.call(g))===0?2:1,v=m.col-y;let x=!0;for(let S=m.col;S<h.endCol&&x;S++)x=this.coveredByPrediction(m.row,S)||Wn(((r=p==null?void 0:p.getCell(S))==null?void 0:r.getChars())??"")===" ";const w=Wn(((u=p==null?void 0:p.getCell(v))==null?void 0:u.getChars())??"");if(v>h.startCol&&x&&w!==" ")return this.predictions=this.predictions.filter(S=>!(S.echoed&&S.row===m.row&&S.col+S.width>v)),this.predictions.push({row:m.row,col:v,char:" ",width:y,kind:"erase",before:[w],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,m.col=v,!0}}return this.freeze("backspace into server content"),!1}}const lT=2;class sT extends aT{handleUserInput(n){var h;if(this.pruneExpired(),n.length===0)return;const l=this.textDecoder.decode(n,{stream:!1});if(!l)return;const o=_y(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 m=this.field??((h=this.getFieldOption)==null?void 0:h.call(this))??null;this.freeze("escape",{demote:(m==null?void 0:m.modal)!==!1});return}const r=this.getTerminal();if(!r){this.reset("terminal unavailable",!0);return}const u=Array.from(l);for(let m=0;m<u.length;m++){const p=u[m],g=p.codePointAt(0);if(g===void 0)continue;if(g===lT){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)){m<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(p),this.note("refused: waiting for the caret to move");continue}const y=Ry(g);if(y===0){if(!this.skipUnpredictable(p,g,r)){m<u.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(p,y,r)){m<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,m;const o=this.field;if(this.getFieldOption){const p=this.getFieldOption();if(!p||p.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(p.layout!==o.layout){this.predictions=[],this.predictedCursor=null,this.field=p,this.note("layout changed");return}}let r=[],u=!1;for(const p of this.predictions){if(p.cancelled){if(!u){const M=l.row>p.row||l.row===p.row&&l.col>=p.col+p.width;if(M||(p.behindCaret=void 0),p.passed&&!M)continue;M&&!p.behindCaret&&(p.passed=!0)}r.push(p),u=!0;continue}const g=(h=n.buffer.active.getLine(p.row))==null?void 0:h.getCell(p.col),y=Wn(g?g.getChars():""),v=p.kind==="char"?y===p.char&&(p.width===1||(((m=g==null?void 0:g.getWidth)==null?void 0:m.call(g))??2)===2):y===" ",x=p.before.includes(y);p.behindCaret&&(l.row<p.row||l.row===p.row&&l.col<=p.col)&&(p.behindCaret=void 0);const w=p.kind==="char"?(l.row>p.row||l.row===p.row&&l.col>=p.col+p.width)&&!(p.behindCaret&&x):l.row<p.row||l.row===p.row&&l.col<=p.col,S=p.kind==="char"&&y===p.char&&!v;if(u&&!p.frozenFrom){if(!v||x){r.push(p);continue}r=r.filter(M=>!M.cancelled),u=!1}if(!(p.echoed&&!v))if(v&&(w||!x)){if(p.echoed||this.confirm(p,o),w){p.kind==="char"&&o&&!p.frozenFrom&&this.learnStyle(o.key,g);continue}p.echoed=!0,r.push(p)}else if(p.frozenFrom){const M=p.frozenFrom,E=p.kind==="erase"||l.col>=M.col;!w&&l.row===M.row&&E?r.push(p):w&&p.probation&&(this.inFlightUnknown=!0)}else if(!w&&!S)r.push(p);else if(p.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(p.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?[]:WC(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 oT=25,rT=2026,cT=1e3;function uT(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},m=a.parser;if(!m||typeof m.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:u,reset:h,dispose:()=>{}};const p=y=>v=>{for(const x of v.flat())if(x===oT&&(l=!y),x===rT){const w=!y&&o!==null;if(o=y?n():null,w)for(const S of[...r])S()}return!1},g=[m.registerCsiHandler({prefix:"?",final:"h"},p(!0)),m.registerCsiHandler({prefix:"?",final:"l"},p(!1)),m.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof m.registerEscHandler=="function"&&g.push(m.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>l,isSynchronizing:()=>o!==null&&n()-o<cT,onSyncEnd:u,reset:h,dispose:()=>{for(const y of g)y.dispose();r.clear()}}}const dT=40;function fT(a,n){return a==="off"?!1:a==="always"?!0:n!==null&&n>dT}function hT(a,n){var m;const l=uT(a),o=new DC({getScreen:()=>{const p=n();if(!p)return null;const g=p.buffer.active;return{cols:p.cols,rows:p.rows,baseY:g.baseY,getLine:y=>g.getLine(y),getNullCell:typeof g.getNullCell=="function"?()=>g.getNullCell():void 0}},getCursor:()=>{var g;const p=(g=n())==null?void 0:g.buffer.active;return p?{row:p.baseY+p.cursorY,col:p.cursorX,hidden:l.isCursorHidden()}:null},isSynchronizing:l.isSynchronizing}),r=(m=a._core)==null?void 0:m.unicodeService,u=new sT({getTerminal:n,getField:o.detect,charWidth:typeof(r==null?void 0:r.wcwidth)=="function"?p=>r.wcwidth(p):void 0}),h=new KC({getTerminal:n,isCursorHidden:()=>l.isCursorHidden()});return{screenState:l,fieldProbe:o,predictor:u,overlay:h}}function mT({termRef:a,rendererRef:n,mode:l,connectionState:o,observeKeyInput:r}){const u=T.useRef(null),h=T.useRef(null),m=T.useRef(null),p=Zn(l),g=T.useCallback(()=>{const M=u.current,E=h.current;if(!(!M||!E)){if(!fT(p.current,M.getEchoSrttMs())){E.clear();return}E.sync(M.getOverlayItems())}},[p]),y=T.useCallback(M=>{var E,k,N,R;(E=u.current)==null||E.reset(M),(k=u.current)==null||k.forgetConfidence(),(N=m.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()},[]),x=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]),w=T.useCallback(M=>{const E=hT(M,()=>a.current);return m.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,m.current=null},[]);return T.useEffect(()=>r(x),[r,x]),T.useEffect(()=>{g()},[l,g]),T.useEffect(()=>{y("connectionState")},[o,y]),{predictorRef:u,overlayRef:h,fieldProbeRef:m,attach:w,detach:S,sync:g,forget:y,discard:v,onUserInput:x}}const pT=20,gT=6,bT=500,yT=300,rl=13,jy=.602,Oy=1.3;function Xn(a,n){return Number.isFinite(a)&&a>0?a:n}function Ig(a,n,l){return Math.min(l,Math.max(n,a))}function Dy(a){const{width:n,height:l,cellWidth:o,cellHeight:r,minCols:u=pT,minRows:h=gT,maxCols:m=bT,maxRows:p=yT}=a,g=Xn(o,rl*jy),y=Xn(r,rl*Oy);return{cols:Ig(Math.floor(Xn(n,0)/g),u,m),rows:Ig(Math.floor(Xn(l,0)/y),h,p)}}function oa(a,n=rl){var o,r,u;if(a)try{const h=a._core,m=(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(m!=null&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const l=Xn(n,rl);return{cellWidth:Math.round(l*jy*100)/100,cellHeight:Math.round(l*Oy*100)/100,measured:!1}}function vT(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:Xn(o,Xn(a.clientWidth,n)),height:Xn(r,Xn(a.clientHeight,l))}}function zy(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 Fg(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),m=Math.round(u*o*100)/100,p=Math.round(h*o*100)/100;return{dpr:o,scale:r,cssWidth:u,cssHeight:h,physicalWidth:m,physicalHeight:p}}function xT(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 m=Math.abs(l.cssWidth-n.cssWidth),p=Math.abs(l.cssHeight-n.cssHeight);return m<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const wT=250;function ST({termRef:a,containerRef:n,frameRef:l,surfaceRef:o,currentScaleRef:r,rendererRef:u,initialBannerWrittenRef:h,isActiveRef:m,sendResize:p,onResized:g}){const y=Zn(p),v=Zn(g),x=T.useRef({cols:0,rows:0}),w=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=w.current;w.current=null,ie&&(ie.cols===x.current.cols&&ie.rows===x.current.rows||(x.current=ie,y.current(ie.cols,ie.rows),v.current()))},[y,v]),j=T.useCallback((ie,re,P=!1)=>{if(!(!Number.isFinite(ie)||!Number.isFinite(re)||ie<=0||re<=0)&&!(ie===x.current.cols&&re===x.current.rows)){if(w.current={cols:ie,rows:re},P){S.current&&clearTimeout(S.current),S.current=null,H();return}S.current||(S.current=setTimeout(()=>{S.current=null,H()},wT))}},[H]),D=T.useCallback((ie=!1,re=!1)=>{var ye;const P=a.current,A=n.current,G=o.current,Q=l.current;if(!P||!A||!G||!Q)return;const se=Ed(A,il(),cd());if(se.width<=0||se.height<=0)return;Q.style.width="100%",Q.style.height="100%",G.style.width="100%",G.style.height="100%",G.style.transform="none",G.style.transformOrigin="top left",r.current=1;const W=Fg(se),be=xT({lastSnapshot:N.current,currentSnapshot:W});if(be.isVisualZoom&&!ie){N.current=W;try{P.refresh(0,Math.max(0,P.rows-1))}catch{}return}if(be.shouldIgnore&&!ie)return;N.current=W;const xe=oa(P,rl),ue=Dy({width:se.width-vT(G),height:se.height,cellWidth:xe.cellWidth,cellHeight:xe.cellHeight}),Te=Math.abs(se.width-k.current.width)>1||Math.abs(se.height-k.current.height)>1;if(P.cols!==ue.cols||P.rows!==ue.rows)try{P.resize(ue.cols,ue.rows)}catch(ae){console.debug("Error resizing terminal grid:",ae)}h.current&&!R.current&&(Te||P.cols!==ue.cols||P.rows!==ue.rows)&&(R.current=!0,(ye=u.current)==null||ye.verify());const ce=ue.cols!==x.current.cols||ue.rows!==x.current.rows;m.current&&(Te||ie||ce)&&(k.current={width:se.width,height:se.height},j(ue.cols,ue.rows,re));try{P.refresh(0,Math.max(0,P.rows-1))}catch{}},[a,n,o,l,r,u,h,m,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 re=0;const P=()=>{E.current=null,re++;const A=re>=ie;_.current(!0),!A&&re<2&&typeof requestAnimationFrame=="function"&&(E.current=requestAnimationFrame(P))};typeof requestAnimationFrame=="function"?E.current=requestAnimationFrame(P):P()},[]),q=T.useCallback(()=>_.current(!0,!0),[]),te=T.useCallback(ie=>{k.current={width:ie.width,height:ie.height},N.current=Fg(ie)},[]),Z=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:q,seedFit:te,cancelPendingFits:Z}}const CT=" ()[]{}'\"\\`";function TT(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=zy(a.clientX,a.clientY,u,o),m=oa(n);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,u.width||n.cols*m.cellWidth),g=Math.max(1,u.height||n.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),x=Math.max(0,Math.min(n.cols-1,Math.floor(y/m.cellWidth))),w=Math.max(0,Math.min(n.rows-1,Math.floor(v/m.cellHeight))),M=(n.buffer.active.viewportY??0)+w;return{col:x,bufferRow:M}}function MT(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 AT(a,n,l){var x,w;if(!((x=a==null?void 0:a.buffer)!=null&&x.active)||n<0||n>=a.cols)return null;const o=a.buffer.active.getLine(l);if(!o)return null;const r=((w=a.options)==null?void 0:w.wordSeparator)??CT,u=new Array(a.cols).fill(null),h=Math.min(a.cols,o.length);let m=0;for(;m<h;){const S=o.getCell(m);if(!S){u[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const M=S.getWidth();if(M===0){u[m]||(u[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const E=S.getChars(),k=MT(E,r),N=Math.min(a.cols,m+M),R={startCol:m,endCol:N,isSeparator:k};for(let H=m;H<N;H++)u[H]=R;m+=Math.max(1,M)}for(let S=h;S<a.cols;S++)u[S]||(u[S]={startCol:S,endCol:S+1,isSeparator:!0});const p=u[n];if(!p||p.isSeparator)return null;let g=p.startCol;for(;g>0;){const S=u[g-1];if(S&&!S.isSeparator)g=S.startCol;else break}let y=p.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 ET(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 m=n.getLine(l+h);r.push(m?m.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
|
|
49
|
+
`)}const Gg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),NT=.6,kT=new Set(["─","━","═","┄","┅","┈","┉","-"]),LT=.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&&kT.has(h)&&l++}}return l>=Math.max(5,Math.min(n*.25,10))}function id(a,n,l){var w;if(!((w=a==null?void 0:a.buffer)!=null&&w.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,m=a.rows>0?a.rows:1,p=new Int32Array(r);let g=0;for(let S=0;S<m;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&&Gg.has(R)&&p[k]++}}}if(g===0)return{startCol:0,endCol:r-1};const y=g*NT,v=S=>p[S]>=y;let x=!1;for(let S=0;S<r;S++)if(v(S)){x=!0;break}if(x){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+m-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+m-1;for(let R=S+1;R<=h+m-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 q=0;q<K;q++){const te=z.getCell(q);if(te){const Z=te.getChars();Z&&Gg.has(Z)&&R[q]++}}}const H=N*LT,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 Yg(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 Pg(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)),m=Math.min(o-1,Math.max(n.startCol,n.endCol));if(h>m||r>u)return"";const p=[];for(let y=r;y<=u;y++){const v=l.getLine(y);if(!v){p.push("");continue}const x=v.translateToString(!0,h,m+1);p.push(x.trimEnd())}return p.join(`
|
|
50
|
+
`)}function _T({termRef:a,surfaceRef:n,mainRef:l,currentScaleRef:o,addToast:r,t:u}){const h=Zn(r),m=Zn(u),[p,g]=T.useState(null),y=T.useRef(null);y.current=p;const[v,x]=T.useState(null),w=T.useRef(null);w.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),q=T.useRef(null),te=T.useRef(null),Z=T.useCallback(ae=>{var we;const ve=a.current;if(!ve)return null;const le=((we=n.current)==null?void 0:we.querySelector(".xterm-screen"))||n.current;return TT(ae,ve,le,o.current)},[a,n,o]),ie=T.useCallback(ae=>{const ve=a.current,le=Z(ae);return!ve||!le?null:eC(ve,le.col,le.bufferRow)},[a,Z]),re=T.useCallback((ae,ve)=>{x(ve),M(Pg(ae,ve)),N(!0)},[]),P=T.useCallback(()=>{x(null),M(""),N(!1),q.current=null,te.current=null},[]),A=T.useCallback(()=>{g(null),y.current=null,x(null),w.current=null,M(""),E.current="",N(!1),z.current=null,K.current=null},[]),G=T.useCallback(ae=>{const ve=a.current;if(!ve)return;const le=Z(ae),we=le?AT(ve,le.col,le.bufferRow):null;if(le&&we){q.current=le;const Ee=id(ve,le.col,le.bufferRow);te.current=Ee;const Be={startCol:we.startCol,endCol:we.startCol+we.length-1,startRow:le.bufferRow,endRow:le.bufferRow};re(ve,Yg(Be,Ee))}else P();z.current=ae,K.current=null},[a,Z,re,P]),Q=T.useCallback(ae=>{const ve=a.current,le=q.current;if(!ve||!le)return;K.current=ae;const we=Z(ae);if(!we)return;const Ee=te.current??id(ve,le.col,le.bufferRow),Be={startCol:Math.min(le.col,we.col),endCol:Math.max(le.col,we.col),startRow:Math.min(le.bufferRow,we.bufferRow),endRow:Math.max(le.bufferRow,we.bufferRow)};re(ve,Yg(Be,Ee))},[a,Z,re]),se=T.useCallback(()=>{const ae=K.current??z.current;if(!ae||!l.current)return;const ve=l.current.getBoundingClientRect(),le=ae.clientX-ve.left,we=ae.clientY-ve.top,Ee=ie(ae);g({x:le,y:we,link:Ee}),y.current={x:le,y:we,link:Ee}},[l,ie]),W=T.useCallback(async ae=>{await Kd(ae)==="failed"?h.current("error",m.current("clipboard.copyFailed")):h.current("success",m.current("clipboard.copied"))},[h,m]),be=T.useCallback(async()=>{const ae=E.current;ae&&await W(ae)},[W]),xe=T.useCallback(async()=>{var Ee,Be,it,tt;const ae=a.current,ve=(Ee=ae==null?void 0:ae.buffer)==null?void 0:Ee.active;if(!ae||!ve)return;const le=((Be=w.current)==null?void 0:Be.startRow)??((it=q.current)==null?void 0:it.bufferRow)??ve.viewportY,we=te.current??id(ae,((tt=q.current)==null?void 0:tt.col)??0,le);await W(Pg(ae,{startCol:we.startCol,endCol:we.endCol,startRow:le,endRow:le}))},[a,W]),ue=T.useCallback(async()=>{const ae=a.current;ae&&await W(ET(ae))},[a,W]),Te=T.useCallback((ae,ve,le)=>{const we=ae.buffer.active.viewportY??0;we!==_.current&&(_.current=we,D(we));const Ee=w.current;if(Ee&&R.current){const Be=Ee.startRow-we,it=Ee.endRow-we;H.current&&ve<=it&&le>=Be&&(N(!1),H.current=!1)}else H.current=!1},[]),ce=T.useCallback(ae=>{const ve=ae.buffer.active.viewportY??0;_.current=ve,D(ve)},[]),ye=T.useCallback(()=>{H.current=!0},[]);return{selectionMenu:p,selectionRect:v,selectionSnapshot:S,isHighlightVisible:k,viewportY:j,hasOpenMenu:()=>y.current!==null,clearSelection:A,handleLongPress:G,handleSelectionExtend:Q,openMenuAtGesture:se,handleCopySelection:be,handleCopyLine:xe,handleCopyScreen:ue,onTerminalRender:Te,onTerminalScroll:ce,onTerminalContentChanged:ye}}const RT=({term:a,surface:n,main:l,rect:o,viewportY:r})=>{if(!a||!l)return null;const u=oa(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 m=h.getBoundingClientRect(),p=l.getBoundingClientRect(),g=o.startRow-r;if(o.endRow-r<0||g>=a.rows)return null;const v=m.top-p.top+g*u.cellHeight,x=m.left-p.left+o.startCol*u.cellWidth,w=(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:`${x}px`,width:`${w}px`,height:`${S}px`}})},tr=new Map;function Hy(a){let n=tr.get(a);return n===void 0&&(n=`#${(a&Je.RGB_MASK).toString(16).padStart(6,"0")}`,tr.size>4096&&tr.clear(),tr.set(a,n)),n}function By(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 Hy(a&Je.RGB_MASK);default:return l}}function rr(a,n,l,o){var v;const r=(a&rt.INVERSE)!==0,u=r?n:a,h=r?a:n;let m;const p=u&Je.CM_MASK;if(p===Je.CM_P16||p===Je.CM_P256){let x=u&Je.PCOLOR_MASK;o&&a&rt.BOLD&&x<8&&(x+=8),m=((v=l.ansi[x])==null?void 0:v.css)??l.foreground.css}else p===Je.CM_RGB?m=Hy(u&Je.RGB_MASK):m=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:By(h,l,l.background.css);return{fg:m,bg:y,bgIsDefault:!r&&g===Je.CM_DEFAULT}}function ms(a){return(a&rt.BOLD)!==0}function cr(a){return(a&Ri.ITALIC)!==0}function xr(a){return(a&Ri.DIM)!==0}function ds(a){return(a&rt.INVISIBLE)!==0}const jT=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 Vg(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function Uy(a,n,l,o,r,u,{css:h,dpr:m,cursorWidth:p}){switch(a.save(),a.fillStyle=h,a.strokeStyle=h,u){case 2:a.fillRect(l,o,Math.max(1,Math.round(p*m)),n.cell.height);break;case 3:a.fillRect(l,o+n.cell.height-Math.max(1,Math.round(m))-1,r,Math.max(1,Math.round(m)));break;case 4:{const g=Math.max(1,Math.round(m));a.lineWidth=g,a.strokeRect(l+g/2,o+g/2,r-g,n.cell.height-g);break}}a.restore()}function OT(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 m=u-n.ydisp;if(m<0||m>=o.rows)return null;const p=Math.min(Math.max(0,h),o.cols-1),g=a.optionsService.rawOptions;let y;if(a._coreBrowserService.isFocused)r?y=0:y=Vg(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";y=v==="none"?0:Vg(v)}return y===0?null:{x:p,y:m,shape:y}}class DT{constructor(n){$(this,"timer",null);$(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()},jT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}const $g=80,zT=16;class HT{constructor(){$(this,"last",null);$(this,"fromX",0);$(this,"toX",0);$(this,"start",0);$(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)<=zT;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 BT(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}=rr(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 UT=120,KT=16,IT=96,FT=32,GT=64;function rs(a,n){const l=a.content[n];if(!(l>>>Qe.WIDTH_SHIFT)||ds(a.fg[n]))return!1;if(l&Qe.IS_COMBINED_MASK)return a.combined[n]!=="";const o=l&Qe.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 YT{constructor(){$(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 m=n*l,p=Math.max(0,o.start),g=Math.min(l,o.end);let y=0;for(let x=p;x<g;x++){const w=m+x;if(r.content[w]===Ja)return;const S=rs(r,w),M=rs(u,x);if(S&&M){if(r.content[w]!==u.content[x]||r.combined[w]!==u.combined[x])return}else(S||M)&&y++}if(y===0||y>FT)return;let v=0;for(let x=p;x<g;x++){const w=m+x,S=rs(r,w),M=rs(u,x);if(M&&!S){const E=Math.min(v++*KT,IT);this.fades.set(w,{...qg(u,x),start:h+E,out:!1})}else S&&!M&&this.fades.set(w,{...qg(r,w),start:h,out:!0})}}at(n,l,o,r){const u=this.fades.get(n);if(!u)return null;const h=u.out?!rs(o,l):o.content[l]===u.content&&o.combined[l]===u.combined,m=(r-u.start)/UT;if(!h||m>=1)return this.fades.delete(n),null;const p=Math.max(0,m);return u.out?{alpha:(1-p)**2,gone:u}:{alpha:1-(1-p)**3}}}function PT(a,n,{gone:l,alpha:o},r,u){if(!l)return;const h=l.content&Qe.IS_COMBINED_MASK?l.combined:String.fromCodePoint(l.content&Qe.CODEPOINT_MASK),m=n.get({chars:h,bold:ms(l.fg),italic:cr(l.bg),dim:xr(l.bg),fg:r.fg,bg:r.bg,cells:u.cells});m&&(a.globalAlpha=o,a.drawImage(m.source,m.x,m.y,m.width,m.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 Xg(a){if(!a)throw new Error("value must not be falsy");return a}const VT={"▀":[{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`}},ws={"":{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}};ws[""]=ws[""];ws[""]=ws[""];function XT(a,n,l,o,r,u,h,m){const p=VT[n];if(p)return ZT(a,p,l,o,r,u),!0;const g=$T[n];if(g)return WT(a,g,l,o,r,u),!0;const y=qT[n];if(y)return QT(a,y,l,o,r,u,m),!0;const v=ws[n];return v?(JT(a,v,l,o,r,u,h,m),!0):!1}function ZT(a,n,l,o,r,u){for(let h=0;h<n.length;h++){const m=n[h],p=r/8,g=u/8;a.fillRect(l+m.x*p,o+m.y*g,m.w*p,m.h*g)}}const Zg=new Map;function WT(a,n,l,o,r,u){let h=Zg.get(n);h||(h=new Map,Zg.set(n,h));const m=a.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let p=h.get(m);if(!p){const g=n[0].length,y=n.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=y;const x=Xg(v.getContext("2d")),w=new ImageData(g,y);let S,M,E,k;if(m.startsWith("#"))S=parseInt(m.slice(1,3),16),M=parseInt(m.slice(3,5),16),E=parseInt(m.slice(5,7),16),k=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[S,M,E,k]=m.substring(5,m.length-1).split(",").map(N=>parseFloat(N));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let N=0;N<y;N++)for(let R=0;R<g;R++)w.data[(N*g+R)*4]=S,w.data[(N*g+R)*4+1]=M,w.data[(N*g+R)*4+2]=E,w.data[(N*g+R)*4+3]=n[N][R]*(k*255);x.putImageData(w,0,0),p=Xg(a.createPattern(v,null)),h.set(m,p)}a.fillStyle=p,a.fillRect(l,o,r,u)}function QT(a,n,l,o,r,u,h){a.strokeStyle=a.fillStyle;for(const[m,p]of Object.entries(n)){a.beginPath(),a.lineWidth=h*Number.parseInt(m,10);let g;if(typeof p=="function"){const v=.15/u*r;g=p(.15,v)}else g=p;for(const y of g.split(" ")){const v=y[0],x=Ky[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(a,Iy(w,r,u,l,o,!0,h))}a.stroke(),a.closePath()}}function JT(a,n,l,o,r,u,h,m){const p=new Path2D;p.rect(l,o,r,u),a.clip(p),a.beginPath();const g=h/12;a.lineWidth=m*g;for(const y of n.d.split(" ")){const v=y[0],x=Ky[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(a,Iy(w,r,u,l,o,!1,m,(n.leftPadding??0)*(g/2),(n.rightPadding??0)*(g/2)))}n.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function Wg(a,n,l=0){return Math.max(Math.min(a,n),l)}const Ky={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 Iy(a,n,l,o,r,u,h,m=0,p=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-m*h-p*h,u&&g[y]!==0&&(g[y]=Wg(Math.round(g[y]+.5)-.5,n,0)),g[y]+=o+m*h;for(let y=1;y<g.length;y+=2)g[y]*=l,u&&g[y]!==0&&(g[y]=Wg(Math.round(g[y]+.5)-.5,l,0)),g[y]+=r;return g}const Id=.5,e5=1024,t5=6;function n5(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class i5{constructor(n,l=typeof navigator<"u"?navigator.userAgent:""){$(this,"pages",[]);$(this,"slots",new Map);$(this,"inkCache",new Map);$(this,"metrics",null);$(this,"font",null);$(this,"baseline");$(this,"generation",0);$(this,"scratch");this.document=n,this.baseline=n5(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 m=this.scratchContext();if(m&&!(this.font.customGlyphs&&Fy(n))){m.font=this.fontString(l,o),m.textBaseline=this.baseline;const p=m.measureText(n),g=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.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,m=l.cellHeight,p=this.allocate(h,m);if(!p)return null;const{page:g,x:y,y:v}=p,x=g.ctx;x.save(),x.beginPath(),x.rect(y,v,h,m),x.clip(),x.globalAlpha=1,x.fillStyle=n.bg,x.fillRect(y,v,h,m),x.fillStyle=n.fg,n.dim&&(x.globalAlpha=Id);let w=!1;o.customGlyphs&&(w=XT(x,n.chars,y,v,l.cellWidth,l.cellHeight,o.fontSize,l.dpr)),w||(x.font=this.fontString(n.bold,n.italic),x.textBaseline=this.baseline,x.fillText(n.chars,y+l.charLeft,v+l.charTop+l.charHeight)),x.restore();const S={source:g.canvas,x:y,y:v,width:h,height:m};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<t5){const o=this.createPage(Math.max(e5,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 Fy(a){if(a.length!==1)return!1;const n=a.charCodeAt(0);return n>=9472&&n<=9631||n>=57504&&n<=57558}function a5(a,n){return(a&(rt.UNDERLINE|rt.STRIKETHROUGH))!==0||(n&Ri.OVERLINE)!==0}function l5(a,n,{px:l,py:o,cells:r,fgWord:u,bgWord:h,ext:m,fgCss:p},{fontSize:g,dpr:y,colors:v,boldBright:x}){const w=(u&rt.UNDERLINE)!==0,S=(u&rt.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(),xr(h)&&(a.globalAlpha=Id);const k=Math.max(1,Math.floor(g*y/15)),N=k%2===1?.5:0;if(w){const R=BC(m);let H=p;if(R){let _=R;x&&ms(u)&&(_&50331648)!==50331648&&(_&255)<8&&(_+=8),H=By(_,v,p)}a.strokeStyle=H,a.lineWidth=k;const j=o+n.char.top+Math.ceil(n.char.height)-N-k*2,D=m?HC(m):el.SINGLE;switch(a.beginPath(),D){case el.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 el.CURLY:{const _=j+k,z=Math.max(1,k);for(let K=0;K<r;K++){const q=l+K*n.cell.width,te=q+n.cell.width/2,Z=q+n.cell.width;a.moveTo(q,_),a.bezierCurveTo(q,_-z,te,_-z,te,_),a.bezierCurveTo(te,_+z,Z,_+z,Z,_)}break}case el.DOTTED:a.setLineDash([k,k]),a.moveTo(l,j),a.lineTo(l+E,j);break;case el.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=p,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=p,a.lineWidth=R,a.beginPath(),a.moveTo(l,H),a.lineTo(l+E,H),a.stroke()}a.restore()}const ad=4,s5=3;class o5{constructor(n,l,o,r){$(this,"atlas");$(this,"fades",new YT);$(this,"cols",0);$(this,"rows",0);$(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});$(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});$(this,"work",zC());this.ctx=n,this.core=o,this.dimensions=r,this.atlas=new i5(l)}resize(n,l){this.cols=n,this.rows=l,this.fades.clear();const o=n*l;this.painted={content:new Uint32Array(o).fill(Ja),fg:new Uint32Array(o),bg:new Uint32Array(o),ext:new Uint32Array(o),meta:new Uint32Array(o).fill(Ja),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(Ja),this.painted.meta.fill(Ja),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 m=0;m<u;m++)for(let p=0;p<r;p++){const g=m*this.cols+p,y=h.content[g];if(y===Ja||h.meta[g]===ad||ds(h.fg[g]))continue;const v=y&Qe.CODEPOINT_MASK;if(y&Qe.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:m}=this.row,p=this.work;for(let g=0;g<this.cols;g++)n&&g<n.length?(n.loadCell(g,p),o[g]=p.content,r[g]=p.fg,u[g]=p.bg,h[g]=My(p),m[g]=p.content&Qe.IS_COMBINED_MASK?p.combinedData:""):(o[g]=1<<Qe.WIDTH_SHIFT,r[g]=0,u[g]=0,h[g]=0,m[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]>>>Qe.WIDTH_SHIFT)&&this.blankAt(y-1);const v=y+g.width;v<this.cols&&!(o[v]>>>Qe.WIDTH_SHIFT)&&o[v-1]>>>Qe.WIDTH_SHIFT===2&&this.blankAt(v);const x=UC(g.chars,g.width);o[y]=x.content,m[y]=x.combinedData,r[y]=g.style.fg,u[y]=g.style.bg,h[y]=g.style.ext,g.width===2&&(o[y+1]=0,m[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<<Qe.WIDTH_SHIFT,this.row.combined[n]=""}paintRow(n,l,o=null,r=0){const u=this.cols,{content:h,fg:m,bg:p,ext:g,combined:y}=this.row,v=this.painted,x=n*u;o&&this.fades.begin(n,u,o,v,this.row,r);let w=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]>>>Qe.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<<s5,_=this.fades.size>0?this.fades.at(x+N,N,this.row,r):null;let z=_!==null||this.differs(x+N,N,D);for(let K=1;K<H;K++)this.differs(x+N+K,N+K,ad)&&(z=!0);if(z){for(let q=0;q<H;q++){const te=x+N+q;v.content[te]=h[N+q],v.fg[te]=m[N+q],v.bg[te]=p[N+q],v.ext[te]=g[N+q],v.meta[te]=q===0?_?D|GT:D:ad,v.combined[te]=y[N+q]}w+=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(),w}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&Qe.CODEPOINT_MASK)<128&&!(h&Qe.IS_COMBINED_MASK)||h>>>Qe.WIDTH_SHIFT!==1||ds(o[n]))return!1;const p=l[n+1],g=p&Qe.CODEPOINT_MASK;if(p>>>Qe.WIDTH_SHIFT!==1||p&Qe.IS_COMBINED_MASK||g!==0&&g!==32||r[n]!==r[n+1]||u[n+1]!==0||(o[n]&rt.INVERSE)!==(o[n+1]&rt.INVERSE)||o[n]&rt.INVERSE&&o[n]!==o[n+1]||o[n+1]&(rt.UNDERLINE|rt.STRIKETHROUGH)||r[n+1]&Ri.OVERLINE)return!1;const y=this.charsAt(n);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Fy(y)?!1:this.atlas.overflow(y,ms(o[n]),cr(r[n]))>0}charsAt(n){const l=this.row.content[n];if(l&Qe.IS_COMBINED_MASK)return this.row.combined[n];const o=l&Qe.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],m=h&Qe.CODEPOINT_MASK,p=!(h&Qe.IS_COMBINED_MASK)&&(m===0||m===32),g=ds(r[n]);return!p&&!g||(r[n]&(rt.UNDERLINE|rt.STRIKETHROUGH)||u[n]&Ri.OVERLINE)&&!g?null:rr(r[n],u[n],this.colors(),this.boldBright()).bg}paintCell(n,l,o,r,u=null){const h=this.ctx,m=this.dimensions.device,p=this.colors(),g=this.row.fg[n],y=this.row.bg[n],v=this.row.ext[n],x=rr(g,y,p,this.boldBright());let w=x.fg,S=x.bg;r===qn.BLOCK&&(S=p.cursor.css,w=p.cursorAccent.css);const M=ds(g),E=this.charsAt(n),k=n*m.cell.width,N=l*m.cell.height,R=o*m.cell.width,H=m.cell.height,j=M||E===""||E===" ",D=j?null:this.atlas.get({chars:E,bold:ms(g),italic:cr(y),dim:xr(y),fg:w,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=w,h.globalAlpha=(xr(y)?Id:1)*_,h.font=this.atlas.fontString(ms(g),cr(y)),h.fillText(E,k+m.char.left,N+m.char.top+m.char.height),h.restore())),u!=null&&u.gone){const K=r===qn.BLOCK||(g&rt.INVERSE)!==0?w:rr(u.gone.fg,u.gone.bg,p,this.boldBright()).fg;PT(h,this.atlas,u,{fg:K,bg:S},{px:k,py:N,width:R,height:H,cells:o})}!M&&a5(g,y)&&l5(h,m,{px:k,py:N,cells:o,fgWord:g,bgWord:y,ext:v,fgCss:w},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:p,boldBright:this.boldBright()}),r!==qn.NONE&&r!==qn.BLOCK&&Uy(h,m,k,N,R,r,{css:p.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 r5(){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 c5(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 u5(a,n,l){if(!a||typeof a.ResizeObserver!="function")return null;let o=new a.ResizeObserver(r=>{var p;const u=r.find(g=>g.target===n);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((p=u.devicePixelContentBoxSize)!=null&&p[0])){o==null||o.disconnect(),o=null;return}const h=u.devicePixelContentBoxSize[0].inlineSize,m=u.devicePixelContentBoxSize[0].blockSize;h<=0||m<=0||h===n.width&&m===n.height||l(h,m)});try{o.observe(n,{box:"device-pixel-content-box"})}catch{o.disconnect(),o=null}return{dispose:()=>o==null?void 0:o.disconnect()}}function d5(a){if(!a)return[];const n=a.cells.map(l=>l.row);return a.cursor&&n.push(a.cursor.row),n}function f5(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 h5{constructor(n){$(this,"canvas");$(this,"ctx");$(this,"selection",null);$(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:m,cursorWidth:p,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:x}=this,w=(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)w(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;w(R,k,H-R,1),w(0,k+1,o,Math.max(N-k-1,0)),k!==N&&w(0,N,E===N?v.end[0]:o,1)}}if(x){y.fillStyle=x.fg===257?u.background.css:x.fg!==void 0&&x.fg<256?((S=u.ansi[x.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-m-1,N*n.cell.width,m);if(x.y1===x.y2)M(x.x1,x.y1,x.x2-x.x1);else{M(x.x1,x.y1,x.cols-x.x1);for(let E=x.y1+1;E<x.y2;E++)M(0,E,x.cols);M(0,x.y2,x.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)):Uy(y,n,M,E,n.cell.width,g.shape,{css:g.css,dpr:m,cursorWidth:p})}}}class m5{constructor(n,l){$(this,"text");$(this,"textContext");$(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 h5(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 u5(n,this.text,(u,h)=>{const m=l.css.canvas;if(!(Math.abs(u-m.width*o())>2||Math.abs(h-m.height*o())>2)){l.device.canvas.width=u,l.device.canvas.height=h;for(const p of[this.text,this.decor.canvas])p.width=u,p.height=h;r()}})}remove(){this.text.remove(),this.decor.canvas.remove()}}function p5(a,n){const l=a.fonts;return!l||typeof l.addEventListener!="function"?null:(l.addEventListener("loadingdone",n),{dispose:()=>l.removeEventListener("loadingdone",n)})}class g5{constructor(n,l,o){$(this,"startedAt",null);$(this,"held",null);$(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 b5(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 y5{constructor(){$(this,"listeners",new Set);$(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 v5=150;class Fd{constructor(n,l){$(this,"dimensions",r5());$(this,"redraw",new y5);$(this,"onRequestRedraw",this.redraw.event);$(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});$(this,"surface");$(this,"cells");$(this,"disposables",[]);$(this,"now");$(this,"syncHold");$(this,"cols",0);$(this,"rows",0);$(this,"overlayProvider",null);$(this,"typingZoneProvider",null);$(this,"reducedMotion");$(this,"paintedOverlayRows",new Set);$(this,"paintedCursorRow",-1);$(this,"lastYdisp",0);$(this,"inputAt",null);$(this,"blink",new DT(()=>this.requestCursorRow()));$(this,"glide",new HT);$(this,"slidingCaret",null);$(this,"disposed",!1);$(this,"isSynchronizing");$(this,"dprUsed",0);var h,m;this.core=n,this.now=l.now??(()=>performance.now()),this.syncHold=new g5(this.now,l.maxSyncHoldMs??v5,()=>this.flushHeld()),this.isSynchronizing=l.isSynchronizing??(()=>!1),this.reducedMotion=(m=(h=n._coreBrowserService.window).matchMedia)==null?void 0:m.call(h,"(prefers-reduced-motion: reduce)");const o=n._coreBrowserService.mainDocument;this.surface=new m5(o,n.screenElement),this.cells=new o5(this.surface.textContext,o,n,this.dimensions),this.disposables.push(n._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),n.optionsService.onOptionChange(p=>{(p==="cursorBlink"||p==="cursorStyle")&&this.restartBlink()})),n.linkifier&&this.disposables.push(n.linkifier.onShowLinkUnderline(p=>{this.surface.decor.link=p,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=p5(o,()=>this.clearTextureAtlas());u&&this.disposables.push(u),this.restartBlink()}static install(n,l={}){const o=b5(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 d5(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){c5(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,m=h?h.row-u:-1,p=((R=this.overlayProvider)==null?void 0:R.call(this))??null,g=f5(p),y=this.cursorState(p),v=BT(y,p,u,this.colors()),x=this.glide.update(v,m,o),w=x?null:y,S=x&&(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)cs(M,H-u,this.rows);for(const H of g.keys())cs(M,H-u,this.rows);this.paintedCursorRow>=0&&cs(M,this.paintedCursorRow,this.rows),w&&cs(M,w.y,this.rows);for(const H of this.cells.fades.rows(this.cols))cs(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===m?{start:h.startCol,end:h.endCol}:null;E+=this.cells.paintRow(H,w,j,o)}this.cells.fades.size>0&&this.requestAbsoluteRows([...this.cells.fades.rows(this.cols)].map(H=>H+u)),(x||this.slidingCaret)&&(this.slidingCaret=x,this.redrawDecor(),x&&this.requestAbsoluteRows([x.y+u])),this.paintedOverlayRows=new Set(g.keys()),this.paintedCursorRow=w?w.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 OT(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 cs(a,n,l){n>=0&&n<l&&a.add(n)}const x5=30,Gy=640,Yy=240,nr=1,w5=720*60*60*1e3;function Py(){const a=bs("local",Et.rendererProbe);if(!a)return{v:nr,ua:{}};try{const n=JSON.parse(a);return typeof n=="object"&&n!==null&&n.v===nr&&typeof n.ua=="object"&&n.ua!==null?n:{v:nr,ua:{}}}catch{return{v:nr,ua:{}}}}function S5(a,n=Date.now()){const l=Py();l.ua[a]={failedAt:n},Li("local",Et.rendererProbe,JSON.stringify(l))}function C5(a,n=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";if(!l)return!1;const r=Py().ua[l];return!(!r||typeof r.failedAt!="number"||n-r.failedAt>w5)}function Qg(a,n=Date.now()){const l=typeof navigator<"u"?navigator.userAgent:"";l&&S5(l,n)}function T5(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 M5(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,Gy),o=Math.min(a.height,Yy);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 T5(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function Jg(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 A5(a,n={}){if(C5())return ld;let l;try{l=Fd.install(a,{isSynchronizing:n.isSynchronizing})}catch(m){return console.debug("Canvas renderer unavailable, using the DOM renderer:",m),Qg(),ld}if(!l)return ld;let o=l,r=null;const u=()=>{var p;if(!o)return;Qg();const m=o;o=null;try{m.uninstall()}catch{}(p=n.onRendererSwapped)==null||p.call(n,"dom")};return{get kind(){return o?"canvas":"dom"},get canvas(){return o},dispose:()=>{const m=o;o=null;try{m==null||m.dispose()}catch{}},verify:async()=>{if(o)return r||(r=(async()=>{try{const m=o.stats.frames;await Jg(2);for(let g=0;g<x5&&o&&o.stats.frames===m;g++)await Jg(1);if(!o)return;const p=M5(o.textCanvas);p==="blank"&&o.hasPaintedInk(Gy,Yy)?u():p==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(m){console.debug("Canvas probe inconclusive: unexpected error during verify():",m)}finally{r=null}})(),r)}}}function E5(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 N5=Sx(),sd={exports:{}},eb;function k5(){return eb||(eb=1,(function(a,n){(function(l,o){a.exports=o()})(self,(()=>(()=>{var l={6:(h,m)=>{function p(y){try{const v=new URL(y),x=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(x.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(y,v,x,w={}){this._terminal=y,this._regex=v,this._handler=x,this._options=w}provideLinks(y,v){const x=g.computeLink(y,this._regex,this._terminal,this._handler);v(this._addCallbacks(x))}_addCallbacks(y){return y.map((v=>(v.leave=this._options.leave,v.hover=(x,w)=>{if(this._options.hover){const{range:S}=v;this._options.hover(x,w,S)}},v)))}};class g{static computeLink(v,x,w,S){const M=new RegExp(x.source,(x.flags||"")+"g"),[E,k]=g._getWindowedLineStrings(v-1,w),N=E.join("");let R;const H=[];for(;R=M.exec(N);){const j=R[0];if(!p(j))continue;const[D,_]=g._mapStrIdx(w,k,0,R.index),[z,K]=g._mapStrIdx(w,D,_,j.length);if(D===-1||_===-1||z===-1||K===-1)continue;const q={start:{x:_+1,y:D+1},end:{x:K,y:z+1}};H.push({range:q,text:j,activate:S})}return H}static _getWindowedLineStrings(v,x){let w,S=v,M=v,E=0,k="";const N=[];if(w=x.buffer.active.getLine(v)){const R=w.translateToString(!0);if(w.isWrapped&&R[0]!==" "){for(E=0;(w=x.buffer.active.getLine(--S))&&E<2048&&(k=w.translateToString(!0),E+=k.length,N.push(k),w.isWrapped&&k.indexOf(" ")===-1););N.reverse()}for(N.push(R),E=0;(w=x.buffer.active.getLine(++M))&&w.isWrapped&&E<2048&&(k=w.translateToString(!0),E+=k.length,N.push(k),k.indexOf(" ")===-1););}return[N,S]}static _mapStrIdx(v,x,w,S){const M=v.buffer.active,E=M.getNullCell();let k=w;for(;S;){const N=M.getLine(x);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(x+1);j&&j.isWrapped&&(j.getCell(0,E),E.getWidth()===2&&(S+=1))}if(S<0)return[x,R]}x++,k=0}return[x,k]}}m.LinkComputer=g}},o={};function r(h){var m=o[h];if(m!==void 0)return m.exports;var p=o[h]={exports:{}};return l[h](p,p.exports,r),p.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const m=r(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(y,v){const x=window.open();if(x){try{x.opener=null}catch{}x.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,x=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,x,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),u})()))})(sd)),sd.exports}var L5=k5(),_5=Cx();function R5({fontSize:a,fontFamily:n,theme:l,cols:o,rows:r}){const u=new _5.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,m)=>{Cd(m)}}});try{const h=new N5.Unicode11Addon;u.loadAddon(h),u.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{u.loadAddon(new L5.WebLinksAddon((h,m)=>{Cd(m)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return u}function fs(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 j5(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 Vy(a,n,l){const o=j5(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 O5(a){var n;try{(n=a.blur)==null||n.call(a)}catch{}}function tb(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 D5(a){var l;const n=a;return n.coreService||((l=n._core)==null?void 0:l.coreService)||null}class z5{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 zy(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=oa(l);if(!u||typeof u.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const m=u.getBoundingClientRect(),p=this.getLogicalCoordinates(n.clientX,n.clientY),g=m.width>0&&m.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,x=o==null?void 0:o.viewportY,S=(o==null?void 0:o.baseY)+v-x,M=m.top+S*h.cellHeight,E=M+h.cellHeight,k=Number(l.rows);return S>=0&&(!Number.isFinite(k)||S<k)&&p.clientY>=M-2&&p.clientY<=E+2&&(!g||p.clientX>=m.left&&p.clientX<=m.right)}resolveDispatchTarget(n,l){var m;const o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(o==null?void 0:o.querySelector(".xterm-screen"))||l.querySelector(".xterm-screen")||null,u=((m=r==null?void 0:r.closest)==null?void 0:m.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),m=oa(l);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,u.width||l.cols*m.cellWidth),g=Math.max(1,u.height||l.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,h.clientX-u.left)),v=Math.max(0,Math.min(g-1,h.clientY-u.top)),x=Math.max(0,Math.min(l.cols-1,Math.floor(y/m.cellWidth))),w=Math.max(0,Math.min(l.rows-1,Math.floor(v/m.cellHeight)));return{col:x,row:w,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),m=l<0?-1:1;let p=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:m,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});u.dispatchEvent(y),p+=1}catch{return p>0}return p>0}emitWheel(n,l,o,r){if(l===0)return!1;if(this.dispatchWheel(n,l,o,r))return!0;const u=tb(o);if(!(u!=null&&u.triggerMouseEvent))return!1;let h=0;for(let m=0;m<Math.abs(l);m+=1){const p=this.getMouseReport(n,o);p&&(p.button=4,p.action=l<0?0:1,p.ctrl=!!(r!=null&&r.ctrlKey),p.alt=!!(r!=null&&r.altKey),p.shift=!!(r!=null&&r.shiftKey),u.triggerMouseEvent(p)&&(h+=1))}return h>0}scrollAlternateBuffer(n,l,o,r){var h;if(l===0)return"none";const u=fs(o);if(!u&&!this.options.getIsController())return"none";if(this.emitWheel(n,l,o,r))return u?"application-mouse":"application-keys";if(!u){const m=D5(o);if(!(m!=null&&m.triggerDataEvent))return"none";const g=`\x1B${!!((h=m.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${l<0?"A":"B"}`;return m.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=tb(u);if(h!=null&&h.triggerMouseEvent){const p=this.getMouseReport(l,u);p&&(p.action=n==="mousedown"?1:n==="mouseup"?0:32,p.ctrl=!!(o!=null&&o.ctrlKey),p.alt=!!(o!=null&&o.altKey),p.shift=!!(o!=null&&o.shiftKey),h.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const m=this.getLogicalCoordinates(l.clientX,l.clientY);Vy(r,n,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:n==="mouseup"?0:1})}}class H5{constructor(n){$(this,"options");$(this,"state","idle");$(this,"startX",0);$(this,"startY",0);$(this,"lastX",0);$(this,"lastY",0);$(this,"activeTarget",null);$(this,"longPressTimer",null);$(this,"capturedPointerId",null);$(this,"captureElement",null);$(this,"scrollRemainderY",0);$(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...n},this.delivery=new z5(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,x;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(),m=this.options.getIsController(),p=fs(h);if(!(u<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(o)||!p||!m){this.setGestureState("scrolling"),h&&O5(h),this.lastX=n.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(n,l);return}if(p&&m){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&&((x=l.preventDefault)==null||x.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=oa(o),h=u.measured?u.cellHeight:this.options.scrollLineHeightPx||u.cellHeight||18;this.scrollRemainderY+=r;const m=Math.trunc(this.scrollRemainderY/h),p=-m;let g=!1,y="none";const v=$y(o),x=fs(o);if(p!==0){if((v==null?void 0:v.type)==="alternate")y=this.delivery.scrollAlternateBuffer(n,p,o,l),g=y!=="none";else{const k=od(o);o.scrollLines(p);const N=od(o);y="buffer",g=k===null||N===null||k!==N}this.scrollRemainderY-=m*h}const w=this.delivery.getViewportElement(o);(M=(S=this.options).onGestureScroll)==null||M.call(S,{deltaY:r,lines:p,viewportY:od(o),scrollTop:(w==null?void 0:w.scrollTop)??null,scrollHeight:(w==null?void 0:w.scrollHeight)??null,clientHeight:(w==null?void 0:w.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:x,scrollMode:y}),l!=null&&l.cancelable&&((E=l.preventDefault)==null||E.call(l))}endGesture(n,l){var h,m,p;this.clearLongPressTimer();const o=this.options.getTerminal(),r=this.options.getIsController(),u=fs(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)&&((m=(h=this.options).onFocus)==null||m.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&&((p=l.preventDefault)==null||p.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=fs(n);if(this.state==="dragging"&&o&&l&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);Vy(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 B5({container:a,term:n,isTouchDevice:l,debug:o,getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:m,getSelection:p,onFocus:g}){const y=new H5({getTerminal:r,getIsController:u,getScale:h,getSurfaceElement:m,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:q,moved:te,bufferType:Z,baseY:ie,cursorY:re,hasScrollback:P,mouseTracking:A,scrollMode:G})=>{o==null||o(Q=>({...Q,deltaY:j,lines:D,viewportY:_,scrollTop:z,scrollHeight:K,clientHeight:q,moved:te,focused:document.activeElement===n.textarea,bufferType:Z,baseY:ie,cursorY:re,hasScrollback:P,mouseTracking:A,scrollMode:G,scrollCalls:Q.scrollCalls+(D!==0?1:0),lastScrollLines:D}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:l?j=>p().handleLongPress(j):void 0,onSelectionExtend:l?j=>p().handleSelectionExtend(j):void 0}),v=typeof window<"u"&&"PointerEvent"in window,x=typeof TouchEvent<"u",w=[],S={passive:!1,capture:!0},M=(j,D)=>{document.addEventListener(j,D,S),w.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=p();return D.hasOpenMenu()?(D.clearSelection(),j.cancelable&&j.preventDefault(),j.stopPropagation(),!0):!1},R=()=>{y.getState()==="longpress"&&p().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"),p().clearSelection(),y.handlePointerCancel(j),j.pointerType!=="mouse"&&j.stopPropagation())}),x){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"),p().clearSelection(),j.stopPropagation(),y.handleTouchCancel())});const H=j=>{j.preventDefault()};return a.addEventListener("contextmenu",H),w.push(()=>a.removeEventListener("contextmenu",H)),()=>{y.handlePointerCancel();for(const j of w)j()}}function U5(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 K5({containerRef:a,surfaceRef:n,termRef:l,rendererRef:o,currentScaleRef:r,initialBannerWrittenRef:u,live:h,selection:m,prediction:p,fit:g,isTouchDevice:y,debug:v,terminalFontSize:x,terminalFontFamily:w,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:q}=g;T.useEffect(()=>{var it,tt;if(!a.current||!n.current)return;const Z=a.current,ie=Ed(Z,il(),cd()),re=oa(null,rl),P=Dy({width:ie.width,height:ie.height,cellWidth:re.cellWidth,cellHeight:re.cellHeight});h.current.sendResize(P.cols,P.rows),K(ie);const A=R5({fontSize:ig(x,ie.width),fontFamily:w,theme:h.current.hostTheme,cols:P.cols,rows:P.rows});A.open(n.current),l.current=A;const G=A.onTitleChange(de=>{H(Sd(de)||null)}),{screenState:Q,fieldProbe:se,overlay:W}=p.attach(A);y&&A.textarea&&(A.textarea.readOnly=!1,A.textarea.tabIndex=0,A.textarea.inputMode="text");let be=()=>{};if(v&&A.textarea){const de=()=>{v(Re=>({...Re,focused:document.activeElement===A.textarea}))};A.textarea.addEventListener("focus",de),A.textarea.addEventListener("blur",de),be=()=>{var Re,Xe;(Re=A.textarea)==null||Re.removeEventListener("focus",de),(Xe=A.textarea)==null||Xe.removeEventListener("blur",de)},de()}const xe=async de=>{p.discard("paste");const Re=wy(de);if(Re){if(de.preventDefault(),de.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Re)}};(it=A.textarea)==null||it.addEventListener("paste",xe),Z.addEventListener("paste",xe);const ue=A5(A,{isSynchronizing:Q.isSynchronizing,onRendererSwapped:de=>{var Re;Z.dataset.renderer=de,j(de),(Re=p.overlayRef.current)==null||Re.attach(null),ta(A)}});W.attach(ue.canvas),(tt=ue.canvas)==null||tt.setTypingZoneProvider(()=>{const de=se.detect();return de&&{row:de.row,startCol:de.startCol,endCol:de.endCol}});const Te=Q.onSyncEnd(()=>{var de,Re;return(Re=(de=o.current)==null?void 0:de.canvas)==null?void 0:Re.flushHeld()});if(o.current=ue,Z.dataset.renderer=ue.kind,j(ue.kind),E5(A,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),u.current=!0,A.write("",()=>void ue.verify()),!y)try{A.focus()}catch{}const ce=typeof document<"u"?document.fonts:void 0;typeof(ce==null?void 0:ce.load)=="function"&&ce.load('13px "Symbols Nerd Font Mono"').then(()=>{l.current&&(ta(l.current),_(5))}).catch(()=>{});const ye=A.onData(de=>{const{isController:Re}=h.current;let Xe=de;if(Re&&_y(de)==="keys"&&Dx(de)){const ht=h.current.consumeModifierLatch();ht&&(Xe=ur(de,ht))}const gt=_d(Xe);if(!Re&&!hr(gt)){h.current.warnViewerMode();return}p.onUserInput(gt),h.current.sendBinary(gt)}),ae=A.onBinary(de=>{const Re=new Uint8Array(de.length);for(let Xe=0;Xe<de.length;Xe++)Re[Xe]=de.charCodeAt(Xe)&255;!h.current.isController&&!hr(Re)||h.current.sendBinary(Re)}),ve=typeof A.onWriteParsed=="function"?A.onWriteParsed(()=>{var ht;if(m.current.onTerminalContentChanged(),se.invalidate(),Q.isSynchronizing())return;const de=A.buffer.active,Re=de.baseY+de.cursorY,Xe=Array.from({length:8},(gn,bn)=>{var kt;return((kt=de.getLine(Re-7+bn))==null?void 0:kt.translateToString(!0))??""}),gt=jw(Xe,h.current.platform);gt&&h.current.reportShellProfile(gt),(ht=p.predictorRef.current)==null||ht.onServerOutput(),p.sync()}):{dispose:()=>{}},le=typeof A.onRender=="function"?A.onRender(de=>{var Re;if(h.current.glyphScan){const Xe=A.buffer.active.viewportY??0;let gt="";for(let ht=de.start;ht<=de.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)}m.current.onTerminalRender(A,de.start,de.end)}):{dispose:()=>{}},we=typeof A.onScroll=="function"?A.onScroll(()=>{m.current.onTerminalScroll(A),p.discard("scroll")}):{dispose:()=>{}},Ee=B5({container:Z,term:A,isTouchDevice:y,debug:v,getTerminal:()=>l.current,getIsController:()=>h.current.isController,getScale:()=>r.current,getSurfaceElement:()=>n.current,getSelection:()=>m.current,onFocus:()=>{var de,Re;return(Re=(de=h.current).onTerminalFocus)==null?void 0:Re.call(de)}}),Be=U5(Z,{requestFit:D,onPageVisible:()=>{_(10),ta(l.current)}});return()=>{var de;ye.dispose(),ae.dispose(),le.dispose(),we.dispose(),ve.dispose(),G.dispose(),Te.dispose(),p.detach(),Q.dispose(),Ee(),Be(),q(),be(),(de=A.textarea)==null||de.removeEventListener("paste",xe),Z.removeEventListener("paste",xe),ue.dispose(),o.current=null,A.dispose(),l.current=null}},[]),T.useEffect(()=>{const Z=l.current;if(!Z)return;const ie=Ed(a.current,il(),cd()),re=ig(x,ie.width),P=Z.options.fontSize!==re||Z.options.fontFamily!==w;Z.options.fontSize=re,Z.options.fontFamily=w,ta(Z),P&&z(),_(10)},[x,w]),T.useEffect(()=>{var ie,re;const Z=l.current;!Z||!M||((re=(ie=o.current)==null?void 0:ie.canvas)==null||re.clearTextureAtlas(),ta(Z))},[M]);const te=T.useRef(E);T.useEffect(()=>{var ie;if(te.current===E)return;te.current=E,p.forget("resetVersion");const Z=l.current;if(Z)try{(ie=Z.reset)==null||ie.call(Z),Z.clear(),Z.refresh(0,Math.max(0,Z.rows-1))}catch{}},[E]),T.useEffect(()=>{const Z=l.current;!Z||!S||(Z.options.theme={...S},ta(Z))},[S]),T.useEffect(()=>N(ie=>{const re=l.current;if(!re)throw new Error("terminal not ready");re.write(ie),R==null||R(ie.byteLength)}),[N,l,R]),T.useEffect(()=>{if(!k)return;_(10);const Z=l.current;if(Z&&(ta(Z),!y))try{Z.focus()}catch{}},[k,y,_,l])}const I5=({onTerminalFocus:a,isActive:n=!0})=>{var bn;const l=T.useRef(null),o=T.useRef(null),r=T.useRef(null),u=T.useRef(null),h=T.useRef(null),m=T.useRef(1),p=T.useRef(null),g=T.useRef(!1),y=tw(),v=y||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,x=rC(),[w,S]=T.useState(oC),{metrics:M,record:E}=cC(x),[k,N]=T.useState(null),{settings:R,terminalFontFamily:H,terminalFontSize:j,hostFont:D,ensureHostGlyphs:_,profiles:z,activeProfileId:K,t:q}=Ae(),{isController:te,connectionState:Z,hostPalette:ie,terminalResetVersion:re,agentStatus:P,platform:A,reportShellProfile:G,connect:Q,rttMs:se}=et(),{addToast:W}=Zt(),{sendResize:be,sendBinary:xe,observeKeyInput:ue,consumeModifierLatch:Te,warnViewerMode:ce,subscribeToOutput:ye,subscribeToPasteFileReady:ae}=Ts(),{uploadImage:ve}=Cr(),le=Qn.useMemo(()=>dw(ie),[ie]),we=Zn({isController:te,sendBinary:xe,sendResize:be,warnViewerMode:ce,uploadImage:ve,t:q,consumeModifierLatch:Te,hostTheme:le,onTerminalFocus:a,ensureHostGlyphs:_,glyphScan:D.glyphs.status==="ready",platform:A,reportShellProfile:G}),Ee=Zn(n),Be=mT({termRef:h,rendererRef:p,mode:R.predictiveEcho,connectionState:Z,observeKeyInput:ue}),[it,tt]=T.useState(null),de=_T({termRef:h,surfaceRef:r,mainRef:u,currentScaleRef:m,addToast:W,t:q}),Re=Zn(de),Xe=mC({termRef:h,isController:te,warnViewerMode:ce,uploadImage:ve,addToast:W,t:q,onPaste:()=>Be.discard("paste"),subscribeToPasteFileReady:ae}),gt=ST({termRef:h,containerRef:l,frameRef:o,surfaceRef:r,currentScaleRef:m,rendererRef:p,initialBannerWrittenRef:g,isActiveRef:Ee,sendResize:be,onResized:()=>Be.forget("resize")});K5({containerRef:l,surfaceRef:r,termRef:h,rendererRef:p,currentScaleRef:m,initialBannerWrittenRef:g,live:we,selection:Re,prediction:Be,fit:gt,isTouchDevice:y,debug:x?S:null,terminalFontSize:j,terminalFontFamily:H,hostTheme:le,glyphRevision:D.glyphRevision,terminalResetVersion:re,isActive:n,subscribeToOutput:ye,onOutput:x?E:null,onTitle:tt,onRendererKind:N});const ht=Qn.useMemo(()=>{var kt;return((kt=z.find(Oi=>Oi.id===K))==null?void 0:kt.displayName)??null},[z,K]);T.useEffect(()=>{Z!=="connected"&&tt(null)},[Z]),T.useEffect(()=>{const kt=n&&Z==="connected",Oi=R.agentAlertBadge?xs(P):null;qS(kt?it:null,ht,Oi)},[n,Z,it,ht,P,R.agentAlertBadge]),T.useEffect(()=>{Z==="disconnected"&&Q()},[]);const gn=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:gn,"aria-label":q("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:gn,"aria-label":q("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%"}})})}),x&&f.jsx(hC,{debug:w,rttMs:se,metrics:M,rendererKind:k,predictiveEcho:R.predictiveEcho,predictor:Be.predictorRef.current,field:((bn=Be.fieldProbeRef.current)==null?void 0:bn.detect())??null,renderer:p.current}),y&&de.selectionRect&&de.isHighlightVisible&&f.jsx(RT,{term:h.current,surface:r.current,main:u.current,rect:de.selectionRect,viewportY:de.viewportY}),y&&de.selectionMenu&&f.jsx(sC,{anchorPoint:de.selectionMenu,hasSelection:!!de.selectionSnapshot,isController:te,vibrateOnKeyPress:R.vibrateOnKeyPress,linkUrl:de.selectionMenu.link??null,onOpenLink:kt=>{Cd(kt)||W("warning",q("clipboard.openLinkFailed"))},onCopySelection:de.handleCopySelection,onCopyLine:de.handleCopyLine,onCopyScreen:de.handleCopyScreen,onPaste:Xe.handlePaste,onClose:de.clearSelection}),y&&f.jsx(lC,{isOpen:Xe.isPasteFallbackOpen,onClose:Xe.closePasteFallback,onSend:Xe.handleFallbackPasteSend,onSendImage:Xe.handleFallbackImageSend})]})},F5=2e3;function Gd(){const{t:a}=Ae(),{addToast:n}=Zt(),[l,o]=T.useState(null),r=T.useRef(null);T.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const u=T.useCallback((h,m,p="success")=>{Kd(h).then(g=>{if(g==="failed"){n("error",a("clipboard.copyFailed"));return}o(h),n(p,m),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>o(null),F5)})},[n,a]);return{copied:l,copy:u}}const ia="herdr-remote pair",nb="herdr-remote",G5=({onPairedSuccess:a})=>{const{settings:n,updateSettings:l,t:o}=Ae(),{connect:r,connectionState:u,stateDetail:h}=et(),{addToast:m}=Zt(),[p,g]=T.useState(""),{copied:y,copy:v}=Gd(),[x,w]=T.useState(!1),[S,M]=T.useState(n.wsUrl||jt),[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=p.trim().toUpperCase();if(!K&&!E.trim()){m("warning",o("toasts.connectionError"));return}const q={pairCode:K,wsUrl:S.trim()||jt,clientId:N.trim()||n.clientId};E.trim()&&(q.token=E.trim()),l(q),r({pairCode:K||void 0,token:E.trim()||void 0,wsUrl:S.trim()||jt,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?Ne.check:"⧉",className:ne("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(nb),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:nb})})]})})]})}),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:p,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(sa,{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:()=>w(!x),"aria-expanded":x,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:x?Ne.chevronDown:Ne.chevronRight}),f.jsx("span",{className:"uppercase",children:o("onboarding.advancedTitle")})]}),x&&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(zS,{}),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)})]})]})]})]})]})})},Jn="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",Y5="border-tui-accent bg-tui-accent text-tui-crust font-bold",P5="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 V5(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}=Ae(),{agentProfile:u,shellProfile:h}=et(),m=Wx(u,o.agentKeymaps[u],h),p=y=>{let v="";try{v=us(y.combo)}catch{}const x=y.custom?y.customLabel||"":r(`agentActions.${y.labelKey}`),w=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:ne(Jn,a,"max-w-[10rem] gap-1 px-1.5",qy[w]),title:`${v} ${x}`.trim(),"aria-label":`${v} ${x}`.trim(),children:[f.jsx("span",{className:"font-bold",children:v}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:x})]},y.id)},g=[...m.agentActions,...m.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(p),n&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:n,className:ne(Jn,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 Xy="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(oe[o]),className:ne(Jn,Ms,a),children:["F",l]},o)})})}const X5=[{code:oe.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:oe.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:oe.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:oe.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:oe.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:oe.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:oe.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:oe.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function Z5({capHeight:a,onKey:n}){const{t:l}=Ae();return f.jsx("div",{className:Xy,children:X5.map(o=>f.jsxs("button",{type:"button",onClick:()=>n(o.code,!1),className:ne(Jn,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 W5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function Q5({squareKeyClass:a,onKey:n}){return f.jsx("div",{className:Xy,children:W5.map(l=>f.jsx("button",{type:"button",onClick:()=>n(l,!0),className:ne(Jn,Ms,a,"font-bold"),children:l},l))})}const ib="image/png,image/jpeg,image/webp,image/gif,image/*";function ab({fileInputRef:a}){const{uploadImage:n}=Cr(),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:ib,className:"hidden","data-testid":"key-toolbar-file-input",onChange:l}),f.jsx("input",{type:"file",accept:ib,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:l})]})}function lb({collapsed:a}){const{uploadProgress:n}=Cr();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(KS,{ratio:n.ratio,label:n.statusText,tone:n.phase==="completed"?"ok":n.phase==="error"?"bad":"accent","aria-label":n.statusText})}):null}function J5({fileInputRef:a,keyClass:n,vibrate:l}){const{t:o}=Ae(),{isController:r}=et(),{warnViewerMode:u}=Ts(),{uploadProgress:h}=Cr(),m=h.active,p=()=>{var g;if(l(),!r){u();return}m||(g=a.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:p,disabled:m,className:ne(Jn,n,m?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Ms),title:m?h.statusText:o("virtualKeyboard.uploadImageTitle"),"aria-label":o("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:m?`${h.percent}%`:o("virtualKeyboard.image")})})}function eM(){const{settings:a}=Ae(),{isController:n}=et(),{sendKey:l,warnViewerMode:o,consumeModifierLatch:r}=Ts(),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]),m=T.useCallback((g,y=!0)=>{if(h(),!n){o();return}const v=r();l(y&&v?ur(g,v):g)},[n,l,o,h,r]),p=T.useCallback(g=>{if(h(),!n){o();return}let y;try{y=Mn(g)}catch{return}if(r(),y.length===1){l(y[0]);return}y.forEach((v,x)=>{const w=setTimeout(()=>{u.current=u.current.filter(S=>S!==w),l(v)},x*120);u.current.push(w)})},[r,n,l,h,o]);return{vibrate:h,pressKey:m,sendCombo:p}}function tM({capHeight:a}){const{platform:n,adminTerminalSupported:l,adapter:o}=et(),{t:r}=Ae();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:ne(Jn,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 nM=({compact:a=!1,onCustomize:n})=>{const{settings:l,updateSettings:o,t:r}=Ae(),{modifierLatch:u,toggleModifierLatch:h}=Ts(),{vibrate:m,pressKey:p,sendCombo:g}=eM(),{capHeight:y,keyClass:v,squareKeyClass:x,drawerToggleClass:w}=V5(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(ab,{fileInputRef:S}),f.jsx(lb,{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):Ib,q=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}),te=P=>{if(m(),P.type==="modifier"){P.modifierType==="ctrl"||P.modifierType==="alt"||P.modifierType==="shift"?h(P.modifierType):P.modifierType==="meta"&&p(oe.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}p(P.code,P.type!=="chord")},Z=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=Z(P),G=["left","up","down","right"].includes(P.id),Q=P.type==="drawer",se=pd(P,r);return f.jsx("button",{type:"button",onClick:()=>te(P),className:ne(Jn,G?x:Q?w:v,P.id==="enter"?P5:A?Y5:Ms),title:se,"aria-label":se,"aria-pressed":A,children:q(P)},P.id)},re=K.find(P=>P.id==="enter");return f.jsxs("div",{"data-testid":"key-toolbar",className:ne("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(ab,{fileInputRef:S}),f.jsx(lb,{collapsed:!1}),M&&f.jsx(q5,{capHeight:y,onKey:p}),R&&f.jsx(Z5,{capHeight:y,onKey:p}),k&&f.jsx(Q5,{squareKeyClass:x,onKey:p}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("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:ne(Jn,x,"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(tM,{capHeight:y}),f.jsx($5,{capHeight:y,onCustomize:n,sendCombo:g}),f.jsx(J5,{fileInputRef:S,keyClass:v,vibrate:m})]}),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"})]}),re&&ie(re)]})]})},iM=({isOpen:a,onClose:n})=>{const{t:l}=Ae(),{isController:o,shellProfile:r}=et(),{sendKey:u,warnViewerMode:h}=Ts(),[m,p]=T.useState("");if(!a)return null;const g=Ow(r),y=x=>{if(x&&x.preventDefault(),!o){h();return}m.length>0?(u(`${m}\r`),p("")):u("\r")},v=x=>{if(!o){h();return}u(`${x}\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(x=>f.jsx("button",{type:"button",onClick:()=>v(x),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:x},x))}),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:m,onChange:x=>p(x.target.value),placeholder:l("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),m.length>0&&f.jsx("button",{type:"button",onClick:()=>p(""),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:Ne.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 Zy=({hint:a,children:n})=>{const{t:l}=Ae(),[o,r]=T.useState(!1);return f.jsxs("div",{className:"border border-tui-border-dim",children:[f.jsxs("button",{type:"button",onClick:()=>r(!o),"aria-expanded":o,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:o?Ne.chevronDown:Ne.chevronRight}),f.jsx("span",{children:l("pairing.advancedTitle")}),f.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint",children:a})]}),o&&f.jsx("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:n})]})},aM=({isOpen:a,onClose:n})=>{const{settings:l,updateSettings:o,t:r,activeProfile:u,activeProfileId:h,renameProfile:m}=Ae(),{connect:p,disconnect:g,connectionState:y,hostId:v}=et(),{addToast:x}=Zt(),[w,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);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 K=te=>{te.preventDefault();const Z={wsUrl:w.trim()||jt,token:M.trim(),pairCode:k.trim().toUpperCase(),clientId:R.trim()||l.clientId,autoReconnect:_};if(!Z.token&&!Z.pairCode){x("warning",r("pairing.credentialsRequired"));return}o(Z),h&&j.trim()&&m(h,j),g(),p({wsUrl:Z.wsUrl,token:Z.token||void 0,pairCode:Z.pairCode||void 0,clientId:Z.clientId,autoReconnect:_}),n()},q=Ar(y,r);return f.jsxs(ul,{isOpen:a,onClose:n,title:r("pairing.title"),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 min-w-0 items-center gap-1.5 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsx(dn,{level:q.level}),f.jsx("span",{className:"shrink-0 text-tui-text",children:q.label}),v&&f.jsxs("span",{className:"truncate text-tui-muted",children:["· ",v]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:K,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:te=>D(te.target.value),placeholder:r("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(un,{htmlFor:"pairing-code",hint:r("pairing.repairNote"),children:r("pairing.pairCodeLabel")}),f.jsx(vt,{id:"pairing-code",type:"text",value:k,onChange:te=>N(te.target.value.toUpperCase()),placeholder:r("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",className:"uppercase"})]}),f.jsxs(Zy,{hint:r("pairing.editAdvancedHint"),children:[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:w,onChange:te=>S(te.target.value),placeholder:r("pairing.wsUrlPlaceholder")})]}),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:te=>E(te.target.value),placeholder:r("pairing.tokenPlaceholder")})]}),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:te=>H(te.target.value),className:"flex-1"}),f.jsx(Me,{onClick:()=>H(`client-${Math.random().toString(36).substring(2,8)}`),className:"shrink-0",children:r("pairing.newIdButton")})]})]}),f.jsx(BS,{checked:_,onChange:z,label:r("pairing.autoReconnectLabel")})]})]})]})},lM=({isOpen:a,onClose:n})=>{const{t:l,addProfileAndConnect:o}=Ae(),{addToast:r}=Zt(),[u,h]=T.useState(""),[m,p]=T.useState(jt),[g,y]=T.useState("");T.useEffect(()=>{a&&(h(""),p(jt),y(""))},[a]);const v=x=>{x.preventDefault();const w=u.trim().toUpperCase();if(!w&&!g.trim()){r("warning",l("pairing.credentialsRequired"));return}o({wsUrl:m.trim()||jt,pairCode:w,token:g.trim()}),n()};return f.jsx(ul,{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:v,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:x=>h(x.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(Zy,{hint:l("pairing.advancedHint"),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:m,onChange:x=>p(x.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:g,onChange:x=>y(x.target.value),placeholder:l("onboarding.manualTokenPlaceholder")})]})]})]})})},ki=ne(Mr,"py-0"),sM="h-7 py-0",Nd="h-7 py-0 px-1.5",wr="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 Wy(a){return{offLabel:a("settings.toggleOff"),onLabel:a("settings.toggleOn")}}const rM=({profile:a,onProfileChange:n})=>{const{settings:l,updateSettings:o,t:r}=Ae(),{agentProfile:u}=et(),[h,m]=T.useState({}),p=T.useRef({}),[g,y]=T.useState(""),[v,x]=T.useState(""),w=a||u,S=l.agentKeymaps[w]||{},M=Sb(w,S),E=Cb(w,S),k=E.filter(A=>!A.hidden).length,N=A=>A.custom?A.customLabel||"":r(`agentActions.${A.labelKey}`),R=A=>{try{return us(A.combo)}catch{return A.combo}},H=A=>{o({agentKeymaps:{...l.agentKeymaps,[w]:A}})},j=(A,G)=>{var Q;H({...S,actions:{...S.actions,[A]:{...(Q=S.actions)==null?void 0:Q[A],...G}}})},D=A=>{j(A.id,{keys:A.defaultCombo})},_=(A,G)=>{const Q=A+(G==="up"?-1:1);if(Q<0||Q>=M.length)return;const se=M.map(W=>W.id);[se[A],se[Q]]=[se[Q],se[A]],H({...S,order:se})},z=A=>{var G;H({...S,custom:(S.custom||[]).filter(Q=>Q.id!==A),order:(G=S.order)==null?void 0:G.filter(Q=>Q!==A)})},K=()=>H(Qx(S)),q=()=>{const A={...l.agentKeymaps};delete A[w],o({agentKeymaps:A})},te=()=>{const A=g.trim();if(!A)return;try{Mn(v)}catch{return}const G=`custom-${Date.now().toString(36)}`;H({...S,custom:[...S.custom||[],{id:G,label:A,keys:v.trim()}],order:[...M.map(Q=>Q.id),G]}),y(""),x("")},Z=A=>A instanceof Tn?r(`agentKeymaps.errors.${A.code}`,A.params):String(A),ie=(A,G)=>`${A}:${G}`,re=(A,G)=>{const Q=ie(w,A);p.current={...p.current,[Q]:G},m(p.current);try{Mn(G),j(A,{keys:G})}catch{}},P=A=>{const G=ie(w,A),Q=p.current[G];if(Q!==void 0){delete p.current[G],m({...p.current});try{Mn(Q),j(A,{keys:Q})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(pn,{title:r("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Me,{variant:"ghost",onClick:q,className:ne(wr,Nd),children:r("agentKeymaps.restoreProfile")}),children:f.jsx(It,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:na[w].configHint?r("agentKeymaps.configHint",{path:na[w].configHint}):void 0,control:f.jsx(Tr,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:w,onChange:A=>n(A.target.value),className:ki,children:Ix.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:ne(wr,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[w].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 G=N(A),Q=R(A),se=!A.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${A.id}`,"aria-pressed":se,onClick:()=>j(A.id,{hidden:se}),title:`${Q} ${G}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",se?"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:se?Ne.check:"+"}),f.jsx("span",{className:"font-bold",children:Q}),f.jsx("span",{className:se?void 0:"opacity-80",children:G})]},A.id)})})]})}),f.jsx(pn,{title:r("agentKeymaps.listGroup",{profile:na[w].name}),children:M.map((A,G)=>{var ce,ye;const Q=N(A),se=r("agentKeymaps.defaultCombo",{combo:us(A.defaultCombo)}),W=((ye=(ce=S.actions)==null?void 0:ce[A.id])==null?void 0:ye.keys)??A.combo,be=ie(w,A.id),xe=h[be]??W;let ue="",Te=null;try{Mn(xe),ue=us(xe)}catch(ae){Te=Z(ae)}return f.jsxs("div",{"data-testid":`agent-setting-row-${A.id}`,className:oM,children:[f.jsx(yy,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:ue||"—"}),f.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:Q,children:[Q,!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")," ",Q]}),f.jsx(vt,{id:`agent-combo-${A.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${Q}`,value:xe,onChange:ae=>re(A.id,ae.target.value),onBlur:()=>P(A.id),onKeyDown:ae=>{ae.key==="Enter"&&ae.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Te,className:ne("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:se,children:se}),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")} ${Q}`,children:"↺"}),f.jsx(aa,{disabled:G===0,onClick:()=>_(G,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${Q}`,children:"↑"}),f.jsx(aa,{disabled:G===M.length-1,onClick:()=>_(G,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${Q}`,children:"↓"}),A.custom?f.jsx(aa,{variant:"danger",onClick:()=>z(A.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${Q}`,children:Ne.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=>x(A.target.value),placeholder:r("agentKeymaps.comboPlaceholder"),className:ki})]}),f.jsx(Me,{variant:"primary",glyph:"+",onClick:te,disabled:!g.trim()||!v.trim(),className:ki,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return Mn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:us(v)})}catch(A){const G=Z(A);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:G})}})()]})})]})},Qy={"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}=Ae(),{herdrLaunch:h,hostname:m}=et(),{addToast:p}=Zt(),{font:g,status:y,glyphs:v}=a,x=y==="loading"||v.status==="loading",w=y==="failed"||v.status==="failed",S=T.useRef(!1);T.useEffect(()=>{S.current&&!x&&!w&&a.interactive&&p("success",u("hostFont.loaded")),S.current=x&&a.interactive},[x,w,a.interactive,p,u]);const M=y==="available"||v.status==="available",E=a.interactive&&(x||w);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=m||(r==null?void 0:r.displayName)||u("herdrLaunch.thisHost"),j=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?Qy[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})}),x?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(US,{value:_,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:u("hostFont.loading",{received:$u(a.receivedBytes),total:$u(a.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[w?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:$u(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(w?"common.retry":"hostFont.load")})]})]})]})})},dM=({onOpenAdmin:a})=>{var j;const{settings:n,updateSettings:l,language:o,setLanguage:r,t:u,hostFont:h,syncHostFont:m,terminalFontFamily:p,terminalFontSize:g}=Ae(),{connectionState:y}=et(),v=ud.find(D=>D.id===n.fontFamily),x=(D,_)=>D==="host"||D==="system"?u(`fontPresets.${D}`):_,w=(()=>{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?Qy[D.source]||D.source:null,K].filter(Boolean).join(" · "):K})(),S=(j=h.font)!=null&&j.sizePx?al(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=Wy(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(It,{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(It,{label:u("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(Tr,{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:x(D.id,D.name)},D.id))]})}),n.fontFamily==="host"&&f.jsx(It,{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:w}),M?f.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:M}):null]}),control:f.jsx(Me,{block:!0,onClick:m,disabled:y!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:ki,children:u("settings.hostFontSync")})}),f.jsx(It,{label:u("settings.fontSizeLabel",{size:g}),hint:u("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:ne("flex items-center",Mr),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(It,{label:H,control:f.jsx(Ni,{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:p,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(It,{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(It,{label:u("settings.touchKeyToolbar"),hint:u("settings.touchKeyToolbarDesc"),control:f.jsx(Ni,{label:u("settings.touchKeyToolbar"),...R,checked:n.toolbarVisible,onChange:D=>l({toolbarVisible:D})})}),f.jsx(It,{label:u("settings.touchHaptics"),hint:u("settings.touchHapticsDesc"),control:f.jsx(Ni,{label:u("settings.touchHaptics"),...R,checked:n.vibrateOnKeyPress,onChange:D=>l({vibrateOnKeyPress:D})})})]}),f.jsxs(pn,{title:u("settings.agentAlertsLabel"),children:[f.jsx(It,{label:u("settings.agentAlertBadge"),hint:u("settings.agentAlertBadgeDesc"),control:f.jsx(Ni,{label:u("settings.agentAlertBadge"),...R,checked:n.agentAlertBadge,onChange:D=>l({agentAlertBadge:D})})}),f.jsx(It,{label:u("settings.agentAlertVibrate"),hint:u("settings.agentAlertVibrateDesc"),control:f.jsx(Ni,{label:u("settings.agentAlertVibrate"),...R,checked:n.agentAlertVibrate,onChange:D=>l({agentAlertVibrate:D})})}),f.jsx(It,{label:u("settings.agentAlertSound"),hint:u("settings.agentAlertSoundDesc"),control:f.jsx(Ni,{label:u("settings.agentAlertSound"),...R,checked:n.agentAlertSound,onChange:D=>{l({agentAlertSound:D}),D&&(Qb(),Jb("done"))}})}),E&&f.jsx(It,{label:u("settings.agentAlertNotify"),hint:u("settings.agentAlertNotifyDesc"),control:f.jsx(Ni,{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(It,{label:u("settings.adminEntry"),hint:u("settings.adminEntryHint"),control:f.jsx(Me,{block:!0,variant:"primary",glyph:Ne.arrowRight,onClick:a,className:ki,children:u("settings.adminEntryOpen")})})})]})},fM=()=>{const{settings:a,updateSettings:n,t:l}=Ae(),{addToast:o}=Zt(),[r,u]=T.useState(!1),h=Wy(l),m=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys:vs(),p=w=>{const S=m.map(M=>M.id===w?{...M,enabled:!M.enabled}:M);n({virtualKeys:S})},g=(w,S)=>{const M=S==="up"?w-1:w+1;if(M<0||M>=m.length)return;const E=[...m],k=E[w];E[w]=E[M],E[M]=k,n({virtualKeys:E})},y=w=>{if(m.some(M=>M.id===w.id)){const M=m.map(E=>E.id===w.id?{...E,enabled:!0}:E);n({virtualKeys:M})}else{const M=[...m,{...w,enabled:!0}];n({virtualKeys:M})}u(!1)},v=w=>{const S=m.filter(M=>M.id!==w);n({virtualKeys:S})},x=()=>{n({virtualKeys:vs()}),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:x,className:ne(wr,Nd),children:l("virtualKeyboard.resetLayout")}),children:m.map((w,S)=>{const M=pd(w,l);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(yy,{className:ne("w-16 shrink-0 truncate",!w.enabled&&"opacity-50"),children:w.label}),f.jsx("span",{className:ne("min-w-0 flex-1 break-words text-tui",w.enabled?"text-tui-text":"text-tui-faint"),children:M}),f.jsx(Ni,{label:`${l("virtualKeyboard.enableKey")} ${w.label}`,...h,checked:w.enabled,onChange:()=>p(w.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===m.length-1,onClick:()=>g(S,"down"),title:l("virtualKeyboard.moveDown"),"aria-label":l("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(aa,{variant:"danger",onClick:()=>v(w.id),title:l("virtualKeyboard.deleteKeyTitle"),"aria-label":l("virtualKeyboard.deleteKeyTitle"),children:Ne.cross})]},w.id)})}),f.jsx(Me,{block:!0,glyph:"+",onClick:()=>u(!r),className:ne("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:b1.map(w=>{const S=m.some(M=>M.id===w.id);return f.jsxs("button",{type:"button",onClick:()=>y(w),title:pd(w,l),className:ne("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:w.label}),f.jsx("span",{"aria-hidden":"true",className:S?"text-tui-ok":"text-tui-accent",children:S?Ne.check:"+"})]},w.id)})})})]})},hM=({isOpen:a,onClose:n,initialTab:l,onOpenAdmin:o})=>{const{updateSettings:r,t:u,activeProfile:h}=Ae(),{addToast:m}=Zt(),[p,g]=T.useState("general"),[y,v]=T.useState(null);if(T.useEffect(()=>{!a||!l||(g(l),v(null))},[a,l]),!a)return null;const x=()=>{const w=Yb();r({fontSize:w.fontSize,fontSizeFollowsHost:w.fontSizeFollowsHost,fontFamily:w.fontFamily,toolbarVisible:w.toolbarVisible,vibrateOnKeyPress:w.vibrateOnKeyPress,predictiveEcho:w.predictiveEcho,agentAlertBadge:w.agentAlertBadge,agentAlertSound:w.agentAlertSound,agentAlertVibrate:w.agentAlertVibrate,agentAlertNotify:w.agentAlertNotify,virtualKeys:w.virtualKeys}),m("info",u("settings.resetDefaultsToast"))};return f.jsxs(ul,{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:x,className:wr,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:p,onSelect:w=>g(w),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&f.jsx(dM,{onOpenAdmin:o}),p==="virtualKeys"&&f.jsx(fM,{}),p==="agentKeymaps"&&f.jsx(rM,{profile:y,onProfileChange:v})]})},mM={success:"ok",warning:"warn",error:"bad",info:"accent"},pM={success:Ne.check,warning:Ne.warn,error:Ne.cross,info:"›"},gM=()=>{const{t:a}=Ae(),{toasts:n,removeToast:l}=Zt();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:ne("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:ne("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:Ne.cross})})]},o.id)})})},Jy=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function bM(a){return a?a.total>0||Jy.some(({status:n})=>{var l;return(((l=a.counts)==null?void 0:l[n])??0)>0}):!1}const e0=({className:a,compact:n=!1})=>{const{t:l}=Ae(),{agentStatus:o}=et();if(!o)return null;const r=Jy.map(({status:h,level:m})=>{var p;return{status:h,level:m,count:((p=o.counts)==null?void 0:p[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:ne("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:ne("flex shrink-0 items-center gap-2 px-1",a),title:l("agents.title"),children:u.map(({status:h,level:m,count:p})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(dn,{level:m}),f.jsx("span",{className:"text-tui-text",children:p}),f.jsx("span",{className:"text-tui-faint",children:l(`agents.${h}`)})]},h))})},Yd=({onAddProfile:a,mobile:n=!1,statusBar:l=!1})=>{const{profiles:o,activeProfileId:r,activeProfile:u,switchProfile:h,renameProfile:m,removeProfile:p,t:g}=Ae(),{connectionState:y}=et(),[v,x]=T.useState(!1),[w,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)&&x(!1)};return document.addEventListener("pointerdown",_),()=>document.removeEventListener("pointerdown",_)},[v]);const N=(_,z)=>{S(_),E(z)},R=_=>{const z=M.trim();z&&m(_,z),S(null)},H=_=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(p(_),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:ne("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:()=>x(_=>!_),className:ne("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:ne("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?Ne.chevronDown:Ne.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":g("profiles.switcherLabel"),className:ne("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===w;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),x(!1)},className:ne("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?Ne.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:Ne.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:q=>E(q.target.value),onKeyDown:q=>{q.key==="Enter"&&R(_.id),q.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:()=>{x(!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")})]})]})]})},t0=({compact:a=!1,className:n})=>{const{settings:l,updateSettings:o,t:r}=Ae(),{connectionState:u,sharedWindowCount:h,assignedClientId:m}=et(),p=l.observerMode,g=f.jsx(xd,{name:"control-mode","aria-label":r("role.modeLabel"),value:p?"observe":"control",onChange:y=>o({observerMode:y==="observe"}),tone:p?"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(p?"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,m?f.jsx(An,{label:r("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:m})}):null]})};function n0(){const{updateStatus:a,ignoredUpdate:n,hostVersion:l}=et();return l===null||!!(a!=null&&a.updateAvailable)&&n!==(a==null?void 0:a.latest)}const yM="Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*node_modules\\herdr-remote*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }",i0=({compact:a=!1,className:n})=>{const{t:l}=Ae(),{updateStatus:o}=et(),r=n0(),[u,h]=T.useState(!1);if(!r)return null;const m=o!=null&&o.updateAvailable?o:null,p=m?m.restartPending?l("update.chipRestart",{version:m.latest}):a?l("update.chipCompact",{version:m.latest}):l("update.chip",{version:m.latest}):l("update.chipOutdated");return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:l("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",n),children:p}),f.jsx(vM,{isOpen:u,onClose:()=>h(!1)})]})},la=({command:a})=>{const{t:n}=Ae(),{addToast:l}=Zt();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")})]})},vM=({isOpen:a,onClose:n})=>{const{t:l}=Ae(),{updateStatus:o,ignoreUpdate:r,hostname:u,hostId:h,platform:m}=et();if(!(o!=null&&o.updateAvailable))return f.jsx(xM,{isOpen:a,onClose:n,host:u||h,win:m==="win32"});const{current:p,installed:g,latest:y,restartPending:v,updateCommand:x}=o;return f.jsx(ul,{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(y),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(An,{label:l("common.host"),labelWidth:10,children:u||h||"—"}),f.jsx(An,{label:l("update.running"),labelWidth:10,children:p}),g!==p?f.jsx(An,{label:l("update.installed"),labelWidth:10,children:g}):null,f.jsx(An,{label:l("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:y})})]}),v?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:l("update.restartPending",{version:g})}),f.jsx(la,{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:Ne.arrowRight}),l("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:l("update.stepCli")}),x?f.jsx(la,{command:"herdr-remote update"}):f.jsxs(f.Fragment,{children:[f.jsx(la,{command:`npm install -g herdr-remote@${y} --prefer-online`}),f.jsx(la,{command:"herdr-remote restart"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:l("update.restartNote")})]})]})})},xM=({isOpen:a,onClose:n,host:l,win:o})=>{const{t:r}=Ae();return f.jsx(ul,{isOpen:a,onClose:n,title:r("update.title"),closeLabel:r("common.closeDialog"),size:"md",footer:f.jsx(Me,{variant:"primary",onClick:n,children:r("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(An,{label:r("common.host"),labelWidth:10,children:l||"—"}),f.jsx(An,{label:r("update.running"),labelWidth:10,children:f.jsx("span",{className:"text-tui-warn",children:r("update.outdatedVersion")})})]}),f.jsx("p",{className:"leading-snug text-tui-text",children:r("update.outdated")}),o?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-muted",children:r("update.windowsStop")}),f.jsx(la,{command:yM})]}):null,f.jsx(la,{command:"npm install -g herdr-remote@latest --prefer-online"}),f.jsx(la,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("update.restartNote")})]})})},wM=({onAddProfile:a=()=>{}})=>{const{settings:n,t:l}=Ae(),{connectionState:o,hostId:r,assignedClientId:u,sharedWindowCount:h,rttMs:m,agentStatus:p}=et(),g=Ar(o,l),y=o==="connected",v=n0();return f.jsx(vy,{left:f.jsxs(f.Fragment,{children:[f.jsx(Yd,{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(t0,{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(i0,{},"update"):null,y&&bM(p)?f.jsx(e0,{},"agents"):null,m!==null?f.jsxs("span",{className:"text-tui-muted",children:[l("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:l("header.tagline")},"mode")]})})},SM=({wsUrl:a,adminUrl:n,onOpenRemoteAdmin:l,onSignIn:o})=>{const{t:r}=Ae();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(An,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:a})}),f.jsx(An,{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:Ne.arrowRight,children:r("admin.openRemoteAdminBtn")}),f.jsx(Me,{onClick:o,children:r("admin.relayAdminLoginBtn")})]})]})},CM=({adminConfigured:a,isAuthError:n,tokenInput:l,onTokenInput:o,onSubmit:r,isSameOriginRelay:u,onBackToTerminal:h,showBack:m,onCancel:p})=>{const{t:g}=Ae();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&&!m?f.jsx(Me,{variant:"ghost",onClick:h,children:g("admin.returnToTerminal")}):null:f.jsx(Me,{variant:"ghost",onClick:p,children:g("common.cancel")})]})]})]})},TM=({onOpenPairing:a,onRetry:n})=>{const{t:l}=Ae(),{copied:o,copy:r}=Gd(),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?Ne.check:"⧉",className:ne("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")})]})]})},MM=[[/\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"]],AM=[[/\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 sb(a,n){for(const[l,o]of a)if(l.test(n))return o;return null}function Pd(a){const n=typeof a=="string"?a.trim():"";if(!n)return{label:"",raw:""};const l=sb(MM,n),o=sb(AM,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 tl(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 ob(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),m=o%60,p=(y,v)=>`${y}${n(`admin.unit${v}`)}`,g=r>0?[p(r,"Day"),p(u,"Hour"),p(h,"Minute")]:u>0?[p(u,"Hour"),p(h,"Minute"),p(m,"Second")]:[p(h,"Minute"),p(m,"Second")];return(l?g.slice(0,2):g).join(" ")}function Vd(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 a0(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 EM=({clients:a})=>{const{t:n}=Ae(),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(gy,{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=Pd(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?Vd(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:["↓",tl(r.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",tl(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")})})},NM=({devices:a,clients:n,onRevoke:l})=>{const{t:o}=Ae(),[r,u]=T.useState(null),[h,m]=T.useState(null),p=a0(n),g=[...a].sort((x,w)=>{const S=+!!p.get(w.deviceId)-+!!p.get(x.deviceId);return S||(Date.parse(w.lastSeenAt)||0)-(Date.parse(x.lastSeenAt)||0)}),y=async x=>{if(r!==x){u(x);return}m(x);try{await l(x)}finally{m(null),u(null)}},v=[{key:"status",header:o("admin.colStatus"),width:12,render:x=>{const w=p.get(x.deviceId)||0;return f.jsxs("span",{className:ne("flex items-center gap-1.5 whitespace-nowrap",w?"text-tui-ok":"text-tui-faint"),children:[f.jsx(dn,{level:w?"ok":"idle"}),o(w?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:o("admin.colDevice"),render:x=>{const w=Pd(x.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:"text-tui-text",title:w.raw,children:w.label||o("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:x.deviceId})]})}},{key:"host",header:o("admin.colHost"),render:x=>f.jsx("span",{className:"text-tui-text",children:x.hostId||"—"})},{key:"ip",header:o("admin.colIp"),render:x=>f.jsx("span",{className:"text-tui-muted",children:x.lastIp||"—"})},{key:"lastSeen",header:o("admin.colLastSeen"),render:x=>{const w=p.get(x.deviceId)||0;return f.jsx("span",{className:ne("whitespace-nowrap",w?"text-tui-ok":"text-tui-muted"),title:$d(x.lastSeenAt),children:w?o("admin.deviceWindows",{count:w}):Vd(x.lastSeenAt,o)})}},{key:"actions",header:o("admin.colActions"),align:"right",render:x=>{const w=r===x.deviceId,S=h===x.deviceId;return f.jsx(Me,{variant:"danger",disabled:S,onClick:()=>void y(x.deviceId),onBlur:()=>u(M=>M===x.deviceId?null:M),"aria-label":o("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",w&&"bg-tui-bad text-tui-crust"),children:S?f.jsx(sa,{}):o(w?"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:x=>x.deviceId,empty:o("admin.noDevices")})})},rb={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function kM(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,version:u.version,latestVersion:u.latestVersion,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 LM=({hosts:a,devices:n,clients:l})=>{const{t:o}=Ae(),r=kM(a,n),u=a0(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(m=>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:rb[m.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:m.hostname}),m.hostname!==m.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:m.id}):null,f.jsx(gy,{tone:rb[m.status],className:"ml-1 text-tui-sm",children:h[m.status]})]}),f.jsx(wd,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:m.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:o("admin.hostConnectedDevices",{count:m.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:o("admin.hostPairedDevices",{count:m.pairedDeviceCount})},"paired"),m.version===void 0?null:f.jsx("span",{className:m.version&&!m.latestVersion?"text-tui-muted":"text-tui-warn",children:m.version?m.latestVersion?o("admin.hostVersionBehind",{version:m.version,latest:m.latestVersion}):o("admin.hostVersion",{version:m.version}):o("admin.hostVersionUnknown")},"version"),m.fromRosterOnly?null:f.jsx("span",{className:m.activePtyCount?"text-tui-info":"text-tui-faint",children:o("admin.hostPtys",{count:m.activePtyCount})},"ptys")]})]}),m.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:m.devices.map(p=>{const g=Pd(p.userAgent),y=u.get(p.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:p.deviceId}),f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:p.lastIp||"—"}),f.jsx("span",{className:ne("whitespace-nowrap text-right text-tui-sm",y?"text-tui-ok":"text-tui-faint"),title:$d(p.lastSeenAt),children:y?o("admin.deviceWindows",{count:y}):Vd(p.lastSeenAt,o)})]},p.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:m.pairedDeviceCount>0?o("admin.hostRosterOperatorOnly"):o("admin.noDevices")})]},m.id))})},_M=({data:a})=>{var r,u,h,m,p,g,y,v,x,w;const{t:n}=Ae(),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(Xa,{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(Xa,{label:n("admin.activeUsers"),value:l,sub:n("admin.acrossWindows",{count:((m=a.clients)==null?void 0:m.length)||0}),tone:l?"accent":"idle"}),f.jsx(Xa,{label:n("admin.activePtys"),value:((p=a.ptys)==null?void 0:p.length)||0,sub:n("admin.terminalShells"),tone:(g=a.ptys)!=null&&g.length?"info":"idle"}),f.jsx(Xa,{label:n("admin.statInbound"),value:n("admin.perSecond",{value:tl(((y=a.throughput)==null?void 0:y.bytesInPerSec)||0)}),sub:n("admin.statTotal",{value:tl(((v=a.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(Xa,{label:n("admin.statOutbound"),value:n("admin.perSecond",{value:tl(((x=a.throughput)==null?void 0:x.bytesOutPerSec)||0)}),sub:n("admin.statTotal",{value:tl(((w=a.throughput)==null?void 0:w.bytesOut)||0)}),tone:"ok"}),f.jsx(Xa,{label:n("admin.uptime"),value:ob(a.uptimeSeconds||0,n,!0),title:ob(a.uptimeSeconds||0,n),sub:a.startTime?n("admin.startedAt",{time:new Date(a.startTime).toLocaleTimeString()}):n("admin.startedRecently")})]}),f.jsx(LM,{hosts:a.hosts||[],devices:a.devices,clients:a.clients||[]})]})},RM=({ptys:a})=>{const{t:n}=Ae(),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 Ss(a,n){const l=kd(a);return l?`${l}${n.startsWith("/")?n:`/${n}`}`:n}async function jM(a){try{const l=await fetch(Ss(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 cb(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 OM(a,n,l){return(await fetch(Ss(a,`/api/admin/devices/${encodeURIComponent(l)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":n}})).ok}function DM(a,n,l){return a!=null&&a.adminPath?a.publicUrl?`${a.publicUrl.replace(/\/$/,"")}${a.adminPath}`:Ss(l,a.adminPath):n!=null&&n.remoteAdminUrl?n.remoteAdminUrl:l?Ss(l,"/admin"):"/admin"}function zM({wsUrl:a,deviceToken:n,adminToken:l,relayOrigin:o,refreshInterval:r,t:u}){const[h,m]=T.useState(null),[p,g]=T.useState(null),[y,v]=T.useState(!1),[x,w]=T.useState(!0),[S,M]=T.useState(null),[E,k]=T.useState(!1),[N,R]=T.useState(null);T.useEffect(()=>{m(null),g(null),v(!1)},[o]),T.useEffect(()=>{let K=!0;return w(!0),jM(a).then(q=>{K&&(g(q),v(!0))}),()=>{K=!1}},[a,o]);const H=(p==null?void 0:p.relayMode)==="remote",j=T.useCallback((K,q)=>{if(K.kind==="denied"){k(!0),M(q),m(null);return}m(K.data),M(null),k(!1),R(new Date)},[]),D=T.useCallback((K,q)=>{k(!1),M(K instanceof Error?K.message:q),m(null)},[]),_=T.useCallback(async()=>{if(y){if(H){if(!l){m(null),w(!1),M(null),k(!1);return}try{w(!0);const K=await cb(Ss(a,(p==null?void 0:p.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{w(!1)}return}try{w(!0);const K=await cb("/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{w(!1)}}},[y,H,l,p,n,a,o,u]),z=T.useCallback(async K=>{try{if(!await OM(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 q=()=>{r>0&&!K&&(K=setInterval(()=>{document.visibilityState==="visible"&&_()},r))},te=()=>{K&&(clearInterval(K),K=null)},Z=()=>{document.visibilityState==="visible"?(_(),q()):te()};return q(),document.addEventListener("visibilitychange",Z),()=>{te(),document.removeEventListener("visibilitychange",Z)}},[y,_,r]),{data:h,relayInfo:p,infoLoaded:y,isRemoteRelay:H,loading:x,error:S,isAuthError:E,lastUpdated:N,fetchStatus:_,revokeDevice:z}}const rd="h-7 py-0",HM=({onBackToTerminal:a,onOpenPairing:n,showBack:l=!1})=>{var xe,ue,Te;const{settings:o,updateSettings:r,t:u}=Ae(),h=kd(o.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((xe=o.adminTokens)==null?void 0:xe[h])||(h===(typeof window<"u"?window.location.origin:"local")?o.adminToken:"")||"",[p,g]=T.useState(3e3),[y,v]=T.useState("overview"),[x,w]=T.useState(m),[S,M]=T.useState(m),[E,k]=T.useState(!!m),N=!kd(o.wsUrl);T.useEffect(()=>{w(m),M(m),k(!!m)},[h]);const{data:R,relayInfo:H,infoLoaded:j,isRemoteRelay:D,loading:_,error:z,isAuthError:K,lastUpdated:q,fetchStatus:te,revokeDevice:Z}=zM({wsUrl:o.wsUrl,deviceToken:o.token,adminToken:S,relayOrigin:h,refreshInterval:p,t:u}),ie=ce=>{ce.preventDefault();const ye=x.trim();r({adminToken:ye,adminTokens:{...o.adminTokens||{},[h]:ye}}),M(ye),k(!!ye)},re=DM(H,R,o.wsUrl),P=R?[{id:"overview",label:u("admin.tabOverview"),index:1},{id:"clients",label:u("admin.tabClients",{count:((ue=R.clients)==null?void 0:ue.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(ce=>ce.id).join("|");T.useEffect(()=>{const ce=A?A.split("|"):[],ye=ae=>{if(ae.ctrlKey||ae.altKey||ae.metaKey)return;const ve=ae.target;if(ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve instanceof HTMLSelectElement||ve!=null&&ve.isContentEditable||document.querySelector('[role="dialog"]'))return;if(ae.key==="Escape"&&a){ae.preventDefault(),a();return}if(ae.key.toLowerCase()==="r"){ae.preventDefault(),te();return}const le=Number.parseInt(ae.key,10)-1;Number.isInteger(le)&&le>=0&&le<ce.length&&(ae.preventDefault(),v(ce[le]))};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[te,a,A]);const G=(H==null?void 0:H.version)||(R==null?void 0:R.version)||"0.1.0",Q=l&&a?f.jsx(Me,{variant:"ghost",onClick:a,title:u("admin.returnToTerminal"),"aria-label":u("admin.returnToTerminal"),glyph:Ne.arrowLeft,brackets:!1,className:rd,children:f.jsx("span",{className:"sr-only",children:u("admin.returnToTerminal")})}):null,se=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",G]}),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(Tr,{value:p,onChange:ce=>g(Number(ce.target.value)),"aria-label":u("admin.autoRefresh"),className:ne("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:te,disabled:_,title:u("admin.refreshNow"),className:rd,children:_?f.jsx(sa,{}):u("admin.refreshNow")})]}):null]}),W=j&&D&&!E&&!N,be=j&&D&&(E||N)&&!R;return f.jsxs(FS,{tabs:P,activeTabId:y,onSelectTab:ce=>v(ce),tabsAriaLabel:u("header.mainNavigationAria"),toolbarStart:Q,toolbarAside:se,hints:[...R?[{keys:"1–4",action:u("admin.hintTabs")},{keys:"r",action:u("admin.hintRefresh")}]:[],...a?[{keys:"esc",action:u("admin.hintBack")}]:[]],footerAside:q?f.jsx("span",{className:"text-tui-faint",children:u("admin.updatedAt",{time:q.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(sa,{label:u("admin.loadingStatus")})}),W&&f.jsx(SM,{wsUrl:o.wsUrl,adminUrl:re,onOpenRemoteAdmin:()=>window.open(re,"_blank","noopener,noreferrer"),onSignIn:()=>k(!0)}),be&&f.jsx(CM,{adminConfigured:H==null?void 0:H.adminConfigured,isAuthError:K,tokenInput:x,onTokenInput:w,onSubmit:ie,isSameOriginRelay:N,onBackToTerminal:a,showBack:l,onCancel:()=>k(!1)}),j&&!D&&K&&f.jsx(TM,{onOpenPairing:n,onRetry:te}),j&&z&&!K&&f.jsx(_i,{tone:"warn",action:f.jsx(Me,{variant:"warn",onClick:te,children:u("common.retry")}),children:u("admin.errorConnecting",{error:z})}),R&&f.jsxs(f.Fragment,{children:[y==="overview"&&f.jsx(_M,{data:R}),y==="clients"&&f.jsx(EM,{clients:R.clients||[]}),y==="ptys"&&f.jsx(RM,{ptys:R.ptys||[]}),y==="devices"&&f.jsx(NM,{devices:R.devices||[],clients:R.clients||[],onRevoke:Z})]})]})},ir="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",ar="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",BM="border-tui-accent bg-tui-selection text-tui-accent",lr=({active:a=!1})=>f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",a?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ne.cursor}),UM=({onClose:a,onOpenPairing:n,onOpenSettings:l,onAddProfile:o=()=>{}})=>{const{settings:r,updateSettings:u,language:h,setLanguage:m,t:p}=Ae(),{connectionState:g,stateDetail:y,rttMs:v,hostId:x,connect:w}=et(),{addToast:S}=Zt(),{copied:M,copy:E}=Gd(),k=M!==null,N=Ar(g,p),R=D=>()=>{var z;const _=document.activeElement;(z=_==null?void 0:_.blur)==null||z.call(_),D()},H=()=>E(r.clientId,p("toasts.clientIdCopied",{id:r.clientId}),"info"),j=()=>{const D=h==="zh"?"en":"zh";m(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:p("mobile.sessionControls")}),f.jsx(Me,{variant:"ghost",onClick:a,"aria-label":p("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(Nt,{title:p("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(Yd,{mobile:!0,onAddProfile:o})}),f.jsxs(Nt,{title:p("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:()=>w(),className:"shrink-0",children:N.actionLabel})]}),N.needsAttention&&y&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:y}),x&&f.jsx(An,{label:p("common.host"),labelWidth:9,children:x}),f.jsxs("button",{type:"button",onClick:H,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:p("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:p("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:ne("shrink-0",k?"text-tui-ok":"text-tui-faint"),children:k?Ne.check:"⧉"})]})]}),f.jsx(Nt,{title:p("mobile.inputControl"),tone:"accent","aria-label":p("mobile.terminalControlAria"),children:f.jsx(t0,{className:"h-11"})}),f.jsxs(Nt,{title:p("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:j,className:ne(ir,ar),"aria-label":p("header.languageToggleTitle"),children:[f.jsx(lr,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:R(l),className:ne(ir,ar),"aria-label":p("mobile.settingsAria"),children:[f.jsx(lr,{}),f.jsx("span",{className:"truncate",children:p("common.settings")})]}),f.jsxs("button",{type:"button",onClick:R(n),className:ne(ir,ar),"aria-label":p("mobile.pairingAria"),children:[f.jsx(lr,{}),f.jsx("span",{className:"truncate",children:p("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>u({toolbarVisible:!r.toolbarVisible}),className:ne(ir,r.toolbarVisible?BM:ar),"aria-label":p("mobile.keybarAria"),"aria-pressed":r.toolbarVisible,children:[f.jsx(lr,{active:r.toolbarVisible}),f.jsx("span",{className:"truncate",children:p("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:r.toolbarVisible?"[x]":"[ ]"})]})]})]})},KM=({onAddProfile:a})=>{const{t:n}=Ae(),{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(Yd,{statusBar:!0,onAddProfile:a}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(e0,{compact:!0}),f.jsx(i0,{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:ne(l===null?"text-tui-faint":"text-tui-text"),children:l===null?"—":`${l}ms`})]})]})},IM=({onOpenPairing:a,onOpenSettings:n,onAddProfile:l=()=>{}})=>{const{t:o}=Ae(),{connectionState:r,isController:u}=et(),[h,m]=T.useState(!1),p=T.useRef(null),g=T.useCallback(()=>m(!1),[]);T.useEffect(()=>{if(!h)return;const v=x=>{if(!(x.ctrlKey||x.altKey||x.metaKey)&&x.key==="Escape"){const w=x.target;w&&typeof w.closest=="function"&&!!w.closest("#terminal-container")||(x.stopPropagation(),x.preventDefault(),g())}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[h,g]),T.useEffect(()=>{var v;h&&((v=p.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:()=>m(!0),"aria-label":o("mobile.sessionControls"),"aria-expanded":h,"aria-haspopup":"dialog",className:ne("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:Ne.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:p,"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(UM,{onClose:g,onOpenPairing:()=>{g(),a()},onOpenSettings:()=>{g(),n()},onAddProfile:()=>{g(),l()}})})]}),f.jsx(KM,{onAddProfile:l})]})},FM=()=>{const{activeProfile:a,t:n}=Ae(),{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(sa,{}),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")})})]})})})},l0="--app-height",s0="--keyboard-inset",GM=80;function YM(){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>=GM?Math.round(l):0;return{height:Math.round(n.height),keyboardInset:o}}return{height:a,keyboardInset:0}}function ub(a,n=YM()){return a.style.setProperty(l0,`${n.height}px`),a.style.setProperty(s0,`${n.keyboardInset}px`),n}function PM(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let n=null;const l=()=>{n=null,ub(a)},o=()=>{if(n===null){if(typeof requestAnimationFrame!="function"){l();return}n=requestAnimationFrame(l)}};ub(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(l0),a.style.removeProperty(s0)}}const VM=900;function db(){if(typeof window>"u")return!1;const a=il();return a<Rd?!0:a<=VM}function $M(){const[a,n]=T.useState(db);return T.useEffect(()=>{var r,u;const l=()=>{const h=db();n(m=>m===h?m: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,m;(h=o==null?void 0:o.removeEventListener)==null||h.call(o,"change",l),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),(m=window.visualViewport)==null||m.removeEventListener("resize",l)}},[]),a}function qM(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 XM(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)&&(qM(o)||(o.preventDefault(),o.stopPropagation(),(r=a.onCloseModals)==null||r.call(a)))};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}}function ZM(){const[a,n]=T.useState("terminal"),[l,o]=T.useState(!1),[r,u]=T.useState(!1),[h,m]=T.useState(!1),[p,g]=T.useState(void 0),y=P=>{g(P),m(!0)},[v,x]=T.useState(!1),{updateSettings:w,addProfileAndConnect:S,settings:M}=Ae(),{connectionState:E,stateDetail:k,stateCode:N,lastPairedAt:R}=et();G1();const H=$M();T.useEffect(()=>PM(),[]),T.useEffect(()=>{Ab()},[]),T.useEffect(()=>{const P=l||r||h||v;if(P)return XM({onCloseModals:()=>{o(!1),u(!1),m(!1),x(!1)}},{isModalOpen:P})},[l,r,h,v]),T.useEffect(()=>{var A;const P=()=>{const G=window.location.pathname,Q=window.location.hash;n(G==="/admin"||Q==="#admin"?"admin":"terminal")};P(),window.addEventListener("popstate",P),window.addEventListener("hashchange",P);try{const G=new URL(window.location.href),Q=(A=G.searchParams.get("pairCode"))==null?void 0:A.toUpperCase();Q&&br().token?S({wsUrl:jt,pairCode:Q}):Q&&w({pairCode:Q});let se=!1;if(G.searchParams.has("token")&&(G.searchParams.delete("token"),se=!0),G.searchParams.has("pairCode")&&(G.searchParams.delete("pairCode"),se=!0),se){const W=G.searchParams.toString(),be=G.pathname+(W?`?${W}`:"")+G.hash;window.history.replaceState({},"",be)}}catch(G){console.warn("Failed to parse URL query params:",G)}return()=>{window.removeEventListener("popstate",P),window.removeEventListener("hashchange",P)}},[w,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||"")),q=z||K,[te,Z]=T.useState(!q);T.useEffect(()=>{q||Z(!0)},[q]),T.useEffect(()=>{R&&(o(!1),u(!1),Z(!0),n("terminal"))},[R]);const ie=a==="terminal"&&!q,re=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(YS,{currentView:a,onNavigate:_,onOpenPairing:j,onOpenSettings:()=>y(),onToggleVirtualKeyboard:()=>x(!v),isVirtualKeyboardOpen:v}),!H&&!q&&f.jsx(PS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[te&&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:re(ie),"aria-hidden":!ie,children:[f.jsx(I5,{isActive:ie}),!H&&f.jsx(iM,{isOpen:v,onClose:()=>x(!1)}),f.jsx(nM,{compact:H,onCustomize:()=>y("agentKeymaps")}),f.jsx(FM,{}),f.jsx(uM,{})]}),a==="terminal"&&q&&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(G5,{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(HM,{onBackToTerminal:()=>_("terminal"),onOpenPairing:j,showBack:H})}),H&&ie&&f.jsx(IM,{onOpenPairing:j,onOpenSettings:()=>y(),onAddProfile:D})]}),!H&&a!=="admin"&&f.jsx(wM,{onAddProfile:D}),f.jsx(aM,{isOpen:l,onClose:()=>o(!1)}),f.jsx(lM,{isOpen:r,onClose:()=>u(!1)}),f.jsx(hM,{isOpen:h,initialTab:p,onClose:()=>m(!1),onOpenAdmin:()=>{m(!1),_("admin")}}),f.jsx(gM,{})]})}function WM(){return f.jsx(_1,{children:f.jsx(ZM,{})})}const o0=document.getElementById("root");if(!o0)throw new Error("Root element not found");_x.createRoot(o0).render(f.jsx(Qn.StrictMode,{children:f.jsx(WM,{})}));
|