herdr-remote 0.3.36 → 0.3.37
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/herdr-plugin.toml +1 -1
- package/node_modules/herdr-remote-relay/package.json +1 -1
- package/node_modules/herdr-remote-relay/web/dist/assets/index-BFsSosIJ.js +61 -0
- package/node_modules/herdr-remote-relay/web/dist/index.html +1 -1
- package/package.json +2 -2
- package/node_modules/herdr-remote-relay/web/dist/assets/index-DMbkU5R6.js +0 -61
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var Ox=Object.defineProperty;var Dx=(i,n,a)=>n in i?Ox(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a;var V=(i,n,a)=>Dx(i,typeof n!="symbol"?n+"":n,a);import{r as Mb,g as Ab,a as Eb}from"./vendor-react-CYSfZuHu.js";import{r as zx,a as Hx}from"./vendor-xterm-BhCxil_4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function a(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(r){if(r.ep)return;r.ep=!0;const c=a(r);fetch(r.href,c)}})();var Ku={exports:{}},cs={};/**
|
|
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 Jp;function Bx(){if(Jp)return cs;Jp=1;var i=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function a(s,r,c){var d=null;if(c!==void 0&&(d=""+c),r.key!==void 0&&(d=""+r.key),"key"in r){c={};for(var m in r)m!=="key"&&(c[m]=r[m])}else c=r;return r=c.ref,{$$typeof:i,type:s,key:d,ref:r!==void 0?r:null,props:c}}return cs.Fragment=n,cs.jsx=a,cs.jsxs=a,cs}var eg;function Ux(){return eg||(eg=1,Ku.exports=Bx()),Ku.exports}var h=Ux(),T=Mb();const ei=Ab(T);var Iu={exports:{}},us={},Fu={exports:{}},Gu={};/**
|
|
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 tg;function Kx(){return tg||(tg=1,(function(i){function n(z,J){var K=z.length;z.push(J);e:for(;0<K;){var ae=K-1>>>1,$=z[ae];if(0<r($,J))z[ae]=J,z[K]=$,K=ae;else break e}}function a(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var J=z[0],K=z.pop();if(K!==J){z[0]=K;e:for(var ae=0,$=z.length,ue=$>>>1;ae<ue;){var xe=2*(ae+1)-1,fe=z[xe],te=xe+1,le=z[te];if(0>r(fe,K))te<$&&0>r(le,fe)?(z[ae]=le,z[te]=K,ae=te):(z[ae]=fe,z[xe]=K,ae=xe);else if(te<$&&0>r(le,K))z[ae]=le,z[te]=K,ae=te;else break e}}return J}function r(z,J){var K=z.sortIndex-J.sortIndex;return K!==0?K:z.id-J.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;i.unstable_now=function(){return c.now()}}else{var d=Date,m=d.now();i.unstable_now=function(){return d.now()-m}}var p=[],g=[],y=1,v=null,S=3,x=!1,w=!1,C=!1,A=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function D(z){for(var J=a(g);J!==null;){if(J.callback===null)s(g);else if(J.startTime<=z)s(g),J.sortIndex=J.expirationTime,n(p,J);else break;J=a(g)}}function P(z){if(C=!1,D(z),!w)if(a(p)!==null)w=!0,B||(B=!0,X());else{var J=a(g);J!==null&&ce(P,J.startTime-z)}}var B=!1,O=-1,k=5,R=-1;function I(){return A?!0:!(i.unstable_now()-R<k)}function Q(){if(A=!1,B){var z=i.unstable_now();R=z;var J=!0;try{e:{w=!1,C&&(C=!1,E(O),O=-1),x=!0;var K=S;try{t:{for(D(z),v=a(p);v!==null&&!(v.expirationTime>z&&I());){var ae=v.callback;if(typeof ae=="function"){v.callback=null,S=v.priorityLevel;var $=ae(v.expirationTime<=z);if(z=i.unstable_now(),typeof $=="function"){v.callback=$,D(z),J=!0;break t}v===a(p)&&s(p),D(z)}else s(p);v=a(p)}if(v!==null)J=!0;else{var ue=a(g);ue!==null&&ce(P,ue.startTime-z),J=!1}}break e}finally{v=null,S=K,x=!1}J=void 0}}finally{J?X():B=!1}}}var X;if(typeof _=="function")X=function(){_(Q)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,oe=ne.port2;ne.port1.onmessage=Q,X=function(){oe.postMessage(null)}}else X=function(){N(Q,0)};function ce(z,J){O=N(function(){z(i.unstable_now())},J)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(z){z.callback=null},i.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<z?Math.floor(1e3/z):5},i.unstable_getCurrentPriorityLevel=function(){return S},i.unstable_next=function(z){switch(S){case 1:case 2:case 3:var J=3;break;default:J=S}var K=S;S=J;try{return z()}finally{S=K}},i.unstable_requestPaint=function(){A=!0},i.unstable_runWithPriority=function(z,J){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var K=S;S=z;try{return J()}finally{S=K}},i.unstable_scheduleCallback=function(z,J,K){var ae=i.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ae+K:ae):K=ae,z){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=K+$,z={id:y++,callback:J,priorityLevel:z,startTime:K,expirationTime:$,sortIndex:-1},K>ae?(z.sortIndex=K,n(g,z),a(p)===null&&z===a(g)&&(C?(E(O),O=-1):C=!0,ce(P,K-ae))):(z.sortIndex=$,n(p,z),w||x||(w=!0,B||(B=!0,X()))),z},i.unstable_shouldYield=I,i.unstable_wrapCallback=function(z){var J=S;return function(){var K=S;S=J;try{return z.apply(this,arguments)}finally{S=K}}}})(Gu)),Gu}var ng;function Ix(){return ng||(ng=1,Fu.exports=Kx()),Fu.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 ig;function Fx(){if(ig)return us;ig=1;var i=Ix(),n=Mb(),a=Eb();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(c(e)!==e)throw Error(s(188))}function g(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(s(188));return t!==e?null:e}for(var l=e,o=t;;){var u=l.return;if(u===null)break;var f=u.alternate;if(f===null){if(o=u.return,o!==null){l=o;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===l)return p(u),e;if(f===o)return p(u),t;f=f.sibling}throw Error(s(188))}if(l.return!==o.return)l=u,o=f;else{for(var b=!1,M=u.child;M;){if(M===l){b=!0,l=u,o=f;break}if(M===o){b=!0,o=u,l=f;break}M=M.sibling}if(!b){for(M=f.child;M;){if(M===l){b=!0,l=f,o=u;break}if(M===o){b=!0,o=f,l=u;break}M=M.sibling}if(!b)throw Error(s(189))}}if(l.alternate!==o)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?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,S=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),_=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var ne=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case N:return"Profiler";case A:return"StrictMode";case P:return"Suspense";case B:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case _:return e.displayName||"Context";case E:return(e._context.displayName||"Context")+".Consumer";case D:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case k:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var ce=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},ae=[],$=-1;function ue(e){return{current:e}}function xe(e){0>$||(e.current=ae[$],ae[$]=null,$--)}function fe(e,t){$++,ae[$]=e.current,e.current=t}var te=ue(null),le=ue(null),he=ue(null),re=ue(null);function pe(e,t){switch(fe(he,t),fe(le,e),fe(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Sp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Sp(t),e=Cp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}xe(te),fe(te,e)}function se(){xe(te),xe(le),xe(he)}function Se(e){e.memoizedState!==null&&fe(re,e);var t=te.current,l=Cp(t,e.type);t!==l&&(fe(le,e),fe(te,l))}function Ae(e){le.current===e&&(xe(te),xe(le)),re.current===e&&(xe(re),as._currentValue=K)}var Be,ht;function tt(e){if(Be===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Be=t&&t[1]||"",ht=-1<l.stack.indexOf(`
|
|
26
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
-
`+Be+e+ht}var we=!1;function Re(e,t){if(!e||we)return"";we=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(q){var Y=q}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(q){Y=q}e.call(ee.prototype)}}else{try{throw Error()}catch(q){Y=q}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(q){if(q&&Y&&typeof q.stack=="string")return[q.stack,Y.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=o.DetermineComponentFrameRoot(),b=f[0],M=f[1];if(b&&M){var L=b.split(`
|
|
28
|
-
`),G=M.split(`
|
|
29
|
-
`);for(u=o=0;o<L.length&&!L[o].includes("DetermineComponentFrameRoot");)o++;for(;u<G.length&&!G[u].includes("DetermineComponentFrameRoot");)u++;if(o===L.length||u===G.length)for(o=L.length-1,u=G.length-1;1<=o&&0<=u&&L[o]!==G[u];)u--;for(;1<=o&&0<=u;o--,u--)if(L[o]!==G[u]){if(o!==1||u!==1)do if(o--,u--,0>u||L[o]!==G[u]){var W=`
|
|
30
|
-
`+L[o].replace(" at new "," at ");return e.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",e.displayName)),W}while(1<=o&&0<=u);break}}}finally{we=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?tt(l):""}function it(e,t){switch(e.tag){case 26:case 27:case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return e.child!==t&&t!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return Re(e.type,!1);case 11:return Re(e.type.render,!1);case 1:return Re(e.type,!0);case 31:return tt("Activity");default:return""}}function Ue(e){try{var t="",l=null;do t+=it(e,l),l=e,e=e.return;while(e);return t}catch(o){return`
|
|
31
|
-
Error generating stack: `+o.message+`
|
|
32
|
-
`+o.stack}}var gt=Object.prototype.hasOwnProperty,Rt=i.unstable_scheduleCallback,xn=i.unstable_cancelCallback,Nn=i.unstable_shouldYield,dl=i.unstable_requestPaint,bt=i.unstable_now,It=i.unstable_getCurrentPriorityLevel,_n=i.unstable_ImmediatePriority,ba=i.unstable_UserBlockingPriority,zi=i.unstable_NormalPriority,Ls=i.unstable_LowPriority,ya=i.unstable_IdlePriority,Rs=i.log,js=i.unstable_setDisableYieldValue,ii=null,Mt=null;function hn(e){if(typeof Rs=="function"&&js(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(ii,e)}catch{}}var kt=Math.clz32?Math.clz32:me,kr=Math.log,Os=Math.LN2;function me(e){return e>>>=0,e===0?32:31-(kr(e)/Os|0)|0}var Ge=256,Nt=262144,Ft=4194304;function Ln(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 fl(e,t,l){var o=e.pendingLanes;if(o===0)return 0;var u=0,f=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var M=o&134217727;return M!==0?(o=M&~f,o!==0?u=Ln(o):(b&=M,b!==0?u=Ln(b):l||(l=M&~e,l!==0&&(u=Ln(l))))):(M=o&~f,M!==0?u=Ln(M):b!==0?u=Ln(b):l||(l=o&~e,l!==0&&(u=Ln(l)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,l=t&-t,f>=l||f===32&&(l&4194048)!==0)?t:u}function Hi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ds(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 zs(){var e=Ft;return Ft<<=1,(Ft&62914560)===0&&(Ft=4194304),e}function hl(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function va(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function S0(e,t,l,o,u,f){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var M=e.entanglements,L=e.expirationTimes,G=e.hiddenUpdates;for(l=b&~l;0<l;){var W=31-kt(l),ee=1<<W;M[W]=0,L[W]=-1;var Y=G[W];if(Y!==null)for(G[W]=null,W=0;W<Y.length;W++){var q=Y[W];q!==null&&(q.lane&=-536870913)}l&=~ee}o!==0&&lf(e,o,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(b&~t))}function lf(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var o=31-kt(t);e.entangledLanes|=t,e.entanglements[o]=e.entanglements[o]|1073741824|l&261930}function af(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var o=31-kt(l),u=1<<o;u&t|e[o]&t&&(e[o]|=t),l&=~u}}function sf(e,t){var l=t&-t;return l=(l&42)!==0?1:Nr(l),(l&(e.suspendedLanes|t))!==0?0:l}function Nr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function _r(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function of(){var e=J.p;return e!==0?e:(e=window.event,e===void 0?32:$p(e.type))}function rf(e,t){var l=J.p;try{return J.p=e,t()}finally{J.p=l}}var li=Math.random().toString(36).slice(2),xt="__reactFiber$"+li,jt="__reactProps$"+li,ml="__reactContainer$"+li,Lr="__reactEvents$"+li,C0="__reactListeners$"+li,T0="__reactHandles$"+li,cf="__reactResources$"+li,xa="__reactMarker$"+li;function Rr(e){delete e[xt],delete e[jt],delete e[Lr],delete e[C0],delete e[T0]}function pl(e){var t=e[xt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[ml]||l[xt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=_p(e);e!==null;){if(l=e[xt])return l;e=_p(e)}return t}e=l,l=e.parentNode}return null}function gl(e){if(e=e[xt]||e[ml]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function bl(e){var t=e[cf];return t||(t=e[cf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function yt(e){e[xa]=!0}var uf=new Set,df={};function Bi(e,t){yl(e,t),yl(e+"Capture",t)}function yl(e,t){for(df[e]=t,e=0;e<t.length;e++)uf.add(t[e])}var M0=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]*$"),ff={},hf={};function A0(e){return gt.call(hf,e)?!0:gt.call(ff,e)?!1:M0.test(e)?hf[e]=!0:(ff[e]=!0,!1)}function Hs(e,t,l){if(A0(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var o=t.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Bs(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Rn(e,t,l,o){if(o===null)e.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+o)}}function Wt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function E0(e,t,l){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,f=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){l=""+b,f.call(this,b)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jr(e){if(!e._valueTracker){var t=mf(e)?"checked":"value";e._valueTracker=E0(e,t,""+e[t])}}function pf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),o="";return e&&(o=mf(e)?e.checked?"true":"false":e.value),e=o,e!==l?(t.setValue(e),!0):!1}function Us(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 k0=/[\n"\\]/g;function Zt(e){return e.replace(k0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Or(e,t,l,o,u,f,b,M){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Wt(t)):e.value!==""+Wt(t)&&(e.value=""+Wt(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Dr(e,b,Wt(t)):l!=null?Dr(e,b,Wt(l)):o!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?e.name=""+Wt(M):e.removeAttribute("name")}function gf(e,t,l,o,u,f,b,M){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||l!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){jr(e);return}l=l!=null?""+Wt(l):"",t=t!=null?""+Wt(t):l,M||t===e.value||(e.value=t),e.defaultValue=t}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=M?e.checked:!!o,e.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),jr(e)}function Dr(e,t,l){t==="number"&&Us(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function vl(e,t,l,o){if(e=e.options,t){t={};for(var u=0;u<l.length;u++)t["$"+l[u]]=!0;for(l=0;l<e.length;l++)u=t.hasOwnProperty("$"+e[l].value),e[l].selected!==u&&(e[l].selected=u),u&&o&&(e[l].defaultSelected=!0)}else{for(l=""+Wt(l),t=null,u=0;u<e.length;u++){if(e[u].value===l){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function bf(e,t,l){if(t!=null&&(t=""+Wt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Wt(l):""}function yf(e,t,l,o){if(t==null){if(o!=null){if(l!=null)throw Error(s(92));if(ce(o)){if(1<o.length)throw Error(s(93));o=o[0]}l=o}l==null&&(l=""),t=l}l=Wt(t),e.defaultValue=l,o=e.textContent,o===l&&o!==""&&o!==null&&(e.value=o),jr(e)}function xl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var N0=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 vf(e,t,l){var o=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?o?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":o?e.setProperty(t,l):typeof l!="number"||l===0||N0.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function xf(e,t,l){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,l!=null){for(var o in l)!l.hasOwnProperty(o)||t!=null&&t.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in t)o=t[u],t.hasOwnProperty(u)&&l[u]!==o&&vf(e,u,o)}else for(var f in t)t.hasOwnProperty(f)&&vf(e,f,t[f])}function zr(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 _0=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"]]),L0=/^[\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 L0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function jn(){}var Hr=null;function Br(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wl=null,Sl=null;function wf(e){var t=gl(e);if(t&&(e=t.stateNode)){var l=e[jt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Or(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Zt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var o=l[t];if(o!==e&&o.form===e.form){var u=o[jt]||null;if(!u)throw Error(s(90));Or(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<l.length;t++)o=l[t],o.form===e.form&&pf(o)}break e;case"textarea":bf(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&vl(e,!!l.multiple,t,!1)}}}var Ur=!1;function Sf(e,t,l){if(Ur)return e(t,l);Ur=!0;try{var o=e(t);return o}finally{if(Ur=!1,(wl!==null||Sl!==null)&&(ko(),wl&&(t=wl,e=Sl,Sl=wl=null,wf(t),e)))for(t=0;t<e.length;t++)wf(e[t])}}function Sa(e,t){var l=e.stateNode;if(l===null)return null;var o=l[jt]||null;if(o===null)return null;l=o[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":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(s(231,t,typeof l));return l}var On=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kr=!1;if(On)try{var Ca={};Object.defineProperty(Ca,"passive",{get:function(){Kr=!0}}),window.addEventListener("test",Ca,Ca),window.removeEventListener("test",Ca,Ca)}catch{Kr=!1}var ai=null,Ir=null,Is=null;function Cf(){if(Is)return Is;var e,t=Ir,l=t.length,o,u="value"in ai?ai.value:ai.textContent,f=u.length;for(e=0;e<l&&t[e]===u[e];e++);var b=l-e;for(o=1;o<=b&&t[l-o]===u[f-o];o++);return Is=u.slice(e,1<o?1-o:void 0)}function Fs(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 Gs(){return!0}function Tf(){return!1}function Ot(e){function t(l,o,u,f,b){this._reactName=l,this._targetInst=u,this.type=o,this.nativeEvent=f,this.target=b,this.currentTarget=null;for(var M in e)e.hasOwnProperty(M)&&(l=e[M],this[M]=l?l(f):f[M]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?Gs:Tf,this.isPropagationStopped=Tf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Gs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Gs)},persist:function(){},isPersistent:Gs}),t}var Ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ys=Ot(Ui),Ta=v({},Ui,{view:0,detail:0}),R0=Ot(Ta),Fr,Gr,Ma,Ps=v({},Ta,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pr,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!==Ma&&(Ma&&e.type==="mousemove"?(Fr=e.screenX-Ma.screenX,Gr=e.screenY-Ma.screenY):Gr=Fr=0,Ma=e),Fr)},movementY:function(e){return"movementY"in e?e.movementY:Gr}}),Mf=Ot(Ps),j0=v({},Ps,{dataTransfer:0}),O0=Ot(j0),D0=v({},Ta,{relatedTarget:0}),Yr=Ot(D0),z0=v({},Ui,{animationName:0,elapsedTime:0,pseudoElement:0}),H0=Ot(z0),B0=v({},Ui,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),U0=Ot(B0),K0=v({},Ui,{data:0}),Af=Ot(K0),I0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},F0={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"},G0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Y0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=G0[e])?!!t[e]:!1}function Pr(){return Y0}var P0=v({},Ta,{key:function(e){if(e.key){var t=I0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?F0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pr,charCode:function(e){return e.type==="keypress"?Fs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),$0=Ot(P0),V0=v({},Ps,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ef=Ot(V0),q0=v({},Ta,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pr}),X0=Ot(q0),W0=v({},Ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),Z0=Ot(W0),Q0=v({},Ps,{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}),J0=Ot(Q0),ev=v({},Ui,{newState:0,oldState:0}),tv=Ot(ev),nv=[9,13,27,32],$r=On&&"CompositionEvent"in window,Aa=null;On&&"documentMode"in document&&(Aa=document.documentMode);var iv=On&&"TextEvent"in window&&!Aa,kf=On&&(!$r||Aa&&8<Aa&&11>=Aa),Nf=" ",_f=!1;function Lf(e,t){switch(e){case"keyup":return nv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Cl=!1;function lv(e,t){switch(e){case"compositionend":return Rf(t);case"keypress":return t.which!==32?null:(_f=!0,Nf);case"textInput":return e=t.data,e===Nf&&_f?null:e;default:return null}}function av(e,t){if(Cl)return e==="compositionend"||!$r&&Lf(e,t)?(e=Cf(),Is=Ir=ai=null,Cl=!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 kf&&t.locale!=="ko"?null:t.data;default:return null}}var sv={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 jf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sv[e.type]:t==="textarea"}function Of(e,t,l,o){wl?Sl?Sl.push(o):Sl=[o]:wl=o,t=Do(t,"onChange"),0<t.length&&(l=new Ys("onChange","change",null,l,o),e.push({event:l,listeners:t}))}var Ea=null,ka=null;function ov(e){gp(e,0)}function $s(e){var t=wa(e);if(pf(t))return e}function Df(e,t){if(e==="change")return t}var zf=!1;if(On){var Vr;if(On){var qr="oninput"in document;if(!qr){var Hf=document.createElement("div");Hf.setAttribute("oninput","return;"),qr=typeof Hf.oninput=="function"}Vr=qr}else Vr=!1;zf=Vr&&(!document.documentMode||9<document.documentMode)}function Bf(){Ea&&(Ea.detachEvent("onpropertychange",Uf),ka=Ea=null)}function Uf(e){if(e.propertyName==="value"&&$s(ka)){var t=[];Of(t,ka,e,Br(e)),Sf(ov,t)}}function rv(e,t,l){e==="focusin"?(Bf(),Ea=t,ka=l,Ea.attachEvent("onpropertychange",Uf)):e==="focusout"&&Bf()}function cv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $s(ka)}function uv(e,t){if(e==="click")return $s(t)}function dv(e,t){if(e==="input"||e==="change")return $s(t)}function fv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gt=typeof Object.is=="function"?Object.is:fv;function Na(e,t){if(Gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),o=Object.keys(t);if(l.length!==o.length)return!1;for(o=0;o<l.length;o++){var u=l[o];if(!gt.call(t,u)||!Gt(e[u],t[u]))return!1}return!0}function Kf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function If(e,t){var l=Kf(e);e=0;for(var o;l;){if(l.nodeType===3){if(o=e+l.textContent.length,e<=t&&o>=t)return{node:l,offset:t-e};e=o}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Kf(l)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Us(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Us(e.document)}return t}function Xr(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 hv=On&&"documentMode"in document&&11>=document.documentMode,Tl=null,Wr=null,_a=null,Zr=!1;function Yf(e,t,l){var o=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Zr||Tl==null||Tl!==Us(o)||(o=Tl,"selectionStart"in o&&Xr(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),_a&&Na(_a,o)||(_a=o,o=Do(Wr,"onSelect"),0<o.length&&(t=new Ys("onSelect","select",null,t,l),e.push({event:t,listeners:o}),t.target=Tl)))}function Ki(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ml={animationend:Ki("Animation","AnimationEnd"),animationiteration:Ki("Animation","AnimationIteration"),animationstart:Ki("Animation","AnimationStart"),transitionrun:Ki("Transition","TransitionRun"),transitionstart:Ki("Transition","TransitionStart"),transitioncancel:Ki("Transition","TransitionCancel"),transitionend:Ki("Transition","TransitionEnd")},Qr={},Pf={};On&&(Pf=document.createElement("div").style,"AnimationEvent"in window||(delete Ml.animationend.animation,delete Ml.animationiteration.animation,delete Ml.animationstart.animation),"TransitionEvent"in window||delete Ml.transitionend.transition);function Ii(e){if(Qr[e])return Qr[e];if(!Ml[e])return e;var t=Ml[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Pf)return Qr[e]=t[l];return e}var $f=Ii("animationend"),Vf=Ii("animationiteration"),qf=Ii("animationstart"),mv=Ii("transitionrun"),pv=Ii("transitionstart"),gv=Ii("transitioncancel"),Xf=Ii("transitionend"),Wf=new Map,Jr="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(" ");Jr.push("scrollEnd");function mn(e,t){Wf.set(e,t),Bi(t,[e])}var Vs=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)},Qt=[],Al=0,ec=0;function qs(){for(var e=Al,t=ec=Al=0;t<e;){var l=Qt[t];Qt[t++]=null;var o=Qt[t];Qt[t++]=null;var u=Qt[t];Qt[t++]=null;var f=Qt[t];if(Qt[t++]=null,o!==null&&u!==null){var b=o.pending;b===null?u.next=u:(u.next=b.next,b.next=u),o.pending=u}f!==0&&Zf(l,u,f)}}function Xs(e,t,l,o){Qt[Al++]=e,Qt[Al++]=t,Qt[Al++]=l,Qt[Al++]=o,ec|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function tc(e,t,l,o){return Xs(e,t,l,o),Ws(e)}function Fi(e,t){return Xs(e,null,null,t),Ws(e)}function Zf(e,t,l){e.lanes|=l;var o=e.alternate;o!==null&&(o.lanes|=l);for(var u=!1,f=e.return;f!==null;)f.childLanes|=l,o=f.alternate,o!==null&&(o.childLanes|=l),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-kt(l),e=f.hiddenUpdates,o=e[u],o===null?e[u]=[t]:o.push(t),t.lane=l|536870912),f):null}function Ws(e){if(50<Qa)throw Qa=0,uu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var El={};function bv(e,t,l,o){this.tag=e,this.key=l,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yt(e,t,l,o){return new bv(e,t,l,o)}function nc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Dn(e,t){var l=e.alternate;return l===null?(l=Yt(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Qf(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Zs(e,t,l,o,u,f){var b=0;if(o=e,typeof e=="function")nc(e)&&(b=1);else if(typeof e=="string")b=Sx(e,l,te.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=Yt(31,l,t,u),e.elementType=R,e.lanes=f,e;case C:return Gi(l.children,u,f,t);case A:b=8,u|=24;break;case N:return e=Yt(12,l,t,u|2),e.elementType=N,e.lanes=f,e;case P:return e=Yt(13,l,t,u),e.elementType=P,e.lanes=f,e;case B:return e=Yt(19,l,t,u),e.elementType=B,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:b=10;break e;case E:b=9;break e;case D:b=11;break e;case O:b=14;break e;case k:b=16,o=null;break e}b=29,l=Error(s(130,e===null?"null":typeof e,"")),o=null}return t=Yt(b,l,t,u),t.elementType=e,t.type=o,t.lanes=f,t}function Gi(e,t,l,o){return e=Yt(7,e,o,t),e.lanes=l,e}function ic(e,t,l){return e=Yt(6,e,null,t),e.lanes=l,e}function Jf(e){var t=Yt(18,null,null,0);return t.stateNode=e,t}function lc(e,t,l){return t=Yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var eh=new WeakMap;function Jt(e,t){if(typeof e=="object"&&e!==null){var l=eh.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Ue(t)},eh.set(e,t),t)}return{value:e,source:t,stack:Ue(t)}}var kl=[],Nl=0,Qs=null,La=0,en=[],tn=0,si=null,wn=1,Sn="";function zn(e,t){kl[Nl++]=La,kl[Nl++]=Qs,Qs=e,La=t}function th(e,t,l){en[tn++]=wn,en[tn++]=Sn,en[tn++]=si,si=e;var o=wn;e=Sn;var u=32-kt(o)-1;o&=~(1<<u),l+=1;var f=32-kt(t)+u;if(30<f){var b=u-u%5;f=(o&(1<<b)-1).toString(32),o>>=b,u-=b,wn=1<<32-kt(t)+u|l<<u|o,Sn=f+e}else wn=1<<f|l<<u|o,Sn=e}function ac(e){e.return!==null&&(zn(e,1),th(e,1,0))}function sc(e){for(;e===Qs;)Qs=kl[--Nl],kl[Nl]=null,La=kl[--Nl],kl[Nl]=null;for(;e===si;)si=en[--tn],en[tn]=null,Sn=en[--tn],en[tn]=null,wn=en[--tn],en[tn]=null}function nh(e,t){en[tn++]=wn,en[tn++]=Sn,en[tn++]=si,wn=t.id,Sn=t.overflow,si=e}var wt=null,We=null,He=!1,oi=null,nn=!1,oc=Error(s(519));function ri(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ra(Jt(t,e)),oc}function ih(e){var t=e.stateNode,l=e.type,o=e.memoizedProps;switch(t[xt]=e,t[jt]=o,l){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(l=0;l<es.length;l++)Oe(es[l],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),gf(t,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),yf(t,o.value,o.defaultValue,o.children)}l=o.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||o.suppressHydrationWarning===!0||xp(t.textContent,l)?(o.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),o.onScroll!=null&&Oe("scroll",t),o.onScrollEnd!=null&&Oe("scrollend",t),o.onClick!=null&&(t.onclick=jn),t=!0):t=!1,t||ri(e,!0)}function lh(e){for(wt=e.return;wt;)switch(wt.tag){case 5:case 31:case 13:nn=!1;return;case 27:case 3:nn=!0;return;default:wt=wt.return}}function _l(e){if(e!==wt)return!1;if(!He)return lh(e),He=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Mu(e.type,e.memoizedProps)),l=!l),l&&We&&ri(e),lh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));We=Np(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));We=Np(e)}else t===27?(t=We,Si(e.type)?(e=_u,_u=null,We=e):We=t):We=wt?an(e.stateNode.nextSibling):null;return!0}function Yi(){We=wt=null,He=!1}function rc(){var e=oi;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),oi=null),e}function Ra(e){oi===null?oi=[e]:oi.push(e)}var cc=ue(null),Pi=null,Hn=null;function ci(e,t,l){fe(cc,t._currentValue),t._currentValue=l}function Bn(e){e._currentValue=cc.current,xe(cc)}function uc(e,t,l){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===l)break;e=e.return}}function dc(e,t,l,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var b=u.child;f=f.firstContext;e:for(;f!==null;){var M=f;f=u;for(var L=0;L<t.length;L++)if(M.context===t[L]){f.lanes|=l,M=f.alternate,M!==null&&(M.lanes|=l),uc(f.return,l,e),o||(b=null);break e}f=M.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(s(341));b.lanes|=l,f=b.alternate,f!==null&&(f.lanes|=l),uc(b,l,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 Ll(e,t,l,o){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(s(387));if(b=b.memoizedProps,b!==null){var M=u.type;Gt(u.pendingProps.value,b.value)||(e!==null?e.push(M):e=[M])}}else if(u===re.current){if(b=u.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(as):e=[as])}u=u.return}e!==null&&dc(t,e,l,o),t.flags|=262144}function Js(e){for(e=e.firstContext;e!==null;){if(!Gt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $i(e){Pi=e,Hn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return ah(Pi,e)}function eo(e,t){return Pi===null&&$i(e),ah(e,t)}function ah(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},Hn===null){if(e===null)throw Error(s(308));Hn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Hn=Hn.next=t;return l}var yv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,o){e.push(o)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},vv=i.unstable_scheduleCallback,xv=i.unstable_NormalPriority,ct={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fc(){return{controller:new yv,data:new Map,refCount:0}}function ja(e){e.refCount--,e.refCount===0&&vv(xv,function(){e.controller.abort()})}var Oa=null,hc=0,Rl=0,jl=null;function wv(e,t){if(Oa===null){var l=Oa=[];hc=0,Rl=gu(),jl={status:"pending",value:void 0,then:function(o){l.push(o)}}}return hc++,t.then(sh,sh),t}function sh(){if(--hc===0&&Oa!==null){jl!==null&&(jl.status="fulfilled");var e=Oa;Oa=null,Rl=0,jl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sv(e,t){var l=[],o={status:"pending",value:null,reason:null,then:function(u){l.push(u)}};return e.then(function(){o.status="fulfilled",o.value=t;for(var u=0;u<l.length;u++)(0,l[u])(t)},function(u){for(o.status="rejected",o.reason=u,u=0;u<l.length;u++)(0,l[u])(void 0)}),o}var oh=z.S;z.S=function(e,t){Ym=bt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&wv(e,t),oh!==null&&oh(e,t)};var Vi=ue(null);function mc(){var e=Vi.current;return e!==null?e:Xe.pooledCache}function to(e,t){t===null?fe(Vi,Vi.current):fe(Vi,t.pool)}function rh(){var e=mc();return e===null?null:{parent:ct._currentValue,pool:e}}var Ol=Error(s(460)),pc=Error(s(474)),no=Error(s(542)),io={then:function(){}};function ch(e){return e=e.status,e==="fulfilled"||e==="rejected"}function uh(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(jn,jn),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e;default:if(typeof t.status=="string")t.then(jn,jn);else{if(e=Xe,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(o){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=o}},function(o){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=o}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,fh(e),e}throw Xi=t,Ol}}function qi(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Xi=l,Ol):l}}var Xi=null;function dh(){if(Xi===null)throw Error(s(459));var e=Xi;return Xi=null,e}function fh(e){if(e===Ol||e===no)throw Error(s(483))}var Dl=null,Da=0;function lo(e){var t=Da;return Da+=1,Dl===null&&(Dl=[]),uh(Dl,e,t)}function za(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ao(e,t){throw t.$$typeof===S?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function hh(e){function t(U,j){if(e){var F=U.deletions;F===null?(U.deletions=[j],U.flags|=16):F.push(j)}}function l(U,j){if(!e)return null;for(;j!==null;)t(U,j),j=j.sibling;return null}function o(U){for(var j=new Map;U!==null;)U.key!==null?j.set(U.key,U):j.set(U.index,U),U=U.sibling;return j}function u(U,j){return U=Dn(U,j),U.index=0,U.sibling=null,U}function f(U,j,F){return U.index=F,e?(F=U.alternate,F!==null?(F=F.index,F<j?(U.flags|=67108866,j):F):(U.flags|=67108866,j)):(U.flags|=1048576,j)}function b(U){return e&&U.alternate===null&&(U.flags|=67108866),U}function M(U,j,F,Z){return j===null||j.tag!==6?(j=ic(F,U.mode,Z),j.return=U,j):(j=u(j,F),j.return=U,j)}function L(U,j,F,Z){var Ce=F.type;return Ce===C?W(U,j,F.props.children,Z,F.key):j!==null&&(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===k&&qi(Ce)===j.type)?(j=u(j,F.props),za(j,F),j.return=U,j):(j=Zs(F.type,F.key,F.props,null,U.mode,Z),za(j,F),j.return=U,j)}function G(U,j,F,Z){return j===null||j.tag!==4||j.stateNode.containerInfo!==F.containerInfo||j.stateNode.implementation!==F.implementation?(j=lc(F,U.mode,Z),j.return=U,j):(j=u(j,F.children||[]),j.return=U,j)}function W(U,j,F,Z,Ce){return j===null||j.tag!==7?(j=Gi(F,U.mode,Z,Ce),j.return=U,j):(j=u(j,F),j.return=U,j)}function ee(U,j,F){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=ic(""+j,U.mode,F),j.return=U,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case x:return F=Zs(j.type,j.key,j.props,null,U.mode,F),za(F,j),F.return=U,F;case w:return j=lc(j,U.mode,F),j.return=U,j;case k:return j=qi(j),ee(U,j,F)}if(ce(j)||X(j))return j=Gi(j,U.mode,F,null),j.return=U,j;if(typeof j.then=="function")return ee(U,lo(j),F);if(j.$$typeof===_)return ee(U,eo(U,j),F);ao(U,j)}return null}function Y(U,j,F,Z){var Ce=j!==null?j.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Ce!==null?null:M(U,j,""+F,Z);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case x:return F.key===Ce?L(U,j,F,Z):null;case w:return F.key===Ce?G(U,j,F,Z):null;case k:return F=qi(F),Y(U,j,F,Z)}if(ce(F)||X(F))return Ce!==null?null:W(U,j,F,Z,null);if(typeof F.then=="function")return Y(U,j,lo(F),Z);if(F.$$typeof===_)return Y(U,j,eo(U,F),Z);ao(U,F)}return null}function q(U,j,F,Z,Ce){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return U=U.get(F)||null,M(j,U,""+Z,Ce);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:return U=U.get(Z.key===null?F:Z.key)||null,L(j,U,Z,Ce);case w:return U=U.get(Z.key===null?F:Z.key)||null,G(j,U,Z,Ce);case k:return Z=qi(Z),q(U,j,F,Z,Ce)}if(ce(Z)||X(Z))return U=U.get(F)||null,W(j,U,Z,Ce,null);if(typeof Z.then=="function")return q(U,j,F,lo(Z),Ce);if(Z.$$typeof===_)return q(U,j,F,eo(j,Z),Ce);ao(j,Z)}return null}function ye(U,j,F,Z){for(var Ce=null,Ke=null,ve=j,_e=j=0,ze=null;ve!==null&&_e<F.length;_e++){ve.index>_e?(ze=ve,ve=null):ze=ve.sibling;var Ie=Y(U,ve,F[_e],Z);if(Ie===null){ve===null&&(ve=ze);break}e&&ve&&Ie.alternate===null&&t(U,ve),j=f(Ie,j,_e),Ke===null?Ce=Ie:Ke.sibling=Ie,Ke=Ie,ve=ze}if(_e===F.length)return l(U,ve),He&&zn(U,_e),Ce;if(ve===null){for(;_e<F.length;_e++)ve=ee(U,F[_e],Z),ve!==null&&(j=f(ve,j,_e),Ke===null?Ce=ve:Ke.sibling=ve,Ke=ve);return He&&zn(U,_e),Ce}for(ve=o(ve);_e<F.length;_e++)ze=q(ve,U,_e,F[_e],Z),ze!==null&&(e&&ze.alternate!==null&&ve.delete(ze.key===null?_e:ze.key),j=f(ze,j,_e),Ke===null?Ce=ze:Ke.sibling=ze,Ke=ze);return e&&ve.forEach(function(Ei){return t(U,Ei)}),He&&zn(U,_e),Ce}function Te(U,j,F,Z){if(F==null)throw Error(s(151));for(var Ce=null,Ke=null,ve=j,_e=j=0,ze=null,Ie=F.next();ve!==null&&!Ie.done;_e++,Ie=F.next()){ve.index>_e?(ze=ve,ve=null):ze=ve.sibling;var Ei=Y(U,ve,Ie.value,Z);if(Ei===null){ve===null&&(ve=ze);break}e&&ve&&Ei.alternate===null&&t(U,ve),j=f(Ei,j,_e),Ke===null?Ce=Ei:Ke.sibling=Ei,Ke=Ei,ve=ze}if(Ie.done)return l(U,ve),He&&zn(U,_e),Ce;if(ve===null){for(;!Ie.done;_e++,Ie=F.next())Ie=ee(U,Ie.value,Z),Ie!==null&&(j=f(Ie,j,_e),Ke===null?Ce=Ie:Ke.sibling=Ie,Ke=Ie);return He&&zn(U,_e),Ce}for(ve=o(ve);!Ie.done;_e++,Ie=F.next())Ie=q(ve,U,_e,Ie.value,Z),Ie!==null&&(e&&Ie.alternate!==null&&ve.delete(Ie.key===null?_e:Ie.key),j=f(Ie,j,_e),Ke===null?Ce=Ie:Ke.sibling=Ie,Ke=Ie);return e&&ve.forEach(function(jx){return t(U,jx)}),He&&zn(U,_e),Ce}function qe(U,j,F,Z){if(typeof F=="object"&&F!==null&&F.type===C&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case x:e:{for(var Ce=F.key;j!==null;){if(j.key===Ce){if(Ce=F.type,Ce===C){if(j.tag===7){l(U,j.sibling),Z=u(j,F.props.children),Z.return=U,U=Z;break e}}else if(j.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===k&&qi(Ce)===j.type){l(U,j.sibling),Z=u(j,F.props),za(Z,F),Z.return=U,U=Z;break e}l(U,j);break}else t(U,j);j=j.sibling}F.type===C?(Z=Gi(F.props.children,U.mode,Z,F.key),Z.return=U,U=Z):(Z=Zs(F.type,F.key,F.props,null,U.mode,Z),za(Z,F),Z.return=U,U=Z)}return b(U);case w:e:{for(Ce=F.key;j!==null;){if(j.key===Ce)if(j.tag===4&&j.stateNode.containerInfo===F.containerInfo&&j.stateNode.implementation===F.implementation){l(U,j.sibling),Z=u(j,F.children||[]),Z.return=U,U=Z;break e}else{l(U,j);break}else t(U,j);j=j.sibling}Z=lc(F,U.mode,Z),Z.return=U,U=Z}return b(U);case k:return F=qi(F),qe(U,j,F,Z)}if(ce(F))return ye(U,j,F,Z);if(X(F)){if(Ce=X(F),typeof Ce!="function")throw Error(s(150));return F=Ce.call(F),Te(U,j,F,Z)}if(typeof F.then=="function")return qe(U,j,lo(F),Z);if(F.$$typeof===_)return qe(U,j,eo(U,F),Z);ao(U,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,j!==null&&j.tag===6?(l(U,j.sibling),Z=u(j,F),Z.return=U,U=Z):(l(U,j),Z=ic(F,U.mode,Z),Z.return=U,U=Z),b(U)):l(U,j)}return function(U,j,F,Z){try{Da=0;var Ce=qe(U,j,F,Z);return Dl=null,Ce}catch(ve){if(ve===Ol||ve===no)throw ve;var Ke=Yt(29,ve,null,U.mode);return Ke.lanes=Z,Ke.return=U,Ke}finally{}}}var Wi=hh(!0),mh=hh(!1),ui=!1;function gc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bc(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 di(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fi(e,t,l){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Fe&2)!==0){var u=o.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),o.pending=t,t=Ws(e),Zf(e,null,l),t}return Xs(e,o,t,l),Ws(e)}function Ha(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var o=t.lanes;o&=e.pendingLanes,l|=o,t.lanes=l,af(e,l)}}function yc(e,t){var l=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,l===o)){var u=null,f=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};f===null?u=f=b:f=f.next=b,l=l.next}while(l!==null);f===null?u=f=t:f=f.next=t}else u=f=t;l={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var vc=!1;function Ba(){if(vc){var e=jl;if(e!==null)throw e}}function Ua(e,t,l,o){vc=!1;var u=e.updateQueue;ui=!1;var f=u.firstBaseUpdate,b=u.lastBaseUpdate,M=u.shared.pending;if(M!==null){u.shared.pending=null;var L=M,G=L.next;L.next=null,b===null?f=G:b.next=G,b=L;var W=e.alternate;W!==null&&(W=W.updateQueue,M=W.lastBaseUpdate,M!==b&&(M===null?W.firstBaseUpdate=G:M.next=G,W.lastBaseUpdate=L))}if(f!==null){var ee=u.baseState;b=0,W=G=L=null,M=f;do{var Y=M.lane&-536870913,q=Y!==M.lane;if(q?(De&Y)===Y:(o&Y)===Y){Y!==0&&Y===Rl&&(vc=!0),W!==null&&(W=W.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var ye=e,Te=M;Y=t;var qe=l;switch(Te.tag){case 1:if(ye=Te.payload,typeof ye=="function"){ee=ye.call(qe,ee,Y);break e}ee=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Te.payload,Y=typeof ye=="function"?ye.call(qe,ee,Y):ye,Y==null)break e;ee=v({},ee,Y);break e;case 2:ui=!0}}Y=M.callback,Y!==null&&(e.flags|=64,q&&(e.flags|=8192),q=u.callbacks,q===null?u.callbacks=[Y]:q.push(Y))}else q={lane:Y,tag:M.tag,payload:M.payload,callback:M.callback,next:null},W===null?(G=W=q,L=ee):W=W.next=q,b|=Y;if(M=M.next,M===null){if(M=u.shared.pending,M===null)break;q=M,M=q.next,q.next=null,u.lastBaseUpdate=q,u.shared.pending=null}}while(!0);W===null&&(L=ee),u.baseState=L,u.firstBaseUpdate=G,u.lastBaseUpdate=W,f===null&&(u.shared.lanes=0),bi|=b,e.lanes=b,e.memoizedState=ee}}function ph(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function gh(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)ph(l[e],t)}var zl=ue(null),so=ue(0);function bh(e,t){e=Vn,fe(so,e),fe(zl,t),Vn=e|t.baseLanes}function xc(){fe(so,Vn),fe(zl,zl.current)}function wc(){Vn=so.current,xe(zl),xe(so)}var Pt=ue(null),ln=null;function hi(e){var t=e.alternate;fe(ot,ot.current&1),fe(Pt,e),ln===null&&(t===null||zl.current!==null||t.memoizedState!==null)&&(ln=e)}function Sc(e){fe(ot,ot.current),fe(Pt,e),ln===null&&(ln=e)}function yh(e){e.tag===22?(fe(ot,ot.current),fe(Pt,e),ln===null&&(ln=e)):mi()}function mi(){fe(ot,ot.current),fe(Pt,Pt.current)}function $t(e){xe(Pt),ln===e&&(ln=null),xe(ot)}var ot=ue(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||ku(l)||Nu(l)))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 Un=0,ke=null,$e=null,ut=null,ro=!1,Hl=!1,Zi=!1,co=0,Ka=0,Bl=null,Cv=0;function lt(){throw Error(s(321))}function Cc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Gt(e[l],t[l]))return!1;return!0}function Tc(e,t,l,o,u,f){return Un=f,ke=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?tm:Uc,Zi=!1,f=l(o,u),Zi=!1,Hl&&(f=xh(t,l,o,u)),vh(e),f}function vh(e){z.H=Ga;var t=$e!==null&&$e.next!==null;if(Un=0,ut=$e=ke=null,ro=!1,Ka=0,Bl=null,t)throw Error(s(300));e===null||dt||(e=e.dependencies,e!==null&&Js(e)&&(dt=!0))}function xh(e,t,l,o){ke=e;var u=0;do{if(Hl&&(Bl=null),Ka=0,Hl=!1,25<=u)throw Error(s(301));if(u+=1,ut=$e=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}z.H=nm,f=t(l,o)}while(Hl);return f}function Tv(){var e=z.H,t=e.useState()[0];return t=typeof t.then=="function"?Ia(t):t,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(ke.flags|=1024),t}function Mc(){var e=co!==0;return co=0,e}function Ac(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Ec(e){if(ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ro=!1}Un=0,ut=$e=ke=null,Hl=!1,Ka=co=0,Bl=null}function _t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?ke.memoizedState=ut=e:ut=ut.next=e,ut}function rt(){if($e===null){var e=ke.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var t=ut===null?ke.memoizedState:ut.next;if(t!==null)ut=t,$e=e;else{if(e===null)throw ke.alternate===null?Error(s(467)):Error(s(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},ut===null?ke.memoizedState=ut=e:ut=ut.next=e}return ut}function uo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ia(e){var t=Ka;return Ka+=1,Bl===null&&(Bl=[]),e=uh(Bl,e,t),t=ke,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?tm:Uc),e}function fo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ia(e);if(e.$$typeof===_)return St(e)}throw Error(s(438,String(e)))}function kc(e){var t=null,l=ke.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var o=ke.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(t={data:o.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=uo(),ke.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),o=0;o<e;o++)l[o]=I;return t.index++,l}function Kn(e,t){return typeof t=="function"?t(e):t}function ho(e){var t=rt();return Nc(t,$e,e)}function Nc(e,t,l){var o=e.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=l;var u=e.baseQueue,f=o.pending;if(f!==null){if(u!==null){var b=u.next;u.next=f.next,f.next=b}t.baseQueue=u=f,o.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var M=b=null,L=null,G=t,W=!1;do{var ee=G.lane&-536870913;if(ee!==G.lane?(De&ee)===ee:(Un&ee)===ee){var Y=G.revertLane;if(Y===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ee===Rl&&(W=!0);else if((Un&Y)===Y){G=G.next,Y===Rl&&(W=!0);continue}else ee={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},L===null?(M=L=ee,b=f):L=L.next=ee,ke.lanes|=Y,bi|=Y;ee=G.action,Zi&&l(f,ee),f=G.hasEagerState?G.eagerState:l(f,ee)}else Y={lane:ee,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},L===null?(M=L=Y,b=f):L=L.next=Y,ke.lanes|=ee,bi|=ee;G=G.next}while(G!==null&&G!==t);if(L===null?b=f:L.next=M,!Gt(f,e.memoizedState)&&(dt=!0,W&&(l=jl,l!==null)))throw l;e.memoizedState=f,e.baseState=b,e.baseQueue=L,o.lastRenderedState=f}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function _c(e){var t=rt(),l=t.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=e;var o=l.dispatch,u=l.pending,f=t.memoizedState;if(u!==null){l.pending=null;var b=u=u.next;do f=e(f,b.action),b=b.next;while(b!==u);Gt(f,t.memoizedState)||(dt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),l.lastRenderedState=f}return[f,o]}function wh(e,t,l){var o=ke,u=rt(),f=He;if(f){if(l===void 0)throw Error(s(407));l=l()}else l=t();var b=!Gt(($e||u).memoizedState,l);if(b&&(u.memoizedState=l,dt=!0),u=u.queue,jc(Th.bind(null,o,u,e),[e]),u.getSnapshot!==t||b||ut!==null&&ut.memoizedState.tag&1){if(o.flags|=2048,Ul(9,{destroy:void 0},Ch.bind(null,o,u,l,t),null),Xe===null)throw Error(s(349));f||(Un&127)!==0||Sh(o,t,l)}return l}function Sh(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=ke.updateQueue,t===null?(t=uo(),ke.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Ch(e,t,l,o){t.value=l,t.getSnapshot=o,Mh(t)&&Ah(e)}function Th(e,t,l){return l(function(){Mh(t)&&Ah(e)})}function Mh(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Gt(e,l)}catch{return!0}}function Ah(e){var t=Fi(e,2);t!==null&&Ut(t,e,2)}function Lc(e){var t=_t();if(typeof e=="function"){var l=e;if(e=l(),Zi){hn(!0);try{l()}finally{hn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:e},t}function Eh(e,t,l,o){return e.baseState=l,Nc(e,$e,typeof o=="function"?o:Kn)}function Mv(e,t,l,o,u){if(go(e))throw Error(s(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){f.listeners.push(b)}};z.T!==null?l(!0):f.isTransition=!1,o(f),l=t.pending,l===null?(f.next=t.pending=f,kh(t,f)):(f.next=l.next,t.pending=l.next=f)}}function kh(e,t){var l=t.action,o=t.payload,u=e.state;if(t.isTransition){var f=z.T,b={};z.T=b;try{var M=l(u,o),L=z.S;L!==null&&L(b,M),Nh(e,t,M)}catch(G){Rc(e,t,G)}finally{f!==null&&b.types!==null&&(f.types=b.types),z.T=f}}else try{f=l(u,o),Nh(e,t,f)}catch(G){Rc(e,t,G)}}function Nh(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(o){_h(e,t,o)},function(o){return Rc(e,t,o)}):_h(e,t,l)}function _h(e,t,l){t.status="fulfilled",t.value=l,Lh(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,kh(e,l)))}function Rc(e,t,l){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do t.status="rejected",t.reason=l,Lh(t),t=t.next;while(t!==o)}e.action=null}function Lh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Rh(e,t){return t}function jh(e,t){if(He){var l=Xe.formState;if(l!==null){e:{var o=ke;if(He){if(We){t:{for(var u=We,f=nn;u.nodeType!==8;){if(!f){u=null;break t}if(u=an(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){We=an(u.nextSibling),o=u.data==="F!";break e}}ri(o)}o=!1}o&&(t=l[0])}}return l=_t(),l.memoizedState=l.baseState=t,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rh,lastRenderedState:t},l.queue=o,l=Qh.bind(null,ke,o),o.dispatch=l,o=Lc(!1),f=Bc.bind(null,ke,!1,o.queue),o=_t(),u={state:t,dispatch:null,action:e,pending:null},o.queue=u,l=Mv.bind(null,ke,u,f,l),u.dispatch=l,o.memoizedState=e,[t,l,!1]}function Oh(e){var t=rt();return Dh(t,$e,e)}function Dh(e,t,l){if(t=Nc(e,t,Rh)[0],e=ho(Kn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var o=Ia(t)}catch(b){throw b===Ol?no:b}else o=t;t=rt();var u=t.queue,f=u.dispatch;return l!==t.memoizedState&&(ke.flags|=2048,Ul(9,{destroy:void 0},Av.bind(null,u,l),null)),[o,f,e]}function Av(e,t){e.action=t}function zh(e){var t=rt(),l=$e;if(l!==null)return Dh(t,l,e);rt(),t=t.memoizedState,l=rt();var o=l.queue.dispatch;return l.memoizedState=e,[t,o,!1]}function Ul(e,t,l,o){return e={tag:e,create:l,deps:o,inst:t,next:null},t=ke.updateQueue,t===null&&(t=uo(),ke.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(o=l.next,l.next=e,e.next=o,t.lastEffect=e),e}function Hh(){return rt().memoizedState}function mo(e,t,l,o){var u=_t();ke.flags|=e,u.memoizedState=Ul(1|t,{destroy:void 0},l,o===void 0?null:o)}function po(e,t,l,o){var u=rt();o=o===void 0?null:o;var f=u.memoizedState.inst;$e!==null&&o!==null&&Cc(o,$e.memoizedState.deps)?u.memoizedState=Ul(t,f,l,o):(ke.flags|=e,u.memoizedState=Ul(1|t,f,l,o))}function Bh(e,t){mo(8390656,8,e,t)}function jc(e,t){po(2048,8,e,t)}function Ev(e){ke.flags|=4;var t=ke.updateQueue;if(t===null)t=uo(),ke.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Uh(e){var t=rt().memoizedState;return Ev({ref:t,nextImpl:e}),function(){if((Fe&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Kh(e,t){return po(4,2,e,t)}function Ih(e,t){return po(4,4,e,t)}function Fh(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Gh(e,t,l){l=l!=null?l.concat([e]):null,po(4,4,Fh.bind(null,t,e),l)}function Oc(){}function Yh(e,t){var l=rt();t=t===void 0?null:t;var o=l.memoizedState;return t!==null&&Cc(t,o[1])?o[0]:(l.memoizedState=[e,t],e)}function Ph(e,t){var l=rt();t=t===void 0?null:t;var o=l.memoizedState;if(t!==null&&Cc(t,o[1]))return o[0];if(o=e(),Zi){hn(!0);try{e()}finally{hn(!1)}}return l.memoizedState=[o,t],o}function Dc(e,t,l){return l===void 0||(Un&1073741824)!==0&&(De&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=$m(),ke.lanes|=e,bi|=e,l)}function $h(e,t,l,o){return Gt(l,t)?l:zl.current!==null?(e=Dc(e,l,o),Gt(e,t)||(dt=!0),e):(Un&42)===0||(Un&1073741824)!==0&&(De&261930)===0?(dt=!0,e.memoizedState=l):(e=$m(),ke.lanes|=e,bi|=e,t)}function Vh(e,t,l,o,u){var f=J.p;J.p=f!==0&&8>f?f:8;var b=z.T,M={};z.T=M,Bc(e,!1,t,l);try{var L=u(),G=z.S;if(G!==null&&G(M,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var W=Sv(L,o);Fa(e,t,W,Xt(e))}else Fa(e,t,o,Xt(e))}catch(ee){Fa(e,t,{then:function(){},status:"rejected",reason:ee},Xt())}finally{J.p=f,b!==null&&M.types!==null&&(b.types=M.types),z.T=b}}function kv(){}function zc(e,t,l,o){if(e.tag!==5)throw Error(s(476));var u=qh(e).queue;Vh(e,u,t,K,l===null?kv:function(){return Xh(e),l(o)})}function qh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:K},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kn,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Xh(e){var t=qh(e);t.next===null&&(t=e.alternate.memoizedState),Fa(e,t.next.queue,{},Xt())}function Hc(){return St(as)}function Wh(){return rt().memoizedState}function Zh(){return rt().memoizedState}function Nv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Xt();e=di(l);var o=fi(t,e,l);o!==null&&(Ut(o,t,l),Ha(o,t,l)),t={cache:fc()},e.payload=t;return}t=t.return}}function _v(e,t,l){var o=Xt();l={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},go(e)?Jh(t,l):(l=tc(e,t,l,o),l!==null&&(Ut(l,e,o),em(l,t,o)))}function Qh(e,t,l){var o=Xt();Fa(e,t,l,o)}function Fa(e,t,l,o){var u={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(go(e))Jh(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var b=t.lastRenderedState,M=f(b,l);if(u.hasEagerState=!0,u.eagerState=M,Gt(M,b))return Xs(e,t,u,0),Xe===null&&qs(),!1}catch{}finally{}if(l=tc(e,t,u,o),l!==null)return Ut(l,e,o),em(l,t,o),!0}return!1}function Bc(e,t,l,o){if(o={lane:2,revertLane:gu(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},go(e)){if(t)throw Error(s(479))}else t=tc(e,l,o,2),t!==null&&Ut(t,e,2)}function go(e){var t=e.alternate;return e===ke||t!==null&&t===ke}function Jh(e,t){Hl=ro=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function em(e,t,l){if((l&4194048)!==0){var o=t.lanes;o&=e.pendingLanes,l|=o,t.lanes=l,af(e,l)}}var Ga={readContext:St,use:fo,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};Ga.useEffectEvent=lt;var tm={readContext:St,use:fo,useCallback:function(e,t){return _t().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Bh,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,mo(4194308,4,Fh.bind(null,t,e),l)},useLayoutEffect:function(e,t){return mo(4194308,4,e,t)},useInsertionEffect:function(e,t){mo(4,2,e,t)},useMemo:function(e,t){var l=_t();t=t===void 0?null:t;var o=e();if(Zi){hn(!0);try{e()}finally{hn(!1)}}return l.memoizedState=[o,t],o},useReducer:function(e,t,l){var o=_t();if(l!==void 0){var u=l(t);if(Zi){hn(!0);try{l(t)}finally{hn(!1)}}}else u=t;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=_v.bind(null,ke,e),[o.memoizedState,e]},useRef:function(e){var t=_t();return e={current:e},t.memoizedState=e},useState:function(e){e=Lc(e);var t=e.queue,l=Qh.bind(null,ke,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Oc,useDeferredValue:function(e,t){var l=_t();return Dc(l,e,t)},useTransition:function(){var e=Lc(!1);return e=Vh.bind(null,ke,e.queue,!0,!1),_t().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var o=ke,u=_t();if(He){if(l===void 0)throw Error(s(407));l=l()}else{if(l=t(),Xe===null)throw Error(s(349));(De&127)!==0||Sh(o,t,l)}u.memoizedState=l;var f={value:l,getSnapshot:t};return u.queue=f,Bh(Th.bind(null,o,f,e),[e]),o.flags|=2048,Ul(9,{destroy:void 0},Ch.bind(null,o,f,l,t),null),l},useId:function(){var e=_t(),t=Xe.identifierPrefix;if(He){var l=Sn,o=wn;l=(o&~(1<<32-kt(o)-1)).toString(32)+l,t="_"+t+"R_"+l,l=co++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Cv++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Hc,useFormState:jh,useActionState:jh,useOptimistic:function(e){var t=_t();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Bc.bind(null,ke,!0,l),l.dispatch=t,[e,t]},useMemoCache:kc,useCacheRefresh:function(){return _t().memoizedState=Nv.bind(null,ke)},useEffectEvent:function(e){var t=_t(),l={impl:e};return t.memoizedState=l,function(){if((Fe&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Uc={readContext:St,use:fo,useCallback:Yh,useContext:St,useEffect:jc,useImperativeHandle:Gh,useInsertionEffect:Kh,useLayoutEffect:Ih,useMemo:Ph,useReducer:ho,useRef:Hh,useState:function(){return ho(Kn)},useDebugValue:Oc,useDeferredValue:function(e,t){var l=rt();return $h(l,$e.memoizedState,e,t)},useTransition:function(){var e=ho(Kn)[0],t=rt().memoizedState;return[typeof e=="boolean"?e:Ia(e),t]},useSyncExternalStore:wh,useId:Wh,useHostTransitionStatus:Hc,useFormState:Oh,useActionState:Oh,useOptimistic:function(e,t){var l=rt();return Eh(l,$e,e,t)},useMemoCache:kc,useCacheRefresh:Zh};Uc.useEffectEvent=Uh;var nm={readContext:St,use:fo,useCallback:Yh,useContext:St,useEffect:jc,useImperativeHandle:Gh,useInsertionEffect:Kh,useLayoutEffect:Ih,useMemo:Ph,useReducer:_c,useRef:Hh,useState:function(){return _c(Kn)},useDebugValue:Oc,useDeferredValue:function(e,t){var l=rt();return $e===null?Dc(l,e,t):$h(l,$e.memoizedState,e,t)},useTransition:function(){var e=_c(Kn)[0],t=rt().memoizedState;return[typeof e=="boolean"?e:Ia(e),t]},useSyncExternalStore:wh,useId:Wh,useHostTransitionStatus:Hc,useFormState:zh,useActionState:zh,useOptimistic:function(e,t){var l=rt();return $e!==null?Eh(l,$e,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:kc,useCacheRefresh:Zh};nm.useEffectEvent=Uh;function Kc(e,t,l,o){t=e.memoizedState,l=l(o,t),l=l==null?t:v({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Ic={enqueueSetState:function(e,t,l){e=e._reactInternals;var o=Xt(),u=di(o);u.payload=t,l!=null&&(u.callback=l),t=fi(e,u,o),t!==null&&(Ut(t,e,o),Ha(t,e,o))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var o=Xt(),u=di(o);u.tag=1,u.payload=t,l!=null&&(u.callback=l),t=fi(e,u,o),t!==null&&(Ut(t,e,o),Ha(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Xt(),o=di(l);o.tag=2,t!=null&&(o.callback=t),t=fi(e,o,l),t!==null&&(Ut(t,e,l),Ha(t,e,l))}};function im(e,t,l,o,u,f,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,f,b):t.prototype&&t.prototype.isPureReactComponent?!Na(l,o)||!Na(u,f):!0}function lm(e,t,l,o){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,o),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,o),t.state!==e&&Ic.enqueueReplaceState(t,t.state,null)}function Qi(e,t){var l=t;if("ref"in t){l={};for(var o in t)o!=="ref"&&(l[o]=t[o])}if(e=e.defaultProps){l===t&&(l=v({},l));for(var u in e)l[u]===void 0&&(l[u]=e[u])}return l}function am(e){Vs(e)}function sm(e){console.error(e)}function om(e){Vs(e)}function bo(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(o){setTimeout(function(){throw o})}}function rm(e,t,l){try{var o=e.onCaughtError;o(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Fc(e,t,l){return l=di(l),l.tag=3,l.payload={element:null},l.callback=function(){bo(e,t)},l}function cm(e){return e=di(e),e.tag=3,e}function um(e,t,l,o){var u=l.type.getDerivedStateFromError;if(typeof u=="function"){var f=o.value;e.payload=function(){return u(f)},e.callback=function(){rm(t,l,o)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){rm(t,l,o),typeof u!="function"&&(yi===null?yi=new Set([this]):yi.add(this));var M=o.stack;this.componentDidCatch(o.value,{componentStack:M!==null?M:""})})}function Lv(e,t,l,o,u){if(l.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(t=l.alternate,t!==null&&Ll(t,l,u,!0),l=Pt.current,l!==null){switch(l.tag){case 31:case 13:return ln===null?No():l.alternate===null&&at===0&&(at=3),l.flags&=-257,l.flags|=65536,l.lanes=u,o===io?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([o]):t.add(o),hu(e,o,u)),!1;case 22:return l.flags|=65536,o===io?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([o])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([o]):l.add(o)),hu(e,o,u)),!1}throw Error(s(435,l.tag))}return hu(e,o,u),No(),!1}if(He)return t=Pt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,o!==oc&&(e=Error(s(422),{cause:o}),Ra(Jt(e,l)))):(o!==oc&&(t=Error(s(423),{cause:o}),Ra(Jt(t,l))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=Jt(o,l),u=Fc(e.stateNode,o,u),yc(e,u),at!==4&&(at=2)),!1;var f=Error(s(520),{cause:o});if(f=Jt(f,l),Za===null?Za=[f]:Za.push(f),at!==4&&(at=2),t===null)return!0;o=Jt(o,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=u&-u,l.lanes|=e,e=Fc(l.stateNode,o,e),yc(l,e),!1;case 1:if(t=l.type,f=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(yi===null||!yi.has(f))))return l.flags|=65536,u&=-u,l.lanes|=u,u=cm(u),um(u,e,l,o),yc(l,u),!1}l=l.return}while(l!==null);return!1}var Gc=Error(s(461)),dt=!1;function Ct(e,t,l,o){t.child=e===null?mh(t,null,l,o):Wi(t,e.child,l,o)}function dm(e,t,l,o,u){l=l.render;var f=t.ref;if("ref"in o){var b={};for(var M in o)M!=="ref"&&(b[M]=o[M])}else b=o;return $i(t),o=Tc(e,t,l,b,f,u),M=Mc(),e!==null&&!dt?(Ac(e,t,u),In(e,t,u)):(He&&M&&ac(t),t.flags|=1,Ct(e,t,o,u),t.child)}function fm(e,t,l,o,u){if(e===null){var f=l.type;return typeof f=="function"&&!nc(f)&&f.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=f,hm(e,t,f,o,u)):(e=Zs(l.type,null,o,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!Zc(e,u)){var b=f.memoizedProps;if(l=l.compare,l=l!==null?l:Na,l(b,o)&&e.ref===t.ref)return In(e,t,u)}return t.flags|=1,e=Dn(f,o),e.ref=t.ref,e.return=t,t.child=e}function hm(e,t,l,o,u){if(e!==null){var f=e.memoizedProps;if(Na(f,o)&&e.ref===t.ref)if(dt=!1,t.pendingProps=o=f,Zc(e,u))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,In(e,t,u)}return Yc(e,t,l,o,u)}function mm(e,t,l,o){var u=o.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|l:l,e!==null){for(o=t.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~f}else o=0,t.child=null;return pm(e,t,f,l,o)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&to(t,f!==null?f.cachePool:null),f!==null?bh(t,f):xc(),yh(t);else return o=t.lanes=536870912,pm(e,t,f!==null?f.baseLanes|l:l,l,o)}else f!==null?(to(t,f.cachePool),bh(t,f),mi(),t.memoizedState=null):(e!==null&&to(t,null),xc(),mi());return Ct(e,t,u,l),t.child}function Ya(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function pm(e,t,l,o,u){var f=mc();return f=f===null?null:{parent:ct._currentValue,pool:f},t.memoizedState={baseLanes:l,cachePool:f},e!==null&&to(t,null),xc(),yh(t),e!==null&&Ll(e,t,o,!0),t.childLanes=u,null}function yo(e,t){return t=xo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function gm(e,t,l){return Wi(t,e.child,null,l),e=yo(t,t.pendingProps),e.flags|=2,$t(t),t.memoizedState=null,e}function Rv(e,t,l){var o=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(He){if(o.mode==="hidden")return e=yo(t,o),t.lanes=536870912,Ya(null,e);if(Sc(t),(e=We)?(e=kp(e,nn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:si!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},l=Jf(e),l.return=t,t.child=l,wt=t,We=null)):e=null,e===null)throw ri(t);return t.lanes=536870912,null}return yo(t,o)}var f=e.memoizedState;if(f!==null){var b=f.dehydrated;if(Sc(t),u)if(t.flags&256)t.flags&=-257,t=gm(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(dt||Ll(e,t,l,!1),u=(l&e.childLanes)!==0,dt||u){if(o=Xe,o!==null&&(b=sf(o,l),b!==0&&b!==f.retryLane))throw f.retryLane=b,Fi(e,b),Ut(o,e,b),Gc;No(),t=gm(e,t,l)}else e=f.treeContext,We=an(b.nextSibling),wt=t,He=!0,oi=null,nn=!1,e!==null&&nh(t,e),t=yo(t,o),t.flags|=4096;return t}return e=Dn(e.child,{mode:o.mode,children:o.children}),e.ref=t.ref,t.child=e,e.return=t,e}function vo(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Yc(e,t,l,o,u){return $i(t),l=Tc(e,t,l,o,void 0,u),o=Mc(),e!==null&&!dt?(Ac(e,t,u),In(e,t,u)):(He&&o&&ac(t),t.flags|=1,Ct(e,t,l,u),t.child)}function bm(e,t,l,o,u,f){return $i(t),t.updateQueue=null,l=xh(t,o,l,u),vh(e),o=Mc(),e!==null&&!dt?(Ac(e,t,f),In(e,t,f)):(He&&o&&ac(t),t.flags|=1,Ct(e,t,l,f),t.child)}function ym(e,t,l,o,u){if($i(t),t.stateNode===null){var f=El,b=l.contextType;typeof b=="object"&&b!==null&&(f=St(b)),f=new l(o,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Ic,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=o,f.state=t.memoizedState,f.refs={},gc(t),b=l.contextType,f.context=typeof b=="object"&&b!==null?St(b):El,f.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Kc(t,l,b,o),f.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(b=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),b!==f.state&&Ic.enqueueReplaceState(f,f.state,null),Ua(t,o,f,u),Ba(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),o=!0}else if(e===null){f=t.stateNode;var M=t.memoizedProps,L=Qi(l,M);f.props=L;var G=f.context,W=l.contextType;b=El,typeof W=="object"&&W!==null&&(b=St(W));var ee=l.getDerivedStateFromProps;W=typeof ee=="function"||typeof f.getSnapshotBeforeUpdate=="function",M=t.pendingProps!==M,W||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(M||G!==b)&&lm(t,f,o,b),ui=!1;var Y=t.memoizedState;f.state=Y,Ua(t,o,f,u),Ba(),G=t.memoizedState,M||Y!==G||ui?(typeof ee=="function"&&(Kc(t,l,ee,o),G=t.memoizedState),(L=ui||im(t,l,L,o,Y,G,b))?(W||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=o,t.memoizedState=G),f.props=o,f.state=G,f.context=b,o=L):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{f=t.stateNode,bc(e,t),b=t.memoizedProps,W=Qi(l,b),f.props=W,ee=t.pendingProps,Y=f.context,G=l.contextType,L=El,typeof G=="object"&&G!==null&&(L=St(G)),M=l.getDerivedStateFromProps,(G=typeof M=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b!==ee||Y!==L)&&lm(t,f,o,L),ui=!1,Y=t.memoizedState,f.state=Y,Ua(t,o,f,u),Ba();var q=t.memoizedState;b!==ee||Y!==q||ui||e!==null&&e.dependencies!==null&&Js(e.dependencies)?(typeof M=="function"&&(Kc(t,l,M,o),q=t.memoizedState),(W=ui||im(t,l,W,o,Y,q,L)||e!==null&&e.dependencies!==null&&Js(e.dependencies))?(G||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(o,q,L),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(o,q,L)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=q),f.props=o,f.state=q,f.context=L,o=W):(typeof f.componentDidUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),o=!1)}return f=o,vo(e,t),o=(t.flags&128)!==0,f||o?(f=t.stateNode,l=o&&typeof l.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&o?(t.child=Wi(t,e.child,null,u),t.child=Wi(t,null,l,u)):Ct(e,t,l,u),t.memoizedState=f.state,e=t.child):e=In(e,t,u),e}function vm(e,t,l,o){return Yi(),t.flags|=256,Ct(e,t,l,o),t.child}var Pc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $c(e){return{baseLanes:e,cachePool:rh()}}function Vc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=qt),e}function xm(e,t,l){var o=t.pendingProps,u=!1,f=(t.flags&128)!==0,b;if((b=f)||(b=e!==null&&e.memoizedState===null?!1:(ot.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(He){if(u?hi(t):mi(),(e=We)?(e=kp(e,nn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:si!==null?{id:wn,overflow:Sn}:null,retryLane:536870912,hydrationErrors:null},l=Jf(e),l.return=t,t.child=l,wt=t,We=null)):e=null,e===null)throw ri(t);return Nu(e)?t.lanes=32:t.lanes=536870912,null}var M=o.children;return o=o.fallback,u?(mi(),u=t.mode,M=xo({mode:"hidden",children:M},u),o=Gi(o,u,l,null),M.return=t,o.return=t,M.sibling=o,t.child=M,o=t.child,o.memoizedState=$c(l),o.childLanes=Vc(e,b,l),t.memoizedState=Pc,Ya(null,o)):(hi(t),qc(t,M))}var L=e.memoizedState;if(L!==null&&(M=L.dehydrated,M!==null)){if(f)t.flags&256?(hi(t),t.flags&=-257,t=Xc(e,t,l)):t.memoizedState!==null?(mi(),t.child=e.child,t.flags|=128,t=null):(mi(),M=o.fallback,u=t.mode,o=xo({mode:"visible",children:o.children},u),M=Gi(M,u,l,null),M.flags|=2,o.return=t,M.return=t,o.sibling=M,t.child=o,Wi(t,e.child,null,l),o=t.child,o.memoizedState=$c(l),o.childLanes=Vc(e,b,l),t.memoizedState=Pc,t=Ya(null,o));else if(hi(t),Nu(M)){if(b=M.nextSibling&&M.nextSibling.dataset,b)var G=b.dgst;b=G,o=Error(s(419)),o.stack="",o.digest=b,Ra({value:o,source:null,stack:null}),t=Xc(e,t,l)}else if(dt||Ll(e,t,l,!1),b=(l&e.childLanes)!==0,dt||b){if(b=Xe,b!==null&&(o=sf(b,l),o!==0&&o!==L.retryLane))throw L.retryLane=o,Fi(e,o),Ut(b,e,o),Gc;ku(M)||No(),t=Xc(e,t,l)}else ku(M)?(t.flags|=192,t.child=e.child,t=null):(e=L.treeContext,We=an(M.nextSibling),wt=t,He=!0,oi=null,nn=!1,e!==null&&nh(t,e),t=qc(t,o.children),t.flags|=4096);return t}return u?(mi(),M=o.fallback,u=t.mode,L=e.child,G=L.sibling,o=Dn(L,{mode:"hidden",children:o.children}),o.subtreeFlags=L.subtreeFlags&65011712,G!==null?M=Dn(G,M):(M=Gi(M,u,l,null),M.flags|=2),M.return=t,o.return=t,o.sibling=M,t.child=o,Ya(null,o),o=t.child,M=e.child.memoizedState,M===null?M=$c(l):(u=M.cachePool,u!==null?(L=ct._currentValue,u=u.parent!==L?{parent:L,pool:L}:u):u=rh(),M={baseLanes:M.baseLanes|l,cachePool:u}),o.memoizedState=M,o.childLanes=Vc(e,b,l),t.memoizedState=Pc,Ya(e.child,o)):(hi(t),l=e.child,e=l.sibling,l=Dn(l,{mode:"visible",children:o.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function qc(e,t){return t=xo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function xo(e,t){return e=Yt(22,e,null,t),e.lanes=0,e}function Xc(e,t,l){return Wi(t,e.child,null,l),e=qc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wm(e,t,l){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),uc(e.return,t,l)}function Wc(e,t,l,o,u,f){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:l,tailMode:u,treeForkCount:f}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=o,b.tail=l,b.tailMode=u,b.treeForkCount=f)}function Sm(e,t,l){var o=t.pendingProps,u=o.revealOrder,f=o.tail;o=o.children;var b=ot.current,M=(b&2)!==0;if(M?(b=b&1|2,t.flags|=128):b&=1,fe(ot,b),Ct(e,t,o,l),o=He?La:0,!M&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wm(e,l,t);else if(e.tag===19)wm(e,l,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(l=t.child,u=null;l!==null;)e=l.alternate,e!==null&&oo(e)===null&&(u=l),l=l.sibling;l=u,l===null?(u=t.child,t.child=null):(u=l.sibling,l.sibling=null),Wc(t,!1,u,l,f,o);break;case"backwards":case"unstable_legacy-backwards":for(l=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&oo(e)===null){t.child=u;break}e=u.sibling,u.sibling=l,l=u,u=e}Wc(t,!0,l,null,f,o);break;case"together":Wc(t,!1,null,null,void 0,o);break;default:t.memoizedState=null}return t.child}function In(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),bi|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ll(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,l=Dn(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=Dn(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Zc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Js(e)))}function jv(e,t,l){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),ci(t,ct,e.memoizedState.cache),Yi();break;case 27:case 5:Se(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:ci(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Sc(t),null;break;case 13:var o=t.memoizedState;if(o!==null)return o.dehydrated!==null?(hi(t),t.flags|=128,null):(l&t.child.childLanes)!==0?xm(e,t,l):(hi(t),e=In(e,t,l),e!==null?e.sibling:null);hi(t);break;case 19:var u=(e.flags&128)!==0;if(o=(l&t.childLanes)!==0,o||(Ll(e,t,l,!1),o=(l&t.childLanes)!==0),u){if(o)return Sm(e,t,l);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),fe(ot,ot.current),o)break;return null;case 22:return t.lanes=0,mm(e,t,l,t.pendingProps);case 24:ci(t,ct,e.memoizedState.cache)}return In(e,t,l)}function Cm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!Zc(e,l)&&(t.flags&128)===0)return dt=!1,jv(e,t,l);dt=(e.flags&131072)!==0}else dt=!1,He&&(t.flags&1048576)!==0&&th(t,La,t.index);switch(t.lanes=0,t.tag){case 16:e:{var o=t.pendingProps;if(e=qi(t.elementType),t.type=e,typeof e=="function")nc(e)?(o=Qi(e,o),t.tag=1,t=ym(null,t,e,o,l)):(t.tag=0,t=Yc(null,t,e,o,l));else{if(e!=null){var u=e.$$typeof;if(u===D){t.tag=11,t=dm(null,t,e,o,l);break e}else if(u===O){t.tag=14,t=fm(null,t,e,o,l);break e}}throw t=oe(e)||e,Error(s(306,t,""))}}return t;case 0:return Yc(e,t,t.type,t.pendingProps,l);case 1:return o=t.type,u=Qi(o,t.pendingProps),ym(e,t,o,u,l);case 3:e:{if(pe(t,t.stateNode.containerInfo),e===null)throw Error(s(387));o=t.pendingProps;var f=t.memoizedState;u=f.element,bc(e,t),Ua(t,o,null,l);var b=t.memoizedState;if(o=b.cache,ci(t,ct,o),o!==f.cache&&dc(t,[ct],l,!0),Ba(),o=b.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=vm(e,t,o,l);break e}else if(o!==u){u=Jt(Error(s(424)),t),Ra(u),t=vm(e,t,o,l);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(We=an(e.firstChild),wt=t,He=!0,oi=null,nn=!0,l=mh(t,null,o,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Yi(),o===u){t=In(e,t,l);break e}Ct(e,t,o,l)}t=t.child}return t;case 26:return vo(e,t),e===null?(l=Op(t.type,null,t.pendingProps,null))?t.memoizedState=l:He||(l=t.type,e=t.pendingProps,o=zo(he.current).createElement(l),o[xt]=t,o[jt]=e,Tt(o,l,e),yt(o),t.stateNode=o):t.memoizedState=Op(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Se(t),e===null&&He&&(o=t.stateNode=Lp(t.type,t.pendingProps,he.current),wt=t,nn=!0,u=We,Si(t.type)?(_u=u,We=an(o.firstChild)):We=u),Ct(e,t,t.pendingProps.children,l),vo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&He&&((u=o=We)&&(o=cx(o,t.type,t.pendingProps,nn),o!==null?(t.stateNode=o,wt=t,We=an(o.firstChild),nn=!1,u=!0):u=!1),u||ri(t)),Se(t),u=t.type,f=t.pendingProps,b=e!==null?e.memoizedProps:null,o=f.children,Mu(u,f)?o=null:b!==null&&Mu(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=Tc(e,t,Tv,null,null,l),as._currentValue=u),vo(e,t),Ct(e,t,o,l),t.child;case 6:return e===null&&He&&((e=l=We)&&(l=ux(l,t.pendingProps,nn),l!==null?(t.stateNode=l,wt=t,We=null,e=!0):e=!1),e||ri(t)),null;case 13:return xm(e,t,l);case 4:return pe(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Wi(t,null,o,l):Ct(e,t,o,l),t.child;case 11:return dm(e,t,t.type,t.pendingProps,l);case 7:return Ct(e,t,t.pendingProps,l),t.child;case 8:return Ct(e,t,t.pendingProps.children,l),t.child;case 12:return Ct(e,t,t.pendingProps.children,l),t.child;case 10:return o=t.pendingProps,ci(t,t.type,o.value),Ct(e,t,o.children,l),t.child;case 9:return u=t.type._context,o=t.pendingProps.children,$i(t),u=St(u),o=o(u),t.flags|=1,Ct(e,t,o,l),t.child;case 14:return fm(e,t,t.type,t.pendingProps,l);case 15:return hm(e,t,t.type,t.pendingProps,l);case 19:return Sm(e,t,l);case 31:return Rv(e,t,l);case 22:return mm(e,t,l,t.pendingProps);case 24:return $i(t),o=St(ct),e===null?(u=mc(),u===null&&(u=Xe,f=fc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=l),u=f),t.memoizedState={parent:o,cache:u},gc(t),ci(t,ct,u)):((e.lanes&l)!==0&&(bc(e,t),Ua(t,null,null,l),Ba()),u=e.memoizedState,f=t.memoizedState,u.parent!==o?(u={parent:o,cache:o},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),ci(t,ct,o)):(o=f.cache,ci(t,ct,o),o!==u.cache&&dc(t,[ct],l,!0))),Ct(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Fn(e){e.flags|=4}function Qc(e,t,l,o,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(Wm())e.flags|=8192;else throw Xi=io,pc}else e.flags&=-16777217}function Tm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Up(t))if(Wm())e.flags|=8192;else throw Xi=io,pc}function wo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?zs():536870912,e.lanes|=t,Gl|=t)}function Pa(e,t){if(!He)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,o=0;if(t)for(var u=e.child;u!==null;)l|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)l|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=l,t}function Ov(e,t,l){var o=t.pendingProps;switch(sc(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 l=t.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),t.memoizedState.cache!==o&&(t.flags|=2048),Bn(ct),se(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(_l(t)?Fn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,rc())),Ze(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Fn(t),f!==null?(Ze(t),Tm(t,f)):(Ze(t),Qc(t,u,null,o,l))):f?f!==e.memoizedState?(Fn(t),Ze(t),Tm(t,f)):(Ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==o&&Fn(t),Ze(t),Qc(t,u,e,o,l)),null;case 27:if(Ae(t),l=he.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==o&&Fn(t);else{if(!o){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}e=te.current,_l(t)?ih(t):(e=Lp(u,o,l),t.stateNode=e,Fn(t))}return Ze(t),null;case 5:if(Ae(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==o&&Fn(t);else{if(!o){if(t.stateNode===null)throw Error(s(166));return Ze(t),null}if(f=te.current,_l(t))ih(t);else{var b=zo(he.current);switch(f){case 1:f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=b.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?b.createElement(u,{is:o.is}):b.createElement(u)}}f[xt]=t,f[jt]=o;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)f.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=f;e:switch(Tt(f,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Fn(t)}}return Ze(t),Qc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==o&&Fn(t);else{if(typeof o!="string"&&t.stateNode===null)throw Error(s(166));if(e=he.current,_l(t)){if(e=t.stateNode,l=t.memoizedProps,o=null,u=wt,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[xt]=t,e=!!(e.nodeValue===l||o!==null&&o.suppressHydrationWarning===!0||xp(e.nodeValue,l)),e||ri(t,!0)}else e=zo(e).createTextNode(o),e[xt]=t,t.stateNode=e}return Ze(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(o=_l(t),l!==null){if(e===null){if(!o)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[xt]=t}else Yi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else l=rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?($t(t),t):($t(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Ze(t),null;case 13:if(o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=_l(t),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(s(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[xt]=t}else Yi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),u=!1}else u=rc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?($t(t),t):($t(t),null)}return $t(t),(t.flags&128)!==0?(t.lanes=l,t):(l=o!==null,e=e!==null&&e.memoizedState!==null,l&&(o=t.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==u&&(o.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),wo(t,t.updateQueue),Ze(t),null);case 4:return se(),e===null&&xu(t.stateNode.containerInfo),Ze(t),null;case 10:return Bn(t.type),Ze(t),null;case 19:if(xe(ot),o=t.memoizedState,o===null)return Ze(t),null;if(u=(t.flags&128)!==0,f=o.rendering,f===null)if(u)Pa(o,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=oo(e),f!==null){for(t.flags|=128,Pa(o,!1),e=f.updateQueue,t.updateQueue=e,wo(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Qf(l,e),l=l.sibling;return fe(ot,ot.current&1|2),He&&zn(t,o.treeForkCount),t.child}e=e.sibling}o.tail!==null&&bt()>Ao&&(t.flags|=128,u=!0,Pa(o,!1),t.lanes=4194304)}else{if(!u)if(e=oo(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,wo(t,e),Pa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!f.alternate&&!He)return Ze(t),null}else 2*bt()-o.renderingStartTime>Ao&&l!==536870912&&(t.flags|=128,u=!0,Pa(o,!1),t.lanes=4194304);o.isBackwards?(f.sibling=t.child,t.child=f):(e=o.last,e!==null?e.sibling=f:t.child=f,o.last=f)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=bt(),e.sibling=null,l=ot.current,fe(ot,u?l&1|2:l&1),He&&zn(t,o.treeForkCount),e):(Ze(t),null);case 22:case 23:return $t(t),wc(),o=t.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(t.flags|=8192):o&&(t.flags|=8192),o?(l&536870912)!==0&&(t.flags&128)===0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),l=t.updateQueue,l!==null&&wo(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),o=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),o!==l&&(t.flags|=2048),e!==null&&xe(Vi),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Bn(ct),Ze(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Dv(e,t){switch(sc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bn(ct),se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ae(t),null;case 31:if(t.memoizedState!==null){if($t(t),t.alternate===null)throw Error(s(340));Yi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($t(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Yi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xe(ot),null;case 4:return se(),null;case 10:return Bn(t.type),null;case 22:case 23:return $t(t),wc(),e!==null&&xe(Vi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Bn(ct),null;case 25:return null;default:return null}}function Mm(e,t){switch(sc(t),t.tag){case 3:Bn(ct),se();break;case 26:case 27:case 5:Ae(t);break;case 4:se();break;case 31:t.memoizedState!==null&&$t(t);break;case 13:$t(t);break;case 19:xe(ot);break;case 10:Bn(t.type);break;case 22:case 23:$t(t),wc(),e!==null&&xe(Vi);break;case 24:Bn(ct)}}function $a(e,t){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var u=o.next;l=u;do{if((l.tag&e)===e){o=void 0;var f=l.create,b=l.inst;o=f(),b.destroy=o}l=l.next}while(l!==u)}}catch(M){Pe(t,t.return,M)}}function pi(e,t,l){try{var o=t.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var f=u.next;o=f;do{if((o.tag&e)===e){var b=o.inst,M=b.destroy;if(M!==void 0){b.destroy=void 0,u=t;var L=l,G=M;try{G()}catch(W){Pe(u,L,W)}}}o=o.next}while(o!==f)}}catch(W){Pe(t,t.return,W)}}function Am(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{gh(t,l)}catch(o){Pe(e,e.return,o)}}}function Em(e,t,l){l.props=Qi(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(o){Pe(e,t,o)}}function Va(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof l=="function"?e.refCleanup=l(o):l.current=o}}catch(u){Pe(e,t,u)}}function Cn(e,t){var l=e.ref,o=e.refCleanup;if(l!==null)if(typeof o=="function")try{o()}catch(u){Pe(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){Pe(e,t,u)}else l.current=null}function km(e){var t=e.type,l=e.memoizedProps,o=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&o.focus();break e;case"img":l.src?o.src=l.src:l.srcSet&&(o.srcset=l.srcSet)}}catch(u){Pe(e,e.return,u)}}function Jc(e,t,l){try{var o=e.stateNode;ix(o,e.type,l,t),o[jt]=t}catch(u){Pe(e,e.return,u)}}function Nm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Si(e.type)||e.tag===4}function eu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Nm(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&&Si(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 tu(e,t,l){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=jn));else if(o!==4&&(o===27&&Si(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(tu(e,t,l),e=e.sibling;e!==null;)tu(e,t,l),e=e.sibling}function So(e,t,l){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(o!==4&&(o===27&&Si(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(So(e,t,l),e=e.sibling;e!==null;)So(e,t,l),e=e.sibling}function _m(e){var t=e.stateNode,l=e.memoizedProps;try{for(var o=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Tt(t,o,l),t[xt]=e,t[jt]=l}catch(f){Pe(e,e.return,f)}}var Gn=!1,ft=!1,nu=!1,Lm=typeof WeakSet=="function"?WeakSet:Set,vt=null;function zv(e,t){if(e=e.containerInfo,Cu=Go,e=Gf(e),Xr(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var o=l.getSelection&&l.getSelection();if(o&&o.rangeCount!==0){l=o.anchorNode;var u=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{l.nodeType,f.nodeType}catch{l=null;break e}var b=0,M=-1,L=-1,G=0,W=0,ee=e,Y=null;t:for(;;){for(var q;ee!==l||u!==0&&ee.nodeType!==3||(M=b+u),ee!==f||o!==0&&ee.nodeType!==3||(L=b+o),ee.nodeType===3&&(b+=ee.nodeValue.length),(q=ee.firstChild)!==null;)Y=ee,ee=q;for(;;){if(ee===e)break t;if(Y===l&&++G===u&&(M=b),Y===f&&++W===o&&(L=b),(q=ee.nextSibling)!==null)break;ee=Y,Y=ee.parentNode}ee=q}l=M===-1||L===-1?null:{start:M,end:L}}else l=null}l=l||{start:0,end:0}}else l=null;for(Tu={focusedElem:e,selectionRange:l},Go=!1,vt=t;vt!==null;)if(t=vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vt=e;else for(;vt!==null;){switch(t=vt,f=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(l=0;l<e.length;l++)u=e[l],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,l=t,u=f.memoizedProps,f=f.memoizedState,o=l.stateNode;try{var ye=Qi(l.type,u);e=o.getSnapshotBeforeUpdate(ye,f),o.__reactInternalSnapshotBeforeUpdate=e}catch(Te){Pe(l,l.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Eu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Eu(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(s(163))}if(e=t.sibling,e!==null){e.return=t.return,vt=e;break}vt=t.return}}function Rm(e,t,l){var o=l.flags;switch(l.tag){case 0:case 11:case 15:Pn(e,l),o&4&&$a(5,l);break;case 1:if(Pn(e,l),o&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){Pe(l,l.return,b)}else{var u=Qi(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Pe(l,l.return,b)}}o&64&&Am(l),o&512&&Va(l,l.return);break;case 3:if(Pn(e,l),o&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{gh(e,t)}catch(b){Pe(l,l.return,b)}}break;case 27:t===null&&o&4&&_m(l);case 26:case 5:Pn(e,l),t===null&&o&4&&km(l),o&512&&Va(l,l.return);break;case 12:Pn(e,l);break;case 31:Pn(e,l),o&4&&Dm(e,l);break;case 13:Pn(e,l),o&4&&zm(e,l),o&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Pv.bind(null,l),dx(e,l))));break;case 22:if(o=l.memoizedState!==null||Gn,!o){t=t!==null&&t.memoizedState!==null||ft,u=Gn;var f=ft;Gn=o,(ft=t)&&!f?$n(e,l,(l.subtreeFlags&8772)!==0):Pn(e,l),Gn=u,ft=f}break;case 30:break;default:Pn(e,l)}}function jm(e){var t=e.alternate;t!==null&&(e.alternate=null,jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Rr(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,Dt=!1;function Yn(e,t,l){for(l=l.child;l!==null;)Om(e,t,l),l=l.sibling}function Om(e,t,l){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(ii,l)}catch{}switch(l.tag){case 26:ft||Cn(l,t),Yn(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:ft||Cn(l,t);var o=et,u=Dt;Si(l.type)&&(et=l.stateNode,Dt=!1),Yn(e,t,l),ns(l.stateNode),et=o,Dt=u;break;case 5:ft||Cn(l,t);case 6:if(o=et,u=Dt,et=null,Yn(e,t,l),et=o,Dt=u,et!==null)if(Dt)try{(et.nodeType===9?et.body:et.nodeName==="HTML"?et.ownerDocument.body:et).removeChild(l.stateNode)}catch(f){Pe(l,t,f)}else try{et.removeChild(l.stateNode)}catch(f){Pe(l,t,f)}break;case 18:et!==null&&(Dt?(e=et,Ap(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),Zl(e)):Ap(et,l.stateNode));break;case 4:o=et,u=Dt,et=l.stateNode.containerInfo,Dt=!0,Yn(e,t,l),et=o,Dt=u;break;case 0:case 11:case 14:case 15:pi(2,l,t),ft||pi(4,l,t),Yn(e,t,l);break;case 1:ft||(Cn(l,t),o=l.stateNode,typeof o.componentWillUnmount=="function"&&Em(l,t,o)),Yn(e,t,l);break;case 21:Yn(e,t,l);break;case 22:ft=(o=ft)||l.memoizedState!==null,Yn(e,t,l),ft=o;break;default:Yn(e,t,l)}}function Dm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zl(e)}catch(l){Pe(t,t.return,l)}}}function zm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zl(e)}catch(l){Pe(t,t.return,l)}}function Hv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Lm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Lm),t;default:throw Error(s(435,e.tag))}}function Co(e,t){var l=Hv(e);t.forEach(function(o){if(!l.has(o)){l.add(o);var u=$v.bind(null,e,o);o.then(u,u)}})}function zt(e,t){var l=t.deletions;if(l!==null)for(var o=0;o<l.length;o++){var u=l[o],f=e,b=t,M=b;e:for(;M!==null;){switch(M.tag){case 27:if(Si(M.type)){et=M.stateNode,Dt=!1;break e}break;case 5:et=M.stateNode,Dt=!1;break e;case 3:case 4:et=M.stateNode.containerInfo,Dt=!0;break e}M=M.return}if(et===null)throw Error(s(160));Om(f,b,u),et=null,Dt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Hm(t,e),t=t.sibling}var pn=null;function Hm(e,t){var l=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:zt(t,e),Ht(e),o&4&&(pi(3,e,e.return),$a(3,e),pi(5,e,e.return));break;case 1:zt(t,e),Ht(e),o&512&&(ft||l===null||Cn(l,l.return)),o&64&&Gn&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?o:l.concat(o))));break;case 26:var u=pn;if(zt(t,e),Ht(e),o&512&&(ft||l===null||Cn(l,l.return)),o&4){var f=l!==null?l.memoizedState:null;if(o=e.memoizedState,l===null)if(o===null)if(e.stateNode===null){e:{o=e.type,l=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":f=u.getElementsByTagName("title")[0],(!f||f[xa]||f[xt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(o),u.head.insertBefore(f,u.querySelector("head > title"))),Tt(f,o,l),f[xt]=e,yt(f),o=f;break e;case"link":var b=Hp("link","href",u).get(o+(l.href||""));if(b){for(var M=0;M<b.length;M++)if(f=b[M],f.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&f.getAttribute("rel")===(l.rel==null?null:l.rel)&&f.getAttribute("title")===(l.title==null?null:l.title)&&f.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(M,1);break t}}f=u.createElement(o),Tt(f,o,l),u.head.appendChild(f);break;case"meta":if(b=Hp("meta","content",u).get(o+(l.content||""))){for(M=0;M<b.length;M++)if(f=b[M],f.getAttribute("content")===(l.content==null?null:""+l.content)&&f.getAttribute("name")===(l.name==null?null:l.name)&&f.getAttribute("property")===(l.property==null?null:l.property)&&f.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&f.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(M,1);break t}}f=u.createElement(o),Tt(f,o,l),u.head.appendChild(f);break;default:throw Error(s(468,o))}f[xt]=e,yt(f),o=f}e.stateNode=o}else Bp(u,e.type,e.stateNode);else e.stateNode=zp(u,o,e.memoizedProps);else f!==o?(f===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):f.count--,o===null?Bp(u,e.type,e.stateNode):zp(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Jc(e,e.memoizedProps,l.memoizedProps)}break;case 27:zt(t,e),Ht(e),o&512&&(ft||l===null||Cn(l,l.return)),l!==null&&o&4&&Jc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(zt(t,e),Ht(e),o&512&&(ft||l===null||Cn(l,l.return)),e.flags&32){u=e.stateNode;try{xl(u,"")}catch(ye){Pe(e,e.return,ye)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Jc(e,u,l!==null?l.memoizedProps:u)),o&1024&&(nu=!0);break;case 6:if(zt(t,e),Ht(e),o&4){if(e.stateNode===null)throw Error(s(162));o=e.memoizedProps,l=e.stateNode;try{l.nodeValue=o}catch(ye){Pe(e,e.return,ye)}}break;case 3:if(Uo=null,u=pn,pn=Ho(t.containerInfo),zt(t,e),pn=u,Ht(e),o&4&&l!==null&&l.memoizedState.isDehydrated)try{Zl(t.containerInfo)}catch(ye){Pe(e,e.return,ye)}nu&&(nu=!1,Bm(e));break;case 4:o=pn,pn=Ho(e.stateNode.containerInfo),zt(t,e),Ht(e),pn=o;break;case 12:zt(t,e),Ht(e);break;case 31:zt(t,e),Ht(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Co(e,o)));break;case 13:zt(t,e),Ht(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Mo=bt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Co(e,o)));break;case 22:u=e.memoizedState!==null;var L=l!==null&&l.memoizedState!==null,G=Gn,W=ft;if(Gn=G||u,ft=W||L,zt(t,e),ft=W,Gn=G,Ht(e),o&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(l===null||L||Gn||ft||Ji(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){L=l=t;try{if(f=L.stateNode,u)b=f.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{M=L.stateNode;var ee=L.memoizedProps.style,Y=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;M.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ye){Pe(L,L.return,ye)}}}else if(t.tag===6){if(l===null){L=t;try{L.stateNode.nodeValue=u?"":L.memoizedProps}catch(ye){Pe(L,L.return,ye)}}}else if(t.tag===18){if(l===null){L=t;try{var q=L.stateNode;u?Ep(q,!0):Ep(L.stateNode,!1)}catch(ye){Pe(L,L.return,ye)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}o&4&&(o=e.updateQueue,o!==null&&(l=o.retryQueue,l!==null&&(o.retryQueue=null,Co(e,l))));break;case 19:zt(t,e),Ht(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Co(e,o)));break;case 30:break;case 21:break;default:zt(t,e),Ht(e)}}function Ht(e){var t=e.flags;if(t&2){try{for(var l,o=e.return;o!==null;){if(Nm(o)){l=o;break}o=o.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var u=l.stateNode,f=eu(e);So(e,f,u);break;case 5:var b=l.stateNode;l.flags&32&&(xl(b,""),l.flags&=-33);var M=eu(e);So(e,M,b);break;case 3:case 4:var L=l.stateNode.containerInfo,G=eu(e);tu(e,G,L);break;default:throw Error(s(161))}}catch(W){Pe(e,e.return,W)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Bm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Bm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Pn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Rm(e,t.alternate,t),t=t.sibling}function Ji(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:pi(4,t,t.return),Ji(t);break;case 1:Cn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Em(t,t.return,l),Ji(t);break;case 27:ns(t.stateNode);case 26:case 5:Cn(t,t.return),Ji(t);break;case 22:t.memoizedState===null&&Ji(t);break;case 30:Ji(t);break;default:Ji(t)}e=e.sibling}}function $n(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var o=t.alternate,u=e,f=t,b=f.flags;switch(f.tag){case 0:case 11:case 15:$n(u,f,l),$a(4,f);break;case 1:if($n(u,f,l),o=f,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(G){Pe(o,o.return,G)}if(o=f,u=o.updateQueue,u!==null){var M=o.stateNode;try{var L=u.shared.hiddenCallbacks;if(L!==null)for(u.shared.hiddenCallbacks=null,u=0;u<L.length;u++)ph(L[u],M)}catch(G){Pe(o,o.return,G)}}l&&b&64&&Am(f),Va(f,f.return);break;case 27:_m(f);case 26:case 5:$n(u,f,l),l&&o===null&&b&4&&km(f),Va(f,f.return);break;case 12:$n(u,f,l);break;case 31:$n(u,f,l),l&&b&4&&Dm(u,f);break;case 13:$n(u,f,l),l&&b&4&&zm(u,f);break;case 22:f.memoizedState===null&&$n(u,f,l),Va(f,f.return);break;case 30:break;default:$n(u,f,l)}t=t.sibling}}function iu(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&ja(l))}function lu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ja(e))}function gn(e,t,l,o){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Um(e,t,l,o),t=t.sibling}function Um(e,t,l,o){var u=t.flags;switch(t.tag){case 0:case 11:case 15:gn(e,t,l,o),u&2048&&$a(9,t);break;case 1:gn(e,t,l,o);break;case 3:gn(e,t,l,o),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ja(e)));break;case 12:if(u&2048){gn(e,t,l,o),e=t.stateNode;try{var f=t.memoizedProps,b=f.id,M=f.onPostCommit;typeof M=="function"&&M(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(L){Pe(t,t.return,L)}}else gn(e,t,l,o);break;case 31:gn(e,t,l,o);break;case 13:gn(e,t,l,o);break;case 23:break;case 22:f=t.stateNode,b=t.alternate,t.memoizedState!==null?f._visibility&2?gn(e,t,l,o):qa(e,t):f._visibility&2?gn(e,t,l,o):(f._visibility|=2,Kl(e,t,l,o,(t.subtreeFlags&10256)!==0||!1)),u&2048&&iu(b,t);break;case 24:gn(e,t,l,o),u&2048&&lu(t.alternate,t);break;default:gn(e,t,l,o)}}function Kl(e,t,l,o,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,b=t,M=l,L=o,G=b.flags;switch(b.tag){case 0:case 11:case 15:Kl(f,b,M,L,u),$a(8,b);break;case 23:break;case 22:var W=b.stateNode;b.memoizedState!==null?W._visibility&2?Kl(f,b,M,L,u):qa(f,b):(W._visibility|=2,Kl(f,b,M,L,u)),u&&G&2048&&iu(b.alternate,b);break;case 24:Kl(f,b,M,L,u),u&&G&2048&&lu(b.alternate,b);break;default:Kl(f,b,M,L,u)}t=t.sibling}}function qa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,o=t,u=o.flags;switch(o.tag){case 22:qa(l,o),u&2048&&iu(o.alternate,o);break;case 24:qa(l,o),u&2048&&lu(o.alternate,o);break;default:qa(l,o)}t=t.sibling}}var Xa=8192;function Il(e,t,l){if(e.subtreeFlags&Xa)for(e=e.child;e!==null;)Km(e,t,l),e=e.sibling}function Km(e,t,l){switch(e.tag){case 26:Il(e,t,l),e.flags&Xa&&e.memoizedState!==null&&Cx(l,pn,e.memoizedState,e.memoizedProps);break;case 5:Il(e,t,l);break;case 3:case 4:var o=pn;pn=Ho(e.stateNode.containerInfo),Il(e,t,l),pn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Xa,Xa=16777216,Il(e,t,l),Xa=o):Il(e,t,l));break;default:Il(e,t,l)}}function Im(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 Wa(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var o=t[l];vt=o,Gm(o,e)}Im(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:Wa(e),e.flags&2048&&pi(9,e,e.return);break;case 3:Wa(e);break;case 12:Wa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,To(e)):Wa(e);break;default:Wa(e)}}function To(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var o=t[l];vt=o,Gm(o,e)}Im(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:pi(8,t,t.return),To(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,To(t));break;default:To(t)}e=e.sibling}}function Gm(e,t){for(;vt!==null;){var l=vt;switch(l.tag){case 0:case 11:case 15:pi(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var o=l.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ja(l.memoizedState.cache)}if(o=l.child,o!==null)o.return=l,vt=o;else e:for(l=e;vt!==null;){o=vt;var u=o.sibling,f=o.return;if(jm(o),o===l){vt=null;break e}if(u!==null){u.return=f,vt=u;break e}vt=f}}}var Bv={getCacheForType:function(e){var t=St(ct),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return St(ct).controller.signal}},Uv=typeof WeakMap=="function"?WeakMap:Map,Fe=0,Xe=null,je=null,De=0,Ye=0,Vt=null,gi=!1,Fl=!1,au=!1,Vn=0,at=0,bi=0,el=0,su=0,qt=0,Gl=0,Za=null,Bt=null,ou=!1,Mo=0,Ym=0,Ao=1/0,Eo=null,yi=null,mt=0,vi=null,Yl=null,qn=0,ru=0,cu=null,Pm=null,Qa=0,uu=null;function Xt(){return(Fe&2)!==0&&De!==0?De&-De:z.T!==null?gu():of()}function $m(){if(qt===0)if((De&536870912)===0||He){var e=Nt;Nt<<=1,(Nt&3932160)===0&&(Nt=262144),qt=e}else qt=536870912;return e=Pt.current,e!==null&&(e.flags|=32),qt}function Ut(e,t,l){(e===Xe&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)&&(Pl(e,0),xi(e,De,qt,!1)),va(e,l),((Fe&2)===0||e!==Xe)&&(e===Xe&&((Fe&2)===0&&(el|=l),at===4&&xi(e,De,qt,!1)),Tn(e))}function Vm(e,t,l){if((Fe&6)!==0)throw Error(s(327));var o=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Hi(e,t),u=o?Fv(e,t):fu(e,t,!0),f=o;do{if(u===0){Fl&&!o&&xi(e,t,0,!1);break}else{if(l=e.current.alternate,f&&!Kv(l)){u=fu(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var M=e;u=Za;var L=M.current.memoizedState.isDehydrated;if(L&&(Pl(M,b).flags|=256),b=fu(M,b,!1),b!==2){if(au&&!L){M.errorRecoveryDisabledLanes|=f,el|=f,u=4;break e}f=Bt,Bt=u,f!==null&&(Bt===null?Bt=f:Bt.push.apply(Bt,f))}u=b}if(f=!1,u!==2)continue}}if(u===1){Pl(e,0),xi(e,t,0,!0);break}e:{switch(o=e,f=u,f){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:xi(o,t,qt,!gi);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(u=Mo+300-bt(),10<u)){if(xi(o,t,qt,!gi),fl(o,0,!0)!==0)break e;qn=t,o.timeoutHandle=Tp(qm.bind(null,o,l,Bt,Eo,ou,t,qt,el,Gl,gi,f,"Throttled",-0,0),u);break e}qm(o,l,Bt,Eo,ou,t,qt,el,Gl,gi,f,null,-0,0)}}break}while(!0);Tn(e)}function qm(e,t,l,o,u,f,b,M,L,G,W,ee,Y,q){if(e.timeoutHandle=-1,ee=t.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:jn},Km(t,f,ee);var ye=(f&62914560)===f?Mo-bt():(f&4194048)===f?Ym-bt():0;if(ye=Tx(ee,ye),ye!==null){qn=f,e.cancelPendingCommit=ye(np.bind(null,e,t,f,l,o,u,b,M,L,W,ee,null,Y,q)),xi(e,f,b,!G);return}}np(e,t,f,l,o,u,b,M,L)}function Kv(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var o=0;o<l.length;o++){var u=l[o],f=u.getSnapshot;u=u.value;try{if(!Gt(f(),u))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 xi(e,t,l,o){t&=~su,t&=~el,e.suspendedLanes|=t,e.pingedLanes&=~t,o&&(e.warmLanes|=t),o=e.expirationTimes;for(var u=t;0<u;){var f=31-kt(u),b=1<<f;o[f]=-1,u&=~b}l!==0&&lf(e,l,t)}function ko(){return(Fe&6)===0?(Ja(0),!1):!0}function du(){if(je!==null){if(Ye===0)var e=je.return;else e=je,Hn=Pi=null,Ec(e),Dl=null,Da=0,e=je;for(;e!==null;)Mm(e.alternate,e),e=e.return;je=null}}function Pl(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,sx(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),qn=0,du(),Xe=e,je=l=Dn(e.current,null),De=t,Ye=0,Vt=null,gi=!1,Fl=Hi(e,t),au=!1,Gl=qt=su=el=bi=at=0,Bt=Za=null,ou=!1,(t&8)!==0&&(t|=t&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=t;0<o;){var u=31-kt(o),f=1<<u;t|=e[u],o&=~f}return Vn=t,qs(),l}function Xm(e,t){ke=null,z.H=Ga,t===Ol||t===no?(t=dh(),Ye=3):t===pc?(t=dh(),Ye=4):Ye=t===Gc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Vt=t,je===null&&(at=1,bo(e,Jt(t,e.current)))}function Wm(){var e=Pt.current;return e===null?!0:(De&4194048)===De?ln===null:(De&62914560)===De||(De&536870912)!==0?e===ln:!1}function Zm(){var e=z.H;return z.H=Ga,e===null?Ga:e}function Qm(){var e=z.A;return z.A=Bv,e}function No(){at=4,gi||(De&4194048)!==De&&Pt.current!==null||(Fl=!0),(bi&134217727)===0&&(el&134217727)===0||Xe===null||xi(Xe,De,qt,!1)}function fu(e,t,l){var o=Fe;Fe|=2;var u=Zm(),f=Qm();(Xe!==e||De!==t)&&(Eo=null,Pl(e,t)),t=!1;var b=at;e:do try{if(Ye!==0&&je!==null){var M=je,L=Vt;switch(Ye){case 8:du(),b=6;break e;case 3:case 2:case 9:case 6:Pt.current===null&&(t=!0);var G=Ye;if(Ye=0,Vt=null,$l(e,M,L,G),l&&Fl){b=0;break e}break;default:G=Ye,Ye=0,Vt=null,$l(e,M,L,G)}}Iv(),b=at;break}catch(W){Xm(e,W)}while(!0);return t&&e.shellSuspendCounter++,Hn=Pi=null,Fe=o,z.H=u,z.A=f,je===null&&(Xe=null,De=0,qs()),b}function Iv(){for(;je!==null;)Jm(je)}function Fv(e,t){var l=Fe;Fe|=2;var o=Zm(),u=Qm();Xe!==e||De!==t?(Eo=null,Ao=bt()+500,Pl(e,t)):Fl=Hi(e,t);e:do try{if(Ye!==0&&je!==null){t=je;var f=Vt;t:switch(Ye){case 1:Ye=0,Vt=null,$l(e,t,f,1);break;case 2:case 9:if(ch(f)){Ye=0,Vt=null,ep(t);break}t=function(){Ye!==2&&Ye!==9||Xe!==e||(Ye=7),Tn(e)},f.then(t,t);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:ch(f)?(Ye=0,Vt=null,ep(t)):(Ye=0,Vt=null,$l(e,t,f,7));break;case 5:var b=null;switch(je.tag){case 26:b=je.memoizedState;case 5:case 27:var M=je;if(b?Up(b):M.stateNode.complete){Ye=0,Vt=null;var L=M.sibling;if(L!==null)je=L;else{var G=M.return;G!==null?(je=G,_o(G)):je=null}break t}}Ye=0,Vt=null,$l(e,t,f,5);break;case 6:Ye=0,Vt=null,$l(e,t,f,6);break;case 8:du(),at=6;break e;default:throw Error(s(462))}}Gv();break}catch(W){Xm(e,W)}while(!0);return Hn=Pi=null,z.H=o,z.A=u,Fe=l,je!==null?0:(Xe=null,De=0,qs(),at)}function Gv(){for(;je!==null&&!Nn();)Jm(je)}function Jm(e){var t=Cm(e.alternate,e,Vn);e.memoizedProps=e.pendingProps,t===null?_o(e):je=t}function ep(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=bm(l,t,t.pendingProps,t.type,void 0,De);break;case 11:t=bm(l,t,t.pendingProps,t.type.render,t.ref,De);break;case 5:Ec(t);default:Mm(l,t),t=je=Qf(t,Vn),t=Cm(l,t,Vn)}e.memoizedProps=e.pendingProps,t===null?_o(e):je=t}function $l(e,t,l,o){Hn=Pi=null,Ec(t),Dl=null,Da=0;var u=t.return;try{if(Lv(e,u,t,l,De)){at=1,bo(e,Jt(l,e.current)),je=null;return}}catch(f){if(u!==null)throw je=u,f;at=1,bo(e,Jt(l,e.current)),je=null;return}t.flags&32768?(He||o===1?e=!0:Fl||(De&536870912)!==0?e=!1:(gi=e=!0,(o===2||o===9||o===3||o===6)&&(o=Pt.current,o!==null&&o.tag===13&&(o.flags|=16384))),tp(t,e)):_o(t)}function _o(e){var t=e;do{if((t.flags&32768)!==0){tp(t,gi);return}e=t.return;var l=Ov(t.alternate,t,Vn);if(l!==null){je=l;return}if(t=t.sibling,t!==null){je=t;return}je=t=e}while(t!==null);at===0&&(at=5)}function tp(e,t){do{var l=Dv(e.alternate,e);if(l!==null){l.flags&=32767,je=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){je=e;return}je=e=l}while(e!==null);at=6,je=null}function np(e,t,l,o,u,f,b,M,L){e.cancelPendingCommit=null;do Lo();while(mt!==0);if((Fe&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(f=t.lanes|t.childLanes,f|=ec,S0(e,l,f,b,M,L),e===Xe&&(je=Xe=null,De=0),Yl=t,vi=e,qn=l,ru=f,cu=u,Pm=o,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Vv(zi,function(){return op(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||o){o=z.T,z.T=null,u=J.p,J.p=2,b=Fe,Fe|=4;try{zv(e,t,l)}finally{Fe=b,J.p=u,z.T=o}}mt=1,ip(),lp(),ap()}}function ip(){if(mt===1){mt=0;var e=vi,t=Yl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=z.T,z.T=null;var o=J.p;J.p=2;var u=Fe;Fe|=4;try{Hm(t,e);var f=Tu,b=Gf(e.containerInfo),M=f.focusedElem,L=f.selectionRange;if(b!==M&&M&&M.ownerDocument&&Ff(M.ownerDocument.documentElement,M)){if(L!==null&&Xr(M)){var G=L.start,W=L.end;if(W===void 0&&(W=G),"selectionStart"in M)M.selectionStart=G,M.selectionEnd=Math.min(W,M.value.length);else{var ee=M.ownerDocument||document,Y=ee&&ee.defaultView||window;if(Y.getSelection){var q=Y.getSelection(),ye=M.textContent.length,Te=Math.min(L.start,ye),qe=L.end===void 0?Te:Math.min(L.end,ye);!q.extend&&Te>qe&&(b=qe,qe=Te,Te=b);var U=If(M,Te),j=If(M,qe);if(U&&j&&(q.rangeCount!==1||q.anchorNode!==U.node||q.anchorOffset!==U.offset||q.focusNode!==j.node||q.focusOffset!==j.offset)){var F=ee.createRange();F.setStart(U.node,U.offset),q.removeAllRanges(),Te>qe?(q.addRange(F),q.extend(j.node,j.offset)):(F.setEnd(j.node,j.offset),q.addRange(F))}}}}for(ee=[],q=M;q=q.parentNode;)q.nodeType===1&&ee.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<ee.length;M++){var Z=ee[M];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Go=!!Cu,Tu=Cu=null}finally{Fe=u,J.p=o,z.T=l}}e.current=t,mt=2}}function lp(){if(mt===2){mt=0;var e=vi,t=Yl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=z.T,z.T=null;var o=J.p;J.p=2;var u=Fe;Fe|=4;try{Rm(e,t.alternate,t)}finally{Fe=u,J.p=o,z.T=l}}mt=3}}function ap(){if(mt===4||mt===3){mt=0,dl();var e=vi,t=Yl,l=qn,o=Pm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?mt=5:(mt=0,Yl=vi=null,sp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(yi=null),_r(l),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(ii,t,void 0,(t.current.flags&128)===128)}catch{}if(o!==null){t=z.T,u=J.p,J.p=2,z.T=null;try{for(var f=e.onRecoverableError,b=0;b<o.length;b++){var M=o[b];f(M.value,{componentStack:M.stack})}}finally{z.T=t,J.p=u}}(qn&3)!==0&&Lo(),Tn(e),u=e.pendingLanes,(l&261930)!==0&&(u&42)!==0?e===uu?Qa++:(Qa=0,uu=e):Qa=0,Ja(0)}}function sp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ja(t)))}function Lo(){return ip(),lp(),ap(),op()}function op(){if(mt!==5)return!1;var e=vi,t=ru;ru=0;var l=_r(qn),o=z.T,u=J.p;try{J.p=32>l?32:l,z.T=null,l=cu,cu=null;var f=vi,b=qn;if(mt=0,Yl=vi=null,qn=0,(Fe&6)!==0)throw Error(s(331));var M=Fe;if(Fe|=4,Fm(f.current),Um(f,f.current,b,l),Fe=M,Ja(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(ii,f)}catch{}return!0}finally{J.p=u,z.T=o,sp(e,t)}}function rp(e,t,l){t=Jt(l,t),t=Fc(e.stateNode,t,2),e=fi(e,t,2),e!==null&&(va(e,2),Tn(e))}function Pe(e,t,l){if(e.tag===3)rp(e,e,l);else for(;t!==null;){if(t.tag===3){rp(t,e,l);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(yi===null||!yi.has(o))){e=Jt(l,e),l=cm(2),o=fi(t,l,2),o!==null&&(um(l,o,t,e),va(o,2),Tn(o));break}}t=t.return}}function hu(e,t,l){var o=e.pingCache;if(o===null){o=e.pingCache=new Uv;var u=new Set;o.set(t,u)}else u=o.get(t),u===void 0&&(u=new Set,o.set(t,u));u.has(l)||(au=!0,u.add(l),e=Yv.bind(null,e,t,l),t.then(e,e))}function Yv(e,t,l){var o=e.pingCache;o!==null&&o.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Xe===e&&(De&l)===l&&(at===4||at===3&&(De&62914560)===De&&300>bt()-Mo?(Fe&2)===0&&Pl(e,0):su|=l,Gl===De&&(Gl=0)),Tn(e)}function cp(e,t){t===0&&(t=zs()),e=Fi(e,t),e!==null&&(va(e,t),Tn(e))}function Pv(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),cp(e,l)}function $v(e,t){var l=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(l=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(t),cp(e,l)}function Vv(e,t){return Rt(e,t)}var Ro=null,Vl=null,mu=!1,jo=!1,pu=!1,wi=0;function Tn(e){e!==Vl&&e.next===null&&(Vl===null?Ro=Vl=e:Vl=Vl.next=e),jo=!0,mu||(mu=!0,Xv())}function Ja(e,t){if(!pu&&jo){pu=!0;do for(var l=!1,o=Ro;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var f=0;else{var b=o.suspendedLanes,M=o.pingedLanes;f=(1<<31-kt(42|e)+1)-1,f&=u&~(b&~M),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(l=!0,hp(o,f))}else f=De,f=fl(o,o===Xe?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||Hi(o,f)||(l=!0,hp(o,f));o=o.next}while(l);pu=!1}}function qv(){up()}function up(){jo=mu=!1;var e=0;wi!==0&&ax()&&(e=wi);for(var t=bt(),l=null,o=Ro;o!==null;){var u=o.next,f=dp(o,t);f===0?(o.next=null,l===null?Ro=u:l.next=u,u===null&&(Vl=l)):(l=o,(e!==0||(f&3)!==0)&&(jo=!0)),o=u}mt!==0&&mt!==5||Ja(e),wi!==0&&(wi=0)}function dp(e,t){for(var l=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var b=31-kt(f),M=1<<b,L=u[b];L===-1?((M&l)===0||(M&o)!==0)&&(u[b]=Ds(M,t)):L<=t&&(e.expiredLanes|=M),f&=~M}if(t=Xe,l=De,l=fl(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,l===0||e===t&&(Ye===2||Ye===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&xn(o),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Hi(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(o!==null&&xn(o),_r(l)){case 2:case 8:l=ba;break;case 32:l=zi;break;case 268435456:l=ya;break;default:l=zi}return o=fp.bind(null,e),l=Rt(l,o),e.callbackPriority=t,e.callbackNode=l,t}return o!==null&&o!==null&&xn(o),e.callbackPriority=2,e.callbackNode=null,2}function fp(e,t){if(mt!==0&&mt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Lo()&&e.callbackNode!==l)return null;var o=De;return o=fl(e,e===Xe?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Vm(e,o,t),dp(e,bt()),e.callbackNode!=null&&e.callbackNode===l?fp.bind(null,e):null)}function hp(e,t){if(Lo())return null;Vm(e,t,!0)}function Xv(){ox(function(){(Fe&6)!==0?Rt(_n,qv):up()})}function gu(){if(wi===0){var e=Rl;e===0&&(e=Ge,Ge<<=1,(Ge&261888)===0&&(Ge=256)),wi=e}return wi}function mp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ks(""+e)}function pp(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Wv(e,t,l,o,u){if(t==="submit"&&l&&l.stateNode===u){var f=mp((u[jt]||null).action),b=o.submitter;b&&(t=(t=b[jt]||null)?mp(t.formAction):b.getAttribute("formAction"),t!==null&&(f=t,b=null));var M=new Ys("action","action",null,o,u);e.push({event:M,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(wi!==0){var L=b?pp(u,b):new FormData(u);zc(l,{pending:!0,data:L,method:u.method,action:f},null,L)}}else typeof f=="function"&&(M.preventDefault(),L=b?pp(u,b):new FormData(u),zc(l,{pending:!0,data:L,method:u.method,action:f},f,L))},currentTarget:u}]})}}for(var bu=0;bu<Jr.length;bu++){var yu=Jr[bu],Zv=yu.toLowerCase(),Qv=yu[0].toUpperCase()+yu.slice(1);mn(Zv,"on"+Qv)}mn($f,"onAnimationEnd"),mn(Vf,"onAnimationIteration"),mn(qf,"onAnimationStart"),mn("dblclick","onDoubleClick"),mn("focusin","onFocus"),mn("focusout","onBlur"),mn(mv,"onTransitionRun"),mn(pv,"onTransitionStart"),mn(gv,"onTransitionCancel"),mn(Xf,"onTransitionEnd"),yl("onMouseEnter",["mouseout","mouseover"]),yl("onMouseLeave",["mouseout","mouseover"]),yl("onPointerEnter",["pointerout","pointerover"]),yl("onPointerLeave",["pointerout","pointerover"]),Bi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var es="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(" "),Jv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(es));function gp(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var o=e[l],u=o.event;o=o.listeners;e:{var f=void 0;if(t)for(var b=o.length-1;0<=b;b--){var M=o[b],L=M.instance,G=M.currentTarget;if(M=M.listener,L!==f&&u.isPropagationStopped())break e;f=M,u.currentTarget=G;try{f(u)}catch(W){Vs(W)}u.currentTarget=null,f=L}else for(b=0;b<o.length;b++){if(M=o[b],L=M.instance,G=M.currentTarget,M=M.listener,L!==f&&u.isPropagationStopped())break e;f=M,u.currentTarget=G;try{f(u)}catch(W){Vs(W)}u.currentTarget=null,f=L}}}}function Oe(e,t){var l=t[Lr];l===void 0&&(l=t[Lr]=new Set);var o=e+"__bubble";l.has(o)||(bp(t,e,2,!1),l.add(o))}function vu(e,t,l){var o=0;t&&(o|=4),bp(l,e,o,t)}var Oo="_reactListening"+Math.random().toString(36).slice(2);function xu(e){if(!e[Oo]){e[Oo]=!0,uf.forEach(function(l){l!=="selectionchange"&&(Jv.has(l)||vu(l,!1,e),vu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Oo]||(t[Oo]=!0,vu("selectionchange",!1,t))}}function bp(e,t,l,o){switch($p(t)){case 2:var u=Ex;break;case 8:u=kx;break;default:u=Du}l=u.bind(null,t,l,e),u=void 0,!Kr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(t,l,{capture:!0,passive:u}):e.addEventListener(t,l,!0):u!==void 0?e.addEventListener(t,l,{passive:u}):e.addEventListener(t,l,!1)}function wu(e,t,l,o,u){var f=o;if((t&1)===0&&(t&2)===0&&o!==null)e:for(;;){if(o===null)return;var b=o.tag;if(b===3||b===4){var M=o.stateNode.containerInfo;if(M===u)break;if(b===4)for(b=o.return;b!==null;){var L=b.tag;if((L===3||L===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;M!==null;){if(b=pl(M),b===null)return;if(L=b.tag,L===5||L===6||L===26||L===27){o=f=b;continue e}M=M.parentNode}}o=o.return}Sf(function(){var G=f,W=Br(l),ee=[];e:{var Y=Wf.get(e);if(Y!==void 0){var q=Ys,ye=e;switch(e){case"keypress":if(Fs(l)===0)break e;case"keydown":case"keyup":q=$0;break;case"focusin":ye="focus",q=Yr;break;case"focusout":ye="blur",q=Yr;break;case"beforeblur":case"afterblur":q=Yr;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":q=Mf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":q=O0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":q=X0;break;case $f:case Vf:case qf:q=H0;break;case Xf:q=Z0;break;case"scroll":case"scrollend":q=R0;break;case"wheel":q=J0;break;case"copy":case"cut":case"paste":q=U0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":q=Ef;break;case"toggle":case"beforetoggle":q=tv}var Te=(t&4)!==0,qe=!Te&&(e==="scroll"||e==="scrollend"),U=Te?Y!==null?Y+"Capture":null:Y;Te=[];for(var j=G,F;j!==null;){var Z=j;if(F=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||F===null||U===null||(Z=Sa(j,U),Z!=null&&Te.push(ts(j,Z,F))),qe)break;j=j.return}0<Te.length&&(Y=new q(Y,ye,null,l,W),ee.push({event:Y,listeners:Te}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",q=e==="mouseout"||e==="pointerout",Y&&l!==Hr&&(ye=l.relatedTarget||l.fromElement)&&(pl(ye)||ye[ml]))break e;if((q||Y)&&(Y=W.window===W?W:(Y=W.ownerDocument)?Y.defaultView||Y.parentWindow:window,q?(ye=l.relatedTarget||l.toElement,q=G,ye=ye?pl(ye):null,ye!==null&&(qe=c(ye),Te=ye.tag,ye!==qe||Te!==5&&Te!==27&&Te!==6)&&(ye=null)):(q=null,ye=G),q!==ye)){if(Te=Mf,Z="onMouseLeave",U="onMouseEnter",j="mouse",(e==="pointerout"||e==="pointerover")&&(Te=Ef,Z="onPointerLeave",U="onPointerEnter",j="pointer"),qe=q==null?Y:wa(q),F=ye==null?Y:wa(ye),Y=new Te(Z,j+"leave",q,l,W),Y.target=qe,Y.relatedTarget=F,Z=null,pl(W)===G&&(Te=new Te(U,j+"enter",ye,l,W),Te.target=F,Te.relatedTarget=qe,Z=Te),qe=Z,q&&ye)t:{for(Te=ex,U=q,j=ye,F=0,Z=U;Z;Z=Te(Z))F++;Z=0;for(var Ce=j;Ce;Ce=Te(Ce))Z++;for(;0<F-Z;)U=Te(U),F--;for(;0<Z-F;)j=Te(j),Z--;for(;F--;){if(U===j||j!==null&&U===j.alternate){Te=U;break t}U=Te(U),j=Te(j)}Te=null}else Te=null;q!==null&&yp(ee,Y,q,Te,!1),ye!==null&&qe!==null&&yp(ee,qe,ye,Te,!0)}}e:{if(Y=G?wa(G):window,q=Y.nodeName&&Y.nodeName.toLowerCase(),q==="select"||q==="input"&&Y.type==="file")var Ke=Df;else if(jf(Y))if(zf)Ke=dv;else{Ke=cv;var ve=rv}else q=Y.nodeName,!q||q.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?G&&zr(G.elementType)&&(Ke=Df):Ke=uv;if(Ke&&(Ke=Ke(e,G))){Of(ee,Ke,l,W);break e}ve&&ve(e,Y,G),e==="focusout"&&G&&Y.type==="number"&&G.memoizedProps.value!=null&&Dr(Y,"number",Y.value)}switch(ve=G?wa(G):window,e){case"focusin":(jf(ve)||ve.contentEditable==="true")&&(Tl=ve,Wr=G,_a=null);break;case"focusout":_a=Wr=Tl=null;break;case"mousedown":Zr=!0;break;case"contextmenu":case"mouseup":case"dragend":Zr=!1,Yf(ee,l,W);break;case"selectionchange":if(hv)break;case"keydown":case"keyup":Yf(ee,l,W)}var _e;if($r)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 Cl?Lf(e,l)&&(ze="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(ze="onCompositionStart");ze&&(kf&&l.locale!=="ko"&&(Cl||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Cl&&(_e=Cf()):(ai=W,Ir="value"in ai?ai.value:ai.textContent,Cl=!0)),ve=Do(G,ze),0<ve.length&&(ze=new Af(ze,e,null,l,W),ee.push({event:ze,listeners:ve}),_e?ze.data=_e:(_e=Rf(l),_e!==null&&(ze.data=_e)))),(_e=iv?lv(e,l):av(e,l))&&(ze=Do(G,"onBeforeInput"),0<ze.length&&(ve=new Af("onBeforeInput","beforeinput",null,l,W),ee.push({event:ve,listeners:ze}),ve.data=_e)),Wv(ee,e,G,l,W)}gp(ee,t)})}function ts(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Do(e,t){for(var l=t+"Capture",o=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Sa(e,l),u!=null&&o.unshift(ts(e,u,f)),u=Sa(e,t),u!=null&&o.push(ts(e,u,f))),e.tag===3)return o;e=e.return}return[]}function ex(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function yp(e,t,l,o,u){for(var f=t._reactName,b=[];l!==null&&l!==o;){var M=l,L=M.alternate,G=M.stateNode;if(M=M.tag,L!==null&&L===o)break;M!==5&&M!==26&&M!==27||G===null||(L=G,u?(G=Sa(l,f),G!=null&&b.unshift(ts(l,G,L))):u||(G=Sa(l,f),G!=null&&b.push(ts(l,G,L)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var tx=/\r\n?/g,nx=/\u0000|\uFFFD/g;function vp(e){return(typeof e=="string"?e:""+e).replace(tx,`
|
|
33
|
-
`).replace(nx,"")}function xp(e,t){return t=vp(t),vp(e)===t}function Ve(e,t,l,o,u,f){switch(l){case"children":typeof o=="string"?t==="body"||t==="textarea"&&o===""||xl(e,o):(typeof o=="number"||typeof o=="bigint")&&t!=="body"&&xl(e,""+o);break;case"className":Bs(e,"class",o);break;case"tabIndex":Bs(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Bs(e,l,o);break;case"style":xf(e,o,f);break;case"data":if(t!=="object"){Bs(e,"data",o);break}case"src":case"href":if(o===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(l);break}o=Ks(""+o),e.setAttribute(l,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(l,"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 f=="function"&&(l==="formAction"?(t!=="input"&&Ve(e,t,"name",u.name,u,null),Ve(e,t,"formEncType",u.formEncType,u,null),Ve(e,t,"formMethod",u.formMethod,u,null),Ve(e,t,"formTarget",u.formTarget,u,null)):(Ve(e,t,"encType",u.encType,u,null),Ve(e,t,"method",u.method,u,null),Ve(e,t,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(l);break}o=Ks(""+o),e.setAttribute(l,o);break;case"onClick":o!=null&&(e.onclick=jn);break;case"onScroll":o!=null&&Oe("scroll",e);break;case"onScrollEnd":o!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(l=o.__html,l!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=l}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}l=Ks(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(l,""+o):e.removeAttribute(l);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":o===!0?e.setAttribute(l,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(l,o):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(l,o):e.removeAttribute(l);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(l):e.setAttribute(l,o);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),Hs(e,"popover",o);break;case"xlinkActuate":Rn(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Rn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Rn(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Rn(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Rn(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Rn(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Rn(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Rn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Rn(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Hs(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=_0.get(l)||l,Hs(e,l,o))}}function Su(e,t,l,o,u,f){switch(l){case"style":xf(e,o,f);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(s(61));if(l=o.__html,l!=null){if(u.children!=null)throw Error(s(60));e.innerHTML=l}}break;case"children":typeof o=="string"?xl(e,o):(typeof o=="number"||typeof o=="bigint")&&xl(e,""+o);break;case"onScroll":o!=null&&Oe("scroll",e);break;case"onScrollEnd":o!=null&&Oe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!df.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(u=l.endsWith("Capture"),t=l.slice(2,u?l.length-7:void 0),f=e[jt]||null,f=f!=null?f[l]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof o=="function")){typeof f!="function"&&f!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,o,u);break e}l in e?e[l]=o:o===!0?e.setAttribute(l,""):Hs(e,l,o)}}}function Tt(e,t,l){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 o=!1,u=!1,f;for(f in l)if(l.hasOwnProperty(f)){var b=l[f];if(b!=null)switch(f){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ve(e,t,f,b,l,null)}}u&&Ve(e,t,"srcSet",l.srcSet,l,null),o&&Ve(e,t,"src",l.src,l,null);return;case"input":Oe("invalid",e);var M=f=b=u=null,L=null,G=null;for(o in l)if(l.hasOwnProperty(o)){var W=l[o];if(W!=null)switch(o){case"name":u=W;break;case"type":b=W;break;case"checked":L=W;break;case"defaultChecked":G=W;break;case"value":f=W;break;case"defaultValue":M=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(s(137,t));break;default:Ve(e,t,o,W,l,null)}}gf(e,f,M,L,G,b,u,!1);return;case"select":Oe("invalid",e),o=b=f=null;for(u in l)if(l.hasOwnProperty(u)&&(M=l[u],M!=null))switch(u){case"value":f=M;break;case"defaultValue":b=M;break;case"multiple":o=M;default:Ve(e,t,u,M,l,null)}t=f,l=b,e.multiple=!!o,t!=null?vl(e,!!o,t,!1):l!=null&&vl(e,!!o,l,!0);return;case"textarea":Oe("invalid",e),f=u=o=null;for(b in l)if(l.hasOwnProperty(b)&&(M=l[b],M!=null))switch(b){case"value":o=M;break;case"defaultValue":u=M;break;case"children":f=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(s(91));break;default:Ve(e,t,b,M,l,null)}yf(e,o,u,f);return;case"option":for(L in l)if(l.hasOwnProperty(L)&&(o=l[L],o!=null))switch(L){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Ve(e,t,L,o,l,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(o=0;o<es.length;o++)Oe(es[o],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 l)if(l.hasOwnProperty(G)&&(o=l[G],o!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ve(e,t,G,o,l,null)}return;default:if(zr(t)){for(W in l)l.hasOwnProperty(W)&&(o=l[W],o!==void 0&&Su(e,t,W,o,l,void 0));return}}for(M in l)l.hasOwnProperty(M)&&(o=l[M],o!=null&&Ve(e,t,M,o,l,null))}function ix(e,t,l,o){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,b=null,M=null,L=null,G=null,W=null;for(q in l){var ee=l[q];if(l.hasOwnProperty(q)&&ee!=null)switch(q){case"checked":break;case"value":break;case"defaultValue":L=ee;default:o.hasOwnProperty(q)||Ve(e,t,q,null,o,ee)}}for(var Y in o){var q=o[Y];if(ee=l[Y],o.hasOwnProperty(Y)&&(q!=null||ee!=null))switch(Y){case"type":f=q;break;case"name":u=q;break;case"checked":G=q;break;case"defaultChecked":W=q;break;case"value":b=q;break;case"defaultValue":M=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(137,t));break;default:q!==ee&&Ve(e,t,Y,q,o,ee)}}Or(e,b,M,L,G,W,f,u);return;case"select":q=b=M=Y=null;for(f in l)if(L=l[f],l.hasOwnProperty(f)&&L!=null)switch(f){case"value":break;case"multiple":q=L;default:o.hasOwnProperty(f)||Ve(e,t,f,null,o,L)}for(u in o)if(f=o[u],L=l[u],o.hasOwnProperty(u)&&(f!=null||L!=null))switch(u){case"value":Y=f;break;case"defaultValue":M=f;break;case"multiple":b=f;default:f!==L&&Ve(e,t,u,f,o,L)}t=M,l=b,o=q,Y!=null?vl(e,!!l,Y,!1):!!o!=!!l&&(t!=null?vl(e,!!l,t,!0):vl(e,!!l,l?[]:"",!1));return;case"textarea":q=Y=null;for(M in l)if(u=l[M],l.hasOwnProperty(M)&&u!=null&&!o.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:Ve(e,t,M,null,o,u)}for(b in o)if(u=o[b],f=l[b],o.hasOwnProperty(b)&&(u!=null||f!=null))switch(b){case"value":Y=u;break;case"defaultValue":q=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(s(91));break;default:u!==f&&Ve(e,t,b,u,o,f)}bf(e,Y,q);return;case"option":for(var ye in l)if(Y=l[ye],l.hasOwnProperty(ye)&&Y!=null&&!o.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:Ve(e,t,ye,null,o,Y)}for(L in o)if(Y=o[L],q=l[L],o.hasOwnProperty(L)&&Y!==q&&(Y!=null||q!=null))switch(L){case"selected":e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Ve(e,t,L,Y,o,q)}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 l)Y=l[Te],l.hasOwnProperty(Te)&&Y!=null&&!o.hasOwnProperty(Te)&&Ve(e,t,Te,null,o,Y);for(G in o)if(Y=o[G],q=l[G],o.hasOwnProperty(G)&&Y!==q&&(Y!=null||q!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,t));break;default:Ve(e,t,G,Y,o,q)}return;default:if(zr(t)){for(var qe in l)Y=l[qe],l.hasOwnProperty(qe)&&Y!==void 0&&!o.hasOwnProperty(qe)&&Su(e,t,qe,void 0,o,Y);for(W in o)Y=o[W],q=l[W],!o.hasOwnProperty(W)||Y===q||Y===void 0&&q===void 0||Su(e,t,W,Y,o,q);return}}for(var U in l)Y=l[U],l.hasOwnProperty(U)&&Y!=null&&!o.hasOwnProperty(U)&&Ve(e,t,U,null,o,Y);for(ee in o)Y=o[ee],q=l[ee],!o.hasOwnProperty(ee)||Y===q||Y==null&&q==null||Ve(e,t,ee,Y,o,q)}function wp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),o=0;o<l.length;o++){var u=l[o],f=u.transferSize,b=u.initiatorType,M=u.duration;if(f&&M&&wp(b)){for(b=0,M=u.responseEnd,o+=1;o<l.length;o++){var L=l[o],G=L.startTime;if(G>M)break;var W=L.transferSize,ee=L.initiatorType;W&&wp(ee)&&(L=L.responseEnd,b+=W*(L<M?1:(M-G)/(L-G)))}if(--o,t+=8*(f+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 Cu=null,Tu=null;function zo(e){return e.nodeType===9?e:e.ownerDocument}function Sp(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 Cp(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 Mu(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 Au=null;function ax(){var e=window.event;return e&&e.type==="popstate"?e===Au?!1:(Au=e,!0):(Au=null,!1)}var Tp=typeof setTimeout=="function"?setTimeout:void 0,sx=typeof clearTimeout=="function"?clearTimeout:void 0,Mp=typeof Promise=="function"?Promise:void 0,ox=typeof queueMicrotask=="function"?queueMicrotask:typeof Mp<"u"?function(e){return Mp.resolve(null).then(e).catch(rx)}:Tp;function rx(e){setTimeout(function(){throw e})}function Si(e){return e==="head"}function Ap(e,t){var l=t,o=0;do{var u=l.nextSibling;if(e.removeChild(l),u&&u.nodeType===8)if(l=u.data,l==="/$"||l==="/&"){if(o===0){e.removeChild(u),Zl(t);return}o--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")o++;else if(l==="html")ns(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ns(l);for(var f=l.firstChild;f;){var b=f.nextSibling,M=f.nodeName;f[xa]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&f.rel.toLowerCase()==="stylesheet"||l.removeChild(f),f=b}}else l==="body"&&ns(e.ownerDocument.body);l=u}while(l);Zl(t)}function Ep(e,t){var l=e;e=0;do{var o=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),o&&o.nodeType===8)if(l=o.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=o}while(l)}function Eu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Eu(l),Rr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function cx(e,t,l,o){for(;e.nodeType===1;){var u=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[xa])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==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(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=an(e.nextSibling),e===null)break}return null}function ux(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=an(e.nextSibling),e===null))return null;return e}function kp(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 ku(e){return e.data==="$?"||e.data==="$~"}function Nu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function dx(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var o=function(){t(),l.removeEventListener("DOMContentLoaded",o)};l.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}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 _u=null;function Np(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return an(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function _p(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function Lp(e,t,l){switch(t=zo(l),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function ns(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Rr(e)}var sn=new Map,Rp=new Set;function Ho(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Xn=J.d;J.d={f:fx,r:hx,D:mx,C:px,L:gx,m:bx,X:vx,S:yx,M:xx};function fx(){var e=Xn.f(),t=ko();return e||t}function hx(e){var t=gl(e);t!==null&&t.tag===5&&t.type==="form"?Xh(t):Xn.r(e)}var ql=typeof document>"u"?null:document;function jp(e,t,l){var o=ql;if(o&&typeof t=="string"&&t){var u=Zt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),Rp.has(u)||(Rp.add(u),e={rel:e,crossOrigin:l,href:t},o.querySelector(u)===null&&(t=o.createElement("link"),Tt(t,"link",e),yt(t),o.head.appendChild(t)))}}function mx(e){Xn.D(e),jp("dns-prefetch",e,null)}function px(e,t){Xn.C(e,t),jp("preconnect",e,t)}function gx(e,t,l){Xn.L(e,t,l);var o=ql;if(o&&e&&t){var u='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+Zt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+Zt(l.imageSizes)+'"]')):u+='[href="'+Zt(e)+'"]';var f=u;switch(t){case"style":f=Xl(e);break;case"script":f=Wl(e)}sn.has(f)||(e=v({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),sn.set(f,e),o.querySelector(u)!==null||t==="style"&&o.querySelector(is(f))||t==="script"&&o.querySelector(ls(f))||(t=o.createElement("link"),Tt(t,"link",e),yt(t),o.head.appendChild(t)))}}function bx(e,t){Xn.m(e,t);var l=ql;if(l&&e){var o=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Zt(o)+'"][href="'+Zt(e)+'"]',f=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Wl(e)}if(!sn.has(f)&&(e=v({rel:"modulepreload",href:e},t),sn.set(f,e),l.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ls(f)))return}o=l.createElement("link"),Tt(o,"link",e),yt(o),l.head.appendChild(o)}}}function yx(e,t,l){Xn.S(e,t,l);var o=ql;if(o&&e){var u=bl(o).hoistableStyles,f=Xl(e);t=t||"default";var b=u.get(f);if(!b){var M={loading:0,preload:null};if(b=o.querySelector(is(f)))M.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},l),(l=sn.get(f))&&Lu(e,l);var L=b=o.createElement("link");yt(L),Tt(L,"link",e),L._p=new Promise(function(G,W){L.onload=G,L.onerror=W}),L.addEventListener("load",function(){M.loading|=1}),L.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Bo(b,t,o)}b={type:"stylesheet",instance:b,count:1,state:M},u.set(f,b)}}}function vx(e,t){Xn.X(e,t);var l=ql;if(l&&e){var o=bl(l).hoistableScripts,u=Wl(e),f=o.get(u);f||(f=l.querySelector(ls(u)),f||(e=v({src:e,async:!0},t),(t=sn.get(u))&&Ru(e,t),f=l.createElement("script"),yt(f),Tt(f,"link",e),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function xx(e,t){Xn.M(e,t);var l=ql;if(l&&e){var o=bl(l).hoistableScripts,u=Wl(e),f=o.get(u);f||(f=l.querySelector(ls(u)),f||(e=v({src:e,async:!0,type:"module"},t),(t=sn.get(u))&&Ru(e,t),f=l.createElement("script"),yt(f),Tt(f,"link",e),l.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function Op(e,t,l,o){var u=(u=he.current)?Ho(u):null;if(!u)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=Xl(l.href),l=bl(u).hoistableStyles,o=l.get(t),o||(o={type:"style",instance:null,count:0,state:null},l.set(t,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Xl(l.href);var f=bl(u).hoistableStyles,b=f.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,b),(f=u.querySelector(is(e)))&&!f._p&&(b.instance=f,b.state.loading=5),sn.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},sn.set(e,l),f||wx(u,e,l,b.state))),t&&o===null)throw Error(s(528,""));return b}if(t&&o!==null)throw Error(s(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Wl(l),l=bl(u).hoistableScripts,o=l.get(t),o||(o={type:"script",instance:null,count:0,state:null},l.set(t,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Xl(e){return'href="'+Zt(e)+'"'}function is(e){return'link[rel="stylesheet"]['+e+"]"}function Dp(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function wx(e,t,l,o){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?o.loading=1:(t=e.createElement("link"),o.preload=t,t.addEventListener("load",function(){return o.loading|=1}),t.addEventListener("error",function(){return o.loading|=2}),Tt(t,"link",l),yt(t),e.head.appendChild(t))}function Wl(e){return'[src="'+Zt(e)+'"]'}function ls(e){return"script[async]"+e}function zp(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var o=e.querySelector('style[data-href~="'+Zt(l.href)+'"]');if(o)return t.instance=o,yt(o),o;var u=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),yt(o),Tt(o,"style",u),Bo(o,l.precedence,e),t.instance=o;case"stylesheet":u=Xl(l.href);var f=e.querySelector(is(u));if(f)return t.state.loading|=4,t.instance=f,yt(f),f;o=Dp(l),(u=sn.get(u))&&Lu(o,u),f=(e.ownerDocument||e).createElement("link"),yt(f);var b=f;return b._p=new Promise(function(M,L){b.onload=M,b.onerror=L}),Tt(f,"link",o),t.state.loading|=4,Bo(f,l.precedence,e),t.instance=f;case"script":return f=Wl(l.src),(u=e.querySelector(ls(f)))?(t.instance=u,yt(u),u):(o=l,(u=sn.get(f))&&(o=v({},l),Ru(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),yt(u),Tt(u,"link",o),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(o=t.instance,t.state.loading|=4,Bo(o,l.precedence,e));return t.instance}function Bo(e,t,l){for(var o=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,f=u,b=0;b<o.length;b++){var M=o[b];if(M.dataset.precedence===t)f=M;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Lu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ru(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Uo=null;function Hp(e,t,l){if(Uo===null){var o=new Map,u=Uo=new Map;u.set(l,o)}else u=Uo,o=u.get(l),o||(o=new Map,u.set(l,o));if(o.has(e))return o;for(o.set(e,null),l=l.getElementsByTagName(e),u=0;u<l.length;u++){var f=l[u];if(!(f[xa]||f[xt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var b=f.getAttribute(t)||"";b=e+b;var M=o.get(b);M?M.push(f):o.set(b,[f])}}return o}function Bp(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function Sx(e,t,l){if(l===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 Up(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Cx(e,t,l,o){if(l.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=Xl(o.href),f=t.querySelector(is(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ko.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=f,yt(f);return}f=t.ownerDocument||t,o=Dp(o),(u=sn.get(u))&&Lu(o,u),f=f.createElement("link"),yt(f);var b=f;b._p=new Promise(function(M,L){b.onload=M,b.onerror=L}),Tt(f,"link",o),l.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Ko.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var ju=0;function Tx(e,t){return e.stylesheets&&e.count===0&&Fo(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var o=setTimeout(function(){if(e.stylesheets&&Fo(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&ju===0&&(ju=62500*lx());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Fo(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>ju?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Ko(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Io=null;function Fo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Io=new Map,t.forEach(Mx,e),Io=null,Ko.call(e))}function Mx(e,t){if(!(t.state.loading&4)){var l=Io.get(e);if(l)var o=l.get(null);else{l=new Map,Io.set(e,l);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var b=u[f];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),o=b)}o&&l.set(null,o)}u=t.instance,b=u.getAttribute("data-precedence"),f=l.get(b)||o,f===o&&l.set(null,u),l.set(b,u),this.count++,o=Ko.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var as={$$typeof:_,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Ax(e,t,l,o,u,f,b,M,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=hl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hl(0),this.hiddenUpdates=hl(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function Kp(e,t,l,o,u,f,b,M,L,G,W,ee){return e=new Ax(e,t,l,b,L,G,W,ee,M),t=1,f===!0&&(t|=24),f=Yt(3,null,null,t),e.current=f,f.stateNode=e,t=fc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:o,isDehydrated:l,cache:t},gc(f),e}function Ip(e){return e?(e=El,e):El}function Fp(e,t,l,o,u,f){u=Ip(u),o.context===null?o.context=u:o.pendingContext=u,o=di(t),o.payload={element:l},f=f===void 0?null:f,f!==null&&(o.callback=f),l=fi(e,o,t),l!==null&&(Ut(l,e,t),Ha(l,e,t))}function Gp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Ou(e,t){Gp(e,t),(e=e.alternate)&&Gp(e,t)}function Yp(e){if(e.tag===13||e.tag===31){var t=Fi(e,67108864);t!==null&&Ut(t,e,67108864),Ou(e,67108864)}}function Pp(e){if(e.tag===13||e.tag===31){var t=Xt();t=Nr(t);var l=Fi(e,t);l!==null&&Ut(l,e,t),Ou(e,t)}}var Go=!0;function Ex(e,t,l,o){var u=z.T;z.T=null;var f=J.p;try{J.p=2,Du(e,t,l,o)}finally{J.p=f,z.T=u}}function kx(e,t,l,o){var u=z.T;z.T=null;var f=J.p;try{J.p=8,Du(e,t,l,o)}finally{J.p=f,z.T=u}}function Du(e,t,l,o){if(Go){var u=zu(o);if(u===null)wu(e,t,o,Yo,l),Vp(e,o);else if(_x(u,e,t,l,o))o.stopPropagation();else if(Vp(e,o),t&4&&-1<Nx.indexOf(e)){for(;u!==null;){var f=gl(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var b=Ln(f.pendingLanes);if(b!==0){var M=f;for(M.pendingLanes|=2,M.entangledLanes|=2;b;){var L=1<<31-kt(b);M.entanglements[1]|=L,b&=~L}Tn(f),(Fe&6)===0&&(Ao=bt()+500,Ja(0))}}break;case 31:case 13:M=Fi(f,2),M!==null&&Ut(M,f,2),ko(),Ou(f,2)}if(f=zu(o),f===null&&wu(e,t,o,Yo,l),f===u)break;u=f}u!==null&&o.stopPropagation()}else wu(e,t,o,null,l)}}function zu(e){return e=Br(e),Hu(e)}var Yo=null;function Hu(e){if(Yo=null,e=pl(e),e!==null){var t=c(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=d(t),e!==null)return e;e=null}else if(l===31){if(e=m(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Yo=e,null}function $p(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(It()){case _n:return 2;case ba:return 8;case zi:case Ls:return 32;case ya:return 268435456;default:return 32}default:return 32}}var Bu=!1,Ci=null,Ti=null,Mi=null,ss=new Map,os=new Map,Ai=[],Nx="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 Vp(e,t){switch(e){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":Ti=null;break;case"mouseover":case"mouseout":Mi=null;break;case"pointerover":case"pointerout":ss.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":os.delete(t.pointerId)}}function rs(e,t,l,o,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:l,eventSystemFlags:o,nativeEvent:f,targetContainers:[u]},t!==null&&(t=gl(t),t!==null&&Yp(t)),e):(e.eventSystemFlags|=o,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function _x(e,t,l,o,u){switch(t){case"focusin":return Ci=rs(Ci,e,t,l,o,u),!0;case"dragenter":return Ti=rs(Ti,e,t,l,o,u),!0;case"mouseover":return Mi=rs(Mi,e,t,l,o,u),!0;case"pointerover":var f=u.pointerId;return ss.set(f,rs(ss.get(f)||null,e,t,l,o,u)),!0;case"gotpointercapture":return f=u.pointerId,os.set(f,rs(os.get(f)||null,e,t,l,o,u)),!0}return!1}function qp(e){var t=pl(e.target);if(t!==null){var l=c(t);if(l!==null){if(t=l.tag,t===13){if(t=d(l),t!==null){e.blockedOn=t,rf(e.priority,function(){Pp(l)});return}}else if(t===31){if(t=m(l),t!==null){e.blockedOn=t,rf(e.priority,function(){Pp(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Po(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=zu(e.nativeEvent);if(l===null){l=e.nativeEvent;var o=new l.constructor(l.type,l);Hr=o,l.target.dispatchEvent(o),Hr=null}else return t=gl(l),t!==null&&Yp(t),e.blockedOn=l,!1;t.shift()}return!0}function Xp(e,t,l){Po(e)&&l.delete(t)}function Lx(){Bu=!1,Ci!==null&&Po(Ci)&&(Ci=null),Ti!==null&&Po(Ti)&&(Ti=null),Mi!==null&&Po(Mi)&&(Mi=null),ss.forEach(Xp),os.forEach(Xp)}function $o(e,t){e.blockedOn===t&&(e.blockedOn=null,Bu||(Bu=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Lx)))}var Vo=null;function Wp(e){Vo!==e&&(Vo=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Vo===e&&(Vo=null);for(var t=0;t<e.length;t+=3){var l=e[t],o=e[t+1],u=e[t+2];if(typeof o!="function"){if(Hu(o||l)===null)continue;break}var f=gl(l);f!==null&&(e.splice(t,3),t-=3,zc(f,{pending:!0,data:u,method:l.method,action:o},o,u))}}))}function Zl(e){function t(L){return $o(L,e)}Ci!==null&&$o(Ci,e),Ti!==null&&$o(Ti,e),Mi!==null&&$o(Mi,e),ss.forEach(t),os.forEach(t);for(var l=0;l<Ai.length;l++){var o=Ai[l];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Ai.length&&(l=Ai[0],l.blockedOn===null);)qp(l),l.blockedOn===null&&Ai.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(o=0;o<l.length;o+=3){var u=l[o],f=l[o+1],b=u[jt]||null;if(typeof f=="function")b||Wp(l);else if(b){var M=null;if(f&&f.hasAttribute("formAction")){if(u=f,b=f[jt]||null)M=b.formAction;else if(Hu(u)!==null)continue}else M=b.action;typeof M=="function"?l[o+1]=M:(l.splice(o,3),o-=3),Wp(l)}}}function Zp(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),o||setTimeout(l,20)}function l(){if(!o&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function Uu(e){this._internalRoot=e}qo.prototype.render=Uu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var l=t.current,o=Xt();Fp(l,o,e,t,null,null)},qo.prototype.unmount=Uu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),ko(),t[ml]=null}};function qo(e){this._internalRoot=e}qo.prototype.unstable_scheduleHydration=function(e){if(e){var t=of();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Ai.length&&t!==0&&t<Ai[l].priority;l++);Ai.splice(l,0,e),l===0&&qp(e)}};var Qp=n.version;if(Qp!=="19.2.8")throw Error(s(527,Qp,"19.2.8"));J.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=g(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Rx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xo.isDisabled&&Xo.supportsFiber)try{ii=Xo.inject(Rx),Mt=Xo}catch{}}return us.createRoot=function(e,t){if(!r(e))throw Error(s(299));var l=!1,o="",u=am,f=sm,b=om;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Kp(e,1,!1,null,null,l,o,null,u,f,b,Zp),e[ml]=t.current,xu(e),new Uu(t)},us.hydrateRoot=function(e,t,l){if(!r(e))throw Error(s(299));var o=!1,u="",f=am,b=sm,M=om,L=null;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(u=l.identifierPrefix),l.onUncaughtError!==void 0&&(f=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(M=l.onRecoverableError),l.formState!==void 0&&(L=l.formState)),t=Kp(e,1,!0,t,l??null,o,u,L,f,b,M,Zp),t.context=Ip(null),l=t.current,o=Xt(),o=Nr(o),u=di(o),u.callback=null,fi(l,u,o),l=o,t.current.lanes=l,va(t,l),Tn(t),e[ml]=t.current,xu(e),new qo(t)},us.version="19.2.8",us}var lg;function Gx(){if(lg)return Iu.exports;lg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),Iu.exports=Fx(),Iu.exports}var Yx=Gx();const Px=Ab(Yx),Kt="/ws/client",kb={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:"Interface language",settingsTitle:"Terminal settings",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionSettings:"cfg"},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",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",controlActive:"Full Control",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedWindows:"{count} windows",modeLabel:"Input mode",controlHint:"Keys, paste and clicks go to the terminal",observerHint:"Watch only: input is held back, scrolling still works",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version",chipOutdated:"↑ update herdr-remote",toastOutdated:"{host} runs an old herdr-remote; please update it",thisHost:"this workstation",outdatedVersion:"too old to tell",outdated:"This workstation runs a herdr-remote too old to report its version or check for updates, and it lacks recent features and fixes. On the workstation, run:",windowsStop:"On Windows, first stop the running herdr-remote in PowerShell:"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 10 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{addTitle:"Add Herdr Instance",addSubtitle:"A pairing code is all it takes",advancedTitle:"Advanced",advancedHint:"another relay, or a device token",pairAndConnect:"Pair & Connect",credentialsRequired:"Enter a pairing code or device token.",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A2B3C4",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",wsUrlLabel:"Relay WebSocket Endpoint URL"},settings:{title:"Terminal Preferences",subtitle:"Interface, font, input and alerts",subtitleInstance:"Only for {name}",tabGeneral:"General",sectionInterface:"Interface",sectionFont:"Font",sectionInput:"Input",sectionAdmin:"Administration",toggleOn:"On",toggleOff:"Off",hostFontLabel:"Workstation font",adminEntry:"Relay dashboard",adminEntryHint:"Hosts, devices and traffic; needs the admin token",adminEntryOpen:"Open",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeHint:"This window only",fontSizeLabel:"Terminal Text Size ({size}px)",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Show typing before the echo returns on slow links",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Modifier and arrow keys",touchKeyboardTrigger:"Touch Keyboard",touchKeyboardTriggerTap:"Tap Input",touchKeyboardTriggerButton:"Floating Button",touchKeyboardTriggerDesc:"Tap Input opens the keyboard from the input line; Floating Button shows a keyboard button there instead",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count waiting and finished agents in the tab title",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent waits or finishes (page on screen)",agentAlertSound:"Chime",agentAlertSoundDesc:"In the background; works after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"In the background (HTTPS only)",languageLabel:"Language",languageHint:"Shared by every instance",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",listGroup:"{profile} shortcuts",genericGroup:"General",profileRowLabel:"Agent to edit",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown); base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",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",comboPickerTitle:"Choose shortcut",comboPickerHint:"Select modifiers, then choose a key. Add more keys to create a sequence.",comboPickerSelection:"Shortcut",comboPickerModifiers:"Modifiers for the next key",comboPickerKeyboard:"Virtual keyboard",comboPickerEmpty:"Select a key or modifier to start.",comboPickerClear:"Clear",comboPickerRemoveStep:"Remove step {step}",comboPickerApply:"Use shortcut",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",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",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",uploadFile:"Upload File",uploadFileTitle:"Select any file (up to 3 MB) and paste its path on the host",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",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",showKeyboard:"Show keyboard",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control",newAdminTerminal:"Open an administrator PowerShell tab in Herdr",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:"Ctrl modifier (tap to toggle, long-press to combine)",alt:"Alt modifier (tap to toggle, long-press to combine)",shift:"Shift modifier (tap to toggle, long-press to combine)",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{returnToTerminal:"Return to Terminal",terminalShells:"terminal sessions",startedAt:"Started at {time}",acrossWindows:"across {count} windows",perSecond:"{value}/s",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto refresh",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic ↓in / ↑out",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal",relJustNow:"just now",relMinutes:"{count}m ago",relHours:"{count}h ago",relDays:"{count}d ago",statInbound:"Inbound",statOutbound:"Outbound",statTotal:"{value} total",hostsOfflineSub:"{count} more offline",colHost:"Host",colStatus:"Status",deviceWindows:"{count} windows open",hostPtys:"{count} PTY",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote too old",relayAdminPrompt:"Enter RELAY_ADMIN_TOKEN to see this relay's hosts, devices and traffic."},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:"This window is in viewer mode. Switch to Full control to type.",clientIdCopied:"Client ID copied: {id}",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image or file exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image or file on host.",paste_file_host_outdated:"The workstation is too old to receive files. Update herdr-remote there.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready.",admin_broker_unavailable:"The administrator terminal broker is not running. On the Windows host, open the herdr-remote TUI, go to Keep-alive, and choose Set up admin terminal access, then tap Admin again.",admin_terminal_unsupported:"This relay or Windows host connector cannot open administrator terminals. Upgrade both, then try again.",admin_tab_failed:"Could not open the administrator tab in Herdr. The host connector log has the details.",herdr_elevated:"Herdr on this workstation runs as administrator and turns herdr-remote away. Start Herdr from an ordinary terminal, or set allow_unelevated_clients = true under [server] in its config.toml and restart its server."},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.",fileTooLarge:"File exceeds the 3 MB upload limit.",fileReadFailed:"Failed to read the file.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},$x={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"界面语言",settingsTitle:"终端设置",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionSettings:"设置"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",controlActive:"控制端",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedWindows:"{count} 个窗口",modeLabel:"输入模式",controlHint:"按键、粘贴和点击都会发送到终端",observerHint:"只看不动:输入被拦下,仍可滚动",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本",chipOutdated:"↑ 升级 herdr-remote",toastOutdated:"{host} 的 herdr-remote 版本过旧,请升级",thisHost:"这台宿主机",outdatedVersion:"过旧,无法获知版本",outdated:"这台宿主机的 herdr-remote 太旧,不会报告版本,也不会检查更新,还缺少近期的功能和修复。在宿主机上执行:",windowsStop:"Windows 上先在 PowerShell 里结束正在运行的 herdr-remote:"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 10 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{addTitle:"添加 Herdr 实例",addSubtitle:"只需输入配对码",advancedTitle:"高级选项",advancedHint:"其他 Relay 或已有设备 Token",pairAndConnect:"配对并连接",credentialsRequired:"请输入配对码或设备令牌。",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A2B3C4",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",wsUrlLabel:"Relay WebSocket 端点"},settings:{title:"终端设置",subtitle:"界面、字体、输入与提醒",subtitleInstance:"仅对 {name} 生效",tabGeneral:"通用",sectionInterface:"界面",sectionFont:"字体",sectionInput:"输入",sectionAdmin:"管理",toggleOn:"开",toggleOff:"关",hostFontLabel:"宿主机字体",adminEntry:"Relay 管理面板",adminEntryHint:"主机、设备与流量;需要管理员令牌",adminEntryOpen:"打开",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeHint:"只影响当前窗口",fontSizeLabel:"终端字号 ({size}px)",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时先显示输入,回显到达后校正",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"修饰键与方向键",touchKeyboardTrigger:"触屏弹出键盘",touchKeyboardTriggerTap:"单击输入行",touchKeyboardTriggerButton:"悬浮按钮",touchKeyboardTriggerDesc:"单击输入行直接弹出键盘;悬浮按钮则先在输入行旁显示键盘按钮,点它才弹出",touchHaptics:"触控振动反馈",touchHapticsDesc:"按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"标签页标题显示等待与完成数",agentAlertVibrate:"震动",agentAlertVibrateDesc:"等待确认或完成时(页面在前台)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放,下次点击后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时通知(仅 HTTPS)",languageLabel:"显示语言",languageHint:"所有实例共用",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",listGroup:"{profile} 快捷键",genericGroup:"通用",profileRowLabel:"编辑的智能体",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在按键栏显示的 {profile} 快捷键(已显示 {count} 个);ESC、方向键在「虚拟按键」页。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",comboPickerTitle:"选择快捷键",comboPickerHint:"先选择修饰键,再选择按键;继续选择按键可组成按键序列。",comboPickerSelection:"快捷键组合",comboPickerModifiers:"下一按键的修饰键",comboPickerKeyboard:"虚拟键盘",comboPickerEmpty:"选择按键或修饰键以开始组合。",comboPickerClear:"清空",comboPickerRemoveStep:"移除第 {step} 步",comboPickerApply:"使用此组合",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:"展开按键栏",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:"剪切",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",uploadFile:"上传文件",uploadFileTitle:"选择任意文件(不超过 3 MB),上传后把工作站上的路径填入终端",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:"终端设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",showKeyboard:"弹出键盘",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权",newAdminTerminal:"在 Herdr 中新建管理员 PowerShell 标签页",adminTerminalSetup:"请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,再使用运行 Herdr Remote 的同一账户批准一次 Windows 提权提示。",adminTerminalUpdate:"请先升级 relay 和 Windows 主机连接器,再新建管理员终端。"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"Ctrl 修饰键(点按切换,长按组合)",alt:"Alt 修饰键(点按切换,长按组合)",shift:"Shift 修饰键(点按切换,长按组合)",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{returnToTerminal:"返回终端",terminalShells:"终端会话",startedAt:"启动于 {time}",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"概览",tabClients:"客户端 ({count})",tabPtys:"PTY ({count})",tabDevices:"设备 ({count})",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接于",colTraffic:"流量 ↓入 / ↑出",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端",relJustNow:"刚刚",relMinutes:"{count} 分钟前",relHours:"{count} 小时前",relDays:"{count} 天前",statInbound:"入站流量",statOutbound:"出站流量",statTotal:"累计 {value}",hostsOfflineSub:"另有 {count} 台离线",colHost:"主机",colStatus:"状态",deviceWindows:"{count} 个窗口在线",hostPtys:"PTY {count}",hostVersion:"herdr-remote {version}",hostVersionBehind:"herdr-remote {version} → {latest}",hostVersionUnknown:"herdr-remote 过旧",relayAdminPrompt:"输入 RELAY_ADMIN_TOKEN,查看本 Relay 的主机、设备与流量。"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"本窗口处于观察者模式,切到「完全控制」才能输入",clientIdCopied:"客户端 ID 已复制: {id}",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴的图片或文件超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片或文件失败。",paste_file_host_outdated:"工作站上的 herdr-remote 版本过旧,无法接收文件,请先更新。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。",admin_broker_unavailable:"管理员终端 broker 尚未运行。请在 Windows 主机打开 herdr-remote TUI,进入「保活」并选择「设置管理员终端」,然后再点一次「管理员」。",admin_terminal_unsupported:"当前 relay 或 Windows 主机连接器不支持管理员终端。请升级两端后再试。",admin_tab_failed:"无法在 Herdr 中打开管理员标签页,详情见主机连接器日志。",herdr_elevated:"工作站上的 Herdr 以管理员身份运行,拒绝了 herdr-remote 的连接。请在普通终端中启动 Herdr,或在它的 config.toml 的 [server] 下设置 allow_unelevated_clients = true 后重启 Herdr 服务。"},fontPresets:{host:"宿主机终端字体(默认)",system:"系统等宽字体"},hostFont:{title:"宿主机终端字体",body:"{host} 的终端使用 {family}{detail}。这台设备没有安装该字体。",bodyGlyphsOnly:"{host} 的终端显示中文用 {family},这台设备没有安装该字体。",glyphs:"中文使用 {family}:先下载常用字约 2 MB,其余的字第一次出现时再补。",glyphsAll:"{family} 太大,不整包传输:先下载常用字符约 2 MB,其余字符第一次出现时再补。",detail:"({detail})",detailSeparator:",",download:"加载 {count} 个字体文件,共 {size}。只下载一次,之后保存在本浏览器。",load:"加载字体",decline:"使用本机字体",loading:"正在加载 {received} / {total}",failed:"字体加载失败:{reason}",loaded:"宿主机字体已加载",reasons:{host_font_unavailable:"宿主机上的字体已变化,请在设置里重新同步",host_font_timeout:"宿主机没有响应",disconnected:"连接已断开",font_api_unavailable:"此浏览器不支持加载字体",other:"浏览器无法解析该字体文件"}},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",fileTooLarge:"文件超过 3 MB 上传上限。",fileReadFailed:"读取文件失败。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},Yu={en:kb,zh:$x};function Dd(i,n,a){const s=Yu[i]||Yu.en,r=n.split(".");let c=s;for(const d of r)if(c&&typeof c=="object"&&d in c)c=c[d];else{let m=Yu.en;for(const p of r)if(m&&typeof m=="object"&&p in m)m=m[p];else return n;c=m;break}if(typeof c!="string")return n;if(a){let d=c;for(const[m,p]of Object.entries(a))d=d.replaceAll(`{${m}}`,String(p));return d}return c}function Pu(i){return typeof i=="string"&&Object.hasOwn(kb.serverErrors,i)}const de={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~"},Vx=new TextEncoder;function zd(i){return Vx.encode(i)}function Hd(i){if(!i||i.length===0)return"";const a=i.toUpperCase().charCodeAt(0);return a>=65&&a<=90?String.fromCharCode(a-64):i==="@"||i===" "?"\0":i==="["?"\x1B":i==="\\"?"":i==="]"?"":i==="^"?"":i==="_"?"":i==="?"?"":i}function qx(i){return`\x1B${i}`}function ag({ctrl:i,alt:n,shift:a}){return 1+(a?1:0)+(n?2:0)+(i?4:0)}const Nb=/^\x1b[[O]([ABCDHF])$/,_b=/^\x1bO([PQRS])$/,Lb=/^\x1b\[(\d+)~$/;function rr(i,n){const{ctrl:a=!1,alt:s=!1,shift:r=!1}=n;if(!a&&!s&&!r)return i;const c=ag(n),d=s&&!a&&!r,m=Nb.exec(i);if(m)return`\x1B[1;${c}${m[1]}`;const p=_b.exec(i);if(p)return`\x1B[1;${c}${p[1]}`;const g=Lb.exec(i);if(g)return`\x1B[${g[1]};${c}~`;switch(i){case de.TAB:return r&&!a&&!s?de.SHIFT_TAB:d?`\x1B${i}`:`\x1B[9;${c}u`;case de.SHIFT_TAB:return!a&&!s?i:`\x1B[9;${ag({...n,shift:!0})}u`;case de.ENTER:return d?`\x1B${i}`:`\x1B[13;${c}u`;case de.BACKSPACE:return a&&!s&&!r?"\b":d?`\x1B${i}`:`\x1B[127;${c}u`;case de.ESC:return d?`\x1B${i}`:`\x1B[27;${c}u`}let y=i;return r&&i.length===1&&!a&&(y=i.toUpperCase()),a&&(y=Hd(y)),s&&(y=qx(y)),y}function Xx(i){return[...i].length===1?!0:Nb.test(i)||_b.test(i)||Lb.test(i)||i===de.SHIFT_TAB}class bn extends Error{constructor(a,s={}){super(a);V(this,"code");V(this,"params");this.name="KeyComboError",this.code=a,this.params=s}}const Wx={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},sg={esc:de.ESC,tab:de.TAB,enter:de.ENTER,backspace:de.BACKSPACE,delete:de.DELETE,left:de.LEFT,right:de.RIGHT,up:de.UP,down:de.DOWN,home:de.HOME,end:de.END,pageup:de.PAGE_UP,pagedown:de.PAGE_DOWN,insert:de.INSERT,space:" ","+":"+"},Zx={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Qx={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function Rb(i,n){const a=i.toLowerCase().split("+");if(a.some(p=>!p))throw new bn("invalidStepSyntax",{step:n+1});const s={};let r;for(const p of a)if(p==="ctrl"||p==="control"){if(s.ctrl)throw new bn("duplicateModifier",{step:n+1,modifier:"Ctrl"});s.ctrl=!0}else if(p==="alt"||p==="option"){if(s.alt)throw new bn("duplicateModifier",{step:n+1,modifier:"Alt"});s.alt=!0}else if(p==="shift"){if(s.shift)throw new bn("duplicateModifier",{step:n+1,modifier:"Shift"});s.shift=!0}else if(r===void 0)r=p;else throw new bn("multipleKeys",{step:n+1});if(!r)throw new bn("missingKey",{step:n+1});const c=Wx[r]||r,d=/^f(?:[1-9]|1[0-2])$/.exec(c);let m;if(d)m=de[c.toUpperCase()];else if(Object.hasOwn(sg,c))m=sg[c];else if([...c].length===1&&/^[\x21-\x7e]$/.test(c))m=c;else throw new bn("unsupportedKey",{step:n+1,key:c});return{key:m,keyName:c,modifiers:s,sequence:ew(m,c,s)}}function Jx(i){return 1+(i.shift?1:0)+(i.alt?2:0)+(i.ctrl?4:0)}function og(i,n){const a=[...i][0].codePointAt(0);return a===void 0?"":`\x1B[${a};${Jx(n)}u`}function ew(i,n,a){if(!a.ctrl)return rr(i,a);if(n.length===1&&/^[\x20-\x7e]$/.test(n)){const s=n.toLowerCase();if(a.alt||a.shift||s==="m"||s==="i")return og(s,a);if(s==="-"||s==="/"||s==="_")return"";const r=Hd(s);return r!==s?r:og(s,a)}return rr(i,a)}function un(i){if(typeof i!="string"||!i.trim())throw new bn("empty");const n=i.trim().split(/\s+/);if(n.length>8)throw new bn("tooManySteps",{count:8});return n.map((a,s)=>Rb(a,s).sequence)}function la(i){const n=i.trim().split(/\s+/);return n.length>1&&n.every(a=>["esc","escape"].includes(a.toLowerCase()))?`ESC${Qx[n.length]||` ×${n.length}`}`:n.map((a,s)=>{const{keyName:r,modifiers:c}=Rb(a,s),d=Zx[r]||(/^f\d+$/.test(r),r.toUpperCase());return c.ctrl&&c.alt&&c.shift?`Ctrl+Alt+⇧${d}`:c.ctrl&&c.alt?`Ctrl+Alt+${d}`:c.ctrl&&c.shift?`^⇧${d}`:c.ctrl?`^${d}`:c.alt&&c.shift?`Alt+⇧${d}`:c.alt?`Alt+${d}`:c.shift?`⇧${d}`:d}).join(" ")}const H=(i,n,a,s=!0)=>({id:i,labelKey:n,combo:a,verified:s}),jb={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[H("mode","mode","shift+tab"),H("rewind","rewind","esc esc"),H("details","details","ctrl+o"),H("model","model","alt+p"),H("thinking","thinking","alt+t"),H("todos","todos","ctrl+t"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("stash","stash","ctrl+s"),H("pasteImage","pasteImage","ctrl+v"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[H("mode","mode","shift+tab"),H("editPrevious","editPrevious","esc esc"),H("details","details","ctrl+t"),H("queue","queue","tab"),H("history","history","ctrl+r"),H("copy","copy","ctrl+o"),H("editor","editor","ctrl+g"),H("newline","newline","ctrl+j"),H("clear","clear","ctrl+l"),H("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[H("mode","mode","shift+tab"),H("yolo","yolo","ctrl+y"),H("rewind","rewind","esc esc"),H("todos","todos","ctrl+t"),H("expand","expand","ctrl+o"),H("background","background","ctrl+b"),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("undo","undo","ctrl+z"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("history","history","ctrl+r"),H("newline","newline","ctrl+j"),H("todos","todos","ctrl+t",!1),H("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[H("agent","agent","tab"),H("agentBack","agentBack","shift+tab"),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[H("agent","agent","tab",!1),H("agentBack","agentBack","shift+tab",!1),H("interrupt","interrupt","esc"),H("palette","palette","ctrl+p"),H("model","model","ctrl+x m"),H("recentModel","recentModel","f2"),H("variant","variant","ctrl+t"),H("newSession","newSession","ctrl+x n"),H("sessions","sessions","ctrl+x l"),H("undo","undo","ctrl+x u"),H("editor","editor","ctrl+x e"),H("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("interrupt","interrupt","esc"),H("nextModel","nextModel","ctrl+p"),H("modelPicker","modelPicker","ctrl+l"),H("tools","tools","ctrl+o"),H("thinkingBlocks","thinkingBlocks","ctrl+t"),H("editor","editor","ctrl+g"),H("followup","followup","alt+enter"),H("dequeue","dequeue","alt+up"),H("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[H("thinkingMode","thinkingMode","shift+tab"),H("plan","plan","alt+shift+p"),H("model","model","alt+m"),H("temporaryModel","temporaryModel","alt+p"),H("nextModel","nextModel","ctrl+p"),H("tools","tools","ctrl+o"),H("thinking","thinking","ctrl+t"),H("history","history","ctrl+r"),H("editor","editor","ctrl+g"),H("followup","followup","ctrl+enter"),H("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","esc"),H("expand","expand","ctrl+o"),H("expandAll","expandAll","ctrl+e"),H("reasoning","reasoning","ctrl+t"),H("editor","editor","ctrl+g"),H("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[H("mode","mode","shift+tab"),H("review","review","ctrl+r"),H("newline","newline","ctrl+j"),H("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[H("specMode","specMode","shift+tab"),H("autonomy","autonomy","ctrl+l"),H("details","details","ctrl+o",!1),H("queue","queue","ctrl+enter"),H("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[H("plan","plan","shift+tab"),H("interrupt","interrupt","esc"),H("undoPicker","undoPicker","esc esc"),H("expand","expand","ctrl+o"),H("editor","editor","ctrl+g"),H("steer","steer","ctrl+s"),H("undo","undo","ctrl+-"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[H("palette","palette","ctrl+o"),H("reasoning","reasoning","alt+d"),H("mode","mode","ctrl+s",!1),H("editor","editor","ctrl+g"),H("history","history","ctrl+r"),H("sidebar","sidebar","ctrl+backslash"),H("pasteImage","pasteImage","ctrl+v"),H("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[H("interrupt","interrupt","ctrl+c"),H("newline","newline","ctrl+j"),H("editor","editor","ctrl+g"),H("agents","agents","ctrl+t"),H("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[H("permissionMode","permissionMode","shift+tab"),H("bypass","bypass","ctrl+y"),H("tasks","tasks","ctrl+t"),H("editor","editor","ctrl+x"),H("history","history","ctrl+r"),H("queue","queue","ctrl+enter"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","alt+v"),H("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","alt+t"),H("newline","newline","ctrl+j"),H("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("rewind","rewind","esc esc"),H("interject","interject","ctrl+enter"),H("multiline","multiline","ctrl+m"),H("newline","newline","alt+enter"),H("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[H("mode","mode","shift+tab"),H("interrupt","interrupt","ctrl+c"),H("background","background","ctrl+b"),H("approve","approve","ctrl+k"),H("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[H("interrupt","interrupt","ctrl+c"),H("thinking","thinking","ctrl+t"),H("expand","expand","ctrl+e"),H("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[H("permissionMode","permissionMode","shift+tab"),H("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[H("agentSwap","agentSwap","shift+tab"),H("interrupt","interrupt","esc"),H("details","details","ctrl+t"),H("steer","steer","ctrl+s"),H("expand","expand","ctrl+o"),H("activity","activity","ctrl+x"),H("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[H("planAct","planAct","tab"),H("autoApprove","autoApprove","shift+tab"),H("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[H("rewind","rewind","esc esc"),H("search","search","ctrl+f"),H("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[H("interrupt","interrupt","esc"),H("queue","queue","alt+enter"),H("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},ll=jb,tw=Object.keys(jb),rg={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 nw(i){return i&&i.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function cg(i){const n=nw(i);return rg[n]?rg[n]:/^muse-bin-\d/.test(n)?"muse":null}function iw(i,n="auto"){return n&&n!=="auto"?cg(n)||"shell":cg(i)||"shell"}const xs=[H("genericCtrlC","interrupt","ctrl+c"),H("genericCtrlD","eof","ctrl+d"),H("genericCtrlZ","suspend","ctrl+z"),H("genericCtrlL","clear","ctrl+l"),H("genericCtrlR","history","ctrl+r"),H("genericCtrlA","startOfLine","ctrl+a"),H("genericCtrlE","endOfLine","ctrl+e"),H("genericCtrlK","killToEnd","ctrl+k")],ug=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],lw=["genericCtrlC"],aw=xs.filter(({id:i})=>i!=="genericCtrlD"&&i!=="genericCtrlZ"),sw=xs.filter(({id:i})=>i==="genericCtrlC"||i==="genericCtrlZ").map(i=>i.id==="genericCtrlZ"?{...i,labelKey:"eof"}:i),ow={posix:xs,"git-bash":xs,cmd:sw,powershell:aw},rw={posix:ug,"git-bash":ug,cmd:["genericCtrlC","genericCtrlZ"],powershell:["genericCtrlC","genericCtrlL","genericCtrlR"]};function cw(i,n){var r,c;const a=i.map(d=>{var g;const m=(g=n==null?void 0:n.actions)==null?void 0:g[d.id];let p=typeof(m==null?void 0:m.keys)=="string"?m.keys:d.combo;try{un(p)}catch{p=d.combo}return{...d,defaultCombo:d.combo,combo:p,hidden:typeof(m==null?void 0:m.hidden)=="boolean"?m.hidden:d.defaultHidden===!0,custom:!1}}),s=new Set(a.map(d=>d.id));for(const d of(n==null?void 0:n.custom)||[]){if(!d||typeof d.id!="string"||s.has(d.id))continue;const m=d.keys;try{un(m)}catch{continue}a.push({id:d.id,labelKey:"custom",defaultCombo:m,combo:m,verified:!0,hidden:((c=(r=n==null?void 0:n.actions)==null?void 0:r[d.id])==null?void 0:c.hidden)===!0,custom:!0,customLabel:d.label}),s.add(d.id)}if(Array.isArray(n==null?void 0:n.order)){const d=new Map(n.order.map((m,p)=>[m,p]));a.sort((m,p)=>(d.get(m.id)??Number.MAX_SAFE_INTEGER)-(d.get(p.id)??Number.MAX_SAFE_INTEGER))}return a}function uw(i,n){const a=new Set(i.map(s=>s.combo.trim().toLowerCase()));return n.filter(s=>!a.has(s.combo.trim().toLowerCase()))}const gs=i=>i.id.startsWith("generic");function Ob(i,n,a="posix"){const s=ll[i],r=i==="shell"?ow[a]:xs,c=new Set([...s.bar||[],...i==="shell"?rw[a]:lw]),d=[...s.actions,...r].map(m=>({...m,defaultHidden:!c.has(m.id)}));return cw(d,n)}function Db(i,n,a="posix"){const s=Ob(i,n,a),r=s.filter(d=>!gs(d)),c=new Set(uw(r,s.filter(gs)));return s.filter(d=>!gs(d)||c.has(d))}function dw(i,n,a="posix"){const s=Db(i,n,a).filter(r=>!r.hidden);return{agentActions:s.filter(r=>!gs(r)),genericActions:s.filter(gs)}}function fw(i){const n={};for(const[a,s]of Object.entries(i.actions||{})){const r={...s};delete r.hidden,Object.keys(r).length>0&&(n[a]=r)}return{...i,actions:n}}function zb(i){if(!i||typeof i!="object"||Array.isArray(i))return{};const n=Object.create(null);for(const[a,s]of Object.entries(i).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(a)||["__proto__","constructor","prototype"].includes(a)||!s||typeof s!="object"||Array.isArray(s))continue;const r=s,c={};if(Array.isArray(r.order)&&(c.order=[...new Set(r.order.filter(d=>typeof d=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(d)))].slice(0,256)),r.actions&&typeof r.actions=="object"&&!Array.isArray(r.actions)){const d=Object.create(null);for(const[m,p]of Object.entries(r.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(m)||!p||typeof p!="object"||Array.isArray(p))continue;const g=p,y={};if(typeof g.keys=="string"&&g.keys.trim()){const v=g.keys.trim().slice(0,80);try{un(v),y.keys=v}catch{}}typeof g.hidden=="boolean"&&(y.hidden=g.hidden),Object.keys(y).length>0&&(d[m]=y)}c.actions=d}if(Array.isArray(r.custom)){const d=new Set;c.custom=r.custom.slice(0,64).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const p=m;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||d.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const g=p.keys.trim().slice(0,80);try{un(g)}catch{return[]}return d.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:g}]})}n[a]=c}return n}const hw=10,mw=24,ws=15,cr=13,Bd=640;function pw(){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 ca()<Bd}function ca(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function gd(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function ua(i,n=ws){const a=typeof i=="number"?i:Number(i);return!Number.isFinite(a)||a<=0?n:Math.min(mw,Math.max(hw,Math.round(a)))}function dg(i,n=ca()){if(n<Bd){const s=ua(i,cr);return Math.min(15,Math.max(12,s))}return ua(i,ws)}const gw=new Set(["http:","https:","mailto:"]),$u=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,bw=/[.,;:!?'"]+$/,fg=8;function Ud(i){return/^www\./i.test(i)?`https://${i}`:i}function yw(i){const n=(r,c)=>r.split(c).length-1;let a=i.replace(bw,"");const s=[["(",")"],["[","]"],["{","}"]];for(const[r,c]of s)for(;a.endsWith(c)&&n(a,c)>n(a,r);)a=a.slice(0,-1);return a}function Hb(i){if(typeof i!="string"||i.length===0)return!1;try{return gw.has(new URL(Ud(i)).protocol)}catch{return!1}}function vw(i,n){if(typeof i!="string"||n<0)return null;$u.lastIndex=0;for(let a=$u.exec(i);a;a=$u.exec(i)){const s=yw(a[0]);if(!s)continue;const r=a.index,c=r+s.length;if(n>=r&&n<c&&Hb(s))return s}return null}function xw(i,n,a){var m;const s=(m=i==null?void 0:i.buffer)==null?void 0:m.active;if(!s||typeof s.getLine!="function"||!s.getLine(a))return null;let r=a;for(let p=0;p<fg;p+=1){const g=s.getLine(r);if(!(g!=null&&g.isWrapped)||r===0)break;r-=1}let c="",d=-1;for(let p=r;p<r+fg;p+=1){const g=s.getLine(p);if(!g||p>r&&!g.isWrapped)break;p===a&&(d=c.length+n),c+=g.translateToString(!1)}return d<0?null:{text:c,index:d}}function ww(i,n,a){const s=xw(i,n,a);return s?vw(s.text,s.index):null}function Sw(i){try{const n=new URL(Ud(i));return n.host||n.pathname}catch{return""}}function ur(i){return!Hb(i)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Ud(i),"_blank","noopener,noreferrer"),!0)}const hg="#11111b",Kd=['"Maple Mono NF CN"','"Herdr Maple Mono"'],Cw=['"Symbols Nerd Font Mono"','"Herdr Maple Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],Id=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],bd=[{id:"host",name:"Host terminal font",faces:[]},{id:"maple-mono",name:"Maple Mono NF CN",faces:Kd},{id:"system",name:"System monospace",faces:Id},{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"']}],Bb="host",Tw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',Mw='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',Aw="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Ew={[Tw]:"host",[Mw]:"host",[Aw]:"host",'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace':"system",'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace':"system",'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace':"system",'"Courier New", Courier, "Symbols Nerd Font Mono", monospace':"system",'"Fira Code", "Symbols Nerd Font Mono", monospace':"fira-code"};function Vu(i){return typeof i!="string"||!i.trim()?Bb:Ew[i]??i}const kw=[[/^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 Nw(i){const n=kw.find(([a])=>a.test(i.trim()));return n?n[1]:null}function ds(i){return`"${i.replace(/["\\]/g,"")}"`}function dr(i){return[...new Set([...i,...Cw])].join(", ")}dr(Id);const _w=dr(Kd);function Lw(i,n){const a=typeof i=="string"?i.trim():"";if(!a||a==="host"){if(!(n!=null&&n.family))return _w;const c=[],d=n.glyphs;(d==null?void 0:d.scope)==="all"&&d.alias&&c.push(ds(d.alias)),n.alias&&c.push(ds(n.alias)),c.push(ds(n.family));const m=Nw(n.family);return m&&c.push(m),(d==null?void 0:d.scope)==="cjk"&&(d.alias&&c.push(ds(d.alias)),c.push(ds(d.family))),dr([...c,...Kd])}const s=bd.find(c=>c.id===a);if(s)return dr([...s.faces,...Id]);if(a.includes("Symbols Nerd Font"))return a;if(/^['"]?monospace['"]?$/i.test(a))return'"Symbols Nerd Font Mono", monospace';const r=/,\s*['"]?monospace['"]?\s*$/i;return r.test(a)?a.replace(r,', "Symbols Nerd Font Mono", monospace'):`${a}, "Symbols Nerd Font Mono", monospace`}function Rw(i){if(!i)return null;const n={};return i.background&&(n.background=i.background,n.cursorAccent=i.background),i.foreground&&(n.foreground=i.foreground),i.cursor&&(n.cursor=i.cursor),i.ansi&&Object.assign(n,i.ansi),Object.keys(n).length===0?null:n}function Ub(){if(typeof document>"u")return;const i=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",i==null||i.setAttribute("content",hg),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=hg}const At={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"},yd={local:{},session:{}};function Ss(i,n){if(typeof window>"u")return yd[i][n]||null;try{return(i==="local"?window.localStorage:window.sessionStorage).getItem(n)}catch{return yd[i][n]||null}}function Ri(i,n,a){if(yd[i][n]=a,!(typeof window>"u"))try{(i==="local"?window.localStorage:window.sessionStorage).setItem(n,a)}catch(s){console.warn(`Failed to write to ${i}Storage:`,s)}}const mg=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),qu=256*1024,jw=2,Ow={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function tl(i){return i?[i.family,...i.faces.map(n=>n.sha256),...(i.subsets||[]).map(n=>n.sha256)].join("|"):null}function pg(i){const n=i==null?void 0:i.faces.find(a=>a.style==="regular");return n?`Herdr Host ${n.sha256.slice(0,12)}`:null}function gg(i){return i?i.faces.reduce((n,a)=>n+a.bytes,0):0}function Xu(i){return i>=1024*1024?`${(i/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(i/1024))} KB`}function Dw(i){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 s of["serif","sans-serif"]){n.font=`72px ${s}`;const r=n.measureText(a).width;if(n.font=`72px "${i}", ${s}`,n.measureText(a).width!==r)return!0}return!1}const zw="herdr-remote-fonts",da="faces",fa="subsets",Kb=new Map,vd=new Map;function Cr(){return new Promise(i=>{if(typeof indexedDB>"u"){i(null);return}try{const n=indexedDB.open(zw,2);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(da)||n.result.createObjectStore(da),n.result.objectStoreNames.contains(fa)||n.result.createObjectStore(fa)},n.onsuccess=()=>i(n.result),n.onerror=()=>i(null),n.onblocked=()=>i(null)}catch{i(null)}})}async function Hw(i){const n=Kb.get(i);if(n)return n;const a=await Cr();return a?new Promise(s=>{try{const r=a.transaction(da,"readonly").objectStore(da).get(i);r.onsuccess=()=>{const c=r.result;s(c instanceof ArrayBuffer?c:null)},r.onerror=()=>s(null)}catch{s(null)}finally{a.close()}}):null}async function Bw(i,n){Kb.set(i,n);const a=await Cr();a&&await new Promise(s=>{try{const r=a.transaction(da,"readwrite");r.objectStore(da).put(n,i),r.oncomplete=()=>s(),r.onerror=()=>s(),r.onabort=()=>s()}catch{s()}finally{a.close()}})}async function Uw(i){const n=await Cr();return n?new Promise(a=>{try{const s=IDBKeyRange.bound(`${i}:`,`${i}:`),r=n.transaction(fa,"readonly").objectStore(fa).getAll(s);r.onsuccess=()=>{const c=Array.isArray(r.result)?r.result:[];a(c.filter(d=>d&&d.data instanceof ArrayBuffer&&Array.isArray(d.codepoints)))},r.onerror=()=>a([])}catch{a([])}finally{n.close()}}):vd.get(i)??[]}async function Kw(i,n){vd.set(i,[...vd.get(i)??[],n]);const a=await Cr();a&&await new Promise(s=>{try{const r=a.transaction(fa,"readwrite");r.objectStore(fa).put(n,`${i}:${n.subsetSha}`),r.oncomplete=()=>s(),r.onerror=()=>s(),r.onabort=()=>s()}catch{s()}finally{a.close()}})}function Wu(i){return i?`Herdr Glyphs ${i.sha256.slice(0,12)}`:null}function Iw(i){return i>=11904&&i<=12255||i>=12288&&i<=13311||i>=13312&&i<=19903||i>=19968&&i<=40959||i>=44032&&i<=55215||i>=63744&&i<=64255||i>=65072&&i<=65103||i>=65280&&i<=65519||i>=131072&&i<=201551}function Ib(i,n){return n<32||n>=127&&n<160||n>=9472&&n<=9631?!1:i==="all"||Iw(n)}function Fw(i){const n=[...new Set(i)].sort((s,r)=>s-r),a=[];for(let s=0;s<n.length;s+=1){const r=n[s];let c=r;for(;s+1<n.length&&n[s+1]===c+1;)c=n[s+1],s+=1;const d=m=>m.toString(16).toUpperCase();a.push(r===c?`U+${d(r)}`:`U+${d(r)}-${d(c)}`)}return a.join(", ")}async function Gw(i,n){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=new FontFace(i,n.data,{weight:"400",style:"normal",unicodeRange:Fw(n.codepoints)});document.fonts.add(await a.load())}const xd=new Set;function Yw(i){return!!(i&&xd.has(i))}async function Pw(i,n){if(xd.has(i))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const a=await Promise.all(n.map(({face:s,data:r})=>new FontFace(i,r,Ow[s.style]).load()));for(const s of a)document.fonts.add(s);xd.add(i)}function bg(i){const n=atob(i),a=new Uint8Array(n.length);for(let s=0;s<n.length;s+=1)a[s]=n.charCodeAt(s);return a}async function Fb(i,n,a){const s=Math.ceil(i.bytes/qu),r=new Uint8Array(i.bytes);let c=0;const d=async()=>{for(;c<s;){const m=c;c+=1;const p=await n(i.sha256,m),g=m*qu,y=Math.min(qu,i.bytes-g);if(p.length!==y)throw new Error("host_font_corrupt");r.set(p,g),a(p.length)}};return await Promise.all(Array.from({length:Math.min(jw,s)},d)),r.buffer}function Gb(){try{const i=JSON.parse(Ss("local",At.hostFontConsent)||"{}");return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function yg(i,n){const a=Gb()[i];return a&&a.fingerprint===n?a.decision:null}function vg(i,n,a){const s=Gb();s[i]={fingerprint:n,decision:a},Ri("local",At.hostFontConsent,JSON.stringify(s))}const Yb={source:null,status:"none",alias:null,covered:0},Zu={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:Yb,interactive:!1,glyphRevision:0},$w=String.fromCodePoint(...Array.from({length:95},(i,n)=>32+n),...Array.from({length:96},(i,n)=>160+n),...Array.from({length:112},(i,n)=>8192+n));function xg(i){const n=(i==null?void 0:i.subsets)??[];return n.find(a=>a.scope==="all")??n.find(a=>a.scope==="cjk")??null}function Vw(i,n){const a=new Set;for(const s of i){const r=s.codePointAt(0);Ib(n,r)&&a.add(r)}return[...a]}const wg=3e4;function qw(i){const n=T.useRef(new Map),a=T.useRef(new Map),s=T.useRef(new Map),r=T.useCallback(m=>{for(const p of[n.current,a.current]){for(const g of p.values())clearTimeout(g.timer),g.reject(new Error(m));p.clear()}},[]),c=T.useCallback((m,p)=>new Promise((g,y)=>{if(!i){y(new Error("disconnected"));return}const v=`${m}:${p}`,S=setTimeout(()=>{n.current.delete(v),y(new Error("host_font_timeout"))},wg);n.current.set(v,{resolve:g,reject:y,timer:S}),i.sendHostFontChunkRequest(m,p)}),[i]),d=T.useCallback((m,p,g)=>new Promise((y,v)=>{if(!i){v(new Error("disconnected"));return}const S=Math.random().toString(36).slice(2,12),x=setTimeout(()=>{a.current.delete(S),v(new Error("host_font_timeout"))},wg);a.current.set(S,{resolve:w=>y({...w,codepoints:p}),reject:v,timer:x}),s.current.set(S,g),i.sendHostFontSubsetRequest(m.sha256,String.fromCodePoint(...p),S)}),[i]);return T.useEffect(()=>{if(!i)return;const m=n.current,p=a.current,g=i.on("hostFontChunk",x=>{const w=`${x.sha256}:${x.index}`,C=m.get(w);if(C){m.delete(w),clearTimeout(C.timer);try{C.resolve(bg(x.dataBase64))}catch{C.reject(new Error("host_font_corrupt"))}}}),y=i.on("hostFontSubset",x=>{const w=p.get(x.requestId);if(!w)return;p.delete(x.requestId),clearTimeout(w.timer);const C=s.current.get(x.requestId)??(()=>{});if(s.current.delete(x.requestId),x.dataBase64!==void 0){try{const N=bg(x.dataBase64);C(N.length,N.length),w.resolve({subsetSha:x.subsetSha,data:N.buffer,codepoints:[]})}catch{w.reject(new Error("host_font_corrupt"))}return}C(0,x.bytes);const A={bytes:x.bytes,sha256:x.subsetSha};Fb(A,c,N=>C(N,x.bytes)).then(N=>w.resolve({subsetSha:x.subsetSha,data:N,codepoints:[]})).catch(N=>w.reject(N instanceof Error?N:new Error("host_font_failed")))}),v=i.on("error",x=>{(x.code==="host_font_unavailable"||x.code==="host_font_subset_failed")&&r(String(x.code))}),S=i.on("stateChange",x=>{x!=="connected"&&r("disconnected")});return()=>{g(),y(),v(),S(),r("disconnected")}},[i,r,c]),{requestChunk:c,requestSubset:d,rejectPending:r}}const Xw=15e3,Ww=80,Zw=2e3;function Qw(i,n={}){const[a,s]=T.useState(Zu),r=T.useRef(a);r.current=a;const c=T.useRef(n);c.current=n;const d=T.useRef(0),m=T.useRef(0),p=T.useRef(new Set),g=T.useRef(new Set),y=T.useRef(new Set),v=T.useRef(null),{requestChunk:S,requestSubset:x,rejectPending:w}=qw(i),C=T.useCallback(()=>({isInstalled:c.current.isInstalled??Dw,readCached:c.current.readCached??Hw,writeCached:c.current.writeCached??Bw,register:c.current.register??Pw,isRegistered:c.current.isRegistered??Yw,readSubsets:c.current.readSubsets??Uw,writeSubset:c.current.writeSubset??Kw,registerGlyphs:c.current.registerGlyphs??Gw}),[]),A=T.useCallback(()=>(i==null?void 0:i.getHostId())||"default",[i]),N=T.useCallback((R,I)=>{R===d.current&&s(Q=>({...Q,glyphs:{...Q.glyphs,...I}}))},[]),E=T.useCallback(async(R,I,Q)=>{const{registerGlyphs:X}=C();for(const ne of Q){if(await X(I,ne),R!==d.current)return;for(const oe of ne.codepoints)p.current.add(oe)}R!==d.current||!Q.length||s(ne=>({...ne,glyphs:{...ne.glyphs,alias:I,covered:p.current.size},glyphRevision:ne.glyphRevision+1}))},[C]),_=T.useCallback(async(R,I,Q)=>{const X=Wu(I),ne=I.scope==="all"?$w+mg:mg,oe=Vw(ne,I.scope).filter(z=>!p.current.has(z));if(!oe.length)return;for(const z of oe)g.current.add(z);const ce=await x(I,oe,Q);R===d.current&&(await C().writeSubset(I.sha256,ce),await E(R,X,[ce]))},[x,C,E]),D=T.useCallback(async(R,{interactive:I=!0}={})=>{const Q=R??r.current.font,X=tl(Q);if(!Q||!X)return;const ne=r.current,oe=tl(ne.font)===X;if(oe&&(ne.status==="loading"||ne.glyphs.status==="loading"))return;const ce=d.current,{isInstalled:z,isRegistered:J,readCached:K,writeCached:ae,register:$}=C();vg(A(),X,"accepted");const ue=pg(Q),xe=xg(Q),fe=!!(ue&&!J(ue)&&!z(Q.family)),te=oe?ne.glyphs:{...Yb,source:xe},le=!!(xe&&!["installed","ready","none"].includes(te.status));let he=fe?gg(Q):0,re=0;const pe=()=>{ce===d.current&&s(se=>({...se,receivedBytes:re,totalBytes:he}))};if(s(se=>({...se,font:Q,interactive:I,receivedBytes:0,totalBytes:he,error:null,status:fe?"loading":se.status,glyphs:le?{...te,status:"loading"}:te})),fe&&ue)try{const se=[];for(const Se of Q.faces){let Ae=await K(Se.sha256);if(Ae?(re+=Se.bytes,pe()):(Ae=await Fb(Se,S,Be=>{re+=Be,pe()}),await ae(Se.sha256,Ae)),ce!==d.current)return;se.push({face:Se,data:Ae})}if(await $(ue,se),ce!==d.current)return;s(Se=>({...Se,status:"loaded",alias:ue}))}catch(se){if(ce!==d.current)return;const Se=se instanceof Error&&se.message?se.message:"host_font_failed";s(Ae=>({...Ae,status:"failed",alias:null,error:Se}))}if(le&&xe){let se=0;try{await _(ce,xe,(Se,Ae)=>{Ae&&!se&&(se=Ae,he+=Ae),re+=Se,pe()}),N(ce,{status:"ready"})}catch(Se){if(ce!==d.current)return;const Ae=Se instanceof Error&&Se.message?Se.message:"host_font_failed";s(Be=>({...Be,error:Be.error??Ae,glyphs:{...Be.glyphs,status:"failed"}}))}}},[S,_,C,A,N]),P=T.useCallback(async R=>{const I=tl(R)!==tl(r.current.font);I&&(w("superseded"),p.current=new Set,g.current=new Set,y.current=new Set);const Q=++d.current;if(!R){s(Zu);return}const{isInstalled:X,readCached:ne,register:oe,isRegistered:ce,readSubsets:z}=C(),J=pg(R),K=tl(R),ae=xg(R);let $="checking";J&&ce(J)?$="loaded":X(R.family)?$="installed":J||($="unavailable");let ue="checking";if(ae?(ae.scope==="cjk"?X(ae.family):$==="installed")&&(ue="installed"):ue="none",s(le=>({...Zu,font:R,status:$==="checking"?"checking":$,alias:$==="loaded"?J:null,totalBytes:gg(R),glyphs:{source:ae,status:ue,alias:I?null:le.glyphs.alias,covered:p.current.size},glyphRevision:le.glyphRevision})),$==="checking"&&J){const le=await Promise.all(R.faces.map(he=>ne(he.sha256)));if(Q!==d.current)return;if($="needs",le.every(Boolean))try{if(await oe(J,R.faces.map((he,re)=>({face:he,data:le[re]}))),Q!==d.current)return;$="loaded",s(he=>({...he,status:"loaded",alias:J}))}catch{}}if(ue==="checking"&&ae){const le=await z(ae.sha256);if(Q!==d.current)return;if(le.length)try{await E(Q,Wu(ae),le),ue="cached"}catch{ue="needs"}else ue="needs";if(Q!==d.current)return}const xe=yg(A(),K),fe=xe==="accepted"||ue==="cached"||Date.now()<m.current;if(ue==="cached"&&(ue="ready",N(Q,{status:"ready"}),_(Q,ae,()=>{}).catch(()=>{})),$!=="needs"&&ue!=="needs")return;if(fe){D(R,{interactive:!1});return}const te=xe==="declined"?"declined":"available";s(le=>({...le,status:$==="needs"?te:le.status,glyphs:ue==="needs"?{...le.glyphs,status:te}:le.glyphs}))},[D,w,A,N,_,C,E]),B=T.useCallback(()=>{const R=tl(r.current.font);R&&vg(A(),R,"declined"),s(I=>({...I,interactive:!1,status:["available","failed"].includes(I.status)?"declined":I.status,glyphs:["available","failed"].includes(I.glyphs.status)?{...I.glyphs,status:"declined"}:I.glyphs}))},[A]),O=T.useCallback(()=>{m.current=Date.now()+Xw,i==null||i.sendHostFontRefresh();const R=r.current,I=["available","declined","failed"];R.font&&(I.includes(R.status)||I.includes(R.glyphs.status))&&D(R.font,{interactive:!1})},[i,D]),k=T.useCallback(R=>{const{glyphs:I}=r.current;if(I.status!=="ready"||!I.source)return;const Q=I.source;for(const X of R){const ne=X.codePointAt(0);ne<128&&Q.scope!=="all"||Ib(Q.scope,ne)&&(p.current.has(ne)||g.current.has(ne)||y.current.add(ne))}!y.current.size||v.current||(v.current=setTimeout(()=>{v.current=null;const X=d.current,ne=[...y.current].slice(0,Zw);for(const oe of ne)y.current.delete(oe),g.current.add(oe);(async()=>{const oe=await x(Q,ne,()=>{});X===d.current&&(await C().writeSubset(Q.sha256,oe),await E(X,Wu(Q),[oe]))})().catch(()=>{})},Ww))},[x,C,E]);return T.useEffect(()=>{if(!i)return;const R=i.on("terminalFont",I=>{P(I)});return()=>{R(),v.current&&clearTimeout(v.current),v.current=null}},[i,P]),T.useEffect(()=>{const R=I=>{if(I.key!==At.hostFontConsent)return;const Q=r.current,X=tl(Q.font),ne=Q.status==="available"||Q.glyphs.status==="available";if(!X||!ne)return;const oe=yg(A(),X);oe==="accepted"?D(Q.font,{interactive:!1}):oe==="declined"&&B()};return window.addEventListener("storage",R),()=>window.removeEventListener("storage",R)},[D,B,A]),{hostFont:a,loadHostFont:D,declineHostFont:B,syncHostFont:O,ensureHostGlyphs:k}}function Jw(i,n=window,a=document){const s=g=>{var y;((y=n.navigator)==null?void 0:y.onLine)!==!1&&i.wake(g)},r=()=>{a.visibilityState==="visible"&&s("visible")},c=()=>s("pageshow"),d=()=>s("online"),m=()=>s("focus"),p=()=>s("resume");return a.addEventListener("visibilitychange",r),a.addEventListener("resume",p),n.addEventListener("pageshow",c),n.addEventListener("online",d),n.addEventListener("focus",m),()=>{a.removeEventListener("visibilitychange",r),a.removeEventListener("resume",p),n.removeEventListener("pageshow",c),n.removeEventListener("online",d),n.removeEventListener("focus",m)}}function Wo(i){return{wsUrl:i.wsUrl,token:i.token||void 0,pairCode:i.pairCode||void 0,clientId:i.clientId,autoReconnect:i.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}function Sg(i,n){return n||(i==="win32"?"powershell":"posix")}function e1(i,n){if(n!=="win32")return n?"posix":null;for(const a of i.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}const t1={connectionState:"disconnected",role:"viewer",shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1,terminalResetVersion:0,agentStatus:null,lastPairedAt:null},Cg={role:"viewer",controllerId:void 0,hostname:void 0,platform:void 0,adminTerminalSupported:void 0,hostVersion:void 0,herdrPrefixKeys:void 0,shellProfile:"posix",hostPalette:null,rttMs:null,sharedWindowCount:1};function n1(i,n){switch(n.type){case"stateChange":return{...i,connectionState:n.state,stateCode:n.code,stateDetail:n.detail,agentStatus:n.state==="connected"?i.agentStatus:null};case"ready":{const{message:a}=n;return{...i,terminalResetVersion:i.terminalResetVersion+(n.resetTerminal?1:0),role:a.role,controllerId:a.controllerId,hostId:a.hostId,hostname:a.hostname,platform:a.platform,adminTerminalSupported:a.adminTerminalSupported,hostVersion:a.hostVersion,herdrPrefixKeys:a.herdrPrefixKeys,shellProfile:Sg(a.platform,a.shellProfile),assignedClientId:a.clientId||i.assignedClientId,hostPalette:a.terminalPalette||null}}case"hostReconnecting":return{...i,...Cg,stateCode:n.code,stateDetail:n.detail};case"sessionRestarted":return{...i,hostname:n.hostname,platform:n.platform,adminTerminalSupported:n.adminTerminalSupported,hostVersion:n.hostVersion,herdrPrefixKeys:n.herdrPrefixKeys,shellProfile:Sg(n.platform,n.shellProfile),hostPalette:n.palette||null,terminalResetVersion:i.terminalResetVersion+1};case"roleChange":return{...i,role:n.role,controllerId:n.controllerId,hostId:n.hostId||i.hostId,assignedClientId:n.assignedClientId||i.assignedClientId};case"controlGranted":return{...i,role:"controller"};case"paired":return{...i,lastPairedAt:n.at};case"rtt":return{...i,rttMs:n.rttMs};case"peerCount":return{...i,sharedWindowCount:Math.max(1,n.count)};case"sessionReady":return{...i,connectionState:"connected"};case"agentStatus":return{...i,agentStatus:n.status};case"shellProfile":return i.shellProfile===n.profile?i:{...i,shellProfile:n.profile};case"reset":return{...i,...Cg,hostId:void 0,platform:void 0,assignedClientId:void 0,terminalResetVersion:i.terminalResetVersion+(n.resetTerminal?1:0)}}}const i1=3e4;function l1(i,n){const[a,s]=T.useState(null),r=T.useRef(null),c=T.useRef(null),d=T.useCallback(y=>{(y==null?void 0:y.phase)!=="starting"&&c.current&&(clearTimeout(c.current),c.current=null),r.current=y,s(y)},[]),m=T.useCallback(()=>{const y=i.current;y&&(d({phase:"starting"}),y.sendHerdrStart(),c.current=setTimeout(()=>{var v;c.current=null,((v=r.current)==null?void 0:v.phase)==="starting"&&d({phase:"failed",message:n.current("herdrLaunch.timeout")})},i1))},[i,n,d]),p=T.useCallback(y=>{var v;return y.code==="herdr_not_running"?(((v=r.current)==null?void 0:v.phase)!=="starting"&&d({phase:"stopped"}),!0):y.code==="herdr_start_failed"&&r.current?(d({phase:"failed",message:y.message||""}),!0):!1},[d]),g=T.useCallback(()=>d(null),[d]);return T.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),{herdrLaunch:a,startHerdr:m,handleLaunchError:p,forgetHerdrLaunch:g}}class a1{constructor(){V(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,openLink: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(r=>{try{r(...a)}catch(c){console.error(`Error in event listener for ${n}:`,c)}})}}const Pb=27,$b=91,s1=60,Tg=59,Vb=77,qb=48,o1=57,r1=64,c1=-30,Qu=32,Mg=255;function Xb(i){return Number.isInteger(i)&&(i&c1)===r1}function u1(i){return i>=qb&&i<=o1}function Ju(i,n){let a=n,s=0;for(;a<i.length&&u1(i[a]);){if(s=s*10+(i[a]-qb),s>65535)return null;a+=1}return a===n?null:{value:s,next:a}}function d1(i,n){if(i[n]!==Pb||i[n+1]!==$b||i[n+2]!==s1)return-1;const a=Ju(i,n+3);if(!a||!Xb(a.value)||i[a.next]!==Tg)return-1;const s=Ju(i,a.next+1);if(!s||i[s.next]!==Tg)return-1;const r=Ju(i,s.next+1);return!r||i[r.next]!==Vb?-1:r.next+1}function f1(i,n){if(i[n]!==Pb||i[n+1]!==$b||i[n+2]!==Vb||n+6>i.length)return-1;const a=i[n+3]-Qu,s=i[n+4],r=i[n+5];return!Xb(a)||s<Qu||s>Mg||r<Qu||r>Mg?-1:n+6}function fr(i){if(!i)return!1;const n=i instanceof Uint8Array?i:new Uint8Array(i);if(n.length===0)return!1;let a=0;for(;a<n.length;){const s=d1(n,a);if(s>a){a=s;continue}const r=f1(n,a);if(r>a){a=r;continue}return!1}return!0}class h1{constructor(n){V(this,"segments",[]);V(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(r=>!fr(r))),n.length===0)return;let s;if(n.length===1)s=n[0];else{let r=0;for(let d=0;d<n.length;d++)r+=n[d].byteLength;s=new Uint8Array(r);let c=0;for(let d=0;d<n.length;d++)s.set(n[d],c),c+=n[d].byteLength}a&&a.readyState===WebSocket.OPEN&&a.send(s)}clear(){this.segments=[],this.flushScheduled=!1}}const m1=3e3,p1=1e4,g1=1500;class b1 extends a1{constructor(a){super();V(this,"ws",null);V(this,"config");V(this,"state","disconnected");V(this,"reconnectAttempts",0);V(this,"reconnectTimer",null);V(this,"pingTimer",null);V(this,"pingTimestamp",null);V(this,"lastInboundAt",0);V(this,"pingSentAt",null);V(this,"connectStartedAt",0);V(this,"lastWakeConnectAt",0);V(this,"probeTimer",null);V(this,"rejectedByRelay",!1);V(this,"isManuallyClosed",!1);V(this,"authFailureDetail",null);V(this,"authFailureCode",null);V(this,"temporaryFailureCode",null);V(this,"input",new h1(()=>this.ws));V(this,"terminalCols",80);V(this,"terminalRows",24);this.config={...a}}updateConfig(a){this.config={...this.config,...a}}getConfig(){return{...this.config}}getState(){return this.state}setState(a,s,r){this.state!==a&&(this.state=a,this.emit("stateChange",a,s,r))}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 s=y1(this.config.wsUrl),r=new WebSocket(s);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=c=>{this.isStaleSocket(r)||this.handleMessage(c)},r.onerror=c=>{this.isStaleSocket(r)||this.handleError(c)},r.onclose=c=>{this.isStaleSocket(r)||this.handleClose(c)}}catch(s){this.setState("error",s instanceof Error?s.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(a){return this.ws!==a}teardownSocket(a=1e3,s="Client closed the connection"){this.input.clear();const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(a,s)}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 s=Date.now(),r=this.ws;if(!r){if(s-this.lastWakeConnectAt<g1)return;this.lastWakeConnectAt=s,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){s-this.connectStartedAt>p1&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&s-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 s=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===a&&this.lastInboundAt<s&&this.dropStaleSocket("connection_stale")},m1)}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 s=JSON.parse(a.data);s.type==="pong"?this.handlePong():this.handleServerMessage(s)}catch(s){console.warn("Received unparseable text frame from server:",s)}else if(a.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(a.data));else if(typeof Blob<"u"&&a.data instanceof Blob)try{const s=await a.data.arrayBuffer();this.emit("binaryData",new Uint8Array(s))}catch(s){console.error("Failed to convert Blob to ArrayBuffer:",s)}}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,r=Math.min(3e4,Math.floor(a*1.5**(this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}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 s=zd(a);this.sendInput(s)}}function y1(i){if(/^wss?:\/\//i.test(i))return i;if(/^https?:\/\//i.test(i)){const n=new URL(i);return n.protocol=n.protocol==="https:"?"wss:":"ws:",(!n.pathname||n.pathname==="/")&&(n.pathname=Kt),n.toString()}if(typeof window<"u"&&window.location){const a=window.location.protocol==="https:"?"wss:":"ws:",s=window.location.host,r=i.startsWith("/")?i:`/${i}`;return`${a}//${s}${r}`}return"ws://127.0.0.1:8787/ws/client"}class v1 extends b1{constructor(){super(...arguments);V(this,"currentRole","viewer");V(this,"controllerId");V(this,"hostId");V(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":{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":{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,a.hostVersion,a.herdrPrefixKeys),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"open_link":{this.emit("openLink",a.url);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}}}sendHello(){const a={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(a.token=this.config.token),this.config.pairCode&&(a.pairCode=this.config.pairCode),this.sendJson(a)}claimControl(a=!1){const s={type:"claim_control",...a?{force:!0}:{}};this.sendJson(s)}releaseControl(){const a={type:"release_control"};this.sendJson(a)}sendResize(a,s){this.terminalCols=a,this.terminalRows=s;const r={type:"resize",cols:a,rows:s};this.sendJson(r)}sendPasteFile(a,s,r){this.sendJson({type:"paste_file",mime:a,dataBase64:s,...r===void 0?{}:{name:r}})}sendHostFontChunkRequest(a,s){this.sendJson({type:"host_font_chunk_request",sha256:a,index:s})}sendHostFontSubsetRequest(a,s,r){this.sendJson({type:"host_font_subset_request",sha256:a,text:s,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendAdminTabOpen(){this.sendJson({type:"admin_tab_open"})}}function x1(i,n,a){const s=T.useRef(a);if(s.current=a,!i.current){const r=new v1(n());for(const c of Object.keys(a)){const d=(...m)=>{var p,g;return(g=(p=s.current)[c])==null?void 0:g.call(p,...m)};r.on(c,d)}i.current=r}return i.current}const Wb=3*1024*1024,w1="application/octet-stream",Zb=1568,S1=[.85,.7,.55,.4],Zo={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function C1(i,n,a=Zb){if(i<=0||n<=0)return{width:Math.max(1,i),height:Math.max(1,n)};const s=Math.max(i,n);if(s<=a)return{width:i,height:n};const r=a/s;return{width:Math.max(1,Math.round(i*r)),height:Math.max(1,Math.round(n*r))}}function T1(i){if(typeof i!="string"||i.length===0)return 0;const n=i.length;let a=0;i.endsWith("==")?a=2:i.endsWith("=")&&(a=1);const s=Math.floor(n*3/4)-a;return Number.isFinite(s)&&s>0?s:0}function M1(i){return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}async function A1(i){if(typeof createImageBitmap=="function")try{const n=await createImageBitmap(i,{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(i);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 s=new Image,r=URL.createObjectURL(i);s.onload=()=>{n({source:s,width:s.naturalWidth||s.width,height:s.naturalHeight||s.height,cleanup:()=>{try{URL.revokeObjectURL(r)}catch{}}})},s.onerror=()=>{try{URL.revokeObjectURL(r)}catch{}a(new Error("Failed to decode image source"))},s.src=r})}async function Qb(i,n=Zb,a=Wb){var r;if(!i||i.size===0||i.type&&!i.type.startsWith("image/"))return null;let s;try{s=await A1(i)}catch(c){return console.warn("Failed to decode image for paste:",c),null}try{const{width:c,height:d}=C1(s.width,s.height,n),m=document.createElement("canvas");m.width=c,m.height=d;const p=m.getContext("2d");if(!p)return null;p.drawImage(s.source,0,0,c,d);let g="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(g="image/jpeg")}catch{g="image/jpeg"}for(const y of S1){let v;try{v=m.toDataURL(g,y)}catch{continue}if(!(v!=null&&v.startsWith("data:")))continue;const S=v.indexOf(","),x=S!==-1?v.slice(S+1):"",w=T1(x);if(w<=a)return{mime:g,dataBase64:x,dataUrl:v,byteLength:w,width:c,height:d}}return null}finally{(r=s.cleanup)==null||r.call(s)}}const E1=3e4,k1=1200;function N1({adapterRef:i,role:n,connectionState:a,warnViewerMode:s,addToast:r,t:c,sendPasteFile:d}){const[m,p]=T.useState(Zo),[g,y]=T.useState("image"),v=T.useMemo(()=>({...m,kind:g}),[m,g]),S=T.useRef(null),x=T.useRef(0),w=T.useRef(null),C=T.useCallback(()=>{w.current&&(clearTimeout(w.current),w.current=null)},[]),A=T.useCallback(()=>{C(),S.current=null,p(Zo)},[C]),N=T.useCallback(()=>{S.current!==null&&A()},[A]),E=T.useCallback(()=>{const k=S.current;k!==null&&(C(),p({active:!0,phase:"completed",ratio:1,percent:100,statusText:c("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{S.current===k&&(S.current=null,p(Zo))},k1))},[C,c]);T.useEffect(()=>{a!=="connected"&&N()},[a,N]),T.useEffect(()=>C,[C]);const _=T.useCallback(k=>{if(n!=="controller")return s(),null;if(!i.current||a!=="connected")return r("error",c("serverErrors.host_offline")),null;if(S.current!==null)return null;const R=++x.current;return S.current=R,y(k),C(),R},[i,n,a,s,r,c,C]),D=T.useCallback(k=>(k&&r("error",k),S.current=null,p(Zo),!1),[r]),P=T.useCallback((k,R,I,Q)=>{p({active:!0,phase:"sending",ratio:.75,percent:75,statusText:c("virtualKeyboard.uploadProgressSending")});const X=d(R,I,Q);return S.current!==k?!1:X?(p({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:c("virtualKeyboard.uploadProgressWaitingHost")}),w.current=setTimeout(()=>{S.current===k&&D(c("serverErrors.paste_file_write_failed"))},E1),!0):D()},[c,d,D]),B=T.useCallback(async k=>{const R=_("image");if(R===null)return!1;const I="dataBase64"in k&&typeof k.dataBase64=="string";try{let Q;if(I)Q=k;else{const X=k;if(p({active:!0,phase:"reading",ratio:.1,percent:10,statusText:c("virtualKeyboard.uploadProgressReading")}),!X||X.size===0)return D(c("clipboard.fileEmpty"));if(X.type&&!X.type.startsWith("image/"))return D(c("clipboard.unsupportedType"));p({active:!0,phase:"processing",ratio:.35,percent:35,statusText:c("virtualKeyboard.uploadProgressProcessing")});const ne=await Qb(X);if(S.current!==R)return!1;if(!ne)return D(c("clipboard.imageTooLarge"));Q=ne,p({active:!0,phase:"processing",ratio:.6,percent:60,statusText:c("virtualKeyboard.uploadProgressProcessing")})}return P(R,Q.mime,Q.dataBase64)}catch(Q){return console.error("Failed to process/upload image:",Q),S.current===R&&D(c("clipboard.imageTooLarge")),!1}},[_,D,P,c]),O=T.useCallback(async k=>{const R=_("file");if(R===null)return!1;if(k.size===0)return D(c("clipboard.fileEmpty"));if(k.size>Wb)return D(c("clipboard.fileTooLarge"));p({active:!0,phase:"reading",ratio:.3,percent:30,statusText:c("virtualKeyboard.uploadProgressReading")});try{const I=await new Promise((X,ne)=>{const oe=new FileReader;oe.onload=()=>X(String(oe.result??"")),oe.onerror=()=>ne(oe.error??new Error("Failed to read file")),oe.readAsDataURL(k)});if(S.current!==R)return!1;const Q=I.slice(I.indexOf(",")+1);return P(R,w1,Q,k.name)}catch(I){return console.error("Failed to read file for upload:",I),S.current===R&&D(c("clipboard.fileReadFailed")),!1}},[_,D,P,c]);return{uploadProgress:v,uploadImage:B,uploadFile:O,resetUploadProgress:A,abortUpload:N,completeUpload:E}}const _1=4096,L1=8*1024*1024;function R1(){const i=T.useRef(null),n=T.useRef([]),a=T.useRef(0),s=T.useCallback(p=>{for(n.current.push(p),a.current+=p.byteLength;n.current.length>_1||a.current>L1;){const g=n.current.shift();if(!g)break;a.current-=g.byteLength}},[]),r=T.useCallback(p=>{const g=i.current;if(g)try{g(p);return}catch(y){console.debug("Terminal output sink threw, buffering chunk instead:",y)}s(p)},[s]),c=T.useCallback(p=>{i.current=p;const g=n.current;n.current=[],a.current=0;for(let y=0;y<g.length;y++)try{p(g[y])}catch(v){console.debug("Terminal sink threw while flushing, re-buffering the tail:",v);for(let S=y;S<g.length;S++)s(g[S]);break}return()=>{i.current===p&&(i.current=null)}},[s]),d=T.useCallback(()=>n.current.length,[]),m=T.useCallback(()=>{n.current=[],a.current=0},[]);return{receiveOutput:r,subscribeToOutput:c,getPendingOutputChunkCount:d,clearPendingOutput:m}}const Ag=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","touchKeyboardTrigger","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify"],j1=["agentKeymaps"],O1=64;function D1(i,n){const a=i,s={};for(const r of n)a[r]!==void 0&&(s[r]=a[r]);return s}function oa(i,n){return D1(i,n==="local"?[...Ag,...j1]:Ag)}function hr(i,n,a){const s=Object.create(null);if(!i||typeof i!="object"||Array.isArray(i))return s;for(const[r,c]of Object.entries(i).slice(0,O1))(r===""?n.length>0:!n.includes(r))||!c||typeof c!="object"||Array.isArray(c)||(s[r]=oa(c,a));return s}const Jb=64,Cs=4096;function Fd(){const i=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${i}`}function z1(i,n){return(typeof i=="string"?i.trim().slice(0,Jb):"")||n}function mr(i,n){if(!i||typeof i!="object"||Array.isArray(i))return null;const a=i,s=typeof a.wsUrl=="string"?a.wsUrl.trim().slice(0,2048):"",r=typeof a.token=="string"?a.token.slice(0,Cs):"",c=typeof a.pairCode=="string"?a.pairCode.trim().toUpperCase().slice(0,32):"";if(!s||!s.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(s)||!r&&!c)return null;const d=Date.now(),m=typeof a.id=="string"&&a.id.length>0?a.id.slice(0,128):Fd(),p=typeof a.hostname=="string"&&a.hostname.trim()?a.hostname.trim().slice(0,Jb):`Herdr ${n+1}`;return{id:m,displayName:z1(a.displayName,p),wsUrl:s,token:r,...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):d,lastUsedAt:Number.isFinite(a.lastUsedAt)?Number(a.lastUsedAt):d}}function Eg(i,n=0){const a=mr({...i,id:i.id||Fd()},n);if(!a)throw new Error("a connection profile requires a relay URL and token or pairing code");return a}function kg(i){let n=i.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const a=new URL(i.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}::${i.hostId||""}`}function ey(i){var c;const n=[];if((Array.isArray(i.profiles)?i.profiles.slice(0,64):[]).forEach((d,m)=>{const p=mr(d,m);p&&!n.some(g=>g.id===p.id)&&n.push(p)}),n.length===0&&(typeof i.token=="string"&&i.token||typeof i.pairCode=="string"&&i.pairCode)){const d=mr({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof i.wsUrl=="string"&&i.wsUrl.trim()?i.wsUrl:Kt,token:i.token||"",pairCode:i.pairCode||"",autoReconnect:i.autoReconnect!==!1},0);d&&n.push(d)}const s=typeof i.activeProfileId=="string"?i.activeProfileId:"",r=n.some(d=>d.id===s)?s:((c=n[0])==null?void 0:c.id)||"";return{profiles:n,activeProfileId:r}}const ty=[{id:"esc",label:"ESC",code:de.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:de.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:de.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:de.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:de.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:de.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:de.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],H1=[{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:de.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:de.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:de.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:de.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:de.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:de.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:de.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:de.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:de.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:de.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:de.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:de.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:de.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:de.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:de.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:de.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:de.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:de.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:de.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:de.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:de.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:de.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:de.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:de.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:de.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:de.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:de.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:de.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:de.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:de.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:de.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:de.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:de.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:de.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:de.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 Ts(){return JSON.parse(JSON.stringify(ty))}const B1=[["esc","tab","shift_tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"],["esc","tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","drawer_agent","drawer_symbols","drawer_fn","enter"]];function U1(i){return B1.some(n=>i.length===n.length&&i.every((a,s)=>a.id===n[s]&&a.enabled!==!1))}function K1(i){if(!Array.isArray(i)||i.length===0)return Ts();const n=i.filter(a=>typeof a=="object"&&a!==null&&typeof a.id=="string"&&typeof a.label=="string"&&typeof a.code=="string");return U1(n)?Ts():n.filter(a=>a.id!=="drawer_agent")}function wd(i,n){if(n){const a=`keyTitles.${i.id}`,s=n(a);if(s&&s!==a)return s}return i.title||i.label}const Ng="herdr-remote.ignoredUpdate";function I1(){const i=Ss("local",At.ignoredUpdate);if(i!==null)return i;const n=Ss("local",Ng);if(n===null)return null;ny(n);try{window.localStorage.removeItem(Ng)}catch{}return n}function ny(i){Ri("local",At.ignoredUpdate,i)}function F1(){return`client-${Math.random().toString(36).substring(2,8)}`}function iy(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function ly(){const i=typeof window<"u"&&window.innerWidth<640;return{wsUrl:Kt,token:"",pairCode:"",clientId:F1(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:i?cr:ws,fontSizeFollowsHost:!0,fontFamily:Bb,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,touchKeyboardTrigger:"tap",predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:iy(),virtualKeys:Ts(),agentKeymaps:{},observerMode:!1,adminToken:"",adminTokens:{}}}const G1=["wsUrl","token","pairCode","clientId","autoReconnect","language"],Y1=["wsUrl","token","pairCode","autoReconnect"],_g=["theme","colorMode"];function ay(i){const n=i;if(!_g.some(r=>n[r]!==void 0))return{data:i,changed:!1};const s={...n};for(const r of _g)delete s[r];return{data:s,changed:!0}}function sy(i){if(!i||typeof i!="object"||Array.isArray(i))return{};const n={};for(const[a,s]of Object.entries(i).slice(0,32))typeof s!="string"||s.length===0||(n[a.slice(0,512)]=s.slice(0,Cs));return n}function pr(i,n){const a=Ss(i,n);if(!a)return{};try{const s=JSON.parse(a);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch(s){return console.warn(`Failed to parse ${i}Storage settings:`,s),{}}}function gr(){const i=ly();if(typeof window>"u")return i;let n=pr("local",At.settings);const a=ay(n);a.changed&&(n=a.data,Ri("local",At.settings,JSON.stringify(n)));const s=pr("session",At.sessionView),r=ey(n),c=r.profiles.map(Q=>Q.id),d=typeof s.activeProfileId=="string"&&c.includes(s.activeProfileId)?s.activeProfileId:r.activeProfileId,m=r.profiles.find(Q=>Q.id===d),p={...oa(n,"local"),...hr(n.instances,c,"local")[d]},g=hr(s.instances,c,"session");let y=g[d];y||(y=oa({...p,...oa(s,"session")},"session"),g[d]=y,Ri("session",At.sessionView,JSON.stringify({activeProfileId:d,instances:g,observerMode:s.observerMode,adminToken:s.adminToken,adminTokens:s.adminTokens})));const v={...p,...y},S=Vu(v.fontFamily??i.fontFamily),x=window.innerWidth<640?cr:ws,w=v.fontSize??i.fontSize,C=ua(w,x),A=v.fontSizeFollowsHost,N=typeof A=="boolean"?A:C===ws||C===cr,E=K1(v.virtualKeys??i.virtualKeys),_=n.language??i.language,D=_==="zh"||_==="en"?_:iy(),P=Q=>{const X=v[Q];return typeof X=="boolean"?X:i[Q]},B=v.predictiveEcho??i.predictiveEcho,O=B==="always"||B==="off"||B==="auto"?B:"auto",k=typeof s.adminToken=="string"?s.adminToken.slice(0,Cs):typeof n.adminToken=="string"?n.adminToken.slice(0,Cs):i.adminToken,R=sy(s.adminTokens),I={...i,wsUrl:(m==null?void 0:m.wsUrl)||(typeof n.wsUrl=="string"?n.wsUrl:i.wsUrl),token:(m==null?void 0:m.token)||"",pairCode:(m==null?void 0:m.pairCode)||"",autoReconnect:(m==null?void 0:m.autoReconnect)??i.autoReconnect,profiles:r.profiles,activeProfileId:d,clientId:typeof n.clientId=="string"&&n.clientId.trim()?n.clientId.trim().slice(0,128):i.clientId,fontFamily:S,fontSize:C,fontSizeFollowsHost:N,toolbarVisible:v.toolbarVisible??i.toolbarVisible,toolbarPosition:v.toolbarPosition??i.toolbarPosition,vibrateOnKeyPress:v.vibrateOnKeyPress??i.vibrateOnKeyPress,touchKeyboardTrigger:v.touchKeyboardTrigger==="button"?"button":"tap",predictiveEcho:O,virtualKeys:E,agentKeymaps:zb(v.agentKeymaps),agentAlertBadge:P("agentAlertBadge"),agentAlertSound:P("agentAlertSound"),agentAlertVibrate:P("agentAlertVibrate"),agentAlertNotify:P("agentAlertNotify"),language:D,observerMode:s.observerMode===!0,adminToken:k,adminTokens:R};return typeof n.fontFamily=="string"&&Vu(n.fontFamily)!==n.fontFamily&&(n.fontFamily=Vu(n.fontFamily),Ri("local",At.settings,JSON.stringify(n))),I}function ki(i){var C;const n=gr(),a={...n,...i};a.agentKeymaps=zb(a.agentKeymaps),a.adminTokens=sy(a.adminTokens),typeof a.adminToken=="string"&&(a.adminToken=a.adminToken.slice(0,Cs)),i.fontSize!==void 0&&(a.fontSize=ua(i.fontSize)),i.predictiveEcho!==void 0&&(i.predictiveEcho==="auto"||i.predictiveEcho==="always"||i.predictiveEcho==="off"?a.predictiveEcho=i.predictiveEcho:a.predictiveEcho="auto");const s=ey(a);let r=s.profiles,c=s.activeProfileId;if(Y1.some(A=>i[A]!==void 0)){const A=r.findIndex(_=>_.id===c),N=A>=0?{...r[A]}:{id:Fd(),displayName:`Herdr ${r.length+1}`,wsUrl:a.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};N.wsUrl=a.wsUrl,N.token=a.token,N.pairCode=a.pairCode||void 0,N.autoReconnect=a.autoReconnect,N.lastUsedAt=Date.now();const E=mr(N,Math.max(A,0));E?A>=0?r[A]=E:(r.push(E),c=E.id):A>=0&&(r=r.filter(_=>_.id!==c),c=((C=r[0])==null?void 0:C.id)||"")}r.length>0&&!r.some(A=>A.id===c)&&(c=r[0].id);const m=r.find(A=>A.id===c);a.wsUrl=(m==null?void 0:m.wsUrl)||a.wsUrl||Kt,a.token=(m==null?void 0:m.token)||"",a.pairCode=(m==null?void 0:m.pairCode)||"",a.autoReconnect=(m==null?void 0:m.autoReconnect)??a.autoReconnect;const p=r.map(A=>A.id),g=ay(pr("local",At.settings)).data,y=pr("session",At.sessionView),v=hr(g.instances,p,"local"),S=hr(y.instances,p,"session"),w=c===n.activeProfileId||!n.activeProfileId?a:i;v[c]={...v[c],...oa(w,"local")},S[c]={...S[c],...oa(w,"session")};for(const A of G1)a[A]!==void 0&&(g[A]=a[A]);return g.profiles=r,g.instances=v,(c!==n.activeProfileId||!p.includes(g.activeProfileId??""))&&(g.activeProfileId=c),Ri("local",At.settings,JSON.stringify(g)),Ri("session",At.sessionView,JSON.stringify({activeProfileId:c,instances:S,observerMode:a.observerMode===!0,adminToken:a.adminToken,adminTokens:a.adminTokens})),gr()}function P1(i){const[n,a]=T.useState(gr),s=T.useRef(n);s.current=n;const r=T.useRef(i);r.current=i;const c=T.useCallback(x=>{const w=ki(x);s.current=w,a(w)},[]),d=T.useCallback(x=>{s.current=x,a(x)},[]),m=T.useCallback(x=>{const w=s.current,C=Eg({...x,wsUrl:x.wsUrl||Kt,token:x.token||"",displayName:x.displayName||`Herdr ${w.profiles.length+1}`,autoReconnect:x.autoReconnect!==!1},w.profiles.length),A=ki({profiles:[...w.profiles,C],activeProfileId:C.id,wsUrl:C.wsUrl,token:C.token,pairCode:C.pairCode||"",autoReconnect:C.autoReconnect});d(A),r.current(A)},[d]),p=T.useCallback(x=>{const w=s.current,C=w.profiles.find(N=>N.id===x);if(!C||C.id===w.activeProfileId)return;const A=ki({activeProfileId:C.id,wsUrl:C.wsUrl,token:C.token,pairCode:C.pairCode||"",autoReconnect:C.autoReconnect,profiles:w.profiles.map(N=>N.id===C.id?{...N,lastUsedAt:Date.now()}:N)});d(A),r.current(A)},[d]),g=T.useCallback((x,w)=>{const C=s.current;if(!C.profiles.find(_=>_.id===x))return;const N=w.trim().slice(0,64);if(!N)return;const E=ki({profiles:C.profiles.map(_=>_.id===x?{..._,displayName:N}:_)});d(E)},[d]),y=T.useCallback(x=>{const w=s.current;if(!w.profiles.some(E=>E.id===x))return;const C=w.profiles.filter(E=>E.id!==x),A=C.find(E=>E.id===w.activeProfileId)||C[0],N=ki(A?{profiles:C,activeProfileId:A.id,wsUrl:A.wsUrl,token:A.token,pairCode:A.pairCode||"",autoReconnect:A.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:Kt,token:"",pairCode:""});d(N),x===w.activeProfileId&&r.current(N)},[d]),v=T.useCallback(x=>{const w=s.current,C=w.profiles.find(k=>k.id===w.activeProfileId),A=x.hostId?kg({wsUrl:w.wsUrl,hostId:x.hostId}):null,N=A?w.profiles.findIndex(k=>kg(k)===A):-1,E=N>=0?N:Math.max(0,w.profiles.findIndex(k=>k.id===w.activeProfileId)),D={...w.profiles[E]||C||Eg({wsUrl:w.wsUrl||Kt,token:"",pairCode:w.pairCode||"PENDING",displayName:`Herdr ${w.profiles.length+1}`},w.profiles.length),token:x.token,pairCode:void 0,...x.hostId?{hostId:x.hostId}:{},...x.deviceId?{deviceId:x.deviceId}:{},lastUsedAt:Date.now()};let P=[...w.profiles];E>=0&&E<P.length?P[E]=D:P.push(D);const B=C==null?void 0:C.id;P=P.filter((k,R)=>R===E||k.id===D.id?!0:!(N>=0&&B&&k.id===B));const O=ki({profiles:P,activeProfileId:D.id,wsUrl:D.wsUrl,token:D.token,pairCode:"",autoReconnect:D.autoReconnect});return d(O),O},[d]),S=T.useCallback(x=>{const w=s.current,C=w.profiles.find(_=>_.id===w.activeProfileId);if(!C||!x.hostId&&!x.hostname)return;const A=/^Herdr \d+$/.test(C.displayName),N={...C,...x.hostId?{hostId:x.hostId}:{},...x.hostname?{hostname:x.hostname}:{},...x.hostname&&A?{displayName:x.hostname}:{}},E=ki({profiles:w.profiles.map(_=>_.id===C.id?N:_)});d(E)},[d]);return{settings:n,updateSettings:c,addProfileAndConnect:m,switchProfile:p,renameProfile:g,removeProfile:y,savePairedProfile:v,noteReadyProfile:S}}const Qo={ctrl:!1,alt:!1,shift:!1};function $1({adapterRef:i,role:n,addToast:a,tRef:s}){const[r,c]=T.useState({cols:80,rows:24}),d=T.useRef(r);d.current=r;const m=T.useRef(new Set),p=T.useRef(new Set),g=T.useRef(!0);T.useEffect(()=>{n==="controller"&&(g.current=!0)},[n]);const y=T.useCallback(()=>{g.current&&(g.current=!1,a("warning",s.current("toasts.viewerModeWarning")))},[a,s]),v=T.useCallback(O=>{if(n!=="controller"){y();return}const k=i.current;if(!k)return;const R=zd(O);for(const I of p.current)try{I(R)}catch(Q){console.debug("Key input observer threw:",Q)}k.sendInput(R)},[i,n,y]),S=T.useCallback(O=>(p.current.add(O),()=>{p.current.delete(O)}),[]),[x,w]=T.useState(Qo),C=T.useRef(Qo),A=T.useCallback(O=>{const k={...C.current,[O]:!C.current[O]};C.current=k,w(k)},[]),N=T.useCallback(()=>{const O=C.current;return!O.ctrl&&!O.alt&&!O.shift?null:(C.current=Qo,w(Qo),O)},[]),E=T.useCallback(O=>{var k;n!=="controller"&&!fr(O)||(k=i.current)==null||k.sendInput(O)},[i,n]),_=T.useCallback((O,k)=>{var R;d.current={cols:O,rows:k},c({cols:O,rows:k}),(R=i.current)==null||R.sendResize(O,k)},[i]),D=T.useCallback((O,k,R)=>n!=="controller"?(y(),!1):i.current?(i.current.sendPasteFile(O,k,R),!0):!1,[i,n,y]),P=T.useCallback(O=>(m.current.add(O),()=>{m.current.delete(O)}),[]),B=T.useCallback(O=>{for(const k of m.current)try{k(O)}catch(R){console.error("Error in pasteFileReady listener:",R)}},[]);return{terminalDimensions:r,dimensionsRef:d,warnViewerMode:y,sendKey:v,observeKeyInput:S,modifierLatch:x,toggleModifierLatch:A,consumeModifierLatch:N,sendBinary:E,sendResize:_,sendPasteFile:D,subscribeToPasteFileReady:P,notifyPasteFileReady:B}}const V1=4e3,q1=3;function X1(){const[i,n]=T.useState([]),a=T.useRef([]),s=T.useRef(new Map),r=T.useCallback(m=>{a.current=m,n(m)},[]),c=T.useCallback(m=>{const p=s.current.get(m);p&&(clearTimeout(p),s.current.delete(m)),r(a.current.filter(g=>g.id!==m))},[r]),d=T.useCallback((m,p)=>{const g=Date.now(),y=a.current,v=y.find(C=>C.type===m&&C.message===p),S=v?v.id:`${g}-${Math.random().toString(36).substring(2,6)}`;let x;if(v)x=y.map(C=>C.id===S?{...C,count:C.count+1,timestamp:g}:C);else for(x=[...y,{id:S,type:m,message:p,timestamp:g,count:1}];x.length>q1;){const[C,...A]=x,N=s.current.get(C.id);N&&(clearTimeout(N),s.current.delete(C.id)),x=A}r(x);const w=s.current.get(S);w&&clearTimeout(w),s.current.set(S,setTimeout(()=>c(S),V1))},[r,c]);return T.useEffect(()=>{const m=s.current;return()=>{for(const p of m.values())clearTimeout(p);m.clear()}},[]),{toasts:i,addToast:d,removeToast:c}}function W1(i,n){const[a,s]=T.useState(null),[r,c]=T.useState(I1),d=T.useRef(r),m=T.useRef(new Set),p=T.useCallback(S=>{d.current=S,c(S),ny(S)},[]),g=T.useCallback(S=>{if(s(S),!S.updateAvailable||d.current===S.latest)return;const x=`${S.latest}:${S.restartPending?"restart":"update"}`;m.current.has(x)||(m.current.add(x),i("info",S.restartPending?n.current("update.toastRestart",{version:S.latest}):n.current("update.toast",{version:S.latest})))},[i,n]),y=T.useCallback(()=>s(null),[]),v=T.useCallback((S,x)=>{if(S!==null)return;const w=`outdated:${x||""}`;m.current.has(w)||(m.current.add(w),i("warning",n.current("update.toastOutdated",{host:x||n.current("update.thisHost")})))},[i,n]);return{updateStatus:a,ignoredUpdate:r,ignoreUpdate:p,receiveUpdateStatus:g,forgetUpdateStatus:y,noteHostVersion:v}}const oy=T.createContext(null),ry=T.createContext(null),cy=T.createContext(null),uy=T.createContext(null),dy=T.createContext(null),Z1=({children:i})=>{var Os;const[n,a]=T.useReducer(n1,t1),s=T.useRef(null),r=T.useRef(!1);T.useEffect(()=>{Ub()},[]);const{receiveOutput:c,subscribeToOutput:d,getPendingOutputChunkCount:m,clearPendingOutput:p}=R1(),{toasts:g,addToast:y,removeToast:v}=X1(),S=T.useCallback(()=>{p(),a({type:"reset",resetTerminal:!0})},[p]),{settings:x,updateSettings:w,addProfileAndConnect:C,switchProfile:A,renameProfile:N,removeProfile:E,savePairedProfile:_,noteReadyProfile:D}=P1(me=>{var Ge;S(),(Ge=s.current)==null||Ge.reconnectWith(Wo(me))}),P=T.useCallback((me,Ge)=>Dd(x.language,me,Ge),[x.language]),B=T.useRef(P);B.current=P;const{herdrLaunch:O,startHerdr:k,handleLaunchError:R,forgetHerdrLaunch:I}=l1(s,B),{updateStatus:Q,ignoredUpdate:X,ignoreUpdate:ne,receiveUpdateStatus:oe,forgetUpdateStatus:ce,noteHostVersion:z}=W1(y,B),J=x.observerMode?"viewer":n.role,K=$1({adapterRef:s,role:J,addToast:y,tRef:B}),{uploadProgress:ae,uploadImage:$,uploadFile:ue,resetUploadProgress:xe,abortUpload:fe,completeUpload:te}=N1({adapterRef:s,role:J,connectionState:n.connectionState,warnViewerMode:K.warnViewerMode,addToast:y,t:P,sendPasteFile:K.sendPasteFile}),le=x1(s,()=>Wo(x),{stateChange:(me,Ge,Nt)=>{const Ft=Pu(Nt)?P(`serverErrors.${Nt}`):Ge;a({type:"stateChange",state:me,detail:Ft,code:Nt}),me==="connected"?y("success",P("toasts.connected")):me==="error"&&y("error",Ft||P("toasts.connectionError")),me!=="connected"&&I()},ready:me=>{const Ge=r.current;Ge&&p(),r.current=!0,I(),ce(),a({type:"ready",message:me,resetTerminal:Ge}),D(me),z(me.hostVersion,me.hostname||me.hostId)},hostReconnecting:me=>{a({type:"hostReconnecting",code:me||"host_reconnecting",detail:P(`serverErrors.${Pu(me)?me:"host_reconnecting"}`)}),p()},sessionRestarted:(me,Ge,Nt,Ft,Ln,fl,Hi,Ds,zs)=>{var hl;p(),a({type:"sessionRestarted",hostname:Ft,palette:Nt,platform:Ln,shellProfile:fl,adminTerminalSupported:Hi,hostVersion:Ds,herdrPrefixKeys:zs}),z(Ds,Ft),D({hostId:(hl=s.current)==null?void 0:hl.getHostId(),hostname:Ft})},roleChange:(me,Ge,Nt,Ft)=>{a({type:"roleChange",role:me,controllerId:Ge,hostId:Nt,assignedClientId:Ft})},controlGranted:()=>{a({type:"controlGranted"}),y("success",P("toasts.controlGranted"))},paired:me=>{var Nt;const Ge=_(me);y("success",P("toasts.pairedSuccess")),a({type:"paired",at:Date.now()}),(Nt=s.current)==null||Nt.reconnectWith(Wo(Ge))},exit:(me,Ge)=>{y("info",`${P("toasts.sessionEnded")}${Ge?`: ${Ge}`:""}${me!=null?` (${me})`:""}`)},error:me=>{if(R(me)||me.code==="host_font_unavailable")return;fe();const Ge=Pu(me.code)?P(`serverErrors.${me.code}`):me.message||`[${me.code}]`;y("error",Ge)},pasteFileReady:me=>{te(),K.notifyPasteFileReady(me)},openLink:me=>ur(me),rttUpdate:me=>a({type:"rtt",rttMs:me}),peerCount:me=>a({type:"peerCount",count:me}),sessionReady:()=>{a({type:"sessionReady"}),I()},agentStatus:me=>a({type:"agentStatus",status:me}),updateStatus:oe,binaryData:c}),{activeProfileId:he}=x,re=x.profiles.find(me=>me.id===he),{hostFont:pe,loadHostFont:se,declineHostFont:Se,syncHostFont:Ae,ensureHostGlyphs:Be}=Qw(le),ht=T.useCallback(()=>{se()},[se]),tt=Lw(x.fontFamily,pe.font?{family:pe.font.family,alias:pe.status==="loaded"?pe.alias:null,glyphs:pe.glyphs.source?{family:pe.glyphs.source.family,scope:pe.glyphs.source.scope,alias:pe.glyphs.alias}:null}:null),we=x.fontSizeFollowsHost&&((Os=pe.font)!=null&&Os.sizePx)?ua(pe.font.sizePx,x.fontSize):x.fontSize;T.useEffect(()=>{var me;(me=s.current)==null||me.updateConfig(Wo(x))},[x]),T.useEffect(()=>{const me=s.current;return me?Jw(me):void 0},[]);const{dimensionsRef:Re}=K,it=T.useCallback(me=>{s.current&&(me&&s.current.updateConfig(me),s.current.connect(Re.current))},[Re]),Ue=T.useCallback(()=>{var me;(me=s.current)==null||me.disconnect()},[]),gt=T.useCallback((me=!1)=>{var Ge;(Ge=s.current)==null||Ge.claimControl(me)},[]),Rt=T.useCallback(()=>{var me;(me=s.current)==null||me.releaseControl()},[]),xn=T.useCallback(me=>w({language:me}),[w]),Nn=T.useMemo(()=>({settings:x,updateSettings:w,language:x.language,setLanguage:xn,t:P,profiles:x.profiles,activeProfileId:he,activeProfile:re,switchProfile:A,addProfileAndConnect:C,renameProfile:N,removeProfile:E,hostFont:pe,loadHostFont:ht,declineHostFont:Se,syncHostFont:Ae,ensureHostGlyphs:Be,terminalFontFamily:tt,terminalFontSize:we}),[x,w,xn,P,he,re,A,C,N,E,pe,ht,Se,Ae,Be,tt,we]),dl=T.useMemo(()=>{var me;return{...n,role:J,isController:J==="controller",agentProfile:iw((me=n.agentStatus)==null?void 0:me.focusedAgent,"auto"),reportShellProfile:Ge=>a({type:"shellProfile",profile:Ge}),adapter:le,connect:it,disconnect:Ue,claimControl:gt,releaseControl:Rt,herdrLaunch:O,startHerdr:k,updateStatus:Q,ignoredUpdate:X,ignoreUpdate:ne}},[n,J,le,it,Ue,gt,Rt,O,k,Q,X,ne]),bt=T.useMemo(()=>({toasts:g,addToast:y,removeToast:v}),[g,y,v]),{terminalDimensions:It,sendKey:_n,observeKeyInput:ba,modifierLatch:zi,toggleModifierLatch:Ls,consumeModifierLatch:ya,sendBinary:Rs,sendResize:js,warnViewerMode:ii,sendPasteFile:Mt,subscribeToPasteFileReady:hn}=K,kt=T.useMemo(()=>({terminalDimensions:It,sendKey:_n,observeKeyInput:ba,modifierLatch:zi,toggleModifierLatch:Ls,consumeModifierLatch:ya,sendBinary:Rs,sendResize:js,warnViewerMode:ii,sendPasteFile:Mt,subscribeToPasteFileReady:hn,subscribeToOutput:d,getPendingOutputChunkCount:m}),[It,_n,ba,zi,Ls,ya,Rs,js,ii,Mt,hn,d,m]),kr=T.useMemo(()=>({uploadProgress:ae,uploadImage:$,uploadFile:ue,resetUploadProgress:xe}),[ae,$,ue,xe]);return h.jsx(oy.Provider,{value:Nn,children:h.jsx(ry.Provider,{value:dl,children:h.jsx(cy.Provider,{value:bt,children:h.jsx(uy.Provider,{value:kt,children:h.jsx(dy.Provider,{value:kr,children:i})})})})})};function Ns(i,n){const a=T.useContext(i);if(!a)throw new Error(`${n} must be used within a TerminalProvider`);return a}const Ee=()=>Ns(oy,"useSettings"),nt=()=>Ns(ry,"useConnection"),fn=()=>Ns(cy,"useToasts"),Tr=()=>Ns(uy,"useTerminalIO"),Mr=()=>Ns(dy,"useUpload");function Ms(i){var n,a;return i?{blocked:((n=i.counts)==null?void 0:n.blocked)??0,done:((a=i.counts)==null?void 0:a.done)??0}:null}function Q1(i){return i?i.blocked>0?"blocked":i.done>0?"done":null:null}function J1(i){if(!i)return"";const n=[];return i.blocked>0&&n.push(`${i.blocked}⚠`),i.done>0&&n.push(`${i.done}✓`),n.length>0?`(${n.join(" ")})`:""}function eS(i,n){if(!i||!n)return null;const a=new Map(i.agents.map(d=>[d.paneId,d.status]));let s=null;for(const d of n.agents)if(!(d.status!=="blocked"&&d.status!=="done")&&a.get(d.paneId)!==d.status){if(d.status==="blocked")return"blocked";s="done"}const r=Ms(i),c=Ms(n);return c.blocked>r.blocked?"blocked":(!s&&c.done>r.done&&(s="done"),s)}const tS={blocked:"%23f9e2af",done:"%23a6e3a1"};function nS(i){return`<circle cx='19' cy='5' r='4.5' fill='${tS[i]}' stroke='%2311111b' stroke-width='1.5'/>`}function iS(i,n){return!n||!i.includes("</svg>")?i:i.replace("</svg>",`${nS(n)}</svg>`)}function Lg(i,n=document){const a=n.querySelector('link[rel~="icon"]');if(!a)return;a.dataset.baseHref===void 0&&(a.dataset.baseHref=a.getAttribute("href")??"");const s=iS(a.dataset.baseHref,i);a.getAttribute("href")!==s&&a.setAttribute("href",s)}let rn=null;function lS(){if(typeof window>"u")return null;const i=window;return i.AudioContext??i.webkitAudioContext??null}function fy(){const i=lS();if(i)try{rn=rn??new i,rn.state==="suspended"&&rn.resume()}catch{rn=null}}function aS(i=window){const n=()=>{fy(),a()},a=()=>{i.removeEventListener("pointerdown",n),i.removeEventListener("keydown",n)};return i.addEventListener("pointerdown",n),i.addEventListener("keydown",n),a}const sS={blocked:[880,660],done:[660,880]};function hy(i){if((rn==null?void 0:rn.state)==="running")try{const n=rn.currentTime;sS[i].forEach((a,s)=>{const r=rn.createOscillator(),c=rn.createGain(),d=n+s*.11;r.type="sine",r.frequency.value=a,c.gain.setValueAtTime(1e-4,d),c.gain.exponentialRampToValueAtTime(.06,d+.01),c.gain.exponentialRampToValueAtTime(1e-4,d+.09),r.connect(c),c.connect(rn.destination),r.start(d),r.stop(d+.1)})}catch{}}const oS=15e3,rS={blocked:[70,50,70],done:[40]};function cS(){const{settings:i,t:n}=Ee(),{agentStatus:a}=nt(),s=T.useRef(i);s.current=i;const r=T.useRef(n);r.current=n;const c=T.useRef(null),d=T.useRef(Number.NEGATIVE_INFINITY);T.useEffect(()=>{Lg(i.agentAlertBadge?Q1(Ms(a)):null)},[a,i.agentAlertBadge]),T.useEffect(()=>()=>Lg(null),[]),T.useEffect(()=>{if(!(!i.agentAlertSound||typeof window>"u"))return aS(window)},[i.agentAlertSound]),T.useEffect(()=>{const m=c.current;c.current=a;const p=eS(m,a);if(!p)return;const g=Date.now();if(g-d.current<oS)return;d.current=g;const y=s.current,v=typeof document<"u"&&document.visibilityState==="hidden",S=v||typeof document<"u"&&!document.hasFocus();if(y.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(rS[p])}catch{}if(y.agentAlertSound&&S&&hy(p),y.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const x=Ms(a),w=p==="blocked"?r.current("agents.notifyBlocked",{count:x.blocked}):r.current("agents.notifyDone",{count:x.done});try{new Notification("Herdr Remote",{body:w,tag:"herdr-agents"})}catch{}}},[a])}function my(i){var n,a,s="";if(typeof i=="string"||typeof i=="number")s+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(n=0;n<r;n++)i[n]&&(a=my(i[n]))&&(s&&(s+=" "),s+=a)}else for(a in i)i[a]&&(s&&(s+=" "),s+=a);return s}function uS(){for(var i,n,a=0,s="",r=arguments.length;a<r;a++)(i=arguments[a])&&(n=my(i))&&(s&&(s+=" "),s+=n);return s}const dS=(i,n)=>{const a=new Array(i.length+n.length);for(let s=0;s<i.length;s++)a[s]=i[s];for(let s=0;s<n.length;s++)a[i.length+s]=n[s];return a},fS=(i,n)=>({classGroupId:i,validator:n}),py=(i=new Map,n=null,a)=>({nextPart:i,validators:n,classGroupId:a}),br="-",Rg=[],hS="arbitrary..",mS=i=>{const n=gS(i),{conflictingClassGroups:a,conflictingClassGroupModifiers:s}=i;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return pS(d);const m=d.split(br),p=m[0]===""&&m.length>1?1:0;return gy(m,p,n)},getConflictingClassGroupIds:(d,m)=>{if(m){const p=s[d],g=a[d];return p?g?dS(g,p):p:g||Rg}return a[d]||Rg}}},gy=(i,n,a)=>{if(i.length-n===0)return a.classGroupId;const r=i[n],c=a.nextPart.get(r);if(c){const g=gy(i,n+1,c);if(g)return g}const d=a.validators;if(d===null)return;const m=n===0?i.join(br):i.slice(n).join(br),p=d.length;for(let g=0;g<p;g++){const y=d[g];if(y.validator(m))return y.classGroupId}},pS=i=>i.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=i.slice(1,-1),a=n.indexOf(":"),s=n.slice(0,a);return s?hS+s:void 0})(),gS=i=>{const{theme:n,classGroups:a}=i;return bS(a,n)},bS=(i,n)=>{const a=py();for(const s in i){const r=i[s];Gd(r,a,s,n)}return a},Gd=(i,n,a,s)=>{const r=i.length;for(let c=0;c<r;c++){const d=i[c];yS(d,n,a,s)}},yS=(i,n,a,s)=>{if(typeof i=="string"){vS(i,n,a);return}if(typeof i=="function"){xS(i,n,a,s);return}wS(i,n,a,s)},vS=(i,n,a)=>{const s=i===""?n:by(n,i);s.classGroupId=a},xS=(i,n,a,s)=>{if(SS(i)){Gd(i(s),n,a,s);return}n.validators===null&&(n.validators=[]),n.validators.push(fS(a,i))},wS=(i,n,a,s)=>{const r=Object.entries(i),c=r.length;for(let d=0;d<c;d++){const[m,p]=r[d];Gd(p,by(n,m),a,s)}},by=(i,n)=>{let a=i;const s=n.split(br),r=s.length;for(let c=0;c<r;c++){const d=s[c];let m=a.nextPart.get(d);m||(m=py(),a.nextPart.set(d,m)),a=m}return a},SS=i=>"isThemeGetter"in i&&i.isThemeGetter===!0,CS=i=>{if(i<1)return{get:()=>{},set:()=>{}};let n=0,a=Object.create(null),s=Object.create(null);const r=(c,d)=>{a[c]=d,n++,n>i&&(n=0,s=a,a=Object.create(null))};return{get(c){let d=a[c];if(d!==void 0)return d;if((d=s[c])!==void 0)return r(c,d),d},set(c,d){c in a?a[c]=d:r(c,d)}}},Sd="!",jg=":",TS=[],Og=(i,n,a,s,r)=>({modifiers:i,hasImportantModifier:n,baseClassName:a,maybePostfixModifierPosition:s,isExternal:r}),MS=i=>{const{prefix:n,experimentalParseClassName:a}=i;let s=r=>{const c=[];let d=0,m=0,p=0,g;const y=r.length;for(let C=0;C<y;C++){const A=r[C];if(d===0&&m===0){if(A===jg){c.push(r.slice(p,C)),p=C+1;continue}if(A==="/"){g=C;continue}}A==="["?d++:A==="]"?d--:A==="("?m++:A===")"&&m--}const v=c.length===0?r:r.slice(p);let S=v,x=!1;v.endsWith(Sd)?(S=v.slice(0,-1),x=!0):v.startsWith(Sd)&&(S=v.slice(1),x=!0);const w=g&&g>p?g-p:void 0;return Og(c,x,S,w)};if(n){const r=n+jg,c=s;s=d=>d.startsWith(r)?c(d.slice(r.length)):Og(TS,!1,d,void 0,!0)}if(a){const r=s;s=c=>a({className:c,parseClassName:r})}return s},AS=i=>{const n=new Map;return i.orderSensitiveModifiers.forEach((a,s)=>{n.set(a,1e6+s)}),a=>{const s=[];let r=[];for(let c=0;c<a.length;c++){const d=a[c],m=d[0]==="[",p=n.has(d);m||p?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(d)):r.push(d)}return r.length>0&&(r.sort(),s.push(...r)),s}},ES=i=>({cache:CS(i.cacheSize),parseClassName:MS(i),sortModifiers:AS(i),postfixLookupClassGroupIds:kS(i),...mS(i)}),kS=i=>{const n=Object.create(null),a=i.postfixLookupClassGroups;if(a)for(let s=0;s<a.length;s++)n[a[s]]=!0;return n},NS=/\s+/,_S=(i,n)=>{const{parseClassName:a,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:c,postfixLookupClassGroupIds:d}=n,m=[],p=i.trim().split(NS);let g="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:S,modifiers:x,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:A}=a(v);if(S){g=v+(g.length>0?" "+g:g);continue}let N=!!A,E;if(N){const O=C.substring(0,A);E=s(O);const k=E&&d[E]?s(C):void 0;k&&k!==E&&(E=k,N=!1)}else E=s(C);if(!E){if(!N){g=v+(g.length>0?" "+g:g);continue}if(E=s(C),!E){g=v+(g.length>0?" "+g:g);continue}N=!1}const _=x.length===0?"":x.length===1?x[0]:c(x).join(":"),D=w?_+Sd:_,P=D+E;if(m.indexOf(P)>-1)continue;m.push(P);const B=r(E,N);for(let O=0;O<B.length;++O){const k=B[O];m.push(D+k)}g=v+(g.length>0?" "+g:g)}return g},LS=(...i)=>{let n=0,a,s,r="";for(;n<i.length;)(a=i[n++])&&(s=yy(a))&&(r&&(r+=" "),r+=s);return r},yy=i=>{if(typeof i=="string")return i;let n,a="";for(let s=0;s<i.length;s++)i[s]&&(n=yy(i[s]))&&(a&&(a+=" "),a+=n);return a},Dg=(i,...n)=>{let a,s,r,c;const d=p=>{const g=n.reduce((y,v)=>v(y),i());return a=ES(g),s=a.cache.get,r=a.cache.set,c=m,m(p)},m=p=>{const g=s(p);if(g)return g;const y=_S(p,a);return r(p,y),y};return c=d,(...p)=>c(LS(...p))},RS=[],pt=i=>{const n=a=>a[i]||RS;return n.isThemeGetter=!0,n},vy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,OS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DS=/\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$/,zS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,BS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ni=i=>jS.test(i),Le=i=>!!i&&!Number.isNaN(Number(i)),Mn=i=>!!i&&Number.isInteger(Number(i)),ed=i=>i.endsWith("%")&&Le(i.slice(0,-1)),Wn=i=>OS.test(i),wy=()=>!0,US=i=>DS.test(i)&&!zS.test(i),Yd=()=>!1,KS=i=>HS.test(i),IS=i=>BS.test(i),FS=i=>!ge(i)&&!be(i),GS=i=>i.startsWith("@container")&&(i[10]==="/"&&i[11]!==void 0||i[11]==="s"&&i[16]!==void 0&&i.startsWith("-size/",10)||i[11]==="n"&&i[18]!==void 0&&i.startsWith("-normal/",10)),YS=i=>Di(i,Ty,Yd),ge=i=>vy.test(i),nl=i=>Di(i,My,US),zg=i=>Di(i,QS,Le),PS=i=>Di(i,Ey,wy),$S=i=>Di(i,Ay,Yd),Hg=i=>Di(i,Sy,Yd),VS=i=>Di(i,Cy,IS),Jo=i=>Di(i,ky,KS),be=i=>xy.test(i),fs=i=>ul(i,My),qS=i=>ul(i,Ay),Bg=i=>ul(i,Sy),XS=i=>ul(i,Ty),WS=i=>ul(i,Cy),er=i=>ul(i,ky,!0),ZS=i=>ul(i,Ey,!0),Di=(i,n,a)=>{const s=vy.exec(i);return s?s[1]?n(s[1]):a(s[2]):!1},ul=(i,n,a=!1)=>{const s=xy.exec(i);return s?s[1]?n(s[1]):a:!1},Sy=i=>i==="position"||i==="percentage",Cy=i=>i==="image"||i==="url",Ty=i=>i==="length"||i==="size"||i==="bg-size",My=i=>i==="length",QS=i=>i==="number",Ay=i=>i==="family-name",Ey=i=>i==="number"||i==="weight",ky=i=>i==="shadow",Ug=()=>{const i=pt("color"),n=pt("font"),a=pt("text"),s=pt("font-weight"),r=pt("tracking"),c=pt("leading"),d=pt("breakpoint"),m=pt("container"),p=pt("spacing"),g=pt("radius"),y=pt("shadow"),v=pt("inset-shadow"),S=pt("text-shadow"),x=pt("drop-shadow"),w=pt("blur"),C=pt("perspective"),A=pt("aspect"),N=pt("ease"),E=pt("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...D(),be,ge],B=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],k=()=>[be,ge,p],R=()=>[Ni,"full","auto",...k()],I=()=>[Mn,"none","subgrid",be,ge],Q=()=>["auto",{span:["full",Mn,be,ge]},Mn,be,ge],X=()=>[Mn,"auto",be,ge],ne=()=>["auto","min","max","fr",be,ge],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ce=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...k()],J=()=>[Ni,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],K=()=>[Ni,"screen","full","dvw","lvw","svw","min","max","fit",...k()],ae=()=>[Ni,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],$=()=>[i,be,ge],ue=()=>[...D(),Bg,Hg,{position:[be,ge]}],xe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],fe=()=>["auto","cover","contain",XS,YS,{size:[be,ge]}],te=()=>[ed,fs,nl],le=()=>["","none","full",g,be,ge],he=()=>["",Le,fs,nl],re=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Le,ed,Bg,Hg],Se=()=>["","none",w,be,ge],Ae=()=>["none",Le,be,ge],Be=()=>["none",Le,be,ge],ht=()=>[Le,be,ge],tt=()=>[Ni,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wn],breakpoint:[Wn],color:[wy],container:[Wn],"drop-shadow":[Wn],ease:["in","out","in-out"],font:[FS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wn],shadow:[Wn],spacing:["px",Le],text:[Wn],"text-shadow":[Wn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ni,ge,be,A]}],container:["container"],"container-type":[{"@container":["","normal","size",be,ge]}],"container-named":[GS],columns:[{columns:[Le,ge,be,m]}],"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:P()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[Mn,"auto",be,ge]}],basis:[{basis:[Ni,"full","auto",m,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,Ni,"auto","initial","none",ge]}],grow:[{grow:["",Le,be,ge]}],shrink:[{shrink:["",Le,be,ge]}],order:[{order:[Mn,"first","last","none",be,ge]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ne()}],"auto-rows":[{"auto-rows":ne()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...ce()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...ce(),"baseline"]}],"place-self":[{"place-self":["auto",...ce()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...ae()]}],"min-block-size":[{"min-block":["auto",...ae()]}],"max-block-size":[{"max-block":["none",...ae()]}],w:[{w:[m,"screen",...J()]}],"min-w":[{"min-w":[m,"screen","none",...J()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[d]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",a,fs,nl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,ZS,PS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ed,ge]}],"font-family":[{font:[qS,$S,n]}],"font-features":[{"font-features":[ge]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,be,ge]}],"line-clamp":[{"line-clamp":[Le,"none",be,zg]}],leading:[{leading:[c,...k()]}],"list-image":[{"list-image":["none",be,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",be,nl]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Le,"auto",be,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"tab-size":[{tab:[Mn,be,ge]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,ge]}],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",be,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:xe()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Mn,be,ge],radial:["",be,ge],conic:[Mn,be,ge]},WS,VS]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:le()}],"rounded-s":[{"rounded-s":le()}],"rounded-e":[{"rounded-e":le()}],"rounded-t":[{"rounded-t":le()}],"rounded-r":[{"rounded-r":le()}],"rounded-b":[{"rounded-b":le()}],"rounded-l":[{"rounded-l":le()}],"rounded-ss":[{"rounded-ss":le()}],"rounded-se":[{"rounded-se":le()}],"rounded-ee":[{"rounded-ee":le()}],"rounded-es":[{"rounded-es":le()}],"rounded-tl":[{"rounded-tl":le()}],"rounded-tr":[{"rounded-tr":le()}],"rounded-br":[{"rounded-br":le()}],"rounded-bl":[{"rounded-bl":le()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-bs":[{"border-bs":$()}],"border-color-be":[{"border-be":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,be,ge]}],"outline-w":[{outline:["",Le,fs,nl]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",y,er,Jo]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",v,er,Jo]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Le,nl]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",S,er,Jo]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Le,be,ge]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"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":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[be,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:xe()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,ge]}],filter:[{filter:["","none",be,ge]}],blur:[{blur:Se()}],brightness:[{brightness:[Le,be,ge]}],contrast:[{contrast:[Le,be,ge]}],"drop-shadow":[{"drop-shadow":["","none",x,er,Jo]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Le,be,ge]}],"hue-rotate":[{"hue-rotate":[Le,be,ge]}],invert:[{invert:["",Le,be,ge]}],saturate:[{saturate:[Le,be,ge]}],sepia:[{sepia:["",Le,be,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",be,ge]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[Le,be,ge]}],"backdrop-contrast":[{"backdrop-contrast":[Le,be,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,be,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,be,ge]}],"backdrop-invert":[{"backdrop-invert":["",Le,be,ge]}],"backdrop-opacity":[{"backdrop-opacity":[Le,be,ge]}],"backdrop-saturate":[{"backdrop-saturate":[Le,be,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,be,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",be,ge]}],ease:[{ease:["linear","initial",N,be,ge]}],delay:[{delay:[Le,be,ge]}],animate:[{animate:["none",E,be,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,be,ge]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:Ae()}],"rotate-x":[{"rotate-x":Ae()}],"rotate-y":[{"rotate-y":Ae()}],"rotate-z":[{"rotate-z":Ae()}],scale:[{scale:Be()}],"scale-x":[{"scale-x":Be()}],"scale-y":[{"scale-y":Be()}],"scale-z":[{"scale-z":Be()}],"scale-3d":["scale-3d"],skew:[{skew:ht()}],"skew-x":[{"skew-x":ht()}],"skew-y":[{"skew-y":ht()}],transform:[{transform:[be,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:tt()}],"translate-x":[{"translate-x":tt()}],"translate-y":[{"translate-y":tt()}],"translate-z":[{"translate-z":tt()}],"translate-none":["translate-none"],zoom:[{zoom:[Mn,be,ge]}],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"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",be,ge]}],"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":$()}],"scrollbar-track-color":[{"scrollbar-track":$()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",be,ge]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Le,fs,nl,zg]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},JS=(i,{cacheSize:n,prefix:a,experimentalParseClassName:s,extend:r={},override:c={}})=>(ta(i,"cacheSize",n),ta(i,"prefix",a),ta(i,"experimentalParseClassName",s),tr(i.theme,c.theme),tr(i.classGroups,c.classGroups),tr(i.conflictingClassGroups,c.conflictingClassGroups),tr(i.conflictingClassGroupModifiers,c.conflictingClassGroupModifiers),ta(i,"postfixLookupClassGroups",c.postfixLookupClassGroups),ta(i,"orderSensitiveModifiers",c.orderSensitiveModifiers),nr(i.theme,r.theme),nr(i.classGroups,r.classGroups),nr(i.conflictingClassGroups,r.conflictingClassGroups),nr(i.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Cd(i,r,"postfixLookupClassGroups"),Cd(i,r,"orderSensitiveModifiers"),i),ta=(i,n,a)=>{a!==void 0&&(i[n]=a)},tr=(i,n)=>{if(n)for(const a in n)ta(i,a,n[a])},nr=(i,n)=>{if(n)for(const a in n)Cd(i,n,a)},Cd=(i,n,a)=>{const s=n[a];s!==void 0&&(i[a]=i[a]?i[a].concat(s):s)},eC=(i,...n)=>typeof i=="function"?Dg(Ug,i,...n):Dg(()=>JS(Ug(),i),...n),tC=eC({extend:{classGroups:{"font-size":[{text:["tui","tui-sm","tui-lg"]}]}}});function ie(...i){return tC(uS(i))}const Ne={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},cn={ok:{text:"text-tui-ok",edgeL:"border-l-tui-ok",edgeB:"border-b-tui-ok"},warn:{text:"text-tui-warn",edgeL:"border-l-tui-warn",edgeB:"border-b-tui-warn"},bad:{text:"text-tui-bad",edgeL:"border-l-tui-bad",edgeB:"border-b-tui-bad"},idle:{text:"text-tui-faint",edgeL:"border-l-tui-border",edgeB:"border-b-tui-border"},accent:{text:"text-tui-accent",edgeL:"border-l-tui-accent",edgeB:"border-b-tui-accent"},alt:{text:"text-tui-alt",edgeL:"border-l-tui-alt",edgeB:"border-b-tui-alt"},info:{text:"text-tui-info",edgeL:"border-l-tui-info",edgeB:"border-b-tui-info"}},pa={ok:cn.ok.text,warn:cn.warn.text,bad:cn.bad.text,idle:cn.idle.text,accent:cn.accent.text,alt:cn.alt.text,info:cn.info.text},vn=({level:i,className:n})=>h.jsx("span",{"aria-hidden":"true",className:ie("select-none leading-none",pa[i],n),children:i==="idle"?Ne.off:Ne.on}),Pd=({className:i})=>h.jsx("span",{"aria-hidden":"true",className:ie("select-none text-tui-faint",i),children:Ne.dot}),Ny={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"},Et=({title:i,aside:n,tone:a="accent",className:s,bodyClassName:r,children:c,...d})=>h.jsxs("fieldset",{className:ie("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",i?"px-3 pb-3 pt-1":"p-3",s),...d,children:[i?h.jsx("legend",{className:ie("flex items-center gap-2 text-tui font-bold",pa[a]),children:h.jsx("span",{children:i})}):null,n?h.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,h.jsx("div",{className:ie("min-w-0",r),children:c})]}),An=({label:i,labelWidth:n=16,className:a,children:s})=>h.jsxs("div",{className:ie("flex items-baseline gap-2 text-tui",a),children:[h.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${n}ch`},title:typeof i=="string"?i:void 0,children:i}),h.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:s})]}),nC=({className:i,label:n})=>n?h.jsxs("div",{className:ie("flex items-center gap-2",i),children:[h.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),h.jsx("span",{className:"text-tui-sm text-tui-faint",children:n}),h.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):h.jsx("div",{className:ie("h-px w-full bg-tui-border-dim",i),"aria-hidden":"true"}),ji=({tone:i="accent",className:n,children:a,action:s})=>{const r=i==="ok"?Ne.check:i==="bad"?Ne.cross:i==="warn"?Ne.warn:"›",c=cn[i].edgeL;return h.jsxs("div",{className:ie("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:[h.jsx("span",{"aria-hidden":"true",className:ie("shrink-0 font-bold",pa[i]),children:r}),h.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:a}),s?h.jsx("div",{className:"shrink-0",children:s}):null]})},iC={default:"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",primary:"border-tui-accent text-tui-accent hover:bg-tui-accent hover:text-tui-crust active:bg-tui-accent-dim",danger:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust active:bg-tui-bad",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust active:bg-tui-warn",ghost:"border-transparent text-tui-muted hover:text-tui-accent hover:border-tui-border active:bg-tui-selection disabled:border-transparent"},Me=({variant:i="default",brackets:n=!0,glyph:a,block:s=!1,className:r,children:c,type:d="button",...m})=>h.jsxs("button",{type:d,className:ie("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",iC[i],s&&"w-full",r),...m,children:[n?h.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,a?h.jsx("span",{"aria-hidden":"true",className:"leading-none",children:a}):null,h.jsx("span",{className:"truncate",children:c}),n?h.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),_y=({tone:i="accent",dot:n=!1,className:a,children:s})=>h.jsxs("span",{className:ie("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",pa[i],a),children:[n?h.jsx(vn,{level:i}):null,s]}),$d=({tabs:i,activeId:n,onSelect:a,ariaLabel:s,className:r,labelClassName:c})=>h.jsx("nav",{className:ie("flex items-center gap-2",r),"aria-label":s,children:i.map((d,m)=>{const p=d.id===n;return h.jsxs(ei.Fragment,{children:[m>0?h.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ne.tabDivider}):null,h.jsxs("button",{type:"button",onClick:()=>a(d.id),"aria-current":p?"page":void 0,"aria-label":d.ariaLabel??d.label,title:d.title,className:ie("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",p?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[d.index!==void 0?h.jsx("span",{"aria-hidden":"true",className:ie("text-tui-faint",p&&"text-tui-accent"),children:d.index}):null,h.jsx("span",{"aria-hidden":"true",className:ie("ml-1",c),children:d.label})]})]},d.id)})}),Ly=({hints:i,className:n})=>h.jsx("div",{className:ie("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",n),children:i.map(a=>h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:a.keys}),h.jsx("span",{children:a.action})]},`${a.keys} ${a.action}`))}),yr=({active:i=!1,className:n,children:a})=>h.jsx("span",{className:ie("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",i?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",n),children:a}),rl=({htmlFor:i,hint:n,className:a,children:s})=>h.jsxs("label",{htmlFor:i,className:ie("block text-tui-sm font-bold text-tui-muted",a),children:[s,n?h.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:n}):null]}),dn=ei.forwardRef(({className:i,...n},a)=>h.jsx("input",{ref:a,className:ie("tui-input w-full px-2 py-1 text-tui",i),...n}));dn.displayName="Input";const Ar=ei.forwardRef(({className:i,children:n,...a},s)=>h.jsx("select",{ref:s,className:ie("tui-input w-full px-2 py-1 text-tui",i),...a,children:n}));Ar.displayName="Select";const Er="h-8",yn=({title:i,aside:n,className:a,children:s})=>h.jsxs("section",{className:ie("min-w-0",a),children:[h.jsxs("div",{className:"flex min-h-[var(--tui-row)] items-center gap-2 border-b border-tui-border pb-1",children:[h.jsx("h3",{className:"text-tui font-bold text-tui-accent",children:i}),n?h.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:n}):null]}),h.jsx("div",{className:"divide-y divide-tui-border-dim",children:s})]}),Lt=({label:i,hint:n,htmlFor:a,control:s,className:r})=>h.jsxs("div",{className:ie("flex flex-col gap-1 py-1.5 sm:flex-row sm:items-center sm:gap-4",r),children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[a?h.jsx("label",{htmlFor:a,className:"block text-tui text-tui-text",children:i}):h.jsx("span",{className:"block text-tui text-tui-text",children:i}),n?h.jsx("span",{className:"block text-tui-sm leading-snug text-tui-faint",children:n}):null]}),h.jsx("div",{className:"w-full shrink-0 sm:w-[20rem]",children:s})]}),Td="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",Md="text-tui-muted hover:bg-tui-selection hover:text-tui-text";function bs({name:i,value:n,options:a,onChange:s,tone:r="accent",size:c="md",className:d,"aria-label":m}){return h.jsx("div",{role:"radiogroup","aria-label":m,className:ie("grid w-full border border-tui-border bg-tui-mantle",Er,d),style:{gridTemplateColumns:`repeat(${a.length}, minmax(max-content, 1fr))`},children:a.map((p,g)=>{const y=p.value===n;return h.jsxs("label",{className:ie(Td,c==="sm"&&"px-1.5 text-tui-sm",g>0&&"border-l border-tui-border",y?ie(Ny[r],"font-bold text-tui-crust"):Md),children:[h.jsx("input",{type:"radio",name:i,value:p.value,className:"sr-only",checked:y,onChange:()=>s(p.value)}),h.jsx("span",{className:"whitespace-nowrap",children:p.label})]},p.value)})})}const _i=({checked:i,onChange:n,label:a,offLabel:s,onLabel:r,disabled:c=!1,className:d})=>{const m=p=>g=>{g.preventDefault(),!(c||p===i)&&n(p)};return h.jsxs("label",{className:ie("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",Er,c&&"cursor-not-allowed opacity-60",d),children:[h.jsx("input",{type:"checkbox",className:"sr-only","aria-label":a,checked:i,disabled:c,onChange:p=>n(p.target.checked)}),h.jsx("span",{"aria-hidden":"true",onClick:m(!1),className:ie(Td,i?Md:"bg-tui-selection font-bold text-tui-text"),children:s}),h.jsx("span",{"aria-hidden":"true",onClick:m(!0),className:ie(Td,"border-l border-tui-border",i?"bg-tui-ok font-bold text-tui-crust":Md),children:r})]})},sl=({variant:i="neutral",className:n,type:a="button",children:s,...r})=>h.jsx("button",{type:a,className:ie("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",i==="danger"?"text-tui-bad hover:border-tui-bad":"text-tui-muted hover:border-tui-border hover:text-tui-accent",n),...r,children:s}),lC=({value:i,width:n=20,tone:a="accent",className:s})=>{const r=Number.isFinite(i)?Math.min(1,Math.max(0,i)):0,c=Math.round(r*n);return h.jsxs("span",{className:ie("inline-flex select-none whitespace-pre font-mono leading-none",s),role:"presentation",children:[h.jsx("span",{className:pa[a],children:Ne.meterFull.repeat(c)}),h.jsx("span",{className:"text-tui-border",children:Ne.meterEmpty.repeat(Math.max(0,n-c))})]})},aC=({ratio:i,label:n,tone:a="accent",className:s,...r})=>{const c=Number.isFinite(i)?Math.min(1,Math.max(0,i)):0;return h.jsxs("div",{className:ie("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",s),role:"progressbar","aria-valuenow":Math.round(c*100),"aria-valuemin":0,"aria-valuemax":100,...r,children:[h.jsx("div",{className:ie("absolute inset-y-0 left-0",Ny[a]),style:{width:`${c*100}%`},"aria-hidden":"true"}),n!==void 0?h.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:i,value:n,sub:a,tone:s,title:r,className:c})=>h.jsxs("div",{className:ie("min-w-0 border border-tui-border bg-tui-base px-2.5 py-1.5",c),title:r,children:[h.jsx("div",{className:"truncate text-tui-sm text-tui-muted",children:i}),h.jsx("div",{className:ie("truncate text-tui-lg font-bold",s?pa[s]:"text-tui-text"),children:n}),h.jsx("div",{className:"truncate text-tui-sm text-tui-faint",children:a||" "})]}),Kg=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],cl=({className:i,label:n})=>{const[a,s]=ei.useState(0);return ei.useEffect(()=>{const r=setInterval(()=>s(c=>(c+1)%Kg.length),90);return()=>clearInterval(r)},[]),h.jsxs("span",{className:ie("inline-flex items-center gap-1.5",i),role:"status",children:[h.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:Kg[a]}),n?h.jsx("span",{children:n}):null]})};function Vd({columns:i,items:n,rowKey:a,empty:s,className:r}){return n.length===0?h.jsx("div",{className:ie("px-1 py-4 text-center text-tui text-tui-faint",r),children:s}):h.jsx("div",{className:ie("w-full overflow-x-auto",r),children:h.jsxs("table",{className:"w-full border-collapse text-tui",children:[h.jsx("thead",{children:h.jsx("tr",{className:"border-b border-tui-border",children:i.map(c=>h.jsx("th",{scope:"col",style:c.width?{width:`${c.width}ch`}:void 0,className:ie("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))})}),h.jsx("tbody",{children:n.map((c,d)=>h.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:i.map(m=>h.jsx("td",{className:ie("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(c,d)},m.key))},a(c,d)))})]})})}var sC=Eb();const ga=({isOpen:i,onClose:n,title:a,subtitle:s,closeLabel:r,footer:c,hints:d,size:m="md",fixedHeight:p=!1,className:g,children:y})=>{if(!i)return null;const v=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",S=`tui-modal-${a.replace(/\s+/g,"-").toLowerCase()}`,x=h.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":S,onMouseDown:w=>{w.target===w.currentTarget&&n()},children:h.jsxs("div",{className:ie("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",v,p&&"h-[46rem]",g),children:[h.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2",children:[h.jsx("h2",{id:S,className:"break-words text-tui font-bold text-tui-accent",children:a}),s?h.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint",children:s}):null]}),h.jsx(Me,{variant:"ghost",onClick:n,"aria-label":r,title:r,children:"esc"})]}),h.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),c||d?h.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:[d?h.jsx(Ly,{hints:d}):h.jsx("span",{}),c?h.jsx("div",{className:"flex items-center gap-2",children:c}):null]}):null]})});return typeof document>"u"?x:sC.createPortal(x,document.body)},Ad=({items:i,className:n,"data-testid":a})=>{const s=i.filter(Boolean);return h.jsx("span",{"data-testid":a,className:ie("flex min-w-0 items-center gap-1.5",n),children:s.map((r,c)=>h.jsxs(ei.Fragment,{children:[c>0?h.jsx(Pd,{className:"shrink-0"}):null,r]},c))})},Ry=({left:i,right:n,className:a})=>h.jsxs("footer",{className:ie("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:[h.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:i}),h.jsx("div",{className:"flex shrink-0 items-center gap-3",children:n})]}),oC=({name:i,tagline:n,aside:a,tabs:s,activeTabId:r,onSelectTab:c,tabsAriaLabel:d,toolbarStart:m,toolbarAside:p,hints:g,footerAside:y,bodyClassName:v,className:S,children:x})=>{const w=!!(s&&s.length>0&&r!==void 0&&c);return h.jsxs("div",{className:ie("flex h-full min-h-0 w-full flex-col bg-tui-crust",S),children:[i?h.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:[h.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[h.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:i}),n?h.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:n}):null]}),a?h.jsx("span",{className:"flex shrink-0 items-center gap-2",children:a}):null]}):null,w||m||p?h.jsxs("div",{className:"flex min-h-[var(--tui-row)] shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-tui-border bg-tui-mantle px-2 py-1",children:[m?h.jsx("div",{className:"flex shrink-0 items-center",children:m}):null,w?h.jsx("div",{className:"scrollbar-none order-last min-w-0 basis-full overflow-x-auto sm:order-none sm:basis-auto",children:h.jsx($d,{tabs:s,activeId:r,onSelect:c,ariaLabel:d,className:"gap-3"})}):null,p?h.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:p}):null]}):null,h.jsx("div",{className:ie("min-h-0 flex-1 overflow-y-auto p-2",v),children:x}),g||y?h.jsx(Ry,{left:g?h.jsx(Ly,{hints:g}):null,right:y}):null]})},rC="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",cC="text-tui-muted hover:border-tui-border hover:text-tui-accent",uC=({currentView:i,onNavigate:n,onOpenSettings:a})=>{const{language:s,setLanguage:r,t:c}=Ee(),{addToast:d}=fn(),m=g=>{g!==s&&(r(g),d("info",Dd(g,"toasts.switchedLanguage",{lang:g==="zh"?"简体中文":"English"})))},p=[{id:"terminal",label:c("header.terminalTab"),index:1,ariaLabel:c("header.terminalTab")},...i==="admin"?[{id:"admin",label:c("header.adminTab"),index:2,ariaLabel:c("header.adminTab")}]:[]];return h.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:h.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[h.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[h.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),h.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:c("header.tagline")})]}),h.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),h.jsx($d,{tabs:p,activeId:i,onSelect:g=>n(g),ariaLabel:c("header.mainNavigationAria"),className:"shrink-0 gap-3"}),h.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),h.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[h.jsx(bs,{name:"header-language",value:s,onChange:m,options:[{value:"zh",label:"中"},{value:"en",label:"EN"}],size:"sm",className:"h-[var(--tui-row)] w-auto","aria-label":c("header.languageToggleTitle")}),h.jsx("button",{type:"button",onClick:a,className:ie(rC,cC),title:c("header.settingsTitle"),"aria-label":c("header.settingsTitle"),children:c("header.actionSettings")})]})]})})},ir=({tone:i,glyph:n,message:a,assertive:s=!1,action:r})=>h.jsxs("aside",{className:ie("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",cn[i].edgeB),"aria-live":s?"assertive":"polite",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[h.jsx("span",{"aria-hidden":"true",className:ie("shrink-0",cn[i].text),children:n}),h.jsx("span",{className:"truncate text-tui-text",children:a})]}),r]}),dC=()=>{const{settings:i,t:n}=Ee(),{connectionState:a,stateDetail:s,connect:r}=nt();return a==="connected"||!i.token&&!i.pairCode&&a==="disconnected"?null:a==="connecting"?h.jsx(ir,{tone:"accent",glyph:h.jsx(cl,{}),message:n("statusBanner.connecting")}):a==="reconnecting"?h.jsx(ir,{tone:"warn",glyph:h.jsx(cl,{}),assertive:!0,message:s||n("statusBanner.reconnectingDefault"),action:h.jsx(Me,{variant:"warn",onClick:()=>r(),className:"shrink-0",children:n("statusBanner.reconnectNow")})}):a==="error"?h.jsx(ir,{tone:"bad",glyph:Ne.cross,assertive:!0,message:s||n("statusBanner.errorDefault"),action:h.jsx(Me,{variant:"danger",onClick:()=>r(),className:"shrink-0",children:n("common.retry")})}):a==="disconnected"?h.jsx(ir,{tone:"idle",glyph:Ne.off,message:n("statusBanner.disconnected"),action:h.jsx(Me,{variant:"primary",onClick:()=>r(),className:"shrink-0",children:n("common.connect")})}):null},td="Herdr Remote",Ig=80,fC=/[\u0000-\u001F\u007F-\u009F]/g;function Ed(i){if(typeof i!="string")return"";const n=i.replace(fC," ").replace(/\s+/g," ").trim();return n.length<=Ig?n:`${n.slice(0,Ig-1).trimEnd()}…`}function hC(i,n,a){const s=J1(a??null),r=s?`${s} `:"",c=Ed(i);if(c)return`${r}${c} · ${td}`;const d=Ed(n);return d?`${r}${d} · ${td}`:`${r}${td}`}function mC(i,n,a){const s=hC(i,n,a);return typeof document<"u"&&(document.title=s),s}const pC=20,gC=6,bC=500,yC=300,ha=13,jy=.602,Oy=1.3;function Qn(i,n){return Number.isFinite(i)&&i>0?i:n}function Fg(i,n,a){return Math.min(a,Math.max(n,i))}function Dy(i){const{width:n,height:a,cellWidth:s,cellHeight:r,minCols:c=pC,minRows:d=gC,maxCols:m=bC,maxRows:p=yC}=i,g=Qn(s,ha*jy),y=Qn(r,ha*Oy);return{cols:Fg(Math.floor(Qn(n,0)/g),c,m),rows:Fg(Math.floor(Qn(a,0)/y),d,p)}}function ti(i,n=ha){var s,r,c;if(i)try{const d=i._core,m=(c=(r=(s=d==null?void 0:d._renderService)==null?void 0:s.dimensions)==null?void 0:r.css)==null?void 0:c.cell;if(m!=null&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const a=Qn(n,ha);return{cellWidth:Math.round(a*jy*100)/100,cellHeight:Math.round(a*Oy*100)/100,measured:!1}}function vC(i){var s;const n=(s=i==null?void 0:i.querySelector)==null?void 0:s.call(i,".xterm-viewport");if(!n)return 0;const a=(n.offsetWidth||0)-(n.clientWidth||0);return Number.isFinite(a)&&a>0?a:0}function kd(i,n,a){if(!i)return{width:n,height:a};let s=0,r=0;if(typeof i.getBoundingClientRect=="function"){const c=i.getBoundingClientRect();s=(c==null?void 0:c.width)||0,r=(c==null?void 0:c.height)||0}return{width:Qn(s,Qn(i.clientWidth,n)),height:Qn(r,Qn(i.clientHeight,a))}}function zy(i,n,a,s){const r=Number.isFinite(s)&&s>.01?s:1;return{clientX:a.left+(i-a.left)/r,clientY:a.top+(n-a.top)/r}}const Gg=36,xC=32;function wC(i){const{cols:n,rows:a,cellWidth:s,cellHeight:r,cursorCol:c,cursorRow:d}=i;if(n<=0||a<=0||s<=0||r<=0||d<0||d>=a)return null;const m=new Int32Array((a+1)*(n+1)),p=(w,C)=>w*(n+1)+C;for(let w=0;w<a;w+=1)for(let C=0;C<n;C+=1){const A=w===d&&C===c||i.occupied(w,C)?1:0;m[p(w+1,C+1)]=A+m[p(w,C+1)]+m[p(w+1,C)]-m[p(w,C)]}const g=(w,C,A,N)=>m[p(w+A,C+N)]-m[p(w,C+N)]-m[p(w+A,C)]+m[p(w,C)],y=[{rows:Math.ceil(Gg/r),cols:Math.ceil(Gg/s),penalty:0},{rows:1,cols:Math.ceil(xC/s),penalty:r*1.5}],v=(c+.5)*s,S=(d+.5)*r;let x=null;for(const w of y)if(!(w.rows>a||w.cols>n))for(let C=0;C+w.rows<=a;C+=1)for(let A=0;A+w.cols<=n;A+=1){const N=g(C,A,w.rows,w.cols),E=Math.max(0,A*s-v,v-(A+w.cols)*s),_=Math.max(0,C*r-S,S-(C+w.rows)*r),D=Math.hypot(E,_)+w.penalty+(A<c?s/2:0);(!x||N<x.overlap||N===x.overlap&&D<x.score)&&(x={row:C,col:A,rows:w.rows,cols:w.cols,overlap:N,score:D})}return x?{row:x.row,col:x.col,rows:x.rows,cols:x.cols}:null}function SC(i){const n=ti(i);if(!n.measured)return null;const a=i.buffer.active,s=a.baseY+a.cursorY-a.viewportY;if(s<0||s>=i.rows)return null;const r=new Map,c=typeof a.getNullCell=="function"?a.getNullCell():void 0;return{cols:i.cols,rows:i.rows,cellWidth:n.cellWidth,cellHeight:n.cellHeight,cursorCol:Math.min(a.cursorX,i.cols-1),cursorRow:s,occupied:(d,m)=>{var g;r.has(d)||r.set(d,a.getLine(a.viewportY+d));const p=(g=r.get(d))==null?void 0:g.getCell(m,c);return p?p.getWidth()===0||p.getChars().trim()!=="":!1}}}const CC=(i,n)=>i!==null&&i.row===n.row&&i.col===n.col&&i.rows===n.rows&&i.cols===n.cols;function TC({termRef:i,enabled:n,onOpen:a}){const[s,r]=T.useState(!1),[c,d]=T.useState(null),m=T.useCallback(()=>r(!0),[]),p=T.useCallback(()=>r(!1),[]);T.useEffect(()=>{n||r(!1)},[n]),T.useEffect(()=>{const y=i.current;if(!s||!y){d(null);return}const v=()=>{const w=SC(y),C=w?wC(w):null;if(!C){r(!1);return}d(A=>CC(A,C)?A:C)};v();const S=y.onRender(v),x=y.textarea;return x==null||x.addEventListener("focus",p),()=>{S.dispose(),x==null||x.removeEventListener("focus",p)}},[s,i,p]);const g=T.useCallback(()=>{var y;r(!1);try{(y=i.current)==null||y.focus()}catch{}a==null||a()},[i,a]);return{box:s?c:null,offer:m,dismiss:p,open:g}}const MC=({term:i,surface:n,main:a,box:s,label:r,onOpen:c})=>{if(!i||!a)return null;const d=ti(i),m=(n==null?void 0:n.querySelector(".xterm-screen"))||n;if(!m)return null;const p=m.getBoundingClientRect(),g=a.getBoundingClientRect();return h.jsx("button",{type:"button","data-testid":"keyboard-offer","aria-label":r,title:r,onClick:c,className:"absolute z-30 flex select-none items-center justify-center rounded-sm border border-tui-accent/50 bg-tui-mantle/60 p-0 text-tui-accent opacity-80 backdrop-blur-[1px] active:opacity-100",style:{left:`${p.left-g.left+s.col*d.cellWidth+1}px`,top:`${p.top-g.top+s.row*d.cellHeight+1}px`,width:`${s.cols*d.cellWidth-2}px`,height:`${s.rows*d.cellHeight-2}px`,touchAction:"manipulation"},children:h.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-[80%] max-h-5 w-auto",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[h.jsx("rect",{x:"2.5",y:"6",width:"19",height:"12",rx:"1.5"}),h.jsx("path",{d:"M6 10h.01M9.5 10h.01M13 10h.01M16.5 10h.01M8 14h8"})]})})};async function qd(i){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(i),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let n=null,a=null,s=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=i,typeof window<"u"&&typeof window.getSelection=="function"&&(s=window.getSelection(),s&&s.rangeCount>0&&(a=s.getRangeAt(0))),document.body.appendChild(n),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const d=document.createRange();d.selectNodeContents(n),s&&(s.removeAllRanges(),s.addRange(d)),n.setSelectionRange(0,i.length)}else n.focus({preventScroll:!0}),n.select();if(document.execCommand("copy"))return"exec"}catch{}finally{n!=null&&n.parentNode&&n.parentNode.removeChild(n),s&&(s.removeAllRanges(),a&&s.addRange(a))}}return"failed"}async function AC(){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 EC(){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 s=a.types.find(r=>r.startsWith("image/"));if(s){const r=await a.getType(s);if(r&&r.size>0)return{ok:!0,blob:r}}}return{ok:!1,reason:"empty"}}catch(n){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const 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 Hy(i){const n=i.clipboardData;if(!n)return null;if(n.files&&n.files.length>0)for(let a=0;a<n.files.length;a++){const s=n.files[a];if(s!=null&&s.type.startsWith("image/"))return s}if(n.items&&n.items.length>0)for(let a=0;a<n.items.length;a++){const s=n.items[a];if(s!=null&&s.type.startsWith("image/")){const r=s.getAsFile();if(r)return r}}return null}function kC(i){if(!i||i.length===0)return null;for(let n=0;n<i.length;n++){const a=i[n];if(a&&(a.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(a.name)))return a}return null}const NC=({isOpen:i,onClose:n,onSend:a,onSendImage:s})=>{const{t:r}=Ee(),{addToast:c}=fn(),[d,m]=T.useState(""),[p,g]=T.useState(null),[y,v]=T.useState(!1),S=T.useRef(null),x=T.useRef(null),w=T.useRef(null),C=async B=>{if(B.size===0){c("error",r("clipboard.fileEmpty"));return}v(!0);try{const O=await Qb(B);O?(g(O),m("")):c("error",r("clipboard.imageTooLarge"))}catch(O){console.error("Failed to process image:",O),c("error",r("clipboard.imageTooLarge"))}finally{v(!1)}},A=async B=>{const O=Hy(B);O&&(B.preventDefault(),await C(O))},N=async B=>{const O=kC(B.target.files);B.target.value="",O&&await C(O)},E=B=>{const O=B.target.value;m(O),O&&p&&g(null)},_=()=>{g(null),S.current&&(S.current.value=""),x.current&&(x.current.value="")},D=()=>{p?(s==null||s(p),n()):d.trim()&&(a(d),n())},P=!!(d.trim()||p);return h.jsx(ga,{isOpen:i,onClose:n,title:r("clipboard.pasteTitle"),closeLabel:r("clipboard.cancel"),size:"sm",footer:h.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h.jsx(Me,{variant:"ghost",onClick:n,children:r("clipboard.cancel")}),h.jsx(Me,{variant:"primary",onClick:D,disabled:!P||y,children:r("clipboard.pasteSend")})]}),children:h.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[h.jsxs("div",{className:"flex flex-col gap-1.5",children:[h.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:r("clipboard.pasteHint")}),h.jsx("textarea",{ref:w,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:r("clipboard.pasteHint"),value:d,onChange:E,onPaste:A,disabled:!!p||y,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),h.jsxs("div",{className:"relative my-1",children:[h.jsx("div",{className:"absolute inset-0 flex items-center",children:h.jsx("div",{className:"w-full border-t border-tui-border"})}),h.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:h.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:r("clipboard.imageSectionTitle")})})]}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:N}),h.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:N}),p?h.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[h.jsx("img",{src:p.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),h.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[h.jsx("span",{children:r("clipboard.imageCompressedSize",{size:M1(p.byteLength)})}),h.jsx(Me,{variant:"ghost",onClick:_,"aria-label":r("clipboard.removeImage"),children:r("clipboard.cancel")})]})]}):h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(Me,{variant:"default",onClick:()=>{var B;return(B=S.current)==null?void 0:B.click()},disabled:y||!!d.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.chooseImage"),children:r("clipboard.chooseImage")}),h.jsx(Me,{variant:"default",onClick:()=>{var B;return(B=x.current)==null?void 0:B.click()},disabled:y||!!d.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":r("clipboard.takePhoto"),children:r("clipboard.takePhoto")})]}),y&&h.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:h.jsx("span",{children:r("clipboard.imageCompressing")})})]})]})})},Jl="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",ea="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",_C=({anchorPoint:i,hasSelection:n,isController:a,vibrateOnKeyPress:s=!1,linkUrl:r=null,onOpenLink:c,onCopySelection:d,onCopyLine:m,onCopyScreen:p,onPaste:g,onClose:y})=>{const{t:v}=Ee(),S=T.useRef(null),[x,w]=T.useState(null);T.useEffect(()=>{if(s&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[s]),T.useLayoutEffect(()=>{const E=S.current;if(!(E!=null&&E.parentElement))return;const _=E.parentElement.getBoundingClientRect(),D=E.getBoundingClientRect(),P=D.width||208,B=D.height||220,O=_.width,k=_.height;let R=i.x-P/2;R=Math.max(8,Math.min(Math.max(8,O-P-8),R));let I=i.y-B-8;I<8&&(I=i.y+8),I=Math.max(8,Math.min(Math.max(8,k-B-8),I)),w({x:R,y:I})},[i.x,i.y,n,a,r]);const C=Math.max(8,i.x-104),A=Math.max(8,i.y-200),N={position:"absolute",left:`${x?x.x:C}px`,top:`${x?x.y:A}px`,visibility:x?"visible":"hidden"};return h.jsx("div",{ref:S,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:h.jsxs(Et,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[r&&c&&h.jsxs("button",{type:"button",role:"menuitem",className:ie(Jl,ea),onClick:()=>{c(r),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),h.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:Sw(r)})]}),n&&h.jsxs("button",{type:"button",role:"menuitem",className:ie(Jl,ea),onClick:()=>{d(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),h.jsxs("button",{type:"button",role:"menuitem",className:ie(Jl,ea),onClick:()=>{m(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),h.jsxs("button",{type:"button",role:"menuitem",className:ie(Jl,ea),onClick:()=>{p(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),a&&h.jsxs("button",{type:"button",role:"menuitem",className:ie(Jl,ea),onClick:()=>{g(),y()},children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),h.jsxs("button",{type:"button",role:"menuitem",className:ie(Jl,ea),onClick:y,children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ne.cursor}),h.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},LC={state:"idle",deltaY:0,lines:0,viewportY:null,scrollTop:null,scrollHeight:null,clientHeight:null,moved:!1,focused:!1,bufferType:null,baseY:null,cursorY:null,hasScrollback:null,mouseTracking:!1,scrollMode:"none",scrollCalls:0,lastScrollLines:null,lastInputEvent:"",pointerEvents:0,touchEvents:0};function RC(){return typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1"}function jC(i){const n=T.useRef([]),[a,s]=T.useState({framesPerSec:0,bytesPerSec:0}),r=T.useCallback(d=>{const m=d-1e3,p=n.current;for(;p.length>0&&p[0].time<m;)p.shift()},[]);T.useEffect(()=>{if(!i)return;const d=setInterval(()=>{r(performance.now());let m=0;for(const p of n.current)m+=p.bytes;s({framesPerSec:n.current.length,bytesPerSec:m})},1e3);return()=>clearInterval(d)},[i,r]);const c=T.useCallback(d=>{const m=performance.now();n.current.push({time:m,bytes:d}),r(m)},[r]);return{metrics:a,record:c}}function OC(i){return i?`${i.kind} row ${i.row} cols ${i.startCol}-${i.endCol} caret ${i.caretCol}`:"none"}function DC(i){var s;const n=(s=i==null?void 0:i.canvas)==null?void 0:s.stats;if(!n)return`paint: ${(i==null?void 0:i.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 zC(i){const n=(i==null?void 0:i.getTrace())??[];return n.length===0?"trace: -":`trace:
|
|
36
|
-
${n.slice(-6).map(a=>` ${a.event}${a.count>1?` ×${a.count}`:""}`).join(`
|
|
37
|
-
`)}`}const HC=({debug:i,rttMs:n,metrics:a,rendererKind:s,predictiveEcho:r,predictor:c,field:d,renderer:m})=>{const p=c==null?void 0:c.getEchoSrttMs();return h.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: ${i.state}
|
|
38
|
-
`,`deltaY: ${i.deltaY} lines: ${i.lines}
|
|
39
|
-
`,`viewportY: ${i.viewportY??"-"} focus: ${i.focused}
|
|
40
|
-
`,`buffer: ${i.bufferType??"-"} base: ${i.baseY??"-"} cursor: ${i.cursorY??"-"} scrollback: ${i.hasScrollback??"-"}
|
|
41
|
-
`,`scroll: ${i.scrollTop??"-"} / ${i.scrollHeight??"-"} (h ${i.clientHeight??"-"}) moved: ${i.moved}
|
|
42
|
-
`,`mode: ${i.scrollMode} calls: ${i.scrollCalls} lines: ${i.lastScrollLines??"-"} mouse: ${i.mouseTracking}
|
|
43
|
-
`,`event: ${i.lastInputEvent||"-"} pointer: ${i.pointerEvents} touch: ${i.touchEvents}
|
|
44
|
-
`,`rtt: ${n!==null?`${n}ms`:"-"} frames/s: ${a.framesPerSec} bytes/s: ${a.bytesPerSec} renderer: ${s??"-"}
|
|
45
|
-
`,`prediction: ${(c==null?void 0:c.getState())??"-"} mode: ${r} pending: ${(c==null?void 0:c.getVisiblePredictions().length)??0} srtt: ${p!=null?`${Math.round(p)}ms`:"-"}
|
|
46
|
-
`,`field: ${OC(d)} mismatches: ${(c==null?void 0:c.getMismatchCount())??0}
|
|
47
|
-
`,DC(m),zC(c)]})};function En(i){const n=T.useRef(i);return n.current=i,n}function BC(i){const n=En(i),{termRef:a,subscribeToPasteFileReady:s}=i,[r,c]=T.useState(!1),d=T.useCallback((v,S)=>{n.current.onPaste(),v.paste(S),n.current.addToast("success",n.current.t("clipboard.pasted"))},[n]),m=T.useCallback(()=>{const v=a.current;return v?n.current.isController?v:(n.current.warnViewerMode(),null):null},[a,n]),p=T.useCallback(async()=>{const v=m();if(v){try{const S=await EC();if(S.ok){await n.current.uploadImage(S.blob);return}}catch{}try{const S=await AC();if(S.ok){d(v,S.text);return}else if(S.reason==="empty"){n.current.addToast("info",n.current.t("clipboard.pasteUnavailable"));return}}catch{}c(!0)}},[m,d,n]),g=T.useCallback(v=>{const S=m();S&&d(S,v)},[m,d]),y=T.useCallback(v=>{m()&&n.current.uploadImage(v)},[m,n]);return T.useEffect(()=>s(v=>{const S=a.current;S&&d(S,v)}),[s,a,d]),{isPasteFallbackOpen:r,closePasteFallback:()=>c(!1),handlePaste:p,handleFallbackPasteSend:g,handleFallbackImageSend:y}}const sr=new Set(["│","┃","║","▐","▕","▏","▌"]),vr=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),UC=new Set(["╭","┌","┏","╔"]),KC=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),IC=new Set(["╮","┐","┓","╗"]),FC=new Set(["╰","└","┗","╚"]),GC=new Set(["╯","┘","┛","╝"]),nd=new Set(["─","━","═","╌","┄"]),By=new Set(["❯","›",">","!"]),Yg=new Set(["$","#","%",">","❯","›","➜","λ","»"]);function kn(i){return i===""||i===" "||i===" "}class YC{constructor(n){V(this,"cell");V(this,"top");V(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 s;if(!(n<this.top||n>this.bottom||a<0||a>=this.screen.cols))return(s=this.screen.getLine(n))==null?void 0:s.getCell(a,this.cell)}char(n,a){var s;return((s=this.at(n,a))==null?void 0:s.getChars())??""}dim(n,a){var s,r;return!!((r=(s=this.at(n,a))==null?void 0:s.isDim)!=null&&r.call(s))}text(n,a,s){var r;return n<this.top||n>this.bottom?"":((r=this.screen.getLine(n))==null?void 0:r.translateToString(!0,a,s))??""}isEdge(n,a){if(!sr.has(this.char(n,a)))return!1;const s=this.char(n-1,a),r=this.char(n+1,a);return sr.has(s)||vr.has(s)||sr.has(r)||vr.has(r)}blankOrDim(n,a,s){var r;for(let c=a;c<s;c++){const d=this.at(n,c);if(d&&!kn(d.getChars())&&!((r=d.isDim)!=null&&r.call(d)))return!1}return!0}}function PC(i,n,a){if(i.isEdge(n,a))return null;let s=0;for(let c=a-1;c>=0;c--)if(i.isEdge(n,c)){s=c+1;break}let r=i.cols;for(let c=a+1;c<i.cols;c++)if(i.isEdge(n,c)){r=c;break}return s<r?{start:s,end:r}:null}const Nd=8,$C=12,_d=2,Pg=1,VC=4,qC=3,XC=20,$g=/-- INSERT --/,WC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,ZC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,QC=/^\s*\d+[.)]\s/;function Vg(i,n,a){if(!nd.has(i.char(n,a.start))||!nd.has(i.char(n,a.end-1))||vr.has(i.char(n,a.start-1)))return!1;const s=a.end-a.start;let r=0;for(let c=a.start;c<a.end;c++)if(nd.has(i.char(n,c)))r++;else if(c-a.start-r>s*.1)return!1;return r>=s*.9}function ma(i){return`${i.start}-${i.end}`}function Uy(i,n,a){if(a.start===0)return i.top;for(let s=n-1;s>=i.top;s--)if(KC.has(i.char(s,a.start-1)))return s;return i.top}function JC(i,n,a){const s=a.start-1,r=a.end,{row:c}=n;if(s<0||r>=i.cols)return null;const d=i.char(c,s);if(!sr.has(d)||i.char(c,r)!==d)return null;let m=c-1;for(;m>=i.top&&i.char(m,s)===d;)m--;let p=c+1;for(;p<=i.bottom&&i.char(p,s)===d;)p++;if(p-m-1>Nd||!UC.has(i.char(m,s))||!IC.has(i.char(m,r))||!FC.has(i.char(p,s))||!GC.has(i.char(p,r))||i.dim(c,s))return null;const g=a.start+Pg,y=a.end-Pg;return n.col<g||n.col>=y?null:{kind:"frame",key:`frame:${ma(a)}`,region:ma(a),layout:`${m}`,row:c,caretCol:n.col,startCol:g,endCol:y,empty:m+2===p&&n.col===g&&i.blankOrDim(c,g,y),agentLike:!0,vimInsert:null,modal:!1,midWord:!1}}function eT(i,n,a){const{row:s}=n;let r=-1;for(let y=s-1;y>=Math.max(i.top,s-Nd);y--)if(Vg(i,y,a)){r=y;break}if(r<0)return null;let c=-1;for(let y=s+1;y<=Math.min(i.bottom,s+Nd);y++)if(Vg(i,y,a)){c=y;break}if(c<0)return null;const d=r+1;let m=-1;for(let y=a.start;y<Math.min(a.end,a.start+3);y++){const v=i.char(d,y);if(!kn(v)){By.has(v)&&kn(i.char(d,y+1))&&(m=y);break}}if(m<0||i.dim(d,m)||QC.test(i.text(d,m+1,a.end)))return null;for(let y=d+1;y<c;y++)for(let v=a.start;v<a.start+_d;v++)if(!kn(i.char(y,v)))return null;let p="";for(let y=c+1;y<=Math.min(i.bottom,c+$C)&&!vr.has(i.char(y,a.start-1));y++)p+=`${i.text(y,a.start,a.end)}
|
|
48
|
-
`;if(ZC.test(p)||WC.test(p))return null;const g=s===d?m+2:a.start+_d;return n.col<g||n.col>=a.end?null:{kind:"rule",key:`rule:${ma(a)}:${Uy(i,r,a)}`,region:ma(a),layout:`${r}`,row:s,caretCol:n.col,startCol:g,endCol:a.end,empty:c-r===2&&n.col===g&&i.blankOrDim(s,g,a.end),agentLike:!0,vimInsert:$g.test(p),modal:$g.test(p),midWord:!1}}function tT(i,n,a){if(n.hidden)return null;const{row:s,col:r}=n,c=nT(i,n,a);if(c!==void 0)return c;for(let d=r-1;d>=a.start;d--){if(i.char(s,d)!==">")continue;const m=i.text(s,a.start,d+1).trimStart();if(/^(?:[a-z]:\\.*|\\\\[^\\]+\\[^\\]+.*|PS\s+[a-z]:\\.*)>$/i.test(m))return or(i,n,a,s,d+1,!1)}for(let d=r-2;d>=a.start;d--)if(!(!Yg.has(i.char(s,d))||!kn(i.char(s,d+1))))return i.dim(s,d)?null:or(i,n,a,s,d+2,d===a.start);for(let d=s-1;d>=Math.max(i.top,s-qC);d--){let m=a.end-1;for(;m>=a.start&&kn(i.char(d,m));)m--;if(m>=a.end-1-VC&&Yg.has(i.char(d,m)))return i.dim(d,m)?null:or(i,n,a,d,a.start,!1);if(m<a.end-1)return null}return null}function nT(i,n,a){const{row:s}=n,r=a.start+_d,c=d=>kn(i.char(d,a.start))&&kn(i.char(d,a.start+1));if(c(s))for(let d=s-1;d>=Math.max(i.top,s-XC);d--){if(By.has(i.char(d,a.start))&&kn(i.char(d,a.start+1)))return i.dim(d,a.start)?null:or(i,n,a,d,r,!0,r);if(!c(d)||i.blankOrDim(d,r,a.end))return}}function or(i,n,a,s,r,c,d=a.start){const m=n.row===s?r:d;if(n.col<m||n.col>=a.end)return null;const p=a.end-2,g=n.row>s&&d>a.start&&n.col===m&&!kn(i.char(n.row-1,p));return{kind:"prompt",key:`prompt:${ma(a)}:${Uy(i,s,a)}`,region:ma(a),layout:`${s}`,row:n.row,caretCol:n.col,startCol:m,endCol:a.end,empty:n.row===s&&n.col===m&&i.blankOrDim(n.row,m,a.end),agentLike:c,vimInsert:null,modal:!1,midWord:g}}function iT(i,n){const a=new YC(i);if(n.row<a.top||n.row>a.bottom||n.col<0||n.col>=i.cols)return null;const s=PC(a,n.row,n.col);return s?JC(a,n,s)??eT(a,n,s)??tT(a,n,s):null}class lT{constructor(){V(this,"insertSeen",new Set)}detect(n,a){const s=iT(n,a);return!s||s.vimInsert===null?s:s.vimInsert?(this.insertSeen.add(s.region),s):this.insertSeen.has(s.region)?null:s}reset(){this.insertSeen.clear()}}class aT{constructor(n){V(this,"tracker",new lT);V(this,"cached");V(this,"lastComplete",null);V(this,"detect",()=>{var n,a;if((a=(n=this.options).isSynchronizing)!=null&&a.call(n))return this.lastComplete;if(this.cached===void 0){const s=this.options.getScreen(),r=this.options.getCursor();this.cached=s&&r?this.tracker.detect(s,r):null,this.lastComplete=this.cached}return this.cached});this.options=n}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const na=4294967295;var Qe=(i=>(i[i.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",i[i.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",i[i.WIDTH_SHIFT=22]="WIDTH_SHIFT",i))(Qe||{}),Je=(i=>(i[i.PCOLOR_MASK=255]="PCOLOR_MASK",i[i.CM_MASK=50331648]="CM_MASK",i[i.CM_DEFAULT=0]="CM_DEFAULT",i[i.CM_P16=16777216]="CM_P16",i[i.CM_P256=33554432]="CM_P256",i[i.CM_RGB=50331648]="CM_RGB",i[i.RGB_MASK=16777215]="RGB_MASK",i))(Je||{}),st=(i=>(i[i.INVERSE=67108864]="INVERSE",i[i.BOLD=134217728]="BOLD",i[i.UNDERLINE=268435456]="UNDERLINE",i[i.BLINK=536870912]="BLINK",i[i.INVISIBLE=1073741824]="INVISIBLE",i[i.STRIKETHROUGH=2147483648]="STRIKETHROUGH",i))(st||{}),Oi=(i=>(i[i.ITALIC=67108864]="ITALIC",i[i.DIM=134217728]="DIM",i[i.HAS_EXTENDED=268435456]="HAS_EXTENDED",i[i.PROTECTED=536870912]="PROTECTED",i[i.OVERLINE=1073741824]="OVERLINE",i))(Oi||{}),ia=(i=>(i[i.NONE=0]="NONE",i[i.SINGLE=1]="SINGLE",i[i.DOUBLE=2]="DOUBLE",i[i.CURLY=3]="CURLY",i[i.DOTTED=4]="DOTTED",i[i.DASHED=5]="DASHED",i))(ia||{});function sT(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const xr={fg:0,bg:0,ext:0};function Ky(i){return i.bg&268435456&&i.extended?i.extended.ext>>>0:0}function oT(i){return i>>>26&7}function rT(i){return i&67108863}function cT(i,n){const a=i.codePointAt(0)??0;return i.length>0&&String.fromCodePoint(a).length===i.length?{content:a|n<<22,combinedData:""}:{content:2097152|n<<22,combinedData:i}}function wr(i){const n=i;return!n||typeof n.fg!="number"||typeof n.bg!="number"?null:{fg:n.fg>>>0,bg:n.bg>>>0,ext:Ky(n)}}const lr=new Map;function Iy(i){let n=lr.get(i);return n===void 0&&(n=`#${(i&Je.RGB_MASK).toString(16).padStart(6,"0")}`,lr.size>4096&&lr.clear(),lr.set(i,n)),n}function Fy(i,n,a){var s;switch(i&Je.CM_MASK){case Je.CM_P16:case Je.CM_P256:return((s=n.ansi[i&Je.PCOLOR_MASK])==null?void 0:s.css)??a;case Je.CM_RGB:return Iy(i&Je.RGB_MASK);default:return a}}function ys(i,n,a,s){var v;const r=(i&st.INVERSE)!==0,c=r?n:i,d=r?i:n;let m;const p=c&Je.CM_MASK;if(p===Je.CM_P16||p===Je.CM_P256){let S=c&Je.PCOLOR_MASK;s&&i&st.BOLD&&S<8&&(S+=8),m=((v=a.ansi[S])==null?void 0:v.css)??a.foreground.css}else p===Je.CM_RGB?m=Iy(c&Je.RGB_MASK):m=r?a.background.css:a.foreground.css;const g=d&Je.CM_MASK,y=g===Je.CM_DEFAULT?r?a.foreground.css:a.background.css:Fy(d,a,a.background.css);return{fg:m,bg:y,bgIsDefault:!r&&g===Je.CM_DEFAULT}}function ra(i){return(i&st.BOLD)!==0}function vs(i){return(i&Oi.ITALIC)!==0}function As(i){return(i&Oi.DIM)!==0}function aa(i){return(i&st.INVISIBLE)!==0}function Gy(i){var a,s,r,c;const n=i._core;return!(n!=null&&n.screenElement)||!n.coreService||!((a=n.optionsService)!=null&&a.rawOptions)||!((s=n._bufferService)!=null&&s.buffer)||!n._charSizeService||!n._coreBrowserService||!((r=n._themeService)!=null&&r.colors)||typeof((c=n._renderService)==null?void 0:c.setRenderer)!="function"?null:n}class uT{constructor(){V(this,"listeners",new Set);V(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()}}class dT{constructor(n){V(this,"provider",null);V(this,"core");V(this,"layer");V(this,"subscriptions",[]);var s;this.terminal=n,this.core=Gy(n);const a=(s=this.core)==null?void 0:s.screenElement;this.layer=a?a.ownerDocument.createElement("div"):null,a&&this.layer&&(this.layer.setAttribute("aria-hidden","true"),Object.assign(this.layer.style,{position:"absolute",inset:"0",pointerEvents:"none",zIndex:"7",overflow:"hidden"}),a.append(this.layer),this.subscriptions.push(n.onRender(()=>this.invalidateOverlay()),n.onScroll(()=>this.invalidateOverlay())))}setOverlayProvider(n){this.provider=n,this.invalidateOverlay()}invalidateOverlay(){var y,v,S,x;const n=this.core,a=this.layer,s=n==null?void 0:n.screenElement;if(!n||!a||!s)return;a.replaceChildren(),delete s.dataset.predictiveEcho;const r=(y=this.provider)==null?void 0:y.call(this),c=(v=n._renderService.dimensions)==null?void 0:v.css.cell;if(!(r!=null&&r.cells.length)||!(c!=null&&c.width)||!c.height)return;const d=n.optionsService.rawOptions,m=n._themeService.colors,p=this.terminal.buffer.active,g=w=>{const C=w.row-p.viewportY;if(C<0||C>=this.terminal.rows)return null;const A=s.ownerDocument.createElement("span"),N=ys(w.style.fg,w.style.bg,m,d.drawBoldTextInBrightColors);return A.textContent=aa(w.style.fg)?" ":w.chars,Object.assign(A.style,{position:"absolute",left:`${w.col*c.width}px`,top:`${C*c.height}px`,width:`${w.width*c.width}px`,height:`${c.height}px`,lineHeight:`${c.height}px`,whiteSpace:"pre",color:As(w.style.bg)?`color-mix(in srgb, ${N.fg} 50%, ${N.bg})`:N.fg,backgroundColor:N.bg,fontFamily:d.fontFamily,fontSize:`${d.fontSize}px`,fontWeight:String(ra(w.style.fg)?d.fontWeightBold:d.fontWeight),fontStyle:vs(w.style.bg)?"italic":"normal",textDecoration:w.style.fg&st.UNDERLINE?"underline":"none"}),a.append(A),A};if(r.cursor){s.dataset.predictiveEcho="true";const w=s.ownerDocument.createElement("style");w.textContent=".xterm-screen[data-predictive-echo] .xterm-cursor { visibility: hidden; }",a.append(w);const C=p.baseY+p.cursorY,A=(S=p.getLine(C))==null?void 0:S.getCell(p.cursorX);g({row:C,col:p.cursorX,chars:(A==null?void 0:A.getChars())||" ",width:(A==null?void 0:A.getWidth())===2?2:1,style:wr(A)??xr})}for(const w of r.cells)g(w);if(r.cursor){const{row:w,col:C}=r.cursor,A=(x=p.getLine(w))==null?void 0:x.getCell(C),N=[...r.cells].reverse().find(_=>_.row===w&&_.col===C),E=g(N??{row:w,col:C,chars:(A==null?void 0:A.getChars())||" ",width:1,style:wr(A)??xr});if(E){const _=d.cursorStyle;if(!n._coreBrowserService.isFocused||_!=="block"){E.style.backgroundColor="transparent",E.textContent="",E.style.boxSizing="border-box";const D=_==="bar"?"borderLeft":_==="underline"?"borderBottom":"border";E.style[D]=`${_==="bar"&&d.cursorWidth||1}px solid ${m.cursor.css}`}else E.style.color=m.cursorAccent.css,E.style.backgroundColor=m.cursor.css}}}dispose(){var n,a;this.provider=null;for(const s of this.subscriptions)s.dispose();(n=this.layer)==null||n.remove(),(a=this.core)!=null&&a.screenElement&&delete this.core.screenElement.dataset.predictiveEcho}}class fT{constructor(n){V(this,"items",[]);V(this,"target",null);V(this,"domTarget",null);V(this,"provider",()=>this.paint());this.options=n}attach(n){var a;if(!n){const s=this.options.getTerminal();s&&(n=this.domTarget??(this.domTarget=new dT(s)))}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(){var n,a;(n=this.target)==null||n.setOverlayProvider(null),this.target=null,(a=this.domTarget)==null||a.dispose(),this.domTarget=null,this.items=[]}paint(){var S,x;const n=this.options.getTerminal(),a=n==null?void 0:n.buffer.active;if(!n||!a)return null;const s=this.options.isCursorHidden(),r=a.baseY+a.cursorY,c=a.cursorX,d=Ld(n,r,c),m=s&&!!d&&Yy(d);if(this.items.length===0){if(!m)return null;const w=((x=(S=a.getLine(r))==null?void 0:S.getCell(c))==null?void 0:x.getChars())??"";return{cells:[],paintedCaret:qg(r,c,w,d)}}const p=[];let g,y;for(const w of this.items)switch(w.kind){case"char":p.push({row:w.row,col:w.col,chars:w.char,width:w.width,style:w.style??mT(n,w.row,w.col)});break;case"erase":p.push({row:w.row,col:w.col,chars:" ",width:w.width,style:hT(w.style??Ld(n,w.row,w.col)??xr)});break;case"mask":m&&w.row===r&&w.col===c&&p.push({row:w.row,col:w.col,chars:w.char,width:1,style:w.style??Py(d)});break;case"caret":s?m&&(p.push({row:w.row,col:w.col,chars:w.char,width:1,style:d}),y=qg(w.row,w.col,w.char,d)):g={row:w.row,col:w.col};break}const v={cells:p};return g!==void 0&&(v.cursor=g),y&&(v.paintedCaret=y),v}}function qg(i,n,a,s){return{row:i,col:n,style:s,plain:{row:i,col:n,chars:a||" ",width:1,style:Py(s)}}}function Ld(i,n,a){var s;return a<0||a>=i.cols?null:wr((s=i.buffer.active.getLine(n))==null?void 0:s.getCell(a))}function Yy(i){return(i.fg&st.INVERSE)!==0||(i.bg&Je.CM_MASK)!==Je.CM_DEFAULT}function Py(i){return{fg:i.fg&~st.INVERSE,bg:i.bg&~(Je.CM_MASK|Je.RGB_MASK),ext:i.ext}}function hT(i){return{fg:i.fg&st.INVERSE?i.fg&(st.INVERSE|Je.CM_MASK|Je.RGB_MASK):0,bg:i.bg&(Je.CM_MASK|Je.RGB_MASK),ext:0}}function mT(i,n,a){const s=Ld(i,n,a-1);return s&&!Yy(s)&&!(s.bg&Oi.DIM)?s:xr}const $y="\x1B",pT=/^\x1b\[[IO]/,Vy=/^\x1b\[<(\d+);\d+;\d+[Mm]/,gT=/^\x1b\[M[\s\S]{3}/,bT=[/^\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\\/],yT=/^\x1b\[1;[2-8]R/;function Xg(i){if(yT.test(i))return 0;const n=pT.exec(i);if(n)return n[0].length;const a=Vy.exec(i);if(a){const s=Number(a[1]);return(s&32)!==0&&(s&3)===3&&(s&64)===0?a[0].length:0}for(const s of bT){const r=s.exec(i);if(r)return r[0].length}return 0}function qy(i){if(!i.startsWith($y))return"keys";if(Vy.test(i)||gT.test(i)){let a=i;for(;a.length>0;){const s=Xg(a);if(s===0)return"pointer";a=a.slice(s)}return"passive"}let n=i;for(;n.length>0;){const a=Xg(n);if(a===0)return"keys";n=n.slice(a)}return"passive"}function vT(i){return i===$y}function Jn(i){return i===""||i===" "?" ":i}function xT(i,n,a,s=64){var d;const r=i.buffer.active.getLine(n),c=[];for(let m=a-1;m>=0&&c.length<s;m--){const p=r==null?void 0:r.getCell(m);if(!p)break;((d=p.getWidth)==null?void 0:d.call(p))!==0&&c.unshift(Jn(p.getChars()))}return c}function wT(i,n){for(let a=Math.min(i.length,n.length);a>0;a--){let s=!0;for(let r=0;r<a&&s;r++)s=n[n.length-a+r]===Jn(i[r]);if(s)return a}return 0}function ST(i){const n=i.buffer.active;return{key:"legacy",row:n.baseY+n.cursorY,caretCol:n.cursorX,startCol:n.cursorX,endCol:i.cols,empty:!1,agentLike:!1}}function CT(i,{style:n,predictedCursor:a,field:s,runStartedEmpty:r,active:c}){var x,w,C,A,N;const d=i.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),_}),m=i[i.length-1],p=a??{row:m.row,col:m.kind==="erase"||m.cancelled?m.col:m.col+m.width},g=(E,_)=>d.some(D=>D.row===E&&D.col<=_&&_<D.col+D.width),y=i.some(E=>E.kind==="char"&&!E.cancelled);if(c&&s&&r&&y&&s.agentLike&&p.row===s.row){const E=c.getLine(p.row);for(let _=p.col;_<s.endCol;_++){if(g(p.row,_)||Jn(((x=E==null?void 0:E.getCell(_))==null?void 0:x.getChars())??"")===" ")continue;const D={row:p.row,col:_,char:" ",width:1,kind:"erase"};n&&(D.style=n),d.push(D)}}if(c){const E={row:c.baseY+c.cursorY,col:c.cursorX};if(!g(E.row,E.col)&&(E.row!==p.row||E.col!==p.col)){const _=((C=(w=c.getLine(E.row))==null?void 0:w.getCell(E.col))==null?void 0:C.getChars())??"",D={row:E.row,col:E.col,char:Jn(_),width:1,kind:"mask"};n&&(D.style=n),d.push(D)}}const v=d.find(E=>E.row===p.row&&E.col===p.col&&E.kind!=="mask"),S=v?v.char:Jn(((N=(A=c==null?void 0:c.getLine(p.row))==null?void 0:A.getCell(p.col))==null?void 0:N.getChars())??"");return d.push({row:p.row,col:p.col,char:S,width:1,kind:"caret"}),d}const TT=[[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 Xy(i){if(i>=32&&i<=126)return 1;if(i<12288)return 0;for(const[n,a]of TT){if(i<n)return 0;if(i<=a)return 2}return 0}const Rd=["ctrl+b"],MT=new Map([["meta","alt"],["bs","backspace"],["minus","-"],["comma",","],["period","."],["slash","/"],["quote","'"],["double_quote",'"'],["double-quote",'"'],["semicolon",";"],["colon",":"],["percent","%"],["ampersand","&"],["backtick","`"]]),Wy=["ctrl","control"],Zy=["alt","option","meta"],AT=[...Wy,...Zy,"shift"];function Wg(i){const n=i.split("+"),a=[];try{a.push(...un(n.map(c=>MT.get(c)??c).join("+")))}catch(c){if(c instanceof bn)return[];throw c}if(a.length!==1)return[];const s=n.find(c=>!AT.includes(c)),r=s==="space"?" ":s;if((r==null?void 0:r.length)===1&&n.some(c=>Wy.includes(c))){const c=Hd(r);c!==r&&a.push(n.some(d=>Zy.includes(d))?`\x1B${c}`:c)}return a}class Zg{constructor(n){V(this,"sequences");const a=new Set(n.flatMap(Wg));this.sequences=a.size>0?[...a]:[...new Set(Rd.flatMap(Wg))]}startsAt(n,a){return this.sequences.some(s=>n.startsWith(s,a))}}function ET(i){let n,a=new Zg(Rd);return()=>{const s=i==null?void 0:i();return s!==n&&(n=s,a=new Zg(s??Rd)),a}}const Qg=8,kT=1500,NT=4e3,_T=20;class LT{constructor(n){V(this,"getTerminal");V(this,"getFieldOption");V(this,"charWidth");V(this,"herdrPrefix");V(this,"now");V(this,"textDecoder",new TextDecoder("utf-8"));V(this,"confidentKeys",new Set);V(this,"fieldStyles",new Map);V(this,"field",null);V(this,"runStartedEmpty",!1);V(this,"predictions",[]);V(this,"predictedCursor",null);V(this,"srtt",null);V(this,"isSuppressed",!1);V(this,"suppressCursor",null);V(this,"suppressSentAt",0);V(this,"inFlight",[]);V(this,"inFlightUnknown",!1);V(this,"runInFlight",[]);V(this,"probationRun",!1);V(this,"runSent",[]);V(this,"lastSentUndrawn",!1);V(this,"awaitingPrefixCommand",!1);V(this,"mismatches",0);V(this,"trace",[]);this.getTerminal=n.getTerminal,this.getFieldOption=n.getField,this.charWidth=n.charWidth,this.herdrPrefix=ET(n.getHerdrPrefixKeys),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(s=>s.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 s=typeof a=="boolean"?a:(a==null?void 0:a.suppress)??!0,r=typeof a=="object"&&(a==null?void 0:a.demote)===!0;if(this.note(`reset: ${n??"unspecified"}`),r){const d=this.field??((c=this.getFieldOption)==null?void 0:c.call(this))??null;d&&this.confidentKeys.delete(d.key)}if(this.forgetInFlight(),s){this.isSuppressed=!0,this.suppressSentAt=this.now();const d=this.getTerminal();d?this.suppressCursor={row:d.buffer.active.baseY+d.buffer.active.cursorY,col:d.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}getExpiryDelayMs(){if(this.predictions.length===0)return null;const n=Math.min(...this.predictions.map(a=>a.sentAt));return Math.max(1,n+this.predictionTimeout()-this.now()+1)}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 p;const s=this.getTerminal(),r=s?{row:s.buffer.active.baseY+s.buffer.active.cursorY,col:s.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=r??{row:g.row,col:g.col},g.shownWhenFrozen=c&&!g.probation);const d=this.predictedCursor?{...this.predictedCursor}:r,m=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn||this.probationRun&&this.runSent.length===0;if(this.predictedCursor=null,this.note(`freeze: ${n}${a.demote?" (demote)":""}`),a.demote){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;g&&this.confidentKeys.delete(g.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=d,this.forgetInFlight(),this.inFlightUnknown=m}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(NT,Math.max(kT,(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 s;const a=(s=this.charWidth)==null?void 0:s.call(this,n);return a===0||a===1||a===2?a:1}coveredByPrediction(n,a){return this.predictions.some(s=>(s.echoed||s.cancelled||s.kind==="erase"&&!s.frozenFrom)&&s.row===n&&s.col<=a&&a<s.col+s.width)}ensureField(n){if(this.predictedCursor&&this.field)return this.field;const a=this.getFieldOption?this.getFieldOption():ST(n);if(!a)return null;let s=a.caretCol,r=[],c=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){r=this.inFlight.slice(wT(this.inFlight,xT(n,a.row,s)));for(const d of r){const m=d.codePointAt(0)??0;s+=Xy(m)||this.assumedWidth(m)}c=r.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=a,this.runStartedEmpty=a.empty&&r.length===0,this.predictions=this.predictions.filter(d=>d.frozenFrom),this.predictedCursor={row:a.row,col:s},this.runInFlight=r,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 s of this.predictions)s.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(n,a){const s=wr(a);if(s)for(this.fieldStyles.delete(n),this.fieldStyles.set(n,s);this.fieldStyles.size>Qg;){const r=this.fieldStyles.keys().next().value;if(r===void 0)break;this.fieldStyles.delete(r)}}markConfident(n){for(this.confidentKeys.delete(n),this.confidentKeys.add(n);this.confidentKeys.size>Qg;){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>_T&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const n=this.now(),a=this.predictionTimeout(),s=this.predictions.filter(r=>n-r.sentAt<=a);s.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=s,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(n){this.srtt===null?this.srtt=n:this.srtt=this.srtt*.8+n*.2}}const RT="?!#";class jT extends LT{handlePrintable(n,a,s){var w;const r=this.ensureField(s);if(!r||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const c=this.predictedCursor,d=this.predictions.every(C=>C.frozenFrom||C.cancelled)&&c.col===r.caretCol;if(r.agentLike&&r.empty&&d&&RT.includes(n))return this.freeze("agent mode switch"),!1;if(r.midWord&&d)return this.freeze("the word above may move down"),!1;if(c.col+a>r.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const m=(w=s.buffer.active.getLine(c.row))==null?void 0:w.getCell(c.col),p=[Jn(m?m.getChars():"")],g=this.predictions.findIndex(C=>C.kind==="erase"&&!C.frozenFrom&&C.row===c.row&&C.col===c.col);let y;g>=0&&([y]=this.predictions.splice(g,1),p.push(...y.before," "));for(const C of this.predictions)C.cancelled&&C.row===c.row&&C.col===c.col&&p.push(C.char);const v=s.buffer.active,S=v.baseY+v.cursorY,x=S>c.row||S===c.row&&v.cursorX>c.col;return this.predictions.push({row:c.row,col:c.col,char:n,width:a,kind:"char",before:p,sentAt:this.now(),replaces:y,probation:this.probationRun||void 0,behindCaret:x||void 0}),this.probationRun&&this.runSent.push(n),this.lastSentUndrawn=!1,c.col+=a,!0}skipUnpredictable(n,a,s){const r=this.ensureField(s),c=this.predictedCursor;if(!r||!c)return this.note("refused: caret is not in an input field"),!1;const d=this.assumedWidth(a);return c.col+d>r.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(n),this.lastSentUndrawn=!0,c.col+=d,this.note("width unknown: guessing"),!0)}handleBackspace(n){var s,r,c;let a;for(let d=this.predictions.length-1;d>=0&&!a;d--)this.predictions[d].cancelled||(a=this.predictions[d]);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 d=this.ensureField(n),m=this.predictedCursor;if(d&&m){const p=n.buffer.active.getLine(m.row),g=p==null?void 0:p.getCell(m.col-1),y=g&&((s=g.getWidth)==null?void 0:s.call(g))===0?2:1,v=m.col-y;let S=!0;for(let w=m.col;w<d.endCol&&S;w++)S=this.coveredByPrediction(m.row,w)||Jn(((r=p==null?void 0:p.getCell(w))==null?void 0:r.getChars())??"")===" ";const x=Jn(((c=p==null?void 0:p.getCell(v))==null?void 0:c.getChars())??"");if(v>=d.startCol&&S&&x!==" ")return this.predictions=this.predictions.filter(w=>!(w.echoed&&w.row===m.row&&w.col+w.width>v)),this.predictions.push({row:m.row,col:v,char:" ",width:y,kind:"erase",before:[x],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,m.col=v,!0}}return this.freeze("backspace into server content"),!1}}class OT extends jT{handleUserInput(n){var p;if(this.pruneExpired(),n.length===0)return;const a=this.textDecoder.decode(n,{stream:!1});if(!a)return;const s=qy(a);if(s==="passive")return;if(s==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}const r=this.herdrPrefix();if(vT(a)&&!r.startsAt(a,0)){const g=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;this.freeze("escape",{demote:(g==null?void 0:g.modal)!==!1});return}const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}const d=Array.from(a);let m=0;for(let g=0;g<d.length;g++){const y=d[g],v=y.codePointAt(0);if(v===void 0)continue;const S=m;if(m+=y.length,r.startsAt(a,S)){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(v===27||v===9||v===10||v===13||v<32&&v!==8){this.freeze("control or escape sequence");return}if(v===8||v===127){if(!this.handleBackspace(c)){g<d.length-1&&(this.inFlightUnknown=!0);return}continue}if(this.stillSuppressed()){this.inFlight.push(y),this.note("refused: waiting for the caret to move");continue}const x=Xy(v);if(x===0){if(!this.skipUnpredictable(y,v,c)){g<d.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(y,x,c)){g<d.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.field&&this.getFieldOption&&!this.getFieldOption()&&(this.reset("left input field",{suppress:!1,demote:!0}),this.field=null),this.updateSuppression(a)}settle(n,a){var d,m;const s=this.field;if(this.getFieldOption){const p=this.getFieldOption();if(!p||p.key!==(s==null?void 0:s.key)){if(this.predictions.every(g=>g.frozenFrom||g.echoed||g.cancelled)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(p.layout!==s.layout){this.predictions=[],this.predictedCursor=null,this.field=p,this.note("layout changed");return}}let r=[],c=!1;for(const p of this.predictions){if(p.cancelled){if(!c){const C=a.row>p.row||a.row===p.row&&a.col>=p.col+p.width;if(C||(p.behindCaret=void 0),p.passed&&!C)continue;C&&!p.behindCaret&&(p.passed=!0)}r.push(p),c=!0;continue}const g=(d=n.buffer.active.getLine(p.row))==null?void 0:d.getCell(p.col),y=Jn(g?g.getChars():""),v=p.kind==="char"?y===p.char&&(p.width===1||(((m=g==null?void 0:g.getWidth)==null?void 0:m.call(g))??2)===2):y===" ",S=p.before.includes(y);p.behindCaret&&(a.row<p.row||a.row===p.row&&a.col<=p.col)&&(p.behindCaret=void 0);const x=p.kind==="char"?(a.row>p.row||a.row===p.row&&a.col>=p.col+p.width)&&!(p.behindCaret&&S):a.row<p.row||a.row===p.row&&a.col<=p.col,w=p.kind==="char"&&y===p.char&&!v;if(c&&!p.frozenFrom){if(!v||S){r.push(p);continue}r=r.filter(C=>!C.cancelled),c=!1}if(!(p.echoed&&!v))if(v&&(x||!S)){if(p.echoed||this.confirm(p,s),x){p.kind==="char"&&s&&!p.frozenFrom&&this.learnStyle(s.key,g);continue}p.echoed=!0,r.push(p)}else if(p.frozenFrom){const C=p.frozenFrom,A=p.kind==="erase"||a.col>=C.col;!x&&a.row===C.row&&A?r.push(p):x&&p.probation&&(this.inFlightUnknown=!0)}else if(!x&&!w)r.push(p);else if(p.probation){this.note("probation guess dropped"),this.predictions.some(C=>!C.frozenFrom&&C.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(C=>C.frozenFrom),this.predictedCursor=null;return}else{this.mismatch("echo differs from prediction");return}}this.predictions=r,r.length===0&&(this.predictedCursor=null,this.probationRun&&(this.inFlightUnknown=!0))}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(n=>!n.echoed&&!n.cancelled).map(n=>({row:n.row,col:n.col,char:n.char}))}getOverlayItems(){var a;this.pruneExpired();const n=this.visiblePredictions();return n.length===0?[]:CT(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 DT=25,zT=2026,HT=1e3;function BT(i,n=()=>performance.now()){let a=!1,s=null;const r=new Set,c=y=>(r.add(y),{dispose:()=>void r.delete(y)}),d=()=>{a=!1,s=null},m=i.parser;if(!m||typeof m.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:c,reset:d,dispose:()=>{}};const p=y=>v=>{for(const S of v.flat())if(S===DT&&(a=!y),S===zT){const x=!y&&s!==null;if(s=y?n():null,x)for(const w of[...r])w()}return!1},g=[m.registerCsiHandler({prefix:"?",final:"h"},p(!0)),m.registerCsiHandler({prefix:"?",final:"l"},p(!1)),m.registerCsiHandler({intermediates:"!",final:"p"},()=>(d(),!1))];return typeof m.registerEscHandler=="function"&&g.push(m.registerEscHandler({final:"c"},()=>(d(),!1))),{isCursorHidden:()=>a,isSynchronizing:()=>s!==null&&n()-s<HT,onSyncEnd:c,reset:d,dispose:()=>{for(const y of g)y.dispose();r.clear()}}}const UT=40;function KT(i,n){return i==="off"?!1:i==="always"?!0:n!==null&&n>UT}function IT(i,n,a){var p;const s=BT(i),r=new aT({getScreen:()=>{const g=n();if(!g)return null;const y=g.buffer.active;return{cols:g.cols,rows:g.rows,baseY:y.baseY,getLine:v=>y.getLine(v),getNullCell:typeof y.getNullCell=="function"?()=>y.getNullCell():void 0}},getCursor:()=>{var y;const g=(y=n())==null?void 0:y.buffer.active;return g?{row:g.baseY+g.cursorY,col:g.cursorX,hidden:s.isCursorHidden()}:null},isSynchronizing:s.isSynchronizing}),c=(p=i._core)==null?void 0:p.unicodeService,d=new OT({getTerminal:n,getField:r.detect,getHerdrPrefixKeys:a,charWidth:typeof(c==null?void 0:c.wcwidth)=="function"?g=>c.wcwidth(g):void 0}),m=new fT({getTerminal:n,isCursorHidden:()=>s.isCursorHidden()});return{screenState:s,fieldProbe:r,predictor:d,overlay:m}}function FT({termRef:i,rendererRef:n,mode:a,connectionState:s,observeKeyInput:r,herdrPrefixKeys:c}){const d=T.useRef(null),m=T.useRef(null),p=T.useRef(null),g=T.useRef(null),y=En(a),v=En(c),S=T.useCallback(()=>{g.current!==null&&clearTimeout(g.current),g.current=null;const E=d.current,_=m.current;if(!E||!_)return;const D=E.getOverlayItems(),P=E.getExpiryDelayMs();if(P!==null&&(g.current=setTimeout(S,P)),!KT(y.current,E.getEchoSrttMs())){_.clear();return}_.sync(D)},[y]),x=T.useCallback(E=>{var _,D,P,B;(_=d.current)==null||_.reset(E),(D=d.current)==null||D.forgetConfidence(),(P=p.current)==null||P.reset(),(B=m.current)==null||B.clear()},[]),w=T.useCallback(E=>{var _,D;(_=d.current)==null||_.reset(E),(D=m.current)==null||D.clear()},[]),C=T.useCallback(E=>{var _,D,P;(_=d.current)==null||_.handleUserInput(E),S(),(P=(D=n.current)==null?void 0:D.canvas)==null||P.markInput()},[S,n]),A=T.useCallback(E=>{const _=IT(E,()=>i.current,()=>v.current);return p.current=_.fieldProbe,d.current=_.predictor,m.current=_.overlay,_},[i,v]),N=T.useCallback(()=>{var E;g.current!==null&&clearTimeout(g.current),g.current=null,(E=m.current)==null||E.dispose(),m.current=null,d.current=null,p.current=null},[]);return T.useEffect(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]),T.useEffect(()=>r(C),[r,C]),T.useEffect(()=>{S()},[a,S]),T.useEffect(()=>{x("connectionState")},[s,x]),{predictorRef:d,overlayRef:m,fieldProbeRef:p,attach:A,detach:N,sync:S,forget:x,discard:w,onUserInput:C}}function Jg(i,n){const a=typeof window<"u"?window:void 0,s=a&&typeof a.devicePixelRatio=="number"&&a.devicePixelRatio>0?a.devicePixelRatio:1,r=a!=null&&a.visualViewport&&typeof a.visualViewport.scale=="number"&&a.visualViewport.scale>0?a.visualViewport.scale:1,c=Math.max(0,i.width),d=Math.max(0,i.height),m=Math.round(c*s*100)/100,p=Math.round(d*s*100)/100;return{dpr:s,scale:r,cssWidth:c,cssHeight:d,physicalWidth:m,physicalHeight:p}}function GT(i){const{lastSnapshot:n,currentSnapshot:a,physicalTolerancePx:s=6}=i;if(!n)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const r=Math.abs(a.scale-n.scale)>.01,c=Math.abs(a.scale-1)>.01;if(r||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<=s&&y<=s)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(a.cssWidth-n.cssWidth),p=Math.abs(a.cssHeight-n.cssHeight);return m<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const YT=250;function PT({termRef:i,containerRef:n,frameRef:a,surfaceRef:s,currentScaleRef:r,rendererRef:c,initialBannerWrittenRef:d,isActiveRef:m,sendResize:p,onResized:g}){const y=En(p),v=En(g),S=T.useRef({cols:0,rows:0}),x=T.useRef(null),w=T.useRef(null),C=T.useRef(null),A=T.useRef(null),N=T.useRef({width:0,height:0}),E=T.useRef(null),_=T.useRef(!1),D=T.useCallback(()=>{const ne=x.current;x.current=null,ne&&(ne.cols===S.current.cols&&ne.rows===S.current.rows||(S.current=ne,y.current(ne.cols,ne.rows),v.current()))},[y,v]),P=T.useCallback((ne,oe,ce=!1)=>{if(!(!Number.isFinite(ne)||!Number.isFinite(oe)||ne<=0||oe<=0)&&!(ne===S.current.cols&&oe===S.current.rows)){if(x.current={cols:ne,rows:oe},ce){w.current&&clearTimeout(w.current),w.current=null,D();return}w.current||(w.current=setTimeout(()=>{w.current=null,D()},YT))}},[D]),B=T.useCallback((ne=!1,oe=!1)=>{var he;const ce=i.current,z=n.current,J=s.current,K=a.current;if(!ce||!z||!J||!K)return;const ae=kd(z,ca(),gd());if(ae.width<=0||ae.height<=0)return;K.style.width="100%",K.style.height="100%",J.style.width="100%",J.style.height="100%",J.style.transform="none",J.style.transformOrigin="top left",r.current=1;const $=Jg(ae),ue=GT({lastSnapshot:E.current,currentSnapshot:$});if(ue.isVisualZoom&&!ne){E.current=$;try{ce.refresh(0,Math.max(0,ce.rows-1))}catch{}return}if(ue.shouldIgnore&&!ne)return;E.current=$;const xe=ti(ce,ha),fe=Dy({width:ae.width-vC(J),height:ae.height,cellWidth:xe.cellWidth,cellHeight:xe.cellHeight}),te=Math.abs(ae.width-N.current.width)>1||Math.abs(ae.height-N.current.height)>1;if(ce.cols!==fe.cols||ce.rows!==fe.rows)try{ce.resize(fe.cols,fe.rows)}catch(re){console.debug("Error resizing terminal grid:",re)}d.current&&!_.current&&(te||ce.cols!==fe.cols||ce.rows!==fe.rows)&&(_.current=!0,(he=c.current)==null||he.verify());const le=fe.cols!==S.current.cols||fe.rows!==S.current.rows;m.current&&(te||ne||le)&&(N.current={width:ae.width,height:ae.height},P(fe.cols,fe.rows,oe));try{ce.refresh(0,Math.max(0,ce.rows-1))}catch{}},[i,n,s,a,r,c,d,m,P]),O=T.useRef(B);O.current=B;const k=T.useCallback(()=>{if(C.current===null){if(typeof requestAnimationFrame!="function"){O.current();return}C.current=requestAnimationFrame(()=>{C.current=null,O.current()})}},[]),R=T.useCallback((ne=30)=>{A.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(A.current),A.current=null);let oe=0;const ce=()=>{A.current=null,oe++;const z=oe>=ne;O.current(!0),!z&&oe<2&&typeof requestAnimationFrame=="function"&&(A.current=requestAnimationFrame(ce))};typeof requestAnimationFrame=="function"?A.current=requestAnimationFrame(ce):ce()},[]),I=T.useCallback(()=>O.current(!0,!0),[]),Q=T.useCallback(ne=>{N.current={width:ne.width,height:ne.height},E.current=Jg(ne)},[]),X=T.useCallback(()=>{w.current&&(clearTimeout(w.current),w.current=null),C.current!==null&&(cancelAnimationFrame(C.current),C.current=null),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null)},[]);return{requestFit:k,scheduleBoundedFit:R,fitNow:I,seedFit:Q,cancelPendingFits:X}}const $T=" ()[]{}'\"\\`";function VT(i,n,a,s=1){var A,N;if(!((A=n==null?void 0:n.buffer)!=null&&A.active)||n.cols<=0||n.rows<=0)return null;const r=a||((N=n.element)==null?void 0:N.querySelector(".xterm-screen"))||n.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const c=r.getBoundingClientRect(),d=zy(i.clientX,i.clientY,c,s),m=ti(n);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||n.cols*m.cellWidth),g=Math.max(1,c.height||n.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,d.clientX-c.left)),v=Math.max(0,Math.min(g-1,d.clientY-c.top)),S=Math.max(0,Math.min(n.cols-1,Math.floor(y/m.cellWidth))),x=Math.max(0,Math.min(n.rows-1,Math.floor(v/m.cellHeight))),C=(n.buffer.active.viewportY??0)+x;return{col:S,bufferRow:C}}function qT(i,n){if(!i||i.length===0||i==="\0")return!0;for(const a of i)if(a==="\0"||/\s/.test(a)||n.includes(a))return!0;return!1}function XT(i,n,a){var S,x;if(!((S=i==null?void 0:i.buffer)!=null&&S.active)||n<0||n>=i.cols)return null;const s=i.buffer.active.getLine(a);if(!s)return null;const r=((x=i.options)==null?void 0:x.wordSeparator)??$T,c=new Array(i.cols).fill(null),d=Math.min(i.cols,s.length);let m=0;for(;m<d;){const w=s.getCell(m);if(!w){c[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const C=w.getWidth();if(C===0){c[m]||(c[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const A=w.getChars(),N=qT(A,r),E=Math.min(i.cols,m+C),_={startCol:m,endCol:E,isSeparator:N};for(let D=m;D<E;D++)c[D]=_;m+=Math.max(1,C)}for(let w=d;w<i.cols;w++)c[w]||(c[w]={startCol:w,endCol:w+1,isSeparator:!0});const p=c[n];if(!p||p.isSeparator)return null;let g=p.startCol;for(;g>0;){const w=c[g-1];if(w&&!w.isSeparator)g=w.startCol;else break}let y=p.endCol;for(;y<i.cols;){const w=c[y];if(w&&!w.isSeparator)y=w.endCol;else break}const v=y-g;return v<=0?null:{startCol:g,length:v}}function WT(i){var c;if(!((c=i==null?void 0:i.buffer)!=null&&c.active))return"";const n=i.buffer.active,a=n.viewportY??0,s=i.rows,r=[];for(let d=0;d<s;d++){const m=n.getLine(a+d);r.push(m?m.translateToString(!0):"")}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
|
|
49
|
-
`)}const eb=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),ZT=.6,QT=new Set(["─","━","═","┄","┅","┈","┉","-"]),JT=.8;function id(i,n){if(!i)return!1;let a=0;const s=Math.min(n,i.length);for(let r=0;r<s;r++){const c=i.getCell(r);if(c){const d=c.getChars();d&&QT.has(d)&&a++}}return a>=Math.max(5,Math.min(n*.25,10))}function ld(i,n,a){var x;if(!((x=i==null?void 0:i.buffer)!=null&&x.active)||i.cols<=0)return{startCol:0,endCol:0};const s=i.buffer.active,r=i.cols,c=Math.max(0,Math.min(r-1,n)),d=s.viewportY??0,m=i.rows>0?i.rows:1,p=new Int32Array(r);let g=0;for(let w=0;w<m;w++){const C=s.getLine(d+w);if(g++,!C)continue;const A=Math.min(r,C.length);for(let N=0;N<A;N++){const E=C.getCell(N);if(E){const _=E.getChars();_&&eb.has(_)&&p[N]++}}}if(g===0)return{startCol:0,endCol:r-1};const y=g*ZT,v=w=>p[w]>=y;let S=!1;for(let w=0;w<r;w++)if(v(w)){S=!0;break}if(S){if(v(c))return{startCol:c,endCol:c};let w=-1;for(let A=c-1;A>=0;A--)if(v(A)){w=A;break}let C=r;for(let A=c+1;A<r;A++)if(v(A)){C=A;break}return{startCol:w+1,endCol:C-1}}if(a!==void 0){const w=Math.max(d,Math.min(d+m-1,a)),C=s.getLine(w);if(!id(C,r)){let A=d;for(let _=w-1;_>=d;_--)if(id(s.getLine(_),r)){A=_+1;break}let N=d+m-1;for(let _=w+1;_<=d+m-1;_++)if(id(s.getLine(_),r)){N=_-1;break}const E=N-A+1;if(E>=2){const _=new Int32Array(r);for(let O=A;O<=N;O++){const k=s.getLine(O);if(!k)continue;const R=Math.min(r,k.length);for(let I=0;I<R;I++){const Q=k.getCell(I);if(Q){const X=Q.getChars();X&&eb.has(X)&&_[I]++}}}const D=E*JT,P=O=>_[O]>=D;let B=!1;for(let O=0;O<r;O++)if(P(O)){B=!0;break}if(B){if(P(c))return{startCol:c,endCol:c};let O=-1;for(let R=c-1;R>=0;R--)if(P(R)){O=R;break}let k=r;for(let R=c+1;R<r;R++)if(P(R)){k=R;break}return{startCol:O+1,endCol:k-1}}}}}return{startCol:0,endCol:r-1}}function tb(i,n){const a=Math.min(i.startCol,i.endCol),s=Math.max(i.startCol,i.endCol),r=Math.min(i.startRow,i.endRow),c=Math.max(i.startRow,i.endRow);return{startCol:Math.max(n.startCol,Math.min(n.endCol,a)),endCol:Math.max(n.startCol,Math.min(n.endCol,s)),startRow:r,endRow:c}}function nb(i,n){var g;if(!((g=i==null?void 0:i.buffer)!=null&&g.active)||i.cols<=0)return"";const a=i.buffer.active,s=i.cols,r=Math.min(n.startRow,n.endRow),c=Math.max(n.startRow,n.endRow),d=Math.max(0,Math.min(n.startCol,n.endCol)),m=Math.min(s-1,Math.max(n.startCol,n.endCol));if(d>m||r>c)return"";const p=[];for(let y=r;y<=c;y++){const v=a.getLine(y);if(!v){p.push("");continue}const S=v.translateToString(!0,d,m+1);p.push(S.trimEnd())}return p.join(`
|
|
50
|
-
`)}function eM({termRef:i,surfaceRef:n,mainRef:a,currentScaleRef:s,addToast:r,t:c}){const d=En(r),m=En(c),[p,g]=T.useState(null),y=T.useRef(null);y.current=p;const[v,S]=T.useState(null),x=T.useRef(null);x.current=v;const[w,C]=T.useState(""),A=T.useRef("");A.current=w;const[N,E]=T.useState(!1),_=T.useRef(!1);_.current=N;const D=T.useRef(!1),[P,B]=T.useState(0),O=T.useRef(0),k=T.useRef(null),R=T.useRef(null),I=T.useRef(null),Q=T.useRef(null),X=T.useCallback(re=>{var Se;const pe=i.current;if(!pe)return null;const se=((Se=n.current)==null?void 0:Se.querySelector(".xterm-screen"))||n.current;return VT(re,pe,se,s.current)},[i,n,s]),ne=T.useCallback(re=>{const pe=i.current,se=X(re);return!pe||!se?null:ww(pe,se.col,se.bufferRow)},[i,X]),oe=T.useCallback((re,pe)=>{S(pe),C(nb(re,pe)),E(!0)},[]),ce=T.useCallback(()=>{S(null),C(""),E(!1),I.current=null,Q.current=null},[]),z=T.useCallback(()=>{g(null),y.current=null,S(null),x.current=null,C(""),A.current="",E(!1),k.current=null,R.current=null},[]),J=T.useCallback(re=>{const pe=i.current;if(!pe)return;const se=X(re),Se=se?XT(pe,se.col,se.bufferRow):null;if(se&&Se){I.current=se;const Ae=ld(pe,se.col,se.bufferRow);Q.current=Ae;const Be={startCol:Se.startCol,endCol:Se.startCol+Se.length-1,startRow:se.bufferRow,endRow:se.bufferRow};oe(pe,tb(Be,Ae))}else ce();k.current=re,R.current=null},[i,X,oe,ce]),K=T.useCallback(re=>{const pe=i.current,se=I.current;if(!pe||!se)return;const Se=X(re);if(!Se)return;R.current=re;const Ae=Q.current??ld(pe,se.col,se.bufferRow),Be={startCol:Math.min(se.col,Se.col),endCol:Math.max(se.col,Se.col),startRow:Math.min(se.bufferRow,Se.bufferRow),endRow:Math.max(se.bufferRow,Se.bufferRow)};oe(pe,tb(Be,Ae))},[i,X,oe]),ae=T.useCallback(()=>{const re=R.current??k.current;if(!re||!a.current)return;const pe=a.current.getBoundingClientRect(),se=re.clientX-pe.left,Se=re.clientY-pe.top,Ae=ne(re);g({x:se,y:Se,link:Ae}),y.current={x:se,y:Se,link:Ae}},[a,ne]),$=T.useCallback(async re=>{await qd(re)==="failed"?d.current("error",m.current("clipboard.copyFailed")):d.current("success",m.current("clipboard.copied"))},[d,m]),ue=T.useCallback(async()=>{const re=A.current;re&&await $(re)},[$]),xe=T.useCallback(async()=>{var Ae,Be,ht,tt;const re=i.current,pe=(Ae=re==null?void 0:re.buffer)==null?void 0:Ae.active;if(!re||!pe)return;const se=((Be=x.current)==null?void 0:Be.startRow)??((ht=I.current)==null?void 0:ht.bufferRow)??pe.viewportY,Se=Q.current??ld(re,((tt=I.current)==null?void 0:tt.col)??0,se);await $(nb(re,{startCol:Se.startCol,endCol:Se.endCol,startRow:se,endRow:se}))},[i,$]),fe=T.useCallback(async()=>{const re=i.current;re&&await $(WT(re))},[i,$]),te=T.useCallback((re,pe,se)=>{const Se=re.buffer.active.viewportY??0;Se!==O.current&&(O.current=Se,B(Se));const Ae=x.current;if(Ae&&_.current){const Be=Ae.startRow-Se,ht=Ae.endRow-Se;D.current&&pe<=ht&&se>=Be&&(E(!1),D.current=!1)}else D.current=!1},[]),le=T.useCallback(re=>{const pe=re.buffer.active.viewportY??0;O.current=pe,B(pe)},[]),he=T.useCallback(()=>{D.current=!0},[]);return{selectionMenu:p,selectionRect:v,selectionSnapshot:w,isHighlightVisible:N,viewportY:P,hasOpenMenu:()=>y.current!==null,hasSelectionExtension:()=>R.current!==null,clearSelection:z,handleLongPress:J,handleSelectionExtend:K,openMenuAtGesture:ae,handleCopySelection:ue,handleCopyLine:xe,handleCopyScreen:fe,onTerminalRender:te,onTerminalScroll:le,onTerminalContentChanged:he}}const tM=({term:i,surface:n,main:a,rect:s,viewportY:r})=>{if(!i||!a)return null;const c=ti(i);if(c.cellWidth<=0||c.cellHeight<=0)return null;const d=(n==null?void 0:n.querySelector(".xterm-screen"))||n;if(!d)return null;const m=d.getBoundingClientRect(),p=a.getBoundingClientRect(),g=s.startRow-r;if(s.endRow-r<0||g>=i.rows)return null;const v=m.top-p.top+g*c.cellHeight,S=m.left-p.left+s.startCol*c.cellWidth,x=(s.endCol-s.startCol+1)*c.cellWidth,w=(s.endRow-s.startRow+1)*c.cellHeight;return h.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${v}px`,left:`${S}px`,width:`${x}px`,height:`${w}px`}})},nM=600;var Zn=(i=>(i[i.NONE=0]="NONE",i[i.BLOCK=1]="BLOCK",i[i.BAR=2]="BAR",i[i.UNDERLINE=3]="UNDERLINE",i[i.OUTLINE=4]="OUTLINE",i))(Zn||{});function ib(i){switch(i){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function Qy(i,n,a,s,r,c,{css:d,dpr:m,cursorWidth:p}){switch(i.save(),i.fillStyle=d,i.strokeStyle=d,c){case 2:i.fillRect(a,s,Math.max(1,Math.round(p*m)),n.cell.height);break;case 3:i.fillRect(a,s+n.cell.height-Math.max(1,Math.round(m))-1,r,Math.max(1,Math.round(m)));break;case 4:{const g=Math.max(1,Math.round(m));i.lineWidth=g,i.strokeRect(a+g/2,s+g/2,r-g,n.cell.height-g);break}}i.restore()}function iM(i,n,a,s,r){let c,d;if(a&&a.cursor!==void 0){if(a.cursor===null)return null;c=a.cursor.row,d=a.cursor.col}else{if(!i.coreService.isCursorInitialized||i.coreService.isCursorHidden)return null;c=n.ybase+n.y,d=n.x}const m=c-n.ydisp;if(m<0||m>=s.rows)return null;const p=Math.min(Math.max(0,d),s.cols-1),g=i.optionsService.rawOptions;let y;if(i._coreBrowserService.isFocused)r?y=0:y=ib(g.cursorStyle||"block");else{const v=g.cursorInactiveStyle??"outline";y=v==="none"?0:ib(v)}return y===0?null:{x:p,y:m,shape:y}}class lM{constructor(n){V(this,"timer",null);V(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()},nM)}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.visible=!0}}const lb=80,aM=16;class sM{constructor(){V(this,"last",null);V(this,"fromX",0);V(this,"toX",0);V(this,"start",0);V(this,"sliding",!1)}update(n,a,s){const r=this.last;if(this.last=n&&{x:n.x,y:n.y},!n)return this.sliding=!1,null;if(!r||r.x!==n.x||r.y!==n.y){const c=r!==null&&r.y===n.y&&n.y===a&&Math.abs(n.x-r.x)<=aM;this.fromX=!c||!r?n.x:this.sliding?this.x(s):r.x,this.toX=n.x,this.start=s,this.sliding=c}return this.sliding?s-this.start>=lb?(this.sliding=!1,null):{x:this.x(s),y:n.y,shape:n.shape,css:n.css}:null}x(n){const a=Math.min(1,Math.max(0,(n-this.start)/lb));return this.fromX+(this.toX-this.fromX)*(1-(1-a)**3)}}function oM(i,n,a,s){if(i)return{x:i.x,y:i.y,shape:i.shape,css:s.cursor.css};const r=n==null?void 0:n.paintedCaret;if(!r)return null;const{bg:c}=ys(r.style.fg,r.style.bg,s,!0);return{x:r.col,y:r.row-a,shape:Zn.BLOCK,css:c,plain:r.plain}}const rM=120,cM=16,uM=96,dM=32,fM=64;function hs(i,n){const a=i.content[n];if(!(a>>>Qe.WIDTH_SHIFT)||aa(i.fg[n]))return!1;if(a&Qe.IS_COMBINED_MASK)return i.combined[n]!=="";const s=a&Qe.CODEPOINT_MASK;return s!==0&&s!==32}function ab(i,n){return{content:i.content[n],fg:i.fg[n],bg:i.bg[n],combined:i.combined[n]}}class hM{constructor(){V(this,"fades",new Map)}get size(){return this.fades.size}clear(){this.fades.clear()}rows(n){const a=new Set;for(const s of this.fades.keys())a.add(Math.floor(s/n));return a}begin(n,a,s,r,c,d){const m=n*a,p=Math.max(0,s.start),g=Math.min(a,s.end);let y=0;for(let S=p;S<g;S++){const x=m+S;if(r.content[x]===na)return;const w=hs(r,x),C=hs(c,S);if(w&&C){if(r.content[x]!==c.content[S]||r.combined[x]!==c.combined[S])return}else(w||C)&&y++}if(y===0||y>dM)return;let v=0;for(let S=p;S<g;S++){const x=m+S,w=hs(r,x),C=hs(c,S);if(C&&!w){const A=Math.min(v++*cM,uM);this.fades.set(x,{...ab(c,S),start:d+A,out:!1})}else w&&!C&&this.fades.set(x,{...ab(r,x),start:d,out:!0})}}at(n,a,s,r){const c=this.fades.get(n);if(!c)return null;const d=c.out?!hs(s,a):s.content[a]===c.content&&s.combined[a]===c.combined,m=(r-c.start)/rM;if(!d||m>=1)return this.fades.delete(n),null;const p=Math.max(0,m);return c.out?{alpha:(1-p)**2,gone:c}:{alpha:1-(1-p)**3}}}function mM(i,n,{gone:a,alpha:s},r,c){if(!a)return;const d=a.content&Qe.IS_COMBINED_MASK?a.combined:String.fromCodePoint(a.content&Qe.CODEPOINT_MASK),m=n.get({chars:d,bold:ra(a.fg),italic:vs(a.bg),dim:As(a.bg),fg:r.fg,bg:r.bg,cells:c.cells});m&&(i.globalAlpha=s,i.drawImage(m.source,m.x,m.y,m.width,m.height,c.px,c.py,c.width,c.height),i.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 sb(i){if(!i)throw new Error("value must not be falsy");return i}const pM={"▀":[{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}]},gM={"░":[[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]]},bM={"─":{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:(i,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"║":{1:(i,n)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╒":{1:(i,n)=>`M.5,1 L.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╓":{1:(i,n)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"╔":{1:(i,n)=>`M1,${.5-n} L${.5-i},${.5-n} L${.5-i},1 M1,${.5+n} L${.5+i},${.5+n} L${.5+i},1`},"╕":{1:(i,n)=>`M0,${.5-n} L.5,${.5-n} L.5,1 M0,${.5+n} L.5,${.5+n}`},"╖":{1:(i,n)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"╗":{1:(i,n)=>`M0,${.5+n} L${.5-i},${.5+n} L${.5-i},1 M0,${.5-n} L${.5+i},${.5-n} L${.5+i},1`},"╘":{1:(i,n)=>`M.5,0 L.5,${.5+n} L1,${.5+n} M.5,${.5-n} L1,${.5-n}`},"╙":{1:(i,n)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╚":{1:(i,n)=>`M1,${.5-n} L${.5+i},${.5-n} L${.5+i},0 M1,${.5+n} L${.5-i},${.5+n} L${.5-i},0`},"╛":{1:(i,n)=>`M0,${.5+n} L.5,${.5+n} L.5,0 M0,${.5-n} L.5,${.5-n}`},"╜":{1:(i,n)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"╝":{1:(i,n)=>`M0,${.5-n} L${.5-i},${.5-n} L${.5-i},0 M0,${.5+n} L${.5+i},${.5+n} L${.5+i},0`},"╞":{1:(i,n)=>`M.5,0 L.5,1 M.5,${.5-n} L1,${.5-n} M.5,${.5+n} L1,${.5+n}`},"╟":{1:(i,n)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"╠":{1:(i,n)=>`M${.5-i},0 L${.5-i},1 M1,${.5+n} L${.5+i},${.5+n} L${.5+i},1 M1,${.5-n} L${.5+i},${.5-n} L${.5+i},0`},"╡":{1:(i,n)=>`M.5,0 L.5,1 M0,${.5-n} L.5,${.5-n} M0,${.5+n} L.5,${.5+n}`},"╢":{1:(i,n)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╣":{1:(i,n)=>`M${.5+i},0 L${.5+i},1 M0,${.5+n} L${.5-i},${.5+n} L${.5-i},1 M0,${.5-n} L${.5-i},${.5-n} L${.5-i},0`},"╤":{1:(i,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n} M.5,${.5+n} L.5,1`},"╥":{1:(i,n)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"╦":{1:(i,n)=>`M0,${.5-n} L1,${.5-n} M0,${.5+n} L${.5-i},${.5+n} L${.5-i},1 M1,${.5+n} L${.5+i},${.5+n} L${.5+i},1`},"╧":{1:(i,n)=>`M.5,0 L.5,${.5-n} M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╨":{1:(i,n)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╩":{1:(i,n)=>`M0,${.5+n} L1,${.5+n} M0,${.5-n} L${.5-i},${.5-n} L${.5-i},0 M1,${.5-n} L${.5+i},${.5-n} L${.5+i},0`},"╪":{1:(i,n)=>`M.5,0 L.5,1 M0,${.5-n} L1,${.5-n} M0,${.5+n} L1,${.5+n}`},"╫":{1:(i,n)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╬":{1:(i,n)=>`M0,${.5+n} L${.5-i},${.5+n} L${.5-i},1 M1,${.5+n} L${.5+i},${.5+n} L${.5+i},1 M0,${.5-n} L${.5-i},${.5-n} L${.5-i},0 M1,${.5-n} L${.5+i},${.5-n} L${.5+i},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:(i,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,1,.5`},"╮":{1:(i,n)=>`M.5,1 L.5,${.5+n/.15*.5} C.5,${.5+n/.15*.5},.5,.5,0,.5`},"╯":{1:(i,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,0,.5`},"╰":{1:(i,n)=>`M.5,0 L.5,${.5-n/.15*.5} C.5,${.5-n/.15*.5},.5,.5,1,.5`}},Es={"":{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}};Es[""]=Es[""];Es[""]=Es[""];function yM(i,n,a,s,r,c,d,m){const p=pM[n];if(p)return vM(i,p,a,s,r,c),!0;const g=gM[n];if(g)return xM(i,g,a,s,r,c),!0;const y=bM[n];if(y)return wM(i,y,a,s,r,c,m),!0;const v=Es[n];return v?(SM(i,v,a,s,r,c,d,m),!0):!1}function vM(i,n,a,s,r,c){for(let d=0;d<n.length;d++){const m=n[d],p=r/8,g=c/8;i.fillRect(a+m.x*p,s+m.y*g,m.w*p,m.h*g)}}const ob=new Map;function xM(i,n,a,s,r,c){let d=ob.get(n);d||(d=new Map,ob.set(n,d));const m=i.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let p=d.get(m);if(!p){const g=n[0].length,y=n.length,v=i.canvas.ownerDocument.createElement("canvas");v.width=g,v.height=y;const S=sb(v.getContext("2d")),x=new ImageData(g,y);let w,C,A,N;if(m.startsWith("#"))w=parseInt(m.slice(1,3),16),C=parseInt(m.slice(3,5),16),A=parseInt(m.slice(5,7),16),N=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[w,C,A,N]=m.substring(5,m.length-1).split(",").map(E=>parseFloat(E));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let E=0;E<y;E++)for(let _=0;_<g;_++)x.data[(E*g+_)*4]=w,x.data[(E*g+_)*4+1]=C,x.data[(E*g+_)*4+2]=A,x.data[(E*g+_)*4+3]=n[E][_]*(N*255);S.putImageData(x,0,0),p=sb(i.createPattern(v,null)),d.set(m,p)}i.fillStyle=p,i.fillRect(a,s,r,c)}function wM(i,n,a,s,r,c,d){i.strokeStyle=i.fillStyle;for(const[m,p]of Object.entries(n)){i.beginPath(),i.lineWidth=d*Number.parseInt(m,10);let g;if(typeof p=="function"){const v=.15/c*r;g=p(.15,v)}else g=p;for(const y of g.split(" ")){const v=y[0],S=Jy[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=y.substring(1).split(",");!x[0]||!x[1]||S(i,e0(x,r,c,a,s,!0,d))}i.stroke(),i.closePath()}}function SM(i,n,a,s,r,c,d,m){const p=new Path2D;p.rect(a,s,r,c),i.clip(p),i.beginPath();const g=d/12;i.lineWidth=m*g;for(const y of n.d.split(" ")){const v=y[0],S=Jy[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const x=y.substring(1).split(",");!x[0]||!x[1]||S(i,e0(x,r,c,a,s,!1,m,(n.leftPadding??0)*(g/2),(n.rightPadding??0)*(g/2)))}n.type===1?(i.strokeStyle=i.fillStyle,i.stroke()):i.fill(),i.closePath()}function rb(i,n,a=0){return Math.max(Math.min(i,n),a)}const Jy={C:(i,n)=>i.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]),L:(i,n)=>i.lineTo(n[0],n[1]),M:(i,n)=>i.moveTo(n[0],n[1])};function e0(i,n,a,s,r,c,d,m=0,p=0){const g=i.map(y=>parseFloat(y)||parseInt(y,10));if(g.length<2)throw new Error("Too few arguments for instruction");for(let y=0;y<g.length;y+=2)g[y]*=n-m*d-p*d,c&&g[y]!==0&&(g[y]=rb(Math.round(g[y]+.5)-.5,n,0)),g[y]+=s+m*d;for(let y=1;y<g.length;y+=2)g[y]*=a,c&&g[y]!==0&&(g[y]=rb(Math.round(g[y]+.5)-.5,a,0)),g[y]+=r;return g}const Xd=.5,CM=1024,TM=6;function MM(i){return/Firefox\//.test(i)||/Edge\/\d/.test(i)?"bottom":"ideographic"}class AM{constructor(n,a=typeof navigator<"u"?navigator.userAgent:""){V(this,"pages",[]);V(this,"slots",new Map);V(this,"inkCache",new Map);V(this,"metrics",null);V(this,"font",null);V(this,"baseline");V(this,"generation",0);V(this,"scratch");this.document=n,this.baseline=MM(a)}configure(n,a){const s=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},s||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 s=this.font,r=n?s.fontWeightBold:s.fontWeight;return`${a?"italic ":""}${r} ${s.fontSize*this.metrics.dpr}px ${s.fontFamily}`}overflow(n,a,s){if(!this.metrics||!this.font||n.length===1&&n.charCodeAt(0)<128)return 0;const r=`${a?1:0}${s?1:0}${n}`,c=this.inkCache.get(r);if(c!==void 0)return c;let d=0;const m=this.scratchContext();if(m&&!(this.font.customGlyphs&&t0(n))){m.font=this.fontString(a,s),m.textBaseline=this.baseline;const p=m.measureText(n),g=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;d=Math.max(0,Math.ceil(this.metrics.charLeft+g-this.metrics.cellWidth))}return this.inkCache.set(r,d),d}get(n){const a=this.metrics,s=this.font;if(!a||!s||a.cellWidth<=0||a.cellHeight<=0)return null;const r=`${n.cells}${n.bold?1:0}${n.italic?1:0}${n.dim?1:0}${n.fg}\0${n.bg}\0${n.chars}`,c=this.slots.get(r);if(c)return c;const d=a.cellWidth*n.cells,m=a.cellHeight,p=this.allocate(d,m);if(!p)return null;const{page:g,x:y,y:v}=p,S=g.ctx;S.save(),S.beginPath(),S.rect(y,v,d,m),S.clip(),S.globalAlpha=1,S.fillStyle=n.bg,S.fillRect(y,v,d,m),S.fillStyle=n.fg,n.dim&&(S.globalAlpha=Xd);let x=!1;s.customGlyphs&&(x=yM(S,n.chars,y,v,a.cellWidth,a.cellHeight,s.fontSize,a.dpr)),x||(S.font=this.fontString(n.bold,n.italic),S.textBaseline=this.baseline,S.fillText(n.chars,y+a.charLeft,v+a.charTop+a.charHeight)),S.restore();const w={source:g.canvas,x:y,y:v,width:d,height:m};return this.slots.set(r,w),w}allocate(n,a){for(const s of this.pages){const r=this.fit(s,n,a);if(r)return r}if(this.pages.length<TM){const s=this.createPage(Math.max(CM,n,a));return s?(this.pages.push(s),this.fit(s,n,a)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],n,a):null}fit(n,a,s){if(n.shelfX+a>n.canvas.width&&(n.shelfX=0,n.shelfY+=s),n.shelfY+s>n.canvas.height||a>n.canvas.width)return null;const r={page:n,x:n.shelfX,y:n.shelfY};return n.shelfX+=a,r}createPage(n){const a=this.document.createElement("canvas");a.width=n,a.height=n;const s=a.getContext("2d",{alpha:!1});return s?{canvas:a,ctx:s,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 t0(i){if(i.length!==1)return!1;const n=i.charCodeAt(0);return n>=9472&&n<=9631||n>=57504&&n<=57558}function EM(i,n){return(i&(st.UNDERLINE|st.STRIKETHROUGH))!==0||(n&Oi.OVERLINE)!==0}function kM(i,n,{px:a,py:s,cells:r,fgWord:c,bgWord:d,ext:m,fgCss:p},{fontSize:g,dpr:y,colors:v,boldBright:S}){const x=(c&st.UNDERLINE)!==0,w=(c&st.STRIKETHROUGH)!==0,C=(d&Oi.OVERLINE)!==0,A=r*n.cell.width;i.save(),i.beginPath(),i.rect(a,s,A,n.cell.height),i.clip(),As(d)&&(i.globalAlpha=Xd);const N=Math.max(1,Math.floor(g*y/15)),E=N%2===1?.5:0;if(x){const _=rT(m);let D=p;if(_){let O=_;S&&ra(c)&&(O&50331648)!==50331648&&(O&255)<8&&(O+=8),D=Fy(O,v,p)}i.strokeStyle=D,i.lineWidth=N;const P=s+n.char.top+Math.ceil(n.char.height)-E-N*2,B=m?oT(m):ia.SINGLE;switch(i.beginPath(),B){case ia.DOUBLE:i.moveTo(a,P),i.lineTo(a+A,P),i.moveTo(a,P+N*2),i.lineTo(a+A,P+N*2);break;case ia.CURLY:{const O=P+N,k=Math.max(1,N);for(let R=0;R<r;R++){const I=a+R*n.cell.width,Q=I+n.cell.width/2,X=I+n.cell.width;i.moveTo(I,O),i.bezierCurveTo(I,O-k,Q,O-k,Q,O),i.bezierCurveTo(Q,O+k,X,O+k,X,O)}break}case ia.DOTTED:i.setLineDash([N,N]),i.moveTo(a,P),i.lineTo(a+A,P);break;case ia.DASHED:{const O=Math.floor(.6*n.cell.width),k=Math.floor(.3*n.cell.width);i.setLineDash([O,k,n.cell.width-O-k]),i.moveTo(a,P),i.lineTo(a+A,P);break}default:i.moveTo(a,P),i.lineTo(a+A,P)}i.stroke(),i.setLineDash([])}if(C&&(i.strokeStyle=p,i.lineWidth=N,i.beginPath(),i.moveTo(a,s+n.char.top+E),i.lineTo(a+A,s+n.char.top+E),i.stroke()),w){const _=Math.max(1,Math.floor(g*y/10)),D=s+n.char.top+Math.floor(n.char.height/2)-(_%2===1?.5:0);i.strokeStyle=p,i.lineWidth=_,i.beginPath(),i.moveTo(a,D),i.lineTo(a+A,D),i.stroke()}i.restore()}const ad=4,NM=3;class _M{constructor(n,a,s,r){V(this,"atlas");V(this,"fades",new hM);V(this,"cols",0);V(this,"rows",0);V(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});V(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});V(this,"work",sT());this.ctx=n,this.core=s,this.dimensions=r,this.atlas=new AM(a)}resize(n,a){this.cols=n,this.rows=a,this.fades.clear();const s=n*a;this.painted={content:new Uint32Array(s).fill(na),fg:new Uint32Array(s),bg:new Uint32Array(s),ext:new Uint32Array(s),meta:new Uint32Array(s).fill(na),combined:new Array(s).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(na),this.painted.meta.fill(na),this.fades.clear()}hasPaintedInk(n,a){const s=this.dimensions.device;if(!s.cell.width||!s.cell.height)return!1;const r=Math.min(this.cols,Math.floor(n/s.cell.width)),c=Math.min(this.rows,Math.floor(a/s.cell.height)),d=this.painted;for(let m=0;m<c;m++)for(let p=0;p<r;p++){const g=m*this.cols+p,y=d.content[g];if(y===na||d.meta[g]===ad||aa(d.fg[g]))continue;const v=y&Qe.CODEPOINT_MASK;if(y&Qe.IS_COMBINED_MASK?d.combined[g]!=="":v!==0&&v!==32)return!0}return!1}loadRow(n,a){const{content:s,fg:r,bg:c,ext:d,combined:m}=this.row,p=this.work;for(let g=0;g<this.cols;g++)n&&g<n.length?(n.loadCell(g,p),s[g]=p.content,r[g]=p.fg,c[g]=p.bg,d[g]=Ky(p),m[g]=p.content&Qe.IS_COMBINED_MASK?p.combinedData:""):(s[g]=1<<Qe.WIDTH_SHIFT,r[g]=0,c[g]=0,d[g]=0,m[g]="");if(a)for(const g of a){const y=g.col;if(y<0||y+g.width>this.cols)continue;y>0&&!(s[y]>>>Qe.WIDTH_SHIFT)&&this.blankAt(y-1);const v=y+g.width;v<this.cols&&!(s[v]>>>Qe.WIDTH_SHIFT)&&s[v-1]>>>Qe.WIDTH_SHIFT===2&&this.blankAt(v);const S=cT(g.chars,g.width);s[y]=S.content,m[y]=S.combinedData,r[y]=g.style.fg,c[y]=g.style.bg,d[y]=g.style.ext,g.width===2&&(s[y+1]=0,m[y+1]="",r[y+1]=g.style.fg,c[y+1]=g.style.bg,d[y+1]=g.style.ext)}}blankAt(n){this.row.content[n]=32|1<<Qe.WIDTH_SHIFT,this.row.combined[n]=""}paintRow(n,a,s=null,r=0){const c=this.cols,{content:d,fg:m,bg:p,ext:g,combined:y}=this.row,v=this.painted,S=n*c;s&&this.fades.begin(n,c,s,v,this.row,r);let x=0,w=-1,C=-1,A="";const N=()=>{w<0||(this.fillCells(w,n,C-w,A),w=-1)};let E=0;for(;E<c;){let D=d[E]>>>Qe.WIDTH_SHIFT;D===0&&(D=1),E+D>c&&(D=c-E),D===1&&E+1<c&&this.overflowsInto(E)&&(D=2);const P=a&&a.y===n&&a.x>=E&&a.x<E+D?a.shape:Zn.NONE,B=D|P<<NM,O=this.fades.size>0?this.fades.at(S+E,E,this.row,r):null;let k=O!==null||this.differs(S+E,E,B);for(let R=1;R<D;R++)this.differs(S+E+R,E+R,ad)&&(k=!0);if(k){for(let I=0;I<D;I++){const Q=S+E+I;v.content[Q]=d[E+I],v.fg[Q]=m[E+I],v.bg[Q]=p[E+I],v.ext[Q]=g[E+I],v.meta[Q]=I===0?O?B|fM:B:ad,v.combined[Q]=y[E+I]}x+=D;const R=O?null:this.plainFill(E,P);R!==null?w>=0&&C===E&&A===R?C=E+D:(N(),w=E,C=E+D,A=R):(N(),this.paintCell(E,n,D,P,O))}E+=D}return N(),x}differs(n,a,s){const r=this.painted,c=this.row;return r.meta[n]!==s||r.content[n]!==c.content[a]||r.fg[n]!==c.fg[a]||r.bg[n]!==c.bg[a]||r.ext[n]!==c.ext[a]||r.combined[n]!==c.combined[a]}overflowsInto(n){const{content:a,fg:s,bg:r,ext:c}=this.row,d=a[n];if((d&Qe.CODEPOINT_MASK)<128&&!(d&Qe.IS_COMBINED_MASK)||d>>>Qe.WIDTH_SHIFT!==1||aa(s[n]))return!1;const p=a[n+1],g=p&Qe.CODEPOINT_MASK;if(p>>>Qe.WIDTH_SHIFT!==1||p&Qe.IS_COMBINED_MASK||g!==0&&g!==32||r[n]!==r[n+1]||c[n+1]!==0||(s[n]&st.INVERSE)!==(s[n+1]&st.INVERSE)||s[n]&st.INVERSE&&s[n]!==s[n+1]||s[n+1]&(st.UNDERLINE|st.STRIKETHROUGH)||r[n+1]&Oi.OVERLINE)return!1;const y=this.charsAt(n);return this.core.optionsService.rawOptions.customGlyphs!==!1&&t0(y)?!1:this.atlas.overflow(y,ra(s[n]),vs(r[n]))>0}charsAt(n){const a=this.row.content[n];if(a&Qe.IS_COMBINED_MASK)return this.row.combined[n];const s=a&Qe.CODEPOINT_MASK;return s?String.fromCodePoint(s):""}plainFill(n,a){if(a!==Zn.NONE)return null;const{content:s,fg:r,bg:c}=this.row,d=s[n],m=d&Qe.CODEPOINT_MASK,p=!(d&Qe.IS_COMBINED_MASK)&&(m===0||m===32),g=aa(r[n]);return!p&&!g||(r[n]&(st.UNDERLINE|st.STRIKETHROUGH)||c[n]&Oi.OVERLINE)&&!g?null:ys(r[n],c[n],this.colors(),this.boldBright()).bg}paintCell(n,a,s,r,c=null){const d=this.ctx,m=this.dimensions.device,p=this.colors(),g=this.row.fg[n],y=this.row.bg[n],v=this.row.ext[n],S=ys(g,y,p,this.boldBright());let x=S.fg,w=S.bg;r===Zn.BLOCK&&(w=p.cursor.css,x=p.cursorAccent.css);const C=aa(g),A=this.charsAt(n),N=n*m.cell.width,E=a*m.cell.height,_=s*m.cell.width,D=m.cell.height,P=C||A===""||A===" ",B=P?null:this.atlas.get({chars:A,bold:ra(g),italic:vs(y),dim:As(y),fg:x,bg:w,cells:s}),O=c&&!c.gone?c.alpha:1;if(B&&O===1?d.drawImage(B.source,B.x,B.y,B.width,B.height,N,E,_,D):(d.fillStyle=w,d.fillRect(N,E,_,D),B?(d.globalAlpha=O,d.drawImage(B.source,B.x,B.y,B.width,B.height,N,E,_,D),d.globalAlpha=1):P||(d.save(),d.beginPath(),d.rect(N,E,_,D),d.clip(),d.fillStyle=x,d.globalAlpha=(As(y)?Xd:1)*O,d.font=this.atlas.fontString(ra(g),vs(y)),d.fillText(A,N+m.char.left,E+m.char.top+m.char.height),d.restore())),c!=null&&c.gone){const R=r===Zn.BLOCK||(g&st.INVERSE)!==0?x:ys(c.gone.fg,c.gone.bg,p,this.boldBright()).fg;mM(d,this.atlas,c,{fg:R,bg:w},{px:N,py:E,width:_,height:D,cells:s})}!C&&EM(g,y)&&kM(d,m,{px:N,py:E,cells:s,fgWord:g,bgWord:y,ext:v,fgCss:x},{fontSize:this.core.optionsService.rawOptions.fontSize,dpr:this.core._coreBrowserService.dpr,colors:p,boldBright:this.boldBright()}),r!==Zn.NONE&&r!==Zn.BLOCK&&Qy(d,m,N,E,_,r,{css:p.cursor.css,dpr:this.core._coreBrowserService.dpr,cursorWidth:this.core.optionsService.rawOptions.cursorWidth})}fillCells(n,a,s,r){const c=this.dimensions.device;this.ctx.fillStyle=r,this.ctx.fillRect(n*c.cell.width,a*c.cell.height,s*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 LM(){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 RM(i,n,a,s){const r=n._charSizeService;if(!r.hasValidSize)return!1;const c=n._coreBrowserService.dpr,d=n.optionsService.rawOptions;return i.device.char.width=Math.floor(r.width*c),i.device.char.height=Math.ceil(r.height*c),i.device.cell.height=Math.floor(i.device.char.height*d.lineHeight),i.device.char.top=d.lineHeight===1?0:Math.round((i.device.cell.height-i.device.char.height)/2),i.device.cell.width=i.device.char.width+Math.round(d.letterSpacing),i.device.char.left=Math.floor(d.letterSpacing/2),i.device.canvas.height=s*i.device.cell.height,i.device.canvas.width=a*i.device.cell.width,i.css.canvas.height=Math.round(i.device.canvas.height/c),i.css.canvas.width=Math.round(i.device.canvas.width/c),i.css.cell.height=i.css.canvas.height/s,i.css.cell.width=i.css.canvas.width/a,!0}function jM(i,n,a){if(!i||typeof i.ResizeObserver!="function")return null;let s=new i.ResizeObserver(r=>{var p;const c=r.find(g=>g.target===n);if(!c)return;if(!("devicePixelContentBoxSize"in c)||!((p=c.devicePixelContentBoxSize)!=null&&p[0])){s==null||s.disconnect(),s=null;return}const d=c.devicePixelContentBoxSize[0].inlineSize,m=c.devicePixelContentBoxSize[0].blockSize;d<=0||m<=0||d===n.width&&m===n.height||a(d,m)});try{s.observe(n,{box:"device-pixel-content-box"})}catch{s.disconnect(),s=null}return{dispose:()=>s==null?void 0:s.disconnect()}}function OM(i){if(!i)return[];const n=i.cells.map(a=>a.row);return i.cursor&&n.push(i.cursor.row),n}function DM(i){const n=new Map;for(const a of(i==null?void 0:i.cells)??[]){const s=n.get(a.row);s?s.push(a):n.set(a.row,[a])}return n}class zM{constructor(n){V(this,"canvas");V(this,"ctx");V(this,"selection",null);V(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,s){this.selection=n&&a&&!(n[0]===a[0]&&n[1]===a[1])?{start:[n[0],n[1]],end:[a[0],a[1]],columnSelectMode:s}:null}paint({dims:n,rows:a,cols:s,ydisp:r,colors:c,focused:d,dpr:m,cursorWidth:p,caret:g}){var w;const y=this.ctx;if(y.clearRect(0,0,this.canvas.width,this.canvas.height),!n.cell.width||!a)return;const{selection:v,link:S}=this,x=(C,A,N,E)=>y.fillRect(C*n.cell.width,A*n.cell.height,N*n.cell.width,E*n.cell.height);if(v){const C=v.start[1]-r,A=v.end[1]-r,N=Math.max(C,0),E=Math.min(A,a-1);if(N<a&&E>=0)if(y.fillStyle=(d?c.selectionBackgroundTransparent:c.selectionInactiveBackgroundTransparent).css,v.columnSelectMode)x(v.start[0],N,v.end[0]-v.start[0],E-N+1);else{const _=C===N?v.start[0]:0,D=N===A?v.end[0]:s;x(_,N,D-_,1),x(0,N+1,s,Math.max(E-N-1,0)),N!==E&&x(0,E,A===E?v.end[0]:s,1)}}if(S){y.fillStyle=S.fg===257?c.background.css:S.fg!==void 0&&S.fg<256?((w=c.ansi[S.fg])==null?void 0:w.css)??c.foreground.css:c.foreground.css;const C=(A,N,E)=>y.fillRect(A*n.cell.width,(N+1)*n.cell.height-m-1,E*n.cell.width,m);if(S.y1===S.y2)C(S.x1,S.y1,S.x2-S.x1);else{C(S.x1,S.y1,S.cols-S.x1);for(let A=S.y1+1;A<S.y2;A++)C(0,A,S.cols);C(0,S.y2,S.x2)}}if(g){const C=Math.round(g.x*n.cell.width),A=g.y*n.cell.height;g.shape===Zn.BLOCK?(y.fillStyle=g.css,y.fillRect(C,A,n.cell.width,n.cell.height)):Qy(y,n,C,A,n.cell.width,g.shape,{css:g.css,dpr:m,cursorWidth:p})}}}class HM{constructor(n,a){V(this,"text");V(this,"textContext");V(this,"decor");this.screen=a,this.text=n.createElement("canvas"),this.text.classList.add("xterm-text-layer"),this.text.style.zIndex="0";const s=this.text.getContext("2d",{alpha:!1});if(!s)throw new Error("2D canvas unavailable");this.textContext=s,this.decor=new zM(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,s,r){return jM(n,this.text,(c,d)=>{const m=a.css.canvas;if(!(Math.abs(c-m.width*s())>2||Math.abs(d-m.height*s())>2)){a.device.canvas.width=c,a.device.canvas.height=d;for(const p of[this.text,this.decor.canvas])p.width=c,p.height=d;r()}})}remove(){this.text.remove(),this.decor.canvas.remove()}}function BM(i,n){const a=i.fonts;return!a||typeof a.addEventListener!="function"?null:(a.addEventListener("loadingdone",n),{dispose:()=>a.removeEventListener("loadingdone",n)})}class UM{constructor(n,a,s){V(this,"startedAt",null);V(this,"held",null);V(this,"timer",null);this.now=n,this.maxHoldMs=a,this.onExpire=s}get pending(){return this.held}hold(n,a){const s=this.now();return this.startedAt===null&&(this.startedAt=s),s-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)}}const KM=150;class Wd{constructor(n,a){V(this,"dimensions",LM());V(this,"redraw",new uT);V(this,"onRequestRedraw",this.redraw.event);V(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});V(this,"surface");V(this,"cells");V(this,"disposables",[]);V(this,"now");V(this,"syncHold");V(this,"cols",0);V(this,"rows",0);V(this,"overlayProvider",null);V(this,"typingZoneProvider",null);V(this,"reducedMotion");V(this,"paintedOverlayRows",new Set);V(this,"paintedCursorRow",-1);V(this,"lastYdisp",0);V(this,"inputAt",null);V(this,"blink",new lM(()=>this.requestCursorRow()));V(this,"glide",new sM);V(this,"slidingCaret",null);V(this,"disposed",!1);V(this,"isSynchronizing");V(this,"dprUsed",0);var d,m;this.core=n,this.now=a.now??(()=>performance.now()),this.syncHold=new UM(this.now,a.maxSyncHoldMs??KM,()=>this.flushHeld()),this.isSynchronizing=a.isSynchronizing??(()=>!1),this.reducedMotion=(m=(d=n._coreBrowserService.window).matchMedia)==null?void 0:m.call(d,"(prefers-reduced-motion: reduce)");const s=n._coreBrowserService.mainDocument;this.surface=new HM(s,n.screenElement),this.cells=new _M(this.surface.textContext,s,n,this.dimensions),this.disposables.push(n._themeService.onChangeColors(()=>{this.cells.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),n.optionsService.onOptionChange(p=>{(p==="cursorBlink"||p==="cursorStyle")&&this.restartBlink()})),n.linkifier&&this.disposables.push(n.linkifier.onShowLinkUnderline(p=>{this.surface.decor.link=p,this.redrawDecor()}),n.linkifier.onHideLinkUnderline(()=>{this.surface.decor.link=null,this.redrawDecor()}));const r=this.surface.watchDevicePixels(n._coreBrowserService.window,this.dimensions,()=>n._coreBrowserService.dpr,()=>{this.invalidateAll(),this.cells.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})});r&&this.disposables.push(r);const c=BM(s,()=>this.clearTextureAtlas());c&&this.disposables.push(c),this.restartBlink()}static install(n,a={}){const s=Gy(n);if(!s)return null;const r=new Wd(s,a);return s._renderService.setRenderer(r),s._renderService.handleResize(s._bufferService.cols,s._bufferService.rows),r}setOverlayProvider(n){this.overlayProvider=n,this.invalidateOverlay()}setTypingZoneProvider(n){this.typingZoneProvider=n}invalidateOverlay(){var s;const n=((s=this.overlayProvider)==null?void 0:s.call(this))??null,a=new Set(this.paintedOverlayRows);for(const r of OM(n))a.add(r);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){RM(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,s){this.surface.decor.setSelection(n,a,s),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 s=this.syncHold.release(n,a);this.paint(Math.max(0,s.start),Math.min(this.rows-1,s.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 s=this.now(),r=this.buffer(),c=r.ydisp;c!==this.lastYdisp&&(this.lastYdisp=c,this.cells.fades.clear(),this.redrawDecor());const d=(N=this.reducedMotion)!=null&&N.matches?null:((E=this.typingZoneProvider)==null?void 0:E.call(this))??null,m=d?d.row-c:-1,p=((_=this.overlayProvider)==null?void 0:_.call(this))??null,g=DM(p),y=this.cursorState(p),v=oM(y,p,c,this.colors()),S=this.glide.update(v,m,s),x=S?null:y,w=S&&(v==null?void 0:v.plain);w&&g.set(w.row,[...g.get(w.row)??[],w]);const C=new Set;for(let D=n;D<=a;D++)C.add(D);for(const D of this.paintedOverlayRows)ms(C,D-c,this.rows);for(const D of g.keys())ms(C,D-c,this.rows);this.paintedCursorRow>=0&&ms(C,this.paintedCursorRow,this.rows),x&&ms(C,x.y,this.rows);for(const D of this.cells.fades.rows(this.cols))ms(C,D,this.rows);let A=0;for(const D of C){this.cells.loadRow(r.lines.get(c+D),g.get(D+c));const P=D===m?{start:d.startCol,end:d.endCol}:null;A+=this.cells.paintRow(D,x,P,s)}this.cells.fades.size>0&&this.requestAbsoluteRows([...this.cells.fades.rows(this.cols)].map(D=>D+c)),(S||this.slidingCaret)&&(this.slidingCaret=S,this.redrawDecor(),S&&this.requestAbsoluteRows([S.y+c])),this.paintedOverlayRows=new Set(g.keys()),this.paintedCursorRow=x?x.y:-1,this.stats.frames++,this.stats.lastCells=A,this.stats.lastPaintMs=this.now()-s,this.inputAt!==null&&A>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}cursorState(n){return iM(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 s=1/0,r=-1/0;for(const c of n){const d=c-a;d<0||d>=this.rows||(s=Math.min(s,d),r=Math.max(r,d))}s<=r&&this.redraw.fire({start:s,end:r})}}function ms(i,n,a){n>=0&&n<a&&i.add(n)}const IM=30,n0=640,i0=240,ar=1,FM=720*60*60*1e3;function l0(){const i=Ss("local",At.rendererProbe);if(!i)return{v:ar,ua:{}};try{const n=JSON.parse(i);return typeof n=="object"&&n!==null&&n.v===ar&&typeof n.ua=="object"&&n.ua!==null?n:{v:ar,ua:{}}}catch{return{v:ar,ua:{}}}}function GM(i,n=Date.now()){const a=l0();a.ua[i]={failedAt:n},Ri("local",At.rendererProbe,JSON.stringify(a))}function YM(i,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";if(!a)return!1;const r=l0().ua[a];return!(!r||typeof r.failedAt!="number"||n-r.failedAt>FM)}function cb(i,n=Date.now()){const a=typeof navigator<"u"?navigator.userAgent:"";a&&GM(a,n)}function PM(i){if(i.length<4)return!0;const n=i[0],a=i[1],s=i[2],r=i[3];for(let c=4;c<i.length;c+=4)if(i[c]!==n||i[c+1]!==a||i[c+2]!==s||i[c+3]!==r)return!1;return!0}function $M(i){if(!i||i.width<=0||i.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let n=null;try{n=i.getContext("2d",{willReadFrequently:!0})||i.getContext("2d")}catch(r){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",r),"inconclusive"}if(!n)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const a=Math.min(i.width,n0),s=Math.min(i.height,i0);if(a<=0||s<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const r=n.getImageData(0,0,a,s);return PM(r.data)?"blank":"healthy"}catch(r){return console.debug("Canvas probe inconclusive: getImageData threw exception:",r),"inconclusive"}}function ub(i=2){return new Promise(n=>{if(typeof requestAnimationFrame!="function"){setTimeout(n,32);return}let a=i;const s=()=>{a--,a<=0?n():requestAnimationFrame(s)};requestAnimationFrame(s)})}const sd={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function VM(i,n={}){if(YM())return sd;let a;try{a=Wd.install(i,{isSynchronizing:n.isSynchronizing})}catch(m){return console.debug("Canvas renderer unavailable, using the DOM renderer:",m),cb(),sd}if(!a)return sd;let s=a,r=null;const c=()=>{var p;if(!s)return;cb();const m=s;s=null;try{m.uninstall()}catch{}(p=n.onRendererSwapped)==null||p.call(n,"dom")};return{get kind(){return s?"canvas":"dom"},get canvas(){return s},dispose:()=>{const m=s;s=null;try{m==null||m.dispose()}catch{}},verify:async()=>{if(s)return r||(r=(async()=>{try{const m=s.stats.frames;await ub(2);for(let g=0;g<IM&&s&&s.stats.frames===m;g++)await ub(1);if(!s)return;const p=$M(s.textCanvas);p==="blank"&&s.hasPaintedInk(n0,i0)?c():p==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(m){console.debug("Canvas probe inconclusive: unexpected error during verify():",m)}finally{r=null}})(),r)}}}function qM(i,n,a){i.writeln(" ___ ___ .___ "),i.writeln(` / | \\ ____ _______| _/______ \x1B[1m${n}\x1B[0m`),i.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${a}\x1B[0m`),i.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),i.writeln(" \\___|_ / \\___ >|__| /___/____ >"),i.writeln(" \\/ \\/ \\/ "),i.writeln("")}var XM=zx(),od={exports:{}},db;function WM(){return db||(db=1,(function(i,n){(function(a,s){i.exports=s()})(self,(()=>(()=>{var a={6:(d,m)=>{function p(y){try{const v=new URL(y),S=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(S.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(y,v,S,x={}){this._terminal=y,this._regex=v,this._handler=S,this._options=x}provideLinks(y,v){const S=g.computeLink(y,this._regex,this._terminal,this._handler);v(this._addCallbacks(S))}_addCallbacks(y){return y.map((v=>(v.leave=this._options.leave,v.hover=(S,x)=>{if(this._options.hover){const{range:w}=v;this._options.hover(S,x,w)}},v)))}};class g{static computeLink(v,S,x,w){const C=new RegExp(S.source,(S.flags||"")+"g"),[A,N]=g._getWindowedLineStrings(v-1,x),E=A.join("");let _;const D=[];for(;_=C.exec(E);){const P=_[0];if(!p(P))continue;const[B,O]=g._mapStrIdx(x,N,0,_.index),[k,R]=g._mapStrIdx(x,B,O,P.length);if(B===-1||O===-1||k===-1||R===-1)continue;const I={start:{x:O+1,y:B+1},end:{x:R,y:k+1}};D.push({range:I,text:P,activate:w})}return D}static _getWindowedLineStrings(v,S){let x,w=v,C=v,A=0,N="";const E=[];if(x=S.buffer.active.getLine(v)){const _=x.translateToString(!0);if(x.isWrapped&&_[0]!==" "){for(A=0;(x=S.buffer.active.getLine(--w))&&A<2048&&(N=x.translateToString(!0),A+=N.length,E.push(N),x.isWrapped&&N.indexOf(" ")===-1););E.reverse()}for(E.push(_),A=0;(x=S.buffer.active.getLine(++C))&&x.isWrapped&&A<2048&&(N=x.translateToString(!0),A+=N.length,E.push(N),N.indexOf(" ")===-1););}return[E,w]}static _mapStrIdx(v,S,x,w){const C=v.buffer.active,A=C.getNullCell();let N=x;for(;w;){const E=C.getLine(S);if(!E)return[-1,-1];for(let _=N;_<E.length;++_){E.getCell(_,A);const D=A.getChars();if(A.getWidth()&&(w-=D.length||1,_===E.length-1&&D==="")){const P=C.getLine(S+1);P&&P.isWrapped&&(P.getCell(0,A),A.getWidth()===2&&(w+=1))}if(w<0)return[S,_]}S++,N=0}return[S,N]}}m.LinkComputer=g}},s={};function r(d){var m=s[d];if(m!==void 0)return m.exports;var p=s[d]={exports:{}};return a[d](p,p.exports,r),p.exports}var c={};return(()=>{var d=c;Object.defineProperty(d,"__esModule",{value:!0}),d.WebLinksAddon=void 0;const m=r(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(y,v){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}d.WebLinksAddon=class{constructor(y=g,v={}){this._handler=y,this._options=v}activate(y){this._terminal=y;const v=this._options,S=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,S,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),c})()))})(od)),od.exports}var ZM=WM(),QM=Hx();function JM({fontSize:i,fontFamily:n,theme:a,cols:s,rows:r}){const c=new QM.Terminal({fontSize:i,fontFamily:n,lineHeight:1.15,...a?{theme:{...a}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:s,rows:r,screenReaderMode:!1,linkHandler:{activate:(d,m)=>{ur(m)}}});try{const d=new XM.Unicode11Addon;c.loadAddon(d),c.unicode.activeVersion="11"}catch(d){console.debug("Unicode11 addon unavailable, using default width table:",d)}try{c.loadAddon(new ZM.WebLinksAddon((d,m)=>{ur(m)}))}catch(d){console.debug("WebLinks addon unavailable, URLs stay plain text:",d)}return c}function ps(i){var n,a;if(!i)return!1;try{const s=i.modes;if(s&&typeof s.mouseTrackingMode=="string"&&s.mouseTrackingMode!=="none")return!0;const r=i._core;if((n=r==null?void 0:r._coreMouseService)!=null&&n.areMouseEventsActive||(a=r==null?void 0:r.coreMouseService)!=null&&a.areMouseEventsActive||r!=null&&r.mouseMode&&r.mouseMode!=="none")return!0}catch{}return!1}function e5(i,n){const a=n.button??0,s=n.buttons??(i==="mouseup"?0:1);return new MouseEvent(i,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,screenX:n.clientX,screenY:n.clientY,button:a,buttons:s})}function a0(i,n,a){const s=e5(n,a);return i.dispatchEvent(s)}function s0(i){var n;try{return((n=i.buffer)==null?void 0:n.active)||null}catch{return null}}function rd(i){var a;const n=(a=s0(i))==null?void 0:a.viewportY;return typeof n=="number"&&Number.isFinite(n)?n:null}function t5(i){var n;try{(n=i.blur)==null||n.call(i)}catch{}}function fb(i){var a,s;const n=i;return n.coreMouseService||((a=n._core)==null?void 0:a.coreMouseService)||((s=n._core)==null?void 0:s._coreMouseService)||null}function n5(i){var a;const n=i;return n.coreService||((a=n._core)==null?void 0:a.coreService)||null}class i5{constructor(n){this.options=n}getLogicalCoordinates(n,a){const s=this.options.getScale?this.options.getScale():1,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(s!==1&&r&&typeof r.getBoundingClientRect=="function"){const c=r.getBoundingClientRect();return zy(n,a,c,s)}return{clientX:n,clientY:a}}getViewportElement(n){var r;const a=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(a==null?void 0:a.querySelector(".xterm-viewport"))||((r=n.element)==null?void 0:r.querySelector(".xterm-viewport"))||null}isInputLineHit(n,a){var E;const s=(E=a.buffer)==null?void 0:E.active,r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,c=(r==null?void 0:r.querySelector(".xterm-screen"))||a.element||r,d=ti(a);if(!c||typeof c.getBoundingClientRect!="function"||d.cellHeight<=0)return!1;const m=c.getBoundingClientRect(),p=this.getLogicalCoordinates(n.clientX,n.clientY),g=m.width>0&&m.height>0;if(![s==null?void 0:s.cursorY,s==null?void 0:s.viewportY,s==null?void 0:s.baseY].every(_=>typeof _=="number"&&Number.isFinite(_)))return!1;const v=s==null?void 0:s.cursorY,S=s==null?void 0:s.viewportY,w=(s==null?void 0:s.baseY)+v-S,C=m.top+w*d.cellHeight,A=C+d.cellHeight,N=Number(a.rows);return w>=0&&(!Number.isFinite(N)||w<N)&&p.clientY>=C-2&&p.clientY<=A+2&&(!g||p.clientX>=m.left&&p.clientX<=m.right)}resolveDispatchTarget(n,a){var m;const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(s==null?void 0:s.querySelector(".xterm-screen"))||a.querySelector(".xterm-screen")||null,c=((m=r==null?void 0:r.closest)==null?void 0:m.call(r,".xterm"))||null;let d=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(d=document.elementFromPoint(n.clientX,n.clientY)),d&&c&&(d===c||c.contains(d))?d:r||s||a}getMouseReport(n,a){const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null,r=(s==null?void 0:s.querySelector(".xterm-screen"))||a.element;if(!r||typeof r.getBoundingClientRect!="function")return null;const c=r.getBoundingClientRect(),d=this.getLogicalCoordinates(n.clientX,n.clientY),m=ti(a);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,c.width||a.cols*m.cellWidth),g=Math.max(1,c.height||a.rows*m.cellHeight),y=Math.max(0,Math.min(p-1,d.clientX-c.left)),v=Math.max(0,Math.min(g-1,d.clientY-c.top)),S=Math.max(0,Math.min(a.cols-1,Math.floor(y/m.cellWidth))),x=Math.max(0,Math.min(a.rows-1,Math.floor(v/m.cellHeight)));return{col:S,row:x,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,s,r){const c=this.getWheelDispatchTarget(s);if(!c||typeof WheelEvent>"u"||a===0)return!1;const d=this.getLogicalCoordinates(n.clientX,n.clientY),m=a<0?-1:1;let p=0;for(let g=0;g<Math.abs(a);g+=1)try{const y=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:d.clientX,clientY:d.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(r!=null&&r.ctrlKey),altKey:!!(r!=null&&r.altKey),shiftKey:!!(r!=null&&r.shiftKey)});c.dispatchEvent(y),p+=1}catch{return p>0}return p>0}emitWheel(n,a,s,r){if(a===0)return!1;if(this.dispatchWheel(n,a,s,r))return!0;const c=fb(s);if(!(c!=null&&c.triggerMouseEvent))return!1;let d=0;for(let m=0;m<Math.abs(a);m+=1){const p=this.getMouseReport(n,s);p&&(p.button=4,p.action=a<0?0:1,p.ctrl=!!(r!=null&&r.ctrlKey),p.alt=!!(r!=null&&r.altKey),p.shift=!!(r!=null&&r.shiftKey),c.triggerMouseEvent(p)&&(d+=1))}return d>0}scrollAlternateBuffer(n,a,s,r){var d;if(a===0)return"none";const c=ps(s);if(!c&&!this.options.getIsController())return"none";if(this.emitWheel(n,a,s,r))return c?"application-mouse":"application-keys";if(!c){const m=n5(s);if(!(m!=null&&m.triggerDataEvent))return"none";const g=`\x1B${!!((d=m.decPrivateModes)!=null&&d.applicationCursorKeys)?"O":"["}${a<0?"A":"B"}`;return m.triggerDataEvent(g.repeat(Math.abs(a)),!0),"application-keys"}return"none"}emitMouse(n,a,s,r){const c=this.options.getTerminal();if(!c)return;const d=fb(c);if(d!=null&&d.triggerMouseEvent){const p=this.getMouseReport(a,c);p&&(p.action=n==="mousedown"?1:n==="mouseup"?0:32,p.ctrl=!!(s!=null&&s.ctrlKey),p.alt=!!(s!=null&&s.altKey),p.shift=!!(s!=null&&s.shiftKey),d.triggerMouseEvent(p));return}if(this.options.allowSyntheticMouseFallback===!1||!r)return;const m=this.getLogicalCoordinates(a.clientX,a.clientY);a0(r,n,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:n==="mouseup"?0:1})}}class l5{constructor(n){V(this,"options");V(this,"state","idle");V(this,"startX",0);V(this,"startY",0);V(this,"lastX",0);V(this,"lastY",0);V(this,"activeTarget",null);V(this,"longPressTimer",null);V(this,"longPressMenuTimer",null);V(this,"capturedPointerId",null);V(this,"captureElement",null);V(this,"scrollRemainderY",0);V(this,"delivery");this.options={longPressDelayMs:500,longPressMenuDelayMs:1e3,dragThresholdPx:8,scrollLineHeightPx:18,...n},this.delivery=new i5(this.options)}getState(){return this.state}setGestureState(n){var a,s;this.state!==n&&(this.state=n,(s=(a=this.options).onGestureStateChange)==null||s.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 s,r;this.state==="pending"&&(this.setGestureState("longpress"),(r=(s=this.options).onLongPress)==null||r.call(s,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs),this.longPressMenuTimer=setTimeout(()=>{var s,r;this.longPressMenuTimer=null,this.state==="longpress"&&((r=(s=this.options).onLongPressMenu)==null||r.call(s,{clientX:this.startX,clientY:this.startY}))},this.options.longPressMenuDelayMs)}moveGesture(n,a){var g,y,v,S;if(this.state==="idle")return;const s=n.clientX-this.startX,r=n.clientY-this.startY,c=Math.hypot(s,r);if(this.state==="longpress"){c>(this.options.dragThresholdPx||8)&&this.clearLongPressMenuTimer(),(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==="scrolling"){this.scrollGesture(n,a);return}const d=this.options.getTerminal(),m=this.options.getIsController(),p=ps(d);if(!(c<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(r)>=Math.abs(s)||!p||!m){this.setGestureState("scrolling"),d&&t5(d),this.lastX=n.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(n,a);return}if(p&&m){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&&((S=a.preventDefault)==null||S.call(a)));return}this.lastX=n.clientX,this.lastY=n.clientY}}scrollGesture(n,a){var w,C,A;const s=this.options.getTerminal();if(!s)return;const r=n.clientY-this.lastY;this.lastX=n.clientX,this.lastY=n.clientY;const c=ti(s),d=c.measured?c.cellHeight:this.options.scrollLineHeightPx||c.cellHeight||18;this.scrollRemainderY+=r;const m=Math.trunc(this.scrollRemainderY/d),p=-m;let g=!1,y="none";const v=s0(s),S=ps(s);if(p!==0){if((v==null?void 0:v.type)==="alternate")y=this.delivery.scrollAlternateBuffer(n,p,s,a),g=y!=="none";else{const N=rd(s);s.scrollLines(p);const E=rd(s);y="buffer",g=N===null||E===null||N!==E}this.scrollRemainderY-=m*d}const x=this.delivery.getViewportElement(s);(C=(w=this.options).onGestureScroll)==null||C.call(w,{deltaY:r,lines:p,viewportY:rd(s),scrollTop:(x==null?void 0:x.scrollTop)??null,scrollHeight:(x==null?void 0:x.scrollHeight)??null,clientHeight:(x==null?void 0:x.clientHeight)??null,moved:g,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:S,scrollMode:y}),a!=null&&a.cancelable&&((A=a.preventDefault)==null||A.call(a))}endGesture(n,a){var d,m,p,g,y;this.clearLongPressTimer();const s=this.options.getTerminal(),r=this.options.getIsController(),c=ps(s);if(this.state==="pending"){if(c&&r){const S={clientX:this.startX,clientY:this.startY};this.delivery.emitMouse("mousedown",S,a,this.activeTarget),this.delivery.emitMouse("mouseup",S,a,this.activeTarget)}const v={clientX:this.startX,clientY:this.startY};r&&s&&this.delivery.isInputLineHit(v,s)?(m=(d=this.options).onFocus)==null||m.call(d):(g=(p=this.options).onTapOutsideInput)==null||g.call(p)}else if(this.state==="dragging"&&c&&r){const v=n??{clientX:this.lastX,clientY:this.lastY};this.delivery.emitMouse("mouseup",v,a,this.activeTarget),a!=null&&a.cancelable&&((y=a.preventDefault)==null||y.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(),s=ps(n);if(this.state==="dragging"&&s&&a&&this.activeTarget){const r=this.delivery.getLogicalCoordinates(this.lastX,this.lastY);a0(this.activeTarget,"mouseup",{clientX:r.clientX,clientY:r.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),this.clearLongPressMenuTimer()}clearLongPressMenuTimer(){this.longPressMenuTimer&&(clearTimeout(this.longPressMenuTimer),this.longPressMenuTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}function a5({container:i,term:n,isTouchDevice:a,debug:s,getTerminal:r,getIsController:c,getScale:d,getSurfaceElement:m,getSelection:p,onFocus:g,getTapOpensKeyboard:y,onKeyboardOffer:v,onKeyboardOfferDismiss:S}){const x=new l5({getTerminal:r,getIsController:c,getScale:d,getSurfaceElement:m,allowSyntheticMouseFallback:!1,onFocus:()=>{if(!y()&&document.activeElement!==n.textarea){v();return}try{n.focus()}catch{}s==null||s(k=>({...k,focused:document.activeElement===n.textarea})),g()},onTapOutsideInput:S,onGestureStateChange:k=>{s==null||s(R=>({...R,state:k})),k!=="idle"&&k!=="pending"&&S()},onGestureScroll:({deltaY:k,lines:R,viewportY:I,scrollTop:Q,scrollHeight:X,clientHeight:ne,moved:oe,bufferType:ce,baseY:z,cursorY:J,hasScrollback:K,mouseTracking:ae,scrollMode:$})=>{s==null||s(ue=>({...ue,deltaY:k,lines:R,viewportY:I,scrollTop:Q,scrollHeight:X,clientHeight:ne,moved:oe,focused:document.activeElement===n.textarea,bufferType:ce,baseY:z,cursorY:J,hasScrollback:K,mouseTracking:ae,scrollMode:$,scrollCalls:ue.scrollCalls+(R!==0?1:0),lastScrollLines:R}))},longPressDelayMs:500,longPressMenuDelayMs:1e3,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:a?k=>p().handleLongPress(k):void 0,onLongPressMenu:a?()=>p().openMenuAtGesture():void 0,onSelectionExtend:a?k=>p().handleSelectionExtend(k):void 0}),w=typeof window<"u"&&"PointerEvent"in window,C=typeof TouchEvent<"u",A=[],N={passive:!1,capture:!0},E=(k,R)=>{document.addEventListener(k,R,N),A.push(()=>document.removeEventListener(k,R,N))},_=(k,R=!1)=>{const I=k.target;return I instanceof Node&&i.contains(I)||R&&x.getState()!=="idle"},D=(k,R)=>{s==null||s(I=>({...I,[k]:I[k]+1,lastInputEvent:R}))},P=k=>{const R=p();return R.hasOpenMenu()?(R.clearSelection(),k.cancelable&&k.preventDefault(),k.stopPropagation(),!0):!1},B=()=>{const k=p();x.getState()==="longpress"&&k.hasSelectionExtension()&&!k.hasOpenMenu()&&k.openMenuAtGesture()};if(w){if(E("pointerdown",k=>{if(!_(k)||(D("pointerEvents","pointerdown"),P(k)))return;x.handlePointerDown(k,i)&&k.stopPropagation()}),E("pointermove",k=>{_(k,!0)&&(D("pointerEvents","pointermove"),x.handlePointerMove(k),k.pointerType!=="mouse"&&k.stopPropagation())}),E("pointerup",k=>{_(k,!0)&&(D("pointerEvents","pointerup"),B(),x.handlePointerUp(k),k.pointerType!=="mouse"&&k.stopPropagation())}),E("pointercancel",k=>{_(k,!0)&&(D("pointerEvents","pointercancel"),p().clearSelection(),x.handlePointerCancel(k),k.pointerType!=="mouse"&&k.stopPropagation())}),C){const k=R=>{_(R,!0)&&(s==null||s(I=>({...I,touchEvents:I.touchEvents+1})),R.cancelable&&R.preventDefault(),R.stopPropagation())};for(const R of["touchstart","touchmove","touchend","touchcancel"])E(R,k)}}else E("touchstart",k=>{_(k)&&(D("touchEvents","touchstart"),!P(k)&&(k.touches.length===1&&k.stopPropagation(),x.handleTouchStart(k,i)))}),E("touchmove",k=>{_(k,!0)&&(D("touchEvents","touchmove"),k.touches.length===1&&k.stopPropagation(),x.handleTouchMove(k))}),E("touchend",k=>{_(k,!0)&&(D("touchEvents","touchend"),B(),k.stopPropagation(),x.handleTouchEnd(k))}),E("touchcancel",k=>{_(k,!0)&&(D("touchEvents","touchcancel"),p().clearSelection(),k.stopPropagation(),x.handleTouchCancel())});const O=k=>{k.preventDefault()};return i.addEventListener("contextmenu",O),A.push(()=>i.removeEventListener("contextmenu",O)),()=>{x.handlePointerCancel();for(const k of A)k()}}function s5(i,{requestFit:n,onPageVisible:a}){const s=new ResizeObserver(()=>{n()});s.observe(i);const r=()=>{n()},c=()=>{document.visibilityState==="visible"&&a()};window.addEventListener("resize",r),window.addEventListener("orientationchange",r),document.addEventListener("visibilitychange",c),window.addEventListener("pageshow",c);const d=()=>{n()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",d),window.visualViewport.addEventListener("scroll",d)),()=>{s.disconnect(),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),document.removeEventListener("visibilitychange",c),window.removeEventListener("pageshow",c),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",d),window.visualViewport.removeEventListener("scroll",d))}}function il(i){if(i)try{i.refresh(0,Math.max(0,i.rows-1))}catch{}}function o5({containerRef:i,surfaceRef:n,termRef:a,rendererRef:s,currentScaleRef:r,initialBannerWrittenRef:c,live:d,selection:m,prediction:p,fit:g,isTouchDevice:y,debug:v,terminalFontSize:S,terminalFontFamily:x,hostTheme:w,glyphRevision:C,terminalResetVersion:A,isActive:N,subscribeToOutput:E,onOutput:_,onTitle:D,onRendererKind:P}){const{requestFit:B,scheduleBoundedFit:O,fitNow:k,seedFit:R,cancelPendingFits:I}=g;T.useEffect(()=>{var ht,tt;if(!i.current||!n.current)return;const X=i.current,ne=kd(X,ca(),gd()),oe=ti(null,ha),ce=Dy({width:ne.width,height:ne.height,cellWidth:oe.cellWidth,cellHeight:oe.cellHeight});d.current.sendResize(ce.cols,ce.rows),R(ne);const z=JM({fontSize:dg(S,ne.width),fontFamily:x,theme:d.current.hostTheme,cols:ce.cols,rows:ce.rows});z.open(n.current),a.current=z;const J=z.onTitleChange(we=>{D(Ed(we)||null)}),{screenState:K,fieldProbe:ae,overlay:$}=p.attach(z);y&&z.textarea&&(z.textarea.readOnly=!1,z.textarea.tabIndex=0,z.textarea.inputMode="text");let ue=()=>{};if(v&&z.textarea){const we=()=>{v(Re=>({...Re,focused:document.activeElement===z.textarea}))};z.textarea.addEventListener("focus",we),z.textarea.addEventListener("blur",we),ue=()=>{var Re,it;(Re=z.textarea)==null||Re.removeEventListener("focus",we),(it=z.textarea)==null||it.removeEventListener("blur",we)},we()}const xe=async we=>{p.discard("paste");const Re=Hy(we);if(Re){if(we.preventDefault(),we.stopPropagation(),!d.current.isController){d.current.warnViewerMode();return}await d.current.uploadImage(Re)}};(ht=z.textarea)==null||ht.addEventListener("paste",xe),X.addEventListener("paste",xe);const fe=VM(z,{isSynchronizing:K.isSynchronizing,onRendererSwapped:we=>{var Re;X.dataset.renderer=we,P(we),(Re=p.overlayRef.current)==null||Re.attach(null),il(z)}});$.attach(fe.canvas),(tt=fe.canvas)==null||tt.setTypingZoneProvider(()=>{const we=ae.detect();return we&&{row:we.row,startCol:we.startCol,endCol:we.endCol}});const te=K.onSyncEnd(()=>{var we,Re;return(Re=(we=s.current)==null?void 0:we.canvas)==null?void 0:Re.flushHeld()});if(s.current=fe,X.dataset.renderer=fe.kind,P(fe.kind),qM(z,d.current.t("terminal.bannerTitle"),d.current.t("terminal.bannerSubtitle")),c.current=!0,z.write("",()=>void fe.verify()),!y)try{z.focus()}catch{}const le=typeof document<"u"?document.fonts:void 0;typeof(le==null?void 0:le.load)=="function"&&le.load('13px "Symbols Nerd Font Mono"').then(()=>{a.current&&(il(a.current),O(5))}).catch(()=>{});const he=z.onData(we=>{const{isController:Re}=d.current;let it=we;if(Re&&qy(we)==="keys"&&Xx(we)){const gt=d.current.consumeModifierLatch();gt&&(it=rr(we,gt))}const Ue=zd(it);if(!Re&&!fr(Ue)){d.current.warnViewerMode();return}p.onUserInput(Ue),d.current.sendBinary(Ue)}),re=z.onBinary(we=>{const Re=new Uint8Array(we.length);for(let it=0;it<we.length;it++)Re[it]=we.charCodeAt(it)&255;!d.current.isController&&!fr(Re)||d.current.sendBinary(Re)}),pe=typeof z.onWriteParsed=="function"?z.onWriteParsed(()=>{var gt;if(m.current.onTerminalContentChanged(),ae.invalidate(),K.isSynchronizing())return;const we=z.buffer.active,Re=we.baseY+we.cursorY,it=Array.from({length:8},(Rt,xn)=>{var Nn;return((Nn=we.getLine(Re-7+xn))==null?void 0:Nn.translateToString(!0))??""}),Ue=e1(it,d.current.platform);Ue&&d.current.reportShellProfile(Ue),(gt=p.predictorRef.current)==null||gt.onServerOutput(),p.sync()}):{dispose:()=>{}},se=typeof z.onRender=="function"?z.onRender(we=>{var Re;if(d.current.glyphScan){const it=z.buffer.active.viewportY??0;let Ue="";for(let gt=we.start;gt<=we.end;gt+=1)Ue+=((Re=z.buffer.active.getLine(it+gt))==null?void 0:Re.translateToString(!0))??"";/[^\x00-\x7f]/.test(Ue)&&d.current.ensureHostGlyphs(Ue)}m.current.onTerminalRender(z,we.start,we.end)}):{dispose:()=>{}},Se=typeof z.onScroll=="function"?z.onScroll(()=>{m.current.onTerminalScroll(z),p.discard("scroll")}):{dispose:()=>{}},Ae=a5({container:X,term:z,isTouchDevice:y,debug:v,getTerminal:()=>a.current,getIsController:()=>d.current.isController,getScale:()=>r.current,getSurfaceElement:()=>n.current,getSelection:()=>m.current,onFocus:()=>{var we,Re;return(Re=(we=d.current).onTerminalFocus)==null?void 0:Re.call(we)},getTapOpensKeyboard:()=>d.current.tapOpensKeyboard,onKeyboardOffer:()=>d.current.offerKeyboard(),onKeyboardOfferDismiss:()=>d.current.dismissKeyboardOffer()}),Be=s5(X,{requestFit:B,onPageVisible:()=>{O(10),il(a.current)}});return()=>{var we;he.dispose(),re.dispose(),se.dispose(),Se.dispose(),pe.dispose(),J.dispose(),te.dispose(),p.detach(),K.dispose(),Ae(),Be(),I(),ue(),(we=z.textarea)==null||we.removeEventListener("paste",xe),X.removeEventListener("paste",xe),fe.dispose(),s.current=null,z.dispose(),a.current=null}},[]),T.useEffect(()=>{const X=a.current;if(!X)return;const ne=kd(i.current,ca(),gd()),oe=dg(S,ne.width),ce=X.options.fontSize!==oe||X.options.fontFamily!==x;X.options.fontSize=oe,X.options.fontFamily=x,il(X),ce&&k(),O(10)},[S,x]),T.useEffect(()=>{var ne,oe;const X=a.current;!X||!C||((oe=(ne=s.current)==null?void 0:ne.canvas)==null||oe.clearTextureAtlas(),il(X))},[C]);const Q=T.useRef(A);T.useEffect(()=>{var ne;if(Q.current===A)return;Q.current=A,p.forget("resetVersion");const X=a.current;if(X)try{(ne=X.reset)==null||ne.call(X),X.clear(),X.refresh(0,Math.max(0,X.rows-1))}catch{}},[A]),T.useEffect(()=>{const X=a.current;!X||!w||(X.options.theme={...w},il(X))},[w]),T.useEffect(()=>E(ne=>{const oe=a.current;if(!oe)throw new Error("terminal not ready");oe.write(ne),_==null||_(ne.byteLength)}),[E,a,_]),T.useEffect(()=>{if(!N)return;O(10);const X=a.current;if(X&&(il(X),!y))try{X.focus()}catch{}},[N,y,O,a])}const r5=({onTerminalFocus:i,isActive:n=!0})=>{var bt;const a=T.useRef(null),s=T.useRef(null),r=T.useRef(null),c=T.useRef(null),d=T.useRef(null),m=T.useRef(1),p=T.useRef(null),g=T.useRef(!1),y=pw(),v=y||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,S=RC(),[x,w]=T.useState(LC),{metrics:C,record:A}=jC(S),[N,E]=T.useState(null),{settings:_,terminalFontFamily:D,terminalFontSize:P,hostFont:B,ensureHostGlyphs:O,profiles:k,activeProfileId:R,t:I}=Ee(),{isController:Q,connectionState:X,hostPalette:ne,herdrPrefixKeys:oe,terminalResetVersion:ce,agentStatus:z,platform:J,reportShellProfile:K,connect:ae,rttMs:$}=nt(),{addToast:ue}=fn(),{sendResize:xe,sendBinary:fe,observeKeyInput:te,consumeModifierLatch:le,warnViewerMode:he,subscribeToOutput:re,subscribeToPasteFileReady:pe}=Tr(),{uploadImage:se}=Mr(),Se=ei.useMemo(()=>Rw(ne),[ne]),Ae=_.touchKeyboardTrigger!=="button",Be=TC({termRef:d,enabled:y&&!Ae&&Q,onOpen:i}),ht=En({isController:Q,sendBinary:fe,sendResize:xe,warnViewerMode:he,uploadImage:se,t:I,consumeModifierLatch:le,hostTheme:Se,onTerminalFocus:i,tapOpensKeyboard:Ae,offerKeyboard:Be.offer,dismissKeyboardOffer:Be.dismiss,ensureHostGlyphs:O,glyphScan:B.glyphs.status==="ready",platform:J,reportShellProfile:K}),tt=En(n),we=FT({termRef:d,rendererRef:p,mode:_.predictiveEcho,connectionState:X,observeKeyInput:te,herdrPrefixKeys:oe}),[Re,it]=T.useState(null),Ue=eM({termRef:d,surfaceRef:r,mainRef:c,currentScaleRef:m,addToast:ue,t:I}),gt=En(Ue),Rt=BC({termRef:d,isController:Q,warnViewerMode:he,uploadImage:se,addToast:ue,t:I,onPaste:()=>we.discard("paste"),subscribeToPasteFileReady:pe}),xn=PT({termRef:d,containerRef:a,frameRef:s,surfaceRef:r,currentScaleRef:m,rendererRef:p,initialBannerWrittenRef:g,isActiveRef:tt,sendResize:xe,onResized:()=>we.forget("resize")});o5({containerRef:a,surfaceRef:r,termRef:d,rendererRef:p,currentScaleRef:m,initialBannerWrittenRef:g,live:ht,selection:gt,prediction:we,fit:xn,isTouchDevice:y,debug:S?w:null,terminalFontSize:P,terminalFontFamily:D,hostTheme:Se,glyphRevision:B.glyphRevision,terminalResetVersion:ce,isActive:n,subscribeToOutput:re,onOutput:S?A:null,onTitle:it,onRendererKind:E});const Nn=ei.useMemo(()=>{var It;return((It=k.find(_n=>_n.id===R))==null?void 0:It.displayName)??null},[k,R]);T.useEffect(()=>{X!=="connected"&&it(null)},[X]),T.useEffect(()=>{const It=n&&X==="connected",_n=_.agentAlertBadge?Ms(z):null;mC(It?Re:null,Nn,_n)},[n,X,Re,Nn,z,_.agentAlertBadge]),T.useEffect(()=>{X==="disconnected"&&ae()},[]);const dl=It=>{It.preventDefault()};return h.jsxs("main",{ref:c,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:dl,"aria-label":I("terminal.windowAriaLabel"),children:[h.jsx("div",{id:"terminal-container",ref:a,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:v?"none":"auto"},tabIndex:0,onContextMenu:dl,"aria-label":I("terminal.bufferAriaLabel"),role:"region",children:h.jsx("div",{id:"terminal-frame",ref:s,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:h.jsx("div",{id:"terminal-surface",ref:r,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),S&&h.jsx(HC,{debug:x,rttMs:$,metrics:C,rendererKind:N,predictiveEcho:_.predictiveEcho,predictor:we.predictorRef.current,field:((bt=we.fieldProbeRef.current)==null?void 0:bt.detect())??null,renderer:p.current}),y&&Ue.selectionRect&&Ue.isHighlightVisible&&h.jsx(tM,{term:d.current,surface:r.current,main:c.current,rect:Ue.selectionRect,viewportY:Ue.viewportY}),Be.box&&!Ue.selectionRect&&!Ue.selectionMenu&&h.jsx(MC,{term:d.current,surface:r.current,main:c.current,box:Be.box,label:I("terminal.showKeyboard"),onOpen:Be.open}),y&&Ue.selectionMenu&&h.jsx(_C,{anchorPoint:Ue.selectionMenu,hasSelection:!!Ue.selectionSnapshot,isController:Q,vibrateOnKeyPress:_.vibrateOnKeyPress,linkUrl:Ue.selectionMenu.link??null,onOpenLink:It=>{ur(It)||ue("warning",I("clipboard.openLinkFailed"))},onCopySelection:Ue.handleCopySelection,onCopyLine:Ue.handleCopyLine,onCopyScreen:Ue.handleCopyScreen,onPaste:Rt.handlePaste,onClose:Ue.clearSelection}),y&&Rt.isPasteFallbackOpen&&h.jsx(NC,{isOpen:Rt.isPasteFallbackOpen,onClose:Rt.closePasteFallback,onSend:Rt.handleFallbackPasteSend,onSendImage:Rt.handleFallbackImageSend})]})},c5=2e3;function Zd(){const{t:i}=Ee(),{addToast:n}=fn(),[a,s]=T.useState(null),r=T.useRef(null);T.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const c=T.useCallback((d,m,p="success")=>{qd(d).then(g=>{if(g==="failed"){n("error",i("clipboard.copyFailed"));return}s(d),n(p,m),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>s(null),c5)})},[n,i]);return{copied:a,copy:c}}const al="herdr-remote pair",hb="herdr-remote",u5=({onPairedSuccess:i})=>{const{settings:n,updateSettings:a,t:s}=Ee(),{connect:r,connectionState:c,stateDetail:d}=nt(),{addToast:m}=fn(),[p,g]=T.useState(""),{copied:y,copy:v}=Zd(),[S,x]=T.useState(!1),[w,C]=T.useState(n.wsUrl||Kt),[A,N]=T.useState(n.token||""),[E,_]=T.useState(n.clientId||""),D=k=>v(k,s("toasts.commandCopied")),P=k=>{k.preventDefault();const R=p.trim().toUpperCase();if(!R&&!A.trim()){m("warning",s("toasts.connectionError"));return}const I={pairCode:R,wsUrl:w.trim()||Kt,clientId:E.trim()||n.clientId};A.trim()&&(I.token=A.trim()),a(I),r({pairCode:R||void 0,token:A.trim()||void 0,wsUrl:w.trim()||Kt,clientId:E.trim()||n.clientId}),i&&i()},B=c==="connecting"||c==="reconnecting",O=({n:k})=>h.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",k,"]"]});return h.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:h.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[h.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[h.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[h.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),h.jsx("h1",{className:"text-tui font-bold text-tui-text",children:s("onboarding.title")}),h.jsx("span",{className:"text-tui uppercase text-tui-warn",children:s("onboarding.firstTimeSetup")})]}),h.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:s("onboarding.description")})]}),c==="error"&&h.jsxs(ji,{tone:"warn",action:h.jsx(Me,{variant:"warn",onClick:()=>r(),children:s("common.retry")}),children:[h.jsx("span",{className:"block font-bold",children:s("onboarding.authRequired")}),h.jsx("span",{className:"block text-tui-muted",children:d||s("onboarding.authRequiredDesc")})]}),h.jsxs("form",{onSubmit:P,className:"grid gap-3",children:[h.jsx(Et,{title:s("onboarding.step1Title"),className:"min-w-0",children:h.jsxs("div",{className:"space-y-2",children:[h.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[h.jsx(O,{n:1}),h.jsx("span",{className:"leading-snug",children:s("onboarding.step1Desc")})]}),h.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),h.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:al}),h.jsx(Me,{onClick:()=>D(al),glyph:y===al?Ne.check:"⧉",className:ie("shrink-0",y===al&&"border-tui-ok text-tui-ok"),children:s(y===al?"common.copied":"common.copy")})]}),h.jsx("div",{className:"space-y-0.5 text-tui-sm",children:h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"truncate text-tui-faint",children:s("onboarding.step1TuiNote")}),h.jsx("button",{type:"button",onClick:()=>D(hb),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:s("common.clickToCopy"),children:h.jsx("code",{children:hb})})]})})]})}),h.jsx(Et,{title:s("onboarding.step2Title"),className:"min-w-0",children:h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(O,{n:2}),h.jsx(dn,{type:"text",value:p,onChange:k=>g(k.target.value.toUpperCase()),placeholder:s("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":s("onboarding.step2Title"),className:"font-bold uppercase"})]}),h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:s("onboarding.step2Note")})]})}),h.jsx(Me,{variant:"primary",type:"submit",block:!0,disabled:B,className:"py-1.5",children:B?h.jsx(cl,{label:s("onboarding.connectingAndPairing")}):s("onboarding.connectAndPair")}),h.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[h.jsxs("button",{type:"button",onClick:()=>x(!S),"aria-expanded":S,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:[h.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:S?Ne.chevronDown:Ne.chevronRight}),h.jsx("span",{className:"uppercase",children:s("onboarding.advancedTitle")})]}),S&&h.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(rl,{htmlFor:"onboarding-token",children:s("onboarding.manualTokenLabel")}),h.jsx(dn,{id:"onboarding-token",type:"password",value:A,onChange:k=>N(k.target.value),placeholder:s("onboarding.manualTokenPlaceholder")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx(rl,{htmlFor:"onboarding-ws",children:s("onboarding.wsEndpointLabel")}),h.jsx(dn,{id:"onboarding-ws",type:"text",value:w,onChange:k=>C(k.target.value),placeholder:s("onboarding.wsEndpointPlaceholder")})]}),h.jsx(nC,{}),h.jsxs("div",{className:"space-y-1",children:[h.jsx(rl,{htmlFor:"onboarding-client-id",children:s("onboarding.clientIdLabel")}),h.jsx(dn,{id:"onboarding-client-id",type:"text",value:E,onChange:k=>_(k.target.value)})]})]})]})]})]})})},ni="tui-focusable inline-flex shrink-0 select-none items-center justify-center gap-1 whitespace-nowrap border text-tui font-medium transition-colors",_s="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",d5="border-tui-accent bg-tui-accent text-tui-crust font-bold",f5="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",o0={default:_s,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 h5(i){return{capHeight:i?"h-8":"h-7",keyClass:i?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",squareKeyClass:i?"h-8 w-8":"h-7 w-7",drawerToggleClass:i?"h-8 px-1.5":"h-7 px-1.5"}}const m5={left:{glyph:"",box:[0,660,34,686]},up:{glyph:"",box:[0,652,30,690]},down:{glyph:"",box:[0,652,30,690]},right:{glyph:"",box:[0,660,34,686]},enter:{glyph:"",box:[0,709,-36,756]},backspace:{glyph:"",box:[0,1e3,-15,735]},shift:{glyph:"",box:[0,832,26,694]},open:{glyph:"",box:[91,509,256,464]},close:{glyph:"",box:[91,509,256,464]},image:{glyph:"",box:[0,750,-15,735]},attach:{glyph:"",box:[70,530,-99,819]},customize:{glyph:"",box:[0,750,-15,735]},admin:{glyph:"",box:[0,750,-99,819]}},p5={"←":"left","↑":"up","↓":"down","→":"right","⏎":"enter","⌫":"backspace","⇧":"shift"},g5=.9,b5=.86,cd=1e3;function y5([i,n,a,s]){const r=g5*cd/Math.max(n-i,s-a),c=(i+n)/2/cd,d=b5-(a+s)/2/cd;return{fontSize:`${r}em`,left:`${(.5-r*c)*100}%`,top:`${(.5-r*d)*100}%`}}function on({name:i}){const n=m5[i];return h.jsx("span",{"aria-hidden":"true","data-key-icon":i,className:"relative inline-block size-[1em] shrink-0 overflow-visible",children:h.jsx("span",{className:"absolute leading-none",style:y5(n.box),children:n.glyph})})}function r0({text:i}){return h.jsx("span",{className:"inline-flex items-center",children:[...i].map((n,a)=>{const s=p5[n];return s?h.jsx(on,{name:s},a):n})})}function v5({keyClass:i,squareKeyClass:n,onCustomize:a,sendCombo:s}){const{settings:r,t:c}=Ee(),{agentProfile:d,shellProfile:m}=nt(),p=dw(d,r.agentKeymaps[d],m),g=v=>{let S="";try{S=la(v.combo)}catch{}const x=v.custom?v.customLabel||"":c(`agentActions.${v.labelKey}`),w=v.labelKey==="interrupt"&&v.combo.trim().toLowerCase()==="ctrl+c"?"bad":v.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return h.jsx("button",{type:"button","data-testid":`agent-key-${v.id}`,onClick:()=>s(v.combo),className:ie(ni,i,"font-bold",o0[w]),title:`${S} ${x}`.trim(),"aria-label":`${S} ${x}`.trim(),children:h.jsx(r0,{text:S||x})},v.id)},y=[...p.agentActions,...p.genericActions];return y.length===0&&!a?null:h.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${ll[d].name} ${c("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[h.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),y.map(g),a&&h.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:a,className:ie(ni,n,"border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:c("agentKeymaps.customizeBar"),"aria-label":c("agentKeymaps.customizeBar"),children:h.jsx(on,{name:"customize"})})]})}const c0="scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5";function x5({capHeight:i,onKey:n}){return h.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 s=`F${a}`;return h.jsxs("button",{type:"button",onClick:()=>n(de[s]),className:ie(ni,_s,i),children:["F",a]},s)})})}const w5=[{code:de.CTRL_C,caption:"^C",title:"virtualKeyboard.ctrlCTitle",badge:"virtualKeyboard.badgeSigint",tone:"bad"},{code:de.CTRL_D,caption:"^D",title:"virtualKeyboard.ctrlDTitle",badge:"virtualKeyboard.badgeEof"},{code:de.CTRL_Z,caption:"^Z",title:"virtualKeyboard.ctrlZTitle",badge:"virtualKeyboard.badgeTstp",tone:"warn"},{code:de.CTRL_L,caption:"^L",title:"virtualKeyboard.ctrlLTitle",badge:"virtualKeyboard.badgeClear"},{code:de.CTRL_R,caption:"^R",title:"virtualKeyboard.ctrlRTitle",badge:"virtualKeyboard.badgeSearch"},{code:de.CTRL_A,caption:"^A",title:"virtualKeyboard.ctrlATitle",badge:"virtualKeyboard.badgeStart"},{code:de.CTRL_E,caption:"^E",title:"virtualKeyboard.ctrlETitle",badge:"virtualKeyboard.badgeEnd"},{code:de.CTRL_K,caption:"^K",title:"virtualKeyboard.ctrlKTitle",badge:"virtualKeyboard.badgeKill"}];function S5({capHeight:i,onKey:n}){const{t:a}=Ee();return h.jsx("div",{className:c0,children:w5.map(s=>h.jsxs("button",{type:"button",onClick:()=>n(s.code,!1),className:ie(ni,i,"gap-1.5 px-2",o0[s.tone??"default"]),title:a(s.title),children:[h.jsx("span",{className:"font-bold",children:s.caption}),h.jsx("span",{className:"text-tui-sm opacity-70",children:a(s.badge)})]},s.caption))})}const C5=["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"];function T5({squareKeyClass:i,onKey:n}){return h.jsx("div",{className:c0,children:C5.map(a=>h.jsx("button",{type:"button",onClick:()=>n(a,!0),className:ie(ni,_s,i,"font-bold"),children:a},a))})}const mb="image/png,image/jpeg,image/webp,image/gif,image/*";function pb({fileInputRef:i,anyFileInputRef:n}){const{uploadImage:a,uploadFile:s}=Mr(),r=d=>{var p;const m=(p=d.target.files)==null?void 0:p[0];d.target.value="",m&&a(m)},c=d=>{var p;const m=(p=d.target.files)==null?void 0:p[0];d.target.value="",m&&s(m)};return h.jsxs(h.Fragment,{children:[h.jsx("input",{ref:i,type:"file",accept:mb,className:"hidden","data-testid":"key-toolbar-file-input",onChange:r}),h.jsx("input",{type:"file",accept:mb,capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:r}),h.jsx("input",{ref:n,type:"file",className:"hidden","data-testid":"key-toolbar-any-file-input",onChange:c})]})}function gb({collapsed:i}){const{uploadProgress:n}=Mr();return n.active?h.jsx("div",{"data-testid":i?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:h.jsx(aC,{ratio:n.ratio,label:n.statusText,tone:n.phase==="completed"?"ok":n.phase==="error"?"bad":"accent","aria-label":n.statusText})}):null}const M5={image:{testId:"image-upload-btn",icon:"image",label:"virtualKeyboard.uploadImage",title:"virtualKeyboard.uploadImageTitle"},file:{testId:"file-upload-btn",icon:"attach",label:"virtualKeyboard.uploadFile",title:"virtualKeyboard.uploadFileTitle"}};function bb({kind:i,inputRef:n,keyClass:a,squareKeyClass:s,vibrate:r}){const{t:c}=Ee(),{isController:d}=nt(),{warnViewerMode:m}=Tr(),{uploadProgress:p}=Mr(),g=p.active,y=g&&(p.kind??"image")===i,v=M5[i],S=()=>{var x;if(r(),!d){m();return}g||(x=n.current)==null||x.click()};return h.jsx("button",{type:"button","data-testid":v.testId,onClick:S,disabled:g,className:ie(ni,y?a:s,g?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":_s),title:g?p.statusText:c(v.title),"aria-label":c(v.label),children:y?h.jsx("span",{children:`${p.percent}%`}):h.jsx(on,{name:v.icon})})}function A5(){const{settings:i}=Ee(),{isController:n}=nt(),{sendKey:a,warnViewerMode:s,consumeModifierLatch:r}=Tr(),c=T.useRef([]);T.useEffect(()=>()=>{for(const g of c.current)clearTimeout(g);c.current=[]},[]);const d=T.useCallback(()=>{if(i.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[i.vibrateOnKeyPress]),m=T.useCallback((g,y=!0)=>{if(d(),!n){s();return}const v=r();a(y&&v?rr(g,v):g)},[n,a,s,d,r]),p=T.useCallback(g=>{if(d(),!n){s();return}let y;try{y=un(g)}catch{return}if(r(),y.length===1){a(y[0]);return}y.forEach((v,S)=>{const x=setTimeout(()=>{c.current=c.current.filter(w=>w!==x),a(v)},S*120);c.current.push(x)})},[r,n,a,d,s]);return{vibrate:d,pressKey:m,sendCombo:p}}function E5({squareKeyClass:i}){const{platform:n,adminTerminalSupported:a,adapter:s}=nt(),{t:r}=Ee();if(n!=="win32")return null;const c=a!==!1;return h.jsx("button",{type:"button","data-testid":"new-admin-terminal",onClick:()=>s==null?void 0:s.sendAdminTabOpen(),disabled:!c,className:ie(ni,i,"border-amber-500/50 bg-amber-500/10 text-amber-200 hover:border-amber-400 hover:bg-amber-500/20 disabled:cursor-not-allowed disabled:opacity-50"),title:r(c?"terminal.adminTerminalSetup":"terminal.adminTerminalUpdate"),"aria-label":r("terminal.newAdminTerminal"),children:h.jsx(on,{name:"admin"})})}const k5=new Set(["left","up","down","right","enter"]),N5=500,_5=8,L5=({compact:i=!1,onCustomize:n})=>{const{settings:a,updateSettings:s,t:r}=Ee(),{modifierLatch:c,toggleModifierLatch:d}=Tr(),{vibrate:m,pressKey:p,sendCombo:g}=A5(),{capHeight:y,keyClass:v,squareKeyClass:S,drawerToggleClass:x}=h5(i),w=T.useRef(null),C=T.useRef(null),A=T.useRef(null),N=T.useRef(null),E=T.useRef(!1);T.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const[_,D]=T.useState(!1),[P,B]=T.useState(!1),[O,k]=T.useState(!1),R=T.useRef(null),[I,Q]=T.useState(!1),X=T.useCallback(()=>{const te=R.current;Q(!!te&&te.scrollLeft+te.clientWidth<te.scrollWidth-1)},[]);T.useEffect(X),T.useEffect(()=>{const te=R.current;if(!te||typeof ResizeObserver!="function")return;const le=new ResizeObserver(X);return le.observe(te),()=>le.disconnect()},[X,a.toolbarVisible]);const ne=()=>{A.current&&clearTimeout(A.current),A.current=null},oe=(te,le)=>{const he=te.modifierType;te.type!=="modifier"||le.button!==0||he!=="ctrl"&&he!=="alt"&&he!=="shift"||(ne(),E.current=!1,N.current={pointerId:le.pointerId,clientX:le.clientX,clientY:le.clientY,triggered:!1},A.current=setTimeout(()=>{const re=N.current;!re||re.pointerId!==le.pointerId||(re.triggered=!0,E.current=!0,c[he]||d(he),m())},N5))},ce=te=>{const le=N.current;!le||le.pointerId!==te.pointerId||Math.hypot(te.clientX-le.clientX,te.clientY-le.clientY)<=_5||(ne(),le.triggered||(N.current=null))},z=te=>{const le=N.current;!le||le.pointerId!==te.pointerId||(ne(),N.current=null,le.triggered&&setTimeout(()=>{E.current=!1},0))},J=te=>{const le=N.current;!le||le.pointerId!==te.pointerId||(ne(),N.current=null,E.current=!1)};if(!a.toolbarVisible)return h.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:[h.jsx(pb,{fileInputRef:w,anyFileInputRef:C}),h.jsx(gb,{collapsed:!0}),h.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:h.jsxs("button",{type:"button",onClick:()=>s({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:r("virtualKeyboard.expandToolbar"),"aria-label":r("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[h.jsx(on,{name:"open"}),h.jsx("span",{"aria-hidden":"true",children:r("common.keyBar")})]})})]});const K=a.virtualKeys&&a.virtualKeys.length>0?a.virtualKeys.filter(te=>te.enabled):ty,ae=te=>te.id==="left"?h.jsx(on,{name:"left"}):te.id==="up"?h.jsx(on,{name:"up"}):te.id==="down"?h.jsx(on,{name:"down"}):te.id==="right"?h.jsx(on,{name:"right"}):te.id==="enter"?h.jsx(on,{name:"enter"}):te.id==="drawer_chords"?h.jsx("span",{children:"^C"}):te.id==="drawer_fn"?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"Fn"}),h.jsx(on,{name:_?"close":"open"})]}):h.jsx(r0,{text:te.label}),$=te=>{if(m(),te.type==="modifier"){te.modifierType==="ctrl"||te.modifierType==="alt"||te.modifierType==="shift"?d(te.modifierType):te.modifierType==="meta"&&p(de.ESC);return}if(te.type==="drawer"){te.drawerType==="fn"?(D(!_),B(!1),k(!1)):te.drawerType==="chords"?(k(!O),D(!1),B(!1)):te.drawerType==="symbols"&&(B(!P),D(!1),k(!1));return}p(te.code,te.type!=="chord")},ue=te=>{if(te.type==="modifier"){if(te.modifierType==="ctrl")return c.ctrl;if(te.modifierType==="alt")return c.alt;if(te.modifierType==="shift")return c.shift}if(te.type==="drawer"){if(te.drawerType==="fn")return _;if(te.drawerType==="chords")return O;if(te.drawerType==="symbols")return P}return!1},xe=te=>{const le=ue(te),he=wd(te,r);return h.jsx("button",{type:"button",onPointerDown:re=>oe(te,re),onPointerMove:ce,onPointerUp:z,onPointerCancel:J,onClick:()=>{if(E.current){E.current=!1;return}$(te)},className:ie(ni,k5.has(te.id)?S:te.type==="drawer"?x:v,te.id==="enter"?f5:le?d5:_s),title:he,"aria-label":he,"aria-pressed":le,children:ae(te)},te.id)},fe=K.find(te=>te.id==="enter");return h.jsxs("div",{"data-testid":"key-toolbar",className:ie("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",i?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":r("virtualKeyboard.touchKeyboardShortcuts"),children:[h.jsx(pb,{fileInputRef:w,anyFileInputRef:C}),h.jsx(gb,{collapsed:!1}),_&&h.jsx(x5,{capHeight:y,onKey:p}),O&&h.jsx(S5,{capHeight:y,onKey:p}),P&&h.jsx(T5,{squareKeyClass:S,onKey:p}),h.jsxs("div",{"data-testid":"key-toolbar-row",className:ie("flex flex-nowrap items-center justify-start gap-1",i?"px-1.5 py-1":"px-2 py-1.5"),children:[h.jsxs("div",{className:"relative min-w-0",children:[h.jsxs("div",{ref:R,"data-testid":"key-toolbar-scroll",onScroll:X,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[h.jsx("button",{type:"button",onClick:()=>s({toolbarVisible:!1}),className:ie(ni,S,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:r("virtualKeyboard.collapseToolbar"),"aria-label":r("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:h.jsx(on,{name:"close"})}),K.filter(te=>te.id!=="enter").map(xe),h.jsx(E5,{squareKeyClass:S}),h.jsx(v5,{keyClass:v,squareKeyClass:S,onCustomize:n,sendCombo:g}),h.jsx(bb,{kind:"file",inputRef:C,keyClass:v,squareKeyClass:S,vibrate:m}),h.jsx(bb,{kind:"image",inputRef:w,keyClass:v,squareKeyClass:S,vibrate:m})]}),I&&h.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"})]}),fe&&xe(fe)]})]})},R5=({hint:i,children:n})=>{const{t:a}=Ee(),[s,r]=T.useState(!1);return h.jsxs("div",{className:"border border-tui-border-dim",children:[h.jsxs("button",{type:"button",onClick:()=>r(!s),"aria-expanded":s,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:[h.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:s?Ne.chevronDown:Ne.chevronRight}),h.jsx("span",{children:a("pairing.advancedTitle")}),h.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint",children:i})]}),s&&h.jsx("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:n})]})},j5=({isOpen:i,onClose:n})=>{const{t:a,addProfileAndConnect:s}=Ee(),{addToast:r}=fn(),[c,d]=T.useState(""),[m,p]=T.useState(Kt),[g,y]=T.useState("");T.useEffect(()=>{i&&(d(""),p(Kt),y(""))},[i]);const v=S=>{S.preventDefault();const x=c.trim().toUpperCase();if(!x&&!g.trim()){r("warning",a("pairing.credentialsRequired"));return}s({wsUrl:m.trim()||Kt,pairCode:x,token:g.trim()}),n()};return h.jsx(ga,{isOpen:i,onClose:n,title:a("pairing.addTitle"),subtitle:a("pairing.addSubtitle"),closeLabel:a("common.closeDialog"),size:"sm",hints:[{keys:"esc",action:a("common.close")},{keys:"⏎",action:a("pairing.pairAndConnect")}],footer:h.jsx(Me,{variant:"primary",type:"submit",form:"add-host-form",children:a("pairing.pairAndConnect")}),children:h.jsxs("form",{id:"add-host-form",onSubmit:v,className:"space-y-3",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(rl,{htmlFor:"add-host-code",hint:a("pairing.pairCodeNote"),children:a("pairing.pairCodeLabel")}),h.jsx(dn,{id:"add-host-code",type:"text",value:c,onChange:S=>d(S.target.value.toUpperCase()),placeholder:a("pairing.pairCodePlaceholder"),maxLength:12,autoComplete:"off",autoFocus:!0,className:"font-bold uppercase"}),h.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("pairing.pairCodeHelp")})]}),h.jsxs(R5,{hint:a("pairing.advancedHint"),children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(rl,{htmlFor:"add-host-ws",children:a("pairing.wsUrlLabel")}),h.jsx(dn,{id:"add-host-ws",type:"text",value:m,onChange:S=>p(S.target.value),placeholder:a("onboarding.wsEndpointPlaceholder")})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx(rl,{htmlFor:"add-host-token",hint:a("pairing.tokenNote"),children:a("pairing.tokenLabel")}),h.jsx(dn,{id:"add-host-token",type:"password",value:g,onChange:S=>y(S.target.value),placeholder:a("onboarding.manualTokenPlaceholder")})]})]})]})})},Li=ie(Er,"py-0"),O5="h-7 py-0",jd="h-7 py-0 px-1.5",Sr="text-tui-bad hover:border-tui-bad hover:text-tui-bad",D5=["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 u0(i){return{offLabel:i("settings.toggleOff"),onLabel:i("settings.toggleOn")}}const z5=["ctrl","alt","shift"],H5=[[..."1234567890"].map(i=>({token:i,label:i})),[..."qwertyuiop"].map(i=>({token:i,label:i.toUpperCase()})),[..."asdfghjkl"].map(i=>({token:i,label:i.toUpperCase()})),[..."zxcvbnm"].map(i=>({token:i,label:i.toUpperCase()})),["-","=","[","]","backslash",";","'",",",".","/","plus"].map(i=>({token:i,label:i==="backslash"?"\\":i==="plus"?"+":i}))],B5=[{token:"esc",label:"ESC"},{token:"tab",label:"TAB"},{token:"space",label:"SPACE"},{token:"enter",label:"ENTER"},{token:"backspace",label:"⌫"},{token:"delete",label:"DEL"},{token:"insert",label:"INS"},{token:"home",label:"HOME"},{token:"end",label:"END"},{token:"pageup",label:"PGUP"},{token:"pagedown",label:"PGDN"},{token:"left",label:"←"},{token:"up",label:"↑"},{token:"down",label:"↓"},{token:"right",label:"→"},...Array.from({length:12},(i,n)=>({token:`f${n+1}`,label:`F${n+1}`}))],ud="tui-focusable min-w-0 border border-tui-border bg-tui-mantle px-1.5 py-1 text-tui-sm font-bold text-tui-text transition-colors hover:border-tui-accent hover:text-tui-accent";function U5(i){const n=i.trim();if(!n)return[];try{return un(n),n.split(/\s+/)}catch{return[]}}function K5({isOpen:i,value:n,onClose:a,onApply:s}){const{t:r}=Ee(),[c,d]=T.useState([]),m=T.useRef(0),[p,g]=T.useState([]);T.useEffect(()=>{i&&(m.current=0,d(U5(n).map(w=>({id:m.current++,combo:w}))),g([]))},[i,n]);const y=w=>{g(C=>C.includes(w)?C.filter(A=>A!==w):[...C,w])},v=w=>{if(c.length>=8)return;const C=[...p,w].join("+");d(A=>[...A,{id:m.current++,combo:C}]),g([])},S=c.map(w=>w.combo).join(" "),x=c.length>0&&p.length===0;return h.jsx(ga,{isOpen:i,onClose:a,title:r("agentKeymaps.comboPickerTitle"),closeLabel:r("common.closeDialog"),size:"lg",footer:h.jsxs(h.Fragment,{children:[h.jsx(Me,{variant:"ghost",onClick:a,children:r("common.cancel")}),h.jsx(Me,{variant:"primary",disabled:!x,onClick:()=>s(S),"data-testid":"combo-picker-apply",children:r("agentKeymaps.comboPickerApply")})]}),children:h.jsxs("div",{className:"space-y-3",children:[h.jsx("p",{className:"text-tui-sm text-tui-faint",children:r("agentKeymaps.comboPickerHint")}),h.jsxs("div",{className:"space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"text-tui-sm text-tui-muted",children:r("agentKeymaps.comboPickerSelection")}),h.jsx(Me,{variant:"ghost",disabled:c.length===0&&p.length===0,onClick:()=>{d([]),g([])},children:r("agentKeymaps.comboPickerClear")})]}),h.jsxs("div",{"data-testid":"combo-picker-selection",className:"flex min-h-9 flex-wrap items-center gap-1 border border-tui-border-dim bg-tui-crust p-1",children:[c.map((w,C)=>{let A=w.combo;try{A=la(w.combo)}catch{}return h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx(yr,{children:A}),h.jsx("button",{type:"button","aria-label":r("agentKeymaps.comboPickerRemoveStep",{step:C+1}),className:"tui-focusable text-tui-faint hover:text-tui-bad",onClick:()=>d(N=>N.filter(E=>E.id!==w.id)),children:"×"})]},w.id)}),p.map(w=>h.jsx(yr,{active:!0,children:w.toUpperCase()},w)),c.length===0&&p.length===0&&h.jsx("span",{className:"px-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.comboPickerEmpty")})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"mb-1 text-tui-sm text-tui-muted",children:r("agentKeymaps.comboPickerModifiers")}),h.jsx("div",{className:"flex gap-1",children:z5.map(w=>h.jsx("button",{type:"button","aria-pressed":p.includes(w),onClick:()=>y(w),className:`${ud} ${p.includes(w)?"border-tui-accent bg-tui-accent text-tui-crust":""}`,children:w.toUpperCase()},w))})]}),h.jsxs("fieldset",{className:"space-y-1.5",children:[h.jsx("legend",{className:"sr-only",children:r("agentKeymaps.comboPickerKeyboard")}),H5.map(w=>h.jsx("div",{className:"grid grid-cols-10 gap-1",children:w.map(({token:C,label:A})=>h.jsx("button",{type:"button","aria-label":A,className:ud,disabled:c.length>=8,onClick:()=>v(C),children:A},C))},w.map(({token:C})=>C).join("-"))),h.jsx("div",{className:"flex flex-wrap gap-1",children:B5.map(({token:w,label:C})=>h.jsx("button",{type:"button","aria-label":C,className:ud,disabled:c.length>=8,onClick:()=>v(w),children:C},w))})]})]})})}const I5=({profile:i,onProfileChange:n})=>{const{settings:a,updateSettings:s,t:r}=Ee(),{agentProfile:c}=nt(),[d,m]=T.useState({}),p=T.useRef({}),[g,y]=T.useState(""),[v,S]=T.useState(""),[x,w]=T.useState(null),C=i||c,A=a.agentKeymaps[C]||{},N=Ob(C,A),E=Db(C,A),_=E.filter(K=>!K.hidden).length,D=K=>K.custom?K.customLabel||"":r(`agentActions.${K.labelKey}`),P=K=>{try{return la(K.combo)}catch{return K.combo}},B=K=>{s({agentKeymaps:{...a.agentKeymaps,[C]:K}})},O=(K,ae)=>{var $;B({...A,actions:{...A.actions,[K]:{...($=A.actions)==null?void 0:$[K],...ae}}})},k=K=>{O(K.id,{keys:K.defaultCombo})},R=(K,ae)=>{const $=K+(ae==="up"?-1:1);if($<0||$>=N.length)return;const ue=N.map(xe=>xe.id);[ue[K],ue[$]]=[ue[$],ue[K]],B({...A,order:ue})},I=K=>{var ae;B({...A,custom:(A.custom||[]).filter($=>$.id!==K),order:(ae=A.order)==null?void 0:ae.filter($=>$!==K)})},Q=()=>B(fw(A)),X=()=>{const K={...a.agentKeymaps};delete K[C],s({agentKeymaps:K})},ne=()=>{const K=g.trim();if(!K)return;try{un(v)}catch{return}const ae=`custom-${Date.now().toString(36)}`;B({...A,custom:[...A.custom||[],{id:ae,label:K,keys:v.trim()}],order:[...N.map($=>$.id),ae]}),y(""),S("")},oe=K=>K instanceof bn?r(`agentKeymaps.errors.${K.code}`,K.params):String(K),ce=(K,ae)=>`${K}:${ae}`,z=(K,ae)=>{const $=ce(C,K);p.current={...p.current,[$]:ae},m(p.current);try{un(ae),O(K,{keys:ae})}catch{}},J=K=>{const ae=ce(C,K),$=p.current[ae];if($!==void 0){delete p.current[ae],m({...p.current});try{un($),O(K,{keys:$})}catch{}}};return h.jsxs("div",{className:"space-y-4",children:[h.jsx(yn,{title:r("agentKeymaps.settingsProfileLabel"),aside:h.jsx(Me,{variant:"ghost",onClick:X,className:ie(Sr,jd),children:r("agentKeymaps.restoreProfile")}),children:h.jsx(Lt,{label:r("agentKeymaps.profileRowLabel"),htmlFor:"agent-keymap-profile",hint:ll[C].configHint?r("agentKeymaps.configHint",{path:ll[C].configHint}):void 0,control:h.jsx(Ar,{id:"agent-keymap-profile","aria-label":r("agentKeymaps.settingsProfileLabel"),value:C,onChange:K=>n(K.target.value),className:Li,children:tw.map(K=>h.jsx("option",{value:K,children:ll[K].name},K))})})}),h.jsx(yn,{title:r("agentKeymaps.barGroup"),aside:h.jsx(Me,{variant:"ghost",onClick:Q,className:ie(Sr,jd),children:r("agentKeymaps.restoreBar")}),children:h.jsxs("div",{className:"space-y-2 py-1.5",children:[h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("agentKeymaps.barHint",{profile:ll[C].name,count:_})}),h.jsx("div",{role:"group","aria-label":r("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:E.map(K=>{const ae=D(K),$=P(K),ue=!K.hidden;return h.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${K.id}`,"aria-pressed":ue,onClick:()=>O(K.id,{hidden:ue}),title:`${$} ${ae}`.trim(),className:ie("tui-focusable inline-flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",ue?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[h.jsx("span",{"aria-hidden":"true",className:"font-bold",children:ue?Ne.check:"+"}),h.jsx("span",{className:"font-bold",children:$}),h.jsx("span",{className:ue?void 0:"opacity-80",children:ae})]},K.id)})})]})}),h.jsx(yn,{title:r("agentKeymaps.listGroup",{profile:ll[C].name}),children:N.map((K,ae)=>{var re,pe;const $=D(K),ue=r("agentKeymaps.defaultCombo",{combo:la(K.defaultCombo)}),xe=((pe=(re=A.actions)==null?void 0:re[K.id])==null?void 0:pe.keys)??K.combo,fe=ce(C,K.id),te=d[fe]??xe;let le="",he=null;try{un(te),le=la(te)}catch(se){he=oe(se)}return h.jsxs("div",{"data-testid":`agent-setting-row-${K.id}`,className:D5,children:[h.jsx(yr,{className:"w-full overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:le||"—"}),h.jsxs("span",{className:"min-w-0 break-words text-tui text-tui-text [grid-area:label]",title:$,children:[$,!K.verified&&h.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:r("agentKeymaps.unverified")})]}),h.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${K.id}`,children:[r("agentKeymaps.shortcutLabel")," ",$]}),h.jsx(dn,{id:`agent-combo-${K.id}`,"aria-label":`${r("agentKeymaps.shortcutLabel")} ${$}`,value:te,onChange:se=>z(K.id,se.target.value),onClick:()=>w({kind:"action",actionId:K.id,value:te}),inputMode:"none",onBlur:()=>J(K.id),onKeyDown:se=>{se.key==="Enter"&&se.currentTarget.blur()},placeholder:r("agentKeymaps.comboPlaceholder"),"aria-invalid":!!he,className:ie("w-full min-w-0 [grid-area:combo]",O5)}),h.jsx("span",{className:"min-w-0 break-words text-tui-sm text-tui-faint [grid-area:default]",title:ue,children:ue}),h.jsxs("div",{className:"flex items-center justify-end [grid-area:actions]",children:[h.jsx(sl,{onClick:()=>k(K),title:r("agentKeymaps.resetAction"),"aria-label":`${r("agentKeymaps.resetAction")} ${$}`,children:"↺"}),h.jsx(sl,{disabled:ae===0,onClick:()=>R(ae,"up"),title:r("agentKeymaps.moveUp"),"aria-label":`${r("agentKeymaps.moveUp")} ${$}`,children:"↑"}),h.jsx(sl,{disabled:ae===N.length-1,onClick:()=>R(ae,"down"),title:r("agentKeymaps.moveDown"),"aria-label":`${r("agentKeymaps.moveDown")} ${$}`,children:"↓"}),K.custom?h.jsx(sl,{variant:"danger",onClick:()=>I(K.id),title:r("agentKeymaps.removeCustom"),"aria-label":`${r("agentKeymaps.removeCustom")} ${$}`,children:Ne.cross}):h.jsx("span",{"aria-hidden":"true",className:"h-7 w-7 shrink-0"})]}),he&&h.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:r("agentKeymaps.invalidCombo",{error:he})})]},K.id)})}),h.jsx(yn,{title:r("agentKeymaps.addCustom"),children:h.jsxs("div",{className:"space-y-1 py-1.5",children:[h.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[h.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[h.jsx("span",{children:r("agentKeymaps.customLabel")}),h.jsx(dn,{value:g,onChange:K=>y(K.target.value),className:Li})]}),h.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-muted",children:[h.jsx("span",{children:r("agentKeymaps.customCombo")}),h.jsx(dn,{value:v,onChange:K=>S(K.target.value),onClick:()=>w({kind:"custom",value:v}),inputMode:"none",placeholder:r("agentKeymaps.comboPlaceholder"),className:Li})]}),h.jsx(Me,{variant:"primary",glyph:"+",onClick:ne,disabled:!g.trim()||!v.trim(),className:Li,children:r("agentKeymaps.addAction")})]}),v.trim()&&(()=>{try{return un(v),h.jsx("p",{className:"text-tui-sm text-tui-info",children:la(v)})}catch(K){const ae=oe(K);return h.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:ae})}})()]})}),x&&h.jsx(K5,{isOpen:!0,value:x.value,onClose:()=>w(null),onApply:K=>{x.kind==="custom"?S(K):(z(x.actionId,K),J(x.actionId)),w(null)}})]})},d0={"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"},F5=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],G5=()=>{const{hostFont:i,loadHostFont:n,declineHostFont:a,settings:s,activeProfile:r,t:c}=Ee(),{herdrLaunch:d,hostname:m}=nt(),{addToast:p}=fn(),{font:g,status:y,glyphs:v}=i,S=y==="loading"||v.status==="loading",x=y==="failed"||v.status==="failed",w=T.useRef(!1);T.useEffect(()=>{w.current&&!S&&!x&&i.interactive&&p("success",c("hostFont.loaded")),w.current=S&&i.interactive},[S,x,i.interactive,p,c]);const C=y==="available"||v.status==="available",A=i.interactive&&(S||x);if(!(g&&s.fontFamily==="host"&&!d&&(C||A)))return null;const E=y==="available"||i.interactive&&(y==="loading"||y==="failed"),_=v.source&&(v.status==="available"||i.interactive&&(v.status==="loading"||v.status==="failed")),D=m||(r==null?void 0:r.displayName)||c("herdrLaunch.thisHost"),P=[g.sizePx?`${Math.round(g.sizePx)}px`:null,g.source?d0[g.source]||g.source:null].filter(Boolean).join(c("hostFont.detailSeparator")),B=i.error&&F5.includes(i.error)?i.error:"other",O=i.totalBytes?i.receivedBytes/i.totalBytes:0;return h.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:h.jsxs(Et,{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:[h.jsx("p",{className:"leading-snug text-tui-text",children:E||!v.source?c("hostFont.body",{host:D,family:g.family,detail:P?c("hostFont.detail",{detail:P}):""}):c("hostFont.bodyGlyphsOnly",{host:D,family:v.source.family})}),S?h.jsxs("div",{className:"space-y-1",role:"status",children:[h.jsx(lC,{value:O,width:32,className:"max-w-full overflow-hidden"}),h.jsx("p",{className:"text-tui-sm text-tui-muted",children:c("hostFont.loading",{received:Xu(i.receivedBytes),total:Xu(i.totalBytes)})})]}):h.jsxs(h.Fragment,{children:[x?h.jsx(ji,{tone:"bad",children:c("hostFont.failed",{reason:c(`hostFont.reasons.${B}`)})}):h.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[E&&g.faces.length?h.jsx("p",{children:c("hostFont.download",{count:g.faces.length,size:Xu(i.totalBytes)})}):null,_&&v.source?h.jsx("p",{children:c(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),h.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[h.jsx(Me,{onClick:a,children:c("hostFont.decline")}),h.jsx(Me,{variant:"primary",onClick:n,autoFocus:!0,children:c(x?"common.retry":"hostFont.load")})]})]})]})})},Y5=({onOpenAdmin:i})=>{var P;const{settings:n,updateSettings:a,language:s,setLanguage:r,t:c,hostFont:d,syncHostFont:m,terminalFontFamily:p,terminalFontSize:g}=Ee(),{connectionState:y}=nt(),v=bd.find(B=>B.id===n.fontFamily),S=(B,O)=>B==="host"||B==="system"?c(`fontPresets.${B}`):O,x=(()=>{const{font:B,status:O}=d,k=d.totalBytes?Math.round(d.receivedBytes/d.totalBytes*100):0,R=c(`settings.hostFontStatus.${O}`,{percent:k});return B?[B.family,B.sizePx?`${Math.round(B.sizePx)}px`:null,B.source?d0[B.source]||B.source:null,R].filter(Boolean).join(" · "):R})(),w=(P=d.font)!=null&&P.sizePx?ua(d.font.sizePx):null,C=d.glyphs.source&&d.glyphs.status!=="none"?c("settings.hostGlyphLine",{family:d.glyphs.source.family,status:c(`settings.hostGlyphStatus.${d.glyphs.status}`,{count:d.glyphs.covered.toLocaleString()})}):null,A=typeof window<"u"&&window.isSecureContext&&"Notification"in window,N=10,E=24,_=u0(c),D=w?c("settings.fontSizeFollowHost",{size:w}):c("settings.fontSizeFollowHostUnknown");return h.jsxs("div",{className:"space-y-4",children:[h.jsx(yn,{title:c("settings.sectionInterface"),children:h.jsx(Lt,{label:c("settings.languageLabel"),hint:c("settings.languageHint"),control:h.jsx(bs,{name:"ui-language","aria-label":c("settings.languageLabel"),value:s,onChange:r,options:[{value:"zh",label:"简体中文"},{value:"en",label:"English"}]})})}),h.jsxs(yn,{title:c("settings.sectionFont"),children:[h.jsx(Lt,{label:c("settings.fontFamilyLabel"),htmlFor:"terminal-font-select",control:h.jsxs(Ar,{id:"terminal-font-select",value:n.fontFamily,onChange:B=>a({fontFamily:B.target.value}),"aria-label":c("settings.fontFamilyLabel"),className:Li,children:[!v&&h.jsx("option",{value:n.fontFamily,children:n.fontFamily}),bd.map(B=>h.jsx("option",{value:B.id,children:S(B.id,B.name)},B.id))]})}),n.fontFamily==="host"&&h.jsx(Lt,{label:c("settings.hostFontLabel"),hint:h.jsxs(h.Fragment,{children:[h.jsx("span",{"data-testid":"host-font-status",className:"block break-words text-tui-info",children:x}),C?h.jsx("span",{"data-testid":"host-glyph-status",className:"block break-words",children:C}):null]}),control:h.jsx(Me,{block:!0,onClick:m,disabled:y!=="connected"||d.status==="loading"||d.glyphs.status==="loading",className:Li,children:c("settings.hostFontSync")})}),h.jsx(Lt,{label:c("settings.fontSizeLabel",{size:g}),hint:c("settings.fontSizeHint"),htmlFor:"terminal-font-size",control:h.jsx("div",{className:ie("flex items-center",Er),children:h.jsx("input",{id:"terminal-font-size",type:"range",min:N,max:E,step:1,value:g,onChange:B=>a({fontSize:Number(B.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})})}),h.jsx(Lt,{label:D,control:h.jsx(_i,{label:D,..._,checked:n.fontSizeFollowsHost,onChange:B=>a(B?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:g})})}),h.jsx("div",{className:"py-1.5",children:h.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:p,fontSize:`${g}px`},children:[h.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})})]}),h.jsxs(yn,{title:c("settings.sectionInput"),children:[h.jsx(Lt,{label:c("settings.predictiveEchoLabel"),hint:c("settings.predictiveEchoDesc"),control:h.jsx(bs,{name:"predictive-echo","aria-label":c("settings.predictiveEchoLabel"),value:n.predictiveEcho,onChange:B=>a({predictiveEcho:B}),options:[{value:"auto",label:c("settings.predictiveEchoAuto")},{value:"always",label:c("settings.predictiveEchoAlways")},{value:"off",label:c("settings.predictiveEchoOff")}]})}),h.jsx(Lt,{label:c("settings.touchKeyToolbar"),hint:c("settings.touchKeyToolbarDesc"),control:h.jsx(_i,{label:c("settings.touchKeyToolbar"),..._,checked:n.toolbarVisible,onChange:B=>a({toolbarVisible:B})})}),h.jsx(Lt,{label:c("settings.touchKeyboardTrigger"),hint:c("settings.touchKeyboardTriggerDesc"),control:h.jsx(bs,{name:"touch-keyboard-trigger","aria-label":c("settings.touchKeyboardTrigger"),value:n.touchKeyboardTrigger,onChange:B=>a({touchKeyboardTrigger:B}),options:[{value:"tap",label:c("settings.touchKeyboardTriggerTap")},{value:"button",label:c("settings.touchKeyboardTriggerButton")}]})}),h.jsx(Lt,{label:c("settings.touchHaptics"),hint:c("settings.touchHapticsDesc"),control:h.jsx(_i,{label:c("settings.touchHaptics"),..._,checked:n.vibrateOnKeyPress,onChange:B=>a({vibrateOnKeyPress:B})})})]}),h.jsxs(yn,{title:c("settings.agentAlertsLabel"),children:[h.jsx(Lt,{label:c("settings.agentAlertBadge"),hint:c("settings.agentAlertBadgeDesc"),control:h.jsx(_i,{label:c("settings.agentAlertBadge"),..._,checked:n.agentAlertBadge,onChange:B=>a({agentAlertBadge:B})})}),h.jsx(Lt,{label:c("settings.agentAlertVibrate"),hint:c("settings.agentAlertVibrateDesc"),control:h.jsx(_i,{label:c("settings.agentAlertVibrate"),..._,checked:n.agentAlertVibrate,onChange:B=>a({agentAlertVibrate:B})})}),h.jsx(Lt,{label:c("settings.agentAlertSound"),hint:c("settings.agentAlertSoundDesc"),control:h.jsx(_i,{label:c("settings.agentAlertSound"),..._,checked:n.agentAlertSound,onChange:B=>{a({agentAlertSound:B}),B&&(fy(),hy("done"))}})}),A&&h.jsx(Lt,{label:c("settings.agentAlertNotify"),hint:c("settings.agentAlertNotifyDesc"),control:h.jsx(_i,{label:c("settings.agentAlertNotify"),..._,checked:n.agentAlertNotify,onChange:B=>{if(B&&Notification.permission!=="granted"){Notification.requestPermission().then(O=>a({agentAlertNotify:O==="granted"}));return}a({agentAlertNotify:B})}})})]}),i&&h.jsx(yn,{title:c("settings.sectionAdmin"),children:h.jsx(Lt,{label:c("settings.adminEntry"),hint:c("settings.adminEntryHint"),control:h.jsx(Me,{block:!0,variant:"primary",glyph:Ne.arrowRight,onClick:i,className:Li,children:c("settings.adminEntryOpen")})})})]})},P5=()=>{const{settings:i,updateSettings:n,t:a}=Ee(),{addToast:s}=fn(),[r,c]=T.useState(!1),d=u0(a),m=i.virtualKeys&&i.virtualKeys.length>0?i.virtualKeys:Ts(),p=x=>{const w=m.map(C=>C.id===x?{...C,enabled:!C.enabled}:C);n({virtualKeys:w})},g=(x,w)=>{const C=w==="up"?x-1:x+1;if(C<0||C>=m.length)return;const A=[...m],N=A[x];A[x]=A[C],A[C]=N,n({virtualKeys:A})},y=x=>{if(m.some(C=>C.id===x.id)){const C=m.map(A=>A.id===x.id?{...A,enabled:!0}:A);n({virtualKeys:C})}else{const C=[...m,{...x,enabled:!0}];n({virtualKeys:C})}c(!1)},v=x=>{const w=m.filter(C=>C.id!==x);n({virtualKeys:w})},S=()=>{n({virtualKeys:Ts()}),s("info",a("toasts.keyLayoutReset"))};return h.jsxs("div",{className:"space-y-3",children:[h.jsx(yn,{title:a("virtualKeyboard.customizeTitle"),aside:h.jsx(Me,{variant:"ghost",onClick:S,className:ie(Sr,jd),children:a("virtualKeyboard.resetLayout")}),children:m.map((x,w)=>{const C=wd(x,a);return h.jsxs("div",{className:"flex items-center gap-2 py-1",children:[h.jsx(yr,{className:ie("w-16 shrink-0 truncate",!x.enabled&&"opacity-50"),children:x.label}),h.jsx("span",{className:ie("min-w-0 flex-1 break-words text-tui",x.enabled?"text-tui-text":"text-tui-faint"),children:C}),h.jsx(_i,{label:`${a("virtualKeyboard.enableKey")} ${x.label}`,...d,checked:x.enabled,onChange:()=>p(x.id),className:"h-7 w-24 shrink-0"}),h.jsx(sl,{disabled:w===0,onClick:()=>g(w,"up"),title:a("virtualKeyboard.moveUp"),"aria-label":a("virtualKeyboard.moveUp"),children:"↑"}),h.jsx(sl,{disabled:w===m.length-1,onClick:()=>g(w,"down"),title:a("virtualKeyboard.moveDown"),"aria-label":a("virtualKeyboard.moveDown"),children:"↓"}),h.jsx(sl,{variant:"danger",onClick:()=>v(x.id),title:a("virtualKeyboard.deleteKeyTitle"),"aria-label":a("virtualKeyboard.deleteKeyTitle"),children:Ne.cross})]},x.id)})}),h.jsx(Me,{block:!0,glyph:"+",onClick:()=>c(!r),className:ie("border-dashed",Li),children:a("virtualKeyboard.addKey")}),r&&h.jsx(yn,{title:a("virtualKeyboard.availableKeys"),children:h.jsx("div",{className:"flex flex-wrap gap-1 py-1.5",children:H1.map(x=>{const w=m.some(C=>C.id===x.id);return h.jsxs("button",{type:"button",onClick:()=>y(x),title:wd(x,a),className:ie("tui-focusable flex h-7 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",w?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[h.jsx("span",{children:x.label}),h.jsx("span",{"aria-hidden":"true",className:w?"text-tui-ok":"text-tui-accent",children:w?Ne.check:"+"})]},x.id)})})})]})},$5=({isOpen:i,onClose:n,initialTab:a,onOpenAdmin:s})=>{const{updateSettings:r,t:c,activeProfile:d}=Ee(),{addToast:m}=fn(),[p,g]=T.useState("general"),[y,v]=T.useState(null);if(T.useEffect(()=>{!i||!a||(g(a),v(null))},[i,a]),!i)return null;const S=()=>{const x=ly();r({fontSize:x.fontSize,fontSizeFollowsHost:x.fontSizeFollowsHost,fontFamily:x.fontFamily,toolbarVisible:x.toolbarVisible,vibrateOnKeyPress:x.vibrateOnKeyPress,predictiveEcho:x.predictiveEcho,agentAlertBadge:x.agentAlertBadge,agentAlertSound:x.agentAlertSound,agentAlertVibrate:x.agentAlertVibrate,agentAlertNotify:x.agentAlertNotify,virtualKeys:x.virtualKeys}),m("info",c("settings.resetDefaultsToast"))};return h.jsxs(ga,{isOpen:i,onClose:n,title:c("settings.title"),subtitle:d?c("settings.subtitleInstance",{name:d.displayName}):c("settings.subtitle"),closeLabel:c("common.closeDialog"),size:"lg",fixedHeight:!0,hints:[{keys:"esc",action:c("common.close")}],footer:h.jsxs(h.Fragment,{children:[h.jsx(Me,{variant:"ghost",onClick:S,className:Sr,children:c("settings.resetDefaults")}),h.jsx(Me,{variant:"primary",onClick:n,children:c("common.done")})]}),children:[h.jsx($d,{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=>g(x),className:"mb-3 border-b border-tui-border-dim pb-1"}),p==="general"&&h.jsx(Y5,{onOpenAdmin:s}),p==="virtualKeys"&&h.jsx(P5,{}),p==="agentKeymaps"&&h.jsx(I5,{profile:y,onProfileChange:v})]})},V5={success:"ok",warning:"warn",error:"bad",info:"accent"},q5={success:Ne.check,warning:Ne.warn,error:Ne.cross,info:"›"},X5=()=>{const{t:i}=Ee(),{toasts:n,removeToast:a}=fn();return n.length===0?null:h.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(s=>{const r=V5[s.type];return h.jsxs("div",{className:ie("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",cn[r].edgeL),role:"alert",children:[h.jsx("span",{"aria-hidden":"true",className:ie("shrink-0 font-bold",cn[r].text),children:q5[s.type]}),h.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:s.message}),s.count>1&&h.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted",children:["×",s.count]}),h.jsx("button",{type:"button",onClick:()=>a(s.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":i("common.dismissNotification"),children:h.jsx("span",{"aria-hidden":"true",children:Ne.cross})})]},s.id)})})};function Qd(i,n){const a=(s,r)=>n?n(s):r;switch(i){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 f0=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function W5(i){return i?i.total>0||f0.some(({status:n})=>{var a;return(((a=i.counts)==null?void 0:a[n])??0)>0}):!1}const h0=({className:i,compact:n=!1})=>{const{t:a}=Ee(),{agentStatus:s}=nt();if(!s)return null;const r=f0.map(({status:d,level:m})=>{var p;return{status:d,level:m,count:((p=s.counts)==null?void 0:p[d])??0}}).filter(d=>d.count>0),c=n?r.slice(0,1):r;return c.length===0?s.total===0?null:h.jsxs("span",{"data-testid":"agent-status-chip",className:ie("flex shrink-0 items-center gap-1 px-1 text-tui-muted",i),title:a("agents.title"),children:[h.jsx(vn,{level:"idle"}),h.jsx("span",{className:"text-tui-faint",children:a("agents.allIdle")})]}):h.jsx("span",{"data-testid":"agent-status-chip",className:ie("flex shrink-0 items-center gap-2 px-1",i),title:a("agents.title"),children:c.map(({status:d,level:m,count:p})=>h.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[h.jsx(vn,{level:m}),h.jsx("span",{className:"text-tui-text",children:p}),h.jsx("span",{className:"text-tui-faint",children:a(`agents.${d}`)})]},d))})},Jd=({onAddProfile:i,mobile:n=!1,statusBar:a=!1})=>{const{profiles:s,activeProfileId:r,activeProfile:c,switchProfile:d,renameProfile:m,removeProfile:p,t:g}=Ee(),{connectionState:y}=nt(),[v,S]=T.useState(!1),[x,w]=T.useState(null),[C,A]=T.useState(""),N=T.useRef(null);T.useEffect(()=>{if(!v)return;const O=k=>{N.current&&!N.current.contains(k.target)&&S(!1)};return document.addEventListener("pointerdown",O),()=>document.removeEventListener("pointerdown",O)},[v]);const E=(O,k)=>{w(O),A(k)},_=O=>{const k=C.trim();k&&m(O,k),w(null)},D=O=>{typeof window<"u"&&!window.confirm(g("profiles.removeConfirm"))||(p(O),w(null))},P=(c==null?void 0:c.displayName)||g("profiles.addHost"),B=y==="connected"?"ok":y==="connecting"||y==="reconnecting"?"warn":y==="error"?"bad":"idle";return h.jsxs("div",{ref:N,className:ie("relative min-w-0",n&&"w-full",a&&"flex-1",!n&&!a&&"h-full",!n&&!a&&"shrink-0"),children:[h.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":g("profiles.switcherLabel"),onClick:()=>S(O=>!O),className:ie("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:[h.jsx(vn,{level:B}),h.jsx("span",{className:ie("min-w-0 truncate text-tui-text",a&&"flex-1"),children:P}),h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?Ne.chevronDown:Ne.chevronRight})]}),v&&h.jsxs("div",{role:"menu","aria-label":g("profiles.switcherLabel"),className:ie("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:[h.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:g("profiles.title")}),s.length===0?h.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:g("profiles.empty")}):s.map(O=>{const k=O.id===r,R=O.id===x;return h.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsxs("button",{type:"button",role:"menuitem","aria-current":k?"true":void 0,onClick:()=>{d(O.id),S(!1)},className:ie("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",k?"text-tui-accent":"text-tui-text"),children:[h.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:k?Ne.cursor:""}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block truncate font-bold",children:O.displayName}),h.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:O.hostname||O.hostId,children:O.hostname||O.hostId||O.wsUrl})]}),k&&h.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:g("profiles.current")})]}),h.jsx("button",{type:"button",role:"menuitem","aria-label":g("profiles.rename"),title:g("profiles.rename"),onClick:()=>E(O.id,O.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Ne.ellipsis})]}),R&&h.jsxs("div",{className:"grid grid-cols-2 gap-1 px-2 pb-2",children:[h.jsx("input",{autoFocus:!0,value:C,maxLength:64,onChange:I=>A(I.target.value),onKeyDown:I=>{I.key==="Enter"&&_(O.id),I.key==="Escape"&&w(null)},"aria-label":g("profiles.rename"),className:"tui-input col-span-2 h-11 min-w-0 px-2 py-1 text-tui"}),h.jsx(Me,{onClick:()=>_(O.id),variant:"primary",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("common.save")}),h.jsx(Me,{onClick:()=>D(O.id),variant:"danger",className:"h-11 w-full min-w-0 whitespace-nowrap",children:g("profiles.remove")})]})]},O.id)}),h.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{S(!1),i()},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:[h.jsx("span",{"aria-hidden":"true",children:"+"}),h.jsx("span",{children:g("profiles.addHost")})]})]})]})},m0=({compact:i=!1,className:n})=>{const{settings:a,updateSettings:s,t:r}=Ee(),{connectionState:c,sharedWindowCount:d,assignedClientId:m}=nt(),p=a.observerMode,g=h.jsx(bs,{name:"control-mode","aria-label":r("role.modeLabel"),value:p?"observe":"control",onChange:y=>s({observerMode:y==="observe"}),tone:p?"warn":"ok",size:i?"sm":"md",options:[{value:"control",label:r("role.sharedControl")},{value:"observe",label:r("common.viewer")}],className:n});return i?g:h.jsxs("div",{className:"flex w-full flex-col gap-1",children:[g,h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r(p?"role.observerHint":"role.controlHint")}),c==="connected"&&d>1?h.jsx("p",{className:"text-tui-sm text-tui-muted",children:r("role.sharedWindows",{count:d})}):null,m?h.jsx(An,{label:r("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:h.jsx("span",{className:"truncate text-tui-muted",children:m})}):null]})},Z5="dibin666/herdr-remote",p0=`https://github.com/${Z5}/releases`,Q5=`${p0}/latest/download/herdr-remote.tgz`;function J5(i){return`${p0}/download/herdr-remote-v${i}/herdr-remote-${i}.tgz`}function g0(){const{updateStatus:i,ignoredUpdate:n,hostVersion:a}=nt();return a===null||!!(i!=null&&i.updateAvailable)&&n!==(i==null?void 0:i.latest)}const eA="Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*node_modules\\herdr-remote*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }",b0=({compact:i=!1,className:n})=>{const{t:a}=Ee(),{updateStatus:s}=nt(),r=g0(),[c,d]=T.useState(!1);if(!r)return null;const m=s!=null&&s.updateAvailable?s:null,p=m?m.restartPending?a("update.chipRestart",{version:m.latest}):i?a("update.chipCompact",{version:m.latest}):a("update.chip",{version:m.latest}):a("update.chipOutdated");return h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>d(!0),title:a("update.title"),className:ie("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",n),children:p}),h.jsx(tA,{isOpen:c,onClose:()=>d(!1)})]})},ol=({command:i})=>{const{t:n}=Ee(),{addToast:a}=fn();return h.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),h.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:i}),h.jsx(Me,{glyph:"⧉",className:"shrink-0",onClick:()=>{qd(i).then(s=>{a(s==="failed"?"error":"success",n(s==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:n("common.copy")})]})},tA=({isOpen:i,onClose:n})=>{const{t:a}=Ee(),{updateStatus:s,ignoreUpdate:r,hostname:c,hostId:d,platform:m}=nt();if(!(s!=null&&s.updateAvailable))return h.jsx(nA,{isOpen:i,onClose:n,host:c||d,win:m==="win32"});const{current:p,installed:g,latest:y,restartPending:v,updateCommand:S}=s;return h.jsx(ga,{isOpen:i,onClose:n,title:a("update.title"),closeLabel:a("common.closeDialog"),size:"md",footer:h.jsxs(h.Fragment,{children:[h.jsx(Me,{variant:"ghost",onClick:()=>{r(y),n()},children:a("update.ignore")}),h.jsx(Me,{variant:"primary",onClick:n,children:a("common.done")})]}),children:h.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx(An,{label:a("common.host"),labelWidth:10,children:c||d||"—"}),h.jsx(An,{label:a("update.running"),labelWidth:10,children:p}),g!==p?h.jsx(An,{label:a("update.installed"),labelWidth:10,children:g}):null,h.jsx(An,{label:a("update.latest"),labelWidth:10,children:h.jsx("span",{className:"text-tui-ok",children:y})})]}),v?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"leading-snug text-tui-text",children:a("update.restartPending",{version:g})}),h.jsx(ol,{command:"herdr-remote restart"})]}):h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:"leading-snug text-tui-text",children:[h.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:Ne.arrowRight}),a("update.stepTui")]}),h.jsx("p",{className:"leading-snug text-tui-muted",children:a("update.stepCli")}),S?h.jsx(ol,{command:"herdr-remote update"}):h.jsxs(h.Fragment,{children:[h.jsx(ol,{command:`npm install -g ${J5(y)}`}),h.jsx(ol,{command:"herdr-remote restart"})]}),h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:a("update.restartNote")})]})]})})},nA=({isOpen:i,onClose:n,host:a,win:s})=>{const{t:r}=Ee();return h.jsx(ga,{isOpen:i,onClose:n,title:r("update.title"),closeLabel:r("common.closeDialog"),size:"md",footer:h.jsx(Me,{variant:"primary",onClick:n,children:r("common.done")}),children:h.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx(An,{label:r("common.host"),labelWidth:10,children:a||"—"}),h.jsx(An,{label:r("update.running"),labelWidth:10,children:h.jsx("span",{className:"text-tui-warn",children:r("update.outdatedVersion")})})]}),h.jsx("p",{className:"leading-snug text-tui-text",children:r("update.outdated")}),s?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"leading-snug text-tui-muted",children:r("update.windowsStop")}),h.jsx(ol,{command:eA})]}):null,h.jsx(ol,{command:`npm install -g ${Q5}`}),h.jsx(ol,{command:"herdr-remote restart"}),h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:r("update.restartNote")})]})})},dd="shrink-0 whitespace-nowrap",yb="min-w-0 truncate whitespace-nowrap",iA=({onAddProfile:i=()=>{}})=>{const{settings:n,t:a}=Ee(),{connectionState:s,hostId:r,assignedClientId:c,sharedWindowCount:d,rttMs:m,agentStatus:p}=nt(),g=Qd(s,a),y=s==="connected",v=g0();return h.jsx(Ry,{left:h.jsxs(h.Fragment,{children:[h.jsx(Jd,{onAddProfile:i}),h.jsx(Ad,{"data-testid":"status-line-segments",items:[h.jsxs("span",{className:ie(dd,"flex items-center gap-1"),children:[h.jsx(vn,{level:g.level}),h.jsx("span",{className:"text-tui-text",children:g.label})]},"status"),y?h.jsx(m0,{compact:!0,className:ie(dd,"h-full w-auto")},"role"):null,y&&d>1?h.jsx("span",{className:ie(dd,"text-tui-muted"),children:a("role.sharedWindows",{count:d})},"windows"):null,r?h.jsxs("span",{className:yb,children:[h.jsxs("span",{className:"text-tui-faint",children:[a("common.host"),":"]})," ",h.jsx("span",{className:"text-tui-text",children:r})]},"host"):null,h.jsxs("span",{className:yb,children:[h.jsx("span",{className:"text-tui-faint",children:a("header.clientIdLabel")})," ",h.jsx("span",{className:"text-tui-text",children:c||n.clientId})]},"client")]})]}),right:h.jsx(Ad,{items:[v?h.jsx(b0,{},"update"):null,y&&W5(p)?h.jsx(h0,{},"agents"):null,m!==null?h.jsxs("span",{className:"text-tui-muted",children:[a("header.latencyTitle"),": ",h.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,h.jsx("span",{className:"hidden text-tui-faint sm:inline",children:a("header.tagline")},"mode")]})})},lA=({wsUrl:i,adminUrl:n,onOpenRemoteAdmin:a,onSignIn:s})=>{const{t:r}=Ee();return h.jsxs(Et,{title:r("admin.remoteRelayTitle"),bodyClassName:"space-y-2",children:[h.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:r("admin.remoteRelayNotice")}),h.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[h.jsx(An,{label:r("admin.remoteRelayEndpoint"),labelWidth:18,children:h.jsx("code",{className:"break-all text-tui-accent",children:i})}),h.jsx(An,{label:r("admin.remoteRelayAdminUrl"),labelWidth:18,children:h.jsx("code",{className:"break-all text-tui-ok",children:n})})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(Me,{variant:"primary",onClick:a,glyph:Ne.arrowRight,children:r("admin.openRemoteAdminBtn")}),h.jsx(Me,{onClick:s,children:r("admin.relayAdminLoginBtn")})]})]})},aA=({adminConfigured:i,isAuthError:n,tokenInput:a,onTokenInput:s,onSubmit:r,isSameOriginRelay:c,onBackToTerminal:d,showBack:m,onCancel:p})=>{const{t:g}=Ee();return h.jsxs(Et,{title:g("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[i===!1?h.jsx(ji,{tone:"warn",children:g("admin.relayAdminNotConfigured")}):n?h.jsx(ji,{tone:"bad",children:g("admin.relayAdminAuthError")}):h.jsx(ji,{tone:"accent",children:g("admin.relayAdminPrompt")}),h.jsxs("form",{onSubmit:r,className:"space-y-2",children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx(rl,{htmlFor:"relay-admin-token",children:g("admin.relayAdminTokenLabel")}),h.jsx(dn,{id:"relay-admin-token",type:"password",autoComplete:"current-password",value:a,onChange:y=>s(y.target.value),placeholder:g("admin.relayAdminTokenPlaceholder")})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Me,{variant:"primary",type:"submit",disabled:!a.trim(),children:g("admin.relayAdminLoginBtn")}),c?d&&!m?h.jsx(Me,{variant:"ghost",onClick:d,children:g("admin.returnToTerminal")}):null:h.jsx(Me,{variant:"ghost",onClick:p,children:g("common.cancel")})]})]})]})},sA=({onOpenPairing:i,onRetry:n})=>{const{t:a}=Ee(),{copied:s,copy:r}=Zd(),c=s!==null,d=()=>r(al,a("toasts.commandCopied"));return h.jsxs(Et,{title:a("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[h.jsx(ji,{tone:"bad",children:a("admin.unauthorizedDesc")}),h.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[h.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:a("admin.pairingStepsTitle")}),h.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),h.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:al}),h.jsx(Me,{onClick:d,glyph:c?Ne.check:"⧉",className:ie("shrink-0",c&&"border-tui-ok text-tui-ok"),children:a(c?"admin.copiedJson":"common.copy")})]}),h.jsx("p",{className:"text-tui-sm text-tui-faint",children:a("admin.pairingStepsHelp")})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[i&&h.jsx(Me,{variant:"primary",onClick:i,children:a("admin.enterPairCodeBtn")}),h.jsx(Me,{onClick:n,children:a("admin.retryFetchBtn")})]})]})},oA=[[/\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"]],rA=[[/\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 vb(i,n){for(const[a,s]of i)if(a.test(n))return s;return null}function ef(i){const n=typeof i=="string"?i.trim():"";if(!n)return{label:"",raw:""};const a=vb(oA,n),s=vb(rA,n);return a&&s?{label:`${a} · ${s}`,raw:n}:a?{label:a,raw:n}:s?{label:s,raw:n}:{label:n.length>32?`${n.slice(0,32)}…`:n,raw:n}}function sa(i){if(!i||i<=0)return"0 B";const n=1024,a=["B","KB","MB","GB","TB"],s=Math.min(a.length-1,Math.floor(Math.log(i)/Math.log(n)));return`${(i/n**s).toFixed(1)} ${a[s]}`}function xb(i,n,a=!1){const s=Math.max(0,Math.floor(i)),r=Math.floor(s/86400),c=Math.floor(s%86400/3600),d=Math.floor(s%3600/60),m=s%60,p=(y,v)=>`${y}${n(`admin.unit${v}`)}`,g=r>0?[p(r,"Day"),p(c,"Hour"),p(d,"Minute")]:c>0?[p(c,"Hour"),p(d,"Minute"),p(m,"Second")]:[p(d,"Minute"),p(m,"Second")];return(a?g.slice(0,2):g).join(" ")}function tf(i,n,a=Date.now()){if(!i)return"—";const s=new Date(i).getTime();if(Number.isNaN(s))return"—";const r=Math.max(0,Math.floor((a-s)/1e3));return r<60?n("admin.relJustNow"):r<3600?n("admin.relMinutes",{count:Math.floor(r/60)}):r<86400?n("admin.relHours",{count:Math.floor(r/3600)}):n("admin.relDays",{count:Math.floor(r/86400)})}function nf(i){if(!i)return"";const n=new Date(i);return Number.isNaN(n.getTime())?"":n.toLocaleString()}function y0(i=[]){const n=new Map;for(const a of i)a.deviceId&&n.set(a.deviceId,(n.get(a.deviceId)||0)+1);return n}const cA=({clients:i})=>{const{t:n}=Ee(),a=i.some(r=>r.hostId),s=[{key:"id",header:n("admin.colClientId"),render:r=>h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx(vn,{level:"ok"}),h.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},...a?[{key:"host",header:n("admin.colHost"),render:r=>h.jsx("span",{className:"text-tui-text",children:r.hostId||"—"})}]:[],{key:"role",header:n("admin.colRole"),width:10,render:r=>{const c=r.role==="controller";return h.jsx(_y,{tone:c?"ok":"warn",className:"text-tui-sm",children:n(c?"common.controller":"common.viewer")})}},{key:"device",header:n("admin.colDevice"),render:r=>{const c=ef(r.userAgent);return h.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[h.jsx("span",{className:c.label?"text-tui-text":"text-tui-faint",title:c.raw,children:c.label||n("admin.unknownDevice")}),r.deviceId?h.jsx("code",{className:"text-tui-sm text-tui-faint",children:r.deviceId}):null]})}},{key:"ip",header:n("admin.colIp"),render:r=>h.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:n("admin.colConnectedAt"),render:r=>h.jsx("span",{className:"whitespace-nowrap text-tui-muted",title:nf(r.connectedAt),children:r.connectedAt?tf(r.connectedAt,n):n("admin.startedRecently")})},{key:"traffic",header:n("admin.colTraffic"),align:"right",render:r=>h.jsxs("span",{className:"whitespace-nowrap",children:[h.jsxs("span",{className:"text-tui-accent",children:["↓",sa(r.bytesReceived||0)]}),h.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),h.jsxs("span",{className:"text-tui-ok",children:["↑",sa(r.bytesSent||0)]})]})}];return h.jsx(Et,{title:n("admin.connectedClientsTitle",{count:i.length}),bodyClassName:"-mx-1",children:h.jsx(Vd,{columns:s,items:i,rowKey:r=>r.id,empty:n("admin.noClients")})})},uA=({devices:i,clients:n,onRevoke:a})=>{const{t:s}=Ee(),[r,c]=T.useState(null),[d,m]=T.useState(null),p=y0(n),g=[...i].sort((S,x)=>{const w=+!!p.get(x.deviceId)-+!!p.get(S.deviceId);return w||(Date.parse(x.lastSeenAt)||0)-(Date.parse(S.lastSeenAt)||0)}),y=async S=>{if(r!==S){c(S);return}m(S);try{await a(S)}finally{m(null),c(null)}},v=[{key:"status",header:s("admin.colStatus"),width:12,render:S=>{const x=p.get(S.deviceId)||0;return h.jsxs("span",{className:ie("flex items-center gap-1.5 whitespace-nowrap",x?"text-tui-ok":"text-tui-faint"),children:[h.jsx(vn,{level:x?"ok":"idle"}),s(x?"admin.hostStatusOnline":"admin.hostStatusOffline")]})}},{key:"device",header:s("admin.colDevice"),render:S=>{const x=ef(S.userAgent);return h.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[h.jsx("span",{className:"text-tui-text",title:x.raw,children:x.label||s("admin.unknownDevice")}),h.jsx("code",{className:"text-tui-sm text-tui-faint",children:S.deviceId})]})}},{key:"host",header:s("admin.colHost"),render:S=>h.jsx("span",{className:"text-tui-text",children:S.hostId||"—"})},{key:"ip",header:s("admin.colIp"),render:S=>h.jsx("span",{className:"text-tui-muted",children:S.lastIp||"—"})},{key:"lastSeen",header:s("admin.colLastSeen"),render:S=>{const x=p.get(S.deviceId)||0;return h.jsx("span",{className:ie("whitespace-nowrap",x?"text-tui-ok":"text-tui-muted"),title:nf(S.lastSeenAt),children:x?s("admin.deviceWindows",{count:x}):tf(S.lastSeenAt,s)})}},{key:"actions",header:s("admin.colActions"),align:"right",render:S=>{const x=r===S.deviceId,w=d===S.deviceId;return h.jsx(Me,{variant:"danger",disabled:w,onClick:()=>void y(S.deviceId),onBlur:()=>c(C=>C===S.deviceId?null:C),"aria-label":s("admin.revokeDevice"),className:ie("h-6 py-0 text-tui-sm",x&&"bg-tui-bad text-tui-crust"),children:w?h.jsx(cl,{}):s(x?"admin.revokeConfirm":"admin.revokeDevice")})}}];return h.jsx(Et,{title:s("admin.pairedDevicesTitle",{count:i.length}),bodyClassName:"-mx-1",children:h.jsx(Vd,{columns:v,items:g,rowKey:S=>S.deviceId,empty:s("admin.noDevices")})})},wb={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function dA(i=[],n=[]){const a=new Map;for(const c of n){if(!(c!=null&&c.hostId))continue;const d=a.get(c.hostId);d?d.push(c):a.set(c.hostId,[c])}const s=i.map(c=>{const d=a.get(c.id)||[];return{id:c.id,hostname:c.hostname||c.id,status:c.status||"online",connectedDeviceCount:c.connectedDeviceCount??0,pairedDeviceCount:c.pairedDeviceCount??d.length,activePtyCount:c.activePtyCount??0,version:c.version,latestVersion:c.latestVersion,devices:d,fromRosterOnly:!1}}),r=new Set(s.map(c=>c.id));for(const[c,d]of a)r.has(c)||s.push({id:c,hostname:c,status:"offline",connectedDeviceCount:0,pairedDeviceCount:d.length,activePtyCount:0,devices:d,fromRosterOnly:!0});return s.sort((c,d)=>c.fromRosterOnly!==d.fromRosterOnly?c.fromRosterOnly?1:-1:c.hostname.localeCompare(d.hostname))}const fA=({hosts:i,devices:n,clients:a})=>{const{t:s}=Ee(),r=dA(i,n),c=y0(a),d={online:s("admin.hostStatusOnline"),busy:s("admin.hostStatusBusy"),reconnecting:s("admin.hostStatusReconnecting"),offline:s("admin.hostStatusOffline")};return h.jsx(Et,{title:s("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?h.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:s("admin.noHosts")}):r.map(m=>h.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[h.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:[h.jsxs("span",{className:"flex min-w-0 flex-auto items-center gap-1.5 text-tui",children:[h.jsx(vn,{level:wb[m.status]}),h.jsx("span",{className:"truncate font-bold text-tui-text",children:m.hostname}),m.hostname!==m.id?h.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:m.id}):null,h.jsx(_y,{tone:wb[m.status],className:"ml-1 text-tui-sm",children:d[m.status]})]}),h.jsx(Ad,{className:"shrink-0 text-tui-sm",items:[h.jsx("span",{className:m.connectedDeviceCount?"text-tui-ok":"text-tui-faint",children:s("admin.hostConnectedDevices",{count:m.connectedDeviceCount})},"connected"),h.jsx("span",{className:"text-tui-muted",children:s("admin.hostPairedDevices",{count:m.pairedDeviceCount})},"paired"),m.version===void 0?null:h.jsx("span",{className:m.version&&!m.latestVersion?"text-tui-muted":"text-tui-warn",children:m.version?m.latestVersion?s("admin.hostVersionBehind",{version:m.version,latest:m.latestVersion}):s("admin.hostVersion",{version:m.version}):s("admin.hostVersionUnknown")},"version"),m.fromRosterOnly?null:h.jsx("span",{className:m.activePtyCount?"text-tui-info":"text-tui-faint",children:s("admin.hostPtys",{count:m.activePtyCount})},"ptys")]})]}),m.devices.length>0?h.jsx("ul",{className:"divide-y divide-tui-border-dim",children:m.devices.map(p=>{const g=ef(p.userAgent),y=c.get(p.deviceId)||0;return h.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:[h.jsx(vn,{level:y?"ok":"idle"}),h.jsx("span",{className:"truncate text-tui-text",title:g.raw,children:g.label||s("admin.unknownDevice")}),h.jsx("code",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:p.deviceId}),h.jsx("span",{className:"hidden truncate text-tui-sm text-tui-muted sm:block",children:p.lastIp||"—"}),h.jsx("span",{className:ie("whitespace-nowrap text-right text-tui-sm",y?"text-tui-ok":"text-tui-faint"),title:nf(p.lastSeenAt),children:y?s("admin.deviceWindows",{count:y}):tf(p.lastSeenAt,s)})]},p.deviceId)})}):h.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:m.pairedDeviceCount>0?s("admin.hostRosterOperatorOnly"):s("admin.noDevices")})]},m.id))})},hA=({data:i})=>{var r,c,d,m,p,g,y,v,S,x;const{t:n}=Ee(),a=i.activeUserCount??((r=i.clients)==null?void 0:r.length)??0,s=new Set((i.devices||[]).map(w=>w.hostId).filter(w=>w&&!(i.hosts||[]).some(C=>C.id===w))).size;return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[h.jsx(Ql,{label:n("admin.connectedHosts"),value:((c=i.hosts)==null?void 0:c.length)||0,sub:s?n("admin.hostsOfflineSub",{count:s}):void 0,tone:(d=i.hosts)!=null&&d.length?"ok":"idle"}),h.jsx(Ql,{label:n("admin.activeUsers"),value:a,sub:n("admin.acrossWindows",{count:((m=i.clients)==null?void 0:m.length)||0}),tone:a?"accent":"idle"}),h.jsx(Ql,{label:n("admin.activePtys"),value:((p=i.ptys)==null?void 0:p.length)||0,sub:n("admin.terminalShells"),tone:(g=i.ptys)!=null&&g.length?"info":"idle"}),h.jsx(Ql,{label:n("admin.statInbound"),value:n("admin.perSecond",{value:sa(((y=i.throughput)==null?void 0:y.bytesInPerSec)||0)}),sub:n("admin.statTotal",{value:sa(((v=i.throughput)==null?void 0:v.bytesIn)||0)}),tone:"accent"}),h.jsx(Ql,{label:n("admin.statOutbound"),value:n("admin.perSecond",{value:sa(((S=i.throughput)==null?void 0:S.bytesOutPerSec)||0)}),sub:n("admin.statTotal",{value:sa(((x=i.throughput)==null?void 0:x.bytesOut)||0)}),tone:"ok"}),h.jsx(Ql,{label:n("admin.uptime"),value:xb(i.uptimeSeconds||0,n,!0),title:xb(i.uptimeSeconds||0,n),sub:i.startTime?n("admin.startedAt",{time:new Date(i.startTime).toLocaleTimeString()}):n("admin.startedRecently")})]}),h.jsx(fA,{hosts:i.hosts||[],devices:i.devices,clients:i.clients||[]})]})},mA=({ptys:i})=>{const{t:n}=Ee(),a=i.some(r=>r.hostId),s=[{key:"id",header:n("admin.colPtyId"),render:r=>h.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},...a?[{key:"host",header:n("admin.colHost"),render:r=>h.jsx("span",{className:"text-tui-text",children:r.hostId})}]:[],{key:"pid",header:n("admin.colPid"),width:9,render:r=>h.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:n("admin.colCommand"),render:r=>h.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:n("admin.colGrid"),width:11,render:r=>h.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,h.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:n("admin.colCwd"),className:"max-w-xs truncate",render:r=>h.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:n("admin.colViewers"),align:"right",width:9,render:r=>h.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return h.jsx(Et,{title:n("admin.activePtysTitle",{count:i.length}),bodyClassName:"-mx-1",children:h.jsx(Vd,{columns:s,items:i,rowKey:r=>r.id,empty:n("admin.noPtys")})})};function Od(i){if(typeof window>"u"||!i||i.startsWith("/"))return"";try{const n=new URL(i.replace(/^ws/,"http")),a=n.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return n.origin===window.location.origin&&!a?"":`${n.origin}${a}`}catch{return""}}function ks(i,n){const a=Od(i);return a?`${a}${n.startsWith("/")?n:`/${n}`}`:n}async function pA(i){try{const a=await fetch(ks(i,"/api/info"),{headers:{Accept:"application/json"}});if(a.ok)return await a.json()}catch{}return{ok:!0,version:"0.1.0",protocol:1,relayMode:!!(i&&!i.startsWith("/")&&!i.includes("localhost")&&!i.includes("127.0.0.1")&&typeof window<"u"&&!i.startsWith(window.location.origin.replace("http","ws")))?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}}async function Sb(i,n){const a=await fetch(i,{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 gA(i,n,a){return(await fetch(ks(i,`/api/admin/devices/${encodeURIComponent(a)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":n}})).ok}function bA(i,n,a){return i!=null&&i.adminPath?i.publicUrl?`${i.publicUrl.replace(/\/$/,"")}${i.adminPath}`:ks(a,i.adminPath):n!=null&&n.remoteAdminUrl?n.remoteAdminUrl:a?ks(a,"/admin"):"/admin"}function yA({wsUrl:i,deviceToken:n,adminToken:a,relayOrigin:s,refreshInterval:r,t:c}){const[d,m]=T.useState(null),[p,g]=T.useState(null),[y,v]=T.useState(!1),[S,x]=T.useState(!0),[w,C]=T.useState(null),[A,N]=T.useState(!1),[E,_]=T.useState(null);T.useEffect(()=>{m(null),g(null),v(!1)},[s]),T.useEffect(()=>{let R=!0;return x(!0),pA(i).then(I=>{R&&(g(I),v(!0))}),()=>{R=!1}},[i,s]);const D=(p==null?void 0:p.relayMode)==="remote",P=T.useCallback((R,I)=>{if(R.kind==="denied"){N(!0),C(I),m(null);return}m(R.data),C(null),N(!1),_(new Date)},[]),B=T.useCallback((R,I)=>{N(!1),C(R instanceof Error?R.message:I),m(null)},[]),O=T.useCallback(async()=>{if(y){if(D){if(!a){m(null),x(!1),C(null),N(!1);return}try{x(!0);const R=await Sb(ks(i,(p==null?void 0:p.adminStatusPath)||"/api/admin/status"),{"X-Relay-Admin-Token":a});P(R,c("admin.relayAdminAuthError"))}catch(R){console.warn("GET /api/admin/status request failed:",R),B(R,"Failed to fetch remote admin status")}finally{x(!1)}return}try{x(!0);const R=await Sb("/api/status",n?{Authorization:`Bearer ${n}`}:{});P(R,R.kind==="denied"?`Authentication failed (HTTP ${R.status}): Access denied. Please configure an authorized token or pair with the host.`:"")}catch(R){console.warn("GET /api/status request failed:",R),B(R,"Failed to fetch status")}finally{x(!1)}}},[y,D,a,p,n,i,s,c]),k=T.useCallback(async R=>{try{if(!await gA(i,a,R)){C(c("admin.revokeFailed"));return}await O()}catch{C(c("admin.revokeFailed"))}},[a,O,i,c]);return T.useEffect(()=>{if(!y)return;O();let R=null;const I=()=>{r>0&&!R&&(R=setInterval(()=>{document.visibilityState==="visible"&&O()},r))},Q=()=>{R&&(clearInterval(R),R=null)},X=()=>{document.visibilityState==="visible"?(O(),I()):Q()};return I(),document.addEventListener("visibilitychange",X),()=>{Q(),document.removeEventListener("visibilitychange",X)}},[y,O,r]),{data:d,relayInfo:p,infoLoaded:y,isRemoteRelay:D,loading:S,error:w,isAuthError:A,lastUpdated:E,fetchStatus:O,revokeDevice:k}}const fd="h-7 py-0",vA=({onBackToTerminal:i,onOpenPairing:n,showBack:a=!1})=>{var xe,fe,te;const{settings:s,updateSettings:r,t:c}=Ee(),d=Od(s.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((xe=s.adminTokens)==null?void 0:xe[d])||(d===(typeof window<"u"?window.location.origin:"local")?s.adminToken:"")||"",[p,g]=T.useState(3e3),[y,v]=T.useState("overview"),[S,x]=T.useState(m),[w,C]=T.useState(m),[A,N]=T.useState(!!m),E=!Od(s.wsUrl);T.useEffect(()=>{x(m),C(m),N(!!m)},[d]);const{data:_,relayInfo:D,infoLoaded:P,isRemoteRelay:B,loading:O,error:k,isAuthError:R,lastUpdated:I,fetchStatus:Q,revokeDevice:X}=yA({wsUrl:s.wsUrl,deviceToken:s.token,adminToken:w,relayOrigin:d,refreshInterval:p,t:c}),ne=le=>{le.preventDefault();const he=S.trim();r({adminToken:he,adminTokens:{...s.adminTokens||{},[d]:he}}),C(he),N(!!he)},oe=bA(D,_,s.wsUrl),ce=_?[{id:"overview",label:c("admin.tabOverview"),index:1},{id:"clients",label:c("admin.tabClients",{count:((fe=_.clients)==null?void 0:fe.length)||0}),index:2},{id:"ptys",label:c("admin.tabPtys",{count:((te=_.ptys)==null?void 0:te.length)||0}),index:3},..._.devices?[{id:"devices",label:c("admin.tabDevices",{count:_.devices.length}),index:4}]:[]]:[],z=ce.map(le=>le.id).join("|");T.useEffect(()=>{const le=z?z.split("|"):[],he=re=>{if(re.ctrlKey||re.altKey||re.metaKey)return;const pe=re.target;if(pe instanceof HTMLInputElement||pe instanceof HTMLTextAreaElement||pe instanceof HTMLSelectElement||pe!=null&&pe.isContentEditable||document.querySelector('[role="dialog"]'))return;if(re.key==="Escape"&&i){re.preventDefault(),i();return}if(re.key.toLowerCase()==="r"){re.preventDefault(),Q();return}const se=Number.parseInt(re.key,10)-1;Number.isInteger(se)&&se>=0&&se<le.length&&(re.preventDefault(),v(le[se]))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[Q,i,z]);const J=(D==null?void 0:D.version)||(_==null?void 0:_.version)||"0.1.0",K=a&&i?h.jsx(Me,{variant:"ghost",onClick:i,title:c("admin.returnToTerminal"),"aria-label":c("admin.returnToTerminal"),glyph:Ne.arrowLeft,brackets:!1,className:fd,children:h.jsx("span",{className:"sr-only",children:c("admin.returnToTerminal")})}):null,ae=h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"hidden items-center gap-1.5 whitespace-nowrap text-tui-sm sm:flex",children:[h.jsxs("span",{className:"text-tui-faint",children:["v",J]}),h.jsx(Pd,{}),h.jsx("span",{className:B?"text-tui-alt":"text-tui-ok",children:c(B?"admin.modeRemote":"admin.localWorkstationBadge")})]}),_?h.jsxs(h.Fragment,{children:[h.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[h.jsx("span",{children:c("admin.autoRefresh")}),h.jsxs(Ar,{value:p,onChange:le=>g(Number(le.target.value)),"aria-label":c("admin.autoRefresh"),className:ie("w-auto",fd),children:[h.jsx("option",{value:0,children:c("admin.paused")}),h.jsx("option",{value:1e3,children:"1s"}),h.jsx("option",{value:3e3,children:"3s"}),h.jsx("option",{value:5e3,children:"5s"}),h.jsx("option",{value:1e4,children:"10s"})]})]}),h.jsx(Me,{variant:"primary",onClick:Q,disabled:O,title:c("admin.refreshNow"),className:fd,children:O?h.jsx(cl,{}):c("admin.refreshNow")})]}):null]}),$=P&&B&&!A&&!E,ue=P&&B&&(A||E)&&!_;return h.jsxs(oC,{tabs:ce,activeTabId:y,onSelectTab:le=>v(le),tabsAriaLabel:c("header.mainNavigationAria"),toolbarStart:K,toolbarAside:ae,hints:[..._?[{keys:"1–4",action:c("admin.hintTabs")},{keys:"r",action:c("admin.hintRefresh")}]:[],...i?[{keys:"esc",action:c("admin.hintBack")}]:[]],footerAside:I?h.jsx("span",{className:"text-tui-faint",children:c("admin.updatedAt",{time:I.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!P&&h.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:h.jsx(cl,{label:c("admin.loadingStatus")})}),$&&h.jsx(lA,{wsUrl:s.wsUrl,adminUrl:oe,onOpenRemoteAdmin:()=>window.open(oe,"_blank","noopener,noreferrer"),onSignIn:()=>N(!0)}),ue&&h.jsx(aA,{adminConfigured:D==null?void 0:D.adminConfigured,isAuthError:R,tokenInput:S,onTokenInput:x,onSubmit:ne,isSameOriginRelay:E,onBackToTerminal:i,showBack:a,onCancel:()=>N(!1)}),P&&!B&&R&&h.jsx(sA,{onOpenPairing:n,onRetry:Q}),P&&k&&!R&&h.jsx(ji,{tone:"warn",action:h.jsx(Me,{variant:"warn",onClick:Q,children:c("common.retry")}),children:c("admin.errorConnecting",{error:k})}),_&&h.jsxs(h.Fragment,{children:[y==="overview"&&h.jsx(hA,{data:_}),y==="clients"&&h.jsx(cA,{clients:_.clients||[]}),y==="ptys"&&h.jsx(mA,{ptys:_.ptys||[]}),y==="devices"&&h.jsx(uA,{devices:_.devices||[],clients:_.clients||[],onRevoke:X})]})]})},hd="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",md="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",xA="border-tui-accent bg-tui-selection text-tui-accent",pd=({active:i=!1})=>h.jsx("span",{"aria-hidden":"true",className:ie("shrink-0",i?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ne.cursor}),wA=({onClose:i,onOpenSettings:n,onAddProfile:a=()=>{}})=>{const{settings:s,updateSettings:r,language:c,setLanguage:d,t:m}=Ee(),{connectionState:p,stateDetail:g,rttMs:y,hostId:v,connect:S}=nt(),{addToast:x}=fn(),{copied:w,copy:C}=Zd(),A=w!==null,N=Qd(p,m),E=P=>()=>{var O;const B=document.activeElement;(O=B==null?void 0:B.blur)==null||O.call(B),P()},_=()=>C(s.clientId,m("toasts.clientIdCopied",{id:s.clientId}),"info"),D=()=>{const P=c==="zh"?"en":"zh";d(P),x("info",Dd(P,"toasts.switchedLanguage",{lang:P==="zh"?"简体中文":"English"}))};return h.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[h.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:m("mobile.sessionControls")}),h.jsx(Me,{variant:"ghost",onClick:i,"aria-label":m("mobile.closeSessionControls"),children:"esc"})]}),h.jsx(Et,{title:m("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:h.jsx(Jd,{mobile:!0,onAddProfile:a})}),h.jsxs(Et,{title:m("common.status"),tone:N.level==="ok"?"ok":N.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[h.jsx(vn,{level:N.level}),h.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:N.label}),p==="connected"&&y!==null&&h.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[y,"ms"]})]}),N.actionLabel&&h.jsx(Me,{variant:"primary",onClick:()=>S(),className:"shrink-0",children:N.actionLabel})]}),N.needsAttention&&g&&h.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:g}),v&&h.jsx(An,{label:m("common.host"),labelWidth:9,children:v}),h.jsxs("button",{type:"button",onClick:_,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:m("header.copyClientIdTitle"),children:[h.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:m("header.clientIdLabel")}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:s.clientId}),h.jsx("span",{"aria-hidden":"true",className:ie("shrink-0",A?"text-tui-ok":"text-tui-faint"),children:A?Ne.check:"⧉"})]})]}),h.jsx(Et,{title:m("mobile.inputControl"),tone:"accent","aria-label":m("mobile.terminalControlAria"),children:h.jsx(m0,{className:"h-11"})}),h.jsxs(Et,{title:m("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[h.jsxs("button",{type:"button",onClick:D,className:ie(hd,md),"aria-label":m("header.languageToggleTitle"),children:[h.jsx(pd,{}),h.jsx("span",{className:"truncate",children:c==="zh"?"English":"中文"})]}),h.jsxs("button",{type:"button",onClick:E(n),className:ie(hd,md),"aria-label":m("mobile.settingsAria"),children:[h.jsx(pd,{}),h.jsx("span",{className:"truncate",children:m("common.settings")})]}),h.jsxs("button",{type:"button",onClick:()=>r({toolbarVisible:!s.toolbarVisible}),className:ie(hd,s.toolbarVisible?xA:md),"aria-label":m("mobile.keybarAria"),"aria-pressed":s.toolbarVisible,children:[h.jsx(pd,{active:s.toolbarVisible}),h.jsx("span",{className:"truncate",children:m("common.keyBar")}),h.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:s.toolbarVisible?"[x]":"[ ]"})]})]})]})},SA=({onAddProfile:i})=>{const{t:n}=Ee(),{rttMs:a}=nt();return h.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:[h.jsx(Jd,{statusBar:!0,onAddProfile:i}),h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),h.jsx(h0,{compact:!0}),h.jsx(b0,{compact:!0}),h.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:n("header.latencyTitle"),children:[h.jsx("span",{className:"text-tui-faint",children:"RTT"}),h.jsx("span",{className:ie(a===null?"text-tui-faint":"text-tui-text"),children:a===null?"—":`${a}ms`})]})]})},CA=({onOpenSettings:i,onAddProfile:n=()=>{}})=>{const{t:a}=Ee(),{connectionState:s,isController:r}=nt(),[c,d]=T.useState(!1),m=T.useRef(null),p=T.useCallback(()=>d(!1),[]);T.useEffect(()=>{if(!c)return;const y=v=>{if(!(v.ctrlKey||v.altKey||v.metaKey)&&v.key==="Escape"){const S=v.target;S&&typeof S.closest=="function"&&!!S.closest("#terminal-container")||(v.stopPropagation(),v.preventDefault(),p())}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[c,p]),T.useEffect(()=>{var y;c&&((y=m.current)==null||y.focus({preventScroll:!0}))},[c]);const g=Qd(s,a);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":a("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:[h.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[h.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),h.jsx(Pd,{className:"shrink-0"}),h.jsx(vn,{level:g.level}),h.jsx("span",{className:"truncate uppercase",children:g.label})]}),h.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>d(!0),"aria-label":a("mobile.sessionControls"),"aria-expanded":c,"aria-haspopup":"dialog",className:ie("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",g.needsAttention?"border-tui-warn text-tui-warn":r?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!r&&!g.needsAttention&&h.jsx("span",{className:"max-w-[8rem] truncate",children:a("common.viewer")}),h.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Ne.chevronDown}),h.jsx("span",{"aria-hidden":"true",children:a("mobile.menu")})]})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:p,"aria-hidden":"true"}),h.jsx("div",{ref:m,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":a("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:h.jsx(wA,{onClose:p,onOpenSettings:()=>{p(),i()},onAddProfile:()=>{p(),n()}})})]}),h.jsx(SA,{onAddProfile:n})]})},TA=()=>{const{activeProfile:i,t:n}=Ee(),{herdrLaunch:a,startHerdr:s,hostname:r}=nt();if(!a)return null;const c=r||(i==null?void 0:i.displayName)||n("herdrLaunch.thisHost"),d=a.phase==="failed";return h.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:h.jsx(Et,{title:n(d?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:d?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":n("herdrLaunch.title"),children:a.phase==="starting"?h.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[h.jsx(cl,{}),h.jsx("span",{children:n("herdrLaunch.starting",{host:c})})]}):h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"leading-snug text-tui-text",children:n("herdrLaunch.body",{host:c})}),d&&a.message?h.jsx(ji,{tone:"bad",children:h.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,h.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:n("herdrLaunch.scope")}),h.jsx("div",{className:"flex justify-end",children:h.jsx(Me,{variant:"primary",onClick:s,autoFocus:!0,children:n(d?"common.retry":"herdrLaunch.start")})})]})})})},v0="--app-height",x0="--keyboard-inset",MA=80;function AA(){if(typeof window>"u")return{height:768,keyboardInset:0};const i=window.innerHeight||768,n=window.visualViewport;if(n&&typeof n.height=="number"&&n.height>0){const a=i-n.height-(n.offsetTop||0),s=a>=MA?Math.round(a):0;return{height:Math.round(n.height),keyboardInset:s}}return{height:i,keyboardInset:0}}function Cb(i,n=AA()){return i.style.setProperty(v0,`${n.height}px`),i.style.setProperty(x0,`${n.keyboardInset}px`),n}function EA(i=typeof document<"u"?document.documentElement:null){if(!i||typeof window>"u")return()=>{};let n=null;const a=()=>{n=null,Cb(i)},s=()=>{if(n===null){if(typeof requestAnimationFrame!="function"){a();return}n=requestAnimationFrame(a)}};Cb(i);const r=window.visualViewport;return r==null||r.addEventListener("resize",s),r==null||r.addEventListener("scroll",s),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),()=>{n!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(n),n=null),r==null||r.removeEventListener("resize",s),r==null||r.removeEventListener("scroll",s),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),i.style.removeProperty(v0),i.style.removeProperty(x0)}}const kA=900;function Tb(){if(typeof window>"u")return!1;const i=ca();return i<Bd?!0:i<=kA}function NA(){const[i,n]=T.useState(Tb);return T.useEffect(()=>{var r,c;const a=()=>{const d=Tb();n(m=>m===d?m:d)};a();let s=null;try{s=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{s=null}return(r=s==null?void 0:s.addEventListener)==null||r.call(s,"change",a),window.addEventListener("resize",a),window.addEventListener("orientationchange",a),(c=window.visualViewport)==null||c.addEventListener("resize",a),()=>{var d,m;(d=s==null?void 0:s.removeEventListener)==null||d.call(s,"change",a),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),(m=window.visualViewport)==null||m.removeEventListener("resize",a)}},[]),i}function _A(i){const n=i.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 LA(i,n={}){if(typeof window>"u")return()=>{};const a=s=>{var r;s.ctrlKey||s.altKey||s.metaKey||s.key==="Escape"&&(n.isModalOpen||n.isSheetOpen)&&(_A(s)||(s.preventDefault(),s.stopPropagation(),(r=i.onCloseModals)==null||r.call(i)))};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}}function RA(){const[i,n]=T.useState("terminal"),[a,s]=T.useState(!1),[r,c]=T.useState(!1),[d,m]=T.useState(void 0),p=I=>{m(I),c(!0)},{updateSettings:g,addProfileAndConnect:y,settings:v}=Ee(),{connectionState:S,stateDetail:x,stateCode:w,lastPairedAt:C}=nt();cS();const A=NA();T.useEffect(()=>EA(),[]),T.useEffect(()=>{Ub()},[]),T.useEffect(()=>{const I=a||r;if(I)return LA({onCloseModals:()=>{s(!1),c(!1)}},{isModalOpen:I})},[a,r]),T.useEffect(()=>{var Q;const I=()=>{const X=window.location.pathname,ne=window.location.hash;n(X==="/admin"||ne==="#admin"?"admin":"terminal")};I(),window.addEventListener("popstate",I),window.addEventListener("hashchange",I);try{const X=new URL(window.location.href),ne=(Q=X.searchParams.get("pairCode"))==null?void 0:Q.toUpperCase();ne&&gr().token?y({wsUrl:Kt,pairCode:ne}):ne&&g({pairCode:ne});let oe=!1;if(X.searchParams.has("token")&&(X.searchParams.delete("token"),oe=!0),X.searchParams.has("pairCode")&&(X.searchParams.delete("pairCode"),oe=!0),oe){const ce=X.searchParams.toString(),z=X.pathname+(ce?`?${ce}`:"")+X.hash;window.history.replaceState({},"",z)}}catch(X){console.warn("Failed to parse URL query params:",X)}return()=>{window.removeEventListener("popstate",I),window.removeEventListener("hashchange",I)}},[g,y]);const N=()=>s(!0),E=I=>{n(I),I==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},_=!v.token&&!v.pairCode&&S!=="connected",D=S==="error"&&(["auth_required","unauthorized","device_revoked"].includes(w||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(x||"")),P=_||D,[B,O]=T.useState(!P);T.useEffect(()=>{P||O(!0)},[P]),T.useEffect(()=>{C&&(s(!1),O(!0),n("terminal"))},[C]);const k=i==="terminal"&&!P,R=I=>({visibility:I?"visible":"hidden",opacity:I?1:0,pointerEvents:I?"auto":"none",zIndex:I?1:0});return h.jsxs("div",{"data-testid":"app-shell",style:A?{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:[!A&&h.jsx(uC,{currentView:i,onNavigate:E,onOpenSettings:()=>p()}),!A&&!P&&h.jsx(dC,{}),h.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[B&&h.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${A?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:R(k),"aria-hidden":!k,children:[h.jsx(r5,{isActive:k}),h.jsx(L5,{compact:A,onCustomize:()=>p("agentKeymaps")}),h.jsx(TA,{}),h.jsx(G5,{})]}),i==="terminal"&&P&&h.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:h.jsx(u5,{onPairedSuccess:()=>{}})}),i==="admin"&&h.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:h.jsx(vA,{onBackToTerminal:()=>E("terminal"),onOpenPairing:N,showBack:A})}),A&&k&&h.jsx(CA,{onOpenSettings:()=>p(),onAddProfile:N})]}),!A&&i!=="admin"&&h.jsx(iA,{onAddProfile:N}),h.jsx(j5,{isOpen:a,onClose:()=>s(!1)}),h.jsx($5,{isOpen:r,initialTab:d,onClose:()=>c(!1),onOpenAdmin:()=>{c(!1),E("admin")}}),h.jsx(X5,{})]})}function jA(){return h.jsx(Z1,{children:h.jsx(RA,{})})}const w0=document.getElementById("root");if(!w0)throw new Error("Root element not found");Px.createRoot(w0).render(h.jsx(ei.StrictMode,{children:h.jsx(jA,{})}));
|