herdr-remote-relay 0.3.19 → 0.3.21
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/messages.d.ts +17 -8
- package/dist/protocol/messages.js +2 -2
- package/dist/server/client-channel.js +27 -2
- package/dist/server/host-broadcasts.d.ts +1 -1
- package/dist/server/host-broadcasts.js +2 -1
- package/dist/server/host-channel.js +1 -1
- package/dist/server/sessions.js +1 -10
- package/dist/server/types.d.ts +3 -2
- package/package.json +1 -1
- package/web/dist/assets/index-C_RZHFCw.js +61 -0
- package/web/dist/index.html +1 -1
- package/web/dist/assets/index-CrQV6NpQ.js +0 -61
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var px=Object.defineProperty;var gx=(l,n,a)=>n in l?px(l,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[n]=a;var X=(l,n,a)=>gx(l,typeof n!="symbol"?n+"":n,a);import{r as db,g as fb,a as hb}from"./vendor-react-CYSfZuHu.js";import{r as bx,a as yx}from"./vendor-xterm-BhCxil_4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function a(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=a(o);fetch(o.href,c)}})();var zu={exports:{}},ts={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Yp;function vx(){if(Yp)return ts;Yp=1;var l=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(r,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var p in o)p!=="key"&&(c[p]=o[p])}else c=o;return o=c.ref,{$$typeof:l,type:r,key:h,ref:o!==void 0?o:null,props:c}}return ts.Fragment=n,ts.jsx=a,ts.jsxs=a,ts}var Pp;function xx(){return Pp||(Pp=1,zu.exports=vx()),zu.exports}var f=xx(),C=db();const Qn=fb(C);var Hu={exports:{}},ns={},Bu={exports:{}},Uu={};/**
|
|
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 wx(){return $p||($p=1,(function(l){function n(k,Y){var Q=k.length;k.push(Y);e:for(;0<Q;){var ae=Q-1>>>1,Z=k[ae];if(0<o(Z,Y))k[ae]=Y,k[Q]=Z,Q=ae;else break e}}function a(k){return k.length===0?null:k[0]}function r(k){if(k.length===0)return null;var Y=k[0],Q=k.pop();if(Q!==Y){k[0]=Q;e:for(var ae=0,Z=k.length,ge=Z>>>1;ae<ge;){var be=2*(ae+1)-1,ye=k[be],Me=be+1,de=k[Me];if(0>o(ye,Q))Me<Z&&0>o(de,ye)?(k[ae]=de,k[Me]=Q,ae=Me):(k[ae]=ye,k[be]=Q,ae=be);else if(Me<Z&&0>o(de,Q))k[ae]=de,k[Me]=Q,ae=Me;else break e}}return Y}function o(k,Y){var Q=k.sortIndex-Y.sortIndex;return Q!==0?Q:k.id-Y.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;l.unstable_now=function(){return c.now()}}else{var h=Date,p=h.now();l.unstable_now=function(){return h.now()-p}}var m=[],g=[],y=1,v=null,x=3,w=!1,M=!1,T=!1,A=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function z(k){for(var Y=a(g);Y!==null;){if(Y.callback===null)r(g);else if(Y.startTime<=k)r(g),Y.sortIndex=Y.expirationTime,n(m,Y);else break;Y=a(g)}}function O(k){if(T=!1,z(k),!M)if(a(m)!==null)M=!0,D||(D=!0,W());else{var Y=a(g);Y!==null&&I(O,Y.startTime-k)}}var D=!1,R=-1,B=5,H=-1;function q(){return A?!0:!(l.unstable_now()-H<B)}function $(){if(A=!1,D){var k=l.unstable_now();H=k;var Y=!0;try{e:{M=!1,T&&(T=!1,E(R),R=-1),w=!0;var Q=x;try{t:{for(z(k),v=a(m);v!==null&&!(v.expirationTime>k&&q());){var ae=v.callback;if(typeof ae=="function"){v.callback=null,x=v.priorityLevel;var Z=ae(v.expirationTime<=k);if(k=l.unstable_now(),typeof Z=="function"){v.callback=Z,z(k),Y=!0;break t}v===a(m)&&r(m),z(k)}else r(m);v=a(m)}if(v!==null)Y=!0;else{var ge=a(g);ge!==null&&I(O,ge.startTime-k),Y=!1}}break e}finally{v=null,x=Q,w=!1}Y=void 0}}finally{Y?W():D=!1}}}var W;if(typeof _=="function")W=function(){_($)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,oe=le.port2;le.port1.onmessage=$,W=function(){oe.postMessage(null)}}else W=function(){N($,0)};function I(k,Y){R=N(function(){k(l.unstable_now())},Y)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(k){k.callback=null},l.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<k?Math.floor(1e3/k):5},l.unstable_getCurrentPriorityLevel=function(){return x},l.unstable_next=function(k){switch(x){case 1:case 2:case 3:var Y=3;break;default:Y=x}var Q=x;x=Y;try{return k()}finally{x=Q}},l.unstable_requestPaint=function(){A=!0},l.unstable_runWithPriority=function(k,Y){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var Q=x;x=k;try{return Y()}finally{x=Q}},l.unstable_scheduleCallback=function(k,Y,Q){var ae=l.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ae+Q:ae):Q=ae,k){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=Q+Z,k={id:y++,callback:Y,priorityLevel:k,startTime:Q,expirationTime:Z,sortIndex:-1},Q>ae?(k.sortIndex=Q,n(g,k),a(m)===null&&k===a(g)&&(T?(E(R),R=-1):T=!0,I(O,Q-ae))):(k.sortIndex=Z,n(m,k),M||w||(M=!0,D||(D=!0,W()))),k},l.unstable_shouldYield=q,l.unstable_wrapCallback=function(k){var Y=x;return function(){var Q=x;x=Y;try{return k.apply(this,arguments)}finally{x=Q}}}})(Uu)),Uu}var qp;function Sx(){return qp||(qp=1,Bu.exports=wx()),Bu.exports}/**
|
|
18
|
-
* @license React
|
|
19
|
-
* react-dom-client.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var Vp;function Cx(){if(Vp)return ns;Vp=1;var l=Sx(),n=db(),a=hb();function r(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 o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(c(e)!==e)throw Error(r(188))}function g(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(r(188));return t!==e?null:e}for(var i=e,s=t;;){var u=i.return;if(u===null)break;var d=u.alternate;if(d===null){if(s=u.return,s!==null){i=s;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===i)return m(u),e;if(d===s)return m(u),t;d=d.sibling}throw Error(r(188))}if(i.return!==s.return)i=u,s=d;else{for(var b=!1,S=u.child;S;){if(S===i){b=!0,i=u,s=d;break}if(S===s){b=!0,s=u,i=d;break}S=S.sibling}if(!b){for(S=d.child;S;){if(S===i){b=!0,i=d,s=u;break}if(S===s){b=!0,s=d,i=u;break}S=S.sibling}if(!b)throw Error(r(189))}}if(i.alternate!==s)throw Error(r(190))}if(i.tag!==3)throw Error(r(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"),M=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),_=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=$&&e[$]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case N:return"Profiler";case A:return"StrictMode";case O:return"Suspense";case D:return"SuspenseList";case H:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case M:return"Portal";case _:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var I=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},ae=[],Z=-1;function ge(e){return{current:e}}function be(e){0>Z||(e.current=ae[Z],ae[Z]=null,Z--)}function ye(e,t){Z++,ae[Z]=e.current,e.current=t}var Me=ge(null),de=ge(null),xe=ge(null),se=ge(null);function ve(e,t){switch(ye(xe,t),ye(de,e),ye(Me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hp(t),e=mp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}be(Me),ye(Me,e)}function ie(){be(Me),be(de),be(xe)}function we(e){e.memoizedState!==null&&ye(se,e);var t=Me.current,i=mp(t,e.type);t!==i&&(ye(de,e),ye(Me,i))}function Ee(e){de.current===e&&(be(Me),be(de)),se.current===e&&(be(se),Qa._currentValue=Q)}var He,ot;function ce(e){if(He===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);He=t&&t[1]||"",ot=-1<i.stack.indexOf(`
|
|
26
|
-
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
-
`+He+e+ot}var Ce=!1;function tt(e,t){if(!e||Ce)return"";Ce=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(V){var P=V}Reflect.construct(e,[],te)}else{try{te.call()}catch(V){P=V}e.call(te.prototype)}}else{try{throw Error()}catch(V){P=V}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(V){if(V&&P&&typeof V.stack=="string")return[V.stack,P.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=s.DetermineComponentFrameRoot(),b=d[0],S=d[1];if(b&&S){var L=b.split(`
|
|
28
|
-
`),G=S.split(`
|
|
29
|
-
`);for(u=s=0;s<L.length&&!L[s].includes("DetermineComponentFrameRoot");)s++;for(;u<G.length&&!G[u].includes("DetermineComponentFrameRoot");)u++;if(s===L.length||u===G.length)for(s=L.length-1,u=G.length-1;1<=s&&0<=u&&L[s]!==G[u];)u--;for(;1<=s&&0<=u;s--,u--)if(L[s]!==G[u]){if(s!==1||u!==1)do if(s--,u--,0>u||L[s]!==G[u]){var J=`
|
|
30
|
-
`+L[s].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=s&&0<=u);break}}}finally{Ce=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?ce(i):""}function lt(e,t){switch(e.tag){case 26:case 27:case 5:return ce(e.type);case 16:return ce("Lazy");case 13:return e.child!==t&&t!==null?ce("Suspense Fallback"):ce("Suspense");case 19:return ce("SuspenseList");case 0:case 15:return tt(e.type,!1);case 11:return tt(e.type.render,!1);case 1:return tt(e.type,!0);case 31:return ce("Activity");default:return""}}function yt(e){try{var t="",i=null;do t+=lt(e,i),i=e,e=e.return;while(e);return t}catch(s){return`
|
|
31
|
-
Error generating stack: `+s.message+`
|
|
32
|
-
`+s.stack}}var bn=Object.prototype.hasOwnProperty,dn=l.unstable_scheduleCallback,Xt=l.unstable_cancelCallback,It=l.unstable_shouldYield,ji=l.unstable_requestPaint,Et=l.unstable_now,xo=l.unstable_getCurrentPriorityLevel,ra=l.unstable_ImmediatePriority,oa=l.unstable_UserBlockingPriority,Oi=l.unstable_NormalPriority,Ss=l.unstable_LowPriority,ca=l.unstable_IdlePriority,Cs=l.log,Ts=l.unstable_setDisableYieldValue,Jn=null,Tt=null;function fn(e){if(typeof Cs=="function"&&Ts(e),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(Jn,e)}catch{}}var Mt=Math.clz32?Math.clz32:Ms,wo=Math.log,So=Math.LN2;function Ms(e){return e>>>=0,e===0?32:31-(wo(e)/So|0)|0}var he=256,Fe=262144,Nt=4194304;function kt(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 ol(e,t,i){var s=e.pendingLanes;if(s===0)return 0;var u=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var S=s&134217727;return S!==0?(s=S&~d,s!==0?u=kt(s):(b&=S,b!==0?u=kt(b):i||(i=S&~e,i!==0&&(u=kt(i))))):(S=s&~d,S!==0?u=kt(S):b!==0?u=kt(b):i||(i=s&~e,i!==0&&(u=kt(i)))),u===0?0:t!==0&&t!==u&&(t&d)===0&&(d=u&-u,i=t&-t,d>=i||d===32&&(i&4194048)!==0)?t:u}function Di(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Co(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 ua(){var e=Nt;return Nt<<=1,(Nt&62914560)===0&&(Nt=4194304),e}function To(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function da(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function i0(e,t,i,s,u,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 S=e.entanglements,L=e.expirationTimes,G=e.hiddenUpdates;for(i=b&~i;0<i;){var J=31-Mt(i),te=1<<J;S[J]=0,L[J]=-1;var P=G[J];if(P!==null)for(G[J]=null,J=0;J<P.length;J++){var V=P[J];V!==null&&(V.lane&=-536870913)}i&=~te}s!==0&&Vd(e,s,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Vd(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Mt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function Xd(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-Mt(i),u=1<<s;u&t|e[s]&t&&(e[s]|=t),i&=~u}}function Zd(e,t){var i=t&-t;return i=(i&42)!==0?1:Mo(i),(i&(e.suspendedLanes|t))!==0?0:i}function Mo(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 Ao(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qd(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:Hp(e.type))}function Wd(e,t){var i=Y.p;try{return Y.p=e,t()}finally{Y.p=i}}var ei=Math.random().toString(36).slice(2),vt="__reactFiber$"+ei,_t="__reactProps$"+ei,cl="__reactContainer$"+ei,Eo="__reactEvents$"+ei,l0="__reactListeners$"+ei,a0="__reactHandles$"+ei,Jd="__reactResources$"+ei,fa="__reactMarker$"+ei;function No(e){delete e[vt],delete e[_t],delete e[Eo],delete e[l0],delete e[a0]}function ul(e){var t=e[vt];if(t)return t;for(var i=e.parentNode;i;){if(t=i[cl]||i[vt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=wp(e);e!==null;){if(i=e[vt])return i;e=wp(e)}return t}e=i,i=e.parentNode}return null}function dl(e){if(e=e[vt]||e[cl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ha(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function fl(e){var t=e[Jd];return t||(t=e[Jd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pt(e){e[fa]=!0}var ef=new Set,tf={};function zi(e,t){hl(e,t),hl(e+"Capture",t)}function hl(e,t){for(tf[e]=t,e=0;e<t.length;e++)ef.add(t[e])}var s0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),nf={},lf={};function r0(e){return bn.call(lf,e)?!0:bn.call(nf,e)?!1:s0.test(e)?lf[e]=!0:(nf[e]=!0,!1)}function As(e,t,i){if(r0(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 Es(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 En(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 Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function af(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function o0(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 u=s.get,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.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 ko(e){if(!e._valueTracker){var t=af(e)?"checked":"value";e._valueTracker=o0(e,t,""+e[t])}}function sf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=af(e)?e.checked?"true":"false":e.value),e=s,e!==i?(t.setValue(e),!0):!1}function Ns(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 c0=/[\n"\\]/g;function Qt(e){return e.replace(c0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Lo(e,t,i,s,u,d,b,S){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=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Ro(e,b,Zt(t)):i!=null?Ro(e,b,Zt(i)):s!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Zt(S):e.removeAttribute("name")}function rf(e,t,i,s,u,d,b,S){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)){ko(e);return}i=i!=null?""+Zt(i):"",t=t!=null?""+Zt(t):i,S||t===e.value||(e.value=t),e.defaultValue=t}s=s??u,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=S?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),ko(e)}function Ro(e,t,i){t==="number"&&Ns(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function ml(e,t,i,s){if(e=e.options,t){t={};for(var u=0;u<i.length;u++)t["$"+i[u]]=!0;for(i=0;i<e.length;i++)u=t.hasOwnProperty("$"+e[i].value),e[i].selected!==u&&(e[i].selected=u),u&&s&&(e[i].defaultSelected=!0)}else{for(i=""+Zt(i),t=null,u=0;u<e.length;u++){if(e[u].value===i){e[u].selected=!0,s&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function of(e,t,i){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Zt(i):""}function cf(e,t,i,s){if(t==null){if(s!=null){if(i!=null)throw Error(r(92));if(I(s)){if(1<s.length)throw Error(r(93));s=s[0]}i=s}i==null&&(i=""),t=i}i=Zt(t),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),ko(e)}function pl(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var u0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function uf(e,t,i){var s=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,i):typeof i!="number"||i===0||u0.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function df(e,t,i){if(t!=null&&typeof t!="object")throw Error(r(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 u in t)s=t[u],t.hasOwnProperty(u)&&i[u]!==s&&uf(e,u,s)}else for(var d in t)t.hasOwnProperty(d)&&uf(e,d,t[d])}function _o(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 d0=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"]]),f0=/^[\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 ks(e){return f0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Nn(){}var jo=null;function Oo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var gl=null,bl=null;function ff(e){var t=dl(e);if(t&&(e=t.stateNode)){var i=e[_t]||null;e:switch(e=t.stateNode,t.type){case"input":if(Lo(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 u=s[_t]||null;if(!u)throw Error(r(90));Lo(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<i.length;t++)s=i[t],s.form===e.form&&sf(s)}break e;case"textarea":of(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&ml(e,!!i.multiple,t,!1)}}}var Do=!1;function hf(e,t,i){if(Do)return e(t,i);Do=!0;try{var s=e(t);return s}finally{if(Do=!1,(gl!==null||bl!==null)&&(gr(),gl&&(t=gl,e=bl,bl=gl=null,ff(t),e)))for(t=0;t<e.length;t++)ff(e[t])}}function ma(e,t){var i=e.stateNode;if(i===null)return null;var s=i[_t]||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(r(231,t,typeof i));return i}var kn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zo=!1;if(kn)try{var pa={};Object.defineProperty(pa,"passive",{get:function(){zo=!0}}),window.addEventListener("test",pa,pa),window.removeEventListener("test",pa,pa)}catch{zo=!1}var ti=null,Ho=null,Ls=null;function mf(){if(Ls)return Ls;var e,t=Ho,i=t.length,s,u="value"in ti?ti.value:ti.textContent,d=u.length;for(e=0;e<i&&t[e]===u[e];e++);var b=i-e;for(s=1;s<=b&&t[i-s]===u[d-s];s++);return Ls=u.slice(e,1<s?1-s:void 0)}function Rs(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 _s(){return!0}function pf(){return!1}function jt(e){function t(i,s,u,d,b){this._reactName=i,this._targetInst=u,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(i=e[S],this[S]=i?i(d):d[S]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?_s:pf,this.isPropagationStopped=pf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=_s)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=_s)},persist:function(){},isPersistent:_s}),t}var Hi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},js=jt(Hi),ga=v({},Hi,{view:0,detail:0}),h0=jt(ga),Bo,Uo,ba,Os=v({},ga,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,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!==ba&&(ba&&e.type==="mousemove"?(Bo=e.screenX-ba.screenX,Uo=e.screenY-ba.screenY):Uo=Bo=0,ba=e),Bo)},movementY:function(e){return"movementY"in e?e.movementY:Uo}}),gf=jt(Os),m0=v({},Os,{dataTransfer:0}),p0=jt(m0),g0=v({},ga,{relatedTarget:0}),Ko=jt(g0),b0=v({},Hi,{animationName:0,elapsedTime:0,pseudoElement:0}),y0=jt(b0),v0=v({},Hi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),x0=jt(v0),w0=v({},Hi,{data:0}),bf=jt(w0),S0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},C0={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"},T0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function M0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=T0[e])?!!t[e]:!1}function Io(){return M0}var A0=v({},ga,{key:function(e){if(e.key){var t=S0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Rs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?C0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(e){return e.type==="keypress"?Rs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Rs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),E0=jt(A0),N0=v({},Os,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yf=jt(N0),k0=v({},ga,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),L0=jt(k0),R0=v({},Hi,{propertyName:0,elapsedTime:0,pseudoElement:0}),_0=jt(R0),j0=v({},Os,{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}),O0=jt(j0),D0=v({},Hi,{newState:0,oldState:0}),z0=jt(D0),H0=[9,13,27,32],Fo=kn&&"CompositionEvent"in window,ya=null;kn&&"documentMode"in document&&(ya=document.documentMode);var B0=kn&&"TextEvent"in window&&!ya,vf=kn&&(!Fo||ya&&8<ya&&11>=ya),xf=" ",wf=!1;function Sf(e,t){switch(e){case"keyup":return H0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yl=!1;function U0(e,t){switch(e){case"compositionend":return Cf(t);case"keypress":return t.which!==32?null:(wf=!0,xf);case"textInput":return e=t.data,e===xf&&wf?null:e;default:return null}}function K0(e,t){if(yl)return e==="compositionend"||!Fo&&Sf(e,t)?(e=mf(),Ls=Ho=ti=null,yl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return vf&&t.locale!=="ko"?null:t.data;default:return null}}var I0={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Tf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!I0[e.type]:t==="textarea"}function Mf(e,t,i,s){gl?bl?bl.push(s):bl=[s]:gl=s,t=Cr(t,"onChange"),0<t.length&&(i=new js("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var va=null,xa=null;function F0(e){rp(e,0)}function Ds(e){var t=ha(e);if(sf(t))return e}function Af(e,t){if(e==="change")return t}var Ef=!1;if(kn){var Go;if(kn){var Yo="oninput"in document;if(!Yo){var Nf=document.createElement("div");Nf.setAttribute("oninput","return;"),Yo=typeof Nf.oninput=="function"}Go=Yo}else Go=!1;Ef=Go&&(!document.documentMode||9<document.documentMode)}function kf(){va&&(va.detachEvent("onpropertychange",Lf),xa=va=null)}function Lf(e){if(e.propertyName==="value"&&Ds(xa)){var t=[];Mf(t,xa,e,Oo(e)),hf(F0,t)}}function G0(e,t,i){e==="focusin"?(kf(),va=t,xa=i,va.attachEvent("onpropertychange",Lf)):e==="focusout"&&kf()}function Y0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ds(xa)}function P0(e,t){if(e==="click")return Ds(t)}function $0(e,t){if(e==="input"||e==="change")return Ds(t)}function q0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ft=typeof Object.is=="function"?Object.is:q0;function wa(e,t){if(Ft(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 u=i[s];if(!bn.call(t,u)||!Ft(e[u],t[u]))return!1}return!0}function Rf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _f(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 jf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Of(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ns(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=Ns(e.document)}return t}function Po(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 V0=kn&&"documentMode"in document&&11>=document.documentMode,vl=null,$o=null,Sa=null,qo=!1;function Df(e,t,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;qo||vl==null||vl!==Ns(s)||(s=vl,"selectionStart"in s&&Po(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}),Sa&&wa(Sa,s)||(Sa=s,s=Cr($o,"onSelect"),0<s.length&&(t=new js("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=vl)))}function Bi(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var xl={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")},Vo={},zf={};kn&&(zf=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function Ui(e){if(Vo[e])return Vo[e];if(!xl[e])return e;var t=xl[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in zf)return Vo[e]=t[i];return e}var Hf=Ui("animationend"),Bf=Ui("animationiteration"),Uf=Ui("animationstart"),X0=Ui("transitionrun"),Z0=Ui("transitionstart"),Q0=Ui("transitioncancel"),Kf=Ui("transitionend"),If=new Map,Xo="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(" ");Xo.push("scrollEnd");function hn(e,t){If.set(e,t),zi(t,[e])}var zs=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)},Wt=[],wl=0,Zo=0;function Hs(){for(var e=wl,t=Zo=wl=0;t<e;){var i=Wt[t];Wt[t++]=null;var s=Wt[t];Wt[t++]=null;var u=Wt[t];Wt[t++]=null;var d=Wt[t];if(Wt[t++]=null,s!==null&&u!==null){var b=s.pending;b===null?u.next=u:(u.next=b.next,b.next=u),s.pending=u}d!==0&&Ff(i,u,d)}}function Bs(e,t,i,s){Wt[wl++]=e,Wt[wl++]=t,Wt[wl++]=i,Wt[wl++]=s,Zo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Qo(e,t,i,s){return Bs(e,t,i,s),Us(e)}function Ki(e,t){return Bs(e,null,null,t),Us(e)}function Ff(e,t,i){e.lanes|=i;var s=e.alternate;s!==null&&(s.lanes|=i);for(var u=!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||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&t!==null&&(u=31-Mt(i),e=d.hiddenUpdates,s=e[u],s===null?e[u]=[t]:s.push(t),t.lane=i|536870912),d):null}function Us(e){if(50<Ya)throw Ya=0,su=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Sl={};function W0(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 Gt(e,t,i,s){return new W0(e,t,i,s)}function Wo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ln(e,t){var i=e.alternate;return i===null?(i=Gt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Gf(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ks(e,t,i,s,u,d){var b=0;if(s=e,typeof e=="function")Wo(e)&&(b=1);else if(typeof e=="string")b=ix(e,i,Me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case H:return e=Gt(31,i,t,u),e.elementType=H,e.lanes=d,e;case T:return Ii(i.children,u,d,t);case A:b=8,u|=24;break;case N:return e=Gt(12,i,t,u|2),e.elementType=N,e.lanes=d,e;case O:return e=Gt(13,i,t,u),e.elementType=O,e.lanes=d,e;case D:return e=Gt(19,i,t,u),e.elementType=D,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:b=10;break e;case E:b=9;break e;case z:b=11;break e;case R:b=14;break e;case B:b=16,s=null;break e}b=29,i=Error(r(130,e===null?"null":typeof e,"")),s=null}return t=Gt(b,i,t,u),t.elementType=e,t.type=s,t.lanes=d,t}function Ii(e,t,i,s){return e=Gt(7,e,s,t),e.lanes=i,e}function Jo(e,t,i){return e=Gt(6,e,null,t),e.lanes=i,e}function Yf(e){var t=Gt(18,null,null,0);return t.stateNode=e,t}function ec(e,t,i){return t=Gt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Pf=new WeakMap;function Jt(e,t){if(typeof e=="object"&&e!==null){var i=Pf.get(e);return i!==void 0?i:(t={value:e,source:t,stack:yt(t)},Pf.set(e,t),t)}return{value:e,source:t,stack:yt(t)}}var Cl=[],Tl=0,Is=null,Ca=0,en=[],tn=0,ni=null,yn=1,vn="";function Rn(e,t){Cl[Tl++]=Ca,Cl[Tl++]=Is,Is=e,Ca=t}function $f(e,t,i){en[tn++]=yn,en[tn++]=vn,en[tn++]=ni,ni=e;var s=yn;e=vn;var u=32-Mt(s)-1;s&=~(1<<u),i+=1;var d=32-Mt(t)+u;if(30<d){var b=u-u%5;d=(s&(1<<b)-1).toString(32),s>>=b,u-=b,yn=1<<32-Mt(t)+u|i<<u|s,vn=d+e}else yn=1<<d|i<<u|s,vn=e}function tc(e){e.return!==null&&(Rn(e,1),$f(e,1,0))}function nc(e){for(;e===Is;)Is=Cl[--Tl],Cl[Tl]=null,Ca=Cl[--Tl],Cl[Tl]=null;for(;e===ni;)ni=en[--tn],en[tn]=null,vn=en[--tn],en[tn]=null,yn=en[--tn],en[tn]=null}function qf(e,t){en[tn++]=yn,en[tn++]=vn,en[tn++]=ni,yn=t.id,vn=t.overflow,ni=e}var xt=null,Xe=null,Be=!1,ii=null,nn=!1,ic=Error(r(519));function li(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ta(Jt(t,e)),ic}function Vf(e){var t=e.stateNode,i=e.type,s=e.memoizedProps;switch(t[vt]=e,t[_t]=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<$a.length;i++)Oe($a[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),cf(t,s.value,s.defaultValue,s.children)}i=s.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||s.suppressHydrationWarning===!0||dp(t.textContent,i)?(s.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),s.onScroll!=null&&Oe("scroll",t),s.onScrollEnd!=null&&Oe("scrollend",t),s.onClick!=null&&(t.onclick=Nn),t=!0):t=!1,t||li(e,!0)}function Xf(e){for(xt=e.return;xt;)switch(xt.tag){case 5:case 31:case 13:nn=!1;return;case 27:case 3:nn=!0;return;default:xt=xt.return}}function Ml(e){if(e!==xt)return!1;if(!Be)return Xf(e),Be=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||wu(e.type,e.memoizedProps)),i=!i),i&&Xe&&li(e),Xf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Xe=xp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Xe=xp(e)}else t===27?(t=Xe,yi(e.type)?(e=Au,Au=null,Xe=e):Xe=t):Xe=xt?an(e.stateNode.nextSibling):null;return!0}function Fi(){Xe=xt=null,Be=!1}function lc(){var e=ii;return e!==null&&(Ht===null?Ht=e:Ht.push.apply(Ht,e),ii=null),e}function Ta(e){ii===null?ii=[e]:ii.push(e)}var ac=ge(null),Gi=null,_n=null;function ai(e,t,i){ye(ac,t._currentValue),t._currentValue=i}function jn(e){e._currentValue=ac.current,be(ac)}function sc(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 rc(e,t,i,s){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var b=u.child;d=d.firstContext;e:for(;d!==null;){var S=d;d=u;for(var L=0;L<t.length;L++)if(S.context===t[L]){d.lanes|=i,S=d.alternate,S!==null&&(S.lanes|=i),sc(d.return,i,e),s||(b=null);break e}d=S.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(r(341));b.lanes|=i,d=b.alternate,d!==null&&(d.lanes|=i),sc(b,i,e),b=null}else b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function Al(e,t,i,s){e=null;for(var u=t,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var S=u.type;Ft(u.pendingProps.value,b.value)||(e!==null?e.push(S):e=[S])}}else if(u===se.current){if(b=u.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Qa):e=[Qa])}u=u.return}e!==null&&rc(t,e,i,s),t.flags|=262144}function Fs(e){for(e=e.firstContext;e!==null;){if(!Ft(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Gi=e,_n=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wt(e){return Zf(Gi,e)}function Gs(e,t){return Gi===null&&Yi(e),Zf(e,t)}function Zf(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},_n===null){if(e===null)throw Error(r(308));_n=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else _n=_n.next=t;return i}var J0=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()})}},ev=l.unstable_scheduleCallback,tv=l.unstable_NormalPriority,ct={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oc(){return{controller:new J0,data:new Map,refCount:0}}function Ma(e){e.refCount--,e.refCount===0&&ev(tv,function(){e.controller.abort()})}var Aa=null,cc=0,El=0,Nl=null;function nv(e,t){if(Aa===null){var i=Aa=[];cc=0,El=fu(),Nl={status:"pending",value:void 0,then:function(s){i.push(s)}}}return cc++,t.then(Qf,Qf),t}function Qf(){if(--cc===0&&Aa!==null){Nl!==null&&(Nl.status="fulfilled");var e=Aa;Aa=null,El=0,Nl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function iv(e,t){var i=[],s={status:"pending",value:null,reason:null,then:function(u){i.push(u)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var u=0;u<i.length;u++)(0,i[u])(t)},function(u){for(s.status="rejected",s.reason=u,u=0;u<i.length;u++)(0,i[u])(void 0)}),s}var Wf=k.S;k.S=function(e,t){Dm=Et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&nv(e,t),Wf!==null&&Wf(e,t)};var Pi=ge(null);function uc(){var e=Pi.current;return e!==null?e:Ve.pooledCache}function Ys(e,t){t===null?ye(Pi,Pi.current):ye(Pi,t.pool)}function Jf(){var e=uc();return e===null?null:{parent:ct._currentValue,pool:e}}var kl=Error(r(460)),dc=Error(r(474)),Ps=Error(r(542)),$s={then:function(){}};function eh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function th(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Nn,Nn),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ih(e),e;default:if(typeof t.status=="string")t.then(Nn,Nn);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=s}},function(s){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ih(e),e}throw qi=t,kl}}function $i(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(qi=i,kl):i}}var qi=null;function nh(){if(qi===null)throw Error(r(459));var e=qi;return qi=null,e}function ih(e){if(e===kl||e===Ps)throw Error(r(483))}var Ll=null,Ea=0;function qs(e){var t=Ea;return Ea+=1,Ll===null&&(Ll=[]),th(Ll,e,t)}function Na(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Vs(e,t){throw t.$$typeof===x?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function lh(e){function t(K,j){if(e){var F=K.deletions;F===null?(K.deletions=[j],K.flags|=16):F.push(j)}}function i(K,j){if(!e)return null;for(;j!==null;)t(K,j),j=j.sibling;return null}function s(K){for(var j=new Map;K!==null;)K.key!==null?j.set(K.key,K):j.set(K.index,K),K=K.sibling;return j}function u(K,j){return K=Ln(K,j),K.index=0,K.sibling=null,K}function d(K,j,F){return K.index=F,e?(F=K.alternate,F!==null?(F=F.index,F<j?(K.flags|=67108866,j):F):(K.flags|=67108866,j)):(K.flags|=1048576,j)}function b(K){return e&&K.alternate===null&&(K.flags|=67108866),K}function S(K,j,F,ee){return j===null||j.tag!==6?(j=Jo(F,K.mode,ee),j.return=K,j):(j=u(j,F),j.return=K,j)}function L(K,j,F,ee){var Se=F.type;return Se===T?J(K,j,F.props.children,ee,F.key):j!==null&&(j.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===B&&$i(Se)===j.type)?(j=u(j,F.props),Na(j,F),j.return=K,j):(j=Ks(F.type,F.key,F.props,null,K.mode,ee),Na(j,F),j.return=K,j)}function G(K,j,F,ee){return j===null||j.tag!==4||j.stateNode.containerInfo!==F.containerInfo||j.stateNode.implementation!==F.implementation?(j=ec(F,K.mode,ee),j.return=K,j):(j=u(j,F.children||[]),j.return=K,j)}function J(K,j,F,ee,Se){return j===null||j.tag!==7?(j=Ii(F,K.mode,ee,Se),j.return=K,j):(j=u(j,F),j.return=K,j)}function te(K,j,F){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=Jo(""+j,K.mode,F),j.return=K,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case w:return F=Ks(j.type,j.key,j.props,null,K.mode,F),Na(F,j),F.return=K,F;case M:return j=ec(j,K.mode,F),j.return=K,j;case B:return j=$i(j),te(K,j,F)}if(I(j)||W(j))return j=Ii(j,K.mode,F,null),j.return=K,j;if(typeof j.then=="function")return te(K,qs(j),F);if(j.$$typeof===_)return te(K,Gs(K,j),F);Vs(K,j)}return null}function P(K,j,F,ee){var Se=j!==null?j.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Se!==null?null:S(K,j,""+F,ee);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case w:return F.key===Se?L(K,j,F,ee):null;case M:return F.key===Se?G(K,j,F,ee):null;case B:return F=$i(F),P(K,j,F,ee)}if(I(F)||W(F))return Se!==null?null:J(K,j,F,ee,null);if(typeof F.then=="function")return P(K,j,qs(F),ee);if(F.$$typeof===_)return P(K,j,Gs(K,F),ee);Vs(K,F)}return null}function V(K,j,F,ee,Se){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return K=K.get(F)||null,S(j,K,""+ee,Se);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:return K=K.get(ee.key===null?F:ee.key)||null,L(j,K,ee,Se);case M:return K=K.get(ee.key===null?F:ee.key)||null,G(j,K,ee,Se);case B:return ee=$i(ee),V(K,j,F,ee,Se)}if(I(ee)||W(ee))return K=K.get(F)||null,J(j,K,ee,Se,null);if(typeof ee.then=="function")return V(K,j,F,qs(ee),Se);if(ee.$$typeof===_)return V(K,j,F,Gs(j,ee),Se);Vs(j,ee)}return null}function me(K,j,F,ee){for(var Se=null,Ue=null,pe=j,Re=j=0,ze=null;pe!==null&&Re<F.length;Re++){pe.index>Re?(ze=pe,pe=null):ze=pe.sibling;var Ke=P(K,pe,F[Re],ee);if(Ke===null){pe===null&&(pe=ze);break}e&&pe&&Ke.alternate===null&&t(K,pe),j=d(Ke,j,Re),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke,pe=ze}if(Re===F.length)return i(K,pe),Be&&Rn(K,Re),Se;if(pe===null){for(;Re<F.length;Re++)pe=te(K,F[Re],ee),pe!==null&&(j=d(pe,j,Re),Ue===null?Se=pe:Ue.sibling=pe,Ue=pe);return Be&&Rn(K,Re),Se}for(pe=s(pe);Re<F.length;Re++)ze=V(pe,K,Re,F[Re],ee),ze!==null&&(e&&ze.alternate!==null&&pe.delete(ze.key===null?Re:ze.key),j=d(ze,j,Re),Ue===null?Se=ze:Ue.sibling=ze,Ue=ze);return e&&pe.forEach(function(Ci){return t(K,Ci)}),Be&&Rn(K,Re),Se}function Te(K,j,F,ee){if(F==null)throw Error(r(151));for(var Se=null,Ue=null,pe=j,Re=j=0,ze=null,Ke=F.next();pe!==null&&!Ke.done;Re++,Ke=F.next()){pe.index>Re?(ze=pe,pe=null):ze=pe.sibling;var Ci=P(K,pe,Ke.value,ee);if(Ci===null){pe===null&&(pe=ze);break}e&&pe&&Ci.alternate===null&&t(K,pe),j=d(Ci,j,Re),Ue===null?Se=Ci:Ue.sibling=Ci,Ue=Ci,pe=ze}if(Ke.done)return i(K,pe),Be&&Rn(K,Re),Se;if(pe===null){for(;!Ke.done;Re++,Ke=F.next())Ke=te(K,Ke.value,ee),Ke!==null&&(j=d(Ke,j,Re),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke);return Be&&Rn(K,Re),Se}for(pe=s(pe);!Ke.done;Re++,Ke=F.next())Ke=V(pe,K,Re,Ke.value,ee),Ke!==null&&(e&&Ke.alternate!==null&&pe.delete(Ke.key===null?Re:Ke.key),j=d(Ke,j,Re),Ue===null?Se=Ke:Ue.sibling=Ke,Ue=Ke);return e&&pe.forEach(function(mx){return t(K,mx)}),Be&&Rn(K,Re),Se}function qe(K,j,F,ee){if(typeof F=="object"&&F!==null&&F.type===T&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case w:e:{for(var Se=F.key;j!==null;){if(j.key===Se){if(Se=F.type,Se===T){if(j.tag===7){i(K,j.sibling),ee=u(j,F.props.children),ee.return=K,K=ee;break e}}else if(j.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===B&&$i(Se)===j.type){i(K,j.sibling),ee=u(j,F.props),Na(ee,F),ee.return=K,K=ee;break e}i(K,j);break}else t(K,j);j=j.sibling}F.type===T?(ee=Ii(F.props.children,K.mode,ee,F.key),ee.return=K,K=ee):(ee=Ks(F.type,F.key,F.props,null,K.mode,ee),Na(ee,F),ee.return=K,K=ee)}return b(K);case M:e:{for(Se=F.key;j!==null;){if(j.key===Se)if(j.tag===4&&j.stateNode.containerInfo===F.containerInfo&&j.stateNode.implementation===F.implementation){i(K,j.sibling),ee=u(j,F.children||[]),ee.return=K,K=ee;break e}else{i(K,j);break}else t(K,j);j=j.sibling}ee=ec(F,K.mode,ee),ee.return=K,K=ee}return b(K);case B:return F=$i(F),qe(K,j,F,ee)}if(I(F))return me(K,j,F,ee);if(W(F)){if(Se=W(F),typeof Se!="function")throw Error(r(150));return F=Se.call(F),Te(K,j,F,ee)}if(typeof F.then=="function")return qe(K,j,qs(F),ee);if(F.$$typeof===_)return qe(K,j,Gs(K,F),ee);Vs(K,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,j!==null&&j.tag===6?(i(K,j.sibling),ee=u(j,F),ee.return=K,K=ee):(i(K,j),ee=Jo(F,K.mode,ee),ee.return=K,K=ee),b(K)):i(K,j)}return function(K,j,F,ee){try{Ea=0;var Se=qe(K,j,F,ee);return Ll=null,Se}catch(pe){if(pe===kl||pe===Ps)throw pe;var Ue=Gt(29,pe,null,K.mode);return Ue.lanes=ee,Ue.return=K,Ue}finally{}}}var Vi=lh(!0),ah=lh(!1),si=!1;function fc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ri(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function oi(e,t,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ie&2)!==0){var u=s.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),s.pending=t,t=Us(e),Ff(e,null,i),t}return Bs(e,s,t,i),Us(e)}function ka(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Xd(e,i)}}function mc(e,t){var i=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var u=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?u=d=b:d=d.next=b,i=i.next}while(i!==null);d===null?u=d=t:d=d.next=t}else u=d=t;i={baseState:s.baseState,firstBaseUpdate:u,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 pc=!1;function La(){if(pc){var e=Nl;if(e!==null)throw e}}function Ra(e,t,i,s){pc=!1;var u=e.updateQueue;si=!1;var d=u.firstBaseUpdate,b=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var L=S,G=L.next;L.next=null,b===null?d=G:b.next=G,b=L;var J=e.alternate;J!==null&&(J=J.updateQueue,S=J.lastBaseUpdate,S!==b&&(S===null?J.firstBaseUpdate=G:S.next=G,J.lastBaseUpdate=L))}if(d!==null){var te=u.baseState;b=0,J=G=L=null,S=d;do{var P=S.lane&-536870913,V=P!==S.lane;if(V?(De&P)===P:(s&P)===P){P!==0&&P===El&&(pc=!0),J!==null&&(J=J.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var me=e,Te=S;P=t;var qe=i;switch(Te.tag){case 1:if(me=Te.payload,typeof me=="function"){te=me.call(qe,te,P);break e}te=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=Te.payload,P=typeof me=="function"?me.call(qe,te,P):me,P==null)break e;te=v({},te,P);break e;case 2:si=!0}}P=S.callback,P!==null&&(e.flags|=64,V&&(e.flags|=8192),V=u.callbacks,V===null?u.callbacks=[P]:V.push(P))}else V={lane:P,tag:S.tag,payload:S.payload,callback:S.callback,next:null},J===null?(G=J=V,L=te):J=J.next=V,b|=P;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;V=S,S=V.next,V.next=null,u.lastBaseUpdate=V,u.shared.pending=null}}while(!0);J===null&&(L=te),u.baseState=L,u.firstBaseUpdate=G,u.lastBaseUpdate=J,d===null&&(u.shared.lanes=0),hi|=b,e.lanes=b,e.memoizedState=te}}function sh(e,t){if(typeof e!="function")throw Error(r(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++)sh(i[e],t)}var Rl=ge(null),Xs=ge(0);function oh(e,t){e=Fn,ye(Xs,e),ye(Rl,t),Fn=e|t.baseLanes}function gc(){ye(Xs,Fn),ye(Rl,Rl.current)}function bc(){Fn=Xs.current,be(Rl),be(Xs)}var Yt=ge(null),ln=null;function ci(e){var t=e.alternate;ye(at,at.current&1),ye(Yt,e),ln===null&&(t===null||Rl.current!==null||t.memoizedState!==null)&&(ln=e)}function yc(e){ye(at,at.current),ye(Yt,e),ln===null&&(ln=e)}function ch(e){e.tag===22?(ye(at,at.current),ye(Yt,e),ln===null&&(ln=e)):ui()}function ui(){ye(at,at.current),ye(Yt,Yt.current)}function Pt(e){be(Yt),ln===e&&(ln=null),be(at)}var at=ge(0);function Zs(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Tu(i)||Mu(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 On=0,ke=null,Pe=null,ut=null,Qs=!1,_l=!1,Xi=!1,Ws=0,_a=0,jl=null,lv=0;function nt(){throw Error(r(321))}function vc(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Ft(e[i],t[i]))return!1;return!0}function xc(e,t,i,s,u,d){return On=d,ke=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?$h:Dc,Xi=!1,d=i(s,u),Xi=!1,_l&&(d=dh(t,i,s,u)),uh(e),d}function uh(e){k.H=Da;var t=Pe!==null&&Pe.next!==null;if(On=0,ut=Pe=ke=null,Qs=!1,_a=0,jl=null,t)throw Error(r(300));e===null||dt||(e=e.dependencies,e!==null&&Fs(e)&&(dt=!0))}function dh(e,t,i,s){ke=e;var u=0;do{if(_l&&(jl=null),_a=0,_l=!1,25<=u)throw Error(r(301));if(u+=1,ut=Pe=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}k.H=qh,d=t(i,s)}while(_l);return d}function av(){var e=k.H,t=e.useState()[0];return t=typeof t.then=="function"?ja(t):t,e=e.useState()[0],(Pe!==null?Pe.memoizedState:null)!==e&&(ke.flags|=1024),t}function wc(){var e=Ws!==0;return Ws=0,e}function Sc(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Cc(e){if(Qs){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Qs=!1}On=0,ut=Pe=ke=null,_l=!1,_a=Ws=0,jl=null}function Lt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?ke.memoizedState=ut=e:ut=ut.next=e,ut}function st(){if(Pe===null){var e=ke.alternate;e=e!==null?e.memoizedState:null}else e=Pe.next;var t=ut===null?ke.memoizedState:ut.next;if(t!==null)ut=t,Pe=e;else{if(e===null)throw ke.alternate===null?Error(r(467)):Error(r(310));Pe=e,e={memoizedState:Pe.memoizedState,baseState:Pe.baseState,baseQueue:Pe.baseQueue,queue:Pe.queue,next:null},ut===null?ke.memoizedState=ut=e:ut=ut.next=e}return ut}function Js(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ja(e){var t=_a;return _a+=1,jl===null&&(jl=[]),e=th(jl,e,t),t=ke,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?$h:Dc),e}function er(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ja(e);if(e.$$typeof===_)return wt(e)}throw Error(r(438,String(e)))}function Tc(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(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=Js(),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 Dn(e,t){return typeof t=="function"?t(e):t}function tr(e){var t=st();return Mc(t,Pe,e)}function Mc(e,t,i){var s=e.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=i;var u=e.baseQueue,d=s.pending;if(d!==null){if(u!==null){var b=u.next;u.next=d.next,d.next=b}t.baseQueue=u=d,s.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{t=u.next;var S=b=null,L=null,G=t,J=!1;do{var te=G.lane&-536870913;if(te!==G.lane?(De&te)===te:(On&te)===te){var P=G.revertLane;if(P===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),te===El&&(J=!0);else if((On&P)===P){G=G.next,P===El&&(J=!0);continue}else te={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},L===null?(S=L=te,b=d):L=L.next=te,ke.lanes|=P,hi|=P;te=G.action,Xi&&i(d,te),d=G.hasEagerState?G.eagerState:i(d,te)}else P={lane:te,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},L===null?(S=L=P,b=d):L=L.next=P,ke.lanes|=te,hi|=te;G=G.next}while(G!==null&&G!==t);if(L===null?b=d:L.next=S,!Ft(d,e.memoizedState)&&(dt=!0,J&&(i=Nl,i!==null)))throw i;e.memoizedState=d,e.baseState=b,e.baseQueue=L,s.lastRenderedState=d}return u===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Ac(e){var t=st(),i=t.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var s=i.dispatch,u=i.pending,d=t.memoizedState;if(u!==null){i.pending=null;var b=u=u.next;do d=e(d,b.action),b=b.next;while(b!==u);Ft(d,t.memoizedState)||(dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),i.lastRenderedState=d}return[d,s]}function fh(e,t,i){var s=ke,u=st(),d=Be;if(d){if(i===void 0)throw Error(r(407));i=i()}else i=t();var b=!Ft((Pe||u).memoizedState,i);if(b&&(u.memoizedState=i,dt=!0),u=u.queue,kc(ph.bind(null,s,u,e),[e]),u.getSnapshot!==t||b||ut!==null&&ut.memoizedState.tag&1){if(s.flags|=2048,Ol(9,{destroy:void 0},mh.bind(null,s,u,i,t),null),Ve===null)throw Error(r(349));d||(On&127)!==0||hh(s,t,i)}return i}function hh(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=ke.updateQueue,t===null?(t=Js(),ke.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function mh(e,t,i,s){t.value=i,t.getSnapshot=s,gh(t)&&bh(e)}function ph(e,t,i){return i(function(){gh(t)&&bh(e)})}function gh(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Ft(e,i)}catch{return!0}}function bh(e){var t=Ki(e,2);t!==null&&Bt(t,e,2)}function Ec(e){var t=Lt();if(typeof e=="function"){var i=e;if(e=i(),Xi){fn(!0);try{i()}finally{fn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:e},t}function yh(e,t,i,s){return e.baseState=i,Mc(e,Pe,typeof s=="function"?s:Dn)}function sv(e,t,i,s,u){if(lr(e))throw Error(r(485));if(e=t.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};k.T!==null?i(!0):d.isTransition=!1,s(d),i=t.pending,i===null?(d.next=t.pending=d,vh(t,d)):(d.next=i.next,t.pending=i.next=d)}}function vh(e,t){var i=t.action,s=t.payload,u=e.state;if(t.isTransition){var d=k.T,b={};k.T=b;try{var S=i(u,s),L=k.S;L!==null&&L(b,S),xh(e,t,S)}catch(G){Nc(e,t,G)}finally{d!==null&&b.types!==null&&(d.types=b.types),k.T=d}}else try{d=i(u,s),xh(e,t,d)}catch(G){Nc(e,t,G)}}function xh(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){wh(e,t,s)},function(s){return Nc(e,t,s)}):wh(e,t,i)}function wh(e,t,i){t.status="fulfilled",t.value=i,Sh(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,vh(e,i)))}function Nc(e,t,i){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=i,Sh(t),t=t.next;while(t!==s)}e.action=null}function Sh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ch(e,t){return t}function Th(e,t){if(Be){var i=Ve.formState;if(i!==null){e:{var s=ke;if(Be){if(Xe){t:{for(var u=Xe,d=nn;u.nodeType!==8;){if(!d){u=null;break t}if(u=an(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Xe=an(u.nextSibling),s=u.data==="F!";break e}}li(s)}s=!1}s&&(t=i[0])}}return i=Lt(),i.memoizedState=i.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ch,lastRenderedState:t},i.queue=s,i=Gh.bind(null,ke,s),s.dispatch=i,s=Ec(!1),d=Oc.bind(null,ke,!1,s.queue),s=Lt(),u={state:t,dispatch:null,action:e,pending:null},s.queue=u,i=sv.bind(null,ke,u,d,i),u.dispatch=i,s.memoizedState=e,[t,i,!1]}function Mh(e){var t=st();return Ah(t,Pe,e)}function Ah(e,t,i){if(t=Mc(e,t,Ch)[0],e=tr(Dn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ja(t)}catch(b){throw b===kl?Ps:b}else s=t;t=st();var u=t.queue,d=u.dispatch;return i!==t.memoizedState&&(ke.flags|=2048,Ol(9,{destroy:void 0},rv.bind(null,u,i),null)),[s,d,e]}function rv(e,t){e.action=t}function Eh(e){var t=st(),i=Pe;if(i!==null)return Ah(t,i,e);st(),t=t.memoizedState,i=st();var s=i.queue.dispatch;return i.memoizedState=e,[t,s,!1]}function Ol(e,t,i,s){return e={tag:e,create:i,deps:s,inst:t,next:null},t=ke.updateQueue,t===null&&(t=Js(),ke.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e),e}function Nh(){return st().memoizedState}function nr(e,t,i,s){var u=Lt();ke.flags|=e,u.memoizedState=Ol(1|t,{destroy:void 0},i,s===void 0?null:s)}function ir(e,t,i,s){var u=st();s=s===void 0?null:s;var d=u.memoizedState.inst;Pe!==null&&s!==null&&vc(s,Pe.memoizedState.deps)?u.memoizedState=Ol(t,d,i,s):(ke.flags|=e,u.memoizedState=Ol(1|t,d,i,s))}function kh(e,t){nr(8390656,8,e,t)}function kc(e,t){ir(2048,8,e,t)}function ov(e){ke.flags|=4;var t=ke.updateQueue;if(t===null)t=Js(),ke.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Lh(e){var t=st().memoizedState;return ov({ref:t,nextImpl:e}),function(){if((Ie&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Rh(e,t){return ir(4,2,e,t)}function _h(e,t){return ir(4,4,e,t)}function jh(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Oh(e,t,i){i=i!=null?i.concat([e]):null,ir(4,4,jh.bind(null,t,e),i)}function Lc(){}function Dh(e,t){var i=st();t=t===void 0?null:t;var s=i.memoizedState;return t!==null&&vc(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function zh(e,t){var i=st();t=t===void 0?null:t;var s=i.memoizedState;if(t!==null&&vc(t,s[1]))return s[0];if(s=e(),Xi){fn(!0);try{e()}finally{fn(!1)}}return i.memoizedState=[s,t],s}function Rc(e,t,i){return i===void 0||(On&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Hm(),ke.lanes|=e,hi|=e,i)}function Hh(e,t,i,s){return Ft(i,t)?i:Rl.current!==null?(e=Rc(e,i,s),Ft(e,t)||(dt=!0),e):(On&42)===0||(On&1073741824)!==0&&(De&261930)===0?(dt=!0,e.memoizedState=i):(e=Hm(),ke.lanes|=e,hi|=e,t)}function Bh(e,t,i,s,u){var d=Y.p;Y.p=d!==0&&8>d?d:8;var b=k.T,S={};k.T=S,Oc(e,!1,t,i);try{var L=u(),G=k.S;if(G!==null&&G(S,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var J=iv(L,s);Oa(e,t,J,Vt(e))}else Oa(e,t,s,Vt(e))}catch(te){Oa(e,t,{then:function(){},status:"rejected",reason:te},Vt())}finally{Y.p=d,b!==null&&S.types!==null&&(b.types=S.types),k.T=b}}function cv(){}function _c(e,t,i,s){if(e.tag!==5)throw Error(r(476));var u=Uh(e).queue;Bh(e,u,t,Q,i===null?cv:function(){return Kh(e),i(s)})}function Uh(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:Dn,lastRenderedState:Q},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dn,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Kh(e){var t=Uh(e);t.next===null&&(t=e.alternate.memoizedState),Oa(e,t.next.queue,{},Vt())}function jc(){return wt(Qa)}function Ih(){return st().memoizedState}function Fh(){return st().memoizedState}function uv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Vt();e=ri(i);var s=oi(t,e,i);s!==null&&(Bt(s,t,i),ka(s,t,i)),t={cache:oc()},e.payload=t;return}t=t.return}}function dv(e,t,i){var s=Vt();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},lr(e)?Yh(t,i):(i=Qo(e,t,i,s),i!==null&&(Bt(i,e,s),Ph(i,t,s)))}function Gh(e,t,i){var s=Vt();Oa(e,t,i,s)}function Oa(e,t,i,s){var u={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(lr(e))Yh(t,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,S=d(b,i);if(u.hasEagerState=!0,u.eagerState=S,Ft(S,b))return Bs(e,t,u,0),Ve===null&&Hs(),!1}catch{}finally{}if(i=Qo(e,t,u,s),i!==null)return Bt(i,e,s),Ph(i,t,s),!0}return!1}function Oc(e,t,i,s){if(s={lane:2,revertLane:fu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},lr(e)){if(t)throw Error(r(479))}else t=Qo(e,i,s,2),t!==null&&Bt(t,e,2)}function lr(e){var t=e.alternate;return e===ke||t!==null&&t===ke}function Yh(e,t){_l=Qs=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Ph(e,t,i){if((i&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Xd(e,i)}}var Da={readContext:wt,use:er,useCallback:nt,useContext:nt,useEffect:nt,useImperativeHandle:nt,useLayoutEffect:nt,useInsertionEffect:nt,useMemo:nt,useReducer:nt,useRef:nt,useState:nt,useDebugValue:nt,useDeferredValue:nt,useTransition:nt,useSyncExternalStore:nt,useId:nt,useHostTransitionStatus:nt,useFormState:nt,useActionState:nt,useOptimistic:nt,useMemoCache:nt,useCacheRefresh:nt};Da.useEffectEvent=nt;var $h={readContext:wt,use:er,useCallback:function(e,t){return Lt().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:kh,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,nr(4194308,4,jh.bind(null,t,e),i)},useLayoutEffect:function(e,t){return nr(4194308,4,e,t)},useInsertionEffect:function(e,t){nr(4,2,e,t)},useMemo:function(e,t){var i=Lt();t=t===void 0?null:t;var s=e();if(Xi){fn(!0);try{e()}finally{fn(!1)}}return i.memoizedState=[s,t],s},useReducer:function(e,t,i){var s=Lt();if(i!==void 0){var u=i(t);if(Xi){fn(!0);try{i(t)}finally{fn(!1)}}}else u=t;return s.memoizedState=s.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},s.queue=e,e=e.dispatch=dv.bind(null,ke,e),[s.memoizedState,e]},useRef:function(e){var t=Lt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ec(e);var t=e.queue,i=Gh.bind(null,ke,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Lc,useDeferredValue:function(e,t){var i=Lt();return Rc(i,e,t)},useTransition:function(){var e=Ec(!1);return e=Bh.bind(null,ke,e.queue,!0,!1),Lt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var s=ke,u=Lt();if(Be){if(i===void 0)throw Error(r(407));i=i()}else{if(i=t(),Ve===null)throw Error(r(349));(De&127)!==0||hh(s,t,i)}u.memoizedState=i;var d={value:i,getSnapshot:t};return u.queue=d,kh(ph.bind(null,s,d,e),[e]),s.flags|=2048,Ol(9,{destroy:void 0},mh.bind(null,s,d,i,t),null),i},useId:function(){var e=Lt(),t=Ve.identifierPrefix;if(Be){var i=vn,s=yn;i=(s&~(1<<32-Mt(s)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ws++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=lv++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:jc,useFormState:Th,useActionState:Th,useOptimistic:function(e){var t=Lt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=Oc.bind(null,ke,!0,i),i.dispatch=t,[e,t]},useMemoCache:Tc,useCacheRefresh:function(){return Lt().memoizedState=uv.bind(null,ke)},useEffectEvent:function(e){var t=Lt(),i={impl:e};return t.memoizedState=i,function(){if((Ie&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},Dc={readContext:wt,use:er,useCallback:Dh,useContext:wt,useEffect:kc,useImperativeHandle:Oh,useInsertionEffect:Rh,useLayoutEffect:_h,useMemo:zh,useReducer:tr,useRef:Nh,useState:function(){return tr(Dn)},useDebugValue:Lc,useDeferredValue:function(e,t){var i=st();return Hh(i,Pe.memoizedState,e,t)},useTransition:function(){var e=tr(Dn)[0],t=st().memoizedState;return[typeof e=="boolean"?e:ja(e),t]},useSyncExternalStore:fh,useId:Ih,useHostTransitionStatus:jc,useFormState:Mh,useActionState:Mh,useOptimistic:function(e,t){var i=st();return yh(i,Pe,e,t)},useMemoCache:Tc,useCacheRefresh:Fh};Dc.useEffectEvent=Lh;var qh={readContext:wt,use:er,useCallback:Dh,useContext:wt,useEffect:kc,useImperativeHandle:Oh,useInsertionEffect:Rh,useLayoutEffect:_h,useMemo:zh,useReducer:Ac,useRef:Nh,useState:function(){return Ac(Dn)},useDebugValue:Lc,useDeferredValue:function(e,t){var i=st();return Pe===null?Rc(i,e,t):Hh(i,Pe.memoizedState,e,t)},useTransition:function(){var e=Ac(Dn)[0],t=st().memoizedState;return[typeof e=="boolean"?e:ja(e),t]},useSyncExternalStore:fh,useId:Ih,useHostTransitionStatus:jc,useFormState:Eh,useActionState:Eh,useOptimistic:function(e,t){var i=st();return Pe!==null?yh(i,Pe,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Tc,useCacheRefresh:Fh};qh.useEffectEvent=Lh;function zc(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 Hc={enqueueSetState:function(e,t,i){e=e._reactInternals;var s=Vt(),u=ri(s);u.payload=t,i!=null&&(u.callback=i),t=oi(e,u,s),t!==null&&(Bt(t,e,s),ka(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=Vt(),u=ri(s);u.tag=1,u.payload=t,i!=null&&(u.callback=i),t=oi(e,u,s),t!==null&&(Bt(t,e,s),ka(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Vt(),s=ri(i);s.tag=2,t!=null&&(s.callback=t),t=oi(e,s,i),t!==null&&(Bt(t,e,i),ka(t,e,i))}};function Vh(e,t,i,s,u,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!wa(i,s)||!wa(u,d):!0}function Xh(e,t,i,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&Hc.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 u in e)i[u]===void 0&&(i[u]=e[u])}return i}function Zh(e){zs(e)}function Qh(e){console.error(e)}function Wh(e){zs(e)}function ar(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Jh(e,t,i){try{var s=e.onCaughtError;s(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Bc(e,t,i){return i=ri(i),i.tag=3,i.payload={element:null},i.callback=function(){ar(e,t)},i}function em(e){return e=ri(e),e.tag=3,e}function tm(e,t,i,s){var u=i.type.getDerivedStateFromError;if(typeof u=="function"){var d=s.value;e.payload=function(){return u(d)},e.callback=function(){Jh(t,i,s)}}var b=i.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Jh(t,i,s),typeof u!="function"&&(mi===null?mi=new Set([this]):mi.add(this));var S=s.stack;this.componentDidCatch(s.value,{componentStack:S!==null?S:""})})}function fv(e,t,i,s,u){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=i.alternate,t!==null&&Al(t,i,u,!0),i=Yt.current,i!==null){switch(i.tag){case 31:case 13:return ln===null?br():i.alternate===null&&it===0&&(it=3),i.flags&=-257,i.flags|=65536,i.lanes=u,s===$s?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([s]):t.add(s),cu(e,s,u)),!1;case 22:return i.flags|=65536,s===$s?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)),cu(e,s,u)),!1}throw Error(r(435,i.tag))}return cu(e,s,u),br(),!1}if(Be)return t=Yt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,s!==ic&&(e=Error(r(422),{cause:s}),Ta(Jt(e,i)))):(s!==ic&&(t=Error(r(423),{cause:s}),Ta(Jt(t,i))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,s=Jt(s,i),u=Bc(e.stateNode,s,u),mc(e,u),it!==4&&(it=2)),!1;var d=Error(r(520),{cause:s});if(d=Jt(d,i),Ga===null?Ga=[d]:Ga.push(d),it!==4&&(it=2),t===null)return!0;s=Jt(s,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=u&-u,i.lanes|=e,e=Bc(i.stateNode,s,e),mc(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"&&(mi===null||!mi.has(d))))return i.flags|=65536,u&=-u,i.lanes|=u,u=em(u),tm(u,e,i,s),mc(i,u),!1}i=i.return}while(i!==null);return!1}var Uc=Error(r(461)),dt=!1;function St(e,t,i,s){t.child=e===null?ah(t,null,i,s):Vi(t,e.child,i,s)}function nm(e,t,i,s,u){i=i.render;var d=t.ref;if("ref"in s){var b={};for(var S in s)S!=="ref"&&(b[S]=s[S])}else b=s;return Yi(t),s=xc(e,t,i,b,d,u),S=wc(),e!==null&&!dt?(Sc(e,t,u),zn(e,t,u)):(Be&&S&&tc(t),t.flags|=1,St(e,t,s,u),t.child)}function im(e,t,i,s,u){if(e===null){var d=i.type;return typeof d=="function"&&!Wo(d)&&d.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=d,lm(e,t,d,s,u)):(e=Ks(i.type,null,s,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!qc(e,u)){var b=d.memoizedProps;if(i=i.compare,i=i!==null?i:wa,i(b,s)&&e.ref===t.ref)return zn(e,t,u)}return t.flags|=1,e=Ln(d,s),e.ref=t.ref,e.return=t,t.child=e}function lm(e,t,i,s,u){if(e!==null){var d=e.memoizedProps;if(wa(d,s)&&e.ref===t.ref)if(dt=!1,t.pendingProps=s=d,qc(e,u))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,zn(e,t,u)}return Kc(e,t,i,s,u)}function am(e,t,i,s){var u=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,u=0;s!==null;)u=u|s.lanes|s.childLanes,s=s.sibling;s=u&~d}else s=0,t.child=null;return sm(e,t,d,i,s)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ys(t,d!==null?d.cachePool:null),d!==null?oh(t,d):gc(),ch(t);else return s=t.lanes=536870912,sm(e,t,d!==null?d.baseLanes|i:i,i,s)}else d!==null?(Ys(t,d.cachePool),oh(t,d),ui(),t.memoizedState=null):(e!==null&&Ys(t,null),gc(),ui());return St(e,t,u,i),t.child}function za(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sm(e,t,i,s,u){var d=uc();return d=d===null?null:{parent:ct._currentValue,pool:d},t.memoizedState={baseLanes:i,cachePool:d},e!==null&&Ys(t,null),gc(),ch(t),e!==null&&Al(e,t,s,!0),t.childLanes=u,null}function sr(e,t){return t=or({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 Vi(t,e.child,null,i),e=sr(t,t.pendingProps),e.flags|=2,Pt(t),t.memoizedState=null,e}function hv(e,t,i){var s=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Be){if(s.mode==="hidden")return e=sr(t,s),t.lanes=536870912,za(null,e);if(yc(t),(e=Xe)?(e=vp(e,nn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ni!==null?{id:yn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},i=Yf(e),i.return=t,t.child=i,xt=t,Xe=null)):e=null,e===null)throw li(t);return t.lanes=536870912,null}return sr(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(yc(t),u)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(r(558));else if(dt||Al(e,t,i,!1),u=(i&e.childLanes)!==0,dt||u){if(s=Ve,s!==null&&(b=Zd(s,i),b!==0&&b!==d.retryLane))throw d.retryLane=b,Ki(e,b),Bt(s,e,b),Uc;br(),t=rm(e,t,i)}else e=d.treeContext,Xe=an(b.nextSibling),xt=t,Be=!0,ii=null,nn=!1,e!==null&&qf(t,e),t=sr(t,s),t.flags|=4096;return t}return e=Ln(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function rr(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(r(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function Kc(e,t,i,s,u){return Yi(t),i=xc(e,t,i,s,void 0,u),s=wc(),e!==null&&!dt?(Sc(e,t,u),zn(e,t,u)):(Be&&s&&tc(t),t.flags|=1,St(e,t,i,u),t.child)}function om(e,t,i,s,u,d){return Yi(t),t.updateQueue=null,i=dh(t,s,i,u),uh(e),s=wc(),e!==null&&!dt?(Sc(e,t,d),zn(e,t,d)):(Be&&s&&tc(t),t.flags|=1,St(e,t,i,d),t.child)}function cm(e,t,i,s,u){if(Yi(t),t.stateNode===null){var d=Sl,b=i.contextType;typeof b=="object"&&b!==null&&(d=wt(b)),d=new i(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Hc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},fc(t),b=i.contextType,d.context=typeof b=="object"&&b!==null?wt(b):Sl,d.state=t.memoizedState,b=i.getDerivedStateFromProps,typeof b=="function"&&(zc(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&&Hc.enqueueReplaceState(d,d.state,null),Ra(t,s,d,u),La(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var S=t.memoizedProps,L=Zi(i,S);d.props=L;var G=d.context,J=i.contextType;b=Sl,typeof J=="object"&&J!==null&&(b=wt(J));var te=i.getDerivedStateFromProps;J=typeof te=="function"||typeof d.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,J||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(S||G!==b)&&Xh(t,d,s,b),si=!1;var P=t.memoizedState;d.state=P,Ra(t,s,d,u),La(),G=t.memoizedState,S||P!==G||si?(typeof te=="function"&&(zc(t,i,te,s),G=t.memoizedState),(L=si||Vh(t,i,L,s,P,G,b))?(J||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=G),d.props=s,d.state=G,d.context=b,s=L):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,hc(e,t),b=t.memoizedProps,J=Zi(i,b),d.props=J,te=t.pendingProps,P=d.context,G=i.contextType,L=Sl,typeof G=="object"&&G!==null&&(L=wt(G)),S=i.getDerivedStateFromProps,(G=typeof S=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==te||P!==L)&&Xh(t,d,s,L),si=!1,P=t.memoizedState,d.state=P,Ra(t,s,d,u),La();var V=t.memoizedState;b!==te||P!==V||si||e!==null&&e.dependencies!==null&&Fs(e.dependencies)?(typeof S=="function"&&(zc(t,i,S,s),V=t.memoizedState),(J=si||Vh(t,i,J,s,P,V,L)||e!==null&&e.dependencies!==null&&Fs(e.dependencies))?(G||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&&P===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=V),d.props=s,d.state=V,d.context=L,s=J):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&P===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,rr(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,i=s&&typeof i.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=Vi(t,e.child,null,u),t.child=Vi(t,null,i,u)):St(e,t,i,u),t.memoizedState=d.state,e=t.child):e=zn(e,t,u),e}function um(e,t,i,s){return Fi(),t.flags|=256,St(e,t,i,s),t.child}var Ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fc(e){return{baseLanes:e,cachePool:Jf()}}function Gc(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=qt),e}function dm(e,t,i){var s=t.pendingProps,u=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Be){if(u?ci(t):ui(),(e=Xe)?(e=vp(e,nn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ni!==null?{id:yn,overflow:vn}:null,retryLane:536870912,hydrationErrors:null},i=Yf(e),i.return=t,t.child=i,xt=t,Xe=null)):e=null,e===null)throw li(t);return Mu(e)?t.lanes=32:t.lanes=536870912,null}var S=s.children;return s=s.fallback,u?(ui(),u=t.mode,S=or({mode:"hidden",children:S},u),s=Ii(s,u,i,null),S.return=t,s.return=t,S.sibling=s,t.child=S,s=t.child,s.memoizedState=Fc(i),s.childLanes=Gc(e,b,i),t.memoizedState=Ic,za(null,s)):(ci(t),Yc(t,S))}var L=e.memoizedState;if(L!==null&&(S=L.dehydrated,S!==null)){if(d)t.flags&256?(ci(t),t.flags&=-257,t=Pc(e,t,i)):t.memoizedState!==null?(ui(),t.child=e.child,t.flags|=128,t=null):(ui(),S=s.fallback,u=t.mode,s=or({mode:"visible",children:s.children},u),S=Ii(S,u,i,null),S.flags|=2,s.return=t,S.return=t,s.sibling=S,t.child=s,Vi(t,e.child,null,i),s=t.child,s.memoizedState=Fc(i),s.childLanes=Gc(e,b,i),t.memoizedState=Ic,t=za(null,s));else if(ci(t),Mu(S)){if(b=S.nextSibling&&S.nextSibling.dataset,b)var G=b.dgst;b=G,s=Error(r(419)),s.stack="",s.digest=b,Ta({value:s,source:null,stack:null}),t=Pc(e,t,i)}else if(dt||Al(e,t,i,!1),b=(i&e.childLanes)!==0,dt||b){if(b=Ve,b!==null&&(s=Zd(b,i),s!==0&&s!==L.retryLane))throw L.retryLane=s,Ki(e,s),Bt(b,e,s),Uc;Tu(S)||br(),t=Pc(e,t,i)}else Tu(S)?(t.flags|=192,t.child=e.child,t=null):(e=L.treeContext,Xe=an(S.nextSibling),xt=t,Be=!0,ii=null,nn=!1,e!==null&&qf(t,e),t=Yc(t,s.children),t.flags|=4096);return t}return u?(ui(),S=s.fallback,u=t.mode,L=e.child,G=L.sibling,s=Ln(L,{mode:"hidden",children:s.children}),s.subtreeFlags=L.subtreeFlags&65011712,G!==null?S=Ln(G,S):(S=Ii(S,u,i,null),S.flags|=2),S.return=t,s.return=t,s.sibling=S,t.child=s,za(null,s),s=t.child,S=e.child.memoizedState,S===null?S=Fc(i):(u=S.cachePool,u!==null?(L=ct._currentValue,u=u.parent!==L?{parent:L,pool:L}:u):u=Jf(),S={baseLanes:S.baseLanes|i,cachePool:u}),s.memoizedState=S,s.childLanes=Gc(e,b,i),t.memoizedState=Ic,za(e.child,s)):(ci(t),i=e.child,e=i.sibling,i=Ln(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 Yc(e,t){return t=or({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function or(e,t){return e=Gt(22,e,null,t),e.lanes=0,e}function Pc(e,t,i){return Vi(t,e.child,null,i),e=Yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fm(e,t,i){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),sc(e.return,t,i)}function $c(e,t,i,s,u,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:u,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=i,b.tailMode=u,b.treeForkCount=d)}function hm(e,t,i){var s=t.pendingProps,u=s.revealOrder,d=s.tail;s=s.children;var b=at.current,S=(b&2)!==0;if(S?(b=b&1|2,t.flags|=128):b&=1,ye(at,b),St(e,t,s,i),s=Be?Ca:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fm(e,i,t);else if(e.tag===19)fm(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(i=t.child,u=null;i!==null;)e=i.alternate,e!==null&&Zs(e)===null&&(u=i),i=i.sibling;i=u,i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null),$c(t,!1,u,i,d,s);break;case"backwards":case"unstable_legacy-backwards":for(i=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Zs(e)===null){t.child=u;break}e=u.sibling,u.sibling=i,i=u,u=e}$c(t,!0,i,null,d,s);break;case"together":$c(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function zn(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),hi|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Al(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,i=Ln(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Ln(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function qc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Fs(e)))}function mv(e,t,i){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),ai(t,ct,e.memoizedState.cache),Fi();break;case 27:case 5:we(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:ai(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,yc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ci(t),t.flags|=128,null):(i&t.child.childLanes)!==0?dm(e,t,i):(ci(t),e=zn(e,t,i),e!==null?e.sibling:null);ci(t);break;case 19:var u=(e.flags&128)!==0;if(s=(i&t.childLanes)!==0,s||(Al(e,t,i,!1),s=(i&t.childLanes)!==0),u){if(s)return hm(e,t,i);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ye(at,at.current),s)break;return null;case 22:return t.lanes=0,am(e,t,i,t.pendingProps);case 24:ai(t,ct,e.memoizedState.cache)}return zn(e,t,i)}function mm(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!qc(e,i)&&(t.flags&128)===0)return dt=!1,mv(e,t,i);dt=(e.flags&131072)!==0}else dt=!1,Be&&(t.flags&1048576)!==0&&$f(t,Ca,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=$i(t.elementType),t.type=e,typeof e=="function")Wo(e)?(s=Zi(e,s),t.tag=1,t=cm(null,t,e,s,i)):(t.tag=0,t=Kc(null,t,e,s,i));else{if(e!=null){var u=e.$$typeof;if(u===z){t.tag=11,t=nm(null,t,e,s,i);break e}else if(u===R){t.tag=14,t=im(null,t,e,s,i);break e}}throw t=oe(e)||e,Error(r(306,t,""))}}return t;case 0:return Kc(e,t,t.type,t.pendingProps,i);case 1:return s=t.type,u=Zi(s,t.pendingProps),cm(e,t,s,u,i);case 3:e:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(r(387));s=t.pendingProps;var d=t.memoizedState;u=d.element,hc(e,t),Ra(t,s,null,i);var b=t.memoizedState;if(s=b.cache,ai(t,ct,s),s!==d.cache&&rc(t,[ct],i,!0),La(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=um(e,t,s,i);break e}else if(s!==u){u=Jt(Error(r(424)),t),Ta(u),t=um(e,t,s,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Xe=an(e.firstChild),xt=t,Be=!0,ii=null,nn=!0,i=ah(t,null,s,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Fi(),s===u){t=zn(e,t,i);break e}St(e,t,s,i)}t=t.child}return t;case 26:return rr(e,t),e===null?(i=Mp(t.type,null,t.pendingProps,null))?t.memoizedState=i:Be||(i=t.type,e=t.pendingProps,s=Tr(xe.current).createElement(i),s[vt]=t,s[_t]=e,Ct(s,i,e),pt(s),t.stateNode=s):t.memoizedState=Mp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return we(t),e===null&&Be&&(s=t.stateNode=Sp(t.type,t.pendingProps,xe.current),xt=t,nn=!0,u=Xe,yi(t.type)?(Au=u,Xe=an(s.firstChild)):Xe=u),St(e,t,t.pendingProps.children,i),rr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Be&&((u=s=Xe)&&(s=Yv(s,t.type,t.pendingProps,nn),s!==null?(t.stateNode=s,xt=t,Xe=an(s.firstChild),nn=!1,u=!0):u=!1),u||li(t)),we(t),u=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,wu(u,d)?s=null:b!==null&&wu(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=xc(e,t,av,null,null,i),Qa._currentValue=u),rr(e,t),St(e,t,s,i),t.child;case 6:return e===null&&Be&&((e=i=Xe)&&(i=Pv(i,t.pendingProps,nn),i!==null?(t.stateNode=i,xt=t,Xe=null,e=!0):e=!1),e||li(t)),null;case 13:return dm(e,t,i);case 4:return ve(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Vi(t,null,s,i):St(e,t,s,i),t.child;case 11:return nm(e,t,t.type,t.pendingProps,i);case 7:return St(e,t,t.pendingProps,i),t.child;case 8:return St(e,t,t.pendingProps.children,i),t.child;case 12:return St(e,t,t.pendingProps.children,i),t.child;case 10:return s=t.pendingProps,ai(t,t.type,s.value),St(e,t,s.children,i),t.child;case 9:return u=t.type._context,s=t.pendingProps.children,Yi(t),u=wt(u),s=s(u),t.flags|=1,St(e,t,s,i),t.child;case 14:return im(e,t,t.type,t.pendingProps,i);case 15:return lm(e,t,t.type,t.pendingProps,i);case 19:return hm(e,t,i);case 31:return hv(e,t,i);case 22:return am(e,t,i,t.pendingProps);case 24:return Yi(t),s=wt(ct),e===null?(u=uc(),u===null&&(u=Ve,d=oc(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=i),u=d),t.memoizedState={parent:s,cache:u},fc(t),ai(t,ct,u)):((e.lanes&i)!==0&&(hc(e,t),Ra(t,null,null,i),La()),u=e.memoizedState,d=t.memoizedState,u.parent!==s?(u={parent:s,cache:s},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ai(t,ct,s)):(s=d.cache,ai(t,ct,s),s!==u.cache&&rc(t,[ct],i,!0))),St(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Hn(e){e.flags|=4}function Vc(e,t,i,s,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Im())e.flags|=8192;else throw qi=$s,dc}else e.flags&=-16777217}function pm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Lp(t))if(Im())e.flags|=8192;else throw qi=$s,dc}function cr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ua():536870912,e.lanes|=t,Bl|=t)}function Ha(e,t){if(!Be)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,s=0;if(t)for(var u=e.child;u!==null;)i|=u.lanes|u.childLanes,s|=u.subtreeFlags&65011712,s|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)i|=u.lanes|u.childLanes,s|=u.subtreeFlags,s|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function pv(e,t,i){var s=t.pendingProps;switch(nc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(t),null;case 1:return Ze(t),null;case 3:return i=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),jn(ct),ie(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ml(t)?Hn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,lc())),Ze(t),null;case 26:var u=t.type,d=t.memoizedState;return e===null?(Hn(t),d!==null?(Ze(t),pm(t,d)):(Ze(t),Vc(t,u,null,s,i))):d?d!==e.memoizedState?(Hn(t),Ze(t),pm(t,d)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Hn(t),Ze(t),Vc(t,u,e,s,i)),null;case 27:if(Ee(t),i=xe.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Hn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ze(t),null}e=Me.current,Ml(t)?Vf(t):(e=Sp(u,s,i),t.stateNode=e,Hn(t))}return Ze(t),null;case 5:if(Ee(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Hn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ze(t),null}if(d=Me.current,Ml(t))Vf(t);else{var b=Tr(xe.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);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(u,{is:s.is}):b.createElement(u)}}d[vt]=t,d[_t]=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(Ct(d,u,s),u){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Hn(t)}}return Ze(t),Vc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Hn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=xe.current,Ml(t)){if(e=t.stateNode,i=t.memoizedProps,s=null,u=xt,u!==null)switch(u.tag){case 27:case 5:s=u.memoizedProps}e[vt]=t,e=!!(e.nodeValue===i||s!==null&&s.suppressHydrationWarning===!0||dp(e.nodeValue,i)),e||li(t,!0)}else e=Tr(e).createTextNode(s),e[vt]=t,t.stateNode=e}return Ze(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(s=Ml(t),i!==null){if(e===null){if(!s)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[vt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else i=lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Pt(t),t):(Pt(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Ze(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Ml(t),s!==null&&s.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[vt]=t}else Fi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),u=!1}else u=lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Pt(t),t):(Pt(t),null)}return Pt(t),(t.flags&128)!==0?(t.lanes=i,t):(i=s!==null,e=e!==null&&e.memoizedState!==null,i&&(s=t.child,u=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(u=s.alternate.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==u&&(s.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),cr(t,t.updateQueue),Ze(t),null);case 4:return ie(),e===null&&gu(t.stateNode.containerInfo),Ze(t),null;case 10:return jn(t.type),Ze(t),null;case 19:if(be(at),s=t.memoizedState,s===null)return Ze(t),null;if(u=(t.flags&128)!==0,d=s.rendering,d===null)if(u)Ha(s,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Zs(e),d!==null){for(t.flags|=128,Ha(s,!1),e=d.updateQueue,t.updateQueue=e,cr(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Gf(i,e),i=i.sibling;return ye(at,at.current&1|2),Be&&Rn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Et()>mr&&(t.flags|=128,u=!0,Ha(s,!1),t.lanes=4194304)}else{if(!u)if(e=Zs(d),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,cr(t,e),Ha(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!Be)return Ze(t),null}else 2*Et()-s.renderingStartTime>mr&&i!==536870912&&(t.flags|=128,u=!0,Ha(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=Et(),e.sibling=null,i=at.current,ye(at,u?i&1|2:i&1),Be&&Rn(t,s.treeForkCount),e):(Ze(t),null);case 22:case 23:return Pt(t),bc(),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&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),i=t.updateQueue,i!==null&&cr(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&&be(Pi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),jn(ct),Ze(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function gv(e,t){switch(nc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jn(ct),ie(),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(Pt(t),t.alternate===null)throw Error(r(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Pt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return be(at),null;case 4:return ie(),null;case 10:return jn(t.type),null;case 22:case 23:return Pt(t),bc(),e!==null&&be(Pi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return jn(ct),null;case 25:return null;default:return null}}function gm(e,t){switch(nc(t),t.tag){case 3:jn(ct),ie();break;case 26:case 27:case 5:Ee(t);break;case 4:ie();break;case 31:t.memoizedState!==null&&Pt(t);break;case 13:Pt(t);break;case 19:be(at);break;case 10:jn(t.type);break;case 22:case 23:Pt(t),bc(),e!==null&&be(Pi);break;case 24:jn(ct)}}function Ba(e,t){try{var i=t.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var u=s.next;i=u;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!==u)}}catch(S){Ye(t,t.return,S)}}function di(e,t,i){try{var s=t.updateQueue,u=s!==null?s.lastEffect:null;if(u!==null){var d=u.next;s=d;do{if((s.tag&e)===e){var b=s.inst,S=b.destroy;if(S!==void 0){b.destroy=void 0,u=t;var L=i,G=S;try{G()}catch(J){Ye(u,L,J)}}}s=s.next}while(s!==d)}}catch(J){Ye(t,t.return,J)}}function bm(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{rh(t,i)}catch(s){Ye(e,e.return,s)}}}function ym(e,t,i){i.props=Zi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){Ye(e,t,s)}}function Ua(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(u){Ye(e,t,u)}}function xn(e,t){var i=e.ref,s=e.refCleanup;if(i!==null)if(typeof s=="function")try{s()}catch(u){Ye(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(u){Ye(e,t,u)}else i.current=null}function vm(e){var t=e.type,i=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&s.focus();break e;case"img":i.src?s.src=i.src:i.srcSet&&(s.srcset=i.srcSet)}}catch(u){Ye(e,e.return,u)}}function Xc(e,t,i){try{var s=e.stateNode;Bv(s,e.type,i,t),s[_t]=t}catch(u){Ye(e,e.return,u)}}function xm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&yi(e.type)||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&yi(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 Qc(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=Nn));else if(s!==4&&(s===27&&yi(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,i),e=e.sibling;e!==null;)Qc(e,t,i),e=e.sibling}function ur(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&&yi(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(ur(e,t,i),e=e.sibling;e!==null;)ur(e,t,i),e=e.sibling}function wm(e){var t=e.stateNode,i=e.memoizedProps;try{for(var s=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Ct(t,s,i),t[vt]=e,t[_t]=i}catch(d){Ye(e,e.return,d)}}var Bn=!1,ft=!1,Wc=!1,Sm=typeof WeakSet=="function"?WeakSet:Set,gt=null;function bv(e,t){if(e=e.containerInfo,vu=Rr,e=Of(e),Po(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 u=s.anchorOffset,d=s.focusNode;s=s.focusOffset;try{i.nodeType,d.nodeType}catch{i=null;break e}var b=0,S=-1,L=-1,G=0,J=0,te=e,P=null;t:for(;;){for(var V;te!==i||u!==0&&te.nodeType!==3||(S=b+u),te!==d||s!==0&&te.nodeType!==3||(L=b+s),te.nodeType===3&&(b+=te.nodeValue.length),(V=te.firstChild)!==null;)P=te,te=V;for(;;){if(te===e)break t;if(P===i&&++G===u&&(S=b),P===d&&++J===s&&(L=b),(V=te.nextSibling)!==null)break;te=P,P=te.parentNode}te=V}i=S===-1||L===-1?null:{start:S,end:L}}else i=null}i=i||{start:0,end:0}}else i=null;for(xu={focusedElem:e,selectionRange:i},Rr=!1,gt=t;gt!==null;)if(t=gt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,gt=e;else for(;gt!==null;){switch(t=gt,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++)u=e[i],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,i=t,u=d.memoizedProps,d=d.memoizedState,s=i.stateNode;try{var me=Zi(i.type,u);e=s.getSnapshotBeforeUpdate(me,d),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){Ye(i,i.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)Cu(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Cu(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(r(163))}if(e=t.sibling,e!==null){e.return=t.return,gt=e;break}gt=t.return}}function Cm(e,t,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:Kn(e,i),s&4&&Ba(5,i);break;case 1:if(Kn(e,i),s&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(b){Ye(i,i.return,b)}else{var u=Zi(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Ye(i,i.return,b)}}s&64&&bm(i),s&512&&Ua(i,i.return);break;case 3:if(Kn(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){Ye(i,i.return,b)}}break;case 27:t===null&&s&4&&wm(i);case 26:case 5:Kn(e,i),t===null&&s&4&&vm(i),s&512&&Ua(i,i.return);break;case 12:Kn(e,i);break;case 31:Kn(e,i),s&4&&Am(e,i);break;case 13:Kn(e,i),s&4&&Em(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Av.bind(null,i),$v(e,i))));break;case 22:if(s=i.memoizedState!==null||Bn,!s){t=t!==null&&t.memoizedState!==null||ft,u=Bn;var d=ft;Bn=s,(ft=t)&&!d?In(e,i,(i.subtreeFlags&8772)!==0):Kn(e,i),Bn=u,ft=d}break;case 30:break;default:Kn(e,i)}}function Tm(e){var t=e.alternate;t!==null&&(e.alternate=null,Tm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&No(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 et=null,Ot=!1;function Un(e,t,i){for(i=i.child;i!==null;)Mm(e,t,i),i=i.sibling}function Mm(e,t,i){if(Tt&&typeof Tt.onCommitFiberUnmount=="function")try{Tt.onCommitFiberUnmount(Jn,i)}catch{}switch(i.tag){case 26:ft||xn(i,t),Un(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:ft||xn(i,t);var s=et,u=Ot;yi(i.type)&&(et=i.stateNode,Ot=!1),Un(e,t,i),Va(i.stateNode),et=s,Ot=u;break;case 5:ft||xn(i,t);case 6:if(s=et,u=Ot,et=null,Un(e,t,i),et=s,Ot=u,et!==null)if(Ot)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(i.stateNode)}catch(d){Ye(i,t,d)}else try{et.removeChild(i.stateNode)}catch(d){Ye(i,t,d)}break;case 18:et!==null&&(Ot?(e=et,bp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),$l(e)):bp(et,i.stateNode));break;case 4:s=et,u=Ot,et=i.stateNode.containerInfo,Ot=!0,Un(e,t,i),et=s,Ot=u;break;case 0:case 11:case 14:case 15:di(2,i,t),ft||di(4,i,t),Un(e,t,i);break;case 1:ft||(xn(i,t),s=i.stateNode,typeof s.componentWillUnmount=="function"&&ym(i,t,s)),Un(e,t,i);break;case 21:Un(e,t,i);break;case 22:ft=(s=ft)||i.memoizedState!==null,Un(e,t,i),ft=s;break;default:Un(e,t,i)}}function Am(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{$l(e)}catch(i){Ye(t,t.return,i)}}}function Em(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{$l(e)}catch(i){Ye(t,t.return,i)}}function yv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Sm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Sm),t;default:throw Error(r(435,e.tag))}}function dr(e,t){var i=yv(e);t.forEach(function(s){if(!i.has(s)){i.add(s);var u=Ev.bind(null,e,s);s.then(u,u)}})}function Dt(e,t){var i=t.deletions;if(i!==null)for(var s=0;s<i.length;s++){var u=i[s],d=e,b=t,S=b;e:for(;S!==null;){switch(S.tag){case 27:if(yi(S.type)){et=S.stateNode,Ot=!1;break e}break;case 5:et=S.stateNode,Ot=!1;break e;case 3:case 4:et=S.stateNode.containerInfo,Ot=!0;break e}S=S.return}if(et===null)throw Error(r(160));Mm(d,b,u),et=null,Ot=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Nm(t,e),t=t.sibling}var mn=null;function Nm(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Dt(t,e),zt(e),s&4&&(di(3,e,e.return),Ba(3,e),di(5,e,e.return));break;case 1:Dt(t,e),zt(e),s&512&&(ft||i===null||xn(i,i.return)),s&64&&Bn&&(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 u=mn;if(Dt(t,e),zt(e),s&512&&(ft||i===null||xn(i,i.return)),s&4){var d=i!==null?i.memoizedState:null;if(s=e.memoizedState,i===null)if(s===null)if(e.stateNode===null){e:{s=e.type,i=e.memoizedProps,u=u.ownerDocument||u;t:switch(s){case"title":d=u.getElementsByTagName("title")[0],(!d||d[fa]||d[vt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(s),u.head.insertBefore(d,u.querySelector("head > title"))),Ct(d,s,i),d[vt]=e,pt(d),s=d;break e;case"link":var b=Np("link","href",u).get(s+(i.href||""));if(b){for(var S=0;S<b.length;S++)if(d=b[S],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(S,1);break t}}d=u.createElement(s),Ct(d,s,i),u.head.appendChild(d);break;case"meta":if(b=Np("meta","content",u).get(s+(i.content||""))){for(S=0;S<b.length;S++)if(d=b[S],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(S,1);break t}}d=u.createElement(s),Ct(d,s,i),u.head.appendChild(d);break;default:throw Error(r(468,s))}d[vt]=e,pt(d),s=d}e.stateNode=s}else kp(u,e.type,e.stateNode);else e.stateNode=Ep(u,s,e.memoizedProps);else d!==s?(d===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):d.count--,s===null?kp(u,e.type,e.stateNode):Ep(u,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,i.memoizedProps)}break;case 27:Dt(t,e),zt(e),s&512&&(ft||i===null||xn(i,i.return)),i!==null&&s&4&&Xc(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Dt(t,e),zt(e),s&512&&(ft||i===null||xn(i,i.return)),e.flags&32){u=e.stateNode;try{pl(u,"")}catch(me){Ye(e,e.return,me)}}s&4&&e.stateNode!=null&&(u=e.memoizedProps,Xc(e,u,i!==null?i.memoizedProps:u)),s&1024&&(Wc=!0);break;case 6:if(Dt(t,e),zt(e),s&4){if(e.stateNode===null)throw Error(r(162));s=e.memoizedProps,i=e.stateNode;try{i.nodeValue=s}catch(me){Ye(e,e.return,me)}}break;case 3:if(Er=null,u=mn,mn=Mr(t.containerInfo),Dt(t,e),mn=u,zt(e),s&4&&i!==null&&i.memoizedState.isDehydrated)try{$l(t.containerInfo)}catch(me){Ye(e,e.return,me)}Wc&&(Wc=!1,km(e));break;case 4:s=mn,mn=Mr(e.stateNode.containerInfo),Dt(t,e),zt(e),mn=s;break;case 12:Dt(t,e),zt(e);break;case 31:Dt(t,e),zt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,dr(e,s)));break;case 13:Dt(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(hr=Et()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,dr(e,s)));break;case 22:u=e.memoizedState!==null;var L=i!==null&&i.memoizedState!==null,G=Bn,J=ft;if(Bn=G||u,ft=J||L,Dt(t,e),ft=J,Bn=G,zt(e),s&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(i===null||L||Bn||ft||Qi(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){L=i=t;try{if(d=L.stateNode,u)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{S=L.stateNode;var te=L.memoizedProps.style,P=te!=null&&te.hasOwnProperty("display")?te.display:null;S.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(me){Ye(L,L.return,me)}}}else if(t.tag===6){if(i===null){L=t;try{L.stateNode.nodeValue=u?"":L.memoizedProps}catch(me){Ye(L,L.return,me)}}}else if(t.tag===18){if(i===null){L=t;try{var V=L.stateNode;u?yp(V,!0):yp(L.stateNode,!1)}catch(me){Ye(L,L.return,me)}}}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,dr(e,i))));break;case 19:Dt(t,e),zt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,dr(e,s)));break;case 30:break;case 21:break;default:Dt(t,e),zt(e)}}function zt(e){var t=e.flags;if(t&2){try{for(var i,s=e.return;s!==null;){if(xm(s)){i=s;break}s=s.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var u=i.stateNode,d=Zc(e);ur(e,d,u);break;case 5:var b=i.stateNode;i.flags&32&&(pl(b,""),i.flags&=-33);var S=Zc(e);ur(e,S,b);break;case 3:case 4:var L=i.stateNode.containerInfo,G=Zc(e);Qc(e,G,L);break;default:throw Error(r(161))}}catch(J){Ye(e,e.return,J)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function km(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;km(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Kn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Cm(e,t.alternate,t),t=t.sibling}function Qi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:di(4,t,t.return),Qi(t);break;case 1:xn(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&ym(t,t.return,i),Qi(t);break;case 27:Va(t.stateNode);case 26:case 5:xn(t,t.return),Qi(t);break;case 22:t.memoizedState===null&&Qi(t);break;case 30:Qi(t);break;default:Qi(t)}e=e.sibling}}function In(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,u=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:In(u,d,i),Ba(4,d);break;case 1:if(In(u,d,i),s=d,u=s.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(G){Ye(s,s.return,G)}if(s=d,u=s.updateQueue,u!==null){var S=s.stateNode;try{var L=u.shared.hiddenCallbacks;if(L!==null)for(u.shared.hiddenCallbacks=null,u=0;u<L.length;u++)sh(L[u],S)}catch(G){Ye(s,s.return,G)}}i&&b&64&&bm(d),Ua(d,d.return);break;case 27:wm(d);case 26:case 5:In(u,d,i),i&&s===null&&b&4&&vm(d),Ua(d,d.return);break;case 12:In(u,d,i);break;case 31:In(u,d,i),i&&b&4&&Am(u,d);break;case 13:In(u,d,i),i&&b&4&&Em(u,d);break;case 22:d.memoizedState===null&&In(u,d,i),Ua(d,d.return);break;case 30:break;default:In(u,d,i)}t=t.sibling}}function Jc(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&&Ma(i))}function eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ma(e))}function pn(e,t,i,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Lm(e,t,i,s),t=t.sibling}function Lm(e,t,i,s){var u=t.flags;switch(t.tag){case 0:case 11:case 15:pn(e,t,i,s),u&2048&&Ba(9,t);break;case 1:pn(e,t,i,s);break;case 3:pn(e,t,i,s),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ma(e)));break;case 12:if(u&2048){pn(e,t,i,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,S=d.onPostCommit;typeof S=="function"&&S(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){Ye(t,t.return,L)}}else pn(e,t,i,s);break;case 31:pn(e,t,i,s);break;case 13:pn(e,t,i,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?pn(e,t,i,s):Ka(e,t):d._visibility&2?pn(e,t,i,s):(d._visibility|=2,Dl(e,t,i,s,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Jc(b,t);break;case 24:pn(e,t,i,s),u&2048&&eu(t.alternate,t);break;default:pn(e,t,i,s)}}function Dl(e,t,i,s,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,b=t,S=i,L=s,G=b.flags;switch(b.tag){case 0:case 11:case 15:Dl(d,b,S,L,u),Ba(8,b);break;case 23:break;case 22:var J=b.stateNode;b.memoizedState!==null?J._visibility&2?Dl(d,b,S,L,u):Ka(d,b):(J._visibility|=2,Dl(d,b,S,L,u)),u&&G&2048&&Jc(b.alternate,b);break;case 24:Dl(d,b,S,L,u),u&&G&2048&&eu(b.alternate,b);break;default:Dl(d,b,S,L,u)}t=t.sibling}}function Ka(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,s=t,u=s.flags;switch(s.tag){case 22:Ka(i,s),u&2048&&Jc(s.alternate,s);break;case 24:Ka(i,s),u&2048&&eu(s.alternate,s);break;default:Ka(i,s)}t=t.sibling}}var Ia=8192;function zl(e,t,i){if(e.subtreeFlags&Ia)for(e=e.child;e!==null;)Rm(e,t,i),e=e.sibling}function Rm(e,t,i){switch(e.tag){case 26:zl(e,t,i),e.flags&Ia&&e.memoizedState!==null&&lx(i,mn,e.memoizedState,e.memoizedProps);break;case 5:zl(e,t,i);break;case 3:case 4:var s=mn;mn=Mr(e.stateNode.containerInfo),zl(e,t,i),mn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Ia,Ia=16777216,zl(e,t,i),Ia=s):zl(e,t,i));break;default:zl(e,t,i)}}function _m(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 Fa(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];gt=s,Om(s,e)}_m(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jm(e),e=e.sibling}function jm(e){switch(e.tag){case 0:case 11:case 15:Fa(e),e.flags&2048&&di(9,e,e.return);break;case 3:Fa(e);break;case 12:Fa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,fr(e)):Fa(e);break;default:Fa(e)}}function fr(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];gt=s,Om(s,e)}_m(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:di(8,t,t.return),fr(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,fr(t));break;default:fr(t)}e=e.sibling}}function Om(e,t){for(;gt!==null;){var i=gt;switch(i.tag){case 0:case 11:case 15:di(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:Ma(i.memoizedState.cache)}if(s=i.child,s!==null)s.return=i,gt=s;else e:for(i=e;gt!==null;){s=gt;var u=s.sibling,d=s.return;if(Tm(s),s===i){gt=null;break e}if(u!==null){u.return=d,gt=u;break e}gt=d}}}var vv={getCacheForType:function(e){var t=wt(ct),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return wt(ct).controller.signal}},xv=typeof WeakMap=="function"?WeakMap:Map,Ie=0,Ve=null,je=null,De=0,Ge=0,$t=null,fi=!1,Hl=!1,tu=!1,Fn=0,it=0,hi=0,Wi=0,nu=0,qt=0,Bl=0,Ga=null,Ht=null,iu=!1,hr=0,Dm=0,mr=1/0,pr=null,mi=null,ht=0,pi=null,Ul=null,Gn=0,lu=0,au=null,zm=null,Ya=0,su=null;function Vt(){return(Ie&2)!==0&&De!==0?De&-De:k.T!==null?fu():Qd()}function Hm(){if(qt===0)if((De&536870912)===0||Be){var e=Fe;Fe<<=1,(Fe&3932160)===0&&(Fe=262144),qt=e}else qt=536870912;return e=Yt.current,e!==null&&(e.flags|=32),qt}function Bt(e,t,i){(e===Ve&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)&&(Kl(e,0),gi(e,De,qt,!1)),da(e,i),((Ie&2)===0||e!==Ve)&&(e===Ve&&((Ie&2)===0&&(Wi|=i),it===4&&gi(e,De,qt,!1)),wn(e))}function Bm(e,t,i){if((Ie&6)!==0)throw Error(r(327));var s=!i&&(t&127)===0&&(t&e.expiredLanes)===0||Di(e,t),u=s?Cv(e,t):ou(e,t,!0),d=s;do{if(u===0){Hl&&!s&&gi(e,t,0,!1);break}else{if(i=e.current.alternate,d&&!wv(i)){u=ou(e,t,!1),d=!1;continue}if(u===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 S=e;u=Ga;var L=S.current.memoizedState.isDehydrated;if(L&&(Kl(S,b).flags|=256),b=ou(S,b,!1),b!==2){if(tu&&!L){S.errorRecoveryDisabledLanes|=d,Wi|=d,u=4;break e}d=Ht,Ht=u,d!==null&&(Ht===null?Ht=d:Ht.push.apply(Ht,d))}u=b}if(d=!1,u!==2)continue}}if(u===1){Kl(e,0),gi(e,t,0,!0);break}e:{switch(s=e,d=u,d){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:gi(s,t,qt,!fi);break e;case 2:Ht=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(u=hr+300-Et(),10<u)){if(gi(s,t,qt,!fi),ol(s,0,!0)!==0)break e;Gn=t,s.timeoutHandle=pp(Um.bind(null,s,i,Ht,pr,iu,t,qt,Wi,Bl,fi,d,"Throttled",-0,0),u);break e}Um(s,i,Ht,pr,iu,t,qt,Wi,Bl,fi,d,null,-0,0)}}break}while(!0);wn(e)}function Um(e,t,i,s,u,d,b,S,L,G,J,te,P,V){if(e.timeoutHandle=-1,te=t.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Nn},Rm(t,d,te);var me=(d&62914560)===d?hr-Et():(d&4194048)===d?Dm-Et():0;if(me=ax(te,me),me!==null){Gn=d,e.cancelPendingCommit=me(qm.bind(null,e,t,d,i,s,u,b,S,L,J,te,null,P,V)),gi(e,d,b,!G);return}}qm(e,t,d,i,s,u,b,S,L)}function wv(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 u=i[s],d=u.getSnapshot;u=u.value;try{if(!Ft(d(),u))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 gi(e,t,i,s){t&=~nu,t&=~Wi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var u=t;0<u;){var d=31-Mt(u),b=1<<d;s[d]=-1,u&=~b}i!==0&&Vd(e,i,t)}function gr(){return(Ie&6)===0?(Pa(0),!1):!0}function ru(){if(je!==null){if(Ge===0)var e=je.return;else e=je,_n=Gi=null,Cc(e),Ll=null,Ea=0,e=je;for(;e!==null;)gm(e.alternate,e),e=e.return;je=null}}function Kl(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Iv(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Gn=0,ru(),Ve=e,je=i=Ln(e.current,null),De=t,Ge=0,$t=null,fi=!1,Hl=Di(e,t),tu=!1,Bl=qt=nu=Wi=hi=it=0,Ht=Ga=null,iu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var u=31-Mt(s),d=1<<u;t|=e[u],s&=~d}return Fn=t,Hs(),i}function Km(e,t){ke=null,k.H=Da,t===kl||t===Ps?(t=nh(),Ge=3):t===dc?(t=nh(),Ge=4):Ge=t===Uc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,$t=t,je===null&&(it=1,ar(e,Jt(t,e.current)))}function Im(){var e=Yt.current;return e===null?!0:(De&4194048)===De?ln===null:(De&62914560)===De||(De&536870912)!==0?e===ln:!1}function Fm(){var e=k.H;return k.H=Da,e===null?Da:e}function Gm(){var e=k.A;return k.A=vv,e}function br(){it=4,fi||(De&4194048)!==De&&Yt.current!==null||(Hl=!0),(hi&134217727)===0&&(Wi&134217727)===0||Ve===null||gi(Ve,De,qt,!1)}function ou(e,t,i){var s=Ie;Ie|=2;var u=Fm(),d=Gm();(Ve!==e||De!==t)&&(pr=null,Kl(e,t)),t=!1;var b=it;e:do try{if(Ge!==0&&je!==null){var S=je,L=$t;switch(Ge){case 8:ru(),b=6;break e;case 3:case 2:case 9:case 6:Yt.current===null&&(t=!0);var G=Ge;if(Ge=0,$t=null,Il(e,S,L,G),i&&Hl){b=0;break e}break;default:G=Ge,Ge=0,$t=null,Il(e,S,L,G)}}Sv(),b=it;break}catch(J){Km(e,J)}while(!0);return t&&e.shellSuspendCounter++,_n=Gi=null,Ie=s,k.H=u,k.A=d,je===null&&(Ve=null,De=0,Hs()),b}function Sv(){for(;je!==null;)Ym(je)}function Cv(e,t){var i=Ie;Ie|=2;var s=Fm(),u=Gm();Ve!==e||De!==t?(pr=null,mr=Et()+500,Kl(e,t)):Hl=Di(e,t);e:do try{if(Ge!==0&&je!==null){t=je;var d=$t;t:switch(Ge){case 1:Ge=0,$t=null,Il(e,t,d,1);break;case 2:case 9:if(eh(d)){Ge=0,$t=null,Pm(t);break}t=function(){Ge!==2&&Ge!==9||Ve!==e||(Ge=7),wn(e)},d.then(t,t);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:eh(d)?(Ge=0,$t=null,Pm(t)):(Ge=0,$t=null,Il(e,t,d,7));break;case 5:var b=null;switch(je.tag){case 26:b=je.memoizedState;case 5:case 27:var S=je;if(b?Lp(b):S.stateNode.complete){Ge=0,$t=null;var L=S.sibling;if(L!==null)je=L;else{var G=S.return;G!==null?(je=G,yr(G)):je=null}break t}}Ge=0,$t=null,Il(e,t,d,5);break;case 6:Ge=0,$t=null,Il(e,t,d,6);break;case 8:ru(),it=6;break e;default:throw Error(r(462))}}Tv();break}catch(J){Km(e,J)}while(!0);return _n=Gi=null,k.H=s,k.A=u,Ie=i,je!==null?0:(Ve=null,De=0,Hs(),it)}function Tv(){for(;je!==null&&!It();)Ym(je)}function Ym(e){var t=mm(e.alternate,e,Fn);e.memoizedProps=e.pendingProps,t===null?yr(e):je=t}function Pm(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=om(i,t,t.pendingProps,t.type,void 0,De);break;case 11:t=om(i,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:Cc(t);default:gm(i,t),t=je=Gf(t,Fn),t=mm(i,t,Fn)}e.memoizedProps=e.pendingProps,t===null?yr(e):je=t}function Il(e,t,i,s){_n=Gi=null,Cc(t),Ll=null,Ea=0;var u=t.return;try{if(fv(e,u,t,i,De)){it=1,ar(e,Jt(i,e.current)),je=null;return}}catch(d){if(u!==null)throw je=u,d;it=1,ar(e,Jt(i,e.current)),je=null;return}t.flags&32768?(Be||s===1?e=!0:Hl||(De&536870912)!==0?e=!1:(fi=e=!0,(s===2||s===9||s===3||s===6)&&(s=Yt.current,s!==null&&s.tag===13&&(s.flags|=16384))),$m(t,e)):yr(t)}function yr(e){var t=e;do{if((t.flags&32768)!==0){$m(t,fi);return}e=t.return;var i=pv(t.alternate,t,Fn);if(i!==null){je=i;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);it===0&&(it=5)}function $m(e,t){do{var i=gv(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);it=6,je=null}function qm(e,t,i,s,u,d,b,S,L){e.cancelPendingCommit=null;do vr();while(ht!==0);if((Ie&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(d=t.lanes|t.childLanes,d|=Zo,i0(e,i,d,b,S,L),e===Ve&&(je=Ve=null,De=0),Ul=t,pi=e,Gn=i,lu=d,au=u,zm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Nv(Oi,function(){return Wm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=k.T,k.T=null,u=Y.p,Y.p=2,b=Ie,Ie|=4;try{bv(e,t,i)}finally{Ie=b,Y.p=u,k.T=s}}ht=1,Vm(),Xm(),Zm()}}function Vm(){if(ht===1){ht=0;var e=pi,t=Ul,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=k.T,k.T=null;var s=Y.p;Y.p=2;var u=Ie;Ie|=4;try{Nm(t,e);var d=xu,b=Of(e.containerInfo),S=d.focusedElem,L=d.selectionRange;if(b!==S&&S&&S.ownerDocument&&jf(S.ownerDocument.documentElement,S)){if(L!==null&&Po(S)){var G=L.start,J=L.end;if(J===void 0&&(J=G),"selectionStart"in S)S.selectionStart=G,S.selectionEnd=Math.min(J,S.value.length);else{var te=S.ownerDocument||document,P=te&&te.defaultView||window;if(P.getSelection){var V=P.getSelection(),me=S.textContent.length,Te=Math.min(L.start,me),qe=L.end===void 0?Te:Math.min(L.end,me);!V.extend&&Te>qe&&(b=qe,qe=Te,Te=b);var K=_f(S,Te),j=_f(S,qe);if(K&&j&&(V.rangeCount!==1||V.anchorNode!==K.node||V.anchorOffset!==K.offset||V.focusNode!==j.node||V.focusOffset!==j.offset)){var F=te.createRange();F.setStart(K.node,K.offset),V.removeAllRanges(),Te>qe?(V.addRange(F),V.extend(j.node,j.offset)):(F.setEnd(j.node,j.offset),V.addRange(F))}}}}for(te=[],V=S;V=V.parentNode;)V.nodeType===1&&te.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<te.length;S++){var ee=te[S];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Rr=!!vu,xu=vu=null}finally{Ie=u,Y.p=s,k.T=i}}e.current=t,ht=2}}function Xm(){if(ht===2){ht=0;var e=pi,t=Ul,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=k.T,k.T=null;var s=Y.p;Y.p=2;var u=Ie;Ie|=4;try{Cm(e,t.alternate,t)}finally{Ie=u,Y.p=s,k.T=i}}ht=3}}function Zm(){if(ht===4||ht===3){ht=0,ji();var e=pi,t=Ul,i=Gn,s=zm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ht=5:(ht=0,Ul=pi=null,Qm(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(mi=null),Ao(i),t=t.stateNode,Tt&&typeof Tt.onCommitFiberRoot=="function")try{Tt.onCommitFiberRoot(Jn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=k.T,u=Y.p,Y.p=2,k.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var S=s[b];d(S.value,{componentStack:S.stack})}}finally{k.T=t,Y.p=u}}(Gn&3)!==0&&vr(),wn(e),u=e.pendingLanes,(i&261930)!==0&&(u&42)!==0?e===su?Ya++:(Ya=0,su=e):Ya=0,Pa(0)}}function Qm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ma(t)))}function vr(){return Vm(),Xm(),Zm(),Wm()}function Wm(){if(ht!==5)return!1;var e=pi,t=lu;lu=0;var i=Ao(Gn),s=k.T,u=Y.p;try{Y.p=32>i?32:i,k.T=null,i=au,au=null;var d=pi,b=Gn;if(ht=0,Ul=pi=null,Gn=0,(Ie&6)!==0)throw Error(r(331));var S=Ie;if(Ie|=4,jm(d.current),Lm(d,d.current,b,i),Ie=S,Pa(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(Jn,d)}catch{}return!0}finally{Y.p=u,k.T=s,Qm(e,t)}}function Jm(e,t,i){t=Jt(i,t),t=Bc(e.stateNode,t,2),e=oi(e,t,2),e!==null&&(da(e,2),wn(e))}function Ye(e,t,i){if(e.tag===3)Jm(e,e,i);else for(;t!==null;){if(t.tag===3){Jm(t,e,i);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(mi===null||!mi.has(s))){e=Jt(i,e),i=em(2),s=oi(t,i,2),s!==null&&(tm(i,s,t,e),da(s,2),wn(s));break}}t=t.return}}function cu(e,t,i){var s=e.pingCache;if(s===null){s=e.pingCache=new xv;var u=new Set;s.set(t,u)}else u=s.get(t),u===void 0&&(u=new Set,s.set(t,u));u.has(i)||(tu=!0,u.add(i),e=Mv.bind(null,e,t,i),t.then(e,e))}function Mv(e,t,i){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,Ve===e&&(De&i)===i&&(it===4||it===3&&(De&62914560)===De&&300>Et()-hr?(Ie&2)===0&&Kl(e,0):nu|=i,Bl===De&&(Bl=0)),wn(e)}function ep(e,t){t===0&&(t=ua()),e=Ki(e,t),e!==null&&(da(e,t),wn(e))}function Av(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),ep(e,i)}function Ev(e,t){var i=0;switch(e.tag){case 31:case 13:var s=e.stateNode,u=e.memoizedState;u!==null&&(i=u.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(r(314))}s!==null&&s.delete(t),ep(e,i)}function Nv(e,t){return dn(e,t)}var xr=null,Fl=null,uu=!1,wr=!1,du=!1,bi=0;function wn(e){e!==Fl&&e.next===null&&(Fl===null?xr=Fl=e:Fl=Fl.next=e),wr=!0,uu||(uu=!0,Lv())}function Pa(e,t){if(!du&&wr){du=!0;do for(var i=!1,s=xr;s!==null;){if(e!==0){var u=s.pendingLanes;if(u===0)var d=0;else{var b=s.suspendedLanes,S=s.pingedLanes;d=(1<<31-Mt(42|e)+1)-1,d&=u&~(b&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(i=!0,lp(s,d))}else d=De,d=ol(s,s===Ve?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||Di(s,d)||(i=!0,lp(s,d));s=s.next}while(i);du=!1}}function kv(){tp()}function tp(){wr=uu=!1;var e=0;bi!==0&&Kv()&&(e=bi);for(var t=Et(),i=null,s=xr;s!==null;){var u=s.next,d=np(s,t);d===0?(s.next=null,i===null?xr=u:i.next=u,u===null&&(Fl=i)):(i=s,(e!==0||(d&3)!==0)&&(wr=!0)),s=u}ht!==0&&ht!==5||Pa(e),bi!==0&&(bi=0)}function np(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-Mt(d),S=1<<b,L=u[b];L===-1?((S&i)===0||(S&s)!==0)&&(u[b]=Co(S,t)):L<=t&&(e.expiredLanes|=S),d&=~S}if(t=Ve,i=De,i=ol(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,i===0||e===t&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Xt(s),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||Di(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(s!==null&&Xt(s),Ao(i)){case 2:case 8:i=oa;break;case 32:i=Oi;break;case 268435456:i=ca;break;default:i=Oi}return s=ip.bind(null,e),i=dn(i,s),e.callbackPriority=t,e.callbackNode=i,t}return s!==null&&s!==null&&Xt(s),e.callbackPriority=2,e.callbackNode=null,2}function ip(e,t){if(ht!==0&&ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(vr()&&e.callbackNode!==i)return null;var s=De;return s=ol(e,e===Ve?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Bm(e,s,t),np(e,Et()),e.callbackNode!=null&&e.callbackNode===i?ip.bind(null,e):null)}function lp(e,t){if(vr())return null;Bm(e,t,!0)}function Lv(){Fv(function(){(Ie&6)!==0?dn(ra,kv):tp()})}function fu(){if(bi===0){var e=El;e===0&&(e=he,he<<=1,(he&261888)===0&&(he=256)),bi=e}return bi}function ap(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ks(""+e)}function sp(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Rv(e,t,i,s,u){if(t==="submit"&&i&&i.stateNode===u){var d=ap((u[_t]||null).action),b=s.submitter;b&&(t=(t=b[_t]||null)?ap(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var S=new js("action","action",null,s,u);e.push({event:S,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(bi!==0){var L=b?sp(u,b):new FormData(u);_c(i,{pending:!0,data:L,method:u.method,action:d},null,L)}}else typeof d=="function"&&(S.preventDefault(),L=b?sp(u,b):new FormData(u),_c(i,{pending:!0,data:L,method:u.method,action:d},d,L))},currentTarget:u}]})}}for(var hu=0;hu<Xo.length;hu++){var mu=Xo[hu],_v=mu.toLowerCase(),jv=mu[0].toUpperCase()+mu.slice(1);hn(_v,"on"+jv)}hn(Hf,"onAnimationEnd"),hn(Bf,"onAnimationIteration"),hn(Uf,"onAnimationStart"),hn("dblclick","onDoubleClick"),hn("focusin","onFocus"),hn("focusout","onBlur"),hn(X0,"onTransitionRun"),hn(Z0,"onTransitionStart"),hn(Q0,"onTransitionCancel"),hn(Kf,"onTransitionEnd"),hl("onMouseEnter",["mouseout","mouseover"]),hl("onMouseLeave",["mouseout","mouseover"]),hl("onPointerEnter",["pointerout","pointerover"]),hl("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 $a="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(" "),Ov=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($a));function rp(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var s=e[i],u=s.event;s=s.listeners;e:{var d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var S=s[b],L=S.instance,G=S.currentTarget;if(S=S.listener,L!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=G;try{d(u)}catch(J){zs(J)}u.currentTarget=null,d=L}else for(b=0;b<s.length;b++){if(S=s[b],L=S.instance,G=S.currentTarget,S=S.listener,L!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=G;try{d(u)}catch(J){zs(J)}u.currentTarget=null,d=L}}}}function Oe(e,t){var i=t[Eo];i===void 0&&(i=t[Eo]=new Set);var s=e+"__bubble";i.has(s)||(op(t,e,2,!1),i.add(s))}function pu(e,t,i){var s=0;t&&(s|=4),op(i,e,s,t)}var Sr="_reactListening"+Math.random().toString(36).slice(2);function gu(e){if(!e[Sr]){e[Sr]=!0,ef.forEach(function(i){i!=="selectionchange"&&(Ov.has(i)||pu(i,!1,e),pu(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Sr]||(t[Sr]=!0,pu("selectionchange",!1,t))}}function op(e,t,i,s){switch(Hp(t)){case 2:var u=ox;break;case 8:u=cx;break;default:u=Ru}i=u.bind(null,t,i,e),u=void 0,!zo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),s?u!==void 0?e.addEventListener(t,i,{capture:!0,passive:u}):e.addEventListener(t,i,!0):u!==void 0?e.addEventListener(t,i,{passive:u}):e.addEventListener(t,i,!1)}function bu(e,t,i,s,u){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 S=s.stateNode.containerInfo;if(S===u)break;if(b===4)for(b=s.return;b!==null;){var L=b.tag;if((L===3||L===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;S!==null;){if(b=ul(S),b===null)return;if(L=b.tag,L===5||L===6||L===26||L===27){s=d=b;continue e}S=S.parentNode}}s=s.return}hf(function(){var G=d,J=Oo(i),te=[];e:{var P=If.get(e);if(P!==void 0){var V=js,me=e;switch(e){case"keypress":if(Rs(i)===0)break e;case"keydown":case"keyup":V=E0;break;case"focusin":me="focus",V=Ko;break;case"focusout":me="blur",V=Ko;break;case"beforeblur":case"afterblur":V=Ko;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=gf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=p0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=L0;break;case Hf:case Bf:case Uf:V=y0;break;case Kf:V=_0;break;case"scroll":case"scrollend":V=h0;break;case"wheel":V=O0;break;case"copy":case"cut":case"paste":V=x0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=yf;break;case"toggle":case"beforetoggle":V=z0}var Te=(t&4)!==0,qe=!Te&&(e==="scroll"||e==="scrollend"),K=Te?P!==null?P+"Capture":null:P;Te=[];for(var j=G,F;j!==null;){var ee=j;if(F=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||F===null||K===null||(ee=ma(j,K),ee!=null&&Te.push(qa(j,ee,F))),qe)break;j=j.return}0<Te.length&&(P=new V(P,me,null,i,J),te.push({event:P,listeners:Te}))}}if((t&7)===0){e:{if(P=e==="mouseover"||e==="pointerover",V=e==="mouseout"||e==="pointerout",P&&i!==jo&&(me=i.relatedTarget||i.fromElement)&&(ul(me)||me[cl]))break e;if((V||P)&&(P=J.window===J?J:(P=J.ownerDocument)?P.defaultView||P.parentWindow:window,V?(me=i.relatedTarget||i.toElement,V=G,me=me?ul(me):null,me!==null&&(qe=c(me),Te=me.tag,me!==qe||Te!==5&&Te!==27&&Te!==6)&&(me=null)):(V=null,me=G),V!==me)){if(Te=gf,ee="onMouseLeave",K="onMouseEnter",j="mouse",(e==="pointerout"||e==="pointerover")&&(Te=yf,ee="onPointerLeave",K="onPointerEnter",j="pointer"),qe=V==null?P:ha(V),F=me==null?P:ha(me),P=new Te(ee,j+"leave",V,i,J),P.target=qe,P.relatedTarget=F,ee=null,ul(J)===G&&(Te=new Te(K,j+"enter",me,i,J),Te.target=F,Te.relatedTarget=qe,ee=Te),qe=ee,V&&me)t:{for(Te=Dv,K=V,j=me,F=0,ee=K;ee;ee=Te(ee))F++;ee=0;for(var Se=j;Se;Se=Te(Se))ee++;for(;0<F-ee;)K=Te(K),F--;for(;0<ee-F;)j=Te(j),ee--;for(;F--;){if(K===j||j!==null&&K===j.alternate){Te=K;break t}K=Te(K),j=Te(j)}Te=null}else Te=null;V!==null&&cp(te,P,V,Te,!1),me!==null&&qe!==null&&cp(te,qe,me,Te,!0)}}e:{if(P=G?ha(G):window,V=P.nodeName&&P.nodeName.toLowerCase(),V==="select"||V==="input"&&P.type==="file")var Ue=Af;else if(Tf(P))if(Ef)Ue=$0;else{Ue=Y0;var pe=G0}else V=P.nodeName,!V||V.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?G&&_o(G.elementType)&&(Ue=Af):Ue=P0;if(Ue&&(Ue=Ue(e,G))){Mf(te,Ue,i,J);break e}pe&&pe(e,P,G),e==="focusout"&&G&&P.type==="number"&&G.memoizedProps.value!=null&&Ro(P,"number",P.value)}switch(pe=G?ha(G):window,e){case"focusin":(Tf(pe)||pe.contentEditable==="true")&&(vl=pe,$o=G,Sa=null);break;case"focusout":Sa=$o=vl=null;break;case"mousedown":qo=!0;break;case"contextmenu":case"mouseup":case"dragend":qo=!1,Df(te,i,J);break;case"selectionchange":if(V0)break;case"keydown":case"keyup":Df(te,i,J)}var Re;if(Fo)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 yl?Sf(e,i)&&(ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(ze="onCompositionStart");ze&&(vf&&i.locale!=="ko"&&(yl||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&yl&&(Re=mf()):(ti=J,Ho="value"in ti?ti.value:ti.textContent,yl=!0)),pe=Cr(G,ze),0<pe.length&&(ze=new bf(ze,e,null,i,J),te.push({event:ze,listeners:pe}),Re?ze.data=Re:(Re=Cf(i),Re!==null&&(ze.data=Re)))),(Re=B0?U0(e,i):K0(e,i))&&(ze=Cr(G,"onBeforeInput"),0<ze.length&&(pe=new bf("onBeforeInput","beforeinput",null,i,J),te.push({event:pe,listeners:ze}),pe.data=Re)),Rv(te,e,G,i,J)}rp(te,t)})}function qa(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Cr(e,t){for(var i=t+"Capture",s=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=ma(e,i),u!=null&&s.unshift(qa(e,u,d)),u=ma(e,t),u!=null&&s.push(qa(e,u,d))),e.tag===3)return s;e=e.return}return[]}function Dv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function cp(e,t,i,s,u){for(var d=t._reactName,b=[];i!==null&&i!==s;){var S=i,L=S.alternate,G=S.stateNode;if(S=S.tag,L!==null&&L===s)break;S!==5&&S!==26&&S!==27||G===null||(L=G,u?(G=ma(i,d),G!=null&&b.unshift(qa(i,G,L))):u||(G=ma(i,d),G!=null&&b.push(qa(i,G,L)))),i=i.return}b.length!==0&&e.push({event:t,listeners:b})}var zv=/\r\n?/g,Hv=/\u0000|\uFFFD/g;function up(e){return(typeof e=="string"?e:""+e).replace(zv,`
|
|
33
|
-
`).replace(Hv,"")}function dp(e,t){return t=up(t),up(e)===t}function $e(e,t,i,s,u,d){switch(i){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||pl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&pl(e,""+s);break;case"className":Es(e,"class",s);break;case"tabIndex":Es(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Es(e,i,s);break;case"style":df(e,s,d);break;case"data":if(t!=="object"){Es(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=ks(""+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"&&$e(e,t,"name",u.name,u,null),$e(e,t,"formEncType",u.formEncType,u,null),$e(e,t,"formMethod",u.formMethod,u,null),$e(e,t,"formTarget",u.formTarget,u,null)):($e(e,t,"encType",u.encType,u,null),$e(e,t,"method",u.method,u,null),$e(e,t,"target",u.target,u,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=ks(""+s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=Nn);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(r(61));if(i=s.__html,i!=null){if(u.children!=null)throw Error(r(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=ks(""+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),As(e,"popover",s);break;case"xlinkActuate":En(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":En(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":En(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":En(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":En(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":En(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":En(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":En(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":En(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":As(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=d0.get(i)||i,As(e,i,s))}}function yu(e,t,i,s,u,d){switch(i){case"style":df(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(r(61));if(i=s.__html,i!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof s=="string"?pl(e,s):(typeof s=="number"||typeof s=="bigint")&&pl(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=Nn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tf.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(u=i.endsWith("Capture"),t=i.slice(2,u?i.length-7:void 0),d=e[_t]||null,d=d!=null?d[i]:null,typeof d=="function"&&e.removeEventListener(t,d,u),typeof s=="function")){typeof d!="function"&&d!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,s,u);break e}i in e?e[i]=s:s===!0?e.setAttribute(i,""):As(e,i,s)}}}function Ct(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,u=!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":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:$e(e,t,d,b,i,null)}}u&&$e(e,t,"srcSet",i.srcSet,i,null),s&&$e(e,t,"src",i.src,i,null);return;case"input":Oe("invalid",e);var S=d=b=u=null,L=null,G=null;for(s in i)if(i.hasOwnProperty(s)){var J=i[s];if(J!=null)switch(s){case"name":u=J;break;case"type":b=J;break;case"checked":L=J;break;case"defaultChecked":G=J;break;case"value":d=J;break;case"defaultValue":S=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,t));break;default:$e(e,t,s,J,i,null)}}rf(e,d,S,L,G,b,u,!1);return;case"select":Oe("invalid",e),s=b=d=null;for(u in i)if(i.hasOwnProperty(u)&&(S=i[u],S!=null))switch(u){case"value":d=S;break;case"defaultValue":b=S;break;case"multiple":s=S;default:$e(e,t,u,S,i,null)}t=d,i=b,e.multiple=!!s,t!=null?ml(e,!!s,t,!1):i!=null&&ml(e,!!s,i,!0);return;case"textarea":Oe("invalid",e),d=u=s=null;for(b in i)if(i.hasOwnProperty(b)&&(S=i[b],S!=null))switch(b){case"value":s=S;break;case"defaultValue":u=S;break;case"children":d=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(r(91));break;default:$e(e,t,b,S,i,null)}cf(e,s,u,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:$e(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<$a.length;s++)Oe($a[s],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in i)if(i.hasOwnProperty(G)&&(s=i[G],s!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:$e(e,t,G,s,i,null)}return;default:if(_o(t)){for(J in i)i.hasOwnProperty(J)&&(s=i[J],s!==void 0&&yu(e,t,J,s,i,void 0));return}}for(S in i)i.hasOwnProperty(S)&&(s=i[S],s!=null&&$e(e,t,S,s,i,null))}function Bv(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 u=null,d=null,b=null,S=null,L=null,G=null,J=null;for(V in i){var te=i[V];if(i.hasOwnProperty(V)&&te!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":L=te;default:s.hasOwnProperty(V)||$e(e,t,V,null,s,te)}}for(var P in s){var V=s[P];if(te=i[P],s.hasOwnProperty(P)&&(V!=null||te!=null))switch(P){case"type":d=V;break;case"name":u=V;break;case"checked":G=V;break;case"defaultChecked":J=V;break;case"value":b=V;break;case"defaultValue":S=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(r(137,t));break;default:V!==te&&$e(e,t,P,V,s,te)}}Lo(e,b,S,L,G,J,d,u);return;case"select":V=b=S=P=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)||$e(e,t,d,null,s,L)}for(u in s)if(d=s[u],L=i[u],s.hasOwnProperty(u)&&(d!=null||L!=null))switch(u){case"value":P=d;break;case"defaultValue":S=d;break;case"multiple":b=d;default:d!==L&&$e(e,t,u,d,s,L)}t=S,i=b,s=V,P!=null?ml(e,!!i,P,!1):!!s!=!!i&&(t!=null?ml(e,!!i,t,!0):ml(e,!!i,i?[]:"",!1));return;case"textarea":V=P=null;for(S in i)if(u=i[S],i.hasOwnProperty(S)&&u!=null&&!s.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:$e(e,t,S,null,s,u)}for(b in s)if(u=s[b],d=i[b],s.hasOwnProperty(b)&&(u!=null||d!=null))switch(b){case"value":P=u;break;case"defaultValue":V=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==d&&$e(e,t,b,u,s,d)}of(e,P,V);return;case"option":for(var me in i)if(P=i[me],i.hasOwnProperty(me)&&P!=null&&!s.hasOwnProperty(me))switch(me){case"selected":e.selected=!1;break;default:$e(e,t,me,null,s,P)}for(L in s)if(P=s[L],V=i[L],s.hasOwnProperty(L)&&P!==V&&(P!=null||V!=null))switch(L){case"selected":e.selected=P&&typeof P!="function"&&typeof P!="symbol";break;default:$e(e,t,L,P,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 Te in i)P=i[Te],i.hasOwnProperty(Te)&&P!=null&&!s.hasOwnProperty(Te)&&$e(e,t,Te,null,s,P);for(G in s)if(P=s[G],V=i[G],s.hasOwnProperty(G)&&P!==V&&(P!=null||V!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(137,t));break;default:$e(e,t,G,P,s,V)}return;default:if(_o(t)){for(var qe in i)P=i[qe],i.hasOwnProperty(qe)&&P!==void 0&&!s.hasOwnProperty(qe)&&yu(e,t,qe,void 0,s,P);for(J in s)P=s[J],V=i[J],!s.hasOwnProperty(J)||P===V||P===void 0&&V===void 0||yu(e,t,J,P,s,V);return}}for(var K in i)P=i[K],i.hasOwnProperty(K)&&P!=null&&!s.hasOwnProperty(K)&&$e(e,t,K,null,s,P);for(te in s)P=s[te],V=i[te],!s.hasOwnProperty(te)||P===V||P==null&&V==null||$e(e,t,te,P,s,V)}function fp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Uv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),s=0;s<i.length;s++){var u=i[s],d=u.transferSize,b=u.initiatorType,S=u.duration;if(d&&S&&fp(b)){for(b=0,S=u.responseEnd,s+=1;s<i.length;s++){var L=i[s],G=L.startTime;if(G>S)break;var J=L.transferSize,te=L.initiatorType;J&&fp(te)&&(L=L.responseEnd,b+=J*(L<S?1:(S-G)/(L-G)))}if(--s,t+=8*(d+b)/(u.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 vu=null,xu=null;function Tr(e){return e.nodeType===9?e:e.ownerDocument}function hp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function mp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function wu(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 Su=null;function Kv(){var e=window.event;return e&&e.type==="popstate"?e===Su?!1:(Su=e,!0):(Su=null,!1)}var pp=typeof setTimeout=="function"?setTimeout:void 0,Iv=typeof clearTimeout=="function"?clearTimeout:void 0,gp=typeof Promise=="function"?Promise:void 0,Fv=typeof queueMicrotask=="function"?queueMicrotask:typeof gp<"u"?function(e){return gp.resolve(null).then(e).catch(Gv)}:pp;function Gv(e){setTimeout(function(){throw e})}function yi(e){return e==="head"}function bp(e,t){var i=t,s=0;do{var u=i.nextSibling;if(e.removeChild(i),u&&u.nodeType===8)if(i=u.data,i==="/$"||i==="/&"){if(s===0){e.removeChild(u),$l(t);return}s--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")s++;else if(i==="html")Va(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Va(i);for(var d=i.firstChild;d;){var b=d.nextSibling,S=d.nodeName;d[fa]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||i.removeChild(d),d=b}}else i==="body"&&Va(e.ownerDocument.body);i=u}while(i);$l(t)}function yp(e,t){var i=e;e=0;do{var s=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=s}while(i)}function Cu(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":Cu(i),No(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Yv(e,t,i,s){for(;e.nodeType===1;){var u=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[fa])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!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=an(e.nextSibling),e===null)break}return null}function Pv(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=an(e.nextSibling),e===null))return null;return e}function vp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=an(e.nextSibling),e===null))return null;return e}function Tu(e){return e.data==="$?"||e.data==="$~"}function Mu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function $v(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 an(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 Au=null;function xp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return an(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function wp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Sp(e,t,i){switch(t=Tr(i),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Va(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);No(e)}var sn=new Map,Cp=new Set;function Mr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Yn=Y.d;Y.d={f:qv,r:Vv,D:Xv,C:Zv,L:Qv,m:Wv,X:ex,S:Jv,M:tx};function qv(){var e=Yn.f(),t=gr();return e||t}function Vv(e){var t=dl(e);t!==null&&t.tag===5&&t.type==="form"?Kh(t):Yn.r(e)}var Gl=typeof document>"u"?null:document;function Tp(e,t,i){var s=Gl;if(s&&typeof t=="string"&&t){var u=Qt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof i=="string"&&(u+='[crossorigin="'+i+'"]'),Cp.has(u)||(Cp.add(u),e={rel:e,crossOrigin:i,href:t},s.querySelector(u)===null&&(t=s.createElement("link"),Ct(t,"link",e),pt(t),s.head.appendChild(t)))}}function Xv(e){Yn.D(e),Tp("dns-prefetch",e,null)}function Zv(e,t){Yn.C(e,t),Tp("preconnect",e,t)}function Qv(e,t,i){Yn.L(e,t,i);var s=Gl;if(s&&e&&t){var u='link[rel="preload"][as="'+Qt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(u+='[imagesrcset="'+Qt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(u+='[imagesizes="'+Qt(i.imageSizes)+'"]')):u+='[href="'+Qt(e)+'"]';var d=u;switch(t){case"style":d=Yl(e);break;case"script":d=Pl(e)}sn.has(d)||(e=v({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),sn.set(d,e),s.querySelector(u)!==null||t==="style"&&s.querySelector(Xa(d))||t==="script"&&s.querySelector(Za(d))||(t=s.createElement("link"),Ct(t,"link",e),pt(t),s.head.appendChild(t)))}}function Wv(e,t){Yn.m(e,t);var i=Gl;if(i&&e){var s=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Qt(s)+'"][href="'+Qt(e)+'"]',d=u;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Pl(e)}if(!sn.has(d)&&(e=v({rel:"modulepreload",href:e},t),sn.set(d,e),i.querySelector(u)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Za(d)))return}s=i.createElement("link"),Ct(s,"link",e),pt(s),i.head.appendChild(s)}}}function Jv(e,t,i){Yn.S(e,t,i);var s=Gl;if(s&&e){var u=fl(s).hoistableStyles,d=Yl(e);t=t||"default";var b=u.get(d);if(!b){var S={loading:0,preload:null};if(b=s.querySelector(Xa(d)))S.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},i),(i=sn.get(d))&&Eu(e,i);var L=b=s.createElement("link");pt(L),Ct(L,"link",e),L._p=new Promise(function(G,J){L.onload=G,L.onerror=J}),L.addEventListener("load",function(){S.loading|=1}),L.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Ar(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:S},u.set(d,b)}}}function ex(e,t){Yn.X(e,t);var i=Gl;if(i&&e){var s=fl(i).hoistableScripts,u=Pl(e),d=s.get(u);d||(d=i.querySelector(Za(u)),d||(e=v({src:e,async:!0},t),(t=sn.get(u))&&Nu(e,t),d=i.createElement("script"),pt(d),Ct(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(u,d))}}function tx(e,t){Yn.M(e,t);var i=Gl;if(i&&e){var s=fl(i).hoistableScripts,u=Pl(e),d=s.get(u);d||(d=i.querySelector(Za(u)),d||(e=v({src:e,async:!0,type:"module"},t),(t=sn.get(u))&&Nu(e,t),d=i.createElement("script"),pt(d),Ct(d,"link",e),i.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(u,d))}}function Mp(e,t,i,s){var u=(u=xe.current)?Mr(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=Yl(i.href),i=fl(u).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=Yl(i.href);var d=fl(u).hoistableStyles,b=d.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=u.querySelector(Xa(e)))&&!d._p&&(b.instance=d,b.state.loading=5),sn.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},sn.set(e,i),d||nx(u,e,i,b.state))),t&&s===null)throw Error(r(528,""));return b}if(t&&s!==null)throw Error(r(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Pl(i),i=fl(u).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(r(444,e))}}function Yl(e){return'href="'+Qt(e)+'"'}function Xa(e){return'link[rel="stylesheet"]['+e+"]"}function Ap(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function nx(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}),Ct(t,"link",i),pt(t),e.head.appendChild(t))}function Pl(e){return'[src="'+Qt(e)+'"]'}function Za(e){return"script[async]"+e}function Ep(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Qt(i.href)+'"]');if(s)return t.instance=s,pt(s),s;var u=v({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),pt(s),Ct(s,"style",u),Ar(s,i.precedence,e),t.instance=s;case"stylesheet":u=Yl(i.href);var d=e.querySelector(Xa(u));if(d)return t.state.loading|=4,t.instance=d,pt(d),d;s=Ap(i),(u=sn.get(u))&&Eu(s,u),d=(e.ownerDocument||e).createElement("link"),pt(d);var b=d;return b._p=new Promise(function(S,L){b.onload=S,b.onerror=L}),Ct(d,"link",s),t.state.loading|=4,Ar(d,i.precedence,e),t.instance=d;case"script":return d=Pl(i.src),(u=e.querySelector(Za(d)))?(t.instance=u,pt(u),u):(s=i,(u=sn.get(d))&&(s=v({},i),Nu(s,u)),e=e.ownerDocument||e,u=e.createElement("script"),pt(u),Ct(u,"link",s),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,Ar(s,i.precedence,e));return t.instance}function Ar(e,t,i){for(var s=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=s.length?s[s.length-1]:null,d=u,b=0;b<s.length;b++){var S=s[b];if(S.dataset.precedence===t)d=S;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function Eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Nu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Er=null;function Np(e,t,i){if(Er===null){var s=new Map,u=Er=new Map;u.set(i,s)}else u=Er,s=u.get(i),s||(s=new Map,u.set(i,s));if(s.has(e))return s;for(s.set(e,null),i=i.getElementsByTagName(e),u=0;u<i.length;u++){var d=i[u];if(!(d[fa]||d[vt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var S=s.get(b);S?S.push(d):s.set(b,[d])}}return s}function kp(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function ix(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Lp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function lx(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 u=Yl(s.href),d=t.querySelector(Xa(u));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Nr.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=d,pt(d);return}d=t.ownerDocument||t,s=Ap(s),(u=sn.get(u))&&Eu(s,u),d=d.createElement("link"),pt(d);var b=d;b._p=new Promise(function(S,L){b.onload=S,b.onerror=L}),Ct(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=Nr.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var ku=0;function ax(e,t){return e.stylesheets&&e.count===0&&Lr(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&Lr(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&ku===0&&(ku=62500*Uv());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Lr(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>ku?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(u)}}:null}function Nr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var kr=null;function Lr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,kr=new Map,t.forEach(sx,e),kr=null,Nr.call(e))}function sx(e,t){if(!(t.state.loading&4)){var i=kr.get(e);if(i)var s=i.get(null);else{i=new Map,kr.set(e,i);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var b=u[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(i.set(b.dataset.precedence,b),s=b)}s&&i.set(null,s)}u=t.instance,b=u.getAttribute("data-precedence"),d=i.get(b)||s,d===s&&i.set(null,u),i.set(b,u),this.count++,s=Nr.bind(this),u.addEventListener("load",s),u.addEventListener("error",s),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Qa={$$typeof:_,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function rx(e,t,i,s,u,d,b,S,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=To(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=To(0),this.hiddenUpdates=To(null),this.identifierPrefix=s,this.onUncaughtError=u,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,u,d,b,S,L,G,J,te){return e=new rx(e,t,i,b,L,G,J,te,S),t=1,d===!0&&(t|=24),d=Gt(3,null,null,t),e.current=d,d.stateNode=e,t=oc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:i,cache:t},fc(d),e}function _p(e){return e?(e=Sl,e):Sl}function jp(e,t,i,s,u,d){u=_p(u),s.context===null?s.context=u:s.pendingContext=u,s=ri(t),s.payload={element:i},d=d===void 0?null:d,d!==null&&(s.callback=d),i=oi(e,s,t),i!==null&&(Bt(i,e,t),ka(i,e,t))}function Op(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function Lu(e,t){Op(e,t),(e=e.alternate)&&Op(e,t)}function Dp(e){if(e.tag===13||e.tag===31){var t=Ki(e,67108864);t!==null&&Bt(t,e,67108864),Lu(e,67108864)}}function zp(e){if(e.tag===13||e.tag===31){var t=Vt();t=Mo(t);var i=Ki(e,t);i!==null&&Bt(i,e,t),Lu(e,t)}}var Rr=!0;function ox(e,t,i,s){var u=k.T;k.T=null;var d=Y.p;try{Y.p=2,Ru(e,t,i,s)}finally{Y.p=d,k.T=u}}function cx(e,t,i,s){var u=k.T;k.T=null;var d=Y.p;try{Y.p=8,Ru(e,t,i,s)}finally{Y.p=d,k.T=u}}function Ru(e,t,i,s){if(Rr){var u=_u(s);if(u===null)bu(e,t,s,_r,i),Bp(e,s);else if(dx(u,e,t,i,s))s.stopPropagation();else if(Bp(e,s),t&4&&-1<ux.indexOf(e)){for(;u!==null;){var d=dl(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=kt(d.pendingLanes);if(b!==0){var S=d;for(S.pendingLanes|=2,S.entangledLanes|=2;b;){var L=1<<31-Mt(b);S.entanglements[1]|=L,b&=~L}wn(d),(Ie&6)===0&&(mr=Et()+500,Pa(0))}}break;case 31:case 13:S=Ki(d,2),S!==null&&Bt(S,d,2),gr(),Lu(d,2)}if(d=_u(s),d===null&&bu(e,t,s,_r,i),d===u)break;u=d}u!==null&&s.stopPropagation()}else bu(e,t,s,null,i)}}function _u(e){return e=Oo(e),ju(e)}var _r=null;function ju(e){if(_r=null,e=ul(e),e!==null){var t=c(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=h(t),e!==null)return e;e=null}else if(i===31){if(e=p(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return _r=e,null}function Hp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(xo()){case ra:return 2;case oa:return 8;case Oi:case Ss:return 32;case ca:return 268435456;default:return 32}default:return 32}}var Ou=!1,vi=null,xi=null,wi=null,Wa=new Map,Ja=new Map,Si=[],ux="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Bp(e,t){switch(e){case"focusin":case"focusout":vi=null;break;case"dragenter":case"dragleave":xi=null;break;case"mouseover":case"mouseout":wi=null;break;case"pointerover":case"pointerout":Wa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ja.delete(t.pointerId)}}function es(e,t,i,s,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:d,targetContainers:[u]},t!==null&&(t=dl(t),t!==null&&Dp(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function dx(e,t,i,s,u){switch(t){case"focusin":return vi=es(vi,e,t,i,s,u),!0;case"dragenter":return xi=es(xi,e,t,i,s,u),!0;case"mouseover":return wi=es(wi,e,t,i,s,u),!0;case"pointerover":var d=u.pointerId;return Wa.set(d,es(Wa.get(d)||null,e,t,i,s,u)),!0;case"gotpointercapture":return d=u.pointerId,Ja.set(d,es(Ja.get(d)||null,e,t,i,s,u)),!0}return!1}function Up(e){var t=ul(e.target);if(t!==null){var i=c(t);if(i!==null){if(t=i.tag,t===13){if(t=h(i),t!==null){e.blockedOn=t,Wd(e.priority,function(){zp(i)});return}}else if(t===31){if(t=p(i),t!==null){e.blockedOn=t,Wd(e.priority,function(){zp(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=_u(e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);jo=s,i.target.dispatchEvent(s),jo=null}else return t=dl(i),t!==null&&Dp(t),e.blockedOn=i,!1;t.shift()}return!0}function Kp(e,t,i){jr(e)&&i.delete(t)}function fx(){Ou=!1,vi!==null&&jr(vi)&&(vi=null),xi!==null&&jr(xi)&&(xi=null),wi!==null&&jr(wi)&&(wi=null),Wa.forEach(Kp),Ja.forEach(Kp)}function Or(e,t){e.blockedOn===t&&(e.blockedOn=null,Ou||(Ou=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,fx)))}var Dr=null;function Ip(e){Dr!==e&&(Dr=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){Dr===e&&(Dr=null);for(var t=0;t<e.length;t+=3){var i=e[t],s=e[t+1],u=e[t+2];if(typeof s!="function"){if(ju(s||i)===null)continue;break}var d=dl(i);d!==null&&(e.splice(t,3),t-=3,_c(d,{pending:!0,data:u,method:i.method,action:s},s,u))}}))}function $l(e){function t(L){return Or(L,e)}vi!==null&&Or(vi,e),xi!==null&&Or(xi,e),wi!==null&&Or(wi,e),Wa.forEach(t),Ja.forEach(t);for(var i=0;i<Si.length;i++){var s=Si[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Si.length&&(i=Si[0],i.blockedOn===null);)Up(i),i.blockedOn===null&&Si.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(s=0;s<i.length;s+=3){var u=i[s],d=i[s+1],b=u[_t]||null;if(typeof d=="function")b||Ip(i);else if(b){var S=null;if(d&&d.hasAttribute("formAction")){if(u=d,b=d[_t]||null)S=b.formAction;else if(ju(u)!==null)continue}else S=b.action;typeof S=="function"?i[s+1]=S:(i.splice(s,3),s-=3),Ip(i)}}}function Fp(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=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,u=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),u!==null&&(u(),u=null)}}}function Du(e){this._internalRoot=e}zr.prototype.render=Du.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var i=t.current,s=Vt();jp(i,s,e,t,null,null)},zr.prototype.unmount=Du.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;jp(e.current,2,null,e,null,null),gr(),t[cl]=null}};function zr(e){this._internalRoot=e}zr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qd();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Si.length&&t!==0&&t<Si[i].priority;i++);Si.splice(i,0,e),i===0&&Up(e)}};var Gp=n.version;if(Gp!=="19.2.8")throw Error(r(527,Gp,"19.2.8"));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var hx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hr.isDisabled&&Hr.supportsFiber)try{Jn=Hr.inject(hx),Tt=Hr}catch{}}return ns.createRoot=function(e,t){if(!o(e))throw Error(r(299));var i=!1,s="",u=Zh,d=Qh,b=Wh;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=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,u,d,b,Fp),e[cl]=t.current,gu(e),new Du(t)},ns.hydrateRoot=function(e,t,i){if(!o(e))throw Error(r(299));var s=!1,u="",d=Zh,b=Qh,S=Wh,L=null;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(d=i.onUncaughtError),i.onCaughtError!==void 0&&(b=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError),i.formState!==void 0&&(L=i.formState)),t=Rp(e,1,!0,t,i??null,s,u,L,d,b,S,Fp),t.context=_p(null),i=t.current,s=Vt(),s=Mo(s),u=ri(s),u.callback=null,oi(i,u,s),i=s,t.current.lanes=i,da(t,i),wn(t),e[cl]=t.current,gu(e),new zr(t)},ns.version="19.2.8",ns}var Xp;function Tx(){if(Xp)return Hu.exports;Xp=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),Hu.exports=Cx(),Hu.exports}var Mx=Tx();const Ax=fb(Mx),cn="/ws/client",mb={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",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",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 a new administrator terminal",adminShort:"Admin",adminTerminalSetup:"On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access. Approve the one-time Windows prompt under the same account as Herdr Remote.",adminTerminalUpdate:"Update the relay and Windows host connector before opening an administrator terminal."},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto refresh",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic ↓in / ↑out",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready.",admin_broker_unavailable:"The administrator terminal broker is not running. On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access, then reload this tab.",admin_terminal_unsupported:"This relay or Windows host connector cannot confirm administrator mode. Upgrade both, then reopen this tab."},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"}},Ex={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:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",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:"显示语言",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:"以管理员身份新建终端",adminShort:"管理员",adminTerminalSetup:"请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,再使用运行 Herdr Remote 的同一账户批准一次 Windows 提权提示。",adminTerminalUpdate:"请先升级 relay 和 Windows 主机连接器,再新建管理员终端。"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"切换 Ctrl 锁定",alt:"切换 Alt 锁定",shift:"切换 Shift 锁定",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"概览",tabClients:"客户端 ({count})",tabPtys:"PTY ({count})",tabDevices:"设备 ({count})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接于",colTraffic:"流量 ↓入 / ↑出",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。",admin_broker_unavailable:"管理员终端 broker 尚未运行。请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,然后刷新此标签页。",admin_terminal_unsupported:"当前 relay 或 Windows 主机连接器无法确认管理员模式。请升级两端后重新打开此标签页。"},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:"移除图片"}},Ku={en:mb,zh:Ex};function Nd(l,n,a){const r=Ku[l]||Ku.en,o=n.split(".");let c=r;for(const h of o)if(c&&typeof c=="object"&&h in c)c=c[h];else{let p=Ku.en;for(const m of o)if(p&&typeof p=="object"&&m in p)p=p[m];else return n;c=p;break}if(typeof c!="string")return n;if(a){let h=c;for(const[p,m]of Object.entries(a))h=h.replaceAll(`{${p}}`,String(m));return h}return c}function Iu(l){return typeof l=="string"&&Object.hasOwn(mb.serverErrors,l)}const re={ESC:"\x1B",TAB:" ",SHIFT_TAB:"\x1B[Z",ENTER:"\r",BACKSPACE:"",UP:"\x1B[A",DOWN:"\x1B[B",RIGHT:"\x1B[C",LEFT:"\x1B[D",HOME:"\x1B[H",END:"\x1B[F",PAGE_UP:"\x1B[5~",PAGE_DOWN:"\x1B[6~",INSERT:"\x1B[2~",DELETE:"\x1B[3~",CTRL_C:"",CTRL_D:"",CTRL_Z:"",CTRL_L:"\f",CTRL_A:"",CTRL_E:"",CTRL_K:"\v",CTRL_R:"",CTRL_W:"",CTRL_U:"",CTRL_X:"",CTRL_N:"",CTRL_P:"",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},Nx=new TextEncoder;function kd(l){return Nx.encode(l)}function pb(l){if(!l||l.length===0)return"";const a=l.toUpperCase().charCodeAt(0);return a>=65&&a<=90?String.fromCharCode(a-64):l==="@"||l===" "?"\0":l==="["?"\x1B":l==="\\"?"":l==="]"?"":l==="^"?"":l==="_"?"":l==="?"?"":l}function kx(l){return`\x1B${l}`}function Zp({ctrl:l,alt:n,shift:a}){return 1+(a?1:0)+(n?2:0)+(l?4:0)}const gb=/^\x1b[[O]([ABCDHF])$/,bb=/^\x1bO([PQRS])$/,yb=/^\x1b\[(\d+)~$/;function io(l,n){const{ctrl:a=!1,alt:r=!1,shift:o=!1}=n;if(!a&&!r&&!o)return l;const c=Zp(n),h=r&&!a&&!o,p=gb.exec(l);if(p)return`\x1B[1;${c}${p[1]}`;const m=bb.exec(l);if(m)return`\x1B[1;${c}${m[1]}`;const g=yb.exec(l);if(g)return`\x1B[${g[1]};${c}~`;switch(l){case re.TAB:return o&&!a&&!r?re.SHIFT_TAB:h?`\x1B${l}`:`\x1B[9;${c}u`;case re.SHIFT_TAB:return!a&&!r?l:`\x1B[9;${Zp({...n,shift:!0})}u`;case re.ENTER:return h?`\x1B${l}`:`\x1B[13;${c}u`;case re.BACKSPACE:return a&&!r&&!o?"\b":h?`\x1B${l}`:`\x1B[127;${c}u`;case re.ESC:return h?`\x1B${l}`:`\x1B[27;${c}u`}let y=l;return o&&l.length===1&&!a&&(y=l.toUpperCase()),a&&(y=pb(y)),r&&(y=kx(y)),y}function Lx(l){return[...l].length===1?!0:gb.test(l)||bb.test(l)||yb.test(l)||l===re.SHIFT_TAB}class Cn extends Error{constructor(a,r={}){super(a);X(this,"code");X(this,"params");this.name="KeyComboError",this.code=a,this.params=r}}const Rx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},Qp={esc:re.ESC,tab:re.TAB,enter:re.ENTER,backspace:re.BACKSPACE,delete:re.DELETE,left:re.LEFT,right:re.RIGHT,up:re.UP,down:re.DOWN,home:re.HOME,end:re.END,pageup:re.PAGE_UP,pagedown:re.PAGE_DOWN,insert:re.INSERT,space:" ","+":"+"},_x={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},jx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function vb(l,n){const a=l.toLowerCase().split("+");if(a.some(m=>!m))throw new Cn("invalidStepSyntax",{step:n+1});const r={};let o;for(const m of a)if(m==="ctrl"||m==="control"){if(r.ctrl)throw new Cn("duplicateModifier",{step:n+1,modifier:"Ctrl"});r.ctrl=!0}else if(m==="alt"||m==="option"){if(r.alt)throw new Cn("duplicateModifier",{step:n+1,modifier:"Alt"});r.alt=!0}else if(m==="shift"){if(r.shift)throw new Cn("duplicateModifier",{step:n+1,modifier:"Shift"});r.shift=!0}else if(o===void 0)o=m;else throw new Cn("multipleKeys",{step:n+1});if(!o)throw new Cn("missingKey",{step:n+1});const c=Rx[o]||o,h=/^f(?:[1-9]|1[0-2])$/.exec(c);let p;if(h)p=re[c.toUpperCase()];else if(Object.hasOwn(Qp,c))p=Qp[c];else if([...c].length===1&&/^[\x21-\x7e]$/.test(c))p=c;else throw new Cn("unsupportedKey",{step:n+1,key:c});return{key:p,keyName:c,modifiers:r,sequence:Dx(p,c,r)}}function Ox(l){return 1+(l.shift?1:0)+(l.alt?2:0)+(l.ctrl?4:0)}function Wp(l,n){const a=[...l][0].codePointAt(0);return a===void 0?"":`\x1B[${a};${Ox(n)}u`}function Dx(l,n,a){if(!a.ctrl)return io(l,a);if(n.length===1&&/^[\x20-\x7e]$/.test(n)){const r=n.toLowerCase();if(a.alt||a.shift||r==="m"||r==="i")return Wp(r,a);if(r==="-"||r==="/"||r==="_")return"";const o=pb(r);return o!==r?o:Wp(r,a)}return io(l,a)}function Tn(l){if(typeof l!="string"||!l.trim())throw new Cn("empty");const n=l.trim().split(/\s+/);if(n.length>8)throw new Cn("tooManySteps",{count:8});return n.map((a,r)=>vb(a,r).sequence)}function rs(l){const n=l.trim().split(/\s+/);return n.length>1&&n.every(a=>["esc","escape"].includes(a.toLowerCase()))?`ESC${jx[n.length]||` ×${n.length}`}`:n.map((a,r)=>{const{keyName:o,modifiers:c}=vb(a,r),h=_x[o]||(/^f\d+$/.test(o),o.toUpperCase());return c.ctrl&&c.alt&&c.shift?`Ctrl+Alt+⇧${h}`:c.ctrl&&c.alt?`Ctrl+Alt+${h}`:c.ctrl&&c.shift?`^⇧${h}`:c.ctrl?`^${h}`:c.alt&&c.shift?`Alt+⇧${h}`:c.alt?`Alt+${h}`:c.shift?`⇧${h}`:h}).join(" ")}const U=(l,n,a,r=!0)=>({id:l,labelKey:n,combo:a,verified:r}),xb={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[U("mode","mode","shift+tab"),U("rewind","rewind","esc esc"),U("details","details","ctrl+o"),U("model","model","alt+p"),U("thinking","thinking","alt+t"),U("todos","todos","ctrl+t"),U("background","background","ctrl+b"),U("editor","editor","ctrl+g"),U("history","history","ctrl+r"),U("stash","stash","ctrl+s"),U("pasteImage","pasteImage","ctrl+v"),U("newline","newline","ctrl+j"),U("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[U("mode","mode","shift+tab"),U("editPrevious","editPrevious","esc esc"),U("details","details","ctrl+t"),U("queue","queue","tab"),U("history","history","ctrl+r"),U("copy","copy","ctrl+o"),U("editor","editor","ctrl+g"),U("newline","newline","ctrl+j"),U("clear","clear","ctrl+l"),U("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[U("mode","mode","shift+tab"),U("yolo","yolo","ctrl+y"),U("rewind","rewind","esc esc"),U("todos","todos","ctrl+t"),U("expand","expand","ctrl+o"),U("background","background","ctrl+b"),U("editor","editor","ctrl+g"),U("history","history","ctrl+r"),U("undo","undo","ctrl+z"),U("newline","newline","ctrl+j"),U("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[U("mode","mode","shift+tab"),U("interrupt","interrupt","esc"),U("history","history","ctrl+r"),U("newline","newline","ctrl+j"),U("todos","todos","ctrl+t",!1),U("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[U("agent","agent","tab"),U("agentBack","agentBack","shift+tab"),U("interrupt","interrupt","esc"),U("palette","palette","ctrl+p"),U("model","model","ctrl+x m"),U("recentModel","recentModel","f2"),U("variant","variant","ctrl+t"),U("newSession","newSession","ctrl+x n"),U("sessions","sessions","ctrl+x l"),U("undo","undo","ctrl+x u"),U("editor","editor","ctrl+x e"),U("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[U("agent","agent","tab",!1),U("agentBack","agentBack","shift+tab",!1),U("interrupt","interrupt","esc"),U("palette","palette","ctrl+p"),U("model","model","ctrl+x m"),U("recentModel","recentModel","f2"),U("variant","variant","ctrl+t"),U("newSession","newSession","ctrl+x n"),U("sessions","sessions","ctrl+x l"),U("undo","undo","ctrl+x u"),U("editor","editor","ctrl+x e"),U("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[U("thinkingMode","thinkingMode","shift+tab"),U("interrupt","interrupt","esc"),U("nextModel","nextModel","ctrl+p"),U("modelPicker","modelPicker","ctrl+l"),U("tools","tools","ctrl+o"),U("thinkingBlocks","thinkingBlocks","ctrl+t"),U("editor","editor","ctrl+g"),U("followup","followup","alt+enter"),U("dequeue","dequeue","alt+up"),U("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[U("thinkingMode","thinkingMode","shift+tab"),U("plan","plan","alt+shift+p"),U("model","model","alt+m"),U("temporaryModel","temporaryModel","alt+p"),U("nextModel","nextModel","ctrl+p"),U("tools","tools","ctrl+o"),U("thinking","thinking","ctrl+t"),U("history","history","ctrl+r"),U("editor","editor","ctrl+g"),U("followup","followup","ctrl+enter"),U("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[U("mode","mode","shift+tab"),U("interrupt","interrupt","esc"),U("expand","expand","ctrl+o"),U("expandAll","expandAll","ctrl+e"),U("reasoning","reasoning","ctrl+t"),U("editor","editor","ctrl+g"),U("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[U("mode","mode","shift+tab"),U("review","review","ctrl+r"),U("newline","newline","ctrl+j"),U("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[U("specMode","specMode","shift+tab"),U("autonomy","autonomy","ctrl+l"),U("details","details","ctrl+o",!1),U("queue","queue","ctrl+enter"),U("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[U("plan","plan","shift+tab"),U("interrupt","interrupt","esc"),U("undoPicker","undoPicker","esc esc"),U("expand","expand","ctrl+o"),U("editor","editor","ctrl+g"),U("steer","steer","ctrl+s"),U("undo","undo","ctrl+-"),U("newline","newline","ctrl+j"),U("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[U("palette","palette","ctrl+o"),U("reasoning","reasoning","alt+d"),U("mode","mode","ctrl+s",!1),U("editor","editor","ctrl+g"),U("history","history","ctrl+r"),U("sidebar","sidebar","ctrl+backslash"),U("pasteImage","pasteImage","ctrl+v"),U("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[U("interrupt","interrupt","ctrl+c"),U("newline","newline","ctrl+j"),U("editor","editor","ctrl+g"),U("agents","agents","ctrl+t"),U("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[U("permissionMode","permissionMode","shift+tab"),U("bypass","bypass","ctrl+y"),U("tasks","tasks","ctrl+t"),U("editor","editor","ctrl+x"),U("history","history","ctrl+r"),U("queue","queue","ctrl+enter"),U("newline","newline","ctrl+j"),U("pasteImage","pasteImage","alt+v"),U("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[U("mode","mode","shift+tab"),U("interrupt","interrupt","ctrl+c"),U("thinking","thinking","alt+t"),U("newline","newline","ctrl+j"),U("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[U("mode","mode","shift+tab"),U("interrupt","interrupt","ctrl+c"),U("rewind","rewind","esc esc"),U("interject","interject","ctrl+enter"),U("multiline","multiline","ctrl+m"),U("newline","newline","alt+enter"),U("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[U("mode","mode","shift+tab"),U("interrupt","interrupt","ctrl+c"),U("background","background","ctrl+b"),U("approve","approve","ctrl+k"),U("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[U("interrupt","interrupt","ctrl+c"),U("thinking","thinking","ctrl+t"),U("expand","expand","ctrl+e"),U("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[U("permissionMode","permissionMode","shift+tab"),U("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[U("agentSwap","agentSwap","shift+tab"),U("interrupt","interrupt","esc"),U("details","details","ctrl+t"),U("steer","steer","ctrl+s"),U("expand","expand","ctrl+o"),U("activity","activity","ctrl+x"),U("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[U("planAct","planAct","tab"),U("autoApprove","autoApprove","shift+tab"),U("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[U("rewind","rewind","esc esc"),U("search","search","ctrl+f"),U("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[U("interrupt","interrupt","esc"),U("queue","queue","alt+enter"),U("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},nl=xb,zx=Object.keys(xb),Jp={pi:"pi",claude:"claude","claude-code":"claude",codex:"codex",gemini:"gemini",cursor:"cursor","cursor-agent":"cursor",devin:"devin","devin-cli":"devin","devin cli":"devin",agy:"agy",antigravity:"agy","antigravity-cli":"agy",cline:"cline",".cline":"cline",omp:"omp",mastracode:"mastracode","mastra-code":"mastracode","mastra code":"mastracode",opencode:"opencode",opencode2:"opencode","open-code":"opencode",copilot:"copilot","github-copilot":"copilot",ghcs:"copilot",kimi:"kimi","kimi-code":"kimi","kimi code":"kimi",kiro:"kiro","kiro-cli":"kiro",droid:"droid",amp:"amp","amp-local":"amp",grok:"grok","grok-build":"grok",hermes:"hermes","hermes-agent":"hermes",kilo:"kilo","kilo-code":"kilo","kilo code":"kilo",qodercli:"qodercli",qoderclicn:"qodercli",qoder:"qodercli",qodercn:"qodercli",qwen:"qwen","qwen-code":"qwen","qwen code":"qwen",letta:"letta","letta-code":"letta","letta code":"letta",maki:"maki",muse:"muse","muse-code":"muse","muse-cli":"muse",shell:"shell"};function Hx(l){return l&&l.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function eg(l){const n=Hx(l);return Jp[n]?Jp[n]:/^muse-bin-\d/.test(n)?"muse":null}function Bx(l,n="auto"){return n&&n!=="auto"?eg(n)||"shell":eg(l)||"shell"}const fs=[U("genericCtrlC","interrupt","ctrl+c"),U("genericCtrlD","eof","ctrl+d"),U("genericCtrlZ","suspend","ctrl+z"),U("genericCtrlL","clear","ctrl+l"),U("genericCtrlR","history","ctrl+r"),U("genericCtrlA","startOfLine","ctrl+a"),U("genericCtrlE","endOfLine","ctrl+e"),U("genericCtrlK","killToEnd","ctrl+k")],tg=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Ux=["genericCtrlC"],Kx=fs.filter(({id:l})=>l!=="genericCtrlD"&&l!=="genericCtrlZ"),Ix=fs.filter(({id:l})=>l==="genericCtrlC"||l==="genericCtrlZ").map(l=>l.id==="genericCtrlZ"?{...l,labelKey:"eof"}:l),Fx={posix:fs,"git-bash":fs,cmd:Ix,powershell:Kx},Gx={posix:tg,"git-bash":tg,cmd:["genericCtrlC","genericCtrlZ"],powershell:["genericCtrlC","genericCtrlL","genericCtrlR"]};function Yx(l,n){var o,c;const a=l.map(h=>{var g;const p=(g=n==null?void 0:n.actions)==null?void 0:g[h.id];let m=typeof(p==null?void 0:p.keys)=="string"?p.keys:h.combo;try{Tn(m)}catch{m=h.combo}return{...h,defaultCombo:h.combo,combo:m,hidden:typeof(p==null?void 0:p.hidden)=="boolean"?p.hidden:h.defaultHidden===!0,custom:!1}}),r=new Set(a.map(h=>h.id));for(const h of(n==null?void 0:n.custom)||[]){if(!h||typeof h.id!="string"||r.has(h.id))continue;const p=h.keys;try{Tn(p)}catch{continue}a.push({id:h.id,labelKey:"custom",defaultCombo:p,combo:p,verified:!0,hidden:((c=(o=n==null?void 0:n.actions)==null?void 0:o[h.id])==null?void 0:c.hidden)===!0,custom:!0,customLabel:h.label}),r.add(h.id)}if(Array.isArray(n==null?void 0:n.order)){const h=new Map(n.order.map((p,m)=>[p,m]));a.sort((p,m)=>(h.get(p.id)??Number.MAX_SAFE_INTEGER)-(h.get(m.id)??Number.MAX_SAFE_INTEGER))}return a}function Px(l,n){const a=new Set(l.map(r=>r.combo.trim().toLowerCase()));return n.filter(r=>!a.has(r.combo.trim().toLowerCase()))}const us=l=>l.id.startsWith("generic");function wb(l,n,a="posix"){const r=nl[l],o=l==="shell"?Fx[a]:fs,c=new Set([...r.bar||[],...l==="shell"?Gx[a]:Ux]),h=[...r.actions,...o].map(p=>({...p,defaultHidden:!c.has(p.id)}));return Yx(h,n)}function Sb(l,n,a="posix"){const r=wb(l,n,a),o=r.filter(h=>!us(h)),c=new Set(Px(o,r.filter(us)));return r.filter(h=>!us(h)||c.has(h))}function $x(l,n,a="posix"){const r=Sb(l,n,a).filter(o=>!o.hidden);return{agentActions:r.filter(o=>!us(o)),genericActions:r.filter(us)}}function qx(l){const n={};for(const[a,r]of Object.entries(l.actions||{})){const o={...r};delete o.hidden,Object.keys(o).length>0&&(n[a]=o)}return{...l,actions:n}}function Cb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const n=Object.create(null);for(const[a,r]of Object.entries(l).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(a)||["__proto__","constructor","prototype"].includes(a)||!r||typeof r!="object"||Array.isArray(r))continue;const o=r,c={};if(Array.isArray(o.order)&&(c.order=[...new Set(o.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),o.actions&&typeof o.actions=="object"&&!Array.isArray(o.actions)){const h=Object.create(null);for(const[p,m]of Object.entries(o.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(p)||!m||typeof m!="object"||Array.isArray(m))continue;const g=m,y={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{Tn(v),y.keys=v}catch{}}typeof g.hidden=="boolean"&&(y.hidden=g.hidden),Object.keys(y).length>0&&(h[p]=y)}c.actions=h}if(Array.isArray(o.custom)){const h=new Set;c.custom=o.custom.slice(0,64).flatMap(p=>{if(!p||typeof p!="object"||Array.isArray(p))return[];const m=p;if(typeof m.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(m.id)||["__proto__","constructor","prototype"].includes(m.id)||h.has(m.id))return[];if(typeof m.label!="string"||!m.label.trim()||typeof m.keys!="string"||!m.keys.trim())return[];const g=m.keys.trim().slice(0,80);try{Tn(g)}catch{return[]}return h.add(m.id),[{id:m.id,label:m.label.trim().slice(0,64),keys:g}]})}n[a]=c}return n}const Vx=10,Xx=24,hs=15,lo=13,Ld=640;function Zx(){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 ea()<Ld}function ea(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function rd(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function ta(l,n=hs){const a=typeof l=="number"?l:Number(l);return!Number.isFinite(a)||a<=0?n:Math.min(Xx,Math.max(Vx,Math.round(a)))}function ng(l,n=ea()){if(n<Ld){const r=ta(l,lo);return Math.min(15,Math.max(12,r))}return ta(l,hs)}const ig="#11111b",Qx=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],ao=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],od=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:ao},{id:"jetbrains-mono",name:"JetBrains Mono",faces:['"JetBrains Mono"','"Herdr JetBrains Mono"']},{id:"fira-code",name:"Fira Code",faces:['"Fira Code"','"Herdr Fira Code"']},{id:"cascadia-code",name:"Cascadia Code",faces:['"Cascadia Code"','"Herdr Cascadia Code"']},{id:"source-code-pro",name:"Source Code Pro",faces:['"Source Code Pro"','"Herdr Source Code Pro"']},{id:"ibm-plex-mono",name:"IBM Plex Mono",faces:['"IBM Plex Mono"','"Herdr IBM Plex Mono"']}],Tb="host",Wx='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Jx='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',ew="JetBrains Mono, Menlo, Monaco, Consolas, monospace",tw={[Wx]:"host",[Jx]:"host",[ew]:"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 Fu(l){return typeof l!="string"||!l.trim()?Tb:tw[l]??l}const nw=[[/^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 iw(l){const n=nw.find(([a])=>a.test(l.trim()));return n?n[1]:null}function is(l){return`"${l.replace(/["\\]/g,"")}"`}function cd(l){return[...new Set([...l,...Qx])].join(", ")}const lw=cd(ao);function aw(l,n){const a=typeof l=="string"?l.trim():"";if(!a||a==="host"){if(!(n!=null&&n.family))return lw;const c=[],h=n.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&c.push(is(h.alias)),n.alias&&c.push(is(n.alias)),c.push(is(n.family));const p=iw(n.family);return p&&c.push(p),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&c.push(is(h.alias)),c.push(is(h.family))),cd([...c,...ao])}const r=od.find(c=>c.id===a);if(r)return cd([...r.faces,...ao]);if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const o=/,\s*['"]?monospace['"]?\s*$/i;return o.test(a)?a.replace(o,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function sw(l){if(!l)return null;const n={};return l.background&&(n.background=l.background,n.cursorAccent=l.background),l.foreground&&(n.foreground=l.foreground),l.cursor&&(n.cursor=l.cursor),l.ansi&&Object.assign(n,l.ansi),Object.keys(n).length===0?null:n}function Mb(){if(typeof document>"u")return;const l=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",l==null||l.setAttribute("content",ig),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=ig}const bt={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"},ud={local:{},session:{}};function Li(l,n){if(typeof window>"u")return ud[l][n]||null;try{return(l==="local"?window.localStorage:window.sessionStorage).getItem(n)}catch{return ud[l][n]||null}}function Mn(l,n,a){if(ud[l][n]=a,!(typeof window>"u"))try{(l==="local"?window.localStorage:window.sessionStorage).setItem(n,a)}catch(r){console.warn(`Failed to write to ${l}Storage:`,r)}}const lg=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),Gu=256*1024,rw=2,ow={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function Ji(l){return l?[l.family,...l.faces.map(n=>n.sha256),...(l.subsets||[]).map(n=>n.sha256)].join("|"):null}function ag(l){const n=l==null?void 0:l.faces.find(a=>a.style==="regular");return n?`Herdr Host ${n.sha256.slice(0,12)}`:null}function sg(l){return l?l.faces.reduce((n,a)=>n+a.bytes,0):0}function Yu(l){return l>=1024*1024?`${(l/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(l/1024))} KB`}function cw(l){if(typeof document>"u")return!1;let n=null;try{n=document.createElement("canvas").getContext("2d")}catch{return!1}if(!n)return!1;const a="mmmmmmmmmmlli10OQ@#WWww";for(const r of["serif","sans-serif"]){n.font=`72px ${r}`;const o=n.measureText(a).width;if(n.font=`72px "${l}", ${r}`,n.measureText(a).width!==o)return!0}return!1}const uw="herdr-remote-fonts",na="faces",ia="subsets",Ab=new Map,dd=new Map;function ho(){return new Promise(l=>{if(typeof indexedDB>"u"){l(null);return}try{const n=indexedDB.open(uw,2);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(na)||n.result.createObjectStore(na),n.result.objectStoreNames.contains(ia)||n.result.createObjectStore(ia)},n.onsuccess=()=>l(n.result),n.onerror=()=>l(null),n.onblocked=()=>l(null)}catch{l(null)}})}async function dw(l){const n=Ab.get(l);if(n)return n;const a=await ho();return a?new Promise(r=>{try{const o=a.transaction(na,"readonly").objectStore(na).get(l);o.onsuccess=()=>{const c=o.result;r(c instanceof ArrayBuffer?c:null)},o.onerror=()=>r(null)}catch{r(null)}finally{a.close()}}):null}async function fw(l,n){Ab.set(l,n);const a=await ho();a&&await new Promise(r=>{try{const o=a.transaction(na,"readwrite");o.objectStore(na).put(n,l),o.oncomplete=()=>r(),o.onerror=()=>r(),o.onabort=()=>r()}catch{r()}finally{a.close()}})}async function hw(l){const n=await ho();return n?new Promise(a=>{try{const r=IDBKeyRange.bound(`${l}:`,`${l}:`),o=n.transaction(ia,"readonly").objectStore(ia).getAll(r);o.onsuccess=()=>{const c=Array.isArray(o.result)?o.result:[];a(c.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},o.onerror=()=>a([])}catch{a([])}finally{n.close()}}):dd.get(l)??[]}async function mw(l,n){dd.set(l,[...dd.get(l)??[],n]);const a=await ho();a&&await new Promise(r=>{try{const o=a.transaction(ia,"readwrite");o.objectStore(ia).put(n,`${l}:${n.subsetSha}`),o.oncomplete=()=>r(),o.onerror=()=>r(),o.onabort=()=>r()}catch{r()}finally{a.close()}})}function Pu(l){return l?`Herdr Glyphs ${l.sha256.slice(0,12)}`:null}function pw(l){return l>=11904&&l<=12255||l>=12288&&l<=13311||l>=13312&&l<=19903||l>=19968&&l<=40959||l>=44032&&l<=55215||l>=63744&&l<=64255||l>=65072&&l<=65103||l>=65280&&l<=65519||l>=131072&&l<=201551}function Eb(l,n){return n<32||n>=127&&n<160||n>=9472&&n<=9631?!1:l==="all"||pw(n)}function gw(l){const n=[...new Set(l)].sort((r,o)=>r-o),a=[];for(let r=0;r<n.length;r+=1){const o=n[r];let c=o;for(;r+1<n.length&&n[r+1]===c+1;)c=n[r+1],r+=1;const h=p=>p.toString(16).toUpperCase();a.push(o===c?`U+${h(o)}`:`U+${h(o)}-${h(c)}`)}return a.join(", ")}async function bw(l,n){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=new FontFace(l,n.data,{weight:"400",style:"normal",unicodeRange:gw(n.codepoints)});document.fonts.add(await a.load())}const fd=new Set;function yw(l){return!!(l&&fd.has(l))}async function vw(l,n){if(fd.has(l))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=await Promise.all(n.map(({face:r,data:o})=>new FontFace(l,o,ow[r.style]).load()));for(const r of a)document.fonts.add(r);fd.add(l)}function rg(l){const n=atob(l),a=new Uint8Array(n.length);for(let r=0;r<n.length;r+=1)a[r]=n.charCodeAt(r);return a}async function Nb(l,n,a){const r=Math.ceil(l.bytes/Gu),o=new Uint8Array(l.bytes);let c=0;const h=async()=>{for(;c<r;){const p=c;c+=1;const m=await n(l.sha256,p),g=p*Gu,y=Math.min(Gu,l.bytes-g);if(m.length!==y)throw new Error("host_font_corrupt");o.set(m,g),a(m.length)}};return await Promise.all(Array.from({length:Math.min(rw,r)},h)),o.buffer}function kb(){try{const l=JSON.parse(Li("local",bt.hostFontConsent)||"{}");return l&&typeof l=="object"&&!Array.isArray(l)?l:{}}catch{return{}}}function og(l,n){const a=kb()[l];return a&&a.fingerprint===n?a.decision:null}function cg(l,n,a){const r=kb();r[l]={fingerprint:n,decision:a},Mn("local",bt.hostFontConsent,JSON.stringify(r))}const Lb={source:null,status:"none",alias:null,covered:0},$u={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:Lb,interactive:!1,glyphRevision:0},xw=String.fromCodePoint(...Array.from({length:95},(l,n)=>32+n),...Array.from({length:96},(l,n)=>160+n),...Array.from({length:112},(l,n)=>8192+n));function ug(l){const n=(l==null?void 0:l.subsets)??[];return n.find(a=>a.scope==="all")??n.find(a=>a.scope==="cjk")??null}function ww(l,n){const a=new Set;for(const r of l){const o=r.codePointAt(0);Eb(n,o)&&a.add(o)}return[...a]}const dg=3e4;function Sw(l){const n=C.useRef(new Map),a=C.useRef(new Map),r=C.useRef(new Map),o=C.useCallback(p=>{for(const m of[n.current,a.current]){for(const g of m.values())clearTimeout(g.timer),g.reject(new Error(p));m.clear()}},[]),c=C.useCallback((p,m)=>new Promise((g,y)=>{if(!l){y(new Error("disconnected"));return}const v=`${p}:${m}`,x=setTimeout(()=>{n.current.delete(v),y(new Error("host_font_timeout"))},dg);n.current.set(v,{resolve:g,reject:y,timer:x}),l.sendHostFontChunkRequest(p,m)}),[l]),h=C.useCallback((p,m,g)=>new Promise((y,v)=>{if(!l){v(new Error("disconnected"));return}const x=Math.random().toString(36).slice(2,12),w=setTimeout(()=>{a.current.delete(x),v(new Error("host_font_timeout"))},dg);a.current.set(x,{resolve:M=>y({...M,codepoints:m}),reject:v,timer:w}),r.current.set(x,g),l.sendHostFontSubsetRequest(p.sha256,String.fromCodePoint(...m),x)}),[l]);return C.useEffect(()=>{if(!l)return;const p=n.current,m=a.current,g=l.on("hostFontChunk",w=>{const M=`${w.sha256}:${w.index}`,T=p.get(M);if(T){p.delete(M),clearTimeout(T.timer);try{T.resolve(rg(w.dataBase64))}catch{T.reject(new Error("host_font_corrupt"))}}}),y=l.on("hostFontSubset",w=>{const M=m.get(w.requestId);if(!M)return;m.delete(w.requestId),clearTimeout(M.timer);const T=r.current.get(w.requestId)??(()=>{});if(r.current.delete(w.requestId),w.dataBase64!==void 0){try{const N=rg(w.dataBase64);T(N.length,N.length),M.resolve({subsetSha:w.subsetSha,data:N.buffer,codepoints:[]})}catch{M.reject(new Error("host_font_corrupt"))}return}T(0,w.bytes);const A={bytes:w.bytes,sha256:w.subsetSha};Nb(A,c,N=>T(N,w.bytes)).then(N=>M.resolve({subsetSha:w.subsetSha,data:N,codepoints:[]})).catch(N=>M.reject(N instanceof Error?N:new Error("host_font_failed")))}),v=l.on("error",w=>{(w.code==="host_font_unavailable"||w.code==="host_font_subset_failed")&&o(String(w.code))}),x=l.on("stateChange",w=>{w!=="connected"&&o("disconnected")});return()=>{g(),y(),v(),x(),o("disconnected")}},[l,o,c]),{requestChunk:c,requestSubset:h,rejectPending:o}}const Cw=15e3,Tw=80,Mw=2e3;function Aw(l,n={}){const[a,r]=C.useState($u),o=C.useRef(a);o.current=a;const c=C.useRef(n);c.current=n;const h=C.useRef(0),p=C.useRef(0),m=C.useRef(new Set),g=C.useRef(new Set),y=C.useRef(new Set),v=C.useRef(null),{requestChunk:x,requestSubset:w,rejectPending:M}=Sw(l),T=C.useCallback(()=>({isInstalled:c.current.isInstalled??cw,readCached:c.current.readCached??dw,writeCached:c.current.writeCached??fw,register:c.current.register??vw,isRegistered:c.current.isRegistered??yw,readSubsets:c.current.readSubsets??hw,writeSubset:c.current.writeSubset??mw,registerGlyphs:c.current.registerGlyphs??bw}),[]),A=C.useCallback(()=>(l==null?void 0:l.getHostId())||"default",[l]),N=C.useCallback((H,q)=>{H===h.current&&r($=>({...$,glyphs:{...$.glyphs,...q}}))},[]),E=C.useCallback(async(H,q,$)=>{const{registerGlyphs:W}=T();for(const le of $){if(await W(q,le),H!==h.current)return;for(const oe of le.codepoints)m.current.add(oe)}H!==h.current||!$.length||r(le=>({...le,glyphs:{...le.glyphs,alias:q,covered:m.current.size},glyphRevision:le.glyphRevision+1}))},[T]),_=C.useCallback(async(H,q,$)=>{const W=Pu(q),le=q.scope==="all"?xw+lg:lg,oe=ww(le,q.scope).filter(k=>!m.current.has(k));if(!oe.length)return;for(const k of oe)g.current.add(k);const I=await w(q,oe,$);H===h.current&&(await T().writeSubset(q.sha256,I),await E(H,W,[I]))},[w,T,E]),z=C.useCallback(async(H,{interactive:q=!0}={})=>{const $=H??o.current.font,W=Ji($);if(!$||!W)return;const le=o.current,oe=Ji(le.font)===W;if(oe&&(le.status==="loading"||le.glyphs.status==="loading"))return;const I=h.current,{isInstalled:k,isRegistered:Y,readCached:Q,writeCached:ae,register:Z}=T();cg(A(),W,"accepted");const ge=ag($),be=ug($),ye=!!(ge&&!Y(ge)&&!k($.family)),Me=oe?le.glyphs:{...Lb,source:be},de=!!(be&&!["installed","ready","none"].includes(Me.status));let xe=ye?sg($):0,se=0;const ve=()=>{I===h.current&&r(ie=>({...ie,receivedBytes:se,totalBytes:xe}))};if(r(ie=>({...ie,font:$,interactive:q,receivedBytes:0,totalBytes:xe,error:null,status:ye?"loading":ie.status,glyphs:de?{...Me,status:"loading"}:Me})),ye&&ge)try{const ie=[];for(const we of $.faces){let Ee=await Q(we.sha256);if(Ee?(se+=we.bytes,ve()):(Ee=await Nb(we,x,He=>{se+=He,ve()}),await ae(we.sha256,Ee)),I!==h.current)return;ie.push({face:we,data:Ee})}if(await Z(ge,ie),I!==h.current)return;r(we=>({...we,status:"loaded",alias:ge}))}catch(ie){if(I!==h.current)return;const we=ie instanceof Error&&ie.message?ie.message:"host_font_failed";r(Ee=>({...Ee,status:"failed",alias:null,error:we}))}if(de&&be){let ie=0;try{await _(I,be,(we,Ee)=>{Ee&&!ie&&(ie=Ee,xe+=Ee),se+=we,ve()}),N(I,{status:"ready"})}catch(we){if(I!==h.current)return;const Ee=we instanceof Error&&we.message?we.message:"host_font_failed";r(He=>({...He,error:He.error??Ee,glyphs:{...He.glyphs,status:"failed"}}))}}},[x,_,T,A,N]),O=C.useCallback(async H=>{const q=Ji(H)!==Ji(o.current.font);q&&(M("superseded"),m.current=new Set,g.current=new Set,y.current=new Set);const $=++h.current;if(!H){r($u);return}const{isInstalled:W,readCached:le,register:oe,isRegistered:I,readSubsets:k}=T(),Y=ag(H),Q=Ji(H),ae=ug(H);let Z="checking";Y&&I(Y)?Z="loaded":W(H.family)?Z="installed":Y||(Z="unavailable");let ge="checking";if(ae?(ae.scope==="cjk"?W(ae.family):Z==="installed")&&(ge="installed"):ge="none",r(de=>({...$u,font:H,status:Z==="checking"?"checking":Z,alias:Z==="loaded"?Y:null,totalBytes:sg(H),glyphs:{source:ae,status:ge,alias:q?null:de.glyphs.alias,covered:m.current.size},glyphRevision:de.glyphRevision})),Z==="checking"&&Y){const de=await Promise.all(H.faces.map(xe=>le(xe.sha256)));if($!==h.current)return;if(Z="needs",de.every(Boolean))try{if(await oe(Y,H.faces.map((xe,se)=>({face:xe,data:de[se]}))),$!==h.current)return;Z="loaded",r(xe=>({...xe,status:"loaded",alias:Y}))}catch{}}if(ge==="checking"&&ae){const de=await k(ae.sha256);if($!==h.current)return;if(de.length)try{await E($,Pu(ae),de),ge="cached"}catch{ge="needs"}else ge="needs";if($!==h.current)return}const be=og(A(),Q),ye=be==="accepted"||ge==="cached"||Date.now()<p.current;if(ge==="cached"&&(ge="ready",N($,{status:"ready"}),_($,ae,()=>{}).catch(()=>{})),Z!=="needs"&&ge!=="needs")return;if(ye){z(H,{interactive:!1});return}const Me=be==="declined"?"declined":"available";r(de=>({...de,status:Z==="needs"?Me:de.status,glyphs:ge==="needs"?{...de.glyphs,status:Me}:de.glyphs}))},[z,M,A,N,_,T,E]),D=C.useCallback(()=>{const H=Ji(o.current.font);H&&cg(A(),H,"declined"),r(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}))},[A]),R=C.useCallback(()=>{p.current=Date.now()+Cw,l==null||l.sendHostFontRefresh();const H=o.current,q=["available","declined","failed"];H.font&&(q.includes(H.status)||q.includes(H.glyphs.status))&&z(H.font,{interactive:!1})},[l,z]),B=C.useCallback(H=>{const{glyphs:q}=o.current;if(q.status!=="ready"||!q.source)return;const $=q.source;for(const W of H){const le=W.codePointAt(0);le<128&&$.scope!=="all"||Eb($.scope,le)&&(m.current.has(le)||g.current.has(le)||y.current.add(le))}!y.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const W=h.current,le=[...y.current].slice(0,Mw);for(const oe of le)y.current.delete(oe),g.current.add(oe);(async()=>{const oe=await w($,le,()=>{});W===h.current&&(await T().writeSubset($.sha256,oe),await E(W,Pu($),[oe]))})().catch(()=>{})},Tw))},[w,T,E]);return C.useEffect(()=>{if(!l)return;const H=l.on("terminalFont",q=>{O(q)});return()=>{H(),v.current&&clearTimeout(v.current),v.current=null}},[l,O]),C.useEffect(()=>{const H=q=>{if(q.key!==bt.hostFontConsent)return;const $=o.current,W=Ji($.font),le=$.status==="available"||$.glyphs.status==="available";if(!W||!le)return;const oe=og(A(),W);oe==="accepted"?z($.font,{interactive:!1}):oe==="declined"&&D()};return window.addEventListener("storage",H),()=>window.removeEventListener("storage",H)},[z,D,A]),{hostFont:a,loadHostFont:z,declineHostFont:D,syncHostFont:R,ensureHostGlyphs:B}}function Ew(l,n=window,a=document){const r=g=>{var y;((y=n.navigator)==null?void 0:y.onLine)!==!1&&l.wake(g)},o=()=>{a.visibilityState==="visible"&&r("visible")},c=()=>r("pageshow"),h=()=>r("online"),p=()=>r("focus"),m=()=>r("resume");return a.addEventListener("visibilitychange",o),a.addEventListener("resume",m),n.addEventListener("pageshow",c),n.addEventListener("online",h),n.addEventListener("focus",p),()=>{a.removeEventListener("visibilitychange",o),a.removeEventListener("resume",m),n.removeEventListener("pageshow",c),n.removeEventListener("online",h),n.removeEventListener("focus",p)}}function Nw(l,n){const a=l.profiles.find(o=>o.id===n),r=(a==null?void 0:a.id)??l.activeProfileId;return{activeProfileId:r,activeProfile:l.profiles.find(o=>o.id===r)}}function Br(l,n){const a=l.profiles.find(r=>r.id===n);return{wsUrl:(a==null?void 0:a.wsUrl)??l.wsUrl,token:((a==null?void 0:a.token)??l.token)||void 0,pairCode:((a==null?void 0:a.pairCode)??l.pairCode)||void 0,adminTerminal:typeof window<"u"&&new URLSearchParams(window.location.search).get("adminTerminal")==="1",clientId:l.clientId,autoReconnect:(a==null?void 0:a.autoReconnect)??l.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}function fg(l,n){return n||(l==="win32"?"powershell":"posix")}function kw(l,n){if(n!=="win32")return n?"posix":null;for(const a of l.slice(-8).reverse()){if(/\b(?:MINGW32|MINGW64|MSYS)\b/i.test(a))return"git-bash";if(/^\s*PS\s+[a-z]:\\[^>]*>/i.test(a))return"powershell";if(/^\s*(?:[a-z]:\\[^>]*|\\\\[^\\]+\\[^>]+)>/i.test(a))return"cmd"}return null}function Lw(l){return l==="cmd"?["dir","cls","git status","cd","tasklist","exit","type"]:l==="powershell"?["Get-ChildItem","Clear-Host","git status","Get-Location","Get-Process","exit","Get-Content"]:["ls -la","clear","git status","pwd","top","exit","cat"]}const Rw={connectionState:"disconnected",role:"viewer",shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},hg={role:"viewer",controllerId:void 0,hostname:void 0,platform:void 0,adminTerminalSupported:void 0,shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1};function _w(l,n){switch(n.type){case"stateChange":return{...l,connectionState:n.state,stateCode:n.code,stateDetail:n.detail,agentStatus:n.state==="connected"?l.agentStatus:null};case"ready":{const{message:a}=n;return{...l,terminalResetVersion:l.terminalResetVersion+(n.resetTerminal?1:0),role:a.role,controllerId:a.controllerId,hostId:a.hostId,hostname:a.hostname,platform:a.platform,adminTerminalSupported:a.adminTerminalSupported,shellProfile:fg(a.platform,a.shellProfile),assignedClientId:a.clientId||l.assignedClientId,hostPalette:a.terminalPalette||null}}case"hostReconnecting":return{...l,...hg,stateCode:n.code,stateDetail:n.detail};case"sessionRestarted":return{...l,hostname:n.hostname,platform:n.platform,adminTerminalSupported:n.adminTerminalSupported,shellProfile:fg(n.platform,n.shellProfile),hostPalette:n.palette||null,terminalResetVersion:l.terminalResetVersion+1};case"roleChange":return{...l,role:n.role,controllerId:n.controllerId,hostId:n.hostId||l.hostId,assignedClientId:n.assignedClientId||l.assignedClientId};case"controlGranted":return{...l,role:"controller"};case"paired":return{...l,lastPairedAt:n.at};case"rtt":return{...l,rttMs:n.rttMs};case"peerCount":return{...l,sharedWindowCount:Math.max(1,n.count)};case"sessionReady":return{...l,connectionState:"connected"};case"agentStatus":return{...l,agentStatus:n.status};case"shellProfile":return l.shellProfile===n.profile?l:{...l,shellProfile:n.profile};case"reset":return{...l,...hg,hostId:void 0,platform:void 0,assignedClientId:void 0,terminalResetVersion:l.terminalResetVersion+(n.resetTerminal?1:0)}}}const jw=3e4;function Ow(l,n){const[a,r]=C.useState(null),o=C.useRef(null),c=C.useRef(null),h=C.useCallback(y=>{(y==null?void 0:y.phase)!=="starting"&&c.current&&(clearTimeout(c.current),c.current=null),o.current=y,r(y)},[]),p=C.useCallback(()=>{const y=l.current;y&&(h({phase:"starting"}),y.sendHerdrStart(),c.current=setTimeout(()=>{var v;c.current=null,((v=o.current)==null?void 0:v.phase)==="starting"&&h({phase:"failed",message:n.current("herdrLaunch.timeout")})},jw))},[l,n,h]),m=C.useCallback(y=>{var v;return y.code==="herdr_not_running"?(((v=o.current)==null?void 0:v.phase)!=="starting"&&h({phase:"stopped"}),!0):y.code==="herdr_start_failed"&&o.current?(h({phase:"failed",message:y.message||""}),!0):!1},[h]),g=C.useCallback(()=>h(null),[h]);return C.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{herdrLaunch:a,startHerdr:p,handleLaunchError:m,forgetHerdrLaunch:g}}class Dw{constructor(){X(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,a){return this.listeners[n].add(a),()=>{this.listeners[n].delete(a)}}emit(n,...a){this.listeners[n].forEach(o=>{try{o(...a)}catch(c){console.error(`Error in event listener for ${n}:`,c)}})}}const Rb=27,_b=91,zw=60,mg=59,jb=77,Ob=48,Hw=57,Bw=64,Uw=-30,qu=32,pg=255;function Db(l){return Number.isInteger(l)&&(l&Uw)===Bw}function Kw(l){return l>=Ob&&l<=Hw}function Vu(l,n){let a=n,r=0;for(;a<l.length&&Kw(l[a]);){if(r=r*10+(l[a]-Ob),r>65535)return null;a+=1}return a===n?null:{value:r,next:a}}function Iw(l,n){if(l[n]!==Rb||l[n+1]!==_b||l[n+2]!==zw)return-1;const a=Vu(l,n+3);if(!a||!Db(a.value)||l[a.next]!==mg)return-1;const r=Vu(l,a.next+1);if(!r||l[r.next]!==mg)return-1;const o=Vu(l,r.next+1);return!o||l[o.next]!==jb?-1:o.next+1}function Fw(l,n){if(l[n]!==Rb||l[n+1]!==_b||l[n+2]!==jb||n+6>l.length)return-1;const a=l[n+3]-qu,r=l[n+4],o=l[n+5];return!Db(a)||r<qu||r>pg||o<qu||o>pg?-1:n+6}function so(l){if(!l)return!1;const n=l instanceof Uint8Array?l:new Uint8Array(l);if(n.length===0)return!1;let a=0;for(;a<n.length;){const r=Iw(n,a);if(r>a){a=r;continue}const o=Fw(n,a);if(o>a){a=o;continue}return!1}return!0}class Gw{constructor(n){X(this,"segments",[]);X(this,"flushScheduled",!1);this.getSocket=n}push(n){const a=n instanceof Uint8Array?n:new Uint8Array(n);a.length!==0&&(this.segments.push(a),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 a=this.getSocket();if(a&&(a.bufferedAmount??0)>256*1024&&(n=n.filter(o=>!so(o))),n.length===0)return;let r;if(n.length===1)r=n[0];else{let o=0;for(let h=0;h<n.length;h++)o+=n[h].byteLength;r=new Uint8Array(o);let c=0;for(let h=0;h<n.length;h++)r.set(n[h],c),c+=n[h].byteLength}a&&a.readyState===WebSocket.OPEN&&a.send(r)}clear(){this.segments=[],this.flushScheduled=!1}}const Yw=3e3,Pw=1e4,$w=1500;class qw extends Dw{constructor(a){super();X(this,"ws",null);X(this,"config");X(this,"state","disconnected");X(this,"reconnectAttempts",0);X(this,"reconnectTimer",null);X(this,"pingTimer",null);X(this,"pingTimestamp",null);X(this,"lastInboundAt",0);X(this,"pingSentAt",null);X(this,"connectStartedAt",0);X(this,"lastWakeConnectAt",0);X(this,"probeTimer",null);X(this,"rejectedByRelay",!1);X(this,"isManuallyClosed",!1);X(this,"authFailureDetail",null);X(this,"authFailureCode",null);X(this,"temporaryFailureCode",null);X(this,"input",new Gw(()=>this.ws));X(this,"terminalCols",80);X(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}getConfig(){return{...this.config}}getState(){return this.state}setState(a,r,o){this.state!==a&&(this.state=a,this.emit("stateChange",a,r,o))}connect(a){if(a&&(this.terminalCols=a.cols,this.terminalRows=a.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 r=Vw(this.config.wsUrl),o=new WebSocket(r);this.ws=o,this.connectStartedAt=Date.now(),o.binaryType="arraybuffer",o.onopen=()=>{this.isStaleSocket(o)||this.handleOpen()},o.onmessage=c=>{this.isStaleSocket(o)||this.handleMessage(c)},o.onerror=c=>{this.isStaleSocket(o)||this.handleError(c)},o.onclose=c=>{this.isStaleSocket(o)||this.handleClose(c)}}catch(r){this.setState("error",r instanceof Error?r.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,r="Client closed the connection"){this.input.clear();const o=this.ws;if(o){this.ws=null,o.onopen=null,o.onmessage=null,o.onerror=null,o.onclose=null;try{(o.readyState===WebSocket.OPEN||o.readyState===WebSocket.CONNECTING)&&o.close(a,r)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.input.clear(),this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(a){this.updateConfig(a),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(a){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const r=Date.now(),o=this.ws;if(!o){if(r-this.lastWakeConnectAt<$w)return;this.lastWakeConnectAt=r,this.reconnectAttempts=0,this.connect();return}if(o.readyState===WebSocket.CONNECTING){r-this.connectStartedAt>Pw&&this.dropStaleSocket("connection_stalled");return}o.readyState===WebSocket.OPEN&&r-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const a=this.ws;if(!a||a.readyState!==WebSocket.OPEN||this.probeTimer)return;const r=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===a&&this.lastInboundAt<r&&this.dropStaleSocket("connection_stale")},Yw)}dropStaleSocket(a){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",a),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(a){if(this.lastInboundAt=Date.now(),typeof a.data=="string")try{const r=JSON.parse(a.data);r.type==="pong"?this.handlePong():this.handleServerMessage(r)}catch(r){console.warn("Received unparseable text frame from server:",r)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const r=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(r))}catch(r){console.error("Failed to convert Blob to ArrayBuffer:",r)}}handlePong(){if(this.pingTimestamp){const a=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(a))}}handleError(a){console.error("WebSocket error:",a),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(a){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(a.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",a.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(a.code===1008){this.rejectedByRelay=!0,this.setState("error",a.reason||"The relay rejected the connection",String(a.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${a.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${a.reason||a.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 a=this.config.reconnectIntervalMs||2e3,o=Math.min(3e4,Math.floor(a*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},o)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const a=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>=a){this.probeLiveness();return}this.sendPing()}},a)}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 a={type:"ping"};this.sendJson(a)}sendJson(a){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(a))}sendInput(a){this.input.push(a)}flushInput(){this.input.flush()}sendBinary(a){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(a)}sendText(a){const r=kd(a);this.sendInput(r)}}function Vw(l){if(/^wss?:\/\//i.test(l))return l;if(/^https?:\/\//i.test(l)){const n=new URL(l);return n.protocol=n.protocol==="https:"?"wss:":"ws:",(!n.pathname||n.pathname==="/")&&(n.pathname=cn),n.toString()}if(typeof window<"u"&&window.location){const a=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,o=l.startsWith("/")?l:`/${l}`;return`${a}//${r}${o}`}return"ws://127.0.0.1:8787/ws/client"}class Xw extends qw{constructor(){super(...arguments);X(this,"currentRole","viewer");X(this,"controllerId");X(this,"hostId");X(this,"assignedClientId")}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}handleServerMessage(a){switch(a.type){case"ready":{if(this.rejectUnsupportedAdminTerminal(a.adminTerminalSupported))break;this.reconnectAttempts=0,this.setState("connected"),this.currentRole=a.role,this.controllerId=a.controllerId,this.hostId=a.hostId,this.assignedClientId=a.clientId,this.emit("ready",a),this.emit("roleChange",a.role,a.controllerId,a.hostId,a.clientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount),this.emit("terminalFont",a.terminalFont??null);break}case"paired":{this.emit("paired",{token:a.token,deviceId:a.deviceId,hostId:a.hostId,expiresAt:a.expiresAt});break}case"control_state":{this.currentRole=a.role,this.controllerId=a.controllerId,this.emit("controlState",a.role,a.controllerId),this.emit("roleChange",a.role,a.controllerId,this.hostId,this.assignedClientId),typeof a.clientCount=="number"&&this.emit("peerCount",a.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",a.code||"host_reconnecting"),this.emit("hostReconnecting",a.code);break}case"session_restarted":{if(this.rejectUnsupportedAdminTerminal(a.adminTerminalSupported))break;this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",a.cols,a.rows,a.terminalPalette,a.hostname,a.platform,a.shellProfile,a.adminTerminalSupported),this.emit("terminalFont",a.terminalFont??null);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",a);break}case"exit":{this.emit("exit",a.code,a.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":{a.code==="host_offline"||a.code==="host_reconnecting"||a.code==="host_reconnect_timeout"||a.code==="rate_limited"?(this.temporaryFailureCode=String(a.code),this.setState("reconnecting",a.message,String(a.code))):(a.code==="auth_required"||a.code==="unauthorized"||a.code==="device_revoked"||a.code==="invalid_handshake"||a.code==="too_many_hosts"||a.code===401||a.code===403)&&(this.authFailureDetail=a.message,this.authFailureCode=String(a.code),this.setState("error",a.message,this.authFailureCode)),this.emit("error",{code:a.code,message:a.message});break}case"paste_file_ready":{this.emit("pasteFileReady",a.path);break}case"agent_status":{this.emit("agentStatus",a);break}case"update_status":{this.emit("updateStatus",a);break}case"terminal_font":{this.emit("terminalFont",a.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",a);break}case"host_font_subset_ready":{this.emit("hostFontSubset",a);break}}}rejectUnsupportedAdminTerminal(a){return!this.config.adminTerminal||a===!0?!1:(this.emit("error",{code:"admin_terminal_unsupported",message:"Upgrade the relay and Windows host connector before opening an administrator terminal."}),this.disconnect(),!0)}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"],...this.config.adminTerminal?{adminTerminal:!0}:{}};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const r={type:"claim_control",...a?{force:!0}:{}};this.sendJson(r)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,r){this.terminalCols=a,this.terminalRows=r;const o={type:"resize",cols:a,rows:r};this.sendJson(o)}sendPasteFile(a,r){this.sendJson({type:"paste_file",mime:a,dataBase64:r})}sendHostFontChunkRequest(a,r){this.sendJson({type:"host_font_chunk_request",sha256:a,index:r})}sendHostFontSubsetRequest(a,r,o){this.sendJson({type:"host_font_subset_request",sha256:a,text:r,requestId:o})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}}function Zw(l,n,a){const r=C.useRef(a);if(r.current=a,!l.current){const o=new Xw(n());for(const c of Object.keys(a)){const h=(...p)=>{var m,g;return(g=(m=r.current)[c])==null?void 0:g.call(m,...p)};o.on(c,h)}l.current=o}return l.current}const Qw=3*1024*1024,zb=1568,Ww=[.85,.7,.55,.4],Ur={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Jw(l,n,a=zb){if(l<=0||n<=0)return{width:Math.max(1,l),height:Math.max(1,n)};const r=Math.max(l,n);if(r<=a)return{width:l,height:n};const o=a/r;return{width:Math.max(1,Math.round(l*o)),height:Math.max(1,Math.round(n*o))}}function e1(l){if(typeof l!="string"||l.length===0)return 0;const n=l.length;let a=0;l.endsWith("==")?a=2:l.endsWith("=")&&(a=1);const r=Math.floor(n*3/4)-a;return Number.isFinite(r)&&r>0?r:0}function t1(l){return l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`}async function n1(l){if(typeof createImageBitmap=="function")try{const n=await createImageBitmap(l,{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(l);return{source:n,width:n.width,height:n.height,cleanup:()=>{typeof n.close=="function"&&n.close()}}}catch{}}return new Promise((n,a)=>{if(typeof Image>"u")return a(new Error("Image decoding not supported in this environment"));const r=new Image,o=URL.createObjectURL(l);r.onload=()=>{n({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,cleanup:()=>{try{URL.revokeObjectURL(o)}catch{}}})},r.onerror=()=>{try{URL.revokeObjectURL(o)}catch{}a(new Error("Failed to decode image source"))},r.src=o})}async function Hb(l,n=zb,a=Qw){var o;if(!l||l.size===0||l.type&&!l.type.startsWith("image/"))return null;let r;try{r=await n1(l)}catch(c){return console.warn("Failed to decode image for paste:",c),null}try{const{width:c,height:h}=Jw(r.width,r.height,n),p=document.createElement("canvas");p.width=c,p.height=h;const m=p.getContext("2d");if(!m)return null;m.drawImage(r.source,0,0,c,h);let g="image/webp";try{p.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const y of Ww){let v;try{v=p.toDataURL(g,y)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const x=v.indexOf(","),w=x!==-1?v.slice(x+1):"",M=e1(w);if(M<=a)return{mime:g,dataBase64:w,dataUrl:v,byteLength:M,width:c,height:h}}return null}finally{(o=r.cleanup)==null||o.call(r)}}const i1=3e4,l1=1200;function a1({adapterRef:l,role:n,connectionState:a,warnViewerMode:r,addToast:o,t:c,sendPasteFile:h}){const[p,m]=C.useState(Ur),g=C.useRef(null),y=C.useRef(0),v=C.useRef(null),x=C.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),w=C.useCallback(()=>{x(),g.current=null,m(Ur)},[x]),M=C.useCallback(()=>{g.current!==null&&w()},[w]),T=C.useCallback(()=>{const N=g.current;N!==null&&(x(),m({active:!0,phase:"completed",ratio:1,percent:100,statusText:c("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{g.current===N&&(g.current=null,m(Ur))},l1))},[x,c]);C.useEffect(()=>{a!=="connected"&&M()},[a,M]),C.useEffect(()=>x,[x]);const A=C.useCallback(async N=>{if(n!=="controller")return r(),!1;if(!l.current||a!=="connected")return o("error",c("serverErrors.host_offline")),!1;if(g.current!==null)return!1;const E=++y.current;g.current=E,x();const _=O=>(O&&o("error",O),g.current=null,m(Ur),!1),z="dataBase64"in N&&typeof N.dataBase64=="string";try{let O;if(z)O=N;else{const R=N;if(m({active:!0,phase:"reading",ratio:.1,percent:10,statusText:c("virtualKeyboard.uploadProgressReading")}),!R||R.size===0)return _(c("clipboard.fileEmpty"));if(R.type&&!R.type.startsWith("image/"))return _(c("clipboard.unsupportedType"));m({active:!0,phase:"processing",ratio:.35,percent:35,statusText:c("virtualKeyboard.uploadProgressProcessing")});const B=await Hb(R);if(g.current!==E)return!1;if(!B)return _(c("clipboard.imageTooLarge"));O=B,m({active:!0,phase:"processing",ratio:.6,percent:60,statusText:c("virtualKeyboard.uploadProgressProcessing")})}m({active:!0,phase:"sending",ratio:.75,percent:75,statusText:c("virtualKeyboard.uploadProgressSending")});const D=h(O.mime,O.dataBase64);return g.current!==E?!1:D?(m({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:c("virtualKeyboard.uploadProgressWaitingHost")}),v.current=setTimeout(()=>{g.current===E&&_(c("serverErrors.paste_file_write_failed"))},i1),!0):_()}catch(O){return console.error("Failed to process/upload image:",O),g.current===E&&_(c("clipboard.imageTooLarge")),!1}},[l,n,a,r,o,c,h,x]);return{uploadProgress:p,uploadImage:A,resetUploadProgress:w,abortUpload:M,completeUpload:T}}const s1=4096,r1=8*1024*1024;function o1(){const l=C.useRef(null),n=C.useRef([]),a=C.useRef(0),r=C.useCallback(m=>{for(n.current.push(m),a.current+=m.byteLength;n.current.length>s1||a.current>r1;){const g=n.current.shift();if(!g)break;a.current-=g.byteLength}},[]),o=C.useCallback(m=>{const g=l.current;if(g)try{g(m);return}catch(y){console.debug("Terminal output sink threw, buffering chunk instead:",y)}r(m)},[r]),c=C.useCallback(m=>{l.current=m;const g=n.current;n.current=[],a.current=0;for(let y=0;y<g.length;y++)try{m(g[y])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let x=y;x<g.length;x++)r(g[x]);break}return()=>{l.current===m&&(l.current=null)}},[r]),h=C.useCallback(()=>n.current.length,[]),p=C.useCallback(()=>{n.current=[],a.current=0},[]);return{receiveOutput:o,subscribeToOutput:c,getPendingOutputChunkCount:h,clearPendingOutput:p}}const Bb=64,ms=4096;function Rd(){const l=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${l}`}function c1(l,n){return(typeof l=="string"?l.trim().slice(0,Bb):"")||n}function ro(l,n){if(!l||typeof l!="object"||Array.isArray(l))return null;const a=l,r=typeof a.wsUrl=="string"?a.wsUrl.trim().slice(0,2048):"",o=typeof a.token=="string"?a.token.slice(0,ms):"",c=typeof a.pairCode=="string"?a.pairCode.trim().toUpperCase().slice(0,32):"";if(!r||!r.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(r)||!o&&!c)return null;const h=Date.now(),p=typeof a.id=="string"&&a.id.length>0?a.id.slice(0,128):Rd(),m=typeof a.hostname=="string"&&a.hostname.trim()?a.hostname.trim().slice(0,Bb):`Herdr ${n+1}`;return{id:p,displayName:c1(a.displayName,m),wsUrl:r,token:o,...c?{pairCode:c}:{},...typeof a.hostId=="string"&&a.hostId.trim()?{hostId:a.hostId.trim().slice(0,128)}:{},...typeof a.hostname=="string"&&a.hostname.trim()?{hostname:a.hostname.trim().slice(0,128)}:{},...typeof a.deviceId=="string"&&a.deviceId.trim()?{deviceId:a.deviceId.trim().slice(0,128)}:{},autoReconnect:a.autoReconnect!==!1,createdAt:Number.isFinite(a.createdAt)?Number(a.createdAt):h,lastUsedAt:Number.isFinite(a.lastUsedAt)?Number(a.lastUsedAt):h}}function gg(l,n=0){const a=ro({...l,id:l.id||Rd()},n);if(!a)throw new Error("a connection profile requires a relay URL and token or pairing code");return a}function bg(l){let n=l.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const a=new URL(l.wsUrl,window.location.origin);a.protocol=a.protocol==="wss:"?"https:":"http:",a.pathname=a.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",a.search="",a.hash="",n=a.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${n}::${l.hostId||""}`}function Ub(l){var c;const n=[];if((Array.isArray(l.profiles)?l.profiles.slice(0,64):[]).forEach((h,p)=>{const m=ro(h,p);m&&!n.some(g=>g.id===m.id)&&n.push(m)}),n.length===0&&(typeof l.token=="string"&&l.token||typeof l.pairCode=="string"&&l.pairCode)){const h=ro({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof l.wsUrl=="string"&&l.wsUrl.trim()?l.wsUrl:cn,token:l.token||"",pairCode:l.pairCode||"",autoReconnect:l.autoReconnect!==!1},0);h&&n.push(h)}const r=typeof l.activeProfileId=="string"?l.activeProfileId:"",o=n.some(h=>h.id===r)?r:((c=n[0])==null?void 0:c.id)||"";return{profiles:n,activeProfileId:o}}const Kb=[{id:"esc",label:"ESC",code:re.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:re.TAB,type:"key",enabled:!0,title:"Tab"},{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"left",label:"←",code:re.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:re.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:re.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:re.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"enter",label:"Enter",code:re.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],u1=[{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"shift",label:"SHIFT",code:"",type:"modifier",enabled:!0,modifierType:"shift",title:"Toggle Shift modifier latch"},{id:"meta",label:"META",code:"\x1B",type:"modifier",enabled:!0,modifierType:"meta",title:"Meta / Cmd key"},{id:"esc",label:"ESC",code:re.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:re.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:re.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:re.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:re.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:re.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:re.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:re.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:re.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:re.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:re.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:re.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:re.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:re.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:re.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:re.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:re.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:re.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:re.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:re.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:re.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:re.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:re.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:re.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:re.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:re.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:re.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:re.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:re.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:re.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:re.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:re.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:re.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:re.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:re.F12,type:"fn",enabled:!0,title:"F12"},{id:"drawer_chords",label:"^C",code:"",type:"drawer",enabled:!0,drawerType:"chords",title:"Quick Ctrl Chords"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"sym_pipe",label:"|",code:"|",type:"symbol",enabled:!0,isPlainChar:!0,title:"Pipe (|)"},{id:"sym_tilde",label:"~",code:"~",type:"symbol",enabled:!0,isPlainChar:!0,title:"Tilde (~)"},{id:"sym_slash",label:"/",code:"/",type:"symbol",enabled:!0,isPlainChar:!0,title:"Slash (/)"},{id:"sym_backslash",label:"\\",code:"\\",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backslash (\\)"},{id:"sym_dash",label:"-",code:"-",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dash (-)"},{id:"sym_underscore",label:"_",code:"_",type:"symbol",enabled:!0,isPlainChar:!0,title:"Underscore (_)"},{id:"sym_dollar",label:"$",code:"$",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dollar ($)"},{id:"sym_ampersand",label:"&",code:"&",type:"symbol",enabled:!0,isPlainChar:!0,title:"Ampersand (&)"},{id:"sym_quote",label:'"',code:'"',type:"symbol",enabled:!0,isPlainChar:!0,title:'Double Quote (")'},{id:"sym_backtick",label:"`",code:"`",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backtick (`)"}];function ps(){return JSON.parse(JSON.stringify(Kb))}const d1=[["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 f1(l){return d1.some(n=>l.length===n.length&&l.every((a,r)=>a.id===n[r]&&a.enabled!==!1))}function h1(l){if(!Array.isArray(l)||l.length===0)return ps();const n=l.filter(a=>typeof a=="object"&&a!==null&&typeof a.id=="string"&&typeof a.label=="string"&&typeof a.code=="string");return f1(n)?ps():n.filter(a=>a.id!=="drawer_agent")}function hd(l,n){if(n){const a=`keyTitles.${l.id}`,r=n(a);if(r&&r!==a)return r}return l.title||l.label}const yg="herdr-remote.ignoredUpdate";function m1(){const l=Li("local",bt.ignoredUpdate);if(l!==null)return l;const n=Li("local",yg);if(n===null)return null;Ib(n);try{window.localStorage.removeItem(yg)}catch{}return n}function Ib(l){Mn("local",bt.ignoredUpdate,l)}function p1(){return`client-${Math.random().toString(36).substring(2,8)}`}function Fb(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Gb(){const l=typeof window<"u"&&window.innerWidth<640;return{wsUrl:cn,token:"",pairCode:"",clientId:p1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:l?lo:hs,fontSizeFollowsHost:!0,fontFamily:Tb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Fb(),virtualKeys:ps(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const g1=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],b1=["wsUrl","token","pairCode","autoReconnect"],_d=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],y1=_d.filter(l=>l!=="adminToken"&&l!=="adminTokens"),vg=["theme","colorMode"];function md(l){const n=l;if(!vg.some(o=>n[o]!==void 0))return{data:l,changed:!1};const r={...n};for(const o of vg)delete r[o];return{data:r,changed:!0}}function Yb(l){if(!l||typeof l!="object"||Array.isArray(l))return{};const n={};for(const[a,r]of Object.entries(l).slice(0,32))typeof r!="string"||r.length===0||(n[a.slice(0,512)]=r.slice(0,ms));return n}function jd(){const l=Gb();if(typeof window>"u")return l;let n={};const a=Li("local",bt.settings);if(a)try{n=JSON.parse(a)}catch(W){console.warn("Failed to parse localStorage settings:",W)}const r=md(n);r.changed&&(n=r.data,Mn("local",bt.settings,JSON.stringify(n)));let o=null;const c=Li("session",bt.sessionView);if(c)try{o=JSON.parse(c)}catch(W){console.warn("Failed to parse sessionStorage settings:",W)}if(!o){const W={};for(const le of _d)n[le]!==void 0&&(W[le]=n[le]);o=W,Mn("session",bt.sessionView,JSON.stringify(o))}const h=Fu(o.fontFamily??n.fontFamily??l.fontFamily),p=window.innerWidth<640?lo:hs,m=o.fontSize??n.fontSize??l.fontSize,g=ta(m,p),y=o.fontSizeFollowsHost??n.fontSizeFollowsHost,v=typeof y=="boolean"?y:m===void 0||g===hs||g===lo,x=o.virtualKeys??n.virtualKeys??l.virtualKeys,w=h1(x),M=n.language??l.language,T=M==="zh"||M==="en"?M:Fb(),A=Ub(n),N=A.profiles.find(W=>W.id===A.activeProfileId),E=md(o);E.changed&&(o=E.data,Mn("session",bt.sessionView,JSON.stringify(o)));const _=o.toolbarVisible??n.toolbarVisible??l.toolbarVisible,z=o.toolbarPosition??n.toolbarPosition??l.toolbarPosition,O=o.vibrateOnKeyPress??n.vibrateOnKeyPress??l.vibrateOnKeyPress,D=W=>{const le=o[W]??n[W];return typeof le=="boolean"?le:l[W]},R=(o==null?void 0:o.predictiveEcho)??(n==null?void 0:n.predictiveEcho)??l.predictiveEcho,B=R==="always"||R==="off"||R==="auto"?R:"auto",H=typeof o.adminToken=="string"?o.adminToken.slice(0,ms):typeof n.adminToken=="string"?n.adminToken.slice(0,ms):l.adminToken,q=Yb(o.adminTokens),$={...l,...n,...o,wsUrl:(N==null?void 0:N.wsUrl)||(typeof n.wsUrl=="string"?n.wsUrl:l.wsUrl),token:(N==null?void 0:N.token)||"",pairCode:(N==null?void 0:N.pairCode)||"",autoReconnect:(N==null?void 0:N.autoReconnect)??l.autoReconnect,profiles:A.profiles,activeProfileId:A.activeProfileId,clientId:typeof n.clientId=="string"&&n.clientId.trim()?n.clientId.trim().slice(0,128):l.clientId,fontFamily:h,fontSize:g,fontSizeFollowsHost:v,toolbarVisible:_,toolbarPosition:z,vibrateOnKeyPress:O,predictiveEcho:B,virtualKeys:w,agentKeymaps:Cb(n.agentKeymaps),agentAlertBadge:D("agentAlertBadge"),agentAlertSound:D("agentAlertSound"),agentAlertVibrate:D("agentAlertVibrate"),agentAlertNotify:D("agentAlertNotify"),language:T,adminToken:H,adminTokens:q};return typeof n.fontFamily=="string"&&Fu(n.fontFamily)!==n.fontFamily&&(n.fontFamily=Fu(n.fontFamily),Mn("local",bt.settings,JSON.stringify(n))),$}function Ti(l){var x;const a={...jd(),...l};a.agentKeymaps=Cb(a.agentKeymaps),a.adminTokens=Yb(a.adminTokens),typeof a.adminToken=="string"&&(a.adminToken=a.adminToken.slice(0,ms)),l.fontSize!==void 0&&(a.fontSize=ta(l.fontSize)),l.predictiveEcho!==void 0&&(l.predictiveEcho==="auto"||l.predictiveEcho==="always"||l.predictiveEcho==="off"?a.predictiveEcho=l.predictiveEcho:a.predictiveEcho="auto");const r=Ub(a);let o=r.profiles,c=r.activeProfileId;if(b1.some(w=>l[w]!==void 0)){const w=o.findIndex(A=>A.id===c),M=w>=0?{...o[w]}:{id:Rd(),displayName:`Herdr ${o.length+1}`,wsUrl:a.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};M.wsUrl=a.wsUrl,M.token=a.token,M.pairCode=a.pairCode||void 0,M.autoReconnect=a.autoReconnect,M.lastUsedAt=Date.now();const T=ro(M,Math.max(w,0));T?w>=0?o[w]=T:(o.push(T),c=T.id):w>=0&&(o=o.filter(A=>A.id!==c),c=((x=o[0])==null?void 0:x.id)||"")}o.length>0&&!o.some(w=>w.id===c)&&(c=o[0].id);const p=o.find(w=>w.id===c);a.profiles=o,a.activeProfileId=c,a.wsUrl=(p==null?void 0:p.wsUrl)||a.wsUrl||cn,a.token=(p==null?void 0:p.token)||"",a.pairCode=(p==null?void 0:p.pairCode)||"",a.autoReconnect=(p==null?void 0:p.autoReconnect)??a.autoReconnect;const m=Li("local",bt.settings);let g={};if(m)try{g=JSON.parse(m)}catch{}g=md(g).data;for(const w of g1)a[w]!==void 0&&(g[w]=a[w]);g.profiles=o,g.activeProfileId=c,Mn("local",bt.settings,JSON.stringify(g));const y=Li("session",bt.sessionView);let v={};if(y)try{v=JSON.parse(y)}catch{}for(const w of _d)a[w]!==void 0&&(v[w]=a[w]);Mn("session",bt.sessionView,JSON.stringify(v));for(const w of y1)a[w]!==void 0&&(g[w]=a[w]);return Mn("local",bt.settings,JSON.stringify(g)),a}function v1(l,n){const[a,r]=C.useState(jd),o=C.useRef(a);o.current=a;const c=C.useRef(l);c.current=l;const h=C.useRef(n);h.current=n;const p=C.useCallback(T=>{const A=Ti(T);o.current=A,r(A)},[]),m=C.useCallback(T=>{o.current=T,r(T)},[]),g=C.useCallback(T=>{var _;(_=h.current)==null||_.call(h);const A=o.current,N=gg({...T,wsUrl:T.wsUrl||cn,token:T.token||"",displayName:T.displayName||`Herdr ${A.profiles.length+1}`,autoReconnect:T.autoReconnect!==!1},A.profiles.length),E=Ti({profiles:[...A.profiles,N],activeProfileId:N.id,wsUrl:N.wsUrl,token:N.token,pairCode:N.pairCode||"",autoReconnect:N.autoReconnect});m(E),c.current(E)},[m]),y=C.useCallback(T=>{var _;const A=o.current,N=A.profiles.find(z=>z.id===T);if(!N||N.id===A.activeProfileId)return;(_=h.current)==null||_.call(h);const E=Ti({activeProfileId:N.id,wsUrl:N.wsUrl,token:N.token,pairCode:N.pairCode||"",autoReconnect:N.autoReconnect,profiles:A.profiles.map(z=>z.id===N.id?{...z,lastUsedAt:Date.now()}:z)});m(E),c.current(E)},[m]),v=C.useCallback((T,A)=>{const N=o.current;if(!N.profiles.find(O=>O.id===T))return;const _=A.trim().slice(0,64);if(!_)return;const z=Ti({profiles:N.profiles.map(O=>O.id===T?{...O,displayName:_}:O)});m(z)},[m]),x=C.useCallback(T=>{const A=o.current;if(!A.profiles.some(z=>z.id===T))return;const N=A.profiles.filter(z=>z.id!==T),E=N.find(z=>z.id===A.activeProfileId)||N[0],_=Ti(E?{profiles:N,activeProfileId:E.id,wsUrl:E.wsUrl,token:E.token,pairCode:E.pairCode||"",autoReconnect:E.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:cn,token:"",pairCode:""});m(_),T===A.activeProfileId&&c.current(_)},[m]),w=C.useCallback(T=>{const A=o.current,N=A.profiles.find(q=>q.id===A.activeProfileId),E=T.hostId?bg({wsUrl:A.wsUrl,hostId:T.hostId}):null,_=E?A.profiles.findIndex(q=>bg(q)===E):-1,z=_>=0?_:Math.max(0,A.profiles.findIndex(q=>q.id===A.activeProfileId)),D={...A.profiles[z]||N||gg({wsUrl:A.wsUrl||cn,token:"",pairCode:A.pairCode||"PENDING",displayName:`Herdr ${A.profiles.length+1}`},A.profiles.length),token:T.token,pairCode:void 0,...T.hostId?{hostId:T.hostId}:{},...T.deviceId?{deviceId:T.deviceId}:{},lastUsedAt:Date.now()};let R=[...A.profiles];z>=0&&z<R.length?R[z]=D:R.push(D);const B=N==null?void 0:N.id;R=R.filter((q,$)=>$===z||q.id===D.id?!0:!(_>=0&&B&&q.id===B));const H=Ti({profiles:R,activeProfileId:D.id,wsUrl:D.wsUrl,token:D.token,pairCode:"",autoReconnect:D.autoReconnect});return m(H),H},[m]),M=C.useCallback(T=>{const A=o.current,N=A.profiles.find(O=>O.id===A.activeProfileId);if(!N||!T.hostId&&!T.hostname)return;const E=/^Herdr \d+$/.test(N.displayName),_={...N,...T.hostId?{hostId:T.hostId}:{},...T.hostname?{hostname:T.hostname}:{},...T.hostname&&E?{displayName:T.hostname}:{}},z=Ti({profiles:A.profiles.map(O=>O.id===N.id?_:O)});m(z)},[m]);return{settings:a,updateSettings:p,addProfileAndConnect:g,switchProfile:y,renameProfile:v,removeProfile:x,savePairedProfile:w,noteReadyProfile:M}}const Kr={ctrl:!1,alt:!1,shift:!1};function x1({adapterRef:l,role:n,addToast:a,tRef:r}){const[o,c]=C.useState({cols:80,rows:24}),h=C.useRef(o);h.current=o;const p=C.useRef(new Set),m=C.useRef(new Set),g=C.useRef(!0);C.useEffect(()=>{n==="controller"&&(g.current=!0)},[n]);const y=C.useCallback(()=>{g.current&&(g.current=!1,a("warning",r.current("toasts.viewerModeWarning")))},[a,r]),v=C.useCallback(R=>{if(n!=="controller"){y();return}const B=l.current;if(!B)return;const H=kd(R);for(const q of m.current)try{q(H)}catch($){console.debug("Key input observer threw:",$)}B.sendInput(H)},[l,n,y]),x=C.useCallback(R=>(m.current.add(R),()=>{m.current.delete(R)}),[]),[w,M]=C.useState(Kr),T=C.useRef(Kr),A=C.useCallback(R=>{const B={...T.current,[R]:!T.current[R]};T.current=B,M(B)},[]),N=C.useCallback(()=>{const R=T.current;return!R.ctrl&&!R.alt&&!R.shift?null:(T.current=Kr,M(Kr),R)},[]),E=C.useCallback(R=>{var B;n!=="controller"&&!so(R)||(B=l.current)==null||B.sendInput(R)},[l,n]),_=C.useCallback((R,B)=>{var H;h.current={cols:R,rows:B},c({cols:R,rows:B}),(H=l.current)==null||H.sendResize(R,B)},[l]),z=C.useCallback((R,B)=>n!=="controller"?(y(),!1):l.current?(l.current.sendPasteFile(R,B),!0):!1,[l,n,y]),O=C.useCallback(R=>(p.current.add(R),()=>{p.current.delete(R)}),[]),D=C.useCallback(R=>{for(const B of p.current)try{B(R)}catch(H){console.error("Error in pasteFileReady listener:",H)}},[]);return{terminalDimensions:o,dimensionsRef:h,warnViewerMode:y,sendKey:v,observeKeyInput:x,modifierLatch:w,toggleModifierLatch:A,consumeModifierLatch:N,sendBinary:E,sendResize:_,sendPasteFile:z,subscribeToPasteFileReady:O,notifyPasteFileReady:D}}const w1=4e3,S1=3;function C1(){const[l,n]=C.useState([]),a=C.useRef([]),r=C.useRef(new Map),o=C.useCallback(p=>{a.current=p,n(p)},[]),c=C.useCallback(p=>{const m=r.current.get(p);m&&(clearTimeout(m),r.current.delete(p)),o(a.current.filter(g=>g.id!==p))},[o]),h=C.useCallback((p,m)=>{const g=Date.now(),y=a.current,v=y.find(T=>T.type===p&&T.message===m),x=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let w;if(v)w=y.map(T=>T.id===x?{...T,count:T.count+1,timestamp:g}:T);else for(w=[...y,{id:x,type:p,message:m,timestamp:g,count:1}];w.length>S1;){const[T,...A]=w,N=r.current.get(T.id);N&&(clearTimeout(N),r.current.delete(T.id)),w=A}o(w);const M=r.current.get(x);M&&clearTimeout(M),r.current.set(x,setTimeout(()=>c(x),w1))},[o,c]);return C.useEffect(()=>{const p=r.current;return()=>{for(const m of p.values())clearTimeout(m);p.clear()}},[]),{toasts:l,addToast:h,removeToast:c}}function T1(l,n){const[a,r]=C.useState(null),[o,c]=C.useState(m1),h=C.useRef(o),p=C.useRef(new Set),m=C.useCallback(v=>{h.current=v,c(v),Ib(v)},[]),g=C.useCallback(v=>{if(r(v),!v.updateAvailable||h.current===v.latest)return;const x=`${v.latest}:${v.restartPending?"restart":"update"}`;p.current.has(x)||(p.current.add(x),l("info",v.restartPending?n.current("update.toastRestart",{version:v.latest}):n.current("update.toast",{version:v.latest})))},[l,n]),y=C.useCallback(()=>r(null),[]);return{updateStatus:a,ignoredUpdate:o,ignoreUpdate:m,receiveUpdateStatus:g,forgetUpdateStatus:y}}function M1(){const[l,n]=C.useState(typeof window<"u"?new URLSearchParams(window.location.search).get("profile"):null),a=C.useRef(l);a.current=l;const r=C.useCallback(()=>{if(a.current=null,n(null),typeof window>"u")return;const o=new URL(window.location.href);if(!o.searchParams.has("profile"))return;o.searchParams.delete("profile");const c=o.searchParams.toString();window.history.replaceState({},"",o.pathname+(c?`?${c}`:"")+o.hash)},[]);return{profileId:l,requestedProfileIdRef:a,clearProfileOverride:r,isAdminTerminal:typeof window<"u"&&new URLSearchParams(window.location.search).get("adminTerminal")==="1"}}const Pb=C.createContext(null),$b=C.createContext(null),qb=C.createContext(null),Vb=C.createContext(null),Xb=C.createContext(null),A1=({children:l})=>{var Ms;const[n,a]=C.useReducer(_w,Rw),r=C.useRef(null),o=C.useRef(!1),{profileId:c,requestedProfileIdRef:h,clearProfileOverride:p,isAdminTerminal:m}=M1();C.useEffect(()=>{Mb()},[]);const{receiveOutput:g,subscribeToOutput:y,getPendingOutputChunkCount:v,clearPendingOutput:x}=o1(),{toasts:w,addToast:M,removeToast:T}=C1(),A=C.useCallback(()=>{x(),a({type:"reset",resetTerminal:!0})},[x]),{settings:N,updateSettings:E,addProfileAndConnect:_,switchProfile:z,renameProfile:O,removeProfile:D,savePairedProfile:R,noteReadyProfile:B}=v1(he=>{var Fe;A(),(Fe=r.current)==null||Fe.reconnectWith(Br(he,h.current))},p),H=C.useCallback((he,Fe)=>Nd(N.language,he,Fe),[N.language]),q=C.useRef(H);q.current=H;const{herdrLaunch:$,startHerdr:W,handleLaunchError:le,forgetHerdrLaunch:oe}=Ow(r,q),{updateStatus:I,ignoredUpdate:k,ignoreUpdate:Y,receiveUpdateStatus:Q,forgetUpdateStatus:ae}=T1(M,q),Z=x1({adapterRef:r,role:n.role,addToast:M,tRef:q}),{uploadProgress:ge,uploadImage:be,resetUploadProgress:ye,abortUpload:Me,completeUpload:de}=a1({adapterRef:r,role:n.role,connectionState:n.connectionState,warnViewerMode:Z.warnViewerMode,addToast:M,t:H,sendPasteFile:Z.sendPasteFile}),xe=Zw(r,()=>Br(N,h.current),{stateChange:(he,Fe,Nt)=>{const kt=Iu(Nt)?H(`serverErrors.${Nt}`):Fe;a({type:"stateChange",state:he,detail:kt,code:Nt}),he==="connected"?M("success",H("toasts.connected")):he==="error"&&M("error",kt||H("toasts.connectionError")),he!=="connected"&&oe()},ready:he=>{const Fe=o.current;Fe&&x(),o.current=!0,oe(),ae(),a({type:"ready",message:he,resetTerminal:Fe}),B(he)},hostReconnecting:he=>{a({type:"hostReconnecting",code:he||"host_reconnecting",detail:H(`serverErrors.${Iu(he)?he:"host_reconnecting"}`)}),x()},sessionRestarted:(he,Fe,Nt,kt,ol,Di,Co)=>{var ua;x(),a({type:"sessionRestarted",hostname:kt,palette:Nt,platform:ol,shellProfile:Di,adminTerminalSupported:Co}),B({hostId:(ua=r.current)==null?void 0:ua.getHostId(),hostname:kt})},roleChange:(he,Fe,Nt,kt)=>{a({type:"roleChange",role:he,controllerId:Fe,hostId:Nt,assignedClientId:kt})},controlGranted:()=>{a({type:"controlGranted"}),M("success",H("toasts.controlGranted"))},paired:he=>{var Nt;const Fe=R(he);M("success",H("toasts.pairedSuccess")),a({type:"paired",at:Date.now()}),(Nt=r.current)==null||Nt.reconnectWith(Br(Fe,h.current))},exit:(he,Fe)=>{M("info",`${H("toasts.sessionEnded")}${Fe?`: ${Fe}`:""}${he!=null?` (${he})`:""}`)},error:he=>{if(le(he)||he.code==="host_font_unavailable")return;Me();const Fe=Iu(he.code)?H(`serverErrors.${he.code}`):he.message||`[${he.code}]`;M("error",Fe)},pasteFileReady:he=>{de(),Z.notifyPasteFileReady(he)},rttUpdate:he=>a({type:"rtt",rttMs:he}),peerCount:he=>a({type:"peerCount",count:he}),sessionReady:()=>{a({type:"sessionReady"}),oe()},agentStatus:he=>a({type:"agentStatus",status:he}),updateStatus:Q,binaryData:g}),{activeProfileId:se,activeProfile:ve}=Nw(N,c),{hostFont:ie,loadHostFont:we,declineHostFont:Ee,syncHostFont:He,ensureHostGlyphs:ot}=Aw(xe),ce=C.useCallback(()=>{we()},[we]),Ce=aw(N.fontFamily,ie.font?{family:ie.font.family,alias:ie.status==="loaded"?ie.alias:null,glyphs:ie.glyphs.source?{family:ie.glyphs.source.family,scope:ie.glyphs.source.scope,alias:ie.glyphs.alias}:null}:null),tt=N.fontSizeFollowsHost&&((Ms=ie.font)!=null&&Ms.sizePx)?ta(ie.font.sizePx,N.fontSize):N.fontSize;C.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",Ce)},[Ce]),C.useEffect(()=>{var he;(he=r.current)==null||he.updateConfig(Br(N,c))},[N,c]),C.useEffect(()=>{const he=r.current;return he?Ew(he):void 0},[]);const{dimensionsRef:lt}=Z,yt=C.useCallback(he=>{r.current&&(he&&r.current.updateConfig(he),r.current.connect(lt.current))},[lt]),bn=C.useCallback(()=>{var he;(he=r.current)==null||he.disconnect()},[]),dn=C.useCallback((he=!1)=>{var Fe;(Fe=r.current)==null||Fe.claimControl(he)},[]),Xt=C.useCallback(()=>{var he;(he=r.current)==null||he.releaseControl()},[]),It=C.useCallback(he=>E({language:he}),[E]),ji=C.useMemo(()=>({settings:N,updateSettings:E,language:N.language,setLanguage:It,t:H,profiles:N.profiles,activeProfileId:se,activeProfile:ve,switchProfile:z,addProfileAndConnect:_,renameProfile:O,removeProfile:D,hostFont:ie,loadHostFont:ce,declineHostFont:Ee,syncHostFont:He,ensureHostGlyphs:ot,terminalFontFamily:Ce,terminalFontSize:tt}),[N,E,It,H,se,ve,z,_,O,D,ie,ce,Ee,He,ot,Ce,tt]),Et=C.useMemo(()=>{var he;return{...n,shellProfile:m?"powershell":n.shellProfile,isController:n.role==="controller",agentProfile:m?"shell":Bx((he=n.agentStatus)==null?void 0:he.focusedAgent,"auto"),reportShellProfile:Fe=>a({type:"shellProfile",profile:Fe}),isAdminTerminal:m,adapter:xe,connect:yt,disconnect:bn,claimControl:dn,releaseControl:Xt,herdrLaunch:$,startHerdr:W,updateStatus:I,ignoredUpdate:k,ignoreUpdate:Y}},[n,m,xe,yt,bn,dn,Xt,$,W,I,k,Y]),xo=C.useMemo(()=>({toasts:w,addToast:M,removeToast:T}),[w,M,T]),{terminalDimensions:ra,sendKey:oa,observeKeyInput:Oi,modifierLatch:Ss,toggleModifierLatch:ca,consumeModifierLatch:Cs,sendBinary:Ts,sendResize:Jn,warnViewerMode:Tt,sendPasteFile:fn,subscribeToPasteFileReady:Mt}=Z,wo=C.useMemo(()=>({terminalDimensions:ra,sendKey:oa,observeKeyInput:Oi,modifierLatch:Ss,toggleModifierLatch:ca,consumeModifierLatch:Cs,sendBinary:Ts,sendResize:Jn,warnViewerMode:Tt,sendPasteFile:fn,subscribeToPasteFileReady:Mt,subscribeToOutput:y,getPendingOutputChunkCount:v}),[ra,oa,Oi,Ss,ca,Cs,Ts,Jn,Tt,fn,Mt,y,v]),So=C.useMemo(()=>({uploadProgress:ge,uploadImage:be,resetUploadProgress:ye}),[ge,be,ye]);return f.jsx(Pb.Provider,{value:ji,children:f.jsx($b.Provider,{value:Et,children:f.jsx(qb.Provider,{value:xo,children:f.jsx(Vb.Provider,{value:wo,children:f.jsx(Xb.Provider,{value:So,children:l})})})})})};function vs(l,n){const a=C.useContext(l);if(!a)throw new Error(`${n} must be used within a TerminalProvider`);return a}const Ne=()=>vs(Pb,"useSettings"),Je=()=>vs($b,"useConnection"),un=()=>vs(qb,"useToasts"),xs=()=>vs(Vb,"useTerminalIO"),mo=()=>vs(Xb,"useUpload");function gs(l){var n,a;return l?{blocked:((n=l.counts)==null?void 0:n.blocked)??0,done:((a=l.counts)==null?void 0:a.done)??0}:null}function E1(l){return l?l.blocked>0?"blocked":l.done>0?"done":null:null}function N1(l){if(!l)return"";const n=[];return l.blocked>0&&n.push(`${l.blocked}⚠`),l.done>0&&n.push(`${l.done}✓`),n.length>0?`(${n.join(" ")})`:""}function k1(l,n){if(!l||!n)return null;const a=new Map(l.agents.map(h=>[h.paneId,h.status]));let r=null;for(const h of n.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&a.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";r="done"}const o=gs(l),c=gs(n);return c.blocked>o.blocked?"blocked":(!r&&c.done>o.done&&(r="done"),r)}const L1={blocked:"%23f9e2af",done:"%23a6e3a1"};function R1(l){return`<circle cx='19' cy='5' r='4.5' fill='${L1[l]}' stroke='%2311111b' stroke-width='1.5'/>`}function _1(l,n){return!n||!l.includes("</svg>")?l:l.replace("</svg>",`${R1(n)}</svg>`)}function xg(l,n=document){const a=n.querySelector('link[rel~="icon"]');if(!a)return;a.dataset.baseHref===void 0&&(a.dataset.baseHref=a.getAttribute("href")??"");const r=_1(a.dataset.baseHref,l);a.getAttribute("href")!==r&&a.setAttribute("href",r)}let rn=null;function j1(){if(typeof window>"u")return null;const l=window;return l.AudioContext??l.webkitAudioContext??null}function Zb(){const l=j1();if(l)try{rn=rn??new l,rn.state==="suspended"&&rn.resume()}catch{rn=null}}function O1(l=window){const n=()=>{Zb(),a()},a=()=>{l.removeEventListener("pointerdown",n),l.removeEventListener("keydown",n)};return l.addEventListener("pointerdown",n),l.addEventListener("keydown",n),a}const D1={blocked:[880,660],done:[660,880]};function Qb(l){if((rn==null?void 0:rn.state)==="running")try{const n=rn.currentTime;D1[l].forEach((a,r)=>{const o=rn.createOscillator(),c=rn.createGain(),h=n+r*.11;o.type="sine",o.frequency.value=a,c.gain.setValueAtTime(1e-4,h),c.gain.exponentialRampToValueAtTime(.06,h+.01),c.gain.exponentialRampToValueAtTime(1e-4,h+.09),o.connect(c),c.connect(rn.destination),o.start(h),o.stop(h+.1)})}catch{}}const z1=15e3,H1={blocked:[70,50,70],done:[40]};function B1(){const{settings:l,t:n}=Ne(),{agentStatus:a}=Je(),r=C.useRef(l);r.current=l;const o=C.useRef(n);o.current=n;const c=C.useRef(null),h=C.useRef(Number.NEGATIVE_INFINITY);C.useEffect(()=>{xg(l.agentAlertBadge?E1(gs(a)):null)},[a,l.agentAlertBadge]),C.useEffect(()=>()=>xg(null),[]),C.useEffect(()=>{if(!(!l.agentAlertSound||typeof window>"u"))return O1(window)},[l.agentAlertSound]),C.useEffect(()=>{const p=c.current;c.current=a;const m=k1(p,a);if(!m)return;const g=Date.now();if(g-h.current<z1)return;h.current=g;const y=r.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(H1[m])}catch{}if(y.agentAlertSound&&x&&Qb(m),y.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const w=gs(a),M=m==="blocked"?o.current("agents.notifyBlocked",{count:w.blocked}):o.current("agents.notifyDone",{count:w.done});try{new Notification("Herdr Remote",{body:M,tag:"herdr-agents"})}catch{}}},[a])}function Wb(l){var n,a,r="";if(typeof l=="string"||typeof l=="number")r+=l;else if(typeof l=="object")if(Array.isArray(l)){var o=l.length;for(n=0;n<o;n++)l[n]&&(a=Wb(l[n]))&&(r&&(r+=" "),r+=a)}else for(a in l)l[a]&&(r&&(r+=" "),r+=a);return r}function U1(){for(var l,n,a=0,r="",o=arguments.length;a<o;a++)(l=arguments[a])&&(n=Wb(l))&&(r&&(r+=" "),r+=n);return r}const K1=(l,n)=>{const a=new Array(l.length+n.length);for(let r=0;r<l.length;r++)a[r]=l[r];for(let r=0;r<n.length;r++)a[l.length+r]=n[r];return a},I1=(l,n)=>({classGroupId:l,validator:n}),Jb=(l=new Map,n=null,a)=>({nextPart:l,validators:n,classGroupId:a}),oo="-",wg=[],F1="arbitrary..",G1=l=>{const n=P1(l),{conflictingClassGroups:a,conflictingClassGroupModifiers:r}=l;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return Y1(h);const p=h.split(oo),m=p[0]===""&&p.length>1?1:0;return ey(p,m,n)},getConflictingClassGroupIds:(h,p)=>{if(p){const m=r[h],g=a[h];return m?g?K1(g,m):m:g||wg}return a[h]||wg}}},ey=(l,n,a)=>{if(l.length-n===0)return a.classGroupId;const o=l[n],c=a.nextPart.get(o);if(c){const g=ey(l,n+1,c);if(g)return g}const h=a.validators;if(h===null)return;const p=n===0?l.join(oo):l.slice(n).join(oo),m=h.length;for(let g=0;g<m;g++){const y=h[g];if(y.validator(p))return y.classGroupId}},Y1=l=>l.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=l.slice(1,-1),a=n.indexOf(":"),r=n.slice(0,a);return r?F1+r:void 0})(),P1=l=>{const{theme:n,classGroups:a}=l;return $1(a,n)},$1=(l,n)=>{const a=Jb();for(const r in l){const o=l[r];Od(o,a,r,n)}return a},Od=(l,n,a,r)=>{const o=l.length;for(let c=0;c<o;c++){const h=l[c];q1(h,n,a,r)}},q1=(l,n,a,r)=>{if(typeof l=="string"){V1(l,n,a);return}if(typeof l=="function"){X1(l,n,a,r);return}Z1(l,n,a,r)},V1=(l,n,a)=>{const r=l===""?n:ty(n,l);r.classGroupId=a},X1=(l,n,a,r)=>{if(Q1(l)){Od(l(r),n,a,r);return}n.validators===null&&(n.validators=[]),n.validators.push(I1(a,l))},Z1=(l,n,a,r)=>{const o=Object.entries(l),c=o.length;for(let h=0;h<c;h++){const[p,m]=o[h];Od(m,ty(n,p),a,r)}},ty=(l,n)=>{let a=l;const r=n.split(oo),o=r.length;for(let c=0;c<o;c++){const h=r[c];let p=a.nextPart.get(h);p||(p=Jb(),a.nextPart.set(h,p)),a=p}return a},Q1=l=>"isThemeGetter"in l&&l.isThemeGetter===!0,W1=l=>{if(l<1)return{get:()=>{},set:()=>{}};let n=0,a=Object.create(null),r=Object.create(null);const o=(c,h)=>{a[c]=h,n++,n>l&&(n=0,r=a,a=Object.create(null))};return{get(c){let h=a[c];if(h!==void 0)return h;if((h=r[c])!==void 0)return o(c,h),h},set(c,h){c in a?a[c]=h:o(c,h)}}},pd="!",Sg=":",J1=[],Cg=(l,n,a,r,o)=>({modifiers:l,hasImportantModifier:n,baseClassName:a,maybePostfixModifierPosition:r,isExternal:o}),eS=l=>{const{prefix:n,experimentalParseClassName:a}=l;let r=o=>{const c=[];let h=0,p=0,m=0,g;const y=o.length;for(let T=0;T<y;T++){const A=o[T];if(h===0&&p===0){if(A===Sg){c.push(o.slice(m,T)),m=T+1;continue}if(A==="/"){g=T;continue}}A==="["?h++:A==="]"?h--:A==="("?p++:A===")"&&p--}const v=c.length===0?o:o.slice(m);let x=v,w=!1;v.endsWith(pd)?(x=v.slice(0,-1),w=!0):v.startsWith(pd)&&(x=v.slice(1),w=!0);const M=g&&g>m?g-m:void 0;return Cg(c,w,x,M)};if(n){const o=n+Sg,c=r;r=h=>h.startsWith(o)?c(h.slice(o.length)):Cg(J1,!1,h,void 0,!0)}if(a){const o=r;r=c=>a({className:c,parseClassName:o})}return r},tS=l=>{const n=new Map;return l.orderSensitiveModifiers.forEach((a,r)=>{n.set(a,1e6+r)}),a=>{const r=[];let o=[];for(let c=0;c<a.length;c++){const h=a[c],p=h[0]==="[",m=n.has(h);p||m?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(h)):o.push(h)}return o.length>0&&(o.sort(),r.push(...o)),r}},nS=l=>({cache:W1(l.cacheSize),parseClassName:eS(l),sortModifiers:tS(l),postfixLookupClassGroupIds:iS(l),...G1(l)}),iS=l=>{const n=Object.create(null),a=l.postfixLookupClassGroups;if(a)for(let r=0;r<a.length;r++)n[a[r]]=!0;return n},lS=/\s+/,aS=(l,n)=>{const{parseClassName:a,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:c,postfixLookupClassGroupIds:h}=n,p=[],m=l.trim().split(lS);let g="";for(let y=m.length-1;y>=0;y-=1){const v=m[y],{isExternal:x,modifiers:w,hasImportantModifier:M,baseClassName:T,maybePostfixModifierPosition:A}=a(v);if(x){g=v+(g.length>0?" "+g:g);continue}let N=!!A,E;if(N){const R=T.substring(0,A);E=r(R);const B=E&&h[E]?r(T):void 0;B&&B!==E&&(E=B,N=!1)}else E=r(T);if(!E){if(!N){g=v+(g.length>0?" "+g:g);continue}if(E=r(T),!E){g=v+(g.length>0?" "+g:g);continue}N=!1}const _=w.length===0?"":w.length===1?w[0]:c(w).join(":"),z=M?_+pd:_,O=z+E;if(p.indexOf(O)>-1)continue;p.push(O);const D=o(E,N);for(let R=0;R<D.length;++R){const B=D[R];p.push(z+B)}g=v+(g.length>0?" "+g:g)}return g},sS=(...l)=>{let n=0,a,r,o="";for(;n<l.length;)(a=l[n++])&&(r=ny(a))&&(o&&(o+=" "),o+=r);return o},ny=l=>{if(typeof l=="string")return l;let n,a="";for(let r=0;r<l.length;r++)l[r]&&(n=ny(l[r]))&&(a&&(a+=" "),a+=n);return a},Tg=(l,...n)=>{let a,r,o,c;const h=m=>{const g=n.reduce((y,v)=>v(y),l());return a=nS(g),r=a.cache.get,o=a.cache.set,c=p,p(m)},p=m=>{const g=r(m);if(g)return g;const y=aS(m,a);return o(m,y),y};return c=h,(...m)=>c(sS(...m))},rS=[],mt=l=>{const n=a=>a[l]||rS;return n.isThemeGetter=!0,n},iy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ly=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,cS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uS=/\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$/,dS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mi=l=>oS.test(l),_e=l=>!!l&&!Number.isNaN(Number(l)),Sn=l=>!!l&&Number.isInteger(Number(l)),Xu=l=>l.endsWith("%")&&_e(l.slice(0,-1)),Pn=l=>cS.test(l),ay=()=>!0,mS=l=>uS.test(l)&&!dS.test(l),Dd=()=>!1,pS=l=>fS.test(l),gS=l=>hS.test(l),bS=l=>!ue(l)&&!fe(l),yS=l=>l.startsWith("@container")&&(l[10]==="/"&&l[11]!==void 0||l[11]==="s"&&l[16]!==void 0&&l.startsWith("-size/",10)||l[11]==="n"&&l[18]!==void 0&&l.startsWith("-normal/",10)),vS=l=>_i(l,oy,Dd),ue=l=>iy.test(l),el=l=>_i(l,cy,mS),Mg=l=>_i(l,ES,_e),xS=l=>_i(l,dy,ay),wS=l=>_i(l,uy,Dd),Ag=l=>_i(l,sy,Dd),SS=l=>_i(l,ry,gS),Ir=l=>_i(l,fy,pS),fe=l=>ly.test(l),ls=l=>rl(l,cy),CS=l=>rl(l,uy),Eg=l=>rl(l,sy),TS=l=>rl(l,oy),MS=l=>rl(l,ry),Fr=l=>rl(l,fy,!0),AS=l=>rl(l,dy,!0),_i=(l,n,a)=>{const r=iy.exec(l);return r?r[1]?n(r[1]):a(r[2]):!1},rl=(l,n,a=!1)=>{const r=ly.exec(l);return r?r[1]?n(r[1]):a:!1},sy=l=>l==="position"||l==="percentage",ry=l=>l==="image"||l==="url",oy=l=>l==="length"||l==="size"||l==="bg-size",cy=l=>l==="length",ES=l=>l==="number",uy=l=>l==="family-name",dy=l=>l==="number"||l==="weight",fy=l=>l==="shadow",Ng=()=>{const l=mt("color"),n=mt("font"),a=mt("text"),r=mt("font-weight"),o=mt("tracking"),c=mt("leading"),h=mt("breakpoint"),p=mt("container"),m=mt("spacing"),g=mt("radius"),y=mt("shadow"),v=mt("inset-shadow"),x=mt("text-shadow"),w=mt("drop-shadow"),M=mt("blur"),T=mt("perspective"),A=mt("aspect"),N=mt("ease"),E=mt("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...z(),fe,ue],D=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],B=()=>[fe,ue,m],H=()=>[Mi,"full","auto",...B()],q=()=>[Sn,"none","subgrid",fe,ue],$=()=>["auto",{span:["full",Sn,fe,ue]},Sn,fe,ue],W=()=>[Sn,"auto",fe,ue],le=()=>["auto","min","max","fr",fe,ue],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...B()],Y=()=>[Mi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],Q=()=>[Mi,"screen","full","dvw","lvw","svw","min","max","fit",...B()],ae=()=>[Mi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...B()],Z=()=>[l,fe,ue],ge=()=>[...z(),Eg,Ag,{position:[fe,ue]}],be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ye=()=>["auto","cover","contain",TS,vS,{size:[fe,ue]}],Me=()=>[Xu,ls,el],de=()=>["","none","full",g,fe,ue],xe=()=>["",_e,ls,el],se=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[_e,Xu,Eg,Ag],we=()=>["","none",M,fe,ue],Ee=()=>["none",_e,fe,ue],He=()=>["none",_e,fe,ue],ot=()=>[_e,fe,ue],ce=()=>[Mi,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pn],breakpoint:[Pn],color:[ay],container:[Pn],"drop-shadow":[Pn],ease:["in","out","in-out"],font:[bS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pn],shadow:[Pn],spacing:["px",_e],text:[Pn],"text-shadow":[Pn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Mi,ue,fe,A]}],container:["container"],"container-type":[{"@container":["","normal","size",fe,ue]}],"container-named":[yS],columns:[{columns:[_e,ue,fe,p]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"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:O()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:H()}],"inset-x":[{"inset-x":H()}],"inset-y":[{"inset-y":H()}],start:[{"inset-s":H(),start:H()}],end:[{"inset-e":H(),end:H()}],"inset-bs":[{"inset-bs":H()}],"inset-be":[{"inset-be":H()}],top:[{top:H()}],right:[{right:H()}],bottom:[{bottom:H()}],left:[{left:H()}],visibility:["visible","invisible","collapse"],z:[{z:[Sn,"auto",fe,ue]}],basis:[{basis:[Mi,"full","auto",p,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,Mi,"auto","initial","none",ue]}],grow:[{grow:["",_e,fe,ue]}],shrink:[{shrink:["",_e,fe,ue]}],order:[{order:[Sn,"first","last","none",fe,ue]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":le()}],"auto-rows":[{"auto-rows":le()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pbs:[{pbs:B()}],pbe:[{pbe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...ae()]}],"min-block-size":[{"min-block":["auto",...ae()]}],"max-block-size":[{"max-block":["none",...ae()]}],w:[{w:[p,"screen",...Y()]}],"min-w":[{"min-w":[p,"screen","none",...Y()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[h]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",a,ls,el]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,AS,xS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xu,ue]}],"font-family":[{font:[CS,wS,n]}],"font-features":[{"font-features":[ue]}],"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:[o,fe,ue]}],"line-clamp":[{"line-clamp":[_e,"none",fe,Mg]}],leading:[{leading:[c,...B()]}],"list-image":[{"list-image":["none",fe,ue]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,ue]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",fe,el]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[_e,"auto",fe,ue]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"tab-size":[{tab:[Sn,fe,ue]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,ue]}],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",fe,ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:be()}],"bg-size":[{bg:ye()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sn,fe,ue],radial:["",fe,ue],conic:[Sn,fe,ue]},MS,SS]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:Me()}],"gradient-via-pos":[{via:Me()}],"gradient-to-pos":[{to:Me()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:xe()}],"border-w-x":[{"border-x":xe()}],"border-w-y":[{"border-y":xe()}],"border-w-s":[{"border-s":xe()}],"border-w-e":[{"border-e":xe()}],"border-w-bs":[{"border-bs":xe()}],"border-w-be":[{"border-be":xe()}],"border-w-t":[{"border-t":xe()}],"border-w-r":[{"border-r":xe()}],"border-w-b":[{"border-b":xe()}],"border-w-l":[{"border-l":xe()}],"divide-x":[{"divide-x":xe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":xe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-bs":[{"border-bs":Z()}],"border-color-be":[{"border-be":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,fe,ue]}],"outline-w":[{outline:["",_e,ls,el]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",y,Fr,Ir]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",v,Fr,Ir]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:xe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[_e,el]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":xe()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",x,Fr,Ir]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[_e,fe,ue]}],"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":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[fe,ue]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:be()}],"mask-size":[{mask:ye()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,ue]}],filter:[{filter:["","none",fe,ue]}],blur:[{blur:we()}],brightness:[{brightness:[_e,fe,ue]}],contrast:[{contrast:[_e,fe,ue]}],"drop-shadow":[{"drop-shadow":["","none",w,Fr,Ir]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",_e,fe,ue]}],"hue-rotate":[{"hue-rotate":[_e,fe,ue]}],invert:[{invert:["",_e,fe,ue]}],saturate:[{saturate:[_e,fe,ue]}],sepia:[{sepia:["",_e,fe,ue]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,ue]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[_e,fe,ue]}],"backdrop-contrast":[{"backdrop-contrast":[_e,fe,ue]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,fe,ue]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,fe,ue]}],"backdrop-invert":[{"backdrop-invert":["",_e,fe,ue]}],"backdrop-opacity":[{"backdrop-opacity":[_e,fe,ue]}],"backdrop-saturate":[{"backdrop-saturate":[_e,fe,ue]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,fe,ue]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,ue]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",fe,ue]}],ease:[{ease:["linear","initial",N,fe,ue]}],delay:[{delay:[_e,fe,ue]}],animate:[{animate:["none",E,fe,ue]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,fe,ue]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:ot()}],"skew-x":[{"skew-x":ot()}],"skew-y":[{"skew-y":ot()}],transform:[{transform:[fe,ue,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],zoom:[{zoom:[Sn,fe,ue]}],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fe,ue]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":Z()}],"scrollbar-track-color":[{"scrollbar-track":Z()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mbs":[{"scroll-mbs":B()}],"scroll-mbe":[{"scroll-mbe":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pbs":[{"scroll-pbs":B()}],"scroll-pbe":[{"scroll-pbe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",fe,ue]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[_e,ls,el,Mg]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},NS=(l,{cacheSize:n,prefix:a,experimentalParseClassName:r,extend:o={},override:c={}})=>(Zl(l,"cacheSize",n),Zl(l,"prefix",a),Zl(l,"experimentalParseClassName",r),Gr(l.theme,c.theme),Gr(l.classGroups,c.classGroups),Gr(l.conflictingClassGroups,c.conflictingClassGroups),Gr(l.conflictingClassGroupModifiers,c.conflictingClassGroupModifiers),Zl(l,"postfixLookupClassGroups",c.postfixLookupClassGroups),Zl(l,"orderSensitiveModifiers",c.orderSensitiveModifiers),Yr(l.theme,o.theme),Yr(l.classGroups,o.classGroups),Yr(l.conflictingClassGroups,o.conflictingClassGroups),Yr(l.conflictingClassGroupModifiers,o.conflictingClassGroupModifiers),gd(l,o,"postfixLookupClassGroups"),gd(l,o,"orderSensitiveModifiers"),l),Zl=(l,n,a)=>{a!==void 0&&(l[n]=a)},Gr=(l,n)=>{if(n)for(const a in n)Zl(l,a,n[a])},Yr=(l,n)=>{if(n)for(const a in n)gd(l,n,a)},gd=(l,n,a)=>{const r=n[a];r!==void 0&&(l[a]=l[a]?l[a].concat(r):r)},kS=(l,...n)=>typeof l=="function"?Tg(Ng,l,...n):Tg(()=>NS(Ng(),l),...n),LS=kS({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ne(...l){return LS(U1(l))}const Le={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},on={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"}},sa={ok:on.ok.text,warn:on.warn.text,bad:on.bad.text,idle:on.idle.text,accent:on.accent.text,alt:on.alt.text,info:on.info.text},Kt=({level:l,className:n})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",sa[l],n),children:l==="idle"?Le.off:Le.on}),zd=({className:l})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",l),children:Le.dot}),hy={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"},At=({title:l,aside:n,tone:a="accent",className:r,bodyClassName:o,children:c,...h})=>f.jsxs("fieldset",{className:ne("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",l?"px-3 pb-3 pt-1":"p-3",r),...h,children:[l?f.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",sa[a]),children:f.jsx("span",{children:l})}):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",o),children:c})]}),Ei=({label:l,labelWidth:n=16,className:a,children:r})=>f.jsxs("div",{className:ne("flex items-baseline gap-2 text-tui",a),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${n}ch`},title:typeof l=="string"?l:void 0,children:l}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:r})]}),RS=({className:l,label:n})=>n?f.jsxs("div",{className:ne("flex items-center gap-2",l),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",l),"aria-hidden":"true"}),ki=({tone:l="accent",className:n,children:a,action:r})=>{const o=l==="ok"?Le.check:l==="bad"?Le.cross:l==="warn"?Le.warn:"›",c=on[l].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",c,n),children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",sa[l]),children:o}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:a}),r?f.jsx("div",{className:"shrink-0",children:r}):null]})},_S={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"},Ae=({variant:l="default",brackets:n=!0,glyph:a,block:r=!1,className:o,children:c,type:h="button",...p})=>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",_S[l],r&&"w-full",o),...p,children:[n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,a?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:a}):null,f.jsx("span",{className:"truncate",children:c}),n?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),Hd=({tone:l="accent",dot:n=!1,className:a,children:r})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",sa[l],a),children:[n?f.jsx(Kt,{level:l}):null,r]}),Bd=({tabs:l,activeId:n,onSelect:a,ariaLabel:r,className:o,labelClassName:c})=>f.jsx("nav",{className:ne("flex items-center gap-2",o),"aria-label":r,children:l.map((h,p)=>{const m=h.id===n;return f.jsxs(Qn.Fragment,{children:[p>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Le.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>a(h.id),"aria-current":m?"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",m?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[h.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:ne("text-tui-faint",m&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:ne("ml-1",c),children:h.label})]})]},h.id)})}),my=({hints:l,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:l.map(a=>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:a.keys}),f.jsx("span",{children:a.action})]},`${a.keys} ${a.action}`))}),py=({active:l=!1,className:n,children:a})=>f.jsx("span",{className:ne("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",l?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",n),children:a}),qn=({htmlFor:l,hint:n,className:a,children:r})=>f.jsxs("label",{htmlFor:l,className:ne("block text-tui-sm font-bold text-tui-muted",a),children:[r,n?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:n}):null]}),Rt=Qn.forwardRef(({className:l,...n},a)=>f.jsx("input",{ref:a,className:ne("tui-input w-full px-2 py-1 text-tui",l),...n}));Rt.displayName="Input";const po=Qn.forwardRef(({className:l,children:n,...a},r)=>f.jsx("select",{ref:r,className:ne("tui-input w-full px-2 py-1 text-tui",l),...a,children:n}));po.displayName="Select";const jS=({checked:l,onChange:n,disabled:a=!1,label:r,description:o,className:c,id:h})=>f.jsxs("label",{className:ne("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",a&&"cursor-not-allowed opacity-60",c),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:l,disabled:a,onChange:p=>n(p.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ne("mt-px shrink-0 font-bold leading-tight",l?"text-tui-ok":"text-tui-faint",!a&&"group-hover:text-tui-accent"),children:l?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:ne("block",l?"text-tui-text":"text-tui-muted"),children:r}),o?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:o}):null]})]}),go="h-8",gn=({title:l,aside:n,className:a,children:r})=>f.jsxs("section",{className:ne("min-w-0",a),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:l}),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:r})]}),Ut=({label:l,hint:n,htmlFor:a,control:r,className:o})=>f.jsxs("div",{className:ne("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",o),children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[a?f.jsx("label",{htmlFor:a,className:"block text-tui text-tui-text",children:l}):f.jsx("span",{className:"block text-tui text-tui-text",children:l}),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:r})]}),bd="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",yd="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function kg({name:l,value:n,options:a,onChange:r,tone:o="accent",className:c,"aria-label":h}){return f.jsx("div",{role:"radiogroup","aria-label":h,className:ne("grid w-full border border-tui-border bg-tui-mantle",go,c),style:{gridTemplateColumns:`repeat(${a.length}, minmax(max-content, 1fr))`},children:a.map((p,m)=>{const g=p.value===n;return f.jsxs("label",{className:ne(bd,m>0&&"border-l border-tui-border",g?ne(hy[o],"font-bold text-tui-crust"):yd),children:[f.jsx("input",{type:"radio",name:l,value:p.value,className:"sr-only",checked:g,onChange:()=>r(p.value)}),f.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const Ai=({checked:l,onChange:n,label:a,offLabel:r,onLabel:o,disabled:c=!1,className:h})=>{const p=m=>g=>{g.preventDefault(),!(c||m===l)&&n(m)};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",go,c&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"checkbox",className:"sr-only","aria-label":a,checked:l,disabled:c,onChange:m=>n(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",onClick:p(!1),className:ne(bd,l?yd:"bg-tui-selection font-bold text-tui-text"),children:r}),f.jsx("span",{"aria-hidden":"true",onClick:p(!0),className:ne(bd,"border-l border-tui-border",l?"bg-tui-ok font-bold text-tui-crust":yd),children:o})]})},ll=({variant:l="neutral",className:n,type:a="button",children:r,...o})=>f.jsx("button",{type:a,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",l==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",n),...o,children:r}),OS=({value:l,width:n=20,tone:a="accent",className:r})=>{const o=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0,c=Math.round(o*n);return f.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",r),role:"presentation",children:[f.jsx("span",{className:sa[a],children:Le.meterFull.repeat(c)}),f.jsx("span",{className:"text-tui-border",children:Le.meterEmpty.repeat(Math.max(0,n-c))})]})},DS=({ratio:l,label:n,tone:a="accent",className:r,...o})=>{const c=Number.isFinite(l)?Math.min(1,Math.max(0,l)):0;return f.jsxs("div",{className:ne("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",r),role:"progressbar","aria-valuenow":Math.round(c*100),"aria-valuemin":0,"aria-valuemax":100,...o,children:[f.jsx("div",{className:ne("absolute inset-y-0 left-0",hy[a]),style:{width:`${c*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]})},ql=({label:l,value:n,sub:a,tone:r,title:o,className:c})=>f.jsxs("div",{className:ne("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",c),title:o,children:[f.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:l}),f.jsx("div",{className:ne("truncate text-tui-lg font-bold",r?sa[r]:"text-tui-text"),children:n}),f.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:a||" "})]}),Lg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],al=({className:l,label:n})=>{const[a,r]=Qn.useState(0);return Qn.useEffect(()=>{const o=setInterval(()=>r(c=>(c+1)%Lg.length),90);return()=>clearInterval(o)},[]),f.jsxs("span",{className:ne("inline-flex items-center gap-1.5",l),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Lg[a]}),n?f.jsx("span",{children:n}):null]})};function Ud({columns:l,items:n,rowKey:a,empty:r,className:o}){return n.length===0?f.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",o),children:r}):f.jsx("div",{className:ne("w-full overflow-x-auto",o),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:l.map(c=>f.jsx("th",{scope:"col",style:c.width?{width:`${c.width}ch`}:void 0,className:ne("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",c.align==="right"?"text-right":"text-left",c.className),children:c.header},c.key))})}),f.jsx("tbody",{children:n.map((c,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:l.map(p=>f.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",p.align==="right"?"text-right":"text-left",p.className),children:p.render(c,h)},p.key))},a(c,h)))})]})})}var zS=hb();const bo=({isOpen:l,onClose:n,title:a,subtitle:r,closeLabel:o,footer:c,hints:h,size:p="md",fixedHeight:m=!1,className:g,children:y})=>{if(!l)return null;const v=p==="sm"?"max-w-md":p==="lg"?"max-w-3xl":"max-w-xl",x=`tui-modal-${a.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:M=>{M.target===M.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,m&&"h-[46rem]",g),children:[f.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[f.jsx("h2",{id:x,className:"break-words text-tui font-bold text-tui-accent",children:a}),r?f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:r}):null]}),f.jsx(Ae,{variant:"ghost",onClick:n,"aria-label":o,title:o,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),c||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(my,{hints:h}):f.jsx("span",{}),c?f.jsx("div",{className:"flex items-center gap-2",children:c}):null]}):null]})});return typeof document>"u"?w:zS.createPortal(w,document.body)},vd=({items:l,className:n})=>{const a=l.filter(Boolean);return f.jsx("span",{className:ne("flex min-w-0 items-center gap-1.5",n),children:a.map((r,o)=>f.jsxs(Qn.Fragment,{children:[o>0?f.jsx(zd,{className:"shrink-0"}):null,r]},o))})},gy=({left:l,right:n,className:a})=>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",a),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:l}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:n})]}),HS=({name:l,tagline:n,aside:a,tabs:r,activeTabId:o,onSelectTab:c,tabsAriaLabel:h,toolbarStart:p,toolbarAside:m,hints:g,footerAside:y,bodyClassName:v,className:x,children:w})=>{const M=!!(r&&r.length>0&&o!==void 0&&c);return f.jsxs("div",{className:ne("flex h-full min-h-0 w-full flex-col bg-tui-crust",x),children:[l?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:l}),n?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:n}):null]}),a?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:a}):null]}):null,M||p||m?f.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[p?f.jsx("div",{className:"flex shrink-0 items-center",children:p}):null,M?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(Bd,{tabs:r,activeId:o,onSelect:c,ariaLabel:h,className:"gap-3"})}):null,m?f.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:m}):null]}):null,f.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",v),children:w}),g||y?f.jsx(gy,{left:g?f.jsx(my,{hints:g}):null,right:y}):null]})},Pr="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",$r="text-tui-muted hover:border-tui-border hover:text-tui-accent",BS="border-tui-accent bg-tui-accent text-tui-crust",US=({currentView:l,onNavigate:n,onOpenPairing:a,onOpenSettings:r,onToggleVirtualKeyboard:o,isVirtualKeyboardOpen:c})=>{const{language:h,setLanguage:p,t:m}=Ne(),{addToast:g}=un(),y=()=>{const x=h==="zh"?"en":"zh";p(x),g("info",Nd(x,"toasts.switchedLanguage",{lang:x==="zh"?"简体中文":"English"}))},v=[{id:"terminal",label:m("header.terminalTab"),index:1,ariaLabel:m("header.terminalTab")},...l==="admin"?[{id:"admin",label:m("header.adminTab"),index:2,ariaLabel:m("header.adminTab")}]:[]];return f.jsx("header",{className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:f.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[f.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[f.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:m("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(Bd,{tabs:v,activeId:l,onSelect:x=>n(x),ariaLabel:m("header.mainNavigationAria"),className:"shrink-0 gap-3"}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[f.jsx("button",{type:"button",onClick:y,className:ne(Pr,$r),title:m("header.languageToggleTitle"),"aria-label":m("header.languageToggleTitle"),children:m("header.languageShort")}),l==="terminal"&&f.jsx("button",{type:"button",onClick:o,className:ne(Pr,c?BS:$r),title:m("header.virtualKeyboardTitle"),"aria-label":m("header.virtualKeyboardTitle"),children:m("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:a,className:ne(Pr,$r),title:m("header.pairingTitle"),"aria-label":m("header.pairingTitle"),children:m("header.actionPairing")}),f.jsx("button",{type:"button",onClick:r,className:ne(Pr,$r),title:m("header.settingsTitle"),"aria-label":m("header.settingsTitle"),children:m("header.actionSettings")})]})]})})},qr=({tone:l,glyph:n,message:a,assertive:r=!1,action:o})=>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",on[l].edgeB),"aria-live":r?"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",on[l].text),children:n}),f.jsx("span",{className:"truncate text-tui-text",children:a})]}),o]}),KS=()=>{const{settings:l,t:n}=Ne(),{connectionState:a,stateDetail:r,connect:o}=Je();return a==="connected"||!l.token&&!l.pairCode&&a==="disconnected"?null:a==="connecting"?f.jsx(qr,{tone:"accent",glyph:f.jsx(al,{}),message:n("statusBanner.connecting")}):a==="reconnecting"?f.jsx(qr,{tone:"warn",glyph:f.jsx(al,{}),assertive:!0,message:r||n("statusBanner.reconnectingDefault"),action:f.jsx(Ae,{variant:"warn",onClick:()=>o(),className:"shrink-0",children:n("statusBanner.reconnectNow")})}):a==="error"?f.jsx(qr,{tone:"bad",glyph:Le.cross,assertive:!0,message:r||n("statusBanner.errorDefault"),action:f.jsx(Ae,{variant:"danger",onClick:()=>o(),className:"shrink-0",children:n("common.retry")})}):a==="disconnected"?f.jsx(qr,{tone:"idle",glyph:Le.off,message:n("statusBanner.disconnected"),action:f.jsx(Ae,{variant:"primary",onClick:()=>o(),className:"shrink-0",children:n("common.connect")})}):null},Zu="Herdr Remote",Rg=80,IS=/[\u0000-\u001F\u007F-\u009F]/g;function xd(l){if(typeof l!="string")return"";const n=l.replace(IS," ").replace(/\s+/g," ").trim();return n.length<=Rg?n:`${n.slice(0,Rg-1).trimEnd()}…`}function FS(l,n,a){const r=N1(a??null),o=r?`${r} `:"",c=xd(l);if(c)return`${o}${c} · ${Zu}`;const h=xd(n);return h?`${o}${h} · ${Zu}`:`${o}${Zu}`}function GS(l,n,a){const r=FS(l,n,a);return typeof document<"u"&&(document.title=r),r}const YS=new Set(["http:","https:","mailto:"]),Qu=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,PS=/[.,;:!?'"]+$/,_g=8;function Kd(l){return/^www\./i.test(l)?`https://${l}`:l}function $S(l){const n=(o,c)=>o.split(c).length-1;let a=l.replace(PS,"");const r=[["(",")"],["[","]"],["{","}"]];for(const[o,c]of r)for(;a.endsWith(c)&&n(a,c)>n(a,o);)a=a.slice(0,-1);return a}function by(l){if(typeof l!="string"||l.length===0)return!1;try{return YS.has(new URL(Kd(l)).protocol)}catch{return!1}}function qS(l,n){if(typeof l!="string"||n<0)return null;Qu.lastIndex=0;for(let a=Qu.exec(l);a;a=Qu.exec(l)){const r=$S(a[0]);if(!r)continue;const o=a.index,c=o+r.length;if(n>=o&&n<c&&by(r))return r}return null}function VS(l,n,a){var p;const r=(p=l==null?void 0:l.buffer)==null?void 0:p.active;if(!r||typeof r.getLine!="function"||!r.getLine(a))return null;let o=a;for(let m=0;m<_g;m+=1){const g=r.getLine(o);if(!(g!=null&&g.isWrapped)||o===0)break;o-=1}let c="",h=-1;for(let m=o;m<o+_g;m+=1){const g=r.getLine(m);if(!g||m>o&&!g.isWrapped)break;m===a&&(h=c.length+n),c+=g.translateToString(!1)}return h<0?null:{text:c,index:h}}function XS(l,n,a){const r=VS(l,n,a);return r?qS(r.text,r.index):null}function ZS(l){try{const n=new URL(Kd(l));return n.host||n.pathname}catch{return""}}function wd(l){return!by(l)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Kd(l),"_blank","noopener,noreferrer"),!0)}async function Id(l){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(l),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let n=null,a=null,r=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=l,typeof window<"u"&&typeof window.getSelection=="function"&&(r=window.getSelection(),r&&r.rangeCount>0&&(a=r.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),r&&(r.removeAllRanges(),r.addRange(h)),n.setSelectionRange(0,l.length)}else n.focus({preventScroll:!0}),n.select();if(document.execCommand("copy"))return"exec"}catch{}finally{n!=null&&n.parentNode&&n.parentNode.removeChild(n),r&&(r.removeAllRanges(),a&&r.addRange(a))}}return"failed"}async function QS(){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 WS(){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 a of n){const r=a.types.find(o=>o.startsWith("image/"));if(r){const o=await a.getType(r);if(o&&o.size>0)return{ok:!0,blob:o}}}return{ok:!1,reason:"empty"}}catch(n){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const a=n==null?void 0:n.name;return a==="SecurityError"?{ok:!1,reason:"insecure"}:a==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function yy(l){const n=l.clipboardData;if(!n)return null;if(n.files&&n.files.length>0)for(let a=0;a<n.files.length;a++){const r=n.files[a];if(r!=null&&r.type.startsWith("image/"))return r}if(n.items&&n.items.length>0)for(let a=0;a<n.items.length;a++){const r=n.items[a];if(r!=null&&r.type.startsWith("image/")){const o=r.getAsFile();if(o)return o}}return null}function JS(l){if(!l||l.length===0)return null;for(let n=0;n<l.length;n++){const a=l[n];if(a&&(a.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(a.name)))return a}return null}const eC=({isOpen:l,onClose:n,onSend:a,onSendImage:r})=>{const{t:o}=Ne(),{addToast:c}=un(),[h,p]=C.useState(""),[m,g]=C.useState(null),[y,v]=C.useState(!1),x=C.useRef(null),w=C.useRef(null),M=C.useRef(null);C.useEffect(()=>{l&&(p(""),g(null),v(!1),x.current&&(x.current.value=""),w.current&&(w.current.value=""))},[l]);const T=async D=>{if(D.size===0){c("error",o("clipboard.fileEmpty"));return}v(!0);try{const R=await Hb(D);R?(g(R),p("")):c("error",o("clipboard.imageTooLarge"))}catch(R){console.error("Failed to process image:",R),c("error",o("clipboard.imageTooLarge"))}finally{v(!1)}},A=async D=>{const R=yy(D);R&&(D.preventDefault(),await T(R))},N=async D=>{const R=JS(D.target.files);D.target.value="",R&&await T(R)},E=D=>{const R=D.target.value;p(R),R&&m&&g(null)},_=()=>{g(null),x.current&&(x.current.value=""),w.current&&(w.current.value="")},z=()=>{m?(r==null||r(m),n()):h.trim()&&(a(h),n())},O=!!(h.trim()||m);return f.jsx(bo,{isOpen:l,onClose:n,title:o("clipboard.pasteTitle"),closeLabel:o("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(Ae,{variant:"ghost",onClick:n,children:o("clipboard.cancel")}),f.jsx(Ae,{variant:"primary",onClick:z,disabled:!O||y,children:o("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:o("clipboard.pasteHint")}),f.jsx("textarea",{ref:M,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:o("clipboard.pasteHint"),value:h,onChange:E,onPaste:A,disabled:!!m||y,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),f.jsxs("div",{className:"relative my-1",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-tui-border"})}),f.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:f.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:o("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:N}),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:N}),m?f.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[f.jsx("img",{src:m.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),f.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[f.jsx("span",{children:o("clipboard.imageCompressedSize",{size:t1(m.byteLength)})}),f.jsx(Ae,{variant:"ghost",onClick:_,"aria-label":o("clipboard.removeImage"),children:o("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Ae,{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":o("clipboard.chooseImage"),children:o("clipboard.chooseImage")}),f.jsx(Ae,{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":o("clipboard.takePhoto"),children:o("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:o("clipboard.imageCompressing")})})]})]})})},Vl="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Xl="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",tC=({anchorPoint:l,hasSelection:n,isController:a,vibrateOnKeyPress:r=!1,linkUrl:o=null,onOpenLink:c,onCopySelection:h,onCopyLine:p,onCopyScreen:m,onPaste:g,onClose:y})=>{const{t:v}=Ne(),x=C.useRef(null),[w,M]=C.useState(null);C.useEffect(()=>{if(r&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r]),C.useLayoutEffect(()=>{const E=x.current;if(!(E!=null&&E.parentElement))return;const _=E.parentElement.getBoundingClientRect(),z=E.getBoundingClientRect(),O=z.width||208,D=z.height||220,R=_.width,B=_.height;let H=l.x-O/2;H=Math.max(8,Math.min(Math.max(8,R-O-8),H));let q=l.y-D-8;q<8&&(q=l.y+8),q=Math.max(8,Math.min(Math.max(8,B-D-8),q)),M({x:H,y:q})},[l.x,l.y,n,a,o]);const T=Math.max(8,l.x-104),A=Math.max(8,l.y-200),N={position:"absolute",left:`${w?w.x:T}px`,top:`${w?w.y:A}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:N,onMouseDown:E=>E.stopPropagation(),onTouchStart:E=>E.stopPropagation(),onPointerDown:E=>E.stopPropagation(),children:f.jsxs(At,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[o&&c&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Vl,Xl),onClick:()=>{c(o),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Le.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:ZS(o)})]}),n&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Vl,Xl),onClick:()=>{h(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Le.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Vl,Xl),onClick:()=>{p(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Le.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Vl,Xl),onClick:()=>{m(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Le.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),a&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Vl,Xl),onClick:()=>{g(),y()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Le.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Vl,Xl),onClick:y,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Le.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},nC={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 iC(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function lC(l){const n=C.useRef([]),[a,r]=C.useState({framesPerSec:0,bytesPerSec:0}),o=C.useCallback(h=>{const p=h-1e3,m=n.current;for(;m.length>0&&m[0].time<p;)m.shift()},[]);C.useEffect(()=>{if(!l)return;const h=setInterval(()=>{o(performance.now());let p=0;for(const m of n.current)p+=m.bytes;r({framesPerSec:n.current.length,bytesPerSec:p})},1e3);return()=>clearInterval(h)},[l,o]);const c=C.useCallback(h=>{const p=performance.now();n.current.push({time:p,bytes:h}),o(p)},[o]);return{metrics:a,record:c}}function aC(l){return l?`${l.kind} row ${l.row} cols ${l.startCol}-${l.endCol} caret ${l.caretCol}`:"none"}function sC(l){var r;const n=(r=l==null?void 0:l.canvas)==null?void 0:r.stats;if(!n)return`paint: ${(l==null?void 0:l.kind)??"-"} renderer
|
|
34
|
-
`;const a=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: ${a}
|
|
35
|
-
`}function rC(l){const n=(l==null?void 0:l.getTrace())??[];return n.length===0?"trace: -":`trace:
|
|
36
|
-
${n.slice(-6).map(a=>` ${a.event}${a.count>1?` ×${a.count}`:""}`).join(`
|
|
37
|
-
`)}`}const oC=({debug:l,rttMs:n,metrics:a,rendererKind:r,predictiveEcho:o,predictor:c,field:h,renderer:p})=>{const m=c==null?void 0:c.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: ${l.state}
|
|
38
|
-
`,`deltaY: ${l.deltaY} lines: ${l.lines}
|
|
39
|
-
`,`viewportY: ${l.viewportY??"-"} focus: ${l.focused}
|
|
40
|
-
`,`buffer: ${l.bufferType??"-"} base: ${l.baseY??"-"} cursor: ${l.cursorY??"-"} scrollback: ${l.hasScrollback??"-"}
|
|
41
|
-
`,`scroll: ${l.scrollTop??"-"} / ${l.scrollHeight??"-"} (h ${l.clientHeight??"-"}) moved: ${l.moved}
|
|
42
|
-
`,`mode: ${l.scrollMode} calls: ${l.scrollCalls} lines: ${l.lastScrollLines??"-"} mouse: ${l.mouseTracking}
|
|
43
|
-
`,`event: ${l.lastInputEvent||"-"} pointer: ${l.pointerEvents} touch: ${l.touchEvents}
|
|
44
|
-
`,`rtt: ${n!==null?`${n}ms`:"-"} frames/s: ${a.framesPerSec} bytes/s: ${a.bytesPerSec} renderer: ${r??"-"}
|
|
45
|
-
`,`prediction: ${(c==null?void 0:c.getState())??"-"} mode: ${o} pending: ${(c==null?void 0:c.getVisiblePredictions().length)??0} srtt: ${m!=null?`${Math.round(m)}ms`:"-"}
|
|
46
|
-
`,`field: ${aC(h)} mismatches: ${(c==null?void 0:c.getMismatchCount())??0}
|
|
47
|
-
`,sC(p),rC(c)]})};function Xn(l){const n=C.useRef(l);return n.current=l,n}function cC(l){const n=Xn(l),{termRef:a,subscribeToPasteFileReady:r}=l,[o,c]=C.useState(!1),h=C.useCallback((v,x)=>{n.current.onPaste(),v.paste(x),n.current.addToast("success",n.current.t("clipboard.pasted"))},[n]),p=C.useCallback(()=>{const v=a.current;return v?n.current.isController?v:(n.current.warnViewerMode(),null):null},[a,n]),m=C.useCallback(async()=>{const v=p();if(v){try{const x=await WS();if(x.ok){await n.current.uploadImage(x.blob);return}}catch{}try{const x=await QS();if(x.ok){h(v,x.text);return}else if(x.reason==="empty"){n.current.addToast("info",n.current.t("clipboard.pasteUnavailable"));return}}catch{}c(!0)}},[p,h,n]),g=C.useCallback(v=>{const x=p();x&&h(x,v)},[p,h]),y=C.useCallback(v=>{p()&&n.current.uploadImage(v)},[p,n]);return C.useEffect(()=>r(v=>{const x=a.current;x&&h(x,v)}),[r,a,h]),{isPasteFallbackOpen:o,closePasteFallback:()=>c(!1),handlePaste:m,handleFallbackPasteSend:g,handleFallbackImageSend:y}}const Jr=new Set(["│","┃","║","▐","▕","▏","▌"]),co=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),uC=new Set(["╭","┌","┏","╔"]),dC=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),fC=new Set(["╮","┐","┓","╗"]),hC=new Set(["╰","└","┗","╚"]),mC=new Set(["╯","┘","┛","╝"]),Wu=new Set(["─","━","═","╌","┄"]),vy=new Set(["❯","›",">","!"]),jg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function An(l){return l===""||l===" "||l===" "}class pC{constructor(n){X(this,"cell");X(this,"top");X(this,"bottom");var a;this.screen=n,this.cell=(a=n.getNullCell)==null?void 0:a.call(n),this.top=n.baseY,this.bottom=n.baseY+n.rows-1}get cols(){return this.screen.cols}at(n,a){var r;if(!(n<this.top||n>this.bottom||a<0||a>=this.screen.cols))return(r=this.screen.getLine(n))==null?void 0:r.getCell(a,this.cell)}char(n,a){var r;return((r=this.at(n,a))==null?void 0:r.getChars())??""}dim(n,a){var r,o;return!!((o=(r=this.at(n,a))==null?void 0:r.isDim)!=null&&o.call(r))}text(n,a,r){var o;return n<this.top||n>this.bottom?"":((o=this.screen.getLine(n))==null?void 0:o.translateToString(!0,a,r))??""}isEdge(n,a){if(!Jr.has(this.char(n,a)))return!1;const r=this.char(n-1,a),o=this.char(n+1,a);return Jr.has(r)||co.has(r)||Jr.has(o)||co.has(o)}blankOrDim(n,a,r){var o;for(let c=a;c<r;c++){const h=this.at(n,c);if(h&&!An(h.getChars())&&!((o=h.isDim)!=null&&o.call(h)))return!1}return!0}}function gC(l,n,a){if(l.isEdge(n,a))return null;let r=0;for(let c=a-1;c>=0;c--)if(l.isEdge(n,c)){r=c+1;break}let o=l.cols;for(let c=a+1;c<l.cols;c++)if(l.isEdge(n,c)){o=c;break}return r<o?{start:r,end:o}:null}const Sd=8,bC=12,Cd=2,Og=1,yC=4,vC=3,xC=20,Dg=/-- INSERT --/,wC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,SC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,CC=/^\s*\d+[.)]\s/;function zg(l,n,a){if(!Wu.has(l.char(n,a.start))||!Wu.has(l.char(n,a.end-1))||co.has(l.char(n,a.start-1)))return!1;const r=a.end-a.start;let o=0;for(let c=a.start;c<a.end;c++)if(Wu.has(l.char(n,c)))o++;else if(c-a.start-o>r*.1)return!1;return o>=r*.9}function la(l){return`${l.start}-${l.end}`}function xy(l,n,a){if(a.start===0)return l.top;for(let r=n-1;r>=l.top;r--)if(dC.has(l.char(r,a.start-1)))return r;return l.top}function TC(l,n,a){const r=a.start-1,o=a.end,{row:c}=n;if(r<0||o>=l.cols)return null;const h=l.char(c,r);if(!Jr.has(h)||l.char(c,o)!==h)return null;let p=c-1;for(;p>=l.top&&l.char(p,r)===h;)p--;let m=c+1;for(;m<=l.bottom&&l.char(m,r)===h;)m++;if(m-p-1>Sd||!uC.has(l.char(p,r))||!fC.has(l.char(p,o))||!hC.has(l.char(m,r))||!mC.has(l.char(m,o))||l.dim(c,r))return null;const g=a.start+Og,y=a.end-Og;return n.col<g||n.col>=y?null:{kind:"frame",key:`frame:${la(a)}`,region:la(a),layout:`${p}`,row:c,caretCol:n.col,startCol:g,endCol:y,empty:p+2===m&&n.col===g&&l.blankOrDim(c,g,y),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function MC(l,n,a){const{row:r}=n;let o=-1;for(let y=r-1;y>=Math.max(l.top,r-Sd);y--)if(zg(l,y,a)){o=y;break}if(o<0)return null;let c=-1;for(let y=r+1;y<=Math.min(l.bottom,r+Sd);y++)if(zg(l,y,a)){c=y;break}if(c<0)return null;const h=o+1;let p=-1;for(let y=a.start;y<Math.min(a.end,a.start+3);y++){const v=l.char(h,y);if(!An(v)){vy.has(v)&&An(l.char(h,y+1))&&(p=y);break}}if(p<0||l.dim(h,p)||CC.test(l.text(h,p+1,a.end)))return null;for(let y=h+1;y<c;y++)for(let v=a.start;v<a.start+Cd;v++)if(!An(l.char(y,v)))return null;let m="";for(let y=c+1;y<=Math.min(l.bottom,c+bC)&&!co.has(l.char(y,a.start-1));y++)m+=`${l.text(y,a.start,a.end)}
|
|
48
|
-
`;if(SC.test(m)||wC.test(m))return null;const g=r===h?p+2:a.start+Cd;return n.col<g||n.col>=a.end?null:{kind:"rule",key:`rule:${la(a)}:${xy(l,o,a)}`,region:la(a),layout:`${o}`,row:r,caretCol:n.col,startCol:g,endCol:a.end,empty:c-o===2&&n.col===g&&l.blankOrDim(r,g,a.end),agentLike:!0,vimInsert:Dg.test(m),modal:Dg.test(m),midWord:!1}}function AC(l,n,a){if(n.hidden)return null;const{row:r,col:o}=n,c=EC(l,n,a);if(c!==void 0)return c;for(let h=o-1;h>=a.start;h--){if(l.char(r,h)!==">")continue;const p=l.text(r,a.start,h+1).trimStart();if(/^(?:[a-z]:\\.*|\\\\[^\\]+\\[^\\]+.*|PS\s+[a-z]:\\.*)>$/i.test(p))return eo(l,n,a,r,h+1,!1)}for(let h=o-2;h>=a.start;h--)if(!(!jg.has(l.char(r,h))||!An(l.char(r,h+1))))return l.dim(r,h)?null:eo(l,n,a,r,h+2,h===a.start);for(let h=r-1;h>=Math.max(l.top,r-vC);h--){let p=a.end-1;for(;p>=a.start&&An(l.char(h,p));)p--;if(p>=a.end-1-yC&&jg.has(l.char(h,p)))return l.dim(h,p)?null:eo(l,n,a,h,a.start,!1);if(p<a.end-1)return null}return null}function EC(l,n,a){const{row:r}=n,o=a.start+Cd,c=h=>An(l.char(h,a.start))&&An(l.char(h,a.start+1));if(c(r))for(let h=r-1;h>=Math.max(l.top,r-xC);h--){if(vy.has(l.char(h,a.start))&&An(l.char(h,a.start+1)))return l.dim(h,a.start)?null:eo(l,n,a,h,o,!0,o);if(!c(h)||l.blankOrDim(h,o,a.end))return}}function eo(l,n,a,r,o,c,h=a.start){const p=n.row===r?o:h;if(n.col<p||n.col>=a.end)return null;const m=a.end-2,g=n.row>r&&h>a.start&&n.col===p&&!An(l.char(n.row-1,m));return{kind:"prompt",key:`prompt:${la(a)}:${xy(l,r,a)}`,region:la(a),layout:`${r}`,row:n.row,caretCol:n.col,startCol:p,endCol:a.end,empty:n.row===r&&n.col===p&&l.blankOrDim(n.row,p,a.end),agentLike:c,vimInsert:null,modal:!1,midWord:g}}function NC(l,n){const a=new pC(l);if(n.row<a.top||n.row>a.bottom||n.col<0||n.col>=l.cols)return null;const r=gC(a,n.row,n.col);return r?TC(a,n,r)??MC(a,n,r)??AC(a,n,r):null}class kC{constructor(){X(this,"insertSeen",new Set)}detect(n,a){const r=NC(n,a);return!r||r.vimInsert===null?r:r.vimInsert?(this.insertSeen.add(r.region),r):this.insertSeen.has(r.region)?null:r}reset(){this.insertSeen.clear()}}class LC{constructor(n){X(this,"tracker",new kC);X(this,"cached");X(this,"lastComplete",null);X(this,"detect",()=>{var n,a;if((a=(n=this.options).isSynchronizing)!=null&&a.call(n))return this.lastComplete;if(this.cached===void 0){const r=this.options.getScreen(),o=this.options.getCursor();this.cached=r&&o?this.tracker.detect(r,o):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 Ql=4294967295;var Qe=(l=>(l[l.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",l[l.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",l[l.WIDTH_SHIFT=22]="WIDTH_SHIFT",l))(Qe||{}),We=(l=>(l[l.PCOLOR_MASK=255]="PCOLOR_MASK",l[l.CM_MASK=50331648]="CM_MASK",l[l.CM_DEFAULT=0]="CM_DEFAULT",l[l.CM_P16=16777216]="CM_P16",l[l.CM_P256=33554432]="CM_P256",l[l.CM_RGB=50331648]="CM_RGB",l[l.RGB_MASK=16777215]="RGB_MASK",l))(We||{}),rt=(l=>(l[l.INVERSE=67108864]="INVERSE",l[l.BOLD=134217728]="BOLD",l[l.UNDERLINE=268435456]="UNDERLINE",l[l.BLINK=536870912]="BLINK",l[l.INVISIBLE=1073741824]="INVISIBLE",l[l.STRIKETHROUGH=2147483648]="STRIKETHROUGH",l))(rt||{}),Ri=(l=>(l[l.ITALIC=67108864]="ITALIC",l[l.DIM=134217728]="DIM",l[l.HAS_EXTENDED=268435456]="HAS_EXTENDED",l[l.PROTECTED=536870912]="PROTECTED",l[l.OVERLINE=1073741824]="OVERLINE",l))(Ri||{}),Wl=(l=>(l[l.NONE=0]="NONE",l[l.SINGLE=1]="SINGLE",l[l.DOUBLE=2]="DOUBLE",l[l.CURLY=3]="CURLY",l[l.DOTTED=4]="DOTTED",l[l.DASHED=5]="DASHED",l))(Wl||{});function RC(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const wy={fg:0,bg:0,ext:0};function Sy(l){return l.bg&268435456&&l.extended?l.extended.ext>>>0:0}function _C(l){return l>>>26&7}function jC(l){return l&67108863}function OC(l,n){const a=l.codePointAt(0)??0;return l.length>0&&String.fromCodePoint(a).length===l.length?{content:a|n<<22,combinedData:""}:{content:2097152|n<<22,combinedData:l}}function Cy(l){const n=l;return!n||typeof n.fg!="number"||typeof n.bg!="number"?null:{fg:n.fg>>>0,bg:n.bg>>>0,ext:Sy(n)}}class DC{constructor(n){X(this,"items",[]);X(this,"target",null);X(this,"provider",()=>this.paint());this.options=n}attach(n){var a;this.target!==n&&((a=this.target)==null||a.setOverlayProvider(null),this.target=n,n==null||n.setOverlayProvider(this.provider))}sync(n){var a;n.length===0&&this.items.length===0||(this.items=n,(a=this.target)==null||a.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(),a=n==null?void 0:n.buffer.active;if(!n||!a)return null;const r=this.options.isCursorHidden(),o=a.baseY+a.cursorY,c=a.cursorX,h=Td(n,o,c),p=r&&!!h&&Ty(h);if(this.items.length===0){if(!p)return null;const M=((w=(x=a.getLine(o))==null?void 0:x.getCell(c))==null?void 0:w.getChars())??"";return{cells:[],paintedCaret:Hg(o,c,M,h)}}const m=[];let g,y;for(const M of this.items)switch(M.kind){case"char":m.push({row:M.row,col:M.col,chars:M.char,width:M.width,style:M.style??HC(n,M.row,M.col)});break;case"erase":m.push({row:M.row,col:M.col,chars:" ",width:M.width,style:zC(M.style??Td(n,M.row,M.col)??wy)});break;case"mask":p&&M.row===o&&M.col===c&&m.push({row:M.row,col:M.col,chars:M.char,width:1,style:M.style??My(h)});break;case"caret":r?p&&(m.push({row:M.row,col:M.col,chars:M.char,width:1,style:h}),y=Hg(M.row,M.col,M.char,h)):g={row:M.row,col:M.col};break}const v={cells:m};return g!==void 0&&(v.cursor=g),y&&(v.paintedCaret=y),v}}function Hg(l,n,a,r){return{row:l,col:n,style:r,plain:{row:l,col:n,chars:a||" ",width:1,style:My(r)}}}function Td(l,n,a){var r;return a<0||a>=l.cols?null:Cy((r=l.buffer.active.getLine(n))==null?void 0:r.getCell(a))}function Ty(l){return(l.fg&rt.INVERSE)!==0||(l.bg&We.CM_MASK)!==We.CM_DEFAULT}function My(l){return{fg:l.fg&~rt.INVERSE,bg:l.bg&~(We.CM_MASK|We.RGB_MASK),ext:l.ext}}function zC(l){return{fg:l.fg&rt.INVERSE?l.fg&(rt.INVERSE|We.CM_MASK|We.RGB_MASK):0,bg:l.bg&(We.CM_MASK|We.RGB_MASK),ext:0}}function HC(l,n,a){const r=Td(l,n,a-1);return r&&!Ty(r)&&!(r.bg&Ri.DIM)?r:wy}const Ay="\x1B",BC=/^\x1b\[[IO]/,Ey=/^\x1b\[<(\d+);\d+;\d+[Mm]/,UC=/^\x1b\[M[\s\S]{3}/,KC=[/^\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\\/],IC=/^\x1b\[1;[2-8]R/;function Bg(l){if(IC.test(l))return 0;const n=BC.exec(l);if(n)return n[0].length;const a=Ey.exec(l);if(a){const r=Number(a[1]);return(r&32)!==0&&(r&3)===3&&(r&64)===0?a[0].length:0}for(const r of KC){const o=r.exec(l);if(o)return o[0].length}return 0}function Ny(l){if(!l.startsWith(Ay))return"keys";if(Ey.test(l)||UC.test(l)){let a=l;for(;a.length>0;){const r=Bg(a);if(r===0)return"pointer";a=a.slice(r)}return"passive"}let n=l;for(;n.length>0;){const a=Bg(n);if(a===0)return"keys";n=n.slice(a)}return"passive"}function FC(l){return l===Ay}function Zn(l){return l===""||l===" "?" ":l}function GC(l,n,a,r=64){var h;const o=l.buffer.active.getLine(n),c=[];for(let p=a-1;p>=0&&c.length<r;p--){const m=o==null?void 0:o.getCell(p);if(!m)break;((h=m.getWidth)==null?void 0:h.call(m))!==0&&c.unshift(Zn(m.getChars()))}return c}function YC(l,n){for(let a=Math.min(l.length,n.length);a>0;a--){let r=!0;for(let o=0;o<a&&r;o++)r=n[n.length-a+o]===Zn(l[o]);if(r)return a}return 0}function PC(l){const n=l.buffer.active;return{key:"legacy",row:n.baseY+n.cursorY,caretCol:n.cursorX,startCol:n.cursorX,endCol:l.cols,empty:!1,agentLike:!1}}function $C(l,{style:n,predictedCursor:a,field:r,runStartedEmpty:o,active:c}){var w,M,T,A,N;const h=l.map(E=>{const _={row:E.row,col:E.col,char:E.cancelled?" ":E.char,width:E.width,kind:E.cancelled?"erase":E.kind};return n&&(_.style=n),_}),p=l[l.length-1],m=a??{row:p.row,col:p.kind==="erase"||p.cancelled?p.col:p.col+p.width},g=(E,_)=>h.some(z=>z.row===E&&z.col<=_&&_<z.col+z.width),y=l.some(E=>E.kind==="char"&&!E.cancelled);if(c&&r&&o&&y&&r.agentLike&&m.row===r.row){const E=c.getLine(m.row);for(let _=m.col;_<r.endCol;_++){if(g(m.row,_)||Zn(((w=E==null?void 0:E.getCell(_))==null?void 0:w.getChars())??"")===" ")continue;const z={row:m.row,col:_,char:" ",width:1,kind:"erase"};n&&(z.style=n),h.push(z)}}if(c){const E={row:c.baseY+c.cursorY,col:c.cursorX};if(!g(E.row,E.col)&&(E.row!==m.row||E.col!==m.col)){const _=((T=(M=c.getLine(E.row))==null?void 0:M.getCell(E.col))==null?void 0:T.getChars())??"",z={row:E.row,col:E.col,char:Zn(_),width:1,kind:"mask"};n&&(z.style=n),h.push(z)}}const v=h.find(E=>E.row===m.row&&E.col===m.col&&E.kind!=="mask"),x=v?v.char:Zn(((N=(A=c==null?void 0:c.getLine(m.row))==null?void 0:A.getCell(m.col))==null?void 0:N.getChars())??"");return h.push({row:m.row,col:m.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 ky(l){if(l>=32&&l<=126)return 1;if(l<12288)return 0;for(const[n,a]of qC){if(l<n)return 0;if(l<=a)return 2}return 0}const Ug=8,VC=1500,XC=4e3,ZC=20;class QC{constructor(n){X(this,"getTerminal");X(this,"getFieldOption");X(this,"charWidth");X(this,"now");X(this,"textDecoder",new TextDecoder("utf-8"));X(this,"confidentKeys",new Set);X(this,"fieldStyles",new Map);X(this,"field",null);X(this,"runStartedEmpty",!1);X(this,"predictions",[]);X(this,"predictedCursor",null);X(this,"srtt",null);X(this,"isSuppressed",!1);X(this,"suppressCursor",null);X(this,"suppressSentAt",0);X(this,"inFlight",[]);X(this,"inFlightUnknown",!1);X(this,"runInFlight",[]);X(this,"probationRun",!1);X(this,"runSent",[]);X(this,"lastSentUndrawn",!1);X(this,"awaitingPrefixCommand",!1);X(this,"mismatches",0);X(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(r=>r.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,a){var c;this.predictions=[],this.predictedCursor=null;const r=typeof a=="boolean"?a:(a==null?void 0:a.suppress)??!0,o=typeof a=="object"&&(a==null?void 0:a.demote)===!0;if(this.note(`reset: ${n??"unspecified"}`),o){const h=this.field??((c=this.getFieldOption)==null?void 0:c.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),r){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(a=>a.frozenFrom?a.shownWhenFrozen:n&&!a.probation)}freeze(n,a={}){var m;const r=this.getTerminal(),o=r?{row:r.buffer.active.baseY+r.buffer.active.cursorY,col:r.buffer.active.cursorX}:null,c=this.getState()==="confident";this.predictions=this.predictions.filter(g=>!g.cancelled);for(const g of this.predictions)g.frozenFrom||(g.frozenFrom=o??{row:g.row,col:g.col},g.shownWhenFrozen=c&&!g.probation);const h=this.predictedCursor?{...this.predictedCursor}:o,p=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${n}${a.demote?" (demote)":""}`),a.demote){const g=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=p}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(XC,Math.max(VC,(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 r;const a=(r=this.charWidth)==null?void 0:r.call(this,n);return a===0||a===1||a===2?a:1}coveredByPrediction(n,a){return this.predictions.some(r=>(r.echoed||r.cancelled||r.kind==="erase"&&!r.frozenFrom)&&r.row===n&&r.col<=a&&a<r.col+r.width)}ensureField(n){if(this.predictedCursor&&this.field)return this.field;const a=this.getFieldOption?this.getFieldOption():PC(n);if(!a)return null;let r=a.caretCol,o=[],c=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){o=this.inFlight.slice(YC(this.inFlight,GC(n,a.row,r)));for(const h of o){const p=h.codePointAt(0)??0;r+=ky(p)||this.assumedWidth(p)}c=o.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=a,this.runStartedEmpty=a.empty&&o.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:a.row,col:r},this.runInFlight=o,this.probationRun=c,this.runSent=[],a}confirm(n,a){if(this.updateSrtt(Math.max(0,this.now()-n.sentAt)),a&&!n.frozenFrom&&this.markConfident(a.key),n.probation&&n.kind==="char"){for(const r of this.predictions)r.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(n,a){const r=Cy(a);if(r)for(this.fieldStyles.delete(n),this.fieldStyles.set(n,r);this.fieldStyles.size>Ug;){const o=this.fieldStyles.keys().next().value;if(o===void 0)break;this.fieldStyles.delete(o)}}markConfident(n){for(this.confidentKeys.delete(n),this.confidentKeys.add(n);this.confidentKeys.size>Ug;){const a=this.confidentKeys.values().next().value;if(a===void 0)break;this.confidentKeys.delete(a)}}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 a=this.trace[this.trace.length-1];if(a&&a.event===n){a.count++,a.at=this.now();return}this.trace.push({at:this.now(),event:n,count:1}),this.trace.length>ZC&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const n=this.now(),a=this.predictionTimeout(),r=this.predictions.filter(o=>n-o.sentAt<=a);r.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=r,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(n){this.srtt===null?this.srtt=n:this.srtt=this.srtt*.8+n*.2}}const WC="?!#";class JC extends QC{handlePrintable(n,a,r){var M;const o=this.ensureField(r);if(!o||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const c=this.predictedCursor,h=this.predictions.every(T=>T.frozenFrom||T.cancelled)&&c.col===o.caretCol;if(o.agentLike&&o.empty&&h&&WC.includes(n))return this.freeze("agent mode switch"),!1;if(o.midWord&&h)return this.freeze("the word above may move down"),!1;if(c.col+a>o.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const p=(M=r.buffer.active.getLine(c.row))==null?void 0:M.getCell(c.col),m=[Zn(p?p.getChars():"")],g=this.predictions.findIndex(T=>T.kind==="erase"&&!T.frozenFrom&&T.row===c.row&&T.col===c.col);let y;g>=0&&([y]=this.predictions.splice(g,1),m.push(...y.before," "));for(const T of this.predictions)T.cancelled&&T.row===c.row&&T.col===c.col&&m.push(T.char);const v=r.buffer.active,x=v.baseY+v.cursorY,w=x>c.row||x===c.row&&v.cursorX>c.col;return this.predictions.push({row:c.row,col:c.col,char:n,width:a,kind:"char",before:m,sentAt:this.now(),replaces:y,probation:this.probationRun||void 0,behindCaret:w||void 0}),this.probationRun&&this.runSent.push(n),this.lastSentUndrawn=!1,c.col+=a,!0}skipUnpredictable(n,a,r){const o=this.ensureField(r),c=this.predictedCursor;if(!o||!c)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(a);return c.col+h>o.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,c.col+=h,this.note("width unknown: guessing"),!0)}handleBackspace(n){var r,o,c;let a;for(let h=this.predictions.length-1;h>=0&&!a;h--)this.predictions[h].cancelled||(a=this.predictions[h]);if(this.predictedCursor&&a&&!a.frozenFrom&&!a.echoed&&a.kind==="char"&&a.row===this.predictedCursor.row&&a.col+a.width===this.predictedCursor.col)return a.cancelled=!0,a.probation&&this.runSent.pop(),this.predictedCursor.col=a.col,a.replaces&&(this.predictions.splice(this.predictions.indexOf(a),0,a.replaces),a.replaces=void 0),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(n),p=this.predictedCursor;if(h&&p){const m=n.buffer.active.getLine(p.row),g=m==null?void 0:m.getCell(p.col-1),y=g&&((r=g.getWidth)==null?void 0:r.call(g))===0?2:1,v=p.col-y;let x=!0;for(let M=p.col;M<h.endCol&&x;M++)x=this.coveredByPrediction(p.row,M)||Zn(((o=m==null?void 0:m.getCell(M))==null?void 0:o.getChars())??"")===" ";const w=Zn(((c=m==null?void 0:m.getCell(v))==null?void 0:c.getChars())??"");if(v>h.startCol&&x&&w!==" ")return this.predictions=this.predictions.filter(M=>!(M.echoed&&M.row===p.row&&M.col+M.width>v)),this.predictions.push({row:p.row,col:v,char:" ",width:y,kind:"erase",before:[w],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,p.col=v,!0}}return this.freeze("backspace into server content"),!1}}const eT=2;class tT extends JC{handleUserInput(n){var h;if(this.pruneExpired(),n.length===0)return;const a=this.textDecoder.decode(n,{stream:!1});if(!a)return;const r=Ny(a);if(r==="passive")return;if(r==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(FC(a)){const p=this.field??((h=this.getFieldOption)==null?void 0:h.call(this))??null;this.freeze("escape",{demote:(p==null?void 0:p.modal)!==!1});return}const o=this.getTerminal();if(!o){this.reset("terminal unavailable",!0);return}const c=Array.from(a);for(let p=0;p<c.length;p++){const m=c[p],g=m.codePointAt(0);if(g===void 0)continue;if(g===eT){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(o)){p<c.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(m),this.note("refused: waiting for the caret to move");continue}const y=ky(g);if(y===0){if(!this.skipUnpredictable(m,g,o)){p<c.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(m,y,o)){p<c.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const n=this.getTerminal(),a=n?{row:n.buffer.active.baseY+n.buffer.active.cursorY,col:n.buffer.active.cursorX}:null;this.pruneExpired(),n&&a&&this.predictions.length>0&&this.settle(n,a),this.updateSuppression(a)}settle(n,a){var h,p;const r=this.field;if(this.getFieldOption){const m=this.getFieldOption();if(!m||m.key!==(r==null?void 0:r.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(m.layout!==r.layout){this.predictions=[],this.predictedCursor=null,this.field=m,this.note("layout changed");return}}let o=[],c=!1;for(const m of this.predictions){if(m.cancelled){if(!c){const T=a.row>m.row||a.row===m.row&&a.col>=m.col+m.width;if(T||(m.behindCaret=void 0),m.passed&&!T)continue;T&&!m.behindCaret&&(m.passed=!0)}o.push(m),c=!0;continue}const g=(h=n.buffer.active.getLine(m.row))==null?void 0:h.getCell(m.col),y=Zn(g?g.getChars():""),v=m.kind==="char"?y===m.char&&(m.width===1||(((p=g==null?void 0:g.getWidth)==null?void 0:p.call(g))??2)===2):y===" ",x=m.before.includes(y);m.behindCaret&&(a.row<m.row||a.row===m.row&&a.col<=m.col)&&(m.behindCaret=void 0);const w=m.kind==="char"?(a.row>m.row||a.row===m.row&&a.col>=m.col+m.width)&&!(m.behindCaret&&x):a.row<m.row||a.row===m.row&&a.col<=m.col,M=m.kind==="char"&&y===m.char&&!v;if(c&&!m.frozenFrom){if(!v||x){o.push(m);continue}o=o.filter(T=>!T.cancelled),c=!1}if(!(m.echoed&&!v))if(v&&(w||!x)){if(m.echoed||this.confirm(m,r),w){m.kind==="char"&&r&&!m.frozenFrom&&this.learnStyle(r.key,g);continue}m.echoed=!0,o.push(m)}else if(m.frozenFrom){const T=m.frozenFrom,A=m.kind==="erase"||a.col>=T.col;!w&&a.row===T.row&&A?o.push(m):w&&m.probation&&(this.inFlightUnknown=!0)}else if(!w&&!M)o.push(m);else if(m.probation){this.note("probation guess dropped"),this.predictions.some(T=>!T.frozenFrom&&T.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(T=>T.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(y)} for ${JSON.stringify(m.char)}`);return}}this.predictions=o,o.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 a;this.pruneExpired();const n=this.visiblePredictions();return n.length===0?[]:$C(n,{style:this.field?this.fieldStyles.get(this.field.key):void 0,predictedCursor:this.predictedCursor,field:this.field,runStartedEmpty:this.runStartedEmpty,active:(a=this.getTerminal())==null?void 0:a.buffer.active})}}const nT=25,iT=2026,lT=1e3;function aT(l,n=()=>performance.now()){let a=!1,r=null;const o=new Set,c=y=>(o.add(y),{dispose:()=>void o.delete(y)}),h=()=>{a=!1,r=null},p=l.parser;if(!p||typeof p.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:c,reset:h,dispose:()=>{}};const m=y=>v=>{for(const x of v.flat())if(x===nT&&(a=!y),x===iT){const w=!y&&r!==null;if(r=y?n():null,w)for(const M of[...o])M()}return!1},g=[p.registerCsiHandler({prefix:"?",final:"h"},m(!0)),p.registerCsiHandler({prefix:"?",final:"l"},m(!1)),p.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof p.registerEscHandler=="function"&&g.push(p.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>a,isSynchronizing:()=>r!==null&&n()-r<lT,onSyncEnd:c,reset:h,dispose:()=>{for(const y of g)y.dispose();o.clear()}}}const sT=40;function rT(l,n){return l==="off"?!1:l==="always"?!0:n!==null&&n>sT}function oT(l,n){var p;const a=aT(l),r=new LC({getScreen:()=>{const m=n();if(!m)return null;const g=m.buffer.active;return{cols:m.cols,rows:m.rows,baseY:g.baseY,getLine:y=>g.getLine(y),getNullCell:typeof g.getNullCell=="function"?()=>g.getNullCell():void 0}},getCursor:()=>{var g;const m=(g=n())==null?void 0:g.buffer.active;return m?{row:m.baseY+m.cursorY,col:m.cursorX,hidden:a.isCursorHidden()}:null},isSynchronizing:a.isSynchronizing}),o=(p=l._core)==null?void 0:p.unicodeService,c=new tT({getTerminal:n,getField:r.detect,charWidth:typeof(o==null?void 0:o.wcwidth)=="function"?m=>o.wcwidth(m):void 0}),h=new DC({getTerminal:n,isCursorHidden:()=>a.isCursorHidden()});return{screenState:a,fieldProbe:r,predictor:c,overlay:h}}function cT({termRef:l,rendererRef:n,mode:a,connectionState:r,observeKeyInput:o}){const c=C.useRef(null),h=C.useRef(null),p=C.useRef(null),m=Xn(a),g=C.useCallback(()=>{const T=c.current,A=h.current;if(!(!T||!A)){if(!rT(m.current,T.getEchoSrttMs())){A.clear();return}A.sync(T.getOverlayItems())}},[m]),y=C.useCallback(T=>{var A,N,E,_;(A=c.current)==null||A.reset(T),(N=c.current)==null||N.forgetConfidence(),(E=p.current)==null||E.reset(),(_=h.current)==null||_.clear()},[]),v=C.useCallback(T=>{var A,N;(A=c.current)==null||A.reset(T),(N=h.current)==null||N.clear()},[]),x=C.useCallback(T=>{var A,N,E;(A=c.current)==null||A.handleUserInput(T),g(),(E=(N=n.current)==null?void 0:N.canvas)==null||E.markInput()},[g,n]),w=C.useCallback(T=>{const A=oT(T,()=>l.current);return p.current=A.fieldProbe,c.current=A.predictor,h.current=A.overlay,A},[l]),M=C.useCallback(()=>{var T;(T=h.current)==null||T.dispose(),h.current=null,c.current=null,p.current=null},[]);return C.useEffect(()=>o(x),[o,x]),C.useEffect(()=>{g()},[a,g]),C.useEffect(()=>{y("connectionState")},[r,y]),{predictorRef:c,overlayRef:h,fieldProbeRef:p,attach:w,detach:M,sync:g,forget:y,discard:v,onUserInput:x}}const uT=20,dT=6,fT=500,hT=300,aa=13,Ly=.602,Ry=1.3;function Vn(l,n){return Number.isFinite(l)&&l>0?l:n}function Kg(l,n,a){return Math.min(a,Math.max(n,l))}function _y(l){const{width:n,height:a,cellWidth:r,cellHeight:o,minCols:c=uT,minRows:h=dT,maxCols:p=fT,maxRows:m=hT}=l,g=Vn(r,aa*Ly),y=Vn(o,aa*Ry);return{cols:Kg(Math.floor(Vn(n,0)/g),c,p),rows:Kg(Math.floor(Vn(a,0)/y),h,m)}}function sl(l,n=aa){var r,o,c;if(l)try{const h=l._core,p=(c=(o=(r=h==null?void 0:h._renderService)==null?void 0:r.dimensions)==null?void 0:o.css)==null?void 0:c.cell;if(p!=null&&p.width&&p.width>0&&p.height&&p.height>0)return{cellWidth:p.width,cellHeight:p.height,measured:!0}}catch{}const a=Vn(n,aa);return{cellWidth:Math.round(a*Ly*100)/100,cellHeight:Math.round(a*Ry*100)/100,measured:!1}}function mT(l){var r;const n=(r=l==null?void 0:l.querySelector)==null?void 0:r.call(l,".xterm-viewport");if(!n)return 0;const a=(n.offsetWidth||0)-(n.clientWidth||0);return Number.isFinite(a)&&a>0?a:0}function Md(l,n,a){if(!l)return{width:n,height:a};let r=0,o=0;if(typeof l.getBoundingClientRect=="function"){const c=l.getBoundingClientRect();r=(c==null?void 0:c.width)||0,o=(c==null?void 0:c.height)||0}return{width:Vn(r,Vn(l.clientWidth,n)),height:Vn(o,Vn(l.clientHeight,a))}}function jy(l,n,a,r){const o=Number.isFinite(r)&&r>.01?r:1;return{clientX:a.left+(l-a.left)/o,clientY:a.top+(n-a.top)/o}}function Ig(l,n){const a=typeof window<"u"?window:void 0,r=a&&typeof a.devicePixelRatio=="number"&&a.devicePixelRatio>0?a.devicePixelRatio:1,o=a!=null&&a.visualViewport&&typeof a.visualViewport.scale=="number"&&a.visualViewport.scale>0?a.visualViewport.scale:1,c=Math.max(0,l.width),h=Math.max(0,l.height),p=Math.round(c*r*100)/100,m=Math.round(h*r*100)/100;return{dpr:r,scale:o,cssWidth:c,cssHeight:h,physicalWidth:p,physicalHeight:m}}function pT(l){const{lastSnapshot:n,currentSnapshot:a,physicalTolerancePx:r=6}=l;if(!n)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const o=Math.abs(a.scale-n.scale)>.01,c=Math.abs(a.scale-1)>.01;if(o||c)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(a.dpr-n.dpr)>.01){const g=Math.abs(a.physicalWidth-n.physicalWidth),y=Math.abs(a.physicalHeight-n.physicalHeight);if(g<=r&&y<=r)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const p=Math.abs(a.cssWidth-n.cssWidth),m=Math.abs(a.cssHeight-n.cssHeight);return p<1&&m<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const gT=250;function bT({termRef:l,containerRef:n,frameRef:a,surfaceRef:r,currentScaleRef:o,rendererRef:c,initialBannerWrittenRef:h,isActiveRef:p,sendResize:m,onResized:g}){const y=Xn(m),v=Xn(g),x=C.useRef({cols:0,rows:0}),w=C.useRef(null),M=C.useRef(null),T=C.useRef(null),A=C.useRef(null),N=C.useRef({width:0,height:0}),E=C.useRef(null),_=C.useRef(!1),z=C.useCallback(($,W)=>{!Number.isFinite($)||!Number.isFinite(W)||$<=0||W<=0||$===x.current.cols&&W===x.current.rows||(w.current={cols:$,rows:W},!M.current&&(M.current=setTimeout(()=>{M.current=null;const le=w.current;w.current=null,le&&(le.cols===x.current.cols&&le.rows===x.current.rows||(x.current=le,y.current(le.cols,le.rows),v.current()))},gT)))},[y,v]),O=C.useCallback(($=!1)=>{var ye;const W=l.current,le=n.current,oe=r.current,I=a.current;if(!W||!le||!oe||!I)return;const k=Md(le,ea(),rd());if(k.width<=0||k.height<=0)return;I.style.width="100%",I.style.height="100%",oe.style.width="100%",oe.style.height="100%",oe.style.transform="none",oe.style.transformOrigin="top left",o.current=1;const Y=Ig(k),Q=pT({lastSnapshot:E.current,currentSnapshot:Y});if(Q.isVisualZoom&&!$){E.current=Y;try{W.refresh(0,Math.max(0,W.rows-1))}catch{}return}if(Q.shouldIgnore&&!$)return;E.current=Y;const ae=sl(W,aa),Z=_y({width:k.width-mT(oe),height:k.height,cellWidth:ae.cellWidth,cellHeight:ae.cellHeight}),ge=Math.abs(k.width-N.current.width)>1||Math.abs(k.height-N.current.height)>1;if(W.cols!==Z.cols||W.rows!==Z.rows)try{W.resize(Z.cols,Z.rows)}catch(Me){console.debug("Error resizing terminal grid:",Me)}h.current&&!_.current&&(ge||W.cols!==Z.cols||W.rows!==Z.rows)&&(_.current=!0,(ye=c.current)==null||ye.verify());const be=Z.cols!==x.current.cols||Z.rows!==x.current.rows;p.current&&(ge||$||be)&&(N.current={width:k.width,height:k.height},z(Z.cols,Z.rows));try{W.refresh(0,Math.max(0,W.rows-1))}catch{}},[l,n,r,a,o,c,h,p,z]),D=C.useRef(O);D.current=O;const R=C.useCallback(()=>{if(T.current===null){if(typeof requestAnimationFrame!="function"){D.current();return}T.current=requestAnimationFrame(()=>{T.current=null,D.current()})}},[]),B=C.useCallback(($=30)=>{A.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(A.current),A.current=null);let W=0;const le=()=>{A.current=null,W++;const oe=W>=$;D.current(!0),!oe&&W<2&&typeof requestAnimationFrame=="function"&&(A.current=requestAnimationFrame(le))};typeof requestAnimationFrame=="function"?A.current=requestAnimationFrame(le):le()},[]),H=C.useCallback($=>{N.current={width:$.width,height:$.height},E.current=Ig($)},[]),q=C.useCallback(()=>{M.current&&(clearTimeout(M.current),M.current=null),T.current!==null&&(cancelAnimationFrame(T.current),T.current=null),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null)},[]);return{requestFit:R,scheduleBoundedFit:B,seedFit:H,cancelPendingFits:q}}const yT=" ()[]{}'\"\\`";function vT(l,n,a,r=1){var A,N;if(!((A=n==null?void 0:n.buffer)!=null&&A.active)||n.cols<=0||n.rows<=0)return null;const o=a||((N=n.element)==null?void 0:N.querySelector(".xterm-screen"))||n.element;if(!o||typeof o.getBoundingClientRect!="function")return null;const c=o.getBoundingClientRect(),h=jy(l.clientX,l.clientY,c,r),p=sl(n);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,c.width||n.cols*p.cellWidth),g=Math.max(1,c.height||n.rows*p.cellHeight),y=Math.max(0,Math.min(m-1,h.clientX-c.left)),v=Math.max(0,Math.min(g-1,h.clientY-c.top)),x=Math.max(0,Math.min(n.cols-1,Math.floor(y/p.cellWidth))),w=Math.max(0,Math.min(n.rows-1,Math.floor(v/p.cellHeight))),T=(n.buffer.active.viewportY??0)+w;return{col:x,bufferRow:T}}function xT(l,n){if(!l||l.length===0||l==="\0")return!0;for(const a of l)if(a==="\0"||/\s/.test(a)||n.includes(a))return!0;return!1}function wT(l,n,a){var x,w;if(!((x=l==null?void 0:l.buffer)!=null&&x.active)||n<0||n>=l.cols)return null;const r=l.buffer.active.getLine(a);if(!r)return null;const o=((w=l.options)==null?void 0:w.wordSeparator)??yT,c=new Array(l.cols).fill(null),h=Math.min(l.cols,r.length);let p=0;for(;p<h;){const M=r.getCell(p);if(!M){c[p]={startCol:p,endCol:p+1,isSeparator:!0},p++;continue}const T=M.getWidth();if(T===0){c[p]||(c[p]={startCol:p,endCol:p+1,isSeparator:!0}),p++;continue}const A=M.getChars(),N=xT(A,o),E=Math.min(l.cols,p+T),_={startCol:p,endCol:E,isSeparator:N};for(let z=p;z<E;z++)c[z]=_;p+=Math.max(1,T)}for(let M=h;M<l.cols;M++)c[M]||(c[M]={startCol:M,endCol:M+1,isSeparator:!0});const m=c[n];if(!m||m.isSeparator)return null;let g=m.startCol;for(;g>0;){const M=c[g-1];if(M&&!M.isSeparator)g=M.startCol;else break}let y=m.endCol;for(;y<l.cols;){const M=c[y];if(M&&!M.isSeparator)y=M.endCol;else break}const v=y-g;return v<=0?null:{startCol:g,length:v}}function ST(l){var c;if(!((c=l==null?void 0:l.buffer)!=null&&c.active))return"";const n=l.buffer.active,a=n.viewportY??0,r=l.rows,o=[];for(let h=0;h<r;h++){const p=n.getLine(a+h);o.push(p?p.translateToString(!0):"")}for(;o.length>0&&o[o.length-1]==="";)o.pop();return o.join(`
|
|
49
|
-
`)}const Fg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),CT=.6,TT=new Set(["─","━","═","┄","┅","┈","┉","-"]),MT=.8;function Ju(l,n){if(!l)return!1;let a=0;const r=Math.min(n,l.length);for(let o=0;o<r;o++){const c=l.getCell(o);if(c){const h=c.getChars();h&&TT.has(h)&&a++}}return a>=Math.max(5,Math.min(n*.25,10))}function ed(l,n,a){var w;if(!((w=l==null?void 0:l.buffer)!=null&&w.active)||l.cols<=0)return{startCol:0,endCol:0};const r=l.buffer.active,o=l.cols,c=Math.max(0,Math.min(o-1,n)),h=r.viewportY??0,p=l.rows>0?l.rows:1,m=new Int32Array(o);let g=0;for(let M=0;M<p;M++){const T=r.getLine(h+M);if(g++,!T)continue;const A=Math.min(o,T.length);for(let N=0;N<A;N++){const E=T.getCell(N);if(E){const _=E.getChars();_&&Fg.has(_)&&m[N]++}}}if(g===0)return{startCol:0,endCol:o-1};const y=g*CT,v=M=>m[M]>=y;let x=!1;for(let M=0;M<o;M++)if(v(M)){x=!0;break}if(x){if(v(c))return{startCol:c,endCol:c};let M=-1;for(let A=c-1;A>=0;A--)if(v(A)){M=A;break}let T=o;for(let A=c+1;A<o;A++)if(v(A)){T=A;break}return{startCol:M+1,endCol:T-1}}if(a!==void 0){const M=Math.max(h,Math.min(h+p-1,a)),T=r.getLine(M);if(!Ju(T,o)){let A=h;for(let _=M-1;_>=h;_--)if(Ju(r.getLine(_),o)){A=_+1;break}let N=h+p-1;for(let _=M+1;_<=h+p-1;_++)if(Ju(r.getLine(_),o)){N=_-1;break}const E=N-A+1;if(E>=2){const _=new Int32Array(o);for(let R=A;R<=N;R++){const B=r.getLine(R);if(!B)continue;const H=Math.min(o,B.length);for(let q=0;q<H;q++){const $=B.getCell(q);if($){const W=$.getChars();W&&Fg.has(W)&&_[q]++}}}const z=E*MT,O=R=>_[R]>=z;let D=!1;for(let R=0;R<o;R++)if(O(R)){D=!0;break}if(D){if(O(c))return{startCol:c,endCol:c};let R=-1;for(let H=c-1;H>=0;H--)if(O(H)){R=H;break}let B=o;for(let H=c+1;H<o;H++)if(O(H)){B=H;break}return{startCol:R+1,endCol:B-1}}}}}return{startCol:0,endCol:o-1}}function Gg(l,n){const a=Math.min(l.startCol,l.endCol),r=Math.max(l.startCol,l.endCol),o=Math.min(l.startRow,l.endRow),c=Math.max(l.startRow,l.endRow);return{startCol:Math.max(n.startCol,Math.min(n.endCol,a)),endCol:Math.max(n.startCol,Math.min(n.endCol,r)),startRow:o,endRow:c}}function Yg(l,n){var g;if(!((g=l==null?void 0:l.buffer)!=null&&g.active)||l.cols<=0)return"";const a=l.buffer.active,r=l.cols,o=Math.min(n.startRow,n.endRow),c=Math.max(n.startRow,n.endRow),h=Math.max(0,Math.min(n.startCol,n.endCol)),p=Math.min(r-1,Math.max(n.startCol,n.endCol));if(h>p||o>c)return"";const m=[];for(let y=o;y<=c;y++){const v=a.getLine(y);if(!v){m.push("");continue}const x=v.translateToString(!0,h,p+1);m.push(x.trimEnd())}return m.join(`
|
|
50
|
-
`)}function AT({termRef:l,surfaceRef:n,mainRef:a,currentScaleRef:r,addToast:o,t:c}){const h=Xn(o),p=Xn(c),[m,g]=C.useState(null),y=C.useRef(null);y.current=m;const[v,x]=C.useState(null),w=C.useRef(null);w.current=v;const[M,T]=C.useState(""),A=C.useRef("");A.current=M;const[N,E]=C.useState(!1),_=C.useRef(!1);_.current=N;const z=C.useRef(!1),[O,D]=C.useState(0),R=C.useRef(0),B=C.useRef(null),H=C.useRef(null),q=C.useRef(null),$=C.useRef(null),W=C.useCallback(se=>{var we;const ve=l.current;if(!ve)return null;const ie=((we=n.current)==null?void 0:we.querySelector(".xterm-screen"))||n.current;return vT(se,ve,ie,r.current)},[l,n,r]),le=C.useCallback(se=>{const ve=l.current,ie=W(se);return!ve||!ie?null:XS(ve,ie.col,ie.bufferRow)},[l,W]),oe=C.useCallback((se,ve)=>{x(ve),T(Yg(se,ve)),E(!0)},[]),I=C.useCallback(()=>{x(null),T(""),E(!1),q.current=null,$.current=null},[]),k=C.useCallback(()=>{g(null),y.current=null,x(null),w.current=null,T(""),A.current="",E(!1),B.current=null,H.current=null},[]),Y=C.useCallback(se=>{const ve=l.current;if(!ve)return;const ie=W(se),we=ie?wT(ve,ie.col,ie.bufferRow):null;if(ie&&we){q.current=ie;const Ee=ed(ve,ie.col,ie.bufferRow);$.current=Ee;const He={startCol:we.startCol,endCol:we.startCol+we.length-1,startRow:ie.bufferRow,endRow:ie.bufferRow};oe(ve,Gg(He,Ee))}else I();B.current=se,H.current=null},[l,W,oe,I]),Q=C.useCallback(se=>{const ve=l.current,ie=q.current;if(!ve||!ie)return;H.current=se;const we=W(se);if(!we)return;const Ee=$.current??ed(ve,ie.col,ie.bufferRow),He={startCol:Math.min(ie.col,we.col),endCol:Math.max(ie.col,we.col),startRow:Math.min(ie.bufferRow,we.bufferRow),endRow:Math.max(ie.bufferRow,we.bufferRow)};oe(ve,Gg(He,Ee))},[l,W,oe]),ae=C.useCallback(()=>{const se=H.current??B.current;if(!se||!a.current)return;const ve=a.current.getBoundingClientRect(),ie=se.clientX-ve.left,we=se.clientY-ve.top,Ee=le(se);g({x:ie,y:we,link:Ee}),y.current={x:ie,y:we,link:Ee}},[a,le]),Z=C.useCallback(async se=>{await Id(se)==="failed"?h.current("error",p.current("clipboard.copyFailed")):h.current("success",p.current("clipboard.copied"))},[h,p]),ge=C.useCallback(async()=>{const se=A.current;se&&await Z(se)},[Z]),be=C.useCallback(async()=>{var Ee,He,ot,ce;const se=l.current,ve=(Ee=se==null?void 0:se.buffer)==null?void 0:Ee.active;if(!se||!ve)return;const ie=((He=w.current)==null?void 0:He.startRow)??((ot=q.current)==null?void 0:ot.bufferRow)??ve.viewportY,we=$.current??ed(se,((ce=q.current)==null?void 0:ce.col)??0,ie);await Z(Yg(se,{startCol:we.startCol,endCol:we.endCol,startRow:ie,endRow:ie}))},[l,Z]),ye=C.useCallback(async()=>{const se=l.current;se&&await Z(ST(se))},[l,Z]),Me=C.useCallback((se,ve,ie)=>{const we=se.buffer.active.viewportY??0;we!==R.current&&(R.current=we,D(we));const Ee=w.current;if(Ee&&_.current){const He=Ee.startRow-we,ot=Ee.endRow-we;z.current&&ve<=ot&&ie>=He&&(E(!1),z.current=!1)}else z.current=!1},[]),de=C.useCallback(se=>{const ve=se.buffer.active.viewportY??0;R.current=ve,D(ve)},[]),xe=C.useCallback(()=>{z.current=!0},[]);return{selectionMenu:m,selectionRect:v,selectionSnapshot:M,isHighlightVisible:N,viewportY:O,hasOpenMenu:()=>y.current!==null,clearSelection:k,handleLongPress:Y,handleSelectionExtend:Q,openMenuAtGesture:ae,handleCopySelection:ge,handleCopyLine:be,handleCopyScreen:ye,onTerminalRender:Me,onTerminalScroll:de,onTerminalContentChanged:xe}}const ET=({term:l,surface:n,main:a,rect:r,viewportY:o})=>{if(!l||!a)return null;const c=sl(l);if(c.cellWidth<=0||c.cellHeight<=0)return null;const h=(n==null?void 0:n.querySelector(".xterm-screen"))||n;if(!h)return null;const p=h.getBoundingClientRect(),m=a.getBoundingClientRect(),g=r.startRow-o;if(r.endRow-o<0||g>=l.rows)return null;const v=p.top-m.top+g*c.cellHeight,x=p.left-m.left+r.startCol*c.cellWidth,w=(r.endCol-r.startCol+1)*c.cellWidth,M=(r.endRow-r.startRow+1)*c.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:`${M}px`}})},Vr=new Map;function Oy(l){let n=Vr.get(l);return n===void 0&&(n=`#${(l&We.RGB_MASK).toString(16).padStart(6,"0")}`,Vr.size>4096&&Vr.clear(),Vr.set(l,n)),n}function Dy(l,n,a){var r;switch(l&We.CM_MASK){case We.CM_P16:case We.CM_P256:return((r=n.ansi[l&We.PCOLOR_MASK])==null?void 0:r.css)??a;case We.CM_RGB:return Oy(l&We.RGB_MASK);default:return a}}function to(l,n,a,r){var v;const o=(l&rt.INVERSE)!==0,c=o?n:l,h=o?l:n;let p;const m=c&We.CM_MASK;if(m===We.CM_P16||m===We.CM_P256){let x=c&We.PCOLOR_MASK;r&&l&rt.BOLD&&x<8&&(x+=8),p=((v=a.ansi[x])==null?void 0:v.css)??a.foreground.css}else m===We.CM_RGB?p=Oy(c&We.RGB_MASK):p=o?a.background.css:a.foreground.css;const g=h&We.CM_MASK,y=g===We.CM_DEFAULT?o?a.foreground.css:a.background.css:Dy(h,a,a.background.css);return{fg:p,bg:y,bgIsDefault:!o&&g===We.CM_DEFAULT}}function ds(l){return(l&rt.BOLD)!==0}function no(l){return(l&Ri.ITALIC)!==0}function uo(l){return(l&Ri.DIM)!==0}function os(l){return(l&rt.INVISIBLE)!==0}const NT=600;var $n=(l=>(l[l.NONE=0]="NONE",l[l.BLOCK=1]="BLOCK",l[l.BAR=2]="BAR",l[l.UNDERLINE=3]="UNDERLINE",l[l.OUTLINE=4]="OUTLINE",l))($n||{});function Pg(l){switch(l){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function zy(l,n,a,r,o,c,{css:h,dpr:p,cursorWidth:m}){switch(l.save(),l.fillStyle=h,l.strokeStyle=h,c){case 2:l.fillRect(a,r,Math.max(1,Math.round(m*p)),n.cell.height);break;case 3:l.fillRect(a,r+n.cell.height-Math.max(1,Math.round(p))-1,o,Math.max(1,Math.round(p)));break;case 4:{const g=Math.max(1,Math.round(p));l.lineWidth=g,l.strokeRect(a+g/2,r+g/2,o-g,n.cell.height-g);break}}l.restore()}function kT(l,n,a,r,o){let c,h;if(a&&a.cursor!==void 0){if(a.cursor===null)return null;c=a.cursor.row,h=a.cursor.col}else{if(!l.coreService.isCursorInitialized||l.coreService.isCursorHidden)return null;c=n.ybase+n.y,h=n.x}const p=c-n.ydisp;if(p<0||p>=r.rows)return null;const m=Math.min(Math.max(0,h),r.cols-1),g=l.optionsService.rawOptions;let y;if(l._coreBrowserService.isFocused)o?y=0:y=Pg(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";y=v==="none"?0:Pg(v)}return y===0?null:{x:m,y:p,shape:y}}class LT{constructor(n){X(this,"timer",null);X(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()},NT)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}const $g=80,RT=16;class _T{constructor(){X(this,"last",null);X(this,"fromX",0);X(this,"toX",0);X(this,"start",0);X(this,"sliding",!1)}update(n,a,r){const o=this.last;if(this.last=n&&{x:n.x,y:n.y},!n)return this.sliding=!1,null;if(!o||o.x!==n.x||o.y!==n.y){const c=o!==null&&o.y===n.y&&n.y===a&&Math.abs(n.x-o.x)<=RT;this.fromX=!c||!o?n.x:this.sliding?this.x(r):o.x,this.toX=n.x,this.start=r,this.sliding=c}return this.sliding?r-this.start>=$g?(this.sliding=!1,null):{x:this.x(r),y:n.y,shape:n.shape,css:n.css}:null}x(n){const a=Math.min(1,Math.max(0,(n-this.start)/$g));return this.fromX+(this.toX-this.fromX)*(1-(1-a)**3)}}function jT(l,n,a,r){if(l)return{x:l.x,y:l.y,shape:l.shape,css:r.cursor.css};const o=n==null?void 0:n.paintedCaret;if(!o)return null;const{bg:c}=to(o.style.fg,o.style.bg,r,!0);return{x:o.col,y:o.row-a,shape:$n.BLOCK,css:c,plain:o.plain}}const OT=120,DT=16,zT=96,HT=32,BT=64;function as(l,n){const a=l.content[n];if(!(a>>>Qe.WIDTH_SHIFT)||os(l.fg[n]))return!1;if(a&Qe.IS_COMBINED_MASK)return l.combined[n]!=="";const r=a&Qe.CODEPOINT_MASK;return r!==0&&r!==32}function qg(l,n){return{content:l.content[n],fg:l.fg[n],bg:l.bg[n],combined:l.combined[n]}}class UT{constructor(){X(this,"fades",new Map)}get size(){return this.fades.size}clear(){this.fades.clear()}rows(n){const a=new Set;for(const r of this.fades.keys())a.add(Math.floor(r/n));return a}begin(n,a,r,o,c,h){const p=n*a,m=Math.max(0,r.start),g=Math.min(a,r.end);let y=0;for(let x=m;x<g;x++){const w=p+x;if(o.content[w]===Ql)return;const M=as(o,w),T=as(c,x);if(M&&T){if(o.content[w]!==c.content[x]||o.combined[w]!==c.combined[x])return}else(M||T)&&y++}if(y===0||y>HT)return;let v=0;for(let x=m;x<g;x++){const w=p+x,M=as(o,w),T=as(c,x);if(T&&!M){const A=Math.min(v++*DT,zT);this.fades.set(w,{...qg(c,x),start:h+A,out:!1})}else M&&!T&&this.fades.set(w,{...qg(o,w),start:h,out:!0})}}at(n,a,r,o){const c=this.fades.get(n);if(!c)return null;const h=c.out?!as(r,a):r.content[a]===c.content&&r.combined[a]===c.combined,p=(o-c.start)/OT;if(!h||p>=1)return this.fades.delete(n),null;const m=Math.max(0,p);return c.out?{alpha:(1-m)**2,gone:c}:{alpha:1-(1-m)**3}}}function KT(l,n,{gone:a,alpha:r},o,c){if(!a)return;const h=a.content&Qe.IS_COMBINED_MASK?a.combined:String.fromCodePoint(a.content&Qe.CODEPOINT_MASK),p=n.get({chars:h,bold:ds(a.fg),italic:no(a.bg),dim:uo(a.bg),fg:o.fg,bg:o.bg,cells:c.cells});p&&(l.globalAlpha=r,l.drawImage(p.source,p.x,p.y,p.width,p.height,c.px,c.py,c.width,c.height),l.globalAlpha=1)}/**
|
|
51
|
-
* Box drawing, block element and Powerline glyphs, drawn as shapes rather than
|
|
52
|
-
* taken from the font.
|
|
53
|
-
*
|
|
54
|
-
* Vendored verbatim from @xterm/xterm 5.5.0,
|
|
55
|
-
* src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
|
|
56
|
-
* helper it imported, inlined below, and underscores on parameters the strict
|
|
57
|
-
* compiler flags as unused.
|
|
58
|
-
*
|
|
59
|
-
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
|
|
60
|
-
* @license MIT
|
|
61
|
-
*/function Vg(l){if(!l)throw new Error("value must not be falsy");return l}const IT={"▀":[{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}]},FT={"░":[[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]]},GT={"─":{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:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"║":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╒":{1:(l,n)=>`M.5,1 L.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╓":{1:(l,n)=>`M${.5-l},1 L${.5-l},.5 L1,.5 M${.5+l},.5 L${.5+l},1`},"╔":{1:(l,n)=>`M1,${.5-n} L${.5-l},${.5-n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1`},"╕":{1:(l,n)=>`M0,${.5-n} L.5,${.5-n} L.5,1 M0,${.5+n} L.5,${.5+n}`},"╖":{1:(l,n)=>`M${.5+l},1 L${.5+l},.5 L0,.5 M${.5-l},.5 L${.5-l},1`},"╗":{1:(l,n)=>`M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M0,${.5-n} L${.5+l},${.5-n} L${.5+l},1`},"╘":{1:(l,n)=>`M.5,0 L.5,${.5+n} L1,${.5+n} M.5,${.5-n} L1,${.5-n}`},"╙":{1:(l,n)=>`M1,.5 L${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╚":{1:(l,n)=>`M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0 M1,${.5+n} L${.5-l},${.5+n} L${.5-l},0`},"╛":{1:(l,n)=>`M0,${.5+n} L.5,${.5+n} L.5,0 M0,${.5-n} L.5,${.5-n}`},"╜":{1:(l,n)=>`M0,.5 L${.5+l},.5 L${.5+l},0 M${.5-l},.5 L${.5-l},0`},"╝":{1:(l,n)=>`M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M0,${.5+n} L${.5+l},${.5+n} L${.5+l},0`},"╞":{1:(l,n)=>`M.5,0 L.5,1 M.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╟":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1 M${.5+l},.5 L1,.5`},"╠":{1:(l,n)=>`M${.5-l},0 L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0`},"╡":{1:(l,n)=>`M.5,0 L.5,1 M0,${.5-n} L.5,${.5-n} M0,${.5+n} L.5,${.5+n}`},"╢":{1:(l,n)=>`M0,.5 L${.5-l},.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╣":{1:(l,n)=>`M${.5+l},0 L${.5+l},1 M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0`},"╤":{1:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n} M.5,${.5+n} L.5,1`},"╥":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},1 M${.5+l},.5 L${.5+l},1`},"╦":{1:(l,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1`},"╧":{1:(l,n)=>`M.5,0 L.5,${.5-n} M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╨":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},.5 L${.5-l},0 M${.5+l},.5 L${.5+l},0`},"╩":{1:(l,n)=>`M0,${.5+n} L1,${.5+n} M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},0`},"╪":{1:(l,n)=>`M.5,0 L.5,1 M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╫":{1:(l,n)=>`M0,.5 L1,.5 M${.5-l},0 L${.5-l},1 M${.5+l},0 L${.5+l},1`},"╬":{1:(l,n)=>`M0,${.5+n} L${.5-l},${.5+n} L${.5-l},1 M1,${.5+n} L${.5+l},${.5+n} L${.5+l},1 M0,${.5-n} L${.5-l},${.5-n} L${.5-l},0 M1,${.5-n} L${.5+l},${.5-n} L${.5+l},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:(l,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,1,.5`},"╮":{1:(l,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,0,.5`},"╯":{1:(l,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,0,.5`},"╰":{1:(l,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,1,.5`}},bs={"":{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}};bs[""]=bs[""];bs[""]=bs[""];function YT(l,n,a,r,o,c,h,p){const m=IT[n];if(m)return PT(l,m,a,r,o,c),!0;const g=FT[n];if(g)return $T(l,g,a,r,o,c),!0;const y=GT[n];if(y)return qT(l,y,a,r,o,c,p),!0;const v=bs[n];return v?(VT(l,v,a,r,o,c,h,p),!0):!1}function PT(l,n,a,r,o,c){for(let h=0;h<n.length;h++){const p=n[h],m=o/8,g=c/8;l.fillRect(a+p.x*m,r+p.y*g,p.w*m,p.h*g)}}const Xg=new Map;function $T(l,n,a,r,o,c){let h=Xg.get(n);h||(h=new Map,Xg.set(n,h));const p=l.fillStyle;if(typeof p!="string")throw new Error(`Unexpected fillStyle type "${p}"`);let m=h.get(p);if(!m){const g=n[0].length,y=n.length,v=l.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=y;const x=Vg(v.getContext("2d")),w=new ImageData(g,y);let M,T,A,N;if(p.startsWith("#"))M=parseInt(p.slice(1,3),16),T=parseInt(p.slice(3,5),16),A=parseInt(p.slice(5,7),16),N=p.length>7&&parseInt(p.slice(7,9),16)||1;else if(p.startsWith("rgba"))[M,T,A,N]=p.substring(5,p.length-1).split(",").map(E=>parseFloat(E));else throw new Error(`Unexpected fillStyle color format "${p}" when drawing pattern glyph`);for(let E=0;E<y;E++)for(let _=0;_<g;_++)w.data[(E*g+_)*4]=M,w.data[(E*g+_)*4+1]=T,w.data[(E*g+_)*4+2]=A,w.data[(E*g+_)*4+3]=n[E][_]*(N*255);x.putImageData(w,0,0),m=Vg(l.createPattern(v,null)),h.set(p,m)}l.fillStyle=m,l.fillRect(a,r,o,c)}function qT(l,n,a,r,o,c,h){l.strokeStyle=l.fillStyle;for(const[p,m]of Object.entries(n)){l.beginPath(),l.lineWidth=h*Number.parseInt(p,10);let g;if(typeof m=="function"){const v=.15/c*o;g=m(.15,v)}else g=m;for(const y of g.split(" ")){const v=y[0],x=Hy[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(l,By(w,o,c,a,r,!0,h))}l.stroke(),l.closePath()}}function VT(l,n,a,r,o,c,h,p){const m=new Path2D;m.rect(a,r,o,c),l.clip(m),l.beginPath();const g=h/12;l.lineWidth=p*g;for(const y of n.d.split(" ")){const v=y[0],x=Hy[v];if(!x){console.error(`Could not find drawing instructions for "${v}"`);continue}const w=y.substring(1).split(",");!w[0]||!w[1]||x(l,By(w,o,c,a,r,!1,p,(n.leftPadding??0)*(g/2),(n.rightPadding??0)*(g/2)))}n.type===1?(l.strokeStyle=l.fillStyle,l.stroke()):l.fill(),l.closePath()}function Zg(l,n,a=0){return Math.max(Math.min(l,n),a)}const Hy={C:(l,n)=>l.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]),L:(l,n)=>l.lineTo(n[0],n[1]),M:(l,n)=>l.moveTo(n[0],n[1])};function By(l,n,a,r,o,c,h,p=0,m=0){const g=l.map(y=>parseFloat(y)||parseInt(y,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<g.length;y+=2)g[y]*=n-p*h-m*h,c&&g[y]!==0&&(g[y]=Zg(Math.round(g[y]+.5)-.5,n,0)),g[y]+=r+p*h;for(let y=1;y<g.length;y+=2)g[y]*=a,c&&g[y]!==0&&(g[y]=Zg(Math.round(g[y]+.5)-.5,a,0)),g[y]+=o;return g}const Fd=.5,XT=1024,ZT=6;function QT(l){return/Firefox\//.test(l)||/Edge\/\d/.test(l)?"bottom":"ideographic"}class WT{constructor(n,a=typeof navigator<"u"?navigator.userAgent:""){X(this,"pages",[]);X(this,"slots",new Map);X(this,"inkCache",new Map);X(this,"metrics",null);X(this,"font",null);X(this,"baseline");X(this,"generation",0);X(this,"scratch");this.document=n,this.baseline=QT(a)}configure(n,a){const r=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===a.fontFamily&&this.font.fontSize===a.fontSize&&this.font.fontWeight===a.fontWeight&&this.font.fontWeightBold===a.fontWeightBold&&this.font.customGlyphs===a.customGlyphs;this.metrics={...n},this.font={...a},r||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,a){const r=this.font,o=n?r.fontWeightBold:r.fontWeight;return`${a?"italic ":""}${o} ${r.fontSize*this.metrics.dpr}px ${r.fontFamily}`}overflow(n,a,r){if(!this.metrics||!this.font||n.length===1&&n.charCodeAt(0)<128)return 0;const o=`${a?1:0}${r?1:0}${n}`,c=this.inkCache.get(o);if(c!==void 0)return c;let h=0;const p=this.scratchContext();if(p&&!(this.font.customGlyphs&&Uy(n))){p.font=this.fontString(a,r),p.textBaseline=this.baseline;const m=p.measureText(n),g=typeof m.actualBoundingBoxRight=="number"?m.actualBoundingBoxRight:m.width;h=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(o,h),h}get(n){const a=this.metrics,r=this.font;if(!a||!r||a.cellWidth<=0||a.cellHeight<=0)return null;const o=`${n.cells}${n.bold?1:0}${n.italic?1:0}${n.dim?1:0}${n.fg}\0${n.bg}\0${n.chars}`,c=this.slots.get(o);if(c)return c;const h=a.cellWidth*n.cells,p=a.cellHeight,m=this.allocate(h,p);if(!m)return null;const{page:g,x:y,y:v}=m,x=g.ctx;x.save(),x.beginPath(),x.rect(y,v,h,p),x.clip(),x.globalAlpha=1,x.fillStyle=n.bg,x.fillRect(y,v,h,p),x.fillStyle=n.fg,n.dim&&(x.globalAlpha=Fd);let w=!1;r.customGlyphs&&(w=YT(x,n.chars,y,v,a.cellWidth,a.cellHeight,r.fontSize,a.dpr)),w||(x.font=this.fontString(n.bold,n.italic),x.textBaseline=this.baseline,x.fillText(n.chars,y+a.charLeft,v+a.charTop+a.charHeight)),x.restore();const M={source:g.canvas,x:y,y:v,width:h,height:p};return this.slots.set(o,M),M}allocate(n,a){for(const r of this.pages){const o=this.fit(r,n,a);if(o)return o}if(this.pages.length<ZT){const r=this.createPage(Math.max(XT,n,a));return r?(this.pages.push(r),this.fit(r,n,a)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],n,a):null}fit(n,a,r){if(n.shelfX+a>n.canvas.width&&(n.shelfX=0,n.shelfY+=r),n.shelfY+r>n.canvas.height||a>n.canvas.width)return null;const o={page:n,x:n.shelfX,y:n.shelfY};return n.shelfX+=a,o}createPage(n){const a=this.document.createElement("canvas");a.width=n,a.height=n;const r=a.getContext("2d",{alpha:!1});return r?{canvas:a,ctx:r,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 Uy(l){if(l.length!==1)return!1;const n=l.charCodeAt(0);return n>=9472&&n<=9631||n>=57504&&n<=57558}function JT(l,n){return(l&(rt.UNDERLINE|rt.STRIKETHROUGH))!==0||(n&Ri.OVERLINE)!==0}function e5(l,n,{px:a,py:r,cells:o,fgWord:c,bgWord:h,ext:p,fgCss:m},{fontSize:g,dpr:y,colors:v,boldBright:x}){const w=(c&rt.UNDERLINE)!==0,M=(c&rt.STRIKETHROUGH)!==0,T=(h&Ri.OVERLINE)!==0,A=o*n.cell.width;l.save(),l.beginPath(),l.rect(a,r,A,n.cell.height),l.clip(),uo(h)&&(l.globalAlpha=Fd);const N=Math.max(1,Math.floor(g*y/15)),E=N%2===1?.5:0;if(w){const _=jC(p);let z=m;if(_){let R=_;x&&ds(c)&&(R&50331648)!==50331648&&(R&255)<8&&(R+=8),z=Dy(R,v,m)}l.strokeStyle=z,l.lineWidth=N;const O=r+n.char.top+Math.ceil(n.char.height)-E-N*2,D=p?_C(p):Wl.SINGLE;switch(l.beginPath(),D){case Wl.DOUBLE:l.moveTo(a,O),l.lineTo(a+A,O),l.moveTo(a,O+N*2),l.lineTo(a+A,O+N*2);break;case Wl.CURLY:{const R=O+N,B=Math.max(1,N);for(let H=0;H<o;H++){const q=a+H*n.cell.width,$=q+n.cell.width/2,W=q+n.cell.width;l.moveTo(q,R),l.bezierCurveTo(q,R-B,$,R-B,$,R),l.bezierCurveTo($,R+B,W,R+B,W,R)}break}case Wl.DOTTED:l.setLineDash([N,N]),l.moveTo(a,O),l.lineTo(a+A,O);break;case Wl.DASHED:{const R=Math.floor(.6*n.cell.width),B=Math.floor(.3*n.cell.width);l.setLineDash([R,B,n.cell.width-R-B]),l.moveTo(a,O),l.lineTo(a+A,O);break}default:l.moveTo(a,O),l.lineTo(a+A,O)}l.stroke(),l.setLineDash([])}if(T&&(l.strokeStyle=m,l.lineWidth=N,l.beginPath(),l.moveTo(a,r+n.char.top+E),l.lineTo(a+A,r+n.char.top+E),l.stroke()),M){const _=Math.max(1,Math.floor(g*y/10)),z=r+n.char.top+Math.floor(n.char.height/2)-(_%2===1?.5:0);l.strokeStyle=m,l.lineWidth=_,l.beginPath(),l.moveTo(a,z),l.lineTo(a+A,z),l.stroke()}l.restore()}const td=4,t5=3;class n5{constructor(n,a,r,o){X(this,"atlas");X(this,"fades",new UT);X(this,"cols",0);X(this,"rows",0);X(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});X(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});X(this,"work",RC());this.ctx=n,this.core=r,this.dimensions=o,this.atlas=new WT(a)}resize(n,a){this.cols=n,this.rows=a,this.fades.clear();const r=n*a;this.painted={content:new Uint32Array(r).fill(Ql),fg:new Uint32Array(r),bg:new Uint32Array(r),ext:new Uint32Array(r),meta:new Uint32Array(r).fill(Ql),combined:new Array(r).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(Ql),this.painted.meta.fill(Ql),this.fades.clear()}hasPaintedInk(n,a){const r=this.dimensions.device;if(!r.cell.width||!r.cell.height)return!1;const o=Math.min(this.cols,Math.floor(n/r.cell.width)),c=Math.min(this.rows,Math.floor(a/r.cell.height)),h=this.painted;for(let p=0;p<c;p++)for(let m=0;m<o;m++){const g=p*this.cols+m,y=h.content[g];if(y===Ql||h.meta[g]===td||os(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,a){const{content:r,fg:o,bg:c,ext:h,combined:p}=this.row,m=this.work;for(let g=0;g<this.cols;g++)n&&g<n.length?(n.loadCell(g,m),r[g]=m.content,o[g]=m.fg,c[g]=m.bg,h[g]=Sy(m),p[g]=m.content&Qe.IS_COMBINED_MASK?m.combinedData:""):(r[g]=1<<Qe.WIDTH_SHIFT,o[g]=0,c[g]=0,h[g]=0,p[g]="");if(a)for(const g of a){const y=g.col;if(y<0||y+g.width>this.cols)continue;y>0&&!(r[y]>>>Qe.WIDTH_SHIFT)&&this.blankAt(y-1);const v=y+g.width;v<this.cols&&!(r[v]>>>Qe.WIDTH_SHIFT)&&r[v-1]>>>Qe.WIDTH_SHIFT===2&&this.blankAt(v);const x=OC(g.chars,g.width);r[y]=x.content,p[y]=x.combinedData,o[y]=g.style.fg,c[y]=g.style.bg,h[y]=g.style.ext,g.width===2&&(r[y+1]=0,p[y+1]="",o[y+1]=g.style.fg,c[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,a,r=null,o=0){const c=this.cols,{content:h,fg:p,bg:m,ext:g,combined:y}=this.row,v=this.painted,x=n*c;r&&this.fades.begin(n,c,r,v,this.row,o);let w=0,M=-1,T=-1,A="";const N=()=>{M<0||(this.fillCells(M,n,T-M,A),M=-1)};let E=0;for(;E<c;){let z=h[E]>>>Qe.WIDTH_SHIFT;z===0&&(z=1),E+z>c&&(z=c-E),z===1&&E+1<c&&this.overflowsInto(E)&&(z=2);const O=a&&a.y===n&&a.x>=E&&a.x<E+z?a.shape:$n.NONE,D=z|O<<t5,R=this.fades.size>0?this.fades.at(x+E,E,this.row,o):null;let B=R!==null||this.differs(x+E,E,D);for(let H=1;H<z;H++)this.differs(x+E+H,E+H,td)&&(B=!0);if(B){for(let q=0;q<z;q++){const $=x+E+q;v.content[$]=h[E+q],v.fg[$]=p[E+q],v.bg[$]=m[E+q],v.ext[$]=g[E+q],v.meta[$]=q===0?R?D|BT:D:td,v.combined[$]=y[E+q]}w+=z;const H=R?null:this.plainFill(E,O);H!==null?M>=0&&T===E&&A===H?T=E+z:(N(),M=E,T=E+z,A=H):(N(),this.paintCell(E,n,z,O,R))}E+=z}return N(),w}differs(n,a,r){const o=this.painted,c=this.row;return o.meta[n]!==r||o.content[n]!==c.content[a]||o.fg[n]!==c.fg[a]||o.bg[n]!==c.bg[a]||o.ext[n]!==c.ext[a]||o.combined[n]!==c.combined[a]}overflowsInto(n){const{content:a,fg:r,bg:o,ext:c}=this.row,h=a[n];if((h&Qe.CODEPOINT_MASK)<128&&!(h&Qe.IS_COMBINED_MASK)||h>>>Qe.WIDTH_SHIFT!==1||os(r[n]))return!1;const m=a[n+1],g=m&Qe.CODEPOINT_MASK;if(m>>>Qe.WIDTH_SHIFT!==1||m&Qe.IS_COMBINED_MASK||g!==0&&g!==32||o[n]!==o[n+1]||c[n+1]!==0||(r[n]&rt.INVERSE)!==(r[n+1]&rt.INVERSE)||r[n]&rt.INVERSE&&r[n]!==r[n+1]||r[n+1]&(rt.UNDERLINE|rt.STRIKETHROUGH)||o[n+1]&Ri.OVERLINE)return!1;const y=this.charsAt(n);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Uy(y)?!1:this.atlas.overflow(y,ds(r[n]),no(o[n]))>0}charsAt(n){const a=this.row.content[n];if(a&Qe.IS_COMBINED_MASK)return this.row.combined[n];const r=a&Qe.CODEPOINT_MASK;return r?String.fromCodePoint(r):""}plainFill(n,a){if(a!==$n.NONE)return null;const{content:r,fg:o,bg:c}=this.row,h=r[n],p=h&Qe.CODEPOINT_MASK,m=!(h&Qe.IS_COMBINED_MASK)&&(p===0||p===32),g=os(o[n]);return!m&&!g||(o[n]&(rt.UNDERLINE|rt.STRIKETHROUGH)||c[n]&Ri.OVERLINE)&&!g?null:to(o[n],c[n],this.colors(),this.boldBright()).bg}paintCell(n,a,r,o,c=null){const h=this.ctx,p=this.dimensions.device,m=this.colors(),g=this.row.fg[n],y=this.row.bg[n],v=this.row.ext[n],x=to(g,y,m,this.boldBright());let w=x.fg,M=x.bg;o===$n.BLOCK&&(M=m.cursor.css,w=m.cursorAccent.css);const T=os(g),A=this.charsAt(n),N=n*p.cell.width,E=a*p.cell.height,_=r*p.cell.width,z=p.cell.height,O=T||A===""||A===" ",D=O?null:this.atlas.get({chars:A,bold:ds(g),italic:no(y),dim:uo(y),fg:w,bg:M,cells:r}),R=c&&!c.gone?c.alpha:1;if(D&&R===1?h.drawImage(D.source,D.x,D.y,D.width,D.height,N,E,_,z):(h.fillStyle=M,h.fillRect(N,E,_,z),D?(h.globalAlpha=R,h.drawImage(D.source,D.x,D.y,D.width,D.height,N,E,_,z),h.globalAlpha=1):O||(h.save(),h.beginPath(),h.rect(N,E,_,z),h.clip(),h.fillStyle=w,h.globalAlpha=(uo(y)?Fd:1)*R,h.font=this.atlas.fontString(ds(g),no(y)),h.fillText(A,N+p.char.left,E+p.char.top+p.char.height),h.restore())),c!=null&&c.gone){const H=o===$n.BLOCK||(g&rt.INVERSE)!==0?w:to(c.gone.fg,c.gone.bg,m,this.boldBright()).fg;KT(h,this.atlas,c,{fg:H,bg:M},{px:N,py:E,width:_,height:z,cells:r})}!T&&JT(g,y)&&e5(h,p,{px:N,py:E,cells:r,fgWord:g,bgWord:y,ext:v,fgCss:w},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:m,boldBright:this.boldBright()}),o!==$n.NONE&&o!==$n.BLOCK&&zy(h,p,N,E,_,o,{css:m.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(n,a,r,o){const c=this.dimensions.device;this.ctx.fillStyle=o,this.ctx.fillRect(n*c.cell.width,a*c.cell.height,r*c.cell.width,c.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,a=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:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,customGlyphs:a.customGlyphs!==!1})}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}}function i5(){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 l5(l,n,a,r){const o=n._charSizeService;if(!o.hasValidSize)return!1;const c=n._coreBrowserService.dpr,h=n.optionsService.rawOptions;return l.device.char.width=Math.floor(o.width*c),l.device.char.height=Math.ceil(o.height*c),l.device.cell.height=Math.floor(l.device.char.height*h.lineHeight),l.device.char.top=h.lineHeight===1?0:Math.round((l.device.cell.height-l.device.char.height)/2),l.device.cell.width=l.device.char.width+Math.round(h.letterSpacing),l.device.char.left=Math.floor(h.letterSpacing/2),l.device.canvas.height=r*l.device.cell.height,l.device.canvas.width=a*l.device.cell.width,l.css.canvas.height=Math.round(l.device.canvas.height/c),l.css.canvas.width=Math.round(l.device.canvas.width/c),l.css.cell.height=l.css.canvas.height/r,l.css.cell.width=l.css.canvas.width/a,!0}function a5(l,n,a){if(!l||typeof l.ResizeObserver!="function")return null;let r=new l.ResizeObserver(o=>{var m;const c=o.find(g=>g.target===n);if(!c)return;if(!("devicePixelContentBoxSize"in c)||!((m=c.devicePixelContentBoxSize)!=null&&m[0])){r==null||r.disconnect(),r=null;return}const h=c.devicePixelContentBoxSize[0].inlineSize,p=c.devicePixelContentBoxSize[0].blockSize;h<=0||p<=0||h===n.width&&p===n.height||a(h,p)});try{r.observe(n,{box:"device-pixel-content-box"})}catch{r.disconnect(),r=null}return{dispose:()=>r==null?void 0:r.disconnect()}}function s5(l){if(!l)return[];const n=l.cells.map(a=>a.row);return l.cursor&&n.push(l.cursor.row),n}function r5(l){const n=new Map;for(const a of(l==null?void 0:l.cells)??[]){const r=n.get(a.row);r?r.push(a):n.set(a.row,[a])}return n}class o5{constructor(n){X(this,"canvas");X(this,"ctx");X(this,"selection",null);X(this,"link",null);this.canvas=n.createElement("canvas"),this.canvas.classList.add("xterm-decor-layer"),this.canvas.style.zIndex="2";const a=this.canvas.getContext("2d");if(!a)throw new Error("2D canvas unavailable");this.ctx=a}setSelection(n,a,r){this.selection=n&&a&&!(n[0]===a[0]&&n[1]===a[1])?{start:[n[0],n[1]],end:[a[0],a[1]],columnSelectMode:r}:null}paint({dims:n,rows:a,cols:r,ydisp:o,colors:c,focused:h,dpr:p,cursorWidth:m,caret:g}){var M;const y=this.ctx;if(y.clearRect(0,0,this.canvas.width,this.canvas.height),!n.cell.width||!a)return;const{selection:v,link:x}=this,w=(T,A,N,E)=>y.fillRect(T*n.cell.width,A*n.cell.height,N*n.cell.width,E*n.cell.height);if(v){const T=v.start[1]-o,A=v.end[1]-o,N=Math.max(T,0),E=Math.min(A,a-1);if(N<a&&E>=0)if(y.fillStyle=(h?c.selectionBackgroundTransparent:c.selectionInactiveBackgroundTransparent).css,v.columnSelectMode)w(v.start[0],N,v.end[0]-v.start[0],E-N+1);else{const _=T===N?v.start[0]:0,z=N===A?v.end[0]:r;w(_,N,z-_,1),w(0,N+1,r,Math.max(E-N-1,0)),N!==E&&w(0,E,A===E?v.end[0]:r,1)}}if(x){y.fillStyle=x.fg===257?c.background.css:x.fg!==void 0&&x.fg<256?((M=c.ansi[x.fg])==null?void 0:M.css)??c.foreground.css:c.foreground.css;const T=(A,N,E)=>y.fillRect(A*n.cell.width,(N+1)*n.cell.height-p-1,E*n.cell.width,p);if(x.y1===x.y2)T(x.x1,x.y1,x.x2-x.x1);else{T(x.x1,x.y1,x.cols-x.x1);for(let A=x.y1+1;A<x.y2;A++)T(0,A,x.cols);T(0,x.y2,x.x2)}}if(g){const T=Math.round(g.x*n.cell.width),A=g.y*n.cell.height;g.shape===$n.BLOCK?(y.fillStyle=g.css,y.fillRect(T,A,n.cell.width,n.cell.height)):zy(y,n,T,A,n.cell.width,g.shape,{css:g.css,dpr:p,cursorWidth:m})}}}class c5{constructor(n,a){X(this,"text");X(this,"textContext");X(this,"decor");this.screen=a,this.text=n.createElement("canvas"),this.text.classList.add("xterm-text-layer"),this.text.style.zIndex="0";const r=this.text.getContext("2d",{alpha:!1});if(!r)throw new Error("2D canvas unavailable");this.textContext=r,this.decor=new o5(n),a.appendChild(this.text),a.appendChild(this.decor.canvas)}size(n){for(const a of[this.text,this.decor.canvas])a.width=n.device.canvas.width,a.height=n.device.canvas.height,a.style.width=`${n.css.canvas.width}px`,a.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,a,r,o){return a5(n,this.text,(c,h)=>{const p=a.css.canvas;if(!(Math.abs(c-p.width*r())>2||Math.abs(h-p.height*r())>2)){a.device.canvas.width=c,a.device.canvas.height=h;for(const m of[this.text,this.decor.canvas])m.width=c,m.height=h;o()}})}remove(){this.text.remove(),this.decor.canvas.remove()}}function u5(l,n){const a=l.fonts;return!a||typeof a.addEventListener!="function"?null:(a.addEventListener("loadingdone",n),{dispose:()=>a.removeEventListener("loadingdone",n)})}class d5{constructor(n,a,r){X(this,"startedAt",null);X(this,"held",null);X(this,"timer",null);this.now=n,this.maxHoldMs=a,this.onExpire=r}get pending(){return this.held}hold(n,a){const r=this.now();return this.startedAt===null&&(this.startedAt=r),r-this.startedAt>=this.maxHoldMs?!1:(this.held=this.held?{start:Math.min(this.held.start,n),end:Math.max(this.held.end,a)}:{start:n,end:a},this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.onExpire()},this.maxHoldMs)),!0)}release(n,a){return this.held&&(n=Math.min(n,this.held.start),a=Math.max(a,this.held.end)),this.held=null,this.startedAt=null,this.timer&&(clearTimeout(this.timer),this.timer=null),{start:n,end:a}}dispose(){this.timer&&clearTimeout(this.timer)}}function f5(l){var a,r,o,c;const n=l._core;return!(n!=null&&n.screenElement)||!n.coreService||!((a=n.optionsService)!=null&&a.rawOptions)||!((r=n._bufferService)!=null&&r.buffer)||!n._charSizeService||!n._coreBrowserService||!((o=n._themeService)!=null&&o.colors)||typeof((c=n._renderService)==null?void 0:c.setRenderer)!="function"?null:n}class h5{constructor(){X(this,"listeners",new Set);X(this,"event",n=>(this.listeners.add(n),{dispose:()=>this.listeners.delete(n)}))}fire(n){for(const a of[...this.listeners])a(n)}dispose(){this.listeners.clear()}}const m5=150;class Gd{constructor(n,a){X(this,"dimensions",i5());X(this,"redraw",new h5);X(this,"onRequestRedraw",this.redraw.event);X(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});X(this,"surface");X(this,"cells");X(this,"disposables",[]);X(this,"now");X(this,"syncHold");X(this,"cols",0);X(this,"rows",0);X(this,"overlayProvider",null);X(this,"typingZoneProvider",null);X(this,"reducedMotion");X(this,"paintedOverlayRows",new Set);X(this,"paintedCursorRow",-1);X(this,"lastYdisp",0);X(this,"inputAt",null);X(this,"blink",new LT(()=>this.requestCursorRow()));X(this,"glide",new _T);X(this,"slidingCaret",null);X(this,"disposed",!1);X(this,"isSynchronizing");X(this,"dprUsed",0);var h,p;this.core=n,this.now=a.now??(()=>performance.now()),this.syncHold=new d5(this.now,a.maxSyncHoldMs??m5,()=>this.flushHeld()),this.isSynchronizing=a.isSynchronizing??(()=>!1),this.reducedMotion=(p=(h=n._coreBrowserService.window).matchMedia)==null?void 0:p.call(h,"(prefers-reduced-motion: reduce)");const r=n._coreBrowserService.mainDocument;this.surface=new c5(r,n.screenElement),this.cells=new n5(this.surface.textContext,r,n,this.dimensions),this.disposables.push(n._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),n.optionsService.onOptionChange(m=>{(m==="cursorBlink"||m==="cursorStyle")&&this.restartBlink()})),n.linkifier&&this.disposables.push(n.linkifier.onShowLinkUnderline(m=>{this.surface.decor.link=m,this.redrawDecor()}),n.linkifier.onHideLinkUnderline(()=>{this.surface.decor.link=null,this.redrawDecor()}));const o=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)})});o&&this.disposables.push(o);const c=u5(r,()=>this.clearTextureAtlas());c&&this.disposables.push(c),this.restartBlink()}static install(n,a={}){const r=f5(n);if(!r)return null;const o=new Gd(r,a);return r._renderService.setRenderer(o),r._renderService.handleResize(r._bufferService.cols,r._bufferService.rows),o}setOverlayProvider(n){this.overlayProvider=n,this.invalidateOverlay()}setTypingZoneProvider(n){this.typingZoneProvider=n}invalidateOverlay(){var r;const n=((r=this.overlayProvider)==null?void 0:r.call(this))??null,a=new Set(this.paintedOverlayRows);for(const o of s5(n))a.add(o);this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(a)}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,a){l5(this.dimensions,this.core,n,a)&&(this.dprUsed=this.core._coreBrowserService.dpr),this.surface.size(this.dimensions),this.cols=n,this.rows=a,this.cells.resize(n,a),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,a,r){this.surface.decor.setSelection(n,a,r),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,a){if(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)return;if(this.isSynchronizing()&&this.syncHold.hold(n,a)){this.stats.heldFrames++;return}const r=this.syncHold.release(n,a);this.paint(Math.max(0,r.start),Math.min(this.rows-1,r.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,a){return this.cells.hasPaintedInk(n,a)}paint(n,a){var N,E,_;const r=this.now(),o=this.buffer(),c=o.ydisp;c!==this.lastYdisp&&(this.lastYdisp=c,this.cells.fades.clear(),this.redrawDecor());const h=(N=this.reducedMotion)!=null&&N.matches?null:((E=this.typingZoneProvider)==null?void 0:E.call(this))??null,p=h?h.row-c:-1,m=((_=this.overlayProvider)==null?void 0:_.call(this))??null,g=r5(m),y=this.cursorState(m),v=jT(y,m,c,this.colors()),x=this.glide.update(v,p,r),w=x?null:y,M=x&&(v==null?void 0:v.plain);M&&g.set(M.row,[...g.get(M.row)??[],M]);const T=new Set;for(let z=n;z<=a;z++)T.add(z);for(const z of this.paintedOverlayRows)ss(T,z-c,this.rows);for(const z of g.keys())ss(T,z-c,this.rows);this.paintedCursorRow>=0&&ss(T,this.paintedCursorRow,this.rows),w&&ss(T,w.y,this.rows);for(const z of this.cells.fades.rows(this.cols))ss(T,z,this.rows);let A=0;for(const z of T){this.cells.loadRow(o.lines.get(c+z),g.get(z+c));const O=z===p?{start:h.startCol,end:h.endCol}:null;A+=this.cells.paintRow(z,w,O,r)}this.cells.fades.size>0&&this.requestAbsoluteRows([...this.cells.fades.rows(this.cols)].map(z=>z+c)),(x||this.slidingCaret)&&(this.slidingCaret=x,this.redrawDecor(),x&&this.requestAbsoluteRows([x.y+c])),this.paintedOverlayRows=new Set(g.keys()),this.paintedCursorRow=w?w.y:-1,this.stats.frames++,this.stats.lastCells=A,this.stats.lastPaintMs=this.now()-r,this.inputAt!==null&&A>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(n){return kT(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(),a=new Set;a.add(n.ybase+n.y),this.paintedCursorRow>=0&&a.add(this.paintedCursorRow+n.ydisp),this.requestAbsoluteRows(a)}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 a=this.buffer().ydisp;let r=1/0,o=-1/0;for(const c of n){const h=c-a;h<0||h>=this.rows||(r=Math.min(r,h),o=Math.max(o,h))}r<=o&&this.redraw.fire({start:r,end:o})}}function ss(l,n,a){n>=0&&n<a&&l.add(n)}const p5=30,Ky=640,Iy=240,Xr=1,g5=720*60*60*1e3;function Fy(){const l=Li("local",bt.rendererProbe);if(!l)return{v:Xr,ua:{}};try{const n=JSON.parse(l);return typeof n=="object"&&n!==null&&n.v===Xr&&typeof n.ua=="object"&&n.ua!==null?n:{v:Xr,ua:{}}}catch{return{v:Xr,ua:{}}}}function b5(l,n=Date.now()){const a=Fy();a.ua[l]={failedAt:n},Mn("local",bt.rendererProbe,JSON.stringify(a))}function y5(l,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";if(!a)return!1;const o=Fy().ua[a];return!(!o||typeof o.failedAt!="number"||n-o.failedAt>g5)}function Qg(l,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";a&&b5(a,n)}function v5(l){if(l.length<4)return!0;const n=l[0],a=l[1],r=l[2],o=l[3];for(let c=4;c<l.length;c+=4)if(l[c]!==n||l[c+1]!==a||l[c+2]!==r||l[c+3]!==o)return!1;return!0}function x5(l){if(!l||l.width<=0||l.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let n=null;try{n=l.getContext("2d",{willReadFrequently:!0})||l.getContext("2d")}catch(o){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",o),"inconclusive"}if(!n)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const a=Math.min(l.width,Ky),r=Math.min(l.height,Iy);if(a<=0||r<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const o=n.getImageData(0,0,a,r);return v5(o.data)?"blank":"healthy"}catch(o){return console.debug("Canvas probe inconclusive: getImageData threw exception:",o),"inconclusive"}}function Wg(l=2){return new Promise(n=>{if(typeof requestAnimationFrame!="function"){setTimeout(n,32);return}let a=l;const r=()=>{a--,a<=0?n():requestAnimationFrame(r)};requestAnimationFrame(r)})}const nd={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function w5(l,n={}){if(y5())return nd;let a;try{a=Gd.install(l,{isSynchronizing:n.isSynchronizing})}catch(p){return console.debug("Canvas renderer unavailable, using the DOM renderer:",p),Qg(),nd}if(!a)return nd;let r=a,o=null;const c=()=>{var m;if(!r)return;Qg();const p=r;r=null;try{p.uninstall()}catch{}(m=n.onRendererSwapped)==null||m.call(n,"dom")};return{get kind(){return r?"canvas":"dom"},get canvas(){return r},dispose:()=>{const p=r;r=null;try{p==null||p.dispose()}catch{}},verify:async()=>{if(r)return o||(o=(async()=>{try{const p=r.stats.frames;await Wg(2);for(let g=0;g<p5&&r&&r.stats.frames===p;g++)await Wg(1);if(!r)return;const m=x5(r.textCanvas);m==="blank"&&r.hasPaintedInk(Ky,Iy)?c():m==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):m==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(p){console.debug("Canvas probe inconclusive: unexpected error during verify():",p)}finally{o=null}})(),o)}}}function S5(l,n,a){l.writeln(" ___ ___ .___ "),l.writeln(` / | \\ ____ _______| _/______ \x1B[1m${n}\x1B[0m`),l.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${a}\x1B[0m`),l.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),l.writeln(" \\___|_ / \\___ >|__| /___/____ >"),l.writeln(" \\/ \\/ \\/ "),l.writeln("")}var C5=bx(),id={exports:{}},Jg;function T5(){return Jg||(Jg=1,(function(l,n){(function(a,r){l.exports=r()})(self,(()=>(()=>{var a={6:(h,p)=>{function m(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(p,"__esModule",{value:!0}),p.LinkComputer=p.WebLinkProvider=void 0,p.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:M}=v;this._options.hover(x,w,M)}},v)))}};class g{static computeLink(v,x,w,M){const T=new RegExp(x.source,(x.flags||"")+"g"),[A,N]=g._getWindowedLineStrings(v-1,w),E=A.join("");let _;const z=[];for(;_=T.exec(E);){const O=_[0];if(!m(O))continue;const[D,R]=g._mapStrIdx(w,N,0,_.index),[B,H]=g._mapStrIdx(w,D,R,O.length);if(D===-1||R===-1||B===-1||H===-1)continue;const q={start:{x:R+1,y:D+1},end:{x:H,y:B+1}};z.push({range:q,text:O,activate:M})}return z}static _getWindowedLineStrings(v,x){let w,M=v,T=v,A=0,N="";const E=[];if(w=x.buffer.active.getLine(v)){const _=w.translateToString(!0);if(w.isWrapped&&_[0]!==" "){for(A=0;(w=x.buffer.active.getLine(--M))&&A<2048&&(N=w.translateToString(!0),A+=N.length,E.push(N),w.isWrapped&&N.indexOf(" ")===-1););E.reverse()}for(E.push(_),A=0;(w=x.buffer.active.getLine(++T))&&w.isWrapped&&A<2048&&(N=w.translateToString(!0),A+=N.length,E.push(N),N.indexOf(" ")===-1););}return[E,M]}static _mapStrIdx(v,x,w,M){const T=v.buffer.active,A=T.getNullCell();let N=w;for(;M;){const E=T.getLine(x);if(!E)return[-1,-1];for(let _=N;_<E.length;++_){E.getCell(_,A);const z=A.getChars();if(A.getWidth()&&(M-=z.length||1,_===E.length-1&&z==="")){const O=T.getLine(x+1);O&&O.isWrapped&&(O.getCell(0,A),A.getWidth()===2&&(M+=1))}if(M<0)return[x,_]}x++,N=0}return[x,N]}}p.LinkComputer=g}},r={};function o(h){var p=r[h];if(p!==void 0)return p.exports;var m=r[h]={exports:{}};return a[h](m,m.exports,o),m.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const p=o(6),m=/(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||m;this._linkProvider=this._terminal.registerLinkProvider(new p.WebLinkProvider(this._terminal,x,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),c})()))})(id)),id.exports}var M5=T5(),A5=yx();function E5({fontSize:l,fontFamily:n,theme:a,cols:r,rows:o}){const c=new A5.Terminal({fontSize:l,fontFamily:n,lineHeight:1.15,...a?{theme:{...a}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:r,rows:o,screenReaderMode:!1,linkHandler:{activate:(h,p)=>{wd(p)}}});try{const h=new C5.Unicode11Addon;c.loadAddon(h),c.unicode.activeVersion="11"}catch(h){console.debug("Unicode11 addon unavailable, using default width table:",h)}try{c.loadAddon(new M5.WebLinksAddon((h,p)=>{wd(p)}))}catch(h){console.debug("WebLinks addon unavailable, URLs stay plain text:",h)}return c}function cs(l){var n,a;if(!l)return!1;try{const r=l.modes;if(r&&typeof r.mouseTrackingMode=="string"&&r.mouseTrackingMode!=="none")return!0;const o=l._core;if((n=o==null?void 0:o._coreMouseService)!=null&&n.areMouseEventsActive||(a=o==null?void 0:o.coreMouseService)!=null&&a.areMouseEventsActive||o!=null&&o.mouseMode&&o.mouseMode!=="none")return!0}catch{}return!1}function N5(l,n){const a=n.button??0,r=n.buttons??(l==="mouseup"?0:1);return new MouseEvent(l,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,screenX:n.clientX,screenY:n.clientY,button:a,buttons:r})}function Gy(l,n,a){const r=N5(n,a);return l.dispatchEvent(r)}function Yy(l){var n;try{return((n=l.buffer)==null?void 0:n.active)||null}catch{return null}}function ld(l){var a;const n=(a=Yy(l))==null?void 0:a.viewportY;return typeof n=="number"&&Number.isFinite(n)?n:null}function k5(l){var n;try{(n=l.blur)==null||n.call(l)}catch{}}function eb(l){var a,r;const n=l;return n.coreMouseService||((a=n._core)==null?void 0:a.coreMouseService)||((r=n._core)==null?void 0:r._coreMouseService)||null}function L5(l){var a;const n=l;return n.coreService||((a=n._core)==null?void 0:a.coreService)||null}class R5{constructor(n){this.options=n}getLogicalCoordinates(n,a){const r=this.options.getScale?this.options.getScale():1,o=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(r!==1&&o&&typeof o.getBoundingClientRect=="function"){const c=o.getBoundingClientRect();return jy(n,a,c,r)}return{clientX:n,clientY:a}}getViewportElement(n){var o;const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm-viewport"))||((o=n.element)==null?void 0:o.querySelector(".xterm-viewport"))||null}isInputLineHit(n,a){var E;const r=(E=a.buffer)==null?void 0:E.active,o=this.options.getSurfaceElement?this.options.getSurfaceElement():null,c=(o==null?void 0:o.querySelector(".xterm-screen"))||a.element||o,h=sl(a);if(!c||typeof c.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const p=c.getBoundingClientRect(),m=this.getLogicalCoordinates(n.clientX,n.clientY),g=p.width>0&&p.height>0;if(![r==null?void 0:r.cursorY,r==null?void 0:r.viewportY,r==null?void 0:r.baseY].every(_=>typeof _=="number"&&Number.isFinite(_)))return!1;const v=r==null?void 0:r.cursorY,x=r==null?void 0:r.viewportY,M=(r==null?void 0:r.baseY)+v-x,T=p.top+M*h.cellHeight,A=T+h.cellHeight,N=Number(a.rows);return M>=0&&(!Number.isFinite(N)||M<N)&&m.clientY>=T-2&&m.clientY<=A+2&&(!g||m.clientX>=p.left&&m.clientX<=p.right)}resolveDispatchTarget(n,a){var p;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,o=(r==null?void 0:r.querySelector(".xterm-screen"))||a.querySelector(".xterm-screen")||null,c=((p=o==null?void 0:o.closest)==null?void 0:p.call(o,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(n.clientX,n.clientY)),h&&c&&(h===c||c.contains(h))?h:o||r||a}getMouseReport(n,a){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,o=(r==null?void 0:r.querySelector(".xterm-screen"))||a.element;if(!o||typeof o.getBoundingClientRect!="function")return null;const c=o.getBoundingClientRect(),h=this.getLogicalCoordinates(n.clientX,n.clientY),p=sl(a);if(p.cellWidth<=0||p.cellHeight<=0)return null;const m=Math.max(1,c.width||a.cols*p.cellWidth),g=Math.max(1,c.height||a.rows*p.cellHeight),y=Math.max(0,Math.min(m-1,h.clientX-c.left)),v=Math.max(0,Math.min(g-1,h.clientY-c.top)),x=Math.max(0,Math.min(a.cols-1,Math.floor(y/p.cellWidth))),w=Math.max(0,Math.min(a.rows-1,Math.floor(v/p.cellHeight)));return{col:x,row:w,x:Math.floor(y),y:Math.floor(v),button:0,action:0}}getWheelDispatchTarget(n){const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm"))||n.element||null}dispatchWheel(n,a,r,o){const c=this.getWheelDispatchTarget(r);if(!c||typeof WheelEvent>"u"||a===0)return!1;const h=this.getLogicalCoordinates(n.clientX,n.clientY),p=a<0?-1:1;let m=0;for(let g=0;g<Math.abs(a);g+=1)try{const y=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:p,deltaMode:1,ctrlKey:!!(o!=null&&o.ctrlKey),altKey:!!(o!=null&&o.altKey),shiftKey:!!(o!=null&&o.shiftKey)});c.dispatchEvent(y),m+=1}catch{return m>0}return m>0}emitWheel(n,a,r,o){if(a===0)return!1;if(this.dispatchWheel(n,a,r,o))return!0;const c=eb(r);if(!(c!=null&&c.triggerMouseEvent))return!1;let h=0;for(let p=0;p<Math.abs(a);p+=1){const m=this.getMouseReport(n,r);m&&(m.button=4,m.action=a<0?0:1,m.ctrl=!!(o!=null&&o.ctrlKey),m.alt=!!(o!=null&&o.altKey),m.shift=!!(o!=null&&o.shiftKey),c.triggerMouseEvent(m)&&(h+=1))}return h>0}scrollAlternateBuffer(n,a,r,o){var h;if(a===0)return"none";const c=cs(r);if(!c&&!this.options.getIsController())return"none";if(this.emitWheel(n,a,r,o))return c?"application-mouse":"application-keys";if(!c){const p=L5(r);if(!(p!=null&&p.triggerDataEvent))return"none";const g=`\x1B${!!((h=p.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${a<0?"A":"B"}`;return p.triggerDataEvent(g.repeat(Math.abs(a)),!0),"application-keys"}return"none"}emitMouse(n,a,r,o){const c=this.options.getTerminal();if(!c)return;const h=eb(c);if(h!=null&&h.triggerMouseEvent){const m=this.getMouseReport(a,c);m&&(m.action=n==="mousedown"?1:n==="mouseup"?0:32,m.ctrl=!!(r!=null&&r.ctrlKey),m.alt=!!(r!=null&&r.altKey),m.shift=!!(r!=null&&r.shiftKey),h.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!o)return;const p=this.getLogicalCoordinates(a.clientX,a.clientY);Gy(o,n,{clientX:p.clientX,clientY:p.clientY,button:0,buttons:n==="mouseup"?0:1})}}class _5{constructor(n){X(this,"options");X(this,"state","idle");X(this,"startX",0);X(this,"startY",0);X(this,"lastX",0);X(this,"lastY",0);X(this,"activeTarget",null);X(this,"longPressTimer",null);X(this,"capturedPointerId",null);X(this,"captureElement",null);X(this,"scrollRemainderY",0);X(this,"delivery");this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...n},this.delivery=new R5(this.options)}getState(){return this.state}setGestureState(n){var a,r;this.state!==n&&(this.state=n,(r=(a=this.options).onGestureStateChange)==null||r.call(a,n))}beginGesture(n,a){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,a),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var r,o;this.state==="pending"&&(this.setGestureState("longpress"),(o=(r=this.options).onLongPress)==null||o.call(r,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(n,a){var g,y,v,x;if(this.state==="longpress"){(y=(g=this.options).onSelectionExtend)==null||y.call(g,{clientX:n.clientX,clientY:n.clientY}),a!=null&&a.cancelable&&((v=a.preventDefault)==null||v.call(a));return}if(this.state==="idle")return;const r=n.clientX-this.startX,o=n.clientY-this.startY,c=Math.hypot(r,o);if(this.state==="scrolling"){this.scrollGesture(n,a);return}const h=this.options.getTerminal(),p=this.options.getIsController(),m=cs(h);if(!(c<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(o)>=Math.abs(r)||!m||!p){this.setGestureState("scrolling"),h&&k5(h),this.lastX=n.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(n,a);return}if(m&&p){this.state==="pending"&&(this.setGestureState("dragging"),this.delivery.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},a,this.activeTarget)),this.state==="dragging"&&(this.lastX=n.clientX,this.lastY=n.clientY,this.delivery.emitMouse("mousemove",n,a,this.activeTarget),a!=null&&a.cancelable&&((x=a.preventDefault)==null||x.call(a)));return}this.lastX=n.clientX,this.lastY=n.clientY}}scrollGesture(n,a){var M,T,A;const r=this.options.getTerminal();if(!r)return;const o=n.clientY-this.lastY;this.lastX=n.clientX,this.lastY=n.clientY;const c=sl(r),h=c.measured?c.cellHeight:this.options.scrollLineHeightPx||c.cellHeight||18;this.scrollRemainderY+=o;const p=Math.trunc(this.scrollRemainderY/h),m=-p;let g=!1,y="none";const v=Yy(r),x=cs(r);if(m!==0){if((v==null?void 0:v.type)==="alternate")y=this.delivery.scrollAlternateBuffer(n,m,r,a),g=y!=="none";else{const N=ld(r);r.scrollLines(m);const E=ld(r);y="buffer",g=N===null||E===null||N!==E}this.scrollRemainderY-=p*h}const w=this.delivery.getViewportElement(r);(T=(M=this.options).onGestureScroll)==null||T.call(M,{deltaY:o,lines:m,viewportY:ld(r),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}),a!=null&&a.cancelable&&((A=a.preventDefault)==null||A.call(a))}endGesture(n,a){var h,p,m;this.clearLongPressTimer();const r=this.options.getTerminal(),o=this.options.getIsController(),c=cs(r);if(this.state==="pending"){if(c&&o){const y={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",y,a,this.activeTarget),this.delivery.emitMouse("mouseup",y,a,this.activeTarget)}const g={clientX:this.startX,clientY:this.startY};o&&r&&this.delivery.isInputLineHit(g,r)&&((p=(h=this.options).onFocus)==null||p.call(h))}else if(this.state==="dragging"&&c&&o){const g=n??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",g,a,this.activeTarget),a!=null&&a.cancelable&&((m=a.preventDefault)==null||m.call(a))}this.reset()}handlePointerDown(n,a){if(n.pointerType==="mouse")return!1;if(!n.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(n.cancelable&&n.preventDefault(),this.beginGesture(n,a),n.pointerType!=="touch")try{typeof a.setPointerCapture=="function"&&(a.setPointerCapture(n.pointerId),this.capturedPointerId=n.pointerId,this.captureElement=a)}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,a){if(n.touches.length!==1){this.reset();return}n.cancelable&&n.preventDefault(),this.beginGesture(n.touches[0],a)}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(),a=this.options.getIsController(),r=cs(n);if(this.state==="dragging"&&r&&a&&this.activeTarget){const o=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);Gy(this.activeTarget,"mouseup",{clientX:o.clientX,clientY:o.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const n=this.captureElement,a=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!n||a===null))try{typeof n.releasePointerCapture=="function"&&(typeof n.hasPointerCapture!="function"||n.hasPointerCapture(a))&&n.releasePointerCapture(a)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function j5({container:l,term:n,isTouchDevice:a,debug:r,getTerminal:o,getIsController:c,getScale:h,getSurfaceElement:p,getSelection:m,onFocus:g}){const y=new _5({getTerminal:o,getIsController:c,getScale:h,getSurfaceElement:p,allowSyntheticMouseFallback:!1,onFocus:()=>{try{n.focus()}catch{}r==null||r(O=>({...O,focused:document.activeElement===n.textarea})),g()},onGestureStateChange:O=>{r==null||r(D=>({...D,state:O}))},onGestureScroll:({deltaY:O,lines:D,viewportY:R,scrollTop:B,scrollHeight:H,clientHeight:q,moved:$,bufferType:W,baseY:le,cursorY:oe,hasScrollback:I,mouseTracking:k,scrollMode:Y})=>{r==null||r(Q=>({...Q,deltaY:O,lines:D,viewportY:R,scrollTop:B,scrollHeight:H,clientHeight:q,moved:$,focused:document.activeElement===n.textarea,bufferType:W,baseY:le,cursorY:oe,hasScrollback:I,mouseTracking:k,scrollMode:Y,scrollCalls:Q.scrollCalls+(D!==0?1:0),lastScrollLines:D}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:a?O=>m().handleLongPress(O):void 0,onSelectionExtend:a?O=>m().handleSelectionExtend(O):void 0}),v=typeof window<"u"&&"PointerEvent"in window,x=typeof TouchEvent<"u",w=[],M={passive:!1,capture:!0},T=(O,D)=>{document.addEventListener(O,D,M),w.push(()=>document.removeEventListener(O,D,M))},A=(O,D=!1)=>{const R=O.target;return R instanceof Node&&l.contains(R)||D&&y.getState()!=="idle"},N=(O,D)=>{r==null||r(R=>({...R,[O]:R[O]+1,lastInputEvent:D}))},E=O=>{const D=m();return D.hasOpenMenu()?(D.clearSelection(),O.cancelable&&O.preventDefault(),O.stopPropagation(),!0):!1},_=()=>{y.getState()==="longpress"&&m().openMenuAtGesture()};if(v){if(T("pointerdown",O=>{if(!A(O)||(N("pointerEvents","pointerdown"),E(O)))return;y.handlePointerDown(O,l)&&O.stopPropagation()}),T("pointermove",O=>{A(O,!0)&&(N("pointerEvents","pointermove"),y.handlePointerMove(O),O.pointerType!=="mouse"&&O.stopPropagation())}),T("pointerup",O=>{A(O,!0)&&(N("pointerEvents","pointerup"),_(),y.handlePointerUp(O),O.pointerType!=="mouse"&&O.stopPropagation())}),T("pointercancel",O=>{A(O,!0)&&(N("pointerEvents","pointercancel"),m().clearSelection(),y.handlePointerCancel(O),O.pointerType!=="mouse"&&O.stopPropagation())}),x){const O=D=>{A(D,!0)&&(r==null||r(R=>({...R,touchEvents:R.touchEvents+1})),D.cancelable&&D.preventDefault(),D.stopPropagation())};for(const D of["touchstart","touchmove","touchend","touchcancel"])T(D,O)}}else T("touchstart",O=>{A(O)&&(N("touchEvents","touchstart"),!E(O)&&(O.touches.length===1&&O.stopPropagation(),y.handleTouchStart(O,l)))}),T("touchmove",O=>{A(O,!0)&&(N("touchEvents","touchmove"),O.touches.length===1&&O.stopPropagation(),y.handleTouchMove(O))}),T("touchend",O=>{A(O,!0)&&(N("touchEvents","touchend"),_(),O.stopPropagation(),y.handleTouchEnd(O))}),T("touchcancel",O=>{A(O,!0)&&(N("touchEvents","touchcancel"),m().clearSelection(),O.stopPropagation(),y.handleTouchCancel())});const z=O=>{O.preventDefault()};return l.addEventListener("contextmenu",z),w.push(()=>l.removeEventListener("contextmenu",z)),()=>{y.handlePointerCancel();for(const O of w)O()}}function O5(l,{requestFit:n,onPageVisible:a}){const r=new ResizeObserver(()=>{n()});r.observe(l);const o=()=>{n()},c=()=>{document.visibilityState==="visible"&&a()};window.addEventListener("resize",o),window.addEventListener("orientationchange",o),document.addEventListener("visibilitychange",c),window.addEventListener("pageshow",c);const h=()=>{n()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",h),window.visualViewport.addEventListener("scroll",h)),()=>{r.disconnect(),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),document.removeEventListener("visibilitychange",c),window.removeEventListener("pageshow",c),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",h),window.visualViewport.removeEventListener("scroll",h))}}function tl(l){if(l)try{l.refresh(0,Math.max(0,l.rows-1))}catch{}}function D5({containerRef:l,surfaceRef:n,termRef:a,rendererRef:r,currentScaleRef:o,initialBannerWrittenRef:c,live:h,selection:p,prediction:m,fit:g,isTouchDevice:y,debug:v,terminalFontSize:x,terminalFontFamily:w,hostTheme:M,glyphRevision:T,terminalResetVersion:A,isActive:N,subscribeToOutput:E,onOutput:_,onTitle:z,onRendererKind:O}){const{requestFit:D,scheduleBoundedFit:R,seedFit:B,cancelPendingFits:H}=g;C.useEffect(()=>{var He,ot;if(!l.current||!n.current)return;const $=l.current,W=Md($,ea(),rd()),le=sl(null,aa),oe=_y({width:W.width,height:W.height,cellWidth:le.cellWidth,cellHeight:le.cellHeight});h.current.sendResize(oe.cols,oe.rows),B(W);const I=E5({fontSize:ng(x,W.width),fontFamily:w,theme:h.current.hostTheme,cols:oe.cols,rows:oe.rows});I.open(n.current),a.current=I;const k=I.onTitleChange(ce=>{z(xd(ce)||null)}),{screenState:Y,fieldProbe:Q,overlay:ae}=m.attach(I);y&&I.textarea&&(I.textarea.readOnly=!1,I.textarea.tabIndex=0,I.textarea.inputMode="text");let Z=()=>{};if(v&&I.textarea){const ce=()=>{v(Ce=>({...Ce,focused:document.activeElement===I.textarea}))};I.textarea.addEventListener("focus",ce),I.textarea.addEventListener("blur",ce),Z=()=>{var Ce,tt;(Ce=I.textarea)==null||Ce.removeEventListener("focus",ce),(tt=I.textarea)==null||tt.removeEventListener("blur",ce)},ce()}const ge=async ce=>{m.discard("paste");const Ce=yy(ce);if(Ce){if(ce.preventDefault(),ce.stopPropagation(),!h.current.isController){h.current.warnViewerMode();return}await h.current.uploadImage(Ce)}};(He=I.textarea)==null||He.addEventListener("paste",ge),$.addEventListener("paste",ge);const be=w5(I,{isSynchronizing:Y.isSynchronizing,onRendererSwapped:ce=>{var Ce;$.dataset.renderer=ce,O(ce),(Ce=m.overlayRef.current)==null||Ce.attach(null),tl(I)}});ae.attach(be.canvas),(ot=be.canvas)==null||ot.setTypingZoneProvider(()=>{const ce=Q.detect();return ce&&{row:ce.row,startCol:ce.startCol,endCol:ce.endCol}});const ye=Y.onSyncEnd(()=>{var ce,Ce;return(Ce=(ce=r.current)==null?void 0:ce.canvas)==null?void 0:Ce.flushHeld()});if(r.current=be,$.dataset.renderer=be.kind,O(be.kind),S5(I,h.current.t("terminal.bannerTitle"),h.current.t("terminal.bannerSubtitle")),c.current=!0,I.write("",()=>void be.verify()),!y)try{I.focus()}catch{}const Me=typeof document<"u"?document.fonts:void 0;typeof(Me==null?void 0:Me.load)=="function"&&Me.load('13px "Symbols Nerd Font Mono"').then(()=>{a.current&&(tl(a.current),R(5))}).catch(()=>{});const de=I.onData(ce=>{const{isController:Ce}=h.current;let tt=ce;if(Ce&&Ny(ce)==="keys"&&Lx(ce)){const yt=h.current.consumeModifierLatch();yt&&(tt=io(ce,yt))}const lt=kd(tt);if(!Ce&&!so(lt)){h.current.warnViewerMode();return}m.onUserInput(lt),h.current.sendBinary(lt)}),xe=I.onBinary(ce=>{const Ce=new Uint8Array(ce.length);for(let tt=0;tt<ce.length;tt++)Ce[tt]=ce.charCodeAt(tt)&255;!h.current.isController&&!so(Ce)||h.current.sendBinary(Ce)}),se=typeof I.onWriteParsed=="function"?I.onWriteParsed(()=>{var yt;if(p.current.onTerminalContentChanged(),Q.invalidate(),Y.isSynchronizing())return;const ce=I.buffer.active,Ce=ce.baseY+ce.cursorY,tt=Array.from({length:8},(bn,dn)=>{var Xt;return((Xt=ce.getLine(Ce-7+dn))==null?void 0:Xt.translateToString(!0))??""}),lt=kw(tt,h.current.platform);lt&&h.current.reportShellProfile(lt),(yt=m.predictorRef.current)==null||yt.onServerOutput(),m.sync()}):{dispose:()=>{}},ve=typeof I.onRender=="function"?I.onRender(ce=>{var Ce;if(h.current.glyphScan){const tt=I.buffer.active.viewportY??0;let lt="";for(let yt=ce.start;yt<=ce.end;yt+=1)lt+=((Ce=I.buffer.active.getLine(tt+yt))==null?void 0:Ce.translateToString(!0))??"";/[^\x00-\x7f]/.test(lt)&&h.current.ensureHostGlyphs(lt)}p.current.onTerminalRender(I,ce.start,ce.end)}):{dispose:()=>{}},ie=typeof I.onScroll=="function"?I.onScroll(()=>{p.current.onTerminalScroll(I),m.discard("scroll")}):{dispose:()=>{}},we=j5({container:$,term:I,isTouchDevice:y,debug:v,getTerminal:()=>a.current,getIsController:()=>h.current.isController,getScale:()=>o.current,getSurfaceElement:()=>n.current,getSelection:()=>p.current,onFocus:()=>{var ce,Ce;return(Ce=(ce=h.current).onTerminalFocus)==null?void 0:Ce.call(ce)}}),Ee=O5($,{requestFit:D,onPageVisible:()=>{R(10),tl(a.current)}});return()=>{var ce;de.dispose(),xe.dispose(),ve.dispose(),ie.dispose(),se.dispose(),k.dispose(),ye.dispose(),m.detach(),Y.dispose(),we(),Ee(),H(),Z(),(ce=I.textarea)==null||ce.removeEventListener("paste",ge),$.removeEventListener("paste",ge),be.dispose(),r.current=null,I.dispose(),a.current=null}},[]),C.useEffect(()=>{const $=a.current;if(!$)return;const W=Md(l.current,ea(),rd());$.options.fontSize=ng(x,W.width),$.options.fontFamily=w,tl($),R(10)},[x,w]),C.useEffect(()=>{var W,le;const $=a.current;!$||!T||((le=(W=r.current)==null?void 0:W.canvas)==null||le.clearTextureAtlas(),tl($))},[T]);const q=C.useRef(A);C.useEffect(()=>{var W;if(q.current===A)return;q.current=A,m.forget("resetVersion");const $=a.current;if($)try{(W=$.reset)==null||W.call($),$.clear(),$.refresh(0,Math.max(0,$.rows-1))}catch{}},[A]),C.useEffect(()=>{const $=a.current;!$||!M||($.options.theme={...M},tl($))},[M]),C.useEffect(()=>E(W=>{const le=a.current;if(!le)throw new Error("terminal not ready");le.write(W),_==null||_(W.byteLength)}),[E,a,_]),C.useEffect(()=>{if(!N)return;R(10);const $=a.current;if($&&(tl($),!y))try{$.focus()}catch{}},[N,y,R,a])}const z5=({onTerminalFocus:l,isActive:n=!0})=>{var Xt;const a=C.useRef(null),r=C.useRef(null),o=C.useRef(null),c=C.useRef(null),h=C.useRef(null),p=C.useRef(1),m=C.useRef(null),g=C.useRef(!1),y=Zx(),v=y||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,x=iC(),[w,M]=C.useState(nC),{metrics:T,record:A}=lC(x),[N,E]=C.useState(null),{settings:_,terminalFontFamily:z,terminalFontSize:O,hostFont:D,ensureHostGlyphs:R,profiles:B,activeProfileId:H,t:q}=Ne(),{isController:$,connectionState:W,hostPalette:le,terminalResetVersion:oe,agentStatus:I,platform:k,reportShellProfile:Y,connect:Q,rttMs:ae}=Je(),{addToast:Z}=un(),{sendResize:ge,sendBinary:be,observeKeyInput:ye,consumeModifierLatch:Me,warnViewerMode:de,subscribeToOutput:xe,subscribeToPasteFileReady:se}=xs(),{uploadImage:ve}=mo(),ie=Qn.useMemo(()=>sw(le),[le]),we=Xn({isController:$,sendBinary:be,sendResize:ge,warnViewerMode:de,uploadImage:ve,t:q,consumeModifierLatch:Me,hostTheme:ie,onTerminalFocus:l,ensureHostGlyphs:R,glyphScan:D.glyphs.status==="ready",platform:k,reportShellProfile:Y}),Ee=Xn(n),He=cT({termRef:h,rendererRef:m,mode:_.predictiveEcho,connectionState:W,observeKeyInput:ye}),[ot,ce]=C.useState(null),Ce=AT({termRef:h,surfaceRef:o,mainRef:c,currentScaleRef:p,addToast:Z,t:q}),tt=Xn(Ce),lt=cC({termRef:h,isController:$,warnViewerMode:de,uploadImage:ve,addToast:Z,t:q,onPaste:()=>He.discard("paste"),subscribeToPasteFileReady:se}),yt=bT({termRef:h,containerRef:a,frameRef:r,surfaceRef:o,currentScaleRef:p,rendererRef:m,initialBannerWrittenRef:g,isActiveRef:Ee,sendResize:ge,onResized:()=>He.forget("resize")});D5({containerRef:a,surfaceRef:o,termRef:h,rendererRef:m,currentScaleRef:p,initialBannerWrittenRef:g,live:we,selection:tt,prediction:He,fit:yt,isTouchDevice:y,debug:x?M:null,terminalFontSize:O,terminalFontFamily:z,hostTheme:ie,glyphRevision:D.glyphRevision,terminalResetVersion:oe,isActive:n,subscribeToOutput:xe,onOutput:x?A:null,onTitle:ce,onRendererKind:E});const bn=Qn.useMemo(()=>{var It;return((It=B.find(ji=>ji.id===H))==null?void 0:It.displayName)??null},[B,H]);C.useEffect(()=>{W!=="connected"&&ce(null)},[W]),C.useEffect(()=>{const It=n&&W==="connected",ji=_.agentAlertBadge?gs(I):null;GS(It?ot:null,bn,ji)},[n,W,ot,bn,I,_.agentAlertBadge]),C.useEffect(()=>{W==="disconnected"&&Q()},[]);const dn=It=>{It.preventDefault()};return f.jsxs("main",{ref:c,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:dn,"aria-label":q("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:a,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:dn,"aria-label":q("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:r,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:o,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),x&&f.jsx(oC,{debug:w,rttMs:ae,metrics:T,rendererKind:N,predictiveEcho:_.predictiveEcho,predictor:He.predictorRef.current,field:((Xt=He.fieldProbeRef.current)==null?void 0:Xt.detect())??null,renderer:m.current}),y&&Ce.selectionRect&&Ce.isHighlightVisible&&f.jsx(ET,{term:h.current,surface:o.current,main:c.current,rect:Ce.selectionRect,viewportY:Ce.viewportY}),y&&Ce.selectionMenu&&f.jsx(tC,{anchorPoint:Ce.selectionMenu,hasSelection:!!Ce.selectionSnapshot,isController:$,vibrateOnKeyPress:_.vibrateOnKeyPress,linkUrl:Ce.selectionMenu.link??null,onOpenLink:It=>{wd(It)||Z("warning",q("clipboard.openLinkFailed"))},onCopySelection:Ce.handleCopySelection,onCopyLine:Ce.handleCopyLine,onCopyScreen:Ce.handleCopyScreen,onPaste:lt.handlePaste,onClose:Ce.clearSelection}),y&&f.jsx(eC,{isOpen:lt.isPasteFallbackOpen,onClose:lt.closePasteFallback,onSend:lt.handleFallbackPasteSend,onSendImage:lt.handleFallbackImageSend})]})},H5=2e3;function yo(){const{t:l}=Ne(),{addToast:n}=un(),[a,r]=C.useState(null),o=C.useRef(null);C.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const c=C.useCallback((h,p,m="success")=>{Id(h).then(g=>{if(g==="failed"){n("error",l("clipboard.copyFailed"));return}r(h),n(m,p),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>r(null),H5)})},[n,l]);return{copied:a,copy:c}}const il="herdr-remote pair",tb="herdr-remote",B5=({onPairedSuccess:l})=>{const{settings:n,updateSettings:a,t:r}=Ne(),{connect:o,connectionState:c,stateDetail:h}=Je(),{addToast:p}=un(),[m,g]=C.useState(""),{copied:y,copy:v}=yo(),[x,w]=C.useState(!1),[M,T]=C.useState(n.wsUrl||cn),[A,N]=C.useState(n.token||""),[E,_]=C.useState(n.clientId||""),z=B=>v(B,r("toasts.commandCopied")),O=B=>{B.preventDefault();const H=m.trim().toUpperCase();if(!H&&!A.trim()){p("warning",r("toasts.connectionError"));return}const q={pairCode:H,wsUrl:M.trim()||cn,clientId:E.trim()||n.clientId};A.trim()&&(q.token=A.trim()),a(q),o({pairCode:H||void 0,token:A.trim()||void 0,wsUrl:M.trim()||cn,clientId:E.trim()||n.clientId}),l&&l()},D=c==="connecting"||c==="reconnecting",R=({n:B})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",B,"]"]});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:r("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:r("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:r("onboarding.description")})]}),c==="error"&&f.jsxs(ki,{tone:"warn",action:f.jsx(Ae,{variant:"warn",onClick:()=>o(),children:r("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:r("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:h||r("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:O,className:"grid gap-3",children:[f.jsx(At,{title:r("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(R,{n:1}),f.jsx("span",{className:"leading-snug",children:r("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:il}),f.jsx(Ae,{onClick:()=>z(il),glyph:y===il?Le.check:"⧉",className:ne("shrink-0",y===il&&"border-tui-ok text-tui-ok"),children:r(y===il?"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:r("onboarding.step1TuiNote")}),f.jsx("button",{type:"button",onClick:()=>z(tb),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:r("common.clickToCopy"),children:f.jsx("code",{children:tb})})]})})]})}),f.jsx(At,{title:r("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(R,{n:2}),f.jsx(Rt,{type:"text",value:m,onChange:B=>g(B.target.value.toUpperCase()),placeholder:r("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":r("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("onboarding.step2Note")})]})}),f.jsx(Ae,{variant:"primary",type:"submit",block:!0,disabled:D,className:"py-1.5",children:D?f.jsx(al,{label:r("onboarding.connectingAndPairing")}):r("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?Le.chevronDown:Le.chevronRight}),f.jsx("span",{className:"uppercase",children:r("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(qn,{htmlFor:"onboarding-token",children:r("onboarding.manualTokenLabel")}),f.jsx(Rt,{id:"onboarding-token",type:"password",value:A,onChange:B=>N(B.target.value),placeholder:r("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"onboarding-ws",children:r("onboarding.wsEndpointLabel")}),f.jsx(Rt,{id:"onboarding-ws",type:"text",value:M,onChange:B=>T(B.target.value),placeholder:r("onboarding.wsEndpointPlaceholder")})]}),f.jsx(RS,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"onboarding-client-id",children:r("onboarding.clientIdLabel")}),f.jsx(Rt,{id:"onboarding-client-id",type:"text",value:E,onChange:B=>_(B.target.value)})]})]})]})]})]})})},Wn="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",ws="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",U5="border-tui-accent bg-tui-accent text-tui-crust font-bold",K5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Py={default:ws,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 I5(l){return{capHeight:l?"h-8":"h-7",keyClass:l?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:l?"h-8 w-8":"h-7 w-7",drawerToggleClass:l?"h-8 px-1.5":"h-7 px-1.5"}}function F5({capHeight:l,onCustomize:n,sendCombo:a}){const{settings:r,t:o}=Ne(),{agentProfile:c,shellProfile:h}=Je(),p=$x(c,r.agentKeymaps[c],h),m=y=>{let v="";try{v=rs(y.combo)}catch{}const x=y.custom?y.customLabel||"":o(`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:()=>a(y.combo),className:ne(Wn,l,"max-w-[10rem] gap-1 px-1.5",Py[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=[...p.agentActions,...p.genericActions];return g.length===0&&!n?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${nl[c].name} ${o("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),g.map(m),n&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:n,className:ne(Wn,l,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:o("agentKeymaps.customizeBar"),"aria-label":o("agentKeymaps.customizeBar"),children:o("agentKeymaps.customizeBarShort")})]})}const $y="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function G5({capHeight:l,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(a=>{const r=`F${a}`;return f.jsxs("button",{type:"button",onClick:()=>n(re[r]),className:ne(Wn,ws,l),children:["F",a]},r)})})}const Y5=[{code:re.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:re.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:re.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:re.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:re.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:re.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:re.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:re.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function P5({capHeight:l,onKey:n}){const{t:a}=Ne();return f.jsx("div",{className:$y,children:Y5.map(r=>f.jsxs("button",{type:"button",onClick:()=>n(r.code,!1),className:ne(Wn,l,"gap-1.5 px-2",Py[r.tone??"default"]),title:a(r.title),children:[f.jsx("span",{className:"font-bold",children:r.caption}),f.jsx("span",{className:"text-tui-sm opacity-70",children:a(r.badge)})]},r.caption))})}const $5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function q5({squareKeyClass:l,onKey:n}){return f.jsx("div",{className:$y,children:$5.map(a=>f.jsx("button",{type:"button",onClick:()=>n(a,!0),className:ne(Wn,ws,l,"font-bold"),children:a},a))})}const nb="image/png,image/jpeg,image/webp,image/gif,image/*";function ib({fileInputRef:l}){const{uploadImage:n}=mo(),a=r=>{var c;const o=(c=r.target.files)==null?void 0:c[0];r.target.value="",o&&n(o)};return f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:l,type:"file",accept:nb,className:"hidden","data-testid":"key-toolbar-file-input",onChange:a}),f.jsx("input",{type:"file",accept:nb,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:a})]})}function lb({collapsed:l}){const{uploadProgress:n}=mo();return n.active?f.jsx("div",{"data-testid":l?"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(DS,{ratio:n.ratio,label:n.statusText,tone:n.phase==="completed"?"ok":n.phase==="error"?"bad":"accent","aria-label":n.statusText})}):null}function V5({fileInputRef:l,keyClass:n,vibrate:a}){const{t:r}=Ne(),{isController:o}=Je(),{warnViewerMode:c}=xs(),{uploadProgress:h}=mo(),p=h.active,m=()=>{var g;if(a(),!o){c();return}p||(g=l.current)==null||g.click()};return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:m,disabled:p,className:ne(Wn,n,p?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":ws),title:p?h.statusText:r("virtualKeyboard.uploadImageTitle"),"aria-label":r("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:p?`${h.percent}%`:r("virtualKeyboard.image")})})}function X5(){const{settings:l}=Ne(),{isController:n}=Je(),{sendKey:a,warnViewerMode:r,consumeModifierLatch:o}=xs(),c=C.useRef([]);C.useEffect(()=>()=>{for(const g of c.current)clearTimeout(g);c.current=[]},[]);const h=C.useCallback(()=>{if(l.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[l.vibrateOnKeyPress]),p=C.useCallback((g,y=!0)=>{if(h(),!n){r();return}const v=o();a(y&&v?io(g,v):g)},[n,a,r,h,o]),m=C.useCallback(g=>{if(h(),!n){r();return}let y;try{y=Tn(g)}catch{return}if(o(),y.length===1){a(y[0]);return}y.forEach((v,x)=>{const w=setTimeout(()=>{c.current=c.current.filter(M=>M!==w),a(v)},x*120);c.current.push(w)})},[o,n,a,h,r]);return{vibrate:h,pressKey:p,sendCombo:m}}function Z5({capHeight:l}){const{platform:n,isAdminTerminal:a,adminTerminalSupported:r}=Je(),{activeProfileId:o,t:c}=Ne();if(n!=="win32"||a)return null;const h=r!==!1,p=()=>{const m=new URL(window.location.href);m.searchParams.set("adminTerminal","1"),m.searchParams.set("profile",o),window.open(m.toString(),"_blank","noopener,noreferrer")};return f.jsxs("button",{type:"button","data-testid":"new-admin-terminal",onClick:p,disabled:!h,className:ne(Wn,l,"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:c(h?"terminal.adminTerminalSetup":"terminal.adminTerminalUpdate"),"aria-label":c("terminal.newAdminTerminal"),children:[f.jsx("span",{"aria-hidden":"true",children:"⬆"}),f.jsx("span",{children:c("terminal.adminShort")})]})}const Q5=({compact:l=!1,onCustomize:n})=>{const{settings:a,updateSettings:r,t:o}=Ne(),{modifierLatch:c,toggleModifierLatch:h}=xs(),{vibrate:p,pressKey:m,sendCombo:g}=X5(),{capHeight:y,keyClass:v,squareKeyClass:x,drawerToggleClass:w}=I5(l),M=C.useRef(null),[T,A]=C.useState(!1),[N,E]=C.useState(!1),[_,z]=C.useState(!1),O=C.useRef(null),[D,R]=C.useState(!1),B=C.useCallback(()=>{const I=O.current;R(!!I&&I.scrollLeft+I.clientWidth<I.scrollWidth-1)},[]);if(C.useEffect(B),C.useEffect(()=>{const I=O.current;if(!I||typeof ResizeObserver!="function")return;const k=new ResizeObserver(B);return k.observe(I),()=>k.disconnect()},[B,a.toolbarVisible]),!a.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[f.jsx(ib,{fileInputRef:M}),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:()=>r({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:o("virtualKeyboard.expandToolbar"),"aria-label":o("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:o("common.keyBar")})]})})]});const H=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys.filter(I=>I.enabled):Kb,q=I=>I.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):I.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):I.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):I.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):I.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:o("virtualKeyboard.keyEnter")})]}):I.id==="drawer_chords"?f.jsx("span",{children:"^C"}):I.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:T?"▾":"▴"})]}):f.jsx("span",{children:I.label}),$=I=>{if(p(),I.type==="modifier"){I.modifierType==="ctrl"||I.modifierType==="alt"||I.modifierType==="shift"?h(I.modifierType):I.modifierType==="meta"&&m(re.ESC);return}if(I.type==="drawer"){I.drawerType==="fn"?(A(!T),E(!1),z(!1)):I.drawerType==="chords"?(z(!_),A(!1),E(!1)):I.drawerType==="symbols"&&(E(!N),A(!1),z(!1));return}m(I.code,I.type!=="chord")},W=I=>{if(I.type==="modifier"){if(I.modifierType==="ctrl")return c.ctrl;if(I.modifierType==="alt")return c.alt;if(I.modifierType==="shift")return c.shift}if(I.type==="drawer"){if(I.drawerType==="fn")return T;if(I.drawerType==="chords")return _;if(I.drawerType==="symbols")return N}return!1},le=I=>{const k=W(I),Y=["left","up","down","right"].includes(I.id),Q=I.type==="drawer",ae=hd(I,o);return f.jsx("button",{type:"button",onClick:()=>$(I),className:ne(Wn,Y?x:Q?w:v,I.id==="enter"?K5:k?U5:ws),title:ae,"aria-label":ae,"aria-pressed":k,children:q(I)},I.id)},oe=H.find(I=>I.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",l?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":o("virtualKeyboard.touchKeyboardShortcuts"),children:[f.jsx(ib,{fileInputRef:M}),f.jsx(lb,{collapsed:!1}),T&&f.jsx(G5,{capHeight:y,onKey:m}),_&&f.jsx(P5,{capHeight:y,onKey:m}),N&&f.jsx(q5,{squareKeyClass:x,onKey:m}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("flex flex-nowrap items-center justify-start gap-1",l?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:O,"data-testid":"key-toolbar-scroll",onScroll:B,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:()=>r({toolbarVisible:!1}),className:ne(Wn,x,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:o("virtualKeyboard.collapseToolbar"),"aria-label":o("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),H.filter(I=>I.id!=="enter").map(le),f.jsx(Z5,{capHeight:y}),f.jsx(F5,{capHeight:y,onCustomize:n,sendCombo:g}),f.jsx(V5,{fileInputRef:M,keyClass:v,vibrate:p})]}),D&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),oe&&le(oe)]})]})},W5=({isOpen:l,onClose:n})=>{const{t:a}=Ne(),{isController:r,shellProfile:o}=Je(),{sendKey:c,warnViewerMode:h}=xs(),[p,m]=C.useState("");if(!l)return null;const g=Lw(o),y=x=>{if(x&&x.preventDefault(),!r){h();return}p.length>0?(c(`${p}\r`),m("")):c("\r")},v=x=>{if(!r){h();return}c(`${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":a("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:a("virtualKeyboard.helperTitle")}),f.jsx(Ae,{variant:"ghost",onClick:n,"aria-label":a("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:a("virtualKeyboard.placeholder")}),f.jsx(Rt,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:p,onChange:x=>m(x.target.value),placeholder:a("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),p.length>0&&f.jsx("button",{type:"button",onClick:()=>m(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":a("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:Le.cross})})]}),f.jsx(Ae,{variant:"primary",type:"submit",title:a("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:a("virtualKeyboard.sendButton")})})]})]})};function vo(l,n){const a=(r,o)=>n?n(r):o;switch(l){case"connected":return{label:a("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:a("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:a("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:a("connection.reconnectNow","Reconnect now")};case"error":return{label:a("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:a("connection.retry","Retry")};default:return{label:a("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:a("connection.connect","Connect")}}}const J5={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},eM=({isOpen:l,onClose:n,isAddMode:a=!1})=>{const{settings:r,updateSettings:o,t:c,activeProfile:h,activeProfileId:p,addProfileAndConnect:m,renameProfile:g}=Ne(),{connect:y,disconnect:v,connectionState:x,hostId:w}=Je(),{addToast:M}=un(),[T,A]=C.useState(r.wsUrl),[N,E]=C.useState(r.token),[_,z]=C.useState(r.pairCode),[O,D]=C.useState(r.clientId),[R,B]=C.useState((h==null?void 0:h.displayName)||""),[H,q]=C.useState(r.autoReconnect),{copied:$,copy:W}=yo(),le=$!==null;if(C.useEffect(()=>{l&&(A(r.wsUrl),E(a?"":r.token),z(a?"":r.pairCode),D(r.clientId),B(a?"":(h==null?void 0:h.displayName)||""),q(r.autoReconnect))},[l,a,r,h]),!l)return null;const oe=Q=>{Q.preventDefault();const ae={wsUrl:T.trim()||cn,token:N.trim(),pairCode:_.trim().toUpperCase(),clientId:O.trim()||r.clientId,autoReconnect:H};if(!ae.token&&!ae.pairCode){M("warning",c("pairing.credentialsRequired"));return}a?m({...ae,displayName:R.trim()||void 0}):(o(ae),p&&R.trim()&&g(p,R),v(),y({wsUrl:ae.wsUrl,token:ae.token||void 0,pairCode:ae.pairCode||void 0,clientId:ae.clientId,autoReconnect:H})),n()},I=()=>{const Q=`client-${Math.random().toString(36).substring(2,8)}`;D(Q)},k=()=>{const Q=new URL(window.location.href);Q.search="",_.trim()&&Q.searchParams.set("pairCode",_.trim().toUpperCase()),W(Q.toString(),c("toasts.pairingLinkCopied"))},Y=J5[x]??"idle";return f.jsxs(bo,{isOpen:l,onClose:n,title:c(a?"pairing.addTitle":"pairing.title"),subtitle:c("pairing.subtitle"),closeLabel:c("common.closeDialog"),hints:[{keys:"esc",action:c("common.close")},{keys:"⏎",action:c("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[x==="connected"&&f.jsx(Ae,{variant:"danger",onClick:()=>{v(),n()},children:c("common.disconnect")}),f.jsx(Ae,{variant:"primary",type:"submit",form:"pairing-form",children:c("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Kt,{level:Y}),f.jsx("span",{className:"text-tui-muted",children:c("common.status")}),f.jsx("span",{className:ne(Y==="ok"?"text-tui-ok":Y==="bad"?"text-tui-bad":Y==="warn"?"text-tui-warn":"text-tui-faint"),children:vo(x,c).label})]}),w&&f.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[c("common.host")," ",f.jsx("span",{className:"text-tui-text",children:w})]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:oe,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"pairing-name",children:c("pairing.displayNameLabel")}),f.jsx(Rt,{id:"pairing-name",type:"text",value:R,onChange:Q=>B(Q.target.value),placeholder:c("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:c("pairing.displayNameHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"pairing-code",hint:c("pairing.pairCodeNote"),children:c("pairing.pairCodeLabel")}),f.jsx(Rt,{id:"pairing-code",type:"text",value:_,onChange:Q=>z(Q.target.value.toUpperCase()),placeholder:c("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:c("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"pairing-token",hint:c("pairing.tokenNote"),children:c("pairing.tokenLabel")}),f.jsx(Rt,{id:"pairing-token",type:"password",value:N,onChange:Q=>E(Q.target.value),placeholder:c("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"pairing-ws",children:c("pairing.wsUrlLabel")}),f.jsx(Rt,{id:"pairing-ws",type:"text",value:T,onChange:Q=>A(Q.target.value),placeholder:c("pairing.wsUrlPlaceholder")}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:c("pairing.wsUrlDefaultNote")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"pairing-client-id",children:c("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Rt,{id:"pairing-client-id",type:"text",value:O,onChange:Q=>D(Q.target.value),className:"flex-1"}),f.jsx(Ae,{onClick:I,title:c("pairing.regenerateClientIdTitle"),className:"shrink-0",children:c("pairing.newIdButton")})]})]}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(jS,{checked:H,onChange:q,label:c("pairing.autoReconnectLabel"),description:c("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(Ae,{onClick:k,block:!0,glyph:le?Le.check:"⧉",className:ne(le&&"border-tui-ok text-tui-ok"),children:c("pairing.copyDirectLink")})})]})]})},Ni=ne(go,"py-0"),tM="h-7 py-0",Ad="h-7 py-0 px-1.5",fo="text-tui-bad hover:border-tui-bad hover:text-tui-bad",nM=["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 qy(l){return{offLabel:l("settings.toggleOff"),onLabel:l("settings.toggleOn")}}const iM=({profile:l,onProfileChange:n})=>{const{settings:a,updateSettings:r,t:o}=Ne(),{agentProfile:c}=Je(),[h,p]=C.useState({}),m=C.useRef({}),[g,y]=C.useState(""),[v,x]=C.useState(""),w=l||c,M=a.agentKeymaps[w]||{},T=wb(w,M),A=Sb(w,M),N=A.filter(k=>!k.hidden).length,E=k=>k.custom?k.customLabel||"":o(`agentActions.${k.labelKey}`),_=k=>{try{return rs(k.combo)}catch{return k.combo}},z=k=>{r({agentKeymaps:{...a.agentKeymaps,[w]:k}})},O=(k,Y)=>{var Q;z({...M,actions:{...M.actions,[k]:{...(Q=M.actions)==null?void 0:Q[k],...Y}}})},D=k=>{O(k.id,{keys:k.defaultCombo})},R=(k,Y)=>{const Q=k+(Y==="up"?-1:1);if(Q<0||Q>=T.length)return;const ae=T.map(Z=>Z.id);[ae[k],ae[Q]]=[ae[Q],ae[k]],z({...M,order:ae})},B=k=>{var Y;z({...M,custom:(M.custom||[]).filter(Q=>Q.id!==k),order:(Y=M.order)==null?void 0:Y.filter(Q=>Q!==k)})},H=()=>z(qx(M)),q=()=>{const k={...a.agentKeymaps};delete k[w],r({agentKeymaps:k})},$=()=>{const k=g.trim();if(!k)return;try{Tn(v)}catch{return}const Y=`custom-${Date.now().toString(36)}`;z({...M,custom:[...M.custom||[],{id:Y,label:k,keys:v.trim()}],order:[...T.map(Q=>Q.id),Y]}),y(""),x("")},W=k=>k instanceof Cn?o(`agentKeymaps.errors.${k.code}`,k.params):String(k),le=(k,Y)=>`${k}:${Y}`,oe=(k,Y)=>{const Q=le(w,k);m.current={...m.current,[Q]:Y},p(m.current);try{Tn(Y),O(k,{keys:Y})}catch{}},I=k=>{const Y=le(w,k),Q=m.current[Y];if(Q!==void 0){delete m.current[Y],p({...m.current});try{Tn(Q),O(k,{keys:Q})}catch{}}};return f.jsxs("div",{className:"space-y-4",children:[f.jsx(gn,{title:o("agentKeymaps.settingsProfileLabel"),aside:f.jsx(Ae,{variant:"ghost",onClick:q,className:ne(fo,Ad),children:o("agentKeymaps.restoreProfile")}),children:f.jsx(Ut,{label:o("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:nl[w].configHint?o("agentKeymaps.configHint",{path:nl[w].configHint}):void 0,control:f.jsx(po,{id:"agent-keymap-profile","aria-label":o("agentKeymaps.settingsProfileLabel"),value:w,onChange:k=>n(k.target.value),className:Ni,children:zx.map(k=>f.jsx("option",{value:k,children:nl[k].name},k))})})}),f.jsx(gn,{title:o("agentKeymaps.barGroup"),aside:f.jsx(Ae,{variant:"ghost",onClick:H,className:ne(fo,Ad),children:o("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:o("agentKeymaps.barHint",{profile:nl[w].name,count:N})}),f.jsx("div",{role:"group","aria-label":o("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:A.map(k=>{const Y=E(k),Q=_(k),ae=!k.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${k.id}`,"aria-pressed":ae,onClick:()=>O(k.id,{hidden:ae}),title:`${Q} ${Y}`.trim(),className:ne("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",ae?"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:ae?Le.check:"+"}),f.jsx("span",{className:"font-bold",children:Q}),f.jsx("span",{className:ae?void 0:"opacity-80",children:Y})]},k.id)})})]})}),f.jsx(gn,{title:o("agentKeymaps.listGroup",{profile:nl[w].name}),children:T.map((k,Y)=>{var de,xe;const Q=E(k),ae=o("agentKeymaps.defaultCombo",{combo:rs(k.defaultCombo)}),Z=((xe=(de=M.actions)==null?void 0:de[k.id])==null?void 0:xe.keys)??k.combo,ge=le(w,k.id),be=h[ge]??Z;let ye="",Me=null;try{Tn(be),ye=rs(be)}catch(se){Me=W(se)}return f.jsxs("div",{"data-testid":`agent-setting-row-${k.id}`,className:nM,children:[f.jsx(py,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:ye||"—"}),f.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:Q,children:[Q,!k.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:o("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${k.id}`,children:[o("agentKeymaps.shortcutLabel")," ",Q]}),f.jsx(Rt,{id:`agent-combo-${k.id}`,"aria-label":`${o("agentKeymaps.shortcutLabel")} ${Q}`,value:be,onChange:se=>oe(k.id,se.target.value),onBlur:()=>I(k.id),onKeyDown:se=>{se.key==="Enter"&&se.currentTarget.blur()},placeholder:o("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Me,className:ne("w-full min-w-0 [grid-area:combo]",tM)}),f.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:ae,children:ae}),f.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[f.jsx(ll,{onClick:()=>D(k),title:o("agentKeymaps.resetAction"),"aria-label":`${o("agentKeymaps.resetAction")} ${Q}`,children:"↺"}),f.jsx(ll,{disabled:Y===0,onClick:()=>R(Y,"up"),title:o("agentKeymaps.moveUp"),"aria-label":`${o("agentKeymaps.moveUp")} ${Q}`,children:"↑"}),f.jsx(ll,{disabled:Y===T.length-1,onClick:()=>R(Y,"down"),title:o("agentKeymaps.moveDown"),"aria-label":`${o("agentKeymaps.moveDown")} ${Q}`,children:"↓"}),k.custom?f.jsx(ll,{variant:"danger",onClick:()=>B(k.id),title:o("agentKeymaps.removeCustom"),"aria-label":`${o("agentKeymaps.removeCustom")} ${Q}`,children:Le.cross}):f.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),Me&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:o("agentKeymaps.invalidCombo",{error:Me})})]},k.id)})}),f.jsx(gn,{title:o("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:o("agentKeymaps.customLabel")}),f.jsx(Rt,{value:g,onChange:k=>y(k.target.value),className:Ni})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[f.jsx("span",{children:o("agentKeymaps.customCombo")}),f.jsx(Rt,{value:v,onChange:k=>x(k.target.value),placeholder:o("agentKeymaps.comboPlaceholder"),className:Ni})]}),f.jsx(Ae,{variant:"primary",glyph:"+",onClick:$,disabled:!g.trim()||!v.trim(),className:Ni,children:o("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return Tn(v),f.jsx("p",{className:"text-tui-sm text-tui-info",children:rs(v)})}catch(k){const Y=W(k);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:Y})}})()]})})]})},Vy={"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"},lM=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],aM=()=>{const{hostFont:l,loadHostFont:n,declineHostFont:a,settings:r,activeProfile:o,t:c}=Ne(),{herdrLaunch:h,hostname:p}=Je(),{addToast:m}=un(),{font:g,status:y,glyphs:v}=l,x=y==="loading"||v.status==="loading",w=y==="failed"||v.status==="failed",M=C.useRef(!1);C.useEffect(()=>{M.current&&!x&&!w&&l.interactive&&m("success",c("hostFont.loaded")),M.current=x&&l.interactive},[x,w,l.interactive,m,c]);const T=y==="available"||v.status==="available",A=l.interactive&&(x||w);if(!(g&&r.fontFamily==="host"&&!h&&(T||A)))return null;const E=y==="available"||l.interactive&&(y==="loading"||y==="failed"),_=v.source&&(v.status==="available"||l.interactive&&(v.status==="loading"||v.status==="failed")),z=p||(o==null?void 0:o.displayName)||c("herdrLaunch.thisHost"),O=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?Vy[g.source]||g.source:null].filter(Boolean).join(c("hostFont.detailSeparator")),D=l.error&&lM.includes(l.error)?l.error:"other",R=l.totalBytes?l.receivedBytes/l.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(At,{title:c("hostFont.title"),tone:y==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":c("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:E||!v.source?c("hostFont.body",{host:z,family:g.family,detail:O?c("hostFont.detail",{detail:O}):""}):c("hostFont.bodyGlyphsOnly",{host:z,family:v.source.family})}),x?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(OS,{value:R,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:c("hostFont.loading",{received:Yu(l.receivedBytes),total:Yu(l.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[w?f.jsx(ki,{tone:"bad",children:c("hostFont.failed",{reason:c(`hostFont.reasons.${D}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[E&&g.faces.length?f.jsx("p",{children:c("hostFont.download",{count:g.faces.length,size:Yu(l.totalBytes)})}):null,_&&v.source?f.jsx("p",{children:c(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(Ae,{onClick:a,children:c("hostFont.decline")}),f.jsx(Ae,{variant:"primary",onClick:n,autoFocus:!0,children:c(w?"common.retry":"hostFont.load")})]})]})]})})},sM=({onOpenAdmin:l})=>{var O;const{settings:n,updateSettings:a,language:r,setLanguage:o,t:c,hostFont:h,syncHostFont:p,terminalFontFamily:m,terminalFontSize:g}=Ne(),{connectionState:y}=Je(),v=od.find(D=>D.id===n.fontFamily),x=(D,R)=>D==="host"||D==="system"?c(`fontPresets.${D}`):R,w=(()=>{const{font:D,status:R}=h,B=h.totalBytes?Math.round(h.receivedBytes/h.totalBytes*100):0,H=c(`settings.hostFontStatus.${R}`,{percent:B});return D?[D.family,D.sizePx?`${Math.round(D.sizePx)}px`:null,D.source?Vy[D.source]||D.source:null,H].filter(Boolean).join(" · "):H})(),M=(O=h.font)!=null&&O.sizePx?ta(h.font.sizePx):null,T=h.glyphs.source&&h.glyphs.status!=="none"?c("settings.hostGlyphLine",{family:h.glyphs.source.family,status:c(`settings.hostGlyphStatus.${h.glyphs.status}`,{count:h.glyphs.covered.toLocaleString()})}):null,A=typeof window<"u"&&window.isSecureContext&&"Notification"in window,N=10,E=24,_=qy(c),z=M?c("settings.fontSizeFollowHost",{size:M}):c("settings.fontSizeFollowHostUnknown");return f.jsxs("div",{className:"space-y-4",children:[f.jsx(gn,{title:c("settings.sectionInterface"),children:f.jsx(Ut,{label:c("settings.languageLabel"),control:f.jsx(kg,{name:"ui-language","aria-label":c("settings.languageLabel"),value:r,onChange:o,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),f.jsxs(gn,{title:c("settings.sectionFont"),children:[f.jsx(Ut,{label:c("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:f.jsxs(po,{id:"terminal-font-select",value:n.fontFamily,onChange:D=>a({fontFamily:D.target.value}),"aria-label":c("settings.fontFamilyLabel"),className:Ni,children:[!v&&f.jsx("option",{value:n.fontFamily,children:n.fontFamily}),od.map(D=>f.jsx("option",{value:D.id,children:x(D.id,D.name)},D.id))]})}),n.fontFamily==="host"&&f.jsx(Ut,{label:c("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}),T?f.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:T}):null]}),control:f.jsx(Ae,{block:!0,onClick:p,disabled:y!=="connected"||h.status==="loading"||h.glyphs.status==="loading",className:Ni,children:c("settings.hostFontSync")})}),f.jsx(Ut,{label:c("settings.fontSizeLabel",{size:g}),hint:c("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:f.jsx("div",{className:ne("flex items-center",go),children:f.jsx("input",{id:"terminal-font-size",type:"range",min:N,max:E,step:1,value:g,onChange:D=>a({fontSize:Number(D.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),f.jsx(Ut,{label:z,control:f.jsx(Ai,{label:z,..._,checked:n.fontSizeFollowsHost,onChange:D=>a(D?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),f.jsx("div",{className:"py-1.5",children:f.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:m,fontSize:`${g}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),f.jsxs(gn,{title:c("settings.sectionInput"),children:[f.jsx(Ut,{label:c("settings.predictiveEchoLabel"),hint:c("settings.predictiveEchoDesc"),control:f.jsx(kg,{name:"predictive-echo","aria-label":c("settings.predictiveEchoLabel"),value:n.predictiveEcho,onChange:D=>a({predictiveEcho:D}),options:[{value:"auto",label:c("settings.predictiveEchoAuto")},{value:"always",label:c("settings.predictiveEchoAlways")},{value:"off",label:c("settings.predictiveEchoOff")}]})}),f.jsx(Ut,{label:c("settings.touchKeyToolbar"),hint:c("settings.touchKeyToolbarDesc"),control:f.jsx(Ai,{label:c("settings.touchKeyToolbar"),..._,checked:n.toolbarVisible,onChange:D=>a({toolbarVisible:D})})}),f.jsx(Ut,{label:c("settings.touchHaptics"),hint:c("settings.touchHapticsDesc"),control:f.jsx(Ai,{label:c("settings.touchHaptics"),..._,checked:n.vibrateOnKeyPress,onChange:D=>a({vibrateOnKeyPress:D})})})]}),f.jsxs(gn,{title:c("settings.agentAlertsLabel"),children:[f.jsx(Ut,{label:c("settings.agentAlertBadge"),hint:c("settings.agentAlertBadgeDesc"),control:f.jsx(Ai,{label:c("settings.agentAlertBadge"),..._,checked:n.agentAlertBadge,onChange:D=>a({agentAlertBadge:D})})}),f.jsx(Ut,{label:c("settings.agentAlertVibrate"),hint:c("settings.agentAlertVibrateDesc"),control:f.jsx(Ai,{label:c("settings.agentAlertVibrate"),..._,checked:n.agentAlertVibrate,onChange:D=>a({agentAlertVibrate:D})})}),f.jsx(Ut,{label:c("settings.agentAlertSound"),hint:c("settings.agentAlertSoundDesc"),control:f.jsx(Ai,{label:c("settings.agentAlertSound"),..._,checked:n.agentAlertSound,onChange:D=>{a({agentAlertSound:D}),D&&(Zb(),Qb("done"))}})}),A&&f.jsx(Ut,{label:c("settings.agentAlertNotify"),hint:c("settings.agentAlertNotifyDesc"),control:f.jsx(Ai,{label:c("settings.agentAlertNotify"),..._,checked:n.agentAlertNotify,onChange:D=>{if(D&&Notification.permission!=="granted"){Notification.requestPermission().then(R=>a({agentAlertNotify:R==="granted"}));return}a({agentAlertNotify:D})}})})]}),l&&f.jsx(gn,{title:c("settings.sectionAdmin"),children:f.jsx(Ut,{label:c("settings.adminEntry"),hint:c("settings.adminEntryHint"),control:f.jsx(Ae,{block:!0,variant:"primary",glyph:Le.arrowRight,onClick:l,className:Ni,children:c("settings.adminEntryOpen")})})})]})},rM=()=>{const{settings:l,updateSettings:n,t:a}=Ne(),{addToast:r}=un(),[o,c]=C.useState(!1),h=qy(a),p=l.virtualKeys&&l.virtualKeys.length>0?l.virtualKeys:ps(),m=w=>{const M=p.map(T=>T.id===w?{...T,enabled:!T.enabled}:T);n({virtualKeys:M})},g=(w,M)=>{const T=M==="up"?w-1:w+1;if(T<0||T>=p.length)return;const A=[...p],N=A[w];A[w]=A[T],A[T]=N,n({virtualKeys:A})},y=w=>{if(p.some(T=>T.id===w.id)){const T=p.map(A=>A.id===w.id?{...A,enabled:!0}:A);n({virtualKeys:T})}else{const T=[...p,{...w,enabled:!0}];n({virtualKeys:T})}c(!1)},v=w=>{const M=p.filter(T=>T.id!==w);n({virtualKeys:M})},x=()=>{n({virtualKeys:ps()}),r("info",a("toasts.keyLayoutReset"))};return f.jsxs("div",{className:"space-y-3",children:[f.jsx(gn,{title:a("virtualKeyboard.customizeTitle"),aside:f.jsx(Ae,{variant:"ghost",onClick:x,className:ne(fo,Ad),children:a("virtualKeyboard.resetLayout")}),children:p.map((w,M)=>{const T=hd(w,a);return f.jsxs("div",{className:"flex items-center gap-2 py-1",children:[f.jsx(py,{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:T}),f.jsx(Ai,{label:`${a("virtualKeyboard.enableKey")} ${w.label}`,...h,checked:w.enabled,onChange:()=>m(w.id),className:"h-7 w-24 shrink-0"}),f.jsx(ll,{disabled:M===0,onClick:()=>g(M,"up"),title:a("virtualKeyboard.moveUp"),"aria-label":a("virtualKeyboard.moveUp"),children:"↑"}),f.jsx(ll,{disabled:M===p.length-1,onClick:()=>g(M,"down"),title:a("virtualKeyboard.moveDown"),"aria-label":a("virtualKeyboard.moveDown"),children:"↓"}),f.jsx(ll,{variant:"danger",onClick:()=>v(w.id),title:a("virtualKeyboard.deleteKeyTitle"),"aria-label":a("virtualKeyboard.deleteKeyTitle"),children:Le.cross})]},w.id)})}),f.jsx(Ae,{block:!0,glyph:"+",onClick:()=>c(!o),className:ne("border-dashed",Ni),children:a("virtualKeyboard.addKey")}),o&&f.jsx(gn,{title:a("virtualKeyboard.availableKeys"),children:f.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:u1.map(w=>{const M=p.some(T=>T.id===w.id);return f.jsxs("button",{type:"button",onClick:()=>y(w),title:hd(w,a),className:ne("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",M?"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:M?"text-tui-ok":"text-tui-accent",children:M?Le.check:"+"})]},w.id)})})})]})},oM=({isOpen:l,onClose:n,initialTab:a,onOpenAdmin:r})=>{const{updateSettings:o,t:c}=Ne(),{addToast:h}=un(),[p,m]=C.useState("general"),[g,y]=C.useState(null);if(C.useEffect(()=>{!l||!a||(m(a),y(null))},[l,a]),!l)return null;const v=()=>{const x=Gb();o({fontSize:x.fontSize,fontSizeFollowsHost:x.fontSizeFollowsHost,fontFamily:x.fontFamily,toolbarVisible:x.toolbarVisible,vibrateOnKeyPress:x.vibrateOnKeyPress,predictiveEcho:x.predictiveEcho,agentAlertBadge:x.agentAlertBadge,agentAlertSound:x.agentAlertSound,agentAlertVibrate:x.agentAlertVibrate,agentAlertNotify:x.agentAlertNotify,language:x.language,virtualKeys:x.virtualKeys}),h("info",c("settings.resetDefaultsToast"))};return f.jsxs(bo,{isOpen:l,onClose:n,title:c("settings.title"),subtitle:c("settings.subtitle"),closeLabel:c("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:c("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(Ae,{variant:"ghost",onClick:v,className:fo,children:c("settings.resetDefaults")}),f.jsx(Ae,{variant:"primary",onClick:n,children:c("common.done")})]}),children:[f.jsx(Bd,{tabs:[{id:"general",label:c("settings.tabGeneral"),index:1},{id:"virtualKeys",label:c("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:c("settings.tabAgentKeymaps"),index:3}],activeId:p,onSelect:x=>m(x),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&f.jsx(sM,{onOpenAdmin:r}),p==="virtualKeys"&&f.jsx(rM,{}),p==="agentKeymaps"&&f.jsx(iM,{profile:g,onProfileChange:y})]})},cM={success:"ok",warning:"warn",error:"bad",info:"accent"},uM={success:Le.check,warning:Le.warn,error:Le.cross,info:"›"},dM=()=>{const{t:l}=Ne(),{toasts:n,removeToast:a}=un();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(r=>{const o=cM[r.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",on[o].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",on[o].text),children:uM[r.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:r.message}),r.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",r.count]}),f.jsx("button",{type:"button",onClick:()=>a(r.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":l("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:Le.cross})})]},r.id)})})},Xy=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function fM(l){return l?l.total>0||Xy.some(({status:n})=>{var a;return(((a=l.counts)==null?void 0:a[n])??0)>0}):!1}const Zy=({className:l,compact:n=!1})=>{const{t:a}=Ne(),{agentStatus:r}=Je();if(!r)return null;const o=Xy.map(({status:h,level:p})=>{var m;return{status:h,level:p,count:((m=r.counts)==null?void 0:m[h])??0}}).filter(h=>h.count>0),c=n?o.slice(0,1):o;return c.length===0?r.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",l),title:a("agents.title"),children:[f.jsx(Kt,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:a("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",l),title:a("agents.title"),children:c.map(({status:h,level:p,count:m})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(Kt,{level:p}),f.jsx("span",{className:"text-tui-text",children:m}),f.jsx("span",{className:"text-tui-faint",children:a(`agents.${h}`)})]},h))})},Yd=({onAddProfile:l,mobile:n=!1,statusBar:a=!1})=>{const{profiles:r,activeProfileId:o,activeProfile:c,switchProfile:h,renameProfile:p,removeProfile:m,t:g}=Ne(),{connectionState:y}=Je(),[v,x]=C.useState(!1),[w,M]=C.useState(null),[T,A]=C.useState(""),N=C.useRef(null);C.useEffect(()=>{if(!v)return;const R=B=>{N.current&&!N.current.contains(B.target)&&x(!1)};return document.addEventListener("pointerdown",R),()=>document.removeEventListener("pointerdown",R)},[v]);const E=(R,B)=>{M(R),A(B)},_=R=>{const B=T.trim();B&&p(R,B),M(null)},z=R=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(m(R),M(null))},O=(c==null?void 0:c.displayName)||g("profiles.addHost"),D=y==="connected"?"ok":y==="connecting"||y==="reconnecting"?"warn":y==="error"?"bad":"idle";return f.jsxs("div",{ref:N,className:ne("relative min-w-0",n&&"w-full",a&&"flex-1",!n&&!a&&"h-full"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>x(R=>!R),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",a?"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(Kt,{level:D}),f.jsx("span",{className:ne("truncate text-tui-text",a&&"min-w-0 flex-1"),children:O}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?Le.chevronDown:Le.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",a?"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")}),r.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):r.map(R=>{const B=R.id===o,H=R.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":B?"true":void 0,onClick:()=>{h(R.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",B?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:B?Le.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:R.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:R.hostname||R.hostId,children:R.hostname||R.hostId||R.wsUrl})]}),B&&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:()=>E(R.id,R.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Le.ellipsis})]}),H&&f.jsxs("div",{className:"grid grid-cols-2 gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:T,maxLength:64,onChange:q=>A(q.target.value),onKeyDown:q=>{q.key==="Enter"&&_(R.id),q.key==="Escape"&&M(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(Ae,{onClick:()=>_(R.id),variant:"primary",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("common.save")}),f.jsx(Ae,{onClick:()=>z(R.id),variant:"danger",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("profiles.remove")})]})]},R.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{x(!1),l()},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")})]})]})]})};function Qy(){const{updateStatus:l,ignoredUpdate:n}=Je();return!!(l!=null&&l.updateAvailable)&&n!==(l==null?void 0:l.latest)}const Wy=({compact:l=!1,className:n})=>{const{t:a}=Ne(),{updateStatus:r}=Je(),o=Qy(),[c,h]=C.useState(!1);if(!o||!r)return null;const{latest:p,restartPending:m}=r,g=m?a("update.chipRestart",{version:p}):l?a("update.chipCompact",{version:p}):a("update.chip",{version:p});return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:a("update.title"),className:ne("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",n),children:g}),f.jsx(hM,{isOpen:c,onClose:()=>h(!1)})]})},ad=({command:l})=>{const{t:n}=Ne(),{addToast:a}=un();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:l}),f.jsx(Ae,{glyph:"⧉",className:"shrink-0",onClick:()=>{Id(l).then(r=>{a(r==="failed"?"error":"success",n(r==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:n("common.copy")})]})},hM=({isOpen:l,onClose:n})=>{const{t:a}=Ne(),{updateStatus:r,ignoreUpdate:o,hostname:c,hostId:h}=Je();if(!r)return null;const{current:p,installed:m,latest:g,restartPending:y}=r;return f.jsx(bo,{isOpen:l,onClose:n,title:a("update.title"),closeLabel:a("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(Ae,{variant:"ghost",onClick:()=>{o(g),n()},children:a("update.ignore")}),f.jsx(Ae,{variant:"primary",onClick:n,children:a("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(Ei,{label:a("common.host"),labelWidth:10,children:c||h||"—"}),f.jsx(Ei,{label:a("update.running"),labelWidth:10,children:p}),m!==p?f.jsx(Ei,{label:a("update.installed"),labelWidth:10,children:m}):null,f.jsx(Ei,{label:a("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:g})})]}),y?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:a("update.restartPending",{version:m})}),f.jsx(ad,{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:Le.arrowRight}),a("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:a("update.stepCli")}),f.jsx(ad,{command:`npm install -g herdr-remote@${g} --prefer-online`}),f.jsx(ad,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:a("update.restartNote")})]})]})})},mM=({onAddProfile:l=()=>{}})=>{const{settings:n,t:a}=Ne(),{connectionState:r,role:o,hostId:c,assignedClientId:h,sharedWindowCount:p,rttMs:m,agentStatus:g}=Je(),y=vo(r,a),v=r==="connected",x=Qy();return f.jsx(gy,{left:f.jsxs(f.Fragment,{children:[f.jsx(Yd,{onAddProfile:l}),f.jsx(vd,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(Kt,{level:y.level}),f.jsx("span",{className:"text-tui-text",children:y.label})]},"status"),v?f.jsx(Hd,{tone:o==="controller"?"ok":"warn",children:a(o==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&p>1?f.jsx("span",{className:"text-tui-muted",children:a("role.sharedWindows",{count:p})},"windows"):null,c?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[a("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:c})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:a("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:h||n.clientId})]},"client")]})]}),right:f.jsx(vd,{items:[x?f.jsx(Wy,{},"update"):null,v&&fM(g)?f.jsx(Zy,{},"agents"):null,m!==null?f.jsxs("span",{className:"text-tui-muted",children:[a("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:a("header.tagline")},"mode")]})})},pM=({wsUrl:l,adminUrl:n,onOpenRemoteAdmin:a,onSignIn:r})=>{const{t:o}=Ne();return f.jsxs(At,{title:o("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:o("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(Ei,{label:o("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:l})}),f.jsx(Ei,{label:o("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(Ae,{variant:"primary",onClick:a,glyph:Le.arrowRight,children:o("admin.openRemoteAdminBtn")}),f.jsx(Ae,{onClick:r,children:o("admin.relayAdminLoginBtn")})]})]})},gM=({adminConfigured:l,isAuthError:n,tokenInput:a,onTokenInput:r,onSubmit:o,isSameOriginRelay:c,onBackToTerminal:h,showBack:p,onCancel:m})=>{const{t:g}=Ne();return f.jsxs(At,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[l===!1?f.jsx(ki,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):n?f.jsx(ki,{tone:"bad",children:g("admin.relayAdminAuthError")}):f.jsx(ki,{tone:"accent",children:g("admin.relayAdminPrompt")}),f.jsxs("form",{onSubmit:o,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(qn,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),f.jsx(Rt,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:a,onChange:y=>r(y.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Ae,{variant:"primary",type:"submit",disabled:!a.trim(),children:g("admin.relayAdminLoginBtn")}),c?h&&!p?f.jsx(Ae,{variant:"ghost",onClick:h,children:g("admin.returnToTerminal")}):null:f.jsx(Ae,{variant:"ghost",onClick:m,children:g("common.cancel")})]})]})]})},bM=({onOpenPairing:l,onRetry:n})=>{const{t:a}=Ne(),{copied:r,copy:o}=yo(),c=r!==null,h=()=>o(il,a("toasts.commandCopied"));return f.jsxs(At,{title:a("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(ki,{tone:"bad",children:a("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:a("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:il}),f.jsx(Ae,{onClick:h,glyph:c?Le.check:"⧉",className:ne("shrink-0",c&&"border-tui-ok text-tui-ok"),children:a(c?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[l&&f.jsx(Ae,{variant:"primary",onClick:l,children:a("admin.enterPairCodeBtn")}),f.jsx(Ae,{onClick:n,children:a("admin.retryFetchBtn")})]})]})},yM=[[/\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"]],vM=[[/\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 ab(l,n){for(const[a,r]of l)if(a.test(n))return r;return null}function Pd(l){const n=typeof l=="string"?l.trim():"";if(!n)return{label:"",raw:""};const a=ab(yM,n),r=ab(vM,n);return a&&r?{label:`${a} · ${r}`,raw:n}:a?{label:a,raw:n}:r?{label:r,raw:n}:{label:n.length>32?`${n.slice(0,32)}…`:n,raw:n}}function Jl(l){if(!l||l<=0)return"0 B";const n=1024,a=["B","KB","MB","GB","TB"],r=Math.min(a.length-1,Math.floor(Math.log(l)/Math.log(n)));return`${(l/n**r).toFixed(1)} ${a[r]}`}function sb(l,n,a=!1){const r=Math.max(0,Math.floor(l)),o=Math.floor(r/86400),c=Math.floor(r%86400/3600),h=Math.floor(r%3600/60),p=r%60,m=(y,v)=>`${y}${n(`admin.unit${v}`)}`,g=o>0?[m(o,"Day"),m(c,"Hour"),m(h,"Minute")]:c>0?[m(c,"Hour"),m(h,"Minute"),m(p,"Second")]:[m(h,"Minute"),m(p,"Second")];return(a?g.slice(0,2):g).join(" ")}function $d(l,n,a=Date.now()){if(!l)return"—";const r=new Date(l).getTime();if(Number.isNaN(r))return"—";const o=Math.max(0,Math.floor((a-r)/1e3));return o<60?n("admin.relJustNow"):o<3600?n("admin.relMinutes",{count:Math.floor(o/60)}):o<86400?n("admin.relHours",{count:Math.floor(o/3600)}):n("admin.relDays",{count:Math.floor(o/86400)})}function qd(l){if(!l)return"";const n=new Date(l);return Number.isNaN(n.getTime())?"":n.toLocaleString()}function Jy(l=[]){const n=new Map;for(const a of l)a.deviceId&&n.set(a.deviceId,(n.get(a.deviceId)||0)+1);return n}const xM=({clients:l})=>{const{t:n}=Ne(),a=l.some(o=>o.hostId),r=[{key:"id",header:n("admin.colClientId"),render:o=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Kt,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:o.id})]})},...a?[{key:"host",header:n("admin.colHost"),render:o=>f.jsx("span",{className:"text-tui-text",children:o.hostId||"—"})}]:[],{key:"role",header:n("admin.colRole"),width:10,render:o=>{const c=o.role==="controller";return f.jsx(Hd,{tone:c?"ok":"warn",className:"text-tui-sm",children:n(c?"common.controller":"common.viewer")})}},{key:"device",header:n("admin.colDevice"),render:o=>{const c=Pd(o.userAgent);return f.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[f.jsx("span",{className:c.label?"text-tui-text":"text-tui-faint",title:c.raw,children:c.label||n("admin.unknownDevice")}),o.deviceId?f.jsx("code",{className:"text-tui-sm text-tui-faint",children:o.deviceId}):null]})}},{key:"ip",header:n("admin.colIp"),render:o=>f.jsx("span",{className:"text-tui-muted",children:o.ip||"127.0.0.1"})},{key:"connectedAt",header:n("admin.colConnectedAt"),render:o=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:qd(o.connectedAt),children:o.connectedAt?$d(o.connectedAt,n):n("admin.startedRecently")})},{key:"traffic",header:n("admin.colTraffic"),align:"right",render:o=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsxs("span",{className:"text-tui-accent",children:["↓",Jl(o.bytesReceived||0)]}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsxs("span",{className:"text-tui-ok",children:["↑",Jl(o.bytesSent||0)]})]})}];return f.jsx(At,{title:n("admin.connectedClientsTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Ud,{columns:r,items:l,rowKey:o=>o.id,empty:n("admin.noClients")})})},wM=({devices:l,clients:n,onRevoke:a})=>{const{t:r}=Ne(),[o,c]=C.useState(null),[h,p]=C.useState(null),m=Jy(n),g=[...l].sort((x,w)=>{const M=+!!m.get(w.deviceId)-+!!m.get(x.deviceId);return M||(Date.parse(w.lastSeenAt)||0)-(Date.parse(x.lastSeenAt)||0)}),y=async x=>{if(o!==x){c(x);return}p(x);try{await a(x)}finally{p(null),c(null)}},v=[{key:"status",header:r("admin.colStatus"),width:12,render:x=>{const w=m.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(Kt,{level:w?"ok":"idle"}),r(w?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:r("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||r("admin.unknownDevice")}),f.jsx("code",{className:"text-tui-sm text-tui-faint",children:x.deviceId})]})}},{key:"host",header:r("admin.colHost"),render:x=>f.jsx("span",{className:"text-tui-text",children:x.hostId||"—"})},{key:"ip",header:r("admin.colIp"),render:x=>f.jsx("span",{className:"text-tui-muted",children:x.lastIp||"—"})},{key:"lastSeen",header:r("admin.colLastSeen"),render:x=>{const w=m.get(x.deviceId)||0;return f.jsx("span",{className:ne("whitespace-nowrap",w?"text-tui-ok":"text-tui-muted"),title:qd(x.lastSeenAt),children:w?r("admin.deviceWindows",{count:w}):$d(x.lastSeenAt,r)})}},{key:"actions",header:r("admin.colActions"),align:"right",render:x=>{const w=o===x.deviceId,M=h===x.deviceId;return f.jsx(Ae,{variant:"danger",disabled:M,onClick:()=>void y(x.deviceId),onBlur:()=>c(T=>T===x.deviceId?null:T),"aria-label":r("admin.revokeDevice"),className:ne("h-6 py-0 text-tui-sm",w&&"bg-tui-bad text-tui-crust"),children:M?f.jsx(al,{}):r(w?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(At,{title:r("admin.pairedDevicesTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Ud,{columns:v,items:g,rowKey:x=>x.deviceId,empty:r("admin.noDevices")})})},rb={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function SM(l=[],n=[]){const a=new Map;for(const c of n){if(!(c!=null&&c.hostId))continue;const h=a.get(c.hostId);h?h.push(c):a.set(c.hostId,[c])}const r=l.map(c=>{const h=a.get(c.id)||[];return{id:c.id,hostname:c.hostname||c.id,status:c.status||"online",connectedDeviceCount:c.connectedDeviceCount??0,pairedDeviceCount:c.pairedDeviceCount??h.length,activePtyCount:c.activePtyCount??0,devices:h,fromRosterOnly:!1}}),o=new Set(r.map(c=>c.id));for(const[c,h]of a)o.has(c)||r.push({id:c,hostname:c,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,activePtyCount:0,devices:h,fromRosterOnly:!0});return r.sort((c,h)=>c.fromRosterOnly!==h.fromRosterOnly?c.fromRosterOnly?1:-1:c.hostname.localeCompare(h.hostname))}const CM=({hosts:l,devices:n,clients:a})=>{const{t:r}=Ne(),o=SM(l,n),c=Jy(a),h={online:r("admin.hostStatusOnline"),busy:r("admin.hostStatusBusy"),reconnecting:r("admin.hostStatusReconnecting"),offline:r("admin.hostStatusOffline")};return f.jsx(At,{title:r("admin.hostsTitle",{count:o.length}),bodyClassName:"space-y-2",children:o.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:r("admin.noHosts")}):o.map(p=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[f.jsxs("span",{className:"flex min-w-0 flex-auto items-center gap-1.5 text-tui",children:[f.jsx(Kt,{level:rb[p.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:p.hostname}),p.hostname!==p.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:p.id}):null,f.jsx(Hd,{tone:rb[p.status],className:"ml-1 text-tui-sm",children:h[p.status]})]}),f.jsx(vd,{className:"shrink-0 text-tui-sm",items:[f.jsx("span",{className:p.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:r("admin.hostConnectedDevices",{count:p.connectedDeviceCount})},"connected"),f.jsx("span",{className:"text-tui-muted",children:r("admin.hostPairedDevices",{count:p.pairedDeviceCount})},"paired"),p.fromRosterOnly?null:f.jsx("span",{className:p.activePtyCount?"text-tui-info":"text-tui-faint",children:r("admin.hostPtys",{count:p.activePtyCount})},"ptys")]})]}),p.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:p.devices.map(m=>{const g=Pd(m.userAgent),y=c.get(m.deviceId)||0;return f.jsxs("li",{className:"grid grid-cols-[1ch_minmax(0,1fr)_auto] items-baseline gap-x-2 px-2 py-0.5 text-tui sm:grid-cols-[1ch_minmax(0,18ch)_minmax(0,1fr)_16ch_16ch]",children:[f.jsx(Kt,{level:y?"ok":"idle"}),f.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||r("admin.unknownDevice")}),f.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:m.deviceId}),f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:m.lastIp||"—"}),f.jsx("span",{className:ne("whitespace-nowrap text-right text-tui-sm",y?"text-tui-ok":"text-tui-faint"),title:qd(m.lastSeenAt),children:y?r("admin.deviceWindows",{count:y}):$d(m.lastSeenAt,r)})]},m.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:p.pairedDeviceCount>0?r("admin.hostRosterOperatorOnly"):r("admin.noDevices")})]},p.id))})},TM=({data:l})=>{var o,c,h,p,m,g,y,v,x,w;const{t:n}=Ne(),a=l.activeUserCount??((o=l.clients)==null?void 0:o.length)??0,r=new Set((l.devices||[]).map(M=>M.hostId).filter(M=>M&&!(l.hosts||[]).some(T=>T.id===M))).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(ql,{label:n("admin.connectedHosts"),value:((c=l.hosts)==null?void 0:c.length)||0,sub:r?n("admin.hostsOfflineSub",{count:r}):void 0,tone:(h=l.hosts)!=null&&h.length?"ok":"idle"}),f.jsx(ql,{label:n("admin.activeUsers"),value:a,sub:n("admin.acrossWindows",{count:((p=l.clients)==null?void 0:p.length)||0}),tone:a?"accent":"idle"}),f.jsx(ql,{label:n("admin.activePtys"),value:((m=l.ptys)==null?void 0:m.length)||0,sub:n("admin.terminalShells"),tone:(g=l.ptys)!=null&&g.length?"info":"idle"}),f.jsx(ql,{label:n("admin.statInbound"),value:n("admin.perSecond",{value:Jl(((y=l.throughput)==null?void 0:y.bytesInPerSec)||0)}),sub:n("admin.statTotal",{value:Jl(((v=l.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),f.jsx(ql,{label:n("admin.statOutbound"),value:n("admin.perSecond",{value:Jl(((x=l.throughput)==null?void 0:x.bytesOutPerSec)||0)}),sub:n("admin.statTotal",{value:Jl(((w=l.throughput)==null?void 0:w.bytesOut)||0)}),tone:"ok"}),f.jsx(ql,{label:n("admin.uptime"),value:sb(l.uptimeSeconds||0,n,!0),title:sb(l.uptimeSeconds||0,n),sub:l.startTime?n("admin.startedAt",{time:new Date(l.startTime).toLocaleTimeString()}):n("admin.startedRecently")})]}),f.jsx(CM,{hosts:l.hosts||[],devices:l.devices,clients:l.clients||[]})]})},MM=({ptys:l})=>{const{t:n}=Ne(),a=l.some(o=>o.hostId),r=[{key:"id",header:n("admin.colPtyId"),render:o=>f.jsx("span",{className:"font-bold text-tui-accent",children:o.id})},...a?[{key:"host",header:n("admin.colHost"),render:o=>f.jsx("span",{className:"text-tui-text",children:o.hostId})}]:[],{key:"pid",header:n("admin.colPid"),width:9,render:o=>f.jsx("span",{className:"text-tui-muted",children:o.pid})},{key:"command",header:n("admin.colCommand"),render:o=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:o.command})},{key:"grid",header:n("admin.colGrid"),width:11,render:o=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[o.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),o.rows]})},{key:"cwd",header:n("admin.colCwd"),className:"max-w-xs truncate",render:o=>f.jsx("span",{className:"text-tui-muted",children:o.cwd||"~"})},{key:"viewers",header:n("admin.colViewers"),align:"right",width:9,render:o=>f.jsx("span",{className:"font-bold text-tui-ok",children:o.activeClients})}];return f.jsx(At,{title:n("admin.activePtysTitle",{count:l.length}),bodyClassName:"-mx-1",children:f.jsx(Ud,{columns:r,items:l,rowKey:o=>o.id,empty:n("admin.noPtys")})})};function Ed(l){if(typeof window>"u"||!l||l.startsWith("/"))return"";try{const n=new URL(l.replace(/^ws/,"http")),a=n.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return n.origin===window.location.origin&&!a?"":`${n.origin}${a}`}catch{return""}}function ys(l,n){const a=Ed(l);return a?`${a}${n.startsWith("/")?n:`/${n}`}`:n}async function AM(l){try{const a=await fetch(ys(l,"/api/info"),{headers:{Accept:"application/json"}});if(a.ok)return await a.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(l&&!l.startsWith("/")&&!l.includes("localhost")&&!l.includes("127.0.0.1")&&typeof window<"u"&&!l.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function ob(l,n){const a=await fetch(l,{headers:{Accept:"application/json",...n}});if(a.status===401||a.status===403)return{kind:"denied",status:a.status};if(!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);return{kind:"ok",data:await a.json()}}async function EM(l,n,a){return(await fetch(ys(l,`/api/admin/devices/${encodeURIComponent(a)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":n}})).ok}function NM(l,n,a){return l!=null&&l.adminPath?l.publicUrl?`${l.publicUrl.replace(/\/$/,"")}${l.adminPath}`:ys(a,l.adminPath):n!=null&&n.remoteAdminUrl?n.remoteAdminUrl:a?ys(a,"/admin"):"/admin"}function kM({wsUrl:l,deviceToken:n,adminToken:a,relayOrigin:r,refreshInterval:o,t:c}){const[h,p]=C.useState(null),[m,g]=C.useState(null),[y,v]=C.useState(!1),[x,w]=C.useState(!0),[M,T]=C.useState(null),[A,N]=C.useState(!1),[E,_]=C.useState(null);C.useEffect(()=>{p(null),g(null),v(!1)},[r]),C.useEffect(()=>{let H=!0;return w(!0),AM(l).then(q=>{H&&(g(q),v(!0))}),()=>{H=!1}},[l,r]);const z=(m==null?void 0:m.relayMode)==="remote",O=C.useCallback((H,q)=>{if(H.kind==="denied"){N(!0),T(q),p(null);return}p(H.data),T(null),N(!1),_(new Date)},[]),D=C.useCallback((H,q)=>{N(!1),T(H instanceof Error?H.message:q),p(null)},[]),R=C.useCallback(async()=>{if(y){if(z){if(!a){p(null),w(!1),T(null),N(!1);return}try{w(!0);const H=await ob(ys(l,(m==null?void 0:m.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":a});O(H,c("admin.relayAdminAuthError"))}catch(H){console.warn("GET /api/admin/status request failed:",H),D(H,"Failed to fetch remote admin status")}finally{w(!1)}return}try{w(!0);const H=await ob("/api/status",n?{Authorization:`Bearer ${n}`}:{});O(H,H.kind==="denied"?`Authentication failed (HTTP ${H.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(H){console.warn("GET /api/status request failed:",H),D(H,"Failed to fetch status")}finally{w(!1)}}},[y,z,a,m,n,l,r,c]),B=C.useCallback(async H=>{try{if(!await EM(l,a,H)){T(c("admin.revokeFailed"));return}await R()}catch{T(c("admin.revokeFailed"))}},[a,R,l,c]);return C.useEffect(()=>{if(!y)return;R();let H=null;const q=()=>{o>0&&!H&&(H=setInterval(()=>{document.visibilityState==="visible"&&R()},o))},$=()=>{H&&(clearInterval(H),H=null)},W=()=>{document.visibilityState==="visible"?(R(),q()):$()};return q(),document.addEventListener("visibilitychange",W),()=>{$(),document.removeEventListener("visibilitychange",W)}},[y,R,o]),{data:h,relayInfo:m,infoLoaded:y,isRemoteRelay:z,loading:x,error:M,isAuthError:A,lastUpdated:E,fetchStatus:R,revokeDevice:B}}const sd="h-7 py-0",LM=({onBackToTerminal:l,onOpenPairing:n,showBack:a=!1})=>{var be,ye,Me;const{settings:r,updateSettings:o,t:c}=Ne(),h=Ed(r.wsUrl)||(typeof window<"u"?window.location.origin:"local"),p=((be=r.adminTokens)==null?void 0:be[h])||(h===(typeof window<"u"?window.location.origin:"local")?r.adminToken:"")||"",[m,g]=C.useState(3e3),[y,v]=C.useState("overview"),[x,w]=C.useState(p),[M,T]=C.useState(p),[A,N]=C.useState(!!p),E=!Ed(r.wsUrl);C.useEffect(()=>{w(p),T(p),N(!!p)},[h]);const{data:_,relayInfo:z,infoLoaded:O,isRemoteRelay:D,loading:R,error:B,isAuthError:H,lastUpdated:q,fetchStatus:$,revokeDevice:W}=kM({wsUrl:r.wsUrl,deviceToken:r.token,adminToken:M,relayOrigin:h,refreshInterval:m,t:c}),le=de=>{de.preventDefault();const xe=x.trim();o({adminToken:xe,adminTokens:{...r.adminTokens||{},[h]:xe}}),T(xe),N(!!xe)},oe=NM(z,_,r.wsUrl),I=_?[{id:"overview",label:c("admin.tabOverview"),index:1},{id:"clients",label:c("admin.tabClients",{count:((ye=_.clients)==null?void 0:ye.length)||0}),index:2},{id:"ptys",label:c("admin.tabPtys",{count:((Me=_.ptys)==null?void 0:Me.length)||0}),index:3},..._.devices?[{id:"devices",label:c("admin.tabDevices",{count:_.devices.length}),index:4}]:[]]:[],k=I.map(de=>de.id).join("|");C.useEffect(()=>{const de=k?k.split("|"):[],xe=se=>{if(se.ctrlKey||se.altKey||se.metaKey)return;const ve=se.target;if(ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve instanceof HTMLSelectElement||ve!=null&&ve.isContentEditable||document.querySelector('[role="dialog"]'))return;if(se.key==="Escape"&&l){se.preventDefault(),l();return}if(se.key.toLowerCase()==="r"){se.preventDefault(),$();return}const ie=Number.parseInt(se.key,10)-1;Number.isInteger(ie)&&ie>=0&&ie<de.length&&(se.preventDefault(),v(de[ie]))};return window.addEventListener("keydown",xe),()=>window.removeEventListener("keydown",xe)},[$,l,k]);const Y=(z==null?void 0:z.version)||(_==null?void 0:_.version)||"0.1.0",Q=a&&l?f.jsx(Ae,{variant:"ghost",onClick:l,title:c("admin.returnToTerminal"),"aria-label":c("admin.returnToTerminal"),glyph:Le.arrowLeft,brackets:!1,className:sd,children:f.jsx("span",{className:"sr-only",children:c("admin.returnToTerminal")})}):null,ae=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",Y]}),f.jsx(zd,{}),f.jsx("span",{className:D?"text-tui-alt":"text-tui-ok",children:c(D?"admin.modeRemote":"admin.localWorkstationBadge")})]}),_?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:c("admin.autoRefresh")}),f.jsxs(po,{value:m,onChange:de=>g(Number(de.target.value)),"aria-label":c("admin.autoRefresh"),className:ne("w-auto",sd),children:[f.jsx("option",{value:0,children:c("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(Ae,{variant:"primary",onClick:$,disabled:R,title:c("admin.refreshNow"),className:sd,children:R?f.jsx(al,{}):c("admin.refreshNow")})]}):null]}),Z=O&&D&&!A&&!E,ge=O&&D&&(A||E)&&!_;return f.jsxs(HS,{tabs:I,activeTabId:y,onSelectTab:de=>v(de),tabsAriaLabel:c("header.mainNavigationAria"),toolbarStart:Q,toolbarAside:ae,hints:[..._?[{keys:"1–4",action:c("admin.hintTabs")},{keys:"r",action:c("admin.hintRefresh")}]:[],...l?[{keys:"esc",action:c("admin.hintBack")}]:[]],footerAside:q?f.jsx("span",{className:"text-tui-faint",children:c("admin.updatedAt",{time:q.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!O&&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(al,{label:c("admin.loadingStatus")})}),Z&&f.jsx(pM,{wsUrl:r.wsUrl,adminUrl:oe,onOpenRemoteAdmin:()=>window.open(oe,"_blank","noopener,noreferrer"),onSignIn:()=>N(!0)}),ge&&f.jsx(gM,{adminConfigured:z==null?void 0:z.adminConfigured,isAuthError:H,tokenInput:x,onTokenInput:w,onSubmit:le,isSameOriginRelay:E,onBackToTerminal:l,showBack:a,onCancel:()=>N(!1)}),O&&!D&&H&&f.jsx(bM,{onOpenPairing:n,onRetry:$}),O&&B&&!H&&f.jsx(ki,{tone:"warn",action:f.jsx(Ae,{variant:"warn",onClick:$,children:c("common.retry")}),children:c("admin.errorConnecting",{error:B})}),_&&f.jsxs(f.Fragment,{children:[y==="overview"&&f.jsx(TM,{data:_}),y==="clients"&&f.jsx(xM,{clients:_.clients||[]}),y==="ptys"&&f.jsx(MM,{ptys:_.ptys||[]}),y==="devices"&&f.jsx(wM,{devices:_.devices||[],clients:_.clients||[],onRevoke:W})]})]})},RM=({compact:l=!1})=>{const{t:n}=Ne(),{role:a,connectionState:r,sharedWindowCount:o,assignedClientId:c}=Je();if(!(r==="connected"))return f.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":n("terminal.offlineStatusAria"),children:[f.jsx(Kt,{level:"idle"}),f.jsx("span",{children:n("common.offline")})]});const p=a==="controller",m=o>1,g=f.jsxs("div",{className:ne("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",p?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":n(p?"role.controllerMode":"role.viewerMode"),children:[f.jsx(Kt,{level:p?"ok":"warn"}),f.jsx("span",{className:"truncate",children:n(p?"role.sharedControl":"role.viewerReadOnly")}),m?f.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:n("role.sharedWindows",{count:o})}):null]});return l?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:n("role.sharedControlDesc")}),c?f.jsx(Ei,{label:n("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:c})}):null]})},Zr="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Qr="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",_M="border-tui-accent bg-tui-selection text-tui-accent",Wr=({active:l=!1})=>f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",l?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Le.cursor}),jM=({onClose:l,onOpenPairing:n,onOpenSettings:a,onAddProfile:r=()=>{}})=>{const{settings:o,updateSettings:c,language:h,setLanguage:p,t:m}=Ne(),{connectionState:g,stateDetail:y,rttMs:v,hostId:x,connect:w}=Je(),{addToast:M}=un(),{copied:T,copy:A}=yo(),N=T!==null,E=vo(g,m),_=D=>()=>{var B;const R=document.activeElement;(B=R==null?void 0:R.blur)==null||B.call(R),D()},z=()=>A(o.clientId,m("toasts.clientIdCopied",{id:o.clientId}),"info"),O=()=>{const D=h==="zh"?"en":"zh";p(D),M("info",Nd(D,"toasts.switchedLanguage",{lang:D==="zh"?"简体中文":"English"}))};return f.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[f.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:m("mobile.sessionControls")}),f.jsx(Ae,{variant:"ghost",onClick:l,"aria-label":m("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(At,{title:m("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(Yd,{mobile:!0,onAddProfile:r})}),f.jsxs(At,{title:m("common.status"),tone:E.level==="ok"?"ok":E.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(Kt,{level:E.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:E.label}),g==="connected"&&v!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[v,"ms"]})]}),E.actionLabel&&f.jsx(Ae,{variant:"primary",onClick:()=>w(),className:"shrink-0",children:E.actionLabel})]}),E.needsAttention&&y&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:y}),x&&f.jsx(Ei,{label:m("common.host"),labelWidth:9,children:x}),f.jsxs("button",{type:"button",onClick:z,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:m("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:m("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:o.clientId}),f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",N?"text-tui-ok":"text-tui-faint"),children:N?Le.check:"⧉"})]})]}),f.jsx(At,{title:m("mobile.inputControl"),tone:"accent","aria-label":m("mobile.terminalControlAria"),children:f.jsx(RM,{})}),f.jsxs(At,{title:m("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:O,className:ne(Zr,Qr),"aria-label":m("header.languageToggleTitle"),children:[f.jsx(Wr,{}),f.jsx("span",{className:"truncate",children:h==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:_(a),className:ne(Zr,Qr),"aria-label":m("mobile.settingsAria"),children:[f.jsx(Wr,{}),f.jsx("span",{className:"truncate",children:m("common.settings")})]}),f.jsxs("button",{type:"button",onClick:_(n),className:ne(Zr,Qr),"aria-label":m("mobile.pairingAria"),children:[f.jsx(Wr,{}),f.jsx("span",{className:"truncate",children:m("common.pairing")})]}),f.jsxs("button",{type:"button",onClick:()=>c({toolbarVisible:!o.toolbarVisible}),className:ne(Zr,o.toolbarVisible?_M:Qr),"aria-label":m("mobile.keybarAria"),"aria-pressed":o.toolbarVisible,children:[f.jsx(Wr,{active:o.toolbarVisible}),f.jsx("span",{className:"truncate",children:m("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:o.toolbarVisible?"[x]":"[ ]"})]})]})]})},OM=({onAddProfile:l})=>{const{t:n}=Ne(),{rttMs:a}=Je();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:l}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(Zy,{compact:!0}),f.jsx(Wy,{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(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},DM=({onOpenPairing:l,onOpenSettings:n,onAddProfile:a=()=>{}})=>{const{t:r}=Ne(),{connectionState:o,isController:c}=Je(),[h,p]=C.useState(!1),m=C.useRef(null),g=C.useCallback(()=>p(!1),[]);C.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]),C.useEffect(()=>{var v;h&&((v=m.current)==null||v.focus({preventScroll:!0}))},[h]);const y=vo(o,r);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":r("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(Kt,{level:y.level}),f.jsx("span",{className:"truncate uppercase",children:y.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>p(!0),"aria-label":r("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":c?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!c&&!y.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:r("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Le.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:r("mobile.menu")})]})]}),h&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:g,"aria-hidden":"true"}),f.jsx("div",{ref:m,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":r("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(jM,{onClose:g,onOpenPairing:()=>{g(),l()},onOpenSettings:()=>{g(),n()},onAddProfile:()=>{g(),a()}})})]}),f.jsx(OM,{onAddProfile:a})]})},zM=()=>{const{activeProfile:l,t:n}=Ne(),{herdrLaunch:a,startHerdr:r,hostname:o}=Je();if(!a)return null;const c=o||(l==null?void 0:l.displayName)||n("herdrLaunch.thisHost"),h=a.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(At,{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:a.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(al,{}),f.jsx("span",{children:n("herdrLaunch.starting",{host:c})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:n("herdrLaunch.body",{host:c})}),h&&a.message?f.jsx(ki,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.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(Ae,{variant:"primary",onClick:r,autoFocus:!0,children:n(h?"common.retry":"herdrLaunch.start")})})]})})})},e0="--app-height",t0="--keyboard-inset",HM=80;function BM(){if(typeof window>"u")return{height:768,keyboardInset:0};const l=window.innerHeight||768,n=window.visualViewport;if(n&&typeof n.height=="number"&&n.height>0){const a=l-n.height-(n.offsetTop||0),r=a>=HM?Math.round(a):0;return{height:Math.round(n.height),keyboardInset:r}}return{height:l,keyboardInset:0}}function cb(l,n=BM()){return l.style.setProperty(e0,`${n.height}px`),l.style.setProperty(t0,`${n.keyboardInset}px`),n}function UM(l=typeof document<"u"?document.documentElement:null){if(!l||typeof window>"u")return()=>{};let n=null;const a=()=>{n=null,cb(l)},r=()=>{if(n===null){if(typeof requestAnimationFrame!="function"){a();return}n=requestAnimationFrame(a)}};cb(l);const o=window.visualViewport;return o==null||o.addEventListener("resize",r),o==null||o.addEventListener("scroll",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),()=>{n!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(n),n=null),o==null||o.removeEventListener("resize",r),o==null||o.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),l.style.removeProperty(e0),l.style.removeProperty(t0)}}const KM=900;function ub(){if(typeof window>"u")return!1;const l=ea();return l<Ld?!0:l<=KM}function IM(){const[l,n]=C.useState(ub);return C.useEffect(()=>{var o,c;const a=()=>{const h=ub();n(p=>p===h?p:h)};a();let r=null;try{r=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{r=null}return(o=r==null?void 0:r.addEventListener)==null||o.call(r,"change",a),window.addEventListener("resize",a),window.addEventListener("orientationchange",a),(c=window.visualViewport)==null||c.addEventListener("resize",a),()=>{var h,p;(h=r==null?void 0:r.removeEventListener)==null||h.call(r,"change",a),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),(p=window.visualViewport)==null||p.removeEventListener("resize",a)}},[]),l}function FM(l){const n=l.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 a=document.activeElement;if(a.id==="terminal-container"||a.classList.contains("xterm-helper-textarea")||a.closest("#terminal-container")||a.closest(".xterm"))return!0}return!1}function GM(l,n={}){if(typeof window>"u")return()=>{};const a=r=>{var o;r.ctrlKey||r.altKey||r.metaKey||r.key==="Escape"&&(n.isModalOpen||n.isSheetOpen)&&(FM(r)||(r.preventDefault(),r.stopPropagation(),(o=l.onCloseModals)==null||o.call(l)))};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}}function YM(){const[l,n]=C.useState("terminal"),[a,r]=C.useState(!1),[o,c]=C.useState(!1),[h,p]=C.useState(!1),[m,g]=C.useState(void 0),y=I=>{g(I),p(!0)},[v,x]=C.useState(!1),{updateSettings:w,addProfileAndConnect:M,settings:T}=Ne(),{connectionState:A,stateDetail:N,stateCode:E,lastPairedAt:_}=Je();B1();const z=IM();C.useEffect(()=>UM(),[]),C.useEffect(()=>{Mb()},[]),C.useEffect(()=>{const I=a||h||v;if(I)return GM({onCloseModals:()=>{r(!1),p(!1),x(!1)}},{isModalOpen:I})},[a,h,v]),C.useEffect(()=>{var k;const I=()=>{const Y=window.location.pathname,Q=window.location.hash;n(Y==="/admin"||Q==="#admin"?"admin":"terminal")};I(),window.addEventListener("popstate",I),window.addEventListener("hashchange",I);try{const Y=new URL(window.location.href),Q=(k=Y.searchParams.get("pairCode"))==null?void 0:k.toUpperCase();Q&&jd().token?M({wsUrl:cn,pairCode:Q}):Q&&w({pairCode:Q});let ae=!1;if(Y.searchParams.has("token")&&(Y.searchParams.delete("token"),ae=!0),Y.searchParams.has("pairCode")&&(Y.searchParams.delete("pairCode"),ae=!0),ae){const Z=Y.searchParams.toString(),ge=Y.pathname+(Z?`?${Z}`:"")+Y.hash;window.history.replaceState({},"",ge)}}catch(Y){console.warn("Failed to parse URL query params:",Y)}return()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[w,M]);const O=(I=!1)=>{c(I),r(!0)},D=()=>{r(!1),c(!1)},R=I=>{n(I),I==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},B=!T.token&&!T.pairCode&&A!=="connected",H=A==="error"&&(["auth_required","unauthorized","device_revoked"].includes(E||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(N||"")),q=B||H,[$,W]=C.useState(!q);C.useEffect(()=>{q||W(!0)},[q]),C.useEffect(()=>{_&&(r(!1),W(!0),n("terminal"))},[_]);const le=l==="terminal"&&!q,oe=I=>({visibility:I?"visible":"hidden",opacity:I?1:0,pointerEvents:I?"auto":"none",zIndex:I?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:z?{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:I=>{I.preventDefault(),I.stopPropagation()},children:[!z&&f.jsx(US,{currentView:l,onNavigate:R,onOpenPairing:()=>O(!1),onOpenSettings:()=>y(),onToggleVirtualKeyboard:()=>x(!v),isVirtualKeyboardOpen:v}),!z&&!q&&f.jsx(KS,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[$&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${z?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:oe(le),"aria-hidden":!le,children:[f.jsx(z5,{isActive:le}),!z&&f.jsx(W5,{isOpen:v,onClose:()=>x(!1)}),f.jsx(Q5,{compact:z,onCustomize:()=>y("agentKeymaps")}),f.jsx(zM,{}),f.jsx(aM,{})]}),l==="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(B5,{onPairedSuccess:()=>{}})}),l==="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(LM,{onBackToTerminal:()=>R("terminal"),onOpenPairing:()=>O(!1),showBack:z})}),z&&le&&f.jsx(DM,{onOpenPairing:()=>O(!1),onOpenSettings:()=>y(),onAddProfile:()=>O(!0)})]}),!z&&l!=="admin"&&f.jsx(mM,{onAddProfile:()=>O(!0)}),f.jsx(eM,{isOpen:a,isAddMode:o,onClose:D}),f.jsx(oM,{isOpen:h,initialTab:m,onClose:()=>p(!1),onOpenAdmin:()=>{p(!1),R("admin")}}),f.jsx(dM,{})]})}function PM(){return f.jsx(A1,{children:f.jsx(YM,{})})}const n0=document.getElementById("root");if(!n0)throw new Error("Root element not found");Ax.createRoot(n0).render(f.jsx(Qn.StrictMode,{children:f.jsx(PM,{})}));
|