herdr-remote-relay 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var D0=Object.defineProperty;var z0=(a,i,s)=>i in a?D0(a,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[i]=s;var X=(a,i,s)=>z0(a,typeof i!="symbol"?i+"":i,s);import{r as mg,g as pg,a as gg}from"./vendor-react-CYSfZuHu.js";import{r as O0,a as B0}from"./vendor-xterm-Bbu8R_5E.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))r(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&r(m)}).observe(document,{childList:!0,subtree:!0});function s(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(u){if(u.ep)return;u.ep=!0;const d=s(u);fetch(u.href,d)}})();var Ou={exports:{}},Bs={};/**
|
|
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 sp;function U0(){if(sp)return Bs;sp=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,u,d){var m=null;if(d!==void 0&&(m=""+d),u.key!==void 0&&(m=""+u.key),"key"in u){d={};for(var h in u)h!=="key"&&(d[h]=u[h])}else d=u;return u=d.ref,{$$typeof:a,type:r,key:m,ref:u!==void 0?u:null,props:d}}return Bs.Fragment=i,Bs.jsx=s,Bs.jsxs=s,Bs}var rp;function H0(){return rp||(rp=1,Ou.exports=U0()),Ou.exports}var f=H0(),w=mg();const Si=pg(w);var Bu={exports:{}},Us={},Uu={exports:{}},Hu={};/**
|
|
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 op;function K0(){return op||(op=1,(function(a){function i(L,$){var le=L.length;L.push($);e:for(;0<le;){var Re=le-1>>>1,W=L[Re];if(0<u(W,$))L[Re]=$,L[le]=W,le=Re;else break e}}function s(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var $=L[0],le=L.pop();if(le!==$){L[0]=le;e:for(var Re=0,W=L.length,et=W>>>1;Re<et;){var je=2*(Re+1)-1,_e=L[je],$e=je+1,Be=L[$e];if(0>u(_e,le))$e<W&&0>u(Be,_e)?(L[Re]=Be,L[$e]=le,Re=$e):(L[Re]=_e,L[je]=le,Re=je);else if($e<W&&0>u(Be,le))L[Re]=Be,L[$e]=le,Re=$e;else break e}}return $}function u(L,$){var le=L.sortIndex-$.sortIndex;return le!==0?le:L.id-$.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var m=Date,h=m.now();a.unstable_now=function(){return m.now()-h}}var p=[],y=[],b=1,v=null,S=3,T=!1,E=!1,Y=!1,A=!1,O=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function ee(L){for(var $=s(y);$!==null;){if($.callback===null)r(y);else if($.startTime<=L)r(y),$.sortIndex=$.expirationTime,i(p,$);else break;$=s(y)}}function re(L){if(Y=!1,ee(L),!E)if(s(p)!==null)E=!0,J||(J=!0,Ee());else{var $=s(y);$!==null&&Ie(re,$.startTime-L)}}var J=!1,G=-1,U=5,ae=-1;function ne(){return A?!0:!(a.unstable_now()-ae<U)}function Se(){if(A=!1,J){var L=a.unstable_now();ae=L;var $=!0;try{e:{E=!1,Y&&(Y=!1,B(G),G=-1),T=!0;var le=S;try{t:{for(ee(L),v=s(p);v!==null&&!(v.expirationTime>L&&ne());){var Re=v.callback;if(typeof Re=="function"){v.callback=null,S=v.priorityLevel;var W=Re(v.expirationTime<=L);if(L=a.unstable_now(),typeof W=="function"){v.callback=W,ee(L),$=!0;break t}v===s(p)&&r(p),ee(L)}else r(p);v=s(p)}if(v!==null)$=!0;else{var et=s(y);et!==null&&Ie(re,et.startTime-L),$=!1}}break e}finally{v=null,S=le,T=!1}$=void 0}}finally{$?Ee():J=!1}}}var Ee;if(typeof H=="function")Ee=function(){H(Se)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,st=Ge.port2;Ge.port1.onmessage=Se,Ee=function(){st.postMessage(null)}}else Ee=function(){O(Se,0)};function Ie(L,$){G=O(function(){L(a.unstable_now())},$)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(L){L.callback=null},a.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<L?Math.floor(1e3/L):5},a.unstable_getCurrentPriorityLevel=function(){return S},a.unstable_next=function(L){switch(S){case 1:case 2:case 3:var $=3;break;default:$=S}var le=S;S=$;try{return L()}finally{S=le}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(L,$){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var le=S;S=L;try{return $()}finally{S=le}},a.unstable_scheduleCallback=function(L,$,le){var Re=a.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?Re+le:Re):le=Re,L){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=le+W,L={id:b++,callback:$,priorityLevel:L,startTime:le,expirationTime:W,sortIndex:-1},le>Re?(L.sortIndex=le,i(y,L),s(p)===null&&L===s(y)&&(Y?(B(G),G=-1):Y=!0,Ie(re,le-Re))):(L.sortIndex=W,i(p,L),E||T||(E=!0,J||(J=!0,Ee()))),L},a.unstable_shouldYield=ne,a.unstable_wrapCallback=function(L){var $=S;return function(){var le=S;S=$;try{return L.apply(this,arguments)}finally{S=le}}}})(Hu)),Hu}var cp;function Y0(){return cp||(cp=1,Uu.exports=K0()),Uu.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 up;function G0(){if(up)return Us;up=1;var a=Y0(),i=mg(),s=gg();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}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 u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function m(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 h(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(d(e)!==e)throw Error(r(188))}function y(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(r(188));return t!==e?null:e}for(var n=e,l=t;;){var o=n.return;if(o===null)break;var c=o.alternate;if(c===null){if(l=o.return,l!==null){n=l;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===n)return p(o),e;if(c===l)return p(o),t;c=c.sibling}throw Error(r(188))}if(n.return!==l.return)n=o,l=c;else{for(var g=!1,x=o.child;x;){if(x===n){g=!0,n=o,l=c;break}if(x===l){g=!0,l=o,n=c;break}x=x.sibling}if(!g){for(x=c.child;x;){if(x===n){g=!0,n=c,l=o;break}if(x===l){g=!0,l=c,n=o;break}x=x.sibling}if(!g)throw Error(r(189))}}if(n.alternate!==l)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,S=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),Y=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),H=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),Se=Symbol.iterator;function Ee(e){return e===null||typeof e!="object"?null:(e=Se&&e[Se]||e["@@iterator"],typeof e=="function"?e:null)}var Ge=Symbol.for("react.client.reference");function st(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Y:return"Fragment";case O:return"Profiler";case A:return"StrictMode";case re:return"Suspense";case J:return"SuspenseList";case ae:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case H:return e.displayName||"Context";case B:return(e._context.displayName||"Context")+".Consumer";case ee:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:st(e.type)||"Memo";case U:t=e._payload,e=e._init;try{return st(e(t))}catch{}}return null}var Ie=Array.isArray,L=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},Re=[],W=-1;function et(e){return{current:e}}function je(e){0>W||(e.current=Re[W],Re[W]=null,W--)}function _e(e,t){W++,Re[W]=e.current,e.current=t}var $e=et(null),Be=et(null),Ze=et(null),ft=et(null);function De(e,t){switch(_e(Ze,t),_e(Be,e),_e($e,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Lm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Lm(t),e=km(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je($e),_e($e,e)}function qe(){je($e),je(Be),je(Ze)}function Gt(e){e.memoizedState!==null&&_e(ft,e);var t=$e.current,n=km(t,e.type);t!==n&&(_e(Be,e),_e($e,n))}function gt(e){Be.current===e&&(je($e),je(Be)),ft.current===e&&(je(ft),js._currentValue=le)}var ut,F;function ve(e){if(ut===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ut=t&&t[1]||"",F=-1<n.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+ut+e+F}var Ce=!1;function At(e,t){if(!e||Ce)return"";Ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(K){var z=K}Reflect.construct(e,[],P)}else{try{P.call()}catch(K){z=K}e.call(P.prototype)}}else{try{throw Error()}catch(K){z=K}(P=e())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(K){if(K&&z&&typeof K.stack=="string")return[K.stack,z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=l.DetermineComponentFrameRoot(),g=c[0],x=c[1];if(g&&x){var C=g.split(`
|
|
28
|
+
`),j=x.split(`
|
|
29
|
+
`);for(o=l=0;l<C.length&&!C[l].includes("DetermineComponentFrameRoot");)l++;for(;o<j.length&&!j[o].includes("DetermineComponentFrameRoot");)o++;if(l===C.length||o===j.length)for(l=C.length-1,o=j.length-1;1<=l&&0<=o&&C[l]!==j[o];)o--;for(;1<=l&&0<=o;l--,o--)if(C[l]!==j[o]){if(l!==1||o!==1)do if(l--,o--,0>o||C[l]!==j[o]){var q=`
|
|
30
|
+
`+C[l].replace(" at new "," at ");return e.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",e.displayName)),q}while(1<=l&&0<=o);break}}}finally{Ce=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ve(n):""}function N(e,t){switch(e.tag){case 26:case 27:case 5:return ve(e.type);case 16:return ve("Lazy");case 13:return e.child!==t&&t!==null?ve("Suspense Fallback"):ve("Suspense");case 19:return ve("SuspenseList");case 0:case 15:return At(e.type,!1);case 11:return At(e.type.render,!1);case 1:return At(e.type,!0);case 31:return ve("Activity");default:return""}}function ue(e){try{var t="",n=null;do t+=N(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
|
|
31
|
+
Error generating stack: `+l.message+`
|
|
32
|
+
`+l.stack}}var ce=Object.prototype.hasOwnProperty,Ve=a.unstable_scheduleCallback,lt=a.unstable_cancelCallback,at=a.unstable_shouldYield,Et=a.unstable_requestPaint,he=a.unstable_now,Le=a.unstable_getCurrentPriorityLevel,Fe=a.unstable_ImmediatePriority,dt=a.unstable_UserBlockingPriority,Dt=a.unstable_NormalPriority,Cn=a.unstable_LowPriority,Bt=a.unstable_IdlePriority,mn=a.log,pn=a.unstable_setDisableYieldValue,Zt=null,wt=null;function Qe(e){if(typeof mn=="function"&&pn(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(Zt,e)}catch{}}var zt=Math.clz32?Math.clz32:jn,Zi=Math.log,Qt=Math.LN2;function jn(e){return e>>>=0,e===0?32:31-(Zi(e)/Qt|0)|0}var Ci=256,bt=262144,Ti=4194304;function Tn(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 Mi(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var o=0,c=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var x=l&134217727;return x!==0?(l=x&~c,l!==0?o=Tn(l):(g&=x,g!==0?o=Tn(g):n||(n=x&~e,n!==0&&(o=Tn(n))))):(x=l&~c,x!==0?o=Tn(x):g!==0?o=Tn(g):n||(n=l&~e,n!==0&&(o=Tn(n)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,n=t&-t,c>=n||c===32&&(n&4194048)!==0)?t:o}function fi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function _l(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 Dn(){var e=Ti;return Ti<<=1,(Ti&62914560)===0&&(Ti=4194304),e}function Mn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function An(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ai(e,t,n,l,o,c){var g=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var x=e.entanglements,C=e.expirationTimes,j=e.hiddenUpdates;for(n=g&~n;0<n;){var q=31-zt(n),P=1<<q;x[q]=0,C[q]=-1;var z=j[q];if(z!==null)for(j[q]=null,q=0;q<z.length;q++){var K=z[q];K!==null&&(K.lane&=-536870913)}n&=~P}l!==0&&ra(e,l,0),c!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=c&~(g&~t))}function ra(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-zt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function jl(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-zt(n),o=1<<l;o&t|e[l]&t&&(e[l]|=t),n&=~o}}function Dl(e,t){var n=t&-t;return n=(n&42)!==0?1:Qi(n),(n&(e.suspendedLanes|t))!==0?0:n}function Qi(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 Wi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ei(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:Jm(e.type))}function Ni(e,t){var n=$.p;try{return $.p=e,t()}finally{$.p=n}}var zn=Math.random().toString(36).slice(2),Lt="__reactFiber$"+zn,tn="__reactProps$"+zn,hi="__reactContainer$"+zn,zl="__reactEvents$"+zn,Za="__reactListeners$"+zn,Ji="__reactHandles$"+zn,Ol="__reactResources$"+zn,$n="__reactMarker$"+zn;function Li(e){delete e[Lt],delete e[tn],delete e[zl],delete e[Za],delete e[Ji]}function D(e){var t=e[Lt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[hi]||n[Lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Bm(e);e!==null;){if(n=e[Lt])return n;e=Bm(e)}return t}e=n,n=e.parentNode}return null}function I(e){if(e=e[Lt]||e[hi]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function de(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Te(e){var t=e[Ol];return t||(t=e[Ol]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function pe(e){e[$n]=!0}var ze=new Set,Xe={};function It(e,t){St(e,t),St(e+"Capture",t)}function St(e,t){for(Xe[e]=t,e=0;e<t.length;e++)ze.add(t[e])}var ki=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]*$"),Q={},te={};function xe(e){return ce.call(te,e)?!0:ce.call(Q,e)?!1:ki.test(e)?te[e]=!0:(Q[e]=!0,!1)}function me(e,t,n){if(xe(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function He(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function se(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function Ct(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ut(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function nn(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var o=l.get,c=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(g){n=""+g,c.call(this,g)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(g){n=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ht(e){if(!e._valueTracker){var t=Ut(e)?"checked":"value";e._valueTracker=nn(e,t,""+e[t])}}function qn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Ut(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Fn(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 el=/[\n"\\]/g;function on(e){return e.replace(el,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function tl(e,t,n,l,o,c,g,x){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ct(t)):e.value!==""+Ct(t)&&(e.value=""+Ct(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?Qa(e,g,Ct(t)):n!=null?Qa(e,g,Ct(n)):l!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+Ct(x):e.removeAttribute("name")}function Ri(e,t,n,l,o,c,g,x){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||n!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){ht(e);return}n=n!=null?""+Ct(n):"",t=t!=null?""+Ct(t):n,x||t===e.value||(e.value=t),e.defaultValue=t}l=l??o,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=x?e.checked:!!l,e.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),ht(e)}function Qa(e,t,n){t==="number"&&Fn(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function nl(e,t,n,l){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&l&&(e[n].defaultSelected=!0)}else{for(n=""+Ct(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function ir(e,t,n){if(t!=null&&(t=""+Ct(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Ct(n):""}function lr(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(r(92));if(Ie(l)){if(1<l.length)throw Error(r(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=Ct(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),ht(e)}function il(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zo=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 ar(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||zo.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function sr(e,t,n){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var o in t)l=t[o],t.hasOwnProperty(o)&&n[o]!==l&&ar(e,o,l)}else for(var c in t)t.hasOwnProperty(c)&&ar(e,c,t[c])}function gn(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 Oo=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"]]),Bo=/^[\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 mi(e){return Bo.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Wt(){}var oa=null;function ca(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ii=null,li=null;function Bl(e){var t=I(e);if(t&&(e=t.stateNode)){var n=e[tn]||null;e:switch(e=t.stateNode,t.type){case"input":if(tl(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+on(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var o=l[tn]||null;if(!o)throw Error(r(90));tl(l,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&qn(l)}break e;case"textarea":ir(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&nl(e,!!n.multiple,t,!1)}}}var ua=!1;function Wa(e,t,n){if(ua)return e(t,n);ua=!0;try{var l=e(t);return l}finally{if(ua=!1,(ii!==null||li!==null)&&(Ir(),ii&&(t=ii,e=li,li=ii=null,Bl(t),e)))for(t=0;t<e.length;t++)Bl(e[t])}}function ll(e,t){var n=e.stateNode;if(n===null)return null;var l=n[tn]||null;if(l===null)return null;n=l[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":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(r(231,t,typeof n));return n}var Z=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oe=!1;if(Z)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){oe=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch{oe=!1}var Tt=null,bn=null,yn=null;function Me(){if(yn)return yn;var e,t=bn,n=t.length,l,o="value"in Tt?Tt.value:Tt.textContent,c=o.length;for(e=0;e<n&&t[e]===o[e];e++);var g=n-e;for(l=1;l<=g&&t[n-l]===o[c-l];l++);return yn=o.slice(e,1<l?1-l:void 0)}function ln(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 kt(){return!0}function On(){return!1}function Ht(e){function t(n,l,o,c,g){this._reactName=n,this._targetInst=o,this.type=l,this.nativeEvent=c,this.target=g,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(c):c[x]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?kt:On,this.isPropagationStopped=On,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=kt)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=kt)},persist:function(){},isPersistent:kt}),t}var vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vn=Ht(vn),al=v({},vn,{view:0,detail:0}),_b=Ht(al),Uo,Ho,Ja,rr=v({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yo,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!==Ja&&(Ja&&e.type==="mousemove"?(Uo=e.screenX-Ja.screenX,Ho=e.screenY-Ja.screenY):Ho=Uo=0,Ja=e),Uo)},movementY:function(e){return"movementY"in e?e.movementY:Ho}}),Rd=Ht(rr),jb=v({},rr,{dataTransfer:0}),Db=Ht(jb),zb=v({},al,{relatedTarget:0}),Ko=Ht(zb),Ob=v({},vn,{animationName:0,elapsedTime:0,pseudoElement:0}),Bb=Ht(Ob),Ub=v({},vn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Hb=Ht(Ub),Kb=v({},vn,{data:0}),_d=Ht(Kb),Yb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gb={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"},Ib={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $b(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ib[e])?!!t[e]:!1}function Yo(){return $b}var qb=v({},al,{key:function(e){if(e.key){var t=Yb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ln(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Gb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yo,charCode:function(e){return e.type==="keypress"?ln(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ln(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Fb=Ht(qb),Vb=v({},rr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jd=Ht(Vb),Xb=v({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yo}),Pb=Ht(Xb),Zb=v({},vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qb=Ht(Zb),Wb=v({},rr,{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}),Jb=Ht(Wb),ey=v({},vn,{newState:0,oldState:0}),ty=Ht(ey),ny=[9,13,27,32],Go=Z&&"CompositionEvent"in window,es=null;Z&&"documentMode"in document&&(es=document.documentMode);var iy=Z&&"TextEvent"in window&&!es,Dd=Z&&(!Go||es&&8<es&&11>=es),zd=" ",Od=!1;function Bd(e,t){switch(e){case"keyup":return ny.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ud(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var da=!1;function ly(e,t){switch(e){case"compositionend":return Ud(t);case"keypress":return t.which!==32?null:(Od=!0,zd);case"textInput":return e=t.data,e===zd&&Od?null:e;default:return null}}function ay(e,t){if(da)return e==="compositionend"||!Go&&Bd(e,t)?(e=Me(),yn=bn=Tt=null,da=!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 Dd&&t.locale!=="ko"?null:t.data;default:return null}}var sy={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 Hd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sy[e.type]:t==="textarea"}function Kd(e,t,n,l){ii?li?li.push(l):li=[l]:ii=l,t=Zr(t,"onChange"),0<t.length&&(n=new Vn("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var ts=null,ns=null;function ry(e){Cm(e,0)}function or(e){var t=de(e);if(qn(t))return e}function Yd(e,t){if(e==="change")return t}var Gd=!1;if(Z){var Io;if(Z){var $o="oninput"in document;if(!$o){var Id=document.createElement("div");Id.setAttribute("oninput","return;"),$o=typeof Id.oninput=="function"}Io=$o}else Io=!1;Gd=Io&&(!document.documentMode||9<document.documentMode)}function $d(){ts&&(ts.detachEvent("onpropertychange",qd),ns=ts=null)}function qd(e){if(e.propertyName==="value"&&or(ns)){var t=[];Kd(t,ns,e,ca(e)),Wa(ry,t)}}function oy(e,t,n){e==="focusin"?($d(),ts=t,ns=n,ts.attachEvent("onpropertychange",qd)):e==="focusout"&&$d()}function cy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return or(ns)}function uy(e,t){if(e==="click")return or(t)}function dy(e,t){if(e==="input"||e==="change")return or(t)}function fy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Bn=typeof Object.is=="function"?Object.is:fy;function is(e,t){if(Bn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var o=n[l];if(!ce.call(t,o)||!Bn(e[o],t[o]))return!1}return!0}function Fd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vd(e,t){var n=Fd(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fd(n)}}function Xd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Fn(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Fn(e.document)}return t}function qo(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 hy=Z&&"documentMode"in document&&11>=document.documentMode,fa=null,Fo=null,ls=null,Vo=!1;function Zd(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vo||fa==null||fa!==Fn(l)||(l=fa,"selectionStart"in l&&qo(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ls&&is(ls,l)||(ls=l,l=Zr(Fo,"onSelect"),0<l.length&&(t=new Vn("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=fa)))}function Ul(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ha={animationend:Ul("Animation","AnimationEnd"),animationiteration:Ul("Animation","AnimationIteration"),animationstart:Ul("Animation","AnimationStart"),transitionrun:Ul("Transition","TransitionRun"),transitionstart:Ul("Transition","TransitionStart"),transitioncancel:Ul("Transition","TransitionCancel"),transitionend:Ul("Transition","TransitionEnd")},Xo={},Qd={};Z&&(Qd=document.createElement("div").style,"AnimationEvent"in window||(delete ha.animationend.animation,delete ha.animationiteration.animation,delete ha.animationstart.animation),"TransitionEvent"in window||delete ha.transitionend.transition);function Hl(e){if(Xo[e])return Xo[e];if(!ha[e])return e;var t=ha[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Qd)return Xo[e]=t[n];return e}var Wd=Hl("animationend"),Jd=Hl("animationiteration"),ef=Hl("animationstart"),my=Hl("transitionrun"),py=Hl("transitionstart"),gy=Hl("transitioncancel"),tf=Hl("transitionend"),nf=new Map,Po="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(" ");Po.push("scrollEnd");function ai(e,t){nf.set(e,t),It(t,[e])}var cr=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)},Xn=[],ma=0,Zo=0;function ur(){for(var e=ma,t=Zo=ma=0;t<e;){var n=Xn[t];Xn[t++]=null;var l=Xn[t];Xn[t++]=null;var o=Xn[t];Xn[t++]=null;var c=Xn[t];if(Xn[t++]=null,l!==null&&o!==null){var g=l.pending;g===null?o.next=o:(o.next=g.next,g.next=o),l.pending=o}c!==0&&lf(n,o,c)}}function dr(e,t,n,l){Xn[ma++]=e,Xn[ma++]=t,Xn[ma++]=n,Xn[ma++]=l,Zo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Qo(e,t,n,l){return dr(e,t,n,l),fr(e)}function Kl(e,t){return dr(e,null,null,t),fr(e)}function lf(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var o=!1,c=e.return;c!==null;)c.childLanes|=n,l=c.alternate,l!==null&&(l.childLanes|=n),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(o=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,o&&t!==null&&(o=31-zt(n),e=c.hiddenUpdates,l=e[o],l===null?e[o]=[t]:l.push(t),t.lane=n|536870912),c):null}function fr(e){if(50<As)throw As=0,su=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var pa={};function by(e,t,n,l){this.tag=e,this.key=n,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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(e,t,n,l){return new by(e,t,n,l)}function Wo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _i(e,t){var n=e.alternate;return n===null?(n=Un(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function af(e,t){e.flags&=65011714;var n=e.alternate;return n===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=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function hr(e,t,n,l,o,c){var g=0;if(l=e,typeof e=="function")Wo(e)&&(g=1);else if(typeof e=="string")g=S0(e,n,$e.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ae:return e=Un(31,n,t,o),e.elementType=ae,e.lanes=c,e;case Y:return Yl(n.children,o,c,t);case A:g=8,o|=24;break;case O:return e=Un(12,n,t,o|2),e.elementType=O,e.lanes=c,e;case re:return e=Un(13,n,t,o),e.elementType=re,e.lanes=c,e;case J:return e=Un(19,n,t,o),e.elementType=J,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:g=10;break e;case B:g=9;break e;case ee:g=11;break e;case G:g=14;break e;case U:g=16,l=null;break e}g=29,n=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=Un(g,n,t,o),t.elementType=e,t.type=l,t.lanes=c,t}function Yl(e,t,n,l){return e=Un(7,e,l,t),e.lanes=n,e}function Jo(e,t,n){return e=Un(6,e,null,t),e.lanes=n,e}function sf(e){var t=Un(18,null,null,0);return t.stateNode=e,t}function ec(e,t,n){return t=Un(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var rf=new WeakMap;function Pn(e,t){if(typeof e=="object"&&e!==null){var n=rf.get(e);return n!==void 0?n:(t={value:e,source:t,stack:ue(t)},rf.set(e,t),t)}return{value:e,source:t,stack:ue(t)}}var ga=[],ba=0,mr=null,as=0,Zn=[],Qn=0,sl=null,pi=1,gi="";function ji(e,t){ga[ba++]=as,ga[ba++]=mr,mr=e,as=t}function of(e,t,n){Zn[Qn++]=pi,Zn[Qn++]=gi,Zn[Qn++]=sl,sl=e;var l=pi;e=gi;var o=32-zt(l)-1;l&=~(1<<o),n+=1;var c=32-zt(t)+o;if(30<c){var g=o-o%5;c=(l&(1<<g)-1).toString(32),l>>=g,o-=g,pi=1<<32-zt(t)+o|n<<o|l,gi=c+e}else pi=1<<c|n<<o|l,gi=e}function tc(e){e.return!==null&&(ji(e,1),of(e,1,0))}function nc(e){for(;e===mr;)mr=ga[--ba],ga[ba]=null,as=ga[--ba],ga[ba]=null;for(;e===sl;)sl=Zn[--Qn],Zn[Qn]=null,gi=Zn[--Qn],Zn[Qn]=null,pi=Zn[--Qn],Zn[Qn]=null}function cf(e,t){Zn[Qn++]=pi,Zn[Qn++]=gi,Zn[Qn++]=sl,pi=t.id,gi=t.overflow,sl=e}var cn=null,Rt=null,it=!1,rl=null,Wn=!1,ic=Error(r(519));function ol(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ss(Pn(t,e)),ic}function uf(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[Lt]=e,t[tn]=l,n){case"dialog":Je("cancel",t),Je("close",t);break;case"iframe":case"object":case"embed":Je("load",t);break;case"video":case"audio":for(n=0;n<Ns.length;n++)Je(Ns[n],t);break;case"source":Je("error",t);break;case"img":case"image":case"link":Je("error",t),Je("load",t);break;case"details":Je("toggle",t);break;case"input":Je("invalid",t),Ri(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Je("invalid",t);break;case"textarea":Je("invalid",t),lr(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||Em(t.textContent,n)?(l.popover!=null&&(Je("beforetoggle",t),Je("toggle",t)),l.onScroll!=null&&Je("scroll",t),l.onScrollEnd!=null&&Je("scrollend",t),l.onClick!=null&&(t.onclick=Wt),t=!0):t=!1,t||ol(e,!0)}function df(e){for(cn=e.return;cn;)switch(cn.tag){case 5:case 31:case 13:Wn=!1;return;case 27:case 3:Wn=!0;return;default:cn=cn.return}}function ya(e){if(e!==cn)return!1;if(!it)return df(e),it=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||wu(e.type,e.memoizedProps)),n=!n),n&&Rt&&ol(e),df(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Rt=Om(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Rt=Om(e)}else t===27?(t=Rt,Sl(e.type)?(e=Au,Au=null,Rt=e):Rt=t):Rt=cn?ei(e.stateNode.nextSibling):null;return!0}function Gl(){Rt=cn=null,it=!1}function lc(){var e=rl;return e!==null&&(kn===null?kn=e:kn.push.apply(kn,e),rl=null),e}function ss(e){rl===null?rl=[e]:rl.push(e)}var ac=et(null),Il=null,Di=null;function cl(e,t,n){_e(ac,t._currentValue),t._currentValue=n}function zi(e){e._currentValue=ac.current,je(ac)}function sc(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function rc(e,t,n,l){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){var g=o.child;c=c.firstContext;e:for(;c!==null;){var x=c;c=o;for(var C=0;C<t.length;C++)if(x.context===t[C]){c.lanes|=n,x=c.alternate,x!==null&&(x.lanes|=n),sc(c.return,n,e),l||(g=null);break e}c=x.next}}else if(o.tag===18){if(g=o.return,g===null)throw Error(r(341));g.lanes|=n,c=g.alternate,c!==null&&(c.lanes|=n),sc(g,n,e),g=null}else g=o.child;if(g!==null)g.return=o;else for(g=o;g!==null;){if(g===e){g=null;break}if(o=g.sibling,o!==null){o.return=g.return,g=o;break}g=g.return}o=g}}function va(e,t,n,l){e=null;for(var o=t,c=!1;o!==null;){if(!c){if((o.flags&524288)!==0)c=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var g=o.alternate;if(g===null)throw Error(r(387));if(g=g.memoizedProps,g!==null){var x=o.type;Bn(o.pendingProps.value,g.value)||(e!==null?e.push(x):e=[x])}}else if(o===ft.current){if(g=o.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(js):e=[js])}o=o.return}e!==null&&rc(t,e,n,l),t.flags|=262144}function pr(e){for(e=e.firstContext;e!==null;){if(!Bn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $l(e){Il=e,Di=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function un(e){return ff(Il,e)}function gr(e,t){return Il===null&&$l(e),ff(e,t)}function ff(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Di===null){if(e===null)throw Error(r(308));Di=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Di=Di.next=t;return n}var yy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},vy=a.unstable_scheduleCallback,xy=a.unstable_NormalPriority,Ft={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oc(){return{controller:new yy,data:new Map,refCount:0}}function rs(e){e.refCount--,e.refCount===0&&vy(xy,function(){e.controller.abort()})}var os=null,cc=0,xa=0,wa=null;function wy(e,t){if(os===null){var n=os=[];cc=0,xa=fu(),wa={status:"pending",value:void 0,then:function(l){n.push(l)}}}return cc++,t.then(hf,hf),t}function hf(){if(--cc===0&&os!==null){wa!==null&&(wa.status="fulfilled");var e=os;os=null,xa=0,wa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sy(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var o=0;o<n.length;o++)(0,n[o])(t)},function(o){for(l.status="rejected",l.reason=o,o=0;o<n.length;o++)(0,n[o])(void 0)}),l}var mf=L.S;L.S=function(e,t){Qh=he(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&wy(e,t),mf!==null&&mf(e,t)};var ql=et(null);function uc(){var e=ql.current;return e!==null?e:Mt.pooledCache}function br(e,t){t===null?_e(ql,ql.current):_e(ql,t.pool)}function pf(){var e=uc();return e===null?null:{parent:Ft._currentValue,pool:e}}var Sa=Error(r(460)),dc=Error(r(474)),yr=Error(r(542)),vr={then:function(){}};function gf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function bf(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Wt,Wt),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,vf(e),e;default:if(typeof t.status=="string")t.then(Wt,Wt);else{if(e=Mt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=l}},function(l){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,vf(e),e}throw Vl=t,Sa}}function Fl(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Vl=n,Sa):n}}var Vl=null;function yf(){if(Vl===null)throw Error(r(459));var e=Vl;return Vl=null,e}function vf(e){if(e===Sa||e===yr)throw Error(r(483))}var Ca=null,cs=0;function xr(e){var t=cs;return cs+=1,Ca===null&&(Ca=[]),bf(Ca,e,t)}function us(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wr(e,t){throw t.$$typeof===S?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function xf(e){function t(R,M){if(e){var _=R.deletions;_===null?(R.deletions=[M],R.flags|=16):_.push(M)}}function n(R,M){if(!e)return null;for(;M!==null;)t(R,M),M=M.sibling;return null}function l(R){for(var M=new Map;R!==null;)R.key!==null?M.set(R.key,R):M.set(R.index,R),R=R.sibling;return M}function o(R,M){return R=_i(R,M),R.index=0,R.sibling=null,R}function c(R,M,_){return R.index=_,e?(_=R.alternate,_!==null?(_=_.index,_<M?(R.flags|=67108866,M):_):(R.flags|=67108866,M)):(R.flags|=1048576,M)}function g(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function x(R,M,_,V){return M===null||M.tag!==6?(M=Jo(_,R.mode,V),M.return=R,M):(M=o(M,_),M.return=R,M)}function C(R,M,_,V){var Ae=_.type;return Ae===Y?q(R,M,_.props.children,V,_.key):M!==null&&(M.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===U&&Fl(Ae)===M.type)?(M=o(M,_.props),us(M,_),M.return=R,M):(M=hr(_.type,_.key,_.props,null,R.mode,V),us(M,_),M.return=R,M)}function j(R,M,_,V){return M===null||M.tag!==4||M.stateNode.containerInfo!==_.containerInfo||M.stateNode.implementation!==_.implementation?(M=ec(_,R.mode,V),M.return=R,M):(M=o(M,_.children||[]),M.return=R,M)}function q(R,M,_,V,Ae){return M===null||M.tag!==7?(M=Yl(_,R.mode,V,Ae),M.return=R,M):(M=o(M,_),M.return=R,M)}function P(R,M,_){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=Jo(""+M,R.mode,_),M.return=R,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case T:return _=hr(M.type,M.key,M.props,null,R.mode,_),us(_,M),_.return=R,_;case E:return M=ec(M,R.mode,_),M.return=R,M;case U:return M=Fl(M),P(R,M,_)}if(Ie(M)||Ee(M))return M=Yl(M,R.mode,_,null),M.return=R,M;if(typeof M.then=="function")return P(R,xr(M),_);if(M.$$typeof===H)return P(R,gr(R,M),_);wr(R,M)}return null}function z(R,M,_,V){var Ae=M!==null?M.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return Ae!==null?null:x(R,M,""+_,V);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case T:return _.key===Ae?C(R,M,_,V):null;case E:return _.key===Ae?j(R,M,_,V):null;case U:return _=Fl(_),z(R,M,_,V)}if(Ie(_)||Ee(_))return Ae!==null?null:q(R,M,_,V,null);if(typeof _.then=="function")return z(R,M,xr(_),V);if(_.$$typeof===H)return z(R,M,gr(R,_),V);wr(R,_)}return null}function K(R,M,_,V,Ae){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return R=R.get(_)||null,x(M,R,""+V,Ae);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case T:return R=R.get(V.key===null?_:V.key)||null,C(M,R,V,Ae);case E:return R=R.get(V.key===null?_:V.key)||null,j(M,R,V,Ae);case U:return V=Fl(V),K(R,M,_,V,Ae)}if(Ie(V)||Ee(V))return R=R.get(_)||null,q(M,R,V,Ae,null);if(typeof V.then=="function")return K(R,M,_,xr(V),Ae);if(V.$$typeof===H)return K(R,M,_,gr(M,V),Ae);wr(M,V)}return null}function ye(R,M,_,V){for(var Ae=null,rt=null,we=M,Ke=M=0,nt=null;we!==null&&Ke<_.length;Ke++){we.index>Ke?(nt=we,we=null):nt=we.sibling;var ot=z(R,we,_[Ke],V);if(ot===null){we===null&&(we=nt);break}e&&we&&ot.alternate===null&&t(R,we),M=c(ot,M,Ke),rt===null?Ae=ot:rt.sibling=ot,rt=ot,we=nt}if(Ke===_.length)return n(R,we),it&&ji(R,Ke),Ae;if(we===null){for(;Ke<_.length;Ke++)we=P(R,_[Ke],V),we!==null&&(M=c(we,M,Ke),rt===null?Ae=we:rt.sibling=we,rt=we);return it&&ji(R,Ke),Ae}for(we=l(we);Ke<_.length;Ke++)nt=K(we,R,Ke,_[Ke],V),nt!==null&&(e&&nt.alternate!==null&&we.delete(nt.key===null?Ke:nt.key),M=c(nt,M,Ke),rt===null?Ae=nt:rt.sibling=nt,rt=nt);return e&&we.forEach(function(El){return t(R,El)}),it&&ji(R,Ke),Ae}function Ne(R,M,_,V){if(_==null)throw Error(r(151));for(var Ae=null,rt=null,we=M,Ke=M=0,nt=null,ot=_.next();we!==null&&!ot.done;Ke++,ot=_.next()){we.index>Ke?(nt=we,we=null):nt=we.sibling;var El=z(R,we,ot.value,V);if(El===null){we===null&&(we=nt);break}e&&we&&El.alternate===null&&t(R,we),M=c(El,M,Ke),rt===null?Ae=El:rt.sibling=El,rt=El,we=nt}if(ot.done)return n(R,we),it&&ji(R,Ke),Ae;if(we===null){for(;!ot.done;Ke++,ot=_.next())ot=P(R,ot.value,V),ot!==null&&(M=c(ot,M,Ke),rt===null?Ae=ot:rt.sibling=ot,rt=ot);return it&&ji(R,Ke),Ae}for(we=l(we);!ot.done;Ke++,ot=_.next())ot=K(we,R,Ke,ot.value,V),ot!==null&&(e&&ot.alternate!==null&&we.delete(ot.key===null?Ke:ot.key),M=c(ot,M,Ke),rt===null?Ae=ot:rt.sibling=ot,rt=ot);return e&&we.forEach(function(j0){return t(R,j0)}),it&&ji(R,Ke),Ae}function xt(R,M,_,V){if(typeof _=="object"&&_!==null&&_.type===Y&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case T:e:{for(var Ae=_.key;M!==null;){if(M.key===Ae){if(Ae=_.type,Ae===Y){if(M.tag===7){n(R,M.sibling),V=o(M,_.props.children),V.return=R,R=V;break e}}else if(M.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===U&&Fl(Ae)===M.type){n(R,M.sibling),V=o(M,_.props),us(V,_),V.return=R,R=V;break e}n(R,M);break}else t(R,M);M=M.sibling}_.type===Y?(V=Yl(_.props.children,R.mode,V,_.key),V.return=R,R=V):(V=hr(_.type,_.key,_.props,null,R.mode,V),us(V,_),V.return=R,R=V)}return g(R);case E:e:{for(Ae=_.key;M!==null;){if(M.key===Ae)if(M.tag===4&&M.stateNode.containerInfo===_.containerInfo&&M.stateNode.implementation===_.implementation){n(R,M.sibling),V=o(M,_.children||[]),V.return=R,R=V;break e}else{n(R,M);break}else t(R,M);M=M.sibling}V=ec(_,R.mode,V),V.return=R,R=V}return g(R);case U:return _=Fl(_),xt(R,M,_,V)}if(Ie(_))return ye(R,M,_,V);if(Ee(_)){if(Ae=Ee(_),typeof Ae!="function")throw Error(r(150));return _=Ae.call(_),Ne(R,M,_,V)}if(typeof _.then=="function")return xt(R,M,xr(_),V);if(_.$$typeof===H)return xt(R,M,gr(R,_),V);wr(R,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,M!==null&&M.tag===6?(n(R,M.sibling),V=o(M,_),V.return=R,R=V):(n(R,M),V=Jo(_,R.mode,V),V.return=R,R=V),g(R)):n(R,M)}return function(R,M,_,V){try{cs=0;var Ae=xt(R,M,_,V);return Ca=null,Ae}catch(we){if(we===Sa||we===yr)throw we;var rt=Un(29,we,null,R.mode);return rt.lanes=V,rt.return=R,rt}finally{}}}var Xl=xf(!0),wf=xf(!1),ul=!1;function fc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function dl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fl(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(ct&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,t=fr(e),lf(e,null,n),t}return dr(e,l,t,n),fr(e)}function ds(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,jl(e,n)}}function mc(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var o=null,c=null;if(n=n.firstBaseUpdate,n!==null){do{var g={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};c===null?o=c=g:c=c.next=g,n=n.next}while(n!==null);c===null?o=c=t:c=c.next=t}else o=c=t;n={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var pc=!1;function fs(){if(pc){var e=wa;if(e!==null)throw e}}function hs(e,t,n,l){pc=!1;var o=e.updateQueue;ul=!1;var c=o.firstBaseUpdate,g=o.lastBaseUpdate,x=o.shared.pending;if(x!==null){o.shared.pending=null;var C=x,j=C.next;C.next=null,g===null?c=j:g.next=j,g=C;var q=e.alternate;q!==null&&(q=q.updateQueue,x=q.lastBaseUpdate,x!==g&&(x===null?q.firstBaseUpdate=j:x.next=j,q.lastBaseUpdate=C))}if(c!==null){var P=o.baseState;g=0,q=j=C=null,x=c;do{var z=x.lane&-536870913,K=z!==x.lane;if(K?(tt&z)===z:(l&z)===z){z!==0&&z===xa&&(pc=!0),q!==null&&(q=q.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var ye=e,Ne=x;z=t;var xt=n;switch(Ne.tag){case 1:if(ye=Ne.payload,typeof ye=="function"){P=ye.call(xt,P,z);break e}P=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Ne.payload,z=typeof ye=="function"?ye.call(xt,P,z):ye,z==null)break e;P=v({},P,z);break e;case 2:ul=!0}}z=x.callback,z!==null&&(e.flags|=64,K&&(e.flags|=8192),K=o.callbacks,K===null?o.callbacks=[z]:K.push(z))}else K={lane:z,tag:x.tag,payload:x.payload,callback:x.callback,next:null},q===null?(j=q=K,C=P):q=q.next=K,g|=z;if(x=x.next,x===null){if(x=o.shared.pending,x===null)break;K=x,x=K.next,K.next=null,o.lastBaseUpdate=K,o.shared.pending=null}}while(!0);q===null&&(C=P),o.baseState=C,o.firstBaseUpdate=j,o.lastBaseUpdate=q,c===null&&(o.shared.lanes=0),bl|=g,e.lanes=g,e.memoizedState=P}}function Sf(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Cf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Sf(n[e],t)}var Ta=et(null),Sr=et(0);function Tf(e,t){e=$i,_e(Sr,e),_e(Ta,t),$i=e|t.baseLanes}function gc(){_e(Sr,$i),_e(Ta,Ta.current)}function bc(){$i=Sr.current,je(Ta),je(Sr)}var Hn=et(null),Jn=null;function hl(e){var t=e.alternate;_e($t,$t.current&1),_e(Hn,e),Jn===null&&(t===null||Ta.current!==null||t.memoizedState!==null)&&(Jn=e)}function yc(e){_e($t,$t.current),_e(Hn,e),Jn===null&&(Jn=e)}function Mf(e){e.tag===22?(_e($t,$t.current),_e(Hn,e),Jn===null&&(Jn=e)):ml()}function ml(){_e($t,$t.current),_e(Hn,Hn.current)}function Kn(e){je(Hn),Jn===e&&(Jn=null),je($t)}var $t=et(0);function Cr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Tu(n)||Mu(n)))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 Oi=0,Ue=null,yt=null,Vt=null,Tr=!1,Ma=!1,Pl=!1,Mr=0,ms=0,Aa=null,Cy=0;function Kt(){throw Error(r(321))}function vc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Bn(e[n],t[n]))return!1;return!0}function xc(e,t,n,l,o,c){return Oi=c,Ue=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?oh:zc,Pl=!1,c=n(l,o),Pl=!1,Ma&&(c=Ef(t,n,l,o)),Af(e),c}function Af(e){L.H=bs;var t=yt!==null&&yt.next!==null;if(Oi=0,Vt=yt=Ue=null,Tr=!1,ms=0,Aa=null,t)throw Error(r(300));e===null||Xt||(e=e.dependencies,e!==null&&pr(e)&&(Xt=!0))}function Ef(e,t,n,l){Ue=e;var o=0;do{if(Ma&&(Aa=null),ms=0,Ma=!1,25<=o)throw Error(r(301));if(o+=1,Vt=yt=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}L.H=ch,c=t(n,l)}while(Ma);return c}function Ty(){var e=L.H,t=e.useState()[0];return t=typeof t.then=="function"?ps(t):t,e=e.useState()[0],(yt!==null?yt.memoizedState:null)!==e&&(Ue.flags|=1024),t}function wc(){var e=Mr!==0;return Mr=0,e}function Sc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Cc(e){if(Tr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Tr=!1}Oi=0,Vt=yt=Ue=null,Ma=!1,ms=Mr=0,Aa=null}function xn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Ue.memoizedState=Vt=e:Vt=Vt.next=e,Vt}function qt(){if(yt===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=Vt===null?Ue.memoizedState:Vt.next;if(t!==null)Vt=t,yt=e;else{if(e===null)throw Ue.alternate===null?Error(r(467)):Error(r(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},Vt===null?Ue.memoizedState=Vt=e:Vt=Vt.next=e}return Vt}function Ar(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ps(e){var t=ms;return ms+=1,Aa===null&&(Aa=[]),e=bf(Aa,e,t),t=Ue,(Vt===null?t.memoizedState:Vt.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?oh:zc),e}function Er(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ps(e);if(e.$$typeof===H)return un(e)}throw Error(r(438,String(e)))}function Tc(e){var t=null,n=Ue.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Ue.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Ar(),Ue.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=ne;return t.index++,n}function Bi(e,t){return typeof t=="function"?t(e):t}function Nr(e){var t=qt();return Mc(t,yt,e)}function Mc(e,t,n){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var o=e.baseQueue,c=l.pending;if(c!==null){if(o!==null){var g=o.next;o.next=c.next,c.next=g}t.baseQueue=o=c,l.pending=null}if(c=e.baseState,o===null)e.memoizedState=c;else{t=o.next;var x=g=null,C=null,j=t,q=!1;do{var P=j.lane&-536870913;if(P!==j.lane?(tt&P)===P:(Oi&P)===P){var z=j.revertLane;if(z===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),P===xa&&(q=!0);else if((Oi&z)===z){j=j.next,z===xa&&(q=!0);continue}else P={lane:0,revertLane:j.revertLane,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},C===null?(x=C=P,g=c):C=C.next=P,Ue.lanes|=z,bl|=z;P=j.action,Pl&&n(c,P),c=j.hasEagerState?j.eagerState:n(c,P)}else z={lane:P,revertLane:j.revertLane,gesture:j.gesture,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},C===null?(x=C=z,g=c):C=C.next=z,Ue.lanes|=P,bl|=P;j=j.next}while(j!==null&&j!==t);if(C===null?g=c:C.next=x,!Bn(c,e.memoizedState)&&(Xt=!0,q&&(n=wa,n!==null)))throw n;e.memoizedState=c,e.baseState=g,e.baseQueue=C,l.lastRenderedState=c}return o===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ac(e){var t=qt(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var l=n.dispatch,o=n.pending,c=t.memoizedState;if(o!==null){n.pending=null;var g=o=o.next;do c=e(c,g.action),g=g.next;while(g!==o);Bn(c,t.memoizedState)||(Xt=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),n.lastRenderedState=c}return[c,l]}function Nf(e,t,n){var l=Ue,o=qt(),c=it;if(c){if(n===void 0)throw Error(r(407));n=n()}else n=t();var g=!Bn((yt||o).memoizedState,n);if(g&&(o.memoizedState=n,Xt=!0),o=o.queue,Lc(Rf.bind(null,l,o,e),[e]),o.getSnapshot!==t||g||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,Ea(9,{destroy:void 0},kf.bind(null,l,o,n,t),null),Mt===null)throw Error(r(349));c||(Oi&127)!==0||Lf(l,t,n)}return n}function Lf(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ue.updateQueue,t===null?(t=Ar(),Ue.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function kf(e,t,n,l){t.value=n,t.getSnapshot=l,_f(t)&&jf(e)}function Rf(e,t,n){return n(function(){_f(t)&&jf(e)})}function _f(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Bn(e,n)}catch{return!0}}function jf(e){var t=Kl(e,2);t!==null&&Rn(t,e,2)}function Ec(e){var t=xn();if(typeof e=="function"){var n=e;if(e=n(),Pl){Qe(!0);try{n()}finally{Qe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bi,lastRenderedState:e},t}function Df(e,t,n,l){return e.baseState=n,Mc(e,yt,typeof l=="function"?l:Bi)}function My(e,t,n,l,o){if(Rr(e))throw Error(r(485));if(e=t.action,e!==null){var c={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){c.listeners.push(g)}};L.T!==null?n(!0):c.isTransition=!1,l(c),n=t.pending,n===null?(c.next=t.pending=c,zf(t,c)):(c.next=n.next,t.pending=n.next=c)}}function zf(e,t){var n=t.action,l=t.payload,o=e.state;if(t.isTransition){var c=L.T,g={};L.T=g;try{var x=n(o,l),C=L.S;C!==null&&C(g,x),Of(e,t,x)}catch(j){Nc(e,t,j)}finally{c!==null&&g.types!==null&&(c.types=g.types),L.T=c}}else try{c=n(o,l),Of(e,t,c)}catch(j){Nc(e,t,j)}}function Of(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Bf(e,t,l)},function(l){return Nc(e,t,l)}):Bf(e,t,n)}function Bf(e,t,n){t.status="fulfilled",t.value=n,Uf(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,zf(e,n)))}function Nc(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Uf(t),t=t.next;while(t!==l)}e.action=null}function Uf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Hf(e,t){return t}function Kf(e,t){if(it){var n=Mt.formState;if(n!==null){e:{var l=Ue;if(it){if(Rt){t:{for(var o=Rt,c=Wn;o.nodeType!==8;){if(!c){o=null;break t}if(o=ei(o.nextSibling),o===null){o=null;break t}}c=o.data,o=c==="F!"||c==="F"?o:null}if(o){Rt=ei(o.nextSibling),l=o.data==="F!";break e}}ol(l)}l=!1}l&&(t=n[0])}}return n=xn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hf,lastRenderedState:t},n.queue=l,n=ah.bind(null,Ue,l),l.dispatch=n,l=Ec(!1),c=Dc.bind(null,Ue,!1,l.queue),l=xn(),o={state:t,dispatch:null,action:e,pending:null},l.queue=o,n=My.bind(null,Ue,o,c,n),o.dispatch=n,l.memoizedState=e,[t,n,!1]}function Yf(e){var t=qt();return Gf(t,yt,e)}function Gf(e,t,n){if(t=Mc(e,t,Hf)[0],e=Nr(Bi)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ps(t)}catch(g){throw g===Sa?yr:g}else l=t;t=qt();var o=t.queue,c=o.dispatch;return n!==t.memoizedState&&(Ue.flags|=2048,Ea(9,{destroy:void 0},Ay.bind(null,o,n),null)),[l,c,e]}function Ay(e,t){e.action=t}function If(e){var t=qt(),n=yt;if(n!==null)return Gf(t,n,e);qt(),t=t.memoizedState,n=qt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function Ea(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Ue.updateQueue,t===null&&(t=Ar(),Ue.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function $f(){return qt().memoizedState}function Lr(e,t,n,l){var o=xn();Ue.flags|=e,o.memoizedState=Ea(1|t,{destroy:void 0},n,l===void 0?null:l)}function kr(e,t,n,l){var o=qt();l=l===void 0?null:l;var c=o.memoizedState.inst;yt!==null&&l!==null&&vc(l,yt.memoizedState.deps)?o.memoizedState=Ea(t,c,n,l):(Ue.flags|=e,o.memoizedState=Ea(1|t,c,n,l))}function qf(e,t){Lr(8390656,8,e,t)}function Lc(e,t){kr(2048,8,e,t)}function Ey(e){Ue.flags|=4;var t=Ue.updateQueue;if(t===null)t=Ar(),Ue.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ff(e){var t=qt().memoizedState;return Ey({ref:t,nextImpl:e}),function(){if((ct&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Vf(e,t){return kr(4,2,e,t)}function Xf(e,t){return kr(4,4,e,t)}function Pf(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Zf(e,t,n){n=n!=null?n.concat([e]):null,kr(4,4,Pf.bind(null,t,e),n)}function kc(){}function Qf(e,t){var n=qt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&vc(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Wf(e,t){var n=qt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&vc(t,l[1]))return l[0];if(l=e(),Pl){Qe(!0);try{e()}finally{Qe(!1)}}return n.memoizedState=[l,t],l}function Rc(e,t,n){return n===void 0||(Oi&1073741824)!==0&&(tt&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Jh(),Ue.lanes|=e,bl|=e,n)}function Jf(e,t,n,l){return Bn(n,t)?n:Ta.current!==null?(e=Rc(e,n,l),Bn(e,t)||(Xt=!0),e):(Oi&42)===0||(Oi&1073741824)!==0&&(tt&261930)===0?(Xt=!0,e.memoizedState=n):(e=Jh(),Ue.lanes|=e,bl|=e,t)}function eh(e,t,n,l,o){var c=$.p;$.p=c!==0&&8>c?c:8;var g=L.T,x={};L.T=x,Dc(e,!1,t,n);try{var C=o(),j=L.S;if(j!==null&&j(x,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var q=Sy(C,l);gs(e,t,q,In(e))}else gs(e,t,l,In(e))}catch(P){gs(e,t,{then:function(){},status:"rejected",reason:P},In())}finally{$.p=c,g!==null&&x.types!==null&&(g.types=x.types),L.T=g}}function Ny(){}function _c(e,t,n,l){if(e.tag!==5)throw Error(r(476));var o=th(e).queue;eh(e,o,t,le,n===null?Ny:function(){return nh(e),n(l)})}function th(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bi,lastRenderedState:le},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bi,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function nh(e){var t=th(e);t.next===null&&(t=e.alternate.memoizedState),gs(e,t.next.queue,{},In())}function jc(){return un(js)}function ih(){return qt().memoizedState}function lh(){return qt().memoizedState}function Ly(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=In();e=dl(n);var l=fl(t,e,n);l!==null&&(Rn(l,t,n),ds(l,t,n)),t={cache:oc()},e.payload=t;return}t=t.return}}function ky(e,t,n){var l=In();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Rr(e)?sh(t,n):(n=Qo(e,t,n,l),n!==null&&(Rn(n,e,l),rh(n,t,l)))}function ah(e,t,n){var l=In();gs(e,t,n,l)}function gs(e,t,n,l){var o={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rr(e))sh(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var g=t.lastRenderedState,x=c(g,n);if(o.hasEagerState=!0,o.eagerState=x,Bn(x,g))return dr(e,t,o,0),Mt===null&&ur(),!1}catch{}finally{}if(n=Qo(e,t,o,l),n!==null)return Rn(n,e,l),rh(n,t,l),!0}return!1}function Dc(e,t,n,l){if(l={lane:2,revertLane:fu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Rr(e)){if(t)throw Error(r(479))}else t=Qo(e,n,l,2),t!==null&&Rn(t,e,2)}function Rr(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function sh(e,t){Ma=Tr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rh(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,jl(e,n)}}var bs={readContext:un,use:Er,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useLayoutEffect:Kt,useInsertionEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useSyncExternalStore:Kt,useId:Kt,useHostTransitionStatus:Kt,useFormState:Kt,useActionState:Kt,useOptimistic:Kt,useMemoCache:Kt,useCacheRefresh:Kt};bs.useEffectEvent=Kt;var oh={readContext:un,use:Er,useCallback:function(e,t){return xn().memoizedState=[e,t===void 0?null:t],e},useContext:un,useEffect:qf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Lr(4194308,4,Pf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Lr(4194308,4,e,t)},useInsertionEffect:function(e,t){Lr(4,2,e,t)},useMemo:function(e,t){var n=xn();t=t===void 0?null:t;var l=e();if(Pl){Qe(!0);try{e()}finally{Qe(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=xn();if(n!==void 0){var o=n(t);if(Pl){Qe(!0);try{n(t)}finally{Qe(!1)}}}else o=t;return l.memoizedState=l.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},l.queue=e,e=e.dispatch=ky.bind(null,Ue,e),[l.memoizedState,e]},useRef:function(e){var t=xn();return e={current:e},t.memoizedState=e},useState:function(e){e=Ec(e);var t=e.queue,n=ah.bind(null,Ue,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:kc,useDeferredValue:function(e,t){var n=xn();return Rc(n,e,t)},useTransition:function(){var e=Ec(!1);return e=eh.bind(null,Ue,e.queue,!0,!1),xn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Ue,o=xn();if(it){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Mt===null)throw Error(r(349));(tt&127)!==0||Lf(l,t,n)}o.memoizedState=n;var c={value:n,getSnapshot:t};return o.queue=c,qf(Rf.bind(null,l,c,e),[e]),l.flags|=2048,Ea(9,{destroy:void 0},kf.bind(null,l,c,n,t),null),n},useId:function(){var e=xn(),t=Mt.identifierPrefix;if(it){var n=gi,l=pi;n=(l&~(1<<32-zt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Mr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Cy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:jc,useFormState:Kf,useActionState:Kf,useOptimistic:function(e){var t=xn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Dc.bind(null,Ue,!0,n),n.dispatch=t,[e,t]},useMemoCache:Tc,useCacheRefresh:function(){return xn().memoizedState=Ly.bind(null,Ue)},useEffectEvent:function(e){var t=xn(),n={impl:e};return t.memoizedState=n,function(){if((ct&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},zc={readContext:un,use:Er,useCallback:Qf,useContext:un,useEffect:Lc,useImperativeHandle:Zf,useInsertionEffect:Vf,useLayoutEffect:Xf,useMemo:Wf,useReducer:Nr,useRef:$f,useState:function(){return Nr(Bi)},useDebugValue:kc,useDeferredValue:function(e,t){var n=qt();return Jf(n,yt.memoizedState,e,t)},useTransition:function(){var e=Nr(Bi)[0],t=qt().memoizedState;return[typeof e=="boolean"?e:ps(e),t]},useSyncExternalStore:Nf,useId:ih,useHostTransitionStatus:jc,useFormState:Yf,useActionState:Yf,useOptimistic:function(e,t){var n=qt();return Df(n,yt,e,t)},useMemoCache:Tc,useCacheRefresh:lh};zc.useEffectEvent=Ff;var ch={readContext:un,use:Er,useCallback:Qf,useContext:un,useEffect:Lc,useImperativeHandle:Zf,useInsertionEffect:Vf,useLayoutEffect:Xf,useMemo:Wf,useReducer:Ac,useRef:$f,useState:function(){return Ac(Bi)},useDebugValue:kc,useDeferredValue:function(e,t){var n=qt();return yt===null?Rc(n,e,t):Jf(n,yt.memoizedState,e,t)},useTransition:function(){var e=Ac(Bi)[0],t=qt().memoizedState;return[typeof e=="boolean"?e:ps(e),t]},useSyncExternalStore:Nf,useId:ih,useHostTransitionStatus:jc,useFormState:If,useActionState:If,useOptimistic:function(e,t){var n=qt();return yt!==null?Df(n,yt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Tc,useCacheRefresh:lh};ch.useEffectEvent=Ff;function Oc(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=In(),o=dl(l);o.payload=t,n!=null&&(o.callback=n),t=fl(e,o,l),t!==null&&(Rn(t,e,l),ds(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=In(),o=dl(l);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=fl(e,o,l),t!==null&&(Rn(t,e,l),ds(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=In(),l=dl(n);l.tag=2,t!=null&&(l.callback=t),t=fl(e,l,n),t!==null&&(Rn(t,e,n),ds(t,e,n))}};function uh(e,t,n,l,o,c,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,c,g):t.prototype&&t.prototype.isPureReactComponent?!is(n,l)||!is(o,c):!0}function dh(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&Bc.enqueueReplaceState(t,t.state,null)}function Zl(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var o in e)n[o]===void 0&&(n[o]=e[o])}return n}function fh(e){cr(e)}function hh(e){console.error(e)}function mh(e){cr(e)}function _r(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function ph(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Uc(e,t,n){return n=dl(n),n.tag=3,n.payload={element:null},n.callback=function(){_r(e,t)},n}function gh(e){return e=dl(e),e.tag=3,e}function bh(e,t,n,l){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var c=l.value;e.payload=function(){return o(c)},e.callback=function(){ph(t,n,l)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){ph(t,n,l),typeof o!="function"&&(yl===null?yl=new Set([this]):yl.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})})}function Ry(e,t,n,l,o){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&va(t,n,o,!0),n=Hn.current,n!==null){switch(n.tag){case 31:case 13:return Jn===null?$r():n.alternate===null&&Yt===0&&(Yt=3),n.flags&=-257,n.flags|=65536,n.lanes=o,l===vr?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),cu(e,l,o)),!1;case 22:return n.flags|=65536,l===vr?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),cu(e,l,o)),!1}throw Error(r(435,n.tag))}return cu(e,l,o),$r(),!1}if(it)return t=Hn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,l!==ic&&(e=Error(r(422),{cause:l}),ss(Pn(e,n)))):(l!==ic&&(t=Error(r(423),{cause:l}),ss(Pn(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,l=Pn(l,n),o=Uc(e.stateNode,l,o),mc(e,o),Yt!==4&&(Yt=2)),!1;var c=Error(r(520),{cause:l});if(c=Pn(c,n),Ms===null?Ms=[c]:Ms.push(c),Yt!==4&&(Yt=2),t===null)return!0;l=Pn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=Uc(n.stateNode,l,e),mc(n,e),!1;case 1:if(t=n.type,c=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(yl===null||!yl.has(c))))return n.flags|=65536,o&=-o,n.lanes|=o,o=gh(o),bh(o,e,n,l),mc(n,o),!1}n=n.return}while(n!==null);return!1}var Hc=Error(r(461)),Xt=!1;function dn(e,t,n,l){t.child=e===null?wf(t,null,n,l):Xl(t,e.child,n,l)}function yh(e,t,n,l,o){n=n.render;var c=t.ref;if("ref"in l){var g={};for(var x in l)x!=="ref"&&(g[x]=l[x])}else g=l;return $l(t),l=xc(e,t,n,g,c,o),x=wc(),e!==null&&!Xt?(Sc(e,t,o),Ui(e,t,o)):(it&&x&&tc(t),t.flags|=1,dn(e,t,l,o),t.child)}function vh(e,t,n,l,o){if(e===null){var c=n.type;return typeof c=="function"&&!Wo(c)&&c.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=c,xh(e,t,c,l,o)):(e=hr(n.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Vc(e,o)){var g=c.memoizedProps;if(n=n.compare,n=n!==null?n:is,n(g,l)&&e.ref===t.ref)return Ui(e,t,o)}return t.flags|=1,e=_i(c,l),e.ref=t.ref,e.return=t,t.child=e}function xh(e,t,n,l,o){if(e!==null){var c=e.memoizedProps;if(is(c,l)&&e.ref===t.ref)if(Xt=!1,t.pendingProps=l=c,Vc(e,o))(e.flags&131072)!==0&&(Xt=!0);else return t.lanes=e.lanes,Ui(e,t,o)}return Kc(e,t,n,l,o)}function wh(e,t,n,l){var o=l.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|n:n,e!==null){for(l=t.child=e.child,o=0;l!==null;)o=o|l.lanes|l.childLanes,l=l.sibling;l=o&~c}else l=0,t.child=null;return Sh(e,t,c,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&br(t,c!==null?c.cachePool:null),c!==null?Tf(t,c):gc(),Mf(t);else return l=t.lanes=536870912,Sh(e,t,c!==null?c.baseLanes|n:n,n,l)}else c!==null?(br(t,c.cachePool),Tf(t,c),ml(),t.memoizedState=null):(e!==null&&br(t,null),gc(),ml());return dn(e,t,o,n),t.child}function ys(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Sh(e,t,n,l,o){var c=uc();return c=c===null?null:{parent:Ft._currentValue,pool:c},t.memoizedState={baseLanes:n,cachePool:c},e!==null&&br(t,null),gc(),Mf(t),e!==null&&va(e,t,l,!0),t.childLanes=o,null}function jr(e,t){return t=zr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ch(e,t,n){return Xl(t,e.child,null,n),e=jr(t,t.pendingProps),e.flags|=2,Kn(t),t.memoizedState=null,e}function _y(e,t,n){var l=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(it){if(l.mode==="hidden")return e=jr(t,l),t.lanes=536870912,ys(null,e);if(yc(t),(e=Rt)?(e=zm(e,Wn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sl!==null?{id:pi,overflow:gi}:null,retryLane:536870912,hydrationErrors:null},n=sf(e),n.return=t,t.child=n,cn=t,Rt=null)):e=null,e===null)throw ol(t);return t.lanes=536870912,null}return jr(t,l)}var c=e.memoizedState;if(c!==null){var g=c.dehydrated;if(yc(t),o)if(t.flags&256)t.flags&=-257,t=Ch(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Xt||va(e,t,n,!1),o=(n&e.childLanes)!==0,Xt||o){if(l=Mt,l!==null&&(g=Dl(l,n),g!==0&&g!==c.retryLane))throw c.retryLane=g,Kl(e,g),Rn(l,e,g),Hc;$r(),t=Ch(e,t,n)}else e=c.treeContext,Rt=ei(g.nextSibling),cn=t,it=!0,rl=null,Wn=!1,e!==null&&cf(t,e),t=jr(t,l),t.flags|=4096;return t}return e=_i(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Dr(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Kc(e,t,n,l,o){return $l(t),n=xc(e,t,n,l,void 0,o),l=wc(),e!==null&&!Xt?(Sc(e,t,o),Ui(e,t,o)):(it&&l&&tc(t),t.flags|=1,dn(e,t,n,o),t.child)}function Th(e,t,n,l,o,c){return $l(t),t.updateQueue=null,n=Ef(t,l,n,o),Af(e),l=wc(),e!==null&&!Xt?(Sc(e,t,c),Ui(e,t,c)):(it&&l&&tc(t),t.flags|=1,dn(e,t,n,c),t.child)}function Mh(e,t,n,l,o){if($l(t),t.stateNode===null){var c=pa,g=n.contextType;typeof g=="object"&&g!==null&&(c=un(g)),c=new n(l,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Bc,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=l,c.state=t.memoizedState,c.refs={},fc(t),g=n.contextType,c.context=typeof g=="object"&&g!==null?un(g):pa,c.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(Oc(t,n,g,l),c.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(g=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),g!==c.state&&Bc.enqueueReplaceState(c,c.state,null),hs(t,l,c,o),fs(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){c=t.stateNode;var x=t.memoizedProps,C=Zl(n,x);c.props=C;var j=c.context,q=n.contextType;g=pa,typeof q=="object"&&q!==null&&(g=un(q));var P=n.getDerivedStateFromProps;q=typeof P=="function"||typeof c.getSnapshotBeforeUpdate=="function",x=t.pendingProps!==x,q||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(x||j!==g)&&dh(t,c,l,g),ul=!1;var z=t.memoizedState;c.state=z,hs(t,l,c,o),fs(),j=t.memoizedState,x||z!==j||ul?(typeof P=="function"&&(Oc(t,n,P,l),j=t.memoizedState),(C=ul||uh(t,n,C,l,z,j,g))?(q||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=j),c.props=l,c.state=j,c.context=g,l=C):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{c=t.stateNode,hc(e,t),g=t.memoizedProps,q=Zl(n,g),c.props=q,P=t.pendingProps,z=c.context,j=n.contextType,C=pa,typeof j=="object"&&j!==null&&(C=un(j)),x=n.getDerivedStateFromProps,(j=typeof x=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(g!==P||z!==C)&&dh(t,c,l,C),ul=!1,z=t.memoizedState,c.state=z,hs(t,l,c,o),fs();var K=t.memoizedState;g!==P||z!==K||ul||e!==null&&e.dependencies!==null&&pr(e.dependencies)?(typeof x=="function"&&(Oc(t,n,x,l),K=t.memoizedState),(q=ul||uh(t,n,q,l,z,K,C)||e!==null&&e.dependencies!==null&&pr(e.dependencies))?(j||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(l,K,C),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(l,K,C)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=K),c.props=l,c.state=K,c.context=C,l=q):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),l=!1)}return c=l,Dr(e,t),l=(t.flags&128)!==0,c||l?(c=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&l?(t.child=Xl(t,e.child,null,o),t.child=Xl(t,null,n,o)):dn(e,t,n,o),t.memoizedState=c.state,e=t.child):e=Ui(e,t,o),e}function Ah(e,t,n,l){return Gl(),t.flags|=256,dn(e,t,n,l),t.child}var Yc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(e){return{baseLanes:e,cachePool:pf()}}function Ic(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Gn),e}function Eh(e,t,n){var l=t.pendingProps,o=!1,c=(t.flags&128)!==0,g;if((g=c)||(g=e!==null&&e.memoizedState===null?!1:($t.current&2)!==0),g&&(o=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(it){if(o?hl(t):ml(),(e=Rt)?(e=zm(e,Wn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:sl!==null?{id:pi,overflow:gi}:null,retryLane:536870912,hydrationErrors:null},n=sf(e),n.return=t,t.child=n,cn=t,Rt=null)):e=null,e===null)throw ol(t);return Mu(e)?t.lanes=32:t.lanes=536870912,null}var x=l.children;return l=l.fallback,o?(ml(),o=t.mode,x=zr({mode:"hidden",children:x},o),l=Yl(l,o,n,null),x.return=t,l.return=t,x.sibling=l,t.child=x,l=t.child,l.memoizedState=Gc(n),l.childLanes=Ic(e,g,n),t.memoizedState=Yc,ys(null,l)):(hl(t),$c(t,x))}var C=e.memoizedState;if(C!==null&&(x=C.dehydrated,x!==null)){if(c)t.flags&256?(hl(t),t.flags&=-257,t=qc(e,t,n)):t.memoizedState!==null?(ml(),t.child=e.child,t.flags|=128,t=null):(ml(),x=l.fallback,o=t.mode,l=zr({mode:"visible",children:l.children},o),x=Yl(x,o,n,null),x.flags|=2,l.return=t,x.return=t,l.sibling=x,t.child=l,Xl(t,e.child,null,n),l=t.child,l.memoizedState=Gc(n),l.childLanes=Ic(e,g,n),t.memoizedState=Yc,t=ys(null,l));else if(hl(t),Mu(x)){if(g=x.nextSibling&&x.nextSibling.dataset,g)var j=g.dgst;g=j,l=Error(r(419)),l.stack="",l.digest=g,ss({value:l,source:null,stack:null}),t=qc(e,t,n)}else if(Xt||va(e,t,n,!1),g=(n&e.childLanes)!==0,Xt||g){if(g=Mt,g!==null&&(l=Dl(g,n),l!==0&&l!==C.retryLane))throw C.retryLane=l,Kl(e,l),Rn(g,e,l),Hc;Tu(x)||$r(),t=qc(e,t,n)}else Tu(x)?(t.flags|=192,t.child=e.child,t=null):(e=C.treeContext,Rt=ei(x.nextSibling),cn=t,it=!0,rl=null,Wn=!1,e!==null&&cf(t,e),t=$c(t,l.children),t.flags|=4096);return t}return o?(ml(),x=l.fallback,o=t.mode,C=e.child,j=C.sibling,l=_i(C,{mode:"hidden",children:l.children}),l.subtreeFlags=C.subtreeFlags&65011712,j!==null?x=_i(j,x):(x=Yl(x,o,n,null),x.flags|=2),x.return=t,l.return=t,l.sibling=x,t.child=l,ys(null,l),l=t.child,x=e.child.memoizedState,x===null?x=Gc(n):(o=x.cachePool,o!==null?(C=Ft._currentValue,o=o.parent!==C?{parent:C,pool:C}:o):o=pf(),x={baseLanes:x.baseLanes|n,cachePool:o}),l.memoizedState=x,l.childLanes=Ic(e,g,n),t.memoizedState=Yc,ys(e.child,l)):(hl(t),n=e.child,e=n.sibling,n=_i(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=n,t.memoizedState=null,n)}function $c(e,t){return t=zr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zr(e,t){return e=Un(22,e,null,t),e.lanes=0,e}function qc(e,t,n){return Xl(t,e.child,null,n),e=$c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nh(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),sc(e.return,t,n)}function Fc(e,t,n,l,o,c){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:o,treeForkCount:c}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=n,g.tailMode=o,g.treeForkCount=c)}function Lh(e,t,n){var l=t.pendingProps,o=l.revealOrder,c=l.tail;l=l.children;var g=$t.current,x=(g&2)!==0;if(x?(g=g&1|2,t.flags|=128):g&=1,_e($t,g),dn(e,t,l,n),l=it?as:0,!x&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Nh(e,n,t);else if(e.tag===19)Nh(e,n,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(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Cr(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Fc(t,!1,o,n,c,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Cr(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Fc(t,!0,n,null,c,l);break;case"together":Fc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Ui(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),bl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(va(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=_i(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=_i(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Vc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&pr(e)))}function jy(e,t,n){switch(t.tag){case 3:De(t,t.stateNode.containerInfo),cl(t,Ft,e.memoizedState.cache),Gl();break;case 27:case 5:Gt(t);break;case 4:De(t,t.stateNode.containerInfo);break;case 10:cl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,yc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(hl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Eh(e,t,n):(hl(t),e=Ui(e,t,n),e!==null?e.sibling:null);hl(t);break;case 19:var o=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(va(e,t,n,!1),l=(n&t.childLanes)!==0),o){if(l)return Lh(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),_e($t,$t.current),l)break;return null;case 22:return t.lanes=0,wh(e,t,n,t.pendingProps);case 24:cl(t,Ft,e.memoizedState.cache)}return Ui(e,t,n)}function kh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xt=!0;else{if(!Vc(e,n)&&(t.flags&128)===0)return Xt=!1,jy(e,t,n);Xt=(e.flags&131072)!==0}else Xt=!1,it&&(t.flags&1048576)!==0&&of(t,as,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Fl(t.elementType),t.type=e,typeof e=="function")Wo(e)?(l=Zl(e,l),t.tag=1,t=Mh(null,t,e,l,n)):(t.tag=0,t=Kc(null,t,e,l,n));else{if(e!=null){var o=e.$$typeof;if(o===ee){t.tag=11,t=yh(null,t,e,l,n);break e}else if(o===G){t.tag=14,t=vh(null,t,e,l,n);break e}}throw t=st(e)||e,Error(r(306,t,""))}}return t;case 0:return Kc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,o=Zl(l,t.pendingProps),Mh(e,t,l,o,n);case 3:e:{if(De(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var c=t.memoizedState;o=c.element,hc(e,t),hs(t,l,null,n);var g=t.memoizedState;if(l=g.cache,cl(t,Ft,l),l!==c.cache&&rc(t,[Ft],n,!0),fs(),l=g.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Ah(e,t,l,n);break e}else if(l!==o){o=Pn(Error(r(424)),t),ss(o),t=Ah(e,t,l,n);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(Rt=ei(e.firstChild),cn=t,it=!0,rl=null,Wn=!0,n=wf(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Gl(),l===o){t=Ui(e,t,n);break e}dn(e,t,l,n)}t=t.child}return t;case 26:return Dr(e,t),e===null?(n=Ym(t.type,null,t.pendingProps,null))?t.memoizedState=n:it||(n=t.type,e=t.pendingProps,l=Qr(Ze.current).createElement(n),l[Lt]=t,l[tn]=e,fn(l,n,e),pe(l),t.stateNode=l):t.memoizedState=Ym(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Gt(t),e===null&&it&&(l=t.stateNode=Um(t.type,t.pendingProps,Ze.current),cn=t,Wn=!0,o=Rt,Sl(t.type)?(Au=o,Rt=ei(l.firstChild)):Rt=o),dn(e,t,t.pendingProps.children,n),Dr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&it&&((o=l=Rt)&&(l=c0(l,t.type,t.pendingProps,Wn),l!==null?(t.stateNode=l,cn=t,Rt=ei(l.firstChild),Wn=!1,o=!0):o=!1),o||ol(t)),Gt(t),o=t.type,c=t.pendingProps,g=e!==null?e.memoizedProps:null,l=c.children,wu(o,c)?l=null:g!==null&&wu(o,g)&&(t.flags|=32),t.memoizedState!==null&&(o=xc(e,t,Ty,null,null,n),js._currentValue=o),Dr(e,t),dn(e,t,l,n),t.child;case 6:return e===null&&it&&((e=n=Rt)&&(n=u0(n,t.pendingProps,Wn),n!==null?(t.stateNode=n,cn=t,Rt=null,e=!0):e=!1),e||ol(t)),null;case 13:return Eh(e,t,n);case 4:return De(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Xl(t,null,l,n):dn(e,t,l,n),t.child;case 11:return yh(e,t,t.type,t.pendingProps,n);case 7:return dn(e,t,t.pendingProps,n),t.child;case 8:return dn(e,t,t.pendingProps.children,n),t.child;case 12:return dn(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,cl(t,t.type,l.value),dn(e,t,l.children,n),t.child;case 9:return o=t.type._context,l=t.pendingProps.children,$l(t),o=un(o),l=l(o),t.flags|=1,dn(e,t,l,n),t.child;case 14:return vh(e,t,t.type,t.pendingProps,n);case 15:return xh(e,t,t.type,t.pendingProps,n);case 19:return Lh(e,t,n);case 31:return _y(e,t,n);case 22:return wh(e,t,n,t.pendingProps);case 24:return $l(t),l=un(Ft),e===null?(o=uc(),o===null&&(o=Mt,c=oc(),o.pooledCache=c,c.refCount++,c!==null&&(o.pooledCacheLanes|=n),o=c),t.memoizedState={parent:l,cache:o},fc(t),cl(t,Ft,o)):((e.lanes&n)!==0&&(hc(e,t),hs(t,null,null,n),fs()),o=e.memoizedState,c=t.memoizedState,o.parent!==l?(o={parent:l,cache:l},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),cl(t,Ft,l)):(l=c.cache,cl(t,Ft,l),l!==o.cache&&rc(t,[Ft],n,!0))),dn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Hi(e){e.flags|=4}function Xc(e,t,n,l,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(im())e.flags|=8192;else throw Vl=vr,dc}else e.flags&=-16777217}function Rh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Fm(t))if(im())e.flags|=8192;else throw Vl=vr,dc}function Or(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Dn():536870912,e.lanes|=t,Ra|=t)}function vs(e,t){if(!it)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function _t(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags&65011712,l|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function Dy(e,t,n){var l=t.pendingProps;switch(nc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(t),null;case 1:return _t(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),zi(Ft),qe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ya(t)?Hi(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,lc())),_t(t),null;case 26:var o=t.type,c=t.memoizedState;return e===null?(Hi(t),c!==null?(_t(t),Rh(t,c)):(_t(t),Xc(t,o,null,l,n))):c?c!==e.memoizedState?(Hi(t),_t(t),Rh(t,c)):(_t(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Hi(t),_t(t),Xc(t,o,e,l,n)),null;case 27:if(gt(t),n=Ze.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Hi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return _t(t),null}e=$e.current,ya(t)?uf(t):(e=Um(o,l,n),t.stateNode=e,Hi(t))}return _t(t),null;case 5:if(gt(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Hi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return _t(t),null}if(c=$e.current,ya(t))uf(t);else{var g=Qr(Ze.current);switch(c){case 1:c=g.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:c=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":c=g.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":c=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":c=g.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?c.multiple=!0:l.size&&(c.size=l.size);break;default:c=typeof l.is=="string"?g.createElement(o,{is:l.is}):g.createElement(o)}}c[Lt]=t,c[tn]=l;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)c.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=c;e:switch(fn(c,o,l),o){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Hi(t)}}return _t(t),Xc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Hi(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=Ze.current,ya(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,o=cn,o!==null)switch(o.tag){case 27:case 5:l=o.memoizedProps}e[Lt]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Em(e.nodeValue,n)),e||ol(t,!0)}else e=Qr(e).createTextNode(l),e[Lt]=t,t.stateNode=e}return _t(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=ya(t),n!==null){if(e===null){if(!l)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Lt]=t}else Gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_t(t),e=!1}else n=lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Kn(t),t):(Kn(t),null);if((t.flags&128)!==0)throw Error(r(558))}return _t(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=ya(t),l!==null&&l.dehydrated!==null){if(e===null){if(!o)throw Error(r(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));o[Lt]=t}else Gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_t(t),o=!1}else o=lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Kn(t),t):(Kn(t),null)}return Kn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,o=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(o=l.alternate.memoizedState.cachePool.pool),c=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(c=l.memoizedState.cachePool.pool),c!==o&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Or(t,t.updateQueue),_t(t),null);case 4:return qe(),e===null&&gu(t.stateNode.containerInfo),_t(t),null;case 10:return zi(t.type),_t(t),null;case 19:if(je($t),l=t.memoizedState,l===null)return _t(t),null;if(o=(t.flags&128)!==0,c=l.rendering,c===null)if(o)vs(l,!1);else{if(Yt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Cr(e),c!==null){for(t.flags|=128,vs(l,!1),e=c.updateQueue,t.updateQueue=e,Or(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)af(n,e),n=n.sibling;return _e($t,$t.current&1|2),it&&ji(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&he()>Yr&&(t.flags|=128,o=!0,vs(l,!1),t.lanes=4194304)}else{if(!o)if(e=Cr(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Or(t,e),vs(l,!0),l.tail===null&&l.tailMode==="hidden"&&!c.alternate&&!it)return _t(t),null}else 2*he()-l.renderingStartTime>Yr&&n!==536870912&&(t.flags|=128,o=!0,vs(l,!1),t.lanes=4194304);l.isBackwards?(c.sibling=t.child,t.child=c):(e=l.last,e!==null?e.sibling=c:t.child=c,l.last=c)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=he(),e.sibling=null,n=$t.current,_e($t,o?n&1|2:n&1),it&&ji(t,l.treeForkCount),e):(_t(t),null);case 22:case 23:return Kn(t),bc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(_t(t),t.subtreeFlags&6&&(t.flags|=8192)):_t(t),n=t.updateQueue,n!==null&&Or(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&je(ql),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Ft),_t(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function zy(e,t){switch(nc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Ft),qe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return gt(t),null;case 31:if(t.memoizedState!==null){if(Kn(t),t.alternate===null)throw Error(r(340));Gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Kn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return je($t),null;case 4:return qe(),null;case 10:return zi(t.type),null;case 22:case 23:return Kn(t),bc(),e!==null&&je(ql),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Ft),null;case 25:return null;default:return null}}function _h(e,t){switch(nc(t),t.tag){case 3:zi(Ft),qe();break;case 26:case 27:case 5:gt(t);break;case 4:qe();break;case 31:t.memoizedState!==null&&Kn(t);break;case 13:Kn(t);break;case 19:je($t);break;case 10:zi(t.type);break;case 22:case 23:Kn(t),bc(),e!==null&&je(ql);break;case 24:zi(Ft)}}function xs(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var o=l.next;n=o;do{if((n.tag&e)===e){l=void 0;var c=n.create,g=n.inst;l=c(),g.destroy=l}n=n.next}while(n!==o)}}catch(x){pt(t,t.return,x)}}function pl(e,t,n){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var c=o.next;l=c;do{if((l.tag&e)===e){var g=l.inst,x=g.destroy;if(x!==void 0){g.destroy=void 0,o=t;var C=n,j=x;try{j()}catch(q){pt(o,C,q)}}}l=l.next}while(l!==c)}}catch(q){pt(t,t.return,q)}}function jh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Cf(t,n)}catch(l){pt(e,e.return,l)}}}function Dh(e,t,n){n.props=Zl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){pt(e,t,l)}}function ws(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(o){pt(e,t,o)}}function bi(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(o){pt(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){pt(e,t,o)}else n.current=null}function zh(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(o){pt(e,e.return,o)}}function Pc(e,t,n){try{var l=e.stateNode;i0(l,e.type,n,t),l[tn]=t}catch(o){pt(e,e.return,o)}}function Oh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sl(e.type)||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oh(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&&Sl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qc(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wt));else if(l!==4&&(l===27&&Sl(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function Br(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&Sl(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Br(e,t,n),e=e.sibling;e!==null;)Br(e,t,n),e=e.sibling}function Bh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);fn(t,l,n),t[Lt]=e,t[tn]=n}catch(c){pt(e,e.return,c)}}var Ki=!1,Pt=!1,Wc=!1,Uh=typeof WeakSet=="function"?WeakSet:Set,an=null;function Oy(e,t){if(e=e.containerInfo,vu=lo,e=Pd(e),qo(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var o=l.anchorOffset,c=l.focusNode;l=l.focusOffset;try{n.nodeType,c.nodeType}catch{n=null;break e}var g=0,x=-1,C=-1,j=0,q=0,P=e,z=null;t:for(;;){for(var K;P!==n||o!==0&&P.nodeType!==3||(x=g+o),P!==c||l!==0&&P.nodeType!==3||(C=g+l),P.nodeType===3&&(g+=P.nodeValue.length),(K=P.firstChild)!==null;)z=P,P=K;for(;;){if(P===e)break t;if(z===n&&++j===o&&(x=g),z===c&&++q===l&&(C=g),(K=P.nextSibling)!==null)break;P=z,z=P.parentNode}P=K}n=x===-1||C===-1?null:{start:x,end:C}}else n=null}n=n||{start:0,end:0}}else n=null;for(xu={focusedElem:e,selectionRange:n},lo=!1,an=t;an!==null;)if(t=an,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,an=e;else for(;an!==null;){switch(t=an,c=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(n=0;n<e.length;n++)o=e[n],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,n=t,o=c.memoizedProps,c=c.memoizedState,l=n.stateNode;try{var ye=Zl(n.type,o);e=l.getSnapshotBeforeUpdate(ye,c),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ne){pt(n,n.return,Ne)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Cu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Cu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,an=e;break}an=t.return}}function Hh(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Gi(e,n),l&4&&xs(5,n);break;case 1:if(Gi(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){pt(n,n.return,g)}else{var o=Zl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){pt(n,n.return,g)}}l&64&&jh(n),l&512&&ws(n,n.return);break;case 3:if(Gi(e,n),l&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Cf(e,t)}catch(g){pt(n,n.return,g)}}break;case 27:t===null&&l&4&&Bh(n);case 26:case 5:Gi(e,n),t===null&&l&4&&zh(n),l&512&&ws(n,n.return);break;case 12:Gi(e,n);break;case 31:Gi(e,n),l&4&&Gh(e,n);break;case 13:Gi(e,n),l&4&&Ih(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qy.bind(null,n),d0(e,n))));break;case 22:if(l=n.memoizedState!==null||Ki,!l){t=t!==null&&t.memoizedState!==null||Pt,o=Ki;var c=Pt;Ki=l,(Pt=t)&&!c?Ii(e,n,(n.subtreeFlags&8772)!==0):Gi(e,n),Ki=o,Pt=c}break;case 30:break;default:Gi(e,n)}}function Kh(e){var t=e.alternate;t!==null&&(e.alternate=null,Kh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Li(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 Ot=null,En=!1;function Yi(e,t,n){for(n=n.child;n!==null;)Yh(e,t,n),n=n.sibling}function Yh(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Zt,n)}catch{}switch(n.tag){case 26:Pt||bi(n,t),Yi(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Pt||bi(n,t);var l=Ot,o=En;Sl(n.type)&&(Ot=n.stateNode,En=!1),Yi(e,t,n),ks(n.stateNode),Ot=l,En=o;break;case 5:Pt||bi(n,t);case 6:if(l=Ot,o=En,Ot=null,Yi(e,t,n),Ot=l,En=o,Ot!==null)if(En)try{(Ot.nodeType===9?Ot.body:Ot.nodeName==="HTML"?Ot.ownerDocument.body:Ot).removeChild(n.stateNode)}catch(c){pt(n,t,c)}else try{Ot.removeChild(n.stateNode)}catch(c){pt(n,t,c)}break;case 18:Ot!==null&&(En?(e=Ot,jm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ha(e)):jm(Ot,n.stateNode));break;case 4:l=Ot,o=En,Ot=n.stateNode.containerInfo,En=!0,Yi(e,t,n),Ot=l,En=o;break;case 0:case 11:case 14:case 15:pl(2,n,t),Pt||pl(4,n,t),Yi(e,t,n);break;case 1:Pt||(bi(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Dh(n,t,l)),Yi(e,t,n);break;case 21:Yi(e,t,n);break;case 22:Pt=(l=Pt)||n.memoizedState!==null,Yi(e,t,n),Pt=l;break;default:Yi(e,t,n)}}function Gh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ha(e)}catch(n){pt(t,t.return,n)}}}function Ih(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ha(e)}catch(n){pt(t,t.return,n)}}function By(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Uh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Uh),t;default:throw Error(r(435,e.tag))}}function Ur(e,t){var n=By(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var o=Fy.bind(null,e,l);l.then(o,o)}})}function Nn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var o=n[l],c=e,g=t,x=g;e:for(;x!==null;){switch(x.tag){case 27:if(Sl(x.type)){Ot=x.stateNode,En=!1;break e}break;case 5:Ot=x.stateNode,En=!1;break e;case 3:case 4:Ot=x.stateNode.containerInfo,En=!0;break e}x=x.return}if(Ot===null)throw Error(r(160));Yh(c,g,o),Ot=null,En=!1,c=o.alternate,c!==null&&(c.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)$h(t,e),t=t.sibling}var si=null;function $h(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Nn(t,e),Ln(e),l&4&&(pl(3,e,e.return),xs(3,e),pl(5,e,e.return));break;case 1:Nn(t,e),Ln(e),l&512&&(Pt||n===null||bi(n,n.return)),l&64&&Ki&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var o=si;if(Nn(t,e),Ln(e),l&512&&(Pt||n===null||bi(n,n.return)),l&4){var c=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,o=o.ownerDocument||o;t:switch(l){case"title":c=o.getElementsByTagName("title")[0],(!c||c[$n]||c[Lt]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=o.createElement(l),o.head.insertBefore(c,o.querySelector("head > title"))),fn(c,l,n),c[Lt]=e,pe(c),l=c;break e;case"link":var g=$m("link","href",o).get(l+(n.href||""));if(g){for(var x=0;x<g.length;x++)if(c=g[x],c.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&c.getAttribute("rel")===(n.rel==null?null:n.rel)&&c.getAttribute("title")===(n.title==null?null:n.title)&&c.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){g.splice(x,1);break t}}c=o.createElement(l),fn(c,l,n),o.head.appendChild(c);break;case"meta":if(g=$m("meta","content",o).get(l+(n.content||""))){for(x=0;x<g.length;x++)if(c=g[x],c.getAttribute("content")===(n.content==null?null:""+n.content)&&c.getAttribute("name")===(n.name==null?null:n.name)&&c.getAttribute("property")===(n.property==null?null:n.property)&&c.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&c.getAttribute("charset")===(n.charSet==null?null:n.charSet)){g.splice(x,1);break t}}c=o.createElement(l),fn(c,l,n),o.head.appendChild(c);break;default:throw Error(r(468,l))}c[Lt]=e,pe(c),l=c}e.stateNode=l}else qm(o,e.type,e.stateNode);else e.stateNode=Im(o,l,e.memoizedProps);else c!==l?(c===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):c.count--,l===null?qm(o,e.type,e.stateNode):Im(o,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Pc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Nn(t,e),Ln(e),l&512&&(Pt||n===null||bi(n,n.return)),n!==null&&l&4&&Pc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Nn(t,e),Ln(e),l&512&&(Pt||n===null||bi(n,n.return)),e.flags&32){o=e.stateNode;try{il(o,"")}catch(ye){pt(e,e.return,ye)}}l&4&&e.stateNode!=null&&(o=e.memoizedProps,Pc(e,o,n!==null?n.memoizedProps:o)),l&1024&&(Wc=!0);break;case 6:if(Nn(t,e),Ln(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(ye){pt(e,e.return,ye)}}break;case 3:if(eo=null,o=si,si=Wr(t.containerInfo),Nn(t,e),si=o,Ln(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Ha(t.containerInfo)}catch(ye){pt(e,e.return,ye)}Wc&&(Wc=!1,qh(e));break;case 4:l=si,si=Wr(e.stateNode.containerInfo),Nn(t,e),Ln(e),si=l;break;case 12:Nn(t,e),Ln(e);break;case 31:Nn(t,e),Ln(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ur(e,l)));break;case 13:Nn(t,e),Ln(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Kr=he()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ur(e,l)));break;case 22:o=e.memoizedState!==null;var C=n!==null&&n.memoizedState!==null,j=Ki,q=Pt;if(Ki=j||o,Pt=q||C,Nn(t,e),Pt=q,Ki=j,Ln(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(n===null||C||Ki||Pt||Ql(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){C=n=t;try{if(c=C.stateNode,o)g=c.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{x=C.stateNode;var P=C.memoizedProps.style,z=P!=null&&P.hasOwnProperty("display")?P.display:null;x.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ye){pt(C,C.return,ye)}}}else if(t.tag===6){if(n===null){C=t;try{C.stateNode.nodeValue=o?"":C.memoizedProps}catch(ye){pt(C,C.return,ye)}}}else if(t.tag===18){if(n===null){C=t;try{var K=C.stateNode;o?Dm(K,!0):Dm(C.stateNode,!1)}catch(ye){pt(C,C.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;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,Ur(e,n))));break;case 19:Nn(t,e),Ln(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ur(e,l)));break;case 30:break;case 21:break;default:Nn(t,e),Ln(e)}}function Ln(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Oh(l)){n=l;break}l=l.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var o=n.stateNode,c=Zc(e);Br(e,c,o);break;case 5:var g=n.stateNode;n.flags&32&&(il(g,""),n.flags&=-33);var x=Zc(e);Br(e,x,g);break;case 3:case 4:var C=n.stateNode.containerInfo,j=Zc(e);Qc(e,j,C);break;default:throw Error(r(161))}}catch(q){pt(e,e.return,q)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Gi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Hh(e,t.alternate,t),t=t.sibling}function Ql(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:pl(4,t,t.return),Ql(t);break;case 1:bi(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Dh(t,t.return,n),Ql(t);break;case 27:ks(t.stateNode);case 26:case 5:bi(t,t.return),Ql(t);break;case 22:t.memoizedState===null&&Ql(t);break;case 30:Ql(t);break;default:Ql(t)}e=e.sibling}}function Ii(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,o=e,c=t,g=c.flags;switch(c.tag){case 0:case 11:case 15:Ii(o,c,n),xs(4,c);break;case 1:if(Ii(o,c,n),l=c,o=l.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(j){pt(l,l.return,j)}if(l=c,o=l.updateQueue,o!==null){var x=l.stateNode;try{var C=o.shared.hiddenCallbacks;if(C!==null)for(o.shared.hiddenCallbacks=null,o=0;o<C.length;o++)Sf(C[o],x)}catch(j){pt(l,l.return,j)}}n&&g&64&&jh(c),ws(c,c.return);break;case 27:Bh(c);case 26:case 5:Ii(o,c,n),n&&l===null&&g&4&&zh(c),ws(c,c.return);break;case 12:Ii(o,c,n);break;case 31:Ii(o,c,n),n&&g&4&&Gh(o,c);break;case 13:Ii(o,c,n),n&&g&4&&Ih(o,c);break;case 22:c.memoizedState===null&&Ii(o,c,n),ws(c,c.return);break;case 30:break;default:Ii(o,c,n)}t=t.sibling}}function Jc(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&rs(n))}function eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&rs(e))}function ri(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Fh(e,t,n,l),t=t.sibling}function Fh(e,t,n,l){var o=t.flags;switch(t.tag){case 0:case 11:case 15:ri(e,t,n,l),o&2048&&xs(9,t);break;case 1:ri(e,t,n,l);break;case 3:ri(e,t,n,l),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&rs(e)));break;case 12:if(o&2048){ri(e,t,n,l),e=t.stateNode;try{var c=t.memoizedProps,g=c.id,x=c.onPostCommit;typeof x=="function"&&x(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(C){pt(t,t.return,C)}}else ri(e,t,n,l);break;case 31:ri(e,t,n,l);break;case 13:ri(e,t,n,l);break;case 23:break;case 22:c=t.stateNode,g=t.alternate,t.memoizedState!==null?c._visibility&2?ri(e,t,n,l):Ss(e,t):c._visibility&2?ri(e,t,n,l):(c._visibility|=2,Na(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),o&2048&&Jc(g,t);break;case 24:ri(e,t,n,l),o&2048&&eu(t.alternate,t);break;default:ri(e,t,n,l)}}function Na(e,t,n,l,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,g=t,x=n,C=l,j=g.flags;switch(g.tag){case 0:case 11:case 15:Na(c,g,x,C,o),xs(8,g);break;case 23:break;case 22:var q=g.stateNode;g.memoizedState!==null?q._visibility&2?Na(c,g,x,C,o):Ss(c,g):(q._visibility|=2,Na(c,g,x,C,o)),o&&j&2048&&Jc(g.alternate,g);break;case 24:Na(c,g,x,C,o),o&&j&2048&&eu(g.alternate,g);break;default:Na(c,g,x,C,o)}t=t.sibling}}function Ss(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,o=l.flags;switch(l.tag){case 22:Ss(n,l),o&2048&&Jc(l.alternate,l);break;case 24:Ss(n,l),o&2048&&eu(l.alternate,l);break;default:Ss(n,l)}t=t.sibling}}var Cs=8192;function La(e,t,n){if(e.subtreeFlags&Cs)for(e=e.child;e!==null;)Vh(e,t,n),e=e.sibling}function Vh(e,t,n){switch(e.tag){case 26:La(e,t,n),e.flags&Cs&&e.memoizedState!==null&&C0(n,si,e.memoizedState,e.memoizedProps);break;case 5:La(e,t,n);break;case 3:case 4:var l=si;si=Wr(e.stateNode.containerInfo),La(e,t,n),si=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Cs,Cs=16777216,La(e,t,n),Cs=l):La(e,t,n));break;default:La(e,t,n)}}function Xh(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 Ts(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];an=l,Zh(l,e)}Xh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ph(e),e=e.sibling}function Ph(e){switch(e.tag){case 0:case 11:case 15:Ts(e),e.flags&2048&&pl(9,e,e.return);break;case 3:Ts(e);break;case 12:Ts(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hr(e)):Ts(e);break;default:Ts(e)}}function Hr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];an=l,Zh(l,e)}Xh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:pl(8,t,t.return),Hr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hr(t));break;default:Hr(t)}e=e.sibling}}function Zh(e,t){for(;an!==null;){var n=an;switch(n.tag){case 0:case 11:case 15:pl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:rs(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,an=l;else e:for(n=e;an!==null;){l=an;var o=l.sibling,c=l.return;if(Kh(l),l===n){an=null;break e}if(o!==null){o.return=c,an=o;break e}an=c}}}var Uy={getCacheForType:function(e){var t=un(Ft),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return un(Ft).controller.signal}},Hy=typeof WeakMap=="function"?WeakMap:Map,ct=0,Mt=null,We=null,tt=0,mt=0,Yn=null,gl=!1,ka=!1,tu=!1,$i=0,Yt=0,bl=0,Wl=0,nu=0,Gn=0,Ra=0,Ms=null,kn=null,iu=!1,Kr=0,Qh=0,Yr=1/0,Gr=null,yl=null,Jt=0,vl=null,_a=null,qi=0,lu=0,au=null,Wh=null,As=0,su=null;function In(){return(ct&2)!==0&&tt!==0?tt&-tt:L.T!==null?fu():Ei()}function Jh(){if(Gn===0)if((tt&536870912)===0||it){var e=bt;bt<<=1,(bt&3932160)===0&&(bt=262144),Gn=e}else Gn=536870912;return e=Hn.current,e!==null&&(e.flags|=32),Gn}function Rn(e,t,n){(e===Mt&&(mt===2||mt===9)||e.cancelPendingCommit!==null)&&(ja(e,0),xl(e,tt,Gn,!1)),An(e,n),((ct&2)===0||e!==Mt)&&(e===Mt&&((ct&2)===0&&(Wl|=n),Yt===4&&xl(e,tt,Gn,!1)),yi(e))}function em(e,t,n){if((ct&6)!==0)throw Error(r(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||fi(e,t),o=l?Gy(e,t):ou(e,t,!0),c=l;do{if(o===0){ka&&!l&&xl(e,t,0,!1);break}else{if(n=e.current.alternate,c&&!Ky(n)){o=ou(e,t,!1),c=!1;continue}if(o===2){if(c=t,e.errorRecoveryDisabledLanes&c)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var x=e;o=Ms;var C=x.current.memoizedState.isDehydrated;if(C&&(ja(x,g).flags|=256),g=ou(x,g,!1),g!==2){if(tu&&!C){x.errorRecoveryDisabledLanes|=c,Wl|=c,o=4;break e}c=kn,kn=o,c!==null&&(kn===null?kn=c:kn.push.apply(kn,c))}o=g}if(c=!1,o!==2)continue}}if(o===1){ja(e,0),xl(e,t,0,!0);break}e:{switch(l=e,c=o,c){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:xl(l,t,Gn,!gl);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(o=Kr+300-he(),10<o)){if(xl(l,t,Gn,!gl),Mi(l,0,!0)!==0)break e;qi=t,l.timeoutHandle=Rm(tm.bind(null,l,n,kn,Gr,iu,t,Gn,Wl,Ra,gl,c,"Throttled",-0,0),o);break e}tm(l,n,kn,Gr,iu,t,Gn,Wl,Ra,gl,c,null,-0,0)}}break}while(!0);yi(e)}function tm(e,t,n,l,o,c,g,x,C,j,q,P,z,K){if(e.timeoutHandle=-1,P=t.subtreeFlags,P&8192||(P&16785408)===16785408){P={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wt},Vh(t,c,P);var ye=(c&62914560)===c?Kr-he():(c&4194048)===c?Qh-he():0;if(ye=T0(P,ye),ye!==null){qi=c,e.cancelPendingCommit=ye(cm.bind(null,e,t,c,n,l,o,g,x,C,q,P,null,z,K)),xl(e,c,g,!j);return}}cm(e,t,c,n,l,o,g,x,C)}function Ky(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var o=n[l],c=o.getSnapshot;o=o.value;try{if(!Bn(c(),o))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 xl(e,t,n,l){t&=~nu,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var o=t;0<o;){var c=31-zt(o),g=1<<c;l[c]=-1,o&=~g}n!==0&&ra(e,n,t)}function Ir(){return(ct&6)===0?(Es(0),!1):!0}function ru(){if(We!==null){if(mt===0)var e=We.return;else e=We,Di=Il=null,Cc(e),Ca=null,cs=0,e=We;for(;e!==null;)_h(e.alternate,e),e=e.return;We=null}}function ja(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,s0(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),qi=0,ru(),Mt=e,We=n=_i(e.current,null),tt=t,mt=0,Yn=null,gl=!1,ka=fi(e,t),tu=!1,Ra=Gn=nu=Wl=bl=Yt=0,kn=Ms=null,iu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var o=31-zt(l),c=1<<o;t|=e[o],l&=~c}return $i=t,ur(),n}function nm(e,t){Ue=null,L.H=bs,t===Sa||t===yr?(t=yf(),mt=3):t===dc?(t=yf(),mt=4):mt=t===Hc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Yn=t,We===null&&(Yt=1,_r(e,Pn(t,e.current)))}function im(){var e=Hn.current;return e===null?!0:(tt&4194048)===tt?Jn===null:(tt&62914560)===tt||(tt&536870912)!==0?e===Jn:!1}function lm(){var e=L.H;return L.H=bs,e===null?bs:e}function am(){var e=L.A;return L.A=Uy,e}function $r(){Yt=4,gl||(tt&4194048)!==tt&&Hn.current!==null||(ka=!0),(bl&134217727)===0&&(Wl&134217727)===0||Mt===null||xl(Mt,tt,Gn,!1)}function ou(e,t,n){var l=ct;ct|=2;var o=lm(),c=am();(Mt!==e||tt!==t)&&(Gr=null,ja(e,t)),t=!1;var g=Yt;e:do try{if(mt!==0&&We!==null){var x=We,C=Yn;switch(mt){case 8:ru(),g=6;break e;case 3:case 2:case 9:case 6:Hn.current===null&&(t=!0);var j=mt;if(mt=0,Yn=null,Da(e,x,C,j),n&&ka){g=0;break e}break;default:j=mt,mt=0,Yn=null,Da(e,x,C,j)}}Yy(),g=Yt;break}catch(q){nm(e,q)}while(!0);return t&&e.shellSuspendCounter++,Di=Il=null,ct=l,L.H=o,L.A=c,We===null&&(Mt=null,tt=0,ur()),g}function Yy(){for(;We!==null;)sm(We)}function Gy(e,t){var n=ct;ct|=2;var l=lm(),o=am();Mt!==e||tt!==t?(Gr=null,Yr=he()+500,ja(e,t)):ka=fi(e,t);e:do try{if(mt!==0&&We!==null){t=We;var c=Yn;t:switch(mt){case 1:mt=0,Yn=null,Da(e,t,c,1);break;case 2:case 9:if(gf(c)){mt=0,Yn=null,rm(t);break}t=function(){mt!==2&&mt!==9||Mt!==e||(mt=7),yi(e)},c.then(t,t);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:gf(c)?(mt=0,Yn=null,rm(t)):(mt=0,Yn=null,Da(e,t,c,7));break;case 5:var g=null;switch(We.tag){case 26:g=We.memoizedState;case 5:case 27:var x=We;if(g?Fm(g):x.stateNode.complete){mt=0,Yn=null;var C=x.sibling;if(C!==null)We=C;else{var j=x.return;j!==null?(We=j,qr(j)):We=null}break t}}mt=0,Yn=null,Da(e,t,c,5);break;case 6:mt=0,Yn=null,Da(e,t,c,6);break;case 8:ru(),Yt=6;break e;default:throw Error(r(462))}}Iy();break}catch(q){nm(e,q)}while(!0);return Di=Il=null,L.H=l,L.A=o,ct=n,We!==null?0:(Mt=null,tt=0,ur(),Yt)}function Iy(){for(;We!==null&&!at();)sm(We)}function sm(e){var t=kh(e.alternate,e,$i);e.memoizedProps=e.pendingProps,t===null?qr(e):We=t}function rm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Th(n,t,t.pendingProps,t.type,void 0,tt);break;case 11:t=Th(n,t,t.pendingProps,t.type.render,t.ref,tt);break;case 5:Cc(t);default:_h(n,t),t=We=af(t,$i),t=kh(n,t,$i)}e.memoizedProps=e.pendingProps,t===null?qr(e):We=t}function Da(e,t,n,l){Di=Il=null,Cc(t),Ca=null,cs=0;var o=t.return;try{if(Ry(e,o,t,n,tt)){Yt=1,_r(e,Pn(n,e.current)),We=null;return}}catch(c){if(o!==null)throw We=o,c;Yt=1,_r(e,Pn(n,e.current)),We=null;return}t.flags&32768?(it||l===1?e=!0:ka||(tt&536870912)!==0?e=!1:(gl=e=!0,(l===2||l===9||l===3||l===6)&&(l=Hn.current,l!==null&&l.tag===13&&(l.flags|=16384))),om(t,e)):qr(t)}function qr(e){var t=e;do{if((t.flags&32768)!==0){om(t,gl);return}e=t.return;var n=Dy(t.alternate,t,$i);if(n!==null){We=n;return}if(t=t.sibling,t!==null){We=t;return}We=t=e}while(t!==null);Yt===0&&(Yt=5)}function om(e,t){do{var n=zy(e.alternate,e);if(n!==null){n.flags&=32767,We=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){We=e;return}We=e=n}while(e!==null);Yt=6,We=null}function cm(e,t,n,l,o,c,g,x,C){e.cancelPendingCommit=null;do Fr();while(Jt!==0);if((ct&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(c=t.lanes|t.childLanes,c|=Zo,Ai(e,n,c,g,x,C),e===Mt&&(We=Mt=null,tt=0),_a=t,vl=e,qi=n,lu=c,au=o,Wh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Vy(Dt,function(){return mm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=L.T,L.T=null,o=$.p,$.p=2,g=ct,ct|=4;try{Oy(e,t,n)}finally{ct=g,$.p=o,L.T=l}}Jt=1,um(),dm(),fm()}}function um(){if(Jt===1){Jt=0;var e=vl,t=_a,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=L.T,L.T=null;var l=$.p;$.p=2;var o=ct;ct|=4;try{$h(t,e);var c=xu,g=Pd(e.containerInfo),x=c.focusedElem,C=c.selectionRange;if(g!==x&&x&&x.ownerDocument&&Xd(x.ownerDocument.documentElement,x)){if(C!==null&&qo(x)){var j=C.start,q=C.end;if(q===void 0&&(q=j),"selectionStart"in x)x.selectionStart=j,x.selectionEnd=Math.min(q,x.value.length);else{var P=x.ownerDocument||document,z=P&&P.defaultView||window;if(z.getSelection){var K=z.getSelection(),ye=x.textContent.length,Ne=Math.min(C.start,ye),xt=C.end===void 0?Ne:Math.min(C.end,ye);!K.extend&&Ne>xt&&(g=xt,xt=Ne,Ne=g);var R=Vd(x,Ne),M=Vd(x,xt);if(R&&M&&(K.rangeCount!==1||K.anchorNode!==R.node||K.anchorOffset!==R.offset||K.focusNode!==M.node||K.focusOffset!==M.offset)){var _=P.createRange();_.setStart(R.node,R.offset),K.removeAllRanges(),Ne>xt?(K.addRange(_),K.extend(M.node,M.offset)):(_.setEnd(M.node,M.offset),K.addRange(_))}}}}for(P=[],K=x;K=K.parentNode;)K.nodeType===1&&P.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<P.length;x++){var V=P[x];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}lo=!!vu,xu=vu=null}finally{ct=o,$.p=l,L.T=n}}e.current=t,Jt=2}}function dm(){if(Jt===2){Jt=0;var e=vl,t=_a,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=L.T,L.T=null;var l=$.p;$.p=2;var o=ct;ct|=4;try{Hh(e,t.alternate,t)}finally{ct=o,$.p=l,L.T=n}}Jt=3}}function fm(){if(Jt===4||Jt===3){Jt=0,Et();var e=vl,t=_a,n=qi,l=Wh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Jt=5:(Jt=0,_a=vl=null,hm(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(yl=null),Wi(n),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(Zt,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=L.T,o=$.p,$.p=2,L.T=null;try{for(var c=e.onRecoverableError,g=0;g<l.length;g++){var x=l[g];c(x.value,{componentStack:x.stack})}}finally{L.T=t,$.p=o}}(qi&3)!==0&&Fr(),yi(e),o=e.pendingLanes,(n&261930)!==0&&(o&42)!==0?e===su?As++:(As=0,su=e):As=0,Es(0)}}function hm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,rs(t)))}function Fr(){return um(),dm(),fm(),mm()}function mm(){if(Jt!==5)return!1;var e=vl,t=lu;lu=0;var n=Wi(qi),l=L.T,o=$.p;try{$.p=32>n?32:n,L.T=null,n=au,au=null;var c=vl,g=qi;if(Jt=0,_a=vl=null,qi=0,(ct&6)!==0)throw Error(r(331));var x=ct;if(ct|=4,Ph(c.current),Fh(c,c.current,g,n),ct=x,Es(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(Zt,c)}catch{}return!0}finally{$.p=o,L.T=l,hm(e,t)}}function pm(e,t,n){t=Pn(n,t),t=Uc(e.stateNode,t,2),e=fl(e,t,2),e!==null&&(An(e,2),yi(e))}function pt(e,t,n){if(e.tag===3)pm(e,e,n);else for(;t!==null;){if(t.tag===3){pm(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(yl===null||!yl.has(l))){e=Pn(n,e),n=gh(2),l=fl(t,n,2),l!==null&&(bh(n,l,t,e),An(l,2),yi(l));break}}t=t.return}}function cu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new Hy;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(n)||(tu=!0,o.add(n),e=$y.bind(null,e,t,n),t.then(e,e))}function $y(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Mt===e&&(tt&n)===n&&(Yt===4||Yt===3&&(tt&62914560)===tt&&300>he()-Kr?(ct&2)===0&&ja(e,0):nu|=n,Ra===tt&&(Ra=0)),yi(e)}function gm(e,t){t===0&&(t=Dn()),e=Kl(e,t),e!==null&&(An(e,t),yi(e))}function qy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gm(e,n)}function Fy(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),gm(e,n)}function Vy(e,t){return Ve(e,t)}var Vr=null,za=null,uu=!1,Xr=!1,du=!1,wl=0;function yi(e){e!==za&&e.next===null&&(za===null?Vr=za=e:za=za.next=e),Xr=!0,uu||(uu=!0,Py())}function Es(e,t){if(!du&&Xr){du=!0;do for(var n=!1,l=Vr;l!==null;){if(e!==0){var o=l.pendingLanes;if(o===0)var c=0;else{var g=l.suspendedLanes,x=l.pingedLanes;c=(1<<31-zt(42|e)+1)-1,c&=o&~(g&~x),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(n=!0,xm(l,c))}else c=tt,c=Mi(l,l===Mt?c:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(c&3)===0||fi(l,c)||(n=!0,xm(l,c));l=l.next}while(n);du=!1}}function Xy(){bm()}function bm(){Xr=uu=!1;var e=0;wl!==0&&a0()&&(e=wl);for(var t=he(),n=null,l=Vr;l!==null;){var o=l.next,c=ym(l,t);c===0?(l.next=null,n===null?Vr=o:n.next=o,o===null&&(za=n)):(n=l,(e!==0||(c&3)!==0)&&(Xr=!0)),l=o}Jt!==0&&Jt!==5||Es(e),wl!==0&&(wl=0)}function ym(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var g=31-zt(c),x=1<<g,C=o[g];C===-1?((x&n)===0||(x&l)!==0)&&(o[g]=_l(x,t)):C<=t&&(e.expiredLanes|=x),c&=~x}if(t=Mt,n=tt,n=Mi(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(mt===2||mt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&<(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||fi(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&<(l),Wi(n)){case 2:case 8:n=dt;break;case 32:n=Dt;break;case 268435456:n=Bt;break;default:n=Dt}return l=vm.bind(null,e),n=Ve(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&<(l),e.callbackPriority=2,e.callbackNode=null,2}function vm(e,t){if(Jt!==0&&Jt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Fr()&&e.callbackNode!==n)return null;var l=tt;return l=Mi(e,e===Mt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(em(e,l,t),ym(e,he()),e.callbackNode!=null&&e.callbackNode===n?vm.bind(null,e):null)}function xm(e,t){if(Fr())return null;em(e,t,!0)}function Py(){r0(function(){(ct&6)!==0?Ve(Fe,Xy):bm()})}function fu(){if(wl===0){var e=xa;e===0&&(e=Ci,Ci<<=1,(Ci&261888)===0&&(Ci=256)),wl=e}return wl}function wm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:mi(""+e)}function Sm(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Zy(e,t,n,l,o){if(t==="submit"&&n&&n.stateNode===o){var c=wm((o[tn]||null).action),g=l.submitter;g&&(t=(t=g[tn]||null)?wm(t.formAction):g.getAttribute("formAction"),t!==null&&(c=t,g=null));var x=new Vn("action","action",null,l,o);e.push({event:x,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(wl!==0){var C=g?Sm(o,g):new FormData(o);_c(n,{pending:!0,data:C,method:o.method,action:c},null,C)}}else typeof c=="function"&&(x.preventDefault(),C=g?Sm(o,g):new FormData(o),_c(n,{pending:!0,data:C,method:o.method,action:c},c,C))},currentTarget:o}]})}}for(var hu=0;hu<Po.length;hu++){var mu=Po[hu],Qy=mu.toLowerCase(),Wy=mu[0].toUpperCase()+mu.slice(1);ai(Qy,"on"+Wy)}ai(Wd,"onAnimationEnd"),ai(Jd,"onAnimationIteration"),ai(ef,"onAnimationStart"),ai("dblclick","onDoubleClick"),ai("focusin","onFocus"),ai("focusout","onBlur"),ai(my,"onTransitionRun"),ai(py,"onTransitionStart"),ai(gy,"onTransitionCancel"),ai(tf,"onTransitionEnd"),St("onMouseEnter",["mouseout","mouseover"]),St("onMouseLeave",["mouseout","mouseover"]),St("onPointerEnter",["pointerout","pointerover"]),St("onPointerLeave",["pointerout","pointerover"]),It("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),It("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),It("onBeforeInput",["compositionend","keypress","textInput","paste"]),It("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),It("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),It("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ns="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(" "),Jy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ns));function Cm(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],o=l.event;l=l.listeners;e:{var c=void 0;if(t)for(var g=l.length-1;0<=g;g--){var x=l[g],C=x.instance,j=x.currentTarget;if(x=x.listener,C!==c&&o.isPropagationStopped())break e;c=x,o.currentTarget=j;try{c(o)}catch(q){cr(q)}o.currentTarget=null,c=C}else for(g=0;g<l.length;g++){if(x=l[g],C=x.instance,j=x.currentTarget,x=x.listener,C!==c&&o.isPropagationStopped())break e;c=x,o.currentTarget=j;try{c(o)}catch(q){cr(q)}o.currentTarget=null,c=C}}}}function Je(e,t){var n=t[zl];n===void 0&&(n=t[zl]=new Set);var l=e+"__bubble";n.has(l)||(Tm(t,e,2,!1),n.add(l))}function pu(e,t,n){var l=0;t&&(l|=4),Tm(n,e,l,t)}var Pr="_reactListening"+Math.random().toString(36).slice(2);function gu(e){if(!e[Pr]){e[Pr]=!0,ze.forEach(function(n){n!=="selectionchange"&&(Jy.has(n)||pu(n,!1,e),pu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Pr]||(t[Pr]=!0,pu("selectionchange",!1,t))}}function Tm(e,t,n,l){switch(Jm(t)){case 2:var o=E0;break;case 8:o=N0;break;default:o=Ru}n=o.bind(null,t,n,e),o=void 0,!oe||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function bu(e,t,n,l,o){var c=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var g=l.tag;if(g===3||g===4){var x=l.stateNode.containerInfo;if(x===o)break;if(g===4)for(g=l.return;g!==null;){var C=g.tag;if((C===3||C===4)&&g.stateNode.containerInfo===o)return;g=g.return}for(;x!==null;){if(g=D(x),g===null)return;if(C=g.tag,C===5||C===6||C===26||C===27){l=c=g;continue e}x=x.parentNode}}l=l.return}Wa(function(){var j=c,q=ca(n),P=[];e:{var z=nf.get(e);if(z!==void 0){var K=Vn,ye=e;switch(e){case"keypress":if(ln(n)===0)break e;case"keydown":case"keyup":K=Fb;break;case"focusin":ye="focus",K=Ko;break;case"focusout":ye="blur",K=Ko;break;case"beforeblur":case"afterblur":K=Ko;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=Rd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Db;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Pb;break;case Wd:case Jd:case ef:K=Bb;break;case tf:K=Qb;break;case"scroll":case"scrollend":K=_b;break;case"wheel":K=Jb;break;case"copy":case"cut":case"paste":K=Hb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=jd;break;case"toggle":case"beforetoggle":K=ty}var Ne=(t&4)!==0,xt=!Ne&&(e==="scroll"||e==="scrollend"),R=Ne?z!==null?z+"Capture":null:z;Ne=[];for(var M=j,_;M!==null;){var V=M;if(_=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||_===null||R===null||(V=ll(M,R),V!=null&&Ne.push(Ls(M,V,_))),xt)break;M=M.return}0<Ne.length&&(z=new K(z,ye,null,n,q),P.push({event:z,listeners:Ne}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",z&&n!==oa&&(ye=n.relatedTarget||n.fromElement)&&(D(ye)||ye[hi]))break e;if((K||z)&&(z=q.window===q?q:(z=q.ownerDocument)?z.defaultView||z.parentWindow:window,K?(ye=n.relatedTarget||n.toElement,K=j,ye=ye?D(ye):null,ye!==null&&(xt=d(ye),Ne=ye.tag,ye!==xt||Ne!==5&&Ne!==27&&Ne!==6)&&(ye=null)):(K=null,ye=j),K!==ye)){if(Ne=Rd,V="onMouseLeave",R="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=jd,V="onPointerLeave",R="onPointerEnter",M="pointer"),xt=K==null?z:de(K),_=ye==null?z:de(ye),z=new Ne(V,M+"leave",K,n,q),z.target=xt,z.relatedTarget=_,V=null,D(q)===j&&(Ne=new Ne(R,M+"enter",ye,n,q),Ne.target=_,Ne.relatedTarget=xt,V=Ne),xt=V,K&&ye)t:{for(Ne=e0,R=K,M=ye,_=0,V=R;V;V=Ne(V))_++;V=0;for(var Ae=M;Ae;Ae=Ne(Ae))V++;for(;0<_-V;)R=Ne(R),_--;for(;0<V-_;)M=Ne(M),V--;for(;_--;){if(R===M||M!==null&&R===M.alternate){Ne=R;break t}R=Ne(R),M=Ne(M)}Ne=null}else Ne=null;K!==null&&Mm(P,z,K,Ne,!1),ye!==null&&xt!==null&&Mm(P,xt,ye,Ne,!0)}}e:{if(z=j?de(j):window,K=z.nodeName&&z.nodeName.toLowerCase(),K==="select"||K==="input"&&z.type==="file")var rt=Yd;else if(Hd(z))if(Gd)rt=dy;else{rt=cy;var we=oy}else K=z.nodeName,!K||K.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?j&&gn(j.elementType)&&(rt=Yd):rt=uy;if(rt&&(rt=rt(e,j))){Kd(P,rt,n,q);break e}we&&we(e,z,j),e==="focusout"&&j&&z.type==="number"&&j.memoizedProps.value!=null&&Qa(z,"number",z.value)}switch(we=j?de(j):window,e){case"focusin":(Hd(we)||we.contentEditable==="true")&&(fa=we,Fo=j,ls=null);break;case"focusout":ls=Fo=fa=null;break;case"mousedown":Vo=!0;break;case"contextmenu":case"mouseup":case"dragend":Vo=!1,Zd(P,n,q);break;case"selectionchange":if(hy)break;case"keydown":case"keyup":Zd(P,n,q)}var Ke;if(Go)e:{switch(e){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else da?Bd(e,n)&&(nt="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(nt="onCompositionStart");nt&&(Dd&&n.locale!=="ko"&&(da||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&da&&(Ke=Me()):(Tt=q,bn="value"in Tt?Tt.value:Tt.textContent,da=!0)),we=Zr(j,nt),0<we.length&&(nt=new _d(nt,e,null,n,q),P.push({event:nt,listeners:we}),Ke?nt.data=Ke:(Ke=Ud(n),Ke!==null&&(nt.data=Ke)))),(Ke=iy?ly(e,n):ay(e,n))&&(nt=Zr(j,"onBeforeInput"),0<nt.length&&(we=new _d("onBeforeInput","beforeinput",null,n,q),P.push({event:we,listeners:nt}),we.data=Ke)),Zy(P,e,j,n,q)}Cm(P,t)})}function Ls(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Zr(e,t){for(var n=t+"Capture",l=[];e!==null;){var o=e,c=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||c===null||(o=ll(e,n),o!=null&&l.unshift(Ls(e,o,c)),o=ll(e,t),o!=null&&l.push(Ls(e,o,c))),e.tag===3)return l;e=e.return}return[]}function e0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Mm(e,t,n,l,o){for(var c=t._reactName,g=[];n!==null&&n!==l;){var x=n,C=x.alternate,j=x.stateNode;if(x=x.tag,C!==null&&C===l)break;x!==5&&x!==26&&x!==27||j===null||(C=j,o?(j=ll(n,c),j!=null&&g.unshift(Ls(n,j,C))):o||(j=ll(n,c),j!=null&&g.push(Ls(n,j,C)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var t0=/\r\n?/g,n0=/\u0000|\uFFFD/g;function Am(e){return(typeof e=="string"?e:""+e).replace(t0,`
|
|
33
|
+
`).replace(n0,"")}function Em(e,t){return t=Am(t),Am(e)===t}function vt(e,t,n,l,o,c){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||il(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&il(e,""+l);break;case"className":He(e,"class",l);break;case"tabIndex":He(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":He(e,n,l);break;case"style":sr(e,l,c);break;case"data":if(t!=="object"){He(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=mi(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"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 c=="function"&&(n==="formAction"?(t!=="input"&&vt(e,t,"name",o.name,o,null),vt(e,t,"formEncType",o.formEncType,o,null),vt(e,t,"formMethod",o.formMethod,o,null),vt(e,t,"formTarget",o.formTarget,o,null)):(vt(e,t,"encType",o.encType,o,null),vt(e,t,"method",o.method,o,null),vt(e,t,"target",o.target,o,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=mi(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Wt);break;case"onScroll":l!=null&&Je("scroll",e);break;case"onScrollEnd":l!=null&&Je("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(n=l.__html,n!=null){if(o.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=mi(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):e.removeAttribute(n);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":Je("beforetoggle",e),Je("toggle",e),me(e,"popover",l);break;case"xlinkActuate":se(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":se(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":se(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":se(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":se(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":se(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":se(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":se(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":se(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":me(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Oo.get(n)||n,me(e,n,l))}}function yu(e,t,n,l,o,c){switch(n){case"style":sr(e,l,c);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(n=l.__html,n!=null){if(o.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"children":typeof l=="string"?il(e,l):(typeof l=="number"||typeof l=="bigint")&&il(e,""+l);break;case"onScroll":l!=null&&Je("scroll",e);break;case"onScrollEnd":l!=null&&Je("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Wt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xe.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),t=n.slice(2,o?n.length-7:void 0),c=e[tn]||null,c=c!=null?c[n]:null,typeof c=="function"&&e.removeEventListener(t,c,o),typeof l=="function")){typeof c!="function"&&c!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,o);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):me(e,n,l)}}}function fn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",e),Je("load",e);var l=!1,o=!1,c;for(c in n)if(n.hasOwnProperty(c)){var g=n[c];if(g!=null)switch(c){case"src":l=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:vt(e,t,c,g,n,null)}}o&&vt(e,t,"srcSet",n.srcSet,n,null),l&&vt(e,t,"src",n.src,n,null);return;case"input":Je("invalid",e);var x=c=g=o=null,C=null,j=null;for(l in n)if(n.hasOwnProperty(l)){var q=n[l];if(q!=null)switch(l){case"name":o=q;break;case"type":g=q;break;case"checked":C=q;break;case"defaultChecked":j=q;break;case"value":c=q;break;case"defaultValue":x=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,t));break;default:vt(e,t,l,q,n,null)}}Ri(e,c,x,C,j,g,o,!1);return;case"select":Je("invalid",e),l=g=c=null;for(o in n)if(n.hasOwnProperty(o)&&(x=n[o],x!=null))switch(o){case"value":c=x;break;case"defaultValue":g=x;break;case"multiple":l=x;default:vt(e,t,o,x,n,null)}t=c,n=g,e.multiple=!!l,t!=null?nl(e,!!l,t,!1):n!=null&&nl(e,!!l,n,!0);return;case"textarea":Je("invalid",e),c=o=l=null;for(g in n)if(n.hasOwnProperty(g)&&(x=n[g],x!=null))switch(g){case"value":l=x;break;case"defaultValue":o=x;break;case"children":c=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:vt(e,t,g,x,n,null)}lr(e,l,o,c);return;case"option":for(C in n)if(n.hasOwnProperty(C)&&(l=n[C],l!=null))switch(C){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:vt(e,t,C,l,n,null)}return;case"dialog":Je("beforetoggle",e),Je("toggle",e),Je("cancel",e),Je("close",e);break;case"iframe":case"object":Je("load",e);break;case"video":case"audio":for(l=0;l<Ns.length;l++)Je(Ns[l],e);break;case"image":Je("error",e),Je("load",e);break;case"details":Je("toggle",e);break;case"embed":case"source":case"link":Je("error",e),Je("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(j in n)if(n.hasOwnProperty(j)&&(l=n[j],l!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:vt(e,t,j,l,n,null)}return;default:if(gn(t)){for(q in n)n.hasOwnProperty(q)&&(l=n[q],l!==void 0&&yu(e,t,q,l,n,void 0));return}}for(x in n)n.hasOwnProperty(x)&&(l=n[x],l!=null&&vt(e,t,x,l,n,null))}function i0(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,c=null,g=null,x=null,C=null,j=null,q=null;for(K in n){var P=n[K];if(n.hasOwnProperty(K)&&P!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":C=P;default:l.hasOwnProperty(K)||vt(e,t,K,null,l,P)}}for(var z in l){var K=l[z];if(P=n[z],l.hasOwnProperty(z)&&(K!=null||P!=null))switch(z){case"type":c=K;break;case"name":o=K;break;case"checked":j=K;break;case"defaultChecked":q=K;break;case"value":g=K;break;case"defaultValue":x=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,t));break;default:K!==P&&vt(e,t,z,K,l,P)}}tl(e,g,x,C,j,q,c,o);return;case"select":K=g=x=z=null;for(c in n)if(C=n[c],n.hasOwnProperty(c)&&C!=null)switch(c){case"value":break;case"multiple":K=C;default:l.hasOwnProperty(c)||vt(e,t,c,null,l,C)}for(o in l)if(c=l[o],C=n[o],l.hasOwnProperty(o)&&(c!=null||C!=null))switch(o){case"value":z=c;break;case"defaultValue":x=c;break;case"multiple":g=c;default:c!==C&&vt(e,t,o,c,l,C)}t=x,n=g,l=K,z!=null?nl(e,!!n,z,!1):!!l!=!!n&&(t!=null?nl(e,!!n,t,!0):nl(e,!!n,n?[]:"",!1));return;case"textarea":K=z=null;for(x in n)if(o=n[x],n.hasOwnProperty(x)&&o!=null&&!l.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:vt(e,t,x,null,l,o)}for(g in l)if(o=l[g],c=n[g],l.hasOwnProperty(g)&&(o!=null||c!=null))switch(g){case"value":z=o;break;case"defaultValue":K=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(r(91));break;default:o!==c&&vt(e,t,g,o,l,c)}ir(e,z,K);return;case"option":for(var ye in n)if(z=n[ye],n.hasOwnProperty(ye)&&z!=null&&!l.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:vt(e,t,ye,null,l,z)}for(C in l)if(z=l[C],K=n[C],l.hasOwnProperty(C)&&z!==K&&(z!=null||K!=null))switch(C){case"selected":e.selected=z&&typeof z!="function"&&typeof z!="symbol";break;default:vt(e,t,C,z,l,K)}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 Ne in n)z=n[Ne],n.hasOwnProperty(Ne)&&z!=null&&!l.hasOwnProperty(Ne)&&vt(e,t,Ne,null,l,z);for(j in l)if(z=l[j],K=n[j],l.hasOwnProperty(j)&&z!==K&&(z!=null||K!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(137,t));break;default:vt(e,t,j,z,l,K)}return;default:if(gn(t)){for(var xt in n)z=n[xt],n.hasOwnProperty(xt)&&z!==void 0&&!l.hasOwnProperty(xt)&&yu(e,t,xt,void 0,l,z);for(q in l)z=l[q],K=n[q],!l.hasOwnProperty(q)||z===K||z===void 0&&K===void 0||yu(e,t,q,z,l,K);return}}for(var R in n)z=n[R],n.hasOwnProperty(R)&&z!=null&&!l.hasOwnProperty(R)&&vt(e,t,R,null,l,z);for(P in l)z=l[P],K=n[P],!l.hasOwnProperty(P)||z===K||z==null&&K==null||vt(e,t,P,z,l,K)}function Nm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function l0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var o=n[l],c=o.transferSize,g=o.initiatorType,x=o.duration;if(c&&x&&Nm(g)){for(g=0,x=o.responseEnd,l+=1;l<n.length;l++){var C=n[l],j=C.startTime;if(j>x)break;var q=C.transferSize,P=C.initiatorType;q&&Nm(P)&&(C=C.responseEnd,g+=q*(C<x?1:(x-j)/(C-j)))}if(--l,t+=8*(c+g)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var vu=null,xu=null;function Qr(e){return e.nodeType===9?e:e.ownerDocument}function Lm(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 km(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function wu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Su=null;function a0(){var e=window.event;return e&&e.type==="popstate"?e===Su?!1:(Su=e,!0):(Su=null,!1)}var Rm=typeof setTimeout=="function"?setTimeout:void 0,s0=typeof clearTimeout=="function"?clearTimeout:void 0,_m=typeof Promise=="function"?Promise:void 0,r0=typeof queueMicrotask=="function"?queueMicrotask:typeof _m<"u"?function(e){return _m.resolve(null).then(e).catch(o0)}:Rm;function o0(e){setTimeout(function(){throw e})}function Sl(e){return e==="head"}function jm(e,t){var n=t,l=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(o),Ha(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")ks(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ks(n);for(var c=n.firstChild;c;){var g=c.nextSibling,x=c.nodeName;c[$n]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&c.rel.toLowerCase()==="stylesheet"||n.removeChild(c),c=g}}else n==="body"&&ks(e.ownerDocument.body);n=o}while(n);Ha(t)}function Dm(e,t){var n=e;e=0;do{var l=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function Cu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Cu(n),Li(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function c0(e,t,n,l){for(;e.nodeType===1;){var o=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[$n])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=ei(e.nextSibling),e===null)break}return null}function u0(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ei(e.nextSibling),e===null))return null;return e}function zm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ei(e.nextSibling),e===null))return null;return e}function Tu(e){return e.data==="$?"||e.data==="$~"}function Mu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function d0(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function ei(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Au=null;function Om(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ei(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Bm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Um(e,t,n){switch(t=Qr(n),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function ks(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Li(e)}var ti=new Map,Hm=new Set;function Wr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Fi=$.d;$.d={f:f0,r:h0,D:m0,C:p0,L:g0,m:b0,X:v0,S:y0,M:x0};function f0(){var e=Fi.f(),t=Ir();return e||t}function h0(e){var t=I(e);t!==null&&t.tag===5&&t.type==="form"?nh(t):Fi.r(e)}var Oa=typeof document>"u"?null:document;function Km(e,t,n){var l=Oa;if(l&&typeof t=="string"&&t){var o=on(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),Hm.has(o)||(Hm.add(o),e={rel:e,crossOrigin:n,href:t},l.querySelector(o)===null&&(t=l.createElement("link"),fn(t,"link",e),pe(t),l.head.appendChild(t)))}}function m0(e){Fi.D(e),Km("dns-prefetch",e,null)}function p0(e,t){Fi.C(e,t),Km("preconnect",e,t)}function g0(e,t,n){Fi.L(e,t,n);var l=Oa;if(l&&e&&t){var o='link[rel="preload"][as="'+on(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+on(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+on(n.imageSizes)+'"]')):o+='[href="'+on(e)+'"]';var c=o;switch(t){case"style":c=Ba(e);break;case"script":c=Ua(e)}ti.has(c)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ti.set(c,e),l.querySelector(o)!==null||t==="style"&&l.querySelector(Rs(c))||t==="script"&&l.querySelector(_s(c))||(t=l.createElement("link"),fn(t,"link",e),pe(t),l.head.appendChild(t)))}}function b0(e,t){Fi.m(e,t);var n=Oa;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+on(l)+'"][href="'+on(e)+'"]',c=o;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Ua(e)}if(!ti.has(c)&&(e=v({rel:"modulepreload",href:e},t),ti.set(c,e),n.querySelector(o)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(_s(c)))return}l=n.createElement("link"),fn(l,"link",e),pe(l),n.head.appendChild(l)}}}function y0(e,t,n){Fi.S(e,t,n);var l=Oa;if(l&&e){var o=Te(l).hoistableStyles,c=Ba(e);t=t||"default";var g=o.get(c);if(!g){var x={loading:0,preload:null};if(g=l.querySelector(Rs(c)))x.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ti.get(c))&&Eu(e,n);var C=g=l.createElement("link");pe(C),fn(C,"link",e),C._p=new Promise(function(j,q){C.onload=j,C.onerror=q}),C.addEventListener("load",function(){x.loading|=1}),C.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Jr(g,t,l)}g={type:"stylesheet",instance:g,count:1,state:x},o.set(c,g)}}}function v0(e,t){Fi.X(e,t);var n=Oa;if(n&&e){var l=Te(n).hoistableScripts,o=Ua(e),c=l.get(o);c||(c=n.querySelector(_s(o)),c||(e=v({src:e,async:!0},t),(t=ti.get(o))&&Nu(e,t),c=n.createElement("script"),pe(c),fn(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(o,c))}}function x0(e,t){Fi.M(e,t);var n=Oa;if(n&&e){var l=Te(n).hoistableScripts,o=Ua(e),c=l.get(o);c||(c=n.querySelector(_s(o)),c||(e=v({src:e,async:!0,type:"module"},t),(t=ti.get(o))&&Nu(e,t),c=n.createElement("script"),pe(c),fn(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(o,c))}}function Ym(e,t,n,l){var o=(o=Ze.current)?Wr(o):null;if(!o)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ba(n.href),n=Te(o).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Ba(n.href);var c=Te(o).hoistableStyles,g=c.get(e);if(g||(o=o.ownerDocument||o,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,g),(c=o.querySelector(Rs(e)))&&!c._p&&(g.instance=c,g.state.loading=5),ti.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ti.set(e,n),c||w0(o,e,n,g.state))),t&&l===null)throw Error(r(528,""));return g}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ua(n),n=Te(o).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Ba(e){return'href="'+on(e)+'"'}function Rs(e){return'link[rel="stylesheet"]['+e+"]"}function Gm(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function w0(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),fn(t,"link",n),pe(t),e.head.appendChild(t))}function Ua(e){return'[src="'+on(e)+'"]'}function _s(e){return"script[async]"+e}function Im(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+on(n.href)+'"]');if(l)return t.instance=l,pe(l),l;var o=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),pe(l),fn(l,"style",o),Jr(l,n.precedence,e),t.instance=l;case"stylesheet":o=Ba(n.href);var c=e.querySelector(Rs(o));if(c)return t.state.loading|=4,t.instance=c,pe(c),c;l=Gm(n),(o=ti.get(o))&&Eu(l,o),c=(e.ownerDocument||e).createElement("link"),pe(c);var g=c;return g._p=new Promise(function(x,C){g.onload=x,g.onerror=C}),fn(c,"link",l),t.state.loading|=4,Jr(c,n.precedence,e),t.instance=c;case"script":return c=Ua(n.src),(o=e.querySelector(_s(c)))?(t.instance=o,pe(o),o):(l=n,(o=ti.get(c))&&(l=v({},n),Nu(l,o)),e=e.ownerDocument||e,o=e.createElement("script"),pe(o),fn(o,"link",l),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Jr(l,n.precedence,e));return t.instance}function Jr(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=l.length?l[l.length-1]:null,c=o,g=0;g<l.length;g++){var x=l[g];if(x.dataset.precedence===t)c=x;else if(c!==o)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Nu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var eo=null;function $m(e,t,n){if(eo===null){var l=new Map,o=eo=new Map;o.set(n,l)}else o=eo,l=o.get(n),l||(l=new Map,o.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),o=0;o<n.length;o++){var c=n[o];if(!(c[$n]||c[Lt]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var g=c.getAttribute(t)||"";g=e+g;var x=l.get(g);x?x.push(c):l.set(g,[c])}}return l}function qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function S0(e,t,n){if(n===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 Fm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function C0(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Ba(l.href),c=t.querySelector(Rs(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=to.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=c,pe(c);return}c=t.ownerDocument||t,l=Gm(l),(o=ti.get(o))&&Eu(l,o),c=c.createElement("link"),pe(c);var g=c;g._p=new Promise(function(x,C){g.onload=x,g.onerror=C}),fn(c,"link",l),n.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=to.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Lu=0;function T0(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&Lu===0&&(Lu=62500*l0());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>Lu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function to(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var no=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,no=new Map,t.forEach(M0,e),no=null,to.call(e))}function M0(e,t){if(!(t.state.loading&4)){var n=no.get(e);if(n)var l=n.get(null);else{n=new Map,no.set(e,n);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<o.length;c++){var g=o[c];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(n.set(g.dataset.precedence,g),l=g)}l&&n.set(null,l)}o=t.instance,g=o.getAttribute("data-precedence"),c=n.get(g)||l,c===l&&n.set(null,o),n.set(g,o),this.count++,l=to.bind(this),o.addEventListener("load",l),o.addEventListener("error",l),c?c.parentNode.insertBefore(o,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var js={$$typeof:H,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function A0(e,t,n,l,o,c,g,x,C){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=Mn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mn(0),this.hiddenUpdates=Mn(null),this.identifierPrefix=l,this.onUncaughtError=o,this.onCaughtError=c,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function Vm(e,t,n,l,o,c,g,x,C,j,q,P){return e=new A0(e,t,n,g,C,j,q,P,x),t=1,c===!0&&(t|=24),c=Un(3,null,null,t),e.current=c,c.stateNode=e,t=oc(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:l,isDehydrated:n,cache:t},fc(c),e}function Xm(e){return e?(e=pa,e):pa}function Pm(e,t,n,l,o,c){o=Xm(o),l.context===null?l.context=o:l.pendingContext=o,l=dl(t),l.payload={element:n},c=c===void 0?null:c,c!==null&&(l.callback=c),n=fl(e,l,t),n!==null&&(Rn(n,e,t),ds(n,e,t))}function Zm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ku(e,t){Zm(e,t),(e=e.alternate)&&Zm(e,t)}function Qm(e){if(e.tag===13||e.tag===31){var t=Kl(e,67108864);t!==null&&Rn(t,e,67108864),ku(e,67108864)}}function Wm(e){if(e.tag===13||e.tag===31){var t=In();t=Qi(t);var n=Kl(e,t);n!==null&&Rn(n,e,t),ku(e,t)}}var lo=!0;function E0(e,t,n,l){var o=L.T;L.T=null;var c=$.p;try{$.p=2,Ru(e,t,n,l)}finally{$.p=c,L.T=o}}function N0(e,t,n,l){var o=L.T;L.T=null;var c=$.p;try{$.p=8,Ru(e,t,n,l)}finally{$.p=c,L.T=o}}function Ru(e,t,n,l){if(lo){var o=_u(l);if(o===null)bu(e,t,l,ao,n),ep(e,l);else if(k0(o,e,t,n,l))l.stopPropagation();else if(ep(e,l),t&4&&-1<L0.indexOf(e)){for(;o!==null;){var c=I(o);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var g=Tn(c.pendingLanes);if(g!==0){var x=c;for(x.pendingLanes|=2,x.entangledLanes|=2;g;){var C=1<<31-zt(g);x.entanglements[1]|=C,g&=~C}yi(c),(ct&6)===0&&(Yr=he()+500,Es(0))}}break;case 31:case 13:x=Kl(c,2),x!==null&&Rn(x,c,2),Ir(),ku(c,2)}if(c=_u(l),c===null&&bu(e,t,l,ao,n),c===o)break;o=c}o!==null&&l.stopPropagation()}else bu(e,t,l,null,n)}}function _u(e){return e=ca(e),ju(e)}var ao=null;function ju(e){if(ao=null,e=D(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=h(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ao=e,null}function Jm(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(Le()){case Fe:return 2;case dt:return 8;case Dt:case Cn:return 32;case Bt:return 268435456;default:return 32}default:return 32}}var Du=!1,Cl=null,Tl=null,Ml=null,Ds=new Map,zs=new Map,Al=[],L0="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 ep(e,t){switch(e){case"focusin":case"focusout":Cl=null;break;case"dragenter":case"dragleave":Tl=null;break;case"mouseover":case"mouseout":Ml=null;break;case"pointerover":case"pointerout":Ds.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zs.delete(t.pointerId)}}function Os(e,t,n,l,o,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:c,targetContainers:[o]},t!==null&&(t=I(t),t!==null&&Qm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function k0(e,t,n,l,o){switch(t){case"focusin":return Cl=Os(Cl,e,t,n,l,o),!0;case"dragenter":return Tl=Os(Tl,e,t,n,l,o),!0;case"mouseover":return Ml=Os(Ml,e,t,n,l,o),!0;case"pointerover":var c=o.pointerId;return Ds.set(c,Os(Ds.get(c)||null,e,t,n,l,o)),!0;case"gotpointercapture":return c=o.pointerId,zs.set(c,Os(zs.get(c)||null,e,t,n,l,o)),!0}return!1}function tp(e){var t=D(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,Ni(e.priority,function(){Wm(n)});return}}else if(t===31){if(t=h(n),t!==null){e.blockedOn=t,Ni(e.priority,function(){Wm(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function so(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_u(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);oa=l,n.target.dispatchEvent(l),oa=null}else return t=I(n),t!==null&&Qm(t),e.blockedOn=n,!1;t.shift()}return!0}function np(e,t,n){so(e)&&n.delete(t)}function R0(){Du=!1,Cl!==null&&so(Cl)&&(Cl=null),Tl!==null&&so(Tl)&&(Tl=null),Ml!==null&&so(Ml)&&(Ml=null),Ds.forEach(np),zs.forEach(np)}function ro(e,t){e.blockedOn===t&&(e.blockedOn=null,Du||(Du=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,R0)))}var oo=null;function ip(e){oo!==e&&(oo=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){oo===e&&(oo=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],o=e[t+2];if(typeof l!="function"){if(ju(l||n)===null)continue;break}var c=I(n);c!==null&&(e.splice(t,3),t-=3,_c(c,{pending:!0,data:o,method:n.method,action:l},l,o))}}))}function Ha(e){function t(C){return ro(C,e)}Cl!==null&&ro(Cl,e),Tl!==null&&ro(Tl,e),Ml!==null&&ro(Ml,e),Ds.forEach(t),zs.forEach(t);for(var n=0;n<Al.length;n++){var l=Al[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Al.length&&(n=Al[0],n.blockedOn===null);)tp(n),n.blockedOn===null&&Al.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var o=n[l],c=n[l+1],g=o[tn]||null;if(typeof c=="function")g||ip(n);else if(g){var x=null;if(c&&c.hasAttribute("formAction")){if(o=c,g=c[tn]||null)x=g.formAction;else if(ju(o)!==null)continue}else x=g.action;typeof x=="function"?n[l+1]=x:(n.splice(l,3),l-=3),ip(n)}}}function lp(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(g){return o=g})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function zu(e){this._internalRoot=e}co.prototype.render=zu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,l=In();Pm(n,l,e,t,null,null)},co.prototype.unmount=zu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Pm(e.current,2,null,e,null,null),Ir(),t[hi]=null}};function co(e){this._internalRoot=e}co.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ei();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Al.length&&t!==0&&t<Al[n].priority;n++);Al.splice(n,0,e),n===0&&tp(e)}};var ap=i.version;if(ap!=="19.2.8")throw Error(r(527,ap,"19.2.8"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=y(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var _0={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uo.isDisabled&&uo.supportsFiber)try{Zt=uo.inject(_0),wt=uo}catch{}}return Us.createRoot=function(e,t){if(!u(e))throw Error(r(299));var n=!1,l="",o=fh,c=hh,g=mh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=Vm(e,1,!1,null,null,n,l,null,o,c,g,lp),e[hi]=t.current,gu(e),new zu(t)},Us.hydrateRoot=function(e,t,n){if(!u(e))throw Error(r(299));var l=!1,o="",c=fh,g=hh,x=mh,C=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(c=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError),n.formState!==void 0&&(C=n.formState)),t=Vm(e,1,!0,t,n??null,l,o,C,c,g,x,lp),t.context=Xm(null),n=t.current,l=In(),l=Qi(l),o=dl(l),o.callback=null,fl(n,o,l),n=l,t.current.lanes=n,An(t,n),yi(t),e[hi]=t.current,gu(e),new co(t)},Us.version="19.2.8",Us}var dp;function I0(){if(dp)return Bu.exports;dp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(i){console.error(i)}}return a(),Bu.exports=G0(),Bu.exports}var $0=I0();const q0=pg($0),fe={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~"},F0=new TextEncoder;function gd(a){return F0.encode(a)}function bg(a){if(!a||a.length===0)return"";const s=a.toUpperCase().charCodeAt(0);return s>=65&&s<=90?String.fromCharCode(s-64):a==="@"||a===" "?"\0":a==="["?"\x1B":a==="\\"?"":a==="]"?"":a==="^"?"":a==="_"?"":a==="?"?"":a}function V0(a){return`\x1B${a}`}function fp({ctrl:a,alt:i,shift:s}){return 1+(s?1:0)+(i?2:0)+(a?4:0)}const yg=/^\x1b[[O]([ABCDHF])$/,vg=/^\x1bO([PQRS])$/,xg=/^\x1b\[(\d+)~$/;function To(a,i){const{ctrl:s=!1,alt:r=!1,shift:u=!1}=i;if(!s&&!r&&!u)return a;const d=fp(i),m=r&&!s&&!u,h=yg.exec(a);if(h)return`\x1B[1;${d}${h[1]}`;const p=vg.exec(a);if(p)return`\x1B[1;${d}${p[1]}`;const y=xg.exec(a);if(y)return`\x1B[${y[1]};${d}~`;switch(a){case fe.TAB:return u&&!s&&!r?fe.SHIFT_TAB:m?`\x1B${a}`:`\x1B[9;${d}u`;case fe.SHIFT_TAB:return!s&&!r?a:`\x1B[9;${fp({...i,shift:!0})}u`;case fe.ENTER:return m?`\x1B${a}`:`\x1B[13;${d}u`;case fe.BACKSPACE:return s&&!r&&!u?"\b":m?`\x1B${a}`:`\x1B[127;${d}u`;case fe.ESC:return m?`\x1B${a}`:`\x1B[27;${d}u`}let b=a;return u&&a.length===1&&!s&&(b=a.toUpperCase()),s&&(b=bg(b)),r&&(b=V0(b)),b}function X0(a){return[...a].length===1?!0:yg.test(a)||vg.test(a)||xg.test(a)||a===fe.SHIFT_TAB}const wg=27,Sg=91,P0=60,hp=59,Cg=77,Tg=48,Z0=57,Q0=64,W0=-30,Ku=32,mp=255;function Mg(a){return Number.isInteger(a)&&(a&W0)===Q0}function J0(a){return a>=Tg&&a<=Z0}function Yu(a,i){let s=i,r=0;for(;s<a.length&&J0(a[s]);){if(r=r*10+(a[s]-Tg),r>65535)return null;s+=1}return s===i?null:{value:r,next:s}}function ev(a,i){if(a[i]!==wg||a[i+1]!==Sg||a[i+2]!==P0)return-1;const s=Yu(a,i+3);if(!s||!Mg(s.value)||a[s.next]!==hp)return-1;const r=Yu(a,s.next+1);if(!r||a[r.next]!==hp)return-1;const u=Yu(a,r.next+1);return!u||a[u.next]!==Cg?-1:u.next+1}function tv(a,i){if(a[i]!==wg||a[i+1]!==Sg||a[i+2]!==Cg||i+6>a.length)return-1;const s=a[i+3]-Ku,r=a[i+4],u=a[i+5];return!Mg(s)||r<Ku||r>mp||u<Ku||u>mp?-1:i+6}function Mo(a){if(!a)return!1;const i=a instanceof Uint8Array?a:new Uint8Array(a);if(i.length===0)return!1;let s=0;for(;s<i.length;){const r=ev(i,s);if(r>s){s=r;continue}const u=tv(i,s);if(u>s){s=u;continue}return!1}return!0}const nv=3e3,iv=1e4,lv=1500;class av{constructor(i){X(this,"ws",null);X(this,"config");X(this,"state","disconnected");X(this,"currentRole","viewer");X(this,"controllerId");X(this,"hostId");X(this,"assignedClientId");X(this,"reconnectAttempts",0);X(this,"reconnectTimer",null);X(this,"pingTimer",null);X(this,"pingTimestamp",null);X(this,"lastInboundAt",0);X(this,"pingSentAt",null);X(this,"connectStartedAt",0);X(this,"lastWakeConnectAt",0);X(this,"probeTimer",null);X(this,"rejectedByRelay",!1);X(this,"isManuallyClosed",!1);X(this,"authFailureDetail",null);X(this,"authFailureCode",null);X(this,"temporaryFailureCode",null);X(this,"pendingInputSegments",[]);X(this,"isFlushScheduled",!1);X(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,controlRevoked:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,controlDenied:new Set,status:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set});X(this,"terminalCols",80);X(this,"terminalRows",24);this.config={...i}}updateConfig(i){this.config={...this.config,...i}}getConfig(){return{...this.config}}getState(){return this.state}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}on(i,s){return this.listeners[i].add(s),()=>{this.listeners[i].delete(s)}}emit(i,...s){this.listeners[i].forEach(u=>{try{u(...s)}catch(d){console.error(`Error in event listener for ${i}:`,d)}})}setState(i,s,r){this.state!==i&&(this.state=i,this.emit("stateChange",i,s,r))}connect(i){if(i&&(this.terminalCols=i.cols,this.terminalRows=i.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=this.resolveWsUrl(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=u=>{this.isStaleSocket(r)||this.handleMessage(u)},r.onerror=u=>{this.isStaleSocket(r)||this.handleError(u)},r.onclose=u=>{this.isStaleSocket(r)||this.handleClose(u)}}catch(s){this.setState("error",s instanceof Error?s.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(i){return this.ws!==i}teardownSocket(i=1e3,s="Client closed the connection"){this.pendingInputSegments=[],this.isFlushScheduled=!1;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(i,s)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.pendingInputSegments=[],this.isFlushScheduled=!1,this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(i){this.updateConfig(i),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(i){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const s=Date.now(),r=this.ws;if(!r){if(s-this.lastWakeConnectAt<lv)return;this.lastWakeConnectAt=s,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){s-this.connectStartedAt>iv&&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 i=this.ws;if(!i||i.readyState!==WebSocket.OPEN||this.probeTimer)return;const s=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===i&&this.lastInboundAt<s&&this.dropStaleSocket("connection_stale")},nv)}dropStaleSocket(i){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",i),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(i){if(this.lastInboundAt=Date.now(),typeof i.data=="string")try{const s=JSON.parse(i.data);this.processJsonMessage(s)}catch(s){console.warn("Received unparseable text frame from server:",s)}else if(i.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(i.data));else if(typeof Blob<"u"&&i.data instanceof Blob)try{const s=await i.data.arrayBuffer();this.emit("binaryData",new Uint8Array(s))}catch(s){console.error("Failed to convert Blob to ArrayBuffer:",s)}}processJsonMessage(i){switch(i.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=i.role,this.controllerId=i.controllerId,this.hostId=i.hostId,this.assignedClientId=i.clientId,this.emit("ready",i),this.emit("roleChange",i.role,i.controllerId,i.hostId,i.clientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount);break}case"paired":{this.emit("paired",{token:i.token,deviceId:i.deviceId,hostId:i.hostId,expiresAt:i.expiresAt});break}case"control_state":{this.currentRole=i.role,this.controllerId=i.controllerId,this.emit("controlState",i.role,i.controllerId),this.emit("roleChange",i.role,i.controllerId,this.hostId,this.assignedClientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",i.code||"host_reconnecting"),this.emit("hostReconnecting",i.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",i.cols,i.rows,i.terminalPalette,i.hostname);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",i.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",i);break}case"exit":{this.emit("exit",i.code,i.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"control_denied":{this.emit("controlDenied",i.message);break}case"status":{this.emit("status",i);break}case"error":{i.code==="host_offline"||i.code==="host_reconnecting"||i.code==="host_reconnect_timeout"||i.code==="rate_limited"?(this.temporaryFailureCode=String(i.code),this.setState("reconnecting",i.message,String(i.code))):(i.code==="auth_required"||i.code==="unauthorized"||i.code==="device_revoked"||i.code==="invalid_handshake"||i.code==="too_many_hosts"||i.code===401||i.code===403)&&(this.authFailureDetail=i.message,this.authFailureCode=String(i.code),this.setState("error",i.message,this.authFailureCode)),this.emit("error",{code:i.code,message:i.message});break}case"pong":{if(this.pingTimestamp){const s=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(s))}break}case"paste_file_ready":{this.emit("pasteFileReady",i.path);break}case"agent_status":{this.emit("agentStatus",i);break}}}handleError(i){console.error("WebSocket error:",i),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(i){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(i.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",i.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(i.code===1008){this.rejectedByRelay=!0,this.setState("error",i.reason||"The relay rejected the connection",String(i.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${i.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${i.reason||i.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 i=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(i*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const i=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>=i){this.probeLiveness();return}this.sendPing()}},i)}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)}sendHello(){const i={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(i.token=this.config.token),this.config.pairCode&&(i.pairCode=this.config.pairCode),this.sendJson(i)}claimControl(i=!1){const s={type:"claim_control",...i?{force:!0}:{}};this.sendJson(s)}releaseControl(){const i={type:"release_control"};this.sendJson(i)}sendResize(i,s){this.terminalCols=i,this.terminalRows=s;const r={type:"resize",cols:i,rows:s};this.sendJson(r)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const i={type:"ping"};this.sendJson(i)}sendPasteFile(i,s){this.sendJson({type:"paste_file",mime:i,dataBase64:s})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendJson(i){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(i))}sendInput(i){const s=i instanceof Uint8Array?i:new Uint8Array(i);s.length!==0&&(this.pendingInputSegments.push(s),this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>this.flushInput())))}flushInput(){if(this.isFlushScheduled=!1,this.pendingInputSegments.length===0)return;let i=this.pendingInputSegments;if(this.pendingInputSegments=[],this.ws&&(this.ws.bufferedAmount??0)>256*1024&&(i=i.filter(r=>!Mo(r))),i.length===0)return;let s;if(i.length===1)s=i[0];else{let r=0;for(let d=0;d<i.length;d++)r+=i[d].byteLength;s=new Uint8Array(r);let u=0;for(let d=0;d<i.length;d++)s.set(i[d],u),u+=i[d].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(s)}sendBinary(i){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(i)}sendText(i){const s=gd(i);this.sendInput(s)}resolveWsUrl(i){if(/^wss?:\/\//i.test(i))return i;if(/^https?:\/\//i.test(i)){const s=new URL(i);return s.protocol=s.protocol==="https:"?"wss:":"ws:",(!s.pathname||s.pathname==="/")&&(s.pathname="/ws/client"),s.toString()}if(typeof window<"u"&&window.location){const r=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host,d=i.startsWith("/")?i:`/${i}`;return`${r}//${u}${d}`}return"ws://127.0.0.1:8787/ws/client"}}function sv(a,i=window,s=document){const r=y=>{var b;((b=i.navigator)==null?void 0:b.onLine)!==!1&&a.wake(y)},u=()=>{s.visibilityState==="visible"&&r("visible")},d=()=>r("pageshow"),m=()=>r("online"),h=()=>r("focus"),p=()=>r("resume");return s.addEventListener("visibilitychange",u),s.addEventListener("resume",p),i.addEventListener("pageshow",d),i.addEventListener("online",m),i.addEventListener("focus",h),()=>{s.removeEventListener("visibilitychange",u),s.removeEventListener("resume",p),i.removeEventListener("pageshow",d),i.removeEventListener("online",m),i.removeEventListener("focus",h)}}const rv=10,ov=24,_o=15,bd=13,yd=640;function cv(){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 qa()<yd}function qa(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function Gu(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Ao(a,i=_o){const s=typeof a=="number"?a:Number(a);return!Number.isFinite(s)||s<=0?i:Math.min(ov,Math.max(rv,Math.round(s)))}function pp(a,i=qa()){if(i<yd){const r=Ao(a,bd);return Math.min(15,Math.max(12,r))}return Ao(a,_o)}const Ag=[{id:"esc",label:"ESC",code:fe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:fe.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:fe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:fe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:fe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:fe.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:fe.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],uv=[{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:fe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:fe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:fe.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:fe.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:fe.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:fe.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:fe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:fe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:fe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:fe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:fe.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:fe.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:fe.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:fe.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:fe.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:fe.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:fe.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:fe.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:fe.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:fe.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:fe.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:fe.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:fe.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:fe.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:fe.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:fe.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:fe.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:fe.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:fe.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:fe.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:fe.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:fe.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:fe.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:fe.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:fe.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 Ws(){return JSON.parse(JSON.stringify(Ag))}const dv=[["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 fv(a){return dv.some(i=>a.length===i.length&&a.every((s,r)=>s.id===i[r]&&s.enabled!==!1))}function hv(a){if(!Array.isArray(a)||a.length===0)return Ws();const i=a.filter(s=>typeof s=="object"&&s!==null&&typeof s.id=="string"&&typeof s.label=="string"&&typeof s.code=="string");return fv(i)?Ws():i.filter(s=>s.id!=="drawer_agent")}function ad(a,i){if(i){const s=`keyTitles.${a.id}`,r=i(s);if(r&&r!==s)return r}return a.title||a.label}class xi extends Error{constructor(s,r={}){super(s);X(this,"code");X(this,"params");this.name="KeyComboError",this.code=s,this.params=r}}const mv={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},gp={esc:fe.ESC,tab:fe.TAB,enter:fe.ENTER,backspace:fe.BACKSPACE,delete:fe.DELETE,left:fe.LEFT,right:fe.RIGHT,up:fe.UP,down:fe.DOWN,home:fe.HOME,end:fe.END,pageup:fe.PAGE_UP,pagedown:fe.PAGE_DOWN,insert:fe.INSERT,space:" ","+":"+"},pv={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},gv={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function Eg(a,i){const s=a.toLowerCase().split("+");if(s.some(p=>!p))throw new xi("invalidStepSyntax",{step:i+1});const r={};let u;for(const p of s)if(p==="ctrl"||p==="control"){if(r.ctrl)throw new xi("duplicateModifier",{step:i+1,modifier:"Ctrl"});r.ctrl=!0}else if(p==="alt"||p==="option"){if(r.alt)throw new xi("duplicateModifier",{step:i+1,modifier:"Alt"});r.alt=!0}else if(p==="shift"){if(r.shift)throw new xi("duplicateModifier",{step:i+1,modifier:"Shift"});r.shift=!0}else if(u===void 0)u=p;else throw new xi("multipleKeys",{step:i+1});if(!u)throw new xi("missingKey",{step:i+1});const d=mv[u]||u,m=/^f(?:[1-9]|1[0-2])$/.exec(d);let h;if(m)h=fe[d.toUpperCase()];else if(Object.hasOwn(gp,d))h=gp[d];else if([...d].length===1&&/^[\x21-\x7e]$/.test(d))h=d;else throw new xi("unsupportedKey",{step:i+1,key:d});return{key:h,keyName:d,modifiers:r,sequence:yv(h,d,r)}}function bv(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function bp(a,i){const s=[...a][0].codePointAt(0);return s===void 0?"":`\x1B[${s};${bv(i)}u`}function yv(a,i,s){if(!s.ctrl)return To(a,s);if(i.length===1&&/^[\x20-\x7e]$/.test(i)){const r=i.toLowerCase();if(s.alt||s.shift||r==="m"||r==="i")return bp(r,s);if(r==="-"||r==="/"||r==="_")return"";const u=bg(r);return u!==r?u:bp(r,s)}return To(a,s)}function wi(a){if(typeof a!="string"||!a.trim())throw new xi("empty");const i=a.trim().split(/\s+/);if(i.length>8)throw new xi("tooManySteps",{count:8});return i.map((s,r)=>Eg(s,r).sequence)}function Fs(a){const i=a.trim().split(/\s+/);return i.length>1&&i.every(s=>["esc","escape"].includes(s.toLowerCase()))?`ESC${gv[i.length]||` ×${i.length}`}`:i.map((s,r)=>{const{keyName:u,modifiers:d}=Eg(s,r),m=pv[u]||(/^f\d+$/.test(u),u.toUpperCase());return d.ctrl&&d.alt&&d.shift?`Ctrl+Alt+⇧${m}`:d.ctrl&&d.alt?`Ctrl+Alt+${m}`:d.ctrl&&d.shift?`^⇧${m}`:d.ctrl?`^${m}`:d.alt&&d.shift?`Alt+⇧${m}`:d.alt?`Alt+${m}`:d.shift?`⇧${m}`:m}).join(" ")}const sd='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',vv='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',yp="JetBrains Mono, Menlo, Monaco, Consolas, monospace",Fa="herdr_remote_settings_v1",Xs="herdr_remote_session_view_v1",Ng=64,Js=4096,rd={local:{},session:{}};function Eo(a,i){if(typeof window>"u")return rd[a][i]||null;try{return(a==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return rd[a][i]||null}}function ta(a,i,s){if(rd[a][i]=s,!(typeof window>"u"))try{(a==="local"?window.localStorage:window.sessionStorage).setItem(i,s)}catch(r){console.warn(`Failed to write to ${a}Storage:`,r)}}function xv(){return`client-${Math.random().toString(36).substring(2,8)}`}function vd(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function wv(a,i){return(typeof a=="string"?a.trim().slice(0,Ng):"")||i}function No(a,i){if(!a||typeof a!="object"||Array.isArray(a))return null;const s=a,r=typeof s.wsUrl=="string"?s.wsUrl.trim().slice(0,2048):"",u=typeof s.token=="string"?s.token.slice(0,Js):"",d=typeof s.pairCode=="string"?s.pairCode.trim().toUpperCase().slice(0,32):"";if(!r||!r.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(r)||!u&&!d)return null;const m=Date.now(),h=typeof s.id=="string"&&s.id.length>0?s.id.slice(0,128):vd(),p=typeof s.hostname=="string"&&s.hostname.trim()?s.hostname.trim().slice(0,Ng):`Herdr ${i+1}`;return{id:h,displayName:wv(s.displayName,p),wsUrl:r,token:u,...d?{pairCode:d}:{},...typeof s.hostId=="string"&&s.hostId.trim()?{hostId:s.hostId.trim().slice(0,128)}:{},...typeof s.hostname=="string"&&s.hostname.trim()?{hostname:s.hostname.trim().slice(0,128)}:{},...typeof s.deviceId=="string"&&s.deviceId.trim()?{deviceId:s.deviceId.trim().slice(0,128)}:{},autoReconnect:s.autoReconnect!==!1,createdAt:Number.isFinite(s.createdAt)?Number(s.createdAt):m,lastUsedAt:Number.isFinite(s.lastUsedAt)?Number(s.lastUsedAt):m}}function vp(a,i=0){const s=No({...a,id:a.id||vd()},i);if(!s)throw new Error("a connection profile requires a relay URL and token or pairing code");return s}function xp(a){let i=a.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const s=new URL(a.wsUrl,window.location.origin);s.protocol=s.protocol==="wss:"?"https:":"http:",s.pathname=s.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",s.search="",s.hash="",i=s.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${a.hostId||""}`}function Lg(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function kg(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:xv(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?bd:_o,fontFamily:sd,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:Lg(),virtualKeys:Ws(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const Sv=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],Cv=["wsUrl","token","pairCode","autoReconnect"],xd=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],Tv=xd.filter(a=>a!=="adminToken"&&a!=="adminTokens"),wp=["theme","colorMode"];function od(a){const i=a;if(!wp.some(u=>i[u]!==void 0))return{data:a,changed:!1};const r={...i};for(const u of wp)delete r[u];return{data:r,changed:!0}}function Rg(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i={};for(const[s,r]of Object.entries(a).slice(0,32))typeof r!="string"||r.length===0||(i[s.slice(0,512)]=r.slice(0,Js));return i}function _g(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i=Object.create(null);for(const[s,r]of Object.entries(a).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(s)||["__proto__","constructor","prototype"].includes(s)||!r||typeof r!="object"||Array.isArray(r))continue;const u=r,d={};if(Array.isArray(u.order)&&(d.order=[...new Set(u.order.filter(m=>typeof m=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(m)))].slice(0,256)),u.actions&&typeof u.actions=="object"&&!Array.isArray(u.actions)){const m=Object.create(null);for(const[h,p]of Object.entries(u.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(h)||!p||typeof p!="object"||Array.isArray(p))continue;const y=p,b={};if(typeof y.keys=="string"&&y.keys.trim()){const v=y.keys.trim().slice(0,80);try{wi(v),b.keys=v}catch{}}typeof y.hidden=="boolean"&&(b.hidden=y.hidden),Object.keys(b).length>0&&(m[h]=b)}d.actions=m}if(Array.isArray(u.custom)){const m=new Set;d.custom=u.custom.slice(0,64).flatMap(h=>{if(!h||typeof h!="object"||Array.isArray(h))return[];const p=h;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||m.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const y=p.keys.trim().slice(0,80);try{wi(y)}catch{return[]}return m.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:y}]})}i[s]=d}return i}function jg(a){var d;const i=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((m,h)=>{const p=No(m,h);p&&!i.some(y=>y.id===p.id)&&i.push(p)}),i.length===0&&(typeof a.token=="string"&&a.token||typeof a.pairCode=="string"&&a.pairCode)){const m=No({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof a.wsUrl=="string"&&a.wsUrl.trim()?a.wsUrl:"/ws/client",token:a.token||"",pairCode:a.pairCode||"",autoReconnect:a.autoReconnect!==!1},0);m&&i.push(m)}const r=typeof a.activeProfileId=="string"?a.activeProfileId:"",u=i.some(m=>m.id===r)?r:((d=i[0])==null?void 0:d.id)||"";return{profiles:i,activeProfileId:u}}function Dg(){const a=kg();if(typeof window>"u")return a;let i={};const s=Eo("local",Fa);if(s)try{i=JSON.parse(s)}catch(ne){console.warn("Failed to parse localStorage settings:",ne)}const r=od(i);r.changed&&(i=r.data,ta("local",Fa,JSON.stringify(i)));let u=null;const d=Eo("session",Xs);if(d)try{u=JSON.parse(d)}catch(ne){console.warn("Failed to parse sessionStorage settings:",ne)}if(!u){const ne={};for(const Se of xd)i[Se]!==void 0&&(ne[Se]=i[Se]);u=ne,ta("session",Xs,JSON.stringify(u))}let m=u.fontFamily??i.fontFamily??a.fontFamily;(!m||m===yp||m===vv)&&(m=sd);const h=window.innerWidth<640?bd:_o,p=u.fontSize??i.fontSize??a.fontSize,y=Ao(p,h),b=u.virtualKeys??i.virtualKeys??a.virtualKeys,v=hv(b),S=i.language??a.language,T=S==="zh"||S==="en"?S:Lg(),E=jg(i),Y=E.profiles.find(ne=>ne.id===E.activeProfileId),A=od(u);A.changed&&(u=A.data,ta("session",Xs,JSON.stringify(u)));const O=u.toolbarVisible??i.toolbarVisible??a.toolbarVisible,B=u.toolbarPosition??i.toolbarPosition??a.toolbarPosition,H=u.vibrateOnKeyPress??i.vibrateOnKeyPress??a.vibrateOnKeyPress,ee=ne=>{const Se=u[ne]??i[ne];return typeof Se=="boolean"?Se:a[ne]},re=(u==null?void 0:u.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??a.predictiveEcho,J=re==="always"||re==="off"||re==="auto"?re:"auto",G=typeof u.adminToken=="string"?u.adminToken.slice(0,Js):typeof i.adminToken=="string"?i.adminToken.slice(0,Js):a.adminToken,U=Rg(u.adminTokens),ae={...a,...i,...u,wsUrl:(Y==null?void 0:Y.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:a.wsUrl),token:(Y==null?void 0:Y.token)||"",pairCode:(Y==null?void 0:Y.pairCode)||"",autoReconnect:(Y==null?void 0:Y.autoReconnect)??a.autoReconnect,profiles:E.profiles,activeProfileId:E.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):a.clientId,fontFamily:m,fontSize:y,toolbarVisible:O,toolbarPosition:B,vibrateOnKeyPress:H,predictiveEcho:J,virtualKeys:v,agentKeymaps:_g(i.agentKeymaps),agentAlertBadge:ee("agentAlertBadge"),agentAlertSound:ee("agentAlertSound"),agentAlertVibrate:ee("agentAlertVibrate"),agentAlertNotify:ee("agentAlertNotify"),language:T,adminToken:G,adminTokens:U};return i.fontFamily===yp&&(i.fontFamily=sd,ta("local",Fa,JSON.stringify(i))),ae}function Nl(a){var S;const s={...Dg(),...a};s.agentKeymaps=_g(s.agentKeymaps),s.adminTokens=Rg(s.adminTokens),typeof s.adminToken=="string"&&(s.adminToken=s.adminToken.slice(0,Js)),a.fontSize!==void 0&&(s.fontSize=Ao(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?s.predictiveEcho=a.predictiveEcho:s.predictiveEcho="auto");const r=jg(s);let u=r.profiles,d=r.activeProfileId;if(Cv.some(T=>a[T]!==void 0)){const T=u.findIndex(A=>A.id===d),E=T>=0?{...u[T]}:{id:vd(),displayName:`Herdr ${u.length+1}`,wsUrl:s.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};E.wsUrl=s.wsUrl,E.token=s.token,E.pairCode=s.pairCode||void 0,E.autoReconnect=s.autoReconnect,E.lastUsedAt=Date.now();const Y=No(E,Math.max(T,0));Y?T>=0?u[T]=Y:(u.push(Y),d=Y.id):T>=0&&(u=u.filter(A=>A.id!==d),d=((S=u[0])==null?void 0:S.id)||"")}u.length>0&&!u.some(T=>T.id===d)&&(d=u[0].id);const h=u.find(T=>T.id===d);s.profiles=u,s.activeProfileId=d,s.wsUrl=(h==null?void 0:h.wsUrl)||s.wsUrl||"/ws/client",s.token=(h==null?void 0:h.token)||"",s.pairCode=(h==null?void 0:h.pairCode)||"",s.autoReconnect=(h==null?void 0:h.autoReconnect)??s.autoReconnect;const p=Eo("local",Fa);let y={};if(p)try{y=JSON.parse(p)}catch{}y=od(y).data;for(const T of Sv)s[T]!==void 0&&(y[T]=s[T]);y.profiles=u,y.activeProfileId=d,ta("local",Fa,JSON.stringify(y));const b=Eo("session",Xs);let v={};if(b)try{v=JSON.parse(b)}catch{}for(const T of xd)s[T]!==void 0&&(v[T]=s[T]);ta("session",Xs,JSON.stringify(v));for(const T of Tv)s[T]!==void 0&&(y[T]=s[T]);return ta("local",Fa,JSON.stringify(y)),s}const Mv={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},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 5 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Font, size, and touch settings",tabGeneral:"General",tabAppearance:"Appearance & Font",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeLabel:"Terminal Text Size ({size}px)",fontSizeCompact:"10px (Compact)",fontSizeDefault:"15px (Default)",fontSizeLarge:"24px (Large)",mobileFontNote:"Terminal font scales automatically on small screens for 80-column layout.",colorPassthroughNote:"Terminal colors and cursor style pass through from the host.",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Under high latency, show what you type in a shell prompt or an agent’s input box before the echo comes back. Menus and other screens are never predicted.",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Show modifier and navigation keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count blocked and finished agents in the tab title, and mark the tab icon",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent stops to ask or finishes, while this page is on screen",agentAlertSound:"Chime",agentAlertSoundDesc:"A short sound while this page is in the background; starts working after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"While this page is in the background (HTTPS only)",languageLabel:"Language",languageDesc:"Choose English or 简体中文",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",windowZoomSharedNote:"Host view isolation is not active; zoom applies locally.",fontSizeZoomHelp:"Adjusts font size in this window only."},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",genericGroup:"General",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). Saved in this browser, per agent. ESC, arrows and other base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",customizeBarShort:"Edit",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",helperTitle:"Quick Commands",closeHelper:"Close Helper",placeholder:"Type command and press Enter...",sendButton:"Send",clearInput:"Clear Input",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",keyEnter:"Enter",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",image:"Image",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",connectionStatusAria:"Connection status",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",adminAria:"Admin dashboard",pairingAria:"Connection & pairing",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{title:"Admin Dashboard",subtitle:"Connected hosts, paired devices, and relay traffic",returnToTerminal:"Return to Terminal",terminalShells:"Terminal Shells",startedAt:"Started at {time}",accessPanel:"Access",acrossWindows:"across {count} windows",perSecond:"{value}/s",framesPerSecond:"{count} fps",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})",throughput:"Throughput",bytesInTotal:"Total Inbound:",bytesOutTotal:"Total Outbound:",frameRate:"Frame Rate:",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",colDeviceId:"Device ID",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",remoteRelayBadge:"Connected to Remote Relay",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",remoteRelayHelp:"Open remote relay admin dashboard.",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"},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",controlDenied:"Request denied: another controller is active",controlRevoked:"Control transferred to another device",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready."},fontPresets:{system:"System Default",apple:"SF Mono / Menlo",windows:"Consolas",linux:"Liberation Mono",courier:"Courier New",firacode:"Fira Code"},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},Av={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},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:"配对码 5 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"字体、字号与触控管理",tabGeneral:"常规设置",tabAppearance:"终端与字体",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeLabel:"终端字号 ({size}px)",fontSizeCompact:"10px (紧凑)",fontSizeDefault:"15px (默认)",fontSizeLarge:"24px (大字号)",mobileFontNote:"小屏设备自动适配字号,保持 80 列完整显示。",colorPassthroughNote:"终端配色与光标样式透传自宿主环境。",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时,在 shell 提示符或智能体输入框里先行显示输入的字符,回显到达后自动校正。菜单等其他界面不做预测。",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"显示移动端修饰键与方向键工具栏",touchHaptics:"触控振动反馈",touchHapticsDesc:"移动端按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"在标签页标题里显示等待确认和已完成的智能体数量,并在图标上加角标",agentAlertVibrate:"震动",agentAlertVibrateDesc:"智能体停下来等你确认或完成时震动(页面在前台时)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放短提示音;下次点击页面后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时发系统通知(仅 HTTPS)",languageLabel:"显示语言",languageDesc:"选择 English 或 简体中文",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",windowZoomSharedNote:"当前宿主未启用视图隔离,字号调整仅影响本地窗口。",fontSizeZoomHelp:"仅调节当前窗口字号,不影响其他窗口。"},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",genericGroup:"通用",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在底部按键栏显示的 {profile} 快捷键(已显示 {count} 个)。按智能体分别保存在当前浏览器;ESC、方向键等基础按键在「虚拟按键」页设置。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",customizeBarShort:"自定义",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",helperTitle:"快捷命令",closeHelper:"关闭命令助手",placeholder:"输入终端命令并回车...",sendButton:"发送",clearInput:"清除输入内容",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",keyEnter:"回车",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",image:"图片",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",connectionStatusAria:"连接状态",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",adminAria:"打开管理面板",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权"},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:{title:"系统管理面板",subtitle:"接入主机、配对设备与中转流量",returnToTerminal:"返回终端",terminalShells:"个终端 Shell",startedAt:"启动于 {time}",accessPanel:"接入概览",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",framesPerSecond:"{count} 帧/秒",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})",throughput:"网络吞吐流量",bytesInTotal:"入站流量:",bytesOutTotal:"出站流量:",frameRate:"帧率统计:",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colDeviceId:"设备 ID",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 服务管理",remoteRelayBadge:"已连接远程 Relay 服务",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",remoteRelayHelp:"直接访问远程 Relay 管理后台。",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:"返回终端"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",controlDenied:"控制请求被拒绝:已有活跃控制者",controlRevoked:"控制权已转移",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。"},fontPresets:{system:"系统默认",apple:"Apple SF Mono / Menlo",windows:"Windows Consolas",linux:"Linux Liberation Mono",courier:"Courier New",firacode:"Fira Code"},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},Iu={en:Mv,zh:Av};function wd(a,i,s){const r=Iu[a]||Iu.en,u=i.split(".");let d=r;for(const m of u)if(d&&typeof d=="object"&&m in d)d=d[m];else{let h=Iu.en;for(const p of u)if(h&&typeof h=="object"&&p in h)h=h[p];else return i;d=h;break}if(typeof d!="string")return i;if(s){let m=d;for(const[h,p]of Object.entries(s))m=m.replaceAll(`{${h}}`,String(p));return m}return d}const Sp="#11111b",cd=[{id:"system",name:"System Default (Recommended)",font:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace'},{id:"apple",name:"Apple SF Mono / Menlo",font:'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace'},{id:"windows",name:"Windows Consolas",font:'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace'},{id:"linux",name:"Linux Liberation Mono",font:'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace'},{id:"courier",name:"Courier New",font:'"Courier New", Courier, "Symbols Nerd Font Mono", monospace'},{id:"firacode",name:"Fira Code (Ligatures)",font:'"Fira Code", "Symbols Nerd Font Mono", monospace'}];function Cp(a){if(!a||typeof a!="string")return cd[0].font;const i=a.trim();if(i.includes("Symbols Nerd Font"))return i;if(/^['"]?monospace['"]?$/i.test(i))return'"Symbols Nerd Font Mono", monospace';const s=/,\s*['"]?monospace['"]?\s*$/i;return s.test(i)?i.replace(s,', "Symbols Nerd Font Mono", monospace'):`${i}, "Symbols Nerd Font Mono", monospace`}function Ev(a){if(!a)return null;const i={};return a.background&&(i.background=a.background,i.cursorAccent=a.background),a.foreground&&(i.foreground=a.foreground),a.cursor&&(i.cursor=a.cursor),a.ansi&&Object.assign(i,a.ansi),Object.keys(i).length===0?null:i}function zg(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",Sp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Sp}const k=(a,i,s,r=!0)=>({id:a,labelKey:i,combo:s,verified:r}),Og={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[k("mode","mode","shift+tab"),k("rewind","rewind","esc esc"),k("details","details","ctrl+o"),k("model","model","alt+p"),k("thinking","thinking","alt+t"),k("todos","todos","ctrl+t"),k("background","background","ctrl+b"),k("editor","editor","ctrl+g"),k("history","history","ctrl+r"),k("stash","stash","ctrl+s"),k("pasteImage","pasteImage","ctrl+v"),k("newline","newline","ctrl+j"),k("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[k("mode","mode","shift+tab"),k("editPrevious","editPrevious","esc esc"),k("details","details","ctrl+t"),k("queue","queue","tab"),k("history","history","ctrl+r"),k("copy","copy","ctrl+o"),k("editor","editor","ctrl+g"),k("newline","newline","ctrl+j"),k("clear","clear","ctrl+l"),k("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[k("mode","mode","shift+tab"),k("yolo","yolo","ctrl+y"),k("rewind","rewind","esc esc"),k("todos","todos","ctrl+t"),k("expand","expand","ctrl+o"),k("background","background","ctrl+b"),k("editor","editor","ctrl+g"),k("history","history","ctrl+r"),k("undo","undo","ctrl+z"),k("newline","newline","ctrl+j"),k("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","esc"),k("history","history","ctrl+r"),k("newline","newline","ctrl+j"),k("todos","todos","ctrl+t",!1),k("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[k("agent","agent","tab"),k("agentBack","agentBack","shift+tab"),k("interrupt","interrupt","esc"),k("palette","palette","ctrl+p"),k("model","model","ctrl+x m"),k("recentModel","recentModel","f2"),k("variant","variant","ctrl+t"),k("newSession","newSession","ctrl+x n"),k("sessions","sessions","ctrl+x l"),k("undo","undo","ctrl+x u"),k("editor","editor","ctrl+x e"),k("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[k("agent","agent","tab",!1),k("agentBack","agentBack","shift+tab",!1),k("interrupt","interrupt","esc"),k("palette","palette","ctrl+p"),k("model","model","ctrl+x m"),k("recentModel","recentModel","f2"),k("variant","variant","ctrl+t"),k("newSession","newSession","ctrl+x n"),k("sessions","sessions","ctrl+x l"),k("undo","undo","ctrl+x u"),k("editor","editor","ctrl+x e"),k("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[k("thinkingMode","thinkingMode","shift+tab"),k("interrupt","interrupt","esc"),k("nextModel","nextModel","ctrl+p"),k("modelPicker","modelPicker","ctrl+l"),k("tools","tools","ctrl+o"),k("thinkingBlocks","thinkingBlocks","ctrl+t"),k("editor","editor","ctrl+g"),k("followup","followup","alt+enter"),k("dequeue","dequeue","alt+up"),k("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[k("thinkingMode","thinkingMode","shift+tab"),k("plan","plan","alt+shift+p"),k("model","model","alt+m"),k("temporaryModel","temporaryModel","alt+p"),k("nextModel","nextModel","ctrl+p"),k("tools","tools","ctrl+o"),k("thinking","thinking","ctrl+t"),k("history","history","ctrl+r"),k("editor","editor","ctrl+g"),k("followup","followup","ctrl+enter"),k("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","esc"),k("expand","expand","ctrl+o"),k("expandAll","expandAll","ctrl+e"),k("reasoning","reasoning","ctrl+t"),k("editor","editor","ctrl+g"),k("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[k("mode","mode","shift+tab"),k("review","review","ctrl+r"),k("newline","newline","ctrl+j"),k("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[k("specMode","specMode","shift+tab"),k("autonomy","autonomy","ctrl+l"),k("details","details","ctrl+o",!1),k("queue","queue","ctrl+enter"),k("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[k("plan","plan","shift+tab"),k("interrupt","interrupt","esc"),k("undoPicker","undoPicker","esc esc"),k("expand","expand","ctrl+o"),k("editor","editor","ctrl+g"),k("steer","steer","ctrl+s"),k("undo","undo","ctrl+-"),k("newline","newline","ctrl+j"),k("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[k("palette","palette","ctrl+o"),k("reasoning","reasoning","alt+d"),k("mode","mode","ctrl+s",!1),k("editor","editor","ctrl+g"),k("history","history","ctrl+r"),k("sidebar","sidebar","ctrl+backslash"),k("pasteImage","pasteImage","ctrl+v"),k("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[k("interrupt","interrupt","ctrl+c"),k("newline","newline","ctrl+j"),k("editor","editor","ctrl+g"),k("agents","agents","ctrl+t"),k("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[k("permissionMode","permissionMode","shift+tab"),k("bypass","bypass","ctrl+y"),k("tasks","tasks","ctrl+t"),k("editor","editor","ctrl+x"),k("history","history","ctrl+r"),k("queue","queue","ctrl+enter"),k("newline","newline","ctrl+j"),k("pasteImage","pasteImage","alt+v"),k("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","ctrl+c"),k("thinking","thinking","alt+t"),k("newline","newline","ctrl+j"),k("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","ctrl+c"),k("rewind","rewind","esc esc"),k("interject","interject","ctrl+enter"),k("multiline","multiline","ctrl+m"),k("newline","newline","alt+enter"),k("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[k("mode","mode","shift+tab"),k("interrupt","interrupt","ctrl+c"),k("background","background","ctrl+b"),k("approve","approve","ctrl+k"),k("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[k("interrupt","interrupt","ctrl+c"),k("thinking","thinking","ctrl+t"),k("expand","expand","ctrl+e"),k("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[k("permissionMode","permissionMode","shift+tab"),k("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[k("agentSwap","agentSwap","shift+tab"),k("interrupt","interrupt","esc"),k("details","details","ctrl+t"),k("steer","steer","ctrl+s"),k("expand","expand","ctrl+o"),k("activity","activity","ctrl+x"),k("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[k("planAct","planAct","tab"),k("autoApprove","autoApprove","shift+tab"),k("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[k("rewind","rewind","esc esc"),k("search","search","ctrl+f"),k("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[k("interrupt","interrupt","esc"),k("queue","queue","alt+enter"),k("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},$a=Og,Nv=Object.keys(Og),Tp={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"},Lv=[k("genericCtrlC","interrupt","ctrl+c"),k("genericCtrlD","eof","ctrl+d"),k("genericCtrlZ","suspend","ctrl+z"),k("genericCtrlL","clear","ctrl+l"),k("genericCtrlR","history","ctrl+r"),k("genericCtrlA","startOfLine","ctrl+a"),k("genericCtrlE","endOfLine","ctrl+e"),k("genericCtrlK","killToEnd","ctrl+k")],kv=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Rv=["genericCtrlC"];function _v(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function Mp(a){const i=_v(a);return Tp[i]?Tp[i]:/^muse-bin-\d/.test(i)?"muse":null}function jv(a,i="auto"){return i&&i!=="auto"?Mp(i)||"shell":Mp(a)||"shell"}function Dv(a,i){var u,d;const s=a.map(m=>{var y;const h=(y=i==null?void 0:i.actions)==null?void 0:y[m.id];let p=typeof(h==null?void 0:h.keys)=="string"?h.keys:m.combo;try{wi(p)}catch{p=m.combo}return{...m,defaultCombo:m.combo,combo:p,hidden:typeof(h==null?void 0:h.hidden)=="boolean"?h.hidden:m.defaultHidden===!0,custom:!1}}),r=new Set(s.map(m=>m.id));for(const m of(i==null?void 0:i.custom)||[]){if(!m||typeof m.id!="string"||r.has(m.id))continue;let h=m.keys;try{wi(h)}catch{continue}s.push({id:m.id,labelKey:"custom",defaultCombo:h,combo:h,verified:!0,hidden:((d=(u=i==null?void 0:i.actions)==null?void 0:u[m.id])==null?void 0:d.hidden)===!0,custom:!0,customLabel:m.label}),r.add(m.id)}if(Array.isArray(i==null?void 0:i.order)){const m=new Map(i.order.map((h,p)=>[h,p]));s.sort((h,p)=>(m.get(h.id)??Number.MAX_SAFE_INTEGER)-(m.get(p.id)??Number.MAX_SAFE_INTEGER))}return s}function zv(a,i){const s=new Set(a.map(r=>r.combo.trim().toLowerCase()));return i.filter(r=>!s.has(r.combo.trim().toLowerCase()))}const Ps=a=>a.id.startsWith("generic");function Bg(a,i){const s=$a[a],r=new Set([...s.bar||[],...a==="shell"?kv:Rv]),u=[...s.actions,...Lv].map(d=>({...d,defaultHidden:!r.has(d.id)}));return Dv(u,i)}function Ug(a,i){const s=Bg(a,i),r=s.filter(d=>!Ps(d)),u=new Set(zv(r,s.filter(Ps)));return s.filter(d=>!Ps(d)||u.has(d))}function Ov(a,i){const s=Ug(a,i).filter(r=>!r.hidden);return{agentActions:s.filter(r=>!Ps(r)),genericActions:s.filter(Ps)}}function Bv(a){const i={};for(const[s,r]of Object.entries(a.actions||{})){const u={...r};delete u.hidden,Object.keys(u).length>0&&(i[s]=u)}return{...a,actions:i}}const Hg=1568,Uv=3*1024*1024,Hv=[.85,.7,.55,.4],oi={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Kv(a,i,s=Hg){if(a<=0||i<=0)return{width:Math.max(1,a),height:Math.max(1,i)};const r=Math.max(a,i);if(r<=s)return{width:a,height:i};const u=s/r;return{width:Math.max(1,Math.round(a*u)),height:Math.max(1,Math.round(i*u))}}function Yv(a){if(typeof a!="string"||a.length===0)return 0;const i=a.length;let s=0;a.endsWith("==")?s=2:a.endsWith("=")&&(s=1);const r=Math.floor(i*3/4)-s;return Number.isFinite(r)&&r>0?r:0}function Gv(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function Iv(a){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(a,{imageOrientation:"from-image"});return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{try{const i=await createImageBitmap(a);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,s)=>{if(typeof Image>"u")return s(new Error("Image decoding not supported in this environment"));const r=new Image,u=URL.createObjectURL(a);r.onload=()=>{i({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,cleanup:()=>{try{URL.revokeObjectURL(u)}catch{}}})},r.onerror=()=>{try{URL.revokeObjectURL(u)}catch{}s(new Error("Failed to decode image source"))},r.src=u})}async function Kg(a,i=Hg,s=Uv){var u;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let r;try{r=await Iv(a)}catch(d){return console.warn("Failed to decode image for paste:",d),null}try{const{width:d,height:m}=Kv(r.width,r.height,i),h=document.createElement("canvas");h.width=d,h.height=m;const p=h.getContext("2d");if(!p)return null;p.drawImage(r.source,0,0,d,m);let y="image/webp";try{h.toDataURL("image/webp",.85).startsWith("data:image/webp")||(y="image/jpeg")}catch{y="image/jpeg"}for(const b of Hv){let v;try{v=h.toDataURL(y,b)}catch{continue}if(!v||!v.startsWith("data:"))continue;const S=v.indexOf(","),T=S!==-1?v.slice(S+1):"",E=Yv(T);if(E<=s)return{mime:y,dataBase64:T,dataUrl:v,byteLength:E,width:d,height:m}}return null}finally{(u=r.cleanup)==null||u.call(r)}}const $v=4e3,qv=3,Fv=4096,Vv=8*1024*1024,fo={ctrl:!1,alt:!1,shift:!1},Xv=3e4,Yg=w.createContext(null);function Ka(a){return{wsUrl:a.wsUrl,token:a.token||void 0,pairCode:a.pairCode||void 0,clientId:a.clientId,autoReconnect:a.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const Pv=({children:a})=>{const[i,s]=w.useState(Dg),[r,u]=w.useState("disconnected"),[d,m]=w.useState(),[h,p]=w.useState(),[y,b]=w.useState("viewer"),[v,S]=w.useState(),[T,E]=w.useState(),[Y,A]=w.useState(),[O,B]=w.useState(null),H=w.useRef(null),ee=w.useRef(null),re=w.useCallback(D=>{(D==null?void 0:D.phase)!=="starting"&&ee.current&&(clearTimeout(ee.current),ee.current=null),H.current=D,B(D)},[]),[J,G]=w.useState(null),[U,ae]=w.useState(),[ne,Se]=w.useState(null),[Ee,Ge]=w.useState(1),[st,Ie]=w.useState(0),[L,$]=w.useState(null),[le,Re]=w.useState(null),[W,et]=w.useState(null),[je,_e]=w.useState({cols:80,rows:24}),[$e,Be]=w.useState([]),Ze=jv(le==null?void 0:le.focusedAgent,"auto");w.useEffect(()=>{zg()},[]);const ft=w.useRef(i);ft.current=i;const De=w.useRef(null),qe=w.useRef(!1),Gt=w.useRef(je);Gt.current=je;const gt=w.useRef(new Set),ut=w.useRef(new Set),[F,ve]=w.useState(oi),Ce=w.useRef(null),At=w.useRef(0),N=w.useRef(null),ue=w.useCallback((D,I)=>wd(i.language,D,I),[i.language]),ce=w.useRef(ue);ce.current=ue;const Ve=w.useRef(null),lt=w.useRef([]),at=w.useRef(0),Et=w.useCallback(D=>{for(lt.current.push(D),at.current+=D.byteLength;lt.current.length>Fv||at.current>Vv;){const I=lt.current.shift();if(!I)break;at.current-=I.byteLength}},[]),he=w.useCallback(D=>{const I=Ve.current;if(I)try{I(D);return}catch(de){console.debug("Terminal output sink threw, buffering chunk instead:",de)}Et(D)},[Et]),Le=w.useRef(he);Le.current=he;const Fe=w.useCallback(D=>{Ve.current=D;const I=lt.current;lt.current=[],at.current=0;for(let de=0;de<I.length;de++)try{D(I[de])}catch(Te){console.debug("Terminal sink threw while flushing, re-buffering the tail:",Te);for(let pe=de;pe<I.length;pe++)Et(I[pe]);break}return()=>{Ve.current===D&&(Ve.current=null)}},[Et]),dt=w.useCallback(()=>lt.current.length,[]),Dt=w.useCallback(()=>{lt.current=[],at.current=0},[]),Cn=w.useCallback((D=!0)=>{b("viewer"),S(void 0),E(void 0),A(void 0),G(null),ae(void 0),Se(null),Ge(1),$(null),Dt(),D&&Ie(I=>I+1)},[Dt]),Bt=w.useRef([]),mn=w.useRef(new Map),pn=w.useCallback(D=>{Bt.current=D,Be(D)},[]),Zt=w.useCallback(D=>{const I=mn.current.get(D);I&&(clearTimeout(I),mn.current.delete(D)),pn(Bt.current.filter(de=>de.id!==D))},[pn]),wt=w.useRef(Zt);wt.current=Zt;const Qe=w.useCallback((D,I)=>{const de=Date.now(),Te=Bt.current,pe=Te.find(St=>St.type===D&&St.message===I),ze=pe?pe.id:`${de}-${Math.random().toString(36).substring(2,6)}`;let Xe;if(pe)Xe=Te.map(St=>St.id===ze?{...St,count:St.count+1,timestamp:de}:St);else for(Xe=[...Te,{id:ze,type:D,message:I,timestamp:de,count:1}];Xe.length>qv;){const[St,...ki]=Xe,Q=mn.current.get(St.id);Q&&(clearTimeout(Q),mn.current.delete(St.id)),Xe=ki}pn(Xe);const It=mn.current.get(ze);It&&clearTimeout(It),mn.current.set(ze,setTimeout(()=>wt.current(ze),$v))},[pn]),zt=w.useCallback(D=>{wt.current(D)},[]),Zi=w.useRef(!0);w.useEffect(()=>{y==="controller"&&(Zi.current=!0)},[y]);const Qt=w.useCallback(()=>{Zi.current&&(Zi.current=!1,Qe("warning",ce.current("toasts.viewerModeWarning")))},[Qe]);w.useEffect(()=>{const D=mn.current;return()=>{for(const I of D.values())clearTimeout(I);D.clear()}},[]);const jn=w.useCallback(D=>{const I=Nl(D);ft.current=I,s(I)},[]),Ci=w.useCallback(D=>{jn({language:D})},[jn]),bt=w.useCallback(D=>{ft.current=D,s(D)},[]),Ti=w.useCallback(D=>{var pe;const I=ft.current,de=vp({...D,wsUrl:D.wsUrl||"/ws/client",token:D.token||"",displayName:D.displayName||`Herdr ${I.profiles.length+1}`,autoReconnect:D.autoReconnect!==!1},I.profiles.length),Te=Nl({profiles:[...I.profiles,de],activeProfileId:de.id,wsUrl:de.wsUrl,token:de.token,pairCode:de.pairCode||"",autoReconnect:de.autoReconnect});bt(Te),Cn(),(pe=De.current)==null||pe.reconnectWith(Ka(Te))},[bt,Cn]),Tn=w.useCallback(D=>{var pe;const I=ft.current,de=I.profiles.find(ze=>ze.id===D);if(!de||de.id===I.activeProfileId)return;const Te=Nl({activeProfileId:de.id,wsUrl:de.wsUrl,token:de.token,pairCode:de.pairCode||"",autoReconnect:de.autoReconnect,profiles:I.profiles.map(ze=>ze.id===de.id?{...ze,lastUsedAt:Date.now()}:ze)});bt(Te),Cn(),(pe=De.current)==null||pe.reconnectWith(Ka(Te))},[bt,Cn]),Mi=w.useCallback((D,I)=>{const de=ft.current;if(!de.profiles.find(Xe=>Xe.id===D))return;const pe=I.trim().slice(0,64);if(!pe)return;const ze=Nl({profiles:de.profiles.map(Xe=>Xe.id===D?{...Xe,displayName:pe}:Xe)});bt(ze)},[bt]),fi=w.useCallback(D=>{var ze;const I=ft.current;if(!I.profiles.some(Xe=>Xe.id===D))return;const de=I.profiles.filter(Xe=>Xe.id!==D),Te=de.find(Xe=>Xe.id===I.activeProfileId)||de[0],pe=Nl(Te?{profiles:de,activeProfileId:Te.id,wsUrl:Te.wsUrl,token:Te.token,pairCode:Te.pairCode||"",autoReconnect:Te.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});bt(pe),D===I.activeProfileId&&(Cn(),(ze=De.current)==null||ze.reconnectWith(Ka(pe)))},[bt,Cn]),_l=w.useCallback(D=>{const I=ft.current,de=I.profiles.find(te=>te.id===I.activeProfileId),Te=D.hostId?xp({wsUrl:I.wsUrl,hostId:D.hostId}):null,pe=Te?I.profiles.findIndex(te=>xp(te)===Te):-1,ze=pe>=0?pe:Math.max(0,I.profiles.findIndex(te=>te.id===I.activeProfileId)),It={...I.profiles[ze]||de||vp({wsUrl:I.wsUrl||"/ws/client",token:"",pairCode:I.pairCode||"PENDING",displayName:`Herdr ${I.profiles.length+1}`},I.profiles.length),token:D.token,pairCode:void 0,...D.hostId?{hostId:D.hostId}:{},...D.deviceId?{deviceId:D.deviceId}:{},lastUsedAt:Date.now()};let St=[...I.profiles];ze>=0&&ze<St.length?St[ze]=It:St.push(It);const ki=de==null?void 0:de.id;St=St.filter((te,xe)=>xe===ze||te.id===It.id?!0:!(pe>=0&&ki&&te.id===ki));const Q=Nl({profiles:St,activeProfileId:It.id,wsUrl:It.wsUrl,token:It.token,pairCode:"",autoReconnect:It.autoReconnect});return bt(Q),Q},[bt]),Dn=w.useCallback(D=>{const I=ft.current,de=I.profiles.find(Xe=>Xe.id===I.activeProfileId);if(!de||!D.hostId&&!D.hostname)return;const Te=/^Herdr \d+$/.test(de.displayName),pe={...de,...D.hostId?{hostId:D.hostId}:{},...D.hostname?{hostname:D.hostname}:{},...D.hostname&&Te?{displayName:D.hostname}:{}},ze=Nl({profiles:I.profiles.map(Xe=>Xe.id===de.id?pe:Xe)});bt(ze)},[bt]);if(!De.current){const D=new av(Ka(i));De.current=D,D.on("stateChange",(I,de,Te)=>{u(I),p(Te);const pe=Te?`serverErrors.${Te}`:null,ze=pe?ce.current(pe):null,Xe=ze&&ze!==pe?ze:de;m(Xe),I==="connected"?Qe("success",ce.current("toasts.connected")):I==="error"&&Qe("error",Xe||ce.current("toasts.connectionError")),I!=="connected"&&Re(null),I!=="connected"&&re(null)}),D.on("ready",I=>{qe.current&&(Dt(),Ie(de=>de+1)),qe.current=!0,re(null),b(I.role),S(I.controllerId),E(I.hostId),A(I.hostname),Dn(I),I.clientId&&ae(I.clientId),G(I.terminalPalette||null)}),D.on("hostReconnecting",I=>{p(I||"host_reconnecting"),m(ce.current(`serverErrors.${I||"host_reconnecting"}`)),b("viewer"),S(void 0),A(void 0),G(null),Se(null),Ge(1),$(null),Dt()}),D.on("sessionRestarted",(I,de,Te,pe)=>{Dt(),A(pe),Dn({hostId:D.getHostId(),hostname:pe}),G(Te||null),Ie(ze=>ze+1)}),D.on("roleChange",(I,de,Te,pe)=>{b(I),S(de),Te&&E(Te),pe&&ae(pe)}),D.on("controlGranted",()=>{b("controller"),Qe("success",ce.current("toasts.controlGranted"))}),D.on("controlDenied",I=>{Qe("warning",I||ce.current("toasts.controlDenied"))}),D.on("controlRevoked",I=>{b("viewer"),Qe("warning",I||ce.current("toasts.controlRevoked"))}),D.on("paired",I=>{const de=_l(I);Qe("success",ce.current("toasts.pairedSuccess")),et(Date.now()),D.reconnectWith(Ka(de))}),D.on("exit",(I,de)=>{Qe("info",`${ce.current("toasts.sessionEnded")}${de?`: ${de}`:""}${I!==void 0?` (${I})`:""}`)}),D.on("status",I=>{$(I)}),D.on("error",I=>{var Xe;if(I.code==="herdr_not_running"){((Xe=H.current)==null?void 0:Xe.phase)!=="starting"&&re({phase:"stopped"});return}if(I.code==="herdr_start_failed"&&H.current){re({phase:"failed",message:I.message||""});return}Ce.current!==null&&(N.current&&(clearTimeout(N.current),N.current=null),Ce.current=null,ve(oi));const Te=`serverErrors.${String(I.code)}`,pe=ce.current(Te),ze=pe&&pe!==Te?pe:I.message||`[${I.code}]`;Qe("error",ze)}),D.on("pasteFileReady",I=>{const de=Ce.current;de!==null&&(N.current&&(clearTimeout(N.current),N.current=null),ve({active:!0,phase:"completed",ratio:1,percent:100,statusText:ce.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{Ce.current===de&&(Ce.current=null,ve(oi))},1200));for(const Te of gt.current)try{Te(I)}catch(pe){console.error("Error in pasteFileReady listener:",pe)}}),D.on("rttUpdate",I=>{Se(I)}),D.on("peerCount",I=>{Ge(Math.max(1,I))}),D.on("sessionReady",()=>{u("connected"),re(null)}),D.on("agentStatus",I=>{Re(I)}),D.on("binaryData",I=>{Le.current(I)})}const Mn=De.current,An=i.profiles.find(D=>D.id===i.activeProfileId);w.useEffect(()=>{var D;(D=De.current)==null||D.updateConfig(Ka(i))},[i]);const Ai=w.useCallback(D=>{De.current&&(D&&De.current.updateConfig(D),De.current.connect(Gt.current))},[]),ra=w.useCallback(()=>{De.current&&De.current.disconnect()},[]),jl=w.useCallback(()=>{const D=De.current;D&&(re({phase:"starting"}),D.sendHerdrStart(),ee.current=setTimeout(()=>{var I;ee.current=null,((I=H.current)==null?void 0:I.phase)==="starting"&&re({phase:"failed",message:ce.current("herdrLaunch.timeout")})},Xv))},[re]);w.useEffect(()=>()=>{ee.current&&clearTimeout(ee.current)},[]);const Dl=w.useCallback((D=!1)=>{De.current&&De.current.claimControl(D)},[]),Qi=w.useCallback(()=>{var D;(D=De.current)==null||D.releaseControl()},[]),Wi=w.useCallback(D=>{if(y!=="controller"){Qt();return}const I=De.current;if(!I)return;const de=gd(D);for(const Te of ut.current)try{Te(de)}catch(pe){console.debug("Key input observer threw:",pe)}I.sendInput(de)},[y,Qt]),Ei=w.useCallback(D=>(ut.current.add(D),()=>{ut.current.delete(D)}),[]),[Ni,zn]=w.useState(fo),Lt=w.useRef(fo),tn=w.useCallback(D=>{const I={...Lt.current,[D]:!Lt.current[D]};Lt.current=I,zn(I)},[]),hi=w.useCallback(()=>{const D=Lt.current;return!D.ctrl&&!D.alt&&!D.shift?null:(Lt.current=fo,zn(fo),D)},[]);w.useEffect(()=>{const D=De.current;return D?sv(D):void 0},[]);const zl=w.useCallback(D=>{y!=="controller"&&!Mo(D)||De.current&&De.current.sendInput(D)},[y]),Za=w.useCallback((D,I)=>{Gt.current={cols:D,rows:I},_e({cols:D,rows:I}),De.current&&De.current.sendResize(D,I)},[]),Ji=w.useCallback((D,I)=>y!=="controller"?(Qt(),!1):De.current?(De.current.sendPasteFile(D,I),!0):!1,[y,Qt]),Ol=w.useCallback(D=>(gt.current.add(D),()=>{gt.current.delete(D)}),[]),$n=w.useCallback(()=>{N.current&&(clearTimeout(N.current),N.current=null),Ce.current=null,ve(oi)},[]);w.useEffect(()=>{r!=="connected"&&Ce.current!==null&&(N.current&&(clearTimeout(N.current),N.current=null),Ce.current=null,ve(oi))},[r]),w.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]);const Li=w.useCallback(async D=>{if(y!=="controller")return Qt(),!1;if(!De.current||r!=="connected")return Qe("error",ue("serverErrors.host_offline")),!1;if(Ce.current!==null)return!1;const I=++At.current;Ce.current=I,N.current&&(clearTimeout(N.current),N.current=null);const de="dataBase64"in D&&typeof D.dataBase64=="string";try{let Te;if(de)Te=D;else{const ze=D;if(ve({active:!0,phase:"reading",ratio:.1,percent:10,statusText:ue("virtualKeyboard.uploadProgressReading")}),!ze||ze.size===0)return Qe("error",ue("clipboard.fileEmpty")),Ce.current=null,ve(oi),!1;if(ze.type&&!ze.type.startsWith("image/"))return Qe("error",ue("clipboard.unsupportedType")),Ce.current=null,ve(oi),!1;ve({active:!0,phase:"processing",ratio:.35,percent:35,statusText:ue("virtualKeyboard.uploadProgressProcessing")});const Xe=await Kg(ze);if(Ce.current!==I)return!1;if(!Xe)return Qe("error",ue("clipboard.imageTooLarge")),Ce.current=null,ve(oi),!1;Te=Xe,ve({active:!0,phase:"processing",ratio:.6,percent:60,statusText:ue("virtualKeyboard.uploadProgressProcessing")})}ve({active:!0,phase:"sending",ratio:.75,percent:75,statusText:ue("virtualKeyboard.uploadProgressSending")});const pe=Ji(Te.mime,Te.dataBase64);return Ce.current!==I?!1:pe?(ve({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:ue("virtualKeyboard.uploadProgressWaitingHost")}),N.current=setTimeout(()=>{Ce.current===I&&(Ce.current=null,Qe("error",ue("serverErrors.paste_file_write_failed")),ve(oi))},3e4),!0):(Ce.current=null,ve(oi),!1)}catch(Te){return console.error("Failed to process/upload image:",Te),Ce.current===I&&(Ce.current=null,Qe("error",ue("clipboard.imageTooLarge")),ve(oi)),!1}},[y,r,Qt,Qe,ue,Ji]);return f.jsx(Yg.Provider,{value:{connectionState:r,stateDetail:d,stateCode:h,role:y,controllerId:v,hostId:T,hostname:Y,assignedClientId:U,profiles:i.profiles,activeProfileId:i.activeProfileId,activeProfile:An,isController:y==="controller",sharedWindowCount:Ee,terminalResetVersion:st,rttMs:ne,statusPayload:L,agentStatus:le,agentProfile:Ze,lastPairedAt:W,settings:i,hostPalette:J,terminalDimensions:je,toasts:$e,adapter:Mn,language:i.language,t:ue,setLanguage:Ci,connect:Ai,disconnect:ra,switchProfile:Tn,addProfileAndConnect:Ti,renameProfile:Mi,removeProfile:fi,claimControl:Dl,releaseControl:Qi,sendKey:Wi,observeKeyInput:Ei,modifierLatch:Ni,toggleModifierLatch:tn,consumeModifierLatch:hi,sendBinary:zl,sendResize:Za,updateSettings:jn,addToast:Qe,removeToast:zt,warnViewerMode:Qt,subscribeToOutput:Fe,getPendingOutputChunkCount:dt,sendPasteFile:Ji,subscribeToPasteFileReady:Ol,uploadProgress:F,uploadImage:Li,resetUploadProgress:$n,herdrLaunch:O,startHerdr:jl},children:a})};function Nt(){const a=w.useContext(Yg);if(!a)throw new Error("useTerminal must be used within a TerminalProvider");return a}function er(a){var i,s;return a?{blocked:((i=a.counts)==null?void 0:i.blocked)??0,done:((s=a.counts)==null?void 0:s.done)??0}:null}function Zv(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function Qv(a){if(!a)return"";const i=[];return a.blocked>0&&i.push(`${a.blocked}⚠`),a.done>0&&i.push(`${a.done}✓`),i.length>0?`(${i.join(" ")})`:""}function Wv(a,i){if(!a||!i)return null;const s=new Map(a.agents.map(m=>[m.paneId,m.status]));let r=null;for(const m of i.agents)if(!(m.status!=="blocked"&&m.status!=="done")&&s.get(m.paneId)!==m.status){if(m.status==="blocked")return"blocked";r="done"}const u=er(a),d=er(i);return d.blocked>u.blocked?"blocked":(!r&&d.done>u.done&&(r="done"),r)}const Jv={blocked:"%23f9e2af",done:"%23a6e3a1"};function ex(a){return`<circle cx='19' cy='5' r='4.5' fill='${Jv[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function tx(a,i){return!i||!a.includes("</svg>")?a:a.replace("</svg>",`${ex(i)}</svg>`)}function Ap(a,i=document){const s=i.querySelector('link[rel~="icon"]');if(!s)return;s.dataset.baseHref===void 0&&(s.dataset.baseHref=s.getAttribute("href")??"");const r=tx(s.dataset.baseHref,a);s.getAttribute("href")!==r&&s.setAttribute("href",r)}let di=null;function nx(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function Gg(){const a=nx();if(a)try{di=di??new a,di.state==="suspended"&&di.resume()}catch{di=null}}function ix(a=window){const i=()=>{Gg(),s()},s=()=>{a.removeEventListener("pointerdown",i),a.removeEventListener("keydown",i)};return a.addEventListener("pointerdown",i),a.addEventListener("keydown",i),s}const lx={blocked:[880,660],done:[660,880]};function Ig(a){if(!(!di||di.state!=="running"))try{const i=di.currentTime;lx[a].forEach((s,r)=>{const u=di.createOscillator(),d=di.createGain(),m=i+r*.11;u.type="sine",u.frequency.value=s,d.gain.setValueAtTime(1e-4,m),d.gain.exponentialRampToValueAtTime(.06,m+.01),d.gain.exponentialRampToValueAtTime(1e-4,m+.09),u.connect(d),d.connect(di.destination),u.start(m),u.stop(m+.1)})}catch{}}const ax=15e3,sx={blocked:[70,50,70],done:[40]};function rx(){const{agentStatus:a,settings:i,t:s}=Nt(),r=w.useRef(i);r.current=i;const u=w.useRef(s);u.current=s;const d=w.useRef(null),m=w.useRef(Number.NEGATIVE_INFINITY);w.useEffect(()=>{Ap(i.agentAlertBadge?Zv(er(a)):null)},[a,i.agentAlertBadge]),w.useEffect(()=>()=>Ap(null),[]),w.useEffect(()=>{if(!(!i.agentAlertSound||typeof window>"u"))return ix(window)},[i.agentAlertSound]),w.useEffect(()=>{const h=d.current;d.current=a;const p=Wv(h,a);if(!p)return;const y=Date.now();if(y-m.current<ax)return;m.current=y;const b=r.current,v=typeof document<"u"&&document.visibilityState==="hidden",S=v||typeof document<"u"&&!document.hasFocus();if(b.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(sx[p])}catch{}if(b.agentAlertSound&&S&&Ig(p),b.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const T=er(a),E=p==="blocked"?u.current("agents.notifyBlocked",{count:T.blocked}):u.current("agents.notifyDone",{count:T.done});try{new Notification("Herdr Remote",{body:E,tag:"herdr-agents"})}catch{}}},[a])}function $g(a){var i,s,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var u=a.length;for(i=0;i<u;i++)a[i]&&(s=$g(a[i]))&&(r&&(r+=" "),r+=s)}else for(s in a)a[s]&&(r&&(r+=" "),r+=s);return r}function ox(){for(var a,i,s=0,r="",u=arguments.length;s<u;s++)(a=arguments[s])&&(i=$g(a))&&(r&&(r+=" "),r+=i);return r}const cx=(a,i)=>{const s=new Array(a.length+i.length);for(let r=0;r<a.length;r++)s[r]=a[r];for(let r=0;r<i.length;r++)s[a.length+r]=i[r];return s},ux=(a,i)=>({classGroupId:a,validator:i}),qg=(a=new Map,i=null,s)=>({nextPart:a,validators:i,classGroupId:s}),Lo="-",Ep=[],dx="arbitrary..",fx=a=>{const i=mx(a),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return hx(m);const h=m.split(Lo),p=h[0]===""&&h.length>1?1:0;return Fg(h,p,i)},getConflictingClassGroupIds:(m,h)=>{if(h){const p=r[m],y=s[m];return p?y?cx(y,p):p:y||Ep}return s[m]||Ep}}},Fg=(a,i,s)=>{if(a.length-i===0)return s.classGroupId;const u=a[i],d=s.nextPart.get(u);if(d){const y=Fg(a,i+1,d);if(y)return y}const m=s.validators;if(m===null)return;const h=i===0?a.join(Lo):a.slice(i).join(Lo),p=m.length;for(let y=0;y<p;y++){const b=m[y];if(b.validator(h))return b.classGroupId}},hx=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=a.slice(1,-1),s=i.indexOf(":"),r=i.slice(0,s);return r?dx+r:void 0})(),mx=a=>{const{theme:i,classGroups:s}=a;return px(s,i)},px=(a,i)=>{const s=qg();for(const r in a){const u=a[r];Sd(u,s,r,i)}return s},Sd=(a,i,s,r)=>{const u=a.length;for(let d=0;d<u;d++){const m=a[d];gx(m,i,s,r)}},gx=(a,i,s,r)=>{if(typeof a=="string"){bx(a,i,s);return}if(typeof a=="function"){yx(a,i,s,r);return}vx(a,i,s,r)},bx=(a,i,s)=>{const r=a===""?i:Vg(i,a);r.classGroupId=s},yx=(a,i,s,r)=>{if(xx(a)){Sd(a(r),i,s,r);return}i.validators===null&&(i.validators=[]),i.validators.push(ux(s,a))},vx=(a,i,s,r)=>{const u=Object.entries(a),d=u.length;for(let m=0;m<d;m++){const[h,p]=u[m];Sd(p,Vg(i,h),s,r)}},Vg=(a,i)=>{let s=a;const r=i.split(Lo),u=r.length;for(let d=0;d<u;d++){const m=r[d];let h=s.nextPart.get(m);h||(h=qg(),s.nextPart.set(m,h)),s=h}return s},xx=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,wx=a=>{if(a<1)return{get:()=>{},set:()=>{}};let i=0,s=Object.create(null),r=Object.create(null);const u=(d,m)=>{s[d]=m,i++,i>a&&(i=0,r=s,s=Object.create(null))};return{get(d){let m=s[d];if(m!==void 0)return m;if((m=r[d])!==void 0)return u(d,m),m},set(d,m){d in s?s[d]=m:u(d,m)}}},ud="!",Np=":",Sx=[],Lp=(a,i,s,r,u)=>({modifiers:a,hasImportantModifier:i,baseClassName:s,maybePostfixModifierPosition:r,isExternal:u}),Cx=a=>{const{prefix:i,experimentalParseClassName:s}=a;let r=u=>{const d=[];let m=0,h=0,p=0,y;const b=u.length;for(let Y=0;Y<b;Y++){const A=u[Y];if(m===0&&h===0){if(A===Np){d.push(u.slice(p,Y)),p=Y+1;continue}if(A==="/"){y=Y;continue}}A==="["?m++:A==="]"?m--:A==="("?h++:A===")"&&h--}const v=d.length===0?u:u.slice(p);let S=v,T=!1;v.endsWith(ud)?(S=v.slice(0,-1),T=!0):v.startsWith(ud)&&(S=v.slice(1),T=!0);const E=y&&y>p?y-p:void 0;return Lp(d,T,S,E)};if(i){const u=i+Np,d=r;r=m=>m.startsWith(u)?d(m.slice(u.length)):Lp(Sx,!1,m,void 0,!0)}if(s){const u=r;r=d=>s({className:d,parseClassName:u})}return r},Tx=a=>{const i=new Map;return a.orderSensitiveModifiers.forEach((s,r)=>{i.set(s,1e6+r)}),s=>{const r=[];let u=[];for(let d=0;d<s.length;d++){const m=s[d],h=m[0]==="[",p=i.has(m);h||p?(u.length>0&&(u.sort(),r.push(...u),u=[]),r.push(m)):u.push(m)}return u.length>0&&(u.sort(),r.push(...u)),r}},Mx=a=>({cache:wx(a.cacheSize),parseClassName:Cx(a),sortModifiers:Tx(a),postfixLookupClassGroupIds:Ax(a),...fx(a)}),Ax=a=>{const i=Object.create(null),s=a.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)i[s[r]]=!0;return i},Ex=/\s+/,Nx=(a,i)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:u,sortModifiers:d,postfixLookupClassGroupIds:m}=i,h=[],p=a.trim().split(Ex);let y="";for(let b=p.length-1;b>=0;b-=1){const v=p[b],{isExternal:S,modifiers:T,hasImportantModifier:E,baseClassName:Y,maybePostfixModifierPosition:A}=s(v);if(S){y=v+(y.length>0?" "+y:y);continue}let O=!!A,B;if(O){const G=Y.substring(0,A);B=r(G);const U=B&&m[B]?r(Y):void 0;U&&U!==B&&(B=U,O=!1)}else B=r(Y);if(!B){if(!O){y=v+(y.length>0?" "+y:y);continue}if(B=r(Y),!B){y=v+(y.length>0?" "+y:y);continue}O=!1}const H=T.length===0?"":T.length===1?T[0]:d(T).join(":"),ee=E?H+ud:H,re=ee+B;if(h.indexOf(re)>-1)continue;h.push(re);const J=u(B,O);for(let G=0;G<J.length;++G){const U=J[G];h.push(ee+U)}y=v+(y.length>0?" "+y:y)}return y},Lx=(...a)=>{let i=0,s,r,u="";for(;i<a.length;)(s=a[i++])&&(r=Xg(s))&&(u&&(u+=" "),u+=r);return u},Xg=a=>{if(typeof a=="string")return a;let i,s="";for(let r=0;r<a.length;r++)a[r]&&(i=Xg(a[r]))&&(s&&(s+=" "),s+=i);return s},kx=(a,...i)=>{let s,r,u,d;const m=p=>{const y=i.reduce((b,v)=>v(b),a());return s=Mx(y),r=s.cache.get,u=s.cache.set,d=h,h(p)},h=p=>{const y=r(p);if(y)return y;const b=Nx(p,s);return u(p,b),b};return d=m,(...p)=>d(Lx(...p))},Rx=[],en=a=>{const i=s=>s[a]||Rx;return i.isThemeGetter=!0,i},Pg=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Zg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_x=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,jx=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Dx=/\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$/,zx=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ox=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bx=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ll=a=>_x.test(a),Pe=a=>!!a&&!Number.isNaN(Number(a)),vi=a=>!!a&&Number.isInteger(Number(a)),$u=a=>a.endsWith("%")&&Pe(a.slice(0,-1)),Vi=a=>jx.test(a),Qg=()=>!0,Ux=a=>Dx.test(a)&&!zx.test(a),Cd=()=>!1,Hx=a=>Ox.test(a),Kx=a=>Bx.test(a),Yx=a=>!ge(a)&&!be(a),Gx=a=>a.startsWith("@container")&&(a[10]==="/"&&a[11]!==void 0||a[11]==="s"&&a[16]!==void 0&&a.startsWith("-size/",10)||a[11]==="n"&&a[18]!==void 0&&a.startsWith("-normal/",10)),Ix=a=>Rl(a,eb,Cd),ge=a=>Pg.test(a),Jl=a=>Rl(a,tb,Ux),kp=a=>Rl(a,Qx,Pe),$x=a=>Rl(a,ib,Qg),qx=a=>Rl(a,nb,Cd),Rp=a=>Rl(a,Wg,Cd),Fx=a=>Rl(a,Jg,Kx),ho=a=>Rl(a,lb,Hx),be=a=>Zg.test(a),Hs=a=>sa(a,tb),Vx=a=>sa(a,nb),_p=a=>sa(a,Wg),Xx=a=>sa(a,eb),Px=a=>sa(a,Jg),mo=a=>sa(a,lb,!0),Zx=a=>sa(a,ib,!0),Rl=(a,i,s)=>{const r=Pg.exec(a);return r?r[1]?i(r[1]):s(r[2]):!1},sa=(a,i,s=!1)=>{const r=Zg.exec(a);return r?r[1]?i(r[1]):s:!1},Wg=a=>a==="position"||a==="percentage",Jg=a=>a==="image"||a==="url",eb=a=>a==="length"||a==="size"||a==="bg-size",tb=a=>a==="length",Qx=a=>a==="number",nb=a=>a==="family-name",ib=a=>a==="number"||a==="weight",lb=a=>a==="shadow",Wx=()=>{const a=en("color"),i=en("font"),s=en("text"),r=en("font-weight"),u=en("tracking"),d=en("leading"),m=en("breakpoint"),h=en("container"),p=en("spacing"),y=en("radius"),b=en("shadow"),v=en("inset-shadow"),S=en("text-shadow"),T=en("drop-shadow"),E=en("blur"),Y=en("perspective"),A=en("aspect"),O=en("ease"),B=en("animate"),H=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],re=()=>[...ee(),be,ge],J=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto","contain","none"],U=()=>[be,ge,p],ae=()=>[Ll,"full","auto",...U()],ne=()=>[vi,"none","subgrid",be,ge],Se=()=>["auto",{span:["full",vi,be,ge]},vi,be,ge],Ee=()=>[vi,"auto",be,ge],Ge=()=>["auto","min","max","fr",be,ge],st=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ie=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...U()],$=()=>[Ll,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...U()],le=()=>[Ll,"screen","full","dvw","lvw","svw","min","max","fit",...U()],Re=()=>[Ll,"screen","full","lh","dvh","lvh","svh","min","max","fit",...U()],W=()=>[a,be,ge],et=()=>[...ee(),_p,Rp,{position:[be,ge]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_e=()=>["auto","cover","contain",Xx,Ix,{size:[be,ge]}],$e=()=>[$u,Hs,Jl],Be=()=>["","none","full",y,be,ge],Ze=()=>["",Pe,Hs,Jl],ft=()=>["solid","dashed","dotted","double"],De=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],qe=()=>[Pe,$u,_p,Rp],Gt=()=>["","none",E,be,ge],gt=()=>["none",Pe,be,ge],ut=()=>["none",Pe,be,ge],F=()=>[Pe,be,ge],ve=()=>[Ll,"full",...U()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vi],breakpoint:[Vi],color:[Qg],container:[Vi],"drop-shadow":[Vi],ease:["in","out","in-out"],font:[Yx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vi],shadow:[Vi],spacing:["px",Pe],text:[Vi],"text-shadow":[Vi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ll,ge,be,A]}],container:["container"],"container-type":[{"@container":["","normal","size",be,ge]}],"container-named":[Gx],columns:[{columns:[Pe,ge,be,h]}],"break-after":[{"break-after":H()}],"break-before":[{"break-before":H()}],"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:re()}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ae()}],"inset-x":[{"inset-x":ae()}],"inset-y":[{"inset-y":ae()}],start:[{"inset-s":ae(),start:ae()}],end:[{"inset-e":ae(),end:ae()}],"inset-bs":[{"inset-bs":ae()}],"inset-be":[{"inset-be":ae()}],top:[{top:ae()}],right:[{right:ae()}],bottom:[{bottom:ae()}],left:[{left:ae()}],visibility:["visible","invisible","collapse"],z:[{z:[vi,"auto",be,ge]}],basis:[{basis:[Ll,"full","auto",h,...U()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pe,Ll,"auto","initial","none",ge]}],grow:[{grow:["",Pe,be,ge]}],shrink:[{shrink:["",Pe,be,ge]}],order:[{order:[vi,"first","last","none",be,ge]}],"grid-cols":[{"grid-cols":ne()}],"col-start-end":[{col:Se()}],"col-start":[{"col-start":Ee()}],"col-end":[{"col-end":Ee()}],"grid-rows":[{"grid-rows":ne()}],"row-start-end":[{row:Se()}],"row-start":[{"row-start":Ee()}],"row-end":[{"row-end":Ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ge()}],"auto-rows":[{"auto-rows":Ge()}],gap:[{gap:U()}],"gap-x":[{"gap-x":U()}],"gap-y":[{"gap-y":U()}],"justify-content":[{justify:[...st(),"normal"]}],"justify-items":[{"justify-items":[...Ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ie()]}],"align-content":[{content:["normal",...st()]}],"align-items":[{items:[...Ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":st()}],"place-items":[{"place-items":[...Ie(),"baseline"]}],"place-self":[{"place-self":["auto",...Ie()]}],p:[{p:U()}],px:[{px:U()}],py:[{py:U()}],ps:[{ps:U()}],pe:[{pe:U()}],pbs:[{pbs:U()}],pbe:[{pbe:U()}],pt:[{pt:U()}],pr:[{pr:U()}],pb:[{pb:U()}],pl:[{pl:U()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mbs:[{mbs:L()}],mbe:[{mbe:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":U()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":U()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],"inline-size":[{inline:["auto",...le()]}],"min-inline-size":[{"min-inline":["auto",...le()]}],"max-inline-size":[{"max-inline":["none",...le()]}],"block-size":[{block:["auto",...Re()]}],"min-block-size":[{"min-block":["auto",...Re()]}],"max-block-size":[{"max-block":["none",...Re()]}],w:[{w:[h,"screen",...$()]}],"min-w":[{"min-w":[h,"screen","none",...$()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[m]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",s,Hs,Jl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Zx,$x]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$u,ge]}],"font-family":[{font:[Vx,qx,i]}],"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:[u,be,ge]}],"line-clamp":[{"line-clamp":[Pe,"none",be,kp]}],leading:[{leading:[d,...U()]}],"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:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ft(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pe,"from-font","auto",be,Jl]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Pe,"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:U()}],"tab-size":[{tab:[vi,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:et()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:_e()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vi,be,ge],radial:["",be,ge],conic:[vi,be,ge]},Px,Fx]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:$e()}],"gradient-via-pos":[{via:$e()}],"gradient-to-pos":[{to:$e()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Be()}],"rounded-s":[{"rounded-s":Be()}],"rounded-e":[{"rounded-e":Be()}],"rounded-t":[{"rounded-t":Be()}],"rounded-r":[{"rounded-r":Be()}],"rounded-b":[{"rounded-b":Be()}],"rounded-l":[{"rounded-l":Be()}],"rounded-ss":[{"rounded-ss":Be()}],"rounded-se":[{"rounded-se":Be()}],"rounded-ee":[{"rounded-ee":Be()}],"rounded-es":[{"rounded-es":Be()}],"rounded-tl":[{"rounded-tl":Be()}],"rounded-tr":[{"rounded-tr":Be()}],"rounded-br":[{"rounded-br":Be()}],"rounded-bl":[{"rounded-bl":Be()}],"border-w":[{border:Ze()}],"border-w-x":[{"border-x":Ze()}],"border-w-y":[{"border-y":Ze()}],"border-w-s":[{"border-s":Ze()}],"border-w-e":[{"border-e":Ze()}],"border-w-bs":[{"border-bs":Ze()}],"border-w-be":[{"border-be":Ze()}],"border-w-t":[{"border-t":Ze()}],"border-w-r":[{"border-r":Ze()}],"border-w-b":[{"border-b":Ze()}],"border-w-l":[{"border-l":Ze()}],"divide-x":[{"divide-x":Ze()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Ze()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ft(),"hidden","none"]}],"divide-style":[{divide:[...ft(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...ft(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pe,be,ge]}],"outline-w":[{outline:["",Pe,Hs,Jl]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",b,mo,ho]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",v,mo,ho]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:Ze()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Pe,Jl]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":Ze()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",S,mo,ho]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Pe,be,ge]}],"mix-blend":[{"mix-blend":[...De(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":De()}],"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":[Pe]}],"mask-image-linear-from-pos":[{"mask-linear-from":qe()}],"mask-image-linear-to-pos":[{"mask-linear-to":qe()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":qe()}],"mask-image-t-to-pos":[{"mask-t-to":qe()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":qe()}],"mask-image-r-to-pos":[{"mask-r-to":qe()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":qe()}],"mask-image-b-to-pos":[{"mask-b-to":qe()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":qe()}],"mask-image-l-to-pos":[{"mask-l-to":qe()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":qe()}],"mask-image-x-to-pos":[{"mask-x-to":qe()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":qe()}],"mask-image-y-to-pos":[{"mask-y-to":qe()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[be,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":qe()}],"mask-image-radial-to-pos":[{"mask-radial-to":qe()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":ee()}],"mask-image-conic-pos":[{"mask-conic":[Pe]}],"mask-image-conic-from-pos":[{"mask-conic-from":qe()}],"mask-image-conic-to-pos":[{"mask-conic-to":qe()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:et()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:_e()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,ge]}],filter:[{filter:["","none",be,ge]}],blur:[{blur:Gt()}],brightness:[{brightness:[Pe,be,ge]}],contrast:[{contrast:[Pe,be,ge]}],"drop-shadow":[{"drop-shadow":["","none",T,mo,ho]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Pe,be,ge]}],"hue-rotate":[{"hue-rotate":[Pe,be,ge]}],invert:[{invert:["",Pe,be,ge]}],saturate:[{saturate:[Pe,be,ge]}],sepia:[{sepia:["",Pe,be,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",be,ge]}],"backdrop-blur":[{"backdrop-blur":Gt()}],"backdrop-brightness":[{"backdrop-brightness":[Pe,be,ge]}],"backdrop-contrast":[{"backdrop-contrast":[Pe,be,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pe,be,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pe,be,ge]}],"backdrop-invert":[{"backdrop-invert":["",Pe,be,ge]}],"backdrop-opacity":[{"backdrop-opacity":[Pe,be,ge]}],"backdrop-saturate":[{"backdrop-saturate":[Pe,be,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",Pe,be,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":U()}],"border-spacing-x":[{"border-spacing-x":U()}],"border-spacing-y":[{"border-spacing-y":U()}],"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:[Pe,"initial",be,ge]}],ease:[{ease:["linear","initial",O,be,ge]}],delay:[{delay:[Pe,be,ge]}],animate:[{animate:["none",B,be,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[Y,be,ge]}],"perspective-origin":[{"perspective-origin":re()}],rotate:[{rotate:gt()}],"rotate-x":[{"rotate-x":gt()}],"rotate-y":[{"rotate-y":gt()}],"rotate-z":[{"rotate-z":gt()}],scale:[{scale:ut()}],"scale-x":[{"scale-x":ut()}],"scale-y":[{"scale-y":ut()}],"scale-z":[{"scale-z":ut()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[be,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:re()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],zoom:[{zoom:[vi,be,ge]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",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":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mbs":[{"scroll-mbs":U()}],"scroll-mbe":[{"scroll-mbe":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pbs":[{"scroll-pbs":U()}],"scroll-pbe":[{"scroll-pbe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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",...W()]}],"stroke-w":[{stroke:[Pe,Hs,Jl,kp]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Jx=kx(Wx);function ie(...a){return Jx(ox(a))}var e1=gg();const Ye={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},ni={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"}},nr={ok:ni.ok.text,warn:ni.warn.text,bad:ni.bad.text,idle:ni.idle.text,accent:ni.accent.text,alt:ni.alt.text,info:ni.info.text},_n=({level:a,className:i})=>f.jsx("span",{"aria-hidden":"true",className:ie("select-none leading-none",nr[a],i),children:a==="idle"?Ye.off:Ye.on}),ab=({className:a})=>f.jsx("span",{"aria-hidden":"true",className:ie("select-none text-tui-faint",a),children:Ye.dot}),hn=({title:a,aside:i,tone:s="accent",className:r,bodyClassName:u,children:d,...m})=>f.jsxs("fieldset",{className:ie("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",a?"px-3 pb-3 pt-1":"p-3",r),...m,children:[a?f.jsx("legend",{className:ie("flex items-center gap-2 text-tui font-bold",nr[s]),children:f.jsx("span",{children:a})}):null,i?f.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:i}):null,f.jsx("div",{className:ie("min-w-0",u),children:d})]}),ci=({label:a,labelWidth:i=16,className:s,children:r})=>f.jsxs("div",{className:ie("flex items-baseline gap-2 text-tui",s),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof a=="string"?a:void 0,children:a}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:r})]}),ui=({className:a,label:i})=>i?f.jsxs("div",{className:ie("flex items-center gap-2",a),children:[f.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),f.jsx("span",{className:"text-tui-sm text-tui-faint",children:i}),f.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):f.jsx("div",{className:ie("h-px w-full bg-tui-border-dim",a),"aria-hidden":"true"}),t1={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"},ke=({variant:a="default",brackets:i=!0,glyph:s,block:r=!1,className:u,children:d,type:m="button",...h})=>f.jsxs("button",{type:m,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",t1[a],r&&"w-full",u),...h,children:[i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,s?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:s}):null,f.jsx("span",{className:"truncate",children:d}),i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),jo=({tone:a="accent",dot:i=!1,className:s,children:r})=>f.jsxs("span",{className:ie("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",nr[a],s),children:[i?f.jsx(_n,{level:a}):null,r]}),Td=({tabs:a,activeId:i,onSelect:s,ariaLabel:r,className:u,labelClassName:d})=>f.jsx("nav",{className:ie("flex items-center gap-2",u),"aria-label":r,children:a.map((m,h)=>{const p=m.id===i;return f.jsxs(Si.Fragment,{children:[h>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ye.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>s(m.id),"aria-current":p?"page":void 0,"aria-label":m.ariaLabel??m.label,title:m.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:[m.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:ie("text-tui-faint",p&&"text-tui-accent"),children:m.index}):null,f.jsx("span",{"aria-hidden":"true",className:ie("ml-1",d),children:m.label})]})]},m.id)})}),sb=({hints:a,className:i})=>f.jsx("div",{className:ie("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:a.map((s,r)=>f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:s.keys}),f.jsx("span",{children:s.action})]},`${s.keys}-${r}`))}),wn=({htmlFor:a,hint:i,className:s,children:r})=>f.jsxs("label",{htmlFor:a,className:ie("block text-tui-sm font-bold text-tui-muted",s),children:[r,i?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),Sn=Si.forwardRef(({className:a,...i},s)=>f.jsx("input",{ref:s,className:ie("tui-input w-full px-2 py-1 text-tui",a),...i}));Sn.displayName="Input";const ko=Si.forwardRef(({className:a,children:i,...s},r)=>f.jsx("select",{ref:r,className:ie("tui-input w-full px-2 py-1 text-tui",a),...s,children:i}));ko.displayName="Select";const ea=({checked:a,onChange:i,disabled:s=!1,label:r,description:u,className:d,id:m})=>f.jsxs("label",{className:ie("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",s&&"cursor-not-allowed opacity-60",d),children:[f.jsx("input",{id:m,type:"checkbox",className:"sr-only",checked:a,disabled:s,onChange:h=>i(h.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ie("mt-px shrink-0 font-bold leading-tight",a?"text-tui-ok":"text-tui-faint",!s&&"group-hover:text-tui-accent"),children:a?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:ie("block",a?"text-tui-text":"text-tui-muted"),children:r}),u?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:u}):null]})]}),Ks=({checked:a,onChange:i,name:s,disabled:r=!1,label:u,description:d,className:m})=>f.jsxs("label",{className:ie("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",r&&"cursor-not-allowed opacity-60",m),children:[f.jsx("input",{type:"radio",name:s,className:"sr-only",checked:a,disabled:r,onChange:i}),f.jsx("span",{"aria-hidden":"true",className:ie("mt-px shrink-0 font-bold leading-tight",a?"text-tui-accent":"text-tui-faint",!r&&"group-hover:text-tui-accent"),children:a?"(•)":"( )"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:ie("block",a?"text-tui-text":"text-tui-muted"),children:u}),d?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:d}):null]})]}),n1=({value:a,width:i=20,tone:s="accent",className:r})=>{const u=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,d=Math.round(u*i);return f.jsxs("span",{className:ie("inline-flex select-none whitespace-pre font-mono leading-none",r),role:"presentation",children:[f.jsx("span",{className:nr[s],children:Ye.meterFull.repeat(d)}),f.jsx("span",{className:"text-tui-border",children:Ye.meterEmpty.repeat(Math.max(0,i-d))})]})},i1={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"},l1=({ratio:a,label:i,tone:s="accent",className:r,...u})=>{const d=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0;return f.jsxs("div",{className:ie("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",r),role:"progressbar","aria-valuenow":Math.round(d*100),"aria-valuemin":0,"aria-valuemax":100,...u,children:[f.jsx("div",{className:ie("absolute inset-y-0 left-0",i1[s]),style:{width:`${d*100}%`},"aria-hidden":"true"}),i!==void 0?f.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:i}):null]})};function Md({columns:a,items:i,rowKey:s,empty:r,className:u}){return i.length===0?f.jsx("div",{className:ie("px-1 py-4 text-center text-tui text-tui-faint",u),children:r}):f.jsx("div",{className:ie("w-full overflow-x-auto",u),children:f.jsxs("table",{className:"w-full border-collapse text-tui",children:[f.jsx("thead",{children:f.jsx("tr",{className:"border-b border-tui-border",children:a.map(d=>f.jsx("th",{scope:"col",style:d.width?{width:`${d.width}ch`}:void 0,className:ie("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",d.align==="right"?"text-right":"text-left",d.className),children:d.header},d.key))})}),f.jsx("tbody",{children:i.map((d,m)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:a.map(h=>f.jsx("td",{className:ie("px-2 py-1 align-top text-tui-text",h.align==="right"?"text-right":"text-left",h.className),children:h.render(d,m)},h.key))},s(d,m)))})]})})}const Ad=({isOpen:a,onClose:i,title:s,subtitle:r,closeLabel:u,footer:d,hints:m,size:h="md",className:p,children:y})=>{if(!a)return null;const b=h==="sm"?"max-w-md":h==="lg"?"max-w-3xl":"max-w-xl",v=`tui-modal-${s.replace(/\s+/g,"-").toLowerCase()}`,S=f.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:T=>{T.target===T.currentTarget&&i()},children:f.jsxs("div",{className:ie("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",b,p),children:[f.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[f.jsx("h2",{id:v,className:"truncate text-tui font-bold text-tui-accent",children:s}),r?f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-sm text-tui-faint",children:r}):f.jsx("span",{className:"flex-1"}),f.jsx(ke,{variant:"ghost",onClick:i,"aria-label":u,title:u,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),d||m?f.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[m?f.jsx(sb,{hints:m}):f.jsx("span",{}),d?f.jsx("div",{className:"flex items-center gap-2",children:d}):null]}):null]})});return typeof document>"u"?S:e1.createPortal(S,document.body)},Zs=({tone:a="accent",className:i,children:s,action:r})=>{const u=a==="ok"?Ye.check:a==="bad"?Ye.cross:a==="warn"?Ye.warn:"›",d=ni[a].edgeL;return f.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",d,i),children:[f.jsx("span",{"aria-hidden":"true",className:ie("shrink-0 font-bold",nr[a]),children:u}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:s}),r?f.jsx("div",{className:"shrink-0",children:r}):null]})},jp=({active:a=!1,className:i,children:s})=>f.jsx("span",{className:ie("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",a?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:s}),Dp=({items:a,className:i})=>{const s=a.filter(Boolean);return f.jsx("span",{className:ie("flex min-w-0 items-center gap-1.5",i),children:s.map((r,u)=>f.jsxs(Si.Fragment,{children:[u>0?f.jsx(ab,{className:"shrink-0"}):null,r]},u))})},rb=({left:a,right:i,className:s})=>f.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",s),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:a}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),a1=({name:a,tagline:i,aside:s,tabs:r,activeTabId:u,onSelectTab:d,tabsAriaLabel:m,hints:h,footerAside:p,bodyClassName:y,className:b,children:v})=>f.jsxs("div",{className:ie("flex h-full min-h-0 w-full flex-col bg-tui-crust",b),children:[f.jsxs("div",{className:"flex h-[var(--tui-row)] shrink-0 items-center justify-between gap-3 overflow-hidden border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[f.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:a}),i?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),s?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:s}):null]}),r&&r.length>0&&u!==void 0&&d?f.jsx("div",{className:"scrollbar-none shrink-0 overflow-x-auto border-b border-tui-border bg-tui-mantle px-2",children:f.jsx(Td,{tabs:r,activeId:u,onSelect:d,ariaLabel:m,className:"gap-3"})}):null,f.jsx("div",{className:ie("min-h-0 flex-1 overflow-y-auto p-2",y),children:v}),h||p?f.jsx(rb,{left:h?f.jsx(sb,{hints:h}):null,right:p}):null]}),zp=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],aa=({className:a,label:i})=>{const[s,r]=Si.useState(0);return Si.useEffect(()=>{const u=setInterval(()=>r(d=>(d+1)%zp.length),90);return()=>clearInterval(u)},[]),f.jsxs("span",{className:ie("inline-flex items-center gap-1.5",a),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:zp[s]}),i?f.jsx("span",{children:i}):null]})},po="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",go="text-tui-muted hover:border-tui-border hover:text-tui-accent",s1="border-tui-accent bg-tui-accent text-tui-crust",r1=({currentView:a,onNavigate:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:u,onToggleVirtualKeyboard:d,isVirtualKeyboardOpen:m})=>{const{addToast:h,language:p,setLanguage:y,t:b}=Nt(),v=()=>{const T=p==="zh"?"en":"zh";y(T),h("info",wd(T,"toasts.switchedLanguage",{lang:T==="zh"?"简体中文":"English"}))},S=[{id:"terminal",label:b("header.terminalTab"),index:1,ariaLabel:b("header.terminalTab")},...s||a==="admin"?[{id:"admin",label:b("header.adminTab"),index:2,ariaLabel:b("header.adminTab")}]:[]];return f.jsx("header",{role:"banner",className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:f.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[f.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[f.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:b("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(Td,{tabs:S,activeId:a,onSelect:T=>i(T),ariaLabel:b("header.mainNavigationAria"),className:"shrink-0 gap-3"}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[f.jsx("button",{type:"button",onClick:v,className:ie(po,go),title:b("header.languageToggleTitle"),"aria-label":b("header.languageToggleTitle"),children:b("header.languageShort")}),a==="terminal"&&f.jsx("button",{type:"button",onClick:d,className:ie(po,m?s1:go),title:b("header.virtualKeyboardTitle"),"aria-label":b("header.virtualKeyboardTitle"),children:b("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:r,className:ie(po,go),title:b("header.pairingTitle"),"aria-label":b("header.pairingTitle"),children:b("header.actionPairing")}),f.jsx("button",{type:"button",onClick:u,className:ie(po,go),title:b("header.settingsTitle"),"aria-label":b("header.settingsTitle"),children:b("header.actionSettings")})]})]})})},bo=({tone:a,glyph:i,message:s,assertive:r=!1,action:u})=>f.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",ni[a].edgeB),"aria-live":r?"assertive":"polite",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("span",{"aria-hidden":"true",className:ie("shrink-0",ni[a].text),children:i}),f.jsx("span",{className:"truncate text-tui-text",children:s})]}),u]}),o1=()=>{const{connectionState:a,stateDetail:i,connect:s,settings:r,t:u}=Nt();return a==="connected"||!r.token&&!r.pairCode&&a==="disconnected"?null:a==="connecting"?f.jsx(bo,{tone:"accent",glyph:f.jsx(aa,{}),message:u("statusBanner.connecting")}):a==="reconnecting"?f.jsx(bo,{tone:"warn",glyph:f.jsx(aa,{}),assertive:!0,message:i||u("statusBanner.reconnectingDefault"),action:f.jsx(ke,{variant:"warn",onClick:()=>s(),className:"shrink-0",children:u("statusBanner.reconnectNow")})}):a==="error"?f.jsx(bo,{tone:"bad",glyph:Ye.cross,assertive:!0,message:i||u("statusBanner.errorDefault"),action:f.jsx(ke,{variant:"danger",onClick:()=>s(),className:"shrink-0",children:u("common.retry")})}):a==="disconnected"?f.jsx(bo,{tone:"idle",glyph:Ye.off,message:u("statusBanner.disconnected"),action:f.jsx(ke,{variant:"primary",onClick:()=>s(),className:"shrink-0",children:u("common.connect")})}):null};var c1=O0(),u1=B0(),qu={exports:{}},Op;function d1(){return Op||(Op=1,(function(a,i){(function(s,r){a.exports=r()})(self,(()=>(()=>{var s={6:(m,h)=>{function p(b){try{const v=new URL(b),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 b.toLocaleLowerCase().startsWith(S.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(h,"__esModule",{value:!0}),h.LinkComputer=h.WebLinkProvider=void 0,h.WebLinkProvider=class{constructor(b,v,S,T={}){this._terminal=b,this._regex=v,this._handler=S,this._options=T}provideLinks(b,v){const S=y.computeLink(b,this._regex,this._terminal,this._handler);v(this._addCallbacks(S))}_addCallbacks(b){return b.map((v=>(v.leave=this._options.leave,v.hover=(S,T)=>{if(this._options.hover){const{range:E}=v;this._options.hover(S,T,E)}},v)))}};class y{static computeLink(v,S,T,E){const Y=new RegExp(S.source,(S.flags||"")+"g"),[A,O]=y._getWindowedLineStrings(v-1,T),B=A.join("");let H;const ee=[];for(;H=Y.exec(B);){const re=H[0];if(!p(re))continue;const[J,G]=y._mapStrIdx(T,O,0,H.index),[U,ae]=y._mapStrIdx(T,J,G,re.length);if(J===-1||G===-1||U===-1||ae===-1)continue;const ne={start:{x:G+1,y:J+1},end:{x:ae,y:U+1}};ee.push({range:ne,text:re,activate:E})}return ee}static _getWindowedLineStrings(v,S){let T,E=v,Y=v,A=0,O="";const B=[];if(T=S.buffer.active.getLine(v)){const H=T.translateToString(!0);if(T.isWrapped&&H[0]!==" "){for(A=0;(T=S.buffer.active.getLine(--E))&&A<2048&&(O=T.translateToString(!0),A+=O.length,B.push(O),T.isWrapped&&O.indexOf(" ")===-1););B.reverse()}for(B.push(H),A=0;(T=S.buffer.active.getLine(++Y))&&T.isWrapped&&A<2048&&(O=T.translateToString(!0),A+=O.length,B.push(O),O.indexOf(" ")===-1););}return[B,E]}static _mapStrIdx(v,S,T,E){const Y=v.buffer.active,A=Y.getNullCell();let O=T;for(;E;){const B=Y.getLine(S);if(!B)return[-1,-1];for(let H=O;H<B.length;++H){B.getCell(H,A);const ee=A.getChars();if(A.getWidth()&&(E-=ee.length||1,H===B.length-1&&ee==="")){const re=Y.getLine(S+1);re&&re.isWrapped&&(re.getCell(0,A),A.getWidth()===2&&(E+=1))}if(E<0)return[S,H]}S++,O=0}return[S,O]}}h.LinkComputer=y}},r={};function u(m){var h=r[m];if(h!==void 0)return h.exports;var p=r[m]={exports:{}};return s[m](p,p.exports,u),p.exports}var d={};return(()=>{var m=d;Object.defineProperty(m,"__esModule",{value:!0}),m.WebLinksAddon=void 0;const h=u(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function y(b,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")}m.WebLinksAddon=class{constructor(b=y,v={}){this._handler=b,this._options=v}activate(b){this._terminal=b;const v=this._options,S=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new h.WebLinkProvider(this._terminal,S,this._handler,v))}dispose(){var b;(b=this._linkProvider)==null||b.dispose()}}})(),d})()))})(qu)),qu.exports}var f1=d1();const ob="\x1B",h1=/^\x1b\[[IO]/,cb=/^\x1b\[<(\d+);\d+;\d+[Mm]/,m1=/^\x1b\[M[\s\S]{3}/,p1=[/^\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\\/],g1=/^\x1b\[1;[2-8]R/;function Bp(a){if(g1.test(a))return 0;const i=h1.exec(a);if(i)return i[0].length;const s=cb.exec(a);if(s){const r=Number(s[1]);return(r&32)!==0&&(r&3)===3&&(r&64)===0?s[0].length:0}for(const r of p1){const u=r.exec(a);if(u)return u[0].length}return 0}function ub(a){if(!a.startsWith(ob))return"keys";if(cb.test(a)||m1.test(a)){let s=a;for(;s.length>0;){const r=Bp(s);if(r===0)return"pointer";s=s.slice(r)}return"passive"}let i=a;for(;i.length>0;){const s=Bp(i);if(s===0)return"keys";i=i.slice(s)}return"passive"}function b1(a){return a===ob}const y1=20,v1=6,x1=500,w1=300,Xa=13,db=.602,fb=1.3;function Pi(a,i){return Number.isFinite(a)&&a>0?a:i}function Up(a,i,s){return Math.min(s,Math.max(i,a))}function Hp(a){const{width:i,height:s,cellWidth:r,cellHeight:u,minCols:d=y1,minRows:m=v1,maxCols:h=x1,maxRows:p=w1}=a,y=Pi(r,Xa*db),b=Pi(u,Xa*fb);return{cols:Up(Math.floor(Pi(i,0)/y),d,h),rows:Up(Math.floor(Pi(s,0)/b),m,p)}}function na(a,i=Xa){var r,u,d;if(a)try{const m=a._core,h=(d=(u=(r=m==null?void 0:m._renderService)==null?void 0:r.dimensions)==null?void 0:u.css)==null?void 0:d.cell;if(h&&h.width&&h.width>0&&h.height&&h.height>0)return{cellWidth:h.width,cellHeight:h.height,measured:!0}}catch{}const s=Pi(i,Xa);return{cellWidth:Math.round(s*db*100)/100,cellHeight:Math.round(s*fb*100)/100,measured:!1}}function S1(a){var r;const i=(r=a==null?void 0:a.querySelector)==null?void 0:r.call(a,".xterm-viewport");if(!i)return 0;const s=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(s)&&s>0?s:0}function Fu(a,i,s){if(!a)return{width:i,height:s};let r=0,u=0;if(typeof a.getBoundingClientRect=="function"){const d=a.getBoundingClientRect();r=(d==null?void 0:d.width)||0,u=(d==null?void 0:d.height)||0}return{width:Pi(r,Pi(a.clientWidth,i)),height:Pi(u,Pi(a.clientHeight,s))}}function hb(a,i,s,r){const u=Number.isFinite(r)&&r>.01?r:1;return{clientX:s.left+(a-s.left)/u,clientY:s.top+(i-s.top)/u}}function Ys(a){var i,s;if(!a)return!1;try{const r=a.modes;if(r&&typeof r.mouseTrackingMode=="string"&&r.mouseTrackingMode!=="none")return!0;const u=a._core;if((i=u==null?void 0:u._coreMouseService)!=null&&i.areMouseEventsActive||(s=u==null?void 0:u.coreMouseService)!=null&&s.areMouseEventsActive||u!=null&&u.mouseMode&&u.mouseMode!=="none")return!0}catch{}return!1}function C1(a,i){const s=i.button??0,r=i.buttons??(a==="mouseup"?0:1);return new MouseEvent(a,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:s,buttons:r})}function Kp(a,i,s){const r=C1(i,s);return a.dispatchEvent(r)}class T1{constructor(i){X(this,"options");X(this,"state","idle");X(this,"startX",0);X(this,"startY",0);X(this,"lastX",0);X(this,"lastY",0);X(this,"activeTarget",null);X(this,"longPressTimer",null);X(this,"capturedPointerId",null);X(this,"captureElement",null);X(this,"scrollRemainderY",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i}}getState(){return this.state}setGestureState(i){var s,r;this.state!==i&&(this.state=i,(r=(s=this.options).onGestureStateChange)==null||r.call(s,i))}getActiveBuffer(i){var s;try{return((s=i.buffer)==null?void 0:s.active)||null}catch{return null}}getViewportY(i){var r;const s=(r=this.getActiveBuffer(i))==null?void 0:r.viewportY;return typeof s=="number"&&Number.isFinite(s)?s:null}blurTerminal(i){var s;try{(s=i.blur)==null||s.call(i)}catch{}}getLogicalCoordinates(i,s){const r=this.options.getScale?this.options.getScale():1,u=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(r!==1&&u&&typeof u.getBoundingClientRect=="function"){const d=u.getBoundingClientRect();return hb(i,s,d,r)}return{clientX:i,clientY:s}}getViewportElement(i){var u;const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(s==null?void 0:s.querySelector(".xterm-viewport"))||((u=i.element)==null?void 0:u.querySelector(".xterm-viewport"))||null}isInputLineHit(i,s){var B;const r=(B=s.buffer)==null?void 0:B.active,u=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(u==null?void 0:u.querySelector(".xterm-screen"))||s.element||u,m=na(s);if(!d||typeof d.getBoundingClientRect!="function"||m.cellHeight<=0)return!1;const h=d.getBoundingClientRect(),p=this.getLogicalCoordinates(i.clientX,i.clientY),y=h.width>0&&h.height>0;if(![r==null?void 0:r.cursorY,r==null?void 0:r.viewportY,r==null?void 0:r.baseY].every(H=>typeof H=="number"&&Number.isFinite(H)))return!1;const v=r==null?void 0:r.cursorY,S=r==null?void 0:r.viewportY,E=(r==null?void 0:r.baseY)+v-S,Y=h.top+E*m.cellHeight,A=Y+m.cellHeight,O=Number(s.rows);return E>=0&&(!Number.isFinite(O)||E<O)&&p.clientY>=Y-2&&p.clientY<=A+2&&(!y||p.clientX>=h.left&&p.clientX<=h.right)}resolveDispatchTarget(i,s){var h;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||s.querySelector(".xterm-screen")||null,d=((h=u==null?void 0:u.closest)==null?void 0:h.call(u,".xterm"))||null;let m=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(m=document.elementFromPoint(i.clientX,i.clientY)),m&&d&&(m===d||d.contains(m))?m:u||r||s}getMouseReport(i,s){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||s.element;if(!u||typeof u.getBoundingClientRect!="function")return null;const d=u.getBoundingClientRect(),m=this.getLogicalCoordinates(i.clientX,i.clientY),h=na(s);if(h.cellWidth<=0||h.cellHeight<=0)return null;const p=Math.max(1,d.width||s.cols*h.cellWidth),y=Math.max(1,d.height||s.rows*h.cellHeight),b=Math.max(0,Math.min(p-1,m.clientX-d.left)),v=Math.max(0,Math.min(y-1,m.clientY-d.top)),S=Math.max(0,Math.min(s.cols-1,Math.floor(b/h.cellWidth))),T=Math.max(0,Math.min(s.rows-1,Math.floor(v/h.cellHeight)));return{col:S,row:T,x:Math.floor(b),y:Math.floor(v),button:0,action:0}}getCoreMouseService(i){var r,u;const s=i;return s.coreMouseService||((r=s._core)==null?void 0:r.coreMouseService)||((u=s._core)==null?void 0:u._coreMouseService)||null}getCoreService(i){var r;const s=i;return s.coreService||((r=s._core)==null?void 0:r.coreService)||null}getWheelDispatchTarget(i){const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(s==null?void 0:s.querySelector(".xterm"))||i.element||null}dispatchWheel(i,s,r,u){const d=this.getWheelDispatchTarget(r);if(!d||typeof WheelEvent>"u"||s===0)return!1;const m=this.getLogicalCoordinates(i.clientX,i.clientY),h=s<0?-1:1;let p=0;for(let y=0;y<Math.abs(s);y+=1)try{const b=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:m.clientX,clientY:m.clientY,deltaX:0,deltaY:h,deltaMode:1,ctrlKey:!!(u!=null&&u.ctrlKey),altKey:!!(u!=null&&u.altKey),shiftKey:!!(u!=null&&u.shiftKey)});d.dispatchEvent(b),p+=1}catch{return p>0}return p>0}emitWheel(i,s,r,u){if(s===0)return!1;if(this.dispatchWheel(i,s,r,u))return!0;const d=this.getCoreMouseService(r);if(!(d!=null&&d.triggerMouseEvent))return!1;let m=0;for(let h=0;h<Math.abs(s);h+=1){const p=this.getMouseReport(i,r);p&&(p.button=4,p.action=s<0?0:1,p.ctrl=!!(u!=null&&u.ctrlKey),p.alt=!!(u!=null&&u.altKey),p.shift=!!(u!=null&&u.shiftKey),d.triggerMouseEvent(p)&&(m+=1))}return m>0}scrollAlternateBuffer(i,s,r,u){var m;if(s===0)return"none";const d=Ys(r);if(!d&&!this.options.getIsController())return"none";if(this.emitWheel(i,s,r,u))return d?"application-mouse":"application-keys";if(!d){const h=this.getCoreService(r);if(!(h!=null&&h.triggerDataEvent))return"none";const y=`\x1B${!!((m=h.decPrivateModes)!=null&&m.applicationCursorKeys)?"O":"["}${s<0?"A":"B"}`;return h.triggerDataEvent(y.repeat(Math.abs(s)),!0),"application-keys"}return"none"}emitMouse(i,s,r){const u=this.options.getTerminal();if(!u)return;const d=this.getCoreMouseService(u);if(d!=null&&d.triggerMouseEvent){const h=this.getMouseReport(s,u);h&&(h.action=i==="mousedown"?1:i==="mouseup"?0:32,h.ctrl=!!(r!=null&&r.ctrlKey),h.alt=!!(r!=null&&r.altKey),h.shift=!!(r!=null&&r.shiftKey),d.triggerMouseEvent(h));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const m=this.getLogicalCoordinates(s.clientX,s.clientY);Kp(this.activeTarget,i,{clientX:m.clientX,clientY:m.clientY,button:0,buttons:i==="mouseup"?0:1})}beginGesture(i,s){this.startX=i.clientX,this.startY=i.clientY,this.lastX=i.clientX,this.lastY=i.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(i,s),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var r,u;this.state==="pending"&&(this.setGestureState("longpress"),(u=(r=this.options).onLongPress)==null||u.call(r,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,s){var y,b,v,S;if(this.state==="longpress"){(b=(y=this.options).onSelectionExtend)==null||b.call(y,{clientX:i.clientX,clientY:i.clientY}),s!=null&&s.cancelable&&((v=s.preventDefault)==null||v.call(s));return}if(this.state==="idle")return;const r=i.clientX-this.startX,u=i.clientY-this.startY,d=Math.hypot(r,u);if(this.state==="scrolling"){this.scrollGesture(i,s);return}const m=this.options.getTerminal(),h=this.options.getIsController(),p=Ys(m);if(!(d<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(u)>=Math.abs(r)||!p||!h){this.setGestureState("scrolling"),m&&this.blurTerminal(m),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,s);return}if(p&&h){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},s)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.emitMouse("mousemove",i,s),s!=null&&s.cancelable&&((S=s.preventDefault)==null||S.call(s)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,s){var E,Y,A;const r=this.options.getTerminal();if(!r)return;const u=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const d=na(r),m=d.measured?d.cellHeight:this.options.scrollLineHeightPx||d.cellHeight||18;this.scrollRemainderY+=u;const h=Math.trunc(this.scrollRemainderY/m),p=-h;let y=!1,b="none";const v=this.getActiveBuffer(r),S=Ys(r);if(p!==0){if((v==null?void 0:v.type)==="alternate")b=this.scrollAlternateBuffer(i,p,r,s),y=b!=="none";else{const O=this.getViewportY(r);r.scrollLines(p);const B=this.getViewportY(r);b="buffer",y=O===null||B===null||O!==B}this.scrollRemainderY-=h*m}const T=this.getViewportElement(r);(Y=(E=this.options).onGestureScroll)==null||Y.call(E,{deltaY:u,lines:p,viewportY:this.getViewportY(r),scrollTop:(T==null?void 0:T.scrollTop)??null,scrollHeight:(T==null?void 0:T.scrollHeight)??null,clientHeight:(T==null?void 0:T.clientHeight)??null,moved:y,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:b}),s!=null&&s.cancelable&&((A=s.preventDefault)==null||A.call(s))}endGesture(i,s){var m,h,p;this.clearLongPressTimer();const r=this.options.getTerminal(),u=this.options.getIsController(),d=Ys(r);if(this.state==="pending"){if(d&&u){const b={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",b,s),this.emitMouse("mouseup",b,s)}const y={clientX:this.startX,clientY:this.startY};u&&r&&this.isInputLineHit(y,r)&&((h=(m=this.options).onFocus)==null||h.call(m))}else if(this.state==="dragging"&&d&&u){const y=i??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",y,s),s!=null&&s.cancelable&&((p=s.preventDefault)==null||p.call(s))}this.reset()}handlePointerDown(i,s){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,s),i.pointerType!=="touch")try{typeof s.setPointerCapture=="function"&&(s.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=s)}catch{}return!0}handlePointerMove(i){i.pointerType==="mouse"||this.state==="idle"||this.moveGesture(i,i)}handlePointerUp(i){i.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(i,i))}handlePointerCancel(i){i&&i.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(i,s){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],s)}handleTouchMove(i){i.touches.length===1&&this.moveGesture(i.touches[0],i)}handleTouchEnd(i){i.cancelable&&i.preventDefault(),this.endGesture(null,i)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const i=this.options.getTerminal(),s=this.options.getIsController(),r=Ys(i);if(this.state==="dragging"&&r&&s&&this.activeTarget){const u=this.getLogicalCoordinates(this.lastX,this.lastY);Kp(this.activeTarget,"mouseup",{clientX:u.clientX,clientY:u.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,s=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||s===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(s))&&i.releasePointerCapture(s)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}var sn=(a=>(a[a.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",a[a.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",a[a.WIDTH_SHIFT=22]="WIDTH_SHIFT",a))(sn||{}),jt=(a=>(a[a.PCOLOR_MASK=255]="PCOLOR_MASK",a[a.CM_MASK=50331648]="CM_MASK",a[a.CM_DEFAULT=0]="CM_DEFAULT",a[a.CM_P16=16777216]="CM_P16",a[a.CM_P256=33554432]="CM_P256",a[a.CM_RGB=50331648]="CM_RGB",a[a.RGB_MASK=16777215]="RGB_MASK",a))(jt||{}),rn=(a=>(a[a.INVERSE=67108864]="INVERSE",a[a.BOLD=134217728]="BOLD",a[a.UNDERLINE=268435456]="UNDERLINE",a[a.BLINK=536870912]="BLINK",a[a.INVISIBLE=1073741824]="INVISIBLE",a[a.STRIKETHROUGH=2147483648]="STRIKETHROUGH",a))(rn||{}),ia=(a=>(a[a.ITALIC=67108864]="ITALIC",a[a.DIM=134217728]="DIM",a[a.HAS_EXTENDED=268435456]="HAS_EXTENDED",a[a.PROTECTED=536870912]="PROTECTED",a[a.OVERLINE=1073741824]="OVERLINE",a))(ia||{}),Ia=(a=>(a[a.NONE=0]="NONE",a[a.SINGLE=1]="SINGLE",a[a.DOUBLE=2]="DOUBLE",a[a.CURLY=3]="CURLY",a[a.DOTTED=4]="DOTTED",a[a.DASHED=5]="DASHED",a))(Ia||{});function M1(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const mb={fg:0,bg:0,ext:0};function pb(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function A1(a){return a>>>26&7}function E1(a){return a&67108863}function N1(a,i){const s=a.codePointAt(0)??0;return a.length>0&&String.fromCodePoint(s).length===a.length?{content:s|i<<22,combinedData:""}:{content:2097152|i<<22,combinedData:a}}function gb(a){const i=a;return!i||typeof i.fg!="number"||typeof i.bg!="number"?null:{fg:i.fg>>>0,bg:i.bg>>>0,ext:pb(i)}}const yo=new Map;function bb(a){let i=yo.get(a);return i===void 0&&(i=`#${(a&jt.RGB_MASK).toString(16).padStart(6,"0")}`,yo.size>4096&&yo.clear(),yo.set(a,i)),i}function yb(a,i,s){var r;switch(a&jt.CM_MASK){case jt.CM_P16:case jt.CM_P256:return((r=i.ansi[a&jt.PCOLOR_MASK])==null?void 0:r.css)??s;case jt.CM_RGB:return bb(a&jt.RGB_MASK);default:return s}}function Yp(a,i,s,r){var v;const u=(a&rn.INVERSE)!==0,d=u?i:a,m=u?a:i;let h;const p=d&jt.CM_MASK;if(p===jt.CM_P16||p===jt.CM_P256){let S=d&jt.PCOLOR_MASK;r&&a&rn.BOLD&&S<8&&(S+=8),h=((v=s.ansi[S])==null?void 0:v.css)??s.foreground.css}else p===jt.CM_RGB?h=bb(d&jt.RGB_MASK):h=u?s.background.css:s.foreground.css;const y=m&jt.CM_MASK,b=y===jt.CM_DEFAULT?u?s.foreground.css:s.background.css:yb(m,s,s.background.css);return{fg:h,bg:b,bgIsDefault:!u&&y===jt.CM_DEFAULT}}function vo(a){return(a&rn.BOLD)!==0}function Vu(a){return(a&ia.ITALIC)!==0}function Xu(a){return(a&ia.DIM)!==0}function Pu(a){return(a&rn.INVISIBLE)!==0}/**
|
|
34
|
+
* Box drawing, block element and Powerline glyphs, drawn as shapes rather than
|
|
35
|
+
* taken from the font.
|
|
36
|
+
*
|
|
37
|
+
* Vendored verbatim from @xterm/xterm 5.5.0,
|
|
38
|
+
* src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
|
|
39
|
+
* helper it imported, inlined below, and underscores on parameters the strict
|
|
40
|
+
* compiler flags as unused.
|
|
41
|
+
*
|
|
42
|
+
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
|
|
43
|
+
* @license MIT
|
|
44
|
+
*/function Gp(a){if(!a)throw new Error("value must not be falsy");return a}const L1={"▀":[{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}]},k1={"░":[[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]]},R1={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"║":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,i)=>`M.5,1 L.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╓":{1:(a,i)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,i)=>`M1,${.5-i} L${.5-a},${.5-i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╕":{1:(a,i)=>`M0,${.5-i} L.5,${.5-i} L.5,1 M0,${.5+i} L.5,${.5+i}`},"╖":{1:(a,i)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5+a},${.5-i} L${.5+a},1`},"╘":{1:(a,i)=>`M.5,0 L.5,${.5+i} L1,${.5+i} M.5,${.5-i} L1,${.5-i}`},"╙":{1:(a,i)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,i)=>`M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0 M1,${.5+i} L${.5-a},${.5+i} L${.5-a},0`},"╛":{1:(a,i)=>`M0,${.5+i} L.5,${.5+i} L.5,0 M0,${.5-i} L.5,${.5-i}`},"╜":{1:(a,i)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,i)=>`M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M0,${.5+i} L${.5+a},${.5+i} L${.5+a},0`},"╞":{1:(a,i)=>`M.5,0 L.5,1 M.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╟":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╡":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L.5,${.5-i} M0,${.5+i} L.5,${.5+i}`},"╢":{1:(a,i)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,i)=>`M${.5+a},0 L${.5+a},1 M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0`},"╤":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i} M.5,${.5+i} L.5,1`},"╥":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╧":{1:(a,i)=>`M.5,0 L.5,${.5-i} M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╨":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,i)=>`M0,${.5+i} L1,${.5+i} M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╪":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╫":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,1,.5`},"╮":{1:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,0,.5`},"╯":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,0,.5`},"╰":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,1,.5`}},tr={"":{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}};tr[""]=tr[""];tr[""]=tr[""];function _1(a,i,s,r,u,d,m,h){const p=L1[i];if(p)return j1(a,p,s,r,u,d),!0;const y=k1[i];if(y)return D1(a,y,s,r,u,d),!0;const b=R1[i];if(b)return z1(a,b,s,r,u,d,h),!0;const v=tr[i];return v?(O1(a,v,s,r,u,d,m,h),!0):!1}function j1(a,i,s,r,u,d){for(let m=0;m<i.length;m++){const h=i[m],p=u/8,y=d/8;a.fillRect(s+h.x*p,r+h.y*y,h.w*p,h.h*y)}}const Ip=new Map;function D1(a,i,s,r,u,d){let m=Ip.get(i);m||(m=new Map,Ip.set(i,m));const h=a.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let p=m.get(h);if(!p){const y=i[0].length,b=i.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=y,v.height=b;const S=Gp(v.getContext("2d")),T=new ImageData(y,b);let E,Y,A,O;if(h.startsWith("#"))E=parseInt(h.slice(1,3),16),Y=parseInt(h.slice(3,5),16),A=parseInt(h.slice(5,7),16),O=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[E,Y,A,O]=h.substring(5,h.length-1).split(",").map(B=>parseFloat(B));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let B=0;B<b;B++)for(let H=0;H<y;H++)T.data[(B*y+H)*4]=E,T.data[(B*y+H)*4+1]=Y,T.data[(B*y+H)*4+2]=A,T.data[(B*y+H)*4+3]=i[B][H]*(O*255);S.putImageData(T,0,0),p=Gp(a.createPattern(v,null)),m.set(h,p)}a.fillStyle=p,a.fillRect(s,r,u,d)}function z1(a,i,s,r,u,d,m){a.strokeStyle=a.fillStyle;for(const[h,p]of Object.entries(i)){a.beginPath(),a.lineWidth=m*Number.parseInt(h);let y;if(typeof p=="function"){const v=.15/d*u;y=p(.15,v)}else y=p;for(const b of y.split(" ")){const v=b[0],S=vb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const T=b.substring(1).split(",");!T[0]||!T[1]||S(a,xb(T,u,d,s,r,!0,m))}a.stroke(),a.closePath()}}function O1(a,i,s,r,u,d,m,h){const p=new Path2D;p.rect(s,r,u,d),a.clip(p),a.beginPath();const y=m/12;a.lineWidth=h*y;for(const b of i.d.split(" ")){const v=b[0],S=vb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const T=b.substring(1).split(",");!T[0]||!T[1]||S(a,xb(T,u,d,s,r,!1,h,(i.leftPadding??0)*(y/2),(i.rightPadding??0)*(y/2)))}i.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function $p(a,i,s=0){return Math.max(Math.min(a,i),s)}const vb={C:(a,i)=>a.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]),L:(a,i)=>a.lineTo(i[0],i[1]),M:(a,i)=>a.moveTo(i[0],i[1])};function xb(a,i,s,r,u,d,m,h=0,p=0){const y=a.map(b=>parseFloat(b)||parseInt(b));if(y.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<y.length;b+=2)y[b]*=i-h*m-p*m,d&&y[b]!==0&&(y[b]=$p(Math.round(y[b]+.5)-.5,i,0)),y[b]+=r+h*m;for(let b=1;b<y.length;b+=2)y[b]*=s,d&&y[b]!==0&&(y[b]=$p(Math.round(y[b]+.5)-.5,s,0)),y[b]+=u;return y}const dd=.5,B1=1024,U1=6;function H1(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class K1{constructor(i,s=typeof navigator<"u"?navigator.userAgent:""){X(this,"pages",[]);X(this,"slots",new Map);X(this,"inkCache",new Map);X(this,"metrics",null);X(this,"font",null);X(this,"baseline");X(this,"generation",0);X(this,"scratch");this.document=i,this.baseline=H1(s)}configure(i,s){const r=this.metrics&&this.font&&this.metrics.cellWidth===i.cellWidth&&this.metrics.cellHeight===i.cellHeight&&this.metrics.charWidth===i.charWidth&&this.metrics.charHeight===i.charHeight&&this.metrics.charLeft===i.charLeft&&this.metrics.charTop===i.charTop&&this.metrics.dpr===i.dpr&&this.font.fontFamily===s.fontFamily&&this.font.fontSize===s.fontSize&&this.font.fontWeight===s.fontWeight&&this.font.fontWeightBold===s.fontWeightBold&&this.font.customGlyphs===s.customGlyphs;this.metrics={...i},this.font={...s},r||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.shelfX=0,i.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.canvas.width=0,i.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(i,s){const r=this.font,u=i?r.fontWeightBold:r.fontWeight;return`${s?"italic ":""}${u} ${r.fontSize*this.metrics.dpr}px ${r.fontFamily}`}overflow(i,s,r){if(!this.metrics||!this.font||i.length===1&&i.charCodeAt(0)<128)return 0;const u=`${s?1:0}${r?1:0}${i}`,d=this.inkCache.get(u);if(d!==void 0)return d;let m=0;const h=this.scratchContext();if(h&&!(this.font.customGlyphs&&wb(i))){h.font=this.fontString(s,r),h.textBaseline=this.baseline;const p=h.measureText(i),y=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;m=Math.max(0,Math.ceil(this.metrics.charLeft+y-this.metrics.cellWidth))}return this.inkCache.set(u,m),m}get(i){const s=this.metrics,r=this.font;if(!s||!r||s.cellWidth<=0||s.cellHeight<=0)return null;const u=`${i.cells}${i.bold?1:0}${i.italic?1:0}${i.dim?1:0}${i.fg}\0${i.bg}\0${i.chars}`,d=this.slots.get(u);if(d)return d;const m=s.cellWidth*i.cells,h=s.cellHeight,p=this.allocate(m,h);if(!p)return null;const{page:y,x:b,y:v}=p,S=y.ctx;S.save(),S.beginPath(),S.rect(b,v,m,h),S.clip(),S.globalAlpha=1,S.fillStyle=i.bg,S.fillRect(b,v,m,h),S.fillStyle=i.fg,i.dim&&(S.globalAlpha=dd);let T=!1;r.customGlyphs&&(T=_1(S,i.chars,b,v,s.cellWidth,s.cellHeight,r.fontSize,s.dpr)),T||(S.font=this.fontString(i.bold,i.italic),S.textBaseline=this.baseline,S.fillText(i.chars,b+s.charLeft,v+s.charTop+s.charHeight)),S.restore();const E={source:y.canvas,x:b,y:v,width:m,height:h};return this.slots.set(u,E),E}allocate(i,s){for(const r of this.pages){const u=this.fit(r,i,s);if(u)return u}if(this.pages.length<U1){const r=this.createPage(Math.max(B1,i,s));return r?(this.pages.push(r),this.fit(r,i,s)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],i,s):null}fit(i,s,r){if(i.shelfX+s>i.canvas.width&&(i.shelfX=0,i.shelfY+=r),i.shelfY+r>i.canvas.height||s>i.canvas.width)return null;const u={page:i,x:i.shelfX,y:i.shelfY};return i.shelfX+=s,u}createPage(i){const s=this.document.createElement("canvas");s.width=i,s.height=i;const r=s.getContext("2d",{alpha:!1});return r?{canvas:s,ctx:r,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const i=this.document.createElement("canvas");i.width=1,i.height=1,this.scratch=i.getContext("2d")}return this.scratch}}function wb(a){if(a.length!==1)return!1;const i=a.charCodeAt(0);return i>=9472&&i<=9631||i>=57504&&i<=57558}function Y1(a){var s,r,u,d;const i=a._core;return!i||!i.screenElement||!i.coreService||!((s=i.optionsService)!=null&&s.rawOptions)||!((r=i._bufferService)!=null&&r.buffer)||!i._charSizeService||!i._coreBrowserService||!((u=i._themeService)!=null&&u.colors)||typeof((d=i._renderService)==null?void 0:d.setRenderer)!="function"?null:i}const G1=150,I1=600,xo=4294967295;function $1(){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}}}}class q1{constructor(){X(this,"listeners",new Set);X(this,"event",i=>(this.listeners.add(i),{dispose:()=>this.listeners.delete(i)}))}fire(i){for(const s of[...this.listeners])s(i)}dispose(){this.listeners.clear()}}class Ed{constructor(i,s){X(this,"dimensions",$1());X(this,"redraw",new q1);X(this,"onRequestRedraw",this.redraw.event);X(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});X(this,"canvas");X(this,"ctx");X(this,"decorCanvas");X(this,"decorCtx");X(this,"atlas");X(this,"disposables",[]);X(this,"now");X(this,"maxSyncHoldMs");X(this,"cols",0);X(this,"rows",0);X(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});X(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});X(this,"work",M1());X(this,"overlayProvider",null);X(this,"paintedOverlayRows",new Set);X(this,"paintedCursorRow",-1);X(this,"lastYdisp",0);X(this,"holdStartedAt",null);X(this,"held",null);X(this,"holdTimer",null);X(this,"selection",null);X(this,"link",null);X(this,"inputAt",null);X(this,"blinkVisible",!0);X(this,"blinkTimer",null);X(this,"disposed",!1);X(this,"isSynchronizing");X(this,"dprUsed",0);this.core=i,this.now=s.now??(()=>performance.now()),this.maxSyncHoldMs=s.maxSyncHoldMs??G1,this.isSynchronizing=s.isSynchronizing??(()=>!1);const r=i._coreBrowserService.mainDocument,u=i.screenElement;this.canvas=r.createElement("canvas"),this.canvas.classList.add("xterm-text-layer"),this.canvas.style.zIndex="0";const d=this.canvas.getContext("2d",{alpha:!1});if(!d)throw new Error("2D canvas unavailable");this.ctx=d,this.decorCanvas=r.createElement("canvas"),this.decorCanvas.classList.add("xterm-decor-layer"),this.decorCanvas.style.zIndex="2";const m=this.decorCanvas.getContext("2d");if(!m)throw new Error("2D canvas unavailable");this.decorCtx=m,u.appendChild(this.canvas),u.appendChild(this.decorCanvas),this.atlas=new K1(r),this.disposables.push(i._themeService.onChangeColors(()=>{this.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),i.optionsService.onOptionChange(h=>{(h==="cursorBlink"||h==="cursorStyle")&&this.restartBlink()})),i.linkifier&&this.disposables.push(i.linkifier.onShowLinkUnderline(h=>{this.link=h,this.redrawDecor()}),i.linkifier.onHideLinkUnderline(()=>{this.link=null,this.redrawDecor()})),this.observeDevicePixels(),this.observeFonts(r),this.restartBlink()}static install(i,s={}){const r=Y1(i);if(!r)return null;const u=new Ed(r,s);return r._renderService.setRenderer(u),r._renderService.handleResize(r._bufferService.cols,r._bufferService.rows),u}setOverlayProvider(i){this.overlayProvider=i,this.invalidateOverlay()}invalidateOverlay(){var r;const i=((r=this.overlayProvider)==null?void 0:r.call(this))??null,s=new Set(this.paintedOverlayRows);for(const u of F1(i))s.add(u);this.paintedCursorRow>=0&&s.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(s)}markInput(){this.inputAt=this.now()}flushHeld(){if(!this.held)return;const{start:i,end:s}=this.held;this.redraw.fire({start:i,end:s})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(i,s){this.updateDimensions(i,s);const r=this.dimensions;for(const d of[this.canvas,this.decorCanvas])d.width=r.device.canvas.width,d.height=r.device.canvas.height,d.style.width=`${r.css.canvas.width}px`,d.style.height=`${r.css.canvas.height}px`;const u=this.core.screenElement;u&&(u.style.width=`${r.css.canvas.width}px`,u.style.height=`${r.css.canvas.height}px`),this.resizeGrid(i,s),this.configureAtlas(),this.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.stopBlink(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(i,s,r){this.selection=i&&s&&!(i[0]===s[0]&&i[1]===s[1])?{start:[i[0],i[1]],end:[s[0],s[1]],columnSelectMode:r}:null,this.redrawDecor()}handleCursorMove(){this.blinkTimer&&this.restartBlink()}clear(){this.invalidateAll(),this.fillBackground()}clearTextureAtlas(){this.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(i,s){if(!(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)){if(this.isSynchronizing()){const r=this.now();if(this.holdStartedAt===null&&(this.holdStartedAt=r),r-this.holdStartedAt<this.maxSyncHoldMs){this.held=this.held?{start:Math.min(this.held.start,i),end:Math.max(this.held.end,s)}:{start:i,end:s},this.stats.heldFrames++,this.holdTimer||(this.holdTimer=setTimeout(()=>{this.holdTimer=null,this.flushHeld()},this.maxSyncHoldMs));return}}this.held&&(i=Math.min(i,this.held.start),s=Math.max(s,this.held.end)),this.held=null,this.holdStartedAt=null,this.holdTimer&&(clearTimeout(this.holdTimer),this.holdTimer=null),this.paint(Math.max(0,i),Math.min(this.rows-1,s))}}dispose(){if(!this.disposed){this.disposed=!0,this.stopBlink(),this.holdTimer&&clearTimeout(this.holdTimer);for(const i of this.disposables)i.dispose();this.disposables.length=0,this.redraw.dispose(),this.atlas.dispose(),this.canvas.remove(),this.decorCanvas.remove()}}uninstall(){const i=this.core._createRenderer;typeof i=="function"&&(this.core._renderService.setRenderer(i.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.canvas}paint(i,s){var v;const r=this.now(),d=this.buffer().ydisp;d!==this.lastYdisp&&(this.lastYdisp=d,this.redrawDecor());const m=((v=this.overlayProvider)==null?void 0:v.call(this))??null,h=new Map;for(const S of(m==null?void 0:m.cells)??[]){const T=h.get(S.row);T?T.push(S):h.set(S.row,[S])}const p=this.cursorState(m),y=new Set;for(let S=i;S<=s;S++)y.add(S);for(const S of this.paintedOverlayRows)wo(y,S-d,this.rows);for(const S of h.keys())wo(y,S-d,this.rows);this.paintedCursorRow>=0&&wo(y,this.paintedCursorRow,this.rows),p&&wo(y,p.y,this.rows);let b=0;for(const S of y)this.loadRow(S,d,h.get(S+d)),b+=this.paintRow(S,p);this.paintedOverlayRows=new Set(h.keys()),this.paintedCursorRow=p?p.y:-1,this.stats.frames++,this.stats.lastCells=b,this.stats.lastPaintMs=this.now()-r,this.inputAt!==null&&b>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}loadRow(i,s,r){const{content:u,fg:d,bg:m,ext:h,combined:p}=this.row,y=this.buffer().lines.get(s+i),b=this.work;for(let v=0;v<this.cols;v++)y&&v<y.length?(y.loadCell(v,b),u[v]=b.content,d[v]=b.fg,m[v]=b.bg,h[v]=pb(b),p[v]=b.content&sn.IS_COMBINED_MASK?b.combinedData:""):(u[v]=1<<sn.WIDTH_SHIFT,d[v]=0,m[v]=0,h[v]=0,p[v]="");if(r)for(const v of r){const S=v.col;if(S<0||S+v.width>this.cols)continue;S>0&&!(u[S]>>>sn.WIDTH_SHIFT)&&this.blankAt(S-1);const T=S+v.width;T<this.cols&&!(u[T]>>>sn.WIDTH_SHIFT)&&u[T-1]>>>sn.WIDTH_SHIFT===2&&this.blankAt(T);const E=N1(v.chars,v.width);u[S]=E.content,p[S]=E.combinedData,d[S]=v.style.fg,m[S]=v.style.bg,h[S]=v.style.ext,v.width===2&&(u[S+1]=0,p[S+1]="",d[S+1]=v.style.fg,m[S+1]=v.style.bg,h[S+1]=v.style.ext)}}blankAt(i){this.row.content[i]=32|1<<sn.WIDTH_SHIFT,this.row.combined[i]=""}paintRow(i,s){const r=this.cols,{content:u,fg:d,bg:m,ext:h,combined:p}=this.row,y=this.painted,b=i*r;let v=0,S=-1,T=-1,E="";const Y=()=>{S<0||(this.fillCells(S,i,T-S,E),S=-1)};let A=0;for(;A<r;){let B=u[A]>>>sn.WIDTH_SHIFT;B===0&&(B=1),A+B>r&&(B=r-A),B===1&&A+1<r&&this.overflowsInto(A)&&(B=2);const H=s&&s.y===i&&s.x>=A&&s.x<A+B?s.shape:0,ee=B|H<<3;let re=this.differs(b+A,A,ee);for(let J=1;J<B;J++)this.differs(b+A+J,A+J,4)&&(re=!0);if(re){for(let G=0;G<B;G++){const U=b+A+G;y.content[U]=u[A+G],y.fg[U]=d[A+G],y.bg[U]=m[A+G],y.ext[U]=h[A+G],y.meta[U]=G===0?ee:4,y.combined[U]=p[A+G]}v+=B;const J=this.plainFill(A,H);J!==null?S>=0&&T===A&&E===J?T=A+B:(Y(),S=A,T=A+B,E=J):(Y(),this.paintCell(A,i,B,H))}A+=B}return Y(),v}differs(i,s,r){const u=this.painted,d=this.row;return u.meta[i]!==r||u.content[i]!==d.content[s]||u.fg[i]!==d.fg[s]||u.bg[i]!==d.bg[s]||u.ext[i]!==d.ext[s]||u.combined[i]!==d.combined[s]}overflowsInto(i){const{content:s,fg:r,bg:u,ext:d}=this.row,m=s[i];if((m&sn.CODEPOINT_MASK)<128&&!(m&sn.IS_COMBINED_MASK)||m>>>sn.WIDTH_SHIFT!==1||Pu(r[i]))return!1;const p=s[i+1],y=p&sn.CODEPOINT_MASK;if(p>>>sn.WIDTH_SHIFT!==1||p&sn.IS_COMBINED_MASK||y!==0&&y!==32||u[i]!==u[i+1]||d[i+1]!==0||(r[i]&rn.INVERSE)!==(r[i+1]&rn.INVERSE)||r[i]&rn.INVERSE&&r[i]!==r[i+1]||r[i+1]&(rn.UNDERLINE|rn.STRIKETHROUGH)||u[i+1]&ia.OVERLINE)return!1;const b=this.charsAt(i);return this.core.optionsService.rawOptions.customGlyphs!==!1&&wb(b)?!1:this.atlas.overflow(b,vo(r[i]),Vu(u[i]))>0}charsAt(i){const s=this.row.content[i];if(s&sn.IS_COMBINED_MASK)return this.row.combined[i];const r=s&sn.CODEPOINT_MASK;return r?String.fromCodePoint(r):""}plainFill(i,s){if(s!==0)return null;const{content:r,fg:u,bg:d}=this.row,m=r[i],h=m&sn.CODEPOINT_MASK,p=!(m&sn.IS_COMBINED_MASK)&&(h===0||h===32),y=Pu(u[i]);return!p&&!y||(u[i]&(rn.UNDERLINE|rn.STRIKETHROUGH)||d[i]&ia.OVERLINE)&&!y?null:Yp(u[i],d[i],this.colors(),this.boldBright()).bg}paintCell(i,s,r,u){const d=this.ctx,m=this.dimensions.device,h=this.colors(),p=this.row.fg[i],y=this.row.bg[i],b=this.row.ext[i],v=Yp(p,y,h,this.boldBright());let S=v.fg,T=v.bg;u===1&&(T=h.cursor.css,S=h.cursorAccent.css);const E=Pu(p),Y=this.charsAt(i),A=i*m.cell.width,O=s*m.cell.height,B=r*m.cell.width,H=m.cell.height,ee=E||Y===""||Y===" ",re=ee?null:this.atlas.get({chars:Y,bold:vo(p),italic:Vu(y),dim:Xu(y),fg:S,bg:T,cells:r});re?d.drawImage(re.source,re.x,re.y,re.width,re.height,A,O,B,H):(d.fillStyle=T,d.fillRect(A,O,B,H),ee||(d.save(),d.beginPath(),d.rect(A,O,B,H),d.clip(),d.fillStyle=S,Xu(y)&&(d.globalAlpha=dd),d.font=this.atlas.fontString(vo(p),Vu(y)),d.fillText(Y,A+m.char.left,O+m.char.top+m.char.height),d.restore())),E||this.paintDecorations(A,O,r,p,y,b,S),u!==0&&u!==1&&this.paintCursorShape(A,O,B,u)}paintDecorations(i,s,r,u,d,m,h){const p=(u&rn.UNDERLINE)!==0,y=(u&rn.STRIKETHROUGH)!==0,b=(d&ia.OVERLINE)!==0;if(!p&&!y&&!b)return;const v=this.ctx,S=this.dimensions.device,T=this.core.optionsService.rawOptions,E=this.core._coreBrowserService.dpr,Y=r*S.cell.width;v.save(),v.beginPath(),v.rect(i,s,Y,S.cell.height),v.clip(),Xu(d)&&(v.globalAlpha=dd);const A=Math.max(1,Math.floor(T.fontSize*E/15)),O=A%2===1?.5:0;if(p){const B=E1(m);let H=h;if(B){let J=B;this.boldBright()&&vo(u)&&(J&50331648)!==50331648&&(J&255)<8&&(J+=8),H=yb(J,this.colors(),h)}v.strokeStyle=H,v.lineWidth=A;const ee=s+S.char.top+Math.ceil(S.char.height)-O-A*2,re=m?A1(m):Ia.SINGLE;switch(v.beginPath(),re){case Ia.DOUBLE:v.moveTo(i,ee),v.lineTo(i+Y,ee),v.moveTo(i,ee+A*2),v.lineTo(i+Y,ee+A*2);break;case Ia.CURLY:{const J=ee+A,G=Math.max(1,A);for(let U=0;U<r;U++){const ae=i+U*S.cell.width,ne=ae+S.cell.width/2,Se=ae+S.cell.width;v.moveTo(ae,J),v.bezierCurveTo(ae,J-G,ne,J-G,ne,J),v.bezierCurveTo(ne,J+G,Se,J+G,Se,J)}break}case Ia.DOTTED:v.setLineDash([A,A]),v.moveTo(i,ee),v.lineTo(i+Y,ee);break;case Ia.DASHED:{const J=Math.floor(.6*S.cell.width),G=Math.floor(.3*S.cell.width);v.setLineDash([J,G,S.cell.width-J-G]),v.moveTo(i,ee),v.lineTo(i+Y,ee);break}default:v.moveTo(i,ee),v.lineTo(i+Y,ee)}v.stroke(),v.setLineDash([])}if(b&&(v.strokeStyle=h,v.lineWidth=A,v.beginPath(),v.moveTo(i,s+S.char.top+O),v.lineTo(i+Y,s+S.char.top+O),v.stroke()),y){const B=Math.max(1,Math.floor(T.fontSize*E/10)),H=s+S.char.top+Math.floor(S.char.height/2)-(B%2===1?.5:0);v.strokeStyle=h,v.lineWidth=B,v.beginPath(),v.moveTo(i,H),v.lineTo(i+Y,H),v.stroke()}v.restore()}paintCursorShape(i,s,r,u){const d=this.ctx,m=this.dimensions.device,h=this.core._coreBrowserService.dpr,p=this.colors();switch(d.save(),d.fillStyle=p.cursor.css,d.strokeStyle=p.cursor.css,u){case 2:d.fillRect(i,s,Math.max(1,Math.round(this.core.optionsService.rawOptions.cursorWidth*h)),m.cell.height);break;case 3:d.fillRect(i,s+m.cell.height-Math.max(1,Math.round(h))-1,r,Math.max(1,Math.round(h)));break;case 4:{const y=Math.max(1,Math.round(h));d.lineWidth=y,d.strokeRect(i+y/2,s+y/2,r-y,m.cell.height-y);break}}d.restore()}fillCells(i,s,r,u){const d=this.dimensions.device;this.ctx.fillStyle=u,this.ctx.fillRect(i*d.cell.width,s*d.cell.height,r*d.cell.width,d.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}cursorState(i){const s=this.core,r=this.buffer();let u,d;if(i&&i.cursor!==void 0){if(i.cursor===null)return null;u=i.cursor.row,d=i.cursor.col}else{if(!s.coreService.isCursorInitialized||s.coreService.isCursorHidden)return null;u=r.ybase+r.y,d=r.x}const m=u-r.ydisp;if(m<0||m>=this.rows)return null;const h=Math.min(Math.max(0,d),this.cols-1),p=s.optionsService.rawOptions;let y;if(s._coreBrowserService.isFocused)this.blinkTimer&&!this.blinkVisible?y=0:y=qp(p.cursorStyle||"block");else{const b=p.cursorInactiveStyle??"outline";y=b==="none"?0:qp(b)}return y===0?null:{x:h,y:m,shape:y}}restartBlink(){if(this.stopBlink(),this.blinkVisible=!0,this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blinkTimer=setInterval(()=>{this.blinkVisible=!this.blinkVisible,this.requestCursorRow()},I1),this.requestCursorRow()}stopBlink(){this.blinkTimer&&clearInterval(this.blinkTimer),this.blinkTimer=null,this.blinkVisible=!0}requestCursorRow(){if(!this.rows)return;const i=this.buffer(),s=new Set;s.add(i.ybase+i.y),this.paintedCursorRow>=0&&s.add(this.paintedCursorRow+i.ydisp),this.requestAbsoluteRows(s)}redrawDecor(){var p;const i=this.decorCtx;i.clearRect(0,0,this.decorCanvas.width,this.decorCanvas.height);const s=this.dimensions.device;if(!s.cell.width||!this.rows)return;const r=this.colors(),u=this.buffer().ydisp,d=(y,b,v,S)=>i.fillRect(y*s.cell.width,b*s.cell.height,v*s.cell.width,S*s.cell.height),m=this.selection;if(m){const y=m.start[1]-u,b=m.end[1]-u,v=Math.max(y,0),S=Math.min(b,this.rows-1);if(v<this.rows&&S>=0)if(i.fillStyle=(this.core._coreBrowserService.isFocused?r.selectionBackgroundTransparent:r.selectionInactiveBackgroundTransparent).css,m.columnSelectMode)d(m.start[0],v,m.end[0]-m.start[0],S-v+1);else{const T=y===v?m.start[0]:0,E=v===b?m.end[0]:this.cols;d(T,v,E-T,1),d(0,v+1,this.cols,Math.max(S-v-1,0)),v!==S&&d(0,S,b===S?m.end[0]:this.cols,1)}}const h=this.link;if(h){const y=this.core._coreBrowserService.dpr;i.fillStyle=h.fg===257?r.background.css:h.fg!==void 0&&h.fg<256?((p=r.ansi[h.fg])==null?void 0:p.css)??r.foreground.css:r.foreground.css;const b=(v,S,T)=>i.fillRect(v*s.cell.width,(S+1)*s.cell.height-y-1,T*s.cell.width,y);if(h.y1===h.y2)b(h.x1,h.y1,h.x2-h.x1);else{b(h.x1,h.y1,h.cols-h.x1);for(let v=h.y1+1;v<h.y2;v++)b(0,v,h.cols);b(0,h.y2,h.x2)}}}updateDimensions(i,s){const r=this.core._charSizeService;if(!r.hasValidSize)return;const u=this.core._coreBrowserService.dpr,d=this.core.optionsService.rawOptions,m=this.dimensions;m.device.char.width=Math.floor(r.width*u),m.device.char.height=Math.ceil(r.height*u),m.device.cell.height=Math.floor(m.device.char.height*d.lineHeight),m.device.char.top=d.lineHeight===1?0:Math.round((m.device.cell.height-m.device.char.height)/2),m.device.cell.width=m.device.char.width+Math.round(d.letterSpacing),m.device.char.left=Math.floor(d.letterSpacing/2),m.device.canvas.height=s*m.device.cell.height,m.device.canvas.width=i*m.device.cell.width,m.css.canvas.height=Math.round(m.device.canvas.height/u),m.css.canvas.width=Math.round(m.device.canvas.width/u),m.css.cell.height=m.css.canvas.height/s,m.css.cell.width=m.css.canvas.width/i,this.dprUsed=u}resizeGrid(i,s){this.cols=i,this.rows=s;const r=i*s;this.painted={content:new Uint32Array(r).fill(xo),fg:new Uint32Array(r),bg:new Uint32Array(r),ext:new Uint32Array(r),meta:new Uint32Array(r).fill(xo),combined:new Array(r).fill("")},this.row={content:new Uint32Array(i),fg:new Uint32Array(i),bg:new Uint32Array(i),ext:new Uint32Array(i),combined:new Array(i).fill("")},this.paintedOverlayRows.clear(),this.paintedCursorRow=-1}configureAtlas(){const i=this.dimensions.device,s=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:i.cell.width,cellHeight:i.cell.height,charWidth:i.char.width,charHeight:i.char.height,charLeft:i.char.left,charTop:i.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,customGlyphs:s.customGlyphs!==!1})}invalidateAll(){this.painted.content.fill(xo),this.painted.meta.fill(xo),this.paintedCursorRow=-1}observeDevicePixels(){const i=this.core._coreBrowserService.window;if(!i||typeof i.ResizeObserver!="function")return;let s=new i.ResizeObserver(r=>{var y;const u=r.find(b=>b.target===this.canvas);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((y=u.devicePixelContentBoxSize)!=null&&y[0])){s==null||s.disconnect(),s=null;return}const d=u.devicePixelContentBoxSize[0].inlineSize,m=u.devicePixelContentBoxSize[0].blockSize;if(d<=0||m<=0||d===this.canvas.width&&m===this.canvas.height)return;const h=this.core._coreBrowserService.dpr,p=this.dimensions.css.canvas;if(!(Math.abs(d-p.width*h)>2||Math.abs(m-p.height*h)>2)){this.dimensions.device.canvas.width=d,this.dimensions.device.canvas.height=m;for(const b of[this.canvas,this.decorCanvas])b.width=d,b.height=m;this.invalidateAll(),this.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}});try{s.observe(this.canvas,{box:"device-pixel-content-box"})}catch{s.disconnect(),s=null}this.disposables.push({dispose:()=>s==null?void 0:s.disconnect()})}observeFonts(i){const s=i.fonts;if(!s||typeof s.addEventListener!="function")return;const r=()=>this.clearTextureAtlas();s.addEventListener("loadingdone",r),this.disposables.push({dispose:()=>s.removeEventListener("loadingdone",r)})}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}requestAbsoluteRows(i){if(!this.rows)return;const s=this.buffer().ydisp;let r=1/0,u=-1/0;for(const d of i){const m=d-s;m<0||m>=this.rows||(r=Math.min(r,m),u=Math.max(u,m))}r<=u&&this.redraw.fire({start:r,end:u})}}function qp(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function F1(a){if(!a)return[];const i=a.cells.map(s=>s.row);return a.cursor&&i.push(a.cursor.row),i}function wo(a,i,s){i>=0&&i<s&&a.add(i)}const Qs="herdr_remote_renderer_probe_v2",V1=30,So=1,X1=720*60*60*1e3,fd={};function Sb(){let a=null;if(typeof window>"u")a=fd[Qs]||null;else try{a=window.localStorage?window.localStorage.getItem(Qs):null}catch{a=fd[Qs]||null}if(!a)return{v:So,ua:{}};try{const i=JSON.parse(a);return typeof i=="object"&&i!==null&&i.v===So&&typeof i.ua=="object"&&i.ua!==null?i:{v:So,ua:{}}}catch{return{v:So,ua:{}}}}function P1(a,i=Date.now()){var u;const s=Sb();s.ua[a]={failedAt:i};const r=JSON.stringify(s);if(fd[Qs]=r,typeof window<"u")try{(u=window.localStorage)==null||u.setItem(Qs,r)}catch(d){console.warn("Failed to write renderer probe result to localStorage:",d)}}function Z1(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";if(!s)return!1;const u=Sb().ua[s];return!(!u||typeof u.failedAt!="number"||i-u.failedAt>X1)}function Fp(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";s&&P1(s,i)}function Q1(a){if(a.length<4)return!0;const i=a[0],s=a[1],r=a[2],u=a[3];for(let d=4;d<a.length;d+=4)if(a[d]!==i||a[d+1]!==s||a[d+2]!==r||a[d+3]!==u)return!1;return!0}function W1(a){if(!a||a.width<=0||a.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=a.getContext("2d",{willReadFrequently:!0})||a.getContext("2d")}catch(u){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",u),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const s=Math.min(a.width,640),r=Math.min(a.height,240);if(s<=0||r<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const u=i.getImageData(0,0,s,r);return Q1(u.data)?"blank":"healthy"}catch(u){return console.debug("Canvas probe inconclusive: getImageData threw exception:",u),"inconclusive"}}function Vp(a=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let s=a;const r=()=>{s--,s<=0?i():requestAnimationFrame(r)};requestAnimationFrame(r)})}const Zu={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function J1(a,i={}){if(Z1())return Zu;let s;try{s=Ed.install(a,{isSynchronizing:i.isSynchronizing})}catch(h){return console.debug("Canvas renderer unavailable, using the DOM renderer:",h),Fp(),Zu}if(!s)return Zu;let r=s,u=null;const d=()=>{var p;if(!r)return;Fp();const h=r;r=null;try{h.uninstall()}catch{}(p=i.onRendererSwapped)==null||p.call(i,"dom")};return{get kind(){return r?"canvas":"dom"},get canvas(){return r},dispose:()=>{const h=r;r=null;try{h==null||h.dispose()}catch{}},verify:async()=>{if(r)return u||(u=(async()=>{try{const h=r.stats.frames;await Vp(2);for(let y=0;y<V1&&r&&r.stats.frames===h;y++)await Vp(1);if(!r)return;const p=W1(r.textCanvas);p==="blank"?d():p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(h){console.debug("Canvas probe inconclusive: unexpected error during verify():",h)}finally{u=null}})(),u)}}}function Xp(a,i){const s=typeof window<"u"?window:void 0,r=s&&typeof s.devicePixelRatio=="number"&&s.devicePixelRatio>0?s.devicePixelRatio:1,u=s&&s.visualViewport&&typeof s.visualViewport.scale=="number"&&s.visualViewport.scale>0?s.visualViewport.scale:1,d=Math.max(0,a.width),m=Math.max(0,a.height),h=Math.round(d*r*100)/100,p=Math.round(m*r*100)/100;return{dpr:r,scale:u,cssWidth:d,cssHeight:m,physicalWidth:h,physicalHeight:p}}function ew(a){const{lastSnapshot:i,currentSnapshot:s,physicalTolerancePx:r=6}=a;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const u=Math.abs(s.scale-i.scale)>.01,d=Math.abs(s.scale-1)>.01;if(u||d)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(s.dpr-i.dpr)>.01){const y=Math.abs(s.physicalWidth-i.physicalWidth),b=Math.abs(s.physicalHeight-i.physicalHeight);if(y<=r&&b<=r)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const h=Math.abs(s.cssWidth-i.cssWidth),p=Math.abs(s.cssHeight-i.cssHeight);return h<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const tw=" ()[]{}'\"\\`";function Qu(a,i,s,r=1){var A,O;if(!i||!((A=i.buffer)!=null&&A.active)||i.cols<=0||i.rows<=0)return null;const u=s||((O=i.element)==null?void 0:O.querySelector(".xterm-screen"))||i.element;if(!u||typeof u.getBoundingClientRect!="function")return null;const d=u.getBoundingClientRect(),m=hb(a.clientX,a.clientY,d,r),h=na(i);if(h.cellWidth<=0||h.cellHeight<=0)return null;const p=Math.max(1,d.width||i.cols*h.cellWidth),y=Math.max(1,d.height||i.rows*h.cellHeight),b=Math.max(0,Math.min(p-1,m.clientX-d.left)),v=Math.max(0,Math.min(y-1,m.clientY-d.top)),S=Math.max(0,Math.min(i.cols-1,Math.floor(b/h.cellWidth))),T=Math.max(0,Math.min(i.rows-1,Math.floor(v/h.cellHeight))),Y=(i.buffer.active.viewportY??0)+T;return{col:S,bufferRow:Y}}function nw(a,i){if(!a||a.length===0||a==="\0")return!0;for(const s of a)if(s==="\0"||/\s/.test(s)||i.includes(s))return!0;return!1}function iw(a,i,s){var S,T;if(!a||!((S=a.buffer)!=null&&S.active)||i<0||i>=a.cols)return null;const r=a.buffer.active.getLine(s);if(!r)return null;const u=((T=a.options)==null?void 0:T.wordSeparator)??tw,d=new Array(a.cols).fill(null),m=Math.min(a.cols,r.length);let h=0;for(;h<m;){const E=r.getCell(h);if(!E){d[h]={startCol:h,endCol:h+1,isSeparator:!0},h++;continue}const Y=E.getWidth();if(Y===0){d[h]||(d[h]={startCol:h,endCol:h+1,isSeparator:!0}),h++;continue}const A=E.getChars(),O=nw(A,u),B=Math.min(a.cols,h+Y),H={startCol:h,endCol:B,isSeparator:O};for(let ee=h;ee<B;ee++)d[ee]=H;h+=Math.max(1,Y)}for(let E=m;E<a.cols;E++)d[E]||(d[E]={startCol:E,endCol:E+1,isSeparator:!0});const p=d[i];if(!p||p.isSeparator)return null;let y=p.startCol;for(;y>0;){const E=d[y-1];if(E&&!E.isSeparator)y=E.startCol;else break}let b=p.endCol;for(;b<a.cols;){const E=d[b];if(E&&!E.isSeparator)b=E.endCol;else break}const v=b-y;return v<=0?null:{startCol:y,length:v}}function lw(a){var d;if(!a||!((d=a.buffer)!=null&&d.active))return"";const i=a.buffer.active,s=i.viewportY??0,r=a.rows,u=[];for(let m=0;m<r;m++){const h=i.getLine(s+m);u.push(h?h.translateToString(!0):"")}for(;u.length>0&&u[u.length-1]==="";)u.pop();return u.join(`
|
|
45
|
+
`)}const Pp=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),aw=.6,sw=new Set(["─","━","═","┄","┅","┈","┉","-"]),rw=.8;function Wu(a,i){if(!a)return!1;let s=0;const r=Math.min(i,a.length);for(let u=0;u<r;u++){const d=a.getCell(u);if(d){const m=d.getChars();m&&sw.has(m)&&s++}}return s>=Math.max(5,Math.min(i*.25,10))}function Ju(a,i,s){var T;if(!a||!((T=a.buffer)!=null&&T.active)||a.cols<=0)return{startCol:0,endCol:0};const r=a.buffer.active,u=a.cols,d=Math.max(0,Math.min(u-1,i)),m=r.viewportY??0,h=a.rows>0?a.rows:1,p=new Int32Array(u);let y=0;for(let E=0;E<h;E++){const Y=r.getLine(m+E);if(y++,!Y)continue;const A=Math.min(u,Y.length);for(let O=0;O<A;O++){const B=Y.getCell(O);if(B){const H=B.getChars();H&&Pp.has(H)&&p[O]++}}}if(y===0)return{startCol:0,endCol:u-1};const b=y*aw,v=E=>p[E]>=b;let S=!1;for(let E=0;E<u;E++)if(v(E)){S=!0;break}if(S){if(v(d))return{startCol:d,endCol:d};let E=-1;for(let A=d-1;A>=0;A--)if(v(A)){E=A;break}let Y=u;for(let A=d+1;A<u;A++)if(v(A)){Y=A;break}return{startCol:E+1,endCol:Y-1}}if(s!==void 0){const E=Math.max(m,Math.min(m+h-1,s)),Y=r.getLine(E);if(!Wu(Y,u)){let A=m;for(let H=E-1;H>=m;H--)if(Wu(r.getLine(H),u)){A=H+1;break}let O=m+h-1;for(let H=E+1;H<=m+h-1;H++)if(Wu(r.getLine(H),u)){O=H-1;break}const B=O-A+1;if(B>=2){const H=new Int32Array(u);for(let G=A;G<=O;G++){const U=r.getLine(G);if(!U)continue;const ae=Math.min(u,U.length);for(let ne=0;ne<ae;ne++){const Se=U.getCell(ne);if(Se){const Ee=Se.getChars();Ee&&Pp.has(Ee)&&H[ne]++}}}const ee=B*rw,re=G=>H[G]>=ee;let J=!1;for(let G=0;G<u;G++)if(re(G)){J=!0;break}if(J){if(re(d))return{startCol:d,endCol:d};let G=-1;for(let ae=d-1;ae>=0;ae--)if(re(ae)){G=ae;break}let U=u;for(let ae=d+1;ae<u;ae++)if(re(ae)){U=ae;break}return{startCol:G+1,endCol:U-1}}}}}return{startCol:0,endCol:u-1}}function Zp(a,i){const s=Math.min(a.startCol,a.endCol),r=Math.max(a.startCol,a.endCol),u=Math.min(a.startRow,a.endRow),d=Math.max(a.startRow,a.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,s)),endCol:Math.max(i.startCol,Math.min(i.endCol,r)),startRow:u,endRow:d}}function ed(a,i){var y;if(!a||!((y=a.buffer)!=null&&y.active)||a.cols<=0)return"";const s=a.buffer.active,r=a.cols,u=Math.min(i.startRow,i.endRow),d=Math.max(i.startRow,i.endRow),m=Math.max(0,Math.min(i.startCol,i.endCol)),h=Math.min(r-1,Math.max(i.startCol,i.endCol));if(m>h||u>d)return"";const p=[];for(let b=u;b<=d;b++){const v=s.getLine(b);if(!v){p.push("");continue}const S=v.translateToString(!0,m,h+1);p.push(S.trimEnd())}return p.join(`
|
|
46
|
+
`)}async function la(a){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(a),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,s=null,r=null;try{if(i=document.createElement("textarea"),i.style.userSelect="text",i.style.webkitUserSelect="text",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="1px",i.style.height="1px",i.style.padding="0",i.style.border="none",i.style.outline="none",i.style.boxShadow="none",i.style.background="transparent",i.style.opacity="0",i.style.fontSize="16px",i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.value=a,typeof window<"u"&&typeof window.getSelection=="function"&&(r=window.getSelection(),r&&r.rangeCount>0&&(s=r.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const m=document.createRange();m.selectNodeContents(i),r&&(r.removeAllRanges(),r.addRange(m)),i.setSelectionRange(0,a.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i&&i.parentNode&&i.parentNode.removeChild(i),r&&(r.removeAllRanges(),s&&r.addRange(s))}}return"failed"}async function ow(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.readText();return!i||i.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:i}}catch(i){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(i==null?void 0:i.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function cw(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.read();if(!i||i.length===0)return{ok:!1,reason:"empty"};for(const s of i){const r=s.types.find(u=>u.startsWith("image/"));if(r){const u=await s.getType(r);if(u&&u.size>0)return{ok:!0,blob:u}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const s=i==null?void 0:i.name;return s==="SecurityError"?{ok:!1,reason:"insecure"}:s==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function Cb(a){const i=a.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let s=0;s<i.files.length;s++){const r=i.files[s];if(r&&r.type.startsWith("image/"))return r}if(i.items&&i.items.length>0)for(let s=0;s<i.items.length;s++){const r=i.items[s];if(r&&r.type.startsWith("image/")){const u=r.getAsFile();if(u)return u}}return null}function uw(a){if(!a||a.length===0)return null;for(let i=0;i<a.length;i++){const s=a[i];if(s&&(s.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(s.name)))return s}return null}const td="Herdr Remote",Qp=80,dw=/[\u0000-\u001F\u007F-\u009F]/g;function hd(a){if(typeof a!="string")return"";const i=a.replace(dw," ").replace(/\s+/g," ").trim();return i.length<=Qp?i:`${i.slice(0,Qp-1).trimEnd()}…`}function fw(a,i,s){const r=Qv(s??null),u=r?`${r} `:"",d=hd(a);if(d)return`${u}${d} · ${td}`;const m=hd(i);return m?`${u}${m} · ${td}`:`${u}${td}`}function hw(a,i,s){const r=fw(a,i,s);return typeof document<"u"&&(document.title=r),r}const mw=new Set(["http:","https:","mailto:"]),nd=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,pw=/[.,;:!?'"]+$/,Wp=8;function Nd(a){return/^www\./i.test(a)?`https://${a}`:a}function gw(a){const i=(u,d)=>u.split(d).length-1;let s=a.replace(pw,"");const r=[["(",")"],["[","]"],["{","}"]];for(const[u,d]of r)for(;s.endsWith(d)&&i(s,d)>i(s,u);)s=s.slice(0,-1);return s}function Tb(a){if(typeof a!="string"||a.length===0)return!1;try{return mw.has(new URL(Nd(a)).protocol)}catch{return!1}}function bw(a,i){if(typeof a!="string"||i<0)return null;nd.lastIndex=0;for(let s=nd.exec(a);s;s=nd.exec(a)){const r=gw(s[0]);if(!r)continue;const u=s.index,d=u+r.length;if(i>=u&&i<d&&Tb(r))return r}return null}function yw(a,i,s){var h;const r=(h=a==null?void 0:a.buffer)==null?void 0:h.active;if(!r||typeof r.getLine!="function"||!r.getLine(s))return null;let u=s;for(let p=0;p<Wp;p+=1){const y=r.getLine(u);if(!(y!=null&&y.isWrapped)||u===0)break;u-=1}let d="",m=-1;for(let p=u;p<u+Wp;p+=1){const y=r.getLine(p);if(!y||p>u&&!y.isWrapped)break;p===s&&(m=d.length+i),d+=y.translateToString(!1)}return m<0?null:{text:d,index:m}}function vw(a,i,s){const r=yw(a,i,s);return r?bw(r.text,r.index):null}function xw(a){try{const i=new URL(Nd(a));return i.host||i.pathname}catch{return""}}function id(a){return!Tb(a)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Nd(a),"_blank","noopener,noreferrer"),!0)}const Ya="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Ga="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",ww=({anchorPoint:a,hasSelection:i,isController:s,vibrateOnKeyPress:r=!1,linkUrl:u=null,onOpenLink:d,onCopySelection:m,onCopyLine:h,onCopyScreen:p,onPaste:y,onClose:b})=>{const{t:v}=Nt(),S=w.useRef(null),[T,E]=w.useState(null);w.useEffect(()=>{if(r&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r]),w.useLayoutEffect(()=>{const B=S.current;if(!B||!B.parentElement)return;const H=B.parentElement.getBoundingClientRect(),ee=B.getBoundingClientRect(),re=ee.width||208,J=ee.height||220,G=H.width,U=H.height;let ae=a.x-re/2;ae=Math.max(8,Math.min(Math.max(8,G-re-8),ae));let ne=a.y-J-8;ne<8&&(ne=a.y+8),ne=Math.max(8,Math.min(Math.max(8,U-J-8),ne)),E({x:ae,y:ne})},[a.x,a.y,i,s,u]);const Y=Math.max(8,a.x-104),A=Math.max(8,a.y-200),O={position:"absolute",left:`${T?T.x:Y}px`,top:`${T?T.y:A}px`,visibility:T?"visible":"hidden"};return f.jsx("div",{ref:S,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:O,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),onPointerDown:B=>B.stopPropagation(),children:f.jsxs(hn,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[u&&d&&f.jsxs("button",{type:"button",role:"menuitem",className:ie(Ya,Ga),onClick:()=>{d(u),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:xw(u)})]}),i&&f.jsxs("button",{type:"button",role:"menuitem",className:ie(Ya,Ga),onClick:()=>{m(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ie(Ya,Ga),onClick:()=>{h(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ie(Ya,Ga),onClick:()=>{p(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),s&&f.jsxs("button",{type:"button",role:"menuitem",className:ie(Ya,Ga),onClick:()=>{y(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ie(Ya,Ga),onClick:b,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},Sw=({isOpen:a,onClose:i,onSend:s,onSendImage:r})=>{const{t:u,addToast:d}=Nt(),[m,h]=w.useState(""),[p,y]=w.useState(null),[b,v]=w.useState(!1),S=w.useRef(null),T=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{a&&(h(""),y(null),v(!1),S.current&&(S.current.value=""),T.current&&(T.current.value=""))},[a]);const Y=async J=>{if(J.size===0){d("error",u("clipboard.fileEmpty"));return}v(!0);try{const G=await Kg(J);G?(y(G),h("")):d("error",u("clipboard.imageTooLarge"))}catch(G){console.error("Failed to process image:",G),d("error",u("clipboard.imageTooLarge"))}finally{v(!1)}},A=async J=>{const G=Cb(J);G&&(J.preventDefault(),await Y(G))},O=async J=>{const G=uw(J.target.files);J.target.value="",G&&await Y(G)},B=J=>{const G=J.target.value;h(G),G&&p&&y(null)},H=()=>{y(null),S.current&&(S.current.value=""),T.current&&(T.current.value="")},ee=()=>{p?(r==null||r(p),i()):m.trim()&&(s(m),i())},re=!!(m.trim()||p);return f.jsx(Ad,{isOpen:a,onClose:i,title:u("clipboard.pasteTitle"),closeLabel:u("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(ke,{variant:"ghost",onClick:i,children:u("clipboard.cancel")}),f.jsx(ke,{variant:"primary",onClick:ee,disabled:!re||b,children:u("clipboard.pasteSend")})]}),children:f.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:u("clipboard.pasteHint")}),f.jsx("textarea",{ref:E,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:u("clipboard.pasteHint"),value:m,onChange:B,onPaste:A,disabled:!!p||b,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),f.jsxs("div",{className:"relative my-1",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-tui-border"})}),f.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:f.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:u("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.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:O}),f.jsx("input",{ref:T,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:O}),p?f.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[f.jsx("img",{src:p.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),f.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[f.jsx("span",{children:u("clipboard.imageCompressedSize",{size:Gv(p.byteLength)})}),f.jsx(ke,{variant:"ghost",onClick:H,"aria-label":u("clipboard.removeImage"),children:u("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(ke,{variant:"default",onClick:()=>{var J;return(J=S.current)==null?void 0:J.click()},disabled:b||!!m.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":u("clipboard.chooseImage"),children:u("clipboard.chooseImage")}),f.jsx(ke,{variant:"default",onClick:()=>{var J;return(J=T.current)==null?void 0:J.click()},disabled:b||!!m.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":u("clipboard.takePhoto"),children:u("clipboard.takePhoto")})]}),b&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:u("clipboard.imageCompressing")})})]})]})})},Cw=[[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 Jp(a){if(a>=32&&a<=126)return 1;if(a<12288)return 0;for(const[i,s]of Cw){if(a<i)return 0;if(a<=s)return 2}return 0}const Tw=2,Mw="?!#",eg=8,Aw=1500,Ew=4e3,Nw=20;function Xi(a){return a===""||a===" "?" ":a}function Lw(a,i,s,r=64){var m;const u=a.buffer.active.getLine(i),d=[];for(let h=s-1;h>=0&&d.length<r;h--){const p=u==null?void 0:u.getCell(h);if(!p)break;((m=p.getWidth)==null?void 0:m.call(p))!==0&&d.unshift(Xi(p.getChars()))}return d}function kw(a,i){for(let s=Math.min(a.length,i.length);s>0;s--){let r=!0;for(let u=0;u<s&&r;u++)r=i[i.length-s+u]===Xi(a[u]);if(r)return s}return 0}function Rw(a){const i=a.buffer.active;return{key:"legacy",row:i.baseY+i.cursorY,caretCol:i.cursorX,startCol:i.cursorX,endCol:a.cols,empty:!1,agentLike:!1}}class _w{constructor(i){X(this,"getTerminal");X(this,"getFieldOption");X(this,"charWidth");X(this,"now");X(this,"textDecoder",new TextDecoder("utf-8"));X(this,"confidentKeys",new Set);X(this,"fieldStyles",new Map);X(this,"field",null);X(this,"runStartedEmpty",!1);X(this,"predictions",[]);X(this,"predictedCursor",null);X(this,"srtt",null);X(this,"isSuppressed",!1);X(this,"suppressCursor",null);X(this,"suppressSentAt",0);X(this,"inFlight",[]);X(this,"inFlightUnknown",!1);X(this,"runInFlight",[]);X(this,"probationRun",!1);X(this,"runSent",[]);X(this,"lastSentUndrawn",!1);X(this,"awaitingPrefixCommand",!1);X(this,"mismatches",0);X(this,"trace",[]);this.getTerminal=i.getTerminal,this.getFieldOption=i.getField,this.charWidth=i.charWidth,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(i){var m;if(this.pruneExpired(),i.length===0)return;const s=this.textDecoder.decode(i,{stream:!1});if(!s)return;const r=ub(s);if(r==="passive")return;if(r==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(b1(s)){const h=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;this.freeze("escape",{demote:!h||h.modal!==!1});return}const u=this.getTerminal();if(!u){this.reset("terminal unavailable",!0);return}const d=Array.from(s);for(let h=0;h<d.length;h++){const p=d[h],y=p.codePointAt(0);if(y===void 0)continue;if(y===Tw){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(y===27||y===9||y===10||y===13||y<32&&y!==8){this.freeze("control or escape sequence");return}if(y===8||y===127){if(!this.handleBackspace(u))return;continue}if(this.stillSuppressed()){this.inFlight.push(p),this.note("refused: waiting for the caret to move");continue}const b=Jp(y);if(b===0){if(!this.skipUnpredictable(p,y,u)){h<d.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(p,b,u)){h<d.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const i=this.getTerminal(),s=i?{row:i.buffer.active.baseY+i.buffer.active.cursorY,col:i.buffer.active.cursorX}:null;this.pruneExpired(),i&&s&&this.predictions.length>0&&this.settle(i,s),this.updateSuppression(s)}updateSuppression(i){if(!this.isSuppressed)return;if(this.predictions.some(r=>r.frozenFrom)){this.suppressSentAt=this.now();return}!!i&&!!this.suppressCursor&&(i.row!==this.suppressCursor.row||i.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}settle(i,s){var d,m;const r=this.field;if(this.getFieldOption){const h=this.getFieldOption();if(!h||h.key!==(r==null?void 0:r.key)){if(this.predictions.every(p=>p.frozenFrom||p.echoed)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(h.layout!==r.layout){this.predictions=[],this.predictedCursor=null,this.field=h,this.note("layout changed");return}}const u=[];for(const h of this.predictions){const p=(d=i.buffer.active.getLine(h.row))==null?void 0:d.getCell(h.col),y=Xi(p?p.getChars():""),b=h.kind==="char"?y===h.char&&(h.width===1||(((m=p==null?void 0:p.getWidth)==null?void 0:m.call(p))??2)===2):y===" ",v=h.kind==="char"?s.row>h.row||s.row===h.row&&s.col>=h.col+h.width:s.row<h.row||s.row===h.row&&s.col<=h.col,S=h.before.includes(y),T=h.kind==="char"&&y===h.char&&!b;if(!(h.echoed&&!b))if(b&&(v||!S)){if(h.echoed||this.confirm(h,r),v){h.kind==="char"&&r&&!h.frozenFrom&&this.learnStyle(r.key,p);continue}h.echoed=!0,u.push(h)}else if(h.frozenFrom){const E=h.frozenFrom;!v&&s.row===E.row&&s.col>=E.col?u.push(h):v&&h.probation&&(this.inFlightUnknown=!0)}else if(!v&&!T)u.push(h);else if(h.probation){this.note("probation guess dropped"),this.predictions.some(E=>!E.frozenFrom&&E.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(E=>E.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(y)} for ${JSON.stringify(h.char)}`);return}}this.predictions=u,u.length===0&&(this.predictedCursor=null)}reset(i,s){var d;this.predictions=[],this.predictedCursor=null;const r=typeof s=="boolean"?s:(s==null?void 0:s.suppress)??!0,u=typeof s=="object"&&(s==null?void 0:s.demote)===!0;if(this.note(`reset: ${i??"unspecified"}`),u){const m=this.field??((d=this.getFieldOption)==null?void 0:d.call(this))??null;m&&this.confidentKeys.delete(m.key)}if(this.forgetInFlight(),r){this.isSuppressed=!0,this.suppressSentAt=this.now();const m=this.getTerminal();m?this.suppressCursor={row:m.buffer.active.baseY+m.buffer.active.cursorY,col:m.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(i=>!i.echoed).map(i=>({row:i.row,col:i.col,char:i.char}))}getOverlayItems(){var S,T,E,Y,A;this.pruneExpired();const i=this.visiblePredictions();if(i.length===0)return[];const s=this.field?this.fieldStyles.get(this.field.key):void 0,r=i.map(O=>{const B={row:O.row,col:O.col,char:O.char,width:O.width,kind:O.kind};return s&&(B.style=s),B}),u=i[i.length-1],d=this.predictedCursor??{row:u.row,col:u.kind==="erase"?u.col:u.col+u.width},m=(O,B)=>r.some(H=>H.row===O&&H.col<=B&&B<H.col+H.width),h=this.getTerminal(),p=h==null?void 0:h.buffer.active,y=this.field;if(p&&y&&this.runStartedEmpty&&y.agentLike&&d.row===y.row){const O=p.getLine(d.row);for(let B=d.col;B<y.endCol;B++){if(m(d.row,B)||Xi(((S=O==null?void 0:O.getCell(B))==null?void 0:S.getChars())??"")===" ")continue;const H={row:d.row,col:B,char:" ",width:1,kind:"erase"};s&&(H.style=s),r.push(H)}}if(p){const O={row:p.baseY+p.cursorY,col:p.cursorX};if(!m(O.row,O.col)&&(O.row!==d.row||O.col!==d.col)){const B=((E=(T=p.getLine(O.row))==null?void 0:T.getCell(O.col))==null?void 0:E.getChars())??"",H={row:O.row,col:O.col,char:Xi(B),width:1,kind:"mask"};s&&(H.style=s),r.push(H)}}const b=r.find(O=>O.row===d.row&&O.col===d.col&&O.kind!=="mask"),v=b?b.char:Xi(((A=(Y=p==null?void 0:p.getLine(d.row))==null?void 0:Y.getCell(d.col))==null?void 0:A.getChars())??"");return r.push({row:d.row,col:d.col,char:v,width:1,kind:"caret"}),r}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getTrace(){return this.trace}visiblePredictions(){const i=this.getState()==="confident";return this.predictions.filter(s=>s.frozenFrom?s.shownWhenFrozen:i&&!s.probation)}freeze(i,s={}){var p;const r=this.getTerminal(),u=r?{row:r.buffer.active.baseY+r.buffer.active.cursorY,col:r.buffer.active.cursorX}:null,d=this.getState()==="confident";for(const y of this.predictions)y.frozenFrom||(y.frozenFrom=u??{row:y.row,col:y.col},y.shownWhenFrozen=d&&!y.probation);const m=this.predictedCursor?{...this.predictedCursor}:u,h=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn;if(this.predictedCursor=null,this.note(`freeze: ${i}${s.demote?" (demote)":""}`),s.demote){const y=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;y&&this.confidentKeys.delete(y.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=m,this.forgetInFlight(),this.inFlightUnknown=h}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(Ew,Math.max(Aw,(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}handlePrintable(i,s,r){var v;const u=this.ensureField(r);if(!u||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const d=this.predictedCursor,m=this.predictions.every(S=>S.frozenFrom)&&d.col===u.caretCol;if(u.agentLike&&u.empty&&m&&Mw.includes(i))return this.freeze("agent mode switch"),!1;if(d.col+s>u.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const h=(v=r.buffer.active.getLine(d.row))==null?void 0:v.getCell(d.col),p=[Xi(h?h.getChars():"")],y=this.predictions[this.predictions.length-1];let b;return y&&y.kind==="erase"&&!y.frozenFrom&&y.row===d.row&&y.col===d.col&&(b=this.predictions.pop(),p.push(...y.before," ")),this.predictions.push({row:d.row,col:d.col,char:i,width:s,kind:"char",before:p,sentAt:this.now(),replaces:b,probation:this.probationRun||void 0}),this.probationRun&&this.runSent.push(i),this.lastSentUndrawn=!1,d.col+=s,!0}skipUnpredictable(i,s,r){const u=this.ensureField(r),d=this.predictedCursor;if(!u||!d)return this.note("refused: caret is not in an input field"),!1;const m=this.assumedWidth(s);return d.col+m>u.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(i),this.lastSentUndrawn=!0,d.col+=m,this.note("width unknown: guessing"),!0)}assumedWidth(i){var r;const s=(r=this.charWidth)==null?void 0:r.call(this,i);return s===0||s===1||s===2?s:1}handleBackspace(i){var r,u,d;const s=this.predictions[this.predictions.length-1];if(this.predictedCursor&&s&&!s.frozenFrom&&!s.echoed&&s.kind==="char"&&s.row===this.predictedCursor.row&&s.col+s.width===this.predictedCursor.col)return this.predictions.pop(),s.probation&&this.runSent.pop(),this.predictedCursor.col=s.col,s.replaces&&this.predictions.push(s.replaces),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const m=this.ensureField(i),h=this.predictedCursor;if(m&&h){const p=i.buffer.active.getLine(h.row),y=p==null?void 0:p.getCell(h.col-1),b=y&&((r=y.getWidth)==null?void 0:r.call(y))===0?2:1,v=h.col-b;let S=!0;for(let E=h.col;E<m.endCol&&S;E++)S=this.coveredByPrediction(h.row,E)||Xi(((u=p==null?void 0:p.getCell(E))==null?void 0:u.getChars())??"")===" ";const T=Xi(((d=p==null?void 0:p.getCell(v))==null?void 0:d.getChars())??"");if(v>m.startCol&&S&&T!==" ")return this.predictions=this.predictions.filter(E=>!(E.echoed&&E.row===h.row&&E.col+E.width>v)),this.predictions.push({row:h.row,col:v,char:" ",width:b,kind:"erase",before:[T],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,h.col=v,!0}}return this.freeze("backspace into server content"),!1}coveredByPrediction(i,s){return this.predictions.some(r=>r.echoed&&r.row===i&&r.col<=s&&s<r.col+r.width)}ensureField(i){if(this.predictedCursor&&this.field)return this.field;const s=this.getFieldOption?this.getFieldOption():Rw(i);if(!s)return null;let r=s.caretCol,u=[],d=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){u=this.inFlight.slice(kw(this.inFlight,Lw(i,s.row,r)));for(const m of u){const h=m.codePointAt(0)??0;r+=Jp(h)||this.assumedWidth(h)}d=u.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=s,this.runStartedEmpty=s.empty&&u.length===0,this.predictions=this.predictions.filter(m=>m.frozenFrom),this.predictedCursor={row:s.row,col:r},this.runInFlight=u,this.probationRun=d,this.runSent=[],s}confirm(i,s){if(this.updateSrtt(Math.max(0,this.now()-i.sentAt)),s&&!i.frozenFrom&&this.markConfident(s.key),i.probation){for(const r of this.predictions)r.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(i,s){const r=gb(s);if(r)for(this.fieldStyles.delete(i),this.fieldStyles.set(i,r);this.fieldStyles.size>eg;){const u=this.fieldStyles.keys().next().value;if(u===void 0)break;this.fieldStyles.delete(u)}}markConfident(i){for(this.confidentKeys.delete(i),this.confidentKeys.add(i);this.confidentKeys.size>eg;){const s=this.confidentKeys.values().next().value;if(s===void 0)break;this.confidentKeys.delete(s)}}mismatch(i){this.mismatches++,this.note(`mismatch: ${i}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(i){const s=this.trace[this.trace.length-1];if(s&&s.event===i){s.count++,s.at=this.now();return}this.trace.push({at:this.now(),event:i,count:1}),this.trace.length>Nw&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),s=this.predictionTimeout(),r=this.predictions.filter(u=>i-u.sentAt<=s);r.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=r,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(i){this.srtt===null?this.srtt=i:this.srtt=this.srtt*.8+i*.2}}class jw{constructor(i){X(this,"items",[]);X(this,"target",null);X(this,"provider",()=>this.paint());this.options=i}attach(i){var s;this.target!==i&&((s=this.target)==null||s.setOverlayProvider(null),this.target=i,i==null||i.setOverlayProvider(this.provider))}sync(i){var s;i.length===0&&this.items.length===0||(this.items=i,(s=this.target)==null||s.invalidateOverlay())}clear(){var i;this.items.length!==0&&(this.items=[],(i=this.target)==null||i.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){if(this.items.length===0)return null;const i=this.options.getTerminal(),s=i==null?void 0:i.buffer.active;if(!i||!s)return null;const r=[],u=this.options.isCursorHidden(),d=s.baseY+s.cursorY,m=s.cursorX,h=md(i,d,m),p=u&&!!h&&Mb(h);let y;for(const b of this.items)switch(b.kind){case"char":r.push({row:b.row,col:b.col,chars:b.char,width:b.width,style:b.style??Ow(i,b.row,b.col)});break;case"erase":r.push({row:b.row,col:b.col,chars:" ",width:b.width,style:zw(b.style??md(i,b.row,b.col)??mb)});break;case"mask":p&&b.row===d&&b.col===m&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:b.style??Dw(h)});break;case"caret":u?p&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:h}):y={row:b.row,col:b.col};break}return y===void 0?{cells:r}:{cells:r,cursor:y}}}function md(a,i,s){var r;return s<0||s>=a.cols?null:gb((r=a.buffer.active.getLine(i))==null?void 0:r.getCell(s))}function Mb(a){return(a.fg&rn.INVERSE)!==0||(a.bg&jt.CM_MASK)!==jt.CM_DEFAULT}function Dw(a){return{fg:a.fg&~rn.INVERSE,bg:a.bg&~(jt.CM_MASK|jt.RGB_MASK),ext:a.ext}}function zw(a){return{fg:a.fg&rn.INVERSE?a.fg&(rn.INVERSE|jt.CM_MASK|jt.RGB_MASK):0,bg:a.bg&(jt.CM_MASK|jt.RGB_MASK),ext:0}}function Ow(a,i,s){const r=md(a,i,s-1);return r&&!Mb(r)&&!(r.bg&ia.DIM)?r:mb}const Co=new Set(["│","┃","║","▐","▕","▏","▌"]),Ro=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),Bw=new Set(["╭","┌","┏","╔"]),Uw=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),Hw=new Set(["╮","┐","┓","╗"]),Kw=new Set(["╰","└","┗","╚"]),Yw=new Set(["╯","┘","┛","╝"]),ld=new Set(["─","━","═","╌","┄"]),Gw=new Set(["❯","›",">","!"]),tg=new Set(["$","#","%",">","❯","›","➜","λ","»"]),pd=8,Iw=12,ng=2,ig=1,$w=4,qw=3,lg=/-- INSERT --/,Fw=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,Vw=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,Xw=/^\s*\d+[.)]\s/;function Va(a){return a===""||a===" "||a===" "}class Pw{constructor(i){X(this,"cell");X(this,"top");X(this,"bottom");var s;this.screen=i,this.cell=(s=i.getNullCell)==null?void 0:s.call(i),this.top=i.baseY,this.bottom=i.baseY+i.rows-1}get cols(){return this.screen.cols}at(i,s){var r;if(!(i<this.top||i>this.bottom||s<0||s>=this.screen.cols))return(r=this.screen.getLine(i))==null?void 0:r.getCell(s,this.cell)}char(i,s){var r;return((r=this.at(i,s))==null?void 0:r.getChars())??""}dim(i,s){var r,u;return!!((u=(r=this.at(i,s))==null?void 0:r.isDim)!=null&&u.call(r))}text(i,s,r){var u;return i<this.top||i>this.bottom?"":((u=this.screen.getLine(i))==null?void 0:u.translateToString(!0,s,r))??""}isEdge(i,s){if(!Co.has(this.char(i,s)))return!1;const r=this.char(i-1,s),u=this.char(i+1,s);return Co.has(r)||Ro.has(r)||Co.has(u)||Ro.has(u)}blankOrDim(i,s,r){var u;for(let d=s;d<r;d++){const m=this.at(i,d);if(m&&!Va(m.getChars())&&!((u=m.isDim)!=null&&u.call(m)))return!1}return!0}}function Zw(a,i,s){if(a.isEdge(i,s))return null;let r=0;for(let d=s-1;d>=0;d--)if(a.isEdge(i,d)){r=d+1;break}let u=a.cols;for(let d=s+1;d<a.cols;d++)if(a.isEdge(i,d)){u=d;break}return r<u?{start:r,end:u}:null}function ag(a,i,s){if(!ld.has(a.char(i,s.start))||!ld.has(a.char(i,s.end-1))||Ro.has(a.char(i,s.start-1)))return!1;const r=s.end-s.start;let u=0;for(let d=s.start;d<s.end;d++)if(ld.has(a.char(i,d)))u++;else if(d-s.start-u>r*.1)return!1;return u>=r*.9}function Pa(a){return`${a.start}-${a.end}`}function Ab(a,i,s){if(s.start===0)return a.top;for(let r=i-1;r>=a.top;r--)if(Uw.has(a.char(r,s.start-1)))return r;return a.top}function Qw(a,i,s){const r=s.start-1,u=s.end,{row:d}=i;if(r<0||u>=a.cols)return null;const m=a.char(d,r);if(!Co.has(m)||a.char(d,u)!==m)return null;let h=d-1;for(;h>=a.top&&a.char(h,r)===m;)h--;let p=d+1;for(;p<=a.bottom&&a.char(p,r)===m;)p++;if(p-h-1>pd||!Bw.has(a.char(h,r))||!Hw.has(a.char(h,u))||!Kw.has(a.char(p,r))||!Yw.has(a.char(p,u))||a.dim(d,r))return null;const y=s.start+ig,b=s.end-ig;return i.col<y||i.col>=b?null:{kind:"frame",key:`frame:${Pa(s)}`,region:Pa(s),layout:`${h}`,row:d,caretCol:i.col,startCol:y,endCol:b,empty:h+2===p&&i.col===y&&a.blankOrDim(d,y,b),agentLike:!0,vimInsert:null,modal:!1}}function Ww(a,i,s){const{row:r}=i;let u=-1;for(let b=r-1;b>=Math.max(a.top,r-pd);b--)if(ag(a,b,s)){u=b;break}if(u<0)return null;let d=-1;for(let b=r+1;b<=Math.min(a.bottom,r+pd);b++)if(ag(a,b,s)){d=b;break}if(d<0)return null;const m=u+1;let h=-1;for(let b=s.start;b<Math.min(s.end,s.start+3);b++){const v=a.char(m,b);if(!Va(v)){Gw.has(v)&&Va(a.char(m,b+1))&&(h=b);break}}if(h<0||a.dim(m,h)||Xw.test(a.text(m,h+1,s.end)))return null;for(let b=m+1;b<d;b++)for(let v=s.start;v<s.start+ng;v++)if(!Va(a.char(b,v)))return null;let p="";for(let b=d+1;b<=Math.min(a.bottom,d+Iw)&&!Ro.has(a.char(b,s.start-1));b++)p+=`${a.text(b,s.start,s.end)}
|
|
47
|
+
`;if(Vw.test(p)||Fw.test(p))return null;const y=r===m?h+2:s.start+ng;return i.col<y||i.col>=s.end?null:{kind:"rule",key:`rule:${Pa(s)}:${Ab(a,u,s)}`,region:Pa(s),layout:`${u}`,row:r,caretCol:i.col,startCol:y,endCol:s.end,empty:d-u===2&&i.col===y&&a.blankOrDim(r,y,s.end),agentLike:!0,vimInsert:lg.test(p),modal:lg.test(p)}}function Jw(a,i,s){if(i.hidden)return null;const{row:r,col:u}=i;for(let d=u-2;d>=s.start;d--)if(!(!tg.has(a.char(r,d))||!Va(a.char(r,d+1))))return a.dim(r,d)?null:sg(a,i,s,r,d+2,d===s.start);for(let d=r-1;d>=Math.max(a.top,r-qw);d--){let m=s.end-1;for(;m>=s.start&&Va(a.char(d,m));)m--;if(m>=s.end-1-$w&&tg.has(a.char(d,m)))return a.dim(d,m)?null:sg(a,i,s,d,s.start,!1);if(m<s.end-1)return null}return null}function sg(a,i,s,r,u,d){const m=i.row===r?u:s.start;return i.col<m||i.col>=s.end?null:{kind:"prompt",key:`prompt:${Pa(s)}:${Ab(a,r,s)}`,region:Pa(s),layout:`${r}`,row:i.row,caretCol:i.col,startCol:m,endCol:s.end,empty:i.row===r&&i.col===m&&a.blankOrDim(i.row,m,s.end),agentLike:d,vimInsert:null,modal:!1}}function eS(a,i){const s=new Pw(a);if(i.row<s.top||i.row>s.bottom||i.col<0||i.col>=a.cols)return null;const r=Zw(s,i.row,i.col);return r?Qw(s,i,r)??Ww(s,i,r)??Jw(s,i,r):null}class tS{constructor(){X(this,"insertSeen",new Set)}detect(i,s){const r=eS(i,s);return!r||r.vimInsert===null?r:r.vimInsert?(this.insertSeen.add(r.region),r):this.insertSeen.has(r.region)?null:r}reset(){this.insertSeen.clear()}}class nS{constructor(i){X(this,"tracker",new tS);X(this,"cached");X(this,"lastComplete",null);X(this,"detect",()=>{var i,s;if((s=(i=this.options).isSynchronizing)!=null&&s.call(i))return this.lastComplete;if(this.cached===void 0){const r=this.options.getScreen(),u=this.options.getCursor();this.cached=r&&u?this.tracker.detect(r,u):null,this.lastComplete=this.cached}return this.cached});this.options=i}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const iS=25,lS=2026,aS=1e3;function sS(a,i=()=>performance.now()){let s=!1,r=null;const u=new Set,d=b=>(u.add(b),{dispose:()=>void u.delete(b)}),m=()=>{s=!1,r=null},h=a.parser;if(!h||typeof h.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:d,reset:m,dispose:()=>{}};const p=b=>v=>{for(const S of v.flat())if(S===iS&&(s=!b),S===lS){const T=!b&&r!==null;if(r=b?i():null,T)for(const E of[...u])E()}return!1},y=[h.registerCsiHandler({prefix:"?",final:"h"},p(!0)),h.registerCsiHandler({prefix:"?",final:"l"},p(!1)),h.registerCsiHandler({intermediates:"!",final:"p"},()=>(m(),!1))];return typeof h.registerEscHandler=="function"&&y.push(h.registerEscHandler({final:"c"},()=>(m(),!1))),{isCursorHidden:()=>s,isSynchronizing:()=>r!==null&&i()-r<aS,onSyncEnd:d,reset:m,dispose:()=>{for(const b of y)b.dispose();u.clear()}}}const rS=40;function oS(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function cS(a){var r;const i=(r=a==null?void 0:a.canvas)==null?void 0:r.stats;if(!i)return`paint: ${(a==null?void 0:a.kind)??"-"} renderer
|
|
48
|
+
`;const s=i.lastInputToPaintMs!==null?`${i.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${i.lastPaintMs.toFixed(2)}ms cells: ${i.lastCells} frames: ${i.frames} held: ${i.heldFrames} key→paint: ${s}
|
|
49
|
+
`}function uS(a){const i=(a==null?void 0:a.getTrace())??[];return i.length===0?"trace: -":`trace:
|
|
50
|
+
${i.slice(-6).map(s=>` ${s.event}${s.count>1?` ×${s.count}`:""}`).join(`
|
|
51
|
+
`)}`}function rg(a,i){return a==="off"?!1:a==="always"?!0:i!==null&&i>rS}const dS=250,fS=({onTerminalFocus:a,isActive:i=!0})=>{var pe,ze,Xe,It,St,ki;const s=w.useRef(null),r=w.useRef(null),u=w.useRef(null),d=w.useRef(null),m=w.useRef(1),h=w.useRef({cols:0,rows:0}),p=w.useRef(null),y=w.useRef(null),b=w.useRef(null),v=w.useRef(null),S=w.useRef({width:0,height:0}),T=w.useRef(null),E=cv(),Y=E||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,A=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[O,B]=w.useState({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}),[H,ee]=w.useState({framesPerSec:0,bytesPerSec:0}),[re,J]=w.useState(null),G=w.useRef(null),U=w.useRef(!1),ae=w.useRef(!1),ne=w.useRef([]);w.useEffect(()=>{if(!A)return;const Q=setInterval(()=>{const xe=performance.now()-1e3,me=ne.current;for(;me.length>0&&me[0].time<xe;)me.shift();let He=0;for(let se=0;se<me.length;se++)He+=me[se].bytes;ee({framesPerSec:me.length,bytesPerSec:He})},1e3);return()=>clearInterval(Q)},[A]);const{isController:Se,connectionState:Ee,settings:Ge,hostPalette:st,terminalResetVersion:Ie,sendResize:L,sendBinary:$,observeKeyInput:le,consumeModifierLatch:Re,agentStatus:W,addToast:et,warnViewerMode:je,connect:_e,subscribeToOutput:$e,subscribeToPasteFileReady:Be,uploadImage:Ze,profiles:ft,activeProfileId:De,t:qe,rttMs:Gt}=Nt(),gt=Si.useMemo(()=>Ev(st),[st]),ut=w.useRef(gt);ut.current=gt;const F=w.useRef(Se);F.current=Se;const ve=w.useRef($);ve.current=$;const Ce=w.useRef(et);Ce.current=et;const At=w.useRef(je);At.current=je;const N=w.useRef(L);N.current=L;const ue=w.useRef(Ze);ue.current=Ze;const ce=w.useRef(i);ce.current=i;const Ve=w.useRef(Ge);Ve.current=Ge;const lt=w.useRef(qe);lt.current=qe;const at=w.useRef(null),Et=w.useRef(null),he=w.useRef(null),Le=w.useRef(Re);Le.current=Re;const Fe=w.useRef(()=>{}),dt=w.useRef(Q=>{var te,xe,me,He;(te=at.current)==null||te.reset(Q),(xe=at.current)==null||xe.forgetConfidence(),(me=he.current)==null||me.reset(),(He=Et.current)==null||He.clear()}),[Dt,Cn]=w.useState(null),Bt=w.useRef(null),[mn,pn]=w.useState(null),Zt=w.useRef(null);Zt.current=mn;const[wt,Qe]=w.useState(null),zt=w.useRef(null);zt.current=wt;const[Zi,Qt]=w.useState(""),jn=w.useRef("");jn.current=Zi;const[Ci,bt]=w.useState(!1),Ti=w.useRef(!1);Ti.current=Ci;const Tn=w.useRef(!1),[Mi,fi]=w.useState(0),_l=w.useRef(0),Dn=w.useRef(null),Mn=w.useRef(null),An=w.useRef(null),Ai=w.useRef(null),[ra,jl]=w.useState(!1),Dl=w.useCallback(Q=>{var He;const te=d.current;if(!te)return null;const xe=((He=u.current)==null?void 0:He.querySelector(".xterm-screen"))||u.current,me=Qu(Q,te,xe,m.current);return me?vw(te,me.col,me.bufferRow):null},[]),Qi=w.useCallback(Q=>{var He;const te=d.current;if(!te)return;const xe=((He=u.current)==null?void 0:He.querySelector(".xterm-screen"))||u.current,me=Qu(Q,te,xe,m.current);if(me){An.current=me;const se=Ju(te,me.col,me.bufferRow);Ai.current=se;const Ct=iw(te,me.col,me.bufferRow);if(Ct){const Ut={startCol:Ct.startCol,endCol:Ct.startCol+Ct.length-1,startRow:me.bufferRow,endRow:me.bufferRow},nn=Zp(Ut,se),ht=ed(te,nn);Qe(nn),Qt(ht),bt(!0)}else Qe(null),Qt(""),bt(!1),An.current=null,Ai.current=null}else Qe(null),Qt(""),bt(!1),An.current=null,Ai.current=null;Dn.current=Q,Mn.current=null},[]),Wi=w.useCallback(Q=>{var ht;const te=d.current,xe=An.current;if(!te||!xe)return;Mn.current=Q;const me=((ht=u.current)==null?void 0:ht.querySelector(".xterm-screen"))||u.current,He=Qu(Q,te,me,m.current);if(!He)return;const se=Ai.current??Ju(te,xe.col,xe.bufferRow),Ct={startCol:Math.min(xe.col,He.col),endCol:Math.max(xe.col,He.col),startRow:Math.min(xe.bufferRow,He.bufferRow),endRow:Math.max(xe.bufferRow,He.bufferRow)},Ut=Zp(Ct,se),nn=ed(te,Ut);Qe(Ut),Qt(nn),bt(!0)},[]),Ei=w.useRef(Qi);Ei.current=Qi;const Ni=w.useRef(Wi);Ni.current=Wi;const zn=w.useCallback(async()=>{const Q=jn.current;if(!Q)return;await la(Q)==="failed"?Ce.current("error",lt.current("clipboard.copyFailed")):Ce.current("success",lt.current("clipboard.copied"))},[]),Lt=w.useCallback(async()=>{var Ut,nn,ht,qn;const Q=d.current;if(!Q)return;const te=(Ut=Q.buffer)==null?void 0:Ut.active;if(!te)return;const xe=((nn=zt.current)==null?void 0:nn.startRow)??((ht=An.current)==null?void 0:ht.bufferRow)??te.viewportY,me=Ai.current??Ju(Q,((qn=An.current)==null?void 0:qn.col)??0,xe),He={startCol:me.startCol,endCol:me.endCol,startRow:xe,endRow:xe},se=ed(Q,He);await la(se)==="failed"?Ce.current("error",lt.current("clipboard.copyFailed")):Ce.current("success",lt.current("clipboard.copied"))},[]),tn=w.useCallback(async()=>{const Q=d.current;if(!Q)return;const te=lw(Q);await la(te)==="failed"?Ce.current("error",lt.current("clipboard.copyFailed")):Ce.current("success",lt.current("clipboard.copied"))},[]),hi=w.useCallback(async()=>{var te,xe;const Q=d.current;if(Q){if(!F.current){At.current();return}try{const me=await cw();if(me.ok){await ue.current(me.blob);return}}catch{}try{const me=await ow();if(me.ok){(te=at.current)==null||te.reset("paste"),(xe=Et.current)==null||xe.clear(),Q.paste(me.text),Ce.current("success",lt.current("clipboard.pasted"));return}else if(me.reason==="empty"){Ce.current("info",lt.current("clipboard.pasteUnavailable"));return}}catch{}jl(!0)}},[]),zl=w.useCallback(Q=>{var xe,me;const te=d.current;if(te){if(!F.current){At.current();return}(xe=at.current)==null||xe.reset("paste"),(me=Et.current)==null||me.clear(),te.paste(Q),Ce.current("success",lt.current("clipboard.pasted"))}},[]),Za=w.useCallback(Q=>{if(d.current){if(!F.current){At.current();return}ue.current(Q)}},[]);w.useEffect(()=>Be(te=>{var me,He;const xe=d.current;xe&&((me=at.current)==null||me.reset("paste"),(He=Et.current)==null||He.clear(),xe.paste(te),Ce.current("success",lt.current("clipboard.pasted")))}),[Be]);const Ji=w.useCallback((Q,te)=>{!Number.isFinite(Q)||!Number.isFinite(te)||Q<=0||te<=0||Q===h.current.cols&&te===h.current.rows||(p.current={cols:Q,rows:te},!y.current&&(y.current=setTimeout(()=>{y.current=null;const xe=p.current;p.current=null,xe&&(xe.cols===h.current.cols&&xe.rows===h.current.rows||(h.current=xe,N.current(xe.cols,xe.rows),dt.current("resize")))},dS)))},[]),Ol=w.useCallback((Q=!1)=>{var el;const te=d.current,xe=s.current,me=u.current,He=r.current;if(!te||!xe||!me||!He)return;const se=Fu(xe,qa(),Gu());if(se.width<=0||se.height<=0)return;He.style.width="100%",He.style.height="100%",me.style.width="100%",me.style.height="100%",me.style.transform="none",me.style.transformOrigin="top left",m.current=1;const Ct=Xp(se),Ut=ew({lastSnapshot:T.current,currentSnapshot:Ct});if(Ut.isVisualZoom&&!Q){T.current=Ct;try{te.refresh(0,Math.max(0,te.rows-1))}catch{}return}if(Ut.shouldIgnore&&!Q)return;T.current=Ct;const nn=na(te,Xa),ht=Hp({width:se.width-S1(me),height:se.height,cellWidth:nn.cellWidth,cellHeight:nn.cellHeight}),qn=Math.abs(se.width-S.current.width)>1||Math.abs(se.height-S.current.height)>1;if(te.cols!==ht.cols||te.rows!==ht.rows)try{te.resize(ht.cols,ht.rows)}catch(on){console.debug("Error resizing terminal grid:",on)}U.current&&!ae.current&&(qn||te.cols!==ht.cols||te.rows!==ht.rows)&&(ae.current=!0,(el=G.current)==null||el.verify());const Fn=ht.cols!==h.current.cols||ht.rows!==h.current.rows;ce.current&&(qn||Q||Fn)&&(S.current={width:se.width,height:se.height},Ji(ht.cols,ht.rows));try{te.refresh(0,Math.max(0,te.rows-1))}catch{}},[Ji]),$n=w.useRef(Ol);$n.current=Ol;const Li=w.useCallback(()=>{if(b.current===null){if(typeof requestAnimationFrame!="function"){$n.current();return}b.current=requestAnimationFrame(()=>{b.current=null,$n.current()})}},[]),D=w.useCallback((Q=30)=>{v.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(v.current),v.current=null);let te=0;const xe=()=>{v.current=null,te++;const me=te>=Q;$n.current(!0),!me&&te<2&&typeof requestAnimationFrame=="function"&&(v.current=requestAnimationFrame(xe))};typeof requestAnimationFrame=="function"?v.current=requestAnimationFrame(xe):xe()},[]);w.useEffect(()=>{var ua,Wa,ll;if(!s.current||!u.current)return;const Q=s.current,te=Fu(Q,qa(),Gu()),xe=na(null,Xa),me=Hp({width:te.width,height:te.height,cellWidth:xe.cellWidth,cellHeight:xe.cellHeight});N.current(me.cols,me.rows),S.current={width:te.width,height:te.height},T.current=Xp(te);const He=pp(Ge.fontSize,te.width),se=new c1.Terminal({fontSize:He,fontFamily:Cp(Ge.fontFamily),lineHeight:1.15,...ut.current?{theme:{...ut.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:me.cols,rows:me.rows,screenReaderMode:!1,linkHandler:{activate:(Z,oe)=>{id(oe)}}});try{const Z=new u1.Unicode11Addon;se.loadAddon(Z),se.unicode.activeVersion="11"}catch(Z){console.debug("Unicode11 addon unavailable, using default width table:",Z)}try{se.loadAddon(new f1.WebLinksAddon((Z,oe)=>{id(oe)}))}catch(Z){console.debug("WebLinks addon unavailable, URLs stay plain text:",Z)}se.open(u.current),d.current=se;const Ct=se.onTitleChange(Z=>{Cn(hd(Z)||null)}),Ut=sS(se),nn=new nS({getScreen:()=>{const Z=d.current;if(!Z)return null;const oe=Z.buffer.active;return{cols:Z.cols,rows:Z.rows,baseY:oe.baseY,getLine:Oe=>oe.getLine(Oe),getNullCell:typeof oe.getNullCell=="function"?()=>oe.getNullCell():void 0}},getCursor:()=>{var oe;const Z=(oe=d.current)==null?void 0:oe.buffer.active;return Z?{row:Z.baseY+Z.cursorY,col:Z.cursorX,hidden:Ut.isCursorHidden()}:null},isSynchronizing:Ut.isSynchronizing});he.current=nn;const ht=(ua=se._core)==null?void 0:ua.unicodeService,qn=new _w({getTerminal:()=>d.current,getField:nn.detect,charWidth:typeof(ht==null?void 0:ht.wcwidth)=="function"?Z=>ht.wcwidth(Z):void 0});at.current=qn;const Fn=new jw({getTerminal:()=>d.current,isCursorHidden:()=>Ut.isCursorHidden()});Et.current=Fn;const el=()=>{const Z=at.current,oe=Et.current;if(!Z||!oe)return;const Oe=Ve.current.predictiveEcho,Tt=Z.getEchoSrttMs();if(!rg(Oe,Tt)){oe.clear();return}oe.sync(Z.getOverlayItems())};Fe.current=el,E&&se.textarea&&(se.textarea.readOnly=!1,se.textarea.tabIndex=0,se.textarea.inputMode="text");let on=()=>{};if(A&&se.textarea){const Z=()=>{B(oe=>({...oe,focused:document.activeElement===se.textarea}))};se.textarea.addEventListener("focus",Z),se.textarea.addEventListener("blur",Z),on=()=>{var oe,Oe;(oe=se.textarea)==null||oe.removeEventListener("focus",Z),(Oe=se.textarea)==null||Oe.removeEventListener("blur",Z)},Z()}const tl=async Z=>{var Oe,Tt;(Oe=at.current)==null||Oe.reset("paste"),(Tt=Et.current)==null||Tt.clear();const oe=Cb(Z);if(oe){if(Z.preventDefault(),Z.stopPropagation(),!F.current){At.current();return}await ue.current(oe)}};(Wa=se.textarea)==null||Wa.addEventListener("paste",tl),Q.addEventListener("paste",tl);const Ri=J1(se,{isSynchronizing:Ut.isSynchronizing,onRendererSwapped:Z=>{var oe;Q&&(Q.dataset.renderer=Z),J(Z),(oe=Et.current)==null||oe.attach(null);try{se.refresh(0,Math.max(0,se.rows-1))}catch{}}});Fn.attach(Ri.canvas);const Qa=Ut.onSyncEnd(()=>{var Z,oe;return(oe=(Z=G.current)==null?void 0:Z.canvas)==null?void 0:oe.flushHeld()});G.current=Ri,Q&&(Q.dataset.renderer=Ri.kind),J(Ri.kind);const nl=lt.current("terminal.bannerTitle"),ir=lt.current("terminal.bannerSubtitle");if(se.writeln(" ___ ___ .___ "),se.writeln(` / | \\ ____ _______| _/______ \x1B[1m${nl}\x1B[0m`),se.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${ir}\x1B[0m`),se.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),se.writeln(" \\___|_ / \\___ >|__| /___/____ >"),se.writeln(" \\/ \\/ \\/ "),se.writeln(""),U.current=!0,se.write("",()=>void Ri.verify()),!E)try{se.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((ll=document.fonts)==null?void 0:ll.load)=="function"&&document.fonts.load('13px "Symbols Nerd Font Mono"').then(()=>{if(d.current){try{d.current.refresh(0,Math.max(0,d.current.rows-1))}catch{}D(5)}}).catch(()=>{});const lr=se.onData(Z=>{var Tt,bn,yn;let oe=Z;if(F.current&&ub(Z)==="keys"&&X0(Z)){const Me=Le.current();Me&&(oe=To(Z,Me))}const Oe=gd(oe);if(!F.current&&!Mo(Oe)){At.current();return}(Tt=at.current)==null||Tt.handleUserInput(Oe),el(),(yn=(bn=G.current)==null?void 0:bn.canvas)==null||yn.markInput(),ve.current(Oe)}),il=se.onBinary(Z=>{const oe=new Uint8Array(Z.length);for(let Oe=0;Oe<Z.length;Oe++)oe[Oe]=Z.charCodeAt(Oe)&255;!F.current&&!Mo(oe)||ve.current(oe)}),zo=typeof se.onWriteParsed=="function"?se.onWriteParsed(()=>{var Z;Tn.current=!0,nn.invalidate(),!Ut.isSynchronizing()&&((Z=at.current)==null||Z.onServerOutput(),el())}):{dispose:()=>{}},ar=typeof se.onRender=="function"?se.onRender(Z=>{const oe=se.buffer.active.viewportY??0;oe!==_l.current&&(_l.current=oe,fi(oe));const Oe=zt.current;if(Oe&&Ti.current){const Tt=Oe.startRow-oe,bn=Oe.endRow-oe;Tn.current&&Z.start<=bn&&Z.end>=Tt&&(bt(!1),Tn.current=!1)}else Tn.current=!1}):{dispose:()=>{}},sr=typeof se.onScroll=="function"?se.onScroll(()=>{var oe,Oe;const Z=se.buffer.active.viewportY??0;_l.current=Z,fi(Z),(oe=at.current)==null||oe.reset("scroll"),(Oe=Et.current)==null||Oe.clear()}):{dispose:()=>{}},gn=new T1({getTerminal:()=>d.current,getIsController:()=>F.current,getScale:()=>m.current,getSurfaceElement:()=>u.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{se.focus()}catch{}A&&B(Z=>({...Z,focused:document.activeElement===se.textarea})),a==null||a()},onGestureStateChange:Z=>{A&&B(oe=>({...oe,state:Z}))},onGestureScroll:({deltaY:Z,lines:oe,viewportY:Oe,scrollTop:Tt,scrollHeight:bn,clientHeight:yn,moved:Me,bufferType:ln,baseY:kt,cursorY:On,hasScrollback:Ht,mouseTracking:vn,scrollMode:Vn})=>{A&&B(al=>({...al,deltaY:Z,lines:oe,viewportY:Oe,scrollTop:Tt,scrollHeight:bn,clientHeight:yn,moved:Me,focused:document.activeElement===se.textarea,bufferType:ln,baseY:kt,cursorY:On,hasScrollback:Ht,mouseTracking:vn,scrollMode:Vn,scrollCalls:al.scrollCalls+(oe!==0?1:0),lastScrollLines:oe}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:E?(Z=>{var oe;return(oe=Ei.current)==null?void 0:oe.call(Ei,Z)}):void 0,onSelectionExtend:E?(Z=>{var oe;return(oe=Ni.current)==null?void 0:oe.call(Ni,Z)}):void 0}),Oo=typeof window<"u"&&"PointerEvent"in window,Bo=typeof TouchEvent<"u",mi=[],Wt=(Z,oe=!1)=>{const Oe=Z.target;return Oe instanceof Node&&Q.contains(Oe)||oe&&gn.getState()!=="idle"};if(Oo){const Z={passive:!1,capture:!0},oe=Me=>{A&&B(ln=>({...ln,pointerEvents:ln.pointerEvents+1,lastInputEvent:Me}))},Oe=Me=>{if(!Wt(Me))return;if(oe("pointerdown"),Zt.current){pn(null),Zt.current=null,Qe(null),zt.current=null,Qt(""),jn.current="",bt(!1),Dn.current=null,Mn.current=null,Me.cancelable&&Me.preventDefault(),Me.stopPropagation();return}gn.handlePointerDown(Me,Q)&&Me.stopPropagation()},Tt=Me=>{Wt(Me,!0)&&(oe("pointermove"),gn.handlePointerMove(Me),Me.pointerType!=="mouse"&&Me.stopPropagation())},bn=Me=>{if(!Wt(Me,!0))return;if(oe("pointerup"),gn.getState()==="longpress"&&Bt.current){const kt=Mn.current??Dn.current;if(kt){const On=Bt.current.getBoundingClientRect(),Ht=kt.clientX-On.left,vn=kt.clientY-On.top,Vn=Dl(kt);pn({x:Ht,y:vn,link:Vn}),Zt.current={x:Ht,y:vn,link:Vn}}}gn.handlePointerUp(Me),Me.pointerType!=="mouse"&&Me.stopPropagation()},yn=Me=>{Wt(Me,!0)&&(oe("pointercancel"),pn(null),Zt.current=null,Qe(null),zt.current=null,Qt(""),jn.current="",bt(!1),Dn.current=null,Mn.current=null,gn.handlePointerCancel(Me),Me.pointerType!=="mouse"&&Me.stopPropagation())};if(document.addEventListener("pointerdown",Oe,Z),document.addEventListener("pointermove",Tt,Z),document.addEventListener("pointerup",bn,Z),document.addEventListener("pointercancel",yn,Z),mi.push(()=>{document.removeEventListener("pointerdown",Oe,Z),document.removeEventListener("pointermove",Tt,Z),document.removeEventListener("pointerup",bn,Z),document.removeEventListener("pointercancel",yn,Z)}),Bo){const Me=kt=>{Wt(kt,!0)&&(A&&B(On=>({...On,touchEvents:On.touchEvents+1})),kt.cancelable&&kt.preventDefault(),kt.stopPropagation())},ln=["touchstart","touchmove","touchend","touchcancel"];for(const kt of ln)document.addEventListener(kt,Me,Z);mi.push(()=>{for(const kt of ln)document.removeEventListener(kt,Me,Z)})}}else{const Z={passive:!1,capture:!0},oe=Me=>{A&&B(ln=>({...ln,touchEvents:ln.touchEvents+1,lastInputEvent:Me}))},Oe=Me=>{if(Wt(Me)){if(oe("touchstart"),Zt.current){pn(null),Zt.current=null,Qe(null),zt.current=null,Qt(""),jn.current="",bt(!1),Dn.current=null,Mn.current=null,Me.cancelable&&Me.preventDefault(),Me.stopPropagation();return}Me.touches.length===1&&Me.stopPropagation(),gn.handleTouchStart(Me,Q)}},Tt=Me=>{Wt(Me,!0)&&(oe("touchmove"),Me.touches.length===1&&Me.stopPropagation(),gn.handleTouchMove(Me))},bn=Me=>{if(!Wt(Me,!0))return;if(oe("touchend"),gn.getState()==="longpress"&&Bt.current){const kt=Mn.current??Dn.current;if(kt){const On=Bt.current.getBoundingClientRect(),Ht=kt.clientX-On.left,vn=kt.clientY-On.top,Vn=Dl(kt);pn({x:Ht,y:vn,link:Vn}),Zt.current={x:Ht,y:vn,link:Vn}}}Me.stopPropagation(),gn.handleTouchEnd(Me)},yn=Me=>{Wt(Me,!0)&&(oe("touchcancel"),pn(null),Zt.current=null,Qe(null),zt.current=null,Qt(""),jn.current="",bt(!1),Dn.current=null,Mn.current=null,Me.stopPropagation(),gn.handleTouchCancel())};document.addEventListener("touchstart",Oe,Z),document.addEventListener("touchmove",Tt,Z),document.addEventListener("touchend",bn,Z),document.addEventListener("touchcancel",yn,Z),mi.push(()=>{document.removeEventListener("touchstart",Oe,Z),document.removeEventListener("touchmove",Tt,Z),document.removeEventListener("touchend",bn,Z),document.removeEventListener("touchcancel",yn,Z)})}const oa=Z=>{Z.preventDefault()};Q.addEventListener("contextmenu",oa),mi.push(()=>{Q.removeEventListener("contextmenu",oa)});const ca=new ResizeObserver(()=>{Li()});ca.observe(Q);const ii=()=>{Li()},li=()=>{var Z,oe;if(document.visibilityState==="visible"){D(10);try{(oe=d.current)==null||oe.refresh(0,Math.max(0,(((Z=d.current)==null?void 0:Z.rows)||1)-1))}catch{}}};window.addEventListener("resize",ii),window.addEventListener("orientationchange",ii),document.addEventListener("visibilitychange",li),window.addEventListener("pageshow",li);const Bl=()=>{Li()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",Bl),window.visualViewport.addEventListener("scroll",Bl)),()=>{var Z,oe;lr.dispose(),il.dispose(),ar.dispose(),sr.dispose(),zo.dispose(),Ct.dispose(),Qa.dispose(),(Z=Et.current)==null||Z.dispose(),Et.current=null,at.current=null,he.current=null,Fe.current=()=>{},Ut.dispose(),gn.handlePointerCancel();for(const Oe of mi)Oe();ca.disconnect(),window.removeEventListener("resize",ii),window.removeEventListener("orientationchange",ii),document.removeEventListener("visibilitychange",li),window.removeEventListener("pageshow",li),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",Bl),window.visualViewport.removeEventListener("scroll",Bl)),y.current&&(clearTimeout(y.current),y.current=null),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),on(),(oe=se.textarea)==null||oe.removeEventListener("paste",tl),Q.removeEventListener("paste",tl),Ri.dispose(),G.current=null,se.dispose(),d.current=null}},[]);const I=Si.useMemo(()=>{var Q;return((Q=ft.find(te=>te.id===De))==null?void 0:Q.displayName)??null},[ft,De]);w.useEffect(()=>{Ee!=="connected"&&Cn(null)},[Ee]),w.useEffect(()=>{const Q=i&&Ee==="connected",te=Ge.agentAlertBadge?er(W):null;hw(Q?Dt:null,I,te)},[i,Ee,Dt,I,W,Ge.agentAlertBadge]),w.useEffect(()=>{const Q=d.current;if(!Q)return;const te=Fu(s.current,qa(),Gu());Q.options.fontSize=pp(Ge.fontSize,te.width),Q.options.fontFamily=Cp(Ge.fontFamily);try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}D(10)},[Ge.fontSize,Ge.fontFamily]),w.useEffect(()=>le(Q=>{var te,xe,me;(te=at.current)==null||te.handleUserInput(Q),Fe.current(),(me=(xe=G.current)==null?void 0:xe.canvas)==null||me.markInput()}),[le]),w.useEffect(()=>{const Q=at.current,te=Et.current;if(!Q||!te)return;const xe=Q.getEchoSrttMs();rg(Ge.predictiveEcho,xe)?te.sync(Q.getOverlayItems()):te.clear()},[Ge.predictiveEcho]);const de=w.useRef(Ie);w.useEffect(()=>{var te;if(de.current===Ie)return;de.current=Ie,dt.current("resetVersion");const Q=d.current;if(Q)try{(te=Q.reset)==null||te.call(Q),Q.clear(),Q.refresh(0,Math.max(0,Q.rows-1))}catch{}},[Ie]),w.useEffect(()=>{dt.current("connectionState")},[Ee]),w.useEffect(()=>{const Q=d.current;if(!(!Q||!gt)){Q.options.theme={...gt};try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}}},[gt]),w.useEffect(()=>$e(te=>{const xe=d.current;if(!xe)throw new Error("terminal not ready");if(xe.write(te),A){const me=performance.now(),He=ne.current;He.push({time:me,bytes:te.byteLength});const se=me-1e3;for(;He.length>0&&He[0].time<se;)He.shift()}}),[$e,A]),w.useEffect(()=>{if(!i)return;D(10);const Q=d.current;if(Q){try{Q.refresh(0,Math.max(0,Q.rows-1))}catch{}if(!E)try{Q.focus()}catch{}}},[i,E,D]),w.useEffect(()=>{Ee==="disconnected"&&_e()},[]);const Te=Q=>{Q.preventDefault()};return f.jsxs("main",{ref:Bt,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:Te,"aria-label":qe("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:s,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:Y?"none":"auto"},tabIndex:0,onContextMenu:Te,"aria-label":qe("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:r,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:u,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),A&&f.jsxs("pre",{"data-testid":"terminal-touch-debug",className:"pointer-events-none absolute left-1 top-1 z-50 border border-tui-border bg-tui-crust/90 px-2 py-1 font-mono text-tui-sm leading-relaxed text-tui-muted","aria-hidden":"true",children:[`gesture: ${O.state}
|
|
52
|
+
`,`deltaY: ${O.deltaY} lines: ${O.lines}
|
|
53
|
+
`,`viewportY: ${O.viewportY??"-"} focus: ${O.focused}
|
|
54
|
+
`,`buffer: ${O.bufferType??"-"} base: ${O.baseY??"-"} cursor: ${O.cursorY??"-"} scrollback: ${O.hasScrollback??"-"}
|
|
55
|
+
`,`scroll: ${O.scrollTop??"-"} / ${O.scrollHeight??"-"} (h ${O.clientHeight??"-"}) moved: ${O.moved}
|
|
56
|
+
`,`mode: ${O.scrollMode} calls: ${O.scrollCalls} lines: ${O.lastScrollLines??"-"} mouse: ${O.mouseTracking}
|
|
57
|
+
`,`event: ${O.lastInputEvent||"-"} pointer: ${O.pointerEvents} touch: ${O.touchEvents}
|
|
58
|
+
`,`rtt: ${Gt!==null?`${Gt}ms`:"-"} frames/s: ${H.framesPerSec} bytes/s: ${H.bytesPerSec} renderer: ${re??"-"}
|
|
59
|
+
`,`prediction: ${((pe=at.current)==null?void 0:pe.getState())??"-"} mode: ${Ge.predictiveEcho} pending: ${((ze=at.current)==null?void 0:ze.getVisiblePredictions().length)??0} srtt: ${((Xe=at.current)==null?void 0:Xe.getEchoSrttMs())!==null&&((It=at.current)==null?void 0:It.getEchoSrttMs())!==void 0?`${Math.round(at.current.getEchoSrttMs())}ms`:"-"}
|
|
60
|
+
`,`field: ${oS(((St=he.current)==null?void 0:St.detect())??null)} mismatches: ${((ki=at.current)==null?void 0:ki.getMismatchCount())??0}
|
|
61
|
+
`,cS(G.current),uS(at.current)]}),E&&wt&&Ci&&(()=>{var Fn;const Q=d.current;if(!Q||!Bt.current)return null;const te=na(Q);if(te.cellWidth<=0||te.cellHeight<=0)return null;const xe=((Fn=u.current)==null?void 0:Fn.querySelector(".xterm-screen"))||u.current;if(!xe)return null;const me=xe.getBoundingClientRect(),He=Bt.current.getBoundingClientRect(),se=wt.startRow-Mi;if(wt.endRow-Mi<0||se>=Q.rows)return null;const Ut=me.top-He.top+se*te.cellHeight,nn=me.left-He.left+wt.startCol*te.cellWidth,ht=(wt.endCol-wt.startCol+1)*te.cellWidth,qn=(wt.endRow-wt.startRow+1)*te.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${Ut}px`,left:`${nn}px`,width:`${ht}px`,height:`${qn}px`}})})(),E&&mn&&f.jsx(ww,{anchorPoint:mn,hasSelection:!!Zi,isController:Se,vibrateOnKeyPress:Ge.vibrateOnKeyPress,linkUrl:mn.link??null,onOpenLink:Q=>{id(Q)||et("warning",qe("clipboard.openLinkFailed"))},onCopySelection:zn,onCopyLine:Lt,onCopyScreen:tn,onPaste:hi,onClose:()=>{pn(null),Zt.current=null,Qe(null),zt.current=null,Qt(""),jn.current="",bt(!1)}}),E&&f.jsx(Sw,{isOpen:ra,onClose:()=>jl(!1),onSend:zl,onSendImage:Za})]})},hS=({onPairedSuccess:a})=>{const{settings:i,updateSettings:s,connect:r,connectionState:u,stateDetail:d,addToast:m,t:h}=Nt(),[p,y]=w.useState(""),[b,v]=w.useState(null),[S,T]=w.useState(!1),[E,Y]=w.useState(i.wsUrl||"/ws/client"),[A,O]=w.useState(i.token||""),[B,H]=w.useState(i.clientId||""),ee="node bin/service.js pair",re="node bin/config-tui.js",J=ne=>{la(ne).then(Se=>{if(Se==="failed"){m("error",h("clipboard.copyFailed"));return}v(ne),m("success",h("toasts.commandCopied")),setTimeout(()=>v(null),2e3)})},G=ne=>{ne.preventDefault();const Se=p.trim().toUpperCase();if(!Se&&!A.trim()){m("warning",h("toasts.connectionError"));return}const Ee={pairCode:Se,wsUrl:E.trim()||"/ws/client",clientId:B.trim()||i.clientId};A.trim()&&(Ee.token=A.trim()),s(Ee),r({pairCode:Se||void 0,token:A.trim()||void 0,wsUrl:E.trim()||"/ws/client",clientId:B.trim()||i.clientId}),a&&a()},U=u==="connecting"||u==="reconnecting",ae=({n:ne})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",ne,"]"]});return f.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:f.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[f.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("h1",{className:"text-tui font-bold text-tui-text",children:h("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:h("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:h("onboarding.description")})]}),u==="error"&&f.jsxs(Zs,{tone:"warn",action:f.jsx(ke,{variant:"warn",onClick:()=>r(),children:h("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:h("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:d||h("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:G,className:"grid gap-3",children:[f.jsx(hn,{title:h("onboarding.step1Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[f.jsx(ae,{n:1}),f.jsx("span",{className:"leading-snug",children:h("onboarding.step1Desc")})]}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:ee}),f.jsx(ke,{onClick:()=>J(ee),glyph:b===ee?Ye.check:"⧉",className:ie("shrink-0",b===ee&&"border-tui-ok text-tui-ok"),children:h(b===ee?"common.copied":"common.copy")})]}),f.jsx("div",{className:"space-y-0.5 text-tui-sm",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:h("onboarding.step1TuiNote")}),f.jsx("code",{onClick:()=>J(re),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:h("common.clickToCopy"),children:re})]})})]})}),f.jsx(hn,{title:h("onboarding.step2Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(ae,{n:2}),f.jsx(Sn,{type:"text",value:p,onChange:ne=>y(ne.target.value.toUpperCase()),placeholder:h("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":h("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:h("onboarding.step2Note")})]})}),f.jsx(ke,{variant:"primary",type:"submit",block:!0,disabled:U,className:"py-1.5",children:U?f.jsx(aa,{label:h("onboarding.connectingAndPairing")}):h("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>T(!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:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:S?Ye.chevronDown:Ye.chevronRight}),f.jsx("span",{className:"uppercase",children:h("onboarding.advancedTitle")})]}),S&&f.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"onboarding-token",children:h("onboarding.manualTokenLabel")}),f.jsx(Sn,{id:"onboarding-token",type:"password",value:A,onChange:ne=>O(ne.target.value),placeholder:h("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"onboarding-ws",children:h("onboarding.wsEndpointLabel")}),f.jsx(Sn,{id:"onboarding-ws",type:"text",value:E,onChange:ne=>Y(ne.target.value),placeholder:h("onboarding.wsEndpointPlaceholder")})]}),f.jsx(ui,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"onboarding-client-id",children:h("onboarding.clientIdLabel")}),f.jsx(Sn,{id:"onboarding-client-id",type:"text",value:B,onChange:ne=>H(ne.target.value)})]})]})]})]})]})})},kl="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Vs="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",mS="border-tui-accent bg-tui-accent text-tui-crust font-bold",pS="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",og={default:Vs,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"},gS=({compact:a=!1,onCustomize:i})=>{const{sendKey:s,settings:r,updateSettings:u,isController:d,warnViewerMode:m,t:h,uploadProgress:p,uploadImage:y,modifierLatch:b,toggleModifierLatch:v,consumeModifierLatch:S,agentProfile:T}=Nt(),E=a?"h-8":"h-7",Y=a?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",A=a?"h-8 w-8":"h-7 w-7",O=a?"h-8 px-1.5":"h-7 px-1.5",B=w.useRef(null),H=w.useRef(null),ee=w.useCallback(()=>{if(r.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r.vibrateOnKeyPress]),re=w.useCallback(()=>{var F;if(ee(),!d){m();return}p.active||(F=B.current)==null||F.click()},[ee,d,m,p.active]),J=w.useCallback(F=>{const ve=F.target.files,Ce=ve&&ve[0];F.target.value="",Ce&&y(Ce)},[y]),G=()=>f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:B,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:J}),f.jsx("input",{ref:H,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:J})]}),U=(F=!1)=>p.active?f.jsx("div",{"data-testid":F?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:f.jsx(l1,{ratio:p.ratio,label:p.statusText,tone:p.phase==="completed"?"ok":p.phase==="error"?"bad":"accent","aria-label":p.statusText})}):null,ae=()=>{const F=p.active;return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:re,disabled:F,className:ie(kl,Y,F?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Vs),title:F?p.statusText:h("virtualKeyboard.uploadImageTitle"),"aria-label":h("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:F?`${p.percent}%`:h("virtualKeyboard.image")})})},[ne,Se]=w.useState(!1),[Ee,Ge]=w.useState(!1),[st,Ie]=w.useState(!1),L=w.useRef([]);w.useEffect(()=>()=>{L.current.forEach(F=>clearTimeout(F)),L.current=[]},[]);const $=w.useRef(null),[le,Re]=w.useState(!1),W=w.useCallback(()=>{const F=$.current;Re(!!F&&F.scrollLeft+F.clientWidth<F.scrollWidth-1)},[]);w.useEffect(W),w.useEffect(()=>{const F=$.current;if(!F||typeof ResizeObserver!="function")return;const ve=new ResizeObserver(W);return ve.observe(F),()=>ve.disconnect()},[W,r.toolbarVisible]);const et=w.useCallback(F=>{if(ee(),!d){m();return}let ve;try{ve=wi(F)}catch{return}if(S(),ve.length===1){s(ve[0]);return}ve.forEach((Ce,At)=>{const N=setTimeout(()=>{L.current=L.current.filter(ue=>ue!==N),s(Ce)},At*120);L.current.push(N)})},[S,d,s,ee,m]),je=Ov(T,r.agentKeymaps[T]),_e=F=>{let ve="";try{ve=Fs(F.combo)}catch{}const Ce=F.custom?F.customLabel||"":h(`agentActions.${F.labelKey}`),At=F.labelKey==="interrupt"&&F.combo.trim().toLowerCase()==="ctrl+c"?"bad":F.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${F.id}`,onClick:()=>et(F.combo),className:ie(kl,E,"max-w-[10rem] gap-1 px-1.5",og[At]),title:`${ve} ${Ce}`.trim(),"aria-label":`${ve} ${Ce}`.trim(),children:[f.jsx("span",{className:"font-bold",children:ve}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:Ce})]},F.id)},$e=()=>{const F=[...je.agentActions,...je.genericActions];return F.length===0&&!i?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${$a[T].name} ${h("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),F.map(_e),i&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:i,className:ie(kl,E,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:h("agentKeymaps.customizeBar"),"aria-label":h("agentKeymaps.customizeBar"),children:h("agentKeymaps.customizeBarShort")})]})},Be=w.useCallback((F,ve=!0)=>{if(ee(),!d){m();return}const Ce=S();s(ve&&Ce?To(F,Ce):F)},[d,s,m,ee,S]);if(!r.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[G(),U(!0),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>u({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:h("virtualKeyboard.expandToolbar"),"aria-label":h("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:h("common.keyBar")})]})})]});const Ze=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys.filter(F=>F.enabled):Ag,ft=F=>F.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):F.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):F.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):F.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):F.id==="enter"?f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",children:"⏎"}),f.jsx("span",{className:"hidden sm:inline",children:h("virtualKeyboard.keyEnter")})]}):F.id==="drawer_chords"?f.jsx("span",{children:"^C"}):F.id==="drawer_fn"?f.jsxs("span",{className:"flex items-center gap-0.5",children:[f.jsx("span",{children:"Fn"}),f.jsx("span",{"aria-hidden":"true",children:ne?"▾":"▴"})]}):f.jsx("span",{children:F.label}),De=F=>{if(ee(),F.type==="modifier"){F.modifierType==="ctrl"||F.modifierType==="alt"||F.modifierType==="shift"?v(F.modifierType):F.modifierType==="meta"&&Be(fe.ESC);return}if(F.type==="drawer"){F.drawerType==="fn"?(Se(!ne),Ge(!1),Ie(!1)):F.drawerType==="chords"?(Ie(!st),Se(!1),Ge(!1)):F.drawerType==="symbols"&&(Ge(!Ee),Se(!1),Ie(!1));return}Be(F.code,F.type!=="chord")},qe=F=>{if(F.type==="modifier"){if(F.modifierType==="ctrl")return b.ctrl;if(F.modifierType==="alt")return b.alt;if(F.modifierType==="shift")return b.shift}if(F.type==="drawer"){if(F.drawerType==="fn")return ne;if(F.drawerType==="chords")return st;if(F.drawerType==="symbols")return Ee}return!1},Gt=F=>{const ve=qe(F),Ce=["left","up","down","right"].includes(F.id),At=F.type==="drawer",N=ad(F,h);return f.jsx("button",{type:"button",onClick:()=>De(F),className:ie(kl,Ce?A:At?O:Y,F.id==="enter"?pS:ve?mS:Vs),title:N,"aria-label":N,"aria-pressed":ve,children:ft(F)},F.id)},gt=Ze.find(F=>F.id==="enter"),ut=(F,ve,Ce,At,N="default")=>f.jsxs("button",{type:"button",onClick:()=>Be(F,!1),className:ie(kl,E,"gap-1.5 px-2",og[N]),title:Ce,children:[f.jsx("span",{className:"font-bold",children:ve}),f.jsx("span",{className:"text-tui-sm opacity-70",children:At})]});return f.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",a?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":h("virtualKeyboard.touchKeyboardShortcuts"),children:[G(),U(!1),ne&&f.jsx("div",{className:"grid grid-cols-6 gap-1 border-b border-tui-border-dim bg-tui-crust p-1.5 sm:grid-cols-12",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(F=>{const ve=`F${F}`;return f.jsxs("button",{type:"button",onClick:()=>Be(fe[ve]),className:ie(kl,Vs,E),children:["F",F]},ve)})}),st&&f.jsxs("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5",children:[ut(fe.CTRL_C,"^C",h("virtualKeyboard.ctrlCTitle"),h("virtualKeyboard.badgeSigint"),"bad"),ut(fe.CTRL_D,"^D",h("virtualKeyboard.ctrlDTitle"),h("virtualKeyboard.badgeEof")),ut(fe.CTRL_Z,"^Z",h("virtualKeyboard.ctrlZTitle"),h("virtualKeyboard.badgeTstp"),"warn"),ut(fe.CTRL_L,"^L",h("virtualKeyboard.ctrlLTitle"),h("virtualKeyboard.badgeClear")),ut(fe.CTRL_R,"^R",h("virtualKeyboard.ctrlRTitle"),h("virtualKeyboard.badgeSearch")),ut(fe.CTRL_A,"^A",h("virtualKeyboard.ctrlATitle"),h("virtualKeyboard.badgeStart")),ut(fe.CTRL_E,"^E",h("virtualKeyboard.ctrlETitle"),h("virtualKeyboard.badgeEnd")),ut(fe.CTRL_K,"^K",h("virtualKeyboard.ctrlKTitle"),h("virtualKeyboard.badgeKill"))]}),Ee&&f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5",children:["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"].map(F=>f.jsx("button",{type:"button",onClick:()=>Be(F,!0),className:ie(kl,Vs,A,"font-bold"),children:F},F))}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ie("flex flex-nowrap items-center justify-start gap-1",a?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:$,"data-testid":"key-toolbar-scroll",onScroll:W,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[f.jsx("button",{type:"button",onClick:()=>u({toolbarVisible:!1}),className:ie(kl,A,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:h("virtualKeyboard.collapseToolbar"),"aria-label":h("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),Ze.filter(F=>F.id!=="enter").map(Gt),$e(),ae()]}),le&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),gt&&Gt(gt)]})]})},bS=["ls -la","clear","git status","pwd","top","exit","cat"],yS=({isOpen:a,onClose:i})=>{const{sendKey:s,isController:r,warnViewerMode:u,t:d}=Nt(),[m,h]=w.useState("");if(!a)return null;const p=b=>{if(b&&b.preventDefault(),!r){u();return}m.length>0?(s(m+"\r"),h("")):s("\r")},y=b=>{if(!r){u();return}s(b+"\r")};return f.jsxs("div",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2",role:"region","aria-label":d("virtualKeyboard.helperTitle"),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:d("virtualKeyboard.helperTitle")}),f.jsx(ke,{variant:"ghost",onClick:i,"aria-label":d("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:bS.map(b=>f.jsx("button",{type:"button",onClick:()=>y(b),className:"tui-focusable shrink-0 select-none border border-tui-border bg-tui-surface px-2 py-0.5 text-tui-sm text-tui-muted transition-colors hover:border-tui-accent hover:text-tui-accent",children:b},b))}),f.jsxs("form",{onSubmit:p,className:"flex items-center gap-1.5",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),f.jsxs("div",{className:"relative flex-1",children:[f.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:d("virtualKeyboard.placeholder")}),f.jsx(Sn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:m,onChange:b=>h(b.target.value),placeholder:d("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),m.length>0&&f.jsx("button",{type:"button",onClick:()=>h(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":d("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:Ye.cross})})]}),f.jsx(ke,{variant:"primary",type:"submit",title:d("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:d("virtualKeyboard.sendButton")})})]})]})};function Do(a,i){const s=(r,u)=>i?i(r):u;switch(a){case"connected":return{label:s("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:s("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:s("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:s("connection.reconnectNow","Reconnect now")};case"error":return{label:s("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:s("connection.retry","Retry")};default:return{label:s("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:s("connection.connect","Connect")}}}const vS={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},xS=({isOpen:a,onClose:i,isAddMode:s=!1})=>{const{settings:r,updateSettings:u,connect:d,disconnect:m,connectionState:h,hostId:p,addToast:y,t:b,activeProfile:v,activeProfileId:S,addProfileAndConnect:T,renameProfile:E}=Nt(),[Y,A]=w.useState(r.wsUrl),[O,B]=w.useState(r.token),[H,ee]=w.useState(r.pairCode),[re,J]=w.useState(r.clientId),[G,U]=w.useState((v==null?void 0:v.displayName)||""),[ae,ne]=w.useState(r.autoReconnect),[Se,Ee]=w.useState(!1);if(w.useEffect(()=>{a&&(A(r.wsUrl),B(s?"":r.token),ee(s?"":r.pairCode),J(r.clientId),U(s?"":(v==null?void 0:v.displayName)||""),ne(r.autoReconnect))},[a,s,r,v]),!a)return null;const Ge=$=>{$.preventDefault();const le={wsUrl:Y.trim()||"/ws/client",token:O.trim(),pairCode:H.trim().toUpperCase(),clientId:re.trim()||r.clientId,autoReconnect:ae};if(!le.token&&!le.pairCode){y("warning",b("pairing.credentialsRequired"));return}s?T({...le,displayName:G.trim()||void 0}):(u(le),S&&G.trim()&&E(S,G),m(),d({wsUrl:le.wsUrl,token:le.token||void 0,pairCode:le.pairCode||void 0,clientId:le.clientId,autoReconnect:ae})),i()},st=()=>{const $=`client-${Math.random().toString(36).substring(2,8)}`;J($)},Ie=()=>{const $=new URL(window.location.href);$.search="",H.trim()&&$.searchParams.set("pairCode",H.trim().toUpperCase()),la($.toString()).then(le=>{if(le==="failed"){y("error",b("clipboard.copyFailed"));return}Ee(!0),y("success",b("toasts.pairingLinkCopied")),setTimeout(()=>Ee(!1),2e3)})},L=vS[h]??"idle";return f.jsxs(Ad,{isOpen:a,onClose:i,title:b(s?"pairing.addTitle":"pairing.title"),subtitle:b("pairing.subtitle"),closeLabel:b("common.closeDialog"),hints:[{keys:"esc",action:b("common.close")},{keys:"⏎",action:b("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[h==="connected"&&f.jsx(ke,{variant:"danger",onClick:()=>{m(),i()},children:b("common.disconnect")}),f.jsx(ke,{variant:"primary",type:"submit",form:"pairing-form",children:b("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:L}),f.jsx("span",{className:"text-tui-muted",children:b("common.status")}),f.jsx("span",{className:ie(L==="ok"?"text-tui-ok":L==="bad"?"text-tui-bad":L==="warn"?"text-tui-warn":"text-tui-faint"),children:Do(h,b).label})]}),p&&f.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[b("common.host")," ",f.jsx("span",{className:"text-tui-text",children:p})]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:Ge,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"pairing-name",children:b("pairing.displayNameLabel")}),f.jsx(Sn,{id:"pairing-name",type:"text",value:G,onChange:$=>U($.target.value),placeholder:b("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.displayNameHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"pairing-code",hint:b("pairing.pairCodeNote"),children:b("pairing.pairCodeLabel")}),f.jsx(Sn,{id:"pairing-code",type:"text",value:H,onChange:$=>ee($.target.value.toUpperCase()),placeholder:b("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"pairing-token",hint:b("pairing.tokenNote"),children:b("pairing.tokenLabel")}),f.jsx(Sn,{id:"pairing-token",type:"password",value:O,onChange:$=>B($.target.value),placeholder:b("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"pairing-ws",children:b("pairing.wsUrlLabel")}),f.jsx(Sn,{id:"pairing-ws",type:"text",value:Y,onChange:$=>A($.target.value),placeholder:b("pairing.wsUrlPlaceholder")}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.wsUrlDefaultNote")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"pairing-client-id",children:b("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Sn,{id:"pairing-client-id",type:"text",value:re,onChange:$=>J($.target.value),className:"flex-1"}),f.jsx(ke,{onClick:st,title:b("pairing.regenerateClientIdTitle"),className:"shrink-0",children:b("pairing.newIdButton")})]})]}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(ea,{checked:ae,onChange:ne,label:b("pairing.autoReconnectLabel"),description:b("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(ke,{onClick:Ie,block:!0,glyph:Se?Ye.check:"⧉",className:ie(Se&&"border-tui-ok text-tui-ok"),children:b("pairing.copyDirectLink")})})]})]})},wS=["grid items-center gap-x-2 gap-y-1 border-b border-tui-border-dim px-2 py-1.5 last:border-b-0","grid-cols-[5rem_minmax(0,1fr)_6.5rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[5rem_minmax(0,1fr)_9rem_7rem_6.5rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" "),SS=({isOpen:a,onClose:i,initialTab:s})=>{const{settings:r,updateSettings:u,addToast:d,language:m,setLanguage:h,t:p,agentProfile:y}=Nt(),[b,v]=w.useState("appearance"),[S,T]=w.useState(null),[E,Y]=w.useState({}),A=w.useRef({}),[O,B]=w.useState(""),[H,ee]=w.useState(""),[re,J]=w.useState(!1);if(w.useEffect(()=>{!a||!s||(v(s),T(null))},[a,s]),!a)return null;const G=cd.find(N=>N.font===r.fontFamily),U=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys:Ws(),ae=S||y,ne=r.agentKeymaps[ae]||{},Se=Bg(ae,ne),Ee=Ug(ae,ne),Ge=Ee.filter(N=>!N.hidden).length,st=N=>N.custom?N.customLabel||"":p(`agentActions.${N.labelKey}`),Ie=N=>{try{return Fs(N.combo)}catch{return N.combo}},L=N=>{u({agentKeymaps:{...r.agentKeymaps,[ae]:N}})},$=(N,ue)=>{var ce;L({...ne,actions:{...ne.actions,[N]:{...(ce=ne.actions)==null?void 0:ce[N],...ue}}})},le=N=>{$(N.id,{keys:N.defaultCombo})},Re=(N,ue)=>{const ce=N+(ue==="up"?-1:1);if(ce<0||ce>=Se.length)return;const Ve=Se.map(lt=>lt.id);[Ve[N],Ve[ce]]=[Ve[ce],Ve[N]],L({...ne,order:Ve})},W=N=>{var ue;L({...ne,custom:(ne.custom||[]).filter(ce=>ce.id!==N),order:(ue=ne.order)==null?void 0:ue.filter(ce=>ce!==N)})},et=()=>L(Bv(ne)),je=()=>{const N={...r.agentKeymaps};delete N[ae],u({agentKeymaps:N})},_e=()=>{const N=O.trim();if(!N)return;try{wi(H)}catch{return}const ue=`custom-${Date.now().toString(36)}`;L({...ne,custom:[...ne.custom||[],{id:ue,label:N,keys:H.trim()}],order:[...Se.map(ce=>ce.id),ue]}),B(""),ee("")},$e=N=>N instanceof xi?p(`agentKeymaps.errors.${N.code}`,N.params):String(N),Be=(N,ue)=>`${N}:${ue}`,Ze=(N,ue)=>{const ce=Be(ae,N);A.current={...A.current,[ce]:ue},Y(A.current);try{wi(ue),$(N,{keys:ue})}catch{}},ft=N=>{const ue=Be(ae,N),ce=A.current[ue];if(ce!==void 0){delete A.current[ue],Y({...A.current});try{wi(ce),$(N,{keys:ce})}catch{}}},De=typeof window<"u"&&window.isSecureContext&&"Notification"in window,qe=()=>{const N=kg();u({fontSize:N.fontSize,fontFamily:N.fontFamily,toolbarVisible:N.toolbarVisible,vibrateOnKeyPress:N.vibrateOnKeyPress,predictiveEcho:N.predictiveEcho,agentAlertBadge:N.agentAlertBadge,agentAlertSound:N.agentAlertSound,agentAlertVibrate:N.agentAlertVibrate,agentAlertNotify:N.agentAlertNotify,language:N.language,virtualKeys:N.virtualKeys}),d("info",p("settings.resetDefaultsToast"))},Gt=N=>{const ue=U.map(ce=>ce.id===N?{...ce,enabled:!ce.enabled}:ce);u({virtualKeys:ue})},gt=(N,ue)=>{const ce=ue==="up"?N-1:N+1;if(ce<0||ce>=U.length)return;const Ve=[...U],lt=Ve[N];Ve[N]=Ve[ce],Ve[ce]=lt,u({virtualKeys:Ve})},ut=N=>{if(U.some(ce=>ce.id===N.id)){const ce=U.map(Ve=>Ve.id===N.id?{...Ve,enabled:!0}:Ve);u({virtualKeys:ce})}else{const ce=[...U,{...N,enabled:!0}];u({virtualKeys:ce})}J(!1)},F=N=>{const ue=U.filter(ce=>ce.id!==N);u({virtualKeys:ue})},ve=()=>{u({virtualKeys:Ws()}),d("info",p("toasts.keyLayoutReset"))},Ce=10,At=24;return f.jsxs(Ad,{isOpen:a,onClose:i,title:p("settings.title"),subtitle:p("settings.subtitle"),closeLabel:p("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:p("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(ke,{variant:"ghost",onClick:qe,children:p("settings.resetDefaults")}),f.jsx(ke,{variant:"primary",onClick:i,children:p("common.done")})]}),children:[f.jsx(Td,{tabs:[{id:"appearance",label:p("settings.tabAppearance"),index:1},{id:"virtualKeys",label:p("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:p("settings.tabAgentKeymaps"),index:3}],activeId:b,onSelect:N=>v(N),className:"mb-3 border-b border-tui-border-dim pb-1"}),b==="appearance"&&f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{children:p("settings.languageLabel")}),f.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[f.jsx(Ks,{name:"ui-language",checked:m==="zh",onChange:()=>h("zh"),label:"简体中文"}),f.jsx(Ks,{name:"ui-language",checked:m==="en",onChange:()=>h("en"),label:"English"})]})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"terminal-font-select",children:p("settings.fontFamilyLabel")}),f.jsxs(ko,{id:"terminal-font-select",value:r.fontFamily,onChange:N=>u({fontFamily:N.target.value}),"aria-label":p("settings.fontFamilyLabel"),children:[!G&&f.jsx("option",{value:r.fontFamily,children:r.fontFamily}),cd.map(N=>f.jsx("option",{value:N.font,children:p(`fontPresets.${N.id}`)||N.name},N.id))]}),f.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:r.fontFamily,fontSize:`${r.fontSize}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"terminal-font-size",children:p("settings.fontSizeLabel",{size:r.fontSize})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(n1,{value:(r.fontSize-Ce)/(At-Ce),width:24,className:"hidden shrink-0 sm:inline-flex"}),f.jsx("input",{id:"terminal-font-size",type:"range",min:Ce,max:At,step:1,value:r.fontSize,onChange:N=>u({fontSize:Number(N.target.value)}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})]}),f.jsxs("div",{className:"flex justify-between text-tui-sm text-tui-faint",children:[f.jsx("span",{children:p("settings.fontSizeCompact")}),f.jsx("span",{children:p("settings.fontSizeDefault")}),f.jsx("span",{children:p("settings.fontSizeLarge")})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.mobileFontNote")}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.windowZoomSharedNote")})]}),f.jsx(ui,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{children:p("settings.predictiveEchoLabel")}),f.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[f.jsx(Ks,{name:"predictive-echo",checked:r.predictiveEcho==="auto",onChange:()=>u({predictiveEcho:"auto"}),label:p("settings.predictiveEchoAuto")}),f.jsx(Ks,{name:"predictive-echo",checked:r.predictiveEcho==="always",onChange:()=>u({predictiveEcho:"always"}),label:p("settings.predictiveEchoAlways")}),f.jsx(Ks,{name:"predictive-echo",checked:r.predictiveEcho==="off",onChange:()=>u({predictiveEcho:"off"}),label:p("settings.predictiveEchoOff")})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.predictiveEchoDesc")})]}),f.jsx(ui,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(ea,{checked:r.toolbarVisible,onChange:N=>u({toolbarVisible:N}),label:p("settings.touchKeyToolbar"),description:p("settings.touchKeyToolbarDesc")}),f.jsx(ea,{checked:r.vibrateOnKeyPress,onChange:N=>u({vibrateOnKeyPress:N}),label:p("settings.touchHaptics"),description:p("settings.touchHapticsDesc")})]}),f.jsx(ui,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{children:p("settings.agentAlertsLabel")}),f.jsx(ea,{checked:r.agentAlertBadge,onChange:N=>u({agentAlertBadge:N}),label:p("settings.agentAlertBadge"),description:p("settings.agentAlertBadgeDesc")}),f.jsx(ea,{checked:r.agentAlertVibrate,onChange:N=>u({agentAlertVibrate:N}),label:p("settings.agentAlertVibrate"),description:p("settings.agentAlertVibrateDesc")}),f.jsx(ea,{checked:r.agentAlertSound,onChange:N=>{u({agentAlertSound:N}),N&&(Gg(),Ig("done"))},label:p("settings.agentAlertSound"),description:p("settings.agentAlertSoundDesc")}),De&&f.jsx(ea,{checked:r.agentAlertNotify,onChange:N=>{if(N&&Notification.permission!=="granted"){Notification.requestPermission().then(ue=>u({agentAlertNotify:ue==="granted"}));return}u({agentAlertNotify:N})},label:p("settings.agentAlertNotify"),description:p("settings.agentAlertNotifyDesc")})]}),f.jsx(ui,{}),f.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1",children:Ye.arrowRight}),p("settings.colorPassthroughNote")]})]}),b==="virtualKeys"&&f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"flex items-start justify-between gap-2",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("h3",{className:"text-tui font-bold uppercase text-tui-accent",children:p("virtualKeyboard.customizeTitle")}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("virtualKeyboard.customizeDesc")})]}),f.jsx(ke,{variant:"ghost",onClick:ve,className:"shrink-0",children:p("virtualKeyboard.resetLayout")})]}),f.jsx("div",{className:"relative max-h-72 overflow-y-auto overscroll-contain border border-tui-border bg-tui-mantle",children:U.map((N,ue)=>f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border-dim px-2 py-1 last:border-b-0 hover:bg-tui-selection",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:N.enabled,onChange:()=>Gt(N.id),className:"sr-only",id:`toggle-${N.id}`}),f.jsx("label",{htmlFor:`toggle-${N.id}`,className:ie("shrink-0 cursor-pointer select-none font-bold",N.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:N.enabled?"[x]":"[ ]"}),f.jsx(jp,{className:ie(!N.enabled&&"opacity-50"),children:N.label}),f.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:ad(N,p)})]}),f.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[f.jsx(ke,{variant:"ghost",brackets:!1,disabled:ue===0,onClick:()=>gt(ue,"up"),title:p("virtualKeyboard.moveUp"),"aria-label":p("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),f.jsx(ke,{variant:"ghost",brackets:!1,disabled:ue===U.length-1,onClick:()=>gt(ue,"down"),title:p("virtualKeyboard.moveDown"),"aria-label":p("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),f.jsx(ke,{variant:"ghost",brackets:!1,onClick:()=>F(N.id),title:p("virtualKeyboard.deleteKeyTitle"),"aria-label":p("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:Ye.cross})]})]},N.id))}),f.jsx(ke,{block:!0,glyph:"+",onClick:()=>J(!re),className:"border-dashed",children:p("virtualKeyboard.addKey")}),re&&f.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[f.jsx(ui,{label:p("virtualKeyboard.availableKeys")}),f.jsx("div",{className:"relative flex max-h-48 flex-wrap gap-1 overflow-y-auto overscroll-contain",children:uv.map(N=>{const ue=U.some(ce=>ce.id===N.id);return f.jsxs("button",{type:"button",onClick:()=>ut(N),title:ad(N,p),className:ie("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",ue?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{children:N.label}),f.jsx("span",{"aria-hidden":"true",className:ue?"text-tui-ok":"text-tui-accent",children:ue?Ye.check:"+"})]},N.id)})})]})]}),b==="agentKeymaps"&&f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"agent-keymap-profile",children:p("agentKeymaps.settingsProfileLabel")}),f.jsx(ko,{id:"agent-keymap-profile","aria-label":p("agentKeymaps.settingsProfileLabel"),value:ae,onChange:N=>T(N.target.value),children:Nv.map(N=>f.jsx("option",{value:N,children:$a[N].name},N))}),$a[ae].configHint&&f.jsx("p",{className:"text-tui-sm text-tui-faint",children:p("agentKeymaps.configHint",{path:$a[ae].configHint})})]}),f.jsx(ui,{label:p("agentKeymaps.barGroup")}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("agentKeymaps.barHint",{profile:$a[ae].name,count:Ge})}),f.jsx("div",{role:"group","aria-label":p("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:Ee.map(N=>{const ue=st(N),ce=Ie(N),Ve=!N.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${N.id}`,"aria-pressed":Ve,onClick:()=>$(N.id,{hidden:Ve}),title:`${ce} ${ue}`.trim(),className:ie("tui-focusable inline-flex h-8 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",Ve?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold",children:Ve?Ye.check:"+"}),f.jsx("span",{className:"font-bold",children:ce}),f.jsx("span",{className:Ve?void 0:"opacity-80",children:ue})]},N.id)})}),f.jsx(ke,{variant:"ghost",onClick:et,children:p("agentKeymaps.restoreBar")})]}),f.jsx(ui,{label:p("agentKeymaps.agentGroup")}),f.jsx("div",{className:"relative max-h-72 overflow-y-auto overscroll-contain border border-tui-border bg-tui-mantle",children:Se.map((N,ue)=>{var Fe,dt;const ce=st(N),Ve=p("agentKeymaps.defaultCombo",{combo:Fs(N.defaultCombo)}),lt=((dt=(Fe=ne.actions)==null?void 0:Fe[N.id])==null?void 0:dt.keys)??N.combo,at=Be(ae,N.id),Et=E[at]??lt;let he="",Le=null;try{wi(Et),he=Fs(Et)}catch(Dt){Le=$e(Dt)}return f.jsxs("div",{"data-testid":`agent-setting-row-${N.id}`,className:wS,children:[f.jsx(jp,{className:"max-w-full justify-self-start overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:he||"—"}),f.jsxs("span",{className:"min-w-0 truncate text-tui-sm text-tui-text [grid-area:label]",title:ce,children:[ce,!N.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:p("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${N.id}`,children:[p("agentKeymaps.shortcutLabel")," ",ce]}),f.jsx(Sn,{id:`agent-combo-${N.id}`,"aria-label":`${p("agentKeymaps.shortcutLabel")} ${ce}`,value:Et,onChange:Dt=>Ze(N.id,Dt.target.value),onBlur:()=>ft(N.id),onKeyDown:Dt=>{Dt.key==="Enter"&&Dt.currentTarget.blur()},placeholder:p("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Le,className:"w-full min-w-0 [grid-area:combo]"}),f.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint [grid-area:default]",title:Ve,children:Ve}),f.jsxs("div",{className:"flex items-center gap-1 [grid-area:actions]",children:[f.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1",onClick:()=>le(N),title:p("agentKeymaps.resetAction"),"aria-label":`${p("agentKeymaps.resetAction")} ${ce}`,children:"↺"}),f.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1",disabled:ue===0,onClick:()=>Re(ue,"up"),title:p("agentKeymaps.moveUp"),"aria-label":`${p("agentKeymaps.moveUp")} ${ce}`,children:"↑"}),f.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1",disabled:ue===Se.length-1,onClick:()=>Re(ue,"down"),title:p("agentKeymaps.moveDown"),"aria-label":`${p("agentKeymaps.moveDown")} ${ce}`,children:"↓"}),N.custom&&f.jsx(ke,{variant:"ghost",brackets:!1,className:"px-1 text-tui-bad",onClick:()=>W(N.id),title:p("agentKeymaps.removeCustom"),"aria-label":`${p("agentKeymaps.removeCustom")} ${ce}`,children:Ye.cross})]}),Le&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:p("agentKeymaps.invalidCombo",{error:Le})})]},N.id)})}),f.jsx(ui,{label:p("agentKeymaps.addCustom")}),f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[f.jsx("span",{children:p("agentKeymaps.customLabel")}),f.jsx(Sn,{value:O,onChange:N=>B(N.target.value)})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[f.jsx("span",{children:p("agentKeymaps.customCombo")}),f.jsx(Sn,{value:H,onChange:N=>ee(N.target.value)})]}),f.jsx(ke,{onClick:_e,disabled:!O.trim()||!H.trim(),children:p("agentKeymaps.addAction")})]}),H.trim()&&(()=>{try{return wi(H),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:Fs(H)})}catch(N){const ue=$e(N);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:ue})}})(),f.jsx(ke,{variant:"ghost",onClick:je,children:p("agentKeymaps.restoreProfile")})]})]})},CS={success:"ok",warning:"warn",error:"bad",info:"accent"},TS={success:Ye.check,warning:Ye.warn,error:Ye.cross,info:"›"},MS=()=>{const{toasts:a,removeToast:i,t:s}=Nt();return a.length===0?null:f.jsx("div",{className:"pointer-events-none fixed right-2 top-12 z-50 flex w-[calc(100vw-16px)] max-w-sm flex-col gap-1","aria-live":"polite","aria-atomic":"true",children:a.map(r=>{const u=CS[r.type];return f.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",ni[u].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ie("shrink-0 font-bold",ni[u].text),children:TS[r.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:r.message}),r.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted","aria-label":`×${r.count}`,children:["×",r.count]}),f.jsx("button",{type:"button",onClick:()=>i(r.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":s("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:Ye.cross})})]},r.id)})})},AS=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}],Eb=({className:a,compact:i=!1})=>{const{agentStatus:s,t:r}=Nt();if(!s)return null;const u=AS.map(({status:m,level:h})=>{var p;return{status:m,level:h,count:((p=s.counts)==null?void 0:p[m])??0}}).filter(m=>m.count>0),d=i?u.slice(0,1):u;return d.length===0?s.total===0?null:f.jsxs("span",{"data-testid":"agent-status-chip",className:ie("flex shrink-0 items-center gap-1 px-1 text-tui-muted",a),title:r("agents.title"),children:[f.jsx(_n,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:r("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ie("flex shrink-0 items-center gap-2 px-1",a),title:r("agents.title"),children:d.map(({status:m,level:h,count:p})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(_n,{level:h}),f.jsx("span",{className:"text-tui-text",children:p}),f.jsx("span",{className:"text-tui-faint",children:r(`agents.${m}`)})]},m))})},Ld=({onAddProfile:a,mobile:i=!1,statusBar:s=!1})=>{const{profiles:r,activeProfileId:u,activeProfile:d,connectionState:m,switchProfile:h,renameProfile:p,removeProfile:y,t:b}=Nt(),[v,S]=w.useState(!1),[T,E]=w.useState(null),[Y,A]=w.useState(""),O=w.useRef(null);w.useEffect(()=>{if(!v)return;const G=U=>{O.current&&!O.current.contains(U.target)&&S(!1)};return document.addEventListener("pointerdown",G),()=>document.removeEventListener("pointerdown",G)},[v]);const B=(G,U)=>{E(G),A(U)},H=G=>{const U=Y.trim();U&&p(G,U),E(null)},ee=G=>{typeof window<"u"&&!window.confirm(b("profiles.removeConfirm"))||(y(G),E(null))},re=(d==null?void 0:d.displayName)||b("profiles.addHost"),J=m==="connected"?"ok":m==="connecting"||m==="reconnecting"?"warn":m==="error"?"bad":"idle";return f.jsxs("div",{ref:O,className:ie("relative min-w-0",i&&"w-full",s&&"flex-1"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":b("profiles.switcherLabel"),onClick:()=>S(G=>!G),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",s?"min-h-11 w-full max-w-none px-2":i?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[f.jsx(_n,{level:J}),f.jsx("span",{className:ie("truncate text-tui-text",s&&"min-w-0 flex-1"),children:re}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?Ye.chevronDown:Ye.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":b("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",s?"w-80 max-w-[calc(100vw-1rem)]":i?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[f.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:b("profiles.title")}),r.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:b("profiles.empty")}):r.map(G=>{const U=G.id===u,ae=G.id===T;return f.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("button",{type:"button",role:"menuitem","aria-current":U?"true":void 0,onClick:()=>{h(G.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",U?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:U?Ye.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:G.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:G.hostname||G.hostId,children:G.hostname||G.hostId||G.wsUrl})]}),U&&f.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:b("profiles.current")})]}),f.jsx("button",{type:"button",role:"menuitem","aria-label":b("profiles.rename"),title:b("profiles.rename"),onClick:()=>B(G.id,G.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Ye.ellipsis})]}),ae&&f.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:Y,maxLength:64,onChange:ne=>A(ne.target.value),onKeyDown:ne=>{ne.key==="Enter"&&H(G.id),ne.key==="Escape"&&E(null)},"aria-label":b("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),f.jsx(ke,{onClick:()=>H(G.id),variant:"primary",className:"min-h-11",children:b("common.save")}),f.jsx(ke,{onClick:()=>ee(G.id),variant:"danger",className:"min-h-11",children:b("profiles.remove")})]})]},G.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{S(!1),a()},className:"tui-focusable flex min-h-11 w-full items-center gap-2 px-2 text-left text-tui-accent hover:bg-tui-selection",children:[f.jsx("span",{"aria-hidden":"true",children:"+"}),f.jsx("span",{children:b("profiles.addHost")})]})]})]})},ES=({onAddProfile:a=()=>{}})=>{const{connectionState:i,role:s,hostId:r,assignedClientId:u,sharedWindowCount:d,settings:m,rttMs:h,t:p}=Nt(),y=Do(i,p),b=i==="connected";return f.jsx(rb,{left:f.jsxs(f.Fragment,{children:[f.jsx(Ld,{onAddProfile:a}),f.jsx(Dp,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(_n,{level:y.level}),f.jsx("span",{className:"text-tui-text",children:y.label})]},"status"),b?f.jsx(jo,{tone:s==="controller"?"ok":"warn",children:p(s==="controller"?"role.sharedControl":"common.viewer")},"role"):null,b&&d>1?f.jsx("span",{className:"text-tui-muted",children:p("role.sharedWindows",{count:d})},"windows"):null,r?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[p("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:r})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:p("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:u||m.clientId})]},"client")]})]}),right:f.jsx(Dp,{items:[b?f.jsx(Eb,{},"agents"):null,h!==null?f.jsxs("span",{className:"text-tui-muted",children:[p("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[h,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:p("header.tagline")},"mode")]})})},NS=[[/\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"]],LS=[[/\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 cg(a,i){for(const[s,r]of a)if(s.test(i))return r;return null}function kd(a){const i=typeof a=="string"?a.trim():"";if(!i)return{label:"",raw:""};const s=cg(NS,i),r=cg(LS,i);return s&&r?{label:`${s} · ${r}`,raw:i}:s?{label:s,raw:i}:r?{label:r,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function ug(a){if(a===0)return"0 B";const i=1024,s=["B","KB","MB","GB"],r=Math.floor(Math.log(a)/Math.log(i));return`${(a/Math.pow(i,r)).toFixed(1)} ${s[r]}`}const kS=({clients:a})=>{const{t:i}=Nt(),s=[{key:"id",header:i("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},{key:"role",header:i("admin.colRole"),width:12,render:r=>{const u=r.role==="controller";return f.jsx(jo,{tone:u?"ok":"warn",children:i(u?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:r=>{const u=kd(r.userAgent);return u.label?f.jsx("span",{className:"text-tui-muted",title:u.raw,children:u.label}):f.jsx("span",{className:"text-tui-faint",children:i("admin.unknownDevice")})}},{key:"ip",header:i("admin.colIp"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.connectedAt?new Date(r.connectedAt).toLocaleTimeString():i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:r=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsx("span",{className:"text-tui-accent",children:ug(r.bytesReceived||0)}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsx("span",{className:"text-tui-ok",children:ug(r.bytesSent||0)})]})}];return f.jsx(hn,{title:i("admin.connectedClientsTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Md,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noClients")})})},dg={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function RS(a=[],i=[]){const s=new Map;for(const d of i){if(!(d!=null&&d.hostId))continue;const m=s.get(d.hostId);m?m.push(d):s.set(d.hostId,[d])}const r=a.map(d=>{const m=s.get(d.id)||[];return{id:d.id,hostname:d.hostname||d.id,status:d.status||"online",connectedDeviceCount:d.connectedDeviceCount??0,pairedDeviceCount:d.pairedDeviceCount??m.length,devices:m,fromRosterOnly:!1}}),u=new Set(r.map(d=>d.id));for(const[d,m]of s)u.has(d)||r.push({id:d,hostname:d,status:"offline",connectedDeviceCount:0,pairedDeviceCount:m.length,devices:m,fromRosterOnly:!0});return r.sort((d,m)=>d.fromRosterOnly!==m.fromRosterOnly?d.fromRosterOnly?1:-1:d.hostname.localeCompare(m.hostname))}const _S=({hosts:a,devices:i})=>{const{t:s}=Nt(),r=RS(a,i),u={online:s("admin.hostStatusOnline"),busy:s("admin.hostStatusBusy"),reconnecting:s("admin.hostStatusReconnecting"),offline:s("admin.hostStatusOffline")};return f.jsx(hn,{title:s("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:s("admin.noHosts")}):r.map(d=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-tui",children:[f.jsx(_n,{level:dg[d.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:d.hostname}),d.hostname!==d.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:d.id}):null]}),f.jsxs("span",{className:"flex shrink-0 items-center gap-3 text-tui-sm",children:[f.jsx(jo,{tone:dg[d.status],children:u[d.status]}),f.jsx("span",{className:"text-tui-accent",children:s("admin.hostConnectedDevices",{count:d.connectedDeviceCount})}),f.jsx("span",{className:"text-tui-muted",children:s("admin.hostPairedDevices",{count:d.pairedDeviceCount})})]})]}),d.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:d.devices.map(m=>{const h=kd(m.userAgent);return f.jsxs("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2 py-0.5 text-tui",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:"·"}),f.jsx("span",{className:"truncate text-tui-text",title:h.raw,children:h.label||s("admin.unknownDevice")}),f.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:m.deviceId}),f.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:m.lastIp||"—"})]},m.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:d.pairedDeviceCount>0?s("admin.hostRosterOperatorOnly"):s("admin.noDevices")})]},d.id))})},jS=({ptys:a})=>{const{t:i}=Nt(),s=[{key:"id",header:i("admin.colPtyId"),render:r=>f.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},{key:"pid",header:i("admin.colPid"),width:9,render:r=>f.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:i("admin.colCommand"),render:r=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:r=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:r=>f.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:r=>f.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return f.jsx(hn,{title:i("admin.activePtysTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Md,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noPtys")})})};function DS(a){if(!a)return"—";const i=new Date(a);return Number.isNaN(i.getTime())?"—":i.toLocaleString()}const zS=({devices:a,onRevoke:i})=>{const{t:s}=Nt(),[r,u]=w.useState(null),[d,m]=w.useState(null),h=async y=>{if(r!==y){u(y);return}m(y);try{await i(y)}finally{m(null),u(null)}},p=[{key:"device",header:s("admin.colDevice"),render:y=>{const b=kd(y.userAgent);return f.jsx("span",{className:"text-tui-text",title:b.raw,children:b.label||s("admin.unknownDevice")})}},{key:"deviceId",header:s("admin.colDeviceId"),render:y=>f.jsx("span",{className:"text-tui-muted",children:y.deviceId})},{key:"ip",header:s("admin.colIp"),render:y=>f.jsx("span",{className:"text-tui-muted",children:y.lastIp||"—"})},{key:"lastSeen",header:s("admin.colLastSeen"),render:y=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:DS(y.lastSeenAt)})},{key:"actions",header:s("admin.colActions"),align:"right",render:y=>{const b=r===y.deviceId,v=d===y.deviceId;return f.jsx(ke,{variant:"danger",disabled:v,onClick:()=>void h(y.deviceId),onBlur:()=>u(S=>S===y.deviceId?null:S),"aria-label":s("admin.revokeDevice"),className:b?"bg-tui-bad text-tui-crust":void 0,children:v?f.jsx(aa,{}):s(b?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(hn,{title:s("admin.pairedDevicesTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Md,{columns:p,items:a,rowKey:y=>y.deviceId,empty:s("admin.noDevices")})})};function Nb(a){if(typeof window>"u"||!a||a.startsWith("/"))return"";try{const i=new URL(a.replace(/^ws/,"http")),s=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!s?"":`${i.origin}${s}`}catch{return""}}function Gs(a,i){const s=Nb(a);return s?`${s}${i.startsWith("/")?i:`/${i}`}`:i}const OS=({onBackToTerminal:a,onOpenPairing:i})=>{var Gt,gt,ut,F,ve,Ce,At,N,ue,ce,Ve,lt,at,Et;const{settings:s,updateSettings:r,addToast:u,t:d}=Nt(),m=Nb(s.wsUrl)||(typeof window<"u"?window.location.origin:"local"),h=((Gt=s.adminTokens)==null?void 0:Gt[m])||(m===(typeof window<"u"?window.location.origin:"local")?s.adminToken:"")||"",[p,y]=w.useState(null),[b,v]=w.useState(null),[S,T]=w.useState(!1),[E,Y]=w.useState(!0),[A,O]=w.useState(null),[B,H]=w.useState(!1),[ee,re]=w.useState(3e3),[J,G]=w.useState(null),[U,ae]=w.useState("overview"),[ne,Se]=w.useState(!1),[Ee,Ge]=w.useState(h),[st,Ie]=w.useState(!!h),L="node bin/service.js pair";w.useEffect(()=>{Ge(h),Ie(!!h),y(null),v(null),T(!1)},[m]);const $=()=>{la(L).then(he=>{if(he==="failed"){u("error",d("clipboard.copyFailed"));return}Se(!0),u("success",d("toasts.commandCopied")),setTimeout(()=>Se(!1),2e3)})};w.useEffect(()=>{let he=!0;Y(!0);async function Le(){try{const Fe=await fetch(Gs(s.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(Fe.ok){const dt=await Fe.json();he&&(v(dt),T(!0));return}}catch{}if(he){const Fe=!!(s.wsUrl&&!s.wsUrl.startsWith("/")&&!s.wsUrl.includes("localhost")&&!s.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!s.wsUrl.startsWith(window.location.origin.replace("http","ws")));v({ok:!0,version:"0.1.0",protocol:1,relayMode:Fe?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),T(!0)}}return Le(),()=>{he=!1}},[s.wsUrl,m]);const le=(b==null?void 0:b.relayMode)==="remote",Re=()=>{if(b!=null&&b.adminPath)return b.publicUrl?`${b.publicUrl.replace(/\/$/,"")}${b.adminPath}`:Gs(s.wsUrl,b.adminPath);if(p!=null&&p.remoteAdminUrl)return p.remoteAdminUrl;if(s.wsUrl)try{return Gs(s.wsUrl,"/admin")}catch{}return"/admin"},W=w.useCallback(async()=>{if(S){if(le){if(!st&&!Ee){y(null),Y(!1),O(null),H(!1);return}try{Y(!0);const he=Gs(s.wsUrl,(b==null?void 0:b.adminStatusPath)||"/api/admin/status"),Fe=await fetch(he,{headers:{Accept:"application/json","X-Relay-Admin-Token":Ee}});if(Fe.status===401||Fe.status===403){H(!0),O(d("admin.relayAdminAuthError")),y(null);return}if(!Fe.ok)throw new Error(`HTTP ${Fe.status}: ${Fe.statusText}`);const dt=await Fe.json();y(dt),O(null),H(!1),G(new Date)}catch(he){console.warn("GET /api/admin/status request failed:",he),H(!1),O(he instanceof Error?he.message:"Failed to fetch remote admin status"),y(null)}finally{Y(!1)}return}try{Y(!0);const he={Accept:"application/json"};s.token&&(he.Authorization=`Bearer ${s.token}`);const Le=await fetch("/api/status",{headers:he});if(Le.status===401||Le.status===403){H(!0),O(`Authentication failed (HTTP ${Le.status}): Access denied. Please configure an authorized token or pair with the host.`),y(null);return}if(!Le.ok)throw new Error(`HTTP ${Le.status}: ${Le.statusText}`);const Fe=await Le.json();y(Fe),O(null),H(!1),G(new Date)}catch(he){console.warn("GET /api/status request failed:",he),H(!1),O(he instanceof Error?he.message:"Failed to fetch status"),y(null)}finally{Y(!1)}}},[S,le,st,Ee,b,s.token,s.wsUrl,m,d]),et=w.useCallback(async he=>{try{if(!(await fetch(Gs(s.wsUrl,`/api/admin/devices/${encodeURIComponent(he)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Ee}})).ok){O(d("admin.revokeFailed"));return}await W()}catch{O(d("admin.revokeFailed"))}},[Ee,W,s.wsUrl,d]);w.useEffect(()=>{if(!S)return;W();let he=null;const Le=()=>{ee>0&&!he&&(he=setInterval(()=>{document.visibilityState==="visible"&&W()},ee))},Fe=()=>{he&&(clearInterval(he),he=null)},dt=()=>{document.visibilityState==="visible"?(W(),Le()):Fe()};return Le(),document.addEventListener("visibilitychange",dt),()=>{Fe(),document.removeEventListener("visibilitychange",dt)}},[S,W,ee]);const je=he=>{he.preventDefault();const Le=Ee.trim();r({adminToken:Le,adminTokens:{...s.adminTokens||{},[m]:Le}}),Ie(!!Le)},_e=he=>{const Le=Math.max(0,Math.floor(he)),Fe=Math.floor(Le/86400),dt=Math.floor(Le%86400/3600),Dt=Math.floor(Le%3600/60),Cn=Le%60,Bt=(mn,pn)=>`${mn}${d(`admin.unit${pn}`)}`;return Fe>0?[Bt(Fe,"Day"),Bt(dt,"Hour"),Bt(Dt,"Minute")].join(" "):dt>0?[Bt(dt,"Hour"),Bt(Dt,"Minute"),Bt(Cn,"Second")].join(" "):[Bt(Dt,"Minute"),Bt(Cn,"Second")].join(" ")},$e=he=>{if(!he||he===0)return"0 B";const Le=1024,Fe=["B","KB","MB","GB"],dt=Math.floor(Math.log(he)/Math.log(Le));return`${(he/Math.pow(Le,dt)).toFixed(1)} ${Fe[dt]}`},Be=()=>{const he=Re();window.open(he,"_blank","noopener,noreferrer")},Ze=p?p.activeUserCount??((gt=p.clients)==null?void 0:gt.length)??0:0,ft=p?[{id:"overview",label:d("admin.tabOverview"),index:1},{id:"clients",label:d("admin.tabClients",{count:((ut=p.clients)==null?void 0:ut.length)||0}),index:2},{id:"ptys",label:d("admin.tabPtys",{count:((F=p.ptys)==null?void 0:F.length)||0}),index:3},...p.devices?[{id:"devices",label:d("admin.tabDevices",{count:p.devices.length}),index:4}]:[]]:[],De=ft.map(he=>he.id);w.useEffect(()=>{const he=Le=>{if(Le.ctrlKey||Le.altKey||Le.metaKey)return;const Fe=Le.target;if(Fe instanceof HTMLInputElement||Fe instanceof HTMLTextAreaElement||Fe instanceof HTMLSelectElement||Fe!=null&&Fe.isContentEditable||document.querySelector('[role="dialog"]'))return;if(Le.key==="Escape"&&a){Le.preventDefault(),a();return}if(Le.key.toLowerCase()==="r"){Le.preventDefault(),W();return}const dt=Number.parseInt(Le.key,10)-1;Number.isInteger(dt)&&dt>=0&&dt<De.length&&(Le.preventDefault(),ae(De[dt]))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[W,De.join("|")]);const qe=f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a&&f.jsx(ke,{variant:"ghost",onClick:a,title:d("admin.returnToTerminal"),"aria-label":d("admin.returnToTerminal"),glyph:Ye.arrowLeft,brackets:!1,className:"shrink-0",children:f.jsx("span",{className:"sr-only",children:d("admin.returnToTerminal")})}),f.jsxs("span",{className:"hidden text-tui-sm text-tui-accent sm:inline",children:["v",(b==null?void 0:b.version)||(p==null?void 0:p.version)||"0.1.0"]}),f.jsx(jo,{tone:le?"alt":"ok",children:d(le?"admin.modeRemote":"admin.localWorkstationBadge")}),f.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[f.jsx("span",{children:d("admin.autoRefresh")}),f.jsxs(ko,{value:ee,onChange:he=>re(Number(he.target.value)),"aria-label":d("admin.autoRefresh"),className:"w-auto",children:[f.jsx("option",{value:0,children:d("admin.paused")}),f.jsx("option",{value:1e3,children:"1s"}),f.jsx("option",{value:3e3,children:"3s"}),f.jsx("option",{value:5e3,children:"5s"}),f.jsx("option",{value:1e4,children:"10s"})]})]}),f.jsx(ke,{variant:"primary",onClick:W,disabled:E,title:d("admin.refreshNow"),children:E?f.jsx(aa,{}):d("admin.refreshNow")})]});return f.jsxs(a1,{name:d("admin.title"),tagline:d("admin.subtitle"),aside:qe,tabs:ft,activeTabId:U,onSelectTab:he=>ae(he),tabsAriaLabel:d("header.mainNavigationAria"),hints:[{keys:"1–4",action:d("admin.hintTabs")},{keys:"r",action:d("admin.hintRefresh")},...a?[{keys:"esc",action:d("admin.hintBack")}]:[]],footerAside:J?f.jsx("span",{className:"text-tui-faint",children:d("admin.updatedAt",{time:J.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!S&&f.jsx("div",{className:"flex items-center justify-center gap-2 border border-tui-border bg-tui-base px-3 py-8 text-tui text-tui-muted",children:f.jsx(aa,{label:d("admin.loadingStatus")})}),S&&le&&!st&&f.jsxs(hn,{title:d("admin.remoteRelayTitle"),aside:d("admin.remoteRelayBadge"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:d("admin.remoteRelayNotice")}),f.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx(ci,{label:d("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:s.wsUrl})}),f.jsx(ci,{label:d("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:Re()})})]}),f.jsx(ui,{}),f.jsxs("div",{className:"flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-center",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:d("admin.remoteRelayHelp")}),f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[f.jsx(ke,{onClick:()=>Ie(!0),children:d("admin.relayAdminLoginBtn")}),f.jsx(ke,{variant:"primary",onClick:Be,glyph:Ye.arrowRight,children:d("admin.openRemoteAdminBtn")})]})]})]}),S&&le&&st&&!p&&f.jsxs(hn,{title:d("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[f.jsx(Zs,{tone:(b==null?void 0:b.adminConfigured)===!1?"warn":"bad",children:(b==null?void 0:b.adminConfigured)===!1?d("admin.relayAdminNotConfigured"):d("admin.relayAdminAuthError")}),f.jsxs("form",{onSubmit:je,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(wn,{htmlFor:"relay-admin-token",children:d("admin.relayAdminTokenLabel")}),f.jsx(Sn,{id:"relay-admin-token",type:"password",value:Ee,onChange:he=>Ge(he.target.value),placeholder:d("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(ke,{variant:"primary",type:"submit",children:d("admin.relayAdminLoginBtn")}),f.jsx(ke,{variant:"ghost",onClick:()=>Ie(!1),children:d("common.cancel")})]})]})]}),S&&!le&&B&&f.jsxs(hn,{title:d("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(Zs,{tone:"bad",children:d("admin.unauthorizedDesc")}),f.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:d("admin.pairingStepsTitle")}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:L}),f.jsx(ke,{onClick:$,glyph:ne?Ye.check:"⧉",className:ie("shrink-0",ne&&"border-tui-ok text-tui-ok"),children:d(ne?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:d("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[i&&f.jsx(ke,{variant:"primary",onClick:i,children:d("admin.enterPairCodeBtn")}),f.jsx(ke,{onClick:W,children:d("admin.retryFetchBtn")})]})]}),S&&A&&!B&&!(!le&&B)&&f.jsx(Zs,{tone:"warn",action:f.jsx(ke,{variant:"warn",onClick:W,children:d("common.retry")}),children:d("admin.errorConnecting",{error:A})}),p&&f.jsxs(f.Fragment,{children:[U==="overview"&&f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:[f.jsxs(hn,{title:d("admin.accessPanel"),aside:_e(p.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[f.jsx(ci,{label:d("admin.connectedHosts"),labelWidth:14,children:f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:(ve=p.hosts)!=null&&ve.length?"ok":"idle"}),f.jsx("span",{className:"font-bold",children:((Ce=p.hosts)==null?void 0:Ce.length)||0})]})}),f.jsx(ci,{label:d("admin.activeUsers"),labelWidth:14,children:f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:Ze?"ok":"idle"}),f.jsx("span",{className:"font-bold",children:Ze}),f.jsx("span",{className:"text-tui-faint",children:d("admin.acrossWindows",{count:((At=p.clients)==null?void 0:At.length)||0})})]})}),f.jsxs(ci,{label:d("admin.activePtys"),labelWidth:14,children:[f.jsx("span",{className:"font-bold",children:((N=p.ptys)==null?void 0:N.length)||0}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.terminalShells")})]}),f.jsx(ci,{label:d("admin.uptime"),labelWidth:14,children:f.jsx("span",{className:"text-tui-muted",children:p.startTime?d("admin.startedAt",{time:new Date(p.startTime).toLocaleTimeString()}):d("admin.startedRecently")})})]}),f.jsxs(hn,{title:d("admin.throughput"),aside:d("admin.perSecond",{value:$e(((ue=p.throughput)==null?void 0:ue.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[f.jsxs(ci,{label:d("admin.bytesInTotal"),labelWidth:13,children:[f.jsx("span",{className:"font-bold text-tui-accent",children:$e(((ce=p.throughput)==null?void 0:ce.bytesIn)||0)}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.perSecond",{value:$e(((Ve=p.throughput)==null?void 0:Ve.bytesInPerSec)||0)})})]}),f.jsxs(ci,{label:d("admin.bytesOutTotal"),labelWidth:13,children:[f.jsx("span",{className:"font-bold text-tui-ok",children:$e(((lt=p.throughput)==null?void 0:lt.bytesOut)||0)}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.perSecond",{value:$e(((at=p.throughput)==null?void 0:at.bytesOutPerSec)||0)})})]}),f.jsx(ui,{}),f.jsx(ci,{label:d("admin.frameRate"),labelWidth:13,children:f.jsx("span",{className:"font-bold",children:d("admin.framesPerSecond",{count:(((Et=p.throughput)==null?void 0:Et.framesOutPerSec)||0).toFixed(0)})})})]})]}),f.jsx(_S,{hosts:p.hosts||[],devices:p.devices})]}),U==="clients"&&f.jsx(kS,{clients:p.clients||[]}),U==="ptys"&&f.jsx(jS,{ptys:p.ptys||[]}),U==="devices"&&f.jsx(zS,{devices:p.devices||[],onRevoke:et})]})]})},BS=({compact:a=!1})=>{const{role:i,connectionState:s,sharedWindowCount:r,assignedClientId:u,t:d}=Nt();if(!(s==="connected"))return f.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":d("terminal.offlineStatusAria"),children:[f.jsx(_n,{level:"idle"}),f.jsx("span",{children:d("common.offline")})]});const h=i==="controller",p=r>1,y=f.jsxs("div",{className:ie("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",h?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":d(h?"role.controllerMode":"role.viewerMode"),children:[f.jsx(_n,{level:h?"ok":"warn"}),f.jsx("span",{className:"truncate",children:d(h?"role.sharedControl":"role.viewerReadOnly")}),p?f.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:d("role.sharedWindows",{count:r})}):null]});return a?y:f.jsxs("div",{className:"flex w-full flex-col gap-1",children:[y,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:d("role.sharedControlDesc")}),u?f.jsx(ci,{label:d("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:u})}):null]})},Is="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",$s="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",US="border-tui-accent bg-tui-selection text-tui-accent",qs=({active:a=!1})=>f.jsx("span",{"aria-hidden":"true",className:ie("shrink-0",a?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ye.cursor}),HS=({onClose:a,onNavigateAdmin:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:u,onAddProfile:d=()=>{}})=>{const{connectionState:m,stateDetail:h,rttMs:p,hostId:y,settings:b,updateSettings:v,connect:S,addToast:T,language:E,setLanguage:Y,t:A}=Nt(),[O,B]=Si.useState(!1),H=Do(m,A),ee=G=>()=>{var ae;const U=document.activeElement;(ae=U==null?void 0:U.blur)==null||ae.call(U),G()},re=()=>{la(b.clientId).then(G=>{if(G==="failed"){T("error",A("clipboard.copyFailed"));return}B(!0),T("info",A("toasts.clientIdCopied",{id:b.clientId})),setTimeout(()=>B(!1),2e3)})},J=()=>{const G=E==="zh"?"en":"zh";Y(G),T("info",wd(G,"toasts.switchedLanguage",{lang:G==="zh"?"简体中文":"English"}))};return f.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[f.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:A("mobile.sessionControls")}),f.jsx(ke,{variant:"ghost",onClick:a,"aria-label":A("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(hn,{title:A("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(Ld,{mobile:!0,onAddProfile:d})}),f.jsxs(hn,{title:A("common.status"),tone:H.level==="ok"?"ok":H.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":A("mobile.connectionStatusAria"),children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(_n,{level:H.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:H.label}),m==="connected"&&p!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[p,"ms"]})]}),H.actionLabel&&f.jsx(ke,{variant:"primary",onClick:()=>S(),className:"shrink-0",children:H.actionLabel})]}),H.needsAttention&&h&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:h}),y&&f.jsx(ci,{label:A("common.host"),labelWidth:9,children:y}),f.jsxs("button",{type:"button",onClick:re,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:A("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:A("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:b.clientId}),f.jsx("span",{"aria-hidden":"true",className:ie("shrink-0",O?"text-tui-ok":"text-tui-faint"),children:O?Ye.check:"⧉"})]})]}),f.jsx(hn,{title:A("mobile.inputControl"),tone:"accent","aria-label":A("mobile.terminalControlAria"),children:f.jsx(BS,{})}),f.jsxs(hn,{title:A("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:J,className:ie(Is,$s),"aria-label":A("header.languageToggleTitle"),children:[f.jsx(qs,{}),f.jsx("span",{className:"truncate",children:E==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:ee(u),className:ie(Is,$s),"aria-label":A("mobile.settingsAria"),children:[f.jsx(qs,{}),f.jsx("span",{className:"truncate",children:A("common.settings")})]}),f.jsxs("button",{type:"button",onClick:ee(r),className:ie(Is,$s),"aria-label":A("mobile.pairingAria"),children:[f.jsx(qs,{}),f.jsx("span",{className:"truncate",children:A("common.pairing")})]}),s&&f.jsxs("button",{type:"button",onClick:ee(i),className:ie(Is,$s),"aria-label":A("mobile.adminAria"),children:[f.jsx(qs,{}),f.jsx("span",{className:"truncate",children:A("common.admin")})]}),f.jsxs("button",{type:"button",onClick:()=>v({toolbarVisible:!b.toolbarVisible}),className:ie(Is,b.toolbarVisible?US:$s),"aria-label":A("mobile.keybarAria"),"aria-pressed":b.toolbarVisible,children:[f.jsx(qs,{active:b.toolbarVisible}),f.jsx("span",{className:"truncate",children:A("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:b.toolbarVisible?"[x]":"[ ]"})]})]})]})},KS=({onAddProfile:a})=>{const{rttMs:i,t:s}=Nt();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":s("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[f.jsx(Ld,{statusBar:!0,onAddProfile:a}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(Eb,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:s("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:ie(i===null?"text-tui-faint":"text-tui-text"),children:i===null?"—":`${i}ms`})]})]})},YS=({onNavigateAdmin:a,showAdminEntry:i=!0,onOpenPairing:s,onOpenSettings:r,onAddProfile:u=()=>{}})=>{const{connectionState:d,isController:m,t:h}=Nt(),[p,y]=w.useState(!1),b=w.useRef(null),v=w.useCallback(()=>y(!1),[]);w.useEffect(()=>{if(!p)return;const T=E=>{if(!(E.ctrlKey||E.altKey||E.metaKey)&&E.key==="Escape"){const Y=E.target;Y&&typeof Y.closest=="function"&&!!Y.closest("#terminal-container")||(E.stopPropagation(),E.preventDefault(),v())}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[p,v]),w.useEffect(()=>{var T;p&&((T=b.current)==null||T.focus({preventScroll:!0}))},[p]);const S=Do(d,h);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":h("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),f.jsx(ab,{className:"shrink-0"}),f.jsx(_n,{level:S.level}),f.jsx("span",{className:"truncate uppercase",children:S.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>y(!0),"aria-label":h("mobile.sessionControls"),"aria-expanded":p,"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",S.needsAttention?"border-tui-warn text-tui-warn":m?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!m&&!S.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:h("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Ye.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:h("mobile.menu")})]})]}),p&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:v,"aria-hidden":"true"}),f.jsx("div",{ref:b,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":h("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:f.jsx(HS,{onClose:v,showAdminEntry:i,onNavigateAdmin:()=>{v(),a()},onOpenPairing:()=>{v(),s()},onOpenSettings:()=>{v(),r()},onAddProfile:()=>{v(),u()}})})]}),f.jsx(KS,{onAddProfile:u})]})},GS=()=>{const{herdrLaunch:a,startHerdr:i,hostname:s,activeProfile:r,t:u}=Nt();if(!a)return null;const d=s||(r==null?void 0:r.displayName)||u("herdrLaunch.thisHost"),m=a.phase==="failed";return f.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsx(hn,{title:u(m?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:m?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":u("herdrLaunch.title"),children:a.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(aa,{}),f.jsx("span",{children:u("herdrLaunch.starting",{host:d})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:u("herdrLaunch.body",{host:d})}),m&&a.message?f.jsx(Zs,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:u("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(ke,{variant:"primary",onClick:i,autoFocus:!0,children:u(m?"common.retry":"herdrLaunch.start")})})]})})})},Lb="--app-height",kb="--keyboard-inset",IS=80;function $S(){if(typeof window>"u")return{height:768,keyboardInset:0};const a=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const s=a-i.height-(i.offsetTop||0),r=s>=IS?Math.round(s):0;return{height:Math.round(i.height),keyboardInset:r}}return{height:a,keyboardInset:0}}function fg(a,i=$S()){return a.style.setProperty(Lb,`${i.height}px`),a.style.setProperty(kb,`${i.keyboardInset}px`),i}function qS(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let i=null;const s=()=>{i=null,fg(a)},r=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){s();return}i=requestAnimationFrame(s)}};fg(a);const u=window.visualViewport;return u==null||u.addEventListener("resize",r),u==null||u.addEventListener("scroll",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),u==null||u.removeEventListener("resize",r),u==null||u.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),a.style.removeProperty(Lb),a.style.removeProperty(kb)}}const FS=900;function hg(){if(typeof window>"u")return!1;const a=qa();return a<yd?!0:a<=FS}function VS(){const[a,i]=w.useState(hg);return w.useEffect(()=>{var u,d;const s=()=>{const m=hg();i(h=>h===m?h:m)};s();let r=null;try{r=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{r=null}return(u=r==null?void 0:r.addEventListener)==null||u.call(r,"change",s),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),(d=window.visualViewport)==null||d.addEventListener("resize",s),()=>{var m,h;(m=r==null?void 0:r.removeEventListener)==null||m.call(r,"change",s),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),(h=window.visualViewport)==null||h.removeEventListener("resize",s)}},[]),a}function XS(a){const i=a.target;if(!i)return!1;if(i.id==="terminal-container"||i.id==="terminal-frame"||i.id==="terminal-surface"||i.classList.contains("xterm-helper-textarea")||i.classList.contains("xterm")||i.closest("#terminal-container")||i.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const s=document.activeElement;if(s.id==="terminal-container"||s.classList.contains("xterm-helper-textarea")||s.closest("#terminal-container")||s.closest(".xterm"))return!0}return!1}function PS(a,i={}){if(typeof window>"u")return()=>{};const s=r=>{var u;r.ctrlKey||r.altKey||r.metaKey||r.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(XS(r)||(r.preventDefault(),r.stopPropagation(),(u=a.onCloseModals)==null||u.call(a)))};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}}function ZS(){const[a,i]=w.useState("terminal"),[s,r]=w.useState(!1),[u,d]=w.useState(!1),[m,h]=w.useState(!1),[p,y]=w.useState(void 0),b=L=>{y(L),h(!0)},[v,S]=w.useState(!1),{updateSettings:T,settings:E,connectionState:Y,stateDetail:A,stateCode:O,lastPairedAt:B}=Nt();rx();const H=VS();w.useEffect(()=>qS(),[]);const[ee,re]=w.useState(!0);w.useEffect(()=>{let L=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then($=>$.ok?$.json():null).then($=>{L||!$||re(!$.isRemoteRelay)}).catch(()=>{}),()=>{L=!0}},[]),w.useEffect(()=>{zg()},[]),w.useEffect(()=>{const L=s||m||v;if(L)return PS({onCloseModals:()=>{r(!1),h(!1),S(!1)}},{isModalOpen:L})},[s,m,v]),w.useEffect(()=>{const L=()=>{const $=window.location.pathname,le=window.location.hash;i($==="/admin"||le==="#admin"?"admin":"terminal")};L(),window.addEventListener("popstate",L),window.addEventListener("hashchange",L);try{const $=new URL(window.location.href),le=$.searchParams.get("token"),Re=$.searchParams.get("pairCode"),W=$.searchParams.get("ws")||$.searchParams.get("wsUrl"),et={};le&&(et.token=le),Re&&(et.pairCode=Re.toUpperCase()),W&&(et.wsUrl=W),Object.keys(et).length>0&&T(et);let je=!1;if($.searchParams.has("token")&&($.searchParams.delete("token"),je=!0),$.searchParams.has("pairCode")&&($.searchParams.delete("pairCode"),je=!0),je){const _e=$.searchParams.toString(),$e=$.pathname+(_e?`?${_e}`:"")+$.hash;window.history.replaceState({},"",$e)}}catch($){console.warn("Failed to parse URL query params:",$)}return()=>{window.removeEventListener("popstate",L),window.removeEventListener("hashchange",L)}},[]);const J=(L=!1)=>{d(L),r(!0)},G=()=>{r(!1),d(!1)},U=L=>{i(L),L==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},ae=!E.token&&!E.pairCode&&Y!=="connected",ne=Y==="error"&&(["auth_required","unauthorized","device_revoked"].includes(O||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(A||"")),Se=ae||ne,[Ee,Ge]=w.useState(!Se);w.useEffect(()=>{Se||Ge(!0)},[Se]),w.useEffect(()=>{B&&(r(!1),Ge(!0),i("terminal"))},[B]);const st=a==="terminal"&&!Se,Ie=L=>({visibility:L?"visible":"hidden",opacity:L?1:0,pointerEvents:L?"auto":"none",zIndex:L?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:H?{paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"}:void 0,className:"flex h-full w-full select-none flex-col overflow-hidden bg-tui-crust font-mono text-tui text-tui-text",onContextMenu:L=>{L.preventDefault(),L.stopPropagation()},children:[!H&&f.jsx(r1,{currentView:a,onNavigate:U,showAdminEntry:ee,onOpenPairing:()=>J(!1),onOpenSettings:()=>b(),onToggleVirtualKeyboard:()=>S(!v),isVirtualKeyboardOpen:v}),!H&&!Se&&f.jsx(o1,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[Ee&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${H?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:Ie(st),"aria-hidden":!st,children:[f.jsx(fS,{isActive:st}),!H&&f.jsx(yS,{isOpen:v,onClose:()=>S(!1)}),f.jsx(gS,{compact:H,onCustomize:()=>b("agentKeymaps")}),f.jsx(GS,{})]}),a==="terminal"&&Se&&f.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:f.jsx(hS,{onPairedSuccess:()=>{}})}),a==="admin"&&f.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:f.jsx(OS,{onBackToTerminal:()=>U("terminal"),onOpenPairing:()=>J(!1)})}),H&&st&&f.jsx(YS,{onNavigateAdmin:()=>U("admin"),showAdminEntry:ee,onOpenPairing:()=>J(!1),onOpenSettings:()=>b(),onAddProfile:()=>J(!0)})]}),!H&&a!=="admin"&&f.jsx(ES,{onAddProfile:()=>J(!0)}),f.jsx(xS,{isOpen:s,isAddMode:u,onClose:G}),f.jsx(SS,{isOpen:m,initialTab:p,onClose:()=>h(!1)}),f.jsx(MS,{})]})}function QS(){return f.jsx(Pv,{children:f.jsx(ZS,{})})}const Rb=document.getElementById("root");if(!Rb)throw new Error("Root element not found");q0.createRoot(Rb).render(f.jsx(Si.StrictMode,{children:f.jsx(QS,{})}));
|